Gazebo | Ignition | Community
Ask Your Question
0

HI, I would like to add virtual pressure(tactile) sensors in to my Gazebo simulator

asked 2019-07-15 23:48:32 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

HI, I would like to add virtual pressure(tactile) sensors in to my Gazebo simulator

I know, I have to use Gazebo plugin "libPressurePlugin.so" but, I don't know how

I have to attach virtual pressure(tactile) sensors in to my URDF form structure

I think there are pretty many hints and examples on SDF form structure

but, I can't find nice example on how to attach virtual pressure(tactile) sensors on URDF form structure using Gazebo plugin "libPressurePlugin.so"

Could you help me???

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2021-07-02 07:33:35 -0500

askkvn gravatar image

Thanks for the solution, it worked

edit flag offensive delete link more
0

answered 2019-09-06 09:04:07 -0500

Duckfrost gravatar image

updated 2019-09-12 06:19:41 -0500

Here you have the ROSject as a plug and play solution for the DogBot: ROSject

Here you have the git with all the code: GIT

Here you have a video explaining all the process: VIDEO

Basically what I have done to have a pressure sensor is to use the libgazebo_ros_bumper.so that gives among other things force on the point of contact. The tricky part is to get the collision element name. This is not trivial because if you come from a XACRO or URDF, it will be most probable that you didn't even give a name to the collision element. So the best way is to convert your URDF or XACRO into SDF, and the get the collision element name.

With this script convert XACRO->URDF->SDF

echo "Cleaning sdf and urdf"
rm -rf dogbot.sdf dogbot.urdf
rosrun xacro xacro.py dogbot.xacro > dogbot.urdf
gz sdf -p dogbot.urdf > dogbot.sdf
echo "Generated SDF".

This is how you would place it in a XACRO or URDF:

<gazebo reference="${prefix}_${suffix}_foot">
  <mu1 value="2000.0"/>
  <mu2 value="1000.0"/>
  <kp value="${kp}" />
  <kd value="${kd}" />

  <!-- Contact Sensor -->
  <sensor name="my_foot_contactsensor_sensor" type="contact">
    <always_on>true</always_on>
    <contact>
      <collision>parent_of_my_foot_fixed_joint_lump__my_foot_collision_5</collision>
    </contact>
    <plugin name="my_foot_plugin" filename="libgazebo_ros_bumper.so">
      <bumperTopicName>my_foot_contactsensor_state</bumperTopicName>
      <frameName>my_foot</frameName>
    </plugin>
  </sensor>

</gazebo>

The critical part is: parent_of_my_foot_fixed_joint_lump__my_foot_collision_5 This is normally generated by the union between the parent, the joint type and the child ( your link with the contact sensor ).

Hope it helped.

EDIT:

I hadded a tutorial also on how to represent these pressuer sensor readings in RVIZ

Check this video for all the details: VIDEO RVIZ Respresentation

I essentially had to create a world to base_link TF publisher and also an Arrow markers publisher for each contact sensor:

world_to_base_tf_publisher.py

arrows_rviz.py

image description

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-07-15 23:48:32 -0500

Seen: 1,229 times

Last updated: Jul 02 '21