I found the following forum entry, which addressed a part of my problem:
I added contact sensors to all 5 parts of the husky robot (base and 4 wheels) into the .sdf file, with the following code:
<!-- contact sensor -->
<sensor type="contact" name="base_contact_sensor">
<plugin name="gazebo_ros_bumper_controller" filename="libgazebo_ros_bumper.so">
I made sure every contact sensor's name is unique, aswell as the bumperTopicName.
However, when trying to ask the values of the sensors within a transfer function as suggested in the other forum post above:
# Imported Python Transfer Function
@nrp.MapRobotSubscriber("bumper", Topic('/base_bumper', gazebo_msgs.msg.ContactsState))
def read_sensor(t, bumper):
clientLogger.info(bumper.value) # type(bumper.value) = gazebo ContactsState
it always prints me "None", even if there is contact between two objects. The collisions happen between spawned boxes, and the husky robot, but the sensor values do not change.
Where is my mistake? Do i have to change the bumperTopicName, or is there something else i missed?
Thanks in advance!