Not sure how to work with the contact sensor.
Hello, New to gazebo.
I am trying to add a sensor to a link and get force values. I am using a urdf. I tried the tutorial for the force torque sensor on gazebo but it didn't work. I tried the contact sensor. IT shows up in the rostopic list. However, does not show any information.
On further investigation, the issue seems to be the collision name within the sensor tag. Most resources say that when gazebo converts the file from a *.urdf.xacro to a *.sdf it messes with the names. Is there a way to see these changes?
I tried converting the file to a sdf but it did not work as expected.
The gazebo code is here:
<gazebo reference="${name}_finger_33_sensor">
<material>Gazebo/Black</material>
<sensor type="contact" name="contact_sensor">
<always_on>true</always_on>
<update_rate>1.0</update_rate>
<contact>
<collision>${name}_finger_13_sensor_collision</collision>
</contact>
<plugin name="contact_plugin" filename="libgazebo_ros_bumper.so">
<alwaysOn>true</alwaysOn>
<updateRate>8</updateRate>
<bumperTopicName>contact_sensor</bumperTopicName>
<frameName>${name}_finger_33_sensor</frameName>
</plugin>
</sensor>
</gazebo>
I can see contact_sensor when I enter rostopic list in the terminal.This is what I get when i use rostopic echo
Thanks for the help in advance. If you also know how to import the data to use it in python kindly let me know.
Asked by adheeshenoy on 2019-10-04 15:44:48 UTC
Answers
Alright so here is what fixed the issue. When using a urdf, gazebo changes the names of the collisions. The two options you have are: 1. convert the urdf to a sdf and see the collision name. 2. Run the simulation. Click on the link you are interested in and within the properties see the name of the Collision. (NOTE: GAZEBO ADDS TWO UNDERSCORES AFTER LUMP __ )
Anyway once you correct the collision name the sensor should give you values.
Asked by adheeshenoy on 2019-10-17 13:36:46 UTC
Comments
Did you try to make the link with the contact sensor to touch something and then see what states are in those messages?
Asked by kumpakri on 2019-10-09 08:36:28 UTC
@kumpakri Could you elaborate more? Not sure what you mean.
Asked by adheeshenoy on 2019-10-10 10:08:21 UTC
You show here messages of some
contact_sensor
topic. I ask what was happening in the simulation when you looked into this topic. The contact sensor outputs a concrete contact information only when there is a contact between the link${name}_finger_33_sensor
and some other object. You need to make the objects touch.Asked by kumpakri on 2019-10-10 10:47:05 UTC
@kumpakri Yes, there was contact between the link and the object. The finger was in contact with a box.
Asked by adheeshenoy on 2019-10-14 20:40:25 UTC
what happens when you don't specify any frameName?
Asked by kumpakri on 2019-10-16 07:12:29 UTC
By removing the frameName, it reverts to the world as the frame id. I think the issue is with the collision name. I tried the contact sensor with the new collision name. However, it still did not give any states. Just out of curiosity, is my code to implement a contact sensor correct? @kumpakri
Asked by adheeshenoy on 2019-10-17 12:41:53 UTC