0
$\begingroup$

Rosanswers logo

Please help.

Very few times the gazebo opens with the loaded model, almost 99 times it fails with the below error.

After searching for one day in all forums I tried the following, so far no luck :(

  1. runnning verbose:=true
  2. running rosrun gzclient and then the launch file
  3. making sure box size is not zero in model description file
  4. transmission type properly mentioned in model description file
  5. gazebo ros control plugin installed and mentioned in model file
  6. gazebo ros control plugin installed (please note that i was able to run the same launch before, suddenly this error is coming up)
  7. checked namesapce

Launch file:

<?xml version="1.0" encoding="UTF-8"?>
<launch>

    <arg name="world" default="empty"/> 
    <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="x" default="0"/>
    <arg name="y" default="0"/>
    <arg name="x1" default="0"/>
    <arg name="y1" default="0"/>
    <arg name="z" default="0"/>
    <arg name="roll" default="0"/>
    <arg name="pitch" default="0"/>
    <arg name="yaw" default="0"/>

    <arg name="initial_pose_x" default="0"/>
    <arg name="initial_pose_y" default="0"/>
    <arg name="initial_pose_a" default="0.0"/>
    <arg name="take_break" default="5.0"/>
    <arg name="world_name" default="$(find robot_gazebo)/worlds/world_2.world" />

    <arg name="ns_1" default="first_pelican" />

    <include file="$(find gazebo_ros)/launch/empty_world.launch">
        <arg name="world_name" value="$(arg world_name)"/>
        <arg name="paused" value="$(arg paused)"/>
        <arg name="use_sim_time" value="$(arg use_sim_time)"/>
        <arg name="gui" value="$(arg gui)"/>
        <arg name="headless" value="$(arg headless)"/>
        <arg name="debug" value="$(arg debug)"/>
    </include>

    
    <group ns="$(arg ns_1)">
        <param name="robot_description" command="$(find xacro)/xacro.py '$(find robot_description)/urdf/robot.xacro' namesapce_deploy:=$(arg ns_1)"/>
    
        <node name="mybot_spawn" pkg="gazebo_ros" type="spawn_model" output="screen"
        args="-urdf -param robot_description -model mybot_$(arg ns_1)
                    -x $(arg x) -y $(arg y) -z $(arg z)
                    -R $(arg roll) -P $(arg pitch) -Y $(arg yaw)" respawn="false" />

        <!-- Load joint controller configurations from YAML file to parameter server -->
        <rosparam file="$(find robot_gazebo)/config/robot_control.yaml" command="load"/>

        <!-- load the controllers -->
        <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
        output="screen" ns="/$(arg ns_1)" args="joint_state_controller joint1_position_controller"/>
                            
        <!-- convert joint states to TF transforms for rviz, etc -->
        <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" respawn="false" output="screen">
            <remap from="/joint_states" to="/$(arg ns_1)/joint_states" />
        </node>

        <!--  ************** Red circle image detection  ***************  -->
        <node name="image_processing_node" pkg="image_processing" type="image_processing_node" output="screen">
            <param name="namesapce_deploy" value="$(arg ns_1)"/>
        </node>

        <!--  ************** Navigation  ***************  -->
        <node name="smart_exploration" type="smart_exploration" pkg="robot_exploration" output="screen">
            <param name="dist_x" value="$(arg x)"/>
            <param name="dist_y" value="$(arg y)"/>
            <param name="namesapce_deploy" value="$(arg ns_1)"/>
        </node>
        
    </group>

</launch>

Trace:

balaji@balaji:~/Documents/balaji/unl/Media/Downloads/robot_ws_final$ source devel/setup.bash 
balaji@balaji:~/Documents/balaji/unl/Media/Downloads/robot_ws_final$ roslaunch robot_gazebo robot_world.launch 
... logging to /home/balaji/.ros/log/e78e4fbc-7f83-11e7-9f51-9801a7b07983/roslaunch-balaji-31825.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
WARNING: disk usage in log directory [/home/balaji/.ros/log] is over 1GB.
It's recommended that you use the 'rosclean' command.

xacro: Traditional processing is deprecated. Switch to --inorder processing!
To check for compatibility of your document, use option --check-order.
For more infos, see http://wiki.ros.org/xacro#Processing_Order
started roslaunch server http://balaji:45487/

SUMMARY
========

PARAMETERS
 * /first_pelican/image_processing_node/namesapce_deploy: first_pelican
 * /first_pelican/joint1_position_controller/joint: palm_riser
 * /first_pelican/joint1_position_controller/pid/d: 10.0
 * /first_pelican/joint1_position_controller/pid/i: 0.01
 * /first_pelican/joint1_position_controller/pid/p: 100.0
 * /first_pelican/joint1_position_controller/type: effort_controller...
 * /first_pelican/joint_state_controller/publish_rate: 100
 * /first_pelican/joint_state_controller/type: joint_state_contr...
 * /first_pelican/robot_description: <?xml version="1....
 * /first_pelican/smart_exploration/dist_x: 0
 * /first_pelican/smart_exploration/dist_y: 0
 * /first_pelican/smart_exploration/namesapce_deploy: first_pelican
 * /rosdistro: kinetic
 * /rosversion: 1.12.7
 * /use_sim_time: True

NODES
  /first_pelican/
    controller_spawner (controller_manager/spawner)
    image_processing_node (image_processing/image_processing_node)
    mybot_spawn (gazebo_ros/spawn_model)
    robot_state_publisher (robot_state_publisher/robot_state_publisher)
    smart_exploration (robot_exploration/smart_exploration)
  /
    gazebo (gazebo_ros/gzserver)
    gazebo_gui (gazebo_ros/gzclient)

auto-starting new master
process[master]: started with pid [31839]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to e78e4fbc-7f83-11e7-9f51-9801a7b07983
process[rosout-1]: started with pid [31852]
started core service [/rosout]
process[gazebo-2]: started with pid [31864]
process[gazebo_gui-3]: started with pid [31879]
process[first_pelican/mybot_spawn-4]: started with pid [31886]
process[first_pelican/controller_spawner-5]: started with pid [31887]
process[first_pelican/robot_state_publisher-6]: started with pid [31888]
process[first_pelican/image_processing_node-7]: started with pid [31889]
process[first_pelican/smart_exploration-8]: started with pid [31890]
[ WARN] [1502559016.978709697]: The root link chassis has an inertia specified in the URDF, but KDL does not support a root link with an inertia.  As a workaround, you can add an extra dummy link to your URDF.
[ INFO] [1502559016.986332012]: Got param: 0.000000
[ INFO] [1502559016.995995700]: Got param: 0.000000
[ INFO] [1502559016.999604731]: Got param: first_pelican
[ INFO] [1502559017.008884277]: In image_converter, got param: first_pelican
SpawnModel script started
[INFO] [1502559017.185603, 0.000000]: Loading model XML from ros parameter
[INFO] [1502559017.190666, 0.000000]: Waiting for service /gazebo/spawn_urdf_model
[ INFO] [1502559017.208092409]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1502559017.209366293]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...
[INFO] [1502559017.386893, 0.000000]: Controller Spawner: Waiting for service controller_manager/load_controller
[ INFO] [1502559017.566665686, 246.206000000]: waitForService: Service [/gazebo/set_physics_properties] is now available.
[ INFO] [1502559017.611486634, 246.249000000]: Physics dynamic reconfigure ready.
[INFO] [1502559017.795112, 246.428000]: Calling service /gazebo/spawn_urdf_model
[ INFO] [1502559018.103326226, 246.494000000]: Camera Plugin: Using the 'robotNamespace' param: '/first_pelican/'
[ INFO] [1502559018.107184854, 246.494000000]: Camera Plugin (ns = /first_pelican/)  <tf_prefix_>, set to "/first_pelican"
[ INFO] [1502559018.628739638, 246.494000000]: Laser Plugin: Using the 'robotNamespace' param: '/first_pelican/'
[ INFO] [1502559018.628941833, 246.494000000]: Starting Laser Plugin (ns = /first_pelican/)
[ INFO] [1502559018.630496093, 246.494000000]: Laser Plugin (ns = /first_pelican/)  <tf_prefix_>, set to "/first_pelican"
[INFO] [1502559018.650747, 246.494000]: Spawn status: SpawnModel: Successfully spawned entity
[ INFO] [1502559018.669444812, 246.494000000]: Loading gazebo_ros_control plugin
[ INFO] [1502559018.669578793, 246.494000000]: Starting gazebo_ros_control plugin in namespace: first_pelican
[ INFO] [1502559018.670483364, 246.494000000]: gazebo_ros_control plugin is waiting for model URDF in parameter [/robot_description] on the ROS param server.
[WARN] [1502917332.970083, 246.277000]: Controller Spawner couldn't find the expected controller_manager ROS interface.

Model files in urdf folder:

  1. robot.xacro

This code block was moved to the following github gist: https://gist.github.com/answers-se-migration-openrobotics/576a987d7c64841a0bec25a3d68b41f4

  1. robot.gazebo

     <xacro:arg name="namesapce_deploy" default="/" />
    
    $(arg namesapce_deploy) /robot_description $(arg namesapce_deploy) false true 10 left_wheel_hinge right_wheel_hinge 0.4 0.2 10 cmd_vel odom odom chassis Gazebo/Orange Gazebo/Blue Gazebo/Blue Gazebo/Green 30.0 1.3962634 800 800 R8G8B8 0.02 300 true 0.0 robot/camera1 image_raw camera_info camera 0.07 0.0 0.0 0.0 0.0 0.0 0 0 0 0 0 0 true 40 720 1 -1.570796 1.570796 0.10 30.0 0.01 gaussian 0.0 0.01 laser/scan hokuyo
  2. materials.xacro

After removing inertial element from root link in xacro, below are the new set of trance output:

roslaunch robot_gazebo robot_world.launch
... logging to /home/balaji/.ros/log/48e0f98c-82cb-11e7-80b7-0242aef01aad/roslaunch-balaji-13778.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
WARNING: disk usage in log directory [/home/balaji/.ros/log] is over 1GB.
It's recommended that you use the 'rosclean' command.

started roslaunch server http://balaji:39555/

SUMMARY
========

PARAMETERS
 * /first_pelican/image_processing_node/namesapce_deploy: first_pelican
 * /first_pelican/joint1_position_controller/joint: palm_riser
 * /first_pelican/joint1_position_controller/pid/d: 10.0
 * /first_pelican/joint1_position_controller/pid/i: 0.01
 * /first_pelican/joint1_position_controller/pid/p: 100.0
 * /first_pelican/joint1_position_controller/type: effort_controller...
 * /first_pelican/joint_state_controller/publish_rate: 100
 * /first_pelican/joint_state_controller/type: joint_state_contr...
 * /first_pelican/robot_description: <?xml version="1....
 * /first_pelican/smart_exploration/dist_x: 0
 * /first_pelican/smart_exploration/dist_y: 0
 * /first_pelican/smart_exploration/namesapce_deploy: first_pelican
 * /rosdistro: kinetic
 * /rosversion: 1.12.7
 * /use_sim_time: True

NODES
  /first_pelican/
    controller_spawner (controller_manager/spawner)
    image_processing_node (image_processing/image_processing_node)
    mybot_spawn (gazebo_ros/spawn_model)
    robot_state_publisher (robot_state_publisher/robot_state_publisher)
    smart_exploration (robot_exploration/smart_exploration)
  /
    gazebo (gazebo_ros/gzserver)
    gazebo_gui (gazebo_ros/gzclient)

auto-starting new master
process[master]: started with pid [13792]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 48e0f98c-82cb-11e7-80b7-0242aef01aad
process[rosout-1]: started with pid [13805]
started core service [/rosout]
process[gazebo-2]: started with pid [13819]
process[gazebo_gui-3]: started with pid [13832]
process[first_pelican/mybot_spawn-4]: started with pid [13839]
process[first_pelican/controller_spawner-5]: started with pid [13840]
process[first_pelican/robot_state_publisher-6]: started with pid [13841]
process[first_pelican/image_processing_node-7]: started with pid [13842]
process[first_pelican/smart_exploration-8]: started with pid [13843]
[ INFO] [1502919528.214139132]: Got param: 0.000000
SpawnModel script started
[ INFO] [1502919528.241338494]: Got param: 0.000000
[ INFO] [1502919528.253249867]: Got param: first_pelican
[ INFO] [1502919528.277624421]: In image_converter, got param: first_pelican
[INFO] [1502919528.412530, 0.000000]: Loading model XML from ros parameter
Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/gazebo_ros/spawn_model", line 313, in <module>
    sm.callSpawnService()
  File "/opt/ros/kinetic/lib/gazebo_ros/spawn_model", line 239, in callSpawnService
    model_xml = rospy.get_param(self.param_name)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/client.py", line 465, in get_param
    return _param_server[param_name] #MasterProxy does all the magic for us
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/msproxy.py", line 123, in __getitem__
    raise KeyError(key)
KeyError: '/robot_description'
[ INFO] [1502919528.541984907]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1502919528.543089268]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...
[first_pelican/mybot_spawn-4] process has died [pid 13839, exit code 1, cmd /opt/ros/kinetic/lib/gazebo_ros/spawn_model -urdf -param /robot_description -model mybot_first_pelican -x 0 -y 0 -z 0 -R 0 -P 0 -Y 0 __name:=mybot_spawn __log:=/home/balaji/.ros/log/48e0f98c-82cb-11e7-80b7-0242aef01aad/first_pelican-mybot_spawn-4.log].
log file: /home/balaji/.ros/log/48e0f98c-82cb-11e7-80b7-0242aef01aad/first_pelican-mybot_spawn-4*.log
[INFO] [1502919528.635410, 0.000000]: Controller Spawner: Waiting for service controller_manager/load_controller
[ INFO] [1502919529.226806240, 246.207000000]: waitForService: Service [/gazebo/set_physics_properties] is now available.
[ INFO] [1502919529.284340544, 246.259000000]: Physics dynamic reconfigure ready.
Qt: Cannot set locale modifiers:

Originally posted by balajithevoyager on ROS Answers with karma: 50 on 2017-08-12

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The problem is that gazebo_ros_control is looking for /robot_description, but that hasn't been set. You set /first_pelican/robot_description instead.

The solution is to change

<node name="mybot_spawn" pkg="gazebo_ros" type="spawn_model" output="screen"
    args="-urdf -param robot_description -model mybot_$(arg ns_1)
                -x $(arg x) -y $(arg y) -z $(arg z)
                -R $(arg roll) -P $(arg pitch) -Y $(arg yaw)" respawn="false" />

to

<node name="mybot_spawn" pkg="gazebo_ros" type="spawn_model" output="screen"
    args="-urdf -param /first_pelican/robot_description -model mybot_$(arg ns_1)
                -x $(arg x) -y $(arg y) -z $(arg z)
                -R $(arg roll) -P $(arg pitch) -Y $(arg yaw)" respawn="false" />

Edit:

This warning may be the culprit

The root link chassis has an inertia specified in the URDF, but KDL does not support a root link with an inertia. As a workaround, you can add an extra dummy link to your URDF.

Try adding a dummy link and move the inertia to that one. https://answers.ros.org/question/192817/error-msg-the-root-link_base-has-an-inertia-specified-in-the-urdf-but-kdl/?answer=192861#post-id-192861


Edit 2:

I'm not too familiar with URDF so this may not be exactly the solution but it should be a good starting point:

<link name="chassis_dummy">
  <inertial>
    <mass value="15.0"/>
    <origin xyz="0 0 0" rpy=" 0 0 0"/>
    <inertia
        ixx="0.1" ixy="0" ixz="0"
        iyy="0.1" iyz="0"
        izz="0.1"
    />
  </inertial>
</link>

<joint name="chassis_to_chassis_dummy" type="fixed">
  <parent link="chassis"/>
  <child link="chassis_dummy"/>
</joint>

And remove the inertial tags and everything between them (in the chassis link only!) because I moved it into this dummy link. For additional help refer to the URDF tutorials (which is how I came up with this).


Edit 3:

I was finally able to get your robot to load in Gazebo by setting the robot_description parameter outside of the <group> tags. I then loaded (spawned) the URDF (robot) in Gazebo inside the <group> tags:

<arg name="robot_description"
     default="$(find urdf_test_pkg)/model/robot.xacro"/>
<param name="/robot_description"
   command="$(find xacro)/xacro --inorder $(arg robot_description) namesapce_deploy:=$(arg ns_1)"/>

<group ns="$(arg ns_1)">
    <node name="mybot_spawn" pkg="gazebo_ros" type="spawn_model" output="screen"
    args="-urdf -param /robot_description -model mybot_$(arg ns_1)
                -x $(arg x) -y $(arg y) -z $(arg z)
                -R $(arg roll) -P $(arg pitch) -Y $(arg yaw)" respawn="false" />

    <!-- convert joint states to TF transforms for rviz, etc -->
    <!-- Notice the leading '/' in '/robot_description' -->
    <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" respawn="false" output="screen">
        <remap from="/joint_states" to="/$(arg ns_1)/joint_states" />
    </node>
</group>

Notice when I'm spawning the robot I specifically attach the leading / to /robot_description. This causes the spawner to grab the global parameter /robot_description. This should solve the issue of spawning the robot.


Originally posted by jayess with karma: 6155 on 2017-08-15

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by rmck on 2017-08-16:
There's also a repeated typo that may be affecting it, you've written namesapce rather than namespace

Comment by jayess on 2017-08-16:
@rmck are you referring to me or @balajithevoyager? If you're referring to me I don't see it.

Comment by jayess on 2017-08-16:
@balajithevoyager's use of namesapce seems to be consistent though so that may not be the issue.

Comment by rmck on 2017-08-16:
@jayess, yeah, was referring to the original post.

Comment by balajithevoyager on 2017-08-16:
I have changed /robot_description to /first_pelican/robot_description in the node name of "mybot_spawn", but unfortunately the issue is still present with same message:

gazebo_ros_control plugin is waiting for model URDF in parameter [/robot_description] on the ROS param server.

Comment by balajithevoyager on 2017-08-16:
Thanks Jayess and rmck for helping out, I really aprreciate it. To better understand the issue, I am uploading the model file as well in the question, these are the files that I have in urdf folder

Comment by balajithevoyager on 2017-08-16:
Hi Jayess, I tried to see about the dummy link warning, as per this website https://bitbucket.org/osrf/gazebo/issues/4/failed-to-spawn-urdf-model-in-gazebo-if, I ensured all the links has intertial element but the issue is not resolved. Please let me know what changes need to be done other than this

Comment by jayess on 2017-08-16:
That's a very old issue (2012) and I'm not sure that's it. Did you try creating a dummy link like I said? The problem is that the root link chassis cannot have an inertia. The workaround is to create a dummy one and give that one an inertia.

Comment by balajithevoyager on 2017-08-16:
I cannot find any tutorial on how to create dummy_link and connect the the dummy_link intertia with the root link. Can you please help?

Comment by balajithevoyager on 2017-08-16:
Thanks Jayess, after creating dummy_link the warning has gone but still the model did not load in gazebo

gazebo_ros_control plugin is waiting for model URDF in parameter [/robot_description] on the ROS param server.
Controller Spawner couldn't find the expected controller_manager ROS interf

Comment by jayess on 2017-08-16:
Try loading the URDF in the parameter /robot_description instead of /first_pelican/robot_description.

Comment by balajithevoyager on 2017-08-16:
That is strange, after changing the URDF in launch file, I am getting whole set of new errors. Please find it in the question

Comment by rmck on 2017-08-16:
I had a very similar error yesterday which turned out to be linking to the wrong yaml config file, it couldn't find my controller parameters. I'd suggest simplifying the various files as much as possible and testing. If it works, add bits back in until something breaks.

Comment by balajithevoyager on 2017-08-16:
Thank you very much Jayess, it finally loaded the model in the gazebo. I can not say how much happy I am right now, thank you, thank you and thank you, you are fantastic.

Comment by jayess on 2017-08-16:
No problem. Happy to help.

Comment by gvdhoorn on 2017-08-17:
I'm not sure, but this could be a reoccurence of ros-simulation/gazebo_ros_pkgs#112, which is/was supposedly fixed.

Comment by jayess on 2017-08-17:
@gvdhoorn I think that it may be. I can only spawn the model using /robot_description and it being set outside of the group tag.

Comment by gvdhoorn on 2017-08-17:
It would probably be good then to comment on the issue again, with a link to this Q&A.

Comment by carlosg on 2020-10-28:
I had the same problem and fixed it by changing the rosParam tag inside the gazebo tag inside of my urdf. This param is set as robot_description as default. See more here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.