Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mazda: Slower rate for ACC cancel msg to avoid cruise disable #1615

Merged
merged 2 commits into from
Jun 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions selfdrive/car/mazda/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ def update(self, enabled, CS, frame, actuators):
CS.out.steeringTorque, SteerLimitParams)
self.steer_rate_limited = new_steer != apply_steer

if CS.out.standstill and frame % 50 == 0:
if CS.out.standstill and frame % 20 == 0:
Copy link
Contributor

@adeebshihadeh adeebshihadeh Jun 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use DT_CTRL instead? It's in common.realtime

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not familiar with it pointer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to leave this as is for now @adeebshihadeh as it works fine now. DT_CTRL will require more code changes and more test drives which delay things if we want to get these fixes in 0.7.6.

# Mazda Stop and Go requires a RES button (or gas) press if the car stops more than 3 seconds
# Send Resume button at 2hz if we're engaged at standstill to support full stop and go!
# Send Resume button at 5hz if we're engaged at standstill to support full stop and go!
# TODO: improve the resume trigger logic by looking at actual radar data
can_sends.append(mazdacan.create_button_cmd(self.packer, CS.CP.carFingerprint, Buttons.RESUME))
else:
apply_steer = 0
self.steer_rate_limited = False
if CS.out.cruiseState.enabled and frame % 10 == 0:
if CS.out.cruiseState.enabled and frame % 20 == 0:
# Cancel Stock ACC if it's enabled while OP is disengaged
# Match stock message rate which is sent at 10hz
# Send at a rate of 5hz until we sync with stock ACC state
can_sends.append(mazdacan.create_button_cmd(self.packer, CS.CP.carFingerprint, Buttons.CANCEL))

self.apply_steer_last = apply_steer
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/car/mazda/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), has_relay=False,
ret.lateralTuning.pid.kf = 0.00006

# No steer below disable speed
ret.minSteerSpeed = LKAS_LIMITS.DISABLE_SPEED * CV.KPH_TO_MS
ret.minSteerSpeed = round(LKAS_LIMITS.DISABLE_SPEED * CV.KPH_TO_MS)

ret.centerToFront = ret.wheelbase * 0.41

Expand Down