More info on various CAN messages

Based on my own logs captured, as well as
https://blog.toyobaru.es/index.php?tag/BusCAN
This commit is contained in:
Timur Iskhodzhanov 2020-09-11 00:16:41 -07:00
parent cba81931e2
commit 0cf0ac475b
1 changed files with 17 additions and 9 deletions

View File

@ -17,7 +17,7 @@ accelerometers.
Channel name | Equation | Notes
------------ | -------- | -----
Steering angle | `bytesToIntLe(raw, 0, 2) * 0.1` | Also available in `0xD0`
Steering angle | `bytesToIntLe(raw, 0, 2) * -0.1` | Also available in `0xD0`
??? | `C` or `bytesToIntLe(raw, 2, 1)` | The value is 112 most of the time for me
??? | `D` or `bytesToIntLe(raw, 3, 1)` | 014 sawtooth
??? | `E` or `bytesToIntLe(raw, 4, 1)` | The value is 0 most of the time for me
@ -33,7 +33,8 @@ Channel name | Equation | Notes
------------ | -------- | -----
Steering angle | `bytesToIntLe(raw, 0, 2) * 0.1` | Also available in 0x18
Z rate of rotation | `bytesToIntLe(raw, 2, 2) * -0.286478897` | The multiplier for º/sec appears to be ((90 / pi) * 100)
??? | bytes 4, 5 |
??? | `E` | Some flags?
??? | `F` | Some flags?
Lateral acceleration | `bytesToIntLe(raw, 6, 1) * 0.2` | Not 100% sure about the multiplier, but looks about right
Longitudinal acceleration | `bytesToIntLe(raw, 7, 1) * -0.1` | Not 100% sure about the multiplier, but looks about right
Combined acceleration | `sqrt(pow2(bytesToIntLe(raw, 6, 1) * 0.2) + pow2(bytesToIntLe(raw, 7, 1) * 0.1))` |
@ -41,11 +42,13 @@ Combined acceleration | `sqrt(pow2(bytesToIntLe(raw, 6, 1) * 0.2) + pow2(bytesTo
## PID 0xD1
Update frequency: 50 times per second.
Length: 4 bytes
Channel name | Equation | Notes
------------ | -------- | -----
Speed | `bytesToIntLe(raw, 0, 2) * 0.015694` | May want to check the multiplier against an external GPS device
Brake position | `min(C / 0.7, 100)` | The third byte is the pressure in the brake system, in Bars. The 0.7 divider seems to be a good value to get 100% at pressure slightly higher than those you're likely to use on the track for cars with no aero. You can use 0.8 or 0.9 if you see 100% too often.
??? | D | Always 0?
## PID 0xD4
@ -66,11 +69,15 @@ Channel name | Equation | Notes
------------ | -------- | -----
Accelerator position | `A / 2.55`
Clutch position | `(B & 0x80) / 1.28` | On/off only
??? | B & 0x70 | Unused?
??? | B & 0x0f | 015 counter?
Engine RPM | `C + (D & 0x3f) * 256`
??? | `D & 0xc0`
??? | byte 4
Throttle position | `F / 2.55` | Not tested
??? | bytes 6, 7
??? | `D & 0x80` | Always 0?
??? | `D & 0x40` | 1 when accelerator pedal is released, 0 otherwise
Accelerator position | `E / 2.55` | Not clear what's the difference from the other two
Accelerator position | `F / 2.55` | Not clear what's the difference from the other two
Throttle position | `G / 2.55` | Not tested
??? | H | Some flags
## PID 0x141
@ -80,9 +87,10 @@ Channel name | Equation | Notes
------------ | -------- | -----
Accelerator pedal position? | `bytesToIntLe(raw, 0, 2)` | Follows `A` from `0x140` closely with ~9860 for 0% and ~11625 for 42%. Needs more testing.
Throttle position? | `bytesToIntLe(raw, 2, 2)` | Follows the accelerator pedal position with some extra smoothness. Independent at idle revs, and you can see it changing in response to modulating the clutch in stop and go traffic. Scale is unknown.
Engine RPM? | `E + (F & 0x3f) * 256`
??? | `F & 0xc0`
Gear | `(G & 0xF) * (1 - (min(G & 0xF, 7)) / 7)` | It's basically just `G & 0xF` but neutral is reported as `7`, hence the complex math to turn it into a 0. The reverse gear is reported as `1`. The value can be wrong when the clutch pedal is depressed.
Engine RPM | `E + (F & 0x3f) * 256`
??? | `F & 0x80` | 1 when accelerator pedal is released, 0 otherwise
??? | `F & 0x40` | Always 0?
Gear | `(G & 0xf) * (1 - (min(G & 0xf, 7)) / 7)` | It's basically just `G & 0xf` but neutral is reported as `7`, hence the complex math to turn it into a 0. The reverse gear is reported as `1`. The value can be wrong when the clutch pedal is depressed.
??? | `G & 0xF0` | I saw values of 128, 160, 192 here.
??? | `H` | Equals to 16 when I lift off the accelerator, then turns to 8, then 0.