前提:已安装好melodic
sudo apt-get install ros-melodic-freenect-*
rospack profile
安装rqt-image-view显示图像
sudo apt-get install ros-melodic-rqt-image-view
在主目录下
git clone https://github.com/ros-drivers/libfreenect.git
cd libfreenect
mkdir build
cd build
cmake -L ..
make
sudo make install
如果下载慢,可以去https://github.com/ros-drivers/libfreenect.git下载后解压
ros网站:http://wiki.ros.org/freenect_camera
首先,创建catkin_ws/src文件夹,运行如下命令
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
git clone https://github.com/ros-drivers/freenect_stack.git
cd ~/catkin_ws
catkin_make
rospack profile
编译完成后需要打开两个终端
1、在catkin_ws文件夹打开终端,运行如下命令
source devel/setup.bash
roslaunch freenect_launch freenect.launch
2、在catkin_ws文件夹打开终端,运行如下命令
rosrun rqt_image_view rqt_image_view
在rqt_image_view中左上角选择不同的话题,就可以查看不同的图像,也可以查看深度图
参考:
http://t.csdn.cn/Hh0qs
http://t.csdn.cn/G9GSK
http://t.csdn.cn/DXarB
主要录制的话题是 /camera/rgb/image_color
和/camera/rgb/image_raw
,其类型都是sensor_msgs/Image
查看话题
rostopic list
录制话题 camera/rgb/image_color
rosbag record /topic1 -o out.bag
//例
rosbag record /camera/rgb/image_color -o camera.bag
rosbag info指令可以显示数据包中的信息
rosbag info filename.bag
//例
rosbag info camera_2022-06-20-20-06-43.bag
回放bag
rosbag play <your bagfile name>
//例
rosbag play camera_2022-06-20-20-06-43.bag
运行驱动
source devel/setup.bash
roslaunch freenect_launch freenect.launch
打开相机屏幕
rosrun rqt_image_view rqt_image_view
查看话题
rostopic list
打开rviz
rosrun rviz rviz
1、在rviz中将Global Option中的Fixed Frame后面选择camera_link
2、点击Add在By topic中选择想录制的话题,点击OK即可。
设置完后,就可在rviz中实时查看想要录制的话题
修改频率命令
rosrun topic_tools throttle messages <intopic> <msgs_per_sec> [outtopic]
//例如,如果我想要让激光雷达的topic发布频率降低至1HZ,则在终端中输入如下命令:
rosrun topic_tools throttle messages base_scan 1.0
本文将话题 /camera/rgb/image_color
和/camera/rgb/image_raw
修改为4Hz,命令如下
rosrun topic_tools throttle messages /camera/rgb/image_color 4.0 /my_image_color
rosrun topic_tools throttle messages /camera/rgb/image_raw 4.0 /my_image_raw
录制频率修改后的话题my_image_color
和my_image_raw
// 同时录制,开一个终端
rosbag record /my_image_color /my_image_raw -o my_image.bag
//分开录制,开两个终端
rosbag record /my_image_color -o my_image_color.bag
rosbag record /my_image_raw -o my_image_raw .bag
参考
http://t.csdn.cn/30ZE3
http://t.csdn.cn/t7DuA