ROS编写节点流程

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/yanshuai_tek/article/details/53188927
  1. 创建工作空间
  2. 创建程序包
  3. 添加cpp程序
  4. 修改包中CMakeList.txt文件
  5. catkin_make

1.创建工作空间

$ source /opt/ros/kinetic/setup.bash
$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/src
$ catkin_init_workspace
$ cd ~/catkin_ws/
$ catkin_make
$ source devel/setup.bash
$ echo $ROS_PACKAGE_PATH

2.创建一个catkin程序包

$ cd ~/catkin_ws/src
$ catkin_create_pkg mypackage std_msgs rospy roscpp
$ cd ~/catkin_ws
$ catkin_make
$ . ~/catkin_ws/devel/setup.bash

3.添加cpp程序

4.修改包中CMakeList.txt文件

add_executable(talker src/talker.cpp)
target_link_libraries(talker ${catkin_LIBRARIES})

5.catkin_make

$ cd ~/catkin_ws
$ catkin_make
展开阅读全文

没有更多推荐了,返回首页