Chapter 1. ROS 创建工作空间

1. 创建catkin工作空间
~$ mkdir -p ros_workspace/src
2. 编译catkin工作空间
~$ cd ros_workspace
~/ros_workspace$ catkin_make

编译成功后,显示如下内容:

Base path: /home/nic/ros_workspace
Source space: /home/nic/ros_workspace/src
Build space: /home/nic/ros_workspace/build
Devel space: /home/nic/ros_workspace/devel
Install space: /home/nic/ros_workspace/install
Creating symlink "/home/nic/ros_workspace/src/CMakeLists.txt" pointing to "/opt/ros/kinetic/share/catkin/cmake/toplevel.cmake"
####
#### Running command: "cmake /home/nic/ros_workspace/src -DCATKIN_DEVEL_PREFIX=/home/nic/ros_workspace/devel -DCMAKE_INSTALL_PREFIX=/home/nic/ros_workspace/install -G Unix Makefiles" in "/home/nic/ros_workspace/build"
####
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.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/nic/ros_workspace/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/kinetic
-- This workspace overlays: /opt/ros/kinetic
-- Found PythonInterp: /usr/bin/python (found version "2.7.12") 
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/nic/ros_workspace/build/test_results
-- Found gmock sources under '/usr/src/gmock': gmock will be built
-- 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  
-- Found gtest sources under '/usr/src/gmock': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.11
-- BUILD_SHARED_LIBS is on
-- Configuring done
-- Generating done
-- Build files have been written to: /home/nic/ros_workspace/build
####
#### Running command: "make -j4 -l4" in "/home/nic/ros_workspace/build"
####
3. 配置环境变量
~/ros_workspace$ source ./devel/setup.bash

最后还要在~/.bashrc文件的末尾添加命令行,来配置我们的环境,如下, 如果在安装ROS时已经配置了,那就不需要配置了,此处的ROS版本是ROS kinetic,如果要使用其他版本的,请自行更改。

$ echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
4. 验证配置

如果工作空间已配置正确,需确保ROS_PACKAGE_PATH环境变量包含工作空间目录,采用以下命令查看:

~/ros_workspace$ echo $ROS_PACKAGE_PATH

返回提示:

/home/nic/ros_workspace/src:/opt/ros/kinetic/share
5. 到此,ROS的工作环境已经搭建完成,接下来继续…
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值