ROS learning by Guangdong Industry University 01

在这里插入图片描述

headers are

from this :
/opt/ros/indigo/include/std_msgs

remapping

rosrun my_minimal_nodes minimal_publisher /miminal_nodes1/topic1:=topic1

 ros::NodeHandle n("miminal_nodes1"); 

using different namespace can change the topic form
and by using remapping to return
在这里插入图片描述

rostopic pub

can publish isolutely

rostopic pub -r 20  /topic2 std_msgs/Float64 '{data: 0.7}' 

rosed

rosed my_minimal_nodes minimal_publisher.cpp

ROS Tools: Catkin Simple

• CATKIN_SIMPLE simplifies catkin_make.
• Book code contains a script to create packages using catkin_simple.
• Create an alias in .bashrc

alias cs_create_pkg=‘~/ros/indigo/ros_ws/src/books/newman/learning_ros_external_packages/cs_create_pkg.py’

• Move to the correct folder location and create a new package as follows:

cs_create_pkg my_minimal_nodes2 roscpp std_msgs

• It will create appropriate CMakeLists.txt and packages.xml files.
• We also need only one command to compile and link!

cs_add_executable(minimal_publisher_3 src/minimal_publisher.cpp

单独编译|调试某包

调试

catkin_make -DCMAKE_BUILD_TYPE=Debug

单独编译

catkin_make -DCATKIN_WHITELIST_PACKAGES=“minimal_nodes"
发布了48 篇原创文章 · 获赞 5 · 访问量 4027

猜你喜欢

转载自blog.csdn.net/hk2121/article/details/104475681