Adding Contact Sensor to a Gazebo Plugin
Hey guys,
I am writing a Gazebo plugin which will go through a robot model (sdf file) and iterate through the links using the joints and add a contact sensor to all the collisions present in those links. Currently, I have all the links, joints and collisions in the custom plugin.
I am stuck at adding a contact sensor to all of those collisions. There is a function AddContact in
gazebo::physics::Collision
but it is deprecated. Any suggestions on how can I add a contact sensor to those collisions in the plugin code itself?
PS: I know I can just add it in the model file but I don't want that because the model will keep changing and I don't want to keep on updating it with the contact sensor tag.
Thanks in advance.
Asked by namankumar on 2019-06-14 03:45:54 UTC
Answers
I went through the Gazebo API and searched a little on the forum and wiki. I would conclude that you cannot add sensors using plugins.
However, you can make some script that will go through your sdf file and add the <sensor>
tags. Actually I am using similar approach in my project to dynamically load multiple sensors on a robot, so that I can use the same robot description when I want to launch it without sensors, with one specific sensor, or any combination of sensors. I am very happy with this approach.
I basically glue the descriptions of the robot and sensors at the launch, write it in a temporary file, which the ROS then loads and when I'm done with the simulation, I remove the temporary file. Maybe that gives you some ideas.
Asked by kumpakri on 2019-06-20 08:45:25 UTC
Comments
I am just being curious. Can you tell me why would anybody tag their question on the Gazebo discussion server
gazebo
? What additional information do you wish to provide with this tag? Thank you.Asked by kumpakri on 2019-06-20 08:29:16 UTC