openpilot icon indicating copy to clipboard operation
openpilot copied to clipboard

New Mazda Gen 4 Port

Open MoreTore opened this issue 2 years ago • 13 comments

Checklist

  • [ ] added entry to CarInfo in selfdrive/car/*/values.py and ran selfdrive/car/docs.py to generate new docs
  • [x] test route added to routes.py
  • [x] route with openpilot: 164080f7933651c4|2022-12-02--08-05-29--37
  • [x] route with stock system: 164080f7933651c4|2022-12-01--16-19-34

MoreTore avatar Dec 18 '22 22:12 MoreTore

@sshane what are the odds we get this port added to release 9.1?

MoreTore avatar Dec 21 '22 01:12 MoreTore

Is this port ready for review? Everything should be in a working, final state?

sshane avatar Dec 21 '22 02:12 sshane

@sshane Just wondering what the deadline is to get it in 0.9.1 . It's almost ready, just need to finish panda safety limits.

MoreTore avatar Dec 23 '22 03:12 MoreTore

@sshane maybe you can figure out what im doing wrong with my panda safety.

const SteeringLimits MAZDA_2019_STEERING_LIMITS = {
  .max_steer = 8000,
  .max_rate_up = 45,
  .max_rate_down = 80,
  .max_rt_delta = 3500,
  .max_rt_interval = 250000,
  .driver_torque_factor = 1,
  .driver_torque_allowance = 1500,
  .type = TorqueDriverLimited,
};
if (steer_torque_cmd_checks(desired_torque, -1, MAZDA_2019_STEERING_LIMITS)) 
{
tx = 0;
}

steer_torque_cmd_checks() returns true when trying to apply torque so I have it disabled for now.

MoreTore avatar Dec 27 '22 13:12 MoreTore

I can check it out when I'm back. Nice work on the port so far!

sshane avatar Dec 29 '22 23:12 sshane

Thank you thank you!

MoreTore avatar Dec 30 '22 00:12 MoreTore

Once this is merged I will add the auto-resume logic because the stock system requires a button press. I already have long control working but I feel it needs some tweaking and testing. Namely the following distance, stopping distance, and the AEB signal needs to be tested somehow.

Side note, I am hoping you guys will add more variables in cereal to dynamically change following distance and comfort-acceleration settings. Another big issue for me is when accelerating from a stop when the roads are slippery the tires lose traction and OP just floors it 💯 ! Should be fairly easy to detect this situation by comparing wheel speeds against measured accel.

MoreTore avatar Dec 30 '22 01:12 MoreTore

I figured out my issue with the panda safety. It was a type casting issue.

MoreTore avatar Dec 30 '22 19:12 MoreTore

I am having a lot of trouble with the torque tuning. It works pretty good at high speeds with some very minor ping pong, but during a low speed turn it will jerk the wheel and I need to take over. I tried playing with the low_speed_factor table but that just makes it not steer enough. It's like the self centering force is high because as soon as the steer command backs off the steering wheel straightens out fast.

MoreTore avatar Jan 05 '23 17:01 MoreTore

Does this Mazda platform have a steering lockout?

adeebshihadeh avatar Jan 07 '23 01:01 adeebshihadeh

@nuwandavek I found a good simple solution to the non-linear steering torque problem. I created a new function torque_from_lateral_accel_non_linear(). Very simple modification and now I have perfect a steering tune. It would be interesting to see if this applies to the other non-linear vehicles.

It requires an addition to cereal. linear Bool and latAngleFactor Float32. https://github.com/commaai/openpilot/pull/27016

MoreTore avatar Jan 19 '23 20:01 MoreTore

@MoreTore Are you on Discord? Do these cars have any LKAS lockouts?

sshane avatar Feb 16 '23 23:02 sshane

No you guys ban me lol! Yea there is a lockout timer. Personally I have bypassed them with a ti. Just leave the car in dash cam mode for now.

MoreTore avatar Feb 17 '23 14:02 MoreTore

Have you found a way around the lockout, what does it do?

sshane avatar Aug 17 '23 04:08 sshane

@adeebshihadeh why was the PR closed?

prusnak avatar Aug 17 '23 19:08 prusnak

The author has been banned for advertising a torque interceptor; see this post for some context. If you or someone else would like to pick up this work, feel free to fork and open a new PR.

adeebshihadeh avatar Aug 17 '23 19:08 adeebshihadeh