# Detecting wheel slippage/not moving

**URL:** <https://forum.hello-robot.com/t/detecting-wheel-slippage-not-moving/436>\
**Category:** Ask\
**Created:** [July 7, 2022, 10:39pm UTC](https://forum.hello-robot.com/t/detecting-wheel-slippage-not-moving/436 "2022-07-07T22:39:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chenyinghan](https://avatars.discourse-cdn.com/v4/letter/c/dfb087/32.png) [@chenyinghan](https://forum.hello-robot.com/u/chenyinghan)\
**Post date:** [July 7, 2022, 10:39pm UTC](https://forum.hello-robot.com/t/detecting-wheel-slippage-not-moving/436/1 "2022-07-07T22:39:39Z")

</div>

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! 🙂

---

<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:** [July 8, 2022, 1:55am UTC](https://forum.hello-robot.com/t/detecting-wheel-slippage-not-moving/436/2 "2022-07-08T01:55:28Z")

</div>

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**](https://github.com/hello-robot/stretch_body/blob/922fe33c191ed3eb6dc5bfc6a35fcfeb33077216/body/stretch_body/base.py#L431): The current signal (`robot.base.right_wheel.status['current']` and `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']`](https://github.com/hello-robot/stretch_body/blob/922fe33c191ed3eb6dc5bfc6a35fcfeb33077216/body/stretch_body/pimu.py#L254) which increments on a bump event. Bump events are triggered when [the sum-of-the-squares](https://github.com/hello-robot/stretch_firmware/blob/a8b9998c32d9f2d72c8774d258c5cf155d49d371/arduino/hello_pimu/IMU.cpp#L245) of the acceleration values exceed a YAML specified [threshold](https://github.com/hello-robot/stretch_body/blob/922fe33c191ed3eb6dc5bfc6a35fcfeb33077216/body/stretch_body/pimu.py#L411). 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](https://github.com/hello-robot/stretch_body/blob/922fe33c191ed3eb6dc5bfc6a35fcfeb33077216/body/stretch_body/stepper.py#L103) (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:

```auto
stretch_pimu_scope.py --bump

```

I hope this helps. Let us know how it goes!
