ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

param robot_description not found by searchParam()

asked 2019-11-07 09:08:31 -0600

davidem gravatar image

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 ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2019-11-07 09:17:45 -0600

gvdhoorn gravatar image

What happens is that Rviz warns me that RobotModel can't be shown because the parameter robot_description doesn't seem to exist.

It doesn't, does it? There's only robot_1/robot_description and robot_2/robot_description.

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 robot sensors.

The error RViz returns to you is (most likely) not about TF, but about the actual parameter.

Moreover, running rosparam list shows that both the robot_descriptions parameters exist under their respective namespaces, being robot_1 and robot_2, and they are non-null, being in fact the XML representation of the robot.

Yes, but again: there is no robot_description in the global namespace, only in the robot_1 and robot_2 namespaces.

The last .launch file you show appears to start rviz in the global namespace, which is where RViz will look for robot_description. It won't look in any child namespaces.

You can probably make things work by configuring the RobotModel display with the robot_1 or robot_2 namespaces. That would allow you to visualise a single robot model. For multiple robots, you'd add multiple RobotModel displays, each with their own parameter configured.

edit flag offensive delete link more

Comments

Hi, thanks for your reply. I have tried to edit the TF Prefix option of RobotModel in Rviz, but it still doesn't work. Is it what you meant? Otherwise I don't see any other way to load the model from the aforementioned namespaces

davidem gravatar image davidem  ( 2019-11-07 09:24:30 -0600 )edit
1

I have tried to edit the TF Prefix option of RobotModel in Rviz, but it still doesn't work. Is it what you meant?

No, that's not what I meant.

The RobotModel display allows you to configure the name of the parameter from which it should read the URDF. That is where you'll need to add the prefix.

So you'll have two RobotModels: one with robot_1/robot_description as the parameter name, and one with robot_2/robot_description.

You will need to make sure to also add the TF Prefix to each I believe. But TF (with or without a prefix) is not involved in loading the model. It only comes into play after things have been loaded, to give the model its pose.

gvdhoorn gravatar image gvdhoorn  ( 2019-11-07 10:38:07 -0600 )edit

Thanks, I thought one of the two would have made the job, while instead you need to set Rviz's parameter Robot description to robot_NUM/robot_descriptionand also the respective TF Prefix

davidem gravatar image davidem  ( 2019-11-08 07:55:27 -0600 )edit

Yes.

The former tells the display where it can find the robot_description parameter.

The latter helps it find the correct transforms.

As I wrote earlier: they are both needed, but completely separate.

gvdhoorn gravatar image gvdhoorn  ( 2019-11-08 07:59:32 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2019-11-07 09:08:31 -0600

Seen: 4,699 times

Last updated: Nov 07 '19