param robot_description not found by searchParam()
I am running ROS Melodic and I'm trying to create a launch file to run multiple Turtlebot3 that share a map. I have created a one_robot.launch
file that launches a single robot, it looks like this:
<launch>
<arg name="model" default="$(env TURTLEBOT3_MODEL)" />
<!-- @ REQUIRED @ -->
<arg name="robot_name" />
<arg name="x_pos" />
<arg name="y_pos" />
<arg name="z_pos" />
<param name="robot_description" command="$(find xacro)/xacro '$(find turtlebot3_description)/urdf/turtlebot3_$(arg model).urdf.xacro' prefix:=$(arg multi_robot_name)" />
<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher">
<param name="publish_frequency" type="double" value="50.0" />
<param name="tf_prefix" value="$(arg multi_robot_name)"/>
</node>
<!--spawner-->
<node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model"
args="-urdf -model $(arg robot_name) -x $(arg x_pos) -y $(arg y_pos) -z $(arg z_pos)
-param /$(arg robot_name)/robot_description"
/>
<!--AMCL -->
<node pkg="amcl" type="amcl" name="amcl" args="scan:=scan">
<remap from="static_map" to="/static_map"/>
<param name="initial_pose_x" value="$(arg x_pos)" />
<param name="initial_pose_y" value="$(arg y_pos)" />
<param name="global_frame_id" value="map" />
<param name="odom_frame_id" value="$(arg robot_name)/odom" />
<param name="base_frame_id" value="$(arg robot_name)/base_link" />
</node>
</launch>
I then run two istances of this file in startup.launch
, which is:
<launch>
<arg name="model" default="$(env TURTLEBOT3_MODEL)" />
<arg name="robot_1" value="robot_1" />
<arg name="robot_2" value="robot_2" />
<arg name="gazebo_gui" default="false" /> <!-- ACTIVATE GAZEBO GUI -->
<!-- GAZEBO -->
<include file="$(find learning_multirobot)/launch/includes/main_gazebo.launch">
<arg name="world_name" value="$(find learning_multirobot)/worlds/turtlebot3_house.world"/>
<arg name="paused" value="false"/>
<arg name="use_sim_time" value="true"/>
<arg name="gui" value="$(arg gazebo_gui)"/>
<arg name="headless" value="false"/>
<arg name="debug" value="false"/>
</include>
<!-- map server -->
<node pkg="map_server" type="map_server" name="map_loader" args="$(find learning_navigation)/maps/mymap.yaml" />
<!--robot 1-->
<group ns="$(arg robot_1)">
<include file="$(find learning_multirobot)/launch/one_robot.launch">
<arg name="robot_name" value="$(arg robot_1)" />
<arg name="x_pos" value="0" />
<arg name="y_pos" value="0" />
<arg name="z_pos" value="0" />
</include>
</group>
<!--robot 2-->
<group ns="$(arg robot_2)">
<include file="$(find learning_multirobot)/launch/one_robot.launch">
<arg name="robot_name" value="$(arg robot_2)" />
<arg name="x_pos" value="-3" />
<arg name="y_pos" value="1" />
<arg name="z_pos" value="0" />
</include>
</group>
<!-- RVIZ -->
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find learning_multirobot)/rviz/complete_config.rviz"/>
</launch>
What happens is that Rviz warns me that RobotModel
can't be shown because the parameter robot_description
doesn't seem to exist.
I checked if the TF tree was correct, and in fact it is: I won't post it because it would make this question too long, but from the /map
root frame there are two tfs to robot_1/odom
and robot_2/odom
, which are then connected to their respective base_link
and all the ...