# Handling Dynamixel servo overload errors

**URL:** <https://forum.hello-robot.com/t/handling-dynamixel-servo-overload-errors/613>\
**Category:** Knowledge Base\
**Created:** [February 28, 2023, 6:23pm UTC](https://forum.hello-robot.com/t/handling-dynamixel-servo-overload-errors/613 "2023-02-28T18:23:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aedsinger](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.hello-robot.com/aedsinger/32/6_2.png) [@aedsinger](https://forum.hello-robot.com/u/aedsinger)\
**Post date:** [February 28, 2023, 6:23pm UTC](https://forum.hello-robot.com/t/handling-dynamixel-servo-overload-errors/613/1 "2023-02-28T18:23:12Z")

</div>

It is possible for the Stretch Dynamixel servos to become overloaded or overheated during normal operation. In particular:

- Stretch Gripper: When grasping an object with a strong grip for a prolonged period
- Wrist Yaw: When rotating into a fixed object and holding a stall condition

Fortunately, Stretch Body has some built in mechanisms to attempt to avoid these states (more below).

When a servo is in an overload condition it becomes unresponsive and will not move. This is the built-in behavior of the servo itself. When this happens, a reboot is required. To do this run:

```auto
stretch_robot_dynamixel_reboot.py

```

**This will reboot all servos and the joints will require homing afterwards.**

In your code you can check if your servo is in an error condition by looking at its status fields. E.g.,:

```auto
robot.end_of_arm.get_joint('wrist_yaw').status['overload_error']
robot.end_of_arm.get_joint('wrist_yaw').status['overtemp_error']

```

**The Robot Sentry**

Stretch Body includes a sentry who’s job it is to keep the robot from hurting itself, among other things. It works by running a thread from the Robot instance that monitors the various `status` fields and then applies safe limits and bounds to actuators, etc.

In the case of Dynamixel servos, the sentry

- Emulates a runstop tied to the runstop button in the robots head (so that hitting the runstop will pause the servo motion)
- Attempt to back off an overload condition to limit the currents applied by the servo.

You can see in the [Stretch Gripper code](https://github.com/hello-robot/stretch_body/blob/master/body/stretch_body/stretch_gripper.py#L75) how this works. If the sentry detects that the motion is stalled it will back off the commanded position by a small amount. This has the effect of reducing the steady-state error of the servos PID controller (and reducing the motor current).

Advanced users may want to overload this sentry or adjust its parameters to best fit their application.

**It is important to note that the sentry only runs when there is an instance of a Robot class running.** Some tools, such as `stretch_gripper_jog.py` do not instantiate the Robot class and therefore do not run the sentry.
