With Stretch Body 0.4.25 and firmware Stepper.v0.2.7p1 we have introduced a watchdog on the stepper velocity controllers. This was introduced primarily as a safety feature when doing velocity control on the base.
This watchdog requires that a new command is sent to the motor at least every 1 second. Otherwise, the controller will automatically switch to its SAFETY mode (equivalent to hitting the runstop).
For example, the script below sets a wheel in velocity control mode.
Without the watchdog: Ctrl-C out of this script and the base will continue to move.
With the watchdog: Ctrl-C out of this script and the base will stop after 1 second
#!/usr/bin/env python
import stretch_body.stepper
import time
motor = stretch_body.stepper.Stepper('/dev/hello-motor-right-wheel')
motor.startup()
motor.disable_sync_mode()
motor.enable_vel_traj()
motor.push_command()
motor.set_command(v_des=4.0)
motor.push_command()
time.sleep(20.0)
motor.stop()
Default settings
By default the watchdog is turned on for the base wheels but not for the arm and lift. You can turn it off/on by overwriting the default settings in your stretch_user_params.yaml
.
>>$ stretch_params.py | grep watchdog
stretch_body.robot_params.nominal_params param.hello-motor-arm.gains.enable_vel_watchdog 0
stretch_user_params.yaml param.hello-motor-left-wheel.gains.enable_vel_watchdog 1
stretch_body.robot_params.nominal_params param.hello-motor-lift.gains.enable_vel_watchdog 0
stretch_user_params.yaml param.hello-motor-right-wheel.gains.enable_vel_watchdog 1
Upgrading / Installing
If you don’t have Stretch Body 0.4.25 and firmware Stepper.v0.2.7p1, then:
pip3 install -U hello-robot-stretch-body
and
REx_firmware_updater.py --install