Back to the blog
ROS + Sim Makes Vehicle Kinematics Look Easy

ROS + Sim Makes Vehicle Kinematics Look Easy

Alex from our controls team explains how to think about templating kinematic models so you can generalize your autonomy approach.

Alex Yuen
November 10, 2022

Vehicle kinematics are notorious for being overwhelming, frustrating, and time-consuming, but does it have to be?

Our team was tasked with working on the vehicle kinematics for our test tractor, lovingly nicknamed Farmonacci. 

The challenge was creating an accurate kinematic model, tuning the controls, then applying it to the actual tractor. 

Getting these kinematics right is a big step. It would mean that we could apply that model to any vehicle with the same steering kinematics, which in this case was an Ackermann-steered (basically, front-wheel steering) robot. 

We could then use this foundation to build off of future projects as long as we consider a few variables.

Applying Kinematics to Different Vehicles 

There are three key things to remember as you make your template and start to apply them to real vehicles:

(1) Understand the kinematic type. 

When you start your kinematic templating, step one is to fully understand what kind of autonomous vehicle you will be working on. For example, managing a project for a differential kinematic drive robot is very different from how you approach an omnidirectional robot. 

(2) Next, determine the base geometry.

To apply correct kinematics, first you have to understand the vehicle’s basic geometry. A semi-truck and a Fiat are going to have significantly different turning capabilities because of how long and wide they are, for instance.

(3) Remember that controls change from vehicle to vehicle.

While your base kinematic template may stay the same between two vehicles, controls may not. Some driving tasks require smooth, navigable driving, while others will need you to focus on accurate positioning. Both of these scenarios require very different approaches. A great way to deal with this is to have different sets of controllers for various applications.

Our Process for Kinematics

Luckily for us (and maybe you), ROS already has a kinematic template built in - our job then is to add the specifications needed to make it work. 

We measured the distance between the two wheels of our test tractor, along with the distance from the front wheels to the back wheels. Then, we used those distances to start defining things like how hard the wheels can turn, to find the minimum turning radius.

Controller Tuning

Once we defined the vehicle specifics in our model, our controller could understand the limits of what it could do. Now we’re ready to start tuning the controls. 

Normally without the tools we have, that would take significant field testing with the tractor to fine-tune how it handles and responds to the controls. Luckily, we’re able to test in simulation instead with our Caladan tool. 

Caladan - Making Simulation Simple

Caladan is a Gazebo simulation in which we use our autonomy engine for testing. 

Within this simulation, we could quickly tune some of the default TEB (timed elastic band) local planner numbers, without having to test on the physical vehicle. 

As much as we’d love to watch our tractor do a bunch of crazy turns in the field (which is what happens when you tune controls directly on the physical vehicle), it sucks up a ton of time and is tough on the machine.

After working in the simulation to key everything in, we ported everything over to the actual vehicle, which worked with a bit of additional fine-tuning. .

Simulations like Caladan are amazing. Live testing is a nightmare - the overhead of setting up a real vehicle is no joke. In a simulation, you can iterate over and over again quickly and without pressure. It saved us a bunch of time, and saved me personally from spending hours fiddling with a robot in a hot dusty field. 

Iteration and What Creating a Kinematic Template Enables

Now that we’ve set up our Ackermann kinematic model, we can use it as a template for any vehicles with the same steering type in the future without much overhead. 

Currently, we’re working to do the same for differential-drive and center-steered vehicles.

The Polymath approach of tackling autonomous vehicles on a broader scale means that our mindset differs from a classic robotics company that might focus on only one vehicle. 

We have the advantage of starting with this templating of things like kinematics that will make every other vehicle we integrate easier so that we don't have to reinvent the wheel every time.

What I Learned

The real takeaway for me from this project was how much starting in sim helped with cutting down our field testing time.

The outcome from tuning the vehicle in sim first was so good that I was honestly shocked! 

I’d originally set aside several days for translating the controls tuning from sim to the actual tractor, but in reality, everything ported so well that it ended up being a 20-minute job. The team finished up and looked at each other like... "So, what do we do for the next few hours?"

The lesson learned here is that with the right tools, even something as conceptually intimidating as kinematics can be made much more approachable. You just have to set yourself up for success with the right methodology and supporting tech.

Alex Yuen
Alex is an experienced mechatronics engineer at Polymath, specializing in the area of motion controls.

Alex is an experienced mechatronics engineer at Polymath, specializing in the area of motion controls.

Want to stay in the loop?

Get updates & robotics insights from Polymath when you sign up for emails.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.