redefining global symbol: pi error while ceating a launch file - ros

created a launch file where my robot should open on the gazebo world and when in try to run the launch file using roslaunch i get the following error
redefining global symbol: pi
when processing file: /home/akash/project/src/techman_robot_ros-master/tm_grasp_description/urdf/tm700.urdf.xacro
included from: /home/akash/project/src/techman_robot_ros-master/tm_grasp_description/urdf/tm700_robot.urdf.xacro
xacro.py is deprecated; please use xacro instead
started roslaunch server http://akash:37109/
still i can see my gazebo world but cannot see the robot imported.
and this was the launch file
<launch>
<arg name="eih" default="false" />
<arg name="limited" default="false"/>
<group unless="$(arg eih)">
<param unless="$(arg limited)" name="robot_description" command="$(find xacro)/xacro.py '$(find tm_grasp_description)/urdf/tm700_robot.urdf.xacro'" />
<param if="$(arg limited)" name="robot_description" command="$(find xacro)/xacro.py '$(find tm_grasp_description)/urdf/tm700_robot_joint_limited.urdf.xacro'" />
</group>
<group if="$(arg eih)">
<param unless="$(arg limited)" name="robot_description" command="$(find xacro)/xacro.py '$(find tm_grasp_description)/urdf/tm700_robot_eih.urdf.xacro'" />
<param if="$(arg limited)" name="robot_description" command="$(find xacro)/xacro.py '$(find tm_grasp_description)/urdf/tm700_robot_joint_limited_eih.urdf.xacro'" />
</group>
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="paused" value="false"/>
<arg name="use_sim_time" value="true"/>
<arg name="gui" value="true"/>
<arg name="headless" value="false"/>
<arg name="debug" value="false"/>
<arg name="world_name"
value="$(find tm700_moveit_config)/launch/gg.world"/>
</include>
</launch>

Since ROS Jade Xacro internally uses functions and constants from Python math module such as pi when converting a Xacro to a URDF robot description. It seems like tm700.urdf.xacro (and several other Xacro-files in the package) for some reason has pi defined in line 8
<property name="pi" value="3.14159265" />
which is in conflict with the existing definition from the math module. Therefore the generation of your robot description fails. Delete all the definitions of pi from the Xacro-files, then it should work.

Related

could not find camera topic on rviz

I was launching the techman robot on ros using the demo.launch. The first time when I launched it on rviz I could able to see the camera under by topic and I can see the video output. So I edited the moveit setup and added some poses to the robot. so when I launched again. now I could not find a camera under by topic. And I am very new to ros.
and the following was my demo.launch file
<launch>
<!-- specify the planning pipeline -->
<arg name="pipeline" default="ompl" />
<!-- By default, we do not start a database (it can be large) -->
<arg name="db" default="false" />
<!-- Allow user to specify database location -->
<arg name="db_path" default="$(find new_techman)/default_warehouse_mongo_db" />
<!-- By default, we are not in debug mode -->
<arg name="debug" default="false" />
<!-- By default, we will load or override the robot_description -->
<arg name="load_robot_description" default="true"/>
<!-- Set execution mode for fake execution controllers -->
<arg name="execution_type" default="interpolate" />
<!--
By default, hide joint_state_publisher's GUI
MoveIt!'s "demo" mode replaces the real robot driver with the joint_state_publisher.
The latter one maintains and publishes the current joint configuration of the simulated robot.
It also provides a GUI to move the simulated robot around "manually".
This corresponds to moving around the real robot without the use of MoveIt.
-->
<arg name="use_gui" default="false" />
<arg name="use_rviz" default="true" />
<!-- If needed, broadcast static tf for robot root -->
<!-- We do not have a robot connected, so publish fake joint states -->
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" unless="$(arg use_gui)">
<rosparam param="source_list">[move_group/fake_controller_joint_states]</rosparam>
</node>
<node name="joint_state_publisher" pkg="joint_state_publisher_gui" type="joint_state_publisher_gui" if="$(arg use_gui)">
<rosparam param="source_list">[move_group/fake_controller_joint_states]</rosparam>
</node>
<!-- Given the published joint states, publish tf for the robot links -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" respawn="true" output="screen" />
<!-- Run the main MoveIt! executable without trajectory execution (we do not have controllers configured by default) -->
<include file="$(find new_techman)/launch/move_group.launch">
<arg name="allow_trajectory_execution" value="true"/>
<arg name="fake_execution" value="true"/>
<arg name="execution_type" value="$(arg execution_type)"/>
<arg name="info" value="true"/>
<arg name="debug" value="$(arg debug)"/>
<arg name="pipeline" value="$(arg pipeline)"/>
<arg name="load_robot_description" value="$(arg load_robot_description)"/>
</include>
<!-- Run Rviz and load the default config to see the state of the move_group node -->
<include file="$(find new_techman)/launch/moveit_rviz.launch" if="$(arg use_rviz)">
<arg name="rviz_config" value="$(find new_techman)/launch/moveit.rviz"/>
<arg name="debug" value="$(arg debug)"/>
</include>
<!-- If database loading was enabled, start mongodb as well -->
<include file="$(find new_techman)/launch/default_warehouse_db.launch" if="$(arg db)">
<arg name="moveit_warehouse_database_path" value="$(arg db_path)"/>
</include>
</launch>
and when I launch the gazebo.launch that was created by the moveit setup assistant I can see the camera from the gazebo platform into rviz
Have you launched Gazebo before or after launching your demo.launch? Try doing it the other way around!
It seems that Gazebo provides your camera-simulation. Rviz itself doesn't create the camera view, it just listens to a topic where a different engine (normally a robot, in your case the robot-simulation of Gazebo) publishes the images and then shows these images to you.
Rviz and Gazebo sometimes have trouble communicating based on which is started first.

Why does my gazebo start in an empty world?

I have written a custom launch file for my custom gazebo world. When I roslaunch the .launch file, only an empty world opens. Could you tell me where am I wrong?
This is my launch file
<launch>
<arg name="x_pos" default="-1.0"/>
<arg name="y_pos" default="-1.0"/>
<arg name="z_pos" default="-1.0"/>
<!-- We resume the logic in empty_world.launch, changing only the name of the world to be launched -->
<arg name="model" value="burger" doc="model type [burger, waffle, waffle_pi]"/>
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="~/catkin_ws/src/cse340a3_gazebo/worlds/cse340a3.world"/>
<!-- more default parameters can be changed here -->
</include>
<!-- <param name="robot_description" value="~/catkin_ws/src/cse340a3_description/urdf/turtlebot3_burger.urdf.xacro" /> -->
<!-- <node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-urdf -model turtlebot3 -x $(arg x_pos) -y $(arg y_pos) -z $(arg z_pos) -param robot_description" /> -->
</launch>
This works for some reason (I put in the full path)
<launch>
<arg name="x_pos" default="-1.0"/>
<arg name="y_pos" default="-1.0"/>
<arg name="z_pos" default="-1.0"/>
<!-- We resume the logic in empty_world.launch, changing only the name of the world to be launched -->
<arg name="model" value="burger" doc="model type [burger, waffle, waffle_pi]"/>
<include file="/home/vishwad/catkin_ws/src/cse340a3_gazebo/launch/empty_world.launch">
<arg name="world_name" value="/home/vishwad/catkin_ws/src/cse340a3_gazebo/worlds/cse340a3.world"/>
<!-- more default parameters can be changed here -->
</include>
<!-- <param name="robot_description" value="~/catkin_ws/src/cse340a3_description/urdf/turtlebot3_burger.urdf.xacro" /> -->
<!-- <node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-urdf -model turtlebot3 -x $(arg x_pos) -y $(arg y_pos) -z $(arg z_pos) -param robot_description" /> -->
</launch>

Invalid <param> tag: Cannot load command parameter [robot_description]

I'm using ros kinetic and Ubuntu 16.04
I'm trying to do run this project but not running inside a Docker container.
After, I had done
user#user-HP-Pavilion-15-Notebook-PC:~/gym-gazebo/gym_gazebo/envs/installation/catkin_ws$ catkin_make
user#user-HP-Pavilion-15-Notebook-PC:~/gym-gazebo/gym_gazebo/envs/installation$ bash setup_kinetic.bash
user#user-HP-Pavilion-15-Notebook-PC:~/gym-gazebo/gym_gazebo/envs/installation$ bash turtlebot_setup.bash
user#user-HP-Pavilion-15-Notebook-PC:~/gym-gazebo/examples/turtlebot$ python circuit2_turtlebot_lidar_qlearn.py
Then, it comes out the following error:
... logging to /home/user/.ros/log/3ac6e572-28a3-11e8-9aba-142d27dccbb5/roslaunch-user-HP-Pavilion-15-Notebook-PC-6853.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://user-HP-Pavilion-15-Notebook-PC:37855/
ros_comm version 1.12.12
SUMMARY
========
PARAMETERS
* /rosdistro: kinetic
* /rosversion: 1.12.12
NODES
auto-starting new master
process[master]: started with pid [6864]
ROS_MASTER_URI=http://user-HP-Pavilion-15-Notebook-PC:11311/
setting /run_id to 3ac6e572-28a3-11e8-9aba-142d27dccbb5
process[rosout-1]: started with pid [6884]
started core service [/rosout]
Roscore launched!
Gazebo launched!
... logging to /home/user/.ros/log/3ac6e572-28a3-11e8-9aba-142d27dccbb5/roslaunch-user-HP-Pavilion-15-Notebook-PC-6908.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
while processing /home/user/gym-gazebo/gym_gazebo/envs/installation/catkin_ws/src/turtlebot_simulator/turtlebot_gazebo/launch/includes/kobuki.launch.xml:
Invalid <param> tag: Cannot load command parameter [robot_description]: command [/opt/ros/kinetic/lib/xacro/xacro --inorder '/home/user/gym-gazebo/gym_gazebo/envs/installation/catkin_ws/src/turtlebot/turtlebot_description/robots/kobuki_hexagons_asus_xtion_pro.urdf.xacro'] returned with code [2].
Param xml is <param command="$(arg urdf_file)" name="robot_description"/>
The traceback for the exception was written to the log file
And the kobuki.launch.xml :
<launch>
<arg name="base" />
<arg name="stacks" />
<arg name="3d_sensor" />
<arg name="urdf_file" default="$(find xacro)/xacro --inorder '$(find turtlebot_description)/robots/$(arg base)_$(arg stacks)_$(arg 3d_sensor).urdf.xacro'" />
<param name="robot_description" command="$(arg urdf_file)" />
<!-- Gazebo model spawner -->
<node name="spawn_turtlebot_model" pkg="gazebo_ros" type="spawn_model" args="$(optenv ROBOT_INITIAL_POSE) -unpause -urdf -param robot_description -model mobile_base" />
<!-- Velocity muxer -->
<node pkg="nodelet" type="nodelet" name="mobile_base_nodelet_manager" args="manager" />
<node pkg="nodelet" type="nodelet" name="cmd_vel_mux" args="load yocs_cmd_vel_mux/CmdVelMuxNodelet mobile_base_nodelet_manager">
<param name="yaml_cfg_file" value="$(find turtlebot_bringup)/param/mux.yaml" />
<remap from="cmd_vel_mux/output" to="mobile_base/commands/velocity" />
</node>
<!-- Bumper/cliff to pointcloud (not working, as it needs sensors/core messages) -->
<include file="$(find turtlebot_bringup)/launch/includes/kobuki/bumper2pc.launch.xml" />
</launch>
This is what I get after run xacro --inorder /home/user/gym-gazebo/gym_gazebo/envs/installation/catkin_ws/src/turtlebot/turtlebot_description/robots/kobuki_hexagons_asus_xtion_pro.urdf.xacro
option --inorder not recognized
Usage: xacro.py [-o <output>] <input>
xacro.py --deps Prints dependencies
xacro.py --includes Only evalutes includes
I'm still new with ROS. Did I miss something?
The Error Your Getting From Xacro Is Actually From A --inorder tag Which Is Mostly Used In ROS Indigo(To My best of knowledge) And I Don't Think U Need It In ROS Kinetic (But I'm Not Sure Cause I'm Still On Indigo Myself) I Suggest U Try It Without The --inorder Argument And If U ran Into Problems Try Replacing it With -i As Said In The xacro Changelog In Their Github
source /opt/ros/kinetic/setup.bash
The above command solved the issue for me.
The error says cannot load command parameter [robot_description] from
/opt/ros/kinetic/lib/xacro/xacro --inorder '/home/user/gym-gazebo/gym_gazebo/envs/installation/catkin_ws/src/turtlebot/turtlebot_description/robots/kobuki_hexagons_asus_xtion_pro.urdf.xacro'
The problem you're seeing is because of the single quote characters in the command line of the xacro file. Line 6 is where param name is given as robot description, and it isnt getting loaded as urdf path hasn't been read properly in the previous line because of the single quotes. In order to load the file remove the single quotes in line 5.
Change line 5 which is
<arg name="urdf_file" default="$(find xacro)/xacro --inorder '$(find turtlebot_description)/robots/$(arg base)_$(arg stacks)_$(arg 3d_sensor).urdf.xacro'" />
to the following
<arg name="urdf_file" default="$(find xacro)/xacro --inorder $(find turtlebot_description)/robots/$(arg base)_$(arg stacks)_$(arg 3d_sensor).urdf.xacro" />
The xml file should look like
<launch>
<arg name="base" />
<arg name="stacks" />
<arg name="3d_sensor" />
<arg name="urdf_file" default="$(find xacro)/xacro --inorder $(find turtlebot_description)/robots/$(arg base)_$(arg stacks)_$(arg 3d_sensor).urdf.xacro" />
<param name="robot_description" command="$(arg urdf_file)" />
<!-- Gazebo model spawner -->
<node name="spawn_turtlebot_model" pkg="gazebo_ros" type="spawn_model" args="$(optenv ROBOT_INITIAL_POSE) -unpause -urdf -param robot_description -model mobile_base" />
<!-- Velocity muxer -->
<node pkg="nodelet" type="nodelet" name="mobile_base_nodelet_manager" args="manager" />
<node pkg="nodelet" type="nodelet" name="cmd_vel_mux" args="load yocs_cmd_vel_mux/CmdVelMuxNodelet mobile_base_nodelet_manager">
<param name="yaml_cfg_file" value="$(find turtlebot_bringup)/param/mux.yaml" />
<remap from="cmd_vel_mux/output" to="mobile_base/commands/velocity" />
</node>
<!-- Bumper/cliff to pointcloud (not working, as it needs sensors/core messages) -->
<include file="$(find turtlebot_bringup)/launch/includes/kobuki/bumper2pc.launch.xml" />
</launch>

ROS Kinetic, How to pass a parameter from a launch file to the xacro file

I'm trying to pass values from the launch file to the xacro model, so I can, for example, launch two robots in a single world but using different topic names or material colors. Is there a way to do this?
I've tried this unsuccessfully: https://answers.ros.org/question/38956/pass-parameters-to-xacro-in-launch-file/
It gives an error: xxx.launch requires the 'ns' arg to be set.
I also see this here: http://wiki.ros.org/roslaunch/XML/arg But that only shows how to send parameters from one launch file to another.
Here is my launch file:
<launch>
<!-- these are the arguments you can pass this launch file, for example paused:=true -->
<arg name="paused" default="false"/>
<arg name="use_sim_time" default="true"/>
<arg name="gui" default="true"/>
<arg name="headless" default="false"/>
<arg name="debug" default="false"/>
<arg name="ctopic" default="/stupid/test" />
<!-- Load the URDF into the ROS Parameter Server -->
<param name="robot_description"
command="$(find xacro)/xacro.py '$(find mybot_description)/urdf/mybot.xacro' ctopic:=$(arg ns) "/>
<!-- We resume the logic in empty_world.launch, changing only the name of the world to be launched -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="$(find mybot_gazebo)/worlds/mybot.world"/>
<arg name="debug" value="$(arg debug)" />
<arg name="gui" value="$(arg gui)" />
<arg name="paused" value="$(arg paused)"/>
<arg name="use_sim_time" value="$(arg use_sim_time)"/>
<arg name="headless" value="$(arg headless)"/>
</include>
<!-- Run a python script to the send a service call to gazebo_ros to spawn a URDF robot -->
<node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen"
args="-urdf -model mybot -param robot_description"/>
<!-- Run RVIZ
<node name="$(anon rviz)" pkg="rviz" type="rviz" args="$(find mybot_gazebo)/mybot.rviz" output="screen"/>-->
<!-- ros_control mybot launch file -->
<include file="$(find mybot_control)/launch/mybot_control.launch" />
</launch>
I've tried this in my xacro file:
$(arg ctopic)
and
<xacro:property name="ctopic" value="$(arg ctopic)" />
Thanks

ROS rtabmap does not create point cloud

I've started to built a stereo camera system to reconstruct the field of view. I use two Logitech C270 webcameras on a base stand to get the image streams.
For the project it's necessary to hold the camera optics as close as I can, so I've turned one camera vertically. I use video_stream_opencv package to get and rotate the images and also to send them to the other nodes.
Because of the further operations and to save some hardware resources, I thought it's necessary to synchronize the images' and camera info's timestamps before calibration, rectification etc., so I've created a synchronization node which uses approximate synchronization between the image frames and camera info messages, and it also republishes the data with the same timestamps.
I thought that after the synchronization won't be necessary to use the approx_sync, but I think I was wrong.
To test the system I also started to use a static tf publisher.
Unfortunately I couldn't get point cloud from the system, but in the terminal a warning message appears frequently:
[ WARN] [1506963490.361523551]: odometry: Could not get transform from base_link to left (stamp=1506963490.228821) after 0.100000 seconds ("wait_for_transform_duration"=0.100000)! Error=". canTransform returned after 0.102307 timeout was 0.1."
Here is my launch file:
<launch>
<!--*******************************************************************************************-->
<!-- Global parameters ************************************************************************-->
<!--*******************************************************************************************-->
<!-- Camera -->
<arg name="fps" default="25" />
<!-- Synchronization -->
<arg name="syncronizer_namespace" default="/syncronizer" />
<arg name="left_camera_raw" default="$(arg syncronizer_namespace)/left" />
<arg name="right_camera_raw" default="$(arg syncronizer_namespace)/right" />
<arg name="left_camera_info_topic" default="$(arg syncronizer_namespace)/left/camera_info" />
<arg name="right_camera_info_topic" default="$(arg syncronizer_namespace)/right/camera_info" />
<!-- Stereo -->
<arg name="stereo_namespace" default="/stereo_camera" />
<arg name="left_image_topic" default="$(arg stereo_namespace)/left/image_rect" />
<arg name="right_image_topic" default="$(arg stereo_namespace)/right/image_rect" />
<arg name="approx_sync" default="true" />
<arg name="queue_size" default="5" />
<!-- Tranfsorm -->
<arg name="use_static_transform" default="true" />
<!-- Visual SLAM -->
<arg name="frame_id" default="base_link" />
<!-- Fixed frame id, set "base_link" or "base_footprint" if they are published -->
<arg name="rtabmap" default="true" />
<arg name="odometry" default="true" />
<!-- Odometry -->
<arg name="odom_frame_id" default="odom" />
<!-- If set, TF is used to get odometry instead of the topic -->
<arg name="ground_truth_frame_id" default="" />
<!-- e.g., "world" -->
<arg name="ground_truth_base_frame_id" default="" />
<!-- e.g., "tracker", a fake frame matching the frame "frame_id" (but on different TF tree) -->
<arg name="wait_for_transform" default="true" />
<arg name="wait_for_transform_duration" default="0.2" />
<!-- 3D visualization -->
<arg name="rviz" default="false" />
<arg name="rtabmapviz" default="true" />
<arg name="camera_info" default="camera_info" />
<!--*******************************************************************************************-->
<!-- Core functionality ***********************************************************************-->
<!--*******************************************************************************************-->
<!-- Camera -->
<group ns="/camera">
<node pkg="nodelet" type="nodelet" name="stereo_camera_nodelet" args="manager" />
<!-- Left video stream input -->
<include file="$(find video_stream_opencv)/launch/camera.launch">
<arg name="camera_name" value="left" />
<arg name="camera_info_url" value="file:///$(find reconstruction)/config/left.yaml" />
<arg name="video_stream_provider" value="1" />
<arg name="flip_horizontal" value="false" />
<arg name="flip_vertical" value="false" />
<arg name="fps" value="$(arg fps)" />
</include>
<!-- Right video stream input -->
<include file="$(find video_stream_opencv)/launch/camera.launch">
<arg name="camera_name" value="right" />
<arg name="camera_info_url" value="file:///$(find reconstruction)/config/right.yaml" />
<arg name="video_stream_provider" value="2" />
<arg name="flip_horizontal" value="false" />
<arg name="flip_vertical" value="true" />
<arg name="fps" value="$(arg fps)" />
</include>
</group>
<!-- Syncronizer -->
<node name="syncronizer" pkg="reconstruction" type="syncronizer" />
<!-- Stereo processing -->
<group ns="/stereo_camera">
<node pkg="nodelet" type="nodelet" name="stereo_nodelet" args="manager" />
<node pkg="stereo_image_proc" type="stereo_image_proc" name="stereo_image_proc">
<remap from="left/image_raw" to="$(arg left_camera_raw)" />
<remap from="right/image_raw" to="$(arg right_camera_raw)" />
<remap from="left/camera_info" to="$(arg left_camera_info_topic)" />
<remap from="right/camera_info" to="$(arg right_camera_info_topic)" />
<param name="prefilter_size" value="35" />
<param name="prefilter_cap" value="11" />
<param name="correlation_window_size" value="41" />
<param name="min_disparity" value="-15" />
<param name="disparity_range" value="160" />
<param name="uniqueness_ratio" value="0.0" />
<param name="texture_threshold" value="1000" />
<param name="speckle_size" value="500" />
<param name="speckle_range" value="16" />
<param name="approximate_sync" value="true" />
<param name="queue_size" value="5" />
</node>
</group>
<!-- Transform -->
<node if="$(arg use_static_transform)" pkg="tf" type="static_transform_publisher" name="world_to_map" args="0.0 0.0 0.30 0.0 0.0 0.0 /base_link /camera_link 100" />
<group ns="rtabmap">
<!-- Stereo Odometry -->
<node if="$(arg odometry)" pkg="rtabmap_ros" type="stereo_odometry" name="stereo_odometry" output="screen">
<remap from="left/image_rect" to="$(arg left_image_topic)" />
<remap from="right/image_rect" to="$(arg right_image_topic)" />
<remap from="left/camera_info" to="$(arg left_camera_info_topic)" />
<remap from="right/camera_info" to="$(arg right_camera_info_topic)" />
<param name="approx_sync" type="bool" value="$(arg approx_sync)" />
<param name="frame_id" type="string" value="$(arg frame_id)" />
<param name="odom_frame_id" type="string" value="odom" />
<param name="queue_size" type="int" value="5" />
</node>
<!-- Visual SLAM: args: "delete_db_on_start" and "udebug" -->
<node if="$(arg rtabmap)" name="rtabmap" pkg="rtabmap_ros" type="rtabmap" output="screen" args="--delete_db_on_start --udebug">
<remap from="left/image_rect" to="$(arg left_image_topic)" />
<remap from="right/image_rect" to="$(arg right_image_topic)" />
<remap from="left/camera_info" to="$(arg left_camera_info_topic)" />
<remap from="right/camera_info" to="$(arg right_camera_info_topic)" />
<remap from="odom" to="/rtabmap/odom" />
<param name="approx_sync" type="bool" value="$(arg approx_sync)" />
<param name="frame_id" type="string" value="$(arg frame_id)" />
<param name="queue_size" type="int" value="30" />
<param name="subscribe_stereo" type="bool" value="true" />
<param name="subscribe_depth" type="bool" value="false" />
</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">
<remap from="left/image_rect" to="$(arg left_image_topic)" />
<remap from="right/image_rect" to="$(arg right_image_topic)" />
<remap from="left/camera_info" to="$(arg left_camera_info_topic)" />
<remap from="right/camera_info" to="$(arg right_camera_info_topic)" />
<remap from="odom_info" to="/rtabmap/odom_info" />
<remap from="odom" to="/rtabmap/odom" />
<param name="frame_id" type="string" value="$(arg frame_id)" />
<param name="queue_size" type="int" value="10" />
<param name="subscribe_stereo" type="bool" value="true" />
<param name="subscribe_odom_info" type="bool" value="true" />
</node>
</group>
</launch>
I also created a rqt graph to understand the connections between the nodes:
rqt_graph
And it's also helpful if we see the tf frames:
tf frames
I hope I said everything to find out what did I wrong, I'm really disapointed because of this problem.
Ok, we found out what was the problem.
As the error is saying, odometry cannot transform frame left to frame base_link. You may want to add a static transform between camera_link and left as this:
<arg name="pi/2" value="1.5707963267948966" />
<node if="$(arg use_static_transform)" pkg="tf" type="static_transform_publisher" name="camera_optical" args="0 0 0 -$(arg pi/2) 0 -$(arg pi/2) /camera_link /left 100" />
... so you have base_link -> camera_link -> left.
Note that you don't need to pre-synchronize as stereo_odometry and rtabmap nodes can do it directly with approx_sync:=true. But yes, if you pre-syncrhonize and set the same timestamp on all image/camera_info topics, you can use approx_sync:=false for odometry and rtabmap. If you have poor results after that, it may be caused by bad stereo rectification and/or synchronization.
I strongly suggest that you get a real stereo camera that does stereo hardware (not software!) synchronization to get good results when the robot is moving.
cheers,
Mathieu

Resources