初始化ROS包,以及launch方式运行,config参数获取
0.需求说明
初始化ROS包
参考ROS入门教程(三)—— 用C++或Python实现Hello world
1.基本操作
1.1.初始化ROS包
mkdir -p helloworld_ws/src
cd helloworld_ws
catkin_make
cd src
catkin_create_pkg helloworld roscpp rospy std_msgs
编辑源文件
编辑配置文件,如
#添加可执行文件
add_executable(camera_split_node src/camera_split.cpp )
#指定链接库
target_link_libraries(camera_split_node
${catkin_LIBRARIES}
${OpenCV_LIBRARIES}
)
如果是python,则
catkin_install_python(PROGRAMS
scripts/hello.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
1.2.launch方式
新建launch文件夹,创建launch文件即可。
具体launch标签参考ROS-ROS运行管理-launch文件
具体程序参考usb_cam_plus
launch传参有两种方式
- param 标签
arg和param的关系参考launch文件arg和param传参 - rosparam 标签(配合config.yaml文件)
传参方式参考
动手学ROS(5):roslaunch