# Ackermann Motion Model Does not Drive in an Arc, but Turns on the Spot

Im trying to implement an ackermann motion model which estimates the x,y and theta for a robot I have.

I have a gazebo simulation running which publishes a steering angle for the virtual tricycle wheel and I have a linear velocity for the back wheel.

I publish the ground truth odometry and transform which I can display in Rviz.

I then use the published values to compute a deltaX, deltaY and deltaTheta for a pose update. If the steering angle is 0, it works fine as the deltaX = linear velocity. However, when I have both values non zero, my robot moves in an arc, but my motion model turns on the spot instead.

The formulae for motion estimation and pose update are taken from "Simultaneous Localization and Mapping for Mobile Robotics" by Juan Antonio Fernandez-Madrigal.

Any ideas where I have made a mistake?

Edit: I will provide the formulae I use here

$u = (v,alpha)$ , where v is the linear velocity form the driving wheels and alpha is the steering angle (in radians)

$l = wheel base$ i.e the distance between the front and back wheel

$w = \frac{v*sin(alpha)}{l}$

$dx = \frac{l * sin(w)}{tan(alpha)}$

$dy = \frac{l * (1-cos(w))}{tan(alpha)}$

Pose Update:

$x_{new} = x + (dx*cos(theta) - dy*sin(theta))*dt$

$y_{new} = y + (dx*sin(theta) + dy*cos(theta))*dt$

$theta_{new} = theta + w*dt$

Ofcourse if alpha = 0 then $delta_x = v$

edit #2. I fixed the problem, but I do not understand the solution.

The first issue was that I did not incorporate the linear velocity into my equation when rotating.

This gives :

$dx = \frac{v*l * sin(w)}{tan(alpha)}$

$dy = \frac{v*l * (1-cos(w))}{tan(alpha)}$

Now the robot drives in an arc! But the arc is wrong. Now I changed the update equation to:

$dx = \frac{v*l * cos(w)}{tan(alpha)}$

$dy = \frac{v*l *sin(w)}{tan(alpha)}$ The rotational arc now seems correct. The rotational speed is still lower (not such an issue), but I dont understand why this works rotation works. I.e. why the $1-cos(x)$ factor gets changed to $sin(x)$ etc.

The first ackermann model presented is based on dead reckoning, i.e. it needs wheel encoders. The ackermann model in edit 2 is based of velocity.

It can be found here:

https://pdfs.semanticscholar.org/5849/770f946e7880000056b5a378d2b7ac89124d.pdf

You may get this behavior if your model has no offset between the steering and drive wheels.

• You make a good point. it seems to related to this. I do model that offset in my motion model, but the value is very small. 0.26 (meters) taken from my gazebo model. When I increase the value by a factor of 10, I have the inverse problem that my rotation is too small by 10, so I have to compensate. Is this normal that these physical measurements can be off by a factor? May 6 '18 at 10:36
• That begins to sound more like a unit conversion problem. e.g., maybe some portion of the code assumes meters and is given centimeters. Alternatively, you could be mixing up radians and degrees. May 6 '18 at 17:17
• Hi @surtur. Thanks for your answer but we are looking for comprehensive answers that provide some explanation and context. Very short answers cannot do this, so please edit your answer to explain why it is right, ideally with citations. Answers that don't include explanations may be removed.
– Ben
May 6 '18 at 17:27
• @surtur I will check. Thank you. In the meantime I have updated my post with the formulae I use. May 6 '18 at 19:19