Hi! I am using two Kinect with RTAB-Map, I'm using the launch file that is included in the demo folder without any problem. But I want to be able to record the topics from my Kinect and play the data back; I modified the launch file to this: (basically removed the launch of freenect driver)
<launch> <!-- Multi-cameras demo with 2 Kinects --> <param name="use_sim_time" type="bool" value="True"/> <!-- Frames: Kinects are placed at 90 degrees, clockwise and 35.32 cm aside on Y axis --> <node pkg="tf2_ros" type="static_transform_publisher" name="base_to_camera1_tf" args="0.0 0.0 0.0 0.0 0.0 0.0 /base_link /camera1_link" /> <node pkg="tf2_ros" type="static_transform_publisher" name="base_to_camera2_tf" args="0.0 0.3532 0.0 1.570796327 0.0 0.0 /base_link /camera2_link" /> <!-- Publish tf for camera1 --> <include file="$(find rgbd_launch)/launch/kinect_frames.launch"> <arg name="camera" value="camera1" /> </include> <!-- Publish tf for camera2 --> <include file="$(find rgbd_launch)/launch/kinect_frames.launch"> <arg name="camera" value="camera2" /> </include> <!-- Choose visualization --> <arg name="rviz" default="false" /> <arg name="rtabmapviz" default="true" /> <!-- ODOMETRY MAIN ARGUMENTS: -"strategy" : Strategy: 0=Frame-to-Map 1=Frame-to-Frame -"feature" : Feature type: 0=SURF 1=SIFT 2=ORB 3=FAST/FREAK 4=FAST/BRIEF 5=GFTT/FREAK 6=GFTT/BRIEF 7=BRISK -"nn" : Nearest neighbor strategy : 0=Linear, 1=FLANN_KDTREE, 2=FLANN_LSH, 3=BRUTEFORCE Set to 1 for float descriptor like SIFT/SURF Set to 3 for binary descriptor like ORB/FREAK/BRIEF/BRISK -"max_depth" : Maximum features depth (m) -"min_inliers" : Minimum visual correspondences to accept a transformation (m) -"inlier_distance" : RANSAC maximum inliers distance (m) -"local_map" : Local map size: number of unique features to keep track -"odom_info_data" : Fill odometry info messages with inliers/outliers data. --> <arg name="strategy" default="0" /> <arg name="feature" default="6" /> <arg name="nn" default="3" /> <arg name="max_depth" default="4.0" /> <arg name="min_inliers" default="20" /> <arg name="inlier_distance" default="0.02" /> <arg name="local_map" default="1000" /> <arg name="odom_info_data" default="true" /> <arg name="wait_for_transform" default="true" /> <!-- sync rgb/depth images per camera --> <group ns="camera1"> <node pkg="nodelet" type="nodelet" name="rgbd_sync" args="load rtabmap_ros/rgbd_sync camera1_nodelet_manager"> <remap from="rgb/image" to="rgb/image_rect_color"/> <remap from="depth/image" to="depth_registered/image_raw"/> <remap from="rgb/camera_info" to="rgb/camera_info"/> </node> </group> <group ns="camera2"> <node pkg="nodelet" type="nodelet" name="rgbd_sync" args="load rtabmap_ros/rgbd_sync camera2_nodelet_manager"> <remap from="rgb/image" to="rgb/image_rect_color"/> <remap from="depth/image" to="depth_registered/image_raw"/> <remap from="rgb/camera_info" to="rgb/camera_info"/> </node> </group> <group ns="rtabmap"> <!-- Odometry --> <node pkg="rtabmap_ros" type="rgbd_odometry" name="rgbd_odometry" output="screen"> <remap from="rgbd_image0" to="/camera1/rgbd_image/"/> <remap from="rgbd_image1" to="/camera2/rgbd_image/"/> <param name="subscribe_rgbd" type="bool" value="true"/> <param name="frame_id" type="string" value="base_link"/> <param name="rgbd_cameras" type="int" value="2"/> <param name="wait_for_transform" type="bool" value="$(arg wait_for_transform)"/> <param name="Odom/Strategy" type="string" value="$(arg strategy)"/> <param name="OdomF2M/BundleAdjustment" type="string" value="0"/> <!-- should be 0 for multi-cameras --> <param name="Vis/EstimationType" type="string" value="0"/> <!-- should be 0 for multi-cameras --> <param name="Vis/FeatureType" type="string" value="$(arg feature)"/> <param name="Vis/CorGuessWinSize" type="string" value="0"/> <param name="Vis/CorNNType" type="string" value="$(arg nn)"/> <param name="Vis/MaxDepth" type="string" value="$(arg max_depth)"/> <param name="Vis/MinInliers" type="string" value="$(arg min_inliers)"/> <param name="Vis/InlierDistance" type="string" value="$(arg inlier_distance)"/> <param name="OdomF2M/MaxSize" type="string" value="$(arg local_map)"/> <param name="Odom/FillInfoData" type="string" value="$(arg odom_info_data)"/> </node> <!-- Visual SLAM (robot side) --> <!-- args: "delete_db_on_start" and "udebug" --> <node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen" args="--delete_db_on_start"> <param name="subscribe_depth" type="bool" value="false"/> <param name="subscribe_rgbd" type="bool" value="true"/> <param name="rgbd_cameras" type="int" value="2"/> <param name="frame_id" type="string" value="base_link"/> <param name="gen_scan" type="bool" value="true"/> <param name="wait_for_transform" type="bool" value="$(arg wait_for_transform)"/> <param name="map_negative_poses_ignored" type="bool" value="false"/> <!-- refresh grid map even if we are not moving--> <param name="map_negative_scan_empty_ray_tracing" type="bool" value="false"/> <!-- don't fill empty space between the generated scans--> <remap from="rgbd_image0" to="/camera1/rgbd_image/"/> <remap from="rgbd_image1" to="/camera2/rgbd_image/"/> <param name="Grid/FromDepth" type="string" value="false"/> <param name="Vis/EstimationType" type="string" value="0"/> <!-- should be 0 for multi-cameras --> <param name="Vis/MinInliers" type="string" value="10"/> <param name="Vis/InlierDistance" type="string" value="$(arg inlier_distance)"/> </node> <!-- Visualisation RTAB-Map --> <node if="$(arg rtabmapviz)" pkg="rtabmap_ros" type="rtabmapviz" name="rtabmapviz" args="-d $(find rtabmap_ros)/launch/config/rgbd_gui.ini" output="screen"> <param name="subscribe_depth" type="bool" value="false"/> <param name="subscribe_rgbd" type="bool" value="true"/> <param name="subscribe_odom_info" type="bool" value="$(arg odom_info_data)"/> <param name="frame_id" type="string" value="base_link"/> <param name="rgbd_cameras" type="int" value="2"/> <param name="wait_for_transform" type="bool" value="$(arg wait_for_transform)"/> <remap from="rgbd_image0" to="/camera1/rgbd_image/"/> <remap from="rgbd_image1" to="/camera2/rgbd_image/"/> </node> </group> <!-- Visualization RVIZ --> <node if="$(arg rviz)" pkg="rviz" type="rviz" name="rviz" args="-d $(find rtabmap_ros)/launch/config/rgbd.rviz"/> </launch> rosbag record -O kinectBig /camera1/rgb/camera_info /camera1/depth_registered/image_raw /camera1/rgb/image_rect_color /camera2/rgb/camera_info /camera2/depth_registered/image_raw /camera2/rgb/image_rect_color rosbag record -O kinectBig /camera1/rgb/camera_info /camera1/depth_registered/image_raw /camera1/rgbd_image /camera1/rgb/image_rect_color /camera2/rgb/camera_info /camera2/depth_registered/image_raw /camera2/rgbd_image /camera2/rgb/image_rect_color |
Might it have something to do with clock and ros param: use_sim_time when you're playing?
this might be helpful: https://answers.ros.org/question/12577/when-should-i-need-clock-parameter-on-rosbag-play/ |
Yes! I set the use_sim_time to true. The thing that I do not understand is that if I also suscribe to the topics: /camera1/rgbd_image and /camera2/rgbd_image everythings works correctly but I don't undersant why do I have to suscribe to those topics since, as far as i know, those topics are created with the rgdb_sync in the launch file node using rgbd and depth.
The only thing that comes to my mind is that the rgbd_sync does not work with publishing the topics from a bag? But then how can I get the /cameraX/rgbd_image topic. |
Administrator
|
Hi,
Can you do a rosbag info on your bag? |
Hello! Sorry for the late response, here you go
|
Administrator
|
I don't see a problem with the bag.
Based on your code above (setting nodelet as standalone because the camera nodelets don't exist with the rosbag): <group ns="camera1"> <node pkg="nodelet" type="nodelet" name="rgbd_sync" args="standalone rtabmap_ros/rgbd_sync"> <remap from="rgb/image" to="rgb/image_rect_color"/> <remap from="depth/image" to="depth_registered/image_raw"/> <remap from="rgb/camera_info" to="rgb/camera_info"/> </node> </group> <group ns="camera2"> <node pkg="nodelet" type="nodelet" name="rgbd_sync" args="standalone rtabmap_ros/rgbd_sync"> <remap from="rgb/image" to="rgb/image_rect_color"/> <remap from="depth/image" to="depth_registered/image_raw"/> <remap from="rgb/camera_info" to="rgb/camera_info"/> </node> </group>the /camera1/rgbd_image and /camera2/rgbd_image should be published. The other thing is that if the stamps in header of the topics are not synchronized, that could block rgbd_sync to synchronize the input topics. |
Free forum by Nabble | Edit this page |