kinect2的深度图可以转换成激光来用,使用depthimage_to_laser
这个tf是用来给rviz显示的
1)开启kinect2
rosrun kinect2_bridge kinect2_bridge
2)开启 depthimage_to_laser
rosrun depthimage_to_laserscan depthimage_to_laserscan image:=/kinect2/qhd/image_depth_rect camera_info:=/kinect2/qhd/camera_info
3)开启rviz
rosrun rviz rviz
按topic找到laserScan rviz没有显示啥 有报错
Transform For frame [camera_depth_frame]: No transform to fixed frame [map]. TF error: [Lookup would require extrapolation into the future. Requested time
4)发布static_tf
rosrun tf static_transform_publisher 0 0 0 0 0 0 1 map camera_depth_frame 10
根据https://answers.ros.org/question/195962/rviz-fixed-frame-world-does-not-exist/
说rviz不知道把scan放哪,按照报错说的,要给他个tf
显示如下:
写了个小launch
<launch> <node pkg="kinect2_bridge" type="kinect2_bridge" name="kinect2_bridge" output="screen"/> <node pkg="depthimage_to_laserscan" type="depthimage_to_laserscan" name="depthimage_to_laser" output="screen" > <remap from="image" to="kinect2/qhd/image_depth_rect"/> <remap from="camera_info" to="kinect2/qhd/camera_info"/> </node> <node pkg="rviz" type="rviz" name="rviz" /> <node pkg="tf" type="static_transform_publisher" name="tf_static" args="0 0 0 0 0 0 1 map camera_depth_frame 10"/> </launch>