How to track robot position?

Robotics Asked by Michael Coss on January 6, 2022

I’m a software researcher, who in my spare time mentors a robotics team, helping on the software side of things. For years, I keep coming back to the same question: How to determine the robots position, and heading during our competitions? We have tried a number of things with varying degrees of success/failure. Encoders on the drive wheels, accelerometers, gyroscopes, etc. I recently bought an IMU with a 3 axis accelerometer, 3 axis gyro, and 3 axis magnetometer, all preprocessed by an Arduino, and outputting the value to a serial port. I thought surely there must be a way to take all these measurements and get a composite view of position and heading. We are using Mecanum wheels on this particular robot, so wheel encoders are not particularly useful. I’ve looked around and there’s a lot of talk about orientation using quaternion with sensor fusion using similar boards, but it very unclear to me how to take the quaternion and the estimation and come up with x,y distance from the starting position? Now, my time window for these measurements is small, ~15 seconds, but I need it to be pretty accurate within that window. I’m about ready to abandon using the IMU, and try something else. One idea is to use a USB ball mouse to try and track robot motion but I’m certain that the mouse is going to get banged around way too much leading to noise and invalid results. As a side note: The robot is about 2ft x 3ft base weighing in at 120 lbs. Any thoughts or suggestions appreciated.

How to estimate a robot's position depends on how well you'd like to estimate it. If you just need a rough guess, try odometry, it works OK. For better results, you have to incorporate more sensors. That's an incremental process that involves a lot of sensor fusion, and suddenly, you've built an Extended Kalman Filter.

The best way, in my opinion, is to use each sensor to form it's own estimate. Then, take a weighted average of the resulting estimates. The weights correspond to the certainty associated with each estimate. This, in essence is the Kalman Filter. What is missing is how to estimate the certainties. This is the hard part of the KF. Try some ad hoc values as a start. You'd be surprised how well this can work.

This is addressed as a first-principals question in any major robotics textbook and even here, on this site.

On this site, we have addressed many questions related to this problem.

and many more I've missed.

But honestly, these are heavy-handed approaches. You must understand the basics (estimating position from odometry, for example) to understand the rest.

Answered by Josh Vander Hook on January 6, 2022

I am not allowed to comment, so I have to add a reply. By position, do you mean the location in space (so X, Y coordinates), or orientation (tilt, etc)?

If position, you can use the accelerometer values and integrate acceleration to get distance traveled, though this is fairly inaccurate. We have tried to do this for a quadcopter, and the drift due to error is quite large.

You can use an accelerometer with a gyroscope together, and a Kalman filter to get a better idea for how far the robot has moved in each direction. Here is a previous discussion on this topic.

The tilt you can calculate directly from accelerometer values (but filter them, even an FIR filter would work ok).

Heading you can get from the gyroscope and/or the magnetometer. The gyroscope detects rotation, so make sure it is somewhere near the center of your robot (or whereever the axis of rotation is).

I hope that helps. I have to go teach, but I'll come back in an hour and add some more info.

Answered by Mewa on January 6, 2022

Related Questions

How to design a robot chassis so as to avoid bending issues?

1  Asked on October 3, 2021 by jash

Can I use a breadboard to power multiple SG90 servos?

0  Asked on October 3, 2021

Moment of Inertia of a Dumbbell

2  Asked on October 3, 2021 by kucar

Are there any tutorials for OMPL in Python?

1  Asked on October 3, 2021 by batini

Arduino and stepper motor

2  Asked on February 19, 2021

Is it OK to apply too many volts to Actobotics HD motors?

1  Asked on February 9, 2021

Is the covariance matrix in the extended Kalman filter guaranteed to be positive definite (ignoring numerical errors)?

1  Asked on January 20, 2021

Pictures coordinates to robot coordinates

1  Asked on January 14, 2021 by dairon

Not able to communicate with Roomba with serial port

1  Asked on January 9, 2021 by aalian-khan

Directly tapping Create2 battery through vacuum brush

2  Asked on January 6, 2021 by xabigarde

How to obtain the state space representation of a computed torque control system?

3  Asked on December 27, 2020 by james_erikson

Is it compulsary to learn Arduino programming in order to use Udoo Neo as an IOT device?

1  Asked on December 24, 2020 by farhan-ahmed

Path planning algorithm better than RRT* and Artificial Potential Field

2  Asked on December 21, 2020 by nikthebrick

How can I allow for this code to switch from remote control to autonomous?

1  Asked on December 15, 2020 by stackcode12

Not getting expected performance from kalman filter+mahalanobis distance

1  Asked on December 14, 2020

A Delivery Drone

1  Asked on December 6, 2020 by will

How to convert vertical motion to horizontal?

5  Asked on December 4, 2020 by boardbite

What should be the required operating voltage for Servo motors in my 5 DOF robotic arm, with 50 kg payload

0  Asked on November 18, 2020 by muzammil-ibrahim