# Dead reckoning or SLAM for localization with unusual locomotion?

I am working on a senior design project with a robot that moves in an unusual way: it rolls around in a single spherical body, similar to BB-8 from the Star Wars sequels. My personal task for the project is to create a localization system for estimating the robot's current location based on its starting position and previous movement, with the primary processor of the robot being a Raspberry Pi 4B mounted in the "head" of BB-8.

So far, I have tried to make this work by using readings from an RSX-UM7 IMU from Redshift Labs to perform dead reckoning, but this has been unreliable. Minor fluctuations in acceleration result in the estimated position rapidly drifting from the actual location, even while sitting completely still. My advisor has suggested that I instead use a depth sensor or similar device for localization, since I still haven't found reliable success with dead reckoning. As far as I can tell, using a depth sensor would involve setting up a SLAM algorithm to estimate a map of the robot's surroundings.

Which of these would be a more reliable option? Should I continue trying to debug my dead reckoning algorithm to minimize the effects of minor drifts, or should I try to implement SLAM with the depth sensor?

• Dead reckoning is difficult. What is a "depth sensor"? And how would you put it to use? Commented Apr 2, 2023 at 15:08

## 2 Answers

• Consider deriving Pitch, Yaw and Roll from the IMU's accelerometer. From this plot the contact point between the robot's spherical body and the (flat) surface the robot travels on. From this derive the direction of travel and distance of traveled.
• Consider using Quaternion rather than Euler angles to avoid Gimbal lock.

Minor fluctuations in acceleration result in the estimated position rapidly drifting from the actual location, even while sitting completely still.

Yup. Welcome to the real world, kid*.

If you assume an otherwise perfect IMU, and a perfect knowledge of your local acceleration due to the earth's** gravity***, the noise of a typical IMU that you can afford will mess you up. This is because even if it's just white noise, you have to integrate twice to get from acceleration to position.

Regardless of anything else, you can use an IMU to augment an existing position or velocity sensor, but if you're going to use it for dead reckoning you can only do so over periods of time that are roughly proportional to the amount of error you can stand divided by the accelerometer error squared (and modified by the gyro error in a non-trivial way). I'd say "you can't use an IMU for navigation" except you can -- purely inertial navigation systems have been in use in airplanes and submarines for decades.

So -- abandon any notions of doing the navigation purely from an IMU, unless you happen to have a hundred pounds of export-restricted**** IMU laying around, and you don't mind building a really BIG version of BB-8.

What you can do, at least theoretically, is combine the short-term good, long-term bad IMU readings with long-term good, short-term bad position sensor readings to get a really good position readout. This is basically what IMU/GPS fusion is all about, or IMU-aided SLAM.

I say theoretically because you're trying to fit this into the space of a senior project, and you already have the design of the robot on your plate. Unless there's some depth-sensor-based, IMU-aided SLAM project already out there in the Internet somewhere, just getting that part working is worthy of a senior project.

So:

• Renegotiate the project to just doing the navigation, perhaps with your BB-8 head on a stick.
• Shop around for a video-based SLAM (probably much more reliable, and not much more expensive than depth sensors) -- then renegotiate that part of your project.
• Shop around for my probably-mythical depth-sensor-based SLAM, with or without IMU assistance.

* Listen to that in Han Solo's voice.

** Assuming earth.

*** Which varies too much from point to point to assume as being constant, even with cheap cell-phone IMU chips.

**** They're called "strategic-grade" IMUs, if you want to go shopping for them on eBay. Hence the export restriction -- if they're rugged enough, they're just what you need for a guidance system in a GPS-independent ICBM.