Gazebo | Ignition | Community
Ask Your Question
0

What collision name is supposed to be passed to contact sensor?

asked 2019-02-21 04:30:16 -0500

kumpakri gravatar image

In this tutorial it seems, that you are supposed to put the name of the collision tag of the link we want to detect the collision of.

When you have the model in URDF and spawn it into the gazebo world, the collision tab of the link would bear name like <link_name>_<joint_type>_lump__<collision_tag_name>_collision. In this answer, the author uses this name to pass to the contact sensor.

Neither of the options works for me, so I can't verify which one is right.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-02-21 06:09:37 -0500

kumpakri gravatar image

It is only important what is the collision tag name in the SDF description. How the Gazebo sees the model you can see by following these steps

  1. Convert XACRO description to URDF

    $ rosrun xacro xacro robot.xacro > robot.urdf

  2. Convert URDF description to SDF

    $ gz sdf -p robot.urdf > robot.sdf

  3. Open the SDF file and find the link you want to detect the contacts of. This name goes to the contact sensor collision tags.

This sensor can be defined in xacro file of the robot as

<robot name="robot" xmlns:xacro="libgazebo_ros_control.so">
  <gazebo reference="my_link">
    <sensor name='my_link_contact' type='contact'>
       <always_on>1</always_on>
       <contact>
         <collision>my_link_fixed_joint_lump__my_link_collision_collision</collision>
         <topic>/my_link_contact</topic>
       </contact>
    </sensor>
  </gazebo>
</robot>
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-02-21 04:30:16 -0500

Seen: 1,043 times

Last updated: Feb 21 '19