How to hold the servo position [After Imact detection ]

Hi all,

I have a 4DOF servo based robot arm. i want to detect impact using a accelerometer and stop whenever it detects a impact.
I am using pololu maestro servo controller and maestro python class to control the servo. Is there a way to stop the servo during it travels from a position to a target position?

Really appreciate your inputs on this.


There are a few ways you can have the Maestro stop a servo while it is moving. One way is to send a 0 target position value, which disables the servo channel. (Note that depending on the servo, it might stop holding its position or it might not.) If you do not want to disable the servo and have specified the speed and accelerations limits for the channel, you could use the “Get Position” command to get the servo’s position and send that value as the new target position. For more details on that command, see the “Serial Servo Commands” section of the Maestro Servo Controller User’s Guide.

By the way, since you mentioned using an accelerometer to detect an impact, you might be interested in looking at the code in the SumoCollisionDetect sketch in our Arduino Library for the Zumo 32U4, which uses the robot’s accelerometer to detect contact with another robot in a sumo ring.

- Amanda

1 Like

Thank you very much Amanda, I’ll check your inputs.

As for the “getposition” command, is it returning me the true current position? I was under the impression that it only provide the last position that was written to maestro.


Yes, the Get Position command returns the last pulse width the Maestro sent to the servo, not the servo’s actual position. Hobby servos do not make their feedback available, so the servo controller (e.g. Maestro) has no way of knowing the exact position of a servo. For the Get Position command to work for your application, you would need to set the speed and acceleration limits for the servo channel. By setting those limits, the movement is broken down between the initial and final position values into multiple smaller divisions.

- Amanda