0.4 Optimize for Gas, Time, and Comfort
0.2 optimized time. 0.3 optimized gas. Real deliveries care about both — and about whether the ride feels like a roller coaster. That third score is comfort, and it starts with jerk.
What is jerk?
Acceleration is how fast velocity changes. Jerk is how fast acceleration changes:
Units are m/s³. In the bang-bang plans of 0.2–0.3, force (and ) jumped instantly between levels. That is an infinite spike of jerk at each switch — fine for a math toy, rough on a pizza and a neck.
Here the vehicle still obeys with , but may only slew toward a commanded value at a limited rate . Soft means gentle ramps of ; large recovers nearly bang-bang.
Comfort as peak |jerk|
Many comfort metrics exist (, ride indices, …). We use a simple one that matches the hardware knob:
If the plan never asks for more than , then . Lower → lower peak jerk → more comfortable (and usually slower).
A three-term cost with equal weights
Time , gas , and comfort have different units. You cannot literally add seconds to newton-seconds to m/s³. So we normalize each term by a fixed reference, then sum with equal weights :
The references (, , ) are constants shown in the playground — yardsticks so a “1” means “about as bad as a harsh baseline on that axis.” Changing the references would change the trade-off; keeping weights equal and refs fixed makes comparisons fair across presets.
Still the same door constraints:
Try it
Compare Harsh, Balanced, Comfort, and Sip gas + soft. Read the three normalized terms and the total . Open Data for , , , , and the running cost.
- Time T
- 0.00 s → T/T_ref = 0.00
- Gas G = ∫|F| dt
- 0 → G/G_ref = 0.00
- Comfort (peak |j|)
- 0.00 m/s³ → J_peak/J_ref = 0.00
- Total cost J
- 0.00 = sum of the three (equal weights)
Acceleration slews toward ±F/m at |j| ≤ j_max. Soft jerk = comfort; watch the cost.
Refs (fixed): T_ref = 12 s, G_ref = 40000, J_ref = 8 m/s³.
Discussion
A single number hides a fight among objectives. Slamming force and jerk wins the clock and loses comfort (and often gas). Feathering wins comfort and loses time. Small peak force sips gas but stretches . Equal weights after normalizing do not mean “equally important in the real world” — they mean “we chose to treat a reference amount of each as one unit of regret.”
Later, Section 4.1 (LQR) will put those tastes into matrices and . Here the pizza run is enough: move the sliders, watch , and feel that multi-objective control is about choosing what hurts.
A note about not reaching the door exactly
The math wants on the nose. The playground usually lands a little short.
Braking starts when a quick preview says “a jerk-limited stop still fits in the remaining distance.” That preview is discrete and padded slightly so the car does not blow past the door. Starting a bit early, plus freezing while settles to zero in the rest phase, means with more often than not.
“At the door” here means within a small tolerance — about half a meter, or of , whichever is larger — the same spirit as sections 0.2 and 0.3. Only if the trajectory overshoots does the sim snap back to . Exact landing is a harder planning problem; for this chapter, a comfortable stop near the door is enough.
If you want to learn how to reach without error, keep reading — that comes in Section 4.2.