I was wondering if there was a way to detect if the wheels are slipping or not moving on the Stretch? I plan to do some collision detection with the base and couldn’t figure out if there was any way to get this information. Thanks in advance!
Hello Daphne, welcome to the Stretch Forum!
We’ve done only preliminary exploration of collision detection on the base. It is something that we do plan to provide as a standard signal exposed by Stretch Body (tbd when we will however).
Perhaps if you figure out a robust collision detector you can share your results back here. There are a number of signals coming out of Stretch Body that may be useful:
Motor current: The current signal (
robot.base.left_wheel.status['current'] will exceed the normal value when the robot stalls or hits a large obstacle. However, we don’t yet have a dynamic model of the robot base (which will be necessary to distinguish between internal loads and external disturbances) – although this is coming soon.
Base accelerometer: The IMU in the base includes an accelerometer which can be used to infer momentary contact events. We expose
robot.pimu.status['bump_event_cnt'] which increments on a bump event. Bump events are triggered when the sum-of-the-squares of the acceleration values exceed a YAML specified threshold. You should be able to see the
bump_event_cnt increment if you knock the base somewhat hard with your hand.
Trajectory tracking: The steppers in the base track position and velocity fairly well in most circumstances (less than 1 degree error RMS or so). You can monitor the tracking error (eg
robot.base.right_wheel.status['err']) of each motor. If the error value exceeds the normal range it likely indicates that the wheel is experiencing a disturbance such as a collision.
I’d suggest exploring these signals and possibly building a detector that fuses the information in some manner (as each signal may capture different aspects of a collision event). The tool
stretch_pimu_scope.py provides a good example of how to plot signal values in a real-time oscilloscope. In addition, you can check the
bump_event values by simply running:
I hope this helps. Let us know how it goes!