mix sonar and laser in model sdf

asked 2015-11-06 10:14:06 -0600

scarlett gravatar image

updated 2015-11-10 08:51:05 -0600

Hi! I am editing a model that has both lasers and sonar. The model below work fine, but if I uncomment the sonar part gazebo crashes with no error thrown in verbose mode. I am working on gazebo-6.5.

If I remove others sensors to keep just a sonar, it is working fine (even if the visual is not updated, the msg is). I don't know what I am missing.

<?xml version='1.0'?>
    <sdf version='1.4'>
      <model name="my_robot">
        <static>false</static>
     <link name='Tibia'>
      <pose>0 0 0.3596 0 -0 0</pose>
      <inertial>
        <pose>0.00220451 0 -0.185729 0 -0 0</pose>
        <mass>11.6015</mass>
      </inertial>
      <collision name='Tibia_collision'>
              <geometry>
                <box>
                  <size>.1 .1 .7</size>
                </box>
              </geometry>
     </collision>
     <visual name='Tibia_visual'>
              <geometry>
                <box>
                  <size>.1 .1 .7</size>
                </box>
              </geometry>
      </visual>

      <!--  <sensor name='FrontSonar' type='sonar'>
        <update_rate>20</update_rate>
        <visualize>0</visualize>
        <sonar>
          <min>0.025</min>
          <max>2.55</max>
          <radius>0.5</radius>
        </sonar>
        <pose>0.0699 0 -0.1023 0 -1.89 0</pose>
      </sensor>

      <sensor name='BackSonar' type='sonar'>
        <update_rate>20</update_rate>
        <visualize>0</visualize>
        <sonar>
          <min>0.025</min>
          <max>2.55</max>
          <radius>0.5</radius>
        </sonar>
        <pose>-0.0718 0 -0.0534 0 1.77 0</pose>
      </sensor> -->
      <sensor name='FrontLaser' type='ray'>
        <always_on>1</always_on>
        <update_rate>40</update_rate>
        <visualize>1</visualize>
        <ray>
          <scan>
            <horizontal>
              <samples>15</samples>
              <resolution>1</resolution>
              <min_angle>-0.36</min_angle>
              <max_angle>0.36</max_angle>
            </horizontal>
          </scan>
          <range>
            <min>0.3</min>
            <max>7</max>
            <resolution>0.01</resolution>
          </range>
        </ray>
        <pose>0.0562 0 -0.303 0 -0.0175 0</pose>
      </sensor>

      <sensor name='LeftLaser' type='ray'>
        <always_on>1</always_on>
        <update_rate>40</update_rate>
        <visualize>1</visualize>
        <ray>
          <scan>
            <horizontal>
              <samples>15</samples>
              <resolution>1</resolution>
              <min_angle>-0.36</min_angle>
              <max_angle>0.36</max_angle>
            </horizontal>
          </scan>
          <range>
            <min>0.3</min>
            <max>7</max>
            <resolution>0.01</resolution>
          </range>
        </ray>
        <pose>-0.018 0.0899 -0.303 5.20497e-18 -0.0175 1.75728</pose>
      </sensor>

      <sensor name='RightLaser' type='ray'>
        <always_on>1</always_on>
        <update_rate>40</update_rate>
        <visualize>1</visualize>
        <ray>
          <scan>
            <horizontal>
              <samples>15</samples>
              <resolution>1</resolution>
              <min_angle>-0.36</min_angle>
              <max_angle>0.36</max_angle>
            </horizontal>
          </scan>
          <range>
            <min>0.3</min>
            <max>7</max>
            <resolution>0.01</resolution>
          </range>
        </ray>
        <pose>-0.018 -0.0899 -0.303 -5.20497e-18 -0.0175 -1.75728</pose>
      </sensor>

    </link>
   </model>
</sdf>

//edit : The problem seems to not happen everytime, it looks like I need to upload several time before the behaviour hapens. When I launch separately gzclient and gzserver then I get the msg "zsh: segmentation fault (core dumped) gzserver --verbose". Plus the few times of when gazebo doesn't segfault, the sonar data range is not updated if an obstacle is in front.

edit retag flag offensive close merge delete

Comments

I loaded your model in an empty world and it ran without error. What world file are you using?

hsu gravatar imagehsu ( 2015-11-09 12:57:51 -0600 )edit

you're right, I discoverd this morning that it was working again... I launch gazebo then I load the model from the GUI. A surprinsing thing is after several loading of this model, the problem came back... So I don't know if the problem is coming from my computer or maybe the sonars are sort of unstable? (This thing don't happen with others models that don't have sonars ). As edited, another strange behaviour is when not segfaulting, the sonars are not updated.

scarlett gravatar imagescarlett ( 2015-11-10 03:25:09 -0600 )edit