Spawner gets blocked when trying to use libhector_gazebo_ros_sonar

asked 2017-05-22 04:47:59 -0500

SorinV gravatar image

updated 2017-05-22 10:17:02 -0500

Hi guys! To get to the point, I have an .xacro file where I am creating a simple 3-wheeled robot. I am trying to include a camera sensor that works fine and 3 sonar sensors using libhector_gazebo_ros_sonar. When I include the sonars the launching process stops at:

[INFO] [1495446798.750176, 0.000000]: Calling service /gazebo/spawn_urdf_model
[ INFO] [1495446798.857894558, 0.022000000]: waitForService: Service [/gazebo/set_physics_properties] is now available.
libGL error: failed to create drawable

If I don't kill the process it fills up my RAM and everything freezes

After I kill the process with CTRL+C i see this warning:

[WARN] [1495446813.634902, 0.032000]: Controller Spawner couldn't find the expected controller_manager ROS interface.

Code for sonar:

<xacro:macro name="sonar_sensor" params="sid dx dy dz rot jr jh plink ray_count field_of_view min_range max_range">
 <link name="sonar${sid}">
      <origin rpy="0 0 ${rot}" xyz="0 0 0"/>
        <box size="${dx} ${dy} ${dz}"/>
       <material name="red"/>

 <joint name="sonar${sid}_joint" type="fixed">
    <parent link="${plink}"/>
    <child link="sonar${sid}"/>
    <origin rpy="0 0 0" xyz="${cos(rot)*jr} ${sin(rot)*jr} ${jh}"/>

  <gazebo reference="sonar${sid}">
    <sensor name="sonar_sensor${sid}" type="ray">
      <always_on> true</always_on>
            <max_angle> ${field_of_view/2}</max_angle>
            <max_angle> ${field_of_view/2}</max_angle>

      <plugin name="sonar${sid}_controller" filename="">


I include the sonar like this:

<xacro:sonar_sensor sid="1" dx="${l_sen}" dy="${L_sen}" dz="${L_sen}" rot="0" jr="${r_base-0.005}" jh="-0.2" plink="base_link" ray_count="640" field_of_view="${pi}" min_range="0.01" max_range="5"/>

No parsing error when parsing directly the .xacro file to .urdf or .sdf. There may be a problem with the way I try to use the library or the namespaces, but I am not configuring those, just / like so:

    <plugin name="gazebo_ros_control" filename="">

I include the spawner in the .launch file like so:

<node name="robot_controller_spawner" pkg="controller_manager" type="spawner" args="[joint controllers here]"/>

system: Ubuntu 16.04, ROS kinetic, Gazebo 7 llibraries: libhector_gazebo_ros_sonar and ros-kinetic-gazebo-ros-control installed with sudo apt-get No path problem for ROS. The Gazebo path returns nothing but I set that up and still does not work. Again, everything spawns without the sonars.

Not sure if this is the same problem.

Thank you in advance for any suggestions. I asked also on the Gazebo forum here.

Thank you in advance for any suggestions.

UPDATE 1 Managed to narrow it down to the ray tag. It spawns when I comment out the vertical caracteristics but still have the warning:

[WARN] [1495446813.634902, 0.032000]: Controller Spawner couldn't find the expected controller_manager ROS interface ...
edit retag flag offensive close merge delete


libGL error: failed to create drawable

this is at least suspicious. Are you running this in a VM, or a bare-metal installation? Do you have the appropriate video card drivers installed for your hardware? The OSS ones typically don't cut it.

gvdhoorn gravatar image gvdhoorn  ( 2017-06-17 04:00:15 -0500 )edit

For this part you are right. The drivers are just the standard ones. I run it on a laptop. But for now this is not such a big of a problem. The error appears but the rest works. For example there has been a while since I didn't get the ram filling problem but I don't know exactly what was the fix

SorinV gravatar image SorinV  ( 2017-06-19 04:30:50 -0500 )edit

It is possible that Gazebo uses OpenGL to accelerate simulation of certain sensors. If the sensor you want to use is one of those, it could be that not having proper drivers installed could have an effect on Gazebo.

gvdhoorn gravatar image gvdhoorn  ( 2017-06-19 04:54:57 -0500 )edit

Hello SorinV, i had the same problem and fixed it with your suggestions! But it's not able to recognize obstacles. Did you have the same problem? Thank you

moshimojo gravatar image moshimojo  ( 2017-11-15 09:01:35 -0500 )edit

Hello moshimojo. I ended up using this plugin:

SorinV gravatar image SorinV  ( 2017-11-17 04:51:23 -0500 )edit

ok, i'll try it thank you!

moshimojo gravatar image moshimojo  ( 2017-11-19 11:36:26 -0500 )edit