Robotics StackExchange | Archived questions

Allaways 100 states in ContactsState/states[] message from bumper sensor

Hello,

i am new to ROS and Gazebo and i am trying to simulate a collision between my robot and a wall. I put a simple sphere at the end of my robot and added a collision sensor (gazebo-plugin gazebo-ros-bumper sensor). I get data from the sensor but know I don't really understand the meaning of the states array in the Contactsstate message. In my understanding for every contact in simulation there is a Contactstate message created, so it would be one Element in the states array for every contact.

I was getting 100 states elements. But when I limit the maximum Contacts with the tag the number of states doesn't change.

I guess I just don't get what the states array means. Could someone help me out at explain the meaning of the message ContactsState/states[]?

thank you in advance!

Asked by val on 2020-07-09 05:34:44 UTC

Comments

Hi, did you find out what the states array is? I can imagine that this array gives you all "intermediate" collision results that the physics engine calculated between the current and the previous published message.

Asked by awck on 2021-01-20 21:16:19 UTC

Answers

The state array in the gazebo_ros_bumper plugin seems to be an array of contacts for each timestamp. Thus, the 100 contact states are the contact states in the span of a period of time. Thus limit the max contacts will not solve this, if you are setting the max_contacts tag in link collision to 1 (for the box example below), there will only be one contact between two bodies.

image description

In other words, having 2 contacts will resulted in 2 contact_positions and wreches in the http://docs.ros.org/en/api/gazebo_msgs/html/msg/ContactState.html

Back to question on why 100 contact states when you rostopic echo the contact msg. This seems because of this in the code, prevent the size from expanding indefinitely. Thus, regardless if you set the <sensor><update_rate> to a lower rate, the contact states (which are the contact states for multiple timestamps between each "echo") will be limited to 100.

Asked by tanyouliang on 2021-06-27 01:34:01 UTC

Comments