ROS快速入门第一讲——ROS的工作空间创建
生活随笔
收集整理的這篇文章主要介紹了
ROS快速入门第一讲——ROS的工作空间创建
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
ROS的工作空間創建
scc18@ubuntu:~$ mkdir ros_ws scc18@ubuntu:~$ cd ros_ws/ scc18@ubuntu:~/ros_ws$ mkdir src scc18@ubuntu:~/ros_ws$ cd src scc18@ubuntu:~/ros_ws/src$ catkin_init_workspace Creating symlink "/home/scc18/ros_ws/src/CMakeLists.txt" pointing to "/opt/ros/melodic/share/catkin/cmake/toplevel.cmake" scc18@ubuntu:~/ros_ws/src$ cd .. scc18@ubuntu:~/ros_ws$ catkin_make Base path: /home/scc18/ros_ws Source space: /home/scc18/ros_ws/src Build space: /home/scc18/ros_ws/build Devel space: /home/scc18/ros_ws/devel Install space: /home/scc18/ros_ws/install #### #### Running command: "cmake /home/scc18/ros_ws/src -DCATKIN_DEVEL_PREFIX=/home/scc18/ros_ws/devel -DCMAKE_INSTALL_PREFIX=/home/scc18/ros_ws/install -G Unix Makefiles" in "/home/scc18/ros_ws/build" #### -- The C compiler identification is GNU 7.5.0 -- The CXX compiler identification is GNU 7.5.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Using CATKIN_DEVEL_PREFIX: /home/scc18/ros_ws/devel -- Using CMAKE_PREFIX_PATH: /opt/ros/melodic -- This workspace overlays: /opt/ros/melodic -- Found PythonInterp: /usr/bin/python2 (found suitable version "2.7.17", minimum required is "2") -- Using PYTHON_EXECUTABLE: /usr/bin/python2 -- Using Debian Python package layout -- Using empy: /usr/bin/empy -- Using CATKIN_ENABLE_TESTING: ON -- Call enable_testing() -- Using CATKIN_TEST_RESULTS_DIR: /home/scc18/ros_ws/build/test_results -- Found gtest sources under '/usr/src/googletest': gtests will be built -- Found gmock sources under '/usr/src/googletest': gmock will be built -- Found PythonInterp: /usr/bin/python2 (found version "2.7.17") -- Looking for pthread.h -- Looking for pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - not found -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE -- Using Python nosetests: /usr/bin/nosetests-2.7 -- catkin 0.7.29 -- BUILD_SHARED_LIBS is on -- BUILD_SHARED_LIBS is on -- Configuring done -- Generating done -- Build files have been written to: /home/scc18/ros_ws/build #### #### Running command: "make -j2 -l2" in "/home/scc18/ros_ws/build" #### scc18@ubuntu:~/ros_ws$ catkin_make install Base path: /home/scc18/ros_ws Source space: /home/scc18/ros_ws/src Build space: /home/scc18/ros_ws/build Devel space: /home/scc18/ros_ws/devel Install space: /home/scc18/ros_ws/install #### #### Running command: "make cmake_check_build_system" in "/home/scc18/ros_ws/build" #### #### #### Running command: "make install -j2 -l2" in "/home/scc18/ros_ws/build" #### Install the project... -- Install configuration: "" -- Installing: /home/scc18/ros_ws/install/_setup_util.py -- Installing: /home/scc18/ros_ws/install/env.sh -- Installing: /home/scc18/ros_ws/install/setup.bash -- Installing: /home/scc18/ros_ws/install/local_setup.bash -- Installing: /home/scc18/ros_ws/install/setup.sh -- Installing: /home/scc18/ros_ws/install/local_setup.sh -- Installing: /home/scc18/ros_ws/install/setup.zsh -- Installing: /home/scc18/ros_ws/install/local_setup.zsh -- Installing: /home/scc18/ros_ws/install/.rosinstall scc18@ubuntu:~/ros_ws$ source devel/setup.bash scc18@ubuntu:~/ros_ws$ cd src scc18@ubuntu:~/ros_ws/src$ catkin_create_pkg test std_msgs rospy roscpp Created file test/CMakeLists.txt Created file test/package.xml Created folder test/include/test Created folder test/src Successfully created files in /home/scc18/ros_ws/src/test. Please adjust the values in package.xml. scc18@ubuntu:~/ros_ws/src$ ls CMakeLists.txt test scc18@ubuntu:~/ros_ws/src$ cd test/ scc18@ubuntu:~/ros_ws/src/test$ ls CMakeLists.txt include package.xml src scc18@ubuntu:~/ros_ws/src/test$ cd .. scc18@ubuntu:~/ros_ws/src$ cd .. scc18@ubuntu:~/ros_ws$ catkin_make Base path: /home/scc18/ros_ws Source space: /home/scc18/ros_ws/src Build space: /home/scc18/ros_ws/build Devel space: /home/scc18/ros_ws/devel Install space: /home/scc18/ros_ws/install #### #### Running command: "cmake /home/scc18/ros_ws/src -DCATKIN_DEVEL_PREFIX=/home/scc18/ros_ws/devel -DCMAKE_INSTALL_PREFIX=/home/scc18/ros_ws/install -G Unix Makefiles" in "/home/scc18/ros_ws/build" #### -- Using CATKIN_DEVEL_PREFIX: /home/scc18/ros_ws/devel -- Using CMAKE_PREFIX_PATH: /home/scc18/ros_ws/devel;/opt/ros/melodic -- This workspace overlays: /home/scc18/ros_ws/devel;/opt/ros/melodic -- Found PythonInterp: /usr/bin/python2 (found suitable version "2.7.17", minimum required is "2") -- Using PYTHON_EXECUTABLE: /usr/bin/python2 -- Using Debian Python package layout -- Using empy: /usr/bin/empy -- Using CATKIN_ENABLE_TESTING: ON -- Call enable_testing() -- Using CATKIN_TEST_RESULTS_DIR: /home/scc18/ros_ws/build/test_results -- Found gtest sources under '/usr/src/googletest': gtests will be built -- Found gmock sources under '/usr/src/googletest': gmock will be built -- Found PythonInterp: /usr/bin/python2 (found version "2.7.17") -- Using Python nosetests: /usr/bin/nosetests-2.7 -- catkin 0.7.29 -- BUILD_SHARED_LIBS is on -- BUILD_SHARED_LIBS is on -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- ~~ traversing 1 packages in topological order: -- ~~ - test -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- +++ processing catkin package: 'test' -- ==> add_subdirectory(test) -- Configuring done -- Generating done -- Build files have been written to: /home/scc18/ros_ws/build #### #### Running command: "make -j2 -l2" in "/home/scc18/ros_ws/build" #### scc18@ubuntu:~/ros_ws$ catkin_make install Base path: /home/scc18/ros_ws Source space: /home/scc18/ros_ws/src Build space: /home/scc18/ros_ws/build Devel space: /home/scc18/ros_ws/devel Install space: /home/scc18/ros_ws/install #### #### Running command: "make cmake_check_build_system" in "/home/scc18/ros_ws/build" #### #### #### Running command: "make install -j2 -l2" in "/home/scc18/ros_ws/build" #### Install the project... -- Install configuration: "" -- Installing: /home/scc18/ros_ws/install/_setup_util.py -- Up-to-date: /home/scc18/ros_ws/install/env.sh -- Up-to-date: /home/scc18/ros_ws/install/setup.bash -- Up-to-date: /home/scc18/ros_ws/install/local_setup.bash -- Up-to-date: /home/scc18/ros_ws/install/setup.sh -- Up-to-date: /home/scc18/ros_ws/install/local_setup.sh -- Up-to-date: /home/scc18/ros_ws/install/setup.zsh -- Up-to-date: /home/scc18/ros_ws/install/local_setup.zsh -- Up-to-date: /home/scc18/ros_ws/install/.rosinstall -- Installing: /home/scc18/ros_ws/install/lib/pkgconfig/test.pc -- Installing: /home/scc18/ros_ws/install/share/test/cmake/testConfig.cmake -- Installing: /home/scc18/ros_ws/install/share/test/cmake/testConfig-version.cmake -- Installing: /home/scc18/ros_ws/install/share/test/package.xml簡單理解
mkdir filename/src
這句話就是在創建一個簡單的文件夾,目前在創建之后,并沒有任何的意義,但是如果我們進行rosinit的操作之后就會變成一個工作空間。
catkin_init_workspace
這句話必須要在src文件目錄下使用,這樣會將src下改變成為一個工作空間。
catkin_make
這句話要求在ros的根目錄,也就是我們創建的filename那個文件夾。(具體叫啥名自己看著辦)。這樣就是一個編譯,其實意思跟我們的C++的編譯類似。但是我們現在編譯沒有啥用處,就是編譯了一個空項目。
catkin_make install
這句話會生成一個install文件夾,但是也沒啥用,以后會有的?,F在就是先試試,看看文件有啥問題沒。
catkin_create_pkg
catkin_create_pkg test std_msgs rospy roscpp 一般來說的話就是這么去寫,但是其實這句話的真正含義是,創建一個pkg,叫做test,然后倒入ros基本的信息發布包,以及python包和C++包。
source devel/setup.bash
這句話就是設置一下環境變量。要注意的是devel是在我們filename的文件夾下面的。
結尾
這就是ROS創建一個工作空間的簡單操作,我覺得沒什么難度,只要好好多練習,這些都屬于基本功。用完刪除,再創建一個也無妨。
總結
以上是生活随笔為你收集整理的ROS快速入门第一讲——ROS的工作空间创建的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 获取公众号的关注链接
- 下一篇: 2022-2027年中国分散染料行业市场