opendbc icon indicating copy to clipboard operation
opendbc copied to clipboard

GM: fix ASCMGasRegenCmd scale and units

Open sshane opened this issue 2 years ago • 1 comments

Correct scaling and offset now. Plus checksum is 1 bit larger, which captures that fake inverse bit, removed some set mes.

Opened to preserve, will verify later.

This does not change behavior.

sshane avatar Sep 12 '23 07:09 sshane

This update would allow 2 m/s^2 acceleration on GM trucks. The extra bits added to GasRegenCmd are needed to achieve this.

garrettpall avatar Jan 04 '24 00:01 garrettpall

I would like to understand why the force doesn't match positive aEgo before we merge (Bolt)

image

sshane avatar Oct 01 '24 23:10 sshane

Is there anything needed from me to support this fix?

1454 avatar Oct 01 '24 23:10 1454

Is there any progress on this to help us GM1500 folks with painfully slow acceleration? It's borderline unusable.

You can start by providing a route showing this issue or ideally running the longitudinal maneuver tool.

sshane avatar Oct 01 '24 23:10 sshane

What is "accel from force"/what's it's formula?

garrettpall avatar Oct 01 '24 23:10 garrettpall

Is there any progress on this to help us GM1500 folks with painfully slow acceleration? It's borderline unusable.

You can start by providing a route showing this issue or ideally running the longitudinal maneuver tool.

Is there any progress on this to help us GM1500 folks with painfully slow acceleration? It's borderline unusable.

You can start by providing a route showing this issue or ideally running the longitudinal maneuver tool.

I'll get that to you tomorrow or Thursday at the latest. Thanks Shane.

1454 avatar Oct 01 '24 23:10 1454

a = F/m

sshane avatar Oct 01 '24 23:10 sshane

Is there any progress on this to help us GM1500 folks with painfully slow acceleration? It's borderline unusable.

You can start by providing a route showing this issue or ideally running the longitudinal maneuver tool.

dc7716b32bf25574/00000009--a7db12be52/0

Please check the above route to see if this works 🤗

morrislee avatar Oct 13 '24 00:10 morrislee

dc7716b32bf25574/00000009--a7db12be52

Route is private

garrettpall avatar Oct 13 '24 15:10 garrettpall

dc7716b32bf25574/00000009--a7db12be52

Route is private

made public and preserved now

morrislee avatar Oct 13 '24 16:10 morrislee

a = F/m Screenshot 2024-10-13 at 3 38 40 PM

Screenshot 2024-10-13 at 3 36 51 PM Screenshot 2024-10-13 at 3 37 21 PM

Factoring in the gas delay, it all looks reasonable

CoeffDrag = .30 (seems stable)
CoeffRolling = 0.008 (seems stable)
tireRadius = 0.42 (varies by car)
frontalArea = 3.971605 (varies by car)
g = 9.81 (constant)
airDensity = 1.225 (constant)
torque = value (gasRegenCmd)
mass = v1
vego = v2

accel = ((torque / tireRadius) - (.5*CoeffDrag*frontalArea*airDensity*vego*vego) - (CoeffRolling*mass*g))/mass 

return (accel)

XT4:

tireRadius = 0.37
frontalArea = 3.13

image

Silverado:

tireRadius = 0.42
frontalArea = 3.97

image

Bolt:

tireRadius = 0.32
frontalArea = 2.85

image

garrettpall avatar Oct 13 '24 19:10 garrettpall

F_rolling isn't doing too much and could probably be removed. To be complete we should also add a F_pitch term to compensate for vehicle pitch going up and down hills.

Screenshot 2024-10-13 at 6 52 52 PM

or

Screenshot 2024-10-13 at 6 54 30 PM

image

garrettpall avatar Oct 13 '24 22:10 garrettpall

What else would you need to get this moving again? This PR has been over a year now :( Would love to see some love for GM peeps

morrislee avatar Oct 18 '24 03:10 morrislee

What else would you need to get this moving again? This PR has been over a year now :( Would love to see some love for GM peeps

Unfortunately until there is a way to tell the Trailblazer and Silverado apart, any tuning efforts have to apply to both. Giving a Trailblazer the same torque command as a Silverado will not act the same.

garrettpall avatar Oct 18 '24 19:10 garrettpall

I made a test branch without pitch compensation and linear fitting wheelbase to tire size and frontal area.

Old: image

New: image image

garrettpall avatar Oct 18 '24 19:10 garrettpall

Panda needs a corresponding change, it's also only checking 12 bits wide: https://github.com/commaai/panda/blob/9aec4294cc940964a5b2fa34aa83301ab408b377/board/safety/safety_gm.h#L137

I'm not super stoked the "over-actuation" from people test driving this gets through Panda safety checks. I'm guessing the overflow was still within bounds. Protection against setting undefined bits is a worthwhile but separate conversation.

jyoung8607 avatar Oct 19 '24 02:10 jyoung8607

Panda needs a corresponding change, it's also only checking 12 bits wide: https://github.com/commaai/panda/blob/9aec4294cc940964a5b2fa34aa83301ab408b377/board/safety/safety_gm.h#L137

I'm not super stoked the "over-actuation" from people test driving this gets through Panda safety checks. I'm guessing the overflow was still within bounds. Protection against setting undefined bits is a worthwhile but separate conversation.

Since there currently isn’t a good way to check torque in panda since it changes based on vehicle for a given accel, my current test branches impose the same old limits in panda and car controller:

https://github.com/garrettpall/openpilot/blob/d890a448cd2a8d22b5a31e324e73cb875b20bdf2/opendbc_repo/opendbc/car/gm/carcontroller.py#L104

Needing to go over that limit is really only helpful with large vehicles like the Silverados which currently only get 1 m/s/s with the current limits, but the formal scales correctly and gives an accurate response. On frog pilot where we already include the extra bits for more acceleration we changes the panda checks to include the extra bits also:

https://github.com/FrogAi/FrogPilot/blob/0e68dff54ba937c0cfabfd6f0f54856010fd543e/panda/board/safety/safety_gm.h#L246

While yes, there is a way to modify the limits unsafely so it basically has no limit, we are not doing that.

TL/DR: The test branches for the formula have been implanted keeping the current limits intact and the formula is only used for command mapping.

garrettpall avatar Oct 19 '24 10:10 garrettpall

To be completely clear, it's fine that you're testing fixes here, just saying the signal width fix has two parts that need to merge together. If we need to allow higher torque demand for heavier vehicles, we can add safety parameter settings in a follow-up round.

jyoung8607 avatar Oct 19 '24 13:10 jyoung8607