Gazebo | Ignition | Community
Ask Your Question

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

asked 2020-07-09 05:34:44 -0500

val gravatar image


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 <maxcontacts> 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!

edit retag flag offensive close merge delete


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.

awck gravatar imageawck ( 2021-01-20 20:16:19 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-06-27 01:34:01 -0500

tanyouliang gravatar image

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 wrechesin the

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.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2020-07-09 05:34:44 -0500

Seen: 306 times

Last updated: Jun 27 '21