Gazebo | Ignition | Community
Ask Your Question
0

Not sure how to work with the contact sensor. [closed]

asked 2019-10-04 15:44:48 -0500

this post is marked as community wiki

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

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 image description

Thanks for the help in advance. If you also know how to import the data to use it in python kindly let me know.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by adheeshenoy
close date 2019-10-25 15:58:03.932456

Comments

Did you try to make the link with the contact sensor to touch something and then see what states are in those messages?

kumpakri gravatar imagekumpakri ( 2019-10-09 08:36:28 -0500 )edit

@kumpakri Could you elaborate more? Not sure what you mean.

adheeshenoy gravatar imageadheeshenoy ( 2019-10-10 10:08:21 -0500 )edit

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.

kumpakri gravatar imagekumpakri ( 2019-10-10 10:47:05 -0500 )edit

@kumpakri Yes, there was contact between the link and the object. The finger was in contact with a box.

adheeshenoy gravatar imageadheeshenoy ( 2019-10-14 20:40:25 -0500 )edit

what happens when you don't specify any frameName?

kumpakri gravatar imagekumpakri ( 2019-10-16 07:12:29 -0500 )edit

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

adheeshenoy gravatar imageadheeshenoy ( 2019-10-17 12:41:53 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-10-17 13:36:46 -0500

adheeshenoy gravatar image

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.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-10-04 15:44:48 -0500

Seen: 520 times

Last updated: Oct 17 '19