I recently asked a question about RTABMapping with a ZED camera and I found a solution to most of my problems, except for one. Whenever I start up rviz using the stereo_mapping.launch, it always starts mapping the pointcloud upwards and I'm not sure how to fix it?
Practical info: I'm using the latest version of RTABmap with ROS Kinetic and the latest ZED wrapper with 2.0 SDK. My current tf tree: My current tf2 tree: My current rqt_graph: The launch files for ZED: zed_camera.launch: <launch> <arg name="svo_file"/> <arg name="zed_id"/> <include file="$(find zed_wrapper)/launch/zed_tf.launch" /> <node name="zed_wrapper_node" pkg="zed_wrapper" type="zed_wrapper_node" output="screen"> <!-- SVO file path --> <param name="svo_filepath" value="$(arg svo_file)" /> <!-- ZED parameters --> <param name="zed_id" value="$(arg zed_id)" /> <param name="resolution" value="2" /> <param name="quality" value="1" /> <param name="sensing_mode" value="1" /> <param name="frame_rate" value="60" /> <param name="odometry_db" value="" /> <param name="openni_depth_mode" value="0" /> <param name="gpu_id" value="-1" /> <!-- ROS topic names --> <param name="rgb_topic" value="rgb/image_rect_color" /> <param name="rgb_raw_topic" value="rgb/image_raw" /> <param name="rgb_cam_info_topic" value="rgb/camera_info" /> <param name="left_topic" value="left/image_rect_color" /> <param name="left_raw_topic" value="left/image_raw" /> <param name="left_cam_info_topic" value="left/camera_info" /> <param name="right_topic" value="right/image_rect_color" /> <param name="right_raw_topic" value="right/image_raw" /> <param name="right_cam_info_topic" value="right/camera_info" /> <param name="depth_topic" value="depth/depth_registered" /> <param name="depth_cam_info_topic" value="depth/camera_info" /> <param name="point_cloud_topic" value="point_cloud/cloud_registered" /> <param name="odometry_topic" value="odom" /> </node> <!-- ROS URDF description of the ZED --> <param name="zed_description" textfile="$(find zed_wrapper)/urdf/zed.urdf" /> <node name="zed_state_publisher" pkg="robot_state_publisher" type="state_publisher"> <remap from="robot_description" to="zed_description" /> </node> </launch> zed_tf.launch <launch> <arg name="tf_prefix" default="" /> <arg name="pi/2" value="1.5707963267948966" /> <arg name="optical_rotate" value="0 0 0 -$(arg pi/2) 0 -$(arg pi/2)" /> <node pkg="tf2_ros" type="static_transform_publisher" name="zed_base_link1" args="0 0 0 0 0 0 map $(arg tf_prefix)/camera_link" /> <node pkg="tf2_ros" type="static_transform_publisher" name="zed_base_link3" args="0 0 0 0 0 0 $(arg tf_prefix)/zed_current_frame ZED_left_camera" /> <node pkg="tf2_ros" type="static_transform_publisher" name="zed_base_link4" args="0 0 0 -$(arg pi/2) 0 -$(arg pi/2) $(arg tf_prefix)/zed_current_frame zed_depth_frame" /> <node pkg="tf2_ros" type="static_transform_publisher" name="zed_base_link5" args="0 0 0 0 0 0 $(arg tf_prefix)/camera_link zed_initial_frame" /> </launch> RTABmap launch files: stereo_mapping.launch <launch> <!-- Backward compatibility launch file, use "rtabmap.launch rgbd:=false stereo:=true" instead --> <!-- Your camera should be calibrated and publishing rectified left and right images + corresponding camera_info msgs. You can use stereo_image_proc for image rectification. Example: $ roslaunch rtabmap_ros bumblebee.launch --> <!-- Choose visualization --> <arg name="rtabmapviz" default="false" /> <arg name="rviz" default="true" /> <!-- Localization-only mode --> <arg name="localization" default="false"/> <!-- Corresponding config files --> <arg name="rtabmapviz_cfg" default="$(find rtabmap_ros)/launch/config/rgbd_gui.ini" /> <arg name="rviz_cfg" default="$(find rtabmap_ros)/launch/config/rgbd.rviz" /> <arg name="frame_id" default="zed_initial_frame"/> <!-- Fixed frame id, you may set "base_link" or "base_footprint" if they are published --> <arg name="database_path" default="~/.ros/rtabmap.db"/> <arg name="rtabmap_args" default=""/> <!-- delete_db_on_start, udebug --> <arg name="launch_prefix" default=""/> <arg name="approx_sync" default="false"/> <!-- if timestamps of the input topics are not synchronized --> <arg name="stereo_namespace" default="/camera"/> <arg name="left_image_topic" default="$(arg stereo_namespace)/left/image_rect_color" /> <arg name="right_image_topic" default="$(arg stereo_namespace)/right/image_rect" /> <!-- using grayscale image for efficiency --> <arg name="left_camera_info_topic" default="$(arg stereo_namespace)/left/camera_info" /> <arg name="right_camera_info_topic" default="$(arg stereo_namespace)/right/camera_info" /> <arg name="compressed" default="false"/> <arg name="subscribe_scan" default="false"/> <!-- Assuming 2D scan if set, rtabmap will do 3DoF mapping instead of 6DoF --> <arg name="scan_topic" default="/scan"/> <arg name="subscribe_scan_cloud" default="false"/> <!-- Assuming 3D scan if set --> <arg name="scan_cloud_topic" default="/scan_cloud"/> <arg name="visual_odometry" default="true"/> <!-- Generate visual odometry --> <arg name="odom_topic" default="/odom"/> <!-- Odometry topic used if visual_odometry is false --> <arg name="odom_frame_id" default=""/> <!-- If set, TF is used to get odometry instead of the topic --> <arg name="namespace" default="rtabmap"/> <arg name="wait_for_transform" default="0.2"/> <include file="$(find rtabmap_ros)/launch/rtabmap.launch"> <arg name="stereo" value="true"/> <arg name="rtabmapviz" value="$(arg rtabmapviz)" /> <arg name="rviz" value="$(arg rviz)" /> <arg name="localization" value="$(arg localization)"/> <arg name="gui_cfg" value="$(arg rtabmapviz_cfg)" /> <arg name="rviz_cfg" value="$(arg rviz_cfg)" /> <arg name="frame_id" value="$(arg frame_id)"/> <arg name="namespace" value="$(arg namespace)"/> <arg name="database_path" value="$(arg database_path)"/> <arg name="wait_for_transform" value="$(arg wait_for_transform)"/> <arg name="rtabmap_args" value="$(arg rtabmap_args)"/> <arg name="launch_prefix" value="$(arg launch_prefix)"/> <arg name="approx_sync" value="$(arg approx_sync)"/> <arg name="stereo_namespace" value="$(arg stereo_namespace)"/> <arg name="left_image_topic" value="$(arg left_image_topic)" /> <arg name="right_image_topic" value="$(arg right_image_topic)" /> <arg name="left_camera_info_topic" value="$(arg left_camera_info_topic)" /> <arg name="right_camera_info_topic" value="$(arg right_camera_info_topic)" /> <arg name="compressed" value="$(arg compressed)"/> <arg name="subscribe_scan" value="$(arg subscribe_scan)"/> <arg name="scan_topic" value="$(arg scan_topic)"/> <arg name="subscribe_scan_cloud" value="$(arg subscribe_scan_cloud)"/> <arg name="scan_cloud_topic" value="$(arg scan_cloud_topic)"/> <arg name="visual_odometry" value="$(arg visual_odometry)"/> <arg name="odom_topic" value="$(arg odom_topic)"/> <arg name="odom_frame_id" value="$(arg odom_frame_id)"/> <arg name="odom_args" value="$(arg rtabmap_args)"/> </include> </launch> rtabmap.launch <launch> <!-- Convenience launch file to launch odometry, rtabmap and rtabmapviz nodes at once --> <!-- For stereo:=false Your RGB-D sensor should be already started with "depth_registration:=true". Examples: $ roslaunch freenect_launch freenect.launch depth_registration:=true $ roslaunch openni2_launch openni2.launch depth_registration:=true --> <!-- For stereo:=true Your camera should be calibrated and publishing rectified left and right images + corresponding camera_info msgs. You can use stereo_image_proc for image rectification. Example: $ roslaunch rtabmap_ros bumblebee.launch --> <!-- Choose between RGB-D and stereo --> <arg name="stereo" default="true"/> <!-- Choose visualization --> <arg name="rtabmapviz" default="false" /> <arg name="rviz" default="true" /> <!-- Localization-only mode --> <arg name="localization" default="false"/> <!-- Corresponding config files --> <arg name="cfg" default="" /> <!-- To change RTAB-Map's parameters, set the path of config file (*.ini) generated by the standalone app --> <arg name="gui_cfg" default="~/.ros/rtabmap_gui.ini" /> <arg name="rviz_cfg" default="$(find rtabmap_ros)/launch/config/rgbd.rviz" /> <arg name="frame_id" default="odom"/> <!-- Fixed frame id, you may set "base_link" or "base_footprint" if they are published --> <arg name="odom_frame_id" default=""/> <!-- If set, TF is used to get odometry instead of the topic --> <arg name="map_frame_id" default="map"/> <arg name="namespace" default="rtabmap"/> <arg name="database_path" default="~/.ros/rtabmap.db"/> <arg name="queue_size" default="30"/> <arg name="wait_for_transform" default="0.2"/> <arg name="args" default=""/> <!-- delete_db_on_start, udebug --> <arg name="rtabmap_args" default="$(arg args)"/> <!-- deprecated, use "args" argument --> <arg name="launch_prefix" default=""/> <!-- for debugging purpose, it fills launch-prefix tag of the nodes --> <!-- if timestamps of the input topics are synchronized using approximate or exact time policy--> <arg if="$(arg stereo)" name="approx_sync" default="false"/> <arg unless="$(arg stereo)" name="approx_sync" default="true"/> <!-- RGB-D related topics --> <arg name="rgb_topic" default="/camera/rgb/image_rect_color" /> <arg name="depth_topic" default="/camera/depth_registered/image_raw" /> <arg name="camera_info_topic" default="/camera/rgb/camera_info" /> <!-- stereo related topics --> <arg name="stereo_namespace" default="/camera"/> <arg name="left_image_topic" default="$(arg stereo_namespace)/left/image_rect_color" /> <arg name="right_image_topic" default="$(arg stereo_namespace)/right/image_rect" /> <!-- using grayscale image for efficiency --> <arg name="left_camera_info_topic" default="$(arg stereo_namespace)/left/camera_info" /> <arg name="right_camera_info_topic" default="$(arg stereo_namespace)/right/camera_info" /> <arg name="compressed" default="false"/> <!-- If you want to subscribe to compressed image topics --> <arg name="rgb_image_transport" default="compressed"/> <!-- Common types: compressed, theora (see "rosrun image_transport list_transports") --> <arg name="depth_image_transport" default="compressedDepth"/> <!-- Common types: compressed, theora (see "rosrun image_transport list_transports") --> <arg name="subscribe_scan" default="false"/> <arg name="scan_topic" default="/scan"/> <arg name="subscribe_scan_cloud" default="false"/> <arg name="scan_cloud_topic" default="/scan_cloud"/> <arg name="visual_odometry" default="true"/> <!-- Launch rtabmap visual odometry node --> <arg name="odom_topic" default="/odom"/> <!-- Odometry topic used if visual_odometry is false --> <arg name="vo_frame_id" default="odom"/> <arg name="odom_tf_angular_variance" default="1"/> <!-- If TF is used to get odometry, this is the default angular variance --> <arg name="odom_tf_linear_variance" default="1"/> <!-- If TF is used to get odometry, this is the default linear variance --> <arg name="odom_args" default="$(arg rtabmap_args)"/> <arg name="subscribe_user_data" default="false"/> <!-- user data synchronized subscription --> <arg name="user_data_topic" default="/user_data"/> <arg name="user_data_async_topic" default="/user_data_async" /> <!-- user data async subscription (rate should be lower than map update rate) --> <!-- These arguments should not be modified directly, see referred topics without "_relay" suffix above --> <arg if="$(arg compressed)" name="rgb_topic_relay" default="$(arg rgb_topic)_relay"/> <arg unless="$(arg compressed)" name="rgb_topic_relay" default="$(arg rgb_topic)"/> <arg if="$(arg compressed)" name="depth_topic_relay" default="$(arg depth_topic)_relay"/> <arg unless="$(arg compressed)" name="depth_topic_relay" default="$(arg depth_topic)"/> <arg if="$(arg compressed)" name="left_image_topic_relay" default="$(arg left_image_topic)_relay"/> <arg unless="$(arg compressed)" name="left_image_topic_relay" default="$(arg left_image_topic)"/> <arg if="$(arg compressed)" name="right_image_topic_relay" default="$(arg right_image_topic)_relay"/> <arg unless="$(arg compressed)" name="right_image_topic_relay" default="$(arg right_image_topic)"/> <!-- Nodes --> <group ns="$(arg namespace)"> <!-- RGB-D Odometry --> <group unless="$(arg stereo)"> <node if="$(arg compressed)" name="republish_rgb" type="republish" pkg="image_transport" args="$(arg rgb_image_transport) in:=$(arg rgb_topic) raw out:=$(arg rgb_topic_relay)" /> <node if="$(arg compressed)" name="republish_depth" type="republish" pkg="image_transport" args="$(arg depth_image_transport) in:=$(arg depth_topic) raw out:=$(arg depth_topic_relay)" /> <node if="$(arg visual_odometry)" pkg="rtabmap_ros" type="rgbd_odometry" name="rgbd_odometry" output="screen" args="$(arg odom_args)" launch-prefix="$(arg launch_prefix)"> <remap from="rgb/image" to="$(arg rgb_topic_relay)"/> <remap from="depth/image" to="$(arg depth_topic_relay)"/> <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/> <param name="frame_id" type="string" value="$(arg frame_id)"/> <param name="odom_frame_id" type="string" value="$(arg vo_frame_id)"/> <param name="wait_for_transform_duration" type="double" value="$(arg wait_for_transform)"/> <param name="approx_sync" type="bool" value="$(arg approx_sync)"/> <param name="config_path" type="string" value="$(arg cfg)"/> <param name="queue_size" type="int" value="$(arg queue_size)"/> </node> </group> <!-- Stereo Odometry --> <group if="$(arg stereo)"> <node if="$(arg compressed)" name="republish_left" type="republish" pkg="image_transport" args="compressed in:=$(arg left_image_topic) raw out:=$(arg left_image_topic_relay)" /> <node if="$(arg compressed)" name="republish_right" type="republish" pkg="image_transport" args="compressed in:=$(arg right_image_topic) raw out:=$(arg right_image_topic_relay)" /> <node if="$(arg visual_odometry)" pkg="rtabmap_ros" type="stereo_odometry" name="stereo_odometry" output="screen" args="$(arg odom_args)" launch-prefix="$(arg launch_prefix)"> <remap from="left/image_rect" to="$(arg left_image_topic_relay)"/> <remap from="right/image_rect" to="$(arg right_image_topic_relay)"/> <remap from="left/camera_info" to="$(arg left_camera_info_topic)"/> <remap from="right/camera_info" to="$(arg right_camera_info_topic)"/> <param name="frame_id" type="string" value="$(arg frame_id)"/> <param name="odom_frame_id" type="string" value="$(arg vo_frame_id)"/> <param name="wait_for_transform_duration" type="double" value="$(arg wait_for_transform)"/> <param name="approx_sync" type="bool" value="$(arg approx_sync)"/> <param name="config_path" type="string" value="$(arg cfg)"/> <param name="queue_size" type="int" value="$(arg queue_size)"/> </node> </group> <!-- Visual SLAM (robot side) --> <!-- args: "delete_db_on_start" and "udebug" --> <node name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen" args="$(arg rtabmap_args)" launch-prefix="$(arg launch_prefix)"> <param if="$(arg stereo)" name="subscribe_depth" type="bool" value="false"/> <param unless="$(arg stereo)" name="subscribe_depth" type="bool" value="true"/> <param name="subscribe_stereo" type="bool" value="$(arg stereo)"/> <param name="subscribe_scan" type="bool" value="$(arg subscribe_scan)"/> <param name="subscribe_scan_cloud" type="bool" value="$(arg subscribe_scan_cloud)"/> <param name="subscribe_user_data" type="bool" value="$(arg subscribe_user_data)"/> <param name="frame_id" type="string" value="$(arg frame_id)"/> <param name="map_frame_id" type="string" value="$(arg map_frame_id)"/> <param name="odom_frame_id" type="string" value="$(arg odom_frame_id)"/> <param name="odom_tf_angular_variance" type="double" value="$(arg odom_tf_angular_variance)"/> <param name="odom_tf_linear_variance" type="double" value="$(arg odom_tf_linear_variance)"/> <param name="wait_for_transform_duration" type="double" value="$(arg wait_for_transform)"/> <param name="database_path" type="string" value="$(arg database_path)"/> <param name="approx_sync" type="bool" value="$(arg approx_sync)"/> <param name="config_path" type="string" value="$(arg cfg)"/> <param name="queue_size" type="int" value="$(arg queue_size)"/> <remap from="rgb/image" to="$(arg rgb_topic_relay)"/> <remap from="depth/image" to="$(arg depth_topic_relay)"/> <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/> <remap from="left/image_rect" to="$(arg left_image_topic_relay)"/> <remap from="right/image_rect" to="$(arg right_image_topic_relay)"/> <remap from="left/camera_info" to="$(arg left_camera_info_topic)"/> <remap from="right/camera_info" to="$(arg right_camera_info_topic)"/> <remap from="scan" to="$(arg scan_topic)"/> <remap from="scan_cloud" to="$(arg scan_cloud_topic)"/> <remap from="user_data" to="$(arg user_data_topic)"/> <remap from="user_data_async" to="$(arg user_data_async_topic)"/> <remap unless="$(arg visual_odometry)" from="odom" to="$(arg odom_topic)"/> <!-- localization mode --> <param if="$(arg localization)" name="Mem/IncrementalMemory" type="string" value="false"/> <param unless="$(arg localization)" name="Mem/IncrementalMemory" type="string" value="true"/> <param name="Mem/InitWMWithAllNodes" type="string" value="$(arg localization)"/> </node> <!-- Visualisation RTAB-Map --> <node if="$(arg rtabmapviz)" pkg="rtabmap_ros" type="rtabmapviz" name="rtabmapviz" args="-d $(arg gui_cfg)" output="screen" launch-prefix="$(arg launch_prefix)"> <param if="$(arg stereo)" name="subscribe_depth" type="bool" value="false"/> <param unless="$(arg stereo)" name="subscribe_depth" type="bool" value="true"/> <param name="subscribe_stereo" type="bool" value="$(arg stereo)"/> <param name="subscribe_scan" type="bool" value="$(arg subscribe_scan)"/> <param name="subscribe_scan_cloud" type="bool" value="$(arg subscribe_scan_cloud)"/> <param name="subscribe_odom_info" type="bool" value="$(arg visual_odometry)"/> <param name="frame_id" type="string" value="$(arg frame_id)"/> <param name="odom_frame_id" type="string" value="$(arg odom_frame_id)"/> <param name="wait_for_transform_duration" type="double" value="$(arg wait_for_transform)"/> <param name="queue_size" type="int" value="$(arg queue_size)"/> <param name="approx_sync" type="bool" value="$(arg approx_sync)"/> <remap from="rgb/image" to="$(arg rgb_topic_relay)"/> <remap from="depth/image" to="$(arg depth_topic_relay)"/> <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/> <remap from="left/image_rect" to="$(arg left_image_topic_relay)"/> <remap from="right/image_rect" to="$(arg right_image_topic_relay)"/> <remap from="left/camera_info" to="$(arg left_camera_info_topic)"/> <remap from="right/camera_info" to="$(arg right_camera_info_topic)"/> <remap from="scan" to="$(arg scan_topic)"/> <remap from="scan_cloud" to="$(arg scan_cloud_topic)"/> <remap unless="$(arg visual_odometry)" from="odom" to="$(arg odom_topic)"/> </node> </group> <!-- Visualization RVIZ --> <node if="$(arg rviz)" pkg="rviz" type="rviz" name="rviz" args="-d $(arg rviz_cfg)"/> <node if="$(arg rviz)" pkg="nodelet" type="nodelet" name="points_xyzrgb" args="standalone rtabmap_ros/point_cloud_xyzrgb"> <remap from="left/image" to="$(arg left_image_topic_relay)"/> <remap from="right/image" to="$(arg right_image_topic_relay)"/> <remap from="left/camera_info" to="$(arg left_camera_info_topic)"/> <remap from="right/camera_info" to="$(arg right_camera_info_topic)"/> <remap from="rgb/image" to="$(arg rgb_topic_relay)"/> <remap from="depth/image" to="$(arg depth_topic_relay)"/> <remap from="rgb/camera_info" to="$(arg camera_info_topic)"/> <remap from="cloud" to="voxel_cloud" /> <param name="decimation" type="double" value="4"/> <param name="voxel_size" type="double" value="0.0"/> <param name="approx_sync" type="bool" value="$(arg approx_sync)"/> </node> </launch> Best Regards Alexia |
Administrator
|
Hi,
Don't use zed_tf.launch as is, or modify it like in this tutorial: <launch> <arg name="tf_prefix" default="" /> <arg name="pi/2" value="1.5707963267948966" /> <arg name="optical_rotate" value="0 0 0 -$(arg pi/2) 0 -$(arg pi/2)" /> <node pkg="tf2_ros" type="static_transform_publisher" name="zed_base_link3" args="0 0 0 0 0 0 $(arg tf_prefix)/zed_current_frame ZED_left_camera" /> <node pkg="tf2_ros" type="static_transform_publisher" name="zed_base_link5" args="$(arg optical_rotate) $(arg tf_prefix)/camera_link zed_initial_frame" /> </launch>Note the optical rotation is between /camera_link and /zed_initial_frame. cheers, Mathieu |
Hi Mathieu
I changed the the zed_tf.launch so it looks like this: <launch> <arg name="tf_prefix" default="" /> <arg name="pi/2" value="1.5707963267948966" /> <arg name="optical_rotate" value="0 0 0 -$(arg pi/2) 0 -$(arg pi/2)" /> <node pkg="tf2_ros" type="static_transform_publisher" name="zed_base_link1" args="0 0 0 0 0 0 map $(arg tf_prefix)/camera_link" /> <node pkg="tf2_ros" type="static_transform_publisher" name="zed_base_link3" args="0 0 0 0 0 0 $(arg tf_prefix)/zed_current_frame ZED_left_camera" /> <node pkg="tf2_ros" type="static_transform_publisher" name="zed_base_link4" args="0 0 0 -$(arg pi/2) 0 -$(arg pi/2) $(arg tf_prefix)/zed_current_frame zed_depth_frame" /> <node pkg="tf2_ros" type="static_transform_publisher" name="zed_base_link5" args="$(arg optical_rotate) $(arg tf_prefix)/camera_link zed_initial_frame" /> </launch> But the point cloud is still pointed upwards when I launch: When I launch with the camera in an upwards facing position and then move it down to be horizontal, the point cloud starts mapping upwards and then moves down to be horizontal too. But when the camera starts horizontal the point cloud starts upwards anyways? Best Regars Alexia |
Administrator
|
Hi,
Remove /map -> /camera_link transform. Can you tell me if the current tutorial works correctly with the zed? cheers, Mathieu |
Hi,
Launching the zed_wrapper_node instead of the zed.launch seems to have fixed the problem. In the tutorial there is a line that says to replace: float baseline = zedParam->baseline * 0.001;With: float baseline = zedParam->baseline;"But in my nodelet it looks like this: float baseline = zedParam.calibration_parameters.T[0]; Otherwise it seems to work Best Regards Alexia |
Free forum by Nabble | Edit this page |