From 300f48c1e417acbde5073282cee5935b62dba15e Mon Sep 17 00:00:00 2001 From: Timur Iskhodzhanov Date: Mon, 30 May 2022 23:45:15 -0700 Subject: [PATCH] Add initial info on the CAN data channels for gen2 cars --- can_db/ft86.md | 6 +++--- can_db/ft86_gen2.md | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 can_db/ft86_gen2.md diff --git a/can_db/ft86.md b/can_db/ft86.md index 60048ac..7db94eb 100644 --- a/can_db/ft86.md +++ b/can_db/ft86.md @@ -12,6 +12,7 @@ Channel name | CAN ID | Equation | Notes ------------ | --- | -------- | ----- Accelerator position (%) | 320 | `A/2.55` | Brake position (%) | 209 | `min(C / 0.7, 100)` | 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. +Brake pressure | 209 | `C * 128` | Steering angle | 208 | `bytesToIntLe(raw, 0, 2) * 0.1` | Positive value = turning right. You can add a `-` if you prefer it the other way around. Speed | 209 | `bytesToIntLe(raw, 0, 2) * 0.015694` | May want to check the multiplier against an external GPS aevice Engine RPM | 320 | `bitsToUIntLe(raw, 16, 14)` | @@ -31,14 +32,13 @@ all other channels. Channel name | CAN ID | Equation | Notes ------------ | --- | -------- | ----- -Brake pressure | 209 | `C * 128` | Clutch position | 320 | `B & 0x80 / 1.28` | Only 0% and "not 0%", unfortunately. Gear | 321 | `(G & 0xf) * (1 - (min(G & 0xf, 7)) / 7)` | Car calculates it based on speed, RPM and clutch position. It's pretty slow. I really doubt it's worth wasting one CAN ID for this channel. It's not that hard to see which gear you're in based on speed and RPM in data. Throttle position | 320 | `G / 2.55` | This is the throttle *valve*, not pedal. Lateral acceleration | 208 | `bytesToIntLe(raw, 6, 1) * 0.2` | Data is noisy. Longitudinal acceleration | 208 | `bytesToIntLe(raw, 7, 1) * -0.1` | Data is noisy. Combined acceleration | 208 | `sqrt(pow2(bytesToIntLe(raw, 6, 1) * 0.2) + pow2(bytesToIntLe(raw, 7, 1) * 0.1))` | -Yaw rate | 208 | `bytesToIntLe(raw, 2, 2) * -0.286478897` | Or is this "Yaw rate"? +Yaw rate | 208 | `bytesToIntLe(raw, 2, 2) * -0.286478897` | Wheel speed FL | 212 | `bytesToIntLe(raw, 0, 2) * 0.015694` | Use same multiplier as for "Speed". Wheel speed FR | 212 | `bytesToIntLe(raw, 2, 2) * 0.015694` | Use same multiplier as for "Speed". Wheel speed RL | 212 | `bytesToIntLe(raw, 4, 2) * 0.015694` | Use same multiplier as for "Speed". @@ -104,7 +104,7 @@ Update frequency: 50 times per second. Channel name | Equation | Notes ------------ | -------- | ----- Steering angle | `bytesToIntLe(raw, 0, 2) * 0.1` | Also available in 0x18 -Yaw rate | `bytesToIntLe(raw, 2, 2) * -0.286478897` | The multiplier for º/sec appears to be ((90 / pi) * 100). Or is this "yaw rate"?.. +Yaw rate | `bytesToIntLe(raw, 2, 2) * -0.286478897` | The multiplier for º/sec appears to be ((90 / pi) * 100). ??? | `E` | Some flags? ??? | `F` | Some flags? Lateral acceleration | `bytesToIntLe(raw, 6, 1) * 0.2` | Not 100% sure about the multiplier, but looks about right diff --git a/can_db/ft86_gen2.md b/can_db/ft86_gen2.md new file mode 100644 index 0000000..f013580 --- /dev/null +++ b/can_db/ft86_gen2.md @@ -0,0 +1,38 @@ +# FT86 gen2 cars (2022 Subaru BRZ, Toyota GR86) + +For details on how to connect to the CAN bus, as well as more information on the +information available on the CAN bus, see https://github.com/timurrrr/ft86/blob/main/can_bus/gen2.md + +Note: the gen2 CAN IDs require some code changes to this CAN bus reader project +(such as different rate limiting parameters) that haven't been pushed to GitHub +yet. Stay tuned! + +Special thanks to Ken Houseal for his early legwork on finding some of these +data mappings! + +## Recommended CAN IDs: + +Here are CAN IDs and RaceChrono equations for data channels that should be enough +for most people: + +Channel name | CAN ID | Equation | Notes +------------ | --- | -------- | ----- +Accelerator position (%) | 64 | `E / 2.55` | +Brake position (%) | 313 | `min(F / 0.7, 100)` | 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. +Brake pressure | 313 | `F * 128` | Coefficient taken from 1st gen cars, seems to match fine? +Steering angle | 312 | `bytesToIntLe(raw, 2, 2) * 0.1` | Positive value = turning right. You can add a `-` if you prefer it the other way around. +Speed | 323 | `bytesToIntLe(raw, 3, 2) * 0.015694` | May want to check the multiplier against an external GPS aevice +Engine RPM | 64 | `bitsToUIntLe(raw, 16, 14)` | +Coolant temperature | 837 | `E - 40` | +Engine oil temperature | 837 | `D - 40` | + +Below is a table with a few more data channels that might be useful for more +detailed analysis. When adding more channels, be aware that it might negatively +affect the update rate of the more essential channels, due to limited Bluetooth +bandwidth. + +TODO: add more + +Channel name | CAN ID | Equation | Notes +------------ | --- | -------- | ----- +Yaw rate | 312 | `bytesToIntLe(raw, 4, 2) * -0.2725` | Calibrated against the gyroscope in RaceBox Mini. Gen1 used 0.286478897 instead.