zoompilot

zoompilot

a Mazda-optimized fork of sunnypilot.

for the CX-5, CX-9. My goal is to enable the best steering possible and support all SunnyPilot features on the 2022-2025 CX-5 staying within openpilot’s safety guidelines.

46G machine gray

tap your colour ;)

01

steering improvements

Using a data driven approach I reverse engineered the steering hardware and developed features to use the EPS to its full potential.

Speed-dependent torque
The EPS caps the steering torque it will deliver, and that cap changes with speed. We encode the whole curve, so openpilot knows the extra torque it has at low speeds and the reduced torque at high speeds. More confident in the neighborhood, fewer wobbles on the highway.
Speed-dependent tuning
Stock openpilot learns ONE lateral acceleration factor and ONE friction value for every speed. We let it learn across seven speed ranges instead, matching the EPS’s non-linear speed-dependent behaviour.
Rate-matched commands
The EPS accepts steering commands changing by up to 12 units a frame; stock asked for 10, leaving ~17% of that rate unused. We ask for the full 12, so torque ramps in faster.
Factory-matched specs
Steering ratio, mass, wheelbase, and steering lag, set to Mazda’s real figures and refined against thousands of miles of learned data, so commands land where the planner intends.

02

fix annoyances

The stock port threw warnings that should have only applied to pre-2022 cars. I pulled the logs from many drivers and cut the false ones. The real ones still fire.

Place hands on wheel alert
The Mazda port was built on pre-2022 cars, where an LKAS_BLOCK signal meant steering control was lost. Across thousands of logged miles from many drivers, we found 2022+ EPS keeps steering through LKAS_BLOCK. It mostly fires near a stop, or when stock LKAS loses the lane lines. Real faults still disengage; we just stopped alerting when the car is still steering.
Steering override hysteresis
The same override filter Hyundai, Ford, Tesla, and Rivian run. It weighs more frames before deciding you’ve taken the wheel, so a pothole or rough patch no longer trips a phantom takeover.

03

wire up sensors

Your CX-5 ships with sensors the stock port never reads. We wire them in.

Forward radar
A radar behind the front badge runs the factory cruise. We read it too: distance, angle, and closing speed for up to four cars ahead, fused with the camera. Braking and throttle stay factory.
Blind-spot monitors
The factory blind-spot sensors already watch the lanes beside you. We feed what they see into openpilot before every lane change.
Speed-limit signs
The camera already reads posted limits for your dash. We route those into speed-limit assist, which can set your cruise to match, so you’re not re-dialing at every sign.

04

radar cruise enhancements

The CX-5 keeps its factory cruise; zoompilot can set the speed for you by 'pressing' your wheel buttons.

Fixed ICBM
SunnyPilot's Intelligent-Cruise-Button-Management and Smart-Cruise are broken for Mazda. I fixed the set speed bugs and made enhancements to more reliably track what speed the user sets even when ICBM is pressing the set speed buttons.
Smart Cruise
A SunnyPilot feature that reduces your set speed before a curve in the road and sets it back after. You can use vision or downloaded maps to determine when to slow down. Enable in the 'cruise' settings menu.
Deceleration Overshoot (Smart Cruise)
An alpha feature to improve deceleration before a curve when using smart cruise. The mazda does not instantly react to adjustments in set cruise speed. This option reduces the set cruise speed MORE than what the model calls for in order to achieve more deceleration before a curve.

05

additional Mazdas covered

Not just the CX-5.

EPS swaps
Swapped a 2022+ CX-5 steering rack into an older Mazda? We fingerprint the rack by its firmware, not by the car openpilot thinks you’re driving, and steer it all the way to a stop.
CX-9
The CX-9 is also supported for all features, but speed-dependent-torque will require more time to learn as I only supply seeds for CX-5. We have also updated the CX-9 specs to match Mazda's official specs.

06

on device settings

You can manage most all of the settings from the device itself. :D

07

recommended setup

  1. Factory-reset the device before you install. A clean device carries no stale settings from a previous fork.
  2. Pick a driving model. I run Firehose. DTRv6 is a favourite and MacroStiff is great at high speed.
  3. Turn on torque control, self-tune, and speed-dependent self-tune. steering → torque control → self-tune → speed-dependent self-tune.
  4. Leave custom tune and manual real-time off. Let the car teach the software. That’s the point.

Want to slowdown for curves? Under cruise, turn on intelligent cruise button management, then pick smart cruise vision, maps, or both. Maps need a region downloaded through SunnyLink first.

08

install

custom software url

zephleggett/zoompilot

Type this when your comma device asks for a custom software URL during setup.

This is experimental software from a development branch. You drive the car, you follow the law where you live, and you carry the risk. It ships with no warranty and no liability for any damage or injury.

  1. Smart cruise decel overshoot New alpha toggle. The Mazda ECU is slow to obey a lower set speed, so this asks for more than the model wants and gets the deceleration the curve needs.
  2. ICBM fixes Fixed set-speed desync with the stock ECU and the target-chasing oscillation. Button presses are now suppressed while you press yours, and pacing adapts to how far the target is.
  3. EPS swap support 2022+ racks in older Mazdas fingerprint by the rack’s firmware and steer to a stop.
  4. Upstream sync Merged sunnypilot master and the opendbc upstream into zoompilot.