# Motion Models in Self Driving Cars

## Introduction to Motion Models like the Bicycle Model, Odometry technique to calculate the new position of the vehicle and Yaw rate

Welcome to this medium article around Motion Models. Motion models account for the physics of a vehicle. So when we have a car, for example, and we give gas, it doesn’t go sideways, it goes forwards in a specific way and it might turn in circles. The mathematics according to how vehicles move is called a motion model.

Why do we have them? Well, they make it easier to predict. They also make it easier to track and do things like localization not just prediction and now we’re going to dive into this by studying a motion model called the bicycle model.

## Introduction

Hello everyone. Welcome to this medium article. In this article, we’re going to review vehicle movement and motion models so that we can predict where our self-driving car will be at some future time. Motion models are an important part of many localization algorithms. For example, motion models are used in the predictive step in Bayesian methods. After this article, you’ll be able to apply a bicycle model to estimate the position of the car given sensor data such as the number of wheel turns, velocity, and/or the yaw rate. Now let’s get started with some physics. In order to predict the location of a car, we need to take into account the way cars move, and for that we have the
bicycle motion model.

## Motion Model — Bicycle Model

How a car moves can easily be demonstrated by the bicycle model. Like all other models, it is based on several simplifying assumptions. First, we all ignore all vertical dynamics of the car, so we can assume the car only moves in 2D. This means no flying cars, unfortunately. Next, we’ll assume that, like a bicycle, the front wheels of the car are connected to the back wheels of the car by a rigid beam with fixed length. Here, we assume that the front two wheels act together so they can effectively be represented as one wheel, just like a bicycle.

The same holds for the two rear wheels. Finally, we assume the car is also controlled like a bicycle, with a steering angle theta and some longitudinal velocity in the direction that the car is heading. For this car, we change the steering angle by pi over 8 radians, and then the car moves forward at a velocity of 3 meters per second. We have just learned how the motion of a car can be simplified down to something similar to a bicycle, with a bicycle motion model. Next, we’ll get reminded how to use the yaw rate and velocity of a car to find its new position.

## Yaw-rate Velocity

To recap what we learned in sensor fusion, a car’s heading, or yaw angle, is its orientation. The value of Yaw is often derived from the x-axis in map coordinates with counter clockwise angles being positive. In this situation, the car’s yaw is positive pi over 4 radians. Assuming constant turn rate and velocity, the equations to find the new position of the car can be derived.

## Odometry

Now that we know one way to calculate the car’s new position, now let’s take a look at another technique to calculate the car’s new position which is called odometry based on motion sensor data. For mobile robots, the values for odometry comes from the sensors located on the wheel which measure how many times the wheels of the car or robot have turned. For instance, the sensor on this wheel would tell us it has turned twice. Given the circumference of the wheel and this odometry data, we can measure the distance travelled. Specifically, the new position of the car is equal to the starting position of the car plus the x and y components of the values given by odometry, multiplied by the circumference of the wheel. Awesome. With this knowledge, next I want you to think about when odometry measurements might fail to report accurate position estimates.

On a slick wet road, there will be errors in odometry values because the wheels will slip and due to this they will travel less distance than expected. Also, there may be error due to the wheels which will slide during braking, further contributing to sensor errors. However, on dry paved roads, the distance travelled by the wheels will be very close to the expected circumference of the wheel. Roads with lots of bumps also create problems for odometry because we are assuming the car travels a straight distance in the direction of its heading. In reality on a bumpy road, the car is traveling much of the distance up and down and not in a straight line. On a road with lots of turns, wheel odometry works well because even though the heading of the car is changing, it’s still moving the expected distance in the direction of its yaw. Notice that despite the fact that the distance vectors for the car are at different yaw angles, the sum of the absolute magnitude of all the vectors is the same as the expected distance travelled.

## References

1. Computer Vision Fundamentals — Self Driving Cars (Finding Lane Lines)

2. Introduction to Neural Networks For Self Driving Cars (Foundational Concepts Part — 1)

3. Introduction to Neural Networks For Self Driving Cars (Foundational Concepts Part — 2)

4. Introduction to Deep Learning for Self Driving Cars (Part — 1)

5. Introduction to Deep Learning for Self Driving Cars (Part — 2)

6. Introduction to Convolutional Neural Networks for Self Driving Cars

7. Introduction to Keras & Transfer Learning for Self Driving Cars

8. Introduction to Sensor Fusion for Self Driving Cars

9. Introduction to Localization for Self Driving Cars

10. Introduction to Functional Safety for Self Driving Cars

AI Engineer at DPS, Germany | 1 Day Intern @Lenovo | Explore ML Facilitator at Google | HackWithInfy Finalist’19 at Infosys | GCI Mentor @TensorFlow | MAIT, IPU

## More from Prateek Sawhney

AI Engineer at DPS, Germany | 1 Day Intern @Lenovo | Explore ML Facilitator at Google | HackWithInfy Finalist’19 at Infosys | GCI Mentor @TensorFlow | MAIT, IPU