Move_base namespace issue with multi robot simulation
Hey All,
I'm trying to setup a simulation that has multiple turlebot3s running with movebase in a gazebo environment. I'm able to get 1 working just fine but when I try to scale up to multiple robots I run into issues with movebase not working when launched from withing a namespace. The robots will spawn just fine but move_base will continuously publish the following warning:
Timed out waiting for transform from basefootprint to map to become available before running costmap, tf error: canTransform: sourceframe base_footprint does not exist.. canTransform returned after 0.101 timeout was 0.1.
I've messed with a bunch of different things and originally followed this ([https://answers.ros.org/question/41433/multiple-robots-simulation-and-navigation/]) answer but haven't been able to make any progress.
Unfortunately I don't have enough points to upload the image of my tf tree but there is the following connection
[map] ----(tb30/amcl)-----> [tb30/odom] ------(gazebo)----->[tb30/basefootprint]-------(tb30/robotstatepublisher)---->[tb30/base_link]
This makes is seem like there is definitely a transform between the basefootprint and the map but for some reason movebase can't use it. However, the transform from basefootprint to baselin only appears to be published once at the very beginning and never again which could cause problems.
Here is the launch file I'm using to try to launch everything. I changed it to one turtlebot3 to try to get move_base launching from within a namespace launching correctly first.
<launch>
<arg name="model" default="$(env TURTLEBOT3_MODEL)" doc="model type [burger, waffle, waffle_pi]"/>
<arg name="first_tb3" default="tb3_0"/>
<arg name="second_tb3" default="tb3_1"/>
<arg name="third_tb3" default="tb3_2"/>
<arg name="first_tb3_x_pos" default="-2.0"/>
<arg name="first_tb3_y_pos" default="-1.0"/>
<arg name="first_tb3_z_pos" default=" 0.0"/>
<arg name="first_tb3_yaw" default=" 0.0"/>
<arg name="map_file" default="$(find multi_robot_plan)/map/turtle_arena_map.yaml"/>
<arg name="move_forward_only" default="false"/>
<arg name="cmd_vel_topic" default="/cmd_vel" />
<arg name="odom_topic" default="odom" />
<param name="robot_description" command="$(find xacro)/xacro --inorder $(find turtlebot3_description)/urdf/turtlebot3_$(arg model).urdf.xacro" />
<!-- Gazebo world -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="world_name" value="$(find turtlebot3_gazebo)/worlds/turtlebot3_world.world"/>
<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"/>
</include>
<!-- Map server -->
<node pkg="map_server" name="map_server" type="map_server" args="$(arg map_file)">
<param name="frame_id" value="/map"/>
</node>
<!-- First robot -->
<group ns = "$(arg first_tb3)">
<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" output="screen">
<param name="publish_frequency" type="double" value="50.0" />
<param name="tf_prefix" value="$(arg first_tb3)" />
</node>
<node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" args="-urdf -model $(arg first_tb3) -x $(arg first_tb3_x_pos) -y $(arg first_tb3_y_pos) -z $(arg first_tb3_z_pos) -Y $(arg first_tb3_yaw) -param /robot_description" />
<!-- AMCL -->
<include file="$(find turtlebot3_navigation)/launch/amcl.launch">
<arg name="ns" value="$(arg first_tb3)"/>
<arg name="initial_pose_x" value="$(first_tb3_x_pos"/>
<arg name="initial_pose_y" value="$(first_tb3_y_pos"/>
<arg name="initial_pose_a" value="$(first_tb3_yaw"/>
</include>
<!-- move_base -->
<!-- <include file="$(find turtlebot3_navigation)/launch/move_base.launch">
<arg name="model" value="$(arg model)" />
<arg name="move_forward_only" value="$(arg move_forward_only)"/>
<remap from="map" to="/map" />
</include> -->
<!-- move_base -->
<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
<param name="base_local_planner" value="dwa_local_planner/DWAPlannerROS" />
<rosparam file="$(find turtlebot3_navigation)/param/costmap_common_params_$(arg model).yaml" command="load" ns="global_costmap" />
<rosparam file="$(find turtlebot3_navigation)/param/costmap_common_params_$(arg model).yaml" command="load" ns="local_costmap" />
<rosparam file="$(find turtlebot3_navigation)/param/local_costmap_params.yaml" command="load" />
<rosparam file="$(find turtlebot3_navigation)/param/global_costmap_params.yaml" command="load" />
<rosparam file="$(find turtlebot3_navigation)/param/move_base_params.yaml" command="load" />
<rosparam file="$(find turtlebot3_navigation)/param/dwa_local_planner_params_$(arg model).yaml" command="load" />
<!-- <remap from="cmd_vel" to="$(arg first_tb3)/cmd_vel"/> -->
<!-- <remap from="odom" to="$(arg first_tb3)/odom"/> -->
<param name="DWAPlannerROS/min_vel_x" value="0.0" if="$(arg move_forward_only)" />
<remap from="map" to="/map" />
</node>
</group>
<!-- Rviz -->
<node pkg="rviz" type="rviz" name="rviz" required="true" args="-d $(find multi_robot_plan)/rviz/test.rviz"/>
Any help would be greatly appreciated!!
Asked by roshea6 on 2020-03-19 23:05:53 UTC
Answers
The reason for this is probably the fact, that the move_base node is looking for base_footprint
in the global namespace. My solution for this was to overwrite the parameters in the yaml
files you load in via rosparam
with params
:
<group ns="$(arg robot_name)">
<param name="tf_prefix" value="$(arg robot_name)" />
<!-- Other stuff like loading in the model etc. -->
<node pkg="fake_localization" type="fake_localization" name="fake_localization" respawn="false" output="screen">
<param name="odom_frame_id" value="$(arg robot_name)/odom" />
<param name="base_frame_id" value="$(arg robot_name)/base_footprint" />
<remap from="base_pose_ground_truth" to="/$(arg robot_name)/odom"/>
<param name="global_frame_id" value="/map"/>
</node>
<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
<param name="base_local_planner" value="dwa_local_planner/DWAPlannerROS" />
<rosparam file="$(find [package_name])/param/costmap_common_params_$(arg model).yaml" command="load" ns="global_costmap" />
<rosparam file="$(find [package_name])/param/costmap_common_params_$(arg model).yaml" command="load" ns="local_costmap" />
<rosparam file="$(find [package_name])/param/local_costmap_params.yaml" command="load" />
<rosparam file="$(find [package_name])/param/global_costmap_params.yaml" command="load" />
<rosparam file="$(find [package_name])/param/move_base_params.yaml" command="load" />
<rosparam file="$(find [package_name])/param/dwa_local_planner_params_$(arg model).yaml" command="load" />
<param name="controller_frequency" value="10.0" />
<param name="global_costmap/robot_base_frame" value="$(arg robot_name)/base_footprint"/>
<param name="local_costmap/robot_base_frame" value="$(arg robot_name)/base_footprint"/>
<param name="local_costmap/global_frame" value="$(arg robot_name)/odom"/>
<remap from="map" to="/map" />
</node>
</group>
where the argument with name robot_name
is the name of the robot.
Hope that helps :)
Asked by Julian98 on 2020-07-26 00:02:11 UTC
Comments
This helped to remove the following error:
Timed out waiting for transform from base_footprint to map to become available before running costmap, tf error: canTransform: source_frame base_footprint does not exist.. canTransform returned after 0.101 timeout was 0.1.
But now, when I set 2D Nav Goal for one of the turtlebot3s, it goes through the following steps:
1. Stays at [ INFO] [1676963896.349457803, 595.862000000]: Got new plan
for a few seconds
2. Then goes to [ WARN] [1676963893.612169307, 594.362000000]: Clearing both costmaps to unstuck robot (3.00m).
3. Then goes to [ WARN] [1676963911.590496967, 604.563000000]: Rotate recovery behavior started.
and gets stuck
None of the 3 turtlebot3s are showing any kind of motion in gazebo. Please help. @Julian98 @jayess
Asked by hunterlineage1 on 2023-02-21 02:22:32 UTC
Comments