一、海龜控制1.啟動海龜仿真器roscore rosrun turtlesim turtlesim_node 2.海龜控制節(jié)點rosrun turtlesim turtle_teleop_key 3.通過發(fā)布話題控制海龜移動rostopic pub -r 10 /turtle1/cmd_vel geometry_msgs/Twist "linear": x:0.0 y:0.0 z:0.0 angular: x:0.0 y:0.0 z:0.0 注:通過修改x、y、z的值進(jìn)行控制 4.通過調(diào)用服務(wù)產(chǎn)生第二只海龜rosservice call /spawn "x:0.0 y:0.0 theta:0.0 name:''" 注:name后面的''中需要輸入名稱 5.刷新rosservice call /clear "{}" 二、創(chuàng)建工作空間mkdir -p ~/catkin_ws/src cd ~/catkin_ws/src catkin_init_workspace cd ~/catkin_ws catkin_make source devel/setup.bash 三、創(chuàng)建功能包cd ~/catkin_ws/src catkin_create_pkg xxx_pkg std_msgs rospy roscpp cd ~/catkin_ws catkin_make source ~/catkin_ws/devel/setup.bash 四、編譯運行c++文件1.編譯c++文件g++ xxx.cpp -o xxx_for #xxx_for為可執(zhí)行文件名稱 2.運行可執(zhí)行文件./xxx_for 五、話題記錄與復(fù)現(xiàn)1.話題記錄rosbag record -a -O 壓縮包名稱 2.話題復(fù)現(xiàn)rosbag play 壓縮包名稱.bag 六、啟動rviz可視化工具roscore rviz 七、調(diào)用攝像頭1.usb_camroscore roslaunch usb_cam usb_cam-test.launch 2.uvc_camroscore rosrun uvc_camera uvc_camera_node 顯示: rosrun image image_view image_view image:=/image_raw |
|