How to simulate motor power loss with diffdrive controller?
Hey, is there a way to simulate power loss? What I ultimately want to achieve:
- mobile robot with a safety scanner gets to close to some object
- safety scanner cuts power to the motors
What I have:
- A differential drive robot (with the gazebo diffdrive controller)
I think one way to achieve this is to implement a safety scanner gazebo plugin, maybe based on the Lidar sensor from gazebo, and then maybe set max_effort for the joints in question to 0.
Does that sound right? Or is there a better/standard way of achieving something similar?
Asked by rtur on 2023-01-29 17:02:49 UTC
Answers
Just thinking with you. One way is to change the cmd_vel to zero when some object is detected. But that is maybe not so realistic. Another way is to change the friction of the diff_drive joints. causing it to stop
<dynamics damping="0.0" friction="0.0"/>
See info urdf - joint
Asked by Nobel on 2023-02-28 07:05:22 UTC
Comments
Yes, I think you'll have to implement a plugin for this. But note that cutting power is different from braking as the robot may continue to move due to its momentum if you just cut power from the motors. If you want to brake, you can use the HaltMotion
component (https://github.com/gazebosim/gz-sim/blob/gz-sim7/include/gz/sim/components/HaltMotion.hh)
Another option is to use the TriggeredPublisher plugin to publish a 0 velocity command to the joint controllers when the safety scanner detects the robot (e.g. Lidar value is below a threshold). This option would avoid writing a plugin.
Asked by azeey on 2023-03-01 23:59:40 UTC
Comments