θm·gm·g·sin θF_cmd = m·g·sin(θ) + F_PID(e)#PRODUCTIONADAS003
← All writing
#ProductionADAS · 003

Why is the car stuck on an incline?

A 3-degree ramp, a P-controller that settled short, and the feedforward term that fixed it.

Raghu Ram Theerthala · 16 Jun 2026 · 2 min read

When I was actively testing the Parking feature in the first few months of KPIT, we faced a peculiar problem on a testing track. The parking on a flat road was working fine, but the car used to get stuck on an incline. For me to notice that the track was inclined, it took a couple of runs. It was a 3-degree incline. The plan was clean, the tracker was locked on, and the car just... gave up partway up and sat there.

My first fix was the obvious one: raise the speed limit, lift the saturation cap. It worked. The car reached the spot. I felt good for about an hour, until I pictured that the car might go on a different ramp at a different angle. We can't raise the limits for each specific scenario. The simple thought that followed is force balance.

On flat ground, a small drive force is enough, you're only fighting rolling resistance. On a ramp, gravity adds a constant pull down the slope: mg·sin(θ). Your drive force now has to beat that before it produces any net motion. And here's the part that reframed it for me: a proportional controller only reacts after an error appears. But gravity isn't an error that comes and goes. It's there the entire time, constant, from the instant you touch the slope.

A proportional controller can't hold against a constant force. It settles where its output matches gravity, and that settling point sits short of the target by a fixed gap. The car was doing exactly what a P-controller does.

We need to generate a forward force that overcomes the mg·sin(θ) of this 1600 kg vehicle. How much force should we generate through wheel torques?

F_cmd = mg·sin(θ) + F_PID(error)

The first term cancels gravity before any error shows up. Your feedback loop is back to handling the small stuff - friction, model error, transients.

And the elegant part: the same term handles everything. Uphill, sin(θ) is positive, push harder. Flat, it's zero, the term vanishes and nothing changes.

Downhill, sin(θ) goes negative and it becomes a braking command, because now gravity is helping and you need to hold the car back. That's the fix it needed. Now it's on the way to work in real-world variable ramp scenarios.

The deeper detail, out of scope of this post, is that you can't just read pitch straight off the IMU. The accelerometer can't tell your own forward acceleration from gravity, and it gets fooled exactly when you're accelerating up the ramp. You fuse it with the gyro and cross-check against the vertical axis, because real grade and fake tilt split gravity differently.

I will share my next post on this aspect. Did you also face a situation where you thought your system was ready and a surprise came all of a sudden?

#VehicleControl#Feedforward#ProductionADAS

First published on LinkedIn · 30 reactions · 5 comments · join the conversation there

Read on LinkedIn ↗