Gazebo | Ignition | Community
Ask Your Question

How to simulate motor power loss with diffdrive controller?

asked 2023-01-29 16:24:59 -0500

rtur gravatar image

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?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2023-03-01 22:59:40 -0500

azeey gravatar image

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 HaltMotioncomponent (

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.

edit flag offensive delete link more

answered 2023-02-28 06:05:22 -0500

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

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2023-01-29 16:02:49 -0500

Seen: 137 times

Last updated: Mar 01 '23