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

image.png

简单理解


mkdir filename/src


这句话就是在创建一个简单的文件夹,目前在创建之后,并没有任何的意义,但是如果我们进行rosinit的操作之后就会变成一个工作空间。

catkin_init_workspace


这句话必须要在src文件目录下使用,这样会将src下改变成为一个工作空间。

catkin_make


这句话要求在ros的根目录,也就是我们创建的filename那个文件夹。(具体叫啥名自己看着办)。这样就是一个编译,其实意思跟我们的C++的编译类似。但是我们现在编译没有啥用处,就是编译了一个空项目。

catkin_make install


这句话会生成一个install文件夹,但是也没啥用,以后会有的。现在就是先试试,看看文件有啥问题没。

catkin_create_pkg


catkin_create_pkg test std_msgs rospy roscpp 一般来说的话就是这么去写,但是其实这句话的真正含义是,创建一个pkg,叫做test,然后倒入ros基本的信息发布包,以及python包和C++包。

source devel/setup.bash


这句话就是设置一下环境变量。要注意的是devel是在我们filename的文件夹下面的。

结尾


这就是ROS创建一个工作空间的简单操作,我觉得没什么难度,只要好好多练习,这些都属于基本功。用完删除,再创建一个也无妨。

相关实践学习
Docker镜像管理快速入门
本教程将介绍如何使用Docker构建镜像,并通过阿里云镜像服务分发到ECS服务器,运行该镜像。
阿里云资源编排ROS使用教程
资源编排(Resource Orchestration)是一种简单易用的云计算资源管理和自动化运维服务。用户通过模板描述多个云计算资源的依赖关系、配置等,并自动完成所有资源的创建和配置,以达到自动化部署、运维等目的。编排模板同时也是一种标准化的资源和应用交付方式,并且可以随时编辑修改,使基础设施即代码(Infrastructure as Code)成为可能。 产品详情:https://www.aliyun.com/product/ros/
相关文章
|
10月前
|
IDE Linux 开发工具
[ROS基础] --- 创建工作空间
[ROS基础] --- 创建工作空间
226 0
|
8月前
ROS创建工作空间添加包并编译
ROS创建工作空间添加包并编译
95 0
|
9月前
|
机器学习/深度学习 前端开发 机器人
ubuntu16.04下ROS操作系统学习笔记(三 / 一)ROS基础-工作空间
ubuntu16.04下ROS操作系统学习笔记(三 / 一)ROS基础-工作空间
163 0
|
Ubuntu Shell
ROS学习-创建一个工作空间
ROS学习-创建一个工作空间
72 0
|
存储
【古月21讲】ROS入门系列(1)——ROS命令工具的使用及创建工作空间和功能包
【古月21讲】ROS入门系列(1)——ROS命令工具的使用及创建工作空间和功能包
282 0
【古月21讲】ROS入门系列(1)——ROS命令工具的使用及创建工作空间和功能包
ros移植别人的工作空间出现问题及解决方法汇总
ros移植别人的工作空间出现问题及解决方法汇总
1001 0
ros移植别人的工作空间出现问题及解决方法汇总
|
8天前
|
传感器 人工智能 算法
ROS机器人操作系统
ROS机器人操作系统
32 1
|
8天前
|
NoSQL 机器人 Windows
ROS机器人编程技术控制两只小海龟的编队运动
ROS机器人编程技术控制两只小海龟的编队运动
24 1

推荐镜像

更多