- 初始化:
source /opt/ros/hydro/setup.bash
mkdir -p catkin_ws/src
(关闭了roscore后,必须重新编译工作空间)
cd ~/catkin_wd/src
catkin_init_workspace
cd ~/catkin_ws
catkin_make
source devel/setup.bash
查看:
echo $ROS_PACKAGE_PATH建立包(多个,则重复建包过程)
cd ~/src
catkin_create_package fish_sonar
catkin_create_package fish_obstacle_avoid
(1)修改Cmakelist.txt,package.xml 文件
(2)建立src文件(源文件)修改Cmakelist.txt,package.xml文件
(3)建立msg文件,修改Cmakelist.txt,package.xml文件
(4)建立include文件
(5)建立launch文件,修改Cmakelist.txt,package.xml文件
编译(可以多个包一起编译)(修改后需要重新编译)
cd ~/catkin_ws
catkin_make运行(launch文件)(编译如果出错,则launch 某部分出错)
(终端1)roslaunch fish_sonar fish_sonar.launch
(包名) (launch文件)
(终端2)roslaunch fish_obstacle_avoid fish_obstacle_avoid.launch运行(节点)(编译如果出错,则没法运行“node”)
rosrun fish_sonar fish_sonar_node记录并回放数据
(运行rostun package package_node)
新开终端窗口
rosbag record -a
rosbag play xxx.bag