Mazda - commaai/openpilot GitHub Wiki

Mazda

◄ Home

Overview

Changing source code, using weighted lockout mitigation or changing EPS is all done at your own risk.

The Mazda community is strong, and most Mazda models are community supported with limitations. Out of the box, only CX-5 2022 and CX-9 2021 is officially supported. For all other models openpilot is only available in dashcam mode due to a steering lockout that occurs when driver does not touch the steering wheel for more than 5 seconds. Using Stock openpilot with Mazda models that have limitations requires source code changes, and always keeping your hands on the wheel or use of a weighted steering lockout mitigation or changing Electronic Power Steering motor (EPS) to 2021 CX-9 where compatible. Failure to overcome the steering lockout results in the car not responding to steer commands from openpilot.

To change source code from dashcam only mode, change the line in selfdrive/car/mazda/interface.py here(//github.com/commaai/openpilot/blob/master/selfdrive/car/mazda/interface.py#L25) from:

ret.dashcamOnly = candidate not in [CAR.CX9_2021]

to

ret.dashcamOnly = False

If you don't want to make source code change, you can use Mazda community fork, see the link at the bottom of this page.

Make-Specific Terms

For general terms, go here.

Mazda I-ACTIVSENSE is an umbrella term that Mazda uses to describe a series of advanced safety and driver assistance technologies such as ACC, LKAS, Blind-spot monitoring, Smart City brakes and so on. Most models/trims from 2017 and newer come with ACC and LKAS as standard options.

Term Abbreviation Definition
Mazda Radar Cruise Control MRCC Mazda Adaptive Cruise Control - ACC
Lane-Keep Assist System LAS Mazda LKAS

Supported models

Official Community Supported Models

  • 2021 CX-9
  • 2022 CX-5

Community Supported Models with Limitation

  • 2017-2020 CX-9 (2019 and 2020 models have twice the torque compared to earlier years)
  • 2017-2021 Mazda 6, and CX-5
  • 2017-2018 Mazda 3
    • 2019 Mazda 3 / CX-30 and newer use a new driver assistance system and is not yet supported, comma connector is not correct
  • 2017-2020 CX-3 (needs confirmation)

Note: Some earlier year models 2016-2017 models that are equipped with LKAS are known to work with the Community fork but may require a different connector than the Mazda development connector sold at comma shop.

Mazda openpilot Capabilities

Lateral Control

Mazda LKAS is not available on low speeds. In particular, LKAS is not available until the car drives above 32mph/52kph. LKAS gets disabled when the speed goes below 28mpg/45kph. When OP is engaged but stock LKAS is not available, OP continues to be engaged but will not steer and will display a warning about steering being unavailable.

Torque

CX-9 2019-2021 offer the best torque among Mazda cars. They offer twice the torque compared to other models/years allowing them to make tighter turns even on city streets. For other cars the available steering torque is adequate for most highway driving conditions. City driving requires driver intervention on sharp turns.

Minimum Speeds

  • LKAS is allowed when the car drives above 32mph
  • LKAS is not allowed when the speed dips below 28mph

Longitudinal Control

Longitudinal control is not supported by OP with Mazda. OP relies on the stock MRCC to control speed. MRCC support follow-to-stop to 0mph and automatic resume if the stop is less than three seconds. OP improve on that by allowing the car to resume without driver intervention after longer delays. Even though MRCC works down to 0mph, the lowest allowed set speed is 19mph.

Custom solutions:

Note: Mazda harness is available at comma shop. Look for "Mazda Harness" when you select a vehicle if your exact Mazda model is not listed.

Harness Connector parts:

Harness wiring:

Mazda harness

Note: Power is supplied to the Comma device via the OBD port from the Comma Power and RJ45 cable.

Steering Lockout Mitigation

Developer TODOs

  • Steer down to zero
  • Steer without lockout
  • openpilot longitudinal control (without intercepting the front radar CANBUS)

See Also