FrogPilot 0.9.7

This commit is contained in:
FrogAi
2024-06-27 10:22:08 -07:00
parent da00915ac8
commit b705b02e70
682 changed files with 181798 additions and 1348 deletions
+34 -43
View File
@@ -1,53 +1,44 @@
name: "PR review" name: "PR Review"
on: on:
pull_request_target: pull_request_target:
types: [opened, reopened, synchronize, edited, edited] types: [opened, reopened]
jobs: jobs:
labeler: pr_check:
name: review name: Check PR Target Branch
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - name: Checkout repository
uses: actions/checkout@v3
with: with:
submodules: false fetch-depth: 0
# Label PRs - name: Check Target Branch
- uses: actions/labeler@v5.0.0 shell: bash
with:
dot: true
configuration-path: .github/labeler.yaml
# Check PR target branch
- name: check branch
uses: Vankka/pr-target-branch-action@def32ec9d93514138d6ac0132ee62e120a72aed5
if: github.repository == 'commaai/openpilot'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
with: run: |
target: /^(?!master$).*/ TOKEN_USERNAME=$(gh api user -H "Authorization: token $GITHUB_TOKEN" --jq '.login')
exclude: /commaai:.*/
change-to: ${{ github.base_ref }}
already-exists-action: close_this
already-exists-comment: "Your PR should be made against the `master` branch"
# Welcome comment if [[ "${{ github.actor }}" == "FrogAi" ]]; then
- name: comment echo "PR opened or reopened by FrogAi. No action needed."
uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6 exit 0
if: github.event.pull_request.head.repo.full_name != 'commaai/openpilot' fi
with:
message: | if [[ "${{ github.base_ref }}" != "MAKE-PRS-HERE" ]]; then
<!-- _(run_id **${{ github.run_id }}**)_ --> git config --global user.name "${{ github.actor }}"
Thanks for contributing to openpilot! In order for us to review your PR as quickly as possible, check the following: git config --global user.email "${{ github.actor }}@users.noreply.github.com"
* Convert your PR to a draft unless it's ready to review
* Read the [contributing docs](https://github.com/commaai/openpilot/blob/master/docs/CONTRIBUTING.md) gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
* Before marking as "ready for review", ensure: -H "Authorization: token $GITHUB_TOKEN" \
* the goal is clearly stated in the description -f body="Please submit your pull request to the \"MAKE-PRS-HERE\" branch."
* all the tests are passing
* the change is [something we merge](https://github.com/commaai/openpilot/blob/master/docs/CONTRIBUTING.md#what-gets-merged) gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }} \
* include a route or your device' dongle ID if relevant -X PATCH -H "Authorization: token $GITHUB_TOKEN" -f state='closed'
comment_tag: run_id
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} exit 1
else
gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
-H "Authorization: token $GITHUB_TOKEN" \
-f body="Thank you for your PR! If you're not already in the FrogPilot Discord, [feel free to join](https://discord.FrogPilot.download) and let me know you've opened a PR!"
fi
+59
View File
@@ -0,0 +1,59 @@
name: Update MAKE-PRS-HERE
on:
push:
branches:
- FrogPilot-Staging
env:
SOURCE_BRANCH: FrogPilot-Staging
TARGET_BRANCH: MAKE-PRS-HERE
jobs:
squash-and-cherry-pick:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ env.SOURCE_BRANCH }}
fetch-depth: 0
- name: Set Git user name and email
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Get the second to last commit hash and create a temporary branch
run: |
commit_hash=$(git rev-parse HEAD~1)
git checkout -b temp-branch $commit_hash
- name: Squash all commits into one with today's date in Phoenix time zone
run: |
day=$(TZ='America/Phoenix' date '+%-d')
suffix="th"
case $day in
1|21|31) suffix="st" ;;
2|22) suffix="nd" ;;
3|23) suffix="rd" ;;
esac
commit_message="$(TZ='America/Phoenix' date '+%B ')$day$suffix, $(TZ='America/Phoenix' date '+%Y') Update"
git reset --soft $(git rev-list --max-parents=0 HEAD)
git commit -m "$commit_message"
- name: Cherry-pick the squashed commit to target branch and push
run: |
git fetch origin
git checkout ${{ env.TARGET_BRANCH }}
git cherry-pick temp-branch -X theirs || {
if git status | grep -q "nothing to commit, working tree clean"; then
echo "Empty commit detected, skipping cherry-pick."
git cherry-pick --skip
else
echo "Continuing with cherry-pick."
git cherry-pick --continue
fi
}
git push origin ${{ env.TARGET_BRANCH }}
@@ -0,0 +1,27 @@
name: Update FrogPilot Branch
on:
workflow_dispatch:
jobs:
update-branch:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Reset "FrogPilot-Previous" branch to match "FrogPilot"
run: |
git fetch origin
git checkout FrogPilot-Previous || git checkout -b FrogPilot-Previous
git reset --hard origin/FrogPilot
git push origin FrogPilot-Previous --force
- name: Reset "FrogPilot" branch to match "FrogPilot-Staging"
run: |
git fetch origin
git checkout FrogPilot || git checkout -b FrogPilot
git reset --hard origin/FrogPilot-Staging
git push origin FrogPilot --force
+180 -32
View File
@@ -1,4 +1,4 @@
[![openpilot on the comma 3X](https://github.com/commaai/openpilot/assets/8762862/f09e6d29-db2d-4179-80c2-51e8d92bdb5c)](https://comma.ai/shop/comma-3x) [![openpilot on the comma 3X](https://i.imgur.com/Zwv9SaN.png)](https://comma.ai/shop/comma-3x)
What is openpilot? What is openpilot?
------ ------
@@ -13,53 +13,201 @@ What is openpilot?
</tr> </tr>
</table> </table>
To start using openpilot in a car What is FrogPilot? 🐸
------ ------
To use openpilot in a car, you need four things: FrogPilot is a fully open-sourced fork of openpilot, featuring clear and concise commits striving to be a resource for the openpilot developer community. It thrives on contributions from both users and developers, focusing on a collaborative, community-led approach to deliver an advanced openpilot experience for everyone!
1. **Supported Device:** a comma 3/3X, available at [comma.ai/shop](https://comma.ai/shop/comma-3x).
2. **Software:** The setup procedure for the comma 3/3X allows users to enter a URL for custom software. Use the URL `openpilot.comma.ai` to install the release version.
3. **Supported Car:** Ensure that you have one of [the 250+ supported cars](docs/CARS.md).
4. **Car Harness:** You will also need a [car harness](https://comma.ai/shop/car-harness) to connect your comma 3/3X to your car.
We have detailed instructions for [how to install the harness and device in a car](https://comma.ai/setup). Note that it's possible to run openpilot on [other hardware](https://blog.comma.ai/self-driving-car-for-free/), although it's not plug-and-play. ------
FrogPilot was last updated on:
To start developing openpilot **January 18th, 2025**
Features
------ ------
openpilot is developed by [comma](https://comma.ai/) and by users like you. We welcome both pull requests and issues on [GitHub](http://github.com/commaai/openpilot). FrogPilot offers a wide range of customizable features that are easily toggled on or off to suit your preferences. Whether you want a completely stock openpilot experience, or want to add some fun and personal touches, FrogPilot has you covered! Some of the features include:
* Join the [community Discord](https://discord.comma.ai) ------
* Check out [the contributing docs](docs/CONTRIBUTING.md) **Advanced Customizations:**
* Check out the [openpilot tools](tools/)
* Read about the [development workflow](docs/WORKFLOW.md)
* Code documentation lives at https://docs.comma.ai
* Information about running openpilot lives on the [community wiki](https://github.com/commaai/openpilot/wiki)
Want to get paid to work on openpilot? [comma is hiring](https://comma.ai/jobs#open-positions) and offers lots of [bounties](docs/BOUNTIES.md) for external contributors. - "Alert Volume Controller" to set the volume level for each of of openpilot's sounds
- Customize the following distance and jerk values for each personality profile
- Fine tune your car's "Steer Ratio" to perfect your lateral control
- Increase the distance when stopped behind lead vehicles
- Increase the max set speed by a custom interval (i.e. 2, 3, 4, 5, 6, etc. instead of just 1)
- Select between past, present, and future openpilot driving models
------
🎨 **Custom Themes:**
Safety and Testing - 🐸 Frog theme (with a bonus 🐐 sound effect)
---- - <img src="https://images.emojiterra.com/google/noto-emoji/unicode-15/color/512px/1f1f7-1f1fa.png" width="15" height="12"> Russia / Joseph Stalin theme
- 🔌 Tesla theme
- Holiday themes! Minor holidays last a day, while major holidays (Easter, Halloween, Thanksgiving, Christmas) last a week
- Random events triggered by specific actions while driving with openpilot
* openpilot observes [ISO26262](https://en.wikipedia.org/wiki/ISO_26262) guidelines, see [SAFETY.md](docs/SAFETY.md) for more details. - 📢 Want to add a theme? Request one in the "feature-request" channel in the FrogPilot Discord!
* openpilot has software-in-the-loop [tests](.github/workflows/selfdrive_tests.yaml) that run on every commit. ------
* The code enforcing the safety model lives in panda and is written in C, see [code rigor](https://github.com/commaai/panda#code-rigor) for more details. 🚀 **Conditional Experimental Mode:**
* panda has software-in-the-loop [safety tests](https://github.com/commaai/panda/tree/master/tests/safety).
* Internally, we have a hardware-in-the-loop Jenkins test suite that builds and unit tests the various processes.
* panda has additional hardware-in-the-loop [tests](https://github.com/commaai/panda/blob/master/Jenkinsfile).
* We run the latest openpilot in a testing closet containing 10 comma devices continuously replaying routes.
User Data and comma Account - Auto-activates "Experimental Mode" under several conditions, including:
- Approaching intersections and turns while using navigation
- Approaching slower vehicles to take advantage of "Experimental Mode"'s smoother braking
- Curve and stop light/stop sign detection
- Driving below a set speed
- Turn signal activation below 55mph for turn assistance
------
📊 **Developer UI:**
- Display various driving logics such as the distance, speed, and the desired following distance to your lead vehicle
- Lane measuring of the adjacent lanes for lane detection
- Tap the "VEHICLE ONLINE"/"CPU"/"GPU" gauge to toggle between CPU and GPU monitoring
- Tap the "CONNECT ONLINE"/"MEMORY"/"LEFT"/"USED" gauge to toggle between RAM and storage monitoring
------
🛠 **Device Management:**
- Adjustable screen brightness for both onroad and offroad states
- Adjustable screen timeout times for both onroad and offroad states
- Backup and restore previous versions of FrogPilot
- Backup and restore previous versions of toggle configurations
- Battery level threshold to automatically shut the device down after you car's battery falls below a set voltage limit when offroad
- Delete stored driving data for increased privacy/space via the "Device" panel
- Device can operate offline indefinitely
- Disable logging and/or uploading
- Disable uploads while onroad to help reduce data usage
- Flash the Panda within the "Device" menu
- "Standby Mode" that wakes the screen up between engagement states or when important alerts are triggered
- Timer to automatically shut down after going offroad
------
🚖 **Lateral Adjustments:**
- Activate lateral control by simply pressing the "Cruise Control" button
- Force comma's auto tuning for unsupported vehicles
- Lateral control won't disengage on gas or brake
- Nudgeless lane changes with lane detection to prevent driving into curbs or going offroad
- Pause lateral control when below a set speed
- Pause lateral control when pressing the brake
- Pause lateral control when turn signals are active
- Precise turns by using turn desires when below the minimum lane change speed
- [Twilsonco's NNFF](https://github.com/twilsonco/openpilot) for smoother steering control
------
🚘 **Longitudinal Adjustments:**
- Aggressive acceleration when following a lead vehicle from a stop
- "Map Turn Speed Controller" to slow down for curves based on stored map data
- With an additional toggle to fine tune the speed aggressiveness
- Smoother braking behind slower leads
- "Speed Limit Controller" to adjust your speed to the posted speed limit
- With additional toggles to set offsets for "0-34 mph", "35-54 mph", "55-64 mph", and "65-99 mph"
- "Sport" and "Eco" acceleration and deceleration profiles
- "Traffic Mode" tailored towards driving in traffic
- Tweak the lead detection threshold to detect leads sooner for smoother braking on stopped/slower vehicles
- "Vision Turn Speed Controller" for smoother handling of curves
- With additional toggles to fine tune the speed aggressiveness and curve detection sensitivity
------
🗺️ **Navigation:**
- 3D buildings
- Custom map styles
- Full screen map that takes up the entire screen for a more expansive map view
- iOS shortcuts to quickly set navigation destinations
- Navigate on openpilot without a comma prime subscription
- Offline maps
- "Open Street Maps" integration for speed limit control and road name view
------
🎮 **Onroad UI:**
- Compass that rotates according to the direction you're driving
- FPS counter in the screen's border
- Hide various UI elements on the screen for a cleaner UI
- Pedals on the onroad UI indicate when the gas/brake pedals are being used
- Road UI Customizations:
- Acceleration path to show the model's desired acceleration/deceleration
- Blind spot path when a vehicle is detected in your blind spot
- Increase/decrease the lane line, path, and road edge widths
- Path edge colors based on specific driving statuses:
- 🔵 Blue - Navigation active
- 🟦 Light Blue - "Always On Lateral" active
- 🟢 Green - Default
- 🟠 Orange - "Experimental Mode" active
- 🔴 Red - "Traffic Mode" active
- 🟡 Yellow - "Conditional Experimental Mode" overridden
- "Unlimited" road UI that extends out as far as the model can see
- Sidebar retains it's previous position between reboots/ignition cycles
- Steering wheel icons
- 📢 Request your own steering wheel icon in the "feature-request" channel!
- Steering wheel in the onroad UI rotates alongside your physical steering wheel
------
🚙 **Vehicle Specific Additions:**
- Automatic/manual fingerprint selection to force a selected fingerprint
- Custom longitudinal tunings for GM EVs and trucks for smoother gas and brake control
- Custom longitudinal tunings for Toyota/Lexus for smoother gas and brake control
- Disable openpilot longitudinal control to use your car's stock cruise control
- GM Volt support
- Honda Clarity support
- Increased torque for the Subaru Crosstrek
- Lock doors automatically when in the drive gear for Toyota/Lexus and unlock when in park
- openpilot longitudinal control for GM vehicles without ACC
- Pedal interceptor support for GM vehicles
- "Stop and Go" hack for Toyota's without stop and go functionality
- ZSS support for the Toyota Prius and Sienna
------
🚦 **Quality of Life Features:**
- Automatic updates for a completely "set and forget" experience
- Camera view selection
- Custom alerts for green lights, vehicles in blindspot, lead departing, and the current speed limit changing
- Display the driver camera when in reverse
- Driving statistics to show how many hours and miles you've driven on the home screen
- Fleet Manager to easily access your driving data and screen recordings
- Numerical temperature gauge
- Retain tethering status between reboots
- Screenrecorder
- Toggle "Experimental Mode" via the "Lane Departure Alert" button, holding down the "Distance" button for 0.5+ seconds, or by double tapping the screen
How to Install
------ ------
By default, openpilot uploads the driving data to our servers. You can also access your data through [comma connect](https://connect.comma.ai/). We use your data to train better models and improve openpilot for everyone. Easiest way to install FrogPilot is via this URL at the installation screen:
openpilot is open source software: the user is free to disable data collection if they wish to do so. ```
frogpilot.download
```
openpilot logs the road-facing cameras, CAN, GPS, IMU, magnetometer, thermal sensors, crashes, and operating system logs. DO NOT install the "FrogPilot-Development" branch. I'm constantly breaking things on there, so unless you don't want to use openpilot, NEVER install it!
The driver-facing camera is only logged if you explicitly opt-in in settings. The microphone is not recorded.
By using openpilot, you agree to [our Privacy Policy](https://comma.ai/privacy). You understand that use of this software or its related services will generate certain types of user data, which may be logged and stored at the sole discretion of comma. By accepting this agreement, you grant an irrevocable, perpetual, worldwide right to comma for the use of this data. ![](https://i.imgur.com/swr0kqJ.png)
Bug reports / Feature Requests
------
If you encounter any issues or bugs while using FrogPilot, or if you have any suggestions for new features or improvements, please don't hesitate to post about it on the Discord! I'm always looking for ways to improve the fork and provide a better experience for everyone!
To report a bug or request a new feature, make a post in the #bug-reports or #feature-requests channel respectively on the FrogPilot Discord. Please provide as much detail as possible about the issue you're experiencing or the feature you'd like to see added. Photos, videos, log files, or other relevant information are very helpful!
I will do my best to respond to bug reports and feature requests in a timely manner, but please understand that I may not be able to address every request immediately. Your feedback and suggestions are valuable, and I appreciate your help in making FrogPilot the best it can be!
Discord
------
[Join the FrogPilot Community Discord!](https://discord.gg/frogpilot)
Credits
------
* [AlexandreSato](https://github.com/AlexandreSato)
* [Crwusiz](https://github.com/crwusiz)
* [DragonPilot](https://github.com/dragonpilot-community)
* [ErichMoraga](https://github.com/ErichMoraga)
* [Garrettpall](https://github.com/garrettpall)
* [Mike8643](https://github.com/mike8643)
* [Neokii](https://github.com/Neokii)
* [OPGM](https://github.com/opgm)
* [OPKR](https://github.com/openpilotkr)
* [Pfeiferj](https://github.com/pfeiferj)
* [ServerDummy](https://github.com/ServerDummy)
* [Twilsonco](https://github.com/twilsonco)
Licensing Licensing
------ ------
+51 -3
View File
@@ -84,6 +84,7 @@ struct CarEvent @0x9b1657f34caf3ad3 {
startup @75; startup @75;
startupNoCar @76; startupNoCar @76;
startupNoControl @77; startupNoControl @77;
startupNoSecOcKey @121;
startupMaster @78; startupMaster @78;
startupNoFw @104; startupNoFw @104;
fcw @79; fcw @79;
@@ -118,7 +119,35 @@ struct CarEvent @0x9b1657f34caf3ad3 {
actuatorsApiUnavailable @120; actuatorsApiUnavailable @120;
# FrogPilot Events # FrogPilot Events
pedalInterceptorNoBrake @134; accel30 @122;
accel35 @123;
accel40 @124;
blockUser @125;
customStartupAlert @126;
dejaVuCurve @127;
firefoxSteerSaturated @128;
forcingStop @129;
goatSteerSaturated @130;
greenLight @131;
hal9000 @132;
holidayActive @133;
laneChangeBlockedLoud @134;
leadDeparting @135;
noLaneAvailable @136;
openpilotCrashed @137;
openpilotCrashedRandomEvent @138;
pedalInterceptorNoBrake @139;
speedLimitChanged @140;
thisIsFineSteerSaturated @141;
toBeContinued @142;
torqueNNLoad @143;
trafficModeActive @144;
trafficModeInactive @145;
turningLeft @146;
turningRight @147;
vCruise69 @148;
yourFrogTriedToKillMe @149;
youveGotMail @150;
radarCanErrorDEPRECATED @15; radarCanErrorDEPRECATED @15;
communityFeatureDisallowedDEPRECATED @62; communityFeatureDisallowedDEPRECATED @62;
@@ -415,6 +444,22 @@ struct CarControl {
prompt @6; prompt @6;
promptRepeat @7; promptRepeat @7;
promptDistracted @8; promptDistracted @8;
# FrogPilot sounds
angry @9;
continued @10;
dejaVu @11;
doc @12;
fart @13;
firefox @14;
goat @15;
hal9000 @16;
mail @17;
nessie @18;
noice @19;
startup @20;
thisIsFine @21;
uwu @22;
} }
} }
@@ -507,6 +552,9 @@ struct CarParams {
wheelSpeedFactor @63 :Float32; # Multiplier on wheels speeds to computer actual speeds wheelSpeedFactor @63 :Float32; # Multiplier on wheels speeds to computer actual speeds
secOcRequired @74 :Bool; # Car requires SecOC message authentication to operate
secOcKeyAvailable @75 :Bool; # Stored SecOC key loaded from params
struct SafetyConfig { struct SafetyConfig {
safetyModel @0 :SafetyModel; safetyModel @0 :SafetyModel;
safetyParam @3 :UInt16; safetyParam @3 :UInt16;
@@ -544,8 +592,8 @@ struct CarParams {
kiBP @2 :List(Float32); kiBP @2 :List(Float32);
kiV @3 :List(Float32); kiV @3 :List(Float32);
kf @6 :Float32; kf @6 :Float32;
deadzoneBPDEPRECATED @4 :List(Float32); deadzoneBP @4 :List(Float32);
deadzoneVDEPRECATED @5 :List(Float32); deadzoneV @5 :List(Float32);
} }
struct LateralINDITuning { struct LateralINDITuning {
+63 -5
View File
@@ -1,6 +1,8 @@
using Cxx = import "./include/c++.capnp"; using Cxx = import "./include/c++.capnp";
$Cxx.namespace("cereal"); $Cxx.namespace("cereal");
using Car = import "car.capnp";
@0xb526ba661d550a59; @0xb526ba661d550a59;
# custom.capnp: a home for empty structs reserved for custom forks # custom.capnp: a home for empty structs reserved for custom forks
@@ -8,19 +10,75 @@ $Cxx.namespace("cereal");
# cereal, so use these if you want custom events in your fork. # cereal, so use these if you want custom events in your fork.
# you can rename the struct, but don't change the identifier # you can rename the struct, but don't change the identifier
struct CustomReserved0 @0x81c2f05a394cf4af { struct FrogPilotCarControl @0x81c2f05a394cf4af {
accelPressed @0 :Bool;
alwaysOnLateralActive @1 :Bool;
decelPressed @2 :Bool;
fcwEventTriggered @3 :Bool;
noEntryEventTriggered @4 :Bool;
steerSaturatedEventTriggered @5 :Bool;
} }
struct CustomReserved1 @0xaedffd8f31e7b55d { struct FrogPilotCarState @0xaedffd8f31e7b55d {
struct ButtonEvent {
enum Type {
lkas @0;
}
}
alwaysOnLateralDisabled @0 :Bool;
brakeLights @1 :Bool;
dashboardSpeedLimit @2 :Float32;
distanceLongPressed @3 :Bool;
ecoGear @4 :Bool;
hasMenu @5 :Bool;
sportGear @6 :Bool;
trafficModeActive @7 :Bool;
} }
struct CustomReserved2 @0xf35cc4560bbf6ec2 { struct FrogPilotDeviceState @0xf35cc4560bbf6ec2 {
freeSpace @0 :Int16;
usedSpace @1 :Int16;
} }
struct CustomReserved3 @0xda96579883444c35 { struct FrogPilotNavigation @0xda96579883444c35 {
approachingIntersection @0 :Bool;
approachingTurn @1 :Bool;
navigationSpeedLimit @2 :Float32;
} }
struct CustomReserved4 @0x80ae746ee2596b11 { struct FrogPilotPlan @0x80ae746ee2596b11 {
accelerationJerk @0 :Float32;
accelerationJerkStock @1 :Float32;
dangerJerk @2 :Float32;
desiredFollowDistance @3 :Int64;
experimentalMode @4 :Bool;
forcingStop @5 :Bool;
forcingStopLength @6 :Float32;
frogpilotEvents @7 :List(Car.CarEvent);
lateralCheck @8 :Bool;
laneWidthLeft @9 :Float32;
laneWidthRight @10 :Float32;
maxAcceleration @11 :Float32;
minAcceleration @12 :Float32;
mtscSpeed @13 :Float32;
redLight @14 :Bool;
slcMapSpeedLimit @15 :Float32;
slcOverridden @16 :Bool;
slcOverriddenSpeed @17 :Float32;
slcSpeedLimit @18 :Float32;
slcSpeedLimitOffset @19 :Float32;
slcSpeedLimitSource @20 :Text;
speedJerk @21 :Float32;
speedJerkStock @22 :Float32;
speedLimitChanged @23 :Bool;
tFollow @24 :Float32;
togglesUpdated @25 :Bool;
unconfirmedSlcSpeedLimit @26 :Float32;
upcomingSLCSpeedLimit @27 :Float32;
vCruise @28 :Float32;
vtscControllingCurve @29 :Bool;
vtscSpeed @30 :Float32;
} }
struct CustomReserved5 @0xa5cd762cd951a455 { struct CustomReserved5 @0xa5cd762cd951a455 {
+58 -9
View File
@@ -335,6 +335,12 @@ enum LaneChangeDirection {
right @2; right @2;
} }
enum TurnDirection {
none @0;
turnLeft @1;
turnRight @2;
}
struct CanData { struct CanData {
address @0 :UInt32; address @0 :UInt32;
busTime @1 :UInt16; busTime @1 :UInt16;
@@ -612,6 +618,10 @@ struct RadarState @0x9a185389d6fdd05f {
leadOne @3 :LeadData; leadOne @3 :LeadData;
leadTwo @4 :LeadData; leadTwo @4 :LeadData;
leadLeft @13 :LeadData;
leadRight @14 :LeadData;
leadLeftFar @15 :LeadData;
leadRightFar @16 :LeadData;
cumLagMs @5 :Float32; cumLagMs @5 :Float32;
struct LeadData { struct LeadData {
@@ -698,6 +708,7 @@ struct ControlsState @0x97ff69c53601abf1 {
personality @66 :LongitudinalPersonality; personality @66 :LongitudinalPersonality;
longControlState @30 :Car.CarControl.Actuators.LongControlState; longControlState @30 :Car.CarControl.Actuators.LongControlState;
vPid @2 :Float32;
vTargetLead @3 :Float32; vTargetLead @3 :Float32;
vCruise @22 :Float32; # actual set speed vCruise @22 :Float32; # actual set speed
vCruiseCluster @63 :Float32; # set speed to display in the UI vCruiseCluster @63 :Float32; # set speed to display in the UI
@@ -744,6 +755,7 @@ struct ControlsState @0x97ff69c53601abf1 {
normal @0; # low priority alert for user's convenience normal @0; # low priority alert for user's convenience
userPrompt @1; # mid priority alert that might require user intervention userPrompt @1; # mid priority alert that might require user intervention
critical @2; # high priority alert that needs immediate user intervention critical @2; # high priority alert that needs immediate user intervention
frogpilot @3; # FrogPilot startup alert
} }
enum AlertSize { enum AlertSize {
@@ -794,6 +806,7 @@ struct ControlsState @0x97ff69c53601abf1 {
saturated @7 :Bool; saturated @7 :Bool;
actualLateralAccel @9 :Float32; actualLateralAccel @9 :Float32;
desiredLateralAccel @10 :Float32; desiredLateralAccel @10 :Float32;
nnLog @11 :List(Float32);
} }
struct LateralLQRState { struct LateralLQRState {
@@ -865,7 +878,39 @@ struct ControlsState @0x97ff69c53601abf1 {
canMonoTimesDEPRECATED @21 :List(UInt64); canMonoTimesDEPRECATED @21 :List(UInt64);
desiredCurvatureRateDEPRECATED @62 :Float32; desiredCurvatureRateDEPRECATED @62 :Float32;
canErrorCounterDEPRECATED @57 :UInt32; canErrorCounterDEPRECATED @57 :UInt32;
vPidDEPRECATED @2 :Float32; }
struct DrivingModelData {
frameId @0 :UInt32;
frameIdExtra @1 :UInt32;
frameDropPerc @6 :Float32;
modelExecutionTime @7 :Float32;
action @2 :ModelDataV2.Action;
laneLineMeta @3 :LaneLineMeta;
meta @4 :MetaData;
path @5 :PolyPath;
struct PolyPath {
xCoefficients @0 :List(Float32);
yCoefficients @1 :List(Float32);
zCoefficients @2 :List(Float32);
}
struct LaneLineMeta {
leftY @0 :Float32;
rightY @1 :Float32;
leftProb @2 :Float32;
rightProb @3 :Float32;
}
struct MetaData {
laneChangeState @0 :LaneChangeState;
laneChangeDirection @1 :LaneChangeDirection;
turnDirection @2 :TurnDirection;
}
} }
# All SI units and in device frame # All SI units and in device frame
@@ -913,8 +958,8 @@ struct ModelDataV2 {
# Model perceived motion # Model perceived motion
temporalPose @21 :Pose; temporalPose @21 :Pose;
navEnabledDEPRECATED @22 :Bool; navEnabled @22 :Bool;
locationMonoTimeDEPRECATED @24 :UInt64; locationMonoTime @24 :UInt64;
# e2e lateral planner # e2e lateral planner
lateralPlannerSolutionDEPRECATED @25: LateralPlannerSolution; lateralPlannerSolutionDEPRECATED @25: LateralPlannerSolution;
@@ -958,6 +1003,7 @@ struct ModelDataV2 {
hardBrakePredicted @7 :Bool; hardBrakePredicted @7 :Bool;
laneChangeState @8 :LaneChangeState; laneChangeState @8 :LaneChangeState;
laneChangeDirection @9 :LaneChangeDirection; laneChangeDirection @9 :LaneChangeDirection;
turnDirection @10 :TurnDirection;
# deprecated # deprecated
@@ -980,6 +1026,8 @@ struct ModelDataV2 {
brake3MetersPerSecondSquaredProbs @4 :List(Float32); brake3MetersPerSecondSquaredProbs @4 :List(Float32);
brake4MetersPerSecondSquaredProbs @5 :List(Float32); brake4MetersPerSecondSquaredProbs @5 :List(Float32);
brake5MetersPerSecondSquaredProbs @6 :List(Float32); brake5MetersPerSecondSquaredProbs @6 :List(Float32);
gasPressProbs @7 :List(Float32);
brakePressProbs @8 :List(Float32);
} }
struct Pose { struct Pose {
@@ -2264,6 +2312,7 @@ struct Event {
driverMonitoringState @71: DriverMonitoringState; driverMonitoringState @71: DriverMonitoringState;
liveLocationKalman @72 :LiveLocationKalman; liveLocationKalman @72 :LiveLocationKalman;
modelV2 @75 :ModelDataV2; modelV2 @75 :ModelDataV2;
drivingModelData @128 :DrivingModelData;
driverStateV2 @92 :DriverStateV2; driverStateV2 @92 :DriverStateV2;
# camera stuff, each camera state has a matching encode idx # camera stuff, each camera state has a matching encode idx
@@ -2318,11 +2367,11 @@ struct Event {
customReservedRawData2 @126 :Data; customReservedRawData2 @126 :Data;
# *********** Custom: reserved for forks *********** # *********** Custom: reserved for forks ***********
customReserved0 @107 :Custom.CustomReserved0; frogpilotCarControl @107 :Custom.FrogPilotCarControl;
customReserved1 @108 :Custom.CustomReserved1; frogpilotCarState @108 :Custom.FrogPilotCarState;
customReserved2 @109 :Custom.CustomReserved2; frogpilotDeviceState @109 :Custom.FrogPilotDeviceState;
customReserved3 @110 :Custom.CustomReserved3; frogpilotNavigation @110 :Custom.FrogPilotNavigation;
customReserved4 @111 :Custom.CustomReserved4; frogpilotPlan @111 :Custom.FrogPilotPlan;
customReserved5 @112 :Custom.CustomReserved5; customReserved5 @112 :Custom.CustomReserved5;
customReserved6 @113 :Custom.CustomReserved6; customReserved6 @113 :Custom.CustomReserved6;
customReserved7 @114 :Custom.CustomReserved7; customReserved7 @114 :Custom.CustomReserved7;
@@ -2368,6 +2417,6 @@ struct Event {
driverStateDEPRECATED @59 :DriverStateDEPRECATED; driverStateDEPRECATED @59 :DriverStateDEPRECATED;
sensorEventsDEPRECATED @11 :List(SensorEventData); sensorEventsDEPRECATED @11 :List(SensorEventData);
lateralPlanDEPRECATED @64 :LateralPlan; lateralPlanDEPRECATED @64 :LateralPlan;
navModelDEPRECATED @104 :NavModelData; navModel @104 :NavModelData;
} }
} }
+10
View File
@@ -60,12 +60,15 @@ _services: dict[str, tuple] = {
"driverMonitoringState": (True, 20., 10), "driverMonitoringState": (True, 20., 10),
"wideRoadEncodeIdx": (False, 20., 1), "wideRoadEncodeIdx": (False, 20., 1),
"wideRoadCameraState": (True, 20., 20), "wideRoadCameraState": (True, 20., 20),
"drivingModelData": (True, 20., 10),
"modelV2": (True, 20., 40), "modelV2": (True, 20., 40),
"managerState": (True, 2., 1), "managerState": (True, 2., 1),
"uploaderState": (True, 0., 1), "uploaderState": (True, 0., 1),
"navInstruction": (True, 1., 10), "navInstruction": (True, 1., 10),
"navRoute": (True, 0.), "navRoute": (True, 0.),
"navThumbnail": (True, 0.), "navThumbnail": (True, 0.),
"navModel": (True, 2., 4.),
"mapRenderState": (True, 2., 1.),
"uiPlan": (True, 20., 40.), "uiPlan": (True, 20., 40.),
"qRoadEncodeIdx": (False, 20.), "qRoadEncodeIdx": (False, 20.),
"userFlag": (True, 0., 1), "userFlag": (True, 0., 1),
@@ -87,6 +90,13 @@ _services: dict[str, tuple] = {
"customReservedRawData0": (True, 0.), "customReservedRawData0": (True, 0.),
"customReservedRawData1": (True, 0.), "customReservedRawData1": (True, 0.),
"customReservedRawData2": (True, 0.), "customReservedRawData2": (True, 0.),
# FrogPilot
"frogpilotCarControl": (True, 100., 10),
"frogpilotCarState": (True, 100., 10),
"frogpilotDeviceState": (True, 2., 1),
"frogpilotNavigation": (True, 1., 10),
"frogpilotPlan": (True, 20., 5),
} }
SERVICE_LIST = {name: Service(*vals) for SERVICE_LIST = {name: Service(*vals) for
idx, (name, vals) in enumerate(_services.items())} idx, (name, vals) in enumerate(_services.items())}
+6
View File
@@ -11,6 +11,12 @@ class Conversions:
MS_TO_KNOTS = 1.9438 MS_TO_KNOTS = 1.9438
KNOTS_TO_MS = 1. / MS_TO_KNOTS KNOTS_TO_MS = 1. / MS_TO_KNOTS
# Distance
METER_TO_FOOT = 3.28084
FOOT_TO_METER = 1. / METER_TO_FOOT
CM_TO_INCH = 1. / 2.54
INCH_TO_CM = 1. / CM_TO_INCH
# Angle # Angle
DEG_TO_RAD = np.pi / 180. DEG_TO_RAD = np.pi / 180.
RAD_TO_DEG = 1. / DEG_TO_RAD RAD_TO_DEG = 1. / DEG_TO_RAD
+344
View File
@@ -189,6 +189,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"RecordFrontLock", PERSISTENT}, // for the internal fleet {"RecordFrontLock", PERSISTENT}, // for the internal fleet
{"ReplayControlsState", CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION}, {"ReplayControlsState", CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION},
{"RouteCount", PERSISTENT}, {"RouteCount", PERSISTENT},
{"SecOCKey", PERSISTENT | DONT_LOG},
{"SnoozeUpdate", CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION}, {"SnoozeUpdate", CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION},
{"SshEnabled", PERSISTENT}, {"SshEnabled", PERSISTENT},
{"TermsVersion", PERSISTENT}, {"TermsVersion", PERSISTENT},
@@ -207,6 +208,349 @@ std::unordered_map<std::string, uint32_t> keys = {
{"UpdaterTargetBranch", CLEAR_ON_MANAGER_START}, {"UpdaterTargetBranch", CLEAR_ON_MANAGER_START},
{"UpdaterLastFetchTime", PERSISTENT}, {"UpdaterLastFetchTime", PERSISTENT},
{"Version", PERSISTENT}, {"Version", PERSISTENT},
// FrogPilot parameters
{"AccelerationPath", PERSISTENT | FROGPILOT_VISUALS},
{"AccelerationProfile", PERSISTENT | FROGPILOT_CONTROLS},
{"AdjacentLeadsUI", PERSISTENT | FROGPILOT_CONTROLS},
{"AdjacentPath", PERSISTENT | FROGPILOT_VISUALS},
{"AdjacentPathMetrics", PERSISTENT | FROGPILOT_VISUALS},
{"AdvancedCustomUI", PERSISTENT | FROGPILOT_VISUALS},
{"AdvancedLateralTune", PERSISTENT | FROGPILOT_CONTROLS},
{"AggressiveFollow", PERSISTENT | FROGPILOT_CONTROLS},
{"AggressiveJerkAcceleration", PERSISTENT | FROGPILOT_CONTROLS},
{"AggressiveJerkDanger", PERSISTENT | FROGPILOT_CONTROLS},
{"AggressiveJerkDeceleration", PERSISTENT | FROGPILOT_CONTROLS},
{"AggressiveJerkSpeed", PERSISTENT | FROGPILOT_CONTROLS},
{"AggressiveJerkSpeedDecrease", PERSISTENT | FROGPILOT_CONTROLS},
{"AggressivePersonalityProfile", PERSISTENT | FROGPILOT_CONTROLS},
{"AlertVolumeControl", PERSISTENT | FROGPILOT_VISUALS},
{"AlwaysOnLateral", PERSISTENT | FROGPILOT_CONTROLS},
{"AlwaysOnLateralLKAS", PERSISTENT | FROGPILOT_CONTROLS},
{"AlwaysOnLateralMain", PERSISTENT | FROGPILOT_CONTROLS},
{"AMapKey1", PERSISTENT},
{"AMapKey2", PERSISTENT},
{"ApiCache_DriveStats", PERSISTENT},
{"AutomaticallyUpdateModels", PERSISTENT | FROGPILOT_CONTROLS},
{"AutomaticUpdates", PERSISTENT | FROGPILOT_OTHER},
{"AvailableModels", PERSISTENT},
{"AvailableModelNames", PERSISTENT},
{"BigMap", PERSISTENT | FROGPILOT_VISUALS},
{"BlacklistedModels", PERSISTENT | FROGPILOT_CONTROLS},
{"BlindSpotMetrics", PERSISTENT | FROGPILOT_VISUALS},
{"BlindSpotPath", PERSISTENT | FROGPILOT_VISUALS},
{"BorderMetrics", PERSISTENT | FROGPILOT_VISUALS},
{"CameraView", PERSISTENT | FROGPILOT_VISUALS},
{"CancelModelDownload", CLEAR_ON_MANAGER_START},
{"CancelThemeDownload", CLEAR_ON_MANAGER_START},
{"CarMake", PERSISTENT},
{"CarModel", PERSISTENT},
{"CarModelName", PERSISTENT},
{"CECurves", PERSISTENT | FROGPILOT_CONTROLS},
{"CECurvesLead", PERSISTENT | FROGPILOT_CONTROLS},
{"CELead", PERSISTENT | FROGPILOT_CONTROLS},
{"CEModelStopTime", PERSISTENT | FROGPILOT_CONTROLS},
{"CENavigation", PERSISTENT | FROGPILOT_CONTROLS},
{"CENavigationIntersections", PERSISTENT | FROGPILOT_CONTROLS},
{"CENavigationLead", PERSISTENT | FROGPILOT_CONTROLS},
{"CENavigationTurns", PERSISTENT | FROGPILOT_CONTROLS},
{"CertifiedHerbalistDrives", PERSISTENT | FROGPILOT_CONTROLS},
{"CertifiedHerbalistScore", PERSISTENT | FROGPILOT_CONTROLS},
{"CESignalSpeed", PERSISTENT | FROGPILOT_CONTROLS},
{"CESignalLaneDetection", PERSISTENT | FROGPILOT_CONTROLS},
{"CESlowerLead", PERSISTENT | FROGPILOT_CONTROLS},
{"CESpeed", PERSISTENT | FROGPILOT_CONTROLS},
{"CESpeedLead", PERSISTENT | FROGPILOT_CONTROLS},
{"CEStatus", CLEAR_ON_OFFROAD_TRANSITION},
{"CEStoppedLead", PERSISTENT | FROGPILOT_CONTROLS},
{"ClusterOffset", PERSISTENT | FROGPILOT_VEHICLES},
{"ColorToDownload", CLEAR_ON_MANAGER_START},
{"Compass", PERSISTENT | FROGPILOT_VISUALS},
{"ConditionalExperimental", PERSISTENT | FROGPILOT_CONTROLS},
{"CurveSensitivity", PERSISTENT | FROGPILOT_CONTROLS},
{"CurveSpeedControl", PERSISTENT | FROGPILOT_CONTROLS},
{"CustomAlerts", PERSISTENT | FROGPILOT_VISUALS},
{"CustomColors", PERSISTENT | FROGPILOT_VISUALS},
{"CustomCruise", PERSISTENT | FROGPILOT_CONTROLS},
{"CustomCruiseLong", PERSISTENT | FROGPILOT_CONTROLS},
{"CustomDistanceIcons", PERSISTENT | FROGPILOT_CONTROLS},
{"CustomIcons", PERSISTENT | FROGPILOT_VISUALS},
{"CustomPersonalities", PERSISTENT | FROGPILOT_CONTROLS},
{"CustomSignals", PERSISTENT | FROGPILOT_VISUALS},
{"CustomSounds", PERSISTENT | FROGPILOT_VISUALS},
{"CustomUI", PERSISTENT | FROGPILOT_VISUALS},
{"DecelerationProfile", PERSISTENT | FROGPILOT_CONTROLS},
{"DeveloperUI", PERSISTENT | FROGPILOT_VISUALS},
{"DeviceManagement", PERSISTENT | FROGPILOT_CONTROLS},
{"DeviceShutdown", PERSISTENT | FROGPILOT_CONTROLS},
{"DisableOnroadUploads", PERSISTENT | FROGPILOT_CONTROLS},
{"DisableOpenpilotLongitudinal", PERSISTENT | FROGPILOT_VEHICLES},
{"DiscordUsername", PERSISTENT},
{"DissolvedOxygenDrives", PERSISTENT | FROGPILOT_CONTROLS},
{"DissolvedOxygenScore", PERSISTENT | FROGPILOT_CONTROLS},
{"DistanceIconToDownload", CLEAR_ON_MANAGER_START},
{"DisengageVolume", PERSISTENT | FROGPILOT_VISUALS},
{"DoToggleReset", PERSISTENT},
{"DownloadableColors", PERSISTENT},
{"DownloadableDistanceIcons", PERSISTENT},
{"DownloadableIcons", PERSISTENT},
{"DownloadableSignals", PERSISTENT},
{"DownloadableSounds", PERSISTENT},
{"DownloadableWheels", PERSISTENT},
{"DownloadAllModels", CLEAR_ON_MANAGER_START},
{"DragonRiderDrives", PERSISTENT | FROGPILOT_CONTROLS},
{"DragonRiderScore", PERSISTENT | FROGPILOT_CONTROLS},
{"DriverCamera", PERSISTENT | FROGPILOT_VISUALS},
{"DuckAmigoDrives", PERSISTENT | FROGPILOT_CONTROLS},
{"DuckAmigoScore", PERSISTENT | FROGPILOT_CONTROLS},
{"DynamicPathWidth", PERSISTENT | FROGPILOT_VISUALS},
{"DynamicPedalsOnUI", PERSISTENT | FROGPILOT_VISUALS},
{"EngageVolume", PERSISTENT | FROGPILOT_VISUALS},
{"ExperimentalGMTune", PERSISTENT | FROGPILOT_VEHICLES},
{"ExperimentalModeActivation", PERSISTENT | FROGPILOT_CONTROLS},
{"ExperimentalModels", PERSISTENT},
{"ExperimentalModeViaDistance", PERSISTENT | FROGPILOT_CONTROLS},
{"ExperimentalModeViaLKAS", PERSISTENT | FROGPILOT_CONTROLS},
{"ExperimentalModeViaTap", PERSISTENT | FROGPILOT_CONTROLS},
{"Fahrenheit", PERSISTENT | FROGPILOT_VISUALS},
{"FingerprintLogged", CLEAR_ON_MANAGER_START},
{"FlashPanda", CLEAR_ON_MANAGER_START},
{"ForceAutoTune", PERSISTENT | FROGPILOT_CONTROLS},
{"ForceAutoTuneOff", PERSISTENT | FROGPILOT_CONTROLS},
{"ForceFingerprint", PERSISTENT | FROGPILOT_VEHICLES},
{"ForceMPHDashboard", PERSISTENT | FROGPILOT_CONTROLS},
{"ForceOffroad", CLEAR_ON_MANAGER_START},
{"ForceOnroad", CLEAR_ON_MANAGER_START},
{"ForceStandstill", PERSISTENT | FROGPILOT_CONTROLS},
{"ForceStops", PERSISTENT | FROGPILOT_CONTROLS},
{"FPSCounter", PERSISTENT | FROGPILOT_VISUALS},
{"FrogPilotDrives", PERSISTENT | FROGPILOT_TRACKING},
{"FrogPilotKilometers", PERSISTENT | FROGPILOT_TRACKING},
{"FrogPilotMinutes", PERSISTENT | FROGPILOT_TRACKING},
{"FrogPilotToggles", CLEAR_ON_MANAGER_START},
{"FrogPilotTogglesUpdated", CLEAR_ON_MANAGER_START},
{"FrogPilotTuningLevels", CLEAR_ON_MANAGER_START},
{"FrogsGoMoosTweak", PERSISTENT | FROGPILOT_VEHICLES},
{"FullMap", PERSISTENT | FROGPILOT_VISUALS},
{"GasRegenCmd", PERSISTENT | FROGPILOT_VEHICLES},
{"GMapKey", PERSISTENT},
{"GoatScream", PERSISTENT | FROGPILOT_VISUALS},
{"GreenLightAlert", PERSISTENT | FROGPILOT_VISUALS},
{"HideAlerts", PERSISTENT | FROGPILOT_VISUALS},
{"HideCSCUI", PERSISTENT | FROGPILOT_CONTROLS},
{"HideLeadMarker", PERSISTENT | FROGPILOT_VISUALS},
{"HideMapIcon", PERSISTENT | FROGPILOT_VISUALS},
{"HideMaxSpeed", PERSISTENT | FROGPILOT_VISUALS},
{"HideSpeed", PERSISTENT | FROGPILOT_VISUALS},
{"HideSpeedLimit", PERSISTENT | FROGPILOT_VISUALS},
{"HolidayThemes", PERSISTENT | FROGPILOT_VISUALS},
{"HumanAcceleration", PERSISTENT | FROGPILOT_CONTROLS},
{"HumanFollowing", PERSISTENT | FROGPILOT_CONTROLS},
{"IconToDownload", CLEAR_ON_MANAGER_START},
{"IncreasedStoppedDistance", PERSISTENT | FROGPILOT_CONTROLS},
{"IncreaseThermalLimits", PERSISTENT | FROGPILOT_CONTROLS},
{"IssueReported", CLEAR_ON_MANAGER_START},
{"JerkInfo", PERSISTENT | FROGPILOT_VISUALS},
{"LaneChangeCustomizations", PERSISTENT | FROGPILOT_CONTROLS},
{"LaneChangeTime", PERSISTENT | FROGPILOT_CONTROLS},
{"LaneDetectionWidth", PERSISTENT | FROGPILOT_CONTROLS},
{"LaneLinesWidth", PERSISTENT | FROGPILOT_VISUALS},
{"LastMapsUpdate", PERSISTENT | FROGPILOT_OTHER},
{"LateralMetrics", PERSISTENT | FROGPILOT_VISUALS},
{"LateralTune", PERSISTENT | FROGPILOT_CONTROLS},
{"LeadDepartingAlert", PERSISTENT | FROGPILOT_VISUALS},
{"LeadDetectionThreshold", PERSISTENT | FROGPILOT_CONTROLS},
{"LeadInfo", PERSISTENT | FROGPILOT_VISUALS},
{"LockDoors", PERSISTENT | FROGPILOT_VEHICLES},
{"LockDoorsTimer", PERSISTENT | FROGPILOT_VEHICLES},
{"LongitudinalMetrics", PERSISTENT | FROGPILOT_VISUALS},
{"LongitudinalTune", PERSISTENT | FROGPILOT_CONTROLS},
{"LongPitch", PERSISTENT | FROGPILOT_VEHICLES},
{"LosAngelesDrives", PERSISTENT | FROGPILOT_CONTROLS},
{"LosAngelesScore", PERSISTENT | FROGPILOT_CONTROLS},
{"LoudBlindspotAlert", PERSISTENT | FROGPILOT_VISUALS},
{"LowVoltageShutdown", PERSISTENT | FROGPILOT_CONTROLS},
{"ManualUpdateInitiated", CLEAR_ON_MANAGER_START},
{"MapAcceleration", PERSISTENT | FROGPILOT_CONTROLS},
{"MapboxPublicKey", PERSISTENT},
{"MapboxSecretKey", PERSISTENT},
{"MapDeceleration", PERSISTENT | FROGPILOT_CONTROLS},
{"MapGears", PERSISTENT | FROGPILOT_CONTROLS},
{"MapsSelected", PERSISTENT | FROGPILOT_OTHER},
{"MapSpeedLimit", CLEAR_ON_MANAGER_START},
{"MapStyle", PERSISTENT | FROGPILOT_VISUALS},
{"MapTargetVelocities", CLEAR_ON_MANAGER_START},
{"MapTurnControl", PERSISTENT | FROGPILOT_CONTROLS},
{"MaxDesiredAcceleration", PERSISTENT | FROGPILOT_CONTROLS},
{"MinimumBackupSize", PERSISTENT},
{"MinimumLaneChangeSpeed", PERSISTENT | FROGPILOT_CONTROLS},
{"Model", PERSISTENT | FROGPILOT_CONTROLS},
{"ModelDrivesAndScores", PERSISTENT | FROGPILOT_CONTROLS},
{"ModelDownloadProgress", CLEAR_ON_MANAGER_START},
{"ModelRandomizer", PERSISTENT | FROGPILOT_CONTROLS},
{"ModelToDownload", CLEAR_ON_MANAGER_START},
{"ModelUI", PERSISTENT | FROGPILOT_VISUALS},
{"ModelVersion", PERSISTENT | FROGPILOT_CONTROLS},
{"ModelVersions", PERSISTENT | FROGPILOT_CONTROLS},
{"MTSCCurvatureCheck", PERSISTENT | FROGPILOT_CONTROLS},
{"NavigationUI", PERSISTENT | FROGPILOT_VISUALS},
{"NextMapSpeedLimit", CLEAR_ON_MANAGER_START},
{"NewLongAPI", PERSISTENT | FROGPILOT_VEHICLES},
{"NewLongAPIGM", PERSISTENT | FROGPILOT_VEHICLES},
{"NNFF", PERSISTENT | FROGPILOT_CONTROLS},
{"NNFFLite", PERSISTENT | FROGPILOT_CONTROLS},
{"NNFFModelName", CLEAR_ON_OFFROAD_TRANSITION},
{"NoLogging", PERSISTENT | FROGPILOT_CONTROLS},
{"NorthDakotaDrives", PERSISTENT | FROGPILOT_CONTROLS},
{"NorthDakotaScore", PERSISTENT | FROGPILOT_CONTROLS},
{"NotreDameDrives", PERSISTENT | FROGPILOT_CONTROLS},
{"NotreDameScore", PERSISTENT | FROGPILOT_CONTROLS},
{"NoUploads", PERSISTENT | FROGPILOT_CONTROLS},
{"NudgelessLaneChange", PERSISTENT | FROGPILOT_CONTROLS},
{"NumericalTemp", PERSISTENT | FROGPILOT_VISUALS},
{"OfflineMode", PERSISTENT | FROGPILOT_CONTROLS},
{"Offset1", PERSISTENT | FROGPILOT_CONTROLS},
{"Offset2", PERSISTENT | FROGPILOT_CONTROLS},
{"Offset3", PERSISTENT | FROGPILOT_CONTROLS},
{"Offset4", PERSISTENT | FROGPILOT_CONTROLS},
{"OneLaneChange", PERSISTENT | FROGPILOT_CONTROLS},
{"OnroadDistanceButton", PERSISTENT | FROGPILOT_CONTROLS},
{"OnroadDistanceButtonPressed", CLEAR_ON_MANAGER_START},
{"openpilotMinutes", PERSISTENT},
{"OSMDownloadBounds", PERSISTENT},
{"OSMDownloadLocations", PERSISTENT},
{"OSMDownloadProgress", CLEAR_ON_MANAGER_START},
{"PathEdgeWidth", PERSISTENT | FROGPILOT_VISUALS},
{"PathWidth", PERSISTENT | FROGPILOT_VISUALS},
{"PauseAOLOnBrake", PERSISTENT | FROGPILOT_CONTROLS},
{"PauseLateralOnSignal", PERSISTENT | FROGPILOT_CONTROLS},
{"PauseLateralSpeed", PERSISTENT | FROGPILOT_CONTROLS},
{"PedalsOnUI", PERSISTENT | FROGPILOT_VISUALS},
{"PersonalizeOpenpilot", PERSISTENT | FROGPILOT_VISUALS},
{"PreferredSchedule", PERSISTENT | FROGPILOT_OTHER},
{"PreviousSpeedLimit", PERSISTENT},
{"PromptDistractedVolume", PERSISTENT | FROGPILOT_VISUALS},
{"PromptVolume", PERSISTENT | FROGPILOT_VISUALS},
{"QOLLateral", PERSISTENT | FROGPILOT_CONTROLS},
{"QOLLongitudinal", PERSISTENT | FROGPILOT_CONTROLS},
{"QOLVisuals", PERSISTENT | FROGPILOT_VISUALS},
{"RadicalTurtleDrives", PERSISTENT | FROGPILOT_CONTROLS},
{"RadicalTurtleScore", PERSISTENT | FROGPILOT_CONTROLS},
{"RainbowPath", PERSISTENT | FROGPILOT_VISUALS},
{"RandomEvents", PERSISTENT | FROGPILOT_VISUALS},
{"RecertifiedHerbalistDrives", PERSISTENT | FROGPILOT_CONTROLS},
{"RecertifiedHerbalistScore", PERSISTENT | FROGPILOT_CONTROLS},
{"RefuseVolume", PERSISTENT | FROGPILOT_VISUALS},
{"RelaxedFollow", PERSISTENT | FROGPILOT_CONTROLS},
{"RelaxedJerkAcceleration", PERSISTENT | FROGPILOT_CONTROLS},
{"RelaxedJerkDanger", PERSISTENT | FROGPILOT_CONTROLS},
{"RelaxedJerkDeceleration", PERSISTENT | FROGPILOT_CONTROLS},
{"RelaxedJerkSpeed", PERSISTENT | FROGPILOT_CONTROLS},
{"RelaxedJerkSpeedDecrease", PERSISTENT | FROGPILOT_CONTROLS},
{"RelaxedPersonalityProfile", PERSISTENT | FROGPILOT_CONTROLS},
{"ReverseCruise", PERSISTENT | FROGPILOT_CONTROLS},
{"RoadEdgesWidth", PERSISTENT | FROGPILOT_VISUALS},
{"RoadName", CLEAR_ON_MANAGER_START},
{"RoadNameUI", PERSISTENT | FROGPILOT_VISUALS},
{"RotatingWheel", PERSISTENT | FROGPILOT_VISUALS},
{"ScreenBrightness", PERSISTENT | FROGPILOT_VISUALS},
{"ScreenBrightnessOnroad", PERSISTENT | FROGPILOT_VISUALS},
{"ScreenManagement", PERSISTENT | FROGPILOT_VISUALS},
{"ScreenRecorder", PERSISTENT | FROGPILOT_VISUALS},
{"ScreenTimeout", PERSISTENT | FROGPILOT_VISUALS},
{"ScreenTimeoutOnroad", PERSISTENT | FROGPILOT_VISUALS},
{"SearchInput", PERSISTENT | FROGPILOT_OTHER},
{"SecretGoodOpenpilotDrives", PERSISTENT | FROGPILOT_CONTROLS},
{"SecretGoodOpenpilotScore", PERSISTENT | FROGPILOT_CONTROLS},
{"SetSpeedLimit", PERSISTENT | FROGPILOT_CONTROLS},
{"SetSpeedOffset", PERSISTENT | FROGPILOT_CONTROLS},
{"ShowCEMStatus", PERSISTENT | FROGPILOT_VISUALS},
{"ShowCPU", PERSISTENT | FROGPILOT_VISUALS},
{"ShowGPU", PERSISTENT | FROGPILOT_VISUALS},
{"ShowIP", PERSISTENT | FROGPILOT_VISUALS},
{"ShowMemoryUsage", PERSISTENT | FROGPILOT_VISUALS},
{"ShowSLCOffset", PERSISTENT | FROGPILOT_CONTROLS},
{"ShowSpeedLimits", PERSISTENT | FROGPILOT_VISUALS},
{"ShowSteering", PERSISTENT | FROGPILOT_VISUALS},
{"ShowStoppingPoint", PERSISTENT | FROGPILOT_VISUALS},
{"ShowStoppingPointMetrics", PERSISTENT | FROGPILOT_VISUALS},
{"ShowStorageLeft", PERSISTENT | FROGPILOT_VISUALS},
{"ShowStorageUsed", PERSISTENT | FROGPILOT_VISUALS},
{"Sidebar", PERSISTENT | FROGPILOT_OTHER},
{"SidebarMetrics", PERSISTENT | FROGPILOT_VISUALS},
{"SignalMetrics", PERSISTENT | FROGPILOT_VISUALS},
{"SignalToDownload", CLEAR_ON_MANAGER_START},
{"SLCConfirmation", PERSISTENT | FROGPILOT_CONTROLS},
{"SLCConfirmationHigher", PERSISTENT | FROGPILOT_CONTROLS},
{"SLCConfirmationLower", PERSISTENT | FROGPILOT_CONTROLS},
{"SLCLookaheadHigher", PERSISTENT | FROGPILOT_CONTROLS},
{"SLCLookaheadLower", PERSISTENT | FROGPILOT_CONTROLS},
{"SLCFallback", PERSISTENT | FROGPILOT_CONTROLS},
{"SLCOverride", PERSISTENT | FROGPILOT_CONTROLS},
{"SLCPriority1", PERSISTENT | FROGPILOT_CONTROLS},
{"SLCPriority2", PERSISTENT | FROGPILOT_CONTROLS},
{"SLCPriority3", PERSISTENT | FROGPILOT_CONTROLS},
{"SmartTurnControl", PERSISTENT | FROGPILOT_CONTROLS},
{"SNGHack", PERSISTENT | FROGPILOT_VEHICLES},
{"SoundToDownload", CLEAR_ON_MANAGER_START},
{"SpeedLimitAccepted", CLEAR_ON_MANAGER_START},
{"SpeedLimitChangedAlert", PERSISTENT | FROGPILOT_CONTROLS},
{"SpeedLimitController", PERSISTENT | FROGPILOT_CONTROLS},
{"SpeedLimitSources", PERSISTENT | FROGPILOT_VISUALS},
{"StandardFollow", PERSISTENT | FROGPILOT_CONTROLS},
{"StandardJerkAcceleration", PERSISTENT | FROGPILOT_CONTROLS},
{"StandardJerkDanger", PERSISTENT | FROGPILOT_CONTROLS},
{"StandardJerkDeceleration", PERSISTENT | FROGPILOT_CONTROLS},
{"StandardJerkSpeed", PERSISTENT | FROGPILOT_CONTROLS},
{"StandardJerkSpeedDecrease", PERSISTENT | FROGPILOT_CONTROLS},
{"StandardPersonalityProfile", PERSISTENT | FROGPILOT_CONTROLS},
{"StandbyMode", PERSISTENT | FROGPILOT_VISUALS},
{"StartupMessageBottom", PERSISTENT | FROGPILOT_VISUALS},
{"StartupMessageTop", PERSISTENT | FROGPILOT_VISUALS},
{"StaticPedalsOnUI", PERSISTENT | FROGPILOT_VISUALS},
{"SteerFriction", PERSISTENT | FROGPILOT_CONTROLS},
{"SteerFrictionStock", PERSISTENT},
{"SteerLatAccel", PERSISTENT | FROGPILOT_CONTROLS},
{"SteerLatAccelStock", PERSISTENT},
{"SteerKP", PERSISTENT | FROGPILOT_CONTROLS},
{"SteerKPStock", PERSISTENT},
{"SteerRatio", PERSISTENT | FROGPILOT_CONTROLS},
{"SteerRatioStock", PERSISTENT},
{"StoppedTimer", PERSISTENT | FROGPILOT_VISUALS},
{"TacoTune", PERSISTENT | FROGPILOT_CONTROLS},
{"TestingSound", CLEAR_ON_MANAGER_START},
{"TetheringEnabled", PERSISTENT | FROGPILOT_OTHER},
{"ThemeDownloadProgress", CLEAR_ON_MANAGER_START},
{"ToyotaDoors", PERSISTENT | FROGPILOT_VEHICLES},
{"TrafficFollow", PERSISTENT | FROGPILOT_CONTROLS},
{"TrafficJerkAcceleration", PERSISTENT | FROGPILOT_CONTROLS},
{"TrafficJerkDanger", PERSISTENT | FROGPILOT_CONTROLS},
{"TrafficJerkDeceleration", PERSISTENT | FROGPILOT_CONTROLS},
{"TrafficJerkSpeed", PERSISTENT | FROGPILOT_CONTROLS},
{"TrafficJerkSpeedDecrease", PERSISTENT | FROGPILOT_CONTROLS},
{"TrafficPersonalityProfile", PERSISTENT | FROGPILOT_CONTROLS},
{"TuningInfo", PERSISTENT | FROGPILOT_VISUALS},
{"TuningLevel", PERSISTENT},
{"TuningLevelConfirmed", PERSISTENT},
{"TurnAggressiveness", PERSISTENT | FROGPILOT_CONTROLS},
{"TurnDesires", PERSISTENT | FROGPILOT_CONTROLS},
{"UnlimitedLength", PERSISTENT | FROGPILOT_VISUALS},
{"UnlockDoors", PERSISTENT | FROGPILOT_VEHICLES},
{"Updated", PERSISTENT},
{"UpdateWheelImage", CLEAR_ON_MANAGER_START},
{"UserCurvature", PERSISTENT},
{"UseSI", PERSISTENT | FROGPILOT_VISUALS},
{"UseStockColors", CLEAR_ON_MANAGER_START},
{"UseVienna", PERSISTENT | FROGPILOT_CONTROLS},
{"VisionTurnControl", PERSISTENT | FROGPILOT_CONTROLS},
{"VoltSNG", PERSISTENT | FROGPILOT_VEHICLES},
{"WarningImmediateVolume", PERSISTENT | FROGPILOT_VISUALS},
{"WarningSoftVolume", PERSISTENT | FROGPILOT_VISUALS},
{"WD40Drives", PERSISTENT | FROGPILOT_CONTROLS},
{"WD40Score", PERSISTENT | FROGPILOT_CONTROLS},
{"WheelIcon", PERSISTENT | FROGPILOT_VISUALS},
{"WheelSpeed", PERSISTENT | FROGPILOT_VISUALS},
{"WheelToDownload", CLEAR_ON_MANAGER_START},
}; };
} // namespace } // namespace
+25
View File
@@ -16,6 +16,11 @@ enum ParamKeyType {
CLEAR_ON_OFFROAD_TRANSITION = 0x10, CLEAR_ON_OFFROAD_TRANSITION = 0x10,
DONT_LOG = 0x20, DONT_LOG = 0x20,
DEVELOPMENT_ONLY = 0x40, DEVELOPMENT_ONLY = 0x40,
FROGPILOT_CONTROLS = 0x80,
FROGPILOT_VISUALS = 0x100,
FROGPILOT_OTHER = 0x400,
FROGPILOT_TRACKING = 0x800,
FROGPILOT_VEHICLES = 0x1000,
ALL = 0xFFFFFFFF ALL = 0xFFFFFFFF
}; };
@@ -43,6 +48,14 @@ public:
inline bool getBool(const std::string &key, bool block = false) { inline bool getBool(const std::string &key, bool block = false) {
return get(key, block) == "1"; return get(key, block) == "1";
} }
inline int getInt(const std::string &key, bool block = false) {
std::string value = get(key, block);
return value.empty() ? 0 : std::stoi(value);
}
inline float getFloat(const std::string &key, bool block = false) {
std::string value = get(key, block);
return value.empty() ? 0.0 : std::stof(value);
}
std::map<std::string, std::string> readAll(); std::map<std::string, std::string> readAll();
// helpers for writing values // helpers for writing values
@@ -53,10 +66,22 @@ public:
inline int putBool(const std::string &key, bool val) { inline int putBool(const std::string &key, bool val) {
return put(key.c_str(), val ? "1" : "0", 1); return put(key.c_str(), val ? "1" : "0", 1);
} }
inline int putInt(const std::string &key, int val) {
return put(key.c_str(), std::to_string(val).c_str(), std::to_string(val).size());
}
inline int putFloat(const std::string &key, float val) {
return put(key.c_str(), std::to_string(val).c_str(), std::to_string(val).size());
}
void putNonBlocking(const std::string &key, const std::string &val); void putNonBlocking(const std::string &key, const std::string &val);
inline void putBoolNonBlocking(const std::string &key, bool val) { inline void putBoolNonBlocking(const std::string &key, bool val) {
putNonBlocking(key, val ? "1" : "0"); putNonBlocking(key, val ? "1" : "0");
} }
inline void putIntNonBlocking(const std::string &key, int val) {
putNonBlocking(key, std::to_string(val));
}
inline void putFloatNonBlocking(const std::string &key, float val) {
putNonBlocking(key, std::to_string(val));
}
private: private:
void asyncWriteThread(); void asyncWriteThread();
+50
View File
@@ -11,21 +11,33 @@ cdef extern from "common/params.h":
CLEAR_ON_ONROAD_TRANSITION CLEAR_ON_ONROAD_TRANSITION
CLEAR_ON_OFFROAD_TRANSITION CLEAR_ON_OFFROAD_TRANSITION
DEVELOPMENT_ONLY DEVELOPMENT_ONLY
FROGPILOT_CONTROLS
FROGPILOT_OTHER
FROGPILOT_TRACKING
FROGPILOT_VEHICLES
FROGPILOT_VISUALS
ALL ALL
cdef cppclass c_Params "Params": cdef cppclass c_Params "Params":
c_Params(string) except + nogil c_Params(string) except + nogil
string get(string, bool) nogil string get(string, bool) nogil
bool getBool(string, bool) nogil bool getBool(string, bool) nogil
int getInt(string, bool) nogil
float getFloat(string, bool) nogil
int remove(string) nogil int remove(string) nogil
int put(string, string) nogil int put(string, string) nogil
void putNonBlocking(string, string) nogil void putNonBlocking(string, string) nogil
void putBoolNonBlocking(string, bool) nogil void putBoolNonBlocking(string, bool) nogil
void putIntNonBlocking(string, int) nogil
void putFloatNonBlocking(string, float) nogil
int putBool(string, bool) nogil int putBool(string, bool) nogil
int putInt(string, int) nogil
int putFloat(string, float) nogil
bool checkKey(string) nogil bool checkKey(string) nogil
string getParamPath(string) nogil string getParamPath(string) nogil
void clearAll(ParamKeyType) void clearAll(ParamKeyType)
vector[string] allKeys() vector[string] allKeys()
ParamKeyType getKeyType(string) nogil
def ensure_bytes(v): def ensure_bytes(v):
@@ -77,6 +89,20 @@ cdef class Params:
r = self.p.getBool(k, block) r = self.p.getBool(k, block)
return r return r
def get_int(self, key, bool block=False):
cdef string k = self.check_key(key)
cdef int r
with nogil:
r = self.p.getInt(k, block)
return r
def get_float(self, key, bool block=False):
cdef string k = self.check_key(key)
cdef float r
with nogil:
r = self.p.getFloat(k, block)
return r
def put(self, key, dat): def put(self, key, dat):
""" """
Warning: This function blocks until the param is written to disk! Warning: This function blocks until the param is written to disk!
@@ -94,6 +120,16 @@ cdef class Params:
with nogil: with nogil:
self.p.putBool(k, val) self.p.putBool(k, val)
def put_int(self, key, int val):
cdef string k = self.check_key(key)
with nogil:
self.p.putInt(k, val)
def put_float(self, key, float val):
cdef string k = self.check_key(key)
with nogil:
self.p.putFloat(k, val)
def put_nonblocking(self, key, dat): def put_nonblocking(self, key, dat):
cdef string k = self.check_key(key) cdef string k = self.check_key(key)
cdef string dat_bytes = ensure_bytes(dat) cdef string dat_bytes = ensure_bytes(dat)
@@ -105,6 +141,16 @@ cdef class Params:
with nogil: with nogil:
self.p.putBoolNonBlocking(k, val) self.p.putBoolNonBlocking(k, val)
def put_int_nonblocking(self, key, int val):
cdef string k = self.check_key(key)
with nogil:
self.p.putIntNonBlocking(k, val)
def put_float_nonblocking(self, key, float val):
cdef string k = self.check_key(key)
with nogil:
self.p.putFloatNonBlocking(k, val)
def remove(self, key): def remove(self, key):
cdef string k = self.check_key(key) cdef string k = self.check_key(key)
with nogil: with nogil:
@@ -116,3 +162,7 @@ cdef class Params:
def all_keys(self): def all_keys(self):
return self.p.allKeys() return self.p.allKeys()
def get_key_type(self, key):
cdef string k = self.check_key(key)
return self.p.getKeyType(k)
+14
View File
@@ -271,4 +271,18 @@ std::string check_output(const std::string& command) {
return result; return result;
} }
bool system_time_valid() {
// Default to March 30, 2024
tm min_tm = {.tm_year = 2024 - 1900, .tm_mon = 2, .tm_mday = 30};
time_t min_date = mktime(&min_tm);
struct stat st;
if (stat("/lib/systemd/systemd", &st) == 0) {
min_date = std::max(min_date, st.st_mtime + 86400); // Add 1 day (86400 seconds)
}
return time(nullptr) > min_date;
}
} // namespace util } // namespace util
+5
View File
@@ -36,6 +36,9 @@ const double MS_TO_KPH = 3.6;
const double MS_TO_MPH = MS_TO_KPH * KM_TO_MILE; const double MS_TO_MPH = MS_TO_KPH * KM_TO_MILE;
const double METER_TO_MILE = KM_TO_MILE / 1000.0; const double METER_TO_MILE = KM_TO_MILE / 1000.0;
const double METER_TO_FOOT = 3.28084; const double METER_TO_FOOT = 3.28084;
const double FOOT_TO_METER = 1. / METER_TO_FOOT;
const double CM_TO_INCH = 1. / 2.54;
const double INCH_TO_CM = 1. / CM_TO_INCH;
namespace util { namespace util {
@@ -93,6 +96,8 @@ bool create_directories(const std::string &dir, mode_t mode);
std::string check_output(const std::string& command); std::string check_output(const std::string& command);
bool system_time_valid();
inline void sleep_for(const int milliseconds) { inline void sleep_for(const int milliseconds) {
if (milliseconds > 0) { if (milliseconds > 0) {
std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds)); std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds));
@@ -312,6 +312,7 @@ BO_ 764 ACCEL_RELATED_2FC: 8 XXX
BO_ 816 TRACTION_BUTTON: 8 XXX BO_ 816 TRACTION_BUTTON: 8 XXX
SG_ TRACTION_OFF : 19|1@0+ (1,0) [0|3] "" XXX SG_ TRACTION_OFF : 19|1@0+ (1,0) [0|3] "" XXX
SG_ TOGGLE_PARKSENSE : 52|1@0+ (1,0) [0|3] "" XXX SG_ TOGGLE_PARKSENSE : 52|1@0+ (1,0) [0|3] "" XXX
SG_ TOGGLE_LKAS : 53|1@0+ (1,0) [0|1] "" XXX
BO_ 878 ACCEL_RELATED_36E: 8 XXX BO_ 878 ACCEL_RELATED_36E: 8 XXX
SG_ ACCEL_OR_RPM_2 : 15|8@0+ (1,0) [0|255] "" XXX SG_ ACCEL_OR_RPM_2 : 15|8@0+ (1,0) [0|255] "" XXX
+21 -1
View File
@@ -90,9 +90,11 @@ BO_ 500 DAS_3: 8 XXX
SG_ DISABLE_FUEL_SHUTOFF : 23|1@1+ (1,0) [0|0] "" XXX SG_ DISABLE_FUEL_SHUTOFF : 23|1@1+ (1,0) [0|0] "" XXX
SG_ GR_MAX_REQ : 32|4@1+ (1,0) [0|0] "" XXX SG_ GR_MAX_REQ : 32|4@1+ (1,0) [0|0] "" XXX
SG_ ACC_DECEL_REQ : 36|3@1+ (1,0) [0|0] "" XXX SG_ ACC_DECEL_REQ : 36|3@1+ (1,0) [0|0] "" XXX
SG_ ACC_FAULTED : 46|2@1+ (1,0) [0|0] "" XXX SG_ STS : 46|2@1+ (1,0) [0|0] "" XXX
SG_ ACC_FAULTED : 47|1@0+ (1,0) [0|1] "" XXX
SG_ COLLISION_BRK_PREP : 48|1@1+ (1,0) [0|0] "" XXX SG_ COLLISION_BRK_PREP : 48|1@1+ (1,0) [0|0] "" XXX
SG_ ACC_BRK_PREP : 49|1@1+ (1,0) [0|0] "" XXX SG_ ACC_BRK_PREP : 49|1@1+ (1,0) [0|0] "" XXX
SG_ BRAKE_BOOL_1 : 36|1@0+ (1,0) [0|3] "" XXX
SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
@@ -137,6 +139,18 @@ BO_ 570 CRUISE_BUTTONS: 3 XXX
SG_ COUNTER : 15|4@0+ (1,0) [0|15] "" XXX SG_ COUNTER : 15|4@0+ (1,0) [0|15] "" XXX
SG_ CHECKSUM : 23|8@0+ (1,0) [0|255] "" XXX SG_ CHECKSUM : 23|8@0+ (1,0) [0|255] "" XXX
BO_ 571 CRUISE_BUTTONS_ALT: 3 XXX
SG_ ACC_Cancel : 0|1@1+ (1,0) [0|0] "" XXX
SG_ ACC_Distance_Dec : 1|1@1+ (1,0) [0|0] "" XXX
SG_ ACC_Accel : 2|1@1+ (1,0) [0|0] "" XXX
SG_ ACC_Decel : 3|1@1+ (1,0) [0|0] "" XXX
SG_ ACC_Resume : 4|1@0+ (1,0) [0|1] "" XXX
SG_ Cruise_OnOff : 6|1@1+ (1,0) [0|0] "" XXX
SG_ ACC_OnOff : 7|1@1+ (1,0) [0|0] "" XXX
SG_ ACC_Distance_Inc : 8|1@1+ (1,0) [0|0] "" XXX
SG_ COUNTER : 15|4@0+ (1,0) [0|15] "" XXX
SG_ CHECKSUM : 23|8@0+ (1,0) [0|255] "" XXX
BO_ 625 DAS_5: 8 XXX BO_ 625 DAS_5: 8 XXX
SG_ FCW_STATE : 2|1@1+ (1,0) [0|0] "" XXX SG_ FCW_STATE : 2|1@1+ (1,0) [0|0] "" XXX
SG_ FCW_DISTANCE : 3|2@1+ (1,0) [0|0] "" XXX SG_ FCW_DISTANCE : 3|2@1+ (1,0) [0|0] "" XXX
@@ -207,3 +221,9 @@ BO_ 630 LKAS_COMMAND: 8 XXX
SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX SG_ COUNTER : 55|4@0+ (1,0) [0|15] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 650 Center_Stack_2: 8 XXX
SG_ LKAS_Button : 57|1@1+ (1,0) [0|0] "" XXX
BO_ 816 Center_Stack_1: 8 XXX
SG_ LKAS_Button : 53|1@1+ (1,0) [0|0] "" XXX
SG_ Traction_Button : 54|1@0+ (1,0) [0|1] "" XXX
+92 -8
View File
@@ -45,9 +45,24 @@ BO_ 37 STEER_ANGLE_SENSOR: 8 XXX
SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX
SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX
BO_ 119 ENG2F41: 6 CGW
SG_ FDRV : 7|16@0- (2,0) [0|0] "N" Vector__XXX
SG_ FDRVREAL : 23|13@0- (10,0) [0|0] "N" Vector__XXX
SG_ XAECT : 39|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ XFDRVCOL : 38|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ FDRVSELP : 34|3@0+ (1,0) [0|0] "" Vector__XXX
SG_ ENG2F41S : 47|8@0+ (1,0) [0|0] "" Vector__XXX
BO_ 120 ENG2F42: 4 CGW
SG_ FAVLMCHH : 7|16@0- (2,0) [0|0] "N" Vector__XX228X
SG_ CCRNG : 23|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ FDRVTYPD : 22|3@0+ (1,0) [0|0] "" Vector__XXX
SG_ GEARHD : 18|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ ENG2F42S : 31|8@0+ (1,0) [0|0] "" Vector__XXX
BO_ 166 BRAKE: 8 XXX BO_ 166 BRAKE: 8 XXX
SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX
SG_ BRAKE_PEDAL : 23|8@0+ (1,0) [0|255] "" XXX SG_ BRAKE_FORCE : 23|8@0+ (40,0) [0|10200] "N" XXX
BO_ 170 WHEEL_SPEEDS: 8 XXX BO_ 170 WHEEL_SPEEDS: 8 XXX
SG_ WHEEL_SPEED_FR : 7|16@0+ (0.01,-67.67) [0|250] "km/h" XXX SG_ WHEEL_SPEED_FR : 7|16@0+ (0.01,-67.67) [0|250] "km/h" XXX
@@ -61,8 +76,8 @@ BO_ 180 SPEED: 8 XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 295 GEAR_PACKET_HYBRID: 8 XXX BO_ 295 GEAR_PACKET_HYBRID: 8 XXX
SG_ CAR_MOVEMENT : 25|10@0- (1,0) [0|255] "" XXX SG_ FDRVREAL : 26|11@0- (25,0) [-25600|25575] "N" XXX
SG_ COUNTER : 55|8@0+ (1,0) [0|255] "" XXX SG_ UNKNOWN : 55|8@0+ (1,0) [0|255] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
SG_ GEAR : 47|4@0+ (1,0) [0|15] "" XXX SG_ GEAR : 47|4@0+ (1,0) [0|15] "" XXX
@@ -71,6 +86,7 @@ BO_ 353 DSU_SPEED: 7 XXX
BO_ 452 ENGINE_RPM: 8 CGW BO_ 452 ENGINE_RPM: 8 CGW
SG_ RPM : 7|16@0- (0.78125,0) [0|0] "rpm" SCS SG_ RPM : 7|16@0- (0.78125,0) [0|0] "rpm" SCS
SG_ ENGINE_RUNNING : 27|1@0+ (1,0) [0|1] "" XXX
BO_ 466 PCM_CRUISE: 8 XXX BO_ 466 PCM_CRUISE: 8 XXX
SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX
@@ -91,9 +107,10 @@ BO_ 467 PCM_CRUISE_2: 8 XXX
SG_ ACC_FAULTED : 47|1@0+ (1,0) [0|1] "" XXX SG_ ACC_FAULTED : 47|1@0+ (1,0) [0|1] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 552 ACCELEROMETER: 8 XXX BO_ 552 VSC1S29: 4 CGW
SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "m/s^2" XXX SG_ ICBACT : 7|1@0+ (1,0) [0|0] "" DS1
SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s^2" XXX SG_ DVS0PCS : 6|15@0- (0.001,0) [0|0] "m/s^2" DS1
SG_ SM228 : 31|8@0+ (1,0) [0|0] "" DS1
BO_ 560 BRAKE_2: 7 XXX BO_ 560 BRAKE_2: 7 XXX
SG_ BRAKE_PRESSED : 26|1@0+ (1,0) [0|1] "" XXX SG_ BRAKE_PRESSED : 26|1@0+ (1,0) [0|1] "" XXX
@@ -147,6 +164,31 @@ BO_ 742 LEAD_INFO: 8 DSU
SG_ LEAD_REL_SPEED : 23|12@0- (0.025,0) [-100|100] "m/s" HCU SG_ LEAD_REL_SPEED : 23|12@0- (0.025,0) [-100|100] "m/s" HCU
SG_ LEAD_LONG_DIST : 7|13@0+ (0.05,0) [0|300] "m" HCU SG_ LEAD_LONG_DIST : 7|13@0+ (0.05,0) [0|300] "m" HCU
BO_ 800 VSC1S07: 8 CGW
SG_ FBKRLY : 6|1@0+ (1,0) [0|0] "" DS1
SG_ FVSCM : 4|1@0+ (1,0) [0|0] "" DS1
SG_ FVSCSFT : 3|1@0+ (1,0) [0|0] "" DS1
SG_ FABS : 2|1@0+ (1,0) [0|0] "" DS1,FCM
SG_ TSVSC : 1|1@0+ (1,0) [0|0] "" DS1
SG_ FVSCL : 0|1@0+ (1,0) [0|0] "" DS1
SG_ RQCSTBKB : 15|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ PSBSTBY : 14|1@0+ (1,0) [0|0] "" DS1
SG_ P2BRXMK : 13|1@0+ (1,0) [0|0] "" DS1
SG_ MCC : 11|1@0+ (1,0) [0|0] "" DS1
SG_ RQBKB : 10|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ BRSTOP : 9|1@0+ (1,0) [0|0] "" DS1,FCM
SG_ BRKON : 8|1@0+ (1,0) [0|0] "" DS1,FCM
SG_ ASLP : 23|8@0- (1,0) [0|0] "deg" DS1
SG_ BRTYPACC : 31|2@0+ (1,0) [0|0] "" DS1
SG_ BRKABT3 : 26|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ BRKABT2 : 25|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ BRKABT1 : 24|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ GVC : 39|8@0- (0.04,0) [0|0] "m/s^2" DS1
SG_ XGVCINV : 43|1@0+ (1,0) [0|0] "" DS1
SG_ S07CNT : 52|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ PCSBRSTA : 50|2@0+ (1,0) [0|0] "" DS1
SG_ VSC07SUM : 63|8@0+ (1,0) [0|0] "" DS1,FCM
BO_ 835 ACC_CONTROL: 8 DSU BO_ 835 ACC_CONTROL: 8 DSU
SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s^2" HCU SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s^2" HCU
SG_ ALLOW_LONG_PRESS : 17|2@0+ (1,0) [0|2] "" XXX SG_ ALLOW_LONG_PRESS : 17|2@0+ (1,0) [0|2] "" XXX
@@ -165,12 +207,19 @@ BO_ 835 ACC_CONTROL: 8 DSU
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 836 PRE_COLLISION_2: 8 DSU BO_ 836 PRE_COLLISION_2: 8 DSU
SG_ DSS1GDRV : 7|10@0- (0.1,0) [0|0] "m/s^2" Vector__XXX
SG_ PCSALM : 17|1@0+ (1,0) [0|0] "" FCM
SG_ IBTRGR : 27|1@0+ (1,0) [0|0] "" FCM
SG_ PBATRGR : 30|2@0+ (1,0) [0|0] "" Vector__XXX
SG_ PREFILL : 33|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ AVSTRGR : 36|1@0+ (1,0) [0|0] "" SCS
SG_ CHECKSUM : 63|8@0+ (1,0) [0|0] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|0] "" XXX
BO_ 865 CLUTCH: 8 XXX BO_ 865 CLUTCH: 8 XXX
SG_ ACC_FAULTED : 32|1@0+ (1,0) [0|1] "" XXX SG_ ACC_FAULTED : 32|1@0+ (1,0) [0|1] "" XXX
SG_ GAS_PEDAL_ALT : 23|8@0+ (0.005,0) [0|1] "" XXX SG_ GAS_PEDAL_ALT : 23|8@0+ (0.005,0) [0|1] "" XXX
SG_ CLUTCH_RELEASED : 38|1@0+ (1,0) [0|1] "" XXX SG_ CLUTCH_RELEASED : 38|1@0+ (1,0) [0|1] "" XXX
SG_ ACCEL_NET : 48|16@1+ (0.0002,-6.5536) [-6.5536|6.5534] "" XXX
BO_ 869 DSU_CRUISE : 7 DSU BO_ 869 DSU_CRUISE : 7 DSU
SG_ RES_BTN : 3|1@0+ (1,0) [0|0] "" XXX SG_ RES_BTN : 3|1@0+ (1,0) [0|0] "" XXX
@@ -272,6 +321,18 @@ BO_ 1044 AUTO_HIGH_BEAM: 8 FCM
SG_ F_AHB : 55|4@0+ (1,0) [0|0] "" Vector__XXX SG_ F_AHB : 55|4@0+ (1,0) [0|0] "" Vector__XXX
SG_ C_AHB : 51|4@0+ (1,0) [0|0] "" Vector__XXX SG_ C_AHB : 51|4@0+ (1,0) [0|0] "" Vector__XXX
BO_ 1056 VSC1S08: 8 CGW
SG_ YR1Z : 7|16@0- (1,0) [0|0] "rad/s" DS1,FCM,MAV
SG_ YR2Z : 23|16@0- (1,0) [0|0] "rad/s" DS1,FCM,MAV
SG_ GL1Z : 39|8@0- (0.0359,0) [0|0] "m/s^2" DS1,FCM,KSS,MAV,SCS
SG_ GL2Z : 47|8@0- (0.0359,0) [0|0] "m/s^2" DS1,FCM,KSS,MAV,SCS
SG_ YRGSDIR : 55|1@0+ (1,0) [0|0] "" DS1,FCM,KSS,SCS
SG_ GLZS : 51|1@0+ (1,0) [0|0] "" DS1,FCM,KSS,MAV,SCS
SG_ YRZF : 50|1@0+ (1,0) [0|0] "" DS1,FCM,MAV
SG_ YRZS : 49|1@0+ (1,0) [0|0] "" DS1,FCM,MAV
SG_ YRZKS : 48|1@0+ (1,0) [0|0] "" DS1,FCM,MAV
SG_ VSC08SUM : 63|8@0+ (1,0) [0|0] "" DS1,FCM,MAV
BO_ 1083 AUTOPARK_STATUS: 8 IPAS BO_ 1083 AUTOPARK_STATUS: 8 IPAS
SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX
@@ -350,9 +411,11 @@ BO_ 1552 BODY_CONTROL_STATE_2: 8 XXX
BO_ 1553 UI_SETTING: 8 XXX BO_ 1553 UI_SETTING: 8 XXX
SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX
SG_ ODOMETER : 39|32@0+ (1,0) [0|1048575] "" XXX SG_ ODOMETER : 39|32@0+ (1,0) [0|1048575] "" XXX
BO_ 1556 BLINKERS_STATE: 8 XXX BO_ 1556 BLINKERS_STATE: 8 XXX
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX SG_ BLINKER_BUTTON_PRESSED : 15|1@0+ (1,0) [0|1] "" XXX
SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
BO_ 1568 BODY_CONTROL_STATE: 8 XXX BO_ 1568 BODY_CONTROL_STATE: 8 XXX
SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" XXX SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" XXX
@@ -381,13 +444,30 @@ BO_ 1592 DOOR_LOCKS: 8 XXX
SG_ LOCK_STATUS : 20|1@0+ (1,0) [0|1] "" XXX SG_ LOCK_STATUS : 20|1@0+ (1,0) [0|1] "" XXX
SG_ LOCKED_VIA_KEYFOB : 23|1@0+ (1,0) [0|1] "" XXX SG_ LOCKED_VIA_KEYFOB : 23|1@0+ (1,0) [0|1] "" XXX
BO_ 1779 ADAS_TOGGLE_STATE: 8 XXX
SG_ OK_BUTTON_PRESSED : 15|1@0+ (1,0) [0|1] "" BCM
SG_ SWS_TOGGLE_CMD : 24|1@0+ (1,0) [0|1] "" XXX
SG_ SWS_SENSITIVITY_CMD : 26|2@0+ (1,0) [0|3] "" XXX
SG_ LKAS_ON_CMD : 28|1@0+ (1,0) [0|1] "" XXX
SG_ LKAS_OFF_CMD : 29|1@0+ (1,0) [0|1] "" XXX
SG_ LDA_SENSITIVITY_HI_CMD : 30|1@0+ (1,0) [0|1] "" XXX
SG_ LDA_SENSITIVITY_STD_CMD : 31|1@0+ (1,0) [0|1] "" XXX
SG_ IPAS_TOGGLE : 34|1@0+ (1,0) [0|1] "" XXX
SG_ BSM_TOGGLE_CMD : 37|1@0+ (1,0) [0|1] "" XXX
SG_ IPAS_SONAR_TOGGLE : 38|1@0+ (1,0) [0|1] "" XXX
SG_ PCS_TOGGLE_CMD : 40|1@0+ (1,0) [0|1] "" XXX
SG_ PCS_SENSITIVITY_CMD : 41|1@0+ (1,0) [0|1] "" XXX
CM_ SG_ 36 YAW_RATE "verify"; CM_ SG_ 36 YAW_RATE "verify";
CM_ SG_ 36 ACCEL_X "x-axis accel"; CM_ SG_ 36 ACCEL_X "x-axis accel";
CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set";
CM_ SG_ 37 STEER_RATE "factor is tbd"; CM_ SG_ 37 STEER_RATE "factor is tbd";
CM_ SG_ 119 FDRVREAL "ICE only: force applied by wheels from the engine. includes creeping force, regen, and engine braking";
CM_ SG_ 166 BRAKE_FORCE "hybrid only: force applied by friction brakes from user or ACC command";
CM_ SG_ 295 FDRVREAL "hybrid only: force applied by wheels from the engine and/or electric motors. includes creeping force, regen, and engine braking";
CM_ SG_ 466 NEUTRAL_FORCE "force in newtons the engine/electric motors are applying without any acceleration commands or user input"; CM_ SG_ 466 NEUTRAL_FORCE "force in newtons the engine/electric motors are applying without any acceleration commands or user input";
CM_ SG_ 466 ACC_BRAKING "whether brakes are being actuated from ACC command"; CM_ SG_ 466 ACC_BRAKING "whether brakes are being actuated from ACC command";
CM_ SG_ 466 ACCEL_NET "net acceleration produced by the system, given ACCEL_CMD, road grade and other factors"; CM_ SG_ 466 ACCEL_NET "net negative acceleration (braking) applied by the system if on flat ground";
CM_ SG_ 466 CRUISE_STATE "Active state is 8, if standstill is requested will switch to state 11(3 sec timer), after timer is elapsed will switch into state 7(standstill). If plus button was pressed - status 9, minus button pressed - status 10"; CM_ SG_ 466 CRUISE_STATE "Active state is 8, if standstill is requested will switch to state 11(3 sec timer), after timer is elapsed will switch into state 7(standstill). If plus button was pressed - status 9, minus button pressed - status 10";
CM_ SG_ 467 ACC_FAULTED "1 when ACC is faulted and the PCM disallows engagement"; CM_ SG_ 467 ACC_FAULTED "1 when ACC is faulted and the PCM disallows engagement";
CM_ SG_ 467 SET_SPEED "43 km/h are shown as 28 mph, so conversion isn't perfect"; CM_ SG_ 467 SET_SPEED "43 km/h are shown as 28 mph, so conversion isn't perfect";
@@ -400,6 +480,8 @@ CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active";
CM_ SG_ 643 _COUNTER "only used on cars that use this msg for cruise control"; CM_ SG_ 643 _COUNTER "only used on cars that use this msg for cruise control";
CM_ SG_ 643 BRAKE_STATUS "only used on cars that use this msg for cruise control"; CM_ SG_ 643 BRAKE_STATUS "only used on cars that use this msg for cruise control";
CM_ SG_ 643 PRECOLLISION_ACTIVE "set 0.5s before any braking"; CM_ SG_ 643 PRECOLLISION_ACTIVE "set 0.5s before any braking";
CM_ SG_ 800 SLOPE_ANGLE "potentially used by the PCM to compensate for road pitch";
CM_ SG_ 800 ACCEL "filtered ego acceleration";
CM_ SG_ 835 ACC_TYPE "if 2, car is likely to have a permanent low speed lockout. 1 is ok"; CM_ SG_ 835 ACC_TYPE "if 2, car is likely to have a permanent low speed lockout. 1 is ok";
CM_ SG_ 835 RADAR_DIRTY "Display Clean Radar Sensor message on HUD"; CM_ SG_ 835 RADAR_DIRTY "Display Clean Radar Sensor message on HUD";
CM_ SG_ 835 ACC_MALFUNCTION "display ACC fault on dash if set to 1"; CM_ SG_ 835 ACC_MALFUNCTION "display ACC fault on dash if set to 1";
@@ -412,6 +494,7 @@ CM_ SG_ 835 PERMIT_BRAKING "Original ACC has this going high when a car in front
CM_ SG_ 835 ACCEL_CMD_ALT "Copy of main ACCEL_CMD, but across 8 bits instead of 16 bits like ACCEL_CMD. Unsure if only informational or has an effect. Likely informational as existing openpilot sets this to 0 and no loss of functionality observed. Originally 'AT_RAW' in leaked toyota_2017_ref_pt.dbc file."; CM_ SG_ 835 ACCEL_CMD_ALT "Copy of main ACCEL_CMD, but across 8 bits instead of 16 bits like ACCEL_CMD. Unsure if only informational or has an effect. Likely informational as existing openpilot sets this to 0 and no loss of functionality observed. Originally 'AT_RAW' in leaked toyota_2017_ref_pt.dbc file.";
CM_ SG_ 865 GAS_PEDAL_ALT "copy of main GAS_PEDAL. Both use 8 bits. Might indicate that this message is for pedals."; CM_ SG_ 865 GAS_PEDAL_ALT "copy of main GAS_PEDAL. Both use 8 bits. Might indicate that this message is for pedals.";
CM_ SG_ 865 CLUTCH_RELEASED "boolean of clutch for 6MT."; CM_ SG_ 865 CLUTCH_RELEASED "boolean of clutch for 6MT.";
CM_ SG_ 865 ACCEL_NET "net positive acceleration (gas) applied by the system if on flat ground, may not include creeping force";
CM_ SG_ 865 ACC_FAULTED "1 when ACC is faulted and the PCM disallows engagement. Also describes a lockout when the ACC_CONTROL->ACC_MALFUNCTION bit is set."; CM_ SG_ 865 ACC_FAULTED "1 when ACC is faulted and the PCM disallows engagement. Also describes a lockout when the ACC_CONTROL->ACC_MALFUNCTION bit is set.";
CM_ SG_ 921 UI_SET_SPEED "set speed shown in the vehicle's UI with the vehicle's unit"; CM_ SG_ 921 UI_SET_SPEED "set speed shown in the vehicle's UI with the vehicle's unit";
CM_ SG_ 921 TEMP_ACC_FAULTED "1 when the UI is displaying or playing fault-related alerts or sounds. Also 1 when pressing main on."; CM_ SG_ 921 TEMP_ACC_FAULTED "1 when the UI is displaying or playing fault-related alerts or sounds. Also 1 when pressing main on.";
@@ -512,4 +595,5 @@ VAL_ 1552 METER_SLIDER_DIMMED 1 "Dimmed" 0 "Not Dimmed";
VAL_ 1552 UNITS 1 "km (km/L)" 2 "km (L/100km)" 3 "miles (MPG US)" 4 "miles (MPG Imperial)"; VAL_ 1552 UNITS 1 "km (km/L)" 2 "km (L/100km)" 3 "miles (MPG US)" 4 "miles (MPG Imperial)";
VAL_ 1553 UNITS 1 "km" 2 "miles"; VAL_ 1553 UNITS 1 "km" 2 "miles";
VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left"; VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left";
VAL_ 1556 BLINKER_BUTTON_PRESSED 1 "button pressed" 0 "not pressed";
VAL_ 1592 LOCK_STATUS 0 "locked" 1 "unlocked"; VAL_ 1592 LOCK_STATUS 0 "locked" 1 "unlocked";
+1 -1
View File
@@ -222,7 +222,7 @@ BO_ 715 ASCMGasRegenCmd: 8 K124_ASCM
SG_ GasRegenCmdActive : 0|1@0+ (1,0) [0|0] "" NEO SG_ GasRegenCmdActive : 0|1@0+ (1,0) [0|0] "" NEO
SG_ RollingCounter : 7|2@0+ (1,0) [0|0] "" NEO SG_ RollingCounter : 7|2@0+ (1,0) [0|0] "" NEO
SG_ GasRegenAlwaysOne3 : 23|1@0+ (1,0) [0|1] "" NEO SG_ GasRegenAlwaysOne3 : 23|1@0+ (1,0) [0|1] "" NEO
SG_ GasRegenCmd : 22|12@0+ (1,0) [0|0] "" NEO SG_ GasRegenCmd : 8|14@0+ (1,0) [0|0] "" NEO
BO_ 717 ASCM_2CD: 5 K124_ASCM BO_ 717 ASCM_2CD: 5 K124_ASCM
+3
View File
@@ -188,6 +188,9 @@ BO_ 497 BCMGeneralPlatformStatus: 8 K9_BCM
SG_ SystemBackUpPowerMode : 5|2@0+ (1,0) [0|3] "" XXX SG_ SystemBackUpPowerMode : 5|2@0+ (1,0) [0|3] "" XXX
SG_ ParkBrakeSwActive : 36|1@0+ (1,0) [0|3] "" XXX SG_ ParkBrakeSwActive : 36|1@0+ (1,0) [0|3] "" XXX
BO_ 500 SportMode: 6 XXX
SG_ SportMode : 15|1@0+ (1,0) [0|1] "" XXX
BO_ 501 ECMPRDNL2: 8 K20_ECM BO_ 501 ECMPRDNL2: 8 K20_ECM
SG_ TransmissionState : 48|4@1+ (1,0) [0|7] "" NEO SG_ TransmissionState : 48|4@1+ (1,0) [0|7] "" NEO
SG_ PRNDL2 : 27|4@0+ (1,0) [0|255] "" NEO SG_ PRNDL2 : 27|4@0+ (1,0) [0|255] "" NEO
+1 -1
View File
@@ -316,7 +316,7 @@ BO_ 441 CAM_0x1b9: 32 CAMERA
BO_ 463 CRUISE_BUTTONS: 8 XXX BO_ 463 CRUISE_BUTTONS: 8 XXX
SG_ _CHECKSUM : 0|8@1+ (1,0) [0|65535] "" XXX SG_ _CHECKSUM : 0|8@1+ (1,0) [0|65535] "" XXX
SG_ LKAS_BTN : 23|1@1+ (1,0) [0|1] "" XXX SG_ LFA_BTN : 23|1@1+ (1,0) [0|1] "" XXX
SG_ SET_ME_1 : 29|1@1+ (1,0) [0|1] "" XXX SG_ SET_ME_1 : 29|1@1+ (1,0) [0|1] "" XXX
SG_ ADAPTIVE_CRUISE_MAIN_BTN : 19|1@1+ (1,0) [0|1] "" XXX SG_ ADAPTIVE_CRUISE_MAIN_BTN : 19|1@1+ (1,0) [0|1] "" XXX
SG_ NORMAL_CRUISE_MAIN_BTN : 21|1@1+ (1,0) [0|1] "" XXX SG_ NORMAL_CRUISE_MAIN_BTN : 21|1@1+ (1,0) [0|1] "" XXX
+2 -2
View File
@@ -1654,8 +1654,8 @@ CM_ SG_ 1348 SpeedLim_Nav_Clu "Speed limit displayed on Nav, Cluster and HUD";
VAL_ 274 CUR_GR 1 "D" 2 "D" 3 "D" 4 "D" 5 "D" 6 "D" 7 "D" 8 "D" 14 "R" 0 "P"; VAL_ 274 CUR_GR 1 "D" 2 "D" 3 "D" 4 "D" 5 "D" 6 "D" 7 "D" 8 "D" 14 "R" 0 "P";
VAL_ 871 CF_Lvr_IsgState 0 "enabled" 1 "activated" 2 "unknown" 3 "disabled"; VAL_ 871 CF_Lvr_IsgState 0 "enabled" 1 "activated" 2 "unknown" 3 "disabled";
VAL_ 871 CF_Lvr_Gear 12 "T" 5 "D" 8 "S" 6 "N" 7 "R" 0 "P"; VAL_ 871 CF_Lvr_Gear 12 "T" 5 "D" 8 "S" 6 "N" 7 "R" 4 "S" 0 "P";
VAL_ 882 Elect_Gear_Shifter 5 "D" 8 "S" 6 "N" 7 "R" 0 "P"; VAL_ 882 Elect_Gear_Shifter 5 "D" 8 "S" 6 "N" 7 "R" 4 "S" 0 "P";
VAL_ 905 ACCMode 0 "off" 1 "enabled" 2 "driver_override" 3 "off_maybe_fault" 4 "cancelled"; VAL_ 905 ACCMode 0 "off" 1 "enabled" 2 "driver_override" 3 "off_maybe_fault" 4 "cancelled";
VAL_ 909 CF_VSM_Warn 2 "FCW" 3 "AEB"; VAL_ 909 CF_VSM_Warn 2 "FCW" 3 "AEB";
VAL_ 916 ACCEnable 0 "SCC ready" 1 "SCC temp fault" 2 "SCC permanent fault" 3 "SCC permanent fault, communication issue"; VAL_ 916 ACCEnable 0 "SCC ready" 1 "SCC temp fault" 2 "SCC permanent fault" 3 "SCC permanent fault, communication issue";
+97 -9
View File
@@ -93,9 +93,24 @@ BO_ 37 STEER_ANGLE_SENSOR: 8 XXX
SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX
SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX
BO_ 119 ENG2F41: 6 CGW
SG_ FDRV : 7|16@0- (2,0) [0|0] "N" Vector__XXX
SG_ FDRVREAL : 23|13@0- (10,0) [0|0] "N" Vector__XXX
SG_ XAECT : 39|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ XFDRVCOL : 38|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ FDRVSELP : 34|3@0+ (1,0) [0|0] "" Vector__XXX
SG_ ENG2F41S : 47|8@0+ (1,0) [0|0] "" Vector__XXX
BO_ 120 ENG2F42: 4 CGW
SG_ FAVLMCHH : 7|16@0- (2,0) [0|0] "N" Vector__XX228X
SG_ CCRNG : 23|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ FDRVTYPD : 22|3@0+ (1,0) [0|0] "" Vector__XXX
SG_ GEARHD : 18|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ ENG2F42S : 31|8@0+ (1,0) [0|0] "" Vector__XXX
BO_ 166 BRAKE: 8 XXX BO_ 166 BRAKE: 8 XXX
SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX
SG_ BRAKE_PEDAL : 23|8@0+ (1,0) [0|255] "" XXX SG_ BRAKE_FORCE : 23|8@0+ (40,0) [0|10200] "N" XXX
BO_ 170 WHEEL_SPEEDS: 8 XXX BO_ 170 WHEEL_SPEEDS: 8 XXX
SG_ WHEEL_SPEED_FR : 7|16@0+ (0.01,-67.67) [0|250] "km/h" XXX SG_ WHEEL_SPEED_FR : 7|16@0+ (0.01,-67.67) [0|250] "km/h" XXX
@@ -109,8 +124,8 @@ BO_ 180 SPEED: 8 XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 295 GEAR_PACKET_HYBRID: 8 XXX BO_ 295 GEAR_PACKET_HYBRID: 8 XXX
SG_ CAR_MOVEMENT : 25|10@0- (1,0) [0|255] "" XXX SG_ FDRVREAL : 26|11@0- (25,0) [-25600|25575] "N" XXX
SG_ COUNTER : 55|8@0+ (1,0) [0|255] "" XXX SG_ UNKNOWN : 55|8@0+ (1,0) [0|255] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
SG_ GEAR : 47|4@0+ (1,0) [0|15] "" XXX SG_ GEAR : 47|4@0+ (1,0) [0|15] "" XXX
@@ -119,6 +134,7 @@ BO_ 353 DSU_SPEED: 7 XXX
BO_ 452 ENGINE_RPM: 8 CGW BO_ 452 ENGINE_RPM: 8 CGW
SG_ RPM : 7|16@0- (0.78125,0) [0|0] "rpm" SCS SG_ RPM : 7|16@0- (0.78125,0) [0|0] "rpm" SCS
SG_ ENGINE_RUNNING : 27|1@0+ (1,0) [0|1] "" XXX
BO_ 466 PCM_CRUISE: 8 XXX BO_ 466 PCM_CRUISE: 8 XXX
SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX
@@ -139,9 +155,10 @@ BO_ 467 PCM_CRUISE_2: 8 XXX
SG_ ACC_FAULTED : 47|1@0+ (1,0) [0|1] "" XXX SG_ ACC_FAULTED : 47|1@0+ (1,0) [0|1] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 552 ACCELEROMETER: 8 XXX BO_ 552 VSC1S29: 4 CGW
SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "m/s^2" XXX SG_ ICBACT : 7|1@0+ (1,0) [0|0] "" DS1
SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s^2" XXX SG_ DVS0PCS : 6|15@0- (0.001,0) [0|0] "m/s^2" DS1
SG_ SM228 : 31|8@0+ (1,0) [0|0] "" DS1
BO_ 560 BRAKE_2: 7 XXX BO_ 560 BRAKE_2: 7 XXX
SG_ BRAKE_PRESSED : 26|1@0+ (1,0) [0|1] "" XXX SG_ BRAKE_PRESSED : 26|1@0+ (1,0) [0|1] "" XXX
@@ -180,7 +197,11 @@ BO_ 643 PRE_COLLISION: 7 DSU
BO_ 705 GAS_PEDAL: 8 XXX BO_ 705 GAS_PEDAL: 8 XXX
SG_ GAS_RELEASED : 3|1@0+ (1,0) [0|1] "" XXX SG_ GAS_RELEASED : 3|1@0+ (1,0) [0|1] "" XXX
SG_ GAS_PEDAL : 55|8@0+ (0.005,0) [0|1] "" XXX SG_ ETQLVSC : 15|16@0- (0.03125,0) [0|0] "Nm" XXX
SG_ ETQREAL : 31|16@0- (0.03125,0) [0|0] "Nm" SCS
SG_ ETQISC : 47|8@0+ (1,-192) [0|0] "Nm" XXX
SG_ GAS_PEDAL : 55|8@0+ (0.5,0) [0|0] "%" DS1,FCM
SG_ CHECKSUM : 63|8@0+ (1,0) [0|0] "" DS1,FCM
BO_ 740 STEERING_LKA: 5 XXX BO_ 740 STEERING_LKA: 5 XXX
SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX
@@ -195,6 +216,31 @@ BO_ 742 LEAD_INFO: 8 DSU
SG_ LEAD_REL_SPEED : 23|12@0- (0.025,0) [-100|100] "m/s" HCU SG_ LEAD_REL_SPEED : 23|12@0- (0.025,0) [-100|100] "m/s" HCU
SG_ LEAD_LONG_DIST : 7|13@0+ (0.05,0) [0|300] "m" HCU SG_ LEAD_LONG_DIST : 7|13@0+ (0.05,0) [0|300] "m" HCU
BO_ 800 VSC1S07: 8 CGW
SG_ FBKRLY : 6|1@0+ (1,0) [0|0] "" DS1
SG_ FVSCM : 4|1@0+ (1,0) [0|0] "" DS1
SG_ FVSCSFT : 3|1@0+ (1,0) [0|0] "" DS1
SG_ FABS : 2|1@0+ (1,0) [0|0] "" DS1,FCM
SG_ TSVSC : 1|1@0+ (1,0) [0|0] "" DS1
SG_ FVSCL : 0|1@0+ (1,0) [0|0] "" DS1
SG_ RQCSTBKB : 15|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ PSBSTBY : 14|1@0+ (1,0) [0|0] "" DS1
SG_ P2BRXMK : 13|1@0+ (1,0) [0|0] "" DS1
SG_ MCC : 11|1@0+ (1,0) [0|0] "" DS1
SG_ RQBKB : 10|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ BRSTOP : 9|1@0+ (1,0) [0|0] "" DS1,FCM
SG_ BRKON : 8|1@0+ (1,0) [0|0] "" DS1,FCM
SG_ ASLP : 23|8@0- (1,0) [0|0] "deg" DS1
SG_ BRTYPACC : 31|2@0+ (1,0) [0|0] "" DS1
SG_ BRKABT3 : 26|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ BRKABT2 : 25|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ BRKABT1 : 24|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ GVC : 39|8@0- (0.04,0) [0|0] "m/s^2" DS1
SG_ XGVCINV : 43|1@0+ (1,0) [0|0] "" DS1
SG_ S07CNT : 52|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ PCSBRSTA : 50|2@0+ (1,0) [0|0] "" DS1
SG_ VSC07SUM : 63|8@0+ (1,0) [0|0] "" DS1,FCM
BO_ 835 ACC_CONTROL: 8 DSU BO_ 835 ACC_CONTROL: 8 DSU
SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s^2" HCU SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s^2" HCU
SG_ ALLOW_LONG_PRESS : 17|2@0+ (1,0) [0|2] "" XXX SG_ ALLOW_LONG_PRESS : 17|2@0+ (1,0) [0|2] "" XXX
@@ -213,12 +259,19 @@ BO_ 835 ACC_CONTROL: 8 DSU
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 836 PRE_COLLISION_2: 8 DSU BO_ 836 PRE_COLLISION_2: 8 DSU
SG_ DSS1GDRV : 7|10@0- (0.1,0) [0|0] "m/s^2" Vector__XXX
SG_ PCSALM : 17|1@0+ (1,0) [0|0] "" FCM
SG_ IBTRGR : 27|1@0+ (1,0) [0|0] "" FCM
SG_ PBATRGR : 30|2@0+ (1,0) [0|0] "" Vector__XXX
SG_ PREFILL : 33|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ AVSTRGR : 36|1@0+ (1,0) [0|0] "" SCS
SG_ CHECKSUM : 63|8@0+ (1,0) [0|0] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|0] "" XXX
BO_ 865 CLUTCH: 8 XXX BO_ 865 CLUTCH: 8 XXX
SG_ ACC_FAULTED : 32|1@0+ (1,0) [0|1] "" XXX SG_ ACC_FAULTED : 32|1@0+ (1,0) [0|1] "" XXX
SG_ GAS_PEDAL_ALT : 23|8@0+ (0.005,0) [0|1] "" XXX SG_ GAS_PEDAL_ALT : 23|8@0+ (0.005,0) [0|1] "" XXX
SG_ CLUTCH_RELEASED : 38|1@0+ (1,0) [0|1] "" XXX SG_ CLUTCH_RELEASED : 38|1@0+ (1,0) [0|1] "" XXX
SG_ ACCEL_NET : 48|16@1+ (0.0002,-6.5536) [-6.5536|6.5534] "" XXX
BO_ 869 DSU_CRUISE : 7 DSU BO_ 869 DSU_CRUISE : 7 DSU
SG_ RES_BTN : 3|1@0+ (1,0) [0|0] "" XXX SG_ RES_BTN : 3|1@0+ (1,0) [0|0] "" XXX
@@ -320,6 +373,18 @@ BO_ 1044 AUTO_HIGH_BEAM: 8 FCM
SG_ F_AHB : 55|4@0+ (1,0) [0|0] "" Vector__XXX SG_ F_AHB : 55|4@0+ (1,0) [0|0] "" Vector__XXX
SG_ C_AHB : 51|4@0+ (1,0) [0|0] "" Vector__XXX SG_ C_AHB : 51|4@0+ (1,0) [0|0] "" Vector__XXX
BO_ 1056 VSC1S08: 8 CGW
SG_ YR1Z : 7|16@0- (1,0) [0|0] "rad/s" DS1,FCM,MAV
SG_ YR2Z : 23|16@0- (1,0) [0|0] "rad/s" DS1,FCM,MAV
SG_ GL1Z : 39|8@0- (0.0359,0) [0|0] "m/s^2" DS1,FCM,KSS,MAV,SCS
SG_ GL2Z : 47|8@0- (0.0359,0) [0|0] "m/s^2" DS1,FCM,KSS,MAV,SCS
SG_ YRGSDIR : 55|1@0+ (1,0) [0|0] "" DS1,FCM,KSS,SCS
SG_ GLZS : 51|1@0+ (1,0) [0|0] "" DS1,FCM,KSS,MAV,SCS
SG_ YRZF : 50|1@0+ (1,0) [0|0] "" DS1,FCM,MAV
SG_ YRZS : 49|1@0+ (1,0) [0|0] "" DS1,FCM,MAV
SG_ YRZKS : 48|1@0+ (1,0) [0|0] "" DS1,FCM,MAV
SG_ VSC08SUM : 63|8@0+ (1,0) [0|0] "" DS1,FCM,MAV
BO_ 1083 AUTOPARK_STATUS: 8 IPAS BO_ 1083 AUTOPARK_STATUS: 8 IPAS
SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX
@@ -398,9 +463,11 @@ BO_ 1552 BODY_CONTROL_STATE_2: 8 XXX
BO_ 1553 UI_SETTING: 8 XXX BO_ 1553 UI_SETTING: 8 XXX
SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX
SG_ ODOMETER : 39|32@0+ (1,0) [0|1048575] "" XXX SG_ ODOMETER : 39|32@0+ (1,0) [0|1048575] "" XXX
BO_ 1556 BLINKERS_STATE: 8 XXX BO_ 1556 BLINKERS_STATE: 8 XXX
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX SG_ BLINKER_BUTTON_PRESSED : 15|1@0+ (1,0) [0|1] "" XXX
SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
BO_ 1568 BODY_CONTROL_STATE: 8 XXX BO_ 1568 BODY_CONTROL_STATE: 8 XXX
SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" XXX SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" XXX
@@ -429,13 +496,30 @@ BO_ 1592 DOOR_LOCKS: 8 XXX
SG_ LOCK_STATUS : 20|1@0+ (1,0) [0|1] "" XXX SG_ LOCK_STATUS : 20|1@0+ (1,0) [0|1] "" XXX
SG_ LOCKED_VIA_KEYFOB : 23|1@0+ (1,0) [0|1] "" XXX SG_ LOCKED_VIA_KEYFOB : 23|1@0+ (1,0) [0|1] "" XXX
BO_ 1779 ADAS_TOGGLE_STATE: 8 XXX
SG_ OK_BUTTON_PRESSED : 15|1@0+ (1,0) [0|1] "" BCM
SG_ SWS_TOGGLE_CMD : 24|1@0+ (1,0) [0|1] "" XXX
SG_ SWS_SENSITIVITY_CMD : 26|2@0+ (1,0) [0|3] "" XXX
SG_ LKAS_ON_CMD : 28|1@0+ (1,0) [0|1] "" XXX
SG_ LKAS_OFF_CMD : 29|1@0+ (1,0) [0|1] "" XXX
SG_ LDA_SENSITIVITY_HI_CMD : 30|1@0+ (1,0) [0|1] "" XXX
SG_ LDA_SENSITIVITY_STD_CMD : 31|1@0+ (1,0) [0|1] "" XXX
SG_ IPAS_TOGGLE : 34|1@0+ (1,0) [0|1] "" XXX
SG_ BSM_TOGGLE_CMD : 37|1@0+ (1,0) [0|1] "" XXX
SG_ IPAS_SONAR_TOGGLE : 38|1@0+ (1,0) [0|1] "" XXX
SG_ PCS_TOGGLE_CMD : 40|1@0+ (1,0) [0|1] "" XXX
SG_ PCS_SENSITIVITY_CMD : 41|1@0+ (1,0) [0|1] "" XXX
CM_ SG_ 36 YAW_RATE "verify"; CM_ SG_ 36 YAW_RATE "verify";
CM_ SG_ 36 ACCEL_X "x-axis accel"; CM_ SG_ 36 ACCEL_X "x-axis accel";
CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set";
CM_ SG_ 37 STEER_RATE "factor is tbd"; CM_ SG_ 37 STEER_RATE "factor is tbd";
CM_ SG_ 119 FDRVREAL "ICE only: force applied by wheels from the engine. includes creeping force, regen, and engine braking";
CM_ SG_ 166 BRAKE_FORCE "hybrid only: force applied by friction brakes from user or ACC command";
CM_ SG_ 295 FDRVREAL "hybrid only: force applied by wheels from the engine and/or electric motors. includes creeping force, regen, and engine braking";
CM_ SG_ 466 NEUTRAL_FORCE "force in newtons the engine/electric motors are applying without any acceleration commands or user input"; CM_ SG_ 466 NEUTRAL_FORCE "force in newtons the engine/electric motors are applying without any acceleration commands or user input";
CM_ SG_ 466 ACC_BRAKING "whether brakes are being actuated from ACC command"; CM_ SG_ 466 ACC_BRAKING "whether brakes are being actuated from ACC command";
CM_ SG_ 466 ACCEL_NET "net acceleration produced by the system, given ACCEL_CMD, road grade and other factors"; CM_ SG_ 466 ACCEL_NET "net negative acceleration (braking) applied by the system if on flat ground";
CM_ SG_ 466 CRUISE_STATE "Active state is 8, if standstill is requested will switch to state 11(3 sec timer), after timer is elapsed will switch into state 7(standstill). If plus button was pressed - status 9, minus button pressed - status 10"; CM_ SG_ 466 CRUISE_STATE "Active state is 8, if standstill is requested will switch to state 11(3 sec timer), after timer is elapsed will switch into state 7(standstill). If plus button was pressed - status 9, minus button pressed - status 10";
CM_ SG_ 467 ACC_FAULTED "1 when ACC is faulted and the PCM disallows engagement"; CM_ SG_ 467 ACC_FAULTED "1 when ACC is faulted and the PCM disallows engagement";
CM_ SG_ 467 SET_SPEED "43 km/h are shown as 28 mph, so conversion isn't perfect"; CM_ SG_ 467 SET_SPEED "43 km/h are shown as 28 mph, so conversion isn't perfect";
@@ -448,6 +532,8 @@ CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active";
CM_ SG_ 643 _COUNTER "only used on cars that use this msg for cruise control"; CM_ SG_ 643 _COUNTER "only used on cars that use this msg for cruise control";
CM_ SG_ 643 BRAKE_STATUS "only used on cars that use this msg for cruise control"; CM_ SG_ 643 BRAKE_STATUS "only used on cars that use this msg for cruise control";
CM_ SG_ 643 PRECOLLISION_ACTIVE "set 0.5s before any braking"; CM_ SG_ 643 PRECOLLISION_ACTIVE "set 0.5s before any braking";
CM_ SG_ 800 SLOPE_ANGLE "potentially used by the PCM to compensate for road pitch";
CM_ SG_ 800 ACCEL "filtered ego acceleration";
CM_ SG_ 835 ACC_TYPE "if 2, car is likely to have a permanent low speed lockout. 1 is ok"; CM_ SG_ 835 ACC_TYPE "if 2, car is likely to have a permanent low speed lockout. 1 is ok";
CM_ SG_ 835 RADAR_DIRTY "Display Clean Radar Sensor message on HUD"; CM_ SG_ 835 RADAR_DIRTY "Display Clean Radar Sensor message on HUD";
CM_ SG_ 835 ACC_MALFUNCTION "display ACC fault on dash if set to 1"; CM_ SG_ 835 ACC_MALFUNCTION "display ACC fault on dash if set to 1";
@@ -460,6 +546,7 @@ CM_ SG_ 835 PERMIT_BRAKING "Original ACC has this going high when a car in front
CM_ SG_ 835 ACCEL_CMD_ALT "Copy of main ACCEL_CMD, but across 8 bits instead of 16 bits like ACCEL_CMD. Unsure if only informational or has an effect. Likely informational as existing openpilot sets this to 0 and no loss of functionality observed. Originally 'AT_RAW' in leaked toyota_2017_ref_pt.dbc file."; CM_ SG_ 835 ACCEL_CMD_ALT "Copy of main ACCEL_CMD, but across 8 bits instead of 16 bits like ACCEL_CMD. Unsure if only informational or has an effect. Likely informational as existing openpilot sets this to 0 and no loss of functionality observed. Originally 'AT_RAW' in leaked toyota_2017_ref_pt.dbc file.";
CM_ SG_ 865 GAS_PEDAL_ALT "copy of main GAS_PEDAL. Both use 8 bits. Might indicate that this message is for pedals."; CM_ SG_ 865 GAS_PEDAL_ALT "copy of main GAS_PEDAL. Both use 8 bits. Might indicate that this message is for pedals.";
CM_ SG_ 865 CLUTCH_RELEASED "boolean of clutch for 6MT."; CM_ SG_ 865 CLUTCH_RELEASED "boolean of clutch for 6MT.";
CM_ SG_ 865 ACCEL_NET "net positive acceleration (gas) applied by the system if on flat ground, may not include creeping force";
CM_ SG_ 865 ACC_FAULTED "1 when ACC is faulted and the PCM disallows engagement. Also describes a lockout when the ACC_CONTROL->ACC_MALFUNCTION bit is set."; CM_ SG_ 865 ACC_FAULTED "1 when ACC is faulted and the PCM disallows engagement. Also describes a lockout when the ACC_CONTROL->ACC_MALFUNCTION bit is set.";
CM_ SG_ 921 UI_SET_SPEED "set speed shown in the vehicle's UI with the vehicle's unit"; CM_ SG_ 921 UI_SET_SPEED "set speed shown in the vehicle's UI with the vehicle's unit";
CM_ SG_ 921 TEMP_ACC_FAULTED "1 when the UI is displaying or playing fault-related alerts or sounds. Also 1 when pressing main on."; CM_ SG_ 921 TEMP_ACC_FAULTED "1 when the UI is displaying or playing fault-related alerts or sounds. Also 1 when pressing main on.";
@@ -560,6 +647,7 @@ VAL_ 1552 METER_SLIDER_DIMMED 1 "Dimmed" 0 "Not Dimmed";
VAL_ 1552 UNITS 1 "km (km/L)" 2 "km (L/100km)" 3 "miles (MPG US)" 4 "miles (MPG Imperial)"; VAL_ 1552 UNITS 1 "km (km/L)" 2 "km (L/100km)" 3 "miles (MPG US)" 4 "miles (MPG Imperial)";
VAL_ 1553 UNITS 1 "km" 2 "miles"; VAL_ 1553 UNITS 1 "km" 2 "miles";
VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left"; VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left";
VAL_ 1556 BLINKER_BUTTON_PRESSED 1 "button pressed" 0 "not pressed";
VAL_ 1592 LOCK_STATUS 0 "locked" 1 "unlocked"; VAL_ 1592 LOCK_STATUS 0 "locked" 1 "unlocked";
CM_ "toyota_new_mc_pt.dbc starts here"; CM_ "toyota_new_mc_pt.dbc starts here";
+99 -9
View File
@@ -93,9 +93,24 @@ BO_ 37 STEER_ANGLE_SENSOR: 8 XXX
SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX
SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX
BO_ 119 ENG2F41: 6 CGW
SG_ FDRV : 7|16@0- (2,0) [0|0] "N" Vector__XXX
SG_ FDRVREAL : 23|13@0- (10,0) [0|0] "N" Vector__XXX
SG_ XAECT : 39|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ XFDRVCOL : 38|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ FDRVSELP : 34|3@0+ (1,0) [0|0] "" Vector__XXX
SG_ ENG2F41S : 47|8@0+ (1,0) [0|0] "" Vector__XXX
BO_ 120 ENG2F42: 4 CGW
SG_ FAVLMCHH : 7|16@0- (2,0) [0|0] "N" Vector__XX228X
SG_ CCRNG : 23|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ FDRVTYPD : 22|3@0+ (1,0) [0|0] "" Vector__XXX
SG_ GEARHD : 18|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ ENG2F42S : 31|8@0+ (1,0) [0|0] "" Vector__XXX
BO_ 166 BRAKE: 8 XXX BO_ 166 BRAKE: 8 XXX
SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX
SG_ BRAKE_PEDAL : 23|8@0+ (1,0) [0|255] "" XXX SG_ BRAKE_FORCE : 23|8@0+ (40,0) [0|10200] "N" XXX
BO_ 170 WHEEL_SPEEDS: 8 XXX BO_ 170 WHEEL_SPEEDS: 8 XXX
SG_ WHEEL_SPEED_FR : 7|16@0+ (0.01,-67.67) [0|250] "km/h" XXX SG_ WHEEL_SPEED_FR : 7|16@0+ (0.01,-67.67) [0|250] "km/h" XXX
@@ -109,8 +124,8 @@ BO_ 180 SPEED: 8 XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 295 GEAR_PACKET_HYBRID: 8 XXX BO_ 295 GEAR_PACKET_HYBRID: 8 XXX
SG_ CAR_MOVEMENT : 25|10@0- (1,0) [0|255] "" XXX SG_ FDRVREAL : 26|11@0- (25,0) [-25600|25575] "N" XXX
SG_ COUNTER : 55|8@0+ (1,0) [0|255] "" XXX SG_ UNKNOWN : 55|8@0+ (1,0) [0|255] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
SG_ GEAR : 47|4@0+ (1,0) [0|15] "" XXX SG_ GEAR : 47|4@0+ (1,0) [0|15] "" XXX
@@ -119,6 +134,7 @@ BO_ 353 DSU_SPEED: 7 XXX
BO_ 452 ENGINE_RPM: 8 CGW BO_ 452 ENGINE_RPM: 8 CGW
SG_ RPM : 7|16@0- (0.78125,0) [0|0] "rpm" SCS SG_ RPM : 7|16@0- (0.78125,0) [0|0] "rpm" SCS
SG_ ENGINE_RUNNING : 27|1@0+ (1,0) [0|1] "" XXX
BO_ 466 PCM_CRUISE: 8 XXX BO_ 466 PCM_CRUISE: 8 XXX
SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX
@@ -139,9 +155,10 @@ BO_ 467 PCM_CRUISE_2: 8 XXX
SG_ ACC_FAULTED : 47|1@0+ (1,0) [0|1] "" XXX SG_ ACC_FAULTED : 47|1@0+ (1,0) [0|1] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 552 ACCELEROMETER: 8 XXX BO_ 552 VSC1S29: 4 CGW
SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "m/s^2" XXX SG_ ICBACT : 7|1@0+ (1,0) [0|0] "" DS1
SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s^2" XXX SG_ DVS0PCS : 6|15@0- (0.001,0) [0|0] "m/s^2" DS1
SG_ SM228 : 31|8@0+ (1,0) [0|0] "" DS1
BO_ 560 BRAKE_2: 7 XXX BO_ 560 BRAKE_2: 7 XXX
SG_ BRAKE_PRESSED : 26|1@0+ (1,0) [0|1] "" XXX SG_ BRAKE_PRESSED : 26|1@0+ (1,0) [0|1] "" XXX
@@ -180,7 +197,11 @@ BO_ 643 PRE_COLLISION: 7 DSU
BO_ 705 GAS_PEDAL: 8 XXX BO_ 705 GAS_PEDAL: 8 XXX
SG_ GAS_RELEASED : 3|1@0+ (1,0) [0|1] "" XXX SG_ GAS_RELEASED : 3|1@0+ (1,0) [0|1] "" XXX
SG_ GAS_PEDAL : 55|8@0+ (0.005,0) [0|1] "" XXX SG_ ETQLVSC : 15|16@0- (0.03125,0) [0|0] "Nm" XXX
SG_ ETQREAL : 31|16@0- (0.03125,0) [0|0] "Nm" SCS
SG_ ETQISC : 47|8@0+ (1,-192) [0|0] "Nm" XXX
SG_ GAS_PEDAL : 55|8@0+ (0.5,0) [0|0] "%" DS1,FCM
SG_ CHECKSUM : 63|8@0+ (1,0) [0|0] "" DS1,FCM
BO_ 740 STEERING_LKA: 5 XXX BO_ 740 STEERING_LKA: 5 XXX
SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX
@@ -195,6 +216,31 @@ BO_ 742 LEAD_INFO: 8 DSU
SG_ LEAD_REL_SPEED : 23|12@0- (0.025,0) [-100|100] "m/s" HCU SG_ LEAD_REL_SPEED : 23|12@0- (0.025,0) [-100|100] "m/s" HCU
SG_ LEAD_LONG_DIST : 7|13@0+ (0.05,0) [0|300] "m" HCU SG_ LEAD_LONG_DIST : 7|13@0+ (0.05,0) [0|300] "m" HCU
BO_ 800 VSC1S07: 8 CGW
SG_ FBKRLY : 6|1@0+ (1,0) [0|0] "" DS1
SG_ FVSCM : 4|1@0+ (1,0) [0|0] "" DS1
SG_ FVSCSFT : 3|1@0+ (1,0) [0|0] "" DS1
SG_ FABS : 2|1@0+ (1,0) [0|0] "" DS1,FCM
SG_ TSVSC : 1|1@0+ (1,0) [0|0] "" DS1
SG_ FVSCL : 0|1@0+ (1,0) [0|0] "" DS1
SG_ RQCSTBKB : 15|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ PSBSTBY : 14|1@0+ (1,0) [0|0] "" DS1
SG_ P2BRXMK : 13|1@0+ (1,0) [0|0] "" DS1
SG_ MCC : 11|1@0+ (1,0) [0|0] "" DS1
SG_ RQBKB : 10|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ BRSTOP : 9|1@0+ (1,0) [0|0] "" DS1,FCM
SG_ BRKON : 8|1@0+ (1,0) [0|0] "" DS1,FCM
SG_ ASLP : 23|8@0- (1,0) [0|0] "deg" DS1
SG_ BRTYPACC : 31|2@0+ (1,0) [0|0] "" DS1
SG_ BRKABT3 : 26|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ BRKABT2 : 25|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ BRKABT1 : 24|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ GVC : 39|8@0- (0.04,0) [0|0] "m/s^2" DS1
SG_ XGVCINV : 43|1@0+ (1,0) [0|0] "" DS1
SG_ S07CNT : 52|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ PCSBRSTA : 50|2@0+ (1,0) [0|0] "" DS1
SG_ VSC07SUM : 63|8@0+ (1,0) [0|0] "" DS1,FCM
BO_ 835 ACC_CONTROL: 8 DSU BO_ 835 ACC_CONTROL: 8 DSU
SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s^2" HCU SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s^2" HCU
SG_ ALLOW_LONG_PRESS : 17|2@0+ (1,0) [0|2] "" XXX SG_ ALLOW_LONG_PRESS : 17|2@0+ (1,0) [0|2] "" XXX
@@ -213,12 +259,19 @@ BO_ 835 ACC_CONTROL: 8 DSU
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 836 PRE_COLLISION_2: 8 DSU BO_ 836 PRE_COLLISION_2: 8 DSU
SG_ DSS1GDRV : 7|10@0- (0.1,0) [0|0] "m/s^2" Vector__XXX
SG_ PCSALM : 17|1@0+ (1,0) [0|0] "" FCM
SG_ IBTRGR : 27|1@0+ (1,0) [0|0] "" FCM
SG_ PBATRGR : 30|2@0+ (1,0) [0|0] "" Vector__XXX
SG_ PREFILL : 33|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ AVSTRGR : 36|1@0+ (1,0) [0|0] "" SCS
SG_ CHECKSUM : 63|8@0+ (1,0) [0|0] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|0] "" XXX
BO_ 865 CLUTCH: 8 XXX BO_ 865 CLUTCH: 8 XXX
SG_ ACC_FAULTED : 32|1@0+ (1,0) [0|1] "" XXX SG_ ACC_FAULTED : 32|1@0+ (1,0) [0|1] "" XXX
SG_ GAS_PEDAL_ALT : 23|8@0+ (0.005,0) [0|1] "" XXX SG_ GAS_PEDAL_ALT : 23|8@0+ (0.005,0) [0|1] "" XXX
SG_ CLUTCH_RELEASED : 38|1@0+ (1,0) [0|1] "" XXX SG_ CLUTCH_RELEASED : 38|1@0+ (1,0) [0|1] "" XXX
SG_ ACCEL_NET : 48|16@1+ (0.0002,-6.5536) [-6.5536|6.5534] "" XXX
BO_ 869 DSU_CRUISE : 7 DSU BO_ 869 DSU_CRUISE : 7 DSU
SG_ RES_BTN : 3|1@0+ (1,0) [0|0] "" XXX SG_ RES_BTN : 3|1@0+ (1,0) [0|0] "" XXX
@@ -249,6 +302,7 @@ BO_ 956 GEAR_PACKET: 8 XXX
SG_ SPORT_GEAR_ON : 33|1@0+ (1,0) [0|1] "" XXX SG_ SPORT_GEAR_ON : 33|1@0+ (1,0) [0|1] "" XXX
SG_ SPORT_GEAR : 38|3@0+ (1,0) [0|7] "" XXX SG_ SPORT_GEAR : 38|3@0+ (1,0) [0|7] "" XXX
SG_ ECON_ON : 40|1@0+ (1,0) [0|1] "" XXX SG_ ECON_ON : 40|1@0+ (1,0) [0|1] "" XXX
SG_ SPORT_ON_2 : 55|1@0+ (1,0) [0|1] "" XXX
SG_ B_GEAR_ENGAGED : 41|1@0+ (1,0) [0|1] "" XXX SG_ B_GEAR_ENGAGED : 41|1@0+ (1,0) [0|1] "" XXX
SG_ DRIVE_ENGAGED : 47|1@0+ (1,0) [0|1] "" XXX SG_ DRIVE_ENGAGED : 47|1@0+ (1,0) [0|1] "" XXX
@@ -320,6 +374,18 @@ BO_ 1044 AUTO_HIGH_BEAM: 8 FCM
SG_ F_AHB : 55|4@0+ (1,0) [0|0] "" Vector__XXX SG_ F_AHB : 55|4@0+ (1,0) [0|0] "" Vector__XXX
SG_ C_AHB : 51|4@0+ (1,0) [0|0] "" Vector__XXX SG_ C_AHB : 51|4@0+ (1,0) [0|0] "" Vector__XXX
BO_ 1056 VSC1S08: 8 CGW
SG_ YR1Z : 7|16@0- (1,0) [0|0] "rad/s" DS1,FCM,MAV
SG_ YR2Z : 23|16@0- (1,0) [0|0] "rad/s" DS1,FCM,MAV
SG_ GL1Z : 39|8@0- (0.0359,0) [0|0] "m/s^2" DS1,FCM,KSS,MAV,SCS
SG_ GL2Z : 47|8@0- (0.0359,0) [0|0] "m/s^2" DS1,FCM,KSS,MAV,SCS
SG_ YRGSDIR : 55|1@0+ (1,0) [0|0] "" DS1,FCM,KSS,SCS
SG_ GLZS : 51|1@0+ (1,0) [0|0] "" DS1,FCM,KSS,MAV,SCS
SG_ YRZF : 50|1@0+ (1,0) [0|0] "" DS1,FCM,MAV
SG_ YRZS : 49|1@0+ (1,0) [0|0] "" DS1,FCM,MAV
SG_ YRZKS : 48|1@0+ (1,0) [0|0] "" DS1,FCM,MAV
SG_ VSC08SUM : 63|8@0+ (1,0) [0|0] "" DS1,FCM,MAV
BO_ 1083 AUTOPARK_STATUS: 8 IPAS BO_ 1083 AUTOPARK_STATUS: 8 IPAS
SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX
@@ -398,9 +464,11 @@ BO_ 1552 BODY_CONTROL_STATE_2: 8 XXX
BO_ 1553 UI_SETTING: 8 XXX BO_ 1553 UI_SETTING: 8 XXX
SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX
SG_ ODOMETER : 39|32@0+ (1,0) [0|1048575] "" XXX SG_ ODOMETER : 39|32@0+ (1,0) [0|1048575] "" XXX
BO_ 1556 BLINKERS_STATE: 8 XXX BO_ 1556 BLINKERS_STATE: 8 XXX
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX SG_ BLINKER_BUTTON_PRESSED : 15|1@0+ (1,0) [0|1] "" XXX
SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
BO_ 1568 BODY_CONTROL_STATE: 8 XXX BO_ 1568 BODY_CONTROL_STATE: 8 XXX
SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" XXX SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" XXX
@@ -429,13 +497,30 @@ BO_ 1592 DOOR_LOCKS: 8 XXX
SG_ LOCK_STATUS : 20|1@0+ (1,0) [0|1] "" XXX SG_ LOCK_STATUS : 20|1@0+ (1,0) [0|1] "" XXX
SG_ LOCKED_VIA_KEYFOB : 23|1@0+ (1,0) [0|1] "" XXX SG_ LOCKED_VIA_KEYFOB : 23|1@0+ (1,0) [0|1] "" XXX
BO_ 1779 ADAS_TOGGLE_STATE: 8 XXX
SG_ OK_BUTTON_PRESSED : 15|1@0+ (1,0) [0|1] "" BCM
SG_ SWS_TOGGLE_CMD : 24|1@0+ (1,0) [0|1] "" XXX
SG_ SWS_SENSITIVITY_CMD : 26|2@0+ (1,0) [0|3] "" XXX
SG_ LKAS_ON_CMD : 28|1@0+ (1,0) [0|1] "" XXX
SG_ LKAS_OFF_CMD : 29|1@0+ (1,0) [0|1] "" XXX
SG_ LDA_SENSITIVITY_HI_CMD : 30|1@0+ (1,0) [0|1] "" XXX
SG_ LDA_SENSITIVITY_STD_CMD : 31|1@0+ (1,0) [0|1] "" XXX
SG_ IPAS_TOGGLE : 34|1@0+ (1,0) [0|1] "" XXX
SG_ BSM_TOGGLE_CMD : 37|1@0+ (1,0) [0|1] "" XXX
SG_ IPAS_SONAR_TOGGLE : 38|1@0+ (1,0) [0|1] "" XXX
SG_ PCS_TOGGLE_CMD : 40|1@0+ (1,0) [0|1] "" XXX
SG_ PCS_SENSITIVITY_CMD : 41|1@0+ (1,0) [0|1] "" XXX
CM_ SG_ 36 YAW_RATE "verify"; CM_ SG_ 36 YAW_RATE "verify";
CM_ SG_ 36 ACCEL_X "x-axis accel"; CM_ SG_ 36 ACCEL_X "x-axis accel";
CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set";
CM_ SG_ 37 STEER_RATE "factor is tbd"; CM_ SG_ 37 STEER_RATE "factor is tbd";
CM_ SG_ 119 FDRVREAL "ICE only: force applied by wheels from the engine. includes creeping force, regen, and engine braking";
CM_ SG_ 166 BRAKE_FORCE "hybrid only: force applied by friction brakes from user or ACC command";
CM_ SG_ 295 FDRVREAL "hybrid only: force applied by wheels from the engine and/or electric motors. includes creeping force, regen, and engine braking";
CM_ SG_ 466 NEUTRAL_FORCE "force in newtons the engine/electric motors are applying without any acceleration commands or user input"; CM_ SG_ 466 NEUTRAL_FORCE "force in newtons the engine/electric motors are applying without any acceleration commands or user input";
CM_ SG_ 466 ACC_BRAKING "whether brakes are being actuated from ACC command"; CM_ SG_ 466 ACC_BRAKING "whether brakes are being actuated from ACC command";
CM_ SG_ 466 ACCEL_NET "net acceleration produced by the system, given ACCEL_CMD, road grade and other factors"; CM_ SG_ 466 ACCEL_NET "net negative acceleration (braking) applied by the system if on flat ground";
CM_ SG_ 466 CRUISE_STATE "Active state is 8, if standstill is requested will switch to state 11(3 sec timer), after timer is elapsed will switch into state 7(standstill). If plus button was pressed - status 9, minus button pressed - status 10"; CM_ SG_ 466 CRUISE_STATE "Active state is 8, if standstill is requested will switch to state 11(3 sec timer), after timer is elapsed will switch into state 7(standstill). If plus button was pressed - status 9, minus button pressed - status 10";
CM_ SG_ 467 ACC_FAULTED "1 when ACC is faulted and the PCM disallows engagement"; CM_ SG_ 467 ACC_FAULTED "1 when ACC is faulted and the PCM disallows engagement";
CM_ SG_ 467 SET_SPEED "43 km/h are shown as 28 mph, so conversion isn't perfect"; CM_ SG_ 467 SET_SPEED "43 km/h are shown as 28 mph, so conversion isn't perfect";
@@ -448,6 +533,8 @@ CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active";
CM_ SG_ 643 _COUNTER "only used on cars that use this msg for cruise control"; CM_ SG_ 643 _COUNTER "only used on cars that use this msg for cruise control";
CM_ SG_ 643 BRAKE_STATUS "only used on cars that use this msg for cruise control"; CM_ SG_ 643 BRAKE_STATUS "only used on cars that use this msg for cruise control";
CM_ SG_ 643 PRECOLLISION_ACTIVE "set 0.5s before any braking"; CM_ SG_ 643 PRECOLLISION_ACTIVE "set 0.5s before any braking";
CM_ SG_ 800 SLOPE_ANGLE "potentially used by the PCM to compensate for road pitch";
CM_ SG_ 800 ACCEL "filtered ego acceleration";
CM_ SG_ 835 ACC_TYPE "if 2, car is likely to have a permanent low speed lockout. 1 is ok"; CM_ SG_ 835 ACC_TYPE "if 2, car is likely to have a permanent low speed lockout. 1 is ok";
CM_ SG_ 835 RADAR_DIRTY "Display Clean Radar Sensor message on HUD"; CM_ SG_ 835 RADAR_DIRTY "Display Clean Radar Sensor message on HUD";
CM_ SG_ 835 ACC_MALFUNCTION "display ACC fault on dash if set to 1"; CM_ SG_ 835 ACC_MALFUNCTION "display ACC fault on dash if set to 1";
@@ -460,6 +547,7 @@ CM_ SG_ 835 PERMIT_BRAKING "Original ACC has this going high when a car in front
CM_ SG_ 835 ACCEL_CMD_ALT "Copy of main ACCEL_CMD, but across 8 bits instead of 16 bits like ACCEL_CMD. Unsure if only informational or has an effect. Likely informational as existing openpilot sets this to 0 and no loss of functionality observed. Originally 'AT_RAW' in leaked toyota_2017_ref_pt.dbc file."; CM_ SG_ 835 ACCEL_CMD_ALT "Copy of main ACCEL_CMD, but across 8 bits instead of 16 bits like ACCEL_CMD. Unsure if only informational or has an effect. Likely informational as existing openpilot sets this to 0 and no loss of functionality observed. Originally 'AT_RAW' in leaked toyota_2017_ref_pt.dbc file.";
CM_ SG_ 865 GAS_PEDAL_ALT "copy of main GAS_PEDAL. Both use 8 bits. Might indicate that this message is for pedals."; CM_ SG_ 865 GAS_PEDAL_ALT "copy of main GAS_PEDAL. Both use 8 bits. Might indicate that this message is for pedals.";
CM_ SG_ 865 CLUTCH_RELEASED "boolean of clutch for 6MT."; CM_ SG_ 865 CLUTCH_RELEASED "boolean of clutch for 6MT.";
CM_ SG_ 865 ACCEL_NET "net positive acceleration (gas) applied by the system if on flat ground, may not include creeping force";
CM_ SG_ 865 ACC_FAULTED "1 when ACC is faulted and the PCM disallows engagement. Also describes a lockout when the ACC_CONTROL->ACC_MALFUNCTION bit is set."; CM_ SG_ 865 ACC_FAULTED "1 when ACC is faulted and the PCM disallows engagement. Also describes a lockout when the ACC_CONTROL->ACC_MALFUNCTION bit is set.";
CM_ SG_ 921 UI_SET_SPEED "set speed shown in the vehicle's UI with the vehicle's unit"; CM_ SG_ 921 UI_SET_SPEED "set speed shown in the vehicle's UI with the vehicle's unit";
CM_ SG_ 921 TEMP_ACC_FAULTED "1 when the UI is displaying or playing fault-related alerts or sounds. Also 1 when pressing main on."; CM_ SG_ 921 TEMP_ACC_FAULTED "1 when the UI is displaying or playing fault-related alerts or sounds. Also 1 when pressing main on.";
@@ -531,6 +619,7 @@ VAL_ 956 GEAR 0 "D" 1 "S" 8 "N" 16 "R" 32 "P";
VAL_ 956 SPORT_GEAR_ON 0 "off" 1 "on"; VAL_ 956 SPORT_GEAR_ON 0 "off" 1 "on";
VAL_ 956 SPORT_GEAR 1 "S1" 2 "S2" 3 "S3" 4 "S4" 5 "S5" 6 "S6"; VAL_ 956 SPORT_GEAR 1 "S1" 2 "S2" 3 "S3" 4 "S4" 5 "S5" 6 "S6";
VAL_ 956 ECON_ON 0 "off" 1 "on"; VAL_ 956 ECON_ON 0 "off" 1 "on";
VAL_ 956 SPORT_ON_2 0 "off" 1 "on";
VAL_ 956 B_GEAR_ENGAGED 0 "off" 1 "on"; VAL_ 956 B_GEAR_ENGAGED 0 "off" 1 "on";
VAL_ 956 DRIVE_ENGAGED 0 "off" 1 "on"; VAL_ 956 DRIVE_ENGAGED 0 "off" 1 "on";
VAL_ 1005 REVERSE_CAMERA_GUIDELINES 3 "No guidelines" 2 "Static guidelines" 1 "Active guidelines"; VAL_ 1005 REVERSE_CAMERA_GUIDELINES 3 "No guidelines" 2 "Static guidelines" 1 "Active guidelines";
@@ -560,6 +649,7 @@ VAL_ 1552 METER_SLIDER_DIMMED 1 "Dimmed" 0 "Not Dimmed";
VAL_ 1552 UNITS 1 "km (km/L)" 2 "km (L/100km)" 3 "miles (MPG US)" 4 "miles (MPG Imperial)"; VAL_ 1552 UNITS 1 "km (km/L)" 2 "km (L/100km)" 3 "miles (MPG US)" 4 "miles (MPG Imperial)";
VAL_ 1553 UNITS 1 "km" 2 "miles"; VAL_ 1553 UNITS 1 "km" 2 "miles";
VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left"; VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left";
VAL_ 1556 BLINKER_BUTTON_PRESSED 1 "button pressed" 0 "not pressed";
VAL_ 1592 LOCK_STATUS 0 "locked" 1 "unlocked"; VAL_ 1592 LOCK_STATUS 0 "locked" 1 "unlocked";
CM_ "toyota_nodsu_pt.dbc starts here"; CM_ "toyota_nodsu_pt.dbc starts here";
+526
View File
@@ -0,0 +1,526 @@
CM_ "AUTOGENERATED FILE, DO NOT EDIT";
CM_ "Imported file _community.dbc starts here";
BO_ 359 STEERING_IPAS_COMMA: 8 IPAS
SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX
SG_ ANGLE : 3|12@0- (1.5,0) [-510|510] "deg" XXX
SG_ SET_ME_X10 : 23|8@0+ (1,0) [0|255] "" XXX
SG_ SET_ME_X00 : 31|8@0+ (1,0) [0|255] "" XXX
SG_ DIRECTION_CMD : 38|2@0+ (1,0) [0|3] "" XXX
SG_ SET_ME_X40 : 47|8@0+ (1,0) [0|255] "" XXX
SG_ SET_ME_X00_1 : 55|8@0+ (1,0) [0|255] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
CM_ "BO_ STEERING_IPAS_COMMA: Copy of msg 614 so we can do angle control while the Park Assist ECU is connected (Panda spoofs 614 with 359 on connector J70). Note that addresses 0x266 and 0x167 are checksum-invariant";
BO_ 512 GAS_COMMAND: 6 EON
SG_ GAS_COMMAND : 7|16@0+ (0.159375,-75.555) [0|1] "" INTERCEPTOR
SG_ GAS_COMMAND2 : 23|16@0+ (0.159375,-151.111) [0|1] "" INTERCEPTOR
SG_ ENABLE : 39|1@0+ (1,0) [0|1] "" INTERCEPTOR
SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" INTERCEPTOR
SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" INTERCEPTOR
BO_ 513 GAS_SENSOR: 6 INTERCEPTOR
SG_ INTERCEPTOR_GAS : 7|16@0+ (1,0) [0|1] "" EON
SG_ INTERCEPTOR_GAS2 : 23|16@0+ (1,0) [0|1] "" EON
SG_ STATE : 39|4@0+ (1,0) [0|15] "" EON
SG_ COUNTER_PEDAL : 35|4@0+ (1,0) [0|15] "" EON
SG_ CHECKSUM_PEDAL : 47|8@0+ (1,0) [0|255] "" EON
VAL_ 513 STATE 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ;
BO_ 35 SECONDARY_STEER_ANGLE: 8 XXX
SG_ ZORRO_STEER : 7|24@0- (0.004901594652,0) [-500|500] "" XXX
CM_ "BO_ SECONDARY_STEER_ANGLE: ZSS is a high-precision steering angle sensor that can replace the lower resolution sensor in most TSS1 Toyotas. Learn more: https://github.com/commaai/openpilot/wiki/Toyota-Lexus#zorro-steering-sensor-zss";
BO_ 767 SDSU: 8 XXX
SG_ FD_BUTTON : 7|1@0+ (1,0) [0|1] "" XXX
SG_ STATE : 23|4@0+ (1,0) [0|15] "" XXX
CM_ "BO_ SDSU: The sDSU is a modified DSU for use in TSS-P Toyotas. Learn more: https://github.com/RetroPilot/ocelot/tree/main/firmware/smart_dsu";
CM_ SG_ 767 FD_BUTTON "The follow distance button signal as forwarded by the sdsu";
VAL_ 767 STATE 7 "STATE_AEB_CTRL" 6 "FAULT_INVALID" 5 "FAULT_TIMEOUT" 4 "FAULT_STARTUP" 3 "FAULT_SCE" 2 "FAULT_SEND" 1 "FAULT_BAD_CHECKSUM" 0 "NO_FAULT" ;
CM_ "toyota_rav4_prime.dbc starts here";
VERSION ""
NS_ :
NS_DESC_
CM_
BA_DEF_
BA_
VAL_
CAT_DEF_
CAT_
FILTER
BA_DEF_DEF_
EV_DATA_
ENVVAR_DATA_
SGTYPE_
SGTYPE_VAL_
BA_DEF_SGTYPE_
BA_SGTYPE_
SIG_TYPE_REF_
VAL_TABLE_
SIG_GROUP_
SIG_VALTYPE_
SIGTYPE_VALTYPE_
BO_TX_BU_
BA_DEF_REL_
BA_REL_
BA_DEF_DEF_REL_
BU_SG_REL_
BU_EV_REL_
BU_BO_REL_
SG_MUL_VAL_
BS_:
BU_: XXX DSU HCU EPS IPAS CGW BGM
BO_ 15 SECOC_SYNCHRONIZATION: 8 XXX
SG_ TRIP_CNT : 7|16@0+ (1,0) [0|65535] "" XXX
SG_ RESET_CNT : 23|20@0+ (1,0) [0|65535] "" XXX
SG_ AUTHENTICATOR : 35|28@0+ (1,0) [0|268435455] "" XXX
BO_ 37 STEER_ANGLE_SENSOR: 8 XXX
SG_ STEER_ANGLE : 3|12@0- (1.5,0) [-500|500] "deg" XXX
SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX
SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX
BO_ 170 WHEEL_SPEEDS: 8 XXX
SG_ WHEEL_SPEED_FR : 7|16@0+ (0.01,-67.67) [0|250] "km/h" XXX
SG_ WHEEL_SPEED_FL : 23|16@0+ (0.01,-67.67) [0|250] "km/h" XXX
SG_ WHEEL_SPEED_RR : 39|16@0+ (0.01,-67.67) [0|250] "km/h" XXX
SG_ WHEEL_SPEED_RL : 55|16@0+ (0.01,-67.67) [0|250] "km/h" XXX
BO_ 257 BRAKE_MODULE: 8 XXX
SG_ BRAKE_PRESSED : 3|1@0+ (1,0) [0|1] "" XXX
SG_ BRAKE_PRESSURE_1 : 31|8@0+ (1,0) [0|15] "" XXX
SG_ BRAKE_PRESSURE_2 : 61|6@0+ (1,0) [0|63] "" XXX
BO_ 278 GAS_PEDAL: 8 XXX
SG_ GAS_PEDAL_ACC : 7|8@0+ (0.005,0) [0|255] "" XXX
SG_ GAS_PEDAL_USER : 15|8@0+ (0.005,0) [0|255] "" XXX
SG_ AUTHENTICATOR : 35|28@0+ (1,0) [0|268435455] "" XXX
SG_ RESET_FLAG : 37|2@0+ (1,0) [0|3] "" XXX
SG_ MSG_CNT_LOWER : 39|2@0+ (1,0) [0|3] "" XXX
BO_ 295 GEAR_PACKET_HYBRID: 8 XXX
SG_ CAR_MOVEMENT : 25|10@0- (1,0) [0|255] "" XXX
SG_ GEAR : 47|4@0+ (1,0) [0|15] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 305 STEERING_LTA_2: 8 XXX
SG_ STEER_REQUEST_2 : 0|1@0+ (1,0) [0|1] "" XXX
SG_ STEER_REQUEST : 3|1@0+ (1,0) [0|1] "" XXX
SG_ COUNTER : 13|6@0+ (1,0) [0|63] "" XXX
SG_ STEER_ANGLE_CMD : 23|16@0- (0.0573,0) [0|65535] "" XXX
SG_ AUTHENTICATOR : 35|28@0+ (1,0) [0|268435455] "" XXX
SG_ RESET_FLAG : 37|2@0+ (1,0) [0|3] "" XXX
SG_ MSG_CNT_LOWER : 39|2@0+ (1,0) [0|3] "" XXX
BO_ 353 DSU_SPEED: 7 XXX
SG_ FORWARD_SPEED : 15|16@0- (0.00390625,-30) [0|255] "km/h" XXX
BO_ 374 PCM_CRUISE: 8 XXX
SG_ CRUISE_ACTIVE : 5|1@0+ (1,0) [0|1] "" XXX
SG_ CRUISE_STATE : 31|4@0+ (1,0) [0|1] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 375 PCM_CRUISE_3: 8 XXX
SG_ NEW_SIGNAL_1 : 7|16@0- (1,0) [0|65535] "" XXX
SG_ NEW_SIGNAL_4 : 16|1@0+ (1,0) [0|1] "" XXX
SG_ NEW_SIGNAL_6 : 19|1@0+ (1,0) [0|1] "" XXX
SG_ NEW_SIGNAL_7 : 21|1@0+ (1,0) [0|1] "" XXX
SG_ NEW_SIGNAL_5 : 22|1@0+ (1,0) [0|1] "" XXX
SG_ GAS_RELEASED : 30|1@0+ (1,0) [0|1] "" XXX
SG_ NEW_SIGNAL_2 : 31|1@0+ (1,0) [0|1] "" XXX
SG_ AUTHENTICATOR : 35|28@0+ (1,0) [0|268435455] "" XXX
SG_ RESET_FLAG : 37|2@0+ (1,0) [0|3] "" XXX
SG_ MSG_CNT_LOWER : 39|2@0+ (1,0) [0|3] "" XXX
BO_ 387 ACC_CONTROL_2: 8 XXX
SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s^2" HCU
SG_ AUTHENTICATOR : 35|28@0+ (1,0) [0|268435455] "" XXX
SG_ RESET_FLAG : 37|2@0+ (1,0) [0|3] "" XXX
SG_ MSG_CNT_LOWER : 39|2@0+ (1,0) [0|3] "" XXX
BO_ 401 STEERING_LTA: 8 XXX
SG_ STEER_REQUEST : 0|1@0+ (1,0) [0|1] "" XXX
SG_ COUNTER : 6|6@0+ (1,0) [0|255] "" XXX
SG_ SETME_X1 : 7|1@0+ (1,0) [0|1] "" XXX
SG_ STEER_ANGLE_CMD : 15|16@0- (0.0573,0) [-540|540] "" XXX
SG_ STEER_REQUEST_2 : 25|1@0+ (1,0) [0|1] "" XXX
SG_ LKA_ACTIVE : 26|1@0+ (1,0) [0|1] "" XXX
SG_ SETME_X3 : 29|2@0+ (1,0) [0|3] "" XXX
SG_ CLEAR_HOLD_STEERING_ALERT : 30|1@0+ (1,0) [0|1] "" XXX
SG_ PERCENTAGE : 39|8@0+ (1,0) [0|255] "" XXX
SG_ TORQUE_WIND_DOWN : 47|8@0+ (1,0) [0|255] "" XXX
SG_ ANGLE : 55|8@0- (0.5,0) [0|255] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 418 CRUISE_RELATED: 8 XXX
SG_ CRUISE_ACTIVE : 7|1@0+ (1,0) [0|1] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 467 PCM_CRUISE_2: 8 XXX
SG_ BRAKE_PRESSED : 3|1@0+ (1,0) [0|1] "" XXX
SG_ PCM_FOLLOW_DISTANCE : 12|2@0+ (1,0) [0|3] "" XXX
SG_ LOW_SPEED_LOCKOUT : 14|2@0+ (1,0) [0|3] "" XXX
SG_ MAIN_ON : 15|1@0+ (1,0) [0|1] "" XXX
SG_ SET_SPEED : 23|8@0+ (1,0) [0|255] "km/h" XXX
SG_ ACC_FAULTED : 47|1@0+ (1,0) [0|1] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 608 STEER_TORQUE_SENSOR: 8 XXX
SG_ STEER_OVERRIDE : 0|1@0+ (1,0) [0|1] "" XXX
SG_ STEER_ANGLE_INITIALIZING : 3|1@0+ (1,0) [0|1] "" XXX
SG_ STEER_TORQUE_DRIVER : 15|16@0- (1,0) [-32768|32767] "" XXX
SG_ STEER_ANGLE : 31|16@0- (0.0573,0) [-500|500] "" XXX
SG_ STEER_TORQUE_EPS : 47|16@0- (1,0) [-32768|32767] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 610 EPS_STATUS: 8 EPS
SG_ IPAS_STATE : 3|4@0+ (1,0) [0|15] "" XXX
SG_ LTA_STATE : 15|5@0+ (1,0) [0|31] "" XXX
SG_ TYPE : 24|1@0+ (1,0) [0|1] "" XXX
SG_ LKA_STATE : 31|7@0+ (1,0) [0|127] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 643 PRE_COLLISION: 8 DSU
SG_ AUTHENTICATOR : 35|28@0+ (1,0) [0|268435455] "" XXX
SG_ RESET_FLAG : 37|2@0+ (1,0) [0|3] "" XXX
SG_ MSG_CNT_LOWER : 39|2@0+ (1,0) [0|3] "" XXX
BO_ 740 STEERING_LKA: 8 XXX
SG_ STEER_REQUEST : 0|1@0+ (1,0) [0|1] "" XXX
SG_ COUNTER : 6|6@0+ (1,0) [0|63] "" XXX
SG_ SET_ME_1 : 7|1@0+ (1,0) [0|1] "" XXX
SG_ STEER_TORQUE_CMD : 15|16@0- (1,0) [0|65535] "" XXX
SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX
SG_ AUTHENTICATOR : 35|28@0+ (1,0) [0|268435455] "" XXX
SG_ RESET_FLAG : 37|2@0+ (1,0) [0|3] "" XXX
SG_ MSG_CNT_LOWER : 39|2@0+ (1,0) [0|3] "" XXX
BO_ 742 LEAD_INFO: 8 DSU
SG_ LEAD_LONG_DIST : 7|13@0+ (0.05,0) [0|300] "m" HCU
SG_ LEAD_REL_SPEED : 23|12@0- (0.025,0) [-100|100] "m/s" HCU
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" HCU
BO_ 835 ACC_CONTROL: 8 DSU
SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s^2" HCU
SG_ ALLOW_LONG_PRESS : 17|2@0+ (1,0) [0|2] "" XXX
SG_ ACC_MALFUNCTION : 18|1@0+ (1,0) [0|0] "" XXX
SG_ RADAR_DIRTY : 19|1@0+ (1,0) [0|1] "" XXX
SG_ DISTANCE : 20|1@0+ (1,0) [0|1] "" XXX
SG_ MINI_CAR : 21|1@0+ (1,0) [0|1] "" XXX
SG_ ACC_TYPE : 23|2@0+ (1,0) [0|3] "" HCU
SG_ CANCEL_REQ : 24|1@0+ (1,0) [0|1] "" HCU
SG_ ACC_CUT_IN : 25|1@0+ (1,0) [0|1] "" XXX
SG_ PERMIT_BRAKING : 30|1@0+ (1,0) [0|1] "" HCU
SG_ RELEASE_STANDSTILL : 31|1@0+ (1,0) [0|1] "" HCU
SG_ ITS_CONNECT_LEAD : 39|8@0+ (1,0) [0|1] "" Vector__XXX
SG_ ACCEL_CMD_ALT : 47|8@0- (0.05,0) [0|0] "m/s^2" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 836 PRE_COLLISION_2: 8 DSU
SG_ AUTHENTICATOR : 35|28@0+ (1,0) [0|268435455] "" XXX
SG_ RESET_FLAG : 37|2@0+ (1,0) [0|3] "" XXX
SG_ MSG_CNT_LOWER : 39|2@0+ (1,0) [0|3] "" XXX
BO_ 881 LTA_RELATED: 8 FCM
SG_ GAS_PEDAL : 15|8@0+ (0.005,0) [0|1] "" XXX
SG_ STEER_ANGLE : 23|16@0- (0.0573,0) [-500|500] "" XXX
SG_ TURN_SIGNALS : 35|2@0+ (1,0) [0|3] "" XXX
SG_ UNKNOWN_2 : 58|1@0+ (1,0) [0|1] "" XXX
SG_ LDA_SA_TOGGLE : 59|1@0+ (1,0) [0|1] "" XXX
SG_ LTA_STEER_REQUEST : 60|1@0+ (1,0) [0|1] "" XXX
SG_ UNKNOWN : 61|1@0+ (1,0) [0|1] "" XXX
SG_ STEERING_PRESSED : 63|1@0+ (1,0) [0|1] "" XXX
BO_ 921 PCM_CRUISE_SM: 8 XXX
SG_ MAIN_ON : 4|1@0+ (1,0) [0|1] "" XXX
SG_ CRUISE_CONTROL_STATE : 11|4@0+ (1,0) [0|15] "" XXX
SG_ DISTANCE_LINES : 14|2@0+ (1,0) [0|3] "" XXX
SG_ TEMP_ACC_FAULTED : 15|1@0+ (1,0) [0|1] "" XXX
SG_ UI_SET_SPEED : 31|8@0+ (1,0) [0|255] "" XXX
BO_ 951 ESP_CONTROL: 8 ESP
SG_ VSC_DISABLED : 12|2@0+ (1,0) [0|1] "" XXX
SG_ TC_DISABLED : 13|1@0+ (1,0) [0|1] "" XXX
SG_ BRAKE_LIGHTS_ACC : 18|1@0+ (1,0) [0|1] "" XXX
SG_ BRAKE_HOLD_ENABLED : 33|1@1+ (1,0) [0|1] "" XXX
SG_ BRAKE_HOLD_ACTIVE : 36|1@0+ (1,0) [0|1] "" XXX
BO_ 1014 BSM: 8 XXX
SG_ L_ADJACENT : 0|1@0+ (1,0) [0|1] "" XXX
SG_ R_ADJACENT : 1|1@0+ (1,0) [0|1] "" XXX
SG_ ADJACENT_ENABLED : 7|1@0+ (1,0) [0|1] "" XXX
SG_ L_APPROACHING : 8|1@0+ (1,0) [0|1] "" XXX
SG_ R_APPROACHING : 10|1@0+ (1,0) [0|1] "" XXX
SG_ APPROACHING_ENABLED : 15|1@0+ (1,0) [0|1] "" XXX
BO_ 1020 SOLAR_SENSOR: 8 XXX
SG_ LUX_SENSOR : 55|13@0+ (1,0) [0|0] "" XXX
BO_ 1041 PCS_HUD: 8 DSU
SG_ FCW : 4|1@0+ (1,0) [0|1] "" XXX
SG_ PCS_INDICATOR : 7|2@0+ (1,0) [0|3] "" XXX
SG_ SET_ME_X20 : 15|8@0+ (1,0) [0|1] "" XXX
SG_ PCS_DUST : 34|1@0+ (1,0) [0|0] "" XXX
SG_ PCS_TEMP : 35|1@0+ (1,0) [0|0] "" XXX
SG_ SET_ME_X10 : 39|8@0+ (1,0) [0|1] "" XXX
SG_ PCS_OFF : 40|1@0+ (1,0) [0|0] "" XXX
SG_ PCS_DUST2 : 41|1@0+ (1,0) [0|0] "" XXX
SG_ PCS_TEMP2 : 42|1@0+ (1,0) [0|0] "" XXX
SG_ FRD_ADJ : 53|3@0+ (1,0) [0|0] "" XXX
SG_ PCS_SENSITIVITY : 55|8@0+ (1,0) [0|1] "" XXX
BO_ 1042 LKAS_HUD: 8 DSU
SG_ BARRIERS : 1|2@0+ (1,0) [0|3] "" XXX
SG_ RIGHT_LINE : 3|2@0+ (1,0) [0|3] "" XXX
SG_ LEFT_LINE : 5|2@0+ (1,0) [0|3] "" XXX
SG_ LKAS_STATUS : 7|2@0+ (1,0) [0|3] "" XXX
SG_ LDA_ALERT : 9|2@0+ (1,0) [0|3] "" XXX
SG_ LDW_EXIST : 10|1@0+ (1,0) [0|1] "" XXX
SG_ TWO_BEEPS : 12|1@0+ (1,0) [0|1] "" XXX
SG_ ADJUSTING_CAMERA : 13|1@0+ (1,0) [0|1] "" XXX
SG_ LDA_UNAVAILABLE_QUIET : 14|1@0+ (1,0) [0|1] "" XXX
SG_ LDA_MALFUNCTION : 15|1@0+ (1,0) [0|1] "" XXX
SG_ LDA_UNAVAILABLE : 16|1@0+ (1,0) [0|1] "" XXX
SG_ LDA_SENSITIVITY : 18|2@0+ (1,0) [0|3] "" XXX
SG_ LDA_SA_TOGGLE : 20|2@0+ (1,0) [0|3] "" XXX
SG_ LDA_MESSAGES : 23|3@0+ (1,0) [0|1] "" XXX
SG_ LDA_ON_MESSAGE : 31|2@0+ (1,0) [0|3] "" XXX
SG_ REPEATED_BEEPS : 32|1@0+ (1,0) [0|1] "" XXX
SG_ SET_ME_X01 : 42|1@0+ (1,0) [0|1] "" XXX
SG_ LANE_SWAY_TOGGLE : 43|1@0+ (1,0) [0|1] "" XXX
SG_ LANE_SWAY_SENSITIVITY : 45|2@0+ (1,0) [0|3] "" XXX
SG_ TAKE_CONTROL : 46|1@0+ (1,0) [0|1] "" XXX
SG_ LDA_FRONT_CAMERA_BLOCKED : 47|1@0+ (1,0) [0|1] "" XXX
SG_ LANE_SWAY_BUZZER : 50|2@0+ (1,0) [0|0] "" XXX
SG_ LANE_SWAY_FLD : 53|3@0+ (1,0) [0|7] "" XXX
SG_ LANE_SWAY_WARNING : 55|2@0+ (1,0) [0|3] "" XXX
SG_ SET_ME_X02 : 63|8@0+ (1,0) [0|1] "" XXX
BO_ 1044 AUTO_HIGH_BEAM: 8 FCM
SG_ AHB_DUTY : 47|8@0+ (0.5,0) [0|0] "%" Vector__XXX
SG_ C_AHB : 51|4@0+ (1,0) [0|0] "" Vector__XXX
SG_ F_AHB : 55|4@0+ (1,0) [0|0] "" Vector__XXX
BO_ 1161 RSA1: 8 FCM
SG_ TSGN1 : 7|8@0+ (1,0) [0|0] "" XXX
SG_ TSGNHLT1 : 9|2@0+ (1,0) [0|0] "" XXX
SG_ TSGNGRY1 : 12|3@0+ (1,0) [0|0] "" XXX
SG_ SPDVAL1 : 23|8@0+ (1,0) [0|0] "km/h" XXX
SG_ SPLSGN2 : 27|4@0+ (1,0) [0|0] "" XXX
SG_ SPLSGN1 : 31|4@0+ (1,0) [0|0] "" XXX
SG_ TSGN2 : 39|8@0+ (1,0) [0|0] "" XXX
SG_ TSGNHLT2 : 41|2@0+ (1,0) [0|0] "" XXX
SG_ TSGNGRY2 : 44|3@0+ (1,0) [0|0] "" XXX
SG_ SPDVAL2 : 55|8@0+ (1,0) [0|0] "" XXX
SG_ SYNCID1 : 59|4@0+ (1,0) [0|0] "" XXX
SG_ BZRRQ_A : 61|2@0+ (1,0) [0|0] "" XXX
SG_ BZRRQ_P : 63|2@0+ (1,0) [0|0] "" XXX
BO_ 1162 RSA2: 8 FCM
SG_ TSGN3 : 7|8@0+ (1,0) [0|0] "" XXX
SG_ TSGNHLT3 : 9|2@0+ (1,0) [0|0] "" XXX
SG_ TSGNGRY3 : 12|3@0+ (1,0) [0|0] "" XXX
SG_ SPLSGN4 : 27|4@0+ (1,0) [0|0] "" XXX
SG_ SPLSGN3 : 31|4@0+ (1,0) [0|0] "" XXX
SG_ TSGN4 : 39|8@0+ (1,0) [0|0] "" XXX
SG_ TSGNHLT4 : 41|2@0+ (1,0) [0|0] "" XXX
SG_ TSGNGRY4 : 44|3@0+ (1,0) [0|0] "" XXX
SG_ SGNNUMA : 50|3@0+ (1,0) [0|0] "" XXX
SG_ SGNNUMP : 53|3@0+ (1,0) [0|0] "" XXX
SG_ DPSGNREQ : 54|1@0+ (1,0) [0|0] "" XXX
SG_ SYNCID2 : 59|4@0+ (1,0) [0|0] "" XXX
SG_ TSRWMSG : 61|2@0+ (1,0) [0|0] "" XXX
SG_ SPDUNT : 63|2@0+ (1,0) [0|0] "" XXX
BO_ 1163 RSA3: 8 FCM
SG_ OVSPNTM : 1|2@0+ (1,0) [0|0] "" XXX
SG_ NTLVLSPD : 3|2@0+ (1,0) [0|0] "" XXX
SG_ OTSGNNTM : 5|2@0+ (1,0) [0|0] "" XXX
SG_ TSRMSW : 6|1@0+ (1,0) [0|0] "" XXX
SG_ TSREQPD : 7|1@0+ (1,0) [0|0] "" XXX
SG_ OVSPVALL : 11|4@0+ (1,-5) [0|0] "" XXX
SG_ OVSPVALM : 19|4@0+ (1,-5) [0|0] "" XXX
SG_ OVSPVALH : 27|4@0+ (1,-5) [0|0] "" XXX
SG_ TSRSPU : 33|2@0+ (1,0) [0|0] "" XXX
BO_ 1552 BODY_CONTROL_STATE_2: 8 XXX
SG_ UI_SPEED : 23|8@0+ (1,0) [0|255] "" XXX
SG_ METER_SLIDER_BRIGHTNESS_PCT : 30|7@0+ (1,0) [12|100] "%" XXX
SG_ METER_SLIDER_LOW_BRIGHTNESS : 37|1@0+ (1,0) [0|1] "" XXX
SG_ METER_SLIDER_DIMMED : 38|1@0+ (1,0) [0|1] "" XXX
SG_ UNITS : 63|3@0+ (1,0) [1|4] "" XXX
BO_ 1553 UI_SETTING: 8 XXX
SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX
SG_ ODOMETER : 39|32@0+ (1,0) [0|1048575] "" XXX
BO_ 1556 BLINKERS_STATE: 8 XXX
SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
BO_ 1568 BODY_CONTROL_STATE: 8 XXX
SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" XXX
SG_ DOOR_OPEN_RL : 42|1@0+ (1,0) [0|1] "" XXX
SG_ DOOR_OPEN_RR : 43|1@0+ (1,0) [0|1] "" XXX
SG_ DOOR_OPEN_FR : 44|1@0+ (1,0) [0|1] "" XXX
SG_ DOOR_OPEN_FL : 45|1@0+ (1,0) [0|1] "" XXX
SG_ PARKING_BRAKE : 60|1@0+ (1,0) [0|1] "" XXX
SG_ SEATBELT_DRIVER_UNLATCHED : 62|1@0+ (1,0) [0|1] "" XXX
BO_ 1570 LIGHT_STALK: 8 SCM
SG_ FRONT_FOG : 27|1@0+ (1,0) [0|1] "" XXX
SG_ PARKING_LIGHT : 28|1@0+ (1,0) [0|1] "" XXX
SG_ LOW_BEAM : 29|1@0+ (1,0) [0|1] "" XXX
SG_ HIGH_BEAM : 30|1@0+ (1,0) [0|1] "" XXX
SG_ DAYTIME_RUNNING_LIGHT : 31|1@0+ (1,0) [0|1] "" XXX
SG_ AUTO_HIGH_BEAM : 37|1@0+ (1,0) [0|1] "" XXX
BO_ 1571 CERTIFICATION_ECU: 8 CGW
SG_ DOOR_LOCK_FEEDBACK_LIGHT : 15|1@0+ (1,0) [0|0] "" XXX
SG_ KEYFOB_LOCKING_FEEDBACK_LIGHT : 61|1@0+ (1,0) [0|0] "" XXX
SG_ KEYFOB_UNLOCKING_FEEDBACK_LIGHT : 62|1@0+ (1,0) [0|0] "" XXX
BO_ 1592 DOOR_LOCKS: 8 XXX
SG_ LOCK_STATUS_CHANGED : 15|1@0+ (1,0) [0|1] "" XXX
SG_ LOCK_STATUS : 20|1@0+ (1,0) [0|1] "" XXX
SG_ LOCKED_VIA_KEYFOB : 23|1@0+ (1,0) [0|1] "" XXX
CM_ SG_ 37 STEER_RATE "factor is tbd";
CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set";
CM_ SG_ 305 STEER_ANGLE_CMD "Used in place of STEERING_LTA.STEER_ANGLE_CMD on SecOC cars";
CM_ SG_ 387 ACCEL_CMD "Used in place of ACC_CONTROL.ACCEL_CMD on SecOC cars";
CM_ SG_ 401 STEER_REQUEST "enable bit for steering, 1 to steer, 0 to not";
CM_ SG_ 401 SETME_X1 "usually 1, seen at 0 on some South American Corollas indicating lack of stock Lane Tracing Assist";
CM_ SG_ 401 STEER_ANGLE_CMD "desired angle, OEM steers up to 95 degrees, no angle limit but torque will bottom out";
CM_ SG_ 401 STEER_REQUEST_2 "enable bit for steering, 1 to steer, 0 to not";
CM_ SG_ 401 LKA_ACTIVE "1 when using LTA for LKA";
CM_ SG_ 401 SETME_X3 "almost completely correlates with Toyota Safety Sense version, but may instead describe max torque when using LTA. if TSS 2.5 or 2022 RAV4, this is always 1. if TSS 2.0 this is always 3 (or 0 on Alphard, Highlander, NX)";
CM_ SG_ 401 CLEAR_HOLD_STEERING_ALERT "set to 1 when user clears LKAS_HUD->LDA_ALERT ('Hold Steering') by applying torque to steering wheel";
CM_ SG_ 401 PERCENTAGE "driver override percentage (0-100), very close to steeringPressed in OP";
CM_ SG_ 401 TORQUE_WIND_DOWN "used to wind down torque on user override";
CM_ SG_ 401 ANGLE "angle of car relative to lane center on LTA camera";
CM_ SG_ 467 LOW_SPEED_LOCKOUT "in low speed lockout, system would always disengage below 28mph";
CM_ SG_ 467 SET_SPEED "43 km/h are shown as 28 mph, so conversion isn't perfect";
CM_ SG_ 467 ACC_FAULTED "1 when ACC is faulted and the PCM disallows engagement";
CM_ SG_ 608 STEER_OVERRIDE "set when driver torque exceeds a certain value";
CM_ SG_ 608 STEER_TORQUE_DRIVER "driver torque";
CM_ SG_ 610 TYPE "seems 1 on Corolla, 0 on all others";
CM_ SG_ 835 ALLOW_LONG_PRESS "Enable Toyota's factory set speed increment behaviour, available on both metrics cars and imperial unit cars";
CM_ SG_ 835 ACC_MALFUNCTION "display ACC fault on dash if set to 1";
CM_ SG_ 835 RADAR_DIRTY "Display Clean Radar Sensor message on HUD";
CM_ SG_ 835 DISTANCE "Cycle through ACC following distance from long, mid, short when set to 1";
CM_ SG_ 835 ACC_TYPE "if 2, car is likely to have a permanent low speed lockout. 1 is ok";
CM_ SG_ 835 ACC_CUT_IN "Display blinking yellow lead if set to 1";
CM_ SG_ 835 PERMIT_BRAKING "Original ACC has this going high when a car in front is detected. In openpilot and before the PERMIT_BRAKING name, this was 'SET_ME_1' and is hardcoded to be high. Unsure if only informational or has an effect though existing usage in openpilot is to always set it to 1. Originally 'PMTBRKG' in the leaked toyota_2017_ref_pt.dbc file and name expansion speculated to be PerMiT BRaKinG.";
CM_ SG_ 835 ITS_CONNECT_LEAD "Displayed when lead car is capable of ITS Connect";
CM_ SG_ 835 ACCEL_CMD_ALT "Copy of main ACCEL_CMD, but across 8 bits instead of 16 bits like ACCEL_CMD. Unsure if only informational or has an effect. Likely informational as existing openpilot sets this to 0 and no loss of functionality observed. Originally 'AT_RAW' in leaked toyota_2017_ref_pt.dbc file.";
CM_ SG_ 881 GAS_PEDAL "not set on all cars, only seen on TSS 2.5 Camry Hybrid so far";
CM_ SG_ 881 STEER_ANGLE "matches STEER_TORQUE_SENSOR->STEER_ANGLE";
CM_ SG_ 881 TURN_SIGNALS "flipped on some cars";
CM_ SG_ 881 LDA_SA_TOGGLE "not applicable for all cars";
CM_ SG_ 881 LTA_STEER_REQUEST "only applicable for TSS 2.5: matches STEERING_LTA->STEER_REQUEST";
CM_ SG_ 881 UNKNOWN "related to steering wheel angle";
CM_ SG_ 881 STEERING_PRESSED "only applicable for TSS 2.5: low sensitivity steering wheel pressed by driver signal";
CM_ SG_ 921 TEMP_ACC_FAULTED "1 when the UI is displaying or playing fault-related alerts or sounds. Also 1 when pressing main on.";
CM_ SG_ 921 UI_SET_SPEED "set speed shown in the vehicle's UI with the vehicle's unit";
CM_ SG_ 951 BRAKE_LIGHTS_ACC "brake lights when ACC commands decel";
CM_ SG_ 1014 L_ADJACENT "vehicle adjacent left side of car. enabled above 10mph, regardless of ADJACENT_ENABLED or APPROACHING_ENABLED";
CM_ SG_ 1014 R_ADJACENT "vehicle adjacent right side of car. enabled above 10mph, regardless of ADJACENT_ENABLED or APPROACHING_ENABLED";
CM_ SG_ 1014 ADJACENT_ENABLED "when BSM is enabled in settings, this is on along with APPROACHING_ENABLED. this controls bsm alert visibility";
CM_ SG_ 1014 L_APPROACHING "vehicle approaching from left side of car. enabled above 10mph, regardless of ADJACENT_ENABLED or APPROACHING_ENABLED";
CM_ SG_ 1014 R_APPROACHING "vehicle approaching from right side of car. enabled above 10mph, regardless of ADJACENT_ENABLED or APPROACHING_ENABLED";
CM_ SG_ 1014 APPROACHING_ENABLED "when BSM is enabled in settings, this is on along with ADJACENT_ENABLED. this controls bsm alert visibility";
CM_ SG_ 1041 PCS_INDICATOR "Pre-Collision System Indicator";
CM_ SG_ 1041 PCS_DUST "alert: Front Camera Low Visibility Unavailable See Owner's Manual";
CM_ SG_ 1041 PCS_TEMP "alert: Front Camera Out of Temperature Range Unavailable Wait until Normal Temperature";
CM_ SG_ 1041 PCS_DUST2 "alert: Pre-Collision System Radar Sensor Blocked Unavailable Clean Radar Sensor";
CM_ SG_ 1041 PCS_TEMP2 "alert: Pre-Collision System Out of Temperature Range Unavailable See Owner's Manual";
CM_ SG_ 1041 FRD_ADJ "alert: ERROR ADJUSTING FRONT RADAR BEAM";
CM_ SG_ 1041 PCS_SENSITIVITY "Pre-Collision System Sensitivity";
CM_ SG_ 1042 LDW_EXIST "Unclear what this is, it's usually set to 0";
CM_ SG_ 1042 LDA_UNAVAILABLE_QUIET "LDA toggles and sensitivity settings are greyed out if set to 1";
CM_ SG_ 1042 LDA_SENSITIVITY "LDA Sensitivity";
CM_ SG_ 1042 LDA_SA_TOGGLE "LDA Steering Assist Toggle";
CM_ SG_ 1042 LDA_MESSAGES "Various LDA Messages";
CM_ SG_ 1042 LDA_ON_MESSAGE "Display LDA Turned ON message";
CM_ SG_ 1042 REPEATED_BEEPS "LDA audible warning";
CM_ SG_ 1042 SET_ME_X01 "empty bit on leaked dbc, always set to 1 during normal operations";
CM_ SG_ 1042 LANE_SWAY_TOGGLE "Lane Sway Warning System SWS Switch";
CM_ SG_ 1042 TAKE_CONTROL "Please Control Steering Wheel warning";
CM_ SG_ 1042 LDA_FRONT_CAMERA_BLOCKED "originally LDAFCVB, LDA related settings are greyed out if set to 1";
CM_ SG_ 1042 LANE_SWAY_BUZZER "Similar to TWO_BEEPS";
CM_ SG_ 1042 LANE_SWAY_FLD "Unknown signal for Lane Sway Warning System, set to 7 on stock system when SWS is enabled, 0 when SWS is disabled";
CM_ SG_ 1042 LANE_SWAY_WARNING "Lane Sway Warning System Triggered";
CM_ SG_ 1042 SET_ME_X02 "empty bit on leaked dbc, always set to 2 during normal operations";
CM_ SG_ 1161 SPDVAL1 "Numbers 0-199 is displayed, 200-254 displays circle without number and 255 is for no limit.";
CM_ SG_ 1161 SPDVAL2 "conditional speed value 70";
CM_ SG_ 1161 SYNCID1 "counter from 1 to f at 1 Hz";
CM_ SG_ 1162 SGNNUMP "1 if SPDVAL1 is set, otherwise 0";
CM_ SG_ 1162 SYNCID2 "counter from 1 to f at 1 Hz";
CM_ SG_ 1163 OVSPNTM "always 3";
CM_ SG_ 1163 NTLVLSPD "always 3";
CM_ SG_ 1163 OTSGNNTM "always 3";
CM_ SG_ 1163 TSRMSW "always 1";
CM_ SG_ 1163 TSREQPD "always 1";
CM_ SG_ 1163 OVSPVALL "-5 at start then 2 after 2 seconds";
CM_ SG_ 1163 OVSPVALM "-5 at start then 5 after 2 seconds";
CM_ SG_ 1163 OVSPVALH "-5 at start then 10 after 2 seconds";
CM_ SG_ 1163 TSRSPU "always 1";
CM_ SG_ 1552 UI_SPEED "Does not appear to match dash";
CM_ SG_ 1552 METER_SLIDER_BRIGHTNESS_PCT "Combination display brightness setting, scales from 12 per cent to 100 per cent, reflects combination meter settings only, not linked with headlight state";
CM_ SG_ 1552 METER_SLIDER_LOW_BRIGHTNESS "Combination display low brightness mode, also controls footwell lighting";
CM_ SG_ 1552 METER_SLIDER_DIMMED "Combination display slider not at max, reflects combination meter settings only, not linked with headlight state";
CM_ SG_ 1553 ODOMETER "Unit is dependent upon units signal";
CM_ SG_ 1592 LOCK_STATUS_CHANGED "1 on rising edge of lock/unlocking";
CM_ SG_ 1592 LOCK_STATUS "The next 3 bits always seem to follow this signal.";
CM_ SG_ 1592 LOCKED_VIA_KEYFOB "1 for as long as car is locked with key fob or door handle touch";
VAL_ 295 GEAR 0 "P" 1 "R" 2 "N" 3 "D" 4 "B";
VAL_ 401 SETME_X3 3 "TSS 2.0" 1 "TSS 2.5 or 2022 RAV4" 0 "TSS 2.0 on Alphard, Highlander, NX";
VAL_ 467 PCM_FOLLOW_DISTANCE 1 "far" 2 "medium" 3 "close";
VAL_ 467 LOW_SPEED_LOCKOUT 2 "low speed locked" 1 "ok";
VAL_ 610 IPAS_STATE 5 "override" 3 "enabled" 1 "disabled";
VAL_ 610 LTA_STATE 25 "temporary_fault" 9 "temporary_fault2" 5 "active" 3 "lta_missing_unavailable" 1 "standby";
VAL_ 610 LKA_STATE 25 "temporary_fault" 17 "permanent_fault" 11 "lka_missing_unavailable2" 9 "temporary_fault2" 5 "active" 3 "lka_missing_unavailable" 1 "standby";
VAL_ 835 ALLOW_LONG_PRESS 2 "set speed increase by 5 speed units regardless" 1 "set speed increase by 1 speed unit on short press, 5 speed units on long press";
VAL_ 835 ACC_MALFUNCTION 1 "faulted" 0 "ok";
VAL_ 835 ACC_TYPE 2 "permanent low speed lockout" 1 "ok";
VAL_ 835 ACC_CUT_IN 1 "CUT-IN Detected" 0 "clear";
VAL_ 921 CRUISE_CONTROL_STATE 2 "disabled" 11 "hold" 10 "hold_waiting_user_cmd" 6 "enabled" 5 "faulted";
VAL_ 1041 PCS_INDICATOR 2 "PCS Faulted" 1 "PCS Turned Off By User" 0 "PCS Enabled";
VAL_ 1041 PCS_SENSITIVITY 64 "high sensitivity" 128 "mid sensitivity" 192 "low sensitivity" 0 "off";
VAL_ 1042 BARRIERS 3 "left" 2 "right" 1 "both" 0 "none";
VAL_ 1042 RIGHT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none";
VAL_ 1042 LEFT_LINE 3 "orange" 2 "faded" 1 "solid" 0 "none";
VAL_ 1042 LKAS_STATUS 1 "on" 0 "off";
VAL_ 1042 LDA_ALERT 3 "hold with continuous beep" 2 "LDA unavailable" 1 "hold" 0 "none";
VAL_ 1042 LDA_SENSITIVITY 2 "standard" 1 "high" 0 "undefined";
VAL_ 1042 LDA_SA_TOGGLE 2 "steering assist off" 1 "steering assist on";
VAL_ 1042 LDA_MESSAGES 4 "lda unavailable at this speed" 1 "lda unavailable below approx 50km/h" 0 "ok";
VAL_ 1042 LDA_ON_MESSAGE 2 "Lane Departure Alert Turned ON, Steering Assist Inactive" 1 "Lane Departure Alert Turned ON, Steering Assist Active" 0 "clear";
VAL_ 1042 TAKE_CONTROL 1 "take control" 0 "ok";
VAL_ 1042 LDA_FRONT_CAMERA_BLOCKED 1 "lda unavailable" 0 "ok";
VAL_ 1042 LANE_SWAY_BUZZER 3 "ok" 2 "beep twice" 1 "beep twice" 0 "ok";
VAL_ 1042 LANE_SWAY_WARNING 3 "ok" 2 "orange please take a break" 1 "prompt would you like to take a break" 0 "ok";
VAL_ 1161 TSGN1 1 "speed sign" 0 "none";
VAL_ 1161 SPLSGN2 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
VAL_ 1161 TSGN2 1 "speed sign" 0 "none";
VAL_ 1162 TSGN3 0 "none" 1 "speed sign" 2 "0 unlimited" 7 "unlimited" 16 "highway" 17 "no highway" 18 "motorway" 19 "no motorway" 20 "in city" 21 "outside city" 22 "pedestrian area" 23 "no pedestrian area" 65 "no overtaking left" 66 "no overtaking right" 67 "overtaking allowed again" 81 "no right turn" 97 "stop" 105 "yield" 113 "stop" 114 "yield us" 129 "no entry" 138 "no entry tss2" 145 "do not enter";
VAL_ 1162 SPLSGN3 15 "conditional blank" 4 "wet road" 5 "rain" 0 "none";
VAL_ 1552 METER_SLIDER_LOW_BRIGHTNESS 1 "Low brightness mode, footwell lights off" 0 "Normal mode, footwell lights on";
VAL_ 1552 METER_SLIDER_DIMMED 1 "Dimmed" 0 "Not Dimmed";
VAL_ 1552 UNITS 1 "km (km/L)" 2 "km (L/100km)" 3 "miles (MPG US)" 4 "miles (MPG Imperial)";
VAL_ 1553 UNITS 1 "km" 2 "miles";
VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left";
VAL_ 1592 LOCK_STATUS 0 "locked" 1 "unlocked";
+97 -9
View File
@@ -93,9 +93,24 @@ BO_ 37 STEER_ANGLE_SENSOR: 8 XXX
SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX SG_ STEER_FRACTION : 39|4@0- (0.1,0) [-0.7|0.7] "deg" XXX
SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX SG_ STEER_RATE : 35|12@0- (1,0) [-2000|2000] "deg/s" XXX
BO_ 119 ENG2F41: 6 CGW
SG_ FDRV : 7|16@0- (2,0) [0|0] "N" Vector__XXX
SG_ FDRVREAL : 23|13@0- (10,0) [0|0] "N" Vector__XXX
SG_ XAECT : 39|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ XFDRVCOL : 38|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ FDRVSELP : 34|3@0+ (1,0) [0|0] "" Vector__XXX
SG_ ENG2F41S : 47|8@0+ (1,0) [0|0] "" Vector__XXX
BO_ 120 ENG2F42: 4 CGW
SG_ FAVLMCHH : 7|16@0- (2,0) [0|0] "N" Vector__XX228X
SG_ CCRNG : 23|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ FDRVTYPD : 22|3@0+ (1,0) [0|0] "" Vector__XXX
SG_ GEARHD : 18|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ ENG2F42S : 31|8@0+ (1,0) [0|0] "" Vector__XXX
BO_ 166 BRAKE: 8 XXX BO_ 166 BRAKE: 8 XXX
SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX SG_ BRAKE_AMOUNT : 7|8@0+ (1,0) [0|255] "" XXX
SG_ BRAKE_PEDAL : 23|8@0+ (1,0) [0|255] "" XXX SG_ BRAKE_FORCE : 23|8@0+ (40,0) [0|10200] "N" XXX
BO_ 170 WHEEL_SPEEDS: 8 XXX BO_ 170 WHEEL_SPEEDS: 8 XXX
SG_ WHEEL_SPEED_FR : 7|16@0+ (0.01,-67.67) [0|250] "km/h" XXX SG_ WHEEL_SPEED_FR : 7|16@0+ (0.01,-67.67) [0|250] "km/h" XXX
@@ -109,8 +124,8 @@ BO_ 180 SPEED: 8 XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 295 GEAR_PACKET_HYBRID: 8 XXX BO_ 295 GEAR_PACKET_HYBRID: 8 XXX
SG_ CAR_MOVEMENT : 25|10@0- (1,0) [0|255] "" XXX SG_ FDRVREAL : 26|11@0- (25,0) [-25600|25575] "N" XXX
SG_ COUNTER : 55|8@0+ (1,0) [0|255] "" XXX SG_ UNKNOWN : 55|8@0+ (1,0) [0|255] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
SG_ GEAR : 47|4@0+ (1,0) [0|15] "" XXX SG_ GEAR : 47|4@0+ (1,0) [0|15] "" XXX
@@ -119,6 +134,7 @@ BO_ 353 DSU_SPEED: 7 XXX
BO_ 452 ENGINE_RPM: 8 CGW BO_ 452 ENGINE_RPM: 8 CGW
SG_ RPM : 7|16@0- (0.78125,0) [0|0] "rpm" SCS SG_ RPM : 7|16@0- (0.78125,0) [0|0] "rpm" SCS
SG_ ENGINE_RUNNING : 27|1@0+ (1,0) [0|1] "" XXX
BO_ 466 PCM_CRUISE: 8 XXX BO_ 466 PCM_CRUISE: 8 XXX
SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX SG_ GAS_RELEASED : 4|1@0+ (1,0) [0|1] "" XXX
@@ -139,9 +155,10 @@ BO_ 467 PCM_CRUISE_2: 8 XXX
SG_ ACC_FAULTED : 47|1@0+ (1,0) [0|1] "" XXX SG_ ACC_FAULTED : 47|1@0+ (1,0) [0|1] "" XXX
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 552 ACCELEROMETER: 8 XXX BO_ 552 VSC1S29: 4 CGW
SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "m/s^2" XXX SG_ ICBACT : 7|1@0+ (1,0) [0|0] "" DS1
SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s^2" XXX SG_ DVS0PCS : 6|15@0- (0.001,0) [0|0] "m/s^2" DS1
SG_ SM228 : 31|8@0+ (1,0) [0|0] "" DS1
BO_ 560 BRAKE_2: 7 XXX BO_ 560 BRAKE_2: 7 XXX
SG_ BRAKE_PRESSED : 26|1@0+ (1,0) [0|1] "" XXX SG_ BRAKE_PRESSED : 26|1@0+ (1,0) [0|1] "" XXX
@@ -180,7 +197,11 @@ BO_ 643 PRE_COLLISION: 7 DSU
BO_ 705 GAS_PEDAL: 8 XXX BO_ 705 GAS_PEDAL: 8 XXX
SG_ GAS_RELEASED : 3|1@0+ (1,0) [0|1] "" XXX SG_ GAS_RELEASED : 3|1@0+ (1,0) [0|1] "" XXX
SG_ GAS_PEDAL : 55|8@0+ (0.005,0) [0|1] "" XXX SG_ ETQLVSC : 15|16@0- (0.03125,0) [0|0] "Nm" XXX
SG_ ETQREAL : 31|16@0- (0.03125,0) [0|0] "Nm" SCS
SG_ ETQISC : 47|8@0+ (1,-192) [0|0] "Nm" XXX
SG_ GAS_PEDAL : 55|8@0+ (0.5,0) [0|0] "%" DS1,FCM
SG_ CHECKSUM : 63|8@0+ (1,0) [0|0] "" DS1,FCM
BO_ 740 STEERING_LKA: 5 XXX BO_ 740 STEERING_LKA: 5 XXX
SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX SG_ LKA_STATE : 31|8@0+ (1,0) [0|255] "" XXX
@@ -195,6 +216,31 @@ BO_ 742 LEAD_INFO: 8 DSU
SG_ LEAD_REL_SPEED : 23|12@0- (0.025,0) [-100|100] "m/s" HCU SG_ LEAD_REL_SPEED : 23|12@0- (0.025,0) [-100|100] "m/s" HCU
SG_ LEAD_LONG_DIST : 7|13@0+ (0.05,0) [0|300] "m" HCU SG_ LEAD_LONG_DIST : 7|13@0+ (0.05,0) [0|300] "m" HCU
BO_ 800 VSC1S07: 8 CGW
SG_ FBKRLY : 6|1@0+ (1,0) [0|0] "" DS1
SG_ FVSCM : 4|1@0+ (1,0) [0|0] "" DS1
SG_ FVSCSFT : 3|1@0+ (1,0) [0|0] "" DS1
SG_ FABS : 2|1@0+ (1,0) [0|0] "" DS1,FCM
SG_ TSVSC : 1|1@0+ (1,0) [0|0] "" DS1
SG_ FVSCL : 0|1@0+ (1,0) [0|0] "" DS1
SG_ RQCSTBKB : 15|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ PSBSTBY : 14|1@0+ (1,0) [0|0] "" DS1
SG_ P2BRXMK : 13|1@0+ (1,0) [0|0] "" DS1
SG_ MCC : 11|1@0+ (1,0) [0|0] "" DS1
SG_ RQBKB : 10|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ BRSTOP : 9|1@0+ (1,0) [0|0] "" DS1,FCM
SG_ BRKON : 8|1@0+ (1,0) [0|0] "" DS1,FCM
SG_ ASLP : 23|8@0- (1,0) [0|0] "deg" DS1
SG_ BRTYPACC : 31|2@0+ (1,0) [0|0] "" DS1
SG_ BRKABT3 : 26|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ BRKABT2 : 25|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ BRKABT1 : 24|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ GVC : 39|8@0- (0.04,0) [0|0] "m/s^2" DS1
SG_ XGVCINV : 43|1@0+ (1,0) [0|0] "" DS1
SG_ S07CNT : 52|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ PCSBRSTA : 50|2@0+ (1,0) [0|0] "" DS1
SG_ VSC07SUM : 63|8@0+ (1,0) [0|0] "" DS1,FCM
BO_ 835 ACC_CONTROL: 8 DSU BO_ 835 ACC_CONTROL: 8 DSU
SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s^2" HCU SG_ ACCEL_CMD : 7|16@0- (0.001,0) [-20|20] "m/s^2" HCU
SG_ ALLOW_LONG_PRESS : 17|2@0+ (1,0) [0|2] "" XXX SG_ ALLOW_LONG_PRESS : 17|2@0+ (1,0) [0|2] "" XXX
@@ -213,12 +259,19 @@ BO_ 835 ACC_CONTROL: 8 DSU
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
BO_ 836 PRE_COLLISION_2: 8 DSU BO_ 836 PRE_COLLISION_2: 8 DSU
SG_ DSS1GDRV : 7|10@0- (0.1,0) [0|0] "m/s^2" Vector__XXX
SG_ PCSALM : 17|1@0+ (1,0) [0|0] "" FCM
SG_ IBTRGR : 27|1@0+ (1,0) [0|0] "" FCM
SG_ PBATRGR : 30|2@0+ (1,0) [0|0] "" Vector__XXX
SG_ PREFILL : 33|1@0+ (1,0) [0|0] "" Vector__XXX
SG_ AVSTRGR : 36|1@0+ (1,0) [0|0] "" SCS
SG_ CHECKSUM : 63|8@0+ (1,0) [0|0] "" XXX SG_ CHECKSUM : 63|8@0+ (1,0) [0|0] "" XXX
BO_ 865 CLUTCH: 8 XXX BO_ 865 CLUTCH: 8 XXX
SG_ ACC_FAULTED : 32|1@0+ (1,0) [0|1] "" XXX SG_ ACC_FAULTED : 32|1@0+ (1,0) [0|1] "" XXX
SG_ GAS_PEDAL_ALT : 23|8@0+ (0.005,0) [0|1] "" XXX SG_ GAS_PEDAL_ALT : 23|8@0+ (0.005,0) [0|1] "" XXX
SG_ CLUTCH_RELEASED : 38|1@0+ (1,0) [0|1] "" XXX SG_ CLUTCH_RELEASED : 38|1@0+ (1,0) [0|1] "" XXX
SG_ ACCEL_NET : 48|16@1+ (0.0002,-6.5536) [-6.5536|6.5534] "" XXX
BO_ 869 DSU_CRUISE : 7 DSU BO_ 869 DSU_CRUISE : 7 DSU
SG_ RES_BTN : 3|1@0+ (1,0) [0|0] "" XXX SG_ RES_BTN : 3|1@0+ (1,0) [0|0] "" XXX
@@ -320,6 +373,18 @@ BO_ 1044 AUTO_HIGH_BEAM: 8 FCM
SG_ F_AHB : 55|4@0+ (1,0) [0|0] "" Vector__XXX SG_ F_AHB : 55|4@0+ (1,0) [0|0] "" Vector__XXX
SG_ C_AHB : 51|4@0+ (1,0) [0|0] "" Vector__XXX SG_ C_AHB : 51|4@0+ (1,0) [0|0] "" Vector__XXX
BO_ 1056 VSC1S08: 8 CGW
SG_ YR1Z : 7|16@0- (1,0) [0|0] "rad/s" DS1,FCM,MAV
SG_ YR2Z : 23|16@0- (1,0) [0|0] "rad/s" DS1,FCM,MAV
SG_ GL1Z : 39|8@0- (0.0359,0) [0|0] "m/s^2" DS1,FCM,KSS,MAV,SCS
SG_ GL2Z : 47|8@0- (0.0359,0) [0|0] "m/s^2" DS1,FCM,KSS,MAV,SCS
SG_ YRGSDIR : 55|1@0+ (1,0) [0|0] "" DS1,FCM,KSS,SCS
SG_ GLZS : 51|1@0+ (1,0) [0|0] "" DS1,FCM,KSS,MAV,SCS
SG_ YRZF : 50|1@0+ (1,0) [0|0] "" DS1,FCM,MAV
SG_ YRZS : 49|1@0+ (1,0) [0|0] "" DS1,FCM,MAV
SG_ YRZKS : 48|1@0+ (1,0) [0|0] "" DS1,FCM,MAV
SG_ VSC08SUM : 63|8@0+ (1,0) [0|0] "" DS1,FCM,MAV
BO_ 1083 AUTOPARK_STATUS: 8 IPAS BO_ 1083 AUTOPARK_STATUS: 8 IPAS
SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX SG_ STATE : 7|4@0+ (1,0) [0|15] "" XXX
@@ -398,9 +463,11 @@ BO_ 1552 BODY_CONTROL_STATE_2: 8 XXX
BO_ 1553 UI_SETTING: 8 XXX BO_ 1553 UI_SETTING: 8 XXX
SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX SG_ UNITS : 26|2@0+ (1,0) [0|3] "" XXX
SG_ ODOMETER : 39|32@0+ (1,0) [0|1048575] "" XXX SG_ ODOMETER : 39|32@0+ (1,0) [0|1048575] "" XXX
BO_ 1556 BLINKERS_STATE: 8 XXX BO_ 1556 BLINKERS_STATE: 8 XXX
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX SG_ BLINKER_BUTTON_PRESSED : 15|1@0+ (1,0) [0|1] "" XXX
SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX SG_ HAZARD_LIGHT : 27|1@0+ (1,0) [0|1] "" XXX
SG_ TURN_SIGNALS : 29|2@0+ (1,0) [0|3] "" XXX
BO_ 1568 BODY_CONTROL_STATE: 8 XXX BO_ 1568 BODY_CONTROL_STATE: 8 XXX
SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" XXX SG_ METER_DIMMED : 38|1@0+ (1,0) [0|1] "" XXX
@@ -429,13 +496,30 @@ BO_ 1592 DOOR_LOCKS: 8 XXX
SG_ LOCK_STATUS : 20|1@0+ (1,0) [0|1] "" XXX SG_ LOCK_STATUS : 20|1@0+ (1,0) [0|1] "" XXX
SG_ LOCKED_VIA_KEYFOB : 23|1@0+ (1,0) [0|1] "" XXX SG_ LOCKED_VIA_KEYFOB : 23|1@0+ (1,0) [0|1] "" XXX
BO_ 1779 ADAS_TOGGLE_STATE: 8 XXX
SG_ OK_BUTTON_PRESSED : 15|1@0+ (1,0) [0|1] "" BCM
SG_ SWS_TOGGLE_CMD : 24|1@0+ (1,0) [0|1] "" XXX
SG_ SWS_SENSITIVITY_CMD : 26|2@0+ (1,0) [0|3] "" XXX
SG_ LKAS_ON_CMD : 28|1@0+ (1,0) [0|1] "" XXX
SG_ LKAS_OFF_CMD : 29|1@0+ (1,0) [0|1] "" XXX
SG_ LDA_SENSITIVITY_HI_CMD : 30|1@0+ (1,0) [0|1] "" XXX
SG_ LDA_SENSITIVITY_STD_CMD : 31|1@0+ (1,0) [0|1] "" XXX
SG_ IPAS_TOGGLE : 34|1@0+ (1,0) [0|1] "" XXX
SG_ BSM_TOGGLE_CMD : 37|1@0+ (1,0) [0|1] "" XXX
SG_ IPAS_SONAR_TOGGLE : 38|1@0+ (1,0) [0|1] "" XXX
SG_ PCS_TOGGLE_CMD : 40|1@0+ (1,0) [0|1] "" XXX
SG_ PCS_SENSITIVITY_CMD : 41|1@0+ (1,0) [0|1] "" XXX
CM_ SG_ 36 YAW_RATE "verify"; CM_ SG_ 36 YAW_RATE "verify";
CM_ SG_ 36 ACCEL_X "x-axis accel"; CM_ SG_ 36 ACCEL_X "x-axis accel";
CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set"; CM_ SG_ 37 STEER_FRACTION "1/15th of the signal STEER_ANGLE, which is 1.5 deg; note that 0x8 is never set";
CM_ SG_ 37 STEER_RATE "factor is tbd"; CM_ SG_ 37 STEER_RATE "factor is tbd";
CM_ SG_ 119 FDRVREAL "ICE only: force applied by wheels from the engine. includes creeping force, regen, and engine braking";
CM_ SG_ 166 BRAKE_FORCE "hybrid only: force applied by friction brakes from user or ACC command";
CM_ SG_ 295 FDRVREAL "hybrid only: force applied by wheels from the engine and/or electric motors. includes creeping force, regen, and engine braking";
CM_ SG_ 466 NEUTRAL_FORCE "force in newtons the engine/electric motors are applying without any acceleration commands or user input"; CM_ SG_ 466 NEUTRAL_FORCE "force in newtons the engine/electric motors are applying without any acceleration commands or user input";
CM_ SG_ 466 ACC_BRAKING "whether brakes are being actuated from ACC command"; CM_ SG_ 466 ACC_BRAKING "whether brakes are being actuated from ACC command";
CM_ SG_ 466 ACCEL_NET "net acceleration produced by the system, given ACCEL_CMD, road grade and other factors"; CM_ SG_ 466 ACCEL_NET "net negative acceleration (braking) applied by the system if on flat ground";
CM_ SG_ 466 CRUISE_STATE "Active state is 8, if standstill is requested will switch to state 11(3 sec timer), after timer is elapsed will switch into state 7(standstill). If plus button was pressed - status 9, minus button pressed - status 10"; CM_ SG_ 466 CRUISE_STATE "Active state is 8, if standstill is requested will switch to state 11(3 sec timer), after timer is elapsed will switch into state 7(standstill). If plus button was pressed - status 9, minus button pressed - status 10";
CM_ SG_ 467 ACC_FAULTED "1 when ACC is faulted and the PCM disallows engagement"; CM_ SG_ 467 ACC_FAULTED "1 when ACC is faulted and the PCM disallows engagement";
CM_ SG_ 467 SET_SPEED "43 km/h are shown as 28 mph, so conversion isn't perfect"; CM_ SG_ 467 SET_SPEED "43 km/h are shown as 28 mph, so conversion isn't perfect";
@@ -448,6 +532,8 @@ CM_ SG_ 614 ANGLE "set to measured angle when ipas control isn't active";
CM_ SG_ 643 _COUNTER "only used on cars that use this msg for cruise control"; CM_ SG_ 643 _COUNTER "only used on cars that use this msg for cruise control";
CM_ SG_ 643 BRAKE_STATUS "only used on cars that use this msg for cruise control"; CM_ SG_ 643 BRAKE_STATUS "only used on cars that use this msg for cruise control";
CM_ SG_ 643 PRECOLLISION_ACTIVE "set 0.5s before any braking"; CM_ SG_ 643 PRECOLLISION_ACTIVE "set 0.5s before any braking";
CM_ SG_ 800 SLOPE_ANGLE "potentially used by the PCM to compensate for road pitch";
CM_ SG_ 800 ACCEL "filtered ego acceleration";
CM_ SG_ 835 ACC_TYPE "if 2, car is likely to have a permanent low speed lockout. 1 is ok"; CM_ SG_ 835 ACC_TYPE "if 2, car is likely to have a permanent low speed lockout. 1 is ok";
CM_ SG_ 835 RADAR_DIRTY "Display Clean Radar Sensor message on HUD"; CM_ SG_ 835 RADAR_DIRTY "Display Clean Radar Sensor message on HUD";
CM_ SG_ 835 ACC_MALFUNCTION "display ACC fault on dash if set to 1"; CM_ SG_ 835 ACC_MALFUNCTION "display ACC fault on dash if set to 1";
@@ -460,6 +546,7 @@ CM_ SG_ 835 PERMIT_BRAKING "Original ACC has this going high when a car in front
CM_ SG_ 835 ACCEL_CMD_ALT "Copy of main ACCEL_CMD, but across 8 bits instead of 16 bits like ACCEL_CMD. Unsure if only informational or has an effect. Likely informational as existing openpilot sets this to 0 and no loss of functionality observed. Originally 'AT_RAW' in leaked toyota_2017_ref_pt.dbc file."; CM_ SG_ 835 ACCEL_CMD_ALT "Copy of main ACCEL_CMD, but across 8 bits instead of 16 bits like ACCEL_CMD. Unsure if only informational or has an effect. Likely informational as existing openpilot sets this to 0 and no loss of functionality observed. Originally 'AT_RAW' in leaked toyota_2017_ref_pt.dbc file.";
CM_ SG_ 865 GAS_PEDAL_ALT "copy of main GAS_PEDAL. Both use 8 bits. Might indicate that this message is for pedals."; CM_ SG_ 865 GAS_PEDAL_ALT "copy of main GAS_PEDAL. Both use 8 bits. Might indicate that this message is for pedals.";
CM_ SG_ 865 CLUTCH_RELEASED "boolean of clutch for 6MT."; CM_ SG_ 865 CLUTCH_RELEASED "boolean of clutch for 6MT.";
CM_ SG_ 865 ACCEL_NET "net positive acceleration (gas) applied by the system if on flat ground, may not include creeping force";
CM_ SG_ 865 ACC_FAULTED "1 when ACC is faulted and the PCM disallows engagement. Also describes a lockout when the ACC_CONTROL->ACC_MALFUNCTION bit is set."; CM_ SG_ 865 ACC_FAULTED "1 when ACC is faulted and the PCM disallows engagement. Also describes a lockout when the ACC_CONTROL->ACC_MALFUNCTION bit is set.";
CM_ SG_ 921 UI_SET_SPEED "set speed shown in the vehicle's UI with the vehicle's unit"; CM_ SG_ 921 UI_SET_SPEED "set speed shown in the vehicle's UI with the vehicle's unit";
CM_ SG_ 921 TEMP_ACC_FAULTED "1 when the UI is displaying or playing fault-related alerts or sounds. Also 1 when pressing main on."; CM_ SG_ 921 TEMP_ACC_FAULTED "1 when the UI is displaying or playing fault-related alerts or sounds. Also 1 when pressing main on.";
@@ -560,6 +647,7 @@ VAL_ 1552 METER_SLIDER_DIMMED 1 "Dimmed" 0 "Not Dimmed";
VAL_ 1552 UNITS 1 "km (km/L)" 2 "km (L/100km)" 3 "miles (MPG US)" 4 "miles (MPG Imperial)"; VAL_ 1552 UNITS 1 "km (km/L)" 2 "km (L/100km)" 3 "miles (MPG US)" 4 "miles (MPG Imperial)";
VAL_ 1553 UNITS 1 "km" 2 "miles"; VAL_ 1553 UNITS 1 "km" 2 "miles";
VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left"; VAL_ 1556 TURN_SIGNALS 3 "none" 2 "right" 1 "left";
VAL_ 1556 BLINKER_BUTTON_PRESSED 1 "button pressed" 0 "not pressed";
VAL_ 1592 LOCK_STATUS 0 "locked" 1 "unlocked"; VAL_ 1592 LOCK_STATUS 0 "locked" 1 "unlocked";
CM_ "toyota_tnga_k_pt.dbc starts here"; CM_ "toyota_tnga_k_pt.dbc starts here";
+15 -4
View File
@@ -552,7 +552,13 @@ bool steer_torque_cmd_checks(int desired_torque, int steer_req, const SteeringLi
bool violation = false; bool violation = false;
uint32_t ts = microsecond_timer_get(); uint32_t ts = microsecond_timer_get();
bool aol_allowed = acc_main_on && (alternative_experience & ALT_EXP_ALWAYS_ON_LATERAL);
if (controls_allowed) { if (controls_allowed) {
// acc main must be on if controls are allowed
acc_main_on = controls_allowed;
}
if (controls_allowed || aol_allowed) {
// *** global torque limit check *** // *** global torque limit check ***
violation |= max_limit_check(desired_torque, limits.max_steer, -limits.max_steer); violation |= max_limit_check(desired_torque, limits.max_steer, -limits.max_steer);
@@ -579,7 +585,7 @@ bool steer_torque_cmd_checks(int desired_torque, int steer_req, const SteeringLi
} }
// no torque if controls is not allowed // no torque if controls is not allowed
if (!controls_allowed && (desired_torque != 0)) { if (!(controls_allowed || aol_allowed) && (desired_torque != 0)) {
violation = true; violation = true;
} }
@@ -621,7 +627,7 @@ bool steer_torque_cmd_checks(int desired_torque, int steer_req, const SteeringLi
} }
// reset to 0 if either controls is not allowed or there's a violation // reset to 0 if either controls is not allowed or there's a violation
if (violation || !controls_allowed) { if (violation || !(controls_allowed || aol_allowed)) {
valid_steer_req_count = 0; valid_steer_req_count = 0;
invalid_steer_req_count = 0; invalid_steer_req_count = 0;
desired_torque_last = 0; desired_torque_last = 0;
@@ -636,8 +642,13 @@ bool steer_torque_cmd_checks(int desired_torque, int steer_req, const SteeringLi
// Safety checks for angle-based steering commands // Safety checks for angle-based steering commands
bool steer_angle_cmd_checks(int desired_angle, bool steer_control_enabled, const SteeringLimits limits) { bool steer_angle_cmd_checks(int desired_angle, bool steer_control_enabled, const SteeringLimits limits) {
bool violation = false; bool violation = false;
bool aol_allowed = acc_main_on && (alternative_experience & ALT_EXP_ALWAYS_ON_LATERAL);
if (controls_allowed) {
// acc main must be on if controls are allowed
acc_main_on = controls_allowed;
}
if (controls_allowed && steer_control_enabled) { if ((controls_allowed || aol_allowed) && steer_control_enabled) {
// convert floating point angle rate limits to integers in the scale of the desired angle on CAN, // convert floating point angle rate limits to integers in the scale of the desired angle on CAN,
// add 1 to not false trigger the violation. also fudge the speed by 1 m/s so rate limits are // add 1 to not false trigger the violation. also fudge the speed by 1 m/s so rate limits are
// always slightly above openpilot's in case we read an updated speed in between angle commands // always slightly above openpilot's in case we read an updated speed in between angle commands
@@ -680,7 +691,7 @@ bool steer_angle_cmd_checks(int desired_angle, bool steer_control_enabled, const
} }
// No angle control allowed when controls are not allowed // No angle control allowed when controls are not allowed
violation |= !controls_allowed && steer_control_enabled; violation |= !(controls_allowed || aol_allowed) && steer_control_enabled;
return violation; return violation;
} }
+8 -1
View File
@@ -37,6 +37,7 @@ typedef struct {
const int DAS_6; const int DAS_6;
const int LKAS_COMMAND; const int LKAS_COMMAND;
const int CRUISE_BUTTONS; const int CRUISE_BUTTONS;
const int CRUISE_BUTTONS_ALT;
} ChryslerAddrs; } ChryslerAddrs;
// CAN messages for Chrysler/Jeep platforms // CAN messages for Chrysler/Jeep platforms
@@ -49,6 +50,7 @@ const ChryslerAddrs CHRYSLER_ADDRS = {
.DAS_6 = 0x2A6, // LKAS HUD and auto headlight control from DASM .DAS_6 = 0x2A6, // LKAS HUD and auto headlight control from DASM
.LKAS_COMMAND = 0x292, // LKAS controls from DASM .LKAS_COMMAND = 0x292, // LKAS controls from DASM
.CRUISE_BUTTONS = 0x23B, // Cruise control buttons .CRUISE_BUTTONS = 0x23B, // Cruise control buttons
.CRUISE_BUTTONS_ALT = 0x23B, // Cruise control buttons
}; };
// CAN messages for the 5th gen RAM DT platform // CAN messages for the 5th gen RAM DT platform
@@ -61,6 +63,7 @@ const ChryslerAddrs CHRYSLER_RAM_DT_ADDRS = {
.DAS_6 = 0xFA, // LKAS HUD and auto headlight control from DASM .DAS_6 = 0xFA, // LKAS HUD and auto headlight control from DASM
.LKAS_COMMAND = 0xA6, // LKAS controls from DASM .LKAS_COMMAND = 0xA6, // LKAS controls from DASM
.CRUISE_BUTTONS = 0xB1, // Cruise control buttons .CRUISE_BUTTONS = 0xB1, // Cruise control buttons
.CRUISE_BUTTONS_ALT = 0xB1, // Cruise control buttons
}; };
// CAN messages for the 5th gen RAM HD platform // CAN messages for the 5th gen RAM HD platform
@@ -73,6 +76,7 @@ const ChryslerAddrs CHRYSLER_RAM_HD_ADDRS = {
.DAS_6 = 0x275, // LKAS HUD and auto headlight control from DASM .DAS_6 = 0x275, // LKAS HUD and auto headlight control from DASM
.LKAS_COMMAND = 0x276, // LKAS controls from DASM .LKAS_COMMAND = 0x276, // LKAS controls from DASM
.CRUISE_BUTTONS = 0x23A, // Cruise control buttons .CRUISE_BUTTONS = 0x23A, // Cruise control buttons
.CRUISE_BUTTONS_ALT = 0x23B, // Cruise control buttons
}; };
const CanMsg CHRYSLER_TX_MSGS[] = { const CanMsg CHRYSLER_TX_MSGS[] = {
@@ -83,12 +87,14 @@ const CanMsg CHRYSLER_TX_MSGS[] = {
const CanMsg CHRYSLER_RAM_DT_TX_MSGS[] = { const CanMsg CHRYSLER_RAM_DT_TX_MSGS[] = {
{CHRYSLER_RAM_DT_ADDRS.CRUISE_BUTTONS, 2, 3}, {CHRYSLER_RAM_DT_ADDRS.CRUISE_BUTTONS, 2, 3},
{CHRYSLER_RAM_DT_ADDRS.CRUISE_BUTTONS_ALT, 2, 3},
{CHRYSLER_RAM_DT_ADDRS.LKAS_COMMAND, 0, 8}, {CHRYSLER_RAM_DT_ADDRS.LKAS_COMMAND, 0, 8},
{CHRYSLER_RAM_DT_ADDRS.DAS_6, 0, 8}, {CHRYSLER_RAM_DT_ADDRS.DAS_6, 0, 8},
}; };
const CanMsg CHRYSLER_RAM_HD_TX_MSGS[] = { const CanMsg CHRYSLER_RAM_HD_TX_MSGS[] = {
{CHRYSLER_RAM_HD_ADDRS.CRUISE_BUTTONS, 2, 3}, {CHRYSLER_RAM_HD_ADDRS.CRUISE_BUTTONS, 2, 3},
{CHRYSLER_RAM_HD_ADDRS.CRUISE_BUTTONS_ALT, 2, 3},
{CHRYSLER_RAM_HD_ADDRS.LKAS_COMMAND, 0, 8}, {CHRYSLER_RAM_HD_ADDRS.LKAS_COMMAND, 0, 8},
{CHRYSLER_RAM_HD_ADDRS.DAS_6, 0, 8}, {CHRYSLER_RAM_HD_ADDRS.DAS_6, 0, 8},
}; };
@@ -186,6 +192,7 @@ static void chrysler_rx_hook(const CANPacket_t *to_push) {
// enter controls on rising edge of ACC, exit controls on ACC off // enter controls on rising edge of ACC, exit controls on ACC off
const int das_3_bus = (chrysler_platform == CHRYSLER_PACIFICA) ? 0 : 2; const int das_3_bus = (chrysler_platform == CHRYSLER_PACIFICA) ? 0 : 2;
if ((bus == das_3_bus) && (addr == chrysler_addrs->DAS_3)) { if ((bus == das_3_bus) && (addr == chrysler_addrs->DAS_3)) {
acc_main_on = GET_BIT(to_push, 20U);
bool cruise_engaged = GET_BIT(to_push, 21U); bool cruise_engaged = GET_BIT(to_push, 21U);
pcm_cruise_check(cruise_engaged); pcm_cruise_check(cruise_engaged);
} }
@@ -234,7 +241,7 @@ static bool chrysler_tx_hook(const CANPacket_t *to_send) {
} }
// FORCE CANCEL: only the cancel button press is allowed // FORCE CANCEL: only the cancel button press is allowed
if (addr == chrysler_addrs->CRUISE_BUTTONS) { if ((addr == chrysler_addrs->CRUISE_BUTTONS) || (addr == CHRYSLER_RAM_HD_ADDRS.CRUISE_BUTTONS_ALT)) {
const bool is_cancel = GET_BYTE(to_send, 0) == 1U; const bool is_cancel = GET_BYTE(to_send, 0) == 1U;
const bool is_resume = GET_BYTE(to_send, 0) == 0x10U; const bool is_resume = GET_BYTE(to_send, 0) == 0x10U;
const bool allowed = is_cancel || (is_resume && controls_allowed); const bool allowed = is_cancel || (is_resume && controls_allowed);
+1
View File
@@ -245,6 +245,7 @@ static void ford_rx_hook(const CANPacket_t *to_push) {
// Signal: CcStat_D_Actl // Signal: CcStat_D_Actl
unsigned int cruise_state = GET_BYTE(to_push, 1) & 0x07U; unsigned int cruise_state = GET_BYTE(to_push, 1) & 0x07U;
acc_main_on = (cruise_state == 3U) ||(cruise_state == 4U) || (cruise_state == 5U);
bool cruise_engaged = (cruise_state == 4U) || (cruise_state == 5U); bool cruise_engaged = (cruise_state == 4U) || (cruise_state == 5U);
pcm_cruise_check(cruise_engaged); pcm_cruise_check(cruise_engaged);
} }
+39 -11
View File
@@ -10,16 +10,30 @@ const SteeringLimits GM_STEERING_LIMITS = {
}; };
const LongitudinalLimits GM_ASCM_LONG_LIMITS = { const LongitudinalLimits GM_ASCM_LONG_LIMITS = {
.max_gas = 3072, .max_gas = 7168,
.min_gas = 1404, .min_gas = 5500,
.inactive_gas = 1404, .inactive_gas = 5500,
.max_brake = 400,
};
const LongitudinalLimits GM_ASCM_LONG_LIMITS_SPORT = {
.max_gas = 8191,
.min_gas = 5500,
.inactive_gas = 5500,
.max_brake = 400, .max_brake = 400,
}; };
const LongitudinalLimits GM_CAM_LONG_LIMITS = { const LongitudinalLimits GM_CAM_LONG_LIMITS = {
.max_gas = 3400, .max_gas = 7496,
.min_gas = 1514, .min_gas = 5610,
.inactive_gas = 1554, .inactive_gas = 5650,
.max_brake = 400,
};
const LongitudinalLimits GM_CAM_LONG_LIMITS_SPORT = {
.max_gas = 8848,
.min_gas = 5610,
.inactive_gas = 5650,
.max_brake = 400, .max_brake = 400,
}; };
@@ -29,7 +43,7 @@ const int GM_STANDSTILL_THRSLD = 10; // 0.311kph
// panda interceptor threshold needs to be equivalent to openpilot threshold to avoid controls mismatches // panda interceptor threshold needs to be equivalent to openpilot threshold to avoid controls mismatches
// If thresholds are mismatched then it is possible for panda to see the gas fall and rise while openpilot is in the pre-enabled state // If thresholds are mismatched then it is possible for panda to see the gas fall and rise while openpilot is in the pre-enabled state
const int GM_GAS_INTERCEPTOR_THRESHOLD = 515; // (610 + 306.25) / 2 ratio between offset and gain from dbc file const int GM_GAS_INTERCEPTOR_THRESHOLD = 515; // (675 + 355) / 2 ratio between offset and gain from dbc file
#define GM_GET_INTERCEPTOR(msg) (((GET_BYTE((msg), 0) << 8) + GET_BYTE((msg), 1) + (GET_BYTE((msg), 2) << 8) + GET_BYTE((msg), 3)) / 2U) // avg between 2 tracks #define GM_GET_INTERCEPTOR(msg) (((GET_BYTE((msg), 0) << 8) + GET_BYTE((msg), 1) + (GET_BYTE((msg), 2) << 8) + GET_BYTE((msg), 3)) / 2U) // avg between 2 tracks
const CanMsg GM_ASCM_TX_MSGS[] = {{0x180, 0, 4}, {0x409, 0, 7}, {0x40A, 0, 7}, {0x2CB, 0, 8}, {0x370, 0, 6}, {0x200, 0, 6}, // pt bus const CanMsg GM_ASCM_TX_MSGS[] = {{0x180, 0, 4}, {0x409, 0, 7}, {0x40A, 0, 7}, {0x2CB, 0, 8}, {0x370, 0, 6}, {0x200, 0, 6}, // pt bus
@@ -143,7 +157,11 @@ static void gm_rx_hook(const CANPacket_t *to_push) {
} }
if ((addr == 0xC9) && ((gm_hw == GM_CAM) || (gm_hw == GM_SDGM))) { if ((addr == 0xC9) && ((gm_hw == GM_CAM) || (gm_hw == GM_SDGM))) {
brake_pressed = GET_BIT(to_push, 40U); brake_pressed = GET_BIT(to_push, 40U) != 0U;
}
if (addr == 0xC9) {
acc_main_on = GET_BIT(to_push, 29U) != 0U;
} }
if (addr == 0x1C4) { if (addr == 0x1C4) {
@@ -225,7 +243,7 @@ static bool gm_tx_hook(const CANPacket_t *to_send) {
// GAS/REGEN: safety check // GAS/REGEN: safety check
if (addr == 0x2CB) { if (addr == 0x2CB) {
bool apply = GET_BIT(to_send, 0U); bool apply = GET_BIT(to_send, 0U);
int gas_regen = ((GET_BYTE(to_send, 2) & 0x7FU) << 5) + ((GET_BYTE(to_send, 3) & 0xF8U) >> 3); int gas_regen = ((GET_BYTE(to_send, 1) & 0x1U) << 13) + ((GET_BYTE(to_send, 2) & 0xFFU) << 5) + ((GET_BYTE(to_send, 3) & 0xF8U) >> 3);
bool violation = false; bool violation = false;
// Allow apply bit in pre-enabled and overriding states // Allow apply bit in pre-enabled and overriding states
@@ -282,6 +300,8 @@ static int gm_fwd_hook(int bus_num, int addr) {
} }
static safety_config gm_init(uint16_t param) { static safety_config gm_init(uint16_t param) {
sport_mode = alternative_experience & ALT_EXP_RAISE_LONGITUDINAL_LIMITS_TO_ISO_MAX;
if GET_FLAG(param, GM_PARAM_HW_CAM) { if GET_FLAG(param, GM_PARAM_HW_CAM) {
gm_hw = GM_CAM; gm_hw = GM_CAM;
} else if GET_FLAG(param, GM_PARAM_HW_SDGM) { } else if GET_FLAG(param, GM_PARAM_HW_SDGM) {
@@ -293,9 +313,17 @@ static safety_config gm_init(uint16_t param) {
gm_force_ascm = GET_FLAG(param, GM_PARAM_HW_ASCM_LONG); gm_force_ascm = GET_FLAG(param, GM_PARAM_HW_ASCM_LONG);
if (gm_hw == GM_ASCM || gm_force_ascm) { if (gm_hw == GM_ASCM || gm_force_ascm) {
gm_long_limits = &GM_ASCM_LONG_LIMITS; if (sport_mode) {
gm_long_limits = &GM_ASCM_LONG_LIMITS_SPORT;
} else {
gm_long_limits = &GM_ASCM_LONG_LIMITS;
}
} else if ((gm_hw == GM_CAM) || (gm_hw == GM_SDGM)) { } else if ((gm_hw == GM_CAM) || (gm_hw == GM_SDGM)) {
gm_long_limits = &GM_CAM_LONG_LIMITS; if (sport_mode) {
gm_long_limits = &GM_CAM_LONG_LIMITS_SPORT;
} else {
gm_long_limits = &GM_CAM_LONG_LIMITS;
}
} else { } else {
} }
+93 -12
View File
@@ -1,9 +1,16 @@
const CanMsg HONDA_N_TX_MSGS[] = {{0xE4, 0, 5}, {0x194, 0, 4}, {0x1FA, 0, 8}, {0x30C, 0, 8}, {0x33D, 0, 5}}; const CanMsg HONDA_N_TX_MSGS[] = {{0xE4, 0, 5}, {0x194, 0, 4}, {0x1FA, 0, 8}, {0x30C, 0, 8}, {0x33D, 0, 5}};
const CanMsg HONDA_N_INTERCEPTOR_TX_MSGS[] = {{0xE4, 0, 5}, {0x194, 0, 4}, {0x1FA, 0, 8}, {0x200, 0, 6}, {0x30C, 0, 8}, {0x33D, 0, 5}};
const CanMsg HONDA_BOSCH_TX_MSGS[] = {{0xE4, 0, 5}, {0xE5, 0, 8}, {0x296, 1, 4}, {0x33D, 0, 5}, {0x33DA, 0, 5}, {0x33DB, 0, 8}}; // Bosch const CanMsg HONDA_BOSCH_TX_MSGS[] = {{0xE4, 0, 5}, {0xE5, 0, 8}, {0x296, 1, 4}, {0x33D, 0, 5}, {0x33DA, 0, 5}, {0x33DB, 0, 8}}; // Bosch
const CanMsg HONDA_BOSCH_LONG_TX_MSGS[] = {{0xE4, 1, 5}, {0x1DF, 1, 8}, {0x1EF, 1, 8}, {0x1FA, 1, 8}, {0x30C, 1, 8}, {0x33D, 1, 5}, {0x33DA, 1, 5}, {0x33DB, 1, 8}, {0x39F, 1, 8}, {0x18DAB0F1, 1, 8}}; // Bosch w/ gas and brakes const CanMsg HONDA_BOSCH_LONG_TX_MSGS[] = {{0xE4, 1, 5}, {0x1DF, 1, 8}, {0x1EF, 1, 8}, {0x1FA, 1, 8}, {0x30C, 1, 8}, {0x33D, 1, 5}, {0x33DA, 1, 5}, {0x33DB, 1, 8}, {0x39F, 1, 8}, {0x18DAB0F1, 1, 8}}; // Bosch w/ gas and brakes
const CanMsg HONDA_RADARLESS_TX_MSGS[] = {{0xE4, 0, 5}, {0x296, 2, 4}, {0x33D, 0, 8}}; // Bosch radarless const CanMsg HONDA_RADARLESS_TX_MSGS[] = {{0xE4, 0, 5}, {0x296, 2, 4}, {0x33D, 0, 8}}; // Bosch radarless
const CanMsg HONDA_RADARLESS_LONG_TX_MSGS[] = {{0xE4, 0, 5}, {0x33D, 0, 8}, {0x1C8, 0, 8}, {0x30C, 0, 8}}; // Bosch radarless w/ gas and brakes const CanMsg HONDA_RADARLESS_LONG_TX_MSGS[] = {{0xE4, 0, 5}, {0x33D, 0, 8}, {0x1C8, 0, 8}, {0x30C, 0, 8}}; // Bosch radarless w/ gas and brakes
// panda interceptor threshold needs to be equivalent to openpilot threshold to avoid controls mismatches
// If thresholds are mismatched then it is possible for panda to see the gas fall and rise while openpilot is in the pre-enabled state
// Threshold calculated from DBC gains: round(((83.3 / 0.253984064) + (83.3 / 0.126992032)) / 2) = 492
const int HONDA_GAS_INTERCEPTOR_THRESHOLD = 492;
#define HONDA_GET_INTERCEPTOR(msg) (((GET_BYTE((msg), 0) << 8) + GET_BYTE((msg), 1) + (GET_BYTE((msg), 2) << 8) + GET_BYTE((msg), 3)) / 2U) // avg between 2 tracks
const LongitudinalLimits HONDA_BOSCH_LONG_LIMITS = { const LongitudinalLimits HONDA_BOSCH_LONG_LIMITS = {
.max_accel = 200, // accel is used for brakes .max_accel = 200, // accel is used for brakes
.min_accel = -350, .min_accel = -350,
@@ -12,6 +19,14 @@ const LongitudinalLimits HONDA_BOSCH_LONG_LIMITS = {
.inactive_gas = -30000, .inactive_gas = -30000,
}; };
const LongitudinalLimits HONDA_BOSCH_LONG_LIMITS_SPORT = {
.max_accel = 400, // accel is used for brakes
.min_accel = -350,
.max_gas = 2000,
.inactive_gas = -30000,
};
const LongitudinalLimits HONDA_NIDEC_LONG_LIMITS = { const LongitudinalLimits HONDA_NIDEC_LONG_LIMITS = {
.max_gas = 198, // 0xc6 .max_gas = 198, // 0xc6
.max_brake = 255, .max_brake = 255,
@@ -40,6 +55,11 @@ RxCheck honda_common_rx_checks[] = {
HONDA_COMMON_RX_CHECKS(0) HONDA_COMMON_RX_CHECKS(0)
}; };
RxCheck honda_common_interceptor_rx_checks[] = {
HONDA_COMMON_RX_CHECKS(0)
{.msg = {{0x201, 0, 6, .check_checksum = false, .max_counter = 15U, .frequency = 50U}, { 0 }, { 0 }}},
};
RxCheck honda_common_alt_brake_rx_checks[] = { RxCheck honda_common_alt_brake_rx_checks[] = {
HONDA_COMMON_RX_CHECKS(0) HONDA_COMMON_RX_CHECKS(0)
HONDA_ALT_BRAKE_ADDR_CHECK(0) HONDA_ALT_BRAKE_ADDR_CHECK(0)
@@ -50,6 +70,11 @@ RxCheck honda_nidec_alt_rx_checks[] = {
HONDA_COMMON_NO_SCM_FEEDBACK_RX_CHECKS(0) HONDA_COMMON_NO_SCM_FEEDBACK_RX_CHECKS(0)
}; };
RxCheck honda_nidec_alt_interceptor_rx_checks[] = {
HONDA_COMMON_NO_SCM_FEEDBACK_RX_CHECKS(0)
{.msg = {{0x201, 0, 6, .check_checksum = false, .max_counter = 15U, .frequency = 50U}, { 0 }, { 0 }}},
};
// Bosch has pt on bus 1, verified 0x1A6 does not exist // Bosch has pt on bus 1, verified 0x1A6 does not exist
RxCheck honda_bosch_rx_checks[] = { RxCheck honda_bosch_rx_checks[] = {
HONDA_COMMON_RX_CHECKS(1) HONDA_COMMON_RX_CHECKS(1)
@@ -64,6 +89,8 @@ const uint16_t HONDA_PARAM_ALT_BRAKE = 1;
const uint16_t HONDA_PARAM_BOSCH_LONG = 2; const uint16_t HONDA_PARAM_BOSCH_LONG = 2;
const uint16_t HONDA_PARAM_NIDEC_ALT = 4; const uint16_t HONDA_PARAM_NIDEC_ALT = 4;
const uint16_t HONDA_PARAM_RADARLESS = 8; const uint16_t HONDA_PARAM_RADARLESS = 8;
const uint16_t HONDA_PARAM_GAS_INTERCEPTOR = 16;
const uint16_t HONDA_PARAM_CLARITY = 32;
enum { enum {
HONDA_BTN_NONE = 0, HONDA_BTN_NONE = 0,
@@ -79,6 +106,7 @@ bool honda_alt_brake_msg = false;
bool honda_fwd_brake = false; bool honda_fwd_brake = false;
bool honda_bosch_long = false; bool honda_bosch_long = false;
bool honda_bosch_radarless = false; bool honda_bosch_radarless = false;
bool honda_clarity_brake_msg = false;
typedef enum {HONDA_NIDEC, HONDA_BOSCH} HondaHw; typedef enum {HONDA_NIDEC, HONDA_BOSCH} HondaHw;
HondaHw honda_hw = HONDA_NIDEC; HondaHw honda_hw = HONDA_NIDEC;
@@ -110,15 +138,26 @@ static uint32_t honda_compute_checksum(const CANPacket_t *to_push) {
} }
static uint8_t honda_get_counter(const CANPacket_t *to_push) { static uint8_t honda_get_counter(const CANPacket_t *to_push) {
int counter_byte = GET_LEN(to_push) - 1U; int addr = GET_ADDR(to_push);
return (GET_BYTE(to_push, counter_byte) >> 4U) & 0x3U;
uint8_t cnt = 0U;
if (addr == 0x201) {
// Signal: COUNTER_PEDAL
cnt = GET_BYTE(to_push, 4) & 0x0FU;
} else {
int counter_byte = GET_LEN(to_push) - 1U;
cnt = (GET_BYTE(to_push, counter_byte) >> 4U) & 0x3U;
}
return cnt;
} }
static void honda_rx_hook(const CANPacket_t *to_push) { static void honda_rx_hook(const CANPacket_t *to_push) {
const bool pcm_cruise = ((honda_hw == HONDA_BOSCH) && !honda_bosch_long) || (honda_hw == HONDA_NIDEC); const bool pcm_cruise = ((honda_hw == HONDA_BOSCH) && !honda_bosch_long) || \
((honda_hw == HONDA_NIDEC) && !enable_gas_interceptor);
int pt_bus = honda_get_pt_bus(); int pt_bus = honda_get_pt_bus();
int addr = GET_ADDR(to_push); int addr = GET_ADDR(to_push);
int len = GET_LEN(to_push);
int bus = GET_BUS(to_push); int bus = GET_BUS(to_push);
// sample speed // sample speed
@@ -190,8 +229,17 @@ static void honda_rx_hook(const CANPacket_t *to_push) {
} }
} }
if (addr == 0x17C) { // length check because bosch hardware also uses this id (0x201 w/ len = 8)
gas_pressed = GET_BYTE(to_push, 0) != 0U; if ((addr == 0x201) && (len == 6) && enable_gas_interceptor) {
int gas_interceptor = HONDA_GET_INTERCEPTOR(to_push);
gas_pressed = gas_interceptor > HONDA_GAS_INTERCEPTOR_THRESHOLD;
gas_interceptor_prev = gas_interceptor;
}
if (!enable_gas_interceptor) {
if (addr == 0x17C) {
gas_pressed = GET_BYTE(to_push, 0) != 0U;
}
} }
// disable stock Honda AEB in alternative experience // disable stock Honda AEB in alternative experience
@@ -200,6 +248,9 @@ static void honda_rx_hook(const CANPacket_t *to_push) {
bool honda_stock_aeb = GET_BIT(to_push, 29U); bool honda_stock_aeb = GET_BIT(to_push, 29U);
int honda_stock_brake = (GET_BYTE(to_push, 0) << 2) | (GET_BYTE(to_push, 1) >> 6); int honda_stock_brake = (GET_BYTE(to_push, 0) << 2) | (GET_BYTE(to_push, 1) >> 6);
if (honda_clarity_brake_msg) {
honda_stock_brake = (GET_BYTE(to_push, 6) << 2) + ((GET_BYTE(to_push, 7) >> 6) & 0x3U);
}
// Forward AEB when stock braking is higher than openpilot braking // Forward AEB when stock braking is higher than openpilot braking
// only stop forwarding when AEB event is over // only stop forwarding when AEB event is over
if (!honda_stock_aeb) { if (!honda_stock_aeb) {
@@ -233,6 +284,8 @@ static void honda_rx_hook(const CANPacket_t *to_push) {
} }
static bool honda_tx_hook(const CANPacket_t *to_send) { static bool honda_tx_hook(const CANPacket_t *to_send) {
sport_mode = alternative_experience & ALT_EXP_RAISE_LONGITUDINAL_LIMITS_TO_ISO_MAX;
bool tx = true; bool tx = true;
int addr = GET_ADDR(to_send); int addr = GET_ADDR(to_send);
int bus = GET_BUS(to_send); int bus = GET_BUS(to_send);
@@ -256,6 +309,9 @@ static bool honda_tx_hook(const CANPacket_t *to_send) {
// BRAKE: safety check (nidec) // BRAKE: safety check (nidec)
if ((addr == 0x1FA) && (bus == bus_pt)) { if ((addr == 0x1FA) && (bus == bus_pt)) {
honda_brake = (GET_BYTE(to_send, 0) << 2) + ((GET_BYTE(to_send, 1) >> 6) & 0x3U); honda_brake = (GET_BYTE(to_send, 0) << 2) + ((GET_BYTE(to_send, 1) >> 6) & 0x3U);
if (honda_clarity_brake_msg) {
honda_brake = (GET_BYTE(to_send, 6) << 2) + ((GET_BYTE(to_send, 7) >> 6) & 0x3U);
}
if (longitudinal_brake_checks(honda_brake, HONDA_NIDEC_LONG_LIMITS)) { if (longitudinal_brake_checks(honda_brake, HONDA_NIDEC_LONG_LIMITS)) {
tx = false; tx = false;
} }
@@ -273,8 +329,13 @@ static bool honda_tx_hook(const CANPacket_t *to_send) {
gas = to_signed(gas, 16); gas = to_signed(gas, 16);
bool violation = false; bool violation = false;
violation |= longitudinal_accel_checks(accel, HONDA_BOSCH_LONG_LIMITS); if (sport_mode) {
violation |= longitudinal_gas_checks(gas, HONDA_BOSCH_LONG_LIMITS); violation |= longitudinal_accel_checks(accel, HONDA_BOSCH_LONG_LIMITS_SPORT);
violation |= longitudinal_gas_checks(gas, HONDA_BOSCH_LONG_LIMITS_SPORT);
} else {
violation |= longitudinal_accel_checks(accel, HONDA_BOSCH_LONG_LIMITS);
violation |= longitudinal_gas_checks(gas, HONDA_BOSCH_LONG_LIMITS);
}
if (violation) { if (violation) {
tx = false; tx = false;
} }
@@ -286,7 +347,11 @@ static bool honda_tx_hook(const CANPacket_t *to_send) {
accel = to_signed(accel, 12); accel = to_signed(accel, 12);
bool violation = false; bool violation = false;
violation |= longitudinal_accel_checks(accel, HONDA_BOSCH_LONG_LIMITS); if (sport_mode) {
violation |= longitudinal_accel_checks(accel, HONDA_BOSCH_LONG_LIMITS_SPORT);
} else {
violation |= longitudinal_accel_checks(accel, HONDA_BOSCH_LONG_LIMITS);
}
if (violation) { if (violation) {
tx = false; tx = false;
} }
@@ -294,7 +359,8 @@ static bool honda_tx_hook(const CANPacket_t *to_send) {
// STEER: safety check // STEER: safety check
if ((addr == 0xE4) || (addr == 0x194)) { if ((addr == 0xE4) || (addr == 0x194)) {
if (!controls_allowed) { bool aol_allowed = acc_main_on && (alternative_experience & ALT_EXP_ALWAYS_ON_LATERAL);
if (!(controls_allowed || aol_allowed)) {
bool steer_applied = GET_BYTE(to_send, 0) | GET_BYTE(to_send, 1); bool steer_applied = GET_BYTE(to_send, 0) | GET_BYTE(to_send, 1);
if (steer_applied) { if (steer_applied) {
tx = false; tx = false;
@@ -309,6 +375,13 @@ static bool honda_tx_hook(const CANPacket_t *to_send) {
} }
} }
// GAS: safety check (interceptor)
if (addr == 0x200) {
if (longitudinal_interceptor_checks(to_send)) {
tx = false;
}
}
// FORCE CANCEL: safety check only relevant when spamming the cancel button in Bosch HW // FORCE CANCEL: safety check only relevant when spamming the cancel button in Bosch HW
// ensuring that only the cancel button press is sent (VAL 2) when controls are off. // ensuring that only the cancel button press is sent (VAL 2) when controls are off.
// This avoids unintended engagements while still allowing resume spam // This avoids unintended engagements while still allowing resume spam
@@ -336,18 +409,26 @@ static safety_config honda_nidec_init(uint16_t param) {
honda_alt_brake_msg = false; honda_alt_brake_msg = false;
honda_bosch_long = false; honda_bosch_long = false;
honda_bosch_radarless = false; honda_bosch_radarless = false;
enable_gas_interceptor = GET_FLAG(param, HONDA_PARAM_GAS_INTERCEPTOR);
honda_clarity_brake_msg = GET_FLAG(param, HONDA_PARAM_CLARITY);
safety_config ret; safety_config ret;
bool enable_nidec_alt = GET_FLAG(param, HONDA_PARAM_NIDEC_ALT); bool enable_nidec_alt = GET_FLAG(param, HONDA_PARAM_NIDEC_ALT);
if (enable_nidec_alt) { if (enable_nidec_alt) {
SET_RX_CHECKS(honda_nidec_alt_rx_checks, ret); enable_gas_interceptor ? SET_RX_CHECKS(honda_nidec_alt_interceptor_rx_checks, ret) : \
SET_RX_CHECKS(honda_nidec_alt_rx_checks, ret);
} else { } else {
SET_RX_CHECKS(honda_common_rx_checks, ret); enable_gas_interceptor ? SET_RX_CHECKS(honda_common_interceptor_rx_checks, ret) : \
SET_RX_CHECKS(honda_common_rx_checks, ret);
} }
SET_TX_MSGS(HONDA_N_TX_MSGS, ret);
if (enable_gas_interceptor) {
SET_TX_MSGS(HONDA_N_INTERCEPTOR_TX_MSGS, ret);
} else {
SET_TX_MSGS(HONDA_N_TX_MSGS, ret);
}
return ret; return ret;
} }
+14 -2
View File
@@ -25,6 +25,11 @@ const LongitudinalLimits HYUNDAI_LONG_LIMITS = {
.min_accel = -350, // 1/100 m/s2 .min_accel = -350, // 1/100 m/s2
}; };
const LongitudinalLimits HYUNDAI_LONG_LIMITS_SPORT = {
.max_accel = 400, // 1/100 m/s2
.min_accel = -350, // 1/100 m/s2
};
const CanMsg HYUNDAI_TX_MSGS[] = { const CanMsg HYUNDAI_TX_MSGS[] = {
{0x340, 0, 8}, // LKAS11 Bus 0 {0x340, 0, 8}, // LKAS11 Bus 0
{0x4F1, 0, 4}, // CLU11 Bus 0 {0x4F1, 0, 4}, // CLU11 Bus 0
@@ -215,6 +220,8 @@ static void hyundai_rx_hook(const CANPacket_t *to_push) {
} }
static bool hyundai_tx_hook(const CANPacket_t *to_send) { static bool hyundai_tx_hook(const CANPacket_t *to_send) {
sport_mode = alternative_experience & ALT_EXP_RAISE_LONGITUDINAL_LIMITS_TO_ISO_MAX;
bool tx = true; bool tx = true;
int addr = GET_ADDR(to_send); int addr = GET_ADDR(to_send);
@@ -239,8 +246,13 @@ static bool hyundai_tx_hook(const CANPacket_t *to_send) {
bool violation = false; bool violation = false;
violation |= longitudinal_accel_checks(desired_accel_raw, HYUNDAI_LONG_LIMITS); if (sport_mode) {
violation |= longitudinal_accel_checks(desired_accel_val, HYUNDAI_LONG_LIMITS); violation |= longitudinal_accel_checks(desired_accel_raw, HYUNDAI_LONG_LIMITS_SPORT);
violation |= longitudinal_accel_checks(desired_accel_val, HYUNDAI_LONG_LIMITS_SPORT);
} else {
violation |= longitudinal_accel_checks(desired_accel_raw, HYUNDAI_LONG_LIMITS);
violation |= longitudinal_accel_checks(desired_accel_val, HYUNDAI_LONG_LIMITS);
}
violation |= (aeb_decel_cmd != 0); violation |= (aeb_decel_cmd != 0);
violation |= aeb_req; violation |= aeb_req;
@@ -63,6 +63,13 @@ void hyundai_common_cruise_state_check(const bool cruise_engaged) {
} }
void hyundai_common_cruise_buttons_check(const int cruise_button, const bool main_button) { void hyundai_common_cruise_buttons_check(const int cruise_button, const bool main_button) {
if (main_button && main_button != cruise_main_prev) {
if (acc_main_on && (alternative_experience & ALT_EXP_ALWAYS_ON_LATERAL)) {
controls_allowed = false;
}
acc_main_on = !acc_main_on;
}
cruise_main_prev = main_button;
if ((cruise_button == HYUNDAI_BTN_RESUME) || (cruise_button == HYUNDAI_BTN_SET) || (cruise_button == HYUNDAI_BTN_CANCEL) || main_button) { if ((cruise_button == HYUNDAI_BTN_RESUME) || (cruise_button == HYUNDAI_BTN_SET) || (cruise_button == HYUNDAI_BTN_CANCEL) || main_button) {
hyundai_last_button_interaction = 0U; hyundai_last_button_interaction = 0U;
} else { } else {
+1
View File
@@ -52,6 +52,7 @@ static void mazda_rx_hook(const CANPacket_t *to_push) {
// enter controls on rising edge of ACC, exit controls on ACC off // enter controls on rising edge of ACC, exit controls on ACC off
if (addr == MAZDA_CRZ_CTRL) { if (addr == MAZDA_CRZ_CTRL) {
acc_main_on = GET_BIT(to_push, 17U);
bool cruise_engaged = GET_BYTE(to_push, 0) & 0x8U; bool cruise_engaged = GET_BYTE(to_push, 0) & 0x8U;
pcm_cruise_check(cruise_engaged); pcm_cruise_check(cruise_engaged);
} }
+5
View File
@@ -64,11 +64,16 @@ static void nissan_rx_hook(const CANPacket_t *to_push) {
UPDATE_VEHICLE_SPEED((right_rear + left_rear) / 2.0 * 0.005 / 3.6); UPDATE_VEHICLE_SPEED((right_rear + left_rear) / 2.0 * 0.005 / 3.6);
} }
if (addr == 0x1b6) {
acc_main_on = GET_BIT(to_push, 36U);
}
// X-Trail 0x15c, Leaf 0x239 // X-Trail 0x15c, Leaf 0x239
if ((addr == 0x15c) || (addr == 0x239)) { if ((addr == 0x15c) || (addr == 0x239)) {
if (addr == 0x15c){ if (addr == 0x15c){
gas_pressed = ((GET_BYTE(to_push, 5) << 2) | ((GET_BYTE(to_push, 6) >> 6) & 0x3U)) > 3U; gas_pressed = ((GET_BYTE(to_push, 5) << 2) | ((GET_BYTE(to_push, 6) >> 6) & 0x3U)) > 3U;
} else { } else {
acc_main_on = GET_BIT(to_push, 17U);
gas_pressed = GET_BYTE(to_push, 0) > 3U; gas_pressed = GET_BYTE(to_push, 0) > 3U;
} }
} }
+2 -1
View File
@@ -17,7 +17,7 @@
} }
const SteeringLimits SUBARU_STEERING_LIMITS = SUBARU_STEERING_LIMITS_GENERATOR(2047, 50, 70); const SteeringLimits SUBARU_STEERING_LIMITS = SUBARU_STEERING_LIMITS_GENERATOR(3071, 50, 70);
const SteeringLimits SUBARU_GEN2_STEERING_LIMITS = SUBARU_STEERING_LIMITS_GENERATOR(1000, 40, 40); const SteeringLimits SUBARU_GEN2_STEERING_LIMITS = SUBARU_STEERING_LIMITS_GENERATOR(1000, 40, 40);
@@ -152,6 +152,7 @@ static void subaru_rx_hook(const CANPacket_t *to_push) {
// enter controls on rising edge of ACC, exit controls on ACC off // enter controls on rising edge of ACC, exit controls on ACC off
if ((addr == MSG_SUBARU_CruiseControl) && (bus == alt_main_bus)) { if ((addr == MSG_SUBARU_CruiseControl) && (bus == alt_main_bus)) {
acc_main_on = GET_BIT(to_push, 40U);
bool cruise_engaged = GET_BIT(to_push, 41U); bool cruise_engaged = GET_BIT(to_push, 41U);
pcm_cruise_check(cruise_engaged); pcm_cruise_check(cruise_engaged);
} }
@@ -56,6 +56,7 @@ static void subaru_preglobal_rx_hook(const CANPacket_t *to_push) {
// enter controls on rising edge of ACC, exit controls on ACC off // enter controls on rising edge of ACC, exit controls on ACC off
if (addr == MSG_SUBARU_PG_CruiseControl) { if (addr == MSG_SUBARU_PG_CruiseControl) {
acc_main_on = GET_BIT(to_push, 48U);
bool cruise_engaged = GET_BIT(to_push, 49U); bool cruise_engaged = GET_BIT(to_push, 49U);
pcm_cruise_check(cruise_engaged); pcm_cruise_check(cruise_engaged);
} }
+8
View File
@@ -100,6 +100,14 @@ static void tesla_rx_hook(const CANPacket_t *to_push) {
if(addr == (tesla_powertrain ? 0x256 : 0x368)) { if(addr == (tesla_powertrain ? 0x256 : 0x368)) {
// Cruise state // Cruise state
int cruise_state = (GET_BYTE(to_push, 1) >> 4); int cruise_state = (GET_BYTE(to_push, 1) >> 4);
acc_main_on = (cruise_state == 1) || // STANDBY
(cruise_state == 2) || // ENABLED
(cruise_state == 3) || // STANDSTILL
(cruise_state == 4) || // OVERRIDE
(cruise_state == 6) || // PRE_FAULT
(cruise_state == 7); // PRE_CANCEL
bool cruise_engaged = (cruise_state == 2) || // ENABLED bool cruise_engaged = (cruise_state == 2) || // ENABLED
(cruise_state == 3) || // STANDSTILL (cruise_state == 3) || // STANDSTILL
(cruise_state == 4) || // OVERRIDE (cruise_state == 4) || // OVERRIDE
+135 -13
View File
@@ -37,9 +37,29 @@ const LongitudinalLimits TOYOTA_LONG_LIMITS = {
.min_accel = -3500, // -3.5 m/s2 .min_accel = -3500, // -3.5 m/s2
}; };
const LongitudinalLimits TOYOTA_LONG_LIMITS_SPORT = {
.max_accel = 4000, // 4.0 m/s2
.min_accel = -3500, // -3.5 m/s2
};
// panda interceptor threshold needs to be equivalent to openpilot threshold to avoid controls mismatches
// If thresholds are mismatched then it is possible for panda to see the gas fall and rise while openpilot is in the pre-enabled state
// Threshold calculated from DBC gains: round((((15 + 75.555) / 0.159375) + ((15 + 151.111) / 0.159375)) / 2) = 805
const int TOYOTA_GAS_INTERCEPTOR_THRSLD = 805;
#define TOYOTA_GET_INTERCEPTOR(msg) (((GET_BYTE((msg), 0) << 8) + GET_BYTE((msg), 1) + (GET_BYTE((msg), 2) << 8) + GET_BYTE((msg), 3)) / 2U) // avg between 2 tracks
// Stock longitudinal // Stock longitudinal
#define TOYOTA_COMMON_TX_MSGS \ #define TOYOTA_BASE_TX_MSGS \
{0x2E4, 0, 5}, {0x191, 0, 8}, {0x412, 0, 8}, {0x343, 0, 8}, {0x1D2, 0, 8}, /* LKAS + LTA + ACC & PCM cancel cmds */ \ {0x191, 0, 8}, {0x412, 0, 8}, {0x343, 0, 8}, {0x1D2, 0, 8}, /* LKAS + LTA + ACC & PCM cancel cmds */ \
{0x750, 0, 8}, /* white list 0x750 for Enhanced Diagnostic Request */ \
#define TOYOTA_COMMON_TX_MSGS \
TOYOTA_BASE_TX_MSGS \
{0x2E4, 0, 5}, \
#define TOYOTA_COMMON_SECOC_TX_MSGS \
TOYOTA_BASE_TX_MSGS \
{0x2E4, 0, 8}, {0x131, 0, 8}, \
#define TOYOTA_COMMON_LONG_TX_MSGS \ #define TOYOTA_COMMON_LONG_TX_MSGS \
TOYOTA_COMMON_TX_MSGS \ TOYOTA_COMMON_TX_MSGS \
@@ -47,31 +67,53 @@ const LongitudinalLimits TOYOTA_LONG_LIMITS = {
{0x128, 1, 6}, {0x141, 1, 4}, {0x160, 1, 8}, {0x161, 1, 7}, {0x470, 1, 4}, /* DSU bus 1 */ \ {0x128, 1, 6}, {0x141, 1, 4}, {0x160, 1, 8}, {0x161, 1, 7}, {0x470, 1, 4}, /* DSU bus 1 */ \
{0x411, 0, 8}, /* PCS_HUD */ \ {0x411, 0, 8}, /* PCS_HUD */ \
{0x750, 0, 8}, /* radar diagnostic address */ \ {0x750, 0, 8}, /* radar diagnostic address */ \
{0x1D3, 0, 8}, \
const CanMsg TOYOTA_TX_MSGS[] = { const CanMsg TOYOTA_TX_MSGS[] = {
TOYOTA_COMMON_TX_MSGS TOYOTA_COMMON_TX_MSGS
}; };
const CanMsg TOYOTA_SECOC_TX_MSGS[] = {
TOYOTA_COMMON_SECOC_TX_MSGS
};
const CanMsg TOYOTA_LONG_TX_MSGS[] = { const CanMsg TOYOTA_LONG_TX_MSGS[] = {
TOYOTA_COMMON_LONG_TX_MSGS TOYOTA_COMMON_LONG_TX_MSGS
}; };
const CanMsg TOYOTA_INTERCEPTOR_TX_MSGS[] = {
TOYOTA_COMMON_LONG_TX_MSGS
{0x200, 0, 6}, // gas interceptor
};
#define TOYOTA_COMMON_RX_CHECKS(lta) \ #define TOYOTA_COMMON_RX_CHECKS(lta) \
{.msg = {{ 0xaa, 0, 8, .check_checksum = false, .frequency = 83U}, { 0 }, { 0 }}}, \ {.msg = {{ 0xaa, 0, 8, .check_checksum = false, .frequency = 83U}, { 0 }, { 0 }}}, \
{.msg = {{0x260, 0, 8, .check_checksum = true, .quality_flag = (lta), .frequency = 50U}, { 0 }, { 0 }}}, \ {.msg = {{0x260, 0, 8, .check_checksum = true, .quality_flag = (lta), .frequency = 50U}, { 0 }, { 0 }}}, \
{.msg = {{0x1D2, 0, 8, .check_checksum = true, .frequency = 33U}, { 0 }, { 0 }}}, \ {.msg = {{0x1D2, 0, 8, .check_checksum = true, .frequency = 33U}, \
{.msg = {{0x224, 0, 8, .check_checksum = false, .frequency = 40U}, \ {0x176, 0, 8, .check_checksum = true, .frequency = 32U}, { 0 }}}, \
{0x226, 0, 8, .check_checksum = false, .frequency = 40U}, { 0 }}}, \ {.msg = {{0x101, 0, 8, .check_checksum = false, .frequency = 50U}, \
{0x224, 0, 8, .check_checksum = false, .frequency = 40U}, \
{0x226, 0, 8, .check_checksum = false, .frequency = 40U}}}, \
RxCheck toyota_lka_rx_checks[] = { RxCheck toyota_lka_rx_checks[] = {
TOYOTA_COMMON_RX_CHECKS(false) TOYOTA_COMMON_RX_CHECKS(false)
}; };
RxCheck toyota_lka_interceptor_rx_checks[] = {
TOYOTA_COMMON_RX_CHECKS(false)
{.msg = {{0x201, 0, 6, .check_checksum = false, .max_counter = 15U, .frequency = 50U}, { 0 }, { 0 }}},
};
// Check the quality flag for angle measurement when using LTA, since it's not set on TSS-P cars // Check the quality flag for angle measurement when using LTA, since it's not set on TSS-P cars
RxCheck toyota_lta_rx_checks[] = { RxCheck toyota_lta_rx_checks[] = {
TOYOTA_COMMON_RX_CHECKS(true) TOYOTA_COMMON_RX_CHECKS(true)
}; };
RxCheck toyota_lta_interceptor_rx_checks[] = {
TOYOTA_COMMON_RX_CHECKS(true)
{.msg = {{0x201, 0, 6, .check_checksum = false, .max_counter = 15U, .frequency = 50U}, { 0 }, { 0 }}},
};
// safety param flags // safety param flags
// first byte is for EPS factor, second is for flags // first byte is for EPS factor, second is for flags
const uint32_t TOYOTA_PARAM_OFFSET = 8U; const uint32_t TOYOTA_PARAM_OFFSET = 8U;
@@ -79,7 +121,9 @@ const uint32_t TOYOTA_EPS_FACTOR = (1UL << TOYOTA_PARAM_OFFSET) - 1U;
const uint32_t TOYOTA_PARAM_ALT_BRAKE = 1UL << TOYOTA_PARAM_OFFSET; const uint32_t TOYOTA_PARAM_ALT_BRAKE = 1UL << TOYOTA_PARAM_OFFSET;
const uint32_t TOYOTA_PARAM_STOCK_LONGITUDINAL = 2UL << TOYOTA_PARAM_OFFSET; const uint32_t TOYOTA_PARAM_STOCK_LONGITUDINAL = 2UL << TOYOTA_PARAM_OFFSET;
const uint32_t TOYOTA_PARAM_LTA = 4UL << TOYOTA_PARAM_OFFSET; const uint32_t TOYOTA_PARAM_LTA = 4UL << TOYOTA_PARAM_OFFSET;
const uint32_t TOYOTA_PARAM_GAS_INTERCEPTOR = 8UL << TOYOTA_PARAM_OFFSET;
bool toyota_secoc = false;
bool toyota_alt_brake = false; bool toyota_alt_brake = false;
bool toyota_stock_longitudinal = false; bool toyota_stock_longitudinal = false;
bool toyota_lta = false; bool toyota_lta = false;
@@ -100,6 +144,17 @@ static uint32_t toyota_get_checksum(const CANPacket_t *to_push) {
return (uint8_t)(GET_BYTE(to_push, checksum_byte)); return (uint8_t)(GET_BYTE(to_push, checksum_byte));
} }
static uint8_t toyota_get_counter(const CANPacket_t *to_push) {
int addr = GET_ADDR(to_push);
uint8_t cnt = 0U;
if (addr == 0x201) {
// Signal: COUNTER_PEDAL
cnt = GET_BYTE(to_push, 4) & 0x0FU;
}
return cnt;
}
static bool toyota_get_quality_flag_valid(const CANPacket_t *to_push) { static bool toyota_get_quality_flag_valid(const CANPacket_t *to_push) {
int addr = GET_ADDR(to_push); int addr = GET_ADDR(to_push);
@@ -144,6 +199,10 @@ static void toyota_rx_hook(const CANPacket_t *to_push) {
} }
} }
if (addr == 0x1D3) {
acc_main_on = GET_BIT(to_push, 15U);
}
// enter controls on rising edge of ACC, exit controls on ACC off // enter controls on rising edge of ACC, exit controls on ACC off
// exit controls on rising edge of gas press // exit controls on rising edge of gas press
if (addr == 0x1D2) { if (addr == 0x1D2) {
@@ -152,7 +211,9 @@ static void toyota_rx_hook(const CANPacket_t *to_push) {
pcm_cruise_check(cruise_engaged); pcm_cruise_check(cruise_engaged);
// sample gas pedal // sample gas pedal
gas_pressed = !GET_BIT(to_push, 4U); if (!enable_gas_interceptor) {
gas_pressed = !GET_BIT(to_push, 4U);
}
} }
// sample speed // sample speed
@@ -175,6 +236,15 @@ static void toyota_rx_hook(const CANPacket_t *to_push) {
brake_pressed = GET_BIT(to_push, bit); brake_pressed = GET_BIT(to_push, bit);
} }
// sample gas interceptor
if ((addr == 0x201) && enable_gas_interceptor) {
int gas_interceptor = TOYOTA_GET_INTERCEPTOR(to_push);
gas_pressed = gas_interceptor > TOYOTA_GAS_INTERCEPTOR_THRSLD;
// TODO: remove this, only left in for gas_interceptor_prev test
gas_interceptor_prev = gas_interceptor;
}
bool stock_ecu_detected = addr == 0x2E4; // STEERING_LKA bool stock_ecu_detected = addr == 0x2E4; // STEERING_LKA
if (!toyota_stock_longitudinal && (addr == 0x343)) { if (!toyota_stock_longitudinal && (addr == 0x343)) {
stock_ecu_detected = true; // ACC_CONTROL stock_ecu_detected = true; // ACC_CONTROL
@@ -184,19 +254,33 @@ static void toyota_rx_hook(const CANPacket_t *to_push) {
} }
static bool toyota_tx_hook(const CANPacket_t *to_send) { static bool toyota_tx_hook(const CANPacket_t *to_send) {
sport_mode = alternative_experience & ALT_EXP_RAISE_LONGITUDINAL_LIMITS_TO_ISO_MAX;
bool tx = true; bool tx = true;
int addr = GET_ADDR(to_send); int addr = GET_ADDR(to_send);
int bus = GET_BUS(to_send); int bus = GET_BUS(to_send);
// Check if msg is sent on BUS 0 // Check if msg is sent on BUS 0
if (bus == 0) { if (bus == 0) {
// GAS PEDAL: safety check
if (addr == 0x200) {
if (longitudinal_interceptor_checks(to_send)) {
tx = false;
}
}
// ACCEL: safety check on byte 1-2 // ACCEL: safety check on byte 1-2
if (addr == 0x343) { if (addr == 0x343) {
int desired_accel = (GET_BYTE(to_send, 0) << 8) | GET_BYTE(to_send, 1); int desired_accel = (GET_BYTE(to_send, 0) << 8) | GET_BYTE(to_send, 1);
desired_accel = to_signed(desired_accel, 16); desired_accel = to_signed(desired_accel, 16);
bool violation = false; bool violation = false;
violation |= longitudinal_accel_checks(desired_accel, TOYOTA_LONG_LIMITS); if (sport_mode) {
violation |= longitudinal_accel_checks(desired_accel, TOYOTA_LONG_LIMITS_SPORT);
} else {
violation |= longitudinal_accel_checks(desired_accel, TOYOTA_LONG_LIMITS);
}
// only ACC messages that cancel are allowed when openpilot is not controlling longitudinal // only ACC messages that cancel are allowed when openpilot is not controlling longitudinal
if (toyota_stock_longitudinal) { if (toyota_stock_longitudinal) {
@@ -223,7 +307,7 @@ static bool toyota_tx_hook(const CANPacket_t *to_send) {
} }
} }
// LTA angle steering check // STEERING_LTA angle steering check
if (addr == 0x191) { if (addr == 0x191) {
// check the STEER_REQUEST, STEER_REQUEST_2, TORQUE_WIND_DOWN, STEER_ANGLE_CMD signals // check the STEER_REQUEST, STEER_REQUEST_2, TORQUE_WIND_DOWN, STEER_ANGLE_CMD signals
bool lta_request = GET_BIT(to_send, 0U); bool lta_request = GET_BIT(to_send, 0U);
@@ -271,6 +355,18 @@ static bool toyota_tx_hook(const CANPacket_t *to_send) {
} }
} }
// STEERING_LTA_2 angle steering check (SecOC)
if (toyota_secoc && (addr == 0x131)) {
// SecOC cars block any form of LTA actuation for now
bool lta_request = GET_BIT(to_send, 3U); // STEERING_LTA_2.STEER_REQUEST
bool lta_request2 = GET_BIT(to_send, 0U); // STEERING_LTA_2.STEER_REQUEST_2
int lta_angle_msb = GET_BYTE(to_send, 2); // STEERING_LTA_2.STEER_ANGLE_CMD (MSB)
int lta_angle_lsb = GET_BYTE(to_send, 3); // STEERING_LTA_2.STEER_ANGLE_CMD (LSB)
bool actuation = lta_request || lta_request2 || (lta_angle_msb != 0) || (lta_angle_lsb != 0);
if (actuation) {
tx = false;
}
}
// STEER: safety check on bytes 2-3 // STEER: safety check on bytes 2-3
if (addr == 0x2E4) { if (addr == 0x2E4) {
int desired_torque = (GET_BYTE(to_send, 1) << 8) | GET_BYTE(to_send, 2); int desired_torque = (GET_BYTE(to_send, 1) << 8) | GET_BYTE(to_send, 2);
@@ -293,7 +389,9 @@ static bool toyota_tx_hook(const CANPacket_t *to_send) {
if (addr == 0x750) { if (addr == 0x750) {
// this address is sub-addressed. only allow tester present to radar (0xF) // this address is sub-addressed. only allow tester present to radar (0xF)
bool invalid_uds_msg = (GET_BYTES(to_send, 0, 4) != 0x003E020FU) || (GET_BYTES(to_send, 4, 4) != 0x0U); bool invalid_uds_msg = (GET_BYTES(to_send, 0, 4) != 0x003E020FU) || (GET_BYTES(to_send, 4, 4) != 0x0U);
if (invalid_uds_msg) { // AleSato added some more hack'sss
bool valid_uds_msgs = (GET_BYTES(to_send, 0, 4) == 0x11300540U); // automatic door locking and unlocking
if (invalid_uds_msg && !valid_uds_msgs) {
tx = 0; tx = 0;
} }
} }
@@ -302,20 +400,41 @@ static bool toyota_tx_hook(const CANPacket_t *to_send) {
} }
static safety_config toyota_init(uint16_t param) { static safety_config toyota_init(uint16_t param) {
#ifdef ALLOW_DEBUG
const uint32_t TOYOTA_PARAM_SECOC = 8UL << TOYOTA_PARAM_OFFSET;
toyota_secoc = GET_FLAG(param, TOYOTA_PARAM_SECOC);
#endif
toyota_alt_brake = GET_FLAG(param, TOYOTA_PARAM_ALT_BRAKE); toyota_alt_brake = GET_FLAG(param, TOYOTA_PARAM_ALT_BRAKE);
toyota_stock_longitudinal = GET_FLAG(param, TOYOTA_PARAM_STOCK_LONGITUDINAL); toyota_stock_longitudinal = GET_FLAG(param, TOYOTA_PARAM_STOCK_LONGITUDINAL);
toyota_lta = GET_FLAG(param, TOYOTA_PARAM_LTA); toyota_lta = GET_FLAG(param, TOYOTA_PARAM_LTA);
enable_gas_interceptor = GET_FLAG(param, TOYOTA_PARAM_GAS_INTERCEPTOR);
toyota_dbc_eps_torque_factor = param & TOYOTA_EPS_FACTOR; toyota_dbc_eps_torque_factor = param & TOYOTA_EPS_FACTOR;
// Gas interceptor should not be used if openpilot is not controlling longitudinal
if (toyota_stock_longitudinal) {
enable_gas_interceptor = false;
}
safety_config ret; safety_config ret;
if (toyota_stock_longitudinal) { if (toyota_stock_longitudinal) {
SET_TX_MSGS(TOYOTA_TX_MSGS, ret); if (toyota_secoc) {
SET_TX_MSGS(TOYOTA_SECOC_TX_MSGS, ret);
} else {
SET_TX_MSGS(TOYOTA_TX_MSGS, ret);
}
} else { } else {
SET_TX_MSGS(TOYOTA_LONG_TX_MSGS, ret); enable_gas_interceptor ? SET_TX_MSGS(TOYOTA_INTERCEPTOR_TX_MSGS, ret) : \
SET_TX_MSGS(TOYOTA_LONG_TX_MSGS, ret);
} }
toyota_lta ? SET_RX_CHECKS(toyota_lta_rx_checks, ret) : \ if (enable_gas_interceptor) {
SET_RX_CHECKS(toyota_lka_rx_checks, ret); toyota_lta ? SET_RX_CHECKS(toyota_lta_interceptor_rx_checks, ret) : \
SET_RX_CHECKS(toyota_lka_interceptor_rx_checks, ret);
} else {
toyota_lta ? SET_RX_CHECKS(toyota_lta_rx_checks, ret) : \
SET_RX_CHECKS(toyota_lka_rx_checks, ret);
}
return ret; return ret;
} }
@@ -331,6 +450,8 @@ static int toyota_fwd_hook(int bus_num, int addr) {
// block stock lkas messages and stock acc messages (if OP is doing ACC) // block stock lkas messages and stock acc messages (if OP is doing ACC)
// in TSS2, 0x191 is LTA which we need to block to avoid controls collision // in TSS2, 0x191 is LTA which we need to block to avoid controls collision
bool is_lkas_msg = ((addr == 0x2E4) || (addr == 0x412) || (addr == 0x191)); bool is_lkas_msg = ((addr == 0x2E4) || (addr == 0x412) || (addr == 0x191));
// on SecOC cars 0x131 is also LTA
is_lkas_msg |= toyota_secoc && (addr == 0x131);
// in TSS2 the camera does ACC as well, so filter 0x343 // in TSS2 the camera does ACC as well, so filter 0x343
bool is_acc_msg = (addr == 0x343); bool is_acc_msg = (addr == 0x343);
bool block_msg = is_lkas_msg || (is_acc_msg && !toyota_stock_longitudinal); bool block_msg = is_lkas_msg || (is_acc_msg && !toyota_stock_longitudinal);
@@ -349,5 +470,6 @@ const safety_hooks toyota_hooks = {
.fwd = toyota_fwd_hook, .fwd = toyota_fwd_hook,
.get_checksum = toyota_get_checksum, .get_checksum = toyota_get_checksum,
.compute_checksum = toyota_compute_checksum, .compute_checksum = toyota_compute_checksum,
.get_counter = toyota_get_counter,
.get_quality_flag_valid = toyota_get_quality_flag_valid, .get_quality_flag_valid = toyota_get_quality_flag_valid,
}; };
+15 -1
View File
@@ -20,6 +20,12 @@ const LongitudinalLimits VOLKSWAGEN_MQB_LONG_LIMITS = {
.inactive_accel = 3010, // VW sends one increment above the max range when inactive .inactive_accel = 3010, // VW sends one increment above the max range when inactive
}; };
const LongitudinalLimits VOLKSWAGEN_MQB_LONG_LIMITS_SPORT = {
.max_accel = 4000,
.min_accel = -3500,
.inactive_accel = 3010, // VW sends one increment above the max range when inactive
};
#define MSG_ESP_19 0x0B2 // RX from ABS, for wheel speeds #define MSG_ESP_19 0x0B2 // RX from ABS, for wheel speeds
#define MSG_LH_EPS_03 0x09F // RX from EPS, for driver steering torque #define MSG_LH_EPS_03 0x09F // RX from EPS, for driver steering torque
#define MSG_ESP_05 0x106 // RX from ABS, for brake switch state #define MSG_ESP_05 0x106 // RX from ABS, for brake switch state
@@ -197,6 +203,8 @@ static void volkswagen_mqb_rx_hook(const CANPacket_t *to_push) {
} }
static bool volkswagen_mqb_tx_hook(const CANPacket_t *to_send) { static bool volkswagen_mqb_tx_hook(const CANPacket_t *to_send) {
sport_mode = alternative_experience & ALT_EXP_RAISE_LONGITUDINAL_LIMITS_TO_ISO_MAX;
int addr = GET_ADDR(to_send); int addr = GET_ADDR(to_send);
bool tx = true; bool tx = true;
@@ -234,7 +242,13 @@ static bool volkswagen_mqb_tx_hook(const CANPacket_t *to_send) {
desired_accel = (((GET_BYTE(to_send, 7) << 3) | ((GET_BYTE(to_send, 6) & 0xE0U) >> 5)) * 5U) - 7220U; desired_accel = (((GET_BYTE(to_send, 7) << 3) | ((GET_BYTE(to_send, 6) & 0xE0U) >> 5)) * 5U) - 7220U;
} }
violation |= longitudinal_accel_checks(desired_accel, VOLKSWAGEN_MQB_LONG_LIMITS); if (sport_mode) {
if (desired_accel != 0) {
violation |= longitudinal_accel_checks(desired_accel, VOLKSWAGEN_MQB_LONG_LIMITS_SPORT);
}
} else {
violation |= longitudinal_accel_checks(desired_accel, VOLKSWAGEN_MQB_LONG_LIMITS);
}
if (violation) { if (violation) {
tx = false; tx = false;
+16 -2
View File
@@ -20,6 +20,12 @@ const LongitudinalLimits VOLKSWAGEN_PQ_LONG_LIMITS = {
.inactive_accel = 3010, // VW sends one increment above the max range when inactive .inactive_accel = 3010, // VW sends one increment above the max range when inactive
}; };
const LongitudinalLimits VOLKSWAGEN_PQ_LONG_LIMITS_SPORT = {
.max_accel = 4000,
.min_accel = -3500,
.inactive_accel = 3010, // VW sends one increment above the max range when inactive
};
#define MSG_LENKHILFE_3 0x0D0 // RX from EPS, for steering angle and driver steering torque #define MSG_LENKHILFE_3 0x0D0 // RX from EPS, for steering angle and driver steering torque
#define MSG_HCA_1 0x0D2 // TX by OP, Heading Control Assist steering torque #define MSG_HCA_1 0x0D2 // TX by OP, Heading Control Assist steering torque
#define MSG_BREMSE_1 0x1A0 // RX from ABS, for ego speed #define MSG_BREMSE_1 0x1A0 // RX from ABS, for ego speed
@@ -170,6 +176,8 @@ static void volkswagen_pq_rx_hook(const CANPacket_t *to_push) {
} }
static bool volkswagen_pq_tx_hook(const CANPacket_t *to_send) { static bool volkswagen_pq_tx_hook(const CANPacket_t *to_send) {
sport_mode = alternative_experience & ALT_EXP_RAISE_LONGITUDINAL_LIMITS_TO_ISO_MAX;
int addr = GET_ADDR(to_send); int addr = GET_ADDR(to_send);
bool tx = true; bool tx = true;
@@ -198,8 +206,14 @@ static bool volkswagen_pq_tx_hook(const CANPacket_t *to_send) {
// Signal: ACC_System.ACS_Sollbeschl (acceleration in m/s2, scale 0.005, offset -7.22) // Signal: ACC_System.ACS_Sollbeschl (acceleration in m/s2, scale 0.005, offset -7.22)
int desired_accel = ((((GET_BYTE(to_send, 4) & 0x7U) << 8) | GET_BYTE(to_send, 3)) * 5U) - 7220U; int desired_accel = ((((GET_BYTE(to_send, 4) & 0x7U) << 8) | GET_BYTE(to_send, 3)) * 5U) - 7220U;
if (longitudinal_accel_checks(desired_accel, VOLKSWAGEN_PQ_LONG_LIMITS)) { if (sport_mode) {
tx = false; if (longitudinal_accel_checks(desired_accel, VOLKSWAGEN_PQ_LONG_LIMITS_SPORT)) {
tx = false;
}
} else {
if (longitudinal_accel_checks(desired_accel, VOLKSWAGEN_PQ_LONG_LIMITS)) {
tx = false;
}
} }
} }
+5
View File
@@ -220,10 +220,12 @@ bool brake_pressed_prev = false;
bool regen_braking = false; bool regen_braking = false;
bool regen_braking_prev = false; bool regen_braking_prev = false;
bool cruise_engaged_prev = false; bool cruise_engaged_prev = false;
bool sport_mode = false;
struct sample_t vehicle_speed; struct sample_t vehicle_speed;
bool vehicle_moving = false; bool vehicle_moving = false;
bool acc_main_on = false; // referred to as "ACC off" in ISO 15622:2018 bool acc_main_on = false; // referred to as "ACC off" in ISO 15622:2018
int cruise_button_prev = 0; int cruise_button_prev = 0;
int cruise_main_prev = 0;
bool safety_rx_checks_invalid = false; bool safety_rx_checks_invalid = false;
// for safety modes with torque steering control // for safety modes with torque steering control
@@ -269,3 +271,6 @@ int alternative_experience = 0;
uint32_t safety_mode_cnt = 0U; uint32_t safety_mode_cnt = 0U;
// allow 1s of transition timeout after relay changes state before assessing malfunctioning // allow 1s of transition timeout after relay changes state before assessing malfunctioning
const uint32_t RELAY_TRNS_TIMEOUT = 1U; const uint32_t RELAY_TRNS_TIMEOUT = 1U;
// Always on Lateral
#define ALT_EXP_ALWAYS_ON_LATERAL 32
+5
View File
@@ -111,6 +111,7 @@ class ALTERNATIVE_EXPERIENCE:
DISABLE_STOCK_AEB = 2 DISABLE_STOCK_AEB = 2
RAISE_LONGITUDINAL_LIMITS_TO_ISO_MAX = 8 RAISE_LONGITUDINAL_LIMITS_TO_ISO_MAX = 8
ALLOW_AEB = 16 ALLOW_AEB = 16
ALWAYS_ON_LATERAL = 32
class Panda: class Panda:
@@ -191,11 +192,14 @@ class Panda:
FLAG_TOYOTA_ALT_BRAKE = (1 << 8) FLAG_TOYOTA_ALT_BRAKE = (1 << 8)
FLAG_TOYOTA_STOCK_LONGITUDINAL = (2 << 8) FLAG_TOYOTA_STOCK_LONGITUDINAL = (2 << 8)
FLAG_TOYOTA_LTA = (4 << 8) FLAG_TOYOTA_LTA = (4 << 8)
FLAG_TOYOTA_GAS_INTERCEPTOR = (8 << 8)
FLAG_HONDA_ALT_BRAKE = 1 FLAG_HONDA_ALT_BRAKE = 1
FLAG_HONDA_BOSCH_LONG = 2 FLAG_HONDA_BOSCH_LONG = 2
FLAG_HONDA_NIDEC_ALT = 4 FLAG_HONDA_NIDEC_ALT = 4
FLAG_HONDA_RADARLESS = 8 FLAG_HONDA_RADARLESS = 8
FLAG_HONDA_GAS_INTERCEPTOR = 16
FLAG_HONDA_CLARITY = 32
FLAG_HYUNDAI_EV_GAS = 1 FLAG_HYUNDAI_EV_GAS = 1
FLAG_HYUNDAI_HYBRID_GAS = 2 FLAG_HYUNDAI_HYBRID_GAS = 2
@@ -205,6 +209,7 @@ class Panda:
FLAG_HYUNDAI_CANFD_ALT_BUTTONS = 32 FLAG_HYUNDAI_CANFD_ALT_BUTTONS = 32
FLAG_HYUNDAI_ALT_LIMITS = 64 FLAG_HYUNDAI_ALT_LIMITS = 64
FLAG_HYUNDAI_CANFD_HDA2_ALT_STEERING = 128 FLAG_HYUNDAI_CANFD_HDA2_ALT_STEERING = 128
FLAG_HYUNDAI_LFA_BTN = 256
FLAG_TESLA_POWERTRAIN = 1 FLAG_TESLA_POWERTRAIN = 1
FLAG_TESLA_LONG_CONTROL = 2 FLAG_TESLA_LONG_CONTROL = 2
+42
View File
@@ -350,6 +350,21 @@ class TestHondaNidecPcmSafety(HondaPcmEnableBase, TestHondaNidecSafetyBase):
pass pass
class TestHondaNidecGasInterceptorSafety(common.GasInterceptorSafetyTest, HondaButtonEnableBase, TestHondaNidecSafetyBase):
"""
Covers the Honda Nidec safety mode with a gas interceptor, switches to a button-enable car
"""
TX_MSGS = HONDA_N_COMMON_TX_MSGS + [[0x200, 0]]
INTERCEPTOR_THRESHOLD = 492
def setUp(self):
self.packer = CANPackerPanda("honda_civic_touring_2016_can_generated")
self.safety = libpanda_py.libpanda
self.safety.set_safety_hooks(Panda.SAFETY_HONDA_NIDEC, Panda.FLAG_HONDA_GAS_INTERCEPTOR)
self.safety.init_tests()
class TestHondaNidecPcmAltSafety(TestHondaNidecPcmSafety): class TestHondaNidecPcmAltSafety(TestHondaNidecPcmSafety):
""" """
Covers the Honda Nidec safety mode with alt SCM messages Covers the Honda Nidec safety mode with alt SCM messages
@@ -372,6 +387,33 @@ class TestHondaNidecPcmAltSafety(TestHondaNidecPcmSafety):
return self.packer.make_can_msg_panda("SCM_BUTTONS", bus, values) return self.packer.make_can_msg_panda("SCM_BUTTONS", bus, values)
class TestHondaNidecAltGasInterceptorSafety(common.GasInterceptorSafetyTest, HondaButtonEnableBase, TestHondaNidecSafetyBase):
"""
Covers the Honda Nidec safety mode with alt SCM messages and gas interceptor, switches to a button-enable car
"""
TX_MSGS = HONDA_N_COMMON_TX_MSGS + [[0x200, 0]]
INTERCEPTOR_THRESHOLD = 492
def setUp(self):
self.packer = CANPackerPanda("acura_ilx_2016_can_generated")
self.safety = libpanda_py.libpanda
self.safety.set_safety_hooks(Panda.SAFETY_HONDA_NIDEC, Panda.FLAG_HONDA_NIDEC_ALT | Panda.FLAG_HONDA_GAS_INTERCEPTOR)
self.safety.init_tests()
def _acc_state_msg(self, main_on):
values = {"MAIN_ON": main_on, "COUNTER": self.cnt_acc_state % 4}
self.__class__.cnt_acc_state += 1
return self.packer.make_can_msg_panda("SCM_BUTTONS", self.PT_BUS, values)
def _button_msg(self, buttons, main_on=False, bus=None):
bus = self.PT_BUS if bus is None else bus
values = {"CRUISE_BUTTONS": buttons, "MAIN_ON": main_on, "COUNTER": self.cnt_button % 4}
self.__class__.cnt_button += 1
return self.packer.make_can_msg_panda("SCM_BUTTONS", bus, values)
# ********************* Honda Bosch ********************** # ********************* Honda Bosch **********************
+39
View File
@@ -14,6 +14,7 @@ TOYOTA_COMMON_LONG_TX_MSGS = [[0x283, 0], [0x2E6, 0], [0x2E7, 0], [0x33E, 0], [0
[0x128, 1], [0x141, 1], [0x160, 1], [0x161, 1], [0x470, 1], # DSU bus 1 [0x128, 1], [0x141, 1], [0x160, 1], [0x161, 1], [0x470, 1], # DSU bus 1
[0x411, 0], # PCS_HUD [0x411, 0], # PCS_HUD
[0x750, 0]] # radar diagnostic address [0x750, 0]] # radar diagnostic address
GAS_INTERCEPTOR_TX_MSGS = [[0x200, 0]]
class TestToyotaSafetyBase(common.PandaCarSafetyTest, common.LongitudinalAccelSafetyTest): class TestToyotaSafetyBase(common.PandaCarSafetyTest, common.LongitudinalAccelSafetyTest):
@@ -126,6 +127,32 @@ class TestToyotaSafetyBase(common.PandaCarSafetyTest, common.LongitudinalAccelSa
self.assertFalse(self.safety.get_controls_allowed()) self.assertFalse(self.safety.get_controls_allowed())
class TestToyotaSafetyGasInterceptorBase(common.GasInterceptorSafetyTest, TestToyotaSafetyBase):
TX_MSGS = TOYOTA_COMMON_TX_MSGS + TOYOTA_COMMON_LONG_TX_MSGS + GAS_INTERCEPTOR_TX_MSGS
INTERCEPTOR_THRESHOLD = 805
def setUp(self):
super().setUp()
self.safety.set_safety_hooks(Panda.SAFETY_TOYOTA, self.safety.get_current_safety_param() |
Panda.FLAG_TOYOTA_GAS_INTERCEPTOR)
self.safety.init_tests()
def test_stock_longitudinal(self):
# If stock longitudinal is set, the gas interceptor safety param should not be respected
self.safety.set_safety_hooks(Panda.SAFETY_TOYOTA, self.safety.get_current_safety_param() |
Panda.FLAG_TOYOTA_STOCK_LONGITUDINAL)
self.safety.init_tests()
# Spot check a few gas interceptor tests: (1) reading interceptor,
# (2) behavior around interceptor, and (3) txing interceptor msgs
for test in (self.test_prev_gas_interceptor, self.test_disengage_on_gas_interceptor,
self.test_gas_interceptor_safety_check):
with self.subTest(test=test.__name__):
with self.assertRaises(AssertionError):
test()
class TestToyotaSafetyTorque(TestToyotaSafetyBase, common.MotorTorqueSteeringSafetyTest, common.SteerRequestCutSafetyTest): class TestToyotaSafetyTorque(TestToyotaSafetyBase, common.MotorTorqueSteeringSafetyTest, common.SteerRequestCutSafetyTest):
MAX_RATE_UP = 15 MAX_RATE_UP = 15
@@ -148,6 +175,10 @@ class TestToyotaSafetyTorque(TestToyotaSafetyBase, common.MotorTorqueSteeringSaf
self.safety.init_tests() self.safety.init_tests()
class TestToyotaSafetyTorqueGasInterceptor(TestToyotaSafetyGasInterceptorBase, TestToyotaSafetyTorque):
pass
class TestToyotaSafetyAngle(TestToyotaSafetyBase, common.AngleSteeringSafetyTest): class TestToyotaSafetyAngle(TestToyotaSafetyBase, common.AngleSteeringSafetyTest):
# Angle control limits # Angle control limits
@@ -261,6 +292,10 @@ class TestToyotaSafetyAngle(TestToyotaSafetyBase, common.AngleSteeringSafetyTest
self.assertEqual(self.safety.get_angle_meas_max(), 0) self.assertEqual(self.safety.get_angle_meas_max(), 0)
class TestToyotaSafetyAngleGasInterceptor(TestToyotaSafetyGasInterceptorBase, TestToyotaSafetyAngle):
pass
class TestToyotaAltBrakeSafety(TestToyotaSafetyTorque): class TestToyotaAltBrakeSafety(TestToyotaSafetyTorque):
def setUp(self): def setUp(self):
@@ -278,6 +313,10 @@ class TestToyotaAltBrakeSafety(TestToyotaSafetyTorque):
pass pass
class TestToyotaAltBrakeSafetyGasInterceptor(TestToyotaSafetyGasInterceptorBase, TestToyotaAltBrakeSafety):
pass
class TestToyotaStockLongitudinalBase(TestToyotaSafetyBase): class TestToyotaStockLongitudinalBase(TestToyotaSafetyBase):
TX_MSGS = TOYOTA_COMMON_TX_MSGS TX_MSGS = TOYOTA_COMMON_TX_MSGS
Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 69 KiB

+9
View File
@@ -1,4 +1,5 @@
# functions common among cars # functions common among cars
import logging
from collections import namedtuple from collections import namedtuple
from dataclasses import dataclass from dataclasses import dataclass
from enum import IntFlag, ReprEnum, EnumType from enum import IntFlag, ReprEnum, EnumType
@@ -11,6 +12,10 @@ from openpilot.common.numpy_fast import clip, interp
from openpilot.common.utils import Freezable from openpilot.common.utils import Freezable
from openpilot.selfdrive.car.docs_definitions import CarDocs from openpilot.selfdrive.car.docs_definitions import CarDocs
# set up logging
carlog = logging.getLogger('carlog')
carlog.setLevel(logging.INFO)
carlog.propagate = False
# kg of standard extra cargo to count for drive, gas, etc... # kg of standard extra cargo to count for drive, gas, etc...
STD_CARGO_KG = 136. STD_CARGO_KG = 136.
@@ -165,6 +170,10 @@ def common_fault_avoidance(fault_condition: bool, request: bool, above_limit_fra
return above_limit_frames, request return above_limit_frames, request
def rate_limit(new_value, last_value, dw_step, up_step):
return clip(new_value, last_value + dw_step, last_value + up_step)
def crc8_pedal(data): def crc8_pedal(data):
crc = 0xFF # standard init value crc = 0xFF # standard init value
poly = 0xD5 # standard crc8: x8+x7+x6+x4+x2+1 poly = 0xD5 # standard crc8: x8+x7+x6+x4+x2+1
+2 -3
View File
@@ -35,13 +35,12 @@ class CarController(CarControllerBase):
torque -= deadband torque -= deadband
return torque return torque
def update(self, CC, CS, now_nanos): def update(self, CC, CS, now_nanos, frogpilot_toggles):
torque_l = 0 torque_l = 0
torque_r = 0 torque_r = 0
llk_valid = len(CC.orientationNED) > 1 and len(CC.angularVelocity) > 1 if CC.enabled:
if CC.enabled and llk_valid:
# Read these from the joystick # Read these from the joystick
# TODO: this isn't acceleration, okay? # TODO: this isn't acceleration, okay?
speed_desired = CC.actuators.accel / 5. speed_desired = CC.actuators.accel / 5.
+4 -3
View File
@@ -1,4 +1,4 @@
from cereal import car from cereal import car, custom
from opendbc.can.parser import CANParser from opendbc.can.parser import CANParser
from openpilot.selfdrive.car.interfaces import CarStateBase from openpilot.selfdrive.car.interfaces import CarStateBase
from openpilot.selfdrive.car.body.values import DBC from openpilot.selfdrive.car.body.values import DBC
@@ -6,8 +6,9 @@ from openpilot.selfdrive.car.body.values import DBC
STARTUP_TICKS = 100 STARTUP_TICKS = 100
class CarState(CarStateBase): class CarState(CarStateBase):
def update(self, cp): def update(self, cp, frogpilot_toggles):
ret = car.CarState.new_message() ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()
ret.wheelSpeeds.fl = cp.vl['MOTORS_DATA']['SPEED_L'] ret.wheelSpeeds.fl = cp.vl['MOTORS_DATA']['SPEED_L']
ret.wheelSpeeds.fr = cp.vl['MOTORS_DATA']['SPEED_R'] ret.wheelSpeeds.fr = cp.vl['MOTORS_DATA']['SPEED_R']
@@ -28,7 +29,7 @@ class CarState(CarStateBase):
ret.cruiseState.enabled = True ret.cruiseState.enabled = True
ret.cruiseState.available = True ret.cruiseState.available = True
return ret return ret, fp_ret
@staticmethod @staticmethod
def get_can_parser(CP): def get_can_parser(CP):
+4 -4
View File
@@ -7,7 +7,7 @@ from openpilot.selfdrive.car.body.values import SPEED_FROM_RPM
class CarInterface(CarInterfaceBase): class CarInterface(CarInterfaceBase):
@staticmethod @staticmethod
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): def _get_params(ret, candidate, fingerprint, car_fw, disable_openpilot_long, experimental_long, docs):
ret.notCar = True ret.notCar = True
ret.carName = "body" ret.carName = "body"
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.body)] ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.body)]
@@ -25,8 +25,8 @@ class CarInterface(CarInterfaceBase):
return ret return ret
def _update(self, c): def _update(self, c, frogpilot_toggles):
ret = self.CS.update(self.cp) ret, fp_ret = self.CS.update(self.cp, frogpilot_toggles)
# wait for everything to init first # wait for everything to init first
if self.frame > int(5. / DT_CTRL): if self.frame > int(5. / DT_CTRL):
@@ -36,4 +36,4 @@ class CarInterface(CarInterfaceBase):
ret.events[0].enable = True ret.events[0].enable = True
self.frame += 1 self.frame += 1
return ret return ret, fp_ret
+17 -10
View File
@@ -12,7 +12,6 @@ from openpilot.selfdrive.car.mock.values import CAR as MOCK
from openpilot.common.swaglog import cloudlog from openpilot.common.swaglog import cloudlog
import cereal.messaging as messaging import cereal.messaging as messaging
from openpilot.selfdrive.car import gen_empty_fingerprint from openpilot.selfdrive.car import gen_empty_fingerprint
from openpilot.system.version import get_build_metadata
FRAME_FINGERPRINT = 100 # 1s FRAME_FINGERPRINT = 100 # 1s
@@ -20,11 +19,7 @@ EventName = car.CarEvent.EventName
def get_startup_event(car_recognized, controller_available, fw_seen): def get_startup_event(car_recognized, controller_available, fw_seen):
build_metadata = get_build_metadata() event = EventName.customStartupAlert
if build_metadata.openpilot.comma_remote and build_metadata.tested_channel:
event = EventName.startup
else:
event = EventName.startupMaster
if not car_recognized: if not car_recognized:
if fw_seen: if fw_seen:
@@ -190,15 +185,27 @@ def get_car_interface(CP):
return CarInterface(CP, CarController, CarState) return CarInterface(CP, CarController, CarState)
def get_car(logcan, sendcan, experimental_long_allowed, num_pandas=1): def get_car(logcan, sendcan, disable_openpilot_long, experimental_long_allowed, params, num_pandas=1, frogpilot_toggles=None):
car_model = params.get("CarModel", encoding='utf-8')
force_fingerprint = params.get_bool("ForceFingerprint")
candidate, fingerprints, vin, car_fw, source, exact_match = fingerprint(logcan, sendcan, num_pandas) candidate, fingerprints, vin, car_fw, source, exact_match = fingerprint(logcan, sendcan, num_pandas)
if candidate is None: if candidate is None or force_fingerprint:
cloudlog.event("car doesn't match any fingerprints", fingerprints=repr(fingerprints), error=True) if car_model is not None:
candidate = car_model
else:
cloudlog.event("car doesn't match any fingerprints", fingerprints=repr(fingerprints), error=True)
candidate = "MOCK"
else:
params.put_nonblocking("CarMake", candidate.split('_')[0].title())
params.put_nonblocking("CarModel", candidate)
if frogpilot_toggles.block_user:
candidate = "MOCK" candidate = "MOCK"
CarInterface, _, _ = interfaces[candidate] CarInterface, _, _ = interfaces[candidate]
CP = CarInterface.get_params(candidate, fingerprints, car_fw, experimental_long_allowed, docs=False) CP = CarInterface.get_params(candidate, fingerprints, car_fw, disable_openpilot_long, experimental_long_allowed, params, docs=False)
CP.carVin = vin CP.carVin = vin
CP.carFw = car_fw CP.carFw = car_fw
CP.fingerprintSource = source CP.fingerprintSource = source
+51 -14
View File
@@ -4,18 +4,21 @@ import time
import cereal.messaging as messaging import cereal.messaging as messaging
from cereal import car from cereal import car, custom
from panda import ALTERNATIVE_EXPERIENCE from panda import ALTERNATIVE_EXPERIENCE
from openpilot.common.params import Params from openpilot.common.params import Params
from openpilot.common.realtime import config_realtime_process, Priority, Ratekeeper, DT_CTRL from openpilot.common.realtime import config_realtime_process, Priority, Ratekeeper, DT_CTRL
from openpilot.common.swaglog import cloudlog
from openpilot.selfdrive.pandad import can_list_to_can_capnp from openpilot.selfdrive.pandad import can_list_to_can_capnp
from openpilot.selfdrive.car.car_helpers import get_car, get_one_can from openpilot.selfdrive.car.car_helpers import get_car, get_one_can
from openpilot.selfdrive.car.interfaces import CarInterfaceBase from openpilot.selfdrive.car.interfaces import CarInterfaceBase
from openpilot.selfdrive.controls.lib.events import Events from openpilot.selfdrive.controls.lib.events import Events
from openpilot.selfdrive.frogpilot.frogpilot_variables import get_frogpilot_toggles, update_frogpilot_toggles
REPLAY = "REPLAY" in os.environ REPLAY = "REPLAY" in os.environ
EventName = car.CarEvent.EventName EventName = car.CarEvent.EventName
@@ -26,8 +29,8 @@ class Car:
def __init__(self, CI=None): def __init__(self, CI=None):
self.can_sock = messaging.sub_sock('can', timeout=20) self.can_sock = messaging.sub_sock('can', timeout=20)
self.sm = messaging.SubMaster(['pandaStates', 'carControl', 'onroadEvents']) self.sm = messaging.SubMaster(['pandaStates', 'carControl', 'onroadEvents', 'frogpilotPlan'])
self.pm = messaging.PubMaster(['sendcan', 'carState', 'carParams', 'carOutput']) self.pm = messaging.PubMaster(['sendcan', 'carState', 'carParams', 'carOutput', 'frogpilotCarState'])
self.can_rcv_cum_timeout_counter = 0 self.can_rcv_cum_timeout_counter = 0
@@ -45,8 +48,9 @@ class Car:
get_one_can(self.can_sock) get_one_can(self.can_sock)
num_pandas = len(messaging.recv_one_retry(self.sm.sock['pandaStates']).pandaStates) num_pandas = len(messaging.recv_one_retry(self.sm.sock['pandaStates']).pandaStates)
disable_openpilot_long = self.params.get_bool("DisableOpenpilotLongitudinal")
experimental_long_allowed = self.params.get_bool("ExperimentalLongitudinalEnabled") experimental_long_allowed = self.params.get_bool("ExperimentalLongitudinalEnabled")
self.CI, self.CP = get_car(self.can_sock, self.pm.sock['sendcan'], experimental_long_allowed, num_pandas) self.CI, self.CP = get_car(self.can_sock, self.pm.sock['sendcan'], disable_openpilot_long, experimental_long_allowed, self.params, num_pandas, get_frogpilot_toggles())
else: else:
self.CI, self.CP = CI, CI.CP self.CI, self.CP = CI, CI.CP
@@ -66,28 +70,52 @@ class Car:
safety_config.safetyModel = car.CarParams.SafetyModel.noOutput safety_config.safetyModel = car.CarParams.SafetyModel.noOutput
self.CP.safetyConfigs = [safety_config] self.CP.safetyConfigs = [safety_config]
if self.CP.secOcRequired and not self.params.get_bool("IsReleaseBranch"):
secoc_key = self.params.get("SecOCKey", encoding='utf8')
if secoc_key is not None:
saved_secoc_key = bytes.fromhex(secoc_key.strip())
if len(saved_secoc_key) == 16:
self.CP.secOcKeyAvailable = True
self.CI.CS.secoc_key = saved_secoc_key
if controller_available:
self.CI.CC.secoc_key = saved_secoc_key
else:
cloudlog.warning("Saved SecOC key is invalid")
# Write previous route's CarParams # Write previous route's CarParams
prev_cp = self.params.get("CarParamsPersistent") prev_cp = self.params.get("CarParamsPersistent")
if prev_cp is not None: if prev_cp is not None:
self.params.put("CarParamsPrevRoute", prev_cp) self.params.put("CarParamsPrevRoute", prev_cp)
self.events = Events()
# card is driven by can recv, expected at 100Hz
self.rk = Ratekeeper(100, print_delay_threshold=None)
# FrogPilot variables
self.frogpilot_toggles = get_frogpilot_toggles()
if self.frogpilot_toggles.acceleration_profile == 3:
self.CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.RAISE_LONGITUDINAL_LIMITS_TO_ISO_MAX
if self.frogpilot_toggles.always_on_lateral:
self.CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.ALWAYS_ON_LATERAL
self.CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.DISABLE_DISENGAGE_ON_GAS
# Write CarParams for controls and radard # Write CarParams for controls and radard
cp_bytes = self.CP.to_bytes() cp_bytes = self.CP.to_bytes()
self.params.put("CarParams", cp_bytes) self.params.put("CarParams", cp_bytes)
self.params.put_nonblocking("CarParamsCache", cp_bytes) self.params.put_nonblocking("CarParamsCache", cp_bytes)
self.params.put_nonblocking("CarParamsPersistent", cp_bytes) self.params.put_nonblocking("CarParamsPersistent", cp_bytes)
self.events = Events() update_frogpilot_toggles()
# card is driven by can recv, expected at 100Hz
self.rk = Ratekeeper(100, print_delay_threshold=None)
def state_update(self) -> car.CarState: def state_update(self) -> car.CarState:
"""carState update loop, driven by can""" """carState update loop, driven by can"""
# Update carState from CAN # Update carState from CAN
can_strs = messaging.drain_sock_raw(self.can_sock, wait_for_one=True) can_strs = messaging.drain_sock_raw(self.can_sock, wait_for_one=True)
CS = self.CI.update(self.CC_prev, can_strs) CS, FPCS = self.CI.update(self.CC_prev, can_strs, self.frogpilot_toggles)
self.sm.update(0) self.sm.update(0)
@@ -100,7 +128,7 @@ class Car:
if can_rcv_valid and REPLAY: if can_rcv_valid and REPLAY:
self.can_log_mono_time = messaging.log_from_bytes(can_strs[0]).logMonoTime self.can_log_mono_time = messaging.log_from_bytes(can_strs[0]).logMonoTime
return CS return CS, FPCS
def update_events(self, CS: car.CarState) -> car.CarState: def update_events(self, CS: car.CarState) -> car.CarState:
self.events.clear() self.events.clear()
@@ -115,7 +143,7 @@ class Car:
CS.events = self.events.to_msg() CS.events = self.events.to_msg()
def state_publish(self, CS: car.CarState): def state_publish(self, CS: car.CarState, FPCS: custom.FrogPilotCarState):
"""carState and carParams publish loop""" """carState and carParams publish loop"""
# carParams - logged every 50 seconds (> 1 per segment) # carParams - logged every 50 seconds (> 1 per segment)
@@ -139,6 +167,12 @@ class Car:
cs_send.carState.cumLagMs = -self.rk.remaining * 1000. cs_send.carState.cumLagMs = -self.rk.remaining * 1000.
self.pm.send('carState', cs_send) self.pm.send('carState', cs_send)
# frogpilotCarState
fpcs_send = messaging.new_message('frogpilotCarState')
fpcs_send.valid = CS.canValid
fpcs_send.frogpilotCarState = FPCS
self.pm.send('frogpilotCarState', fpcs_send)
def controls_update(self, CS: car.CarState, CC: car.CarControl): def controls_update(self, CS: car.CarState, CC: car.CarControl):
"""control update loop, driven by carControl""" """control update loop, driven by carControl"""
@@ -152,17 +186,17 @@ class Car:
if self.sm.all_alive(['carControl']): if self.sm.all_alive(['carControl']):
# send car controls over can # send car controls over can
now_nanos = self.can_log_mono_time if REPLAY else int(time.monotonic() * 1e9) now_nanos = self.can_log_mono_time if REPLAY else int(time.monotonic() * 1e9)
self.last_actuators_output, can_sends = self.CI.apply(CC, now_nanos) self.last_actuators_output, can_sends = self.CI.apply(CC, now_nanos, self.frogpilot_toggles)
self.pm.send('sendcan', can_list_to_can_capnp(can_sends, msgtype='sendcan', valid=CS.canValid)) self.pm.send('sendcan', can_list_to_can_capnp(can_sends, msgtype='sendcan', valid=CS.canValid))
self.CC_prev = CC self.CC_prev = CC
def step(self): def step(self):
CS = self.state_update() CS, FPCS = self.state_update()
self.update_events(CS) self.update_events(CS)
self.state_publish(CS) self.state_publish(CS, FPCS)
initialized = (not any(e.name == EventName.controlsInitializing for e in self.sm['onroadEvents']) and initialized = (not any(e.name == EventName.controlsInitializing for e in self.sm['onroadEvents']) and
self.sm.seen['onroadEvents']) self.sm.seen['onroadEvents'])
@@ -177,6 +211,9 @@ class Car:
self.step() self.step()
self.rk.monitor_time() self.rk.monitor_time()
# Update FrogPilot parameters
if self.sm['frogpilotPlan'].togglesUpdated:
self.frogpilot_toggles = get_frogpilot_toggles()
def main(): def main():
config_realtime_process(4, Priority.CTRL_HIGH) config_realtime_process(4, Priority.CTRL_HIGH)
+11 -6
View File
@@ -2,7 +2,7 @@ from opendbc.can.packer import CANPacker
from openpilot.common.realtime import DT_CTRL from openpilot.common.realtime import DT_CTRL
from openpilot.selfdrive.car import apply_meas_steer_torque_limits from openpilot.selfdrive.car import apply_meas_steer_torque_limits
from openpilot.selfdrive.car.chrysler import chryslercan from openpilot.selfdrive.car.chrysler import chryslercan
from openpilot.selfdrive.car.chrysler.values import RAM_CARS, CarControllerParams, ChryslerFlags from openpilot.selfdrive.car.chrysler.values import RAM_CARS, RAM_DT, CarControllerParams, ChryslerFlags
from openpilot.selfdrive.car.interfaces import CarControllerBase from openpilot.selfdrive.car.interfaces import CarControllerBase
@@ -20,7 +20,7 @@ class CarController(CarControllerBase):
self.packer = CANPacker(dbc_name) self.packer = CANPacker(dbc_name)
self.params = CarControllerParams(CP) self.params = CarControllerParams(CP)
def update(self, CC, CS, now_nanos): def update(self, CC, CS, now_nanos, frogpilot_toggles):
can_sends = [] can_sends = []
lkas_active = CC.latActive and self.lkas_control_bit_prev lkas_active = CC.latActive and self.lkas_control_bit_prev
@@ -32,18 +32,18 @@ class CarController(CarControllerBase):
# ACC cancellation # ACC cancellation
if CC.cruiseControl.cancel: if CC.cruiseControl.cancel:
self.last_button_frame = self.frame self.last_button_frame = self.frame
can_sends.append(chryslercan.create_cruise_buttons(self.packer, CS.button_counter + 1, das_bus, cancel=True)) can_sends.append(chryslercan.create_cruise_buttons(self.packer, self.CP, CS.button_counter + 1, das_bus, cancel=True))
# ACC resume from standstill # ACC resume from standstill
elif CC.cruiseControl.resume: elif CC.cruiseControl.resume:
self.last_button_frame = self.frame self.last_button_frame = self.frame
can_sends.append(chryslercan.create_cruise_buttons(self.packer, CS.button_counter + 1, das_bus, resume=True)) can_sends.append(chryslercan.create_cruise_buttons(self.packer, self.CP, CS.button_counter + 1, das_bus, resume=True))
# HUD alerts # HUD alerts
if self.frame % 25 == 0: if self.frame % 25 == 0:
if CS.lkas_car_model != -1: if CS.lkas_car_model != -1:
can_sends.append(chryslercan.create_lkas_hud(self.packer, self.CP, lkas_active, CC.hudControl.visualAlert, can_sends.append(chryslercan.create_lkas_hud(self.packer, self.CP, lkas_active, CC.hudControl.visualAlert,
self.hud_count, CS.lkas_car_model, CS.auto_high_beam)) self.hud_count, CS.lkas_car_model, CS.auto_high_beam, CC.latActive))
self.hud_count += 1 self.hud_count += 1
# steering # steering
@@ -51,7 +51,12 @@ class CarController(CarControllerBase):
# TODO: can we make this more sane? why is it different for all the cars? # TODO: can we make this more sane? why is it different for all the cars?
lkas_control_bit = self.lkas_control_bit_prev lkas_control_bit = self.lkas_control_bit_prev
if CS.out.vEgo > self.CP.minSteerSpeed: if self.CP.carFingerprint in RAM_DT:
if self.CP.minEnableSpeed <= CS.out.vEgo <= self.CP.minEnableSpeed + 0.5:
lkas_control_bit = True
if (self.CP.minEnableSpeed >= 14.5) and (CS.out.gearShifter != 2):
lkas_control_bit = False
elif CS.out.vEgo > self.CP.minSteerSpeed:
lkas_control_bit = True lkas_control_bit = True
elif self.CP.flags & ChryslerFlags.HIGHER_MIN_STEERING_SPEED: elif self.CP.flags & ChryslerFlags.HIGHER_MIN_STEERING_SPEED:
if CS.out.vEgo < (self.CP.minSteerSpeed - 3.0): if CS.out.vEgo < (self.CP.minSteerSpeed - 3.0):
+22 -7
View File
@@ -1,9 +1,9 @@
from cereal import car from cereal import car, custom
from openpilot.common.conversions import Conversions as CV from openpilot.common.conversions import Conversions as CV
from opendbc.can.parser import CANParser from opendbc.can.parser import CANParser
from opendbc.can.can_define import CANDefine from opendbc.can.can_define import CANDefine
from openpilot.selfdrive.car.interfaces import CarStateBase from openpilot.selfdrive.car.interfaces import CarStateBase
from openpilot.selfdrive.car.chrysler.values import DBC, STEER_THRESHOLD, RAM_CARS from openpilot.selfdrive.car.chrysler.values import ChryslerFlags, DBC, STEER_THRESHOLD, RAM_CARS
class CarState(CarStateBase): class CarState(CarStateBase):
@@ -15,6 +15,7 @@ class CarState(CarStateBase):
self.auto_high_beam = 0 self.auto_high_beam = 0
self.button_counter = 0 self.button_counter = 0
self.lkas_car_model = -1 self.lkas_car_model = -1
self.button_message = "CRUISE_BUTTONS_ALT" if CP.flags & ChryslerFlags.RAM_HD_ALT_BUTTONS else "CRUISE_BUTTONS"
if CP.carFingerprint in RAM_CARS: if CP.carFingerprint in RAM_CARS:
self.shifter_values = can_define.dv["Transmission_Status"]["Gear_State"] self.shifter_values = can_define.dv["Transmission_Status"]["Gear_State"]
@@ -24,12 +25,13 @@ class CarState(CarStateBase):
self.prev_distance_button = 0 self.prev_distance_button = 0
self.distance_button = 0 self.distance_button = 0
def update(self, cp, cp_cam): def update(self, cp, cp_cam, frogpilot_toggles):
ret = car.CarState.new_message() ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()
self.prev_distance_button = self.distance_button self.prev_distance_button = self.distance_button
self.distance_button = cp.vl["CRUISE_BUTTONS"]["ACC_Distance_Dec"] self.distance_button = cp.vl[self.button_message]["ACC_Distance_Dec"]
# lock info # lock info
ret.doorOpen = any([cp.vl["BCM_1"]["DOOR_OPEN_FL"], ret.doorOpen = any([cp.vl["BCM_1"]["DOOR_OPEN_FL"],
@@ -99,9 +101,18 @@ class CarState(CarStateBase):
ret.rightBlindspot = cp.vl["BSM_1"]["RIGHT_STATUS"] == 1 ret.rightBlindspot = cp.vl["BSM_1"]["RIGHT_STATUS"] == 1
self.lkas_car_model = cp_cam.vl["DAS_6"]["CAR_MODEL"] self.lkas_car_model = cp_cam.vl["DAS_6"]["CAR_MODEL"]
self.button_counter = cp.vl["CRUISE_BUTTONS"]["COUNTER"] self.button_counter = cp.vl[self.button_message]["COUNTER"]
return ret # FrogPilot CarState functions
fp_ret.brakeLights = bool(cp.vl["ESP_1"]["BRAKE_PRESSED_ACC"])
self.lkas_previously_enabled = self.lkas_enabled
if self.CP.carFingerprint in RAM_CARS:
self.lkas_enabled = cp.vl["Center_Stack_2"]["LKAS_Button"] or cp.vl["Center_Stack_1"]["LKAS_Button"]
else:
self.lkas_enabled = cp.vl["TRACTION_BUTTON"]["TOGGLE_LKAS"] == 1
return ret, fp_ret
@staticmethod @staticmethod
def get_cruise_messages(): def get_cruise_messages():
@@ -113,6 +124,7 @@ class CarState(CarStateBase):
@staticmethod @staticmethod
def get_can_parser(CP): def get_can_parser(CP):
button_message = "CRUISE_BUTTONS_ALT" if CP.flags & ChryslerFlags.RAM_HD_ALT_BUTTONS else "CRUISE_BUTTONS"
messages = [ messages = [
# sig_address, frequency # sig_address, frequency
("ESP_1", 50), ("ESP_1", 50),
@@ -120,7 +132,7 @@ class CarState(CarStateBase):
("ESP_6", 50), ("ESP_6", 50),
("STEERING", 100), ("STEERING", 100),
("ECM_5", 50), ("ECM_5", 50),
("CRUISE_BUTTONS", 50), (button_message, 50),
("STEERING_LEVERS", 10), ("STEERING_LEVERS", 10),
("ORC_1", 2), ("ORC_1", 2),
("BCM_1", 1), ("BCM_1", 1),
@@ -134,11 +146,14 @@ class CarState(CarStateBase):
("ESP_8", 50), ("ESP_8", 50),
("EPS_3", 50), ("EPS_3", 50),
("Transmission_Status", 50), ("Transmission_Status", 50),
("Center_Stack_1", 1),
("Center_Stack_2", 1),
] ]
else: else:
messages += [ messages += [
("GEAR", 50), ("GEAR", 50),
("SPEED_1", 100), ("SPEED_1", 100),
("TRACTION_BUTTON", 1),
] ]
messages += CarState.get_cruise_messages() messages += CarState.get_cruise_messages()
+7 -5
View File
@@ -1,10 +1,10 @@
from cereal import car from cereal import car
from openpilot.selfdrive.car.chrysler.values import RAM_CARS from openpilot.selfdrive.car.chrysler.values import RAM_CARS, ChryslerFlags
GearShifter = car.CarState.GearShifter GearShifter = car.CarState.GearShifter
VisualAlert = car.CarControl.HUDControl.VisualAlert VisualAlert = car.CarControl.HUDControl.VisualAlert
def create_lkas_hud(packer, CP, lkas_active, hud_alert, hud_count, car_model, auto_high_beam): def create_lkas_hud(packer, CP, lkas_active, hud_alert, hud_count, car_model, auto_high_beam, lat_active):
# LKAS_HUD - Controls what lane-keeping icon is displayed # LKAS_HUD - Controls what lane-keeping icon is displayed
# == Color == # == Color ==
@@ -27,7 +27,7 @@ def create_lkas_hud(packer, CP, lkas_active, hud_alert, hud_count, car_model, au
# 7 Normal # 7 Normal
# 6 lane departure place hands on wheel # 6 lane departure place hands on wheel
color = 2 if lkas_active else 1 color = 2 if lkas_active else 1 if lat_active else 0
lines = 3 if lkas_active else 0 lines = 3 if lkas_active else 0
alerts = 7 if lkas_active else 0 alerts = 7 if lkas_active else 0
@@ -48,6 +48,7 @@ def create_lkas_hud(packer, CP, lkas_active, hud_alert, hud_count, car_model, au
if CP.carFingerprint in RAM_CARS: if CP.carFingerprint in RAM_CARS:
values['AUTO_HIGH_BEAM_ON'] = auto_high_beam values['AUTO_HIGH_BEAM_ON'] = auto_high_beam
values['LKAS_DISABLED'] = 0 if lat_active else 1
return packer.make_can_msg("DAS_6", 0, values) return packer.make_can_msg("DAS_6", 0, values)
@@ -62,10 +63,11 @@ def create_lkas_command(packer, CP, apply_steer, lkas_control_bit):
return packer.make_can_msg("LKAS_COMMAND", 0, values) return packer.make_can_msg("LKAS_COMMAND", 0, values)
def create_cruise_buttons(packer, frame, bus, cancel=False, resume=False): def create_cruise_buttons(packer, CP, frame, bus, cancel=False, resume=False):
values = { values = {
"ACC_Cancel": cancel, "ACC_Cancel": cancel,
"ACC_Resume": resume, "ACC_Resume": resume,
"COUNTER": frame % 0x10, "COUNTER": frame % 0x10,
} }
return packer.make_can_msg("CRUISE_BUTTONS", bus, values) button_message = "CRUISE_BUTTONS_ALT" if CP.flags & ChryslerFlags.RAM_HD_ALT_BUTTONS else "CRUISE_BUTTONS"
return packer.make_can_msg(button_message, bus, values)
+12
View File
@@ -535,6 +535,7 @@ FW_VERSIONS = {
b'05149848AC ', b'05149848AC ',
b'05190341AD', b'05190341AD',
b'68378695AJ ', b'68378695AJ ',
b'68378696AI ',
b'68378696AJ ', b'68378696AJ ',
b'68378701AI ', b'68378701AI ',
b'68378702AI ', b'68378702AI ',
@@ -591,6 +592,7 @@ FW_VERSIONS = {
b'68360081AM', b'68360081AM',
b'68360085AJ', b'68360085AJ',
b'68360085AL', b'68360085AL',
b'68360085AF',
b'68360086AH', b'68360086AH',
b'68360086AK', b'68360086AK',
b'68384328AD', b'68384328AD',
@@ -620,14 +622,21 @@ FW_VERSIONS = {
(Ecu.combinationMeter, 0x742, None): [ (Ecu.combinationMeter, 0x742, None): [
b'68361606AH', b'68361606AH',
b'68437735AC', b'68437735AC',
b'68437746AD',
b'68492682AD',
b'68525438AB',
b'68492693AD', b'68492693AD',
b'68525485AB', b'68525485AB',
b'68525487AB', b'68525487AB',
b'68525498AB', b'68525498AB',
b'68528791AF', b'68528791AF',
b'68620919AB',
b'68620921AC',
b'68620923AB',
b'68628474AB', b'68628474AB',
], ],
(Ecu.srs, 0x744, None): [ (Ecu.srs, 0x744, None): [
b'68346749AB',
b'68399794AC', b'68399794AC',
b'68428503AA', b'68428503AA',
b'68428505AA', b'68428505AA',
@@ -668,9 +677,12 @@ FW_VERSIONS = {
b'52401032AE', b'52401032AE',
b'52421132AF', b'52421132AF',
b'52421332AF', b'52421332AF',
b'52421332AG',
b'68527616AD ', b'68527616AD ',
b'M2370131MB', b'M2370131MB',
b'M2421132MB', b'M2421132MB',
b'52421232AF',
b'52421492AA',
], ],
}, },
CAR.DODGE_DURANGO: { CAR.DODGE_DURANGO: {
+30 -11
View File
@@ -1,18 +1,18 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from cereal import car from cereal import car, custom
from panda import Panda from panda import Panda
from openpilot.selfdrive.car import create_button_events, get_safety_config from openpilot.selfdrive.car import create_button_events, get_safety_config
from openpilot.selfdrive.car.chrysler.values import CAR, RAM_HD, RAM_DT, RAM_CARS, ChryslerFlags from openpilot.selfdrive.car.chrysler.values import CAR, RAM_HD, RAM_DT, RAM_CARS, ChryslerFlags
from openpilot.selfdrive.car.interfaces import CarInterfaceBase from openpilot.selfdrive.car.interfaces import CarInterfaceBase
ButtonType = car.CarState.ButtonEvent.Type ButtonType = car.CarState.ButtonEvent.Type
FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
class CarInterface(CarInterfaceBase): class CarInterface(CarInterfaceBase):
@staticmethod @staticmethod
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): def _get_params(ret, candidate, fingerprint, car_fw, disable_openpilot_long, experimental_long, docs):
ret.carName = "chrysler" ret.carName = "chrysler"
ret.dashcamOnly = candidate in RAM_HD
# radar parsing needs some work, see https://github.com/commaai/openpilot/issues/26842 # radar parsing needs some work, see https://github.com/commaai/openpilot/issues/26842
ret.radarUnavailable = True # DBC[candidate]['radar'] is None ret.radarUnavailable = True # DBC[candidate]['radar'] is None
@@ -55,14 +55,24 @@ class CarInterface(CarInterfaceBase):
elif candidate == CAR.RAM_1500_5TH_GEN: elif candidate == CAR.RAM_1500_5TH_GEN:
ret.steerActuatorDelay = 0.2 ret.steerActuatorDelay = 0.2
ret.wheelbase = 3.88 ret.wheelbase = 3.88
ret.minSteerSpeed = 0.5
ret.minEnableSpeed = 14.5
# Older EPS FW allow steer to zero # Older EPS FW allow steer to zero
if any(fw.ecu == 'eps' and b"68" < fw.fwVersion[:4] <= b"6831" for fw in car_fw): if any(fw.ecu == 'eps' and b"68" < fw.fwVersion[:4] <= b"6831" for fw in car_fw):
ret.minSteerSpeed = 0. ret.minSteerSpeed = 0.
elif candidate == CAR.RAM_HD_5TH_GEN: elif candidate == CAR.RAM_HD_5TH_GEN:
ret.steerActuatorDelay = 0.2 ret.steerActuatorDelay = 0.2
ret.wheelbase = 3.785
ret.steerRatio = 15.61
ret.mass = 3405.
ret.minSteerSpeed = 16
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning, 1.0, False) CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning, 1.0, False)
# Some RAM HD use Chrysler button address
if 570 not in fingerprint[0]:
ret.flags |= ChryslerFlags.RAM_HD_ALT_BUTTONS.value
else: else:
raise ValueError(f"Unsupported car: {candidate}") raise ValueError(f"Unsupported car: {candidate}")
@@ -76,22 +86,31 @@ class CarInterface(CarInterfaceBase):
return ret return ret
def _update(self, c): def _update(self, c, frogpilot_toggles):
ret = self.CS.update(self.cp, self.cp_cam) ret, fp_ret = self.CS.update(self.cp, self.cp_cam, frogpilot_toggles)
ret.buttonEvents = create_button_events(self.CS.distance_button, self.CS.prev_distance_button, {1: ButtonType.gapAdjustCruise}) ret.buttonEvents = [
*create_button_events(self.CS.distance_button, self.CS.prev_distance_button, {1: ButtonType.gapAdjustCruise}),
*create_button_events(self.CS.lkas_enabled, self.CS.lkas_previously_enabled, {1: FrogPilotButtonType.lkas}),
]
# events # events
events = self.create_common_events(ret, extra_gears=[car.CarState.GearShifter.low]) events = self.create_common_events(ret, extra_gears=[car.CarState.GearShifter.low])
# Low speed steer alert hysteresis logic # Low speed steer alert hysteresis logic
if self.CP.minSteerSpeed > 0. and ret.vEgo < (self.CP.minSteerSpeed + 0.5): if self.CP.carFingerprint in RAM_DT:
self.low_speed_alert = True if self.CS.out.vEgo >= self.CP.minEnableSpeed:
elif ret.vEgo > (self.CP.minSteerSpeed + 1.): self.low_speed_alert = False
self.low_speed_alert = False if (self.CP.minEnableSpeed >= 14.5) and (self.CS.out.gearShifter != car.CarState.GearShifter.drive):
self.low_speed_alert = True
else:
if self.CP.minSteerSpeed > 0. and ret.vEgo < (self.CP.minSteerSpeed + 0.5):
self.low_speed_alert = True
elif ret.vEgo > (self.CP.minSteerSpeed + 1.):
self.low_speed_alert = False
if self.low_speed_alert: if self.low_speed_alert:
events.add(car.CarEvent.EventName.belowSteerSpeed) events.add(car.CarEvent.EventName.belowSteerSpeed)
ret.events = events.to_msg() ret.events = events.to_msg()
return ret return ret, fp_ret
+2 -1
View File
@@ -13,6 +13,7 @@ Ecu = car.CarParams.Ecu
class ChryslerFlags(IntFlag): class ChryslerFlags(IntFlag):
# Detected flags # Detected flags
HIGHER_MIN_STEERING_SPEED = 1 HIGHER_MIN_STEERING_SPEED = 1
RAM_HD_ALT_BUTTONS = 2
@dataclass @dataclass
class ChryslerCarDocs(CarDocs): class ChryslerCarDocs(CarDocs):
@@ -100,7 +101,7 @@ class CarControllerParams:
elif CP.carFingerprint in RAM_DT: elif CP.carFingerprint in RAM_DT:
self.STEER_DELTA_UP = 6 self.STEER_DELTA_UP = 6
self.STEER_DELTA_DOWN = 6 self.STEER_DELTA_DOWN = 6
self.STEER_MAX = 261 # EPS allows more, up to 350? self.STEER_MAX = 350 # EPS allows more, up to 350?
else: else:
self.STEER_DELTA_UP = 3 self.STEER_DELTA_UP = 3
self.STEER_DELTA_DOWN = 3 self.STEER_DELTA_DOWN = 3
+14 -2
View File
@@ -7,6 +7,8 @@ from openpilot.selfdrive.car.ford.values import CarControllerParams, FordFlags
from openpilot.selfdrive.car.interfaces import CarControllerBase from openpilot.selfdrive.car.interfaces import CarControllerBase
from openpilot.selfdrive.controls.lib.drive_helpers import V_CRUISE_MAX from openpilot.selfdrive.controls.lib.drive_helpers import V_CRUISE_MAX
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_acceleration import get_max_allowed_accel
LongCtrlState = car.CarControl.Actuators.LongControlState LongCtrlState = car.CarControl.Actuators.LongControlState
VisualAlert = car.CarControl.HUDControl.VisualAlert VisualAlert = car.CarControl.HUDControl.VisualAlert
@@ -37,7 +39,7 @@ class CarController(CarControllerBase):
self.steer_alert_last = False self.steer_alert_last = False
self.lead_distance_bars_last = None self.lead_distance_bars_last = None
def update(self, CC, CS, now_nanos): def update(self, CC, CS, now_nanos, frogpilot_toggles):
can_sends = [] can_sends = []
actuators = CC.actuators actuators = CC.actuators
@@ -65,6 +67,13 @@ class CarController(CarControllerBase):
if CC.latActive: if CC.latActive:
# apply rate limits, curvature error limit, and clip to signal range # apply rate limits, curvature error limit, and clip to signal range
current_curvature = -CS.out.yawRate / max(CS.out.vEgoRaw, 0.1) current_curvature = -CS.out.yawRate / max(CS.out.vEgoRaw, 0.1)
# PFEIFER - FSH {{
# Ignore limits while overriding, this prevents pull when releasing the wheel. This will cause messages to be
# blocked by panda safety, usually while the driver is overriding and limited to at most 1 message while the
# driver is not overriding.
if CS.out.steeringPressed:
self.apply_curvature_last = actuators.curvature
# }} PFEIFER - FSH
apply_curvature = apply_ford_curvature_limits(actuators.curvature, self.apply_curvature_last, current_curvature, CS.out.vEgoRaw) apply_curvature = apply_ford_curvature_limits(actuators.curvature, self.apply_curvature_last, current_curvature, CS.out.vEgoRaw)
else: else:
apply_curvature = 0. apply_curvature = 0.
@@ -87,7 +96,10 @@ class CarController(CarControllerBase):
# send acc msg at 50Hz # send acc msg at 50Hz
if self.CP.openpilotLongitudinalControl and (self.frame % CarControllerParams.ACC_CONTROL_STEP) == 0: if self.CP.openpilotLongitudinalControl and (self.frame % CarControllerParams.ACC_CONTROL_STEP) == 0:
# Both gas and accel are in m/s^2, accel is used solely for braking # Both gas and accel are in m/s^2, accel is used solely for braking
accel = clip(actuators.accel, CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX) if frogpilot_toggles.sport_plus:
accel = clip(actuators.accel, CarControllerParams.ACCEL_MIN, min(frogpilot_toggles.max_desired_acceleration, get_max_allowed_accel(CS.out.vEgo)))
else:
accel = clip(actuators.accel, CarControllerParams.ACCEL_MIN, min(frogpilot_toggles.max_desired_acceleration, CarControllerParams.ACCEL_MAX))
gas = accel gas = accel
if not CC.longActive or gas < CarControllerParams.MIN_GAS: if not CC.longActive or gas < CarControllerParams.MIN_GAS:
gas = CarControllerParams.INACTIVE_GAS gas = CarControllerParams.INACTIVE_GAS
+8 -3
View File
@@ -1,4 +1,4 @@
from cereal import car from cereal import car, custom
from opendbc.can.can_define import CANDefine from opendbc.can.can_define import CANDefine
from opendbc.can.parser import CANParser from opendbc.can.parser import CANParser
from openpilot.common.conversions import Conversions as CV from openpilot.common.conversions import Conversions as CV
@@ -22,8 +22,9 @@ class CarState(CarStateBase):
self.prev_distance_button = 0 self.prev_distance_button = 0
self.distance_button = 0 self.distance_button = 0
def update(self, cp, cp_cam): def update(self, cp, cp_cam, frogpilot_toggles):
ret = car.CarState.new_message() ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()
# Occasionally on startup, the ABS module recalibrates the steering pinion offset, so we need to block engagement # Occasionally on startup, the ABS module recalibrates the steering pinion offset, so we need to block engagement
# The vehicle usually recovers out of this state within a minute of normal driving # The vehicle usually recovers out of this state within a minute of normal driving
@@ -107,7 +108,11 @@ class CarState(CarStateBase):
self.acc_tja_status_stock_values = cp_cam.vl["ACCDATA_3"] self.acc_tja_status_stock_values = cp_cam.vl["ACCDATA_3"]
self.lkas_status_stock_values = cp_cam.vl["IPMA_Data"] self.lkas_status_stock_values = cp_cam.vl["IPMA_Data"]
return ret # FrogPilot CarState functions
self.lkas_previously_enabled = self.lkas_enabled
self.lkas_enabled = ret.genericToggle
return ret, fp_ret
@staticmethod @staticmethod
def get_can_parser(CP): def get_can_parser(CP):
+11 -7
View File
@@ -1,4 +1,4 @@
from cereal import car from cereal import car, custom
from panda import Panda from panda import Panda
from openpilot.common.conversions import Conversions as CV from openpilot.common.conversions import Conversions as CV
from openpilot.selfdrive.car import create_button_events, get_safety_config from openpilot.selfdrive.car import create_button_events, get_safety_config
@@ -7,15 +7,16 @@ from openpilot.selfdrive.car.ford.values import Ecu, FordFlags
from openpilot.selfdrive.car.interfaces import CarInterfaceBase from openpilot.selfdrive.car.interfaces import CarInterfaceBase
ButtonType = car.CarState.ButtonEvent.Type ButtonType = car.CarState.ButtonEvent.Type
FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
TransmissionType = car.CarParams.TransmissionType TransmissionType = car.CarParams.TransmissionType
GearShifter = car.CarState.GearShifter GearShifter = car.CarState.GearShifter
class CarInterface(CarInterfaceBase): class CarInterface(CarInterfaceBase):
@staticmethod @staticmethod
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): def _get_params(ret, candidate, fingerprint, car_fw, disable_openpilot_long, experimental_long, docs):
ret.carName = "ford" ret.carName = "ford"
ret.dashcamOnly = bool(ret.flags & FordFlags.CANFD) ret.dashcamOnly = False
ret.radarUnavailable = True ret.radarUnavailable = True
ret.steerControlType = car.CarParams.SteerControlType.angle ret.steerControlType = car.CarParams.SteerControlType.angle
@@ -67,10 +68,13 @@ class CarInterface(CarInterfaceBase):
ret.centerToFront = ret.wheelbase * 0.44 ret.centerToFront = ret.wheelbase * 0.44
return ret return ret
def _update(self, c): def _update(self, c, frogpilot_toggles):
ret = self.CS.update(self.cp, self.cp_cam) ret, fp_ret = self.CS.update(self.cp, self.cp_cam, frogpilot_toggles)
ret.buttonEvents = create_button_events(self.CS.distance_button, self.CS.prev_distance_button, {1: ButtonType.gapAdjustCruise}) ret.buttonEvents = [
*create_button_events(self.CS.distance_button, self.CS.prev_distance_button, {1: ButtonType.gapAdjustCruise}),
*create_button_events(self.CS.lkas_enabled, self.CS.lkas_previously_enabled, {1: FrogPilotButtonType.lkas}),
]
events = self.create_common_events(ret, extra_gears=[GearShifter.manumatic]) events = self.create_common_events(ret, extra_gears=[GearShifter.manumatic])
if not self.CS.vehicle_sensors_valid: if not self.CS.vehicle_sensors_valid:
@@ -78,4 +82,4 @@ class CarInterface(CarInterfaceBase):
ret.events = events.to_msg() ret.events = events.to_msg()
return ret return ret, fp_ret
+43 -7
View File
@@ -1,13 +1,16 @@
from cereal import car from cereal import car
from openpilot.common.conversions import Conversions as CV from openpilot.common.conversions import Conversions as CV
from openpilot.common.filter_simple import FirstOrderFilter
from openpilot.common.numpy_fast import interp, clip from openpilot.common.numpy_fast import interp, clip
from openpilot.common.realtime import DT_CTRL from openpilot.common.realtime import DT_CTRL
from openpilot.common.params_pyx import Params from openpilot.common.params_pyx import Params
from opendbc.can.packer import CANPacker from opendbc.can.packer import CANPacker
from openpilot.selfdrive.car import apply_driver_steer_torque_limits, create_gas_interceptor_command from openpilot.selfdrive.car import apply_driver_steer_torque_limits, create_gas_interceptor_command
from openpilot.selfdrive.car.gm import gmcan from openpilot.selfdrive.car.gm import gmcan
from openpilot.selfdrive.car.gm.values import DBC, CanBus, CarControllerParams, CruiseButtons, GMFlags, CC_ONLY_CAR, SDGM_CAR, EV_CAR from openpilot.selfdrive.car.gm.values import DBC, CanBus, CarControllerParams, CruiseButtons, GMFlags, CC_ONLY_CAR, SDGM_CAR, EV_CAR, AccState
from openpilot.selfdrive.car.interfaces import CarControllerBase from openpilot.selfdrive.car.interfaces import CarControllerBase
from openpilot.selfdrive.controls.lib.drive_helpers import apply_deadzone
from openpilot.selfdrive.controls.lib.vehicle_model import ACCELERATION_DUE_TO_GRAVITY
VisualAlert = car.CarControl.HUDControl.VisualAlert VisualAlert = car.CarControl.HUDControl.VisualAlert
NetworkLocation = car.CarParams.NetworkLocation NetworkLocation = car.CarParams.NetworkLocation
@@ -20,6 +23,10 @@ CAMERA_CANCEL_DELAY_FRAMES = 10
# Enforce a minimum interval between steering messages to avoid a fault # Enforce a minimum interval between steering messages to avoid a fault
MIN_STEER_MSG_INTERVAL_MS = 15 MIN_STEER_MSG_INTERVAL_MS = 15
# Constants for pitch compensation
PITCH_DEADZONE = 0.01 # [radians] 0.01 ≈ 1% grade
BRAKE_PITCH_FACTOR_BP = [5., 10.] # [m/s] smoothly revert to planned accel at low speeds
BRAKE_PITCH_FACTOR_V = [0., 1.] # [unitless in [0,1]]; don't touch
class CarController(CarControllerBase): class CarController(CarControllerBase):
def __init__(self, dbc_name, CP, VM): def __init__(self, dbc_name, CP, VM):
@@ -45,6 +52,10 @@ class CarController(CarControllerBase):
self.packer_obj = CANPacker(DBC[self.CP.carFingerprint]['radar']) self.packer_obj = CANPacker(DBC[self.CP.carFingerprint]['radar'])
self.packer_ch = CANPacker(DBC[self.CP.carFingerprint]['chassis']) self.packer_ch = CANPacker(DBC[self.CP.carFingerprint]['chassis'])
# FrogPilot variables
self.pitch = FirstOrderFilter(0., 0.09 * 4, DT_CTRL * 4) # runs at 25 Hz
self.accel_g = 0.0
@staticmethod @staticmethod
def calc_pedal_command(accel: float, long_active: bool) -> float: def calc_pedal_command(accel: float, long_active: bool) -> float:
if not long_active: return 0. if not long_active: return 0.
@@ -60,8 +71,9 @@ class CarController(CarControllerBase):
return pedal_gas return pedal_gas
def update(self, CC, CS, now_nanos): def update(self, CC, CS, now_nanos, frogpilot_toggles):
actuators = CC.actuators actuators = CC.actuators
accel = brake_accel = actuators.accel
hud_control = CC.hudControl hud_control = CC.hudControl
hud_alert = hud_control.visualAlert hud_alert = hud_control.visualAlert
hud_v_cruise = hud_control.setSpeed hud_v_cruise = hud_control.setSpeed
@@ -108,6 +120,15 @@ class CarController(CarControllerBase):
# Gas/regen, brakes, and UI commands - all at 25Hz # Gas/regen, brakes, and UI commands - all at 25Hz
if self.frame % 4 == 0: if self.frame % 4 == 0:
stopping = actuators.longControlState == LongCtrlState.stopping stopping = actuators.longControlState == LongCtrlState.stopping
# Pitch compensated acceleration;
# TODO: include future pitch (sm['modelDataV2'].orientation.y) to account for long actuator delay
if frogpilot_toggles.long_pitch and len(CC.orientationNED) > 1:
self.pitch.update(CC.orientationNED[1])
self.accel_g = ACCELERATION_DUE_TO_GRAVITY * apply_deadzone(self.pitch.x, PITCH_DEADZONE) # driving uphill is positive pitch
accel += self.accel_g
brake_accel = actuators.accel + self.accel_g * interp(CS.out.vEgo, BRAKE_PITCH_FACTOR_BP, BRAKE_PITCH_FACTOR_V)
at_full_stop = CC.longActive and CS.out.standstill at_full_stop = CC.longActive and CS.out.standstill
near_stop = CC.longActive and (CS.out.vEgo < self.params.NEAR_STOP_BRAKE_PHASE) near_stop = CC.longActive and (CS.out.vEgo < self.params.NEAR_STOP_BRAKE_PHASE)
interceptor_gas_cmd = 0 interceptor_gas_cmd = 0
@@ -122,11 +143,17 @@ class CarController(CarControllerBase):
# Normal operation # Normal operation
if self.CP.carFingerprint in EV_CAR: if self.CP.carFingerprint in EV_CAR:
self.params.update_ev_gas_brake_threshold(CS.out.vEgo) self.params.update_ev_gas_brake_threshold(CS.out.vEgo)
self.apply_gas = int(round(interp(actuators.accel, self.params.EV_GAS_LOOKUP_BP, self.params.GAS_LOOKUP_V))) if frogpilot_toggles.sport_plus:
self.apply_brake = int(round(interp(actuators.accel, self.params.EV_BRAKE_LOOKUP_BP, self.params.BRAKE_LOOKUP_V))) self.apply_gas = int(round(interp(accel, self.params.EV_GAS_LOOKUP_BP_PLUS, self.params.GAS_LOOKUP_V_PLUS)))
else:
self.apply_gas = int(round(interp(accel, self.params.EV_GAS_LOOKUP_BP, self.params.GAS_LOOKUP_V)))
self.apply_brake = int(round(interp(brake_accel, self.params.EV_BRAKE_LOOKUP_BP, self.params.BRAKE_LOOKUP_V)))
else: else:
self.apply_gas = int(round(interp(actuators.accel, self.params.GAS_LOOKUP_BP, self.params.GAS_LOOKUP_V))) if frogpilot_toggles.sport_plus:
self.apply_brake = int(round(interp(actuators.accel, self.params.BRAKE_LOOKUP_BP, self.params.BRAKE_LOOKUP_V))) self.apply_gas = int(round(interp(accel, self.params.GAS_LOOKUP_BP_PLUS, self.params.GAS_LOOKUP_V_PLUS)))
else:
self.apply_gas = int(round(interp(accel, self.params.GAS_LOOKUP_BP, self.params.GAS_LOOKUP_V)))
self.apply_brake = int(round(interp(brake_accel, self.params.BRAKE_LOOKUP_BP, self.params.BRAKE_LOOKUP_V)))
# Don't allow any gas above inactive regen while stopping # Don't allow any gas above inactive regen while stopping
# FIXME: brakes aren't applied immediately when enabling at a stop # FIXME: brakes aren't applied immediately when enabling at a stop
if stopping: if stopping:
@@ -161,8 +188,13 @@ class CarController(CarControllerBase):
resume = actuators.longControlState != LongCtrlState.starting or CC.cruiseControl.resume resume = actuators.longControlState != LongCtrlState.starting or CC.cruiseControl.resume
at_full_stop = at_full_stop and not resume at_full_stop = at_full_stop and not resume
if CC.cruiseControl.resume and CS.pcm_acc_status == AccState.STANDSTILL and frogpilot_toggles.volt_sng:
acc_engaged = False
else:
acc_engaged = CC.enabled
# GasRegenCmdActive needs to be 1 to avoid cruise faults. It describes the ACC state, not actuation # GasRegenCmdActive needs to be 1 to avoid cruise faults. It describes the ACC state, not actuation
can_sends.append(gmcan.create_gas_regen_command(self.packer_pt, CanBus.POWERTRAIN, self.apply_gas, idx, CC.enabled, at_full_stop)) can_sends.append(gmcan.create_gas_regen_command(self.packer_pt, CanBus.POWERTRAIN, self.apply_gas, idx, acc_engaged, at_full_stop))
can_sends.append(gmcan.create_friction_brake_command(self.packer_ch, friction_brake_bus, self.apply_brake, can_sends.append(gmcan.create_friction_brake_command(self.packer_ch, friction_brake_bus, self.apply_brake,
idx, CC.enabled, near_stop, at_full_stop, self.CP)) idx, CC.enabled, near_stop, at_full_stop, self.CP))
@@ -170,6 +202,9 @@ class CarController(CarControllerBase):
send_fcw = hud_alert == VisualAlert.fcw send_fcw = hud_alert == VisualAlert.fcw
can_sends.append(gmcan.create_acc_dashboard_command(self.packer_pt, CanBus.POWERTRAIN, CC.enabled, can_sends.append(gmcan.create_acc_dashboard_command(self.packer_pt, CanBus.POWERTRAIN, CC.enabled,
hud_v_cruise * CV.MS_TO_KPH, hud_control, send_fcw)) hud_v_cruise * CV.MS_TO_KPH, hud_control, send_fcw))
else:
# to keep accel steady for logs when not sending gas
accel += self.accel_g
# Radar needs to know current speed and yaw rate (50hz), # Radar needs to know current speed and yaw rate (50hz),
# and that ADAS is alive (10hz) # and that ADAS is alive (10hz)
@@ -219,6 +254,7 @@ class CarController(CarControllerBase):
can_sends.append(gmcan.create_pscm_status(self.packer_pt, CanBus.CAMERA, CS.pscm_status)) can_sends.append(gmcan.create_pscm_status(self.packer_pt, CanBus.CAMERA, CS.pscm_status))
new_actuators = actuators.as_builder() new_actuators = actuators.as_builder()
new_actuators.accel = accel
new_actuators.steer = self.apply_steer_last / self.params.STEER_MAX new_actuators.steer = self.apply_steer_last / self.params.STEER_MAX
new_actuators.steerOutputCan = self.apply_steer_last new_actuators.steerOutputCan = self.apply_steer_last
new_actuators.gas = self.apply_gas new_actuators.gas = self.apply_gas
+20 -5
View File
@@ -1,5 +1,5 @@
import copy import copy
from cereal import car from cereal import car, custom
from openpilot.common.conversions import Conversions as CV from openpilot.common.conversions import Conversions as CV
from openpilot.common.numpy_fast import mean from openpilot.common.numpy_fast import mean
from opendbc.can.can_define import CANDefine from opendbc.can.can_define import CANDefine
@@ -33,8 +33,9 @@ class CarState(CarStateBase):
self.single_pedal_mode = False self.single_pedal_mode = False
self.pedal_steady = 0. self.pedal_steady = 0.
def update(self, pt_cp, cam_cp, loopback_cp): def update(self, pt_cp, cam_cp, loopback_cp, frogpilot_toggles):
ret = car.CarState.new_message() ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()
self.prev_cruise_buttons = self.cruise_buttons self.prev_cruise_buttons = self.cruise_buttons
self.prev_distance_button = self.distance_button self.prev_distance_button = self.distance_button
@@ -91,11 +92,11 @@ class CarState(CarStateBase):
# Regen braking is braking # Regen braking is braking
if self.CP.transmissionType == TransmissionType.direct: if self.CP.transmissionType == TransmissionType.direct:
ret.regenBraking = pt_cp.vl["EBCMRegenPaddle"]["RegenPaddle"] != 0 ret.regenBraking = pt_cp.vl["EBCMRegenPaddle"]["RegenPaddle"] != 0
self.single_pedal_mode = ret.gearShifter == GearShifter.low or pt_cp.vl["EVDriveMode"]["SinglePedalModeActive"] == 1 self.single_pedal_mode = ret.gearShifter == GearShifter.low or pt_cp.vl["EVDriveMode"]["SinglePedalModeActive"] == 1 or (ret.regenBraking and GearShifter.manumatic)
if self.CP.enableGasInterceptor: if self.CP.enableGasInterceptor:
ret.gas = (pt_cp.vl["GAS_SENSOR"]["INTERCEPTOR_GAS"] + pt_cp.vl["GAS_SENSOR"]["INTERCEPTOR_GAS2"]) / 2. ret.gas = (pt_cp.vl["GAS_SENSOR"]["INTERCEPTOR_GAS"] + pt_cp.vl["GAS_SENSOR"]["INTERCEPTOR_GAS2"]) / 2.
threshold = 15 if self.CP.carFingerprint in CAMERA_ACC_CAR else 4 threshold = 10 if self.CP.carFingerprint in CAMERA_ACC_CAR else 4 # Panda 515 threshold = 10.88. Set lower to avoid panda blocking messages and GasInterceptor faulting.
ret.gasPressed = ret.gas > threshold ret.gasPressed = ret.gas > threshold
else: else:
ret.gas = pt_cp.vl["AcceleratorPedal2"]["AcceleratorPedal2"] / 254. ret.gas = pt_cp.vl["AcceleratorPedal2"]["AcceleratorPedal2"] / 254.
@@ -168,7 +169,20 @@ class CarState(CarStateBase):
ret.leftBlindspot = cam_cp.vl["BCMBlindSpotMonitor"]["LeftBSM"] == 1 ret.leftBlindspot = cam_cp.vl["BCMBlindSpotMonitor"]["LeftBSM"] == 1
ret.rightBlindspot = cam_cp.vl["BCMBlindSpotMonitor"]["RightBSM"] == 1 ret.rightBlindspot = cam_cp.vl["BCMBlindSpotMonitor"]["RightBSM"] == 1
return ret # FrogPilot CarState functions
fp_ret.hasMenu = not (self.CP.flags & GMFlags.NO_CAMERA.value or self.CP.carFingerprint in CC_ONLY_CAR)
self.lkas_previously_enabled = self.lkas_enabled
if self.CP.carFingerprint in SDGM_CAR:
self.lkas_enabled = cam_cp.vl["ASCMSteeringButton"]["LKAButton"]
else:
self.lkas_enabled = pt_cp.vl["ASCMSteeringButton"]["LKAButton"]
self.pcm_acc_status = pt_cp.vl["AcceleratorPedal2"]["CruiseState"]
fp_ret.sportGear = pt_cp.vl["SportMode"]["SportMode"] == 1
return ret, fp_ret
@staticmethod @staticmethod
def get_cam_can_parser(CP): def get_cam_can_parser(CP):
@@ -207,6 +221,7 @@ class CarState(CarStateBase):
("EBCMFrictionBrakeStatus", 20), ("EBCMFrictionBrakeStatus", 20),
("PSCMSteeringAngle", 100), ("PSCMSteeringAngle", 100),
("ECMAcceleratorPos", 80), ("ECMAcceleratorPos", 80),
("SportMode", 0),
] ]
if CP.carFingerprint in SDGM_CAR: if CP.carFingerprint in SDGM_CAR:
+8
View File
@@ -195,6 +195,14 @@ FINGERPRINTS = {
{ {
190: 6, 193: 8, 197: 8, 199: 4, 201: 8, 208: 8, 209: 7, 211: 2, 241: 6, 249: 8, 257: 8, 288: 5, 289: 8, 292: 2, 298: 8, 304: 3, 309: 8, 311: 8, 313: 8, 320: 4, 322: 7, 328: 1, 331: 3, 352: 5, 353: 3, 368: 3, 381: 8, 384: 4, 386: 8, 388: 8, 394: 7, 398: 8, 401: 8, 405: 8, 407: 7, 413: 8, 417: 7, 419: 1, 422: 4, 426: 7, 431: 8, 442: 8, 450: 4, 451: 8, 452: 8, 453: 6, 454: 8, 455: 7, 456: 8, 457: 6, 462: 4, 463: 3, 479: 3, 481: 7, 485: 8, 489: 8, 497: 8, 499: 3, 500: 6, 501: 8, 503: 2, 508: 8, 528: 5, 532: 6, 554: 3, 560: 8, 562: 8, 563: 5, 564: 5, 565: 5, 567: 5, 569: 3, 573: 1, 577: 8, 608: 8, 609: 6, 610: 6, 611: 6, 612: 8, 613: 8, 647: 6, 707: 8, 715: 8, 717: 5, 723: 4, 730: 4, 761: 7, 810: 8, 840: 5, 842: 5, 844: 8, 869: 4, 872: 1, 880: 6, 882: 8, 890: 1, 892: 2, 893: 2, 894: 1, 961: 8, 969: 8, 975: 2, 977: 8, 979: 8, 985: 5, 1001: 8, 1005: 6, 1009: 8, 1011: 6, 1013: 6, 1017: 8, 1020: 8, 1033: 7, 1034: 7, 1037: 5, 1105: 5, 1187: 5, 1195: 3, 1201: 3, 1217: 8, 1218: 3, 1221: 5, 1223: 3, 1225: 7, 1233: 8, 1236: 8, 1249: 8, 1257: 6, 1259: 8, 1261: 7, 1263: 4, 1265: 8, 1267: 1, 1268: 2, 1271: 8, 1273: 3, 1276: 2, 1277: 7, 1278: 4, 1279: 4, 1280: 4, 1296: 4, 1300: 8, 1322: 6, 1323: 4, 1328: 4, 1345: 8, 1417: 8, 1512: 8, 1514: 8, 1517: 8, 1601: 8, 1906: 7, 1907: 7, 1910: 7, 1912: 7, 1914: 7, 1916: 7, 1919: 7, 1927: 7, 1930: 7, 2018: 8, 2020: 8, 2021: 8, 2028: 8 190: 6, 193: 8, 197: 8, 199: 4, 201: 8, 208: 8, 209: 7, 211: 2, 241: 6, 249: 8, 257: 8, 288: 5, 289: 8, 292: 2, 298: 8, 304: 3, 309: 8, 311: 8, 313: 8, 320: 4, 322: 7, 328: 1, 331: 3, 352: 5, 353: 3, 368: 3, 381: 8, 384: 4, 386: 8, 388: 8, 394: 7, 398: 8, 401: 8, 405: 8, 407: 7, 413: 8, 417: 7, 419: 1, 422: 4, 426: 7, 431: 8, 442: 8, 450: 4, 451: 8, 452: 8, 453: 6, 454: 8, 455: 7, 456: 8, 457: 6, 462: 4, 463: 3, 479: 3, 481: 7, 485: 8, 489: 8, 497: 8, 499: 3, 500: 6, 501: 8, 503: 2, 508: 8, 528: 5, 532: 6, 554: 3, 560: 8, 562: 8, 563: 5, 564: 5, 565: 5, 567: 5, 569: 3, 573: 1, 577: 8, 608: 8, 609: 6, 610: 6, 611: 6, 612: 8, 613: 8, 647: 6, 707: 8, 715: 8, 717: 5, 723: 4, 730: 4, 761: 7, 810: 8, 840: 5, 842: 5, 844: 8, 869: 4, 872: 1, 880: 6, 882: 8, 890: 1, 892: 2, 893: 2, 894: 1, 961: 8, 969: 8, 975: 2, 977: 8, 979: 8, 985: 5, 1001: 8, 1005: 6, 1009: 8, 1011: 6, 1013: 6, 1017: 8, 1020: 8, 1033: 7, 1034: 7, 1037: 5, 1105: 5, 1187: 5, 1195: 3, 1201: 3, 1217: 8, 1218: 3, 1221: 5, 1223: 3, 1225: 7, 1233: 8, 1236: 8, 1249: 8, 1257: 6, 1259: 8, 1261: 7, 1263: 4, 1265: 8, 1267: 1, 1268: 2, 1271: 8, 1273: 3, 1276: 2, 1277: 7, 1278: 4, 1279: 4, 1280: 4, 1296: 4, 1300: 8, 1322: 6, 1323: 4, 1328: 4, 1345: 8, 1417: 8, 1512: 8, 1514: 8, 1517: 8, 1601: 8, 1906: 7, 1907: 7, 1910: 7, 1912: 7, 1914: 7, 1916: 7, 1919: 7, 1927: 7, 1930: 7, 2018: 8, 2020: 8, 2021: 8, 2028: 8
}], }],
CAR.CHEVROLET_MALIBU_CC: [
{
190: 6, 193: 8, 197: 8, 199: 4, 201: 8, 209: 7, 211: 2, 241: 6, 249: 8, 257: 8, 288: 5, 298: 8, 304: 3, 309: 8, 311: 8, 313: 8, 320: 4, 328: 1, 352: 5, 368: 3, 381: 8, 384: 4, 386: 8, 388: 8, 393: 7, 398: 8, 401: 8, 407: 7, 409: 8, 413: 8, 417: 7, 419: 1, 422: 4, 426: 7, 431: 8, 442: 8, 451: 8, 452: 8, 453: 6, 455: 7, 479: 3, 481: 7, 485: 8, 489: 8, 497: 8, 499: 3, 500: 6, 501: 8, 508: 8, 532: 6, 554: 3, 560: 8, 562: 8, 563: 5, 564: 5, 565: 5, 567: 5, 573: 1, 577: 8, 608: 8, 609: 6, 610: 6, 611: 6, 612: 8, 613: 8, 647: 6, 707: 8, 717: 5, 730: 4, 761: 7, 800: 6, 810: 8, 840: 5, 842: 5, 844: 8, 866: 4, 869: 4, 961: 8, 969: 8, 975: 2, 977: 8, 979: 8, 985: 5, 1001: 8, 1005: 6, 1009: 8, 1011: 6, 1013: 6, 1017: 8, 1020: 8, 1037: 5, 1105: 5, 1187: 6, 1189: 1, 1195: 3, 1217: 8, 1221: 5, 1223: 3, 1225: 7, 1233: 8, 1236: 8, 1249: 8, 1257: 6, 1259: 8, 1261: 7, 1263: 4, 1265: 8, 1267: 1, 1268: 2, 1271: 8, 1273: 3, 1279: 4, 1280: 4, 1300: 8, 1322: 6, 1323: 4, 1328: 4, 1417: 8, 1601: 8, 1906: 7, 1907: 7, 1912: 7, 1919: 7
}],
CAR.CHEVROLET_TRAX: [
{
190: 6, 193: 8, 197: 8, 201: 8, 209: 7, 211: 2, 241: 6, 249: 8, 288: 5, 298: 8, 304: 3, 309: 8, 311: 8, 313: 8, 320: 4, 322: 7, 328: 1, 352: 5, 381: 8, 384: 4, 386: 8, 388: 8, 413: 8, 451: 8, 452: 8, 453: 6, 455: 7, 479: 3, 481: 7, 485: 8, 489: 8, 497: 8, 500: 6, 501: 8, 532: 6, 560: 8, 562: 8, 563: 5, 565: 5, 608: 8, 609: 6, 610: 6, 611: 6, 612: 8, 613: 8, 707: 8, 715: 8, 717: 5, 761: 7, 789: 5, 800: 6, 810: 8, 840: 5, 842: 5, 844: 8, 869: 4, 880: 6, 977: 8, 1001: 8, 1011: 6, 1017: 8, 1020: 8, 1217: 8, 1221: 5, 1233: 8, 1249: 8, 1259: 8, 1261: 7, 1263: 4, 1265: 8, 1267: 1, 1271: 8, 1280: 4, 1296: 4, 1300: 8, 1930: 7
}],
} }
FW_VERSIONS: dict[str, dict[tuple, list[bytes]]] = { FW_VERSIONS: dict[str, dict[tuple, list[bytes]]] = {
+80 -22
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os import os
from cereal import car from cereal import car, custom
from math import fabs, exp from math import fabs, exp
from panda import Panda from panda import Panda
@@ -12,7 +12,10 @@ from openpilot.selfdrive.car.gm.values import CAR, CruiseButtons, CarControllerP
from openpilot.selfdrive.car.interfaces import CarInterfaceBase, TorqueFromLateralAccelCallbackType, FRICTION_THRESHOLD, LatControlInputs, NanoFFModel from openpilot.selfdrive.car.interfaces import CarInterfaceBase, TorqueFromLateralAccelCallbackType, FRICTION_THRESHOLD, LatControlInputs, NanoFFModel
from openpilot.selfdrive.controls.lib.drive_helpers import get_friction from openpilot.selfdrive.controls.lib.drive_helpers import get_friction
from openpilot.selfdrive.frogpilot.frogpilot_variables import params
ButtonType = car.CarState.ButtonEvent.Type ButtonType = car.CarState.ButtonEvent.Type
FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
EventName = car.CarEvent.EventName EventName = car.CarEvent.EventName
GearShifter = car.CarState.GearShifter GearShifter = car.CarState.GearShifter
TransmissionType = car.CarParams.TransmissionType TransmissionType = car.CarParams.TransmissionType
@@ -93,7 +96,9 @@ class CarInterface(CarInterfaceBase):
return self.torque_from_lateral_accel_linear return self.torque_from_lateral_accel_linear
@staticmethod @staticmethod
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): def _get_params(ret, candidate, fingerprint, car_fw, disable_openpilot_long, experimental_long, docs):
use_new_api = params.get_bool("NewLongAPIGM")
ret.carName = "gm" ret.carName = "gm"
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.gm)] ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.gm)]
ret.autoResumeSng = False ret.autoResumeSng = False
@@ -107,7 +112,14 @@ class CarInterface(CarInterfaceBase):
else: else:
ret.transmissionType = TransmissionType.automatic ret.transmissionType = TransmissionType.automatic
ret.longitudinalTuning.kiBP = [5., 35.] if use_new_api:
ret.longitudinalTuning.kiBP = [5., 35.]
else:
ret.longitudinalTuning.deadzoneBP = [0.]
ret.longitudinalTuning.deadzoneV = [0.15]
ret.longitudinalTuning.kpBP = [5., 35.]
ret.longitudinalTuning.kiBP = [0.]
if candidate in CAMERA_ACC_CAR: if candidate in CAMERA_ACC_CAR:
ret.experimentalLongitudinalAvailable = candidate not in CC_ONLY_CAR ret.experimentalLongitudinalAvailable = candidate not in CC_ONLY_CAR
@@ -119,7 +131,14 @@ class CarInterface(CarInterfaceBase):
ret.minSteerSpeed = 10 * CV.KPH_TO_MS ret.minSteerSpeed = 10 * CV.KPH_TO_MS
# Tuning for experimental long # Tuning for experimental long
ret.longitudinalTuning.kiV = [2.0, 1.5] if use_new_api:
ret.longitudinalTuning.kiV = [2.0, 1.5]
ret.vEgoStopping = 0.1
ret.vEgoStarting = 0.1
else:
ret.longitudinalTuning.kpV = [2.0, 1.5]
ret.longitudinalTuning.kiV = [0.72]
ret.stoppingDecelRate = 2.0 # reach brake quickly after enabling ret.stoppingDecelRate = 2.0 # reach brake quickly after enabling
ret.vEgoStopping = 0.25 ret.vEgoStopping = 0.25
ret.vEgoStarting = 0.25 ret.vEgoStarting = 0.25
@@ -130,6 +149,8 @@ class CarInterface(CarInterfaceBase):
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_HW_CAM_LONG ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_HW_CAM_LONG
elif candidate in SDGM_CAR: elif candidate in SDGM_CAR:
if use_new_api:
ret.longitudinalTuning.kiV = [0., 0.] # TODO: tuning
ret.experimentalLongitudinalAvailable = False ret.experimentalLongitudinalAvailable = False
ret.networkLocation = NetworkLocation.fwdCamera ret.networkLocation = NetworkLocation.fwdCamera
ret.pcmCruise = True ret.pcmCruise = True
@@ -139,7 +160,7 @@ class CarInterface(CarInterfaceBase):
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_HW_SDGM ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_HW_SDGM
else: # ASCM, OBD-II harness else: # ASCM, OBD-II harness
ret.openpilotLongitudinalControl = True ret.openpilotLongitudinalControl = not disable_openpilot_long
ret.networkLocation = NetworkLocation.gateway ret.networkLocation = NetworkLocation.gateway
ret.radarUnavailable = RADAR_HEADER_MSG not in fingerprint[CanBus.OBSTACLE] and not docs ret.radarUnavailable = RADAR_HEADER_MSG not in fingerprint[CanBus.OBSTACLE] and not docs
ret.pcmCruise = False # stock non-adaptive cruise control is kept off ret.pcmCruise = False # stock non-adaptive cruise control is kept off
@@ -148,7 +169,11 @@ class CarInterface(CarInterfaceBase):
ret.minSteerSpeed = 7 * CV.MPH_TO_MS ret.minSteerSpeed = 7 * CV.MPH_TO_MS
# Tuning # Tuning
ret.longitudinalTuning.kiV = [2.4, 1.5] if use_new_api:
ret.longitudinalTuning.kiV = [2.4, 1.5]
else:
ret.longitudinalTuning.kpV = [2.4, 1.5]
ret.longitudinalTuning.kiV = [0.36]
if ret.enableGasInterceptor: if ret.enableGasInterceptor:
# Need to set ASCM long limits when using pedal interceptor, instead of camera ACC long limits # Need to set ASCM long limits when using pedal interceptor, instead of camera ACC long limits
@@ -248,12 +273,19 @@ class CarInterface(CarInterfaceBase):
elif candidate == CAR.CADILLAC_CT6_CC: elif candidate == CAR.CADILLAC_CT6_CC:
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
elif candidate == CAR.CHEVROLET_MALIBU_CC:
ret.steerActuatorDelay = 0.2
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
elif candidate == CAR.CHEVROLET_TRAX:
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
if ret.enableGasInterceptor: if ret.enableGasInterceptor:
ret.networkLocation = NetworkLocation.fwdCamera ret.networkLocation = NetworkLocation.fwdCamera
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_HW_CAM ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_HW_CAM
ret.minEnableSpeed = -1 ret.minEnableSpeed = -1
ret.pcmCruise = False ret.pcmCruise = False
ret.openpilotLongitudinalControl = True ret.openpilotLongitudinalControl = not disable_openpilot_long
ret.stoppingControl = True ret.stoppingControl = True
ret.autoResumeSng = True ret.autoResumeSng = True
@@ -261,8 +293,14 @@ class CarInterface(CarInterfaceBase):
ret.flags |= GMFlags.PEDAL_LONG.value ret.flags |= GMFlags.PEDAL_LONG.value
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_PEDAL_LONG ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_PEDAL_LONG
# Note: Low speed, stop and go not tested. Should be fairly smooth on highway # Note: Low speed, stop and go not tested. Should be fairly smooth on highway
ret.longitudinalTuning.kiBP = [0.0, 5., 35.] if use_new_api:
ret.longitudinalTuning.kiV = [0.0, 0.35, 0.5] ret.longitudinalTuning.kiBP = [0.0, 5., 35.]
ret.longitudinalTuning.kiV = [0.0, 0.35, 0.5]
else:
ret.longitudinalTuning.kpBP = [5., 35.]
ret.longitudinalTuning.kpV = [0.35, 0.5]
ret.longitudinalTuning.kiBP = [0., 35.0]
ret.longitudinalTuning.kiV = [0.1, 0.1]
ret.longitudinalTuning.kf = 0.15 ret.longitudinalTuning.kf = 0.15
ret.stoppingDecelRate = 0.8 ret.stoppingDecelRate = 0.8
else: # Pedal used for SNG, ACC for longitudinal control otherwise else: # Pedal used for SNG, ACC for longitudinal control otherwise
@@ -277,17 +315,24 @@ class CarInterface(CarInterfaceBase):
ret.radarUnavailable = True ret.radarUnavailable = True
ret.experimentalLongitudinalAvailable = False ret.experimentalLongitudinalAvailable = False
ret.minEnableSpeed = 24 * CV.MPH_TO_MS ret.minEnableSpeed = 24 * CV.MPH_TO_MS
ret.openpilotLongitudinalControl = True ret.openpilotLongitudinalControl = not disable_openpilot_long
ret.pcmCruise = False ret.pcmCruise = False
if use_new_api:
ret.longitudinalTuning.kiBP = [10.7, 10.8, 28.]
ret.longitudinalTuning.kiV = [0., 20., 20.] # set lower end to 0 since we can't drive below that speed
else:
ret.longitudinalTuning.deadzoneBP = [0.]
ret.longitudinalTuning.deadzoneV = [0.56] # == 2 km/h/s, 1.25 mph/s
ret.longitudinalActuatorDelay = 1. # TODO: measure this
ret.longitudinalTuning.kpBP = [10.7, 10.8, 28.] # 10.7 m/s == 24 mph
ret.longitudinalTuning.kpV = [0., 20., 20.] # set lower end to 0 since we can't drive below that speed
ret.longitudinalTuning.kiBP = [0.]
ret.longitudinalTuning.kiV = [0.1]
ret.stoppingDecelRate = 11.18 # == 25 mph/s (.04 rate) ret.stoppingDecelRate = 11.18 # == 25 mph/s (.04 rate)
ret.longitudinalActuatorDelayLowerBound = 1. # TODO: measure this
ret.longitudinalActuatorDelayUpperBound = 2.
ret.longitudinalTuning.kiBP = [10.7, 10.8, 28.]
ret.longitudinalTuning.kiV = [0., 20., 20.] # set lower end to 0 since we can't drive below that speed
if candidate in CC_ONLY_CAR: if candidate in CC_ONLY_CAR:
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_NO_ACC ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_NO_ACC
@@ -302,8 +347,8 @@ class CarInterface(CarInterfaceBase):
return ret return ret
# returns a car.CarState # returns a car.CarState
def _update(self, c): def _update(self, c, frogpilot_toggles):
ret = self.CS.update(self.cp, self.cp_cam, self.cp_loopback) ret, fp_ret = self.CS.update(self.cp, self.cp_cam, self.cp_loopback, frogpilot_toggles)
# Don't add event if transitioning from INIT, unless it's to an actual button # Don't add event if transitioning from INIT, unless it's to an actual button
if self.CS.cruise_buttons != CruiseButtons.UNPRESS or self.CS.prev_cruise_buttons != CruiseButtons.INIT: if self.CS.cruise_buttons != CruiseButtons.UNPRESS or self.CS.prev_cruise_buttons != CruiseButtons.INIT:
@@ -311,7 +356,9 @@ class CarInterface(CarInterfaceBase):
*create_button_events(self.CS.cruise_buttons, self.CS.prev_cruise_buttons, BUTTONS_DICT, *create_button_events(self.CS.cruise_buttons, self.CS.prev_cruise_buttons, BUTTONS_DICT,
unpressed_btn=CruiseButtons.UNPRESS), unpressed_btn=CruiseButtons.UNPRESS),
*create_button_events(self.CS.distance_button, self.CS.prev_distance_button, *create_button_events(self.CS.distance_button, self.CS.prev_distance_button,
{1: ButtonType.gapAdjustCruise}) {1: ButtonType.gapAdjustCruise}),
*create_button_events(self.CS.lkas_enabled, self.CS.lkas_previously_enabled,
{1: FrogPilotButtonType.lkas}),
] ]
# The ECM allows enabling on falling edge of set, but only rising edge of resume # The ECM allows enabling on falling edge of set, but only rising edge of resume
@@ -328,10 +375,21 @@ class CarInterface(CarInterfaceBase):
if below_min_enable_speed and not (ret.standstill and ret.brake >= 20 and if below_min_enable_speed and not (ret.standstill and ret.brake >= 20 and
(self.CP.networkLocation == NetworkLocation.fwdCamera and not self.CP.carFingerprint in SDGM_CAR)): (self.CP.networkLocation == NetworkLocation.fwdCamera and not self.CP.carFingerprint in SDGM_CAR)):
events.add(EventName.belowEngageSpeed) events.add(EventName.belowEngageSpeed)
if ret.cruiseState.standstill and not self.CP.autoResumeSng: if ret.cruiseState.standstill and not (self.CP.autoResumeSng or self.disable_resumeRequired):
events.add(EventName.resumeRequired) events.add(EventName.resumeRequired)
if ret.vEgo < self.CP.minSteerSpeed: self.resumeRequired_shown = True
# Disable the "resumeRequired" event after it's been shown once to not annoy the driver
if self.resumeRequired_shown and not ret.cruiseState.standstill:
self.disable_resumeRequired = True
if ret.vEgo < self.CP.minSteerSpeed and not self.disable_belowSteerSpeed:
events.add(EventName.belowSteerSpeed) events.add(EventName.belowSteerSpeed)
self.belowSteerSpeed_shown = True
# Disable the "belowSteerSpeed" event after it's been shown once to not annoy the driver
if self.belowSteerSpeed_shown and ret.vEgo >= self.CP.minSteerSpeed:
self.disable_belowSteerSpeed = True
if (self.CP.flags & GMFlags.CC_LONG.value) and ret.vEgo < self.CP.minEnableSpeed and ret.cruiseState.enabled: if (self.CP.flags & GMFlags.CC_LONG.value) and ret.vEgo < self.CP.minEnableSpeed and ret.cruiseState.enabled:
events.add(EventName.speedTooLow) events.add(EventName.speedTooLow)
@@ -344,4 +402,4 @@ class CarInterface(CarInterfaceBase):
ret.events = events.to_msg() ret.events = events.to_msg()
return ret return ret, fp_ret
+34 -19
View File
@@ -33,39 +33,45 @@ class CarControllerParams:
# Our controller should still keep the 2 second average above # Our controller should still keep the 2 second average above
# -3.5 m/s^2 as per planner limits # -3.5 m/s^2 as per planner limits
ACCEL_MAX = 2. # m/s^2 ACCEL_MAX = 2. # m/s^2
ACCEL_MAX_PLUS = 4. # m/s^2
ACCEL_MIN = -4. # m/s^2 ACCEL_MIN = -4. # m/s^2
def __init__(self, CP): def __init__(self, CP):
# Gas/brake lookups # Gas/brake lookups
self.ZERO_GAS = 2048 # Coasting self.ZERO_GAS = 6144 # Coasting
self.MAX_BRAKE = 400 # ~ -4.0 m/s^2 with regen self.MAX_BRAKE = 400 # ~ -4.0 m/s^2 with regen
if CP.carFingerprint in CAMERA_ACC_CAR and CP.carFingerprint not in CC_ONLY_CAR: if CP.carFingerprint in CAMERA_ACC_CAR and CP.carFingerprint not in CC_ONLY_CAR:
self.MAX_GAS = 3400 self.MAX_GAS = 7496
self.MAX_ACC_REGEN = 1514 self.MAX_GAS_PLUS = 8848
self.INACTIVE_REGEN = 1554 self.MAX_ACC_REGEN = 5610
self.INACTIVE_REGEN = 5650
# Camera ACC vehicles have no regen while enabled. # Camera ACC vehicles have no regen while enabled.
# Camera transitions to MAX_ACC_REGEN from ZERO_GAS and uses friction brakes instantly # Camera transitions to MAX_ACC_REGEN from ZERO_GAS and uses friction brakes instantly
max_regen_acceleration = 0. self.max_regen_acceleration = 0.
elif CP.carFingerprint in SDGM_CAR: elif CP.carFingerprint in SDGM_CAR:
self.MAX_GAS = 3400 self.MAX_GAS = 7496
self.MAX_ACC_REGEN = 1514 self.MAX_GAS_PLUS = 7496
self.INACTIVE_REGEN = 1554 self.MAX_ACC_REGEN = 5610
max_regen_acceleration = 0. self.INACTIVE_REGEN = 5650
self.max_regen_acceleration = 0.
else: else:
self.MAX_GAS = 3072 # Safety limit, not ACC max. Stock ACC >4096 from standstill. self.MAX_GAS = 7168 # Safety limit, not ACC max. Stock ACC >8192 from standstill.
self.MAX_ACC_REGEN = 1404 # Max ACC regen is slightly less than max paddle regen self.MAX_GAS_PLUS = 8191 # 8292 uses new bit, possible but not tested. Matches Twilsonco tw-main max
self.INACTIVE_REGEN = 1404 self.MAX_ACC_REGEN = 5500 # Max ACC regen is slightly less than max paddle regen
self.INACTIVE_REGEN = 5500
# ICE has much less engine braking force compared to regen in EVs, # ICE has much less engine braking force compared to regen in EVs,
# lower threshold removes some braking deadzone # lower threshold removes some braking deadzone
max_regen_acceleration = -1. if CP.carFingerprint in EV_CAR else -0.1 self.max_regen_acceleration = -1. if CP.carFingerprint in EV_CAR else -0.1
self.GAS_LOOKUP_BP = [max_regen_acceleration, 0., self.ACCEL_MAX] self.GAS_LOOKUP_BP = [self.max_regen_acceleration, 0., self.ACCEL_MAX]
self.GAS_LOOKUP_BP_PLUS = [self.max_regen_acceleration, 0., self.ACCEL_MAX_PLUS]
self.GAS_LOOKUP_V = [self.MAX_ACC_REGEN, self.ZERO_GAS, self.MAX_GAS] self.GAS_LOOKUP_V = [self.MAX_ACC_REGEN, self.ZERO_GAS, self.MAX_GAS]
self.GAS_LOOKUP_V_PLUS = [self.MAX_ACC_REGEN, self.ZERO_GAS, self.MAX_GAS_PLUS]
self.BRAKE_LOOKUP_BP = [self.ACCEL_MIN, max_regen_acceleration] self.BRAKE_LOOKUP_BP = [self.ACCEL_MIN, self.max_regen_acceleration]
self.BRAKE_LOOKUP_V = [self.MAX_BRAKE, 0.] self.BRAKE_LOOKUP_V = [self.MAX_BRAKE, 0.]
# determined by letting Volt regen to a stop in L gear from 89mph, # determined by letting Volt regen to a stop in L gear from 89mph,
@@ -76,10 +82,11 @@ class CarControllerParams:
def update_ev_gas_brake_threshold(self, v_ego): def update_ev_gas_brake_threshold(self, v_ego):
gas_brake_threshold = interp(v_ego, self.EV_GAS_BRAKE_THRESHOLD_BP, self.EV_GAS_BRAKE_THRESHOLD_V) gas_brake_threshold = interp(v_ego, self.EV_GAS_BRAKE_THRESHOLD_BP, self.EV_GAS_BRAKE_THRESHOLD_V)
self.GAS_LOOKUP_BP_PLUS = [self.max_regen_acceleration, 0., self.ACCEL_MAX_PLUS]
self.EV_GAS_LOOKUP_BP = [gas_brake_threshold, max(0., gas_brake_threshold), self.ACCEL_MAX] self.EV_GAS_LOOKUP_BP = [gas_brake_threshold, max(0., gas_brake_threshold), self.ACCEL_MAX]
self.EV_GAS_LOOKUP_BP_PLUS = [gas_brake_threshold, max(0., gas_brake_threshold), self.ACCEL_MAX_PLUS]
self.EV_BRAKE_LOOKUP_BP = [self.ACCEL_MIN, gas_brake_threshold] self.EV_BRAKE_LOOKUP_BP = [self.ACCEL_MIN, gas_brake_threshold]
@dataclass @dataclass
class GMCarDocs(CarDocs): class GMCarDocs(CarDocs):
package: str = "Adaptive Cruise Control (ACC)" package: str = "Adaptive Cruise Control (ACC)"
@@ -225,6 +232,14 @@ class CAR(Platforms):
[GMCarDocs("Buick Baby Enclave 2020-23", "Driver Assist Package")], [GMCarDocs("Buick Baby Enclave 2020-23", "Driver Assist Package")],
CarSpecs(mass=2050, wheelbase=2.86, steerRatio=16.0, centerToFrontRatio=0.5), CarSpecs(mass=2050, wheelbase=2.86, steerRatio=16.0, centerToFrontRatio=0.5),
) )
CHEVROLET_MALIBU_CC = GMPlatformConfig(
[GMCarDocs("Chevrolet Malibu 2023 No ACC")],
CarSpecs(mass=1450, wheelbase=2.8, steerRatio=15.8, centerToFrontRatio=0.4),
)
CHEVROLET_TRAX = GMPlatformConfig(
[GMCarDocs("Chevrolet TRAX 2024")],
CarSpecs(mass=1365, wheelbase=2.7, steerRatio=16.4, centerToFrontRatio=0.4),
)
class CruiseButtons: class CruiseButtons:
@@ -306,15 +321,15 @@ FW_QUERY_CONFIG = FwQueryConfig(
) )
EV_CAR = {CAR.CHEVROLET_VOLT, CAR.CHEVROLET_BOLT_EUV, CAR.CHEVROLET_VOLT_CC, CAR.CHEVROLET_BOLT_CC} EV_CAR = {CAR.CHEVROLET_VOLT, CAR.CHEVROLET_BOLT_EUV, CAR.CHEVROLET_VOLT_CC, CAR.CHEVROLET_BOLT_CC}
CC_ONLY_CAR = {CAR.CHEVROLET_VOLT_CC, CAR.CHEVROLET_BOLT_CC, CAR.CHEVROLET_EQUINOX_CC, CAR.CHEVROLET_SUBURBAN_CC, CAR.GMC_YUKON_CC, CAR.CADILLAC_CT6_CC, CAR.CHEVROLET_TRAILBLAZER_CC, CAR.CADILLAC_XT5_CC} CC_ONLY_CAR = {CAR.CHEVROLET_VOLT_CC, CAR.CHEVROLET_BOLT_CC, CAR.CHEVROLET_EQUINOX_CC, CAR.CHEVROLET_SUBURBAN_CC, CAR.GMC_YUKON_CC, CAR.CADILLAC_CT6_CC, CAR.CHEVROLET_TRAILBLAZER_CC, CAR.CADILLAC_XT5_CC, CAR.CHEVROLET_MALIBU_CC}
# CC_ONLY_CAR = set(c for c in CAR if str(c).endswith('_CC')) # CC_ONLY_CAR = set(c for c in CAR if str(c).endswith('_CC'))
# We're integrated at the Safety Data Gateway Module on these cars # We're integrated at the Safety Data Gateway Module on these cars
SDGM_CAR = {CAR.CADILLAC_XT4, CAR.CHEVROLET_TRAVERSE, CAR.BUICK_BABYENCLAVE} SDGM_CAR = {CAR.CADILLAC_XT4, CAR.CHEVROLET_TRAVERSE, CAR.BUICK_BABYENCLAVE}
# We're integrated at the camera with VOACC on these cars (instead of ASCM w/ OBD-II harness) # We're integrated at the camera with VOACC on these cars (instead of ASCM w/ OBD-II harness)
CAMERA_ACC_CAR = {CAR.CHEVROLET_BOLT_EUV, CAR.CHEVROLET_SILVERADO, CAR.CHEVROLET_EQUINOX, CAR.CHEVROLET_TRAILBLAZER} CAMERA_ACC_CAR = {CAR.CHEVROLET_BOLT_EUV, CAR.CHEVROLET_SILVERADO, CAR.CHEVROLET_EQUINOX, CAR.CHEVROLET_TRAILBLAZER, CAR.CHEVROLET_TRAX}
CAMERA_ACC_CAR.update({CAR.CHEVROLET_VOLT_CC, CAR.CHEVROLET_BOLT_CC, CAR.CHEVROLET_EQUINOX_CC, CAR.GMC_YUKON_CC, CAR.CADILLAC_CT6_CC, CAR.CHEVROLET_TRAILBLAZER_CC, CAR.CADILLAC_XT5_CC}) CAMERA_ACC_CAR.update({CAR.CHEVROLET_VOLT_CC, CAR.CHEVROLET_BOLT_CC, CAR.CHEVROLET_EQUINOX_CC, CAR.GMC_YUKON_CC, CAR.CADILLAC_CT6_CC, CAR.CHEVROLET_TRAILBLAZER_CC, CAR.CADILLAC_XT5_CC, CAR.CHEVROLET_MALIBU_CC})
# CAMERA_ACC_CAR.update(CC_ONLY_CAR) # CAMERA_ACC_CAR.update(CC_ONLY_CAR)
STEER_THRESHOLD = 1.0 STEER_THRESHOLD = 1.0
+25 -5
View File
@@ -4,11 +4,14 @@ from cereal import car
from openpilot.common.numpy_fast import clip, interp from openpilot.common.numpy_fast import clip, interp
from openpilot.common.realtime import DT_CTRL from openpilot.common.realtime import DT_CTRL
from opendbc.can.packer import CANPacker from opendbc.can.packer import CANPacker
from openpilot.selfdrive.car import create_gas_interceptor_command
from openpilot.selfdrive.car.honda import hondacan from openpilot.selfdrive.car.honda import hondacan
from openpilot.selfdrive.car.honda.values import CruiseButtons, VISUAL_HUD, HONDA_BOSCH, HONDA_BOSCH_RADARLESS, HONDA_NIDEC_ALT_PCM_ACCEL, CarControllerParams from openpilot.selfdrive.car.honda.values import CruiseButtons, VISUAL_HUD, HONDA_BOSCH, HONDA_BOSCH_RADARLESS, HONDA_NIDEC_ALT_PCM_ACCEL, CarControllerParams
from openpilot.selfdrive.car.interfaces import CarControllerBase from openpilot.selfdrive.car.interfaces import CarControllerBase
from openpilot.selfdrive.controls.lib.drive_helpers import rate_limit from openpilot.selfdrive.controls.lib.drive_helpers import rate_limit
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_acceleration import get_max_allowed_accel
VisualAlert = car.CarControl.HUDControl.VisualAlert VisualAlert = car.CarControl.HUDControl.VisualAlert
LongCtrlState = car.CarControl.Actuators.LongControlState LongCtrlState = car.CarControl.Actuators.LongControlState
@@ -125,7 +128,7 @@ class CarController(CarControllerBase):
self.brake = 0.0 self.brake = 0.0
self.last_steer = 0.0 self.last_steer = 0.0
def update(self, CC, CS, now_nanos): def update(self, CC, CS, now_nanos, frogpilot_toggles):
actuators = CC.actuators actuators = CC.actuators
hud_control = CC.hudControl hud_control = CC.hudControl
conversion = hondacan.get_cruise_speed_conversion(self.CP.carFingerprint, CS.is_metric) conversion = hondacan.get_cruise_speed_conversion(self.CP.carFingerprint, CS.is_metric)
@@ -182,7 +185,7 @@ class CarController(CarControllerBase):
0.5] 0.5]
# The Honda ODYSSEY seems to have different PCM_ACCEL # The Honda ODYSSEY seems to have different PCM_ACCEL
# msgs, is it other cars too? # msgs, is it other cars too?
if not CC.longActive: if self.CP.enableGasInterceptor or not CC.longActive:
pcm_speed = 0.0 pcm_speed = 0.0
pcm_accel = int(0.0) pcm_accel = int(0.0)
elif self.CP.carFingerprint in HONDA_NIDEC_ALT_PCM_ACCEL: elif self.CP.carFingerprint in HONDA_NIDEC_ALT_PCM_ACCEL:
@@ -215,7 +218,10 @@ class CarController(CarControllerBase):
ts = self.frame * DT_CTRL ts = self.frame * DT_CTRL
if self.CP.carFingerprint in HONDA_BOSCH: if self.CP.carFingerprint in HONDA_BOSCH:
self.accel = clip(accel, self.params.BOSCH_ACCEL_MIN, self.params.BOSCH_ACCEL_MAX) if frogpilot_toggles.sport_plus:
self.accel = clip(accel, self.params.BOSCH_ACCEL_MIN, min(frogpilot_toggles.max_desired_acceleration, get_max_allowed_accel(CS.out.vEgo)))
else:
self.accel = clip(accel, self.params.BOSCH_ACCEL_MIN, min(frogpilot_toggles.max_desired_acceleration, self.params.BOSCH_ACCEL_MAX))
self.gas = interp(accel, self.params.BOSCH_GAS_LOOKUP_BP, self.params.BOSCH_GAS_LOOKUP_V) self.gas = interp(accel, self.params.BOSCH_GAS_LOOKUP_BP, self.params.BOSCH_GAS_LOOKUP_V)
stopping = actuators.longControlState == LongCtrlState.stopping stopping = actuators.longControlState == LongCtrlState.stopping
@@ -234,15 +240,29 @@ class CarController(CarControllerBase):
self.apply_brake_last = apply_brake self.apply_brake_last = apply_brake
self.brake = apply_brake / self.params.NIDEC_BRAKE_MAX self.brake = apply_brake / self.params.NIDEC_BRAKE_MAX
if self.CP.enableGasInterceptor:
# way too aggressive at low speed without this
gas_mult = interp(CS.out.vEgo, [0., 10.], [0.4, 1.0])
# send exactly zero if apply_gas is zero. Interceptor will send the max between read value and apply_gas.
# This prevents unexpected pedal range rescaling
# Sending non-zero gas when OP is not enabled will cause the PCM not to respond to throttle as expected
# when you do enable.
if CC.longActive:
self.gas = clip(gas_mult * (gas - brake + wind_brake * 3 / 4), 0., 1.)
else:
self.gas = 0.0
can_sends.append(create_gas_interceptor_command(self.packer, self.gas, self.frame // 2))
# Send dashboard UI commands. # Send dashboard UI commands.
if self.frame % 10 == 0: if self.frame % 10 == 0:
hud = HUDData(int(pcm_accel), int(round(hud_v_cruise)), hud_control.leadVisible, hud = HUDData(int(pcm_accel), int(round(hud_v_cruise)), hud_control.leadVisible,
hud_control.lanesVisible, fcw_display, acc_alert, steer_required, hud_control.leadDistanceBars) hud_control.lanesVisible, fcw_display, acc_alert, steer_required, hud_control.leadDistanceBars)
can_sends.extend(hondacan.create_ui_commands(self.packer, self.CAN, self.CP, CC.enabled, pcm_speed, hud, CS.is_metric, CS.acc_hud, CS.lkas_hud)) can_sends.extend(hondacan.create_ui_commands(self.packer, self.CAN, self.CP, CC.enabled, pcm_speed, hud, CS.is_metric, CS.acc_hud, CS.lkas_hud, CC.latActive))
if self.CP.openpilotLongitudinalControl and self.CP.carFingerprint not in HONDA_BOSCH: if self.CP.openpilotLongitudinalControl and self.CP.carFingerprint not in HONDA_BOSCH:
self.speed = pcm_speed self.speed = pcm_speed
self.gas = pcm_accel / self.params.NIDEC_GAS_MAX if not self.CP.enableGasInterceptor:
self.gas = pcm_accel / self.params.NIDEC_GAS_MAX
new_actuators = actuators.as_builder() new_actuators = actuators.as_builder()
new_actuators.speed = self.speed new_actuators.speed = self.speed
+36 -8
View File
@@ -1,6 +1,6 @@
from collections import defaultdict from collections import defaultdict
from cereal import car from cereal import car, custom
from openpilot.common.conversions import Conversions as CV from openpilot.common.conversions import Conversions as CV
from openpilot.common.numpy_fast import interp from openpilot.common.numpy_fast import interp
from opendbc.can.can_define import CANDefine from opendbc.can.can_define import CANDefine
@@ -47,7 +47,7 @@ def get_can_messages(CP, gearbox_msg):
if CP.flags & HondaFlags.BOSCH_ALT_BRAKE: if CP.flags & HondaFlags.BOSCH_ALT_BRAKE:
messages.append(("BRAKE_MODULE", 50)) messages.append(("BRAKE_MODULE", 50))
if CP.carFingerprint in (HONDA_BOSCH | {CAR.HONDA_CIVIC, CAR.HONDA_ODYSSEY, CAR.HONDA_ODYSSEY_CHN}): if CP.carFingerprint in (HONDA_BOSCH | {CAR.HONDA_CIVIC, CAR.HONDA_CLARITY, CAR.HONDA_ODYSSEY, CAR.HONDA_ODYSSEY_CHN}):
messages.append(("EPB_STATUS", 50)) messages.append(("EPB_STATUS", 50))
if CP.carFingerprint in HONDA_BOSCH: if CP.carFingerprint in HONDA_BOSCH:
@@ -72,8 +72,14 @@ def get_can_messages(CP, gearbox_msg):
else: else:
messages.append(("DOORS_STATUS", 3)) messages.append(("DOORS_STATUS", 3))
# add gas interceptor reading if we are using it
if CP.enableGasInterceptor:
messages.append(("GAS_SENSOR", 50))
if CP.carFingerprint in HONDA_BOSCH_RADARLESS: if CP.carFingerprint in HONDA_BOSCH_RADARLESS:
messages.append(("CRUISE_FAULT_STATUS", 50)) messages.append(("CRUISE_FAULT_STATUS", 50))
elif CP.carFingerprint == CAR.HONDA_CLARITY:
messages.append(("BRAKE_ERROR", 100)),
elif CP.openpilotLongitudinalControl: elif CP.openpilotLongitudinalControl:
messages.append(("STANDSTILL", 50)) messages.append(("STANDSTILL", 50))
@@ -104,8 +110,9 @@ class CarState(CarStateBase):
# However, on cars without a digital speedometer this is not always present (HRV, FIT, CRV 2016, ILX and RDX) # However, on cars without a digital speedometer this is not always present (HRV, FIT, CRV 2016, ILX and RDX)
self.dash_speed_seen = False self.dash_speed_seen = False
def update(self, cp, cp_cam, cp_body): def update(self, cp, cp_cam, cp_body, frogpilot_toggles):
ret = car.CarState.new_message() ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()
# car params # car params
v_weight_v = [0., 1.] # don't trust smooth speed at low values to avoid premature zero snapping v_weight_v = [0., 1.] # don't trust smooth speed at low values to avoid premature zero snapping
@@ -143,6 +150,8 @@ class CarState(CarStateBase):
if self.CP.carFingerprint in HONDA_BOSCH_RADARLESS: if self.CP.carFingerprint in HONDA_BOSCH_RADARLESS:
ret.accFaulted = bool(cp.vl["CRUISE_FAULT_STATUS"]["CRUISE_FAULT"]) ret.accFaulted = bool(cp.vl["CRUISE_FAULT_STATUS"]["CRUISE_FAULT"])
elif self.CP.carFingerprint == CAR.HONDA_CLARITY:
ret.accFaulted = bool(cp.vl["BRAKE_ERROR"]["BRAKE_ERROR_1"] or cp.vl["BRAKE_ERROR"]["BRAKE_ERROR_2"])
else: else:
# On some cars, these two signals are always 1, this flag is masking a bug in release # On some cars, these two signals are always 1, this flag is masking a bug in release
# FIXME: find and set the ACC faulted signals on more platforms # FIXME: find and set the ACC faulted signals on more platforms
@@ -181,14 +190,19 @@ class CarState(CarStateBase):
ret.brakeHoldActive = cp.vl["VSA_STATUS"]["BRAKE_HOLD_ACTIVE"] == 1 ret.brakeHoldActive = cp.vl["VSA_STATUS"]["BRAKE_HOLD_ACTIVE"] == 1
# TODO: set for all cars # TODO: set for all cars
if self.CP.carFingerprint in (HONDA_BOSCH | {CAR.HONDA_CIVIC, CAR.HONDA_ODYSSEY, CAR.HONDA_ODYSSEY_CHN}): if self.CP.carFingerprint in (HONDA_BOSCH | {CAR.HONDA_CIVIC, CAR.HONDA_CLARITY, CAR.HONDA_ODYSSEY, CAR.HONDA_ODYSSEY_CHN}):
ret.parkingBrake = cp.vl["EPB_STATUS"]["EPB_STATE"] != 0 ret.parkingBrake = cp.vl["EPB_STATUS"]["EPB_STATE"] != 0
gear = int(cp.vl[self.gearbox_msg]["GEAR_SHIFTER"]) gear = int(cp.vl[self.gearbox_msg]["GEAR_SHIFTER"])
ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(gear, None)) ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(gear, None))
ret.gas = cp.vl["POWERTRAIN_DATA"]["PEDAL_GAS"] if self.CP.enableGasInterceptor:
ret.gasPressed = ret.gas > 1e-5 # Same threshold as panda, equivalent to 1e-5 with previous DBC scaling
ret.gas = (cp.vl["GAS_SENSOR"]["INTERCEPTOR_GAS"] + cp.vl["GAS_SENSOR"]["INTERCEPTOR_GAS2"]) // 2
ret.gasPressed = ret.gas > 492
else:
ret.gas = cp.vl["POWERTRAIN_DATA"]["PEDAL_GAS"]
ret.gasPressed = ret.gas > 1e-5
ret.steeringTorque = cp.vl["STEER_STATUS"]["STEER_TORQUE_SENSOR"] ret.steeringTorque = cp.vl["STEER_STATUS"]["STEER_TORQUE_SENSOR"]
ret.steeringTorqueEps = cp.vl["STEER_MOTOR_TORQUE"]["MOTOR_TORQUE"] ret.steeringTorqueEps = cp.vl["STEER_MOTOR_TORQUE"]["MOTOR_TORQUE"]
@@ -241,7 +255,8 @@ class CarState(CarStateBase):
if self.CP.carFingerprint not in HONDA_BOSCH_RADARLESS: if self.CP.carFingerprint not in HONDA_BOSCH_RADARLESS:
ret.stockAeb = (not self.CP.openpilotLongitudinalControl) and bool(cp.vl["ACC_CONTROL"]["AEB_STATUS"] and cp.vl["ACC_CONTROL"]["ACCEL_COMMAND"] < -1e-5) ret.stockAeb = (not self.CP.openpilotLongitudinalControl) and bool(cp.vl["ACC_CONTROL"]["AEB_STATUS"] and cp.vl["ACC_CONTROL"]["ACCEL_COMMAND"] < -1e-5)
else: else:
ret.stockAeb = bool(cp_cam.vl["BRAKE_COMMAND"]["AEB_REQ_1"] and cp_cam.vl["BRAKE_COMMAND"]["COMPUTER_BRAKE"] > 1e-5) aeb_sig = "COMPUTER_BRAKE_ALT" if self.CP.carFingerprint == CAR.HONDA_CLARITY else "COMPUTER_BRAKE"
ret.stockAeb = bool(cp_cam.vl["BRAKE_COMMAND"]["AEB_REQ_1"] and cp_cam.vl["BRAKE_COMMAND"][aeb_sig] > 1e-5)
self.acc_hud = False self.acc_hud = False
self.lkas_hud = False self.lkas_hud = False
@@ -258,7 +273,20 @@ class CarState(CarStateBase):
ret.leftBlindspot = cp_body.vl["BSM_STATUS_LEFT"]["BSM_ALERT"] == 1 ret.leftBlindspot = cp_body.vl["BSM_STATUS_LEFT"]["BSM_ALERT"] == 1
ret.rightBlindspot = cp_body.vl["BSM_STATUS_RIGHT"]["BSM_ALERT"] == 1 ret.rightBlindspot = cp_body.vl["BSM_STATUS_RIGHT"]["BSM_ALERT"] == 1
return ret # FrogPilot CarState functions
brake_light_cars = (CAR.HONDA_CIVIC, CAR.HONDA_ODYSSEY, CAR.HONDA_ODYSSEY_CHN, CAR.HONDA_CRV_5G, CAR.HONDA_ACCORD, CAR.HONDA_CIVIC_BOSCH,
CAR.HONDA_CIVIC_BOSCH_DIESEL, CAR.HONDA_CRV_HYBRID, CAR.ACURA_RDX_3G, CAR.HONDA_E)
if self.CP.carFingerprint in brake_light_cars or (self.CP.carFingerprint in HONDA_BOSCH and self.CP.carFingerprint not in HONDA_BOSCH_RADARLESS):
fp_ret.brakeLights = bool(cp.vl["ACC_CONTROL"]['BRAKE_LIGHTS'] != 0 or ret.brake > 0.4) if not self.CP.openpilotLongitudinalControl else bool(ret.brake > 0.4)
self.prev_distance_button = self.distance_button
self.distance_button = self.cruise_setting == 3
self.lkas_previously_enabled = self.lkas_enabled
self.lkas_enabled = self.cruise_setting == 1
return ret, fp_ret
def get_can_parser(self, CP): def get_can_parser(self, CP):
messages = get_can_messages(CP, self.gearbox_msg) messages = get_can_messages(CP, self.gearbox_msg)
+35
View File
@@ -222,6 +222,16 @@ FW_VERSIONS = {
b'39990-TGH-J530\x00\x00', b'39990-TGH-J530\x00\x00',
b'39990-TGL-E130\x00\x00', b'39990-TGL-E130\x00\x00',
b'39990-TGN-E120\x00\x00', b'39990-TGN-E120\x00\x00',
# Modded EPS Bosch Civic fw list
b'39990-TBA,C020\x00\x00',
b'39990-TBA,C120\x00\x00',
b'39990-TEA,T820\x00\x00',
b'39990-TEZ,T020\x00\x00',
b'39990-TGG,A020\x00\x00',
b'39990-TGG,A120\x00\x00',
b'39990-TGG,J510\x00\x00',
b'39990-TGL,E130\x00\x00',
b'39990-TGN,E120\x00\x00',
], ],
(Ecu.srs, 0x18da53f1, None): [ (Ecu.srs, 0x18da53f1, None): [
b'77959-TBA-A060\x00\x00', b'77959-TBA-A060\x00\x00',
@@ -892,4 +902,29 @@ FW_VERSIONS = {
b'28101-65J-N010\x00\x00', b'28101-65J-N010\x00\x00',
], ],
}, },
CAR.HONDA_CLARITY: {
(Ecu.shiftByWire, 0x18da0bf1, None): [
b'54008-TRW-A910\x00\x00',
],
(Ecu.vsa, 0x18da28f1, None): [
b'57114-TRW-A010\x00\x00',
b'57114-TRW-A020\x00\x00',
],
(Ecu.eps, 0x18da30f1, None): [
b'39990-TRW-A020\x00\x00',
b'39990-TRW,A020\x00\x00', # modified firmware
b'39990,TRW,A020\x00\x00', # extra modified firmware
],
(Ecu.srs, 0x18da53f1, None): [
b'77959-TRW-A210\x00\x00',
b'77959-TRW-A220\x00\x00',
],
(Ecu.gateway, 0x18daeff1, None): [
b'38897-TRW-A010\x00\x00',
],
(Ecu.combinationMeter, 0x18da60f1, None): [
b'78109-TRW-A020\x00\x00',
b'78109-TRW-A030\x00\x00',
],
},
} }
+10 -4
View File
@@ -53,8 +53,6 @@ def create_brake_command(packer, CAN, apply_brake, pump_on, pcm_override, pcm_ca
pcm_fault_cmd = False pcm_fault_cmd = False
values = { values = {
"COMPUTER_BRAKE": apply_brake,
"BRAKE_PUMP_REQUEST": pump_on,
"CRUISE_OVERRIDE": pcm_override, "CRUISE_OVERRIDE": pcm_override,
"CRUISE_FAULT_CMD": pcm_fault_cmd, "CRUISE_FAULT_CMD": pcm_fault_cmd,
"CRUISE_CANCEL_CMD": pcm_cancel_cmd, "CRUISE_CANCEL_CMD": pcm_cancel_cmd,
@@ -67,6 +65,14 @@ def create_brake_command(packer, CAN, apply_brake, pump_on, pcm_override, pcm_ca
"AEB_REQ_2": 0, "AEB_REQ_2": 0,
"AEB_STATUS": 0, "AEB_STATUS": 0,
} }
if car_fingerprint == CAR.HONDA_CLARITY:
values["COMPUTER_BRAKE_ALT"] = apply_brake
values["BRAKE_PUMP_REQUEST_ALT"] = apply_brake > 0
else:
values["COMPUTER_BRAKE"] = apply_brake
values["BRAKE_PUMP_REQUEST"] = pump_on
return packer.make_can_msg("BRAKE_COMMAND", CAN.pt, values) return packer.make_can_msg("BRAKE_COMMAND", CAN.pt, values)
@@ -134,7 +140,7 @@ def create_bosch_supplemental_1(packer, CAN, car_fingerprint):
return packer.make_can_msg("BOSCH_SUPPLEMENTAL_1", bus, values) return packer.make_can_msg("BOSCH_SUPPLEMENTAL_1", bus, values)
def create_ui_commands(packer, CAN, CP, enabled, pcm_speed, hud, is_metric, acc_hud, lkas_hud): def create_ui_commands(packer, CAN, CP, enabled, pcm_speed, hud, is_metric, acc_hud, lkas_hud, lat_active):
commands = [] commands = []
radar_disabled = CP.carFingerprint in (HONDA_BOSCH - HONDA_BOSCH_RADARLESS) and CP.openpilotLongitudinalControl radar_disabled = CP.carFingerprint in (HONDA_BOSCH - HONDA_BOSCH_RADARLESS) and CP.openpilotLongitudinalControl
bus_lkas = get_lkas_cmd_bus(CAN, CP.carFingerprint, radar_disabled) bus_lkas = get_lkas_cmd_bus(CAN, CP.carFingerprint, radar_disabled)
@@ -169,7 +175,7 @@ def create_ui_commands(packer, CAN, CP, enabled, pcm_speed, hud, is_metric, acc_
lkas_hud_values = { lkas_hud_values = {
'SET_ME_X41': 0x41, 'SET_ME_X41': 0x41,
'STEERING_REQUIRED': hud.steer_required, 'STEERING_REQUIRED': hud.steer_required,
'SOLID_LANES': hud.lanes_visible, 'SOLID_LANES': lat_active,
'BEEP': 0, 'BEEP': 0,
} }
+38 -11
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from cereal import car from cereal import car, custom
from panda import Panda from panda import Panda
from openpilot.common.conversions import Conversions as CV from openpilot.common.conversions import Conversions as CV
from openpilot.common.numpy_fast import interp from openpilot.common.numpy_fast import interp
@@ -12,6 +12,7 @@ from openpilot.selfdrive.car.disable_ecu import disable_ecu
ButtonType = car.CarState.ButtonEvent.Type ButtonType = car.CarState.ButtonEvent.Type
FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
EventName = car.CarEvent.EventName EventName = car.CarEvent.EventName
TransmissionType = car.CarParams.TransmissionType TransmissionType = car.CarParams.TransmissionType
BUTTONS_DICT = {CruiseButtons.RES_ACCEL: ButtonType.accelCruise, CruiseButtons.DECEL_SET: ButtonType.decelCruise, BUTTONS_DICT = {CruiseButtons.RES_ACCEL: ButtonType.accelCruise, CruiseButtons.DECEL_SET: ButtonType.decelCruise,
@@ -24,6 +25,8 @@ class CarInterface(CarInterfaceBase):
def get_pid_accel_limits(CP, current_speed, cruise_speed): def get_pid_accel_limits(CP, current_speed, cruise_speed):
if CP.carFingerprint in HONDA_BOSCH: if CP.carFingerprint in HONDA_BOSCH:
return CarControllerParams.BOSCH_ACCEL_MIN, CarControllerParams.BOSCH_ACCEL_MAX return CarControllerParams.BOSCH_ACCEL_MIN, CarControllerParams.BOSCH_ACCEL_MAX
elif CP.enableGasInterceptor:
return CarControllerParams.NIDEC_ACCEL_MIN, CarControllerParams.NIDEC_ACCEL_MAX
else: else:
# NIDECs don't allow acceleration near cruise_speed, # NIDECs don't allow acceleration near cruise_speed,
# so limit limits of pid to prevent windup # so limit limits of pid to prevent windup
@@ -32,7 +35,7 @@ class CarInterface(CarInterfaceBase):
return CarControllerParams.NIDEC_ACCEL_MIN, interp(current_speed, ACCEL_MAX_BP, ACCEL_MAX_VALS) return CarControllerParams.NIDEC_ACCEL_MIN, interp(current_speed, ACCEL_MAX_BP, ACCEL_MAX_VALS)
@staticmethod @staticmethod
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): def _get_params(ret, candidate, fingerprint, car_fw, disable_openpilot_long, experimental_long, docs):
ret.carName = "honda" ret.carName = "honda"
CAN = CanBus(ret, fingerprint) CAN = CanBus(ret, fingerprint)
@@ -48,9 +51,10 @@ class CarInterface(CarInterfaceBase):
ret.pcmCruise = not ret.openpilotLongitudinalControl ret.pcmCruise = not ret.openpilotLongitudinalControl
else: else:
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.hondaNidec)] ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.hondaNidec)]
ret.openpilotLongitudinalControl = True ret.enableGasInterceptor = 0x201 in fingerprint[CAN.pt]
ret.openpilotLongitudinalControl = not disable_openpilot_long
ret.pcmCruise = True ret.pcmCruise = not ret.enableGasInterceptor
if candidate == CAR.HONDA_CRV_5G: if candidate == CAR.HONDA_CRV_5G:
ret.enableBsm = 0x12f8bfa7 in fingerprint[CAN.radar] ret.enableBsm = 0x12f8bfa7 in fingerprint[CAN.radar]
@@ -100,8 +104,12 @@ class CarInterface(CarInterfaceBase):
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[1.1], [0.33]] ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[1.1], [0.33]]
elif candidate in (CAR.HONDA_CIVIC_BOSCH, CAR.HONDA_CIVIC_BOSCH_DIESEL, CAR.HONDA_CIVIC_2022): elif candidate in (CAR.HONDA_CIVIC_BOSCH, CAR.HONDA_CIVIC_BOSCH_DIESEL, CAR.HONDA_CIVIC_2022):
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end if eps_modified:
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.8], [0.24]] ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 2564, 8000], [0, 2564, 3840]]
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.3], [0.09]] # 2.5x Modded EPS
else:
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.8], [0.24]]
elif candidate == CAR.HONDA_ACCORD: elif candidate == CAR.HONDA_ACCORD:
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end
@@ -184,6 +192,21 @@ class CarInterface(CarInterfaceBase):
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 4096], [0, 4096]] # TODO: determine if there is a dead zone at the top end
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.18]] # TODO: can probably use some tuning ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.6], [0.18]] # TODO: can probably use some tuning
elif candidate == CAR.HONDA_CLARITY:
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_HONDA_CLARITY
if eps_modified:
for fw in car_fw:
if fw.ecu == "eps" and b"-" not in fw.fwVersion and b"," in fw.fwVersion:
ret.lateralTuning.pid.kf = 0.00004
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 0xA00, 0x3C00], [0, 2560, 3840]]
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.1575], [0.05175]]
elif fw.ecu == "eps" and b"-" in fw.fwVersion and b"," in fw.fwVersion:
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 0xA00, 0x2800], [0, 2560, 3840]]
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.3], [0.1]]
else:
ret.lateralParams.torqueBP, ret.lateralParams.torqueV = [[0, 2560], [0, 2560]]
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.8], [0.24]]
else: else:
raise ValueError(f"unsupported car {candidate}") raise ValueError(f"unsupported car {candidate}")
@@ -202,13 +225,16 @@ class CarInterface(CarInterfaceBase):
if ret.openpilotLongitudinalControl and candidate in HONDA_BOSCH: if ret.openpilotLongitudinalControl and candidate in HONDA_BOSCH:
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_HONDA_BOSCH_LONG ret.safetyConfigs[0].safetyParam |= Panda.FLAG_HONDA_BOSCH_LONG
if ret.enableGasInterceptor and candidate not in HONDA_BOSCH:
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_HONDA_GAS_INTERCEPTOR
if candidate in HONDA_BOSCH_RADARLESS: if candidate in HONDA_BOSCH_RADARLESS:
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_HONDA_RADARLESS ret.safetyConfigs[0].safetyParam |= Panda.FLAG_HONDA_RADARLESS
# min speed to enable ACC. if car can do stop and go, then set enabling speed # min speed to enable ACC. if car can do stop and go, then set enabling speed
# to a negative value, so it won't matter. Otherwise, add 0.5 mph margin to not # to a negative value, so it won't matter. Otherwise, add 0.5 mph margin to not
# conflict with PCM acc # conflict with PCM acc
ret.autoResumeSng = candidate in (HONDA_BOSCH | {CAR.HONDA_CIVIC}) ret.autoResumeSng = candidate in (HONDA_BOSCH | {CAR.HONDA_CIVIC, CAR.HONDA_CLARITY}) or ret.enableGasInterceptor
ret.minEnableSpeed = -1. if ret.autoResumeSng else 25.5 * CV.MPH_TO_MS ret.minEnableSpeed = -1. if ret.autoResumeSng else 25.5 * CV.MPH_TO_MS
ret.steerActuatorDelay = 0.1 ret.steerActuatorDelay = 0.1
@@ -222,12 +248,13 @@ class CarInterface(CarInterfaceBase):
disable_ecu(logcan, sendcan, bus=1, addr=0x18DAB0F1, com_cont_req=b'\x28\x83\x03') disable_ecu(logcan, sendcan, bus=1, addr=0x18DAB0F1, com_cont_req=b'\x28\x83\x03')
# returns a car.CarState # returns a car.CarState
def _update(self, c): def _update(self, c, frogpilot_toggles):
ret = self.CS.update(self.cp, self.cp_cam, self.cp_body) ret, fp_ret = self.CS.update(self.cp, self.cp_cam, self.cp_body, frogpilot_toggles)
ret.buttonEvents = [ ret.buttonEvents = [
*create_button_events(self.CS.cruise_buttons, self.CS.prev_cruise_buttons, BUTTONS_DICT), *create_button_events(self.CS.cruise_buttons, self.CS.prev_cruise_buttons, BUTTONS_DICT),
*create_button_events(self.CS.cruise_setting, self.CS.prev_cruise_setting, SETTINGS_BUTTONS_DICT), *create_button_events(self.CS.cruise_setting, self.CS.prev_cruise_setting, SETTINGS_BUTTONS_DICT),
*create_button_events(self.CS.lkas_enabled, self.CS.lkas_previously_enabled, {1: FrogPilotButtonType.lkas}),
] ]
# events # events
@@ -246,10 +273,10 @@ class CarInterface(CarInterfaceBase):
# non loud alert if cruise disables below 25mph as expected (+ a little margin) # non loud alert if cruise disables below 25mph as expected (+ a little margin)
events.add(EventName.speedTooLow) events.add(EventName.speedTooLow)
else: else:
events.add(EventName.cruiseDisabled) events.add(EventName.buttonCancel)
if self.CS.CP.minEnableSpeed > 0 and ret.vEgo < 0.001: if self.CS.CP.minEnableSpeed > 0 and ret.vEgo < 0.001:
events.add(EventName.manualRestart) events.add(EventName.manualRestart)
ret.events = events.to_msg() ret.events = events.to_msg()
return ret return ret, fp_ret
+5
View File
@@ -191,6 +191,11 @@ class CAR(Platforms):
dbc_dict('acura_ilx_2016_can_generated', 'acura_ilx_2016_nidec'), dbc_dict('acura_ilx_2016_can_generated', 'acura_ilx_2016_nidec'),
flags=HondaFlags.NIDEC_ALT_SCM_MESSAGES, flags=HondaFlags.NIDEC_ALT_SCM_MESSAGES,
) )
HONDA_CLARITY = HondaNidecPlatformConfig(
[HondaCarDocs("Honda Clarity 2018-22", "All", min_steer_speed=3. * CV.MPH_TO_MS)],
CarSpecs(mass=4052. * CV.LB_TO_KG, wheelbase=2.75, centerToFrontRatio=0.41, steerRatio=16.50, tireStiffnessFactor=1.),
dbc_dict('honda_clarity_hybrid_2018_can_generated', 'acura_ilx_2016_nidec'),
)
HONDA_CRV = HondaNidecPlatformConfig( HONDA_CRV = HondaNidecPlatformConfig(
[HondaCarDocs("Honda CR-V 2015-16", "Touring Trim", min_steer_speed=12. * CV.MPH_TO_MS)], [HondaCarDocs("Honda CR-V 2015-16", "Touring Trim", min_steer_speed=12. * CV.MPH_TO_MS)],
CarSpecs(mass=3572 * CV.LB_TO_KG, wheelbase=2.62, steerRatio=16.89, centerToFrontRatio=0.41, tireStiffnessFactor=0.444), # as spec CarSpecs(mass=3572 * CV.LB_TO_KG, wheelbase=2.62, steerRatio=16.89, centerToFrontRatio=0.41, tireStiffnessFactor=0.444), # as spec
+10 -5
View File
@@ -9,6 +9,8 @@ from openpilot.selfdrive.car.hyundai.hyundaicanfd import CanBus
from openpilot.selfdrive.car.hyundai.values import HyundaiFlags, Buttons, CarControllerParams, CANFD_CAR, CAR from openpilot.selfdrive.car.hyundai.values import HyundaiFlags, Buttons, CarControllerParams, CANFD_CAR, CAR
from openpilot.selfdrive.car.interfaces import CarControllerBase from openpilot.selfdrive.car.interfaces import CarControllerBase
from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_acceleration import get_max_allowed_accel
VisualAlert = car.CarControl.HUDControl.VisualAlert VisualAlert = car.CarControl.HUDControl.VisualAlert
LongCtrlState = car.CarControl.Actuators.LongControlState LongCtrlState = car.CarControl.Actuators.LongControlState
@@ -57,7 +59,7 @@ class CarController(CarControllerBase):
self.car_fingerprint = CP.carFingerprint self.car_fingerprint = CP.carFingerprint
self.last_button_frame = 0 self.last_button_frame = 0
def update(self, CC, CS, now_nanos): def update(self, CC, CS, now_nanos, frogpilot_toggles):
actuators = CC.actuators actuators = CC.actuators
hud_control = CC.hudControl hud_control = CC.hudControl
@@ -79,7 +81,10 @@ class CarController(CarControllerBase):
self.apply_steer_last = apply_steer self.apply_steer_last = apply_steer
# accel + longitudinal # accel + longitudinal
accel = clip(actuators.accel, CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX) if frogpilot_toggles.sport_plus:
accel = clip(actuators.accel, CarControllerParams.ACCEL_MIN, min(frogpilot_toggles.max_desired_acceleration, get_max_allowed_accel(CS.out.vEgo)))
else:
accel = clip(actuators.accel, CarControllerParams.ACCEL_MIN, min(frogpilot_toggles.max_desired_acceleration, CarControllerParams.ACCEL_MAX))
stopping = actuators.longControlState == LongCtrlState.stopping stopping = actuators.longControlState == LongCtrlState.stopping
set_speed_in_units = hud_control.setSpeed * (CV.MS_TO_KPH if CS.is_metric else CV.MS_TO_MPH) set_speed_in_units = hud_control.setSpeed * (CV.MS_TO_KPH if CS.is_metric else CV.MS_TO_MPH)
@@ -118,7 +123,7 @@ class CarController(CarControllerBase):
# LFA and HDA icons # LFA and HDA icons
if self.frame % 5 == 0 and (not hda2 or hda2_long): if self.frame % 5 == 0 and (not hda2 or hda2_long):
can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CAN, CC.enabled)) can_sends.append(hyundaicanfd.create_lfahda_cluster(self.packer, self.CAN, CC.enabled, CC.latActive))
# blinkers # blinkers
if hda2 and self.CP.flags & HyundaiFlags.ENABLE_BLINKERS: if hda2 and self.CP.flags & HyundaiFlags.ENABLE_BLINKERS:
@@ -149,11 +154,11 @@ class CarController(CarControllerBase):
use_fca = self.CP.flags & HyundaiFlags.USE_FCA.value use_fca = self.CP.flags & HyundaiFlags.USE_FCA.value
can_sends.extend(hyundaican.create_acc_commands(self.packer, CC.enabled, accel, jerk, int(self.frame / 2), can_sends.extend(hyundaican.create_acc_commands(self.packer, CC.enabled, accel, jerk, int(self.frame / 2),
hud_control, set_speed_in_units, stopping, hud_control, set_speed_in_units, stopping,
CC.cruiseControl.override, use_fca)) CC.cruiseControl.override, use_fca, CS.out.cruiseState.available))
# 20 Hz LFA MFA message # 20 Hz LFA MFA message
if self.frame % 5 == 0 and self.CP.flags & HyundaiFlags.SEND_LFA.value: if self.frame % 5 == 0 and self.CP.flags & HyundaiFlags.SEND_LFA.value:
can_sends.append(hyundaican.create_lfahda_mfc(self.packer, CC.enabled)) can_sends.append(hyundaican.create_lfahda_mfc(self.packer, CC.enabled, CC.latActive))
# 5 Hz ACC options # 5 Hz ACC options
if self.frame % 20 == 0 and self.CP.openpilotLongitudinalControl: if self.frame % 20 == 0 and self.CP.openpilotLongitudinalControl:
+83 -8
View File
@@ -2,7 +2,7 @@ from collections import deque
import copy import copy
import math import math
from cereal import car from cereal import car, custom
from openpilot.common.conversions import Conversions as CV from openpilot.common.conversions import Conversions as CV
from opendbc.can.parser import CANParser from opendbc.can.parser import CANParser
from opendbc.can.can_define import CANDefine from opendbc.can.can_define import CANDefine
@@ -52,11 +52,28 @@ class CarState(CarStateBase):
self.params = CarControllerParams(CP) self.params = CarControllerParams(CP)
def update(self, cp, cp_cam): # FrogPilot variables
self.main_enabled = False
self.active_mode = 0
self.drive_mode_prev = 0
# Traffic signals for Speed Limit Controller - Credit goes to Multikyd!
def calculate_speed_limit(self, cp, cp_cam):
if self.CP.carFingerprint in CANFD_CAR: if self.CP.carFingerprint in CANFD_CAR:
return self.update_canfd(cp, cp_cam) speed_limit_bus = cp if self.CP.flags & HyundaiFlags.CANFD_HDA2 else cp_cam
return speed_limit_bus.vl["CLUSTER_SPEED_LIMIT"]["SPEED_LIMIT_1"]
else:
speed_limit_nav = cp.vl["Navi_HU"]["SpeedLim_Nav_Clu"] if self.CP.flags & HyundaiFlags.NAV_MSG else 0
speed_limit_cam = cp_cam.vl["LKAS12"]["CF_Lkas_TsrSpeed_Display_Clu"] if self.CP.flags & HyundaiFlags.LKAS12 else None
return speed_limit_cam if speed_limit_cam is not None and speed_limit_cam not in (0, 255) else speed_limit_nav
def update(self, cp, cp_cam, frogpilot_toggles):
if self.CP.carFingerprint in CANFD_CAR:
return self.update_canfd(cp, cp_cam, frogpilot_toggles)
ret = car.CarState.new_message() ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()
cp_cruise = cp_cam if self.CP.carFingerprint in CAMERA_SCC_CAR else cp cp_cruise = cp_cam if self.CP.carFingerprint in CAMERA_SCC_CAR else cp
self.is_metric = cp.vl["CLU11"]["CF_Clu_SPEED_UNIT"] == 0 self.is_metric = cp.vl["CLU11"]["CF_Clu_SPEED_UNIT"] == 0
speed_conv = CV.KPH_TO_MS if self.is_metric else CV.MPH_TO_MS speed_conv = CV.KPH_TO_MS if self.is_metric else CV.MPH_TO_MS
@@ -102,7 +119,7 @@ class CarState(CarStateBase):
# cruise state # cruise state
if self.CP.openpilotLongitudinalControl: if self.CP.openpilotLongitudinalControl:
# These are not used for engage/disengage since openpilot keeps track of state using the buttons # These are not used for engage/disengage since openpilot keeps track of state using the buttons
ret.cruiseState.available = cp.vl["TCS13"]["ACCEnable"] == 0 ret.cruiseState.available = self.main_enabled
ret.cruiseState.enabled = cp.vl["TCS13"]["ACC_REQ"] == 1 ret.cruiseState.enabled = cp.vl["TCS13"]["ACC_REQ"] == 1
ret.cruiseState.standstill = False ret.cruiseState.standstill = False
ret.cruiseState.nonAdaptive = False ret.cruiseState.nonAdaptive = False
@@ -163,12 +180,29 @@ class CarState(CarStateBase):
self.steer_state = cp.vl["MDPS12"]["CF_Mdps_ToiActive"] # 0 NOT ACTIVE, 1 ACTIVE self.steer_state = cp.vl["MDPS12"]["CF_Mdps_ToiActive"] # 0 NOT ACTIVE, 1 ACTIVE
self.prev_cruise_buttons = self.cruise_buttons[-1] self.prev_cruise_buttons = self.cruise_buttons[-1]
self.cruise_buttons.extend(cp.vl_all["CLU11"]["CF_Clu_CruiseSwState"]) self.cruise_buttons.extend(cp.vl_all["CLU11"]["CF_Clu_CruiseSwState"])
self.prev_main_buttons = self.main_buttons[-1]
self.main_buttons.extend(cp.vl_all["CLU11"]["CF_Clu_CruiseSwMain"]) self.main_buttons.extend(cp.vl_all["CLU11"]["CF_Clu_CruiseSwMain"])
if self.prev_main_buttons == 0 and self.main_buttons[-1] != 0:
self.main_enabled = not self.main_enabled
return ret # FrogPilot CarState functions
fp_ret.brakeLights = bool(cp.vl["TCS13"]["BrakeLight"])
def update_canfd(self, cp, cp_cam): if self.CP.flags & HyundaiFlags.LKAS12 or self.CP.flags & HyundaiFlags.NAV_MSG:
fp_ret.dashboardSpeedLimit = self.calculate_speed_limit(cp, cp_cam) * speed_conv
self.prev_distance_button = self.distance_button
self.distance_button = self.cruise_buttons[-1] == Buttons.GAP_DIST
self.lkas_previously_enabled = self.lkas_enabled
if self.CP.flags & HyundaiFlags.CAN_LFA_BTN:
self.lkas_enabled = cp.vl["BCM_PO_11"]["LFA_Pressed"]
return ret, fp_ret
def update_canfd(self, cp, cp_cam, frogpilot_toggles):
ret = car.CarState.new_message() ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()
self.is_metric = cp.vl["CRUISE_BUTTONS_ALT"]["DISTANCE_UNIT"] != 1 self.is_metric = cp.vl["CRUISE_BUTTONS_ALT"]["DISTANCE_UNIT"] != 1
speed_factor = CV.KPH_TO_MS if self.is_metric else CV.MPH_TO_MS speed_factor = CV.KPH_TO_MS if self.is_metric else CV.MPH_TO_MS
@@ -218,7 +252,7 @@ class CarState(CarStateBase):
# cruise state # cruise state
# CAN FD cars enable on main button press, set available if no TCS faults preventing engagement # CAN FD cars enable on main button press, set available if no TCS faults preventing engagement
ret.cruiseState.available = cp.vl["TCS"]["ACCEnable"] == 0 ret.cruiseState.available = self.main_enabled
if self.CP.openpilotLongitudinalControl: if self.CP.openpilotLongitudinalControl:
# These are not used for engage/disengage since openpilot keeps track of state using the buttons # These are not used for engage/disengage since openpilot keeps track of state using the buttons
ret.cruiseState.enabled = cp.vl["TCS"]["ACC_REQ"] == 1 ret.cruiseState.enabled = cp.vl["TCS"]["ACC_REQ"] == 1
@@ -239,7 +273,10 @@ class CarState(CarStateBase):
self.prev_cruise_buttons = self.cruise_buttons[-1] self.prev_cruise_buttons = self.cruise_buttons[-1]
self.cruise_buttons.extend(cp.vl_all[self.cruise_btns_msg_canfd]["CRUISE_BUTTONS"]) self.cruise_buttons.extend(cp.vl_all[self.cruise_btns_msg_canfd]["CRUISE_BUTTONS"])
self.prev_main_buttons = self.main_buttons[-1]
self.main_buttons.extend(cp.vl_all[self.cruise_btns_msg_canfd]["ADAPTIVE_CRUISE_MAIN_BTN"]) self.main_buttons.extend(cp.vl_all[self.cruise_btns_msg_canfd]["ADAPTIVE_CRUISE_MAIN_BTN"])
if self.prev_main_buttons == 0 and self.main_buttons[-1] != 0:
self.main_enabled = not self.main_enabled
self.buttons_counter = cp.vl[self.cruise_btns_msg_canfd]["COUNTER"] self.buttons_counter = cp.vl[self.cruise_btns_msg_canfd]["COUNTER"]
ret.accFaulted = cp.vl["TCS"]["ACCEnable"] != 0 # 0 ACC CONTROL ENABLED, 1-3 ACC CONTROL DISABLED ret.accFaulted = cp.vl["TCS"]["ACCEnable"] != 0 # 0 ACC CONTROL ENABLED, 1-3 ACC CONTROL DISABLED
@@ -247,7 +284,28 @@ class CarState(CarStateBase):
self.hda2_lfa_block_msg = copy.copy(cp_cam.vl["CAM_0x362"] if self.CP.flags & HyundaiFlags.CANFD_HDA2_ALT_STEERING self.hda2_lfa_block_msg = copy.copy(cp_cam.vl["CAM_0x362"] if self.CP.flags & HyundaiFlags.CANFD_HDA2_ALT_STEERING
else cp_cam.vl["CAM_0x2a4"]) else cp_cam.vl["CAM_0x2a4"])
return ret # FrogPilot CarState functions
fp_ret.brakeLights = bool(cp.vl["TCS"]["DriverBraking"])
if self.CP.flags & HyundaiFlags.NAV_MSG:
fp_ret.dashboardSpeedLimit = self.calculate_speed_limit(cp, cp_cam) * speed_factor
self.prev_distance_button = self.distance_button
self.distance_button = self.cruise_buttons[-1] == Buttons.GAP_DIST
drive_mode = cp.vl["DRIVE_MODE"]["DRIVE_MODE2"]
if drive_mode != 0 and drive_mode != self.drive_mode_prev:
self.active_mode = drive_mode if drive_mode in (2, 3) else 1
self.drive_mode_prev = drive_mode
fp_ret.ecoGear = self.active_mode == 2
fp_ret.sportGear = self.active_mode == 3
self.lkas_previously_enabled = self.lkas_enabled
self.lkas_enabled = cp.vl[self.cruise_btns_msg_canfd]["LFA_BTN"]
return ret, fp_ret
def get_can_parser(self, CP): def get_can_parser(self, CP):
if CP.carFingerprint in CANFD_CAR: if CP.carFingerprint in CANFD_CAR:
@@ -297,6 +355,13 @@ class CarState(CarStateBase):
else: else:
messages.append(("LVR12", 100)) messages.append(("LVR12", 100))
if CP.flags & HyundaiFlags.CAN_LFA_BTN:
messages.append(("BCM_PO_11", 50))
messages += [
("Navi_HU", 5),
]
return CANParser(DBC[CP.carFingerprint]["pt"], messages, 0) return CANParser(DBC[CP.carFingerprint]["pt"], messages, 0)
@staticmethod @staticmethod
@@ -317,6 +382,9 @@ class CarState(CarStateBase):
if CP.flags & HyundaiFlags.USE_FCA.value: if CP.flags & HyundaiFlags.USE_FCA.value:
messages.append(("FCA11", 50)) messages.append(("FCA11", 50))
if CP.flags & HyundaiFlags.LKAS12:
messages.append(("LKAS12", 10))
return CANParser(DBC[CP.carFingerprint]["pt"], messages, 2) return CANParser(DBC[CP.carFingerprint]["pt"], messages, 2)
def get_can_parser_canfd(self, CP): def get_can_parser_canfd(self, CP):
@@ -330,6 +398,7 @@ class CarState(CarStateBase):
("CRUISE_BUTTONS_ALT", 50), ("CRUISE_BUTTONS_ALT", 50),
("BLINKERS", 4), ("BLINKERS", 4),
("DOORS_SEATBELTS", 4), ("DOORS_SEATBELTS", 4),
("DRIVE_MODE", 0),
] ]
if CP.flags & HyundaiFlags.EV: if CP.flags & HyundaiFlags.EV:
@@ -352,6 +421,9 @@ class CarState(CarStateBase):
("SCC_CONTROL", 50), ("SCC_CONTROL", 50),
] ]
if CP.flags & HyundaiFlags.CANFD_HDA2 and CP.flags & HyundaiFlags.NAV_MSG:
messages.append(("CLUSTER_SPEED_LIMIT", 10))
return CANParser(DBC[CP.carFingerprint]["pt"], messages, CanBus(CP).ECAN) return CANParser(DBC[CP.carFingerprint]["pt"], messages, CanBus(CP).ECAN)
@staticmethod @staticmethod
@@ -365,4 +437,7 @@ class CarState(CarStateBase):
("SCC_CONTROL", 50), ("SCC_CONTROL", 50),
] ]
if not (CP.flags & HyundaiFlags.CANFD_HDA2) and CP.flags & HyundaiFlags.NAV_MSG:
messages.append(("CLUSTER_SPEED_LIMIT", 10))
return CANParser(DBC[CP.carFingerprint]["pt"], messages, CanBus(CP).CAM) return CANParser(DBC[CP.carFingerprint]["pt"], messages, CanBus(CP).CAM)
+4 -4
View File
@@ -117,20 +117,20 @@ def create_clu11(packer, frame, clu11, button, CP):
return packer.make_can_msg("CLU11", bus, values) return packer.make_can_msg("CLU11", bus, values)
def create_lfahda_mfc(packer, enabled, hda_set_speed=0): def create_lfahda_mfc(packer, enabled, lat_active, hda_set_speed=0):
values = { values = {
"LFA_Icon_State": 2 if enabled else 0, "LFA_Icon_State": 2 if lat_active else 0,
"HDA_Active": 1 if hda_set_speed else 0, "HDA_Active": 1 if hda_set_speed else 0,
"HDA_Icon_State": 2 if hda_set_speed else 0, "HDA_Icon_State": 2 if hda_set_speed else 0,
"HDA_VSetReq": hda_set_speed, "HDA_VSetReq": hda_set_speed,
} }
return packer.make_can_msg("LFAHDA_MFC", 0, values) return packer.make_can_msg("LFAHDA_MFC", 0, values)
def create_acc_commands(packer, enabled, accel, upper_jerk, idx, hud_control, set_speed, stopping, long_override, use_fca): def create_acc_commands(packer, enabled, accel, upper_jerk, idx, hud_control, set_speed, stopping, long_override, use_fca, cruise_available):
commands = [] commands = []
scc11_values = { scc11_values = {
"MainMode_ACC": 1, "MainMode_ACC": 1 if cruise_available else 0,
"TauGapSet": hud_control.leadDistanceBars, "TauGapSet": hud_control.leadDistanceBars,
"VSetDis": set_speed if enabled else 0, "VSetDis": set_speed if enabled else 0,
"AliveCounterACC": idx % 0x10, "AliveCounterACC": idx % 0x10,
+3 -3
View File
@@ -41,7 +41,7 @@ def create_steering_messages(packer, CP, CAN, enabled, lat_active, apply_steer):
values = { values = {
"LKA_MODE": 2, "LKA_MODE": 2,
"LKA_ICON": 2 if enabled else 1, "LKA_ICON": 2 if enabled else 1 if lat_active else 0, # HDA2
"TORQUE_REQUEST": apply_steer, "TORQUE_REQUEST": apply_steer,
"LKA_ASSIST": 0, "LKA_ASSIST": 0,
"STEER_REQ": 1 if lat_active else 0, "STEER_REQ": 1 if lat_active else 0,
@@ -113,10 +113,10 @@ def create_acc_cancel(packer, CP, CAN, cruise_info_copy):
}) })
return packer.make_can_msg("SCC_CONTROL", CAN.ECAN, values) return packer.make_can_msg("SCC_CONTROL", CAN.ECAN, values)
def create_lfahda_cluster(packer, CAN, enabled): def create_lfahda_cluster(packer, CAN, enabled, lat_active):
values = { values = {
"HDA_ICON": 1 if enabled else 0, "HDA_ICON": 1 if enabled else 0,
"LFA_ICON": 2 if enabled else 0, "LFA_ICON": 2 if enabled else 1 if lat_active else 0, # HDA1
} }
return packer.make_can_msg("LFAHDA_CLUSTER", CAN.ECAN, values) return packer.make_can_msg("LFAHDA_CLUSTER", CAN.ECAN, values)
+46 -7
View File
@@ -1,4 +1,4 @@
from cereal import car from cereal import car, custom
from panda import Panda from panda import Panda
from openpilot.selfdrive.car.hyundai.hyundaicanfd import CanBus from openpilot.selfdrive.car.hyundai.hyundaicanfd import CanBus
from openpilot.selfdrive.car.hyundai.values import HyundaiFlags, CAR, DBC, CANFD_CAR, CAMERA_SCC_CAR, CANFD_RADAR_SCC_CAR, \ from openpilot.selfdrive.car.hyundai.values import HyundaiFlags, CAR, DBC, CANFD_CAR, CAMERA_SCC_CAR, CANFD_RADAR_SCC_CAR, \
@@ -9,9 +9,13 @@ from openpilot.selfdrive.car import create_button_events, get_safety_config
from openpilot.selfdrive.car.interfaces import CarInterfaceBase from openpilot.selfdrive.car.interfaces import CarInterfaceBase
from openpilot.selfdrive.car.disable_ecu import disable_ecu from openpilot.selfdrive.car.disable_ecu import disable_ecu
from openpilot.selfdrive.frogpilot.frogpilot_variables import params
Ecu = car.CarParams.Ecu Ecu = car.CarParams.Ecu
ButtonType = car.CarState.ButtonEvent.Type ButtonType = car.CarState.ButtonEvent.Type
FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
EventName = car.CarEvent.EventName EventName = car.CarEvent.EventName
GearShifter = car.CarState.GearShifter
ENABLE_BUTTONS = (Buttons.RES_ACCEL, Buttons.SET_DECEL, Buttons.CANCEL) ENABLE_BUTTONS = (Buttons.RES_ACCEL, Buttons.SET_DECEL, Buttons.CANCEL)
BUTTONS_DICT = {Buttons.RES_ACCEL: ButtonType.accelCruise, Buttons.SET_DECEL: ButtonType.decelCruise, BUTTONS_DICT = {Buttons.RES_ACCEL: ButtonType.accelCruise, Buttons.SET_DECEL: ButtonType.decelCruise,
Buttons.GAP_DIST: ButtonType.gapAdjustCruise, Buttons.CANCEL: ButtonType.cancel} Buttons.GAP_DIST: ButtonType.gapAdjustCruise, Buttons.CANCEL: ButtonType.cancel}
@@ -19,7 +23,9 @@ BUTTONS_DICT = {Buttons.RES_ACCEL: ButtonType.accelCruise, Buttons.SET_DECEL: Bu
class CarInterface(CarInterfaceBase): class CarInterface(CarInterfaceBase):
@staticmethod @staticmethod
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): def _get_params(ret, candidate, fingerprint, car_fw, disable_openpilot_long, experimental_long, docs):
use_new_api = params.get_bool("NewLongAPI")
ret.carName = "hyundai" ret.carName = "hyundai"
ret.radarUnavailable = RADAR_START_ADDR not in fingerprint[1] or DBC[ret.carFingerprint]["radar"] is None ret.radarUnavailable = RADAR_START_ADDR not in fingerprint[1] or DBC[ret.carFingerprint]["radar"] is None
@@ -71,6 +77,9 @@ class CarInterface(CarInterfaceBase):
if 0x38d in fingerprint[0] or 0x38d in fingerprint[2]: if 0x38d in fingerprint[0] or 0x38d in fingerprint[2]:
ret.flags |= HyundaiFlags.USE_FCA.value ret.flags |= HyundaiFlags.USE_FCA.value
if 0x53E in fingerprint[2]:
ret.flags |= HyundaiFlags.LKAS12.value
ret.steerActuatorDelay = 0.1 # Default delay ret.steerActuatorDelay = 0.1 # Default delay
ret.steerLimitTimer = 0.4 ret.steerLimitTimer = 0.4
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning) CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
@@ -80,8 +89,18 @@ class CarInterface(CarInterfaceBase):
# *** longitudinal control *** # *** longitudinal control ***
if candidate in CANFD_CAR: if candidate in CANFD_CAR:
if not use_new_api:
ret.longitudinalTuning.deadzoneBP = [0.]
ret.longitudinalTuning.deadzoneV = [0.]
ret.longitudinalTuning.kpV = [0.1]
ret.longitudinalTuning.kiV = [0.0]
ret.experimentalLongitudinalAvailable = candidate not in (CANFD_UNSUPPORTED_LONGITUDINAL_CAR | CANFD_RADAR_SCC_CAR) ret.experimentalLongitudinalAvailable = candidate not in (CANFD_UNSUPPORTED_LONGITUDINAL_CAR | CANFD_RADAR_SCC_CAR)
else: else:
if not use_new_api:
ret.longitudinalTuning.deadzoneBP = [0.]
ret.longitudinalTuning.deadzoneV = [0.]
ret.longitudinalTuning.kpV = [0.5]
ret.longitudinalTuning.kiV = [0.0]
ret.experimentalLongitudinalAvailable = candidate not in (UNSUPPORTED_LONGITUDINAL_CAR | CAMERA_SCC_CAR) ret.experimentalLongitudinalAvailable = candidate not in (UNSUPPORTED_LONGITUDINAL_CAR | CAMERA_SCC_CAR)
ret.openpilotLongitudinalControl = experimental_long and ret.experimentalLongitudinalAvailable ret.openpilotLongitudinalControl = experimental_long and ret.experimentalLongitudinalAvailable
ret.pcmCruise = not ret.openpilotLongitudinalControl ret.pcmCruise = not ret.openpilotLongitudinalControl
@@ -95,9 +114,15 @@ class CarInterface(CarInterfaceBase):
# *** feature detection *** # *** feature detection ***
if candidate in CANFD_CAR: if candidate in CANFD_CAR:
ret.enableBsm = 0x1e5 in fingerprint[CAN.ECAN] ret.enableBsm = 0x1e5 in fingerprint[CAN.ECAN]
if 0x1fa in fingerprint[CAN.ECAN]:
ret.flags |= HyundaiFlags.NAV_MSG.value
else: else:
ret.enableBsm = 0x58b in fingerprint[0] ret.enableBsm = 0x58b in fingerprint[0]
if 0x544 in fingerprint[0]:
ret.flags |= HyundaiFlags.NAV_MSG.value
# *** panda safety config *** # *** panda safety config ***
if candidate in CANFD_CAR: if candidate in CANFD_CAR:
cfgs = [get_safety_config(car.CarParams.SafetyModel.hyundaiCanfd), ] cfgs = [get_safety_config(car.CarParams.SafetyModel.hyundaiCanfd), ]
@@ -123,6 +148,10 @@ class CarInterface(CarInterfaceBase):
if candidate in CAMERA_SCC_CAR: if candidate in CAMERA_SCC_CAR:
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_HYUNDAI_CAMERA_SCC ret.safetyConfigs[0].safetyParam |= Panda.FLAG_HYUNDAI_CAMERA_SCC
if 0x391 in fingerprint[0]:
ret.flags |= HyundaiFlags.CAN_LFA_BTN.value
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_HYUNDAI_LFA_BTN
if ret.openpilotLongitudinalControl: if ret.openpilotLongitudinalControl:
ret.safetyConfigs[-1].safetyParam |= Panda.FLAG_HYUNDAI_LONG ret.safetyConfigs[-1].safetyParam |= Panda.FLAG_HYUNDAI_LONG
if ret.flags & HyundaiFlags.HYBRID: if ret.flags & HyundaiFlags.HYBRID:
@@ -136,6 +165,10 @@ class CarInterface(CarInterfaceBase):
ret.centerToFront = ret.wheelbase * 0.4 ret.centerToFront = ret.wheelbase * 0.4
# Detect smartMDPS
if 0x2AA in fingerprint[0]:
ret.minSteerSpeed = 0.
return ret return ret
@staticmethod @staticmethod
@@ -150,17 +183,23 @@ class CarInterface(CarInterfaceBase):
if CP.flags & HyundaiFlags.ENABLE_BLINKERS: if CP.flags & HyundaiFlags.ENABLE_BLINKERS:
disable_ecu(logcan, sendcan, bus=CanBus(CP).ECAN, addr=0x7B1, com_cont_req=b'\x28\x83\x01') disable_ecu(logcan, sendcan, bus=CanBus(CP).ECAN, addr=0x7B1, com_cont_req=b'\x28\x83\x01')
def _update(self, c): def _update(self, c, frogpilot_toggles):
ret = self.CS.update(self.cp, self.cp_cam) ret, fp_ret = self.CS.update(self.cp, self.cp_cam, frogpilot_toggles)
if self.CS.CP.openpilotLongitudinalControl: if self.CS.CP.openpilotLongitudinalControl:
ret.buttonEvents = create_button_events(self.CS.cruise_buttons[-1], self.CS.prev_cruise_buttons, BUTTONS_DICT) ret.buttonEvents = [
*create_button_events(self.CS.cruise_buttons[-1], self.CS.prev_cruise_buttons, BUTTONS_DICT),
*create_button_events(self.CS.lkas_enabled, self.CS.lkas_previously_enabled, {1: FrogPilotButtonType.lkas}),
]
else:
ret.buttonEvents = create_button_events(self.CS.lkas_enabled, self.CS.lkas_previously_enabled, {1: FrogPilotButtonType.lkas})
# On some newer model years, the CANCEL button acts as a pause/resume button based on the PCM state # On some newer model years, the CANCEL button acts as a pause/resume button based on the PCM state
# To avoid re-engaging when openpilot cancels, check user engagement intention via buttons # To avoid re-engaging when openpilot cancels, check user engagement intention via buttons
# Main button also can trigger an engagement on these cars # Main button also can trigger an engagement on these cars
allow_enable = any(btn in ENABLE_BUTTONS for btn in self.CS.cruise_buttons) or any(self.CS.main_buttons) allow_enable = any(btn in ENABLE_BUTTONS for btn in self.CS.cruise_buttons) or any(self.CS.main_buttons)
events = self.create_common_events(ret, pcm_enable=self.CS.CP.pcmCruise, allow_enable=allow_enable) events = self.create_common_events(ret, extra_gears=[GearShifter.sport, GearShifter.manumatic],
pcm_enable=self.CS.CP.pcmCruise, allow_enable=allow_enable)
# low speed steer alert hysteresis logic (only for cars with steer cut off above 10 m/s) # low speed steer alert hysteresis logic (only for cars with steer cut off above 10 m/s)
if ret.vEgo < (self.CP.minSteerSpeed + 2.) and self.CP.minSteerSpeed > 10.: if ret.vEgo < (self.CP.minSteerSpeed + 2.) and self.CP.minSteerSpeed > 10.:
@@ -172,4 +211,4 @@ class CarInterface(CarInterfaceBase):
ret.events = events.to_msg() ret.events = events.to_msg()
return ret return ret, fp_ret
+4
View File
@@ -95,6 +95,10 @@ class HyundaiFlags(IntFlag):
MIN_STEER_32_MPH = 2 ** 23 MIN_STEER_32_MPH = 2 ** 23
# FrogPilot HKG flags
CAN_LFA_BTN = 2 ** 24
LKAS12 = 2 ** 25
NAV_MSG = 2 ** 26
class Footnote(Enum): class Footnote(Enum):
CANFD = CarFootnote( CANFD = CarFootnote(
+208 -10
View File
@@ -3,12 +3,13 @@ import os
import numpy as np import numpy as np
import tomllib import tomllib
from abc import abstractmethod, ABC from abc import abstractmethod, ABC
from difflib import SequenceMatcher
from enum import StrEnum from enum import StrEnum
from typing import Any, NamedTuple from typing import Any, NamedTuple
from collections.abc import Callable from collections.abc import Callable
from functools import cache from functools import cache
from cereal import car from cereal import car, custom
from openpilot.common.basedir import BASEDIR from openpilot.common.basedir import BASEDIR
from openpilot.common.conversions import Conversions as CV from openpilot.common.conversions import Conversions as CV
from openpilot.common.simple_kalman import KF1D, get_kalman_gain from openpilot.common.simple_kalman import KF1D, get_kalman_gain
@@ -16,11 +17,14 @@ from openpilot.common.numpy_fast import clip
from openpilot.common.realtime import DT_CTRL from openpilot.common.realtime import DT_CTRL
from openpilot.selfdrive.car import apply_hysteresis, gen_empty_fingerprint, scale_rot_inertia, scale_tire_stiffness, STD_CARGO_KG from openpilot.selfdrive.car import apply_hysteresis, gen_empty_fingerprint, scale_rot_inertia, scale_tire_stiffness, STD_CARGO_KG
from openpilot.selfdrive.car.values import PLATFORMS from openpilot.selfdrive.car.values import PLATFORMS
from openpilot.selfdrive.controls.lib.drive_helpers import V_CRUISE_MAX, get_friction from openpilot.selfdrive.controls.lib.drive_helpers import CRUISE_LONG_PRESS, V_CRUISE_MAX, get_friction
from openpilot.selfdrive.controls.lib.events import Events from openpilot.selfdrive.controls.lib.events import Events
from openpilot.selfdrive.controls.lib.vehicle_model import VehicleModel from openpilot.selfdrive.controls.lib.vehicle_model import VehicleModel
from openpilot.selfdrive.frogpilot.frogpilot_variables import get_frogpilot_toggles, params, params_memory
ButtonType = car.CarState.ButtonEvent.Type ButtonType = car.CarState.ButtonEvent.Type
FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
GearShifter = car.CarState.GearShifter GearShifter = car.CarState.GearShifter
EventName = car.CarEvent.EventName EventName = car.CarEvent.EventName
@@ -29,10 +33,15 @@ ACCEL_MAX = 2.0
ACCEL_MIN = -3.5 ACCEL_MIN = -3.5
FRICTION_THRESHOLD = 0.3 FRICTION_THRESHOLD = 0.3
NEURAL_PARAMS_PATH = os.path.join(BASEDIR, 'selfdrive/car/torque_data/neural_ff_weights.json')
TORQUE_NN_MODEL_PATH = os.path.join(BASEDIR, 'selfdrive/car/torque_data/lat_models')
TORQUE_PARAMS_PATH = os.path.join(BASEDIR, 'selfdrive/car/torque_data/params.toml') TORQUE_PARAMS_PATH = os.path.join(BASEDIR, 'selfdrive/car/torque_data/params.toml')
TORQUE_OVERRIDE_PATH = os.path.join(BASEDIR, 'selfdrive/car/torque_data/override.toml') TORQUE_OVERRIDE_PATH = os.path.join(BASEDIR, 'selfdrive/car/torque_data/override.toml')
TORQUE_SUBSTITUTE_PATH = os.path.join(BASEDIR, 'selfdrive/car/torque_data/substitute.toml') TORQUE_SUBSTITUTE_PATH = os.path.join(BASEDIR, 'selfdrive/car/torque_data/substitute.toml')
# dict used to rename activation functions whose names aren't valid python identifiers
ACTIVATION_FUNCTION_NAMES = {'σ': 'sigmoid'}
GEAR_SHIFTER_MAP: dict[str, car.CarState.GearShifter] = { GEAR_SHIFTER_MAP: dict[str, car.CarState.GearShifter] = {
'P': GearShifter.park, 'PARK': GearShifter.park, 'P': GearShifter.park, 'PARK': GearShifter.park,
'R': GearShifter.reverse, 'REVERSE': GearShifter.reverse, 'R': GearShifter.reverse, 'REVERSE': GearShifter.reverse,
@@ -45,6 +54,8 @@ GEAR_SHIFTER_MAP: dict[str, car.CarState.GearShifter] = {
'B': GearShifter.brake, 'BRAKE': GearShifter.brake, 'B': GearShifter.brake, 'BRAKE': GearShifter.brake,
} }
def similarity(s1: str, s2: str) -> float:
return SequenceMatcher(None, s1, s2).ratio()
class LatControlInputs(NamedTuple): class LatControlInputs(NamedTuple):
lateral_acceleration: float lateral_acceleration: float
@@ -85,6 +96,108 @@ def get_torque_params():
return torque_params return torque_params
# Twilsonco's Lateral Neural Network Feedforward
class FluxModel:
def __init__(self, params_file, zero_bias=False):
with open(params_file, "r") as f:
params = json.load(f)
self.input_size = params["input_size"]
self.output_size = params["output_size"]
self.input_mean = np.array(params["input_mean"], dtype=np.float32).T
self.input_std = np.array(params["input_std"], dtype=np.float32).T
self.layers = []
self.friction_override = False
for layer_params in params["layers"]:
W = np.array(layer_params[next(key for key in layer_params.keys() if key.endswith('_W'))], dtype=np.float32).T
b = np.array(layer_params[next(key for key in layer_params.keys() if key.endswith('_b'))], dtype=np.float32).T
if zero_bias:
b = np.zeros_like(b)
activation = layer_params["activation"]
for k, v in ACTIVATION_FUNCTION_NAMES.items():
activation = activation.replace(k, v)
self.layers.append((W, b, activation))
self.validate_layers()
self.check_for_friction_override()
# Begin activation functions.
# These are called by name using the keys in the model json file
@staticmethod
def sigmoid(x):
return 1 / (1 + np.exp(-x))
@staticmethod
def identity(x):
return x
# End activation functions
def forward(self, x):
for W, b, activation in self.layers:
x = getattr(self, activation)(x.dot(W) + b)
return x
def evaluate(self, input_array):
in_len = len(input_array)
if in_len != self.input_size:
# If the input is length 2-4, then it's a simplified evaluation.
# In that case, need to add on zeros to fill out the input array to match the correct length.
if 2 <= in_len:
input_array = input_array + [0] * (self.input_size - in_len)
else:
raise ValueError(f"Input array length {len(input_array)} must be length 2 or greater")
input_array = np.array(input_array, dtype=np.float32)
# Rescale the input array using the input_mean and input_std
input_array = (input_array - self.input_mean) / self.input_std
output_array = self.forward(input_array)
return float(output_array[0, 0])
def validate_layers(self):
for W, b, activation in self.layers:
if not hasattr(self, activation):
raise ValueError(f"Unknown activation: {activation}")
def check_for_friction_override(self):
y = self.evaluate([10.0, 0.0, 0.2])
self.friction_override = (y < 0.1)
def get_nn_model_path(car, eps_firmware) -> tuple[str | None, float]:
def check_nn_path(check_model):
model_path = None
max_similarity = -1.0
for f in os.listdir(TORQUE_NN_MODEL_PATH):
if f.endswith(".json"):
model = f.replace(".json", "").replace(f"{TORQUE_NN_MODEL_PATH}/", "")
similarity_score = similarity(model, check_model)
if similarity_score > max_similarity:
max_similarity = similarity_score
model_path = os.path.join(TORQUE_NN_MODEL_PATH, f)
return model_path, max_similarity
if len(eps_firmware) > 3:
eps_firmware = eps_firmware.replace("\\", "")
check_model = f"{car} {eps_firmware}"
else:
check_model = car
model_path, max_similarity = check_nn_path(check_model)
if car not in model_path or 0.0 <= max_similarity < 0.9:
check_model = car
model_path, max_similarity = check_nn_path(check_model)
if car not in model_path or 0.0 <= max_similarity < 0.9:
model_path = None
return model_path
def get_nn_model(car, eps_firmware) -> tuple[FluxModel | None, float]:
model = get_nn_model_path(car, eps_firmware)
if model is not None:
model = FluxModel(model)
return model
# generic car and radar interfaces # generic car and radar interfaces
class CarInterfaceBase(ABC): class CarInterfaceBase(ABC):
@@ -110,8 +223,44 @@ class CarInterfaceBase(ABC):
dbc_name = "" if self.cp is None else self.cp.dbc_name dbc_name = "" if self.cp is None else self.cp.dbc_name
self.CC: CarControllerBase = CarController(dbc_name, CP, self.VM) self.CC: CarControllerBase = CarController(dbc_name, CP, self.VM)
def apply(self, c: car.CarControl, now_nanos: int) -> tuple[car.CarControl.Actuators, list[tuple[int, int, bytes, int]]]: # FrogPilot variables
return self.CC.update(c, self.CS, now_nanos) self.frogpilot_toggles = get_frogpilot_toggles()
eps_firmware = str(next((fw.fwVersion for fw in CP.carFw if fw.ecu == "eps"), ""))
comma_nnff_supported = self.check_comma_nn_ff_support(CP.carFingerprint)
nnff_supported = self.initialize_lat_torque_nn(CP.carFingerprint, eps_firmware)
self.use_nnff = not comma_nnff_supported and nnff_supported and self.frogpilot_toggles.nnff
self.use_nnff_lite = not self.use_nnff and self.frogpilot_toggles.nnff_lite
self.always_on_lateral_disabled = False
self.belowSteerSpeed_shown = False
self.disable_belowSteerSpeed = False
self.disable_resumeRequired = False
self.prev_distance_button = False
self.resumeRequired_shown = False
self.traffic_mode_active = False
self.traffic_mode_changed = False
self.gap_counter = 0
self.is_gm = self.CP.carName == "gm"
def get_ff_nn(self, x):
return self.lat_torque_nn_model.evaluate(x)
def check_comma_nn_ff_support(self, car):
with open(NEURAL_PARAMS_PATH, 'r') as file:
data = json.load(file)
return car in data
def initialize_lat_torque_nn(self, car, eps_firmware) -> bool:
self.lat_torque_nn_model = get_nn_model(car, eps_firmware)
return self.lat_torque_nn_model is not None
def apply(self, c: car.CarControl, now_nanos: int, frogpilot_toggles) -> tuple[car.CarControl.Actuators, list[tuple[int, int, bytes, int]]]:
return self.CC.update(c, self.CS, now_nanos, frogpilot_toggles)
@staticmethod @staticmethod
def get_pid_accel_limits(CP, current_speed, cruise_speed): def get_pid_accel_limits(CP, current_speed, cruise_speed):
@@ -122,10 +271,10 @@ class CarInterfaceBase(ABC):
""" """
Parameters essential to controlling the car may be incomplete or wrong without FW versions or fingerprints. Parameters essential to controlling the car may be incomplete or wrong without FW versions or fingerprints.
""" """
return cls.get_params(candidate, gen_empty_fingerprint(), list(), False, False) return cls.get_params(candidate, gen_empty_fingerprint(), list(), False, False, False)
@classmethod @classmethod
def get_params(cls, candidate: str, fingerprint: dict[int, dict[int, int]], car_fw: list[car.CarParams.CarFw], experimental_long: bool, docs: bool): def get_params(cls, candidate: str, fingerprint: dict[int, dict[int, int]], car_fw: list[car.CarParams.CarFw], disable_openpilot_long: bool, experimental_long: bool, params: params, docs: bool):
ret = CarInterfaceBase.get_std_params(candidate) ret = CarInterfaceBase.get_std_params(candidate)
platform = PLATFORMS[candidate] platform = PLATFORMS[candidate]
@@ -138,7 +287,15 @@ class CarInterfaceBase(ABC):
ret.tireStiffnessFactor = platform.config.specs.tireStiffnessFactor ret.tireStiffnessFactor = platform.config.specs.tireStiffnessFactor
ret.flags |= int(platform.config.flags) ret.flags |= int(platform.config.flags)
ret = cls._get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs) ret = cls._get_params(ret, candidate, fingerprint, car_fw, disable_openpilot_long, experimental_long, docs)
# Enable torque controller for all cars that do not use angle based steering
if ret.steerControlType != car.CarParams.SteerControlType.angle and params.get_bool("LateralTune") and params.get_bool("NNFF"):
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
eps_firmware = str(next((fw.fwVersion for fw in car_fw if fw.ecu == "eps"), ""))
model = get_nn_model_path(candidate, eps_firmware)
if model is not None:
params.put("NNFFModelName", candidate.replace("_", " "))
# Vehicle mass is published curb weight plus assumed payload such as a human driver; notCars have no assumed payload # Vehicle mass is published curb weight plus assumed payload such as a human driver; notCars have no assumed payload
if not ret.notCar: if not ret.notCar:
@@ -230,14 +387,14 @@ class CarInterfaceBase(ABC):
def _update(self, c: car.CarControl) -> car.CarState: def _update(self, c: car.CarControl) -> car.CarState:
pass pass
def update(self, c: car.CarControl, can_strings: list[bytes]) -> car.CarState: def update(self, c: car.CarControl, can_strings: list[bytes], frogpilot_toggles) -> car.CarState:
# parse can # parse can
for cp in self.can_parsers: for cp in self.can_parsers:
if cp is not None: if cp is not None:
cp.update_strings(can_strings) cp.update_strings(can_strings)
# get CarState # get CarState
ret = self._update(c) ret, fp_ret = self._update(c, frogpilot_toggles)
ret.canValid = all(cp.can_valid for cp in self.can_parsers if cp is not None) ret.canValid = all(cp.can_valid for cp in self.can_parsers if cp is not None)
ret.canTimeout = any(cp.bus_timeout for cp in self.can_parsers if cp is not None) ret.canTimeout = any(cp.bus_timeout for cp in self.can_parsers if cp is not None)
@@ -256,11 +413,18 @@ class CarInterfaceBase(ABC):
if ret.cruiseState.speedCluster == 0: if ret.cruiseState.speedCluster == 0:
ret.cruiseState.speedCluster = ret.cruiseState.speed ret.cruiseState.speedCluster = ret.cruiseState.speed
# Add any additional frogpilotCarStates
fp_ret.alwaysOnLateralDisabled = self.always_on_lateral_disabled
fp_ret.distanceLongPressed = self.frogpilot_distance_functions(frogpilot_toggles)
fp_ret.ecoGear |= ret.gearShifter == GearShifter.eco
fp_ret.sportGear |= ret.gearShifter == GearShifter.sport
fp_ret.trafficModeActive = self.traffic_mode_active
# copy back for next iteration # copy back for next iteration
if self.CS is not None: if self.CS is not None:
self.CS.out = ret.as_reader() self.CS.out = ret.as_reader()
return ret return ret, fp_ret
def create_common_events(self, cs_out, extra_gears=None, pcm_enable=True, allow_enable=True, def create_common_events(self, cs_out, extra_gears=None, pcm_enable=True, allow_enable=True,
@@ -310,6 +474,10 @@ class CarInterfaceBase(ABC):
if b.type == ButtonType.cancel: if b.type == ButtonType.cancel:
events.add(EventName.buttonCancel) events.add(EventName.buttonCancel)
# FrogPilot button presses
if b.type == FrogPilotButtonType.lkas and b.pressed:
self.always_on_lateral_disabled = not self.always_on_lateral_disabled
# Handle permanent and temporary steering faults # Handle permanent and temporary steering faults
self.steering_unpressed = 0 if cs_out.steeringPressed else self.steering_unpressed + 1 self.steering_unpressed = 0 if cs_out.steeringPressed else self.steering_unpressed + 1
if cs_out.steerFaultTemporary: if cs_out.steerFaultTemporary:
@@ -340,6 +508,30 @@ class CarInterfaceBase(ABC):
return events return events
def frogpilot_distance_functions(self, frogpilot_toggles):
distance_button = self.CS.distance_button or params_memory.get_bool("OnroadDistanceButtonPressed")
if distance_button:
self.gap_counter += 1
elif not self.prev_distance_button:
self.gap_counter = 0
if self.gap_counter == CRUISE_LONG_PRESS * (1.5 if self.is_gm else 1) and frogpilot_toggles.experimental_mode_via_distance or self.traffic_mode_changed:
if frogpilot_toggles.conditional_experimental_mode:
conditional_status = params_memory.get_int("CEStatus")
override_value = 0 if conditional_status in {1, 2, 3, 4, 5, 6} else 1 if conditional_status >= 7 else 2
params_memory.put_int("CEStatus", override_value)
else:
experimental_mode = params.get_bool("ExperimentalMode")
params.put_bool("ExperimentalMode", not experimental_mode)
self.traffic_mode_changed = False
if self.gap_counter == CRUISE_LONG_PRESS * 5:
self.traffic_mode_active = not self.traffic_mode_active
self.traffic_mode_changed = frogpilot_toggles.experimental_mode_via_distance
self.prev_distance_button = distance_button
return self.gap_counter >= CRUISE_LONG_PRESS
class RadarInterfaceBase(ABC): class RadarInterfaceBase(ABC):
def __init__(self, CP): def __init__(self, CP):
@@ -379,6 +571,12 @@ class CarStateBase(ABC):
K = get_kalman_gain(DT_CTRL, np.array(A), np.array(C), np.array(Q), R) K = get_kalman_gain(DT_CTRL, np.array(A), np.array(C), np.array(Q), R)
self.v_ego_kf = KF1D(x0=x0, A=A, C=C[0], K=K) self.v_ego_kf = KF1D(x0=x0, A=A, C=C[0], K=K)
# FrogPilot variables
self.cruise_decreased = False
self.cruise_increased = False
self.distance_button = False
self.lkas_enabled = False
def update_speed_kf(self, v_ego_raw): def update_speed_kf(self, v_ego_raw):
if abs(v_ego_raw - self.v_ego_kf.x[0][0]) > 2.0: # Prevent large accelerations when car starts at non zero speed if abs(v_ego_raw - self.v_ego_kf.x[0][0]) > 2.0: # Prevent large accelerations when car starts at non zero speed
self.v_ego_kf.set_x([[v_ego_raw], [0.0]]) self.v_ego_kf.set_x([[v_ego_raw], [0.0]])
+1 -1
View File
@@ -16,7 +16,7 @@ class CarController(CarControllerBase):
self.brake_counter = 0 self.brake_counter = 0
self.frame = 0 self.frame = 0
def update(self, CC, CS, now_nanos): def update(self, CC, CS, now_nanos, frogpilot_toggles):
can_sends = [] can_sends = []
apply_steer = 0 apply_steer = 0
+8 -3
View File
@@ -1,4 +1,4 @@
from cereal import car from cereal import car, custom
from openpilot.common.conversions import Conversions as CV from openpilot.common.conversions import Conversions as CV
from opendbc.can.can_define import CANDefine from opendbc.can.can_define import CANDefine
from opendbc.can.parser import CANParser from opendbc.can.parser import CANParser
@@ -21,9 +21,10 @@ class CarState(CarStateBase):
self.prev_distance_button = 0 self.prev_distance_button = 0
self.distance_button = 0 self.distance_button = 0
def update(self, cp, cp_cam): def update(self, cp, cp_cam, frogpilot_toggles):
ret = car.CarState.new_message() ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()
self.prev_distance_button = self.distance_button self.prev_distance_button = self.distance_button
self.distance_button = cp.vl["CRZ_BTNS"]["DISTANCE_LESS"] self.distance_button = cp.vl["CRZ_BTNS"]["DISTANCE_LESS"]
@@ -110,7 +111,11 @@ class CarState(CarStateBase):
self.cam_laneinfo = cp_cam.vl["CAM_LANEINFO"] self.cam_laneinfo = cp_cam.vl["CAM_LANEINFO"]
ret.steerFaultPermanent = cp_cam.vl["CAM_LKAS"]["ERR_BIT_1"] == 1 ret.steerFaultPermanent = cp_cam.vl["CAM_LKAS"]["ERR_BIT_1"] == 1
return ret # FrogPilot CarState functions
self.lkas_previously_enabled = self.lkas_enabled
self.lkas_enabled = not self.lkas_disabled
return ret, fp_ret
@staticmethod @staticmethod
def get_can_parser(CP): def get_can_parser(CP):
+10 -8
View File
@@ -1,23 +1,22 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from cereal import car from cereal import car, custom
from openpilot.common.conversions import Conversions as CV from openpilot.common.conversions import Conversions as CV
from openpilot.selfdrive.car.mazda.values import CAR, LKAS_LIMITS from openpilot.selfdrive.car.mazda.values import CAR, LKAS_LIMITS
from openpilot.selfdrive.car import create_button_events, get_safety_config from openpilot.selfdrive.car import create_button_events, get_safety_config
from openpilot.selfdrive.car.interfaces import CarInterfaceBase from openpilot.selfdrive.car.interfaces import CarInterfaceBase
ButtonType = car.CarState.ButtonEvent.Type ButtonType = car.CarState.ButtonEvent.Type
FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
EventName = car.CarEvent.EventName EventName = car.CarEvent.EventName
class CarInterface(CarInterfaceBase): class CarInterface(CarInterfaceBase):
@staticmethod @staticmethod
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): def _get_params(ret, candidate, fingerprint, car_fw, disable_openpilot_long, experimental_long, docs):
ret.carName = "mazda" ret.carName = "mazda"
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.mazda)] ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.mazda)]
ret.radarUnavailable = True ret.radarUnavailable = True
ret.dashcamOnly = candidate not in (CAR.MAZDA_CX5_2022, CAR.MAZDA_CX9_2021)
ret.steerActuatorDelay = 0.1 ret.steerActuatorDelay = 0.1
ret.steerLimitTimer = 0.8 ret.steerLimitTimer = 0.8
@@ -31,11 +30,14 @@ class CarInterface(CarInterfaceBase):
return ret return ret
# returns a car.CarState # returns a car.CarState
def _update(self, c): def _update(self, c, frogpilot_toggles):
ret = self.CS.update(self.cp, self.cp_cam) ret, fp_ret = self.CS.update(self.cp, self.cp_cam, frogpilot_toggles)
# TODO: add button types for inc and dec # TODO: add button types for inc and dec
ret.buttonEvents = create_button_events(self.CS.distance_button, self.CS.prev_distance_button, {1: ButtonType.gapAdjustCruise}) ret.buttonEvents = [
*create_button_events(self.CS.distance_button, self.CS.prev_distance_button, {1: ButtonType.gapAdjustCruise}),
*create_button_events(self.CS.lkas_enabled, self.CS.lkas_previously_enabled, {1: FrogPilotButtonType.lkas}),
]
# events # events
events = self.create_common_events(ret) events = self.create_common_events(ret)
@@ -47,4 +49,4 @@ class CarInterface(CarInterfaceBase):
ret.events = events.to_msg() ret.events = events.to_msg()
return ret return ret, fp_ret
+5 -4
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from cereal import car from cereal import car, custom
import cereal.messaging as messaging import cereal.messaging as messaging
from openpilot.selfdrive.car.interfaces import CarInterfaceBase from openpilot.selfdrive.car.interfaces import CarInterfaceBase
@@ -12,7 +12,7 @@ class CarInterface(CarInterfaceBase):
self.sm = messaging.SubMaster(['gpsLocation', 'gpsLocationExternal']) self.sm = messaging.SubMaster(['gpsLocation', 'gpsLocationExternal'])
@staticmethod @staticmethod
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): def _get_params(ret, candidate, fingerprint, car_fw, disable_openpilot_long, experimental_long, docs):
ret.carName = "mock" ret.carName = "mock"
ret.mass = 1700. ret.mass = 1700.
ret.wheelbase = 2.70 ret.wheelbase = 2.70
@@ -21,12 +21,13 @@ class CarInterface(CarInterfaceBase):
ret.dashcamOnly = True ret.dashcamOnly = True
return ret return ret
def _update(self, c): def _update(self, c, frogpilot_toggles):
self.sm.update(0) self.sm.update(0)
gps_sock = 'gpsLocationExternal' if self.sm.recv_frame['gpsLocationExternal'] > 1 else 'gpsLocation' gps_sock = 'gpsLocationExternal' if self.sm.recv_frame['gpsLocationExternal'] > 1 else 'gpsLocation'
ret = car.CarState.new_message() ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()
ret.vEgo = self.sm[gps_sock].speed ret.vEgo = self.sm[gps_sock].speed
ret.vEgoRaw = self.sm[gps_sock].speed ret.vEgoRaw = self.sm[gps_sock].speed
return ret return ret, fp_ret
+2 -2
View File
@@ -19,7 +19,7 @@ class CarController(CarControllerBase):
self.packer = CANPacker(dbc_name) self.packer = CANPacker(dbc_name)
def update(self, CC, CS, now_nanos): def update(self, CC, CS, now_nanos, frogpilot_toggles):
actuators = CC.actuators actuators = CC.actuators
hud_control = CC.hudControl hud_control = CC.hudControl
pcm_cancel_cmd = CC.cruiseControl.cancel pcm_cancel_cmd = CC.cruiseControl.cancel
@@ -68,7 +68,7 @@ class CarController(CarControllerBase):
if self.CP.carFingerprint != CAR.NISSAN_ALTIMA: if self.CP.carFingerprint != CAR.NISSAN_ALTIMA:
if self.frame % 2 == 0: if self.frame % 2 == 0:
can_sends.append(nissancan.create_lkas_hud_msg(self.packer, CS.lkas_hud_msg, CC.enabled, hud_control.leftLaneVisible, hud_control.rightLaneVisible, can_sends.append(nissancan.create_lkas_hud_msg(self.packer, CS.lkas_hud_msg, CC.enabled, hud_control.leftLaneVisible, hud_control.rightLaneVisible,
hud_control.leftLaneDepart, hud_control.rightLaneDepart)) hud_control.leftLaneDepart, hud_control.rightLaneDepart, CC.latActive))
if self.frame % 50 == 0: if self.frame % 50 == 0:
can_sends.append(nissancan.create_lkas_hud_info_msg( can_sends.append(nissancan.create_lkas_hud_info_msg(
+5 -3
View File
@@ -1,6 +1,6 @@
import copy import copy
from collections import deque from collections import deque
from cereal import car from cereal import car, custom
from opendbc.can.can_define import CANDefine from opendbc.can.can_define import CANDefine
from openpilot.selfdrive.car.interfaces import CarStateBase from openpilot.selfdrive.car.interfaces import CarStateBase
from openpilot.common.conversions import Conversions as CV from openpilot.common.conversions import Conversions as CV
@@ -23,8 +23,9 @@ class CarState(CarStateBase):
self.prev_distance_button = 0 self.prev_distance_button = 0
self.distance_button = 0 self.distance_button = 0
def update(self, cp, cp_adas, cp_cam): def update(self, cp, cp_adas, cp_cam, frogpilot_toggles):
ret = car.CarState.new_message() ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()
self.prev_distance_button = self.distance_button self.prev_distance_button = self.distance_button
self.distance_button = cp.vl["CRUISE_THROTTLE"]["FOLLOW_DISTANCE_BUTTON"] self.distance_button = cp.vl["CRUISE_THROTTLE"]["FOLLOW_DISTANCE_BUTTON"]
@@ -107,6 +108,7 @@ class CarState(CarStateBase):
can_gear = int(cp.vl["GEARBOX"]["GEAR_SHIFTER"]) can_gear = int(cp.vl["GEARBOX"]["GEAR_SHIFTER"])
ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(can_gear, None)) ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(can_gear, None))
self.lkas_previously_enabled = self.lkas_enabled
if self.CP.carFingerprint == CAR.NISSAN_ALTIMA: if self.CP.carFingerprint == CAR.NISSAN_ALTIMA:
self.lkas_enabled = bool(cp.vl["LKAS_SETTINGS"]["LKAS_ENABLED"]) self.lkas_enabled = bool(cp.vl["LKAS_SETTINGS"]["LKAS_ENABLED"])
else: else:
@@ -121,7 +123,7 @@ class CarState(CarStateBase):
self.lkas_hud_msg = copy.copy(cp_adas.vl["PROPILOT_HUD"]) self.lkas_hud_msg = copy.copy(cp_adas.vl["PROPILOT_HUD"])
self.lkas_hud_info_msg = copy.copy(cp_adas.vl["PROPILOT_HUD_INFO_MSG"]) self.lkas_hud_info_msg = copy.copy(cp_adas.vl["PROPILOT_HUD_INFO_MSG"])
return ret return ret, fp_ret
@staticmethod @staticmethod
def get_can_parser(CP): def get_can_parser(CP):
+10 -6
View File
@@ -1,16 +1,17 @@
from cereal import car from cereal import car, custom
from panda import Panda from panda import Panda
from openpilot.selfdrive.car import create_button_events, get_safety_config from openpilot.selfdrive.car import create_button_events, get_safety_config
from openpilot.selfdrive.car.interfaces import CarInterfaceBase from openpilot.selfdrive.car.interfaces import CarInterfaceBase
from openpilot.selfdrive.car.nissan.values import CAR from openpilot.selfdrive.car.nissan.values import CAR
ButtonType = car.CarState.ButtonEvent.Type ButtonType = car.CarState.ButtonEvent.Type
FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
class CarInterface(CarInterfaceBase): class CarInterface(CarInterfaceBase):
@staticmethod @staticmethod
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): def _get_params(ret, candidate, fingerprint, car_fw, disable_openpilot_long, experimental_long, docs):
ret.carName = "nissan" ret.carName = "nissan"
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.nissan)] ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.nissan)]
ret.autoResumeSng = False ret.autoResumeSng = False
@@ -29,10 +30,13 @@ class CarInterface(CarInterfaceBase):
return ret return ret
# returns a car.CarState # returns a car.CarState
def _update(self, c): def _update(self, c, frogpilot_toggles):
ret = self.CS.update(self.cp, self.cp_adas, self.cp_cam) ret, fp_ret = self.CS.update(self.cp, self.cp_adas, self.cp_cam, frogpilot_toggles)
ret.buttonEvents = create_button_events(self.CS.distance_button, self.CS.prev_distance_button, {1: ButtonType.gapAdjustCruise}) ret.buttonEvents = [
*create_button_events(self.CS.distance_button, self.CS.prev_distance_button, {1: ButtonType.gapAdjustCruise}),
*create_button_events(self.CS.lkas_enabled, self.CS.lkas_previously_enabled, {1: FrogPilotButtonType.lkas}),
]
events = self.create_common_events(ret, extra_gears=[car.CarState.GearShifter.brake]) events = self.create_common_events(ret, extra_gears=[car.CarState.GearShifter.brake])
@@ -41,4 +45,4 @@ class CarInterface(CarInterfaceBase):
ret.events = events.to_msg() ret.events = events.to_msg()
return ret return ret, fp_ret
+4 -4
View File
@@ -65,7 +65,7 @@ def create_cancel_msg(packer, cancel_msg, cruise_cancel):
return packer.make_can_msg("CANCEL_MSG", 2, values) return packer.make_can_msg("CANCEL_MSG", 2, values)
def create_lkas_hud_msg(packer, lkas_hud_msg, enabled, left_line, right_line, left_lane_depart, right_lane_depart): def create_lkas_hud_msg(packer, lkas_hud_msg, enabled, left_line, right_line, left_lane_depart, right_lane_depart, lat_active):
values = {s: lkas_hud_msg[s] for s in [ values = {s: lkas_hud_msg[s] for s in [
"LARGE_WARNING_FLASHING", "LARGE_WARNING_FLASHING",
"SIDE_RADAR_ERROR_FLASHING1", "SIDE_RADAR_ERROR_FLASHING1",
@@ -98,9 +98,9 @@ def create_lkas_hud_msg(packer, lkas_hud_msg, enabled, left_line, right_line, le
values["RIGHT_LANE_YELLOW_FLASH"] = 1 if right_lane_depart else 0 values["RIGHT_LANE_YELLOW_FLASH"] = 1 if right_lane_depart else 0
values["LEFT_LANE_YELLOW_FLASH"] = 1 if left_lane_depart else 0 values["LEFT_LANE_YELLOW_FLASH"] = 1 if left_lane_depart else 0
values["LARGE_STEERING_WHEEL_ICON"] = 2 if enabled else 0 values["LARGE_STEERING_WHEEL_ICON"] = 2 if lat_active else 0
values["RIGHT_LANE_GREEN"] = 1 if right_line and enabled else 0 values["RIGHT_LANE_GREEN"] = 1 if right_line and lat_active else 0
values["LEFT_LANE_GREEN"] = 1 if left_line and enabled else 0 values["LEFT_LANE_GREEN"] = 1 if left_line and lat_active else 0
return packer.make_can_msg("PROPILOT_HUD", 0, values) return packer.make_can_msg("PROPILOT_HUD", 0, values)
+5 -1
View File
@@ -48,7 +48,11 @@ class CAR(Platforms):
) )
# Leaf with ADAS ECU found behind instrument cluster instead of glovebox # Leaf with ADAS ECU found behind instrument cluster instead of glovebox
# Currently the only known difference between them is the inverted seatbelt signal. # Currently the only known difference between them is the inverted seatbelt signal.
NISSAN_LEAF_IC = NISSAN_LEAF.override(car_docs=[]) NISSAN_LEAF_IC = NissanPlatformConfig(
[NissanCarDocs("Nissan Leaf 2018-23 - Instrument Cluster", video_link="https://youtu.be/vaMbtAh_0cY")],
NISSAN_LEAF.specs,
dbc_dict('nissan_leaf_2018_generated', None),
)
NISSAN_ROGUE = NissanPlatformConfig( NISSAN_ROGUE = NissanPlatformConfig(
[NissanCarDocs("Nissan Rogue 2018-20")], [NissanCarDocs("Nissan Rogue 2018-20")],
NissanCarSpecs(mass=1610, wheelbase=2.705) NissanCarSpecs(mass=1610, wheelbase=2.705)
+47
View File
@@ -0,0 +1,47 @@
import struct
from Crypto.Hash import CMAC
from Crypto.Cipher import AES
def add_mac(key, trip_cnt, reset_cnt, msg_cnt, msg):
# TODO: clean up conversion to and from hex
addr, payload, bus = msg
reset_flag = reset_cnt & 0b11
msg_cnt_flag = msg_cnt & 0b11
payload = payload[:4]
# Step 1: Build Freshness Value (48 bits)
# [Trip Counter (16 bit)][[Reset Counter (20 bit)][Message Counter (8 bit)][Reset Flag (2 bit)][Padding (2 bit)]
freshness_value = struct.pack('>HI', trip_cnt, (reset_cnt << 12) | ((msg_cnt & 0xff) << 4) | (reset_flag << 2))
# Step 2: Build data to authenticate (96 bits)
# [Message ID (16 bits)][Payload (32 bits)][Freshness Value (48 bits)]
to_auth = struct.pack('>H', addr) + payload + freshness_value
# Step 3: Calculate CMAC (28 bit)
cmac = CMAC.new(key, ciphermod=AES)
cmac.update(to_auth)
mac = cmac.digest().hex()[:7] # truncated MAC
# Step 4: Build message
# [Payload (32 bit)][Message Counter Flag (2 bit)][Reset Flag (2 bit)][Authenticator (28 bit)]
msg_cnt_rst_flag = struct.pack('>B', (msg_cnt_flag << 2) | reset_flag).hex()[1]
msg = payload.hex() + msg_cnt_rst_flag + mac
payload = bytes.fromhex(msg)
return (addr, payload, bus)
def build_sync_mac(key, trip_cnt, reset_cnt, id_=0xf):
id_ = struct.pack('>H', id_) # 16
trip_cnt = struct.pack('>H', trip_cnt) # 16
reset_cnt = struct.pack('>I', reset_cnt << 12)[:-1] # 20 + 4 padding
to_auth = id_ + trip_cnt + reset_cnt # SecOC 11.4.1.1 page 138
cmac = CMAC.new(key, ciphermod=AES)
cmac.update(to_auth)
msg = "0" + cmac.digest().hex()[:7]
msg = bytes.fromhex(msg)
return struct.unpack('>I', msg)[0]
+2 -2
View File
@@ -23,7 +23,7 @@ class CarController(CarControllerBase):
self.p = CarControllerParams(CP) self.p = CarControllerParams(CP)
self.packer = CANPacker(DBC[CP.carFingerprint]['pt']) self.packer = CANPacker(DBC[CP.carFingerprint]['pt'])
def update(self, CC, CS, now_nanos): def update(self, CC, CS, now_nanos, frogpilot_toggles):
actuators = CC.actuators actuators = CC.actuators
hud_control = CC.hudControl hud_control = CC.hudControl
pcm_cancel_cmd = CC.cruiseControl.cancel pcm_cancel_cmd = CC.cruiseControl.cancel
@@ -100,7 +100,7 @@ class CarController(CarControllerBase):
can_sends.append(subarucan.create_es_lkas_state(self.packer, self.frame // 10, CS.es_lkas_state_msg, CC.enabled, hud_control.visualAlert, can_sends.append(subarucan.create_es_lkas_state(self.packer, self.frame // 10, CS.es_lkas_state_msg, CC.enabled, hud_control.visualAlert,
hud_control.leftLaneVisible, hud_control.rightLaneVisible, hud_control.leftLaneVisible, hud_control.rightLaneVisible,
hud_control.leftLaneDepart, hud_control.rightLaneDepart)) hud_control.leftLaneDepart, hud_control.rightLaneDepart, CC.latActive))
if self.CP.flags & SubaruFlags.SEND_INFOTAINMENT: if self.CP.flags & SubaruFlags.SEND_INFOTAINMENT:
can_sends.append(subarucan.create_es_infotainment(self.packer, self.frame // 10, CS.es_infotainment_msg, hud_control.visualAlert)) can_sends.append(subarucan.create_es_infotainment(self.packer, self.frame // 10, CS.es_infotainment_msg, hud_control.visualAlert))
+14 -5
View File
@@ -1,10 +1,10 @@
import copy import copy
from cereal import car from cereal import car, custom
from opendbc.can.can_define import CANDefine from opendbc.can.can_define import CANDefine
from openpilot.common.conversions import Conversions as CV from openpilot.common.conversions import Conversions as CV
from openpilot.selfdrive.car.interfaces import CarStateBase from openpilot.selfdrive.car.interfaces import CarStateBase
from opendbc.can.parser import CANParser from opendbc.can.parser import CANParser
from openpilot.selfdrive.car.subaru.values import DBC, CanBus, SubaruFlags from openpilot.selfdrive.car.subaru.values import DBC, CanBus, PREGLOBAL_CARS, SubaruFlags
from openpilot.selfdrive.car import CanSignalRateCalculator from openpilot.selfdrive.car import CanSignalRateCalculator
@@ -16,8 +16,9 @@ class CarState(CarStateBase):
self.angle_rate_calulator = CanSignalRateCalculator(50) self.angle_rate_calulator = CanSignalRateCalculator(50)
def update(self, cp, cp_cam, cp_body): def update(self, cp, cp_cam, cp_body, frogpilot_toggles):
ret = car.CarState.new_message() ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()
throttle_msg = cp.vl["Throttle"] if not (self.CP.flags & SubaruFlags.HYBRID) else cp_body.vl["Throttle_Hybrid"] throttle_msg = cp.vl["Throttle"] if not (self.CP.flags & SubaruFlags.HYBRID) else cp_body.vl["Throttle_Hybrid"]
ret.gas = throttle_msg["Throttle_Pedal"] / 255. ret.gas = throttle_msg["Throttle_Pedal"] / 255.
@@ -125,7 +126,15 @@ class CarState(CarStateBase):
if self.CP.flags & SubaruFlags.SEND_INFOTAINMENT: if self.CP.flags & SubaruFlags.SEND_INFOTAINMENT:
self.es_infotainment_msg = copy.copy(cp_cam.vl["ES_Infotainment"]) self.es_infotainment_msg = copy.copy(cp_cam.vl["ES_Infotainment"])
return ret # FrogPilot CarState functions
self.lkas_previously_enabled = self.lkas_enabled
if self.car_fingerprint not in PREGLOBAL_CARS:
fp_ret.brakeLights = bool(cp_cam.vl["ES_DashStatus"]["Brake_Lights"])
self.lkas_enabled = self.es_lkas_state_msg.get("LKAS_Dash_State")
else:
fp_ret.brakeLights = bool(cp_cam.vl["ES_Brake"]["Cruise_Brake_Lights"])
return ret, fp_ret
@staticmethod @staticmethod
def get_common_global_body_messages(CP): def get_common_global_body_messages(CP):
@@ -196,6 +205,7 @@ class CarState(CarStateBase):
messages = [ messages = [
("ES_DashStatus", 20), ("ES_DashStatus", 20),
("ES_Distance", 20), ("ES_Distance", 20),
("ES_Brake", 20),
] ]
else: else:
messages = [ messages = [
@@ -226,4 +236,3 @@ class CarState(CarStateBase):
] ]
return CANParser(DBC[CP.carFingerprint]["pt"], messages, CanBus.alt) return CANParser(DBC[CP.carFingerprint]["pt"], messages, CanBus.alt)
+16 -9
View File
@@ -1,22 +1,25 @@
from cereal import car from cereal import car, custom
from panda import Panda from panda import Panda
from openpilot.selfdrive.car import get_safety_config from openpilot.selfdrive.car import create_button_events, get_safety_config
from openpilot.selfdrive.car.disable_ecu import disable_ecu from openpilot.selfdrive.car.disable_ecu import disable_ecu
from openpilot.selfdrive.car.interfaces import CarInterfaceBase from openpilot.selfdrive.car.interfaces import CarInterfaceBase
from openpilot.selfdrive.car.subaru.values import CAR, GLOBAL_ES_ADDR, SubaruFlags from openpilot.selfdrive.car.subaru.values import CAR, GLOBAL_ES_ADDR, SubaruFlags
from openpilot.selfdrive.frogpilot.frogpilot_variables import get_frogpilot_toggles
FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
class CarInterface(CarInterfaceBase): class CarInterface(CarInterfaceBase):
@staticmethod @staticmethod
def _get_params(ret, candidate: CAR, fingerprint, car_fw, experimental_long, docs): def _get_params(ret, candidate: CAR, fingerprint, car_fw, disable_openpilot_long, experimental_long, docs):
ret.carName = "subaru" ret.carName = "subaru"
ret.radarUnavailable = True ret.radarUnavailable = True
# for HYBRID CARS to be upstreamed, we need: # for HYBRID CARS to be upstreamed, we need:
# - replacement for ES_Distance so we can cancel the cruise control # - replacement for ES_Distance so we can cancel the cruise control
# - to find the Cruise_Activated bit from the car # - to find the Cruise_Activated bit from the car
# - proper panda safety setup (use the correct cruise_activated bit, throttle from Throttle_Hybrid, etc) # - proper panda safety setup (use the correct cruise_activated bit, throttle from Throttle_Hybrid, etc)
ret.dashcamOnly = bool(ret.flags & (SubaruFlags.PREGLOBAL | SubaruFlags.LKAS_ANGLE | SubaruFlags.HYBRID)) ret.dashcamOnly = bool(ret.flags & (SubaruFlags.LKAS_ANGLE | SubaruFlags.HYBRID))
ret.autoResumeSng = False ret.autoResumeSng = False
# Detect infotainment message sent from the camera # Detect infotainment message sent from the camera
@@ -50,9 +53,9 @@ class CarInterface(CarInterfaceBase):
elif candidate == CAR.SUBARU_IMPREZA: elif candidate == CAR.SUBARU_IMPREZA:
ret.steerActuatorDelay = 0.4 # end-to-end angle controller ret.steerActuatorDelay = 0.4 # end-to-end angle controller
ret.lateralTuning.init('pid') ret.lateralTuning.init('pid')
ret.lateralTuning.pid.kf = 0.00005 ret.lateralTuning.pid.kf = 0.00003333
ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[0., 20.], [0., 20.]] ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[0., 20.], [0., 20.]]
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2, 0.3], [0.02, 0.03]] ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.133, 0.2], [0.0133, 0.02]]
elif candidate == CAR.SUBARU_IMPREZA_2020: elif candidate == CAR.SUBARU_IMPREZA_2020:
ret.lateralTuning.init('pid') ret.lateralTuning.init('pid')
@@ -97,13 +100,17 @@ class CarInterface(CarInterfaceBase):
return ret return ret
# returns a car.CarState # returns a car.CarState
def _update(self, c): def _update(self, c, frogpilot_toggles):
ret = self.CS.update(self.cp, self.cp_cam, self.cp_body) ret, fp_ret = self.CS.update(self.cp, self.cp_cam, self.cp_body, frogpilot_toggles)
ret.buttonEvents = [
*create_button_events(self.CS.lkas_enabled, self.CS.lkas_previously_enabled, {1: FrogPilotButtonType.lkas}),
]
ret.events = self.create_common_events(ret).to_msg() ret.events = self.create_common_events(ret).to_msg()
return ret return ret, fp_ret
@staticmethod @staticmethod
def init(CP, logcan, sendcan): def init(CP, logcan, sendcan):
+4 -2
View File
@@ -66,7 +66,7 @@ def create_es_distance(packer, frame, es_distance_msg, bus, pcm_cancel_cmd, long
return packer.make_can_msg("ES_Distance", bus, values) return packer.make_can_msg("ES_Distance", bus, values)
def create_es_lkas_state(packer, frame, es_lkas_state_msg, enabled, visual_alert, left_line, right_line, left_lane_depart, right_lane_depart): def create_es_lkas_state(packer, frame, es_lkas_state_msg, enabled, visual_alert, left_line, right_line, left_lane_depart, right_lane_depart, lat_active):
values = {s: es_lkas_state_msg[s] for s in [ values = {s: es_lkas_state_msg[s] for s in [
"CHECKSUM", "CHECKSUM",
"LKAS_Alert_Msg", "LKAS_Alert_Msg",
@@ -118,9 +118,11 @@ def create_es_lkas_state(packer, frame, es_lkas_state_msg, enabled, visual_alert
elif right_lane_depart: elif right_lane_depart:
values["LKAS_Alert"] = 11 # Right lane departure dash alert values["LKAS_Alert"] = 11 # Right lane departure dash alert
if enabled: if lat_active:
values["LKAS_ACTIVE"] = 1 # Show LKAS lane lines values["LKAS_ACTIVE"] = 1 # Show LKAS lane lines
values["LKAS_Dash_State"] = 2 # Green enabled indicator values["LKAS_Dash_State"] = 2 # Green enabled indicator
values["LKAS_Left_Line_Enable"] = 1
values["LKAS_Right_Line_Enable"] = 1
else: else:
values["LKAS_Dash_State"] = 0 # LKAS Not enabled values["LKAS_Dash_State"] = 0 # LKAS Not enabled
+6
View File
@@ -7,6 +7,8 @@ from openpilot.selfdrive.car import CarSpecs, DbcDict, PlatformConfig, Platforms
from openpilot.selfdrive.car.docs_definitions import CarFootnote, CarHarness, CarDocs, CarParts, Tool, Column from openpilot.selfdrive.car.docs_definitions import CarFootnote, CarHarness, CarDocs, CarParts, Tool, Column
from openpilot.selfdrive.car.fw_query_definitions import FwQueryConfig, Request, StdQueries, p16 from openpilot.selfdrive.car.fw_query_definitions import FwQueryConfig, Request, StdQueries, p16
from openpilot.selfdrive.frogpilot.frogpilot_variables import get_frogpilot_toggles
Ecu = car.CarParams.Ecu Ecu = car.CarParams.Ecu
@@ -25,6 +27,8 @@ class CarControllerParams:
self.STEER_DELTA_DOWN = 40 self.STEER_DELTA_DOWN = 40
elif CP.carFingerprint == CAR.SUBARU_IMPREZA_2020: elif CP.carFingerprint == CAR.SUBARU_IMPREZA_2020:
self.STEER_MAX = 1439 self.STEER_MAX = 1439
elif CP.carFingerprint == CAR.SUBARU_IMPREZA:
self.STEER_MAX = 3071
else: else:
self.STEER_MAX = 2047 self.STEER_MAX = 2047
@@ -208,6 +212,8 @@ class CAR(Platforms):
) )
PREGLOBAL_CARS = {CAR.SUBARU_FORESTER_PREGLOBAL, CAR.SUBARU_LEGACY_PREGLOBAL, CAR.SUBARU_OUTBACK_PREGLOBAL, CAR.SUBARU_OUTBACK_PREGLOBAL_2018}
SUBARU_VERSION_REQUEST = bytes([uds.SERVICE_TYPE.READ_DATA_BY_IDENTIFIER]) + \ SUBARU_VERSION_REQUEST = bytes([uds.SERVICE_TYPE.READ_DATA_BY_IDENTIFIER]) + \
p16(uds.DATA_IDENTIFIER_TYPE.APPLICATION_DATA_IDENTIFICATION) p16(uds.DATA_IDENTIFIER_TYPE.APPLICATION_DATA_IDENTIFICATION)
SUBARU_VERSION_RESPONSE = bytes([uds.SERVICE_TYPE.READ_DATA_BY_IDENTIFIER + 0x40]) + \ SUBARU_VERSION_RESPONSE = bytes([uds.SERVICE_TYPE.READ_DATA_BY_IDENTIFIER + 0x40]) + \
+1 -1
View File
@@ -15,7 +15,7 @@ class CarController(CarControllerBase):
self.pt_packer = CANPacker(DBC[CP.carFingerprint]['pt']) self.pt_packer = CANPacker(DBC[CP.carFingerprint]['pt'])
self.tesla_can = TeslaCAN(self.packer, self.pt_packer) self.tesla_can = TeslaCAN(self.packer, self.pt_packer)
def update(self, CC, CS, now_nanos): def update(self, CC, CS, now_nanos, frogpilot_toggles):
actuators = CC.actuators actuators = CC.actuators
pcm_cancel_cmd = CC.cruiseControl.cancel pcm_cancel_cmd = CC.cruiseControl.cancel
+4 -3
View File
@@ -1,6 +1,6 @@
import copy import copy
from collections import deque from collections import deque
from cereal import car from cereal import car, custom
from openpilot.common.conversions import Conversions as CV from openpilot.common.conversions import Conversions as CV
from openpilot.selfdrive.car.tesla.values import CAR, DBC, CANBUS, GEAR_MAP, DOORS, BUTTONS from openpilot.selfdrive.car.tesla.values import CAR, DBC, CANBUS, GEAR_MAP, DOORS, BUTTONS
from openpilot.selfdrive.car.interfaces import CarStateBase from openpilot.selfdrive.car.interfaces import CarStateBase
@@ -20,8 +20,9 @@ class CarState(CarStateBase):
self.acc_state = 0 self.acc_state = 0
self.das_control_counters = deque(maxlen=32) self.das_control_counters = deque(maxlen=32)
def update(self, cp, cp_cam): def update(self, cp, cp_cam, frogpilot_toggles):
ret = car.CarState.new_message() ret = car.CarState.new_message()
fp_ret = custom.FrogPilotCarState.new_message()
# Vehicle speed # Vehicle speed
ret.vEgoRaw = cp.vl["ESP_B"]["ESP_vehicleSpeed"] * CV.KPH_TO_MS ret.vEgoRaw = cp.vl["ESP_B"]["ESP_vehicleSpeed"] * CV.KPH_TO_MS
@@ -102,7 +103,7 @@ class CarState(CarStateBase):
self.acc_state = cp_cam.vl["DAS_control"]["DAS_accState"] self.acc_state = cp_cam.vl["DAS_control"]["DAS_accState"]
self.das_control_counters.extend(cp_cam.vl_all["DAS_control"]["DAS_controlCounter"]) self.das_control_counters.extend(cp_cam.vl_all["DAS_control"]["DAS_controlCounter"])
return ret return ret, fp_ret
@staticmethod @staticmethod
def get_can_parser(CP): def get_can_parser(CP):
+5 -5
View File
@@ -8,7 +8,7 @@ from openpilot.selfdrive.car.interfaces import CarInterfaceBase
class CarInterface(CarInterfaceBase): class CarInterface(CarInterfaceBase):
@staticmethod @staticmethod
def _get_params(ret, candidate, fingerprint, car_fw, experimental_long, docs): def _get_params(ret, candidate, fingerprint, car_fw, disable_openpilot_long, experimental_long, docs):
ret.carName = "tesla" ret.carName = "tesla"
# There is no safe way to do steer blending with user torque, # There is no safe way to do steer blending with user torque,
@@ -25,7 +25,7 @@ class CarInterface(CarInterfaceBase):
# If so, we assume that it is connected to the longitudinal harness. # If so, we assume that it is connected to the longitudinal harness.
flags = (Panda.FLAG_TESLA_RAVEN if candidate == CAR.TESLA_MODELS_RAVEN else 0) flags = (Panda.FLAG_TESLA_RAVEN if candidate == CAR.TESLA_MODELS_RAVEN else 0)
if (CANBUS.autopilot_powertrain in fingerprint.keys()) and (0x2bf in fingerprint[CANBUS.autopilot_powertrain].keys()): if (CANBUS.autopilot_powertrain in fingerprint.keys()) and (0x2bf in fingerprint[CANBUS.autopilot_powertrain].keys()):
ret.openpilotLongitudinalControl = True ret.openpilotLongitudinalControl = not disable_openpilot_long
flags |= Panda.FLAG_TESLA_LONG_CONTROL flags |= Panda.FLAG_TESLA_LONG_CONTROL
ret.safetyConfigs = [ ret.safetyConfigs = [
get_safety_config(car.CarParams.SafetyModel.tesla, flags), get_safety_config(car.CarParams.SafetyModel.tesla, flags),
@@ -39,9 +39,9 @@ class CarInterface(CarInterfaceBase):
ret.steerActuatorDelay = 0.25 ret.steerActuatorDelay = 0.25
return ret return ret
def _update(self, c): def _update(self, c, frogpilot_toggles):
ret = self.CS.update(self.cp, self.cp_cam) ret, fp_ret = self.CS.update(self.cp, self.cp_cam, frogpilot_toggles)
ret.events = self.create_common_events(ret).to_msg() ret.events = self.create_common_events(ret).to_msg()
return ret return ret, fp_ret
+2
View File
@@ -295,6 +295,8 @@ routes = [
CarTestRoute("66c1699b7697267d/2024-03-03--13-09-53", TESLA.TESLA_MODELS_RAVEN), CarTestRoute("66c1699b7697267d/2024-03-03--13-09-53", TESLA.TESLA_MODELS_RAVEN),
# Segments that test specific issues # Segments that test specific issues
# Controls mismatch due to interceptor threshold
CarTestRoute("cfb32f0fb91b173b|2022-04-06--14-54-45", HONDA.CIVIC, segment=21),
# Controls mismatch due to standstill threshold # Controls mismatch due to standstill threshold
CarTestRoute("bec2dcfde6a64235|2022-04-08--14-21-32", HONDA.HONDA_CRV_HYBRID, segment=22), CarTestRoute("bec2dcfde6a64235|2022-04-08--14-21-32", HONDA.HONDA_CRV_HYBRID, segment=22),
] ]
@@ -76,6 +76,10 @@ class TestCarInterfaces:
assert len(car_params.longitudinalTuning.kpV) == len(car_params.longitudinalTuning.kpBP) assert len(car_params.longitudinalTuning.kpV) == len(car_params.longitudinalTuning.kpBP)
assert len(car_params.longitudinalTuning.kiV) == len(car_params.longitudinalTuning.kiBP) assert len(car_params.longitudinalTuning.kiV) == len(car_params.longitudinalTuning.kiBP)
# If we're using the interceptor for gasPressed, we should be commanding gas with it
if car_params.enableGasInterceptor:
self.assertTrue(car_params.openpilotLongitudinalControl)
# Lateral sanity checks # Lateral sanity checks
if car_params.steerControlType != car.CarParams.SteerControlType.angle: if car_params.steerControlType != car.CarParams.SteerControlType.angle:
tune = car_params.lateralTuning tune = car_params.lateralTuning
@@ -0,0 +1 @@
{"input_std":[[8.319796],[0.8197253],[0.2695665],[0.042975243],[0.82591987],[0.8242552],[0.82166827],[0.7989035],[0.78012997],[0.7541669],[0.727379],[0.042928882],[0.042931043],[0.04292182],[0.042691696],[0.042392965],[0.04186602],[0.041271493]],"model_test_loss":0.026207376271486282,"input_size":18,"current_date_and_time":"2023-08-05_00-22-46","input_mean":[[26.074522],[0.02839493],[0.0066744387],[0.002057746],[0.02693295],[0.026884235],[0.027213756],[0.03047188],[0.032183405],[0.03682154],[0.037578877],[0.0020827646],[0.0020767434],[0.002068271],[0.0019987107],[0.001959759],[0.0019052405],[0.0017531246]],"input_vars":["v_ego","lateral_accel","lateral_jerk","roll","lateral_accel_m03","lateral_accel_m02","lateral_accel_m01","lateral_accel_p03","lateral_accel_p06","lateral_accel_p10","lateral_accel_p15","roll_m03","roll_m02","roll_m01","roll_p03","roll_p06","roll_p10","roll_p15"],"output_size":1,"layers":[{"dense_1_b":[[-0.040739167],[2.3032],[0.12316159],[-0.2659433],[-0.14477858],[2.5866256],[0.007428121]],"dense_1_W":[[-0.00041187002,-0.43338582,0.00060599507,-0.1214792,0.11413983,-0.5961203,0.28133482,0.20372222,-0.3518884,0.004369656,0.059917737,-0.8609317,0.057816904,0.6169038,0.3990334,0.008638719,0.40356407,-0.16347249],[2.204209,-0.6977474,0.0003794136,-0.029842956,0.42360333,-0.03850665,0.77470416,0.13669024,-1.1576334,-0.2837559,0.290581,-0.20709048,0.06827377,0.39236906,0.2664924,-0.070944384,0.061474152,-0.18787181],[0.0027994395,1.1713752,3.9056025,-0.2533814,-0.5706249,-0.31465232,-0.28078023,0.9239433,0.8800892,0.45323586,-1.5842354,1.1251147,0.001203793,-0.631376,0.17771868,-0.5216376,-0.3776946,0.2864524],[-0.45875242,-0.35037747,-0.0044959267,0.2115901,0.49776042,0.40634266,0.16292186,0.085123494,-0.9553305,-0.6551008,1.0865217,-0.71530885,-0.122710146,0.41569617,0.053198084,-0.013457165,0.36482632,-0.3238176],[-0.002217434,1.7620963,-1.2475897,0.2861537,2.5786693,1.6882615,2.2971427,0.5035391,-3.1869397,-3.7319245,-1.4041471,-1.1169863,-0.17736337,0.21103925,0.1615338,-0.7596914,0.4106967,0.9845423],[2.4344306,-0.5410767,0.0015357351,-0.4139311,-0.2258391,0.22010726,-0.43920308,0.3511928,0.9479655,0.80018866,-0.516027,0.007953332,0.033446178,-0.082440384,0.35339966,-0.26683265,-0.33867463,0.3848125],[-0.006754755,0.48652485,-0.00026165723,-0.07224382,-0.032497358,0.3571908,-0.30286846,-0.38309038,0.36634418,0.2480767,-0.20110212,0.7545479,0.11547977,-0.7146525,-0.018818611,-0.31016228,0.010726242,0.2242711]],"activation":"σ"},{"dense_2_W":[[0.5528864,0.008744154,0.6015725,0.22935376,-0.51005757,-0.5996119,-0.061544895],[-1.4023882,0.050312754,-0.09053194,-0.5902193,0.3458193,-0.14508769,0.946796],[-1.1020836,-1.510418,0.81544393,-0.40635344,-0.4560999,-0.2849373,1.1164322],[-0.4434681,-0.6467564,0.35384342,-0.4493043,-0.23754148,-0.24804021,0.9237547],[-0.27906877,-0.9630674,0.42410734,-0.76862967,-0.59738564,-0.70335937,-0.18449919],[-0.50024533,-0.013576657,0.25596973,0.105690226,-0.52567744,0.80972326,0.7098216],[-0.8556806,-0.14960146,-0.14877279,0.25888273,-0.18901795,-0.16515623,0.7054368],[-1.041555,0.5246004,0.87523067,-0.4851678,-0.5188004,1.3508142,1.344452],[0.83991337,0.54517484,0.09614608,0.028868627,0.35332617,0.22425945,-0.24393064],[0.48884755,-0.6723522,0.161554,-0.18337585,0.010732531,0.042358696,-0.94669324],[0.7589174,0.44016284,-0.21002136,-0.7584538,-0.1012028,-0.44348133,-0.34792235],[0.68993133,-0.13230318,-0.20205282,0.33807474,0.2551999,-0.7216631,-0.9246813],[0.55567986,0.92921287,-0.3879664,-0.06419992,0.44321644,0.34334105,-0.7811811]],"activation":"σ","dense_2_b":[[0.009339096],[-0.027214382],[-0.19324711],[-0.1799901],[-0.3219004],[-0.0076973503],[0.031202752],[0.1887236],[-0.10121091],[-0.21036065],[-0.02065366],[-0.068702094],[0.096490316]]},{"dense_3_W":[[0.5728007,-0.3089611,0.28924087,-0.5445901,0.35486373,-0.44516575,-0.5423116,0.1779453,0.58426845,0.66963387,-0.31166366,0.6550927,0.50334716],[-0.40078798,-0.027345562,-0.5357739,-0.5126658,-0.5254064,-0.32021227,-0.44433862,-0.79833746,-0.10665151,0.20663711,-0.17090832,0.98109436,0.78809434],[-0.17410587,0.23138371,0.66809905,0.2743278,0.096785605,0.5667218,0.52852666,0.4389385,-0.4016732,0.05424836,-0.7506198,-0.71257013,-0.20795672]],"activation":"identity","dense_3_b":[[0.02470415],[0.1408834],[-0.05001292]]},{"dense_4_W":[[-0.3242929,-0.272474,0.8721407]],"dense_4_b":[[-0.046378713]],"activation":"identity"}]}

Some files were not shown because too many files have changed in this diff Show More