diff --git a/.github/workflows/auto_pr_review.yaml b/.github/workflows/auto_pr_review.yaml
index 447e559c9..252a66a6b 100644
--- a/.github/workflows/auto_pr_review.yaml
+++ b/.github/workflows/auto_pr_review.yaml
@@ -1,53 +1,44 @@
-name: "PR review"
+name: "PR Review"
on:
pull_request_target:
- types: [opened, reopened, synchronize, edited, edited]
+ types: [opened, reopened]
jobs:
- labeler:
- name: review
- permissions:
- contents: read
- pull-requests: write
+ pr_check:
+ name: Check PR Target Branch
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v4
+ - name: Checkout repository
+ uses: actions/checkout@v3
with:
- submodules: false
+ fetch-depth: 0
- # Label PRs
- - uses: actions/labeler@v5.0.0
- 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'
+ - name: Check Target Branch
+ shell: bash
env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- target: /^(?!master$).*/
- exclude: /commaai:.*/
- change-to: ${{ github.base_ref }}
- already-exists-action: close_this
- already-exists-comment: "Your PR should be made against the `master` branch"
+ GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
+ run: |
+ TOKEN_USERNAME=$(gh api user -H "Authorization: token $GITHUB_TOKEN" --jq '.login')
- # Welcome comment
- - name: comment
- uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6
- if: github.event.pull_request.head.repo.full_name != 'commaai/openpilot'
- with:
- message: |
-
- Thanks for contributing to openpilot! In order for us to review your PR as quickly as possible, check the following:
- * 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)
- * Before marking as "ready for review", ensure:
- * the goal is clearly stated in the description
- * all the tests are passing
- * the change is [something we merge](https://github.com/commaai/openpilot/blob/master/docs/CONTRIBUTING.md#what-gets-merged)
- * include a route or your device' dongle ID if relevant
- comment_tag: run_id
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ if [[ "${{ github.actor }}" == "FrogAi" ]]; then
+ echo "PR opened or reopened by FrogAi. No action needed."
+ exit 0
+ fi
+
+ if [[ "${{ github.base_ref }}" != "MAKE-PRS-HERE" ]]; then
+ git config --global user.name "${{ github.actor }}"
+ git config --global user.email "${{ github.actor }}@users.noreply.github.com"
+
+ gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
+ -H "Authorization: token $GITHUB_TOKEN" \
+ -f body="Please submit your pull request to the \"MAKE-PRS-HERE\" branch."
+
+ gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }} \
+ -X PATCH -H "Authorization: token $GITHUB_TOKEN" -f state='closed'
+
+ 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
diff --git a/.github/workflows/update-pr-branch.yaml b/.github/workflows/update-pr-branch.yaml
new file mode 100644
index 000000000..8facfe305
--- /dev/null
+++ b/.github/workflows/update-pr-branch.yaml
@@ -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 }}
diff --git a/.github/workflows/update-release-branch.yaml b/.github/workflows/update-release-branch.yaml
new file mode 100644
index 000000000..328bbff4e
--- /dev/null
+++ b/.github/workflows/update-release-branch.yaml
@@ -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
diff --git a/README.md b/README.md
index db74ee6a1..3364f2de0 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-[](https://comma.ai/shop/comma-3x)
+[](https://comma.ai/shop/comma-3x)
What is openpilot?
------
@@ -13,53 +13,201 @@ What is openpilot?
-To start using openpilot in a car
+What is FrogPilot? 🐸
------
-To use openpilot in a car, you need four things:
-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.
+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!
-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)
-* 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)
+------
+⚡ **Advanced Customizations:**
-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)
+ -
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.
-* 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.
-* 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.
+ - 📢 Want to add a theme? Request one in the "feature-request" channel in the FrogPilot Discord!
+------
+🚀 **Conditional Experimental Mode:**
-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.
-The driver-facing camera is only logged if you explicitly opt-in in settings. The microphone is not recorded.
+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!
-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.
+
+
+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
------
diff --git a/cereal/car.capnp b/cereal/car.capnp
index a7d299a8e..9f3505338 100644
--- a/cereal/car.capnp
+++ b/cereal/car.capnp
@@ -84,6 +84,7 @@ struct CarEvent @0x9b1657f34caf3ad3 {
startup @75;
startupNoCar @76;
startupNoControl @77;
+ startupNoSecOcKey @121;
startupMaster @78;
startupNoFw @104;
fcw @79;
@@ -118,7 +119,35 @@ struct CarEvent @0x9b1657f34caf3ad3 {
actuatorsApiUnavailable @120;
# 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;
communityFeatureDisallowedDEPRECATED @62;
@@ -415,6 +444,22 @@ struct CarControl {
prompt @6;
promptRepeat @7;
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
+ secOcRequired @74 :Bool; # Car requires SecOC message authentication to operate
+ secOcKeyAvailable @75 :Bool; # Stored SecOC key loaded from params
+
struct SafetyConfig {
safetyModel @0 :SafetyModel;
safetyParam @3 :UInt16;
@@ -544,8 +592,8 @@ struct CarParams {
kiBP @2 :List(Float32);
kiV @3 :List(Float32);
kf @6 :Float32;
- deadzoneBPDEPRECATED @4 :List(Float32);
- deadzoneVDEPRECATED @5 :List(Float32);
+ deadzoneBP @4 :List(Float32);
+ deadzoneV @5 :List(Float32);
}
struct LateralINDITuning {
diff --git a/cereal/custom.capnp b/cereal/custom.capnp
index 369222add..26d2c5bc1 100644
--- a/cereal/custom.capnp
+++ b/cereal/custom.capnp
@@ -1,6 +1,8 @@
using Cxx = import "./include/c++.capnp";
$Cxx.namespace("cereal");
+using Car = import "car.capnp";
+
@0xb526ba661d550a59;
# 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.
# 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 {
diff --git a/cereal/log.capnp b/cereal/log.capnp
index 99b5dddf1..f1cd6a929 100644
--- a/cereal/log.capnp
+++ b/cereal/log.capnp
@@ -335,6 +335,12 @@ enum LaneChangeDirection {
right @2;
}
+enum TurnDirection {
+ none @0;
+ turnLeft @1;
+ turnRight @2;
+}
+
struct CanData {
address @0 :UInt32;
busTime @1 :UInt16;
@@ -612,6 +618,10 @@ struct RadarState @0x9a185389d6fdd05f {
leadOne @3 :LeadData;
leadTwo @4 :LeadData;
+ leadLeft @13 :LeadData;
+ leadRight @14 :LeadData;
+ leadLeftFar @15 :LeadData;
+ leadRightFar @16 :LeadData;
cumLagMs @5 :Float32;
struct LeadData {
@@ -698,6 +708,7 @@ struct ControlsState @0x97ff69c53601abf1 {
personality @66 :LongitudinalPersonality;
longControlState @30 :Car.CarControl.Actuators.LongControlState;
+ vPid @2 :Float32;
vTargetLead @3 :Float32;
vCruise @22 :Float32; # actual set speed
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
userPrompt @1; # mid priority alert that might require user intervention
critical @2; # high priority alert that needs immediate user intervention
+ frogpilot @3; # FrogPilot startup alert
}
enum AlertSize {
@@ -794,6 +806,7 @@ struct ControlsState @0x97ff69c53601abf1 {
saturated @7 :Bool;
actualLateralAccel @9 :Float32;
desiredLateralAccel @10 :Float32;
+ nnLog @11 :List(Float32);
}
struct LateralLQRState {
@@ -865,7 +878,39 @@ struct ControlsState @0x97ff69c53601abf1 {
canMonoTimesDEPRECATED @21 :List(UInt64);
desiredCurvatureRateDEPRECATED @62 :Float32;
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
@@ -913,8 +958,8 @@ struct ModelDataV2 {
# Model perceived motion
temporalPose @21 :Pose;
- navEnabledDEPRECATED @22 :Bool;
- locationMonoTimeDEPRECATED @24 :UInt64;
+ navEnabled @22 :Bool;
+ locationMonoTime @24 :UInt64;
# e2e lateral planner
lateralPlannerSolutionDEPRECATED @25: LateralPlannerSolution;
@@ -958,6 +1003,7 @@ struct ModelDataV2 {
hardBrakePredicted @7 :Bool;
laneChangeState @8 :LaneChangeState;
laneChangeDirection @9 :LaneChangeDirection;
+ turnDirection @10 :TurnDirection;
# deprecated
@@ -980,6 +1026,8 @@ struct ModelDataV2 {
brake3MetersPerSecondSquaredProbs @4 :List(Float32);
brake4MetersPerSecondSquaredProbs @5 :List(Float32);
brake5MetersPerSecondSquaredProbs @6 :List(Float32);
+ gasPressProbs @7 :List(Float32);
+ brakePressProbs @8 :List(Float32);
}
struct Pose {
@@ -2264,6 +2312,7 @@ struct Event {
driverMonitoringState @71: DriverMonitoringState;
liveLocationKalman @72 :LiveLocationKalman;
modelV2 @75 :ModelDataV2;
+ drivingModelData @128 :DrivingModelData;
driverStateV2 @92 :DriverStateV2;
# camera stuff, each camera state has a matching encode idx
@@ -2318,11 +2367,11 @@ struct Event {
customReservedRawData2 @126 :Data;
# *********** Custom: reserved for forks ***********
- customReserved0 @107 :Custom.CustomReserved0;
- customReserved1 @108 :Custom.CustomReserved1;
- customReserved2 @109 :Custom.CustomReserved2;
- customReserved3 @110 :Custom.CustomReserved3;
- customReserved4 @111 :Custom.CustomReserved4;
+ frogpilotCarControl @107 :Custom.FrogPilotCarControl;
+ frogpilotCarState @108 :Custom.FrogPilotCarState;
+ frogpilotDeviceState @109 :Custom.FrogPilotDeviceState;
+ frogpilotNavigation @110 :Custom.FrogPilotNavigation;
+ frogpilotPlan @111 :Custom.FrogPilotPlan;
customReserved5 @112 :Custom.CustomReserved5;
customReserved6 @113 :Custom.CustomReserved6;
customReserved7 @114 :Custom.CustomReserved7;
@@ -2368,6 +2417,6 @@ struct Event {
driverStateDEPRECATED @59 :DriverStateDEPRECATED;
sensorEventsDEPRECATED @11 :List(SensorEventData);
lateralPlanDEPRECATED @64 :LateralPlan;
- navModelDEPRECATED @104 :NavModelData;
+ navModel @104 :NavModelData;
}
}
diff --git a/cereal/services.py b/cereal/services.py
index 2ab28f6d5..6a15c9672 100755
--- a/cereal/services.py
+++ b/cereal/services.py
@@ -60,12 +60,15 @@ _services: dict[str, tuple] = {
"driverMonitoringState": (True, 20., 10),
"wideRoadEncodeIdx": (False, 20., 1),
"wideRoadCameraState": (True, 20., 20),
+ "drivingModelData": (True, 20., 10),
"modelV2": (True, 20., 40),
"managerState": (True, 2., 1),
"uploaderState": (True, 0., 1),
"navInstruction": (True, 1., 10),
"navRoute": (True, 0.),
"navThumbnail": (True, 0.),
+ "navModel": (True, 2., 4.),
+ "mapRenderState": (True, 2., 1.),
"uiPlan": (True, 20., 40.),
"qRoadEncodeIdx": (False, 20.),
"userFlag": (True, 0., 1),
@@ -87,6 +90,13 @@ _services: dict[str, tuple] = {
"customReservedRawData0": (True, 0.),
"customReservedRawData1": (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
idx, (name, vals) in enumerate(_services.items())}
diff --git a/common/conversions.py b/common/conversions.py
index b02b33c62..62c8debdb 100644
--- a/common/conversions.py
+++ b/common/conversions.py
@@ -11,6 +11,12 @@ class Conversions:
MS_TO_KNOTS = 1.9438
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
DEG_TO_RAD = np.pi / 180.
RAD_TO_DEG = 1. / DEG_TO_RAD
diff --git a/common/params.cc b/common/params.cc
index 233016017..e1ac9b318 100644
--- a/common/params.cc
+++ b/common/params.cc
@@ -189,6 +189,7 @@ std::unordered_map keys = {
{"RecordFrontLock", PERSISTENT}, // for the internal fleet
{"ReplayControlsState", CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION},
{"RouteCount", PERSISTENT},
+ {"SecOCKey", PERSISTENT | DONT_LOG},
{"SnoozeUpdate", CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION},
{"SshEnabled", PERSISTENT},
{"TermsVersion", PERSISTENT},
@@ -207,6 +208,349 @@ std::unordered_map keys = {
{"UpdaterTargetBranch", CLEAR_ON_MANAGER_START},
{"UpdaterLastFetchTime", 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
diff --git a/common/params.h b/common/params.h
index d726a6185..4ca716a41 100644
--- a/common/params.h
+++ b/common/params.h
@@ -16,6 +16,11 @@ enum ParamKeyType {
CLEAR_ON_OFFROAD_TRANSITION = 0x10,
DONT_LOG = 0x20,
DEVELOPMENT_ONLY = 0x40,
+ FROGPILOT_CONTROLS = 0x80,
+ FROGPILOT_VISUALS = 0x100,
+ FROGPILOT_OTHER = 0x400,
+ FROGPILOT_TRACKING = 0x800,
+ FROGPILOT_VEHICLES = 0x1000,
ALL = 0xFFFFFFFF
};
@@ -43,6 +48,14 @@ public:
inline bool getBool(const std::string &key, bool block = false) {
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 readAll();
// helpers for writing values
@@ -53,10 +66,22 @@ public:
inline int putBool(const std::string &key, bool val) {
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);
inline void putBoolNonBlocking(const std::string &key, bool val) {
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:
void asyncWriteThread();
diff --git a/common/params_pyx.pyx b/common/params_pyx.pyx
index 535514e52..c8dc65855 100644
--- a/common/params_pyx.pyx
+++ b/common/params_pyx.pyx
@@ -11,21 +11,33 @@ cdef extern from "common/params.h":
CLEAR_ON_ONROAD_TRANSITION
CLEAR_ON_OFFROAD_TRANSITION
DEVELOPMENT_ONLY
+ FROGPILOT_CONTROLS
+ FROGPILOT_OTHER
+ FROGPILOT_TRACKING
+ FROGPILOT_VEHICLES
+ FROGPILOT_VISUALS
ALL
cdef cppclass c_Params "Params":
c_Params(string) except + nogil
string get(string, bool) nogil
bool getBool(string, bool) nogil
+ int getInt(string, bool) nogil
+ float getFloat(string, bool) nogil
int remove(string) nogil
int put(string, string) nogil
void putNonBlocking(string, string) nogil
void putBoolNonBlocking(string, bool) nogil
+ void putIntNonBlocking(string, int) nogil
+ void putFloatNonBlocking(string, float) nogil
int putBool(string, bool) nogil
+ int putInt(string, int) nogil
+ int putFloat(string, float) nogil
bool checkKey(string) nogil
string getParamPath(string) nogil
void clearAll(ParamKeyType)
vector[string] allKeys()
+ ParamKeyType getKeyType(string) nogil
def ensure_bytes(v):
@@ -77,6 +89,20 @@ cdef class Params:
r = self.p.getBool(k, block)
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):
"""
Warning: This function blocks until the param is written to disk!
@@ -94,6 +120,16 @@ cdef class Params:
with nogil:
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):
cdef string k = self.check_key(key)
cdef string dat_bytes = ensure_bytes(dat)
@@ -105,6 +141,16 @@ cdef class Params:
with nogil:
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):
cdef string k = self.check_key(key)
with nogil:
@@ -116,3 +162,7 @@ cdef class Params:
def all_keys(self):
return self.p.allKeys()
+
+ def get_key_type(self, key):
+ cdef string k = self.check_key(key)
+ return self.p.getKeyType(k)
diff --git a/common/util.cc b/common/util.cc
index 5ffd6e409..4e766c925 100644
--- a/common/util.cc
+++ b/common/util.cc
@@ -271,4 +271,18 @@ std::string check_output(const std::string& command) {
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
diff --git a/common/util.h b/common/util.h
index 186873ac2..a8a5adf5e 100644
--- a/common/util.h
+++ b/common/util.h
@@ -36,6 +36,9 @@ const double MS_TO_KPH = 3.6;
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_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 {
@@ -93,6 +96,8 @@ bool create_directories(const std::string &dir, mode_t mode);
std::string check_output(const std::string& command);
+bool system_time_valid();
+
inline void sleep_for(const int milliseconds) {
if (milliseconds > 0) {
std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds));
diff --git a/opendbc/chrysler_pacifica_2017_hybrid_generated.dbc b/opendbc/chrysler_pacifica_2017_hybrid_generated.dbc
index d8f4c6623..98f290168 100644
--- a/opendbc/chrysler_pacifica_2017_hybrid_generated.dbc
+++ b/opendbc/chrysler_pacifica_2017_hybrid_generated.dbc
@@ -312,6 +312,7 @@ BO_ 764 ACCEL_RELATED_2FC: 8 XXX
BO_ 816 TRACTION_BUTTON: 8 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_LKAS : 53|1@0+ (1,0) [0|1] "" XXX
BO_ 878 ACCEL_RELATED_36E: 8 XXX
SG_ ACCEL_OR_RPM_2 : 15|8@0+ (1,0) [0|255] "" XXX
diff --git a/opendbc/chrysler_ram_hd_generated.dbc b/opendbc/chrysler_ram_hd_generated.dbc
index 697c3bf91..19b57434f 100644
--- a/opendbc/chrysler_ram_hd_generated.dbc
+++ b/opendbc/chrysler_ram_hd_generated.dbc
@@ -90,9 +90,11 @@ BO_ 500 DAS_3: 8 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_ 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_ 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_ 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_ 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
SG_ FCW_STATE : 2|1@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_ 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
diff --git a/opendbc/generator/toyota/_toyota_2017.dbc b/opendbc/generator/toyota/_toyota_2017.dbc
index e21f7426b..a8ff91077 100644
--- a/opendbc/generator/toyota/_toyota_2017.dbc
+++ b/opendbc/generator/toyota/_toyota_2017.dbc
@@ -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_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
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
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
BO_ 295 GEAR_PACKET_HYBRID: 8 XXX
- SG_ CAR_MOVEMENT : 25|10@0- (1,0) [0|255] "" XXX
- SG_ COUNTER : 55|8@0+ (1,0) [0|255] "" XXX
+ SG_ FDRVREAL : 26|11@0- (25,0) [-25600|25575] "N" XXX
+ SG_ UNKNOWN : 55|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
@@ -71,6 +86,7 @@ BO_ 353 DSU_SPEED: 7 XXX
BO_ 452 ENGINE_RPM: 8 CGW
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
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_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
-BO_ 552 ACCELEROMETER: 8 XXX
- SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "m/s^2" XXX
- SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s^2" XXX
+BO_ 552 VSC1S29: 4 CGW
+ SG_ ICBACT : 7|1@0+ (1,0) [0|0] "" DS1
+ 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
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_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
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
@@ -165,12 +207,19 @@ BO_ 835 ACC_CONTROL: 8 DSU
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
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
BO_ 865 CLUTCH: 8 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_ 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
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_ 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
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
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_ 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_ 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
@@ -381,13 +444,30 @@ BO_ 1592 DOOR_LOCKS: 8 XXX
SG_ LOCK_STATUS : 20|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 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_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 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_ 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";
@@ -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 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_ 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 RADAR_DIRTY "Display Clean Radar Sensor message on HUD";
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_ 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 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_ 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.";
@@ -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_ 1553 UNITS 1 "km" 2 "miles";
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";
diff --git a/opendbc/gm_global_a_powertrain_generated.dbc b/opendbc/gm_global_a_powertrain_generated.dbc
index 1c78dd7b0..8de42d598 100644
--- a/opendbc/gm_global_a_powertrain_generated.dbc
+++ b/opendbc/gm_global_a_powertrain_generated.dbc
@@ -222,7 +222,7 @@ BO_ 715 ASCMGasRegenCmd: 8 K124_ASCM
SG_ GasRegenCmdActive : 0|1@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_ 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
diff --git a/opendbc/gm_global_a_powertrain_volt.dbc b/opendbc/gm_global_a_powertrain_volt.dbc
index 98e7cfbd8..9361c7569 100644
--- a/opendbc/gm_global_a_powertrain_volt.dbc
+++ b/opendbc/gm_global_a_powertrain_volt.dbc
@@ -188,6 +188,9 @@ BO_ 497 BCMGeneralPlatformStatus: 8 K9_BCM
SG_ SystemBackUpPowerMode : 5|2@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
SG_ TransmissionState : 48|4@1+ (1,0) [0|7] "" NEO
SG_ PRNDL2 : 27|4@0+ (1,0) [0|255] "" NEO
diff --git a/opendbc/hyundai_canfd.dbc b/opendbc/hyundai_canfd.dbc
index 1ef67c044..00991a714 100644
--- a/opendbc/hyundai_canfd.dbc
+++ b/opendbc/hyundai_canfd.dbc
@@ -316,7 +316,7 @@ BO_ 441 CAM_0x1b9: 32 CAMERA
BO_ 463 CRUISE_BUTTONS: 8 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_ 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
diff --git a/opendbc/hyundai_kia_generic.dbc b/opendbc/hyundai_kia_generic.dbc
index fc4d14f4f..f7ecd38f5 100644
--- a/opendbc/hyundai_kia_generic.dbc
+++ b/opendbc/hyundai_kia_generic.dbc
@@ -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_ 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_ 882 Elect_Gear_Shifter 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" 4 "S" 0 "P";
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_ 916 ACCEnable 0 "SCC ready" 1 "SCC temp fault" 2 "SCC permanent fault" 3 "SCC permanent fault, communication issue";
diff --git a/opendbc/toyota_new_mc_pt_generated.dbc b/opendbc/toyota_new_mc_pt_generated.dbc
index dfb69df49..2b74b4651 100644
--- a/opendbc/toyota_new_mc_pt_generated.dbc
+++ b/opendbc/toyota_new_mc_pt_generated.dbc
@@ -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_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
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
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
BO_ 295 GEAR_PACKET_HYBRID: 8 XXX
- SG_ CAR_MOVEMENT : 25|10@0- (1,0) [0|255] "" XXX
- SG_ COUNTER : 55|8@0+ (1,0) [0|255] "" XXX
+ SG_ FDRVREAL : 26|11@0- (25,0) [-25600|25575] "N" XXX
+ SG_ UNKNOWN : 55|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
@@ -119,6 +134,7 @@ BO_ 353 DSU_SPEED: 7 XXX
BO_ 452 ENGINE_RPM: 8 CGW
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
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_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
-BO_ 552 ACCELEROMETER: 8 XXX
- SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "m/s^2" XXX
- SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s^2" XXX
+BO_ 552 VSC1S29: 4 CGW
+ SG_ ICBACT : 7|1@0+ (1,0) [0|0] "" DS1
+ 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
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
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
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_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
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
@@ -213,12 +259,19 @@ BO_ 835 ACC_CONTROL: 8 DSU
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
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
BO_ 865 CLUTCH: 8 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_ 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
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_ 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
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
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_ 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_ 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
@@ -429,13 +496,30 @@ BO_ 1592 DOOR_LOCKS: 8 XXX
SG_ LOCK_STATUS : 20|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 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_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 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_ 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";
@@ -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 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_ 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 RADAR_DIRTY "Display Clean Radar Sensor message on HUD";
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_ 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 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_ 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.";
@@ -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_ 1553 UNITS 1 "km" 2 "miles";
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";
CM_ "toyota_new_mc_pt.dbc starts here";
diff --git a/opendbc/toyota_nodsu_pt_generated.dbc b/opendbc/toyota_nodsu_pt_generated.dbc
index efbcccc86..ef60ba931 100644
--- a/opendbc/toyota_nodsu_pt_generated.dbc
+++ b/opendbc/toyota_nodsu_pt_generated.dbc
@@ -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_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
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
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
BO_ 295 GEAR_PACKET_HYBRID: 8 XXX
- SG_ CAR_MOVEMENT : 25|10@0- (1,0) [0|255] "" XXX
- SG_ COUNTER : 55|8@0+ (1,0) [0|255] "" XXX
+ SG_ FDRVREAL : 26|11@0- (25,0) [-25600|25575] "N" XXX
+ SG_ UNKNOWN : 55|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
@@ -119,6 +134,7 @@ BO_ 353 DSU_SPEED: 7 XXX
BO_ 452 ENGINE_RPM: 8 CGW
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
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_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
-BO_ 552 ACCELEROMETER: 8 XXX
- SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "m/s^2" XXX
- SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s^2" XXX
+BO_ 552 VSC1S29: 4 CGW
+ SG_ ICBACT : 7|1@0+ (1,0) [0|0] "" DS1
+ 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
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
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
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_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
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
@@ -213,12 +259,19 @@ BO_ 835 ACC_CONTROL: 8 DSU
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
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
BO_ 865 CLUTCH: 8 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_ 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
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 : 38|3@0+ (1,0) [0|7] "" 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_ 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_ 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
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
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_ 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_ 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
@@ -429,13 +497,30 @@ BO_ 1592 DOOR_LOCKS: 8 XXX
SG_ LOCK_STATUS : 20|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 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_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 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_ 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";
@@ -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 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_ 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 RADAR_DIRTY "Display Clean Radar Sensor message on HUD";
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_ 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 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_ 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.";
@@ -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 1 "S1" 2 "S2" 3 "S3" 4 "S4" 5 "S5" 6 "S6";
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 DRIVE_ENGAGED 0 "off" 1 "on";
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_ 1553 UNITS 1 "km" 2 "miles";
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";
CM_ "toyota_nodsu_pt.dbc starts here";
diff --git a/opendbc/toyota_rav4_prime_generated.dbc b/opendbc/toyota_rav4_prime_generated.dbc
new file mode 100644
index 000000000..c2477c151
--- /dev/null
+++ b/opendbc/toyota_rav4_prime_generated.dbc
@@ -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";
diff --git a/opendbc/toyota_tnga_k_pt_generated.dbc b/opendbc/toyota_tnga_k_pt_generated.dbc
index d95cfbe69..7f99d3873 100644
--- a/opendbc/toyota_tnga_k_pt_generated.dbc
+++ b/opendbc/toyota_tnga_k_pt_generated.dbc
@@ -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_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
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
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
BO_ 295 GEAR_PACKET_HYBRID: 8 XXX
- SG_ CAR_MOVEMENT : 25|10@0- (1,0) [0|255] "" XXX
- SG_ COUNTER : 55|8@0+ (1,0) [0|255] "" XXX
+ SG_ FDRVREAL : 26|11@0- (25,0) [-25600|25575] "N" XXX
+ SG_ UNKNOWN : 55|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
@@ -119,6 +134,7 @@ BO_ 353 DSU_SPEED: 7 XXX
BO_ 452 ENGINE_RPM: 8 CGW
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
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_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
-BO_ 552 ACCELEROMETER: 8 XXX
- SG_ ACCEL_Z : 22|15@0- (1,0) [0|32767] "m/s^2" XXX
- SG_ ACCEL_X : 6|15@0- (0.001,0) [-20|20] "m/s^2" XXX
+BO_ 552 VSC1S29: 4 CGW
+ SG_ ICBACT : 7|1@0+ (1,0) [0|0] "" DS1
+ 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
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
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
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_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
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
@@ -213,12 +259,19 @@ BO_ 835 ACC_CONTROL: 8 DSU
SG_ CHECKSUM : 63|8@0+ (1,0) [0|255] "" XXX
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
BO_ 865 CLUTCH: 8 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_ 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
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_ 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
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
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_ 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_ 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
@@ -429,13 +496,30 @@ BO_ 1592 DOOR_LOCKS: 8 XXX
SG_ LOCK_STATUS : 20|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 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_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 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_ 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";
@@ -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 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_ 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 RADAR_DIRTY "Display Clean Radar Sensor message on HUD";
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_ 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 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_ 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.";
@@ -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_ 1553 UNITS 1 "km" 2 "miles";
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";
CM_ "toyota_tnga_k_pt.dbc starts here";
diff --git a/panda/board/safety.h b/panda/board/safety.h
index 1516fac84..24ff77907 100644
--- a/panda/board/safety.h
+++ b/panda/board/safety.h
@@ -552,7 +552,13 @@ bool steer_torque_cmd_checks(int desired_torque, int steer_req, const SteeringLi
bool violation = false;
uint32_t ts = microsecond_timer_get();
+ 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 || aol_allowed) {
// *** global torque limit check ***
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
- if (!controls_allowed && (desired_torque != 0)) {
+ if (!(controls_allowed || aol_allowed) && (desired_torque != 0)) {
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
- if (violation || !controls_allowed) {
+ if (violation || !(controls_allowed || aol_allowed)) {
valid_steer_req_count = 0;
invalid_steer_req_count = 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
bool steer_angle_cmd_checks(int desired_angle, bool steer_control_enabled, const SteeringLimits limits) {
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,
// 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
@@ -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
- violation |= !controls_allowed && steer_control_enabled;
+ violation |= !(controls_allowed || aol_allowed) && steer_control_enabled;
return violation;
}
diff --git a/panda/board/safety/safety_chrysler.h b/panda/board/safety/safety_chrysler.h
index be27832c9..a1934a6c2 100644
--- a/panda/board/safety/safety_chrysler.h
+++ b/panda/board/safety/safety_chrysler.h
@@ -37,6 +37,7 @@ typedef struct {
const int DAS_6;
const int LKAS_COMMAND;
const int CRUISE_BUTTONS;
+ const int CRUISE_BUTTONS_ALT;
} ChryslerAddrs;
// 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
.LKAS_COMMAND = 0x292, // LKAS controls from DASM
.CRUISE_BUTTONS = 0x23B, // Cruise control buttons
+ .CRUISE_BUTTONS_ALT = 0x23B, // Cruise control buttons
};
// 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
.LKAS_COMMAND = 0xA6, // LKAS controls from DASM
.CRUISE_BUTTONS = 0xB1, // Cruise control buttons
+ .CRUISE_BUTTONS_ALT = 0xB1, // Cruise control buttons
};
// 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
.LKAS_COMMAND = 0x276, // LKAS controls from DASM
.CRUISE_BUTTONS = 0x23A, // Cruise control buttons
+ .CRUISE_BUTTONS_ALT = 0x23B, // Cruise control buttons
};
const CanMsg CHRYSLER_TX_MSGS[] = {
@@ -83,12 +87,14 @@ const CanMsg CHRYSLER_TX_MSGS[] = {
const CanMsg CHRYSLER_RAM_DT_TX_MSGS[] = {
{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.DAS_6, 0, 8},
};
const CanMsg CHRYSLER_RAM_HD_TX_MSGS[] = {
{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.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
const int das_3_bus = (chrysler_platform == CHRYSLER_PACIFICA) ? 0 : 2;
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);
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
- 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_resume = GET_BYTE(to_send, 0) == 0x10U;
const bool allowed = is_cancel || (is_resume && controls_allowed);
diff --git a/panda/board/safety/safety_ford.h b/panda/board/safety/safety_ford.h
index d6ee20803..e17cdf3cb 100644
--- a/panda/board/safety/safety_ford.h
+++ b/panda/board/safety/safety_ford.h
@@ -245,6 +245,7 @@ static void ford_rx_hook(const CANPacket_t *to_push) {
// Signal: CcStat_D_Actl
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);
pcm_cruise_check(cruise_engaged);
}
diff --git a/panda/board/safety/safety_gm.h b/panda/board/safety/safety_gm.h
index 214958bac..c7ae19b7d 100644
--- a/panda/board/safety/safety_gm.h
+++ b/panda/board/safety/safety_gm.h
@@ -10,16 +10,30 @@ const SteeringLimits GM_STEERING_LIMITS = {
};
const LongitudinalLimits GM_ASCM_LONG_LIMITS = {
- .max_gas = 3072,
- .min_gas = 1404,
- .inactive_gas = 1404,
+ .max_gas = 7168,
+ .min_gas = 5500,
+ .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,
};
const LongitudinalLimits GM_CAM_LONG_LIMITS = {
- .max_gas = 3400,
- .min_gas = 1514,
- .inactive_gas = 1554,
+ .max_gas = 7496,
+ .min_gas = 5610,
+ .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,
};
@@ -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
// 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
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))) {
- 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) {
@@ -225,7 +243,7 @@ static bool gm_tx_hook(const CANPacket_t *to_send) {
// GAS/REGEN: safety check
if (addr == 0x2CB) {
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;
// 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) {
+ sport_mode = alternative_experience & ALT_EXP_RAISE_LONGITUDINAL_LIMITS_TO_ISO_MAX;
+
if GET_FLAG(param, GM_PARAM_HW_CAM) {
gm_hw = GM_CAM;
} 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);
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)) {
- 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 {
}
diff --git a/panda/board/safety/safety_honda.h b/panda/board/safety/safety_honda.h
index 630f6d731..a0b3cece9 100644
--- a/panda/board/safety/safety_honda.h
+++ b/panda/board/safety/safety_honda.h
@@ -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_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_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_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 = {
.max_accel = 200, // accel is used for brakes
.min_accel = -350,
@@ -12,6 +19,14 @@ const LongitudinalLimits HONDA_BOSCH_LONG_LIMITS = {
.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 = {
.max_gas = 198, // 0xc6
.max_brake = 255,
@@ -40,6 +55,11 @@ RxCheck honda_common_rx_checks[] = {
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[] = {
HONDA_COMMON_RX_CHECKS(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)
};
+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
RxCheck honda_bosch_rx_checks[] = {
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_NIDEC_ALT = 4;
const uint16_t HONDA_PARAM_RADARLESS = 8;
+const uint16_t HONDA_PARAM_GAS_INTERCEPTOR = 16;
+const uint16_t HONDA_PARAM_CLARITY = 32;
enum {
HONDA_BTN_NONE = 0,
@@ -79,6 +106,7 @@ bool honda_alt_brake_msg = false;
bool honda_fwd_brake = false;
bool honda_bosch_long = false;
bool honda_bosch_radarless = false;
+bool honda_clarity_brake_msg = false;
typedef enum {HONDA_NIDEC, HONDA_BOSCH} HondaHw;
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) {
- int counter_byte = GET_LEN(to_push) - 1U;
- return (GET_BYTE(to_push, counter_byte) >> 4U) & 0x3U;
+ int addr = GET_ADDR(to_push);
+
+ 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) {
- 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 addr = GET_ADDR(to_push);
+ int len = GET_LEN(to_push);
int bus = GET_BUS(to_push);
// sample speed
@@ -190,8 +229,17 @@ static void honda_rx_hook(const CANPacket_t *to_push) {
}
}
- if (addr == 0x17C) {
- gas_pressed = GET_BYTE(to_push, 0) != 0U;
+ // length check because bosch hardware also uses this id (0x201 w/ len = 8)
+ 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
@@ -200,6 +248,9 @@ static void honda_rx_hook(const CANPacket_t *to_push) {
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);
+ 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
// only stop forwarding when AEB event is over
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) {
+ sport_mode = alternative_experience & ALT_EXP_RAISE_LONGITUDINAL_LIMITS_TO_ISO_MAX;
+
bool tx = true;
int addr = GET_ADDR(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)
if ((addr == 0x1FA) && (bus == bus_pt)) {
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)) {
tx = false;
}
@@ -273,8 +329,13 @@ static bool honda_tx_hook(const CANPacket_t *to_send) {
gas = to_signed(gas, 16);
bool violation = false;
- violation |= longitudinal_accel_checks(accel, HONDA_BOSCH_LONG_LIMITS);
- violation |= longitudinal_gas_checks(gas, HONDA_BOSCH_LONG_LIMITS);
+ if (sport_mode) {
+ 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) {
tx = false;
}
@@ -286,7 +347,11 @@ static bool honda_tx_hook(const CANPacket_t *to_send) {
accel = to_signed(accel, 12);
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) {
tx = false;
}
@@ -294,7 +359,8 @@ static bool honda_tx_hook(const CANPacket_t *to_send) {
// STEER: safety check
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);
if (steer_applied) {
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
// ensuring that only the cancel button press is sent (VAL 2) when controls are off.
// 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_bosch_long = 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;
bool enable_nidec_alt = GET_FLAG(param, HONDA_PARAM_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 {
- 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;
}
diff --git a/panda/board/safety/safety_hyundai.h b/panda/board/safety/safety_hyundai.h
index 5a324bff2..a849a87e1 100644
--- a/panda/board/safety/safety_hyundai.h
+++ b/panda/board/safety/safety_hyundai.h
@@ -25,6 +25,11 @@ const LongitudinalLimits HYUNDAI_LONG_LIMITS = {
.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[] = {
{0x340, 0, 8}, // LKAS11 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) {
+ sport_mode = alternative_experience & ALT_EXP_RAISE_LONGITUDINAL_LIMITS_TO_ISO_MAX;
+
bool tx = true;
int addr = GET_ADDR(to_send);
@@ -239,8 +246,13 @@ static bool hyundai_tx_hook(const CANPacket_t *to_send) {
bool violation = false;
- violation |= longitudinal_accel_checks(desired_accel_raw, HYUNDAI_LONG_LIMITS);
- violation |= longitudinal_accel_checks(desired_accel_val, HYUNDAI_LONG_LIMITS);
+ if (sport_mode) {
+ 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_req;
diff --git a/panda/board/safety/safety_hyundai_common.h b/panda/board/safety/safety_hyundai_common.h
index 54ea0f024..b4cf2b540 100644
--- a/panda/board/safety/safety_hyundai_common.h
+++ b/panda/board/safety/safety_hyundai_common.h
@@ -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) {
+ 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) {
hyundai_last_button_interaction = 0U;
} else {
diff --git a/panda/board/safety/safety_mazda.h b/panda/board/safety/safety_mazda.h
index ea4ce92d0..19e2dd120 100644
--- a/panda/board/safety/safety_mazda.h
+++ b/panda/board/safety/safety_mazda.h
@@ -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
if (addr == MAZDA_CRZ_CTRL) {
+ acc_main_on = GET_BIT(to_push, 17U);
bool cruise_engaged = GET_BYTE(to_push, 0) & 0x8U;
pcm_cruise_check(cruise_engaged);
}
diff --git a/panda/board/safety/safety_nissan.h b/panda/board/safety/safety_nissan.h
index c2406260f..30e1445bd 100644
--- a/panda/board/safety/safety_nissan.h
+++ b/panda/board/safety/safety_nissan.h
@@ -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);
}
+ if (addr == 0x1b6) {
+ acc_main_on = GET_BIT(to_push, 36U);
+ }
+
// X-Trail 0x15c, Leaf 0x239
if ((addr == 0x15c) || (addr == 0x239)) {
if (addr == 0x15c){
gas_pressed = ((GET_BYTE(to_push, 5) << 2) | ((GET_BYTE(to_push, 6) >> 6) & 0x3U)) > 3U;
} else {
+ acc_main_on = GET_BIT(to_push, 17U);
gas_pressed = GET_BYTE(to_push, 0) > 3U;
}
}
diff --git a/panda/board/safety/safety_subaru.h b/panda/board/safety/safety_subaru.h
index 581dc50b7..a4f497dab 100644
--- a/panda/board/safety/safety_subaru.h
+++ b/panda/board/safety/safety_subaru.h
@@ -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);
@@ -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
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);
pcm_cruise_check(cruise_engaged);
}
diff --git a/panda/board/safety/safety_subaru_preglobal.h b/panda/board/safety/safety_subaru_preglobal.h
index 1047814ac..7d44fb0c8 100644
--- a/panda/board/safety/safety_subaru_preglobal.h
+++ b/panda/board/safety/safety_subaru_preglobal.h
@@ -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
if (addr == MSG_SUBARU_PG_CruiseControl) {
+ acc_main_on = GET_BIT(to_push, 48U);
bool cruise_engaged = GET_BIT(to_push, 49U);
pcm_cruise_check(cruise_engaged);
}
diff --git a/panda/board/safety/safety_tesla.h b/panda/board/safety/safety_tesla.h
index 652161ff2..4c3a1575c 100644
--- a/panda/board/safety/safety_tesla.h
+++ b/panda/board/safety/safety_tesla.h
@@ -100,6 +100,14 @@ static void tesla_rx_hook(const CANPacket_t *to_push) {
if(addr == (tesla_powertrain ? 0x256 : 0x368)) {
// Cruise state
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
(cruise_state == 3) || // STANDSTILL
(cruise_state == 4) || // OVERRIDE
diff --git a/panda/board/safety/safety_toyota.h b/panda/board/safety/safety_toyota.h
index 05f84e460..36b236cea 100644
--- a/panda/board/safety/safety_toyota.h
+++ b/panda/board/safety/safety_toyota.h
@@ -37,9 +37,29 @@ const LongitudinalLimits TOYOTA_LONG_LIMITS = {
.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
-#define TOYOTA_COMMON_TX_MSGS \
- {0x2E4, 0, 5}, {0x191, 0, 8}, {0x412, 0, 8}, {0x343, 0, 8}, {0x1D2, 0, 8}, /* LKAS + LTA + ACC & PCM cancel cmds */ \
+#define TOYOTA_BASE_TX_MSGS \
+ {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 \
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 */ \
{0x411, 0, 8}, /* PCS_HUD */ \
{0x750, 0, 8}, /* radar diagnostic address */ \
+ {0x1D3, 0, 8}, \
const CanMsg TOYOTA_TX_MSGS[] = {
TOYOTA_COMMON_TX_MSGS
};
+const CanMsg TOYOTA_SECOC_TX_MSGS[] = {
+ TOYOTA_COMMON_SECOC_TX_MSGS
+};
+
const CanMsg TOYOTA_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) \
{.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 = {{0x1D2, 0, 8, .check_checksum = true, .frequency = 33U}, { 0 }, { 0 }}}, \
- {.msg = {{0x224, 0, 8, .check_checksum = false, .frequency = 40U}, \
- {0x226, 0, 8, .check_checksum = false, .frequency = 40U}, { 0 }}}, \
+ {.msg = {{0x1D2, 0, 8, .check_checksum = true, .frequency = 33U}, \
+ {0x176, 0, 8, .check_checksum = true, .frequency = 32U}, { 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[] = {
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
RxCheck toyota_lta_rx_checks[] = {
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
// first byte is for EPS factor, second is for flags
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_STOCK_LONGITUDINAL = 2UL << 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_stock_longitudinal = 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));
}
+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) {
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
// exit controls on rising edge of gas press
if (addr == 0x1D2) {
@@ -152,7 +211,9 @@ static void toyota_rx_hook(const CANPacket_t *to_push) {
pcm_cruise_check(cruise_engaged);
// sample gas pedal
- gas_pressed = !GET_BIT(to_push, 4U);
+ if (!enable_gas_interceptor) {
+ gas_pressed = !GET_BIT(to_push, 4U);
+ }
}
// sample speed
@@ -175,6 +236,15 @@ static void toyota_rx_hook(const CANPacket_t *to_push) {
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
if (!toyota_stock_longitudinal && (addr == 0x343)) {
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) {
+ sport_mode = alternative_experience & ALT_EXP_RAISE_LONGITUDINAL_LIMITS_TO_ISO_MAX;
+
bool tx = true;
int addr = GET_ADDR(to_send);
int bus = GET_BUS(to_send);
// Check if msg is sent on 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
if (addr == 0x343) {
int desired_accel = (GET_BYTE(to_send, 0) << 8) | GET_BYTE(to_send, 1);
desired_accel = to_signed(desired_accel, 16);
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
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) {
// check the STEER_REQUEST, STEER_REQUEST_2, TORQUE_WIND_DOWN, STEER_ANGLE_CMD signals
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
if (addr == 0x2E4) {
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) {
// 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);
- 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;
}
}
@@ -302,20 +400,41 @@ static bool toyota_tx_hook(const CANPacket_t *to_send) {
}
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_stock_longitudinal = GET_FLAG(param, TOYOTA_PARAM_STOCK_LONGITUDINAL);
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;
+ // Gas interceptor should not be used if openpilot is not controlling longitudinal
+ if (toyota_stock_longitudinal) {
+ enable_gas_interceptor = false;
+ }
+
safety_config ret;
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 {
- 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) : \
- SET_RX_CHECKS(toyota_lka_rx_checks, ret);
+ if (enable_gas_interceptor) {
+ 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;
}
@@ -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)
// in TSS2, 0x191 is LTA which we need to block to avoid controls collision
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
bool is_acc_msg = (addr == 0x343);
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,
.get_checksum = toyota_get_checksum,
.compute_checksum = toyota_compute_checksum,
+ .get_counter = toyota_get_counter,
.get_quality_flag_valid = toyota_get_quality_flag_valid,
};
diff --git a/panda/board/safety/safety_volkswagen_mqb.h b/panda/board/safety/safety_volkswagen_mqb.h
index d880a69a6..0a84342f5 100644
--- a/panda/board/safety/safety_volkswagen_mqb.h
+++ b/panda/board/safety/safety_volkswagen_mqb.h
@@ -20,6 +20,12 @@ const LongitudinalLimits VOLKSWAGEN_MQB_LONG_LIMITS = {
.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_LH_EPS_03 0x09F // RX from EPS, for driver steering torque
#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) {
+ sport_mode = alternative_experience & ALT_EXP_RAISE_LONGITUDINAL_LIMITS_TO_ISO_MAX;
+
int addr = GET_ADDR(to_send);
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;
}
- 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) {
tx = false;
diff --git a/panda/board/safety/safety_volkswagen_pq.h b/panda/board/safety/safety_volkswagen_pq.h
index de147cb58..c8838cf48 100644
--- a/panda/board/safety/safety_volkswagen_pq.h
+++ b/panda/board/safety/safety_volkswagen_pq.h
@@ -20,6 +20,12 @@ const LongitudinalLimits VOLKSWAGEN_PQ_LONG_LIMITS = {
.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_HCA_1 0x0D2 // TX by OP, Heading Control Assist steering torque
#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) {
+ sport_mode = alternative_experience & ALT_EXP_RAISE_LONGITUDINAL_LIMITS_TO_ISO_MAX;
+
int addr = GET_ADDR(to_send);
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)
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)) {
- tx = false;
+ if (sport_mode) {
+ 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;
+ }
}
}
diff --git a/panda/board/safety_declarations.h b/panda/board/safety_declarations.h
index 6df5b18f9..0427d90aa 100644
--- a/panda/board/safety_declarations.h
+++ b/panda/board/safety_declarations.h
@@ -220,10 +220,12 @@ bool brake_pressed_prev = false;
bool regen_braking = false;
bool regen_braking_prev = false;
bool cruise_engaged_prev = false;
+bool sport_mode = false;
struct sample_t vehicle_speed;
bool vehicle_moving = false;
bool acc_main_on = false; // referred to as "ACC off" in ISO 15622:2018
int cruise_button_prev = 0;
+int cruise_main_prev = 0;
bool safety_rx_checks_invalid = false;
// for safety modes with torque steering control
@@ -269,3 +271,6 @@ int alternative_experience = 0;
uint32_t safety_mode_cnt = 0U;
// allow 1s of transition timeout after relay changes state before assessing malfunctioning
const uint32_t RELAY_TRNS_TIMEOUT = 1U;
+
+// Always on Lateral
+#define ALT_EXP_ALWAYS_ON_LATERAL 32
diff --git a/panda/python/__init__.py b/panda/python/__init__.py
index bcb675ed6..d31235075 100644
--- a/panda/python/__init__.py
+++ b/panda/python/__init__.py
@@ -111,6 +111,7 @@ class ALTERNATIVE_EXPERIENCE:
DISABLE_STOCK_AEB = 2
RAISE_LONGITUDINAL_LIMITS_TO_ISO_MAX = 8
ALLOW_AEB = 16
+ ALWAYS_ON_LATERAL = 32
class Panda:
@@ -191,11 +192,14 @@ class Panda:
FLAG_TOYOTA_ALT_BRAKE = (1 << 8)
FLAG_TOYOTA_STOCK_LONGITUDINAL = (2 << 8)
FLAG_TOYOTA_LTA = (4 << 8)
+ FLAG_TOYOTA_GAS_INTERCEPTOR = (8 << 8)
FLAG_HONDA_ALT_BRAKE = 1
FLAG_HONDA_BOSCH_LONG = 2
FLAG_HONDA_NIDEC_ALT = 4
FLAG_HONDA_RADARLESS = 8
+ FLAG_HONDA_GAS_INTERCEPTOR = 16
+ FLAG_HONDA_CLARITY = 32
FLAG_HYUNDAI_EV_GAS = 1
FLAG_HYUNDAI_HYBRID_GAS = 2
@@ -205,6 +209,7 @@ class Panda:
FLAG_HYUNDAI_CANFD_ALT_BUTTONS = 32
FLAG_HYUNDAI_ALT_LIMITS = 64
FLAG_HYUNDAI_CANFD_HDA2_ALT_STEERING = 128
+ FLAG_HYUNDAI_LFA_BTN = 256
FLAG_TESLA_POWERTRAIN = 1
FLAG_TESLA_LONG_CONTROL = 2
diff --git a/panda/tests/safety/test_honda.py b/panda/tests/safety/test_honda.py
index 082199c02..8262b5256 100644
--- a/panda/tests/safety/test_honda.py
+++ b/panda/tests/safety/test_honda.py
@@ -350,6 +350,21 @@ class TestHondaNidecPcmSafety(HondaPcmEnableBase, TestHondaNidecSafetyBase):
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):
"""
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)
+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 **********************
diff --git a/panda/tests/safety/test_toyota.py b/panda/tests/safety/test_toyota.py
index 80bf9ce9a..0743c67e8 100644
--- a/panda/tests/safety/test_toyota.py
+++ b/panda/tests/safety/test_toyota.py
@@ -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
[0x411, 0], # PCS_HUD
[0x750, 0]] # radar diagnostic address
+GAS_INTERCEPTOR_TX_MSGS = [[0x200, 0]]
class TestToyotaSafetyBase(common.PandaCarSafetyTest, common.LongitudinalAccelSafetyTest):
@@ -126,6 +127,32 @@ class TestToyotaSafetyBase(common.PandaCarSafetyTest, common.LongitudinalAccelSa
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):
MAX_RATE_UP = 15
@@ -148,6 +175,10 @@ class TestToyotaSafetyTorque(TestToyotaSafetyBase, common.MotorTorqueSteeringSaf
self.safety.init_tests()
+class TestToyotaSafetyTorqueGasInterceptor(TestToyotaSafetyGasInterceptorBase, TestToyotaSafetyTorque):
+ pass
+
+
class TestToyotaSafetyAngle(TestToyotaSafetyBase, common.AngleSteeringSafetyTest):
# Angle control limits
@@ -261,6 +292,10 @@ class TestToyotaSafetyAngle(TestToyotaSafetyBase, common.AngleSteeringSafetyTest
self.assertEqual(self.safety.get_angle_meas_max(), 0)
+class TestToyotaSafetyAngleGasInterceptor(TestToyotaSafetyGasInterceptorBase, TestToyotaSafetyAngle):
+ pass
+
+
class TestToyotaAltBrakeSafety(TestToyotaSafetyTorque):
def setUp(self):
@@ -278,6 +313,10 @@ class TestToyotaAltBrakeSafety(TestToyotaSafetyTorque):
pass
+class TestToyotaAltBrakeSafetyGasInterceptor(TestToyotaSafetyGasInterceptorBase, TestToyotaAltBrakeSafety):
+ pass
+
+
class TestToyotaStockLongitudinalBase(TestToyotaSafetyBase):
TX_MSGS = TOYOTA_COMMON_TX_MSGS
diff --git a/selfdrive/assets/img_spinner_comma.png b/selfdrive/assets/img_spinner_comma.png
index 16109557f..9f5e55877 100644
Binary files a/selfdrive/assets/img_spinner_comma.png and b/selfdrive/assets/img_spinner_comma.png differ
diff --git a/selfdrive/assets/img_spinner_track.png b/selfdrive/assets/img_spinner_track.png
index 931c17e83..d54d51ead 100644
Binary files a/selfdrive/assets/img_spinner_track.png and b/selfdrive/assets/img_spinner_track.png differ
diff --git a/selfdrive/car/__init__.py b/selfdrive/car/__init__.py
index cb978f6c8..b918b684a 100644
--- a/selfdrive/car/__init__.py
+++ b/selfdrive/car/__init__.py
@@ -1,4 +1,5 @@
# functions common among cars
+import logging
from collections import namedtuple
from dataclasses import dataclass
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.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...
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
+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):
crc = 0xFF # standard init value
poly = 0xD5 # standard crc8: x8+x7+x6+x4+x2+1
diff --git a/selfdrive/car/body/carcontroller.py b/selfdrive/car/body/carcontroller.py
index 259126c41..66ea4dd74 100644
--- a/selfdrive/car/body/carcontroller.py
+++ b/selfdrive/car/body/carcontroller.py
@@ -35,13 +35,12 @@ class CarController(CarControllerBase):
torque -= deadband
return torque
- def update(self, CC, CS, now_nanos):
+ def update(self, CC, CS, now_nanos, frogpilot_toggles):
torque_l = 0
torque_r = 0
- llk_valid = len(CC.orientationNED) > 1 and len(CC.angularVelocity) > 1
- if CC.enabled and llk_valid:
+ if CC.enabled:
# Read these from the joystick
# TODO: this isn't acceleration, okay?
speed_desired = CC.actuators.accel / 5.
diff --git a/selfdrive/car/body/carstate.py b/selfdrive/car/body/carstate.py
index fca9bcc62..08ee92299 100644
--- a/selfdrive/car/body/carstate.py
+++ b/selfdrive/car/body/carstate.py
@@ -1,4 +1,4 @@
-from cereal import car
+from cereal import car, custom
from opendbc.can.parser import CANParser
from openpilot.selfdrive.car.interfaces import CarStateBase
from openpilot.selfdrive.car.body.values import DBC
@@ -6,8 +6,9 @@ from openpilot.selfdrive.car.body.values import DBC
STARTUP_TICKS = 100
class CarState(CarStateBase):
- def update(self, cp):
+ def update(self, cp, frogpilot_toggles):
ret = car.CarState.new_message()
+ fp_ret = custom.FrogPilotCarState.new_message()
ret.wheelSpeeds.fl = cp.vl['MOTORS_DATA']['SPEED_L']
ret.wheelSpeeds.fr = cp.vl['MOTORS_DATA']['SPEED_R']
@@ -28,7 +29,7 @@ class CarState(CarStateBase):
ret.cruiseState.enabled = True
ret.cruiseState.available = True
- return ret
+ return ret, fp_ret
@staticmethod
def get_can_parser(CP):
diff --git a/selfdrive/car/body/interface.py b/selfdrive/car/body/interface.py
index f797a7ecf..c5e265496 100644
--- a/selfdrive/car/body/interface.py
+++ b/selfdrive/car/body/interface.py
@@ -7,7 +7,7 @@ from openpilot.selfdrive.car.body.values import SPEED_FROM_RPM
class CarInterface(CarInterfaceBase):
@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.carName = "body"
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.body)]
@@ -25,8 +25,8 @@ class CarInterface(CarInterfaceBase):
return ret
- def _update(self, c):
- ret = self.CS.update(self.cp)
+ def _update(self, c, frogpilot_toggles):
+ ret, fp_ret = self.CS.update(self.cp, frogpilot_toggles)
# wait for everything to init first
if self.frame > int(5. / DT_CTRL):
@@ -36,4 +36,4 @@ class CarInterface(CarInterfaceBase):
ret.events[0].enable = True
self.frame += 1
- return ret
+ return ret, fp_ret
diff --git a/selfdrive/car/car_helpers.py b/selfdrive/car/car_helpers.py
index 66097339b..40977e4b8 100644
--- a/selfdrive/car/car_helpers.py
+++ b/selfdrive/car/car_helpers.py
@@ -12,7 +12,6 @@ from openpilot.selfdrive.car.mock.values import CAR as MOCK
from openpilot.common.swaglog import cloudlog
import cereal.messaging as messaging
from openpilot.selfdrive.car import gen_empty_fingerprint
-from openpilot.system.version import get_build_metadata
FRAME_FINGERPRINT = 100 # 1s
@@ -20,11 +19,7 @@ EventName = car.CarEvent.EventName
def get_startup_event(car_recognized, controller_available, fw_seen):
- build_metadata = get_build_metadata()
- if build_metadata.openpilot.comma_remote and build_metadata.tested_channel:
- event = EventName.startup
- else:
- event = EventName.startupMaster
+ event = EventName.customStartupAlert
if not car_recognized:
if fw_seen:
@@ -190,15 +185,27 @@ def get_car_interface(CP):
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)
- if candidate is None:
- cloudlog.event("car doesn't match any fingerprints", fingerprints=repr(fingerprints), error=True)
+ if candidate is None or force_fingerprint:
+ 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"
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.carFw = car_fw
CP.fingerprintSource = source
diff --git a/selfdrive/car/card.py b/selfdrive/car/card.py
index d9ee020ba..7e055f53c 100755
--- a/selfdrive/car/card.py
+++ b/selfdrive/car/card.py
@@ -4,18 +4,21 @@ import time
import cereal.messaging as messaging
-from cereal import car
+from cereal import car, custom
from panda import ALTERNATIVE_EXPERIENCE
from openpilot.common.params import Params
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.car.car_helpers import get_car, get_one_can
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
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
EventName = car.CarEvent.EventName
@@ -26,8 +29,8 @@ class Car:
def __init__(self, CI=None):
self.can_sock = messaging.sub_sock('can', timeout=20)
- self.sm = messaging.SubMaster(['pandaStates', 'carControl', 'onroadEvents'])
- self.pm = messaging.PubMaster(['sendcan', 'carState', 'carParams', 'carOutput'])
+ self.sm = messaging.SubMaster(['pandaStates', 'carControl', 'onroadEvents', 'frogpilotPlan'])
+ self.pm = messaging.PubMaster(['sendcan', 'carState', 'carParams', 'carOutput', 'frogpilotCarState'])
self.can_rcv_cum_timeout_counter = 0
@@ -45,8 +48,9 @@ class Car:
get_one_can(self.can_sock)
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")
- 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:
self.CI, self.CP = CI, CI.CP
@@ -66,28 +70,52 @@ class Car:
safety_config.safetyModel = car.CarParams.SafetyModel.noOutput
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
prev_cp = self.params.get("CarParamsPersistent")
if prev_cp is not None:
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
cp_bytes = self.CP.to_bytes()
self.params.put("CarParams", cp_bytes)
self.params.put_nonblocking("CarParamsCache", cp_bytes)
self.params.put_nonblocking("CarParamsPersistent", cp_bytes)
- self.events = Events()
-
- # card is driven by can recv, expected at 100Hz
- self.rk = Ratekeeper(100, print_delay_threshold=None)
+ update_frogpilot_toggles()
def state_update(self) -> car.CarState:
"""carState update loop, driven by can"""
# Update carState from CAN
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)
@@ -100,7 +128,7 @@ class Car:
if can_rcv_valid and REPLAY:
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:
self.events.clear()
@@ -115,7 +143,7 @@ class Car:
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"""
# carParams - logged every 50 seconds (> 1 per segment)
@@ -139,6 +167,12 @@ class Car:
cs_send.carState.cumLagMs = -self.rk.remaining * 1000.
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):
"""control update loop, driven by carControl"""
@@ -152,17 +186,17 @@ class Car:
if self.sm.all_alive(['carControl']):
# send car controls over can
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.CC_prev = CC
def step(self):
- CS = self.state_update()
+ CS, FPCS = self.state_update()
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
self.sm.seen['onroadEvents'])
@@ -177,6 +211,9 @@ class Car:
self.step()
self.rk.monitor_time()
+ # Update FrogPilot parameters
+ if self.sm['frogpilotPlan'].togglesUpdated:
+ self.frogpilot_toggles = get_frogpilot_toggles()
def main():
config_realtime_process(4, Priority.CTRL_HIGH)
diff --git a/selfdrive/car/chrysler/carcontroller.py b/selfdrive/car/chrysler/carcontroller.py
index 85f53f68e..1b954a252 100644
--- a/selfdrive/car/chrysler/carcontroller.py
+++ b/selfdrive/car/chrysler/carcontroller.py
@@ -2,7 +2,7 @@ from opendbc.can.packer import CANPacker
from openpilot.common.realtime import DT_CTRL
from openpilot.selfdrive.car import apply_meas_steer_torque_limits
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
@@ -20,7 +20,7 @@ class CarController(CarControllerBase):
self.packer = CANPacker(dbc_name)
self.params = CarControllerParams(CP)
- def update(self, CC, CS, now_nanos):
+ def update(self, CC, CS, now_nanos, frogpilot_toggles):
can_sends = []
lkas_active = CC.latActive and self.lkas_control_bit_prev
@@ -32,18 +32,18 @@ class CarController(CarControllerBase):
# ACC cancellation
if CC.cruiseControl.cancel:
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
elif CC.cruiseControl.resume:
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
if self.frame % 25 == 0:
if CS.lkas_car_model != -1:
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
# steering
@@ -51,7 +51,12 @@ class CarController(CarControllerBase):
# TODO: can we make this more sane? why is it different for all the cars?
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
elif self.CP.flags & ChryslerFlags.HIGHER_MIN_STEERING_SPEED:
if CS.out.vEgo < (self.CP.minSteerSpeed - 3.0):
diff --git a/selfdrive/car/chrysler/carstate.py b/selfdrive/car/chrysler/carstate.py
index 91b922c59..3085a320a 100644
--- a/selfdrive/car/chrysler/carstate.py
+++ b/selfdrive/car/chrysler/carstate.py
@@ -1,9 +1,9 @@
-from cereal import car
+from cereal import car, custom
from openpilot.common.conversions import Conversions as CV
from opendbc.can.parser import CANParser
from opendbc.can.can_define import CANDefine
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):
@@ -15,6 +15,7 @@ class CarState(CarStateBase):
self.auto_high_beam = 0
self.button_counter = 0
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:
self.shifter_values = can_define.dv["Transmission_Status"]["Gear_State"]
@@ -24,12 +25,13 @@ class CarState(CarStateBase):
self.prev_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()
+ fp_ret = custom.FrogPilotCarState.new_message()
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
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
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
def get_cruise_messages():
@@ -113,6 +124,7 @@ class CarState(CarStateBase):
@staticmethod
def get_can_parser(CP):
+ button_message = "CRUISE_BUTTONS_ALT" if CP.flags & ChryslerFlags.RAM_HD_ALT_BUTTONS else "CRUISE_BUTTONS"
messages = [
# sig_address, frequency
("ESP_1", 50),
@@ -120,7 +132,7 @@ class CarState(CarStateBase):
("ESP_6", 50),
("STEERING", 100),
("ECM_5", 50),
- ("CRUISE_BUTTONS", 50),
+ (button_message, 50),
("STEERING_LEVERS", 10),
("ORC_1", 2),
("BCM_1", 1),
@@ -134,11 +146,14 @@ class CarState(CarStateBase):
("ESP_8", 50),
("EPS_3", 50),
("Transmission_Status", 50),
+ ("Center_Stack_1", 1),
+ ("Center_Stack_2", 1),
]
else:
messages += [
("GEAR", 50),
("SPEED_1", 100),
+ ("TRACTION_BUTTON", 1),
]
messages += CarState.get_cruise_messages()
diff --git a/selfdrive/car/chrysler/chryslercan.py b/selfdrive/car/chrysler/chryslercan.py
index 96439f35d..b5e9956c0 100644
--- a/selfdrive/car/chrysler/chryslercan.py
+++ b/selfdrive/car/chrysler/chryslercan.py
@@ -1,10 +1,10 @@
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
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
# == Color ==
@@ -27,7 +27,7 @@ def create_lkas_hud(packer, CP, lkas_active, hud_alert, hud_count, car_model, au
# 7 Normal
# 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
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:
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)
@@ -62,10 +63,11 @@ def create_lkas_command(packer, CP, apply_steer, lkas_control_bit):
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 = {
"ACC_Cancel": cancel,
"ACC_Resume": resume,
"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)
diff --git a/selfdrive/car/chrysler/fingerprints.py b/selfdrive/car/chrysler/fingerprints.py
index 5072aad5c..da8ac55a0 100644
--- a/selfdrive/car/chrysler/fingerprints.py
+++ b/selfdrive/car/chrysler/fingerprints.py
@@ -535,6 +535,7 @@ FW_VERSIONS = {
b'05149848AC ',
b'05190341AD',
b'68378695AJ ',
+ b'68378696AI ',
b'68378696AJ ',
b'68378701AI ',
b'68378702AI ',
@@ -591,6 +592,7 @@ FW_VERSIONS = {
b'68360081AM',
b'68360085AJ',
b'68360085AL',
+ b'68360085AF',
b'68360086AH',
b'68360086AK',
b'68384328AD',
@@ -620,14 +622,21 @@ FW_VERSIONS = {
(Ecu.combinationMeter, 0x742, None): [
b'68361606AH',
b'68437735AC',
+ b'68437746AD',
+ b'68492682AD',
+ b'68525438AB',
b'68492693AD',
b'68525485AB',
b'68525487AB',
b'68525498AB',
b'68528791AF',
+ b'68620919AB',
+ b'68620921AC',
+ b'68620923AB',
b'68628474AB',
],
(Ecu.srs, 0x744, None): [
+ b'68346749AB',
b'68399794AC',
b'68428503AA',
b'68428505AA',
@@ -668,9 +677,12 @@ FW_VERSIONS = {
b'52401032AE',
b'52421132AF',
b'52421332AF',
+ b'52421332AG',
b'68527616AD ',
b'M2370131MB',
b'M2421132MB',
+ b'52421232AF',
+ b'52421492AA',
],
},
CAR.DODGE_DURANGO: {
diff --git a/selfdrive/car/chrysler/interface.py b/selfdrive/car/chrysler/interface.py
index 217a1a756..e3e76433a 100755
--- a/selfdrive/car/chrysler/interface.py
+++ b/selfdrive/car/chrysler/interface.py
@@ -1,18 +1,18 @@
#!/usr/bin/env python3
-from cereal import car
+from cereal import car, custom
from panda import Panda
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.interfaces import CarInterfaceBase
ButtonType = car.CarState.ButtonEvent.Type
+FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
class CarInterface(CarInterfaceBase):
@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.dashcamOnly = candidate in RAM_HD
# radar parsing needs some work, see https://github.com/commaai/openpilot/issues/26842
ret.radarUnavailable = True # DBC[candidate]['radar'] is None
@@ -55,14 +55,24 @@ class CarInterface(CarInterfaceBase):
elif candidate == CAR.RAM_1500_5TH_GEN:
ret.steerActuatorDelay = 0.2
ret.wheelbase = 3.88
+ ret.minSteerSpeed = 0.5
+ ret.minEnableSpeed = 14.5
# 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):
ret.minSteerSpeed = 0.
elif candidate == CAR.RAM_HD_5TH_GEN:
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)
+ # Some RAM HD use Chrysler button address
+ if 570 not in fingerprint[0]:
+ ret.flags |= ChryslerFlags.RAM_HD_ALT_BUTTONS.value
+
else:
raise ValueError(f"Unsupported car: {candidate}")
@@ -76,22 +86,31 @@ class CarInterface(CarInterfaceBase):
return ret
- def _update(self, c):
- ret = self.CS.update(self.cp, self.cp_cam)
+ def _update(self, c, frogpilot_toggles):
+ 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 = self.create_common_events(ret, extra_gears=[car.CarState.GearShifter.low])
# Low speed steer alert hysteresis logic
- 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.CP.carFingerprint in RAM_DT:
+ if self.CS.out.vEgo >= self.CP.minEnableSpeed:
+ 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:
events.add(car.CarEvent.EventName.belowSteerSpeed)
ret.events = events.to_msg()
- return ret
+ return ret, fp_ret
diff --git a/selfdrive/car/chrysler/values.py b/selfdrive/car/chrysler/values.py
index 42ea94cf8..14209bfb3 100644
--- a/selfdrive/car/chrysler/values.py
+++ b/selfdrive/car/chrysler/values.py
@@ -13,6 +13,7 @@ Ecu = car.CarParams.Ecu
class ChryslerFlags(IntFlag):
# Detected flags
HIGHER_MIN_STEERING_SPEED = 1
+ RAM_HD_ALT_BUTTONS = 2
@dataclass
class ChryslerCarDocs(CarDocs):
@@ -100,7 +101,7 @@ class CarControllerParams:
elif CP.carFingerprint in RAM_DT:
self.STEER_DELTA_UP = 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:
self.STEER_DELTA_UP = 3
self.STEER_DELTA_DOWN = 3
diff --git a/selfdrive/car/ford/carcontroller.py b/selfdrive/car/ford/carcontroller.py
index 7be3b2ebe..fc0dd0125 100644
--- a/selfdrive/car/ford/carcontroller.py
+++ b/selfdrive/car/ford/carcontroller.py
@@ -7,6 +7,8 @@ from openpilot.selfdrive.car.ford.values import CarControllerParams, FordFlags
from openpilot.selfdrive.car.interfaces import CarControllerBase
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
VisualAlert = car.CarControl.HUDControl.VisualAlert
@@ -37,7 +39,7 @@ class CarController(CarControllerBase):
self.steer_alert_last = False
self.lead_distance_bars_last = None
- def update(self, CC, CS, now_nanos):
+ def update(self, CC, CS, now_nanos, frogpilot_toggles):
can_sends = []
actuators = CC.actuators
@@ -65,6 +67,13 @@ class CarController(CarControllerBase):
if CC.latActive:
# apply rate limits, curvature error limit, and clip to signal range
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)
else:
apply_curvature = 0.
@@ -87,7 +96,10 @@ class CarController(CarControllerBase):
# send acc msg at 50Hz
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
- 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
if not CC.longActive or gas < CarControllerParams.MIN_GAS:
gas = CarControllerParams.INACTIVE_GAS
diff --git a/selfdrive/car/ford/carstate.py b/selfdrive/car/ford/carstate.py
index 78f48ec5c..db9abdf6c 100644
--- a/selfdrive/car/ford/carstate.py
+++ b/selfdrive/car/ford/carstate.py
@@ -1,4 +1,4 @@
-from cereal import car
+from cereal import car, custom
from opendbc.can.can_define import CANDefine
from opendbc.can.parser import CANParser
from openpilot.common.conversions import Conversions as CV
@@ -22,8 +22,9 @@ class CarState(CarStateBase):
self.prev_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()
+ fp_ret = custom.FrogPilotCarState.new_message()
# 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
@@ -107,7 +108,11 @@ class CarState(CarStateBase):
self.acc_tja_status_stock_values = cp_cam.vl["ACCDATA_3"]
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
def get_can_parser(CP):
diff --git a/selfdrive/car/ford/interface.py b/selfdrive/car/ford/interface.py
index 54cf86510..15ecb4bbf 100644
--- a/selfdrive/car/ford/interface.py
+++ b/selfdrive/car/ford/interface.py
@@ -1,4 +1,4 @@
-from cereal import car
+from cereal import car, custom
from panda import Panda
from openpilot.common.conversions import Conversions as CV
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
ButtonType = car.CarState.ButtonEvent.Type
+FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
TransmissionType = car.CarParams.TransmissionType
GearShifter = car.CarState.GearShifter
class CarInterface(CarInterfaceBase):
@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.dashcamOnly = bool(ret.flags & FordFlags.CANFD)
+ ret.dashcamOnly = False
ret.radarUnavailable = True
ret.steerControlType = car.CarParams.SteerControlType.angle
@@ -67,10 +68,13 @@ class CarInterface(CarInterfaceBase):
ret.centerToFront = ret.wheelbase * 0.44
return ret
- def _update(self, c):
- ret = self.CS.update(self.cp, self.cp_cam)
+ def _update(self, c, frogpilot_toggles):
+ 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])
if not self.CS.vehicle_sensors_valid:
@@ -78,4 +82,4 @@ class CarInterface(CarInterfaceBase):
ret.events = events.to_msg()
- return ret
+ return ret, fp_ret
diff --git a/selfdrive/car/gm/carcontroller.py b/selfdrive/car/gm/carcontroller.py
index 9ece11b05..b77a8e8f1 100644
--- a/selfdrive/car/gm/carcontroller.py
+++ b/selfdrive/car/gm/carcontroller.py
@@ -1,13 +1,16 @@
from cereal import car
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.realtime import DT_CTRL
from openpilot.common.params_pyx import Params
from opendbc.can.packer import CANPacker
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.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.controls.lib.drive_helpers import apply_deadzone
+from openpilot.selfdrive.controls.lib.vehicle_model import ACCELERATION_DUE_TO_GRAVITY
VisualAlert = car.CarControl.HUDControl.VisualAlert
NetworkLocation = car.CarParams.NetworkLocation
@@ -20,6 +23,10 @@ CAMERA_CANCEL_DELAY_FRAMES = 10
# Enforce a minimum interval between steering messages to avoid a fault
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):
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_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
def calc_pedal_command(accel: float, long_active: bool) -> float:
if not long_active: return 0.
@@ -60,8 +71,9 @@ class CarController(CarControllerBase):
return pedal_gas
- def update(self, CC, CS, now_nanos):
+ def update(self, CC, CS, now_nanos, frogpilot_toggles):
actuators = CC.actuators
+ accel = brake_accel = actuators.accel
hud_control = CC.hudControl
hud_alert = hud_control.visualAlert
hud_v_cruise = hud_control.setSpeed
@@ -108,6 +120,15 @@ class CarController(CarControllerBase):
# Gas/regen, brakes, and UI commands - all at 25Hz
if self.frame % 4 == 0:
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
near_stop = CC.longActive and (CS.out.vEgo < self.params.NEAR_STOP_BRAKE_PHASE)
interceptor_gas_cmd = 0
@@ -122,11 +143,17 @@ class CarController(CarControllerBase):
# Normal operation
if self.CP.carFingerprint in EV_CAR:
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)))
- self.apply_brake = int(round(interp(actuators.accel, self.params.EV_BRAKE_LOOKUP_BP, self.params.BRAKE_LOOKUP_V)))
+ if frogpilot_toggles.sport_plus:
+ 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:
- self.apply_gas = int(round(interp(actuators.accel, self.params.GAS_LOOKUP_BP, self.params.GAS_LOOKUP_V)))
- self.apply_brake = int(round(interp(actuators.accel, self.params.BRAKE_LOOKUP_BP, self.params.BRAKE_LOOKUP_V)))
+ if frogpilot_toggles.sport_plus:
+ 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
# FIXME: brakes aren't applied immediately when enabling at a stop
if stopping:
@@ -161,8 +188,13 @@ class CarController(CarControllerBase):
resume = actuators.longControlState != LongCtrlState.starting or CC.cruiseControl.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
- 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,
idx, CC.enabled, near_stop, at_full_stop, self.CP))
@@ -170,6 +202,9 @@ class CarController(CarControllerBase):
send_fcw = hud_alert == VisualAlert.fcw
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))
+ 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),
# 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))
new_actuators = actuators.as_builder()
+ new_actuators.accel = accel
new_actuators.steer = self.apply_steer_last / self.params.STEER_MAX
new_actuators.steerOutputCan = self.apply_steer_last
new_actuators.gas = self.apply_gas
diff --git a/selfdrive/car/gm/carstate.py b/selfdrive/car/gm/carstate.py
index 0ce6e5a6b..b1728bd39 100644
--- a/selfdrive/car/gm/carstate.py
+++ b/selfdrive/car/gm/carstate.py
@@ -1,5 +1,5 @@
import copy
-from cereal import car
+from cereal import car, custom
from openpilot.common.conversions import Conversions as CV
from openpilot.common.numpy_fast import mean
from opendbc.can.can_define import CANDefine
@@ -33,8 +33,9 @@ class CarState(CarStateBase):
self.single_pedal_mode = False
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()
+ fp_ret = custom.FrogPilotCarState.new_message()
self.prev_cruise_buttons = self.cruise_buttons
self.prev_distance_button = self.distance_button
@@ -91,11 +92,11 @@ class CarState(CarStateBase):
# Regen braking is braking
if self.CP.transmissionType == TransmissionType.direct:
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:
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
else:
ret.gas = pt_cp.vl["AcceleratorPedal2"]["AcceleratorPedal2"] / 254.
@@ -168,7 +169,20 @@ class CarState(CarStateBase):
ret.leftBlindspot = cam_cp.vl["BCMBlindSpotMonitor"]["LeftBSM"] == 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
def get_cam_can_parser(CP):
@@ -207,6 +221,7 @@ class CarState(CarStateBase):
("EBCMFrictionBrakeStatus", 20),
("PSCMSteeringAngle", 100),
("ECMAcceleratorPos", 80),
+ ("SportMode", 0),
]
if CP.carFingerprint in SDGM_CAR:
diff --git a/selfdrive/car/gm/fingerprints.py b/selfdrive/car/gm/fingerprints.py
index 132dc225f..d18319343 100644
--- a/selfdrive/car/gm/fingerprints.py
+++ b/selfdrive/car/gm/fingerprints.py
@@ -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
}],
+ 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]]] = {
diff --git a/selfdrive/car/gm/interface.py b/selfdrive/car/gm/interface.py
index 99a97ed9c..86ddd42d4 100644
--- a/selfdrive/car/gm/interface.py
+++ b/selfdrive/car/gm/interface.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
import os
-from cereal import car
+from cereal import car, custom
from math import fabs, exp
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.controls.lib.drive_helpers import get_friction
+from openpilot.selfdrive.frogpilot.frogpilot_variables import params
+
ButtonType = car.CarState.ButtonEvent.Type
+FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
EventName = car.CarEvent.EventName
GearShifter = car.CarState.GearShifter
TransmissionType = car.CarParams.TransmissionType
@@ -93,7 +96,9 @@ class CarInterface(CarInterfaceBase):
return self.torque_from_lateral_accel_linear
@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.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.gm)]
ret.autoResumeSng = False
@@ -107,7 +112,14 @@ class CarInterface(CarInterfaceBase):
else:
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:
ret.experimentalLongitudinalAvailable = candidate not in CC_ONLY_CAR
@@ -119,7 +131,14 @@ class CarInterface(CarInterfaceBase):
ret.minSteerSpeed = 10 * CV.KPH_TO_MS
# 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.vEgoStopping = 0.25
ret.vEgoStarting = 0.25
@@ -130,6 +149,8 @@ class CarInterface(CarInterfaceBase):
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_HW_CAM_LONG
elif candidate in SDGM_CAR:
+ if use_new_api:
+ ret.longitudinalTuning.kiV = [0., 0.] # TODO: tuning
ret.experimentalLongitudinalAvailable = False
ret.networkLocation = NetworkLocation.fwdCamera
ret.pcmCruise = True
@@ -139,7 +160,7 @@ class CarInterface(CarInterfaceBase):
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_HW_SDGM
else: # ASCM, OBD-II harness
- ret.openpilotLongitudinalControl = True
+ ret.openpilotLongitudinalControl = not disable_openpilot_long
ret.networkLocation = NetworkLocation.gateway
ret.radarUnavailable = RADAR_HEADER_MSG not in fingerprint[CanBus.OBSTACLE] and not docs
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
# 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:
# 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:
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:
ret.networkLocation = NetworkLocation.fwdCamera
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_HW_CAM
ret.minEnableSpeed = -1
ret.pcmCruise = False
- ret.openpilotLongitudinalControl = True
+ ret.openpilotLongitudinalControl = not disable_openpilot_long
ret.stoppingControl = True
ret.autoResumeSng = True
@@ -261,8 +293,14 @@ class CarInterface(CarInterfaceBase):
ret.flags |= GMFlags.PEDAL_LONG.value
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_PEDAL_LONG
# Note: Low speed, stop and go not tested. Should be fairly smooth on highway
- ret.longitudinalTuning.kiBP = [0.0, 5., 35.]
- ret.longitudinalTuning.kiV = [0.0, 0.35, 0.5]
+ if use_new_api:
+ 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.stoppingDecelRate = 0.8
else: # Pedal used for SNG, ACC for longitudinal control otherwise
@@ -277,17 +315,24 @@ class CarInterface(CarInterfaceBase):
ret.radarUnavailable = True
ret.experimentalLongitudinalAvailable = False
ret.minEnableSpeed = 24 * CV.MPH_TO_MS
- ret.openpilotLongitudinalControl = True
+ ret.openpilotLongitudinalControl = not disable_openpilot_long
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.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:
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_NO_ACC
@@ -302,8 +347,8 @@ class CarInterface(CarInterfaceBase):
return ret
# returns a car.CarState
- def _update(self, c):
- ret = self.CS.update(self.cp, self.cp_cam, self.cp_loopback)
+ def _update(self, c, frogpilot_toggles):
+ 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
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,
unpressed_btn=CruiseButtons.UNPRESS),
*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
@@ -328,10 +375,21 @@ class CarInterface(CarInterfaceBase):
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)):
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)
- 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)
+ 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:
events.add(EventName.speedTooLow)
@@ -344,4 +402,4 @@ class CarInterface(CarInterfaceBase):
ret.events = events.to_msg()
- return ret
+ return ret, fp_ret
diff --git a/selfdrive/car/gm/values.py b/selfdrive/car/gm/values.py
index d4288671b..6780776cf 100644
--- a/selfdrive/car/gm/values.py
+++ b/selfdrive/car/gm/values.py
@@ -33,39 +33,45 @@ class CarControllerParams:
# Our controller should still keep the 2 second average above
# -3.5 m/s^2 as per planner limits
ACCEL_MAX = 2. # m/s^2
+ ACCEL_MAX_PLUS = 4. # m/s^2
ACCEL_MIN = -4. # m/s^2
def __init__(self, CP):
# Gas/brake lookups
- self.ZERO_GAS = 2048 # Coasting
+ self.ZERO_GAS = 6144 # Coasting
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:
- self.MAX_GAS = 3400
- self.MAX_ACC_REGEN = 1514
- self.INACTIVE_REGEN = 1554
+ self.MAX_GAS = 7496
+ self.MAX_GAS_PLUS = 8848
+ self.MAX_ACC_REGEN = 5610
+ self.INACTIVE_REGEN = 5650
# Camera ACC vehicles have no regen while enabled.
# 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:
- self.MAX_GAS = 3400
- self.MAX_ACC_REGEN = 1514
- self.INACTIVE_REGEN = 1554
- max_regen_acceleration = 0.
+ self.MAX_GAS = 7496
+ self.MAX_GAS_PLUS = 7496
+ self.MAX_ACC_REGEN = 5610
+ self.INACTIVE_REGEN = 5650
+ self.max_regen_acceleration = 0.
else:
- self.MAX_GAS = 3072 # Safety limit, not ACC max. Stock ACC >4096 from standstill.
- self.MAX_ACC_REGEN = 1404 # Max ACC regen is slightly less than max paddle regen
- self.INACTIVE_REGEN = 1404
+ self.MAX_GAS = 7168 # Safety limit, not ACC max. Stock ACC >8192 from standstill.
+ self.MAX_GAS_PLUS = 8191 # 8292 uses new bit, possible but not tested. Matches Twilsonco tw-main max
+ 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,
# 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_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.]
# 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):
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_PLUS = [gas_brake_threshold, max(0., gas_brake_threshold), self.ACCEL_MAX_PLUS]
self.EV_BRAKE_LOOKUP_BP = [self.ACCEL_MIN, gas_brake_threshold]
-
@dataclass
class GMCarDocs(CarDocs):
package: str = "Adaptive Cruise Control (ACC)"
@@ -225,6 +232,14 @@ class CAR(Platforms):
[GMCarDocs("Buick Baby Enclave 2020-23", "Driver Assist Package")],
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:
@@ -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}
-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'))
# We're integrated at the Safety Data Gateway Module on these cars
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)
-CAMERA_ACC_CAR = {CAR.CHEVROLET_BOLT_EUV, CAR.CHEVROLET_SILVERADO, CAR.CHEVROLET_EQUINOX, CAR.CHEVROLET_TRAILBLAZER}
-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 = {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, CAR.CHEVROLET_MALIBU_CC})
# CAMERA_ACC_CAR.update(CC_ONLY_CAR)
STEER_THRESHOLD = 1.0
diff --git a/selfdrive/car/honda/carcontroller.py b/selfdrive/car/honda/carcontroller.py
index fe023ea17..9dd120ec7 100644
--- a/selfdrive/car/honda/carcontroller.py
+++ b/selfdrive/car/honda/carcontroller.py
@@ -4,11 +4,14 @@ from cereal import car
from openpilot.common.numpy_fast import clip, interp
from openpilot.common.realtime import DT_CTRL
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.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.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
LongCtrlState = car.CarControl.Actuators.LongControlState
@@ -125,7 +128,7 @@ class CarController(CarControllerBase):
self.brake = 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
hud_control = CC.hudControl
conversion = hondacan.get_cruise_speed_conversion(self.CP.carFingerprint, CS.is_metric)
@@ -182,7 +185,7 @@ class CarController(CarControllerBase):
0.5]
# The Honda ODYSSEY seems to have different PCM_ACCEL
# msgs, is it other cars too?
- if not CC.longActive:
+ if self.CP.enableGasInterceptor or not CC.longActive:
pcm_speed = 0.0
pcm_accel = int(0.0)
elif self.CP.carFingerprint in HONDA_NIDEC_ALT_PCM_ACCEL:
@@ -215,7 +218,10 @@ class CarController(CarControllerBase):
ts = self.frame * DT_CTRL
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)
stopping = actuators.longControlState == LongCtrlState.stopping
@@ -234,15 +240,29 @@ class CarController(CarControllerBase):
self.apply_brake_last = apply_brake
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.
if self.frame % 10 == 0:
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)
- 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:
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.speed = self.speed
diff --git a/selfdrive/car/honda/carstate.py b/selfdrive/car/honda/carstate.py
index c98d1a72d..253a0ae93 100644
--- a/selfdrive/car/honda/carstate.py
+++ b/selfdrive/car/honda/carstate.py
@@ -1,6 +1,6 @@
from collections import defaultdict
-from cereal import car
+from cereal import car, custom
from openpilot.common.conversions import Conversions as CV
from openpilot.common.numpy_fast import interp
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:
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))
if CP.carFingerprint in HONDA_BOSCH:
@@ -72,8 +72,14 @@ def get_can_messages(CP, gearbox_msg):
else:
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:
messages.append(("CRUISE_FAULT_STATUS", 50))
+ elif CP.carFingerprint == CAR.HONDA_CLARITY:
+ messages.append(("BRAKE_ERROR", 100)),
elif CP.openpilotLongitudinalControl:
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)
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()
+ fp_ret = custom.FrogPilotCarState.new_message()
# car params
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:
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:
# 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
@@ -181,14 +190,19 @@ class CarState(CarStateBase):
ret.brakeHoldActive = cp.vl["VSA_STATUS"]["BRAKE_HOLD_ACTIVE"] == 1
# 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
gear = int(cp.vl[self.gearbox_msg]["GEAR_SHIFTER"])
ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(gear, None))
- ret.gas = cp.vl["POWERTRAIN_DATA"]["PEDAL_GAS"]
- ret.gasPressed = ret.gas > 1e-5
+ if self.CP.enableGasInterceptor:
+ # 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.steeringTorqueEps = cp.vl["STEER_MOTOR_TORQUE"]["MOTOR_TORQUE"]
@@ -241,7 +255,8 @@ class CarState(CarStateBase):
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)
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.lkas_hud = False
@@ -258,7 +273,20 @@ class CarState(CarStateBase):
ret.leftBlindspot = cp_body.vl["BSM_STATUS_LEFT"]["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):
messages = get_can_messages(CP, self.gearbox_msg)
diff --git a/selfdrive/car/honda/fingerprints.py b/selfdrive/car/honda/fingerprints.py
index 8a5b79b41..3074bc89c 100644
--- a/selfdrive/car/honda/fingerprints.py
+++ b/selfdrive/car/honda/fingerprints.py
@@ -222,6 +222,16 @@ FW_VERSIONS = {
b'39990-TGH-J530\x00\x00',
b'39990-TGL-E130\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): [
b'77959-TBA-A060\x00\x00',
@@ -892,4 +902,29 @@ FW_VERSIONS = {
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',
+ ],
+ },
}
diff --git a/selfdrive/car/honda/hondacan.py b/selfdrive/car/honda/hondacan.py
index 1be496d95..2b595e0e4 100644
--- a/selfdrive/car/honda/hondacan.py
+++ b/selfdrive/car/honda/hondacan.py
@@ -53,8 +53,6 @@ def create_brake_command(packer, CAN, apply_brake, pump_on, pcm_override, pcm_ca
pcm_fault_cmd = False
values = {
- "COMPUTER_BRAKE": apply_brake,
- "BRAKE_PUMP_REQUEST": pump_on,
"CRUISE_OVERRIDE": pcm_override,
"CRUISE_FAULT_CMD": pcm_fault_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_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)
@@ -134,7 +140,7 @@ def create_bosch_supplemental_1(packer, CAN, car_fingerprint):
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 = []
radar_disabled = CP.carFingerprint in (HONDA_BOSCH - HONDA_BOSCH_RADARLESS) and CP.openpilotLongitudinalControl
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 = {
'SET_ME_X41': 0x41,
'STEERING_REQUIRED': hud.steer_required,
- 'SOLID_LANES': hud.lanes_visible,
+ 'SOLID_LANES': lat_active,
'BEEP': 0,
}
diff --git a/selfdrive/car/honda/interface.py b/selfdrive/car/honda/interface.py
index fdcba8bb8..253e44dc2 100755
--- a/selfdrive/car/honda/interface.py
+++ b/selfdrive/car/honda/interface.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-from cereal import car
+from cereal import car, custom
from panda import Panda
from openpilot.common.conversions import Conversions as CV
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
+FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
EventName = car.CarEvent.EventName
TransmissionType = car.CarParams.TransmissionType
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):
if CP.carFingerprint in HONDA_BOSCH:
return CarControllerParams.BOSCH_ACCEL_MIN, CarControllerParams.BOSCH_ACCEL_MAX
+ elif CP.enableGasInterceptor:
+ return CarControllerParams.NIDEC_ACCEL_MIN, CarControllerParams.NIDEC_ACCEL_MAX
else:
# NIDECs don't allow acceleration near cruise_speed,
# 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)
@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"
CAN = CanBus(ret, fingerprint)
@@ -48,9 +51,10 @@ class CarInterface(CarInterfaceBase):
ret.pcmCruise = not ret.openpilotLongitudinalControl
else:
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:
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]]
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
- ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.8], [0.24]]
+ if eps_modified:
+ 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:
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.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:
raise ValueError(f"unsupported car {candidate}")
@@ -202,13 +225,16 @@ class CarInterface(CarInterfaceBase):
if ret.openpilotLongitudinalControl and candidate in HONDA_BOSCH:
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:
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_HONDA_RADARLESS
# 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
# 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.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')
# returns a car.CarState
- def _update(self, c):
- ret = self.CS.update(self.cp, self.cp_cam, self.cp_body)
+ def _update(self, c, frogpilot_toggles):
+ ret, fp_ret = self.CS.update(self.cp, self.cp_cam, self.cp_body, frogpilot_toggles)
ret.buttonEvents = [
*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.lkas_enabled, self.CS.lkas_previously_enabled, {1: FrogPilotButtonType.lkas}),
]
# events
@@ -246,10 +273,10 @@ class CarInterface(CarInterfaceBase):
# non loud alert if cruise disables below 25mph as expected (+ a little margin)
events.add(EventName.speedTooLow)
else:
- events.add(EventName.cruiseDisabled)
+ events.add(EventName.buttonCancel)
if self.CS.CP.minEnableSpeed > 0 and ret.vEgo < 0.001:
events.add(EventName.manualRestart)
ret.events = events.to_msg()
- return ret
+ return ret, fp_ret
diff --git a/selfdrive/car/honda/values.py b/selfdrive/car/honda/values.py
index c3005c667..7c2e3d8b3 100644
--- a/selfdrive/car/honda/values.py
+++ b/selfdrive/car/honda/values.py
@@ -191,6 +191,11 @@ class CAR(Platforms):
dbc_dict('acura_ilx_2016_can_generated', 'acura_ilx_2016_nidec'),
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(
[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
diff --git a/selfdrive/car/hyundai/carcontroller.py b/selfdrive/car/hyundai/carcontroller.py
index 4038ddcca..ff037c116 100644
--- a/selfdrive/car/hyundai/carcontroller.py
+++ b/selfdrive/car/hyundai/carcontroller.py
@@ -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.interfaces import CarControllerBase
+from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_acceleration import get_max_allowed_accel
+
VisualAlert = car.CarControl.HUDControl.VisualAlert
LongCtrlState = car.CarControl.Actuators.LongControlState
@@ -57,7 +59,7 @@ class CarController(CarControllerBase):
self.car_fingerprint = CP.carFingerprint
self.last_button_frame = 0
- def update(self, CC, CS, now_nanos):
+ def update(self, CC, CS, now_nanos, frogpilot_toggles):
actuators = CC.actuators
hud_control = CC.hudControl
@@ -79,7 +81,10 @@ class CarController(CarControllerBase):
self.apply_steer_last = apply_steer
# 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
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
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
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
can_sends.extend(hyundaican.create_acc_commands(self.packer, CC.enabled, accel, jerk, int(self.frame / 2),
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
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
if self.frame % 20 == 0 and self.CP.openpilotLongitudinalControl:
diff --git a/selfdrive/car/hyundai/carstate.py b/selfdrive/car/hyundai/carstate.py
index 92c489cf3..842074c83 100644
--- a/selfdrive/car/hyundai/carstate.py
+++ b/selfdrive/car/hyundai/carstate.py
@@ -2,7 +2,7 @@ from collections import deque
import copy
import math
-from cereal import car
+from cereal import car, custom
from openpilot.common.conversions import Conversions as CV
from opendbc.can.parser import CANParser
from opendbc.can.can_define import CANDefine
@@ -52,11 +52,28 @@ class CarState(CarStateBase):
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:
- 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()
+ fp_ret = custom.FrogPilotCarState.new_message()
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
speed_conv = CV.KPH_TO_MS if self.is_metric else CV.MPH_TO_MS
@@ -102,7 +119,7 @@ class CarState(CarStateBase):
# cruise state
if self.CP.openpilotLongitudinalControl:
# 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.standstill = 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.prev_cruise_buttons = self.cruise_buttons[-1]
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"])
+ 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()
+ fp_ret = custom.FrogPilotCarState.new_message()
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
@@ -218,7 +252,7 @@ class CarState(CarStateBase):
# cruise state
# 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:
# 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
@@ -239,7 +273,10 @@ class CarState(CarStateBase):
self.prev_cruise_buttons = self.cruise_buttons[-1]
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"])
+ 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"]
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
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):
if CP.carFingerprint in CANFD_CAR:
@@ -297,6 +355,13 @@ class CarState(CarStateBase):
else:
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)
@staticmethod
@@ -317,6 +382,9 @@ class CarState(CarStateBase):
if CP.flags & HyundaiFlags.USE_FCA.value:
messages.append(("FCA11", 50))
+ if CP.flags & HyundaiFlags.LKAS12:
+ messages.append(("LKAS12", 10))
+
return CANParser(DBC[CP.carFingerprint]["pt"], messages, 2)
def get_can_parser_canfd(self, CP):
@@ -330,6 +398,7 @@ class CarState(CarStateBase):
("CRUISE_BUTTONS_ALT", 50),
("BLINKERS", 4),
("DOORS_SEATBELTS", 4),
+ ("DRIVE_MODE", 0),
]
if CP.flags & HyundaiFlags.EV:
@@ -352,6 +421,9 @@ class CarState(CarStateBase):
("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)
@staticmethod
@@ -365,4 +437,7 @@ class CarState(CarStateBase):
("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)
diff --git a/selfdrive/car/hyundai/hyundaican.py b/selfdrive/car/hyundai/hyundaican.py
index b4b951f89..81ff568a6 100644
--- a/selfdrive/car/hyundai/hyundaican.py
+++ b/selfdrive/car/hyundai/hyundaican.py
@@ -117,20 +117,20 @@ def create_clu11(packer, frame, clu11, button, CP):
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 = {
- "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_Icon_State": 2 if hda_set_speed else 0,
"HDA_VSetReq": hda_set_speed,
}
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 = []
scc11_values = {
- "MainMode_ACC": 1,
+ "MainMode_ACC": 1 if cruise_available else 0,
"TauGapSet": hud_control.leadDistanceBars,
"VSetDis": set_speed if enabled else 0,
"AliveCounterACC": idx % 0x10,
diff --git a/selfdrive/car/hyundai/hyundaicanfd.py b/selfdrive/car/hyundai/hyundaicanfd.py
index 54804f94f..c26c42c02 100644
--- a/selfdrive/car/hyundai/hyundaicanfd.py
+++ b/selfdrive/car/hyundai/hyundaicanfd.py
@@ -41,7 +41,7 @@ def create_steering_messages(packer, CP, CAN, enabled, lat_active, apply_steer):
values = {
"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,
"LKA_ASSIST": 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)
-def create_lfahda_cluster(packer, CAN, enabled):
+def create_lfahda_cluster(packer, CAN, enabled, lat_active):
values = {
"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)
diff --git a/selfdrive/car/hyundai/interface.py b/selfdrive/car/hyundai/interface.py
index ecedf3fd7..dc875f534 100644
--- a/selfdrive/car/hyundai/interface.py
+++ b/selfdrive/car/hyundai/interface.py
@@ -1,4 +1,4 @@
-from cereal import car
+from cereal import car, custom
from panda import Panda
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, \
@@ -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.disable_ecu import disable_ecu
+from openpilot.selfdrive.frogpilot.frogpilot_variables import params
+
Ecu = car.CarParams.Ecu
ButtonType = car.CarState.ButtonEvent.Type
+FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
EventName = car.CarEvent.EventName
+GearShifter = car.CarState.GearShifter
ENABLE_BUTTONS = (Buttons.RES_ACCEL, Buttons.SET_DECEL, Buttons.CANCEL)
BUTTONS_DICT = {Buttons.RES_ACCEL: ButtonType.accelCruise, Buttons.SET_DECEL: ButtonType.decelCruise,
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):
@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.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]:
ret.flags |= HyundaiFlags.USE_FCA.value
+ if 0x53E in fingerprint[2]:
+ ret.flags |= HyundaiFlags.LKAS12.value
+
ret.steerActuatorDelay = 0.1 # Default delay
ret.steerLimitTimer = 0.4
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
@@ -80,8 +89,18 @@ class CarInterface(CarInterfaceBase):
# *** longitudinal control ***
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)
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.openpilotLongitudinalControl = experimental_long and ret.experimentalLongitudinalAvailable
ret.pcmCruise = not ret.openpilotLongitudinalControl
@@ -95,9 +114,15 @@ class CarInterface(CarInterfaceBase):
# *** feature detection ***
if candidate in CANFD_CAR:
ret.enableBsm = 0x1e5 in fingerprint[CAN.ECAN]
+
+ if 0x1fa in fingerprint[CAN.ECAN]:
+ ret.flags |= HyundaiFlags.NAV_MSG.value
else:
ret.enableBsm = 0x58b in fingerprint[0]
+ if 0x544 in fingerprint[0]:
+ ret.flags |= HyundaiFlags.NAV_MSG.value
+
# *** panda safety config ***
if candidate in CANFD_CAR:
cfgs = [get_safety_config(car.CarParams.SafetyModel.hyundaiCanfd), ]
@@ -123,6 +148,10 @@ class CarInterface(CarInterfaceBase):
if candidate in CAMERA_SCC_CAR:
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:
ret.safetyConfigs[-1].safetyParam |= Panda.FLAG_HYUNDAI_LONG
if ret.flags & HyundaiFlags.HYBRID:
@@ -136,6 +165,10 @@ class CarInterface(CarInterfaceBase):
ret.centerToFront = ret.wheelbase * 0.4
+ # Detect smartMDPS
+ if 0x2AA in fingerprint[0]:
+ ret.minSteerSpeed = 0.
+
return ret
@staticmethod
@@ -150,17 +183,23 @@ class CarInterface(CarInterfaceBase):
if CP.flags & HyundaiFlags.ENABLE_BLINKERS:
disable_ecu(logcan, sendcan, bus=CanBus(CP).ECAN, addr=0x7B1, com_cont_req=b'\x28\x83\x01')
- def _update(self, c):
- ret = self.CS.update(self.cp, self.cp_cam)
+ def _update(self, c, frogpilot_toggles):
+ ret, fp_ret = self.CS.update(self.cp, self.cp_cam, frogpilot_toggles)
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
# To avoid re-engaging when openpilot cancels, check user engagement intention via buttons
# 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)
- 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)
if ret.vEgo < (self.CP.minSteerSpeed + 2.) and self.CP.minSteerSpeed > 10.:
@@ -172,4 +211,4 @@ class CarInterface(CarInterfaceBase):
ret.events = events.to_msg()
- return ret
+ return ret, fp_ret
diff --git a/selfdrive/car/hyundai/values.py b/selfdrive/car/hyundai/values.py
index 8cb29c803..df4079449 100644
--- a/selfdrive/car/hyundai/values.py
+++ b/selfdrive/car/hyundai/values.py
@@ -95,6 +95,10 @@ class HyundaiFlags(IntFlag):
MIN_STEER_32_MPH = 2 ** 23
+ # FrogPilot HKG flags
+ CAN_LFA_BTN = 2 ** 24
+ LKAS12 = 2 ** 25
+ NAV_MSG = 2 ** 26
class Footnote(Enum):
CANFD = CarFootnote(
diff --git a/selfdrive/car/interfaces.py b/selfdrive/car/interfaces.py
index e5762ed52..4871ff5a4 100644
--- a/selfdrive/car/interfaces.py
+++ b/selfdrive/car/interfaces.py
@@ -3,12 +3,13 @@ import os
import numpy as np
import tomllib
from abc import abstractmethod, ABC
+from difflib import SequenceMatcher
from enum import StrEnum
from typing import Any, NamedTuple
from collections.abc import Callable
from functools import cache
-from cereal import car
+from cereal import car, custom
from openpilot.common.basedir import BASEDIR
from openpilot.common.conversions import Conversions as CV
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.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.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.vehicle_model import VehicleModel
+from openpilot.selfdrive.frogpilot.frogpilot_variables import get_frogpilot_toggles, params, params_memory
+
ButtonType = car.CarState.ButtonEvent.Type
+FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
GearShifter = car.CarState.GearShifter
EventName = car.CarEvent.EventName
@@ -29,10 +33,15 @@ ACCEL_MAX = 2.0
ACCEL_MIN = -3.5
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_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')
+# 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] = {
'P': GearShifter.park, 'PARK': GearShifter.park,
'R': GearShifter.reverse, 'REVERSE': GearShifter.reverse,
@@ -45,6 +54,8 @@ GEAR_SHIFTER_MAP: dict[str, car.CarState.GearShifter] = {
'B': GearShifter.brake, 'BRAKE': GearShifter.brake,
}
+def similarity(s1: str, s2: str) -> float:
+ return SequenceMatcher(None, s1, s2).ratio()
class LatControlInputs(NamedTuple):
lateral_acceleration: float
@@ -85,6 +96,108 @@ def get_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
class CarInterfaceBase(ABC):
@@ -110,8 +223,44 @@ class CarInterfaceBase(ABC):
dbc_name = "" if self.cp is None else self.cp.dbc_name
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]]]:
- return self.CC.update(c, self.CS, now_nanos)
+ # FrogPilot variables
+ 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
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.
"""
- return cls.get_params(candidate, gen_empty_fingerprint(), list(), False, False)
+ return cls.get_params(candidate, gen_empty_fingerprint(), list(), False, False, False)
@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)
platform = PLATFORMS[candidate]
@@ -138,7 +287,15 @@ class CarInterfaceBase(ABC):
ret.tireStiffnessFactor = platform.config.specs.tireStiffnessFactor
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
if not ret.notCar:
@@ -230,14 +387,14 @@ class CarInterfaceBase(ABC):
def _update(self, c: car.CarControl) -> car.CarState:
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
for cp in self.can_parsers:
if cp is not None:
cp.update_strings(can_strings)
# 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.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:
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
if self.CS is not None:
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,
@@ -310,6 +474,10 @@ class CarInterfaceBase(ABC):
if b.type == ButtonType.cancel:
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
self.steering_unpressed = 0 if cs_out.steeringPressed else self.steering_unpressed + 1
if cs_out.steerFaultTemporary:
@@ -340,6 +508,30 @@ class CarInterfaceBase(ABC):
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):
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)
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):
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]])
diff --git a/selfdrive/car/mazda/carcontroller.py b/selfdrive/car/mazda/carcontroller.py
index 3d4163487..b38ea72e4 100644
--- a/selfdrive/car/mazda/carcontroller.py
+++ b/selfdrive/car/mazda/carcontroller.py
@@ -16,7 +16,7 @@ class CarController(CarControllerBase):
self.brake_counter = 0
self.frame = 0
- def update(self, CC, CS, now_nanos):
+ def update(self, CC, CS, now_nanos, frogpilot_toggles):
can_sends = []
apply_steer = 0
diff --git a/selfdrive/car/mazda/carstate.py b/selfdrive/car/mazda/carstate.py
index 83b238fb6..b7a64659a 100644
--- a/selfdrive/car/mazda/carstate.py
+++ b/selfdrive/car/mazda/carstate.py
@@ -1,4 +1,4 @@
-from cereal import car
+from cereal import car, custom
from openpilot.common.conversions import Conversions as CV
from opendbc.can.can_define import CANDefine
from opendbc.can.parser import CANParser
@@ -21,9 +21,10 @@ class CarState(CarStateBase):
self.prev_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()
+ fp_ret = custom.FrogPilotCarState.new_message()
self.prev_distance_button = self.distance_button
self.distance_button = cp.vl["CRZ_BTNS"]["DISTANCE_LESS"]
@@ -110,7 +111,11 @@ class CarState(CarStateBase):
self.cam_laneinfo = cp_cam.vl["CAM_LANEINFO"]
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
def get_can_parser(CP):
diff --git a/selfdrive/car/mazda/interface.py b/selfdrive/car/mazda/interface.py
index 6992d49ff..9f46274b7 100755
--- a/selfdrive/car/mazda/interface.py
+++ b/selfdrive/car/mazda/interface.py
@@ -1,23 +1,22 @@
#!/usr/bin/env python3
-from cereal import car
+from cereal import car, custom
from openpilot.common.conversions import Conversions as CV
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.interfaces import CarInterfaceBase
ButtonType = car.CarState.ButtonEvent.Type
+FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
EventName = car.CarEvent.EventName
class CarInterface(CarInterfaceBase):
@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.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.mazda)]
ret.radarUnavailable = True
- ret.dashcamOnly = candidate not in (CAR.MAZDA_CX5_2022, CAR.MAZDA_CX9_2021)
-
ret.steerActuatorDelay = 0.1
ret.steerLimitTimer = 0.8
@@ -31,11 +30,14 @@ class CarInterface(CarInterfaceBase):
return ret
# returns a car.CarState
- def _update(self, c):
- ret = self.CS.update(self.cp, self.cp_cam)
+ def _update(self, c, frogpilot_toggles):
+ ret, fp_ret = self.CS.update(self.cp, self.cp_cam, frogpilot_toggles)
# 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 = self.create_common_events(ret)
@@ -47,4 +49,4 @@ class CarInterface(CarInterfaceBase):
ret.events = events.to_msg()
- return ret
+ return ret, fp_ret
diff --git a/selfdrive/car/mock/interface.py b/selfdrive/car/mock/interface.py
index 7506bab05..414bcd455 100755
--- a/selfdrive/car/mock/interface.py
+++ b/selfdrive/car/mock/interface.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
-from cereal import car
+from cereal import car, custom
import cereal.messaging as messaging
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
@@ -12,7 +12,7 @@ class CarInterface(CarInterfaceBase):
self.sm = messaging.SubMaster(['gpsLocation', 'gpsLocationExternal'])
@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.mass = 1700.
ret.wheelbase = 2.70
@@ -21,12 +21,13 @@ class CarInterface(CarInterfaceBase):
ret.dashcamOnly = True
return ret
- def _update(self, c):
+ def _update(self, c, frogpilot_toggles):
self.sm.update(0)
gps_sock = 'gpsLocationExternal' if self.sm.recv_frame['gpsLocationExternal'] > 1 else 'gpsLocation'
ret = car.CarState.new_message()
+ fp_ret = custom.FrogPilotCarState.new_message()
ret.vEgo = self.sm[gps_sock].speed
ret.vEgoRaw = self.sm[gps_sock].speed
- return ret
+ return ret, fp_ret
diff --git a/selfdrive/car/nissan/carcontroller.py b/selfdrive/car/nissan/carcontroller.py
index c7bd23139..187010961 100644
--- a/selfdrive/car/nissan/carcontroller.py
+++ b/selfdrive/car/nissan/carcontroller.py
@@ -19,7 +19,7 @@ class CarController(CarControllerBase):
self.packer = CANPacker(dbc_name)
- def update(self, CC, CS, now_nanos):
+ def update(self, CC, CS, now_nanos, frogpilot_toggles):
actuators = CC.actuators
hud_control = CC.hudControl
pcm_cancel_cmd = CC.cruiseControl.cancel
@@ -68,7 +68,7 @@ class CarController(CarControllerBase):
if self.CP.carFingerprint != CAR.NISSAN_ALTIMA:
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,
- hud_control.leftLaneDepart, hud_control.rightLaneDepart))
+ hud_control.leftLaneDepart, hud_control.rightLaneDepart, CC.latActive))
if self.frame % 50 == 0:
can_sends.append(nissancan.create_lkas_hud_info_msg(
diff --git a/selfdrive/car/nissan/carstate.py b/selfdrive/car/nissan/carstate.py
index 57146b49c..3a67c59e4 100644
--- a/selfdrive/car/nissan/carstate.py
+++ b/selfdrive/car/nissan/carstate.py
@@ -1,6 +1,6 @@
import copy
from collections import deque
-from cereal import car
+from cereal import car, custom
from opendbc.can.can_define import CANDefine
from openpilot.selfdrive.car.interfaces import CarStateBase
from openpilot.common.conversions import Conversions as CV
@@ -23,8 +23,9 @@ class CarState(CarStateBase):
self.prev_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()
+ fp_ret = custom.FrogPilotCarState.new_message()
self.prev_distance_button = self.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"])
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:
self.lkas_enabled = bool(cp.vl["LKAS_SETTINGS"]["LKAS_ENABLED"])
else:
@@ -121,7 +123,7 @@ class CarState(CarStateBase):
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"])
- return ret
+ return ret, fp_ret
@staticmethod
def get_can_parser(CP):
diff --git a/selfdrive/car/nissan/interface.py b/selfdrive/car/nissan/interface.py
index 2e9a99061..e1addf0e2 100644
--- a/selfdrive/car/nissan/interface.py
+++ b/selfdrive/car/nissan/interface.py
@@ -1,16 +1,17 @@
-from cereal import car
+from cereal import car, custom
from panda import Panda
from openpilot.selfdrive.car import create_button_events, get_safety_config
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
from openpilot.selfdrive.car.nissan.values import CAR
ButtonType = car.CarState.ButtonEvent.Type
+FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
class CarInterface(CarInterfaceBase):
@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.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.nissan)]
ret.autoResumeSng = False
@@ -29,10 +30,13 @@ class CarInterface(CarInterfaceBase):
return ret
# returns a car.CarState
- def _update(self, c):
- ret = self.CS.update(self.cp, self.cp_adas, self.cp_cam)
+ def _update(self, c, frogpilot_toggles):
+ 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])
@@ -41,4 +45,4 @@ class CarInterface(CarInterfaceBase):
ret.events = events.to_msg()
- return ret
+ return ret, fp_ret
diff --git a/selfdrive/car/nissan/nissancan.py b/selfdrive/car/nissan/nissancan.py
index b9a1b4f84..676ed89bf 100644
--- a/selfdrive/car/nissan/nissancan.py
+++ b/selfdrive/car/nissan/nissancan.py
@@ -65,7 +65,7 @@ def create_cancel_msg(packer, cancel_msg, cruise_cancel):
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 [
"LARGE_WARNING_FLASHING",
"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["LEFT_LANE_YELLOW_FLASH"] = 1 if left_lane_depart else 0
- values["LARGE_STEERING_WHEEL_ICON"] = 2 if enabled else 0
- values["RIGHT_LANE_GREEN"] = 1 if right_line and enabled else 0
- values["LEFT_LANE_GREEN"] = 1 if left_line and enabled else 0
+ values["LARGE_STEERING_WHEEL_ICON"] = 2 if lat_active else 0
+ values["RIGHT_LANE_GREEN"] = 1 if right_line and lat_active else 0
+ values["LEFT_LANE_GREEN"] = 1 if left_line and lat_active else 0
return packer.make_can_msg("PROPILOT_HUD", 0, values)
diff --git a/selfdrive/car/nissan/values.py b/selfdrive/car/nissan/values.py
index eecffb21b..a19b93fc9 100644
--- a/selfdrive/car/nissan/values.py
+++ b/selfdrive/car/nissan/values.py
@@ -48,7 +48,11 @@ class CAR(Platforms):
)
# Leaf with ADAS ECU found behind instrument cluster instead of glovebox
# 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(
[NissanCarDocs("Nissan Rogue 2018-20")],
NissanCarSpecs(mass=1610, wheelbase=2.705)
diff --git a/selfdrive/car/secoc.py b/selfdrive/car/secoc.py
new file mode 100644
index 000000000..971ea36a1
--- /dev/null
+++ b/selfdrive/car/secoc.py
@@ -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]
diff --git a/selfdrive/car/subaru/carcontroller.py b/selfdrive/car/subaru/carcontroller.py
index d89ae8c63..b6239366c 100644
--- a/selfdrive/car/subaru/carcontroller.py
+++ b/selfdrive/car/subaru/carcontroller.py
@@ -23,7 +23,7 @@ class CarController(CarControllerBase):
self.p = CarControllerParams(CP)
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
hud_control = CC.hudControl
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,
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:
can_sends.append(subarucan.create_es_infotainment(self.packer, self.frame // 10, CS.es_infotainment_msg, hud_control.visualAlert))
diff --git a/selfdrive/car/subaru/carstate.py b/selfdrive/car/subaru/carstate.py
index 821ff2c15..b6fe64bbb 100644
--- a/selfdrive/car/subaru/carstate.py
+++ b/selfdrive/car/subaru/carstate.py
@@ -1,10 +1,10 @@
import copy
-from cereal import car
+from cereal import car, custom
from opendbc.can.can_define import CANDefine
from openpilot.common.conversions import Conversions as CV
from openpilot.selfdrive.car.interfaces import CarStateBase
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
@@ -16,8 +16,9 @@ class CarState(CarStateBase):
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()
+ fp_ret = custom.FrogPilotCarState.new_message()
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.
@@ -125,7 +126,15 @@ class CarState(CarStateBase):
if self.CP.flags & SubaruFlags.SEND_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
def get_common_global_body_messages(CP):
@@ -196,6 +205,7 @@ class CarState(CarStateBase):
messages = [
("ES_DashStatus", 20),
("ES_Distance", 20),
+ ("ES_Brake", 20),
]
else:
messages = [
@@ -226,4 +236,3 @@ class CarState(CarStateBase):
]
return CANParser(DBC[CP.carFingerprint]["pt"], messages, CanBus.alt)
-
diff --git a/selfdrive/car/subaru/interface.py b/selfdrive/car/subaru/interface.py
index cb0093437..654668281 100644
--- a/selfdrive/car/subaru/interface.py
+++ b/selfdrive/car/subaru/interface.py
@@ -1,22 +1,25 @@
-from cereal import car
+from cereal import car, custom
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.interfaces import CarInterfaceBase
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):
@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.radarUnavailable = True
# for HYBRID CARS to be upstreamed, we need:
# - replacement for ES_Distance so we can cancel the cruise control
# - to find the Cruise_Activated bit from the car
# - 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
# Detect infotainment message sent from the camera
@@ -50,9 +53,9 @@ class CarInterface(CarInterfaceBase):
elif candidate == CAR.SUBARU_IMPREZA:
ret.steerActuatorDelay = 0.4 # end-to-end angle controller
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.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:
ret.lateralTuning.init('pid')
@@ -97,13 +100,17 @@ class CarInterface(CarInterfaceBase):
return ret
# 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()
- return ret
+ return ret, fp_ret
@staticmethod
def init(CP, logcan, sendcan):
diff --git a/selfdrive/car/subaru/subarucan.py b/selfdrive/car/subaru/subarucan.py
index 86d39ff88..4036d7c61 100644
--- a/selfdrive/car/subaru/subarucan.py
+++ b/selfdrive/car/subaru/subarucan.py
@@ -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)
-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 [
"CHECKSUM",
"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:
values["LKAS_Alert"] = 11 # Right lane departure dash alert
- if enabled:
+ if lat_active:
values["LKAS_ACTIVE"] = 1 # Show LKAS lane lines
values["LKAS_Dash_State"] = 2 # Green enabled indicator
+ values["LKAS_Left_Line_Enable"] = 1
+ values["LKAS_Right_Line_Enable"] = 1
else:
values["LKAS_Dash_State"] = 0 # LKAS Not enabled
diff --git a/selfdrive/car/subaru/values.py b/selfdrive/car/subaru/values.py
index dcbea1979..ae09350fd 100644
--- a/selfdrive/car/subaru/values.py
+++ b/selfdrive/car/subaru/values.py
@@ -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.fw_query_definitions import FwQueryConfig, Request, StdQueries, p16
+from openpilot.selfdrive.frogpilot.frogpilot_variables import get_frogpilot_toggles
+
Ecu = car.CarParams.Ecu
@@ -25,6 +27,8 @@ class CarControllerParams:
self.STEER_DELTA_DOWN = 40
elif CP.carFingerprint == CAR.SUBARU_IMPREZA_2020:
self.STEER_MAX = 1439
+ elif CP.carFingerprint == CAR.SUBARU_IMPREZA:
+ self.STEER_MAX = 3071
else:
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]) + \
p16(uds.DATA_IDENTIFIER_TYPE.APPLICATION_DATA_IDENTIFICATION)
SUBARU_VERSION_RESPONSE = bytes([uds.SERVICE_TYPE.READ_DATA_BY_IDENTIFIER + 0x40]) + \
diff --git a/selfdrive/car/tesla/carcontroller.py b/selfdrive/car/tesla/carcontroller.py
index e460111e3..3ad189f36 100644
--- a/selfdrive/car/tesla/carcontroller.py
+++ b/selfdrive/car/tesla/carcontroller.py
@@ -15,7 +15,7 @@ class CarController(CarControllerBase):
self.pt_packer = CANPacker(DBC[CP.carFingerprint]['pt'])
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
pcm_cancel_cmd = CC.cruiseControl.cancel
diff --git a/selfdrive/car/tesla/carstate.py b/selfdrive/car/tesla/carstate.py
index 645ea4601..315dcd594 100644
--- a/selfdrive/car/tesla/carstate.py
+++ b/selfdrive/car/tesla/carstate.py
@@ -1,6 +1,6 @@
import copy
from collections import deque
-from cereal import car
+from cereal import car, custom
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.interfaces import CarStateBase
@@ -20,8 +20,9 @@ class CarState(CarStateBase):
self.acc_state = 0
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()
+ fp_ret = custom.FrogPilotCarState.new_message()
# Vehicle speed
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.das_control_counters.extend(cp_cam.vl_all["DAS_control"]["DAS_controlCounter"])
- return ret
+ return ret, fp_ret
@staticmethod
def get_can_parser(CP):
diff --git a/selfdrive/car/tesla/interface.py b/selfdrive/car/tesla/interface.py
index deb0e0023..0c8a1d69c 100755
--- a/selfdrive/car/tesla/interface.py
+++ b/selfdrive/car/tesla/interface.py
@@ -8,7 +8,7 @@ from openpilot.selfdrive.car.interfaces import CarInterfaceBase
class CarInterface(CarInterfaceBase):
@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"
# 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.
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()):
- ret.openpilotLongitudinalControl = True
+ ret.openpilotLongitudinalControl = not disable_openpilot_long
flags |= Panda.FLAG_TESLA_LONG_CONTROL
ret.safetyConfigs = [
get_safety_config(car.CarParams.SafetyModel.tesla, flags),
@@ -39,9 +39,9 @@ class CarInterface(CarInterfaceBase):
ret.steerActuatorDelay = 0.25
return ret
- def _update(self, c):
- ret = self.CS.update(self.cp, self.cp_cam)
+ def _update(self, c, frogpilot_toggles):
+ ret, fp_ret = self.CS.update(self.cp, self.cp_cam, frogpilot_toggles)
ret.events = self.create_common_events(ret).to_msg()
- return ret
+ return ret, fp_ret
diff --git a/selfdrive/car/tests/routes.py b/selfdrive/car/tests/routes.py
index dd3a8f633..3ab4047c7 100755
--- a/selfdrive/car/tests/routes.py
+++ b/selfdrive/car/tests/routes.py
@@ -295,6 +295,8 @@ routes = [
CarTestRoute("66c1699b7697267d/2024-03-03--13-09-53", TESLA.TESLA_MODELS_RAVEN),
# 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
CarTestRoute("bec2dcfde6a64235|2022-04-08--14-21-32", HONDA.HONDA_CRV_HYBRID, segment=22),
]
diff --git a/selfdrive/car/tests/test_car_interfaces.py b/selfdrive/car/tests/test_car_interfaces.py
index a6f74d685..f20a56bfe 100644
--- a/selfdrive/car/tests/test_car_interfaces.py
+++ b/selfdrive/car/tests/test_car_interfaces.py
@@ -76,6 +76,10 @@ class TestCarInterfaces:
assert len(car_params.longitudinalTuning.kpV) == len(car_params.longitudinalTuning.kpBP)
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
if car_params.steerControlType != car.CarParams.SteerControlType.angle:
tune = car_params.lateralTuning
diff --git a/selfdrive/car/torque_data/lat_models/ACURA_RDX_3G.json b/selfdrive/car/torque_data/lat_models/ACURA_RDX_3G.json
new file mode 100644
index 000000000..68c6079ae
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/ACURA_RDX_3G.json
@@ -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"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/AUDI_A3_MK3.json b/selfdrive/car/torque_data/lat_models/AUDI_A3_MK3.json
new file mode 100644
index 000000000..61fac1337
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/AUDI_A3_MK3.json
@@ -0,0 +1 @@
+{"input_std":[[8.821153],[1.1607649],[0.47132117],[0.042723242],[1.137403],[1.1458488],[1.154415],[1.1424824],[1.1269064],[1.1112212],[1.0889144],[0.04246643],[0.04255451],[0.042637058],[0.04284904],[0.04293054],[0.04296549],[0.04289919]],"model_test_loss":0.010373540222644806,"input_size":18,"current_date_and_time":"2023-08-05_01-15-19","input_mean":[[22.519371],[-0.051268775],[0.008842468],[-0.0062438333],[-0.049525455],[-0.050104525],[-0.050982136],[-0.044812053],[-0.03977025],[-0.029485626],[-0.022126574],[-0.00628094],[-0.006273981],[-0.00626523],[-0.006110039],[-0.005949586],[-0.0056778532],[-0.005516688]],"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":[[2.145696],[-2.4282207],[-0.0467647],[0.10926833],[0.0520818],[0.04222916],[-0.5462429]],"dense_1_W":[[0.89382285,0.05062796,0.92885584,0.07922598,0.5873072,1.1331865,-0.91537136,-0.13934332,0.17509349,-0.017687947,0.1421727,0.07907387,-0.43241176,-0.29524758,0.64221257,0.25150946,-0.05171897,-0.2579187],[-0.98185164,0.15350275,0.9519401,-0.09016293,0.5030077,0.777908,-0.5172474,-0.1343053,0.060967423,0.059980214,0.10476908,0.17575294,-0.20688392,-0.37559837,0.5713468,0.08849066,0.06383742,-0.21201873],[-0.0056540756,0.34154844,-0.0002563853,0.1807267,0.48449796,1.7143611,-1.3936676,-0.35775846,-0.5523075,-0.15023966,0.5988954,0.72132236,0.18023057,-0.46348006,-0.3817839,0.23941651,-0.06494792,-0.41726813],[-0.01459551,1.354641,6.4718165,-0.45382518,-0.35718468,0.69441503,-0.12716621,-0.10042224,-0.016146144,-0.4092775,-1.1707406,0.24052495,0.18990588,-0.1906599,0.070675336,0.2473157,-0.13808818,0.048208434],[-0.0009390727,1.1310523,0.0082692,-0.10876187,0.25259772,1.0159874,-0.72615826,0.107342415,0.0071694367,-0.065621555,0.13799563,-0.24110964,-0.073862016,-0.496919,-0.3644365,0.16880687,0.13885318,0.15355359],[-0.0016120744,-1.5514591,-0.000675083,0.40327275,0.8975076,-0.8923279,0.7910547,-0.40612024,-0.35091725,-0.101295106,0.38604048,-0.3228168,-0.17239958,-0.3530256,0.58767676,0.15752153,0.060442753,-0.32661223],[0.028779855,2.903487,-0.022664804,0.67652136,0.86524385,1.6721133,1.4576133,1.4279684,0.98554605,0.5130255,-0.469917,-0.0684012,0.4178242,0.3712093,-0.7501333,-0.06791517,0.33725083,-0.09968473]],"activation":"σ"},{"dense_2_W":[[0.72010493,-0.22845428,0.34250122,-0.10947913,-0.09878085,0.19209231,0.3437535],[-0.19205496,-0.07013072,-0.7416267,0.25280657,-0.1804019,0.4552836,0.12560841],[0.3121345,0.351005,0.5316866,0.03252624,-0.057188597,-0.9498188,0.07712814],[-0.16806532,0.25612888,0.43424875,-0.24325378,0.23957624,-0.14204793,-0.13016012],[-0.02399125,-0.71077454,0.03666176,-0.044081435,-0.495433,0.2724298,0.22011437],[-0.24902506,-0.59004927,-0.13717845,-0.5492086,-0.8540712,1.7531782,-0.18482044],[0.045421652,0.13694939,0.35765722,-0.28403643,0.13330263,-0.053298414,0.07322283],[-0.34804162,-0.38957596,-0.1432544,0.071290284,-0.538751,1.1790421,0.29278603],[0.45716798,-0.3516285,-0.2764383,0.4446462,0.76846844,-0.7801458,0.49539566],[0.07269321,-0.15379232,-0.8779124,-0.92490155,-0.91285044,1.7692323,0.028679641],[-0.763075,0.17418097,-0.2823778,0.04659932,-0.030475633,0.37596756,-0.66006523],[-0.30286422,-0.03590232,-0.012065834,-0.16185908,-0.2584895,0.3575371,-0.36891615],[-0.39941847,0.09128256,-0.32452282,-0.36513522,0.06978018,0.028525386,-0.7303688]],"activation":"σ","dense_2_b":[[0.048172507],[-0.07530213],[-0.340101],[-0.022203589],[0.009521725],[0.46328664],[0.004919447],[0.022925986],[-0.15940326],[0.40359482],[-0.14555077],[-0.02970779],[-0.24673922]]},{"dense_3_W":[[-0.32974115,-0.5017099,0.5581341,-0.22340928,-0.03365036,-0.20835784,0.537433,0.5391966,-0.36658195,-0.5869503,0.17776869,-0.013170913,0.49127203],[-0.29820803,0.28987518,-0.24515595,0.25772423,-0.04187076,0.69620353,-0.3389867,0.12667182,0.150237,0.5090255,0.49386412,-0.3637399,-0.01771473],[0.5784079,-0.0028831854,0.43896967,0.60790384,-0.4540079,-0.45909828,0.046820417,-0.56937873,0.530507,-0.1309796,0.32449916,-0.49291292,-0.07336644]],"activation":"identity","dense_3_b":[[0.0460099],[-0.07466251],[0.050609488]]},{"dense_4_W":[[0.13093115,-0.7773025,0.81287336]],"dense_4_b":[[0.057754416]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/AUDI_Q3_MK2.json b/selfdrive/car/torque_data/lat_models/AUDI_Q3_MK2.json
new file mode 100644
index 000000000..04a37fb73
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/AUDI_Q3_MK2.json
@@ -0,0 +1 @@
+{"input_std":[[7.7137036],[0.9591701],[0.43025136],[0.042929597],[0.94636554],[0.9494532],[0.9542092],[0.9331239],[0.92229235],[0.90257126],[0.88295245],[0.04270026],[0.042758208],[0.042818923],[0.042808957],[0.04270763],[0.04245825],[0.04215921]],"model_test_loss":0.013933051377534866,"input_size":18,"current_date_and_time":"2023-08-05_03-45-12","input_mean":[[22.835394],[0.021439364],[0.0072024865],[-0.030873412],[0.021618834],[0.022110935],[0.02246376],[0.027221544],[0.027849164],[0.028268991],[0.032981515],[-0.030950077],[-0.030914158],[-0.030886404],[-0.030796975],[-0.03080609],[-0.030815149],[-0.030869272]],"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.04303998],[0.18157572],[-0.08682473],[2.9495513],[1.4374219],[0.6783021],[-2.7817473]],"dense_1_W":[[-0.0047104284,-0.6137708,0.002341153,0.0833492,0.08768307,-0.81527835,0.6300508,-0.16833228,-0.25419337,-0.031592067,0.122596905,-0.10794349,-0.06970466,0.1521993,-0.04051286,0.059251916,-0.11607053,0.024402162],[-0.06346717,-0.8082159,0.0040190252,0.3896669,0.06872366,-0.7609862,1.0698833,-0.06101861,0.1457311,0.19787341,-0.21086167,-0.07617529,-0.40358907,0.012452437,0.10700336,0.3594503,0.025611963,-0.14057784],[-0.010002668,-1.4602287,-5.6766963,0.03532623,-0.3498076,-0.005860239,0.092076786,-0.22858407,-0.4043539,0.277433,2.0291262,0.044144016,0.06367758,-0.2504535,0.3463553,-0.27935135,0.18728429,-0.15520296],[1.595175,1.1790471,0.33827057,-0.36523697,-0.028244315,0.88139707,-1.6474634,0.3107364,-0.13230316,0.019280735,-0.015979009,0.5001427,-0.13290524,-0.15675303,0.12809546,-0.09519324,-0.046115097,0.14121765],[0.01943066,0.3716076,-0.048877437,-0.3783698,0.8343788,-0.51018566,1.0465596,-0.123417296,-0.446517,0.0398392,0.5281696,-0.3002102,-0.4030578,-0.23385769,0.45266014,-0.15139927,-0.084088355,-0.8366423],[-0.05169121,0.34580684,-0.0006902231,-0.0828817,-0.67921466,1.1092558,-0.4253136,0.008052844,-0.08571924,0.14040273,-0.057995982,0.5459289,-0.1640265,-0.24621837,-0.44702664,0.25875458,-0.16363451,0.07772843],[-1.5420308,-0.0795151,0.32449803,0.09269649,-0.12254087,0.95711464,-0.32903105,0.03880426,-0.24505275,0.3849109,-0.085893035,0.1646195,-0.14589338,-0.44051296,-0.05752575,0.38210398,0.32775694,-0.34554252]],"activation":"σ"},{"dense_2_W":[[-1.1991313,-0.99167293,-0.51472193,0.16773303,0.02101984,0.2913248,1.2563334],[0.50807565,0.2559231,0.3110827,-0.7911515,-0.2996264,-0.76801026,0.21431924],[-0.85551465,-0.3015842,-0.283833,0.5011012,-1.0202202,0.6740454,0.972628],[0.98223805,1.0016109,-0.09864264,0.13172226,-0.12697673,-0.40963414,-0.35780042],[-1.1385525,-0.88758576,-0.2415131,1.0169281,-0.37200353,0.83228046,0.58273304],[0.21168564,-0.01694945,-0.13944875,0.12901805,-0.58597475,-0.23450175,0.07449124],[0.6887359,0.49634412,-0.4524045,-0.5046205,0.80216706,-0.37323585,0.15390924],[-0.86359656,-0.8294278,-0.10975485,-0.111551575,-0.21511969,1.1387116,0.014124521],[0.6704329,0.7197621,-0.16924202,-0.03436297,0.3256051,-0.6220993,-0.3785999],[0.88013136,0.211954,0.26013535,-0.5998456,-0.14124529,-1.0012022,0.30486783],[0.8889406,0.25632593,0.029823503,-0.6760066,0.40066594,-0.6796646,-0.42230535],[-0.09985791,-0.6314821,-0.6048359,-0.28479984,0.022334062,-0.11070772,-0.50172895],[-1.0790496,-0.81828046,-0.26459435,-0.15203167,-0.10264537,0.7340549,0.6219628]],"activation":"σ","dense_2_b":[[0.07743759],[-0.08656865],[-0.028110785],[0.011056744],[0.33631137],[-0.33865649],[0.093462616],[0.28041044],[-0.1485106],[-0.10288075],[-0.118501574],[-0.19659644],[0.23902157]]},{"dense_3_W":[[-0.21247761,-0.3863918,-0.35711917,-0.15159392,-0.3087554,0.27256498,0.059494548,0.79742235,-0.6449726,-0.3814191,-0.6635471,0.14567713,0.6240987],[-0.60485286,0.36261612,-0.3062913,0.5288856,-0.8237054,0.14184983,0.36521724,-0.6798562,0.19129165,0.76819366,0.3231601,0.028053993,-0.89101535],[0.5106036,-0.047764797,0.003893947,0.122273564,-0.616694,-0.30744067,0.10899531,-0.98274595,0.045314062,0.3392997,0.15401444,0.406467,-0.3275237]],"activation":"identity","dense_3_b":[[0.0072817504],[0.054671016],[0.3754705]]},{"dense_4_W":[[0.18990728,-1.0539979,-0.04924367]],"dense_4_b":[[-0.04299712]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/BUICK_LACROSSE.json b/selfdrive/car/torque_data/lat_models/BUICK_LACROSSE.json
new file mode 100644
index 000000000..dcd89c815
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/BUICK_LACROSSE.json
@@ -0,0 +1 @@
+{"input_std":[[6.227712],[1.1068953],[1.0287797],[0.031075474],[1.0763543],[1.0856286],[1.0965383],[1.126149],[1.1471479],[1.1817935],[1.207976],[0.03088383],[0.030962178],[0.031021496],[0.031159075],[0.031329848],[0.031462345],[0.031319857]],"model_test_loss":0.004972144495695829,"input_size":18,"current_date_and_time":"2023-08-31_18-04-43","input_mean":[[24.297255],[0.05408088],[-0.024366971],[0.017203888],[0.04666708],[0.049268622],[0.050475407],[0.05590255],[0.04882452],[0.04647568],[0.05159426],[0.017288238],[0.017341834],[0.017397404],[0.017483119],[0.017647635],[0.018217644],[0.018788869]],"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.022334022],[-0.100295104],[-0.110021666],[-0.37309307],[-0.18126963],[-0.90585893],[-0.5534994]],"dense_1_W":[[0.0030549474,1.145932,-0.09721581,0.18435507,-0.2573822,-0.19281419,0.43596926,0.1603594,0.10032455,-0.051014125,0.4603509,0.38878915,-0.22585483,-0.29935592,-0.04472448,-0.15199424,0.44078583,-0.19637495],[0.007835068,0.57188964,0.18070067,-0.2610156,-0.17529912,0.14483498,-0.23499107,0.4929414,0.10448897,-0.45648035,0.029684572,0.1314099,-0.16433047,0.2065975,0.07887834,-0.0060373824,-0.20691155,0.13691476],[-0.005327477,1.7886202,2.9505506,0.09841906,-1.9402149,-1.3852259,-0.043792397,0.660079,0.60579574,0.24349208,0.29671067,0.08202194,-0.13981113,0.36684915,0.057882063,-0.41412312,0.31871474,-0.02327852],[1.0903977,-1.1873779,0.14879608,0.040507846,0.040393896,0.13455993,0.9753803,0.085223004,-0.06493875,-0.20206894,0.18746802,-0.24526027,-0.08939371,0.2430548,0.13119027,0.15268146,0.20207612,-0.083613925],[0.0021948,3.2657847,-0.18798442,-0.12689658,-0.30403885,0.3367026,0.91909635,1.7143666,0.045331903,-0.31545398,-0.051042344,-0.3529171,0.29837632,0.09466574,-0.8073861,-0.0039647045,-0.1720164,0.5201512],[1.0928359,1.2096838,-0.14703602,0.018953208,-0.03811592,-0.2855322,-0.8143947,0.05326237,-0.066094,0.064099275,-0.06976516,-0.06933611,0.34876755,-0.25860986,-0.14344722,-0.07053271,-0.20750608,0.025129952],[-0.0055736825,0.64105284,0.10726179,-0.17012087,-0.001185817,0.5677425,-0.93299127,0.09094073,0.0109323105,0.2228847,-0.16700141,0.30421817,0.13674305,-0.49573237,-0.13086164,0.31447932,0.15766789,-0.16813341]],"activation":"σ"},{"dense_2_W":[[0.27341422,-0.47601527,-0.6289435,1.3114856,-0.18440256,-0.69279665,-0.58332384],[-0.34085867,-0.29880068,-0.9368486,0.2080702,0.6225143,-0.6358373,-1.1943169],[0.6918406,0.15412113,0.04159215,-0.6581899,0.24066101,-0.043641392,0.045506563],[-0.026726253,-0.81909335,0.16420767,0.00291583,-0.3189569,-0.5359374,-0.7172654],[-0.8483084,-0.35060802,-0.41203314,-0.5305087,0.47287297,-0.28290507,-0.8737458],[0.35316753,0.90733016,-0.2770915,0.20165613,0.20155826,0.36213335,-0.24496384],[-0.5022167,-0.5612638,0.38854852,-0.018215526,-0.19334692,-0.4468064,-0.86793435],[0.47059315,0.23489894,0.41844767,-0.08509097,-0.31178007,0.11894885,0.5030957],[0.24172585,0.24865924,-0.15847187,-0.7011813,0.48085362,0.14869425,0.23137042],[-0.618487,0.12818213,-0.6849712,0.29365247,0.20846452,-0.063214555,0.125115],[0.5387756,0.06612413,-0.4151303,-0.63775194,0.5008791,-0.059868183,0.5720243],[-0.32397416,-0.08635292,-0.4818767,-0.67876416,-0.5552992,0.2187673,-0.4787086],[-0.89717907,-0.42284042,0.31489655,-0.8514086,-0.7674914,-0.41609457,-0.006730729]],"activation":"σ","dense_2_b":[[0.44311488],[0.11209076],[-0.0894076],[0.1847591],[-0.1593725],[-0.022556875],[0.21991341],[-0.05744998],[-0.057585794],[-0.2627398],[-0.054548565],[0.105285086],[-0.19715697]]},{"dense_3_W":[[-0.35089782,-0.39416888,-0.30615157,-0.46847108,-0.26617768,0.43837857,-0.485962,-0.2902945,-0.17870793,0.2757293,0.6125576,-0.24665116,-0.21227285],[-0.37411463,0.19765407,-0.014807391,0.06321688,0.37360784,0.22288837,-0.116587795,0.029183213,0.6631047,0.11275381,-0.27042058,-0.44573787,0.14713542],[-0.50715375,-0.38213205,0.5145017,-0.6412086,-0.39256987,0.058481824,-0.437418,0.30487192,0.5463277,-0.17863718,0.47274628,-0.5652254,-0.2641463]],"activation":"identity","dense_3_b":[[0.0534896],[0.01632865],[0.023216043]]},{"dense_4_W":[[0.3922371,0.50241,1.2339215]],"dense_4_b":[[0.022297831]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/CHEVROLET_EQUINOX.json b/selfdrive/car/torque_data/lat_models/CHEVROLET_EQUINOX.json
new file mode 100644
index 000000000..00a68d269
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/CHEVROLET_EQUINOX.json
@@ -0,0 +1 @@
+{"input_std":[[10.534294],[1.5504998],[1.4046903],[0.029573984],[1.5927145],[1.578906],[1.564156],[1.5118331],[1.493684],[1.4678634],[1.4253669],[0.02943281],[0.029483505],[0.029535847],[0.02967169],[0.029826282],[0.03000203],[0.030046586]],"model_test_loss":0.02003631368279457,"input_size":18,"current_date_and_time":"2023-08-31_20-50-28","input_mean":[[20.131113],[0.009686473],[0.06975938],[0.0023475066],[0.0038891183],[0.0060874033],[0.008401226],[0.013517541],[0.01840766],[0.0266773],[0.02453028],[0.0023093733],[0.002328295],[0.0023440488],[0.0024961669],[0.0025724813],[0.0024677413],[0.0023574075]],"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":[[-4.0288644],[0.10457083],[-3.9555483],[0.1691402],[-0.012094571],[-0.0782635],[-0.2598278]],"dense_1_W":[[-2.1827135,1.6132607,-0.9255983,0.116717376,-1.8178183,-0.54029983,0.33489665,0.56080383,-0.22747517,-0.5733255,0.5044412,-0.2292483,0.043896638,0.08075467,-0.28934216,0.17338042,0.0033520209,0.10574474],[-0.03214852,1.3043286,1.787647,-0.19292493,-1.496456,-1.6432034,-1.0122085,0.6772478,0.9241051,2.137595,1.1481318,0.7382223,0.24003813,-0.26050806,-0.28489965,-0.055436503,-1.5187881,0.5395662],[-2.130688,-2.4082897,0.8946516,1.182773,1.0356439,1.0627962,0.681919,-1.07377,0.9514841,0.2902732,-0.51102746,-1.0186149,0.06007755,0.55835754,-0.8702267,-0.27547133,1.1577551,-0.79220283],[0.048019372,0.56005365,0.090563335,0.04659274,-0.3400944,0.08129445,0.079794005,1.6712024,0.37665895,0.92944545,-0.818461,1.0755452,0.03035464,-0.7417196,0.46747556,-1.7863483,0.1933551,0.6655417],[0.010540867,-2.1044421,0.123707764,0.19983652,-0.3400125,0.042333197,-0.14189881,-0.15991694,1.1688339,0.89001805,-1.0717757,-0.12767468,-0.23459645,0.55075175,0.08273279,-1.410371,-0.11742753,1.0628744],[-0.0035597957,3.3175247,-0.08206834,-0.41877395,-2.3628318,-0.3887815,0.33513132,1.0517763,1.3315583,-0.45716277,-0.83998686,0.038495045,-0.29630885,-0.5393306,0.004715303,-0.3557685,-0.0024815162,0.5117863],[-0.06787126,-1.0245934,0.846602,0.76652443,-3.6147707,-3.2961829,-3.046585,-2.334436,-2.2018268,-2.0479157,-2.1753612,-0.3235234,0.3021576,0.6696055,-0.5296955,-0.34782553,-0.6869261,0.61321783]],"activation":"σ"},{"dense_2_W":[[0.64928615,0.2816972,-0.8923362,0.39578387,-0.61536825,0.81299543,0.32944572],[-3.469548,-0.088318504,4.506985,1.7126206,-0.54613674,1.1776173,-1.3406864],[-0.16514356,-0.18710926,-0.049463313,-0.74177825,-0.89867437,-0.12767266,-0.41532612],[0.3880128,0.14577644,-0.22068585,0.47859693,-0.3810993,0.21953157,-0.28429258],[0.09226449,-0.31862667,-0.7718878,-0.3926271,0.39786428,0.24407528,0.50177044],[0.67237484,0.12668592,-0.30338138,-0.625696,0.26677904,-0.40067798,-0.32989067],[0.55108297,-0.46753818,-0.2422762,-0.32914385,1.0277789,-0.21390574,-0.51578075],[-0.6387295,0.087801814,0.4115124,0.19489816,-0.50232434,0.88593876,0.04993241],[-0.0012766474,-0.39255276,-0.43439093,0.5811583,0.04147405,0.39352056,-0.2983913],[0.5312808,-0.46965963,-0.2202195,0.022353612,0.9100419,-0.7610306,-0.045171853],[-0.4153422,0.25298238,-0.16235219,0.6847717,-0.24125478,0.12481583,0.17123348],[0.019955412,-0.049374487,-0.028301261,-0.1474805,-0.99081236,0.46832514,0.04314314],[-0.060847353,-0.4487362,0.11238633,-0.2315336,0.61632276,-0.037449174,-0.31603873]],"activation":"σ","dense_2_b":[[-0.0784909],[-0.78942764],[-0.15396598],[-0.0694357],[0.42111325],[0.13395377],[0.13471761],[-0.2390017],[-0.10127865],[0.021352982],[-0.10597191],[-0.0495153],[0.08049109]]},{"dense_3_W":[[-0.5803282,-0.4269681,-0.29210615,-0.35849357,0.6151693,0.4374335,0.33656615,-0.38959798,-0.124871194,0.80708337,-0.2547417,-0.4598867,0.28997138],[-0.024669895,1.1817242,-0.08351745,-0.24313891,-0.31439584,-0.25903952,-0.07882097,0.5553487,-0.3152985,-0.31680647,-0.116309114,0.010063961,0.2913986],[-0.43385702,-0.37067002,0.0936241,0.23112701,0.11643858,-0.15334345,-0.003450505,0.18969658,0.37703827,-0.25617403,0.11559996,-0.19988349,0.1828592]],"activation":"identity","dense_3_b":[[0.098078996],[0.0034752209],[0.008636777]]},{"dense_4_W":[[-0.73048496,0.39407238,-0.07285802]],"dense_4_b":[[-0.09288416]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/CHEVROLET_EQUINOX_CC.json b/selfdrive/car/torque_data/lat_models/CHEVROLET_EQUINOX_CC.json
new file mode 100644
index 000000000..00a68d269
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/CHEVROLET_EQUINOX_CC.json
@@ -0,0 +1 @@
+{"input_std":[[10.534294],[1.5504998],[1.4046903],[0.029573984],[1.5927145],[1.578906],[1.564156],[1.5118331],[1.493684],[1.4678634],[1.4253669],[0.02943281],[0.029483505],[0.029535847],[0.02967169],[0.029826282],[0.03000203],[0.030046586]],"model_test_loss":0.02003631368279457,"input_size":18,"current_date_and_time":"2023-08-31_20-50-28","input_mean":[[20.131113],[0.009686473],[0.06975938],[0.0023475066],[0.0038891183],[0.0060874033],[0.008401226],[0.013517541],[0.01840766],[0.0266773],[0.02453028],[0.0023093733],[0.002328295],[0.0023440488],[0.0024961669],[0.0025724813],[0.0024677413],[0.0023574075]],"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":[[-4.0288644],[0.10457083],[-3.9555483],[0.1691402],[-0.012094571],[-0.0782635],[-0.2598278]],"dense_1_W":[[-2.1827135,1.6132607,-0.9255983,0.116717376,-1.8178183,-0.54029983,0.33489665,0.56080383,-0.22747517,-0.5733255,0.5044412,-0.2292483,0.043896638,0.08075467,-0.28934216,0.17338042,0.0033520209,0.10574474],[-0.03214852,1.3043286,1.787647,-0.19292493,-1.496456,-1.6432034,-1.0122085,0.6772478,0.9241051,2.137595,1.1481318,0.7382223,0.24003813,-0.26050806,-0.28489965,-0.055436503,-1.5187881,0.5395662],[-2.130688,-2.4082897,0.8946516,1.182773,1.0356439,1.0627962,0.681919,-1.07377,0.9514841,0.2902732,-0.51102746,-1.0186149,0.06007755,0.55835754,-0.8702267,-0.27547133,1.1577551,-0.79220283],[0.048019372,0.56005365,0.090563335,0.04659274,-0.3400944,0.08129445,0.079794005,1.6712024,0.37665895,0.92944545,-0.818461,1.0755452,0.03035464,-0.7417196,0.46747556,-1.7863483,0.1933551,0.6655417],[0.010540867,-2.1044421,0.123707764,0.19983652,-0.3400125,0.042333197,-0.14189881,-0.15991694,1.1688339,0.89001805,-1.0717757,-0.12767468,-0.23459645,0.55075175,0.08273279,-1.410371,-0.11742753,1.0628744],[-0.0035597957,3.3175247,-0.08206834,-0.41877395,-2.3628318,-0.3887815,0.33513132,1.0517763,1.3315583,-0.45716277,-0.83998686,0.038495045,-0.29630885,-0.5393306,0.004715303,-0.3557685,-0.0024815162,0.5117863],[-0.06787126,-1.0245934,0.846602,0.76652443,-3.6147707,-3.2961829,-3.046585,-2.334436,-2.2018268,-2.0479157,-2.1753612,-0.3235234,0.3021576,0.6696055,-0.5296955,-0.34782553,-0.6869261,0.61321783]],"activation":"σ"},{"dense_2_W":[[0.64928615,0.2816972,-0.8923362,0.39578387,-0.61536825,0.81299543,0.32944572],[-3.469548,-0.088318504,4.506985,1.7126206,-0.54613674,1.1776173,-1.3406864],[-0.16514356,-0.18710926,-0.049463313,-0.74177825,-0.89867437,-0.12767266,-0.41532612],[0.3880128,0.14577644,-0.22068585,0.47859693,-0.3810993,0.21953157,-0.28429258],[0.09226449,-0.31862667,-0.7718878,-0.3926271,0.39786428,0.24407528,0.50177044],[0.67237484,0.12668592,-0.30338138,-0.625696,0.26677904,-0.40067798,-0.32989067],[0.55108297,-0.46753818,-0.2422762,-0.32914385,1.0277789,-0.21390574,-0.51578075],[-0.6387295,0.087801814,0.4115124,0.19489816,-0.50232434,0.88593876,0.04993241],[-0.0012766474,-0.39255276,-0.43439093,0.5811583,0.04147405,0.39352056,-0.2983913],[0.5312808,-0.46965963,-0.2202195,0.022353612,0.9100419,-0.7610306,-0.045171853],[-0.4153422,0.25298238,-0.16235219,0.6847717,-0.24125478,0.12481583,0.17123348],[0.019955412,-0.049374487,-0.028301261,-0.1474805,-0.99081236,0.46832514,0.04314314],[-0.060847353,-0.4487362,0.11238633,-0.2315336,0.61632276,-0.037449174,-0.31603873]],"activation":"σ","dense_2_b":[[-0.0784909],[-0.78942764],[-0.15396598],[-0.0694357],[0.42111325],[0.13395377],[0.13471761],[-0.2390017],[-0.10127865],[0.021352982],[-0.10597191],[-0.0495153],[0.08049109]]},{"dense_3_W":[[-0.5803282,-0.4269681,-0.29210615,-0.35849357,0.6151693,0.4374335,0.33656615,-0.38959798,-0.124871194,0.80708337,-0.2547417,-0.4598867,0.28997138],[-0.024669895,1.1817242,-0.08351745,-0.24313891,-0.31439584,-0.25903952,-0.07882097,0.5553487,-0.3152985,-0.31680647,-0.116309114,0.010063961,0.2913986],[-0.43385702,-0.37067002,0.0936241,0.23112701,0.11643858,-0.15334345,-0.003450505,0.18969658,0.37703827,-0.25617403,0.11559996,-0.19988349,0.1828592]],"activation":"identity","dense_3_b":[[0.098078996],[0.0034752209],[0.008636777]]},{"dense_4_W":[[-0.73048496,0.39407238,-0.07285802]],"dense_4_b":[[-0.09288416]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/CHEVROLET_SILVERADO.json b/selfdrive/car/torque_data/lat_models/CHEVROLET_SILVERADO.json
new file mode 100644
index 000000000..fe64977fe
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/CHEVROLET_SILVERADO.json
@@ -0,0 +1 @@
+{"input_std":[[9.111214],[1.4682485],[0.57526964],[0.04511676],[1.4448825],[1.4523145],[1.460504],[1.4530647],[1.436759],[1.409998],[1.3768793],[0.04496706],[0.044998076],[0.04501952],[0.044998042],[0.04498694],[0.044818893],[0.04446676]],"model_test_loss":0.022049037739634514,"input_size":18,"current_date_and_time":"2023-08-05_05-39-06","input_mean":[[24.08155],[0.011368711],[0.0031438756],[-0.0055672466],[0.01115314],[0.0110932905],[0.010956869],[0.013351914],[0.012678603],[0.010665299],[0.007861591],[-0.0056356518],[-0.0056050173],[-0.005582452],[-0.0056302436],[-0.0057524433],[-0.0058822],[-0.006047828]],"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":[[1.4668645],[0.0061378293],[0.14334162],[-1.507637],[-3.6057515],[-0.045111466],[0.18928593]],"dense_1_W":[[0.6566544,0.7743814,0.18751603,0.04858998,0.7569071,0.25307912,-2.068015,0.9910395,0.86449015,0.5162737,0.17964111,0.73959017,-0.13406877,-1.2188785,0.051854312,0.557273,0.42717713,-0.4706351],[0.025763594,2.3271172,7.5912685,-0.59063435,-1.0175278,0.07860616,-0.39720893,-1.3828933,0.27263463,0.5794174,-0.941214,0.5112712,0.31876096,-0.38133666,-0.17985544,0.50390506,-0.42106378,0.24962576],[0.05800794,4.917338,-0.050065108,0.5062318,2.31812,2.2346003,0.97258455,2.237544,3.1694891,3.0328865,2.4481356,0.87150276,0.23922867,-0.27206227,-0.76175624,-0.59474605,0.022229204,0.18751834],[0.91351914,0.42640725,0.21792875,-0.6499657,0.42711547,0.46455538,-0.7128904,0.6972329,0.07784378,0.15792462,0.86492527,0.16739717,0.3357893,-0.1592361,0.10722909,0.21031618,-0.019191844,-0.031056747],[-1.390049,0.89916164,0.30032212,0.0886132,0.81011575,-0.3205005,-2.085708,1.6698592,1.496016,0.86138624,0.12484511,0.47975743,-0.41812262,-0.7270122,-0.06460007,0.9231981,0.42574838,-0.64465237],[-0.001402944,-1.1569467,0.0005942974,0.063189715,-0.09013453,-1.2986813,1.6477252,-0.4343868,-0.08533708,-0.27364805,0.21535206,-0.34249792,-0.48679602,0.6684111,0.16701448,0.39430234,0.2199159,-0.27228448],[-1.1195272,0.015763488,-0.200724,0.05122529,0.40223718,0.5024332,-1.402779,-0.47795737,-0.24807225,-0.70503217,-0.21363245,0.76604843,-0.14105192,-0.4387646,-0.28273064,-0.21595778,0.03305617,0.22701742]],"activation":"σ"},{"dense_2_W":[[1.7721981,2.2011127,0.29388586,0.38426542,0.83704543,-2.9152303,0.5229557],[-0.36864644,0.42984635,-0.41658726,-0.041540317,0.18798253,0.38724944,-0.65996665],[-0.52116436,0.2358491,-0.2220775,-0.032654468,-0.48732167,0.3548198,-0.45838025],[-0.2911298,-0.46853513,0.03141412,-0.795555,-0.18514551,-0.08353839,-0.33849046],[-0.67049307,0.10367472,0.4490753,-0.55316794,-0.48152244,0.31841356,-0.14415056],[0.28696507,-1.2001104,-0.55151457,0.95023096,-1.3845363,-0.3174642,-0.3309214],[-0.6142683,0.0910831,-0.18282256,-0.44715023,0.37679994,0.44533804,0.027039269],[0.14790064,-0.27130985,-0.18719442,-0.13985236,-0.22100836,-0.6535676,-0.19135725],[-0.4416883,-0.37975168,-0.43114612,-0.07862877,0.20007153,0.95488816,-0.52858645],[-0.17171355,0.2863653,0.4144529,0.679835,0.34844747,-1.2170105,0.29281953],[0.06252894,0.095131,-0.13292563,-0.6726018,-0.39990836,-0.68776375,-0.36863],[0.7808943,-0.8408942,0.13730413,0.102169715,0.1682241,-0.5337488,1.5183735],[0.11278698,0.10173518,0.10506139,0.4002509,0.16067709,-1.1565727,0.75811535]],"activation":"σ","dense_2_b":[[-1.5210099],[-0.0006081214],[0.021954967],[0.032652497],[0.19418235],[-0.42663833],[0.11631468],[-0.27090475],[0.18836942],[-0.4026297],[-0.3532125],[-0.095932305],[-0.094078794]]},{"dense_3_W":[[-0.08552111,0.15208419,0.3206692,-0.46672416,-0.0039158463,-0.05807648,-0.5021984,0.15186986,-0.59495836,0.2405156,-0.5498271,0.070102595,0.26428217],[-0.63763195,0.14358082,0.45475405,0.4365134,0.5539486,-0.44107583,0.46288002,-0.1564132,0.39014947,-0.55990654,-0.05062592,-0.5582297,-0.45318148],[0.57558644,-0.5381224,-0.6278913,0.21171339,-0.06526249,-0.1312582,0.3146726,-0.45940813,-0.15466015,0.11860342,0.36926913,-0.16175088,0.17500523]],"activation":"identity","dense_3_b":[[-0.03552377],[0.059005316],[-0.037881076]]},{"dense_4_W":[[0.43992618,-0.9712287,0.43158254]],"dense_4_b":[[-0.04844147]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/CHEVROLET_SUBURBAN.json b/selfdrive/car/torque_data/lat_models/CHEVROLET_SUBURBAN.json
new file mode 100644
index 000000000..1383fdf7f
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/CHEVROLET_SUBURBAN.json
@@ -0,0 +1 @@
+{"input_std":[[7.0000353],[0.91031396],[1.269469],[0.0315604],[0.9563133],[0.95031977],[0.9356424],[0.873496],[0.8912867],[0.8935701],[0.96191794],[0.031832103],[0.031727515],[0.031619374],[0.03170114],[0.03179356],[0.031944003],[0.03203715]],"model_test_loss":0.025683574378490448,"input_size":18,"current_date_and_time":"2023-08-31_22-32-43","input_mean":[[27.019146],[0.2162388],[-0.102987334],[-0.016973253],[0.2426502],[0.23661843],[0.22663806],[0.18541981],[0.17368032],[0.14804864],[0.09238692],[-0.017235657],[-0.017166195],[-0.017074104],[-0.016875083],[-0.016880676],[-0.017125089],[-0.017351476]],"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.23588695],[-0.5088953],[1.5173167],[0.21325926],[0.7270255],[1.0430372],[-2.1749456]],"dense_1_W":[[-0.00035987928,1.4975938,2.03412,-0.83676016,-5.5800395,-1.7383903,-0.18633558,6.249567,0.15692733,1.1870492,-1.8389847,0.8397649,0.41889027,0.19991927,-0.71028113,-0.42742363,-0.01929488,0.56470984],[0.1451778,-0.42022082,-0.08357744,0.37352008,0.13762045,-0.513736,0.19210075,-0.99654514,0.07671047,0.3092085,-0.09438795,-0.7692168,-0.05790273,-0.019019479,0.68036485,-0.3681197,0.042775016,0.113177255],[0.17934947,0.6802453,0.53991216,1.2953564,0.36064458,-2.232729,-1.3662916,9.39327,3.2034888,0.82174385,-3.8604288,-0.059266165,0.23885792,1.2206435,-0.037034295,-1.0659415,-1.2380418,-0.38709572],[-0.63551307,0.14085051,-0.058989003,-0.096907504,-0.08637354,-0.9568107,-0.203569,0.09172185,-1.7067626,0.23453063,0.40079904,-0.33019188,-0.14800894,0.4674501,-0.058009204,-0.3754687,-0.10436635,0.64636946],[0.33742648,-0.36501276,-0.034292817,-0.51860994,-1.3856511,-1.5455489,-1.0439808,-0.75624853,-1.0810176,-0.5734188,0.55518353,-0.80131483,-0.6185672,-0.28676248,-0.104135,-0.62493587,-0.8962451,-1.5516719],[0.43760708,-1.6991494,-0.03338309,-0.96213526,0.00956474,-1.2663416,-1.9227605,-3.5994406,0.26717234,1.618855,-0.69799376,-0.3365453,0.08994935,0.16855639,-2.0510433,-1.3217996,-1.0182589,-0.993361],[0.38308197,-1.8382412,-0.15014274,0.11305897,1.90282,-0.91276294,-1.8583714,-2.2861354,-1.0779126,-2.9923978,-2.1958616,-0.40794706,-0.3506177,0.21085607,0.39614698,0.46702477,-0.1904523,-0.28659886]],"activation":"σ"},{"dense_2_W":[[-0.13722074,0.17729984,-0.24335465,0.24187207,-0.14201832,-0.07732416,0.13892417],[-0.4686111,0.30702016,-0.15520222,0.2413592,-0.06519562,-0.02441734,0.05019473],[0.79214656,-0.7921441,-0.6606072,0.055532016,-0.11311045,-0.08024592,-0.0085274875],[-0.25042439,0.21615438,0.4954985,0.0046605244,-0.4504836,-0.13616334,-0.39802498],[0.49501747,-0.8520829,-0.74666256,0.59406155,-0.3424727,-0.42375195,-0.056689456],[0.09918636,-0.27861944,-0.06896329,0.07916021,0.39362162,-0.3197992,-0.38495535],[-0.44832206,0.775501,-1.5508496,-1.2964923,0.2656348,0.73607206,0.102380335],[-0.12338452,0.45182562,0.15285002,0.36166486,0.106165096,-0.44855922,0.26180896],[1.468655,-2.9420528,1.1340134,-1.8203074,-1.8435699,1.8503501,-0.6241417],[0.11571435,0.44641992,0.5466342,0.460799,0.34136263,0.118771955,0.03079372],[-0.89526504,0.4808293,-0.020656256,0.23367782,0.24296117,0.14677529,-0.17654741],[0.48179916,-0.9906037,-0.5923862,-0.4594782,-0.35988396,0.8058588,-0.045400906],[0.5093772,0.44455037,0.17609815,-0.81010824,-0.7701845,-0.67883664,-0.105422966]],"activation":"σ","dense_2_b":[[-0.016313186],[-0.23423415],[-0.11555125],[0.031153541],[-0.008395348],[-0.05427732],[0.04926095],[-0.03232725],[1.3587319],[0.039414253],[-0.2525624],[0.069728516],[-0.1901692]]},{"dense_3_W":[[-0.40749985,-0.48021835,0.56590366,0.18960631,0.38889936,-0.016490487,0.2452584,-0.49623072,0.38123888,-0.64162004,-0.4950841,-0.28877184,0.033746734],[-0.42167312,0.4292303,-0.117614456,-0.051768117,0.051334534,0.5342065,0.5592815,-0.093919486,0.65363497,-0.43596736,0.16242468,0.2578982,-0.2107315],[0.3909801,0.0338481,0.17298904,-0.6669294,0.66819596,0.5040033,-0.11421765,0.24396016,0.58365494,-0.4551556,0.13173825,0.29966846,-0.28813577]],"activation":"identity","dense_3_b":[[-0.039529935],[-0.049995966],[-0.054298006]]},{"dense_4_W":[[0.5930795,0.46760607,0.73884505]],"dense_4_b":[[-0.046037514]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/CHEVROLET_SUBURBAN_CC.json b/selfdrive/car/torque_data/lat_models/CHEVROLET_SUBURBAN_CC.json
new file mode 100644
index 000000000..1383fdf7f
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/CHEVROLET_SUBURBAN_CC.json
@@ -0,0 +1 @@
+{"input_std":[[7.0000353],[0.91031396],[1.269469],[0.0315604],[0.9563133],[0.95031977],[0.9356424],[0.873496],[0.8912867],[0.8935701],[0.96191794],[0.031832103],[0.031727515],[0.031619374],[0.03170114],[0.03179356],[0.031944003],[0.03203715]],"model_test_loss":0.025683574378490448,"input_size":18,"current_date_and_time":"2023-08-31_22-32-43","input_mean":[[27.019146],[0.2162388],[-0.102987334],[-0.016973253],[0.2426502],[0.23661843],[0.22663806],[0.18541981],[0.17368032],[0.14804864],[0.09238692],[-0.017235657],[-0.017166195],[-0.017074104],[-0.016875083],[-0.016880676],[-0.017125089],[-0.017351476]],"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.23588695],[-0.5088953],[1.5173167],[0.21325926],[0.7270255],[1.0430372],[-2.1749456]],"dense_1_W":[[-0.00035987928,1.4975938,2.03412,-0.83676016,-5.5800395,-1.7383903,-0.18633558,6.249567,0.15692733,1.1870492,-1.8389847,0.8397649,0.41889027,0.19991927,-0.71028113,-0.42742363,-0.01929488,0.56470984],[0.1451778,-0.42022082,-0.08357744,0.37352008,0.13762045,-0.513736,0.19210075,-0.99654514,0.07671047,0.3092085,-0.09438795,-0.7692168,-0.05790273,-0.019019479,0.68036485,-0.3681197,0.042775016,0.113177255],[0.17934947,0.6802453,0.53991216,1.2953564,0.36064458,-2.232729,-1.3662916,9.39327,3.2034888,0.82174385,-3.8604288,-0.059266165,0.23885792,1.2206435,-0.037034295,-1.0659415,-1.2380418,-0.38709572],[-0.63551307,0.14085051,-0.058989003,-0.096907504,-0.08637354,-0.9568107,-0.203569,0.09172185,-1.7067626,0.23453063,0.40079904,-0.33019188,-0.14800894,0.4674501,-0.058009204,-0.3754687,-0.10436635,0.64636946],[0.33742648,-0.36501276,-0.034292817,-0.51860994,-1.3856511,-1.5455489,-1.0439808,-0.75624853,-1.0810176,-0.5734188,0.55518353,-0.80131483,-0.6185672,-0.28676248,-0.104135,-0.62493587,-0.8962451,-1.5516719],[0.43760708,-1.6991494,-0.03338309,-0.96213526,0.00956474,-1.2663416,-1.9227605,-3.5994406,0.26717234,1.618855,-0.69799376,-0.3365453,0.08994935,0.16855639,-2.0510433,-1.3217996,-1.0182589,-0.993361],[0.38308197,-1.8382412,-0.15014274,0.11305897,1.90282,-0.91276294,-1.8583714,-2.2861354,-1.0779126,-2.9923978,-2.1958616,-0.40794706,-0.3506177,0.21085607,0.39614698,0.46702477,-0.1904523,-0.28659886]],"activation":"σ"},{"dense_2_W":[[-0.13722074,0.17729984,-0.24335465,0.24187207,-0.14201832,-0.07732416,0.13892417],[-0.4686111,0.30702016,-0.15520222,0.2413592,-0.06519562,-0.02441734,0.05019473],[0.79214656,-0.7921441,-0.6606072,0.055532016,-0.11311045,-0.08024592,-0.0085274875],[-0.25042439,0.21615438,0.4954985,0.0046605244,-0.4504836,-0.13616334,-0.39802498],[0.49501747,-0.8520829,-0.74666256,0.59406155,-0.3424727,-0.42375195,-0.056689456],[0.09918636,-0.27861944,-0.06896329,0.07916021,0.39362162,-0.3197992,-0.38495535],[-0.44832206,0.775501,-1.5508496,-1.2964923,0.2656348,0.73607206,0.102380335],[-0.12338452,0.45182562,0.15285002,0.36166486,0.106165096,-0.44855922,0.26180896],[1.468655,-2.9420528,1.1340134,-1.8203074,-1.8435699,1.8503501,-0.6241417],[0.11571435,0.44641992,0.5466342,0.460799,0.34136263,0.118771955,0.03079372],[-0.89526504,0.4808293,-0.020656256,0.23367782,0.24296117,0.14677529,-0.17654741],[0.48179916,-0.9906037,-0.5923862,-0.4594782,-0.35988396,0.8058588,-0.045400906],[0.5093772,0.44455037,0.17609815,-0.81010824,-0.7701845,-0.67883664,-0.105422966]],"activation":"σ","dense_2_b":[[-0.016313186],[-0.23423415],[-0.11555125],[0.031153541],[-0.008395348],[-0.05427732],[0.04926095],[-0.03232725],[1.3587319],[0.039414253],[-0.2525624],[0.069728516],[-0.1901692]]},{"dense_3_W":[[-0.40749985,-0.48021835,0.56590366,0.18960631,0.38889936,-0.016490487,0.2452584,-0.49623072,0.38123888,-0.64162004,-0.4950841,-0.28877184,0.033746734],[-0.42167312,0.4292303,-0.117614456,-0.051768117,0.051334534,0.5342065,0.5592815,-0.093919486,0.65363497,-0.43596736,0.16242468,0.2578982,-0.2107315],[0.3909801,0.0338481,0.17298904,-0.6669294,0.66819596,0.5040033,-0.11421765,0.24396016,0.58365494,-0.4551556,0.13173825,0.29966846,-0.28813577]],"activation":"identity","dense_3_b":[[-0.039529935],[-0.049995966],[-0.054298006]]},{"dense_4_W":[[0.5930795,0.46760607,0.73884505]],"dense_4_b":[[-0.046037514]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/CHEVROLET_TRAILBLAZER.json b/selfdrive/car/torque_data/lat_models/CHEVROLET_TRAILBLAZER.json
new file mode 100644
index 000000000..d81339bae
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/CHEVROLET_TRAILBLAZER.json
@@ -0,0 +1 @@
+{"input_std":[[10.263361],[1.5407822],[1.6990757],[0.031916086],[1.4340314],[1.4340314],[1.4340314],[1.4340314],[1.4340314],[1.4340314],[1.4340314],[0.031784274],[0.031784274],[0.031784274],[0.031784274],[0.031784274],[0.031784274],[0.031784274]],"model_test_loss":0.050728149712085724,"input_size":18,"current_date_and_time":"2023-09-28_17-19-10","input_mean":[[21.170568],[0.0028904085],[-0.01997667],[-0.011566885],[0.0088682],[0.0088682],[0.0088682],[0.0088682],[0.0088682],[0.0088682],[0.0088682],[-0.011584887],[-0.011584887],[-0.011584887],[-0.011584887],[-0.011584887],[-0.011584887],[-0.011584887]],"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.8283137],[-0.6380811],[-0.14581172],[0.21757337],[-0.17584349],[-0.15822433],[-0.04526756]],"dense_1_W":[[-0.12061483,-2.6186888,-5.533526,1.2848519,0.10997799,0.09768942,0.29055217,-0.4338942,0.45353734,0.40870407,0.74510694,0.035301626,0.1254258,0.06881082,-0.43392724,-0.6579088,0.12848276,0.10206295],[0.47858974,1.0521514,0.13895132,-0.11845431,-0.6055809,-0.30129787,0.10536316,0.36635193,0.062468443,0.16439146,0.7524098,-0.08773286,0.08453637,0.14768569,0.054678865,0.04296218,-0.1013483,-0.017113626],[1.5098917,0.5894743,0.59322363,-0.40857914,-0.04409986,-0.059111845,-0.22999583,0.13513245,0.20424314,0.8996403,0.6257698,-0.012137316,-0.26447135,0.33300093,0.5780546,0.11556365,-0.21325883,-0.11405065],[-0.09270235,4.2095594,-0.03419901,-0.85176253,-0.792438,-1.1375993,-0.95709634,-0.5417718,0.13269264,0.34799594,0.8776221,0.23166949,0.25684002,0.14214455,0.31949127,-0.1842014,-0.048224565,0.06972774],[-0.07368613,7.987101,-1.5705101,-2.7268257,-1.6060512,-2.2150717,-1.7734491,-1.0044583,-0.9965295,-0.53904784,-0.71252525,0.82295734,0.079120055,0.8620408,0.040507376,0.5511871,0.57866305,-0.3000211],[-0.19393307,1.3685007,-0.81581175,-0.65915656,-0.26665,-0.18225093,-0.2348052,-0.613443,-0.4242962,-0.1411918,-0.40366364,0.14329708,-0.15040468,0.111927874,0.35063627,0.2598781,0.044979107,-0.13300987],[-0.15487364,1.5682242,-0.39758956,-1.613167,-1.2005973,-1.3606614,-1.4602566,-0.8778308,-0.8630755,-1.1338134,-1.5346371,0.44767708,-0.07334435,0.46988532,0.38771385,0.18633042,-0.31606805,0.49087706]],"activation":"σ"},{"dense_2_W":[[0.08773213,1.118686,-0.19026187,-0.18222769,0.05527968,-0.51330656,-0.036496755],[-0.5858637,-0.4254996,0.021144927,-0.08652764,-0.21240492,0.2946317,0.2629631],[0.20821263,-0.6136043,-0.2656985,-0.11885001,-0.23193532,0.573116,0.19101338],[1.3147112,0.8279403,-1.8892661,0.22684072,0.5924725,0.18479976,1.5572529],[0.09764118,0.8507632,0.54017293,-0.14499734,-0.08574703,-0.8551757,0.525648],[-0.63802594,-0.65069646,0.26210403,-0.24471927,0.48373717,-0.2968227,0.06695796],[-2.1634326,-0.6064817,-1.8872,1.6661983,0.24116987,-1.8317598,-1.4297333],[0.030689137,0.045585413,-0.619795,-0.3127205,0.00026456476,-1.2520658,-0.021226548],[-0.43981192,-0.6087822,0.26009014,-0.41205314,0.10397853,0.30045325,0.15389265],[-1.4882747,1.6382228,0.1060073,1.4234135,2.3527496,-1.4529006,-0.6220931],[0.32924128,-0.7916863,-0.16856577,-0.49799073,-0.3400066,0.34466445,0.47758287],[-0.3820367,-0.07035885,-0.770717,-0.08017813,-0.4997505,-0.5413408,-0.22099844],[-0.5534209,0.15586813,0.46922186,-0.285645,-0.43601796,-0.5457336,-0.09376932]],"activation":"σ","dense_2_b":[[-0.07499287],[0.056654293],[-0.033568453],[0.012748798],[-0.16169988],[-0.031001234],[0.4491975],[-0.18781444],[-0.022485357],[-0.4145325],[0.05514316],[-0.17725536],[-0.027867718]]},{"dense_3_W":[[0.48439038,0.11946673,-0.10710485,0.2569157,0.55854136,0.69526154,-0.045092683,-0.22340369,-0.057273377,-0.43256047,0.51690865,-0.45954293,0.5041862],[-0.39225766,0.5658039,0.13191655,-0.26512942,-0.45468462,0.029447814,-0.7955542,-0.47096017,0.19746478,-0.40087095,0.6816974,-0.313998,-0.2719639],[-0.20068921,-0.29952648,0.34961987,-0.66211593,-0.47286674,-0.1865282,0.25309294,0.27628332,0.5233655,0.30510098,0.5197866,-0.51454246,0.46288064]],"activation":"identity","dense_3_b":[[0.055204097],[0.070561714],[0.057622224]]},{"dense_4_W":[[-0.5929016,-1.4001877,-0.6662524]],"dense_4_b":[[-0.06424638]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/CHEVROLET_VOLT.json b/selfdrive/car/torque_data/lat_models/CHEVROLET_VOLT.json
new file mode 100644
index 000000000..881f47c90
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/CHEVROLET_VOLT.json
@@ -0,0 +1 @@
+{"input_std":[[9.342214],[1.5915664],[0.60113484],[0.048193663],[1.5680411],[1.57577],[1.5836853],[1.5711677],[1.5445132],[1.5007596],[1.4529978],[0.047915205],[0.04800539],[0.04808892],[0.04822398],[0.04817677],[0.047881734],[0.047405947]],"model_test_loss":0.019342588260769844,"input_size":18,"current_date_and_time":"2023-08-05_06-09-11","input_mean":[[22.757933],[-0.016342578],[-0.001405228],[-0.014619173],[-0.018091483],[-0.018382493],[-0.019270267],[-0.018759886],[-0.019559544],[-0.017848592],[-0.020014366],[-0.014564899],[-0.01457757],[-0.014600966],[-0.014757987],[-0.014915743],[-0.015121007],[-0.015359475]],"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.045577038],[-2.8160777],[-0.21418032],[2.9552083],[-0.06852827],[0.029141279],[-0.053249933]],"dense_1_W":[[0.0010664682,1.3813498,-8.153277,-0.009101015,-0.1484779,1.0008405,-1.5930991,-1.195274,0.6136762,0.3560462,-0.30077773,0.93531257,0.14550218,-0.40074933,-0.21716364,0.13834935,-0.0658936,-0.49427196],[-0.7338253,-0.037501235,-0.49922377,-1.0526338,-0.46141604,-1.3649396,0.7309814,-0.91667104,0.044683233,-0.18628967,-0.20878822,-0.2678598,0.48446324,0.51164204,0.09547851,0.41491362,-0.4524314,0.16594785],[-0.0032175342,3.5451593,-0.11421584,-0.2511033,0.27893174,0.6384996,0.80790603,1.3835542,1.8000495,2.249461,1.4026878,0.7851167,-0.35052946,0.041820426,-0.39790183,0.45703772,-0.30459648,0.18287674],[0.72289664,-0.77138704,-0.5025135,-0.49323097,-0.39893976,-0.8779149,0.6848096,-0.58729875,-0.16643623,-0.14427555,-0.15013328,-0.11467142,-0.27280045,0.48508415,0.52080667,-0.0029569597,-0.28170735,0.06367212],[0.00014026981,-2.0353239,0.0060915067,0.4794941,1.1882906,-1.512865,0.80642134,-0.26044324,-0.56213886,-0.365122,0.55078083,-0.34897435,-0.32031298,0.46106994,0.37792024,-0.14116105,0.15597256,-0.32811671],[0.0011494387,1.9060265,8.3941965,-0.3078165,-0.9530427,0.6589645,-1.2487054,-0.541133,0.13451256,0.2805466,-0.33187166,0.9900705,0.2821258,-0.51270896,-0.5130031,-0.28222615,0.042734932,0.27233443],[-0.0014444552,-1.0933362,0.003359957,-0.15052961,0.37165833,1.7087307,-1.4971043,0.673802,-0.108465396,-0.088505454,0.21561684,0.6252258,-0.15019403,-0.34727478,0.08958758,-0.1723621,-0.25557828,0.29778987]],"activation":"σ"},{"dense_2_W":[[0.20810607,-0.13481373,-0.15003344,-0.6067625,-0.31937903,-0.37380016,0.4666911],[0.71834767,0.15669753,-0.11389502,0.27131546,-0.060118295,0.039282244,0.52961355],[-0.27200606,0.43380752,-0.106262706,-0.49363258,0.35659012,-0.01706296,-1.0807354],[-0.79583454,-0.66428274,-0.42157334,-0.52979547,-0.2803004,-0.57637554,0.084149174],[0.1230394,-0.57023287,0.28639448,-0.506744,-0.9920808,0.7510901,0.8584937],[-0.41256845,0.35423175,0.13009231,0.5198333,0.7576573,-0.7053181,-0.3390053],[-0.15090485,0.33375353,-0.64164793,0.57386595,0.25700107,-0.15245672,-0.49020413],[-0.50120676,0.5210849,-0.3282951,0.4276323,1.0257447,-1.0398436,-0.8911315],[0.11402861,-0.41491523,0.247507,-0.39776865,-0.6089287,0.20646147,0.6692102],[0.09411492,0.31819808,0.41330767,0.024243973,0.2314893,0.08529045,0.14911193],[0.5179265,0.20473345,-0.36762783,-0.009045922,-0.19436747,-0.548099,-0.08656279],[-0.69121784,-0.14201449,0.3887621,0.10787631,1.0371574,-0.64747447,-0.73437464],[-0.07860244,-0.597764,0.019551078,0.010199122,-0.7493642,0.66619915,0.121666186]],"activation":"σ","dense_2_b":[[-0.04259814],[-0.053309314],[-0.28045595],[-0.23801634],[0.00944943],[-0.109921046],[-0.037457183],[0.24627604],[-0.0069056284],[-0.04725389],[-0.03361769],[0.044101644],[-0.0009850285]]},{"dense_3_W":[[-0.19631335,-0.47722518,-0.019853225,-0.29363275,-0.625923,0.35145283,0.62401354,0.14337404,-0.25707108,-0.51310915,0.2565006,0.61742216,-0.07952821],[0.5868974,-0.36786363,-0.0177682,-0.45121866,0.68608487,-0.55178356,-0.35236016,-0.7226455,-0.015394288,-0.10650332,0.5391039,0.17791761,0.34196886],[0.16821232,-0.35580373,0.26906335,0.41736925,-0.6979869,0.41801625,0.34707317,0.7784011,-0.10002936,0.32485273,-0.3644285,0.49092358,-0.43872768]],"activation":"identity","dense_3_b":[[-0.019481273],[0.031026587],[-0.03595322]]},{"dense_4_W":[[-0.72340566,0.21244061,-0.67248434]],"dense_4_b":[[0.026229527]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/CHRYSLER_PACIFICA_2017_HYBRID.json b/selfdrive/car/torque_data/lat_models/CHRYSLER_PACIFICA_2017_HYBRID.json
new file mode 100644
index 000000000..3f3339df3
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/CHRYSLER_PACIFICA_2017_HYBRID.json
@@ -0,0 +1 @@
+{"input_std":[[8.330973],[0.76358914],[0.44177866],[0.03320337],[0.7486537],[0.75224125],[0.7557512],[0.75438327],[0.7465672],[0.74091655],[0.72914463],[0.0329607],[0.03301792],[0.033070814],[0.03301661],[0.03287754],[0.032609064],[0.032365352]],"model_test_loss":0.017960982397198677,"input_size":18,"current_date_and_time":"2023-08-05_11-13-44","input_mean":[[26.671413],[0.058293253],[0.0043816683],[-0.009296047],[0.051497567],[0.053402483],[0.055134997],[0.052773204],[0.048979968],[0.049683023],[0.049251523],[-0.009440276],[-0.009414148],[-0.0093886675],[-0.009580273],[-0.009747584],[-0.0099527575],[-0.010216651]],"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":[[1.0565631],[-0.21411526],[0.8872178],[-0.73335165],[0.15017867],[-0.11148372],[-0.47569525]],"dense_1_W":[[0.3191545,0.60174775,0.28932345,-0.22362822,-0.29199237,0.8730365,-0.521551,0.33030298,0.11159445,0.13276689,-0.38501248,0.6321162,0.3564933,0.05880718,-0.9028309,-0.1717296,-0.26462427,0.5646279],[-0.023215095,-0.07631244,-6.183804,0.4336958,-0.626333,-0.124013826,0.87823963,0.39341283,-1.2711039,-0.14306393,0.85833305,-0.31328923,-0.0057761483,-0.45113772,-0.13151798,0.48965174,-0.36885157,0.3205572],[-2.0049603,0.2562212,0.0074997903,0.15363267,-0.39047363,0.31743163,0.21375915,-0.08397038,-0.018758992,-0.03530787,0.008622982,-0.12050882,0.1763159,-0.0045240982,0.037064075,-0.22826771,-0.13217667,0.04430793],[1.9245242,0.17275631,0.007043335,0.38269743,-0.0008547418,0.339189,-0.33623248,0.24801533,-0.05911935,-0.28433016,0.1669682,0.35657904,-0.114900894,-0.49049523,-0.009977193,-0.22768717,0.10655727,-0.07729294],[0.087077305,-0.6003964,-0.1793809,0.25290787,0.029625213,-0.19629402,0.31878904,-0.08061085,-0.21837004,0.20829839,0.08959171,-0.30037507,0.05254617,-0.03698672,0.101752795,0.042104118,-0.12350318,0.0102602765],[0.0048545175,-0.21292417,0.016375653,-0.053975366,0.13703452,-1.074619,0.58369935,-0.17510407,-0.09377952,-0.14615338,0.07890737,-0.15442717,0.22381516,0.0459976,0.11773441,-0.018902443,0.06373771,-0.104368865],[-0.09855327,-0.1122513,-0.37817958,-0.008812584,-0.5383468,0.15305355,-0.7411861,-0.4013825,0.30445403,0.2985024,-0.095201105,0.47804987,-0.17235969,-0.47166833,0.08742673,-0.13090365,0.016420232,0.102743514]],"activation":"σ"},{"dense_2_W":[[0.15356968,0.03880223,-0.0033031541,0.71969205,-0.5551066,-1.2770053,0.852479],[-0.5814842,-0.4205401,-0.44136125,-0.20208618,0.62991315,1.2533134,-0.07128404],[-0.85485667,-0.27133262,-0.18317062,-0.5872431,0.0009068991,-0.8143884,0.24185239],[0.485521,-0.12876768,0.13680507,0.5191915,-0.33198348,-1.0602576,0.5135775],[0.9131491,-0.41206366,-0.11229955,0.8287815,0.013217909,-0.9175312,0.48983303],[-0.20012985,-0.18931809,-0.43908978,-0.2832052,0.8635579,0.22567339,0.18861422],[0.018180205,-0.3399698,-0.79971874,0.03282556,-0.17152967,0.065363236,-0.11356214],[-0.90014875,0.04525059,-0.62574875,0.21017492,-0.2622857,-0.64767957,-0.17940037],[0.053192608,-0.6683769,0.5183324,0.3161827,-0.43558958,-0.7137959,0.50653154],[-0.084774315,0.02843045,0.11588221,0.48853788,-0.6368693,-0.9299525,0.7869719],[0.12993711,0.85281557,-0.52333623,0.47304502,0.3320428,0.84226716,-0.51683784],[-0.24643111,0.40814662,-0.45649922,0.021663502,0.7520966,0.5363597,-0.51477396],[-0.30198774,-1.0936731,0.5198244,-0.6298923,-0.47961158,-0.46270132,0.17015655]],"activation":"σ","dense_2_b":[[-0.030014591],[0.112632275],[-0.38837513],[-0.009132882],[0.32848948],[0.05313135],[-0.1084323],[-0.38779393],[-0.17182945],[-0.17182226],[0.08077316],[-0.009312498],[-0.20723443]]},{"dense_3_W":[[-0.7191352,0.82575274,-0.4208178,-0.42105228,-0.12746234,0.6060775,-0.36437324,0.011044404,-0.06605932,-0.23161481,-0.07892281,-0.2586107,0.22741254],[-0.03922699,0.28218865,-0.08608041,-0.49147275,-0.75184256,0.37435916,0.46016482,-0.0026176786,-0.28095058,-0.18674251,0.6548586,0.23019525,-0.66313064],[-0.70486027,0.67592573,0.31197107,-0.25772044,-0.32144958,0.59903663,-0.013240984,-0.097765416,-0.4100128,-0.39269626,0.3077929,0.50466055,-0.20290402]],"activation":"identity","dense_3_b":[[0.06820397],[0.04168449],[0.03600891]]},{"dense_4_W":[[-0.5796537,-0.81390715,-0.64433306]],"dense_4_b":[[-0.04506098]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/CHRYSLER_PACIFICA_2018_HYBRID.json b/selfdrive/car/torque_data/lat_models/CHRYSLER_PACIFICA_2018_HYBRID.json
new file mode 100644
index 000000000..f8074bf93
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/CHRYSLER_PACIFICA_2018_HYBRID.json
@@ -0,0 +1 @@
+{"input_std":[[8.210334],[0.9762297],[0.46461004],[0.04707402],[0.9570847],[0.962571],[0.9688103],[0.9626872],[0.9493875],[0.93438673],[0.91365314],[0.046885576],[0.04696745],[0.047010563],[0.047022652],[0.047106303],[0.047075313],[0.0468335]],"model_test_loss":0.01662263832986355,"input_size":18,"current_date_and_time":"2023-08-05_06-34-39","input_mean":[[24.433825],[0.027294964],[-0.007775845],[-0.008583761],[0.028062655],[0.026877884],[0.025869267],[0.024155349],[0.025895124],[0.02763769],[0.028466335],[-0.00856314],[-0.008589166],[-0.008611988],[-0.008814955],[-0.008984508],[-0.009198656],[-0.009352716]],"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.01408288],[1.6081693],[-0.06155718],[-1.54345],[-0.24193887],[-2.5958166],[-2.5204089]],"dense_1_W":[[0.0027263653,0.8206801,-0.0032928735,0.13611287,-0.076531366,1.5959642,-1.2799904,-0.06996241,0.03039119,0.02152609,0.0963275,0.5368505,0.14871612,-0.3396571,-0.2039869,-0.6619022,-0.039203983,0.4320533],[1.0668212,-0.75284845,0.1227131,0.26535362,0.13527365,-0.2295604,1.1708634,-0.021281645,-0.15021786,0.39643094,0.74283296,-0.3838045,0.003083275,-0.19208938,-0.0017936465,0.703765,-0.092454515,-0.31097198],[0.0027553164,0.7843536,4.634527,-0.26233014,-0.5298467,-0.5220332,-0.74772763,0.2625032,1.8427289,0.32081687,-1.2304753,0.90846735,0.22365782,0.250327,-0.6063961,-0.39930865,-0.18285267,0.079409026],[-1.1514753,-1.0265552,0.13074096,0.38378564,0.7118709,-0.35103342,1.0191414,-0.004307897,-0.1731455,0.13679343,1.0576029,-0.40426365,-0.26618227,0.048847493,0.23475589,0.2227605,0.085375875,-0.30894497],[-0.0047089225,-0.5524328,-0.0045054047,0.66928285,0.064004675,-1.3554454,0.75827724,-0.44520453,-0.070583,0.2953706,-0.17199413,-0.52929235,0.076917104,0.5385476,0.43512538,-0.24582133,0.1710678,-0.17150968],[-0.85862017,0.34829536,0.10180492,-0.16177164,-0.70526654,0.610196,-0.51517403,0.19511817,0.5740542,0.4342128,0.10650083,-0.08206996,-0.14800107,-0.11421001,0.25861365,0.49271822,0.13999887,-0.38721174],[-0.852335,-0.32791263,-0.10090505,-0.21708132,0.70464164,-0.4129493,0.19680835,-0.0039844504,-0.58808166,-0.5447895,-0.055174615,-0.009039755,0.3263737,0.39800122,-0.43388817,-0.2980978,-0.109957084,0.34861532]],"activation":"σ"},{"dense_2_W":[[-0.8770086,-0.024234872,-0.29209283,0.2774463,0.24086247,-0.38808098,0.76261544],[0.7931689,-0.4432339,0.5408512,-0.40607476,0.018381504,0.22573993,-1.2025113],[0.2774073,-0.28390488,0.48924458,-0.10028617,-1.1787524,0.55241233,-0.31903595],[1.187657,-0.90130055,-0.11544119,-0.48425758,-0.5087712,1.5533149,-0.44771603],[0.58252364,-0.7203072,0.46005324,0.2731612,-0.67982006,0.15357131,-0.57816696],[-0.9171702,0.37134174,-0.41417953,0.17179497,0.39356327,-0.10935133,-0.09958233],[-0.66176236,0.14740363,0.07868582,-0.40370503,0.3730389,-0.06752067,0.5966177],[0.057574127,-0.085722245,0.09327541,0.19917345,-0.112103276,0.4723292,-0.71419835],[-0.3262963,-0.03496345,-0.18610413,0.28829092,0.5575449,-0.96931815,0.2509937],[-0.14358501,-0.53553015,0.102502294,0.38049912,-0.011593848,-0.10357873,0.38666174],[1.0979931,-0.5266687,0.011019552,-0.36888388,-0.36552617,0.7437136,-1.0329511],[-0.99298805,0.033587284,-0.0815785,0.2939779,0.17858009,-0.36309564,0.7169502],[0.1916819,-0.3956481,0.23111235,-0.19816011,-0.79406476,0.9587695,-0.5586975]],"activation":"σ","dense_2_b":[[-0.08816166],[0.23371251],[-0.22228523],[-0.015670193],[-0.03642067],[-0.008211963],[-0.17989649],[0.0062512616],[-0.030759228],[-0.15077485],[0.01450626],[-0.07085153],[-0.13338038]]},{"dense_3_W":[[-0.13808444,0.27692232,0.13246109,0.13561308,-0.050800115,-0.3225275,-0.5869831,0.64456654,0.19247706,-0.48861238,0.47843403,-0.009448491,-0.38144258],[-0.18783484,-0.17080472,0.36493075,-0.6014318,-0.6958318,0.33951765,0.06917564,0.34324136,0.5521416,-0.65650636,0.07141213,0.48251265,-0.095275834],[0.67380184,-0.285928,-0.43182224,0.052221615,0.0014595015,0.21199639,-0.06704697,-0.40021017,0.5456471,0.4511299,-0.31108952,0.5755762,-0.41977003]],"activation":"identity","dense_3_b":[[0.05807602],[-0.052454475],[-0.061056226]]},{"dense_4_W":[[0.47078133,-0.7455223,-0.98688024]],"dense_4_b":[[0.054955926]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/CHRYSLER_PACIFICA_2019_HYBRID.json b/selfdrive/car/torque_data/lat_models/CHRYSLER_PACIFICA_2019_HYBRID.json
new file mode 100644
index 000000000..e00c5807e
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/CHRYSLER_PACIFICA_2019_HYBRID.json
@@ -0,0 +1 @@
+{"input_std":[[6.150079],[1.133713],[0.43403986],[0.044542935],[1.116597],[1.1228739],[1.1282343],[1.1087918],[1.0829574],[1.0503302],[1.0201406],[0.044353947],[0.04440376],[0.04444536],[0.044435233],[0.044352584],[0.04415751],[0.04374931]],"model_test_loss":0.021649373695254326,"input_size":18,"current_date_and_time":"2023-08-05_13-22-16","input_mean":[[28.718779],[0.027420705],[-0.0010486431],[-0.006476941],[0.03194379],[0.030714247],[0.029522395],[0.031175172],[0.03329464],[0.03204752],[0.030367676],[-0.006409366],[-0.0064388723],[-0.0064642774],[-0.006523428],[-0.0065177125],[-0.006653054],[-0.0068931]],"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":[[-2.1557553],[0.15239237],[-0.7883996],[0.21607175],[-0.10778271],[-0.110362194],[-0.0008402114]],"dense_1_W":[[-0.39730522,-1.2665217,-0.018751338,-0.36011004,0.06413814,0.13557298,0.675142,-0.58107,-0.71815616,-0.67207223,0.8874161,-0.21224383,0.3109732,0.11582158,-0.10825705,0.20035155,0.13655844,-0.11123461],[0.08248368,-0.9288284,0.006650333,-0.3600497,0.048258215,-0.4385164,0.7812643,-0.36598027,-0.17953908,0.0043003927,0.14774609,-0.2284627,-0.15616533,0.35386756,0.5318769,0.081253365,-0.030911509,-0.12792926],[-0.012793936,-0.95197654,0.0013175827,0.4850853,0.06403457,-0.60757506,1.0891476,-0.15639184,-0.07080147,-0.141186,0.14856425,-0.6297083,-0.09511309,0.13792045,-0.003489132,0.39871147,0.23734719,-0.41034752],[0.036720853,-1.1706092,-0.0117205065,0.22939475,0.06332086,-0.27194244,0.6138069,0.0057003004,-0.23597574,-0.20802614,0.23779614,-0.2707945,-0.065516055,0.16179438,-0.1341947,0.014489582,0.27160132,-0.19034316],[-0.017165367,-0.31984007,-5.1292553,-0.09900438,1.891005,1.522304,1.3964776,-0.27762464,-3.1030765,-1.4986553,0.23631042,-0.58467907,-0.44058293,0.4239101,-0.07130837,0.06697376,0.22419664,0.49982306],[-0.029110994,-0.78375465,0.030992711,0.09522315,-0.32218152,-0.18287186,0.20446928,0.2509469,-0.32046452,-0.69563234,0.43957192,-0.2393486,0.0034883572,0.3692833,-0.1480584,-0.21708085,-0.04099675,0.16072796],[0.011984756,0.4372055,0.00038938643,-0.3804347,-0.14191024,0.83822465,-0.75622463,0.1774374,-0.15122366,-0.08789587,0.1162553,0.36315253,0.019167189,-0.015732778,-0.21518882,-0.17138954,-0.06687768,0.16531232]],"activation":"σ"},{"dense_2_W":[[-0.66123444,0.053167176,-0.67734295,-0.43834037,0.30200854,-0.6062845,0.49393648],[-0.5499434,-0.5910183,-0.04735582,-0.9205705,0.29150906,0.18296994,0.49427703],[-0.3087813,-0.6735604,0.1032743,-0.7492757,-0.47998416,0.38746807,-0.3792903],[0.22218491,-0.37423322,-0.68595016,-0.3057585,-0.67376715,0.18519343,0.26224977],[0.12493204,-0.6740838,-0.48158708,-0.11590075,-0.6646322,0.3766876,0.5211831],[0.033400588,-0.37467673,0.13653982,-0.7425377,-0.58915126,-0.44702393,0.15368707],[-0.03525442,0.6467697,0.27980375,0.53180575,0.5175674,-0.2184231,-1.3612056],[-0.26941165,0.034494866,0.54393685,0.823304,0.91855395,-0.5912671,-0.16972241],[0.5912191,0.50708044,0.8906907,0.4043412,-0.6052221,0.9453074,-0.9854745],[-0.1847966,0.29045746,-0.35760128,0.2358291,0.08363469,-0.28862038,-0.6393691],[0.082734466,-0.20940094,0.1263725,-0.61631376,-0.29357114,-0.22268835,0.48448983],[0.008772746,-0.3295119,-0.77102983,-0.37905028,0.1420826,0.19744958,0.12742513],[-0.34957173,-0.4635609,-0.6658351,-0.074581586,-0.137647,-0.031496365,0.17163728]],"activation":"σ","dense_2_b":[[-0.011190517],[-0.11420608],[-0.11911637],[-0.047058385],[-0.05209559],[-0.0067813573],[-0.6960103],[-0.2218484],[-0.638528],[-0.1287715],[-0.13393182],[-0.13222918],[-0.08612358]]},{"dense_3_W":[[-0.56854904,-0.004440354,0.20522526,-0.5189793,-0.5598319,0.004857475,0.7723675,0.08466752,0.3211879,0.22073807,-0.50451374,0.14052922,-0.15547366],[0.4760816,0.49406376,0.28560668,-0.27424216,0.0395443,0.63189626,-0.5996514,-0.59683996,-0.2216528,0.065270856,-0.40737736,0.13047104,-0.32319623],[0.35351506,0.5386659,0.32769755,0.12265874,0.56839216,0.5655456,-0.034122158,-0.18965866,-0.329834,0.10452169,-0.11418242,0.32698897,0.31875592]],"activation":"identity","dense_3_b":[[0.17258255],[-0.16791473],[-0.16998908]]},{"dense_4_W":[[-0.9664698,0.46322697,0.7462367]],"dense_4_b":[[-0.17601651]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/CHRYSLER_PACIFICA_2020.json b/selfdrive/car/torque_data/lat_models/CHRYSLER_PACIFICA_2020.json
new file mode 100644
index 000000000..555843209
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/CHRYSLER_PACIFICA_2020.json
@@ -0,0 +1 @@
+{"input_std":[[5.693015],[1.1106057],[0.4839505],[0.047381964],[1.0865142],[1.0940344],[1.1007035],[1.0835435],[1.057553],[1.0248959],[0.99939334],[0.047141436],[0.047186267],[0.047211904],[0.04706877],[0.046951234],[0.04684611],[0.04661448]],"model_test_loss":0.013941051438450813,"input_size":18,"current_date_and_time":"2023-08-05_08-16-38","input_mean":[[28.37103],[0.03974344],[-0.014893848],[-0.00037599605],[0.044908416],[0.043708824],[0.042289667],[0.039325528],[0.043006305],[0.04660932],[0.04483933],[-0.00043650295],[-0.0004215664],[-0.0004140165],[-0.0003983723],[-0.00044116066],[-0.00051853625],[-0.00058758573]],"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.1451855],[-0.15737621],[-0.060310073],[0.6073345],[-0.05780308],[-0.16048814],[-0.23519869]],"dense_1_W":[[0.69470924,-0.6133493,0.0012405561,0.019553972,0.06448226,-0.73440015,1.0196836,-0.032631803,-0.21402587,-0.03535706,0.08963821,-0.4151518,0.04951377,0.21540186,0.08403593,0.30007103,0.0721286,-0.21808833],[-0.0055281483,-0.97871476,0.053892706,0.29578617,0.24488142,-0.9456837,0.31968737,0.23062654,-0.3851994,-0.14804605,0.12488454,-0.59180176,0.1747962,0.582284,-0.056728594,0.052842837,-0.25234208,0.08868016],[0.19908331,-0.23178522,-0.00033343132,0.29788065,-0.2630549,-0.9329808,0.9836051,-0.025557669,-0.046352006,0.021415278,-0.10175714,-0.44916221,0.41586125,-0.027728092,-0.11277255,0.28242412,-0.4416653,0.19147082],[0.49298579,0.29445317,0.0024654444,-0.034087177,-0.32976052,0.7320162,-0.13650697,-0.18142147,0.048409745,0.3485382,-0.1782508,0.17317066,0.0046146074,-0.455786,0.23675595,0.17629597,-0.2908207,0.05100971],[0.0025918921,0.60664314,0.08437282,0.0038275314,-0.26773483,0.7368417,-0.8442401,0.35636544,0.09660225,0.06810851,-0.23716143,0.15216075,0.4089829,-0.25967675,-0.5667884,-0.037151016,-0.22253121,0.35003844],[-0.0069139847,0.5928849,5.9585037,-0.2729994,-1.1027155,-0.5361705,-0.39928573,-0.21191321,1.6408015,0.88942456,-0.5805952,0.711463,1.0614796,0.75551856,-0.25333017,-1.0107019,-0.6404496,-0.4423781],[0.77807605,0.4254286,-0.0070603983,0.13885634,-0.11155952,0.92952013,-1.1097448,0.25786868,0.18906161,-0.19558257,0.03620436,0.5284809,0.28771606,-0.39166483,-0.412538,-0.41851315,-0.53765815,0.6955264]],"activation":"σ"},{"dense_2_W":[[0.14673255,-0.25427318,-0.41763714,-0.57974076,-0.56608886,-0.18331228,0.027660826],[-0.22915831,-0.55615884,-0.4508235,0.34225336,0.5593746,0.40537748,0.7960525],[0.21956417,-0.07734256,0.27312982,-0.3854605,-0.08650003,-0.27906924,0.26293612],[-0.77091247,-0.7756027,-0.9580333,0.765381,0.32493275,-0.51463944,0.7389473],[0.5907749,0.26036587,0.5915251,0.1214773,-0.029054264,-0.13793655,-0.038385104],[0.2536978,-0.44341302,0.088218234,-0.07722079,-0.69654363,-0.04497505,-0.37380072],[0.1492596,0.50270057,0.46113217,0.08208802,-0.44300494,-0.049104072,-0.38107514],[-0.033503003,0.31365246,-0.23077266,-0.51006895,0.10363347,-0.780032,-0.6072311],[0.19008167,0.41587985,0.41156146,-0.36104697,-0.25369507,-0.020715002,0.101388365],[-0.12538931,-0.93145704,-0.38526508,0.757801,0.4460356,0.22134012,0.059445396],[-0.010972688,-0.04331066,-0.5205074,-0.61291635,-0.38937822,-0.5410802,-0.776376],[-2.1453147,-0.70847136,-1.2064056,-0.31943244,0.13231355,1.2215211,-0.11054935],[-0.57651573,-0.17007175,-0.34664136,0.4060285,0.8317285,0.13207953,0.11835387]],"activation":"σ","dense_2_b":[[-0.10427355],[0.11536775],[-0.10146174],[0.08055071],[-0.1175017],[-0.09294055],[-0.12414659],[-0.12894793],[-0.122823305],[-0.0023050748],[-0.09449869],[-0.25891626],[0.0091852965]]},{"dense_3_W":[[0.018232554,0.26810202,0.2565264,0.30350316,0.51860917,0.3029135,0.5572722,0.37361154,0.45107833,-0.48839125,0.3939663,-0.0054893196,0.054042112],[0.4726983,-0.7600223,-0.2362871,-0.7305271,0.3979434,-0.16793822,0.08976205,-0.10595847,-0.5852833,-0.20750386,-0.19634347,-0.16581649,-0.49387524],[0.102563694,-0.77121973,0.49441037,-0.74888134,0.4121642,0.45769525,-0.36120865,0.5654234,0.5058435,0.45810163,0.20354177,-0.564163,-0.42752033]],"activation":"identity","dense_3_b":[[-0.09124249],[-0.07674238],[-0.08837357]]},{"dense_4_W":[[-0.9619778,-0.7475,-0.82428706]],"dense_4_b":[[0.088022344]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/GENESIS_G70.json b/selfdrive/car/torque_data/lat_models/GENESIS_G70.json
new file mode 100644
index 000000000..3e3f833b7
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/GENESIS_G70.json
@@ -0,0 +1 @@
+{"input_std":[[6.6771574],[0.8306398],[0.44399694],[0.03148828],[0.82453376],[0.82558274],[0.8276523],[0.8249276],[0.82540375],[0.8268513],[0.8293405],[0.031258367],[0.031317297],[0.031381857],[0.031565305],[0.031729955],[0.031927522],[0.031937882]],"model_test_loss":0.0016914892476052046,"input_size":18,"current_date_and_time":"2023-08-05_15-54-16","input_mean":[[25.397608],[0.061366253],[-0.004759293],[-0.017377611],[0.063574664],[0.0629952],[0.06279838],[0.06257633],[0.0642723],[0.06428019],[0.06443743],[-0.017316736],[-0.01732337],[-0.017324336],[-0.017258912],[-0.017273892],[-0.01738509],[-0.017547127]],"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.5071787],[-0.011610117],[-0.25543153],[-0.2288577],[0.3640026],[-0.20951404],[-0.018084347]],"dense_1_W":[[-0.32076025,0.5609776,0.06455551,0.4650965,-0.3128346,0.29808214,-0.068447836,-0.080615535,-0.1533624,0.086725675,0.0019198896,0.38526085,-0.33096933,-0.4344235,-0.24709408,-0.21656084,0.12910959,0.10089391],[-0.013731939,-0.37048897,1.5160967,1.216611,-0.026065614,-0.012039334,-1.7950301,-0.6103514,1.727483,2.0623763,-0.9575297,0.39149958,-0.218174,-0.51533777,-0.76304054,-0.3384101,-0.10145121,0.34581316],[0.014144666,0.22945884,-0.45639136,0.08440587,-0.19207898,-0.5290964,0.54655564,-0.07094287,-0.41206077,-0.23082434,0.77867293,-0.83082336,-0.31685916,0.3376802,0.18800995,0.28112486,0.5808552,0.0882255],[0.55997515,-0.45515752,-0.3620537,-0.21491247,-0.12751056,0.6437451,0.4513876,0.14484537,-0.012545343,-0.70398337,-0.03420965,0.5712778,-0.34471962,0.2639977,0.15245198,-0.09942475,-0.52654004,-0.39195266],[0.16048487,-2.0932982,0.060834095,-0.43821463,-0.12897933,0.8929607,0.08955616,1.5023427,0.47960326,-0.24697156,-0.2284945,0.3664966,0.36733755,-0.70950145,0.25744,0.16433853,-0.4799496,0.3186391],[0.0031760861,-0.32184288,-0.033980735,-0.4582301,-0.07663507,-0.7593102,0.50883085,0.22713356,-0.20064494,0.3521629,-0.22366937,-0.07778892,-0.2534047,0.56217426,0.41395634,-0.12142341,-0.0027042534,0.03405264],[-0.0017348339,-0.29796287,0.062474936,-0.11221718,-0.23059554,-0.626899,0.10690498,0.5434746,-0.05614545,-0.061325278,-0.2274304,0.29413497,-0.38511482,0.10846904,-0.15861528,0.35446325,-0.38156375,0.18584998]],"activation":"σ"},{"dense_2_W":[[0.08477807,-0.35302192,-0.40779448,-0.5867174,0.13918135,-0.6664157,-0.3491646],[0.3792094,-0.030590685,-0.21691003,0.13814875,-0.22226094,-0.66838443,0.11945859],[0.114434734,0.3219143,-0.65471864,-0.5160347,-0.10297699,-0.546052,0.23859331],[0.4386374,-0.13452144,-0.0146616185,0.408655,0.29078993,-0.45133266,-0.6718732],[0.04953622,-0.309141,-0.028895855,-0.081540965,-0.04211146,0.19563156,0.1549496],[-0.07437576,0.18886302,-0.11578516,-0.02629349,0.5117754,-0.8601534,-0.27231035],[0.07671942,0.0293902,-0.5813721,0.3454169,-0.053973634,0.046247624,-0.35544363],[0.22220099,-0.53176254,0.49601117,0.16283734,-0.41594207,0.14338993,-0.23063558],[0.50082463,0.3444267,-0.5869549,0.31520668,0.3332609,-0.5623406,0.0112578],[-0.05211133,-0.24212956,-0.37504154,-0.24755752,-0.61364114,0.61201805,0.5261763],[0.16144137,-0.5551527,-0.27000764,0.48719284,-0.20183928,0.4279106,0.5559925],[-0.38015607,-0.17513199,0.0054852753,0.49040842,-0.5847223,-0.315286,0.41083756],[0.027273893,0.37111732,-0.29921013,0.35153958,0.6107227,0.058014646,-0.48178723]],"activation":"σ","dense_2_b":[[-0.13192527],[-0.11472918],[-0.2398955],[-0.012978796],[-0.24606323],[-0.16946991],[-0.09656156],[-0.011122704],[-0.13971844],[0.025623204],[-0.01150639],[0.031865247],[-0.14259984]]},{"dense_3_W":[[-0.49097103,-0.38446474,0.19654791,-0.04500209,-0.353884,-0.59052265,-0.26697198,0.25850582,-0.4691939,-0.3658384,0.49351692,-0.21503085,0.43769556],[-0.49650973,-0.24257205,0.27875185,0.056984637,-0.084106766,0.21747197,-0.14523055,-0.062517725,-0.12865941,-0.4967132,-0.47404718,-0.39828455,0.20428851],[0.51754504,0.44354475,-0.12756172,0.60820955,-0.16570193,-0.24837321,0.3779718,-0.12072089,0.33560675,-0.29205063,0.42597872,-0.57351613,0.275068]],"activation":"identity","dense_3_b":[[0.03487869],[-0.013982357],[-0.02665594]]},{"dense_4_W":[[-0.40196383,0.97064435,0.88333386]],"dense_4_b":[[-0.019127952]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/GENESIS_GV60_EV_1ST_GEN.json b/selfdrive/car/torque_data/lat_models/GENESIS_GV60_EV_1ST_GEN.json
new file mode 100644
index 000000000..8d39b0612
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/GENESIS_GV60_EV_1ST_GEN.json
@@ -0,0 +1 @@
+{"input_std":[[6.8682947],[1.3247597],[0.52117354],[0.053211],[1.3196762],[1.321261],[1.3220409],[1.3065661],[1.2855599],[1.2555516],[1.221194],[0.05287544],[0.052969508],[0.053053025],[0.053157352],[0.05310392],[0.052811027],[0.052315235]],"model_test_loss":0.004652302712202072,"input_size":18,"current_date_and_time":"2023-08-05_17-08-23","input_mean":[[25.097141],[0.030100366],[0.008127931],[0.0017367124],[0.025092127],[0.026649075],[0.027925659],[0.031518627],[0.031421654],[0.03279364],[0.028935509],[0.0016365603],[0.0016674129],[0.0016875914],[0.001713633],[0.0017992958],[0.0018609823],[0.0017497891]],"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.01906636],[-0.026147846],[-0.06956214],[-0.12893584],[3.3396657],[-0.11347563],[3.4662268]],"dense_1_W":[[0.0016520686,0.43010652,-0.016737647,-0.5847046,0.42132026,0.6080183,-0.36023164,0.04929399,-0.05639926,0.055730373,0.07496767,0.40559384,0.5495037,-0.78057534,-0.3052922,-0.4512687,-0.15058433,0.049945023],[0.0036362763,0.904483,0.001981453,-0.33253717,0.25831643,0.7194124,-0.29999894,-0.4751608,-0.22190008,0.22535524,0.18900982,-0.04392861,0.30455038,-0.40629083,0.551194,0.3208965,0.2746982,-0.6420702],[-0.0013973061,-1.2801182,-4.660272,-0.2299565,0.5036499,1.121957,0.6687826,0.08227576,-0.87890655,-0.816766,0.5726014,-0.48010656,-0.7163965,0.08434925,0.26663804,0.6864054,0.38185596,-0.08777598],[-0.024978189,0.45179686,-0.43001783,-0.19626012,-0.145855,0.3520434,-0.9694731,0.11912776,-0.069412105,-0.65245837,0.3938456,0.88234675,0.2711265,-0.09912691,-0.12296636,0.14305602,-0.12646228,0.12271214],[0.6889864,-1.4383845,-0.5985031,0.43910387,-0.14574279,-0.5830182,0.28500378,-0.18694921,-0.5173389,-0.15667093,0.1595579,-0.3700834,0.11795122,0.28467125,-0.20037529,0.44890952,-0.43353197,0.15507948],[-0.016126553,-0.5084034,-0.3446227,0.13306846,0.16979276,-0.6851119,0.97122914,-0.11992911,-0.38304567,-0.3581892,0.4410937,-0.085785575,-0.17046288,0.43981537,0.31712607,0.29649833,0.20096925,-0.42831364],[0.70960057,1.176625,0.618315,-0.35273266,0.50546986,0.41693547,-0.30839127,0.19819334,0.5911515,0.2822198,-0.22344977,0.06145853,-0.052926417,0.008550686,-0.02682976,-0.34092346,0.41492197,-0.16889408]],"activation":"σ"},{"dense_2_W":[[0.3105403,-0.13943449,-0.5671977,0.7278831,-0.9538581,-0.53992945,0.2537109],[0.25039518,-0.19284537,-0.33849826,0.19139016,-0.13403177,-0.07362739,-0.71186584],[0.077256136,-0.6989092,-0.236067,-0.53454214,0.4003753,0.3068613,-0.50189966],[-0.3387507,0.08022835,-0.13841416,-0.21556431,-0.16097516,0.82565576,-1.0068827],[-0.5129783,-0.64633214,0.6501237,-0.31724972,-0.41725558,0.6616404,-0.8662519],[0.4270751,0.67877465,-0.30108768,-0.16842516,-0.82080853,-0.8198072,-0.14678568],[0.42951444,0.47302562,-0.59648263,0.50122297,-0.4004039,-0.8508191,-0.5640101],[0.31044075,0.4447596,-0.0133176055,0.39672032,-0.13207492,-0.1053544,0.3750294],[-0.49185774,-0.6246744,0.2108288,0.036430668,-0.19068871,-0.684725,-0.5135398],[0.6451895,0.15162985,0.35664967,0.539209,0.24193677,-0.0060984846,-0.38601643],[0.33735067,0.48711634,0.3457868,0.40235066,-0.5442683,-0.8894964,0.083602294],[0.6303491,0.47514284,-0.25302443,0.048399102,-0.6309426,0.071017355,-0.42443976],[-0.028995385,0.6780545,-0.48130322,-0.10078704,-0.35888222,-0.038346574,0.21966858]],"activation":"σ","dense_2_b":[[-0.16421281],[-0.0066147824],[0.2712916],[-0.037723377],[0.009121119],[-0.24584663],[-0.17050697],[-0.28670987],[-0.15715508],[-0.09428354],[-0.21343407],[-0.17752221],[-0.17326371]]},{"dense_3_W":[[0.39673528,0.5029898,-0.77688295,-0.20485383,-0.69867265,0.52573097,0.5760262,-0.057309195,0.38914645,0.11605935,0.3120174,0.22832489,0.5434368],[0.49983713,0.12314057,-0.23971559,-0.29951656,0.01370866,0.3070287,-0.101687245,0.34138146,-0.15633298,-0.5573778,0.6135126,-0.24733001,-0.3987656],[0.041431323,-0.5985834,-0.5442451,-0.052750558,-0.7950125,-0.18662111,0.56161785,0.04896858,-0.3108859,0.44375634,-0.21281773,0.40877533,0.062354703]],"activation":"identity","dense_3_b":[[-0.08339912],[-0.0697586],[-0.070846304]]},{"dense_4_W":[[0.82060516,0.39197603,1.0617381]],"dense_4_b":[[-0.07490547]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/GENESIS_GV70_1ST_GEN.json b/selfdrive/car/torque_data/lat_models/GENESIS_GV70_1ST_GEN.json
new file mode 100644
index 000000000..66e4c7dda
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/GENESIS_GV70_1ST_GEN.json
@@ -0,0 +1 @@
+{"input_std":[[10.192138],[1.2619681],[0.99538904],[0.03173082],[1.390097],[1.3528733],[1.3105861],[1.0981697],[0.9660985],[0.83304054],[0.73382217],[0.031833883],[0.031806096],[0.03176805],[0.031585068],[0.031403936],[0.031049846],[0.03052816]],"model_test_loss":0.08113811910152435,"input_size":18,"current_date_and_time":"2023-09-01_15-46-16","input_mean":[[17.870602],[0.06094058],[0.76994574],[-0.018258877],[0.07383096],[0.06954971],[0.06553388],[0.045131978],[0.034243006],[0.017750643],[0.0021489365],[-0.018112624],[-0.018160766],[-0.018217338],[-0.018421978],[-0.018636575],[-0.018845296],[-0.019152297]],"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.60173887],[-1.2184482],[-2.5489855],[-0.13953118],[0.6530774],[-1.9541978],[0.6348104]],"dense_1_W":[[0.9151844,-0.69396037,-0.0015744013,0.13417375,0.47273952,0.053828586,-0.2703337,-0.06767218,-0.06996197,0.33860308,0.6809081,0.062160317,0.20090835,-0.39224413,0.20620485,-0.011424855,0.16862637,-0.2757232],[0.28972548,-0.02519699,-0.0015914065,0.16588296,0.18867342,0.054137114,0.08766244,-0.10144043,-0.00023482303,0.035658572,0.3292638,0.025065169,0.02802059,0.040422786,-0.28468195,0.014785016,-0.040343814,0.020054903],[-0.88864183,0.81139094,0.005142466,0.07717855,-0.3736464,-0.48089615,-0.33839747,0.72515595,-0.20632601,0.2192427,0.6845602,0.045920767,-0.0058251703,-0.10204114,0.0328523,0.1720919,0.22784986,-0.39458126],[0.04597544,-0.5142907,-0.039751884,-0.1760501,-2.0647182,-2.079671,-1.7764702,2.893614,2.1160357,0.62820613,-0.58175343,0.13933943,-0.07837348,0.2579554,-0.21817936,0.058899857,0.0867017,-0.2388197],[1.008347,0.6241744,0.0006175654,0.24427246,0.3880548,-0.71216303,-0.08657326,0.43654963,-0.002103242,-0.35102853,-0.72472453,-0.14762312,0.058478996,-0.27061918,0.08358053,-0.05671504,-0.39794087,0.38000095],[-0.75398517,-0.31240758,-0.0035077638,0.042402916,0.03954997,0.38596287,0.3007671,-0.71371967,0.24568759,-0.18542135,-0.63920254,0.012125213,-0.13132948,0.1092853,-0.09679227,-0.19704841,-0.06888792,0.28378332],[-0.2624838,0.19304885,-0.0020451967,-0.42735267,0.5025606,0.020195944,-0.100870304,-0.38624248,-0.1858948,0.15579382,0.32803276,0.24784385,0.31001303,-0.23803873,0.1500903,-0.2607993,0.30487004,-0.11202888]],"activation":"σ"},{"dense_2_W":[[-1.2400194,0.17729802,1.6934681,0.7075426,-0.11226228,-0.83732116,0.33559176],[0.5745533,-0.80457217,-0.6967583,0.08430375,-0.5941207,0.6564719,-0.70027584],[0.013842665,-1.1106777,0.12004836,-0.7758639,-0.7202531,2.1383853,-0.26417783],[0.53778696,-0.9851601,-0.16901778,-0.63449734,-0.5228541,1.452694,-0.5041905],[-0.5252082,0.9113041,0.96822953,-0.2888941,0.19632195,-0.06139024,0.23265024],[0.8556627,-0.5657162,-0.92154366,-0.028895194,-0.5141267,0.72371626,-0.751295],[0.75094503,-0.17778125,-0.7352838,-0.43035126,-0.514307,0.9411462,-0.9285261],[-0.23282954,-0.20877087,-0.41192415,-0.89742875,-1.3174541,-0.15595351,-0.15537289],[-0.7422097,0.3961414,0.3959817,-0.16982703,0.80190444,-0.8246868,1.0364479],[0.84093606,-0.5901947,-0.6232177,-0.35342738,-0.49815804,1.1040002,-0.95394325],[-0.97321624,1.2088536,0.85022783,0.002327647,0.43647796,-0.4797704,0.095545724],[-0.75402004,0.8438213,0.258789,0.092278235,0.5893333,-1.1115283,0.98487294],[0.4652842,-1.1645225,-0.80774826,0.1144249,-0.14423822,0.46821204,-0.4388547]],"activation":"σ","dense_2_b":[[-0.29847553],[0.11241894],[-0.03942593],[-0.045420405],[-0.1453599],[-0.002497385],[0.035479035],[-0.20913747],[-0.13740407],[0.07032733],[-0.21931723],[-0.09019325],[-0.07747503]]},{"dense_3_W":[[-0.3440359,0.13350633,-0.2793149,0.06343626,0.46869245,0.35055122,-0.29592252,0.56705844,-0.35353094,-0.16574235,-0.4968441,0.23517826,0.2515689],[0.034386467,-0.9523351,-0.6150173,-0.43728954,0.3108096,-0.14083374,-0.5916635,-0.62779754,0.5980072,-0.72700554,0.7860504,0.84748363,-0.5247365],[0.67116046,-0.74161327,-0.18781546,-0.6720034,0.46030635,-0.91020125,-0.81438667,0.05195494,0.5849977,-0.87362975,0.42857662,0.74513984,-0.15408307]],"activation":"identity","dense_3_b":[[0.08475188],[0.005057218],[0.099355556]]},{"dense_4_W":[[-0.005187234,0.74306834,1.0122273]],"dense_4_b":[[0.092436805]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/GMC_ACADIA.json b/selfdrive/car/torque_data/lat_models/GMC_ACADIA.json
new file mode 100644
index 000000000..419f3b62e
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/GMC_ACADIA.json
@@ -0,0 +1 @@
+{"input_std":[[9.589161],[1.6526152],[1.0296179],[0.04015747],[1.6503558],[1.6541231],[1.6558622],[1.6062601],[1.5521498],[1.4774255],[1.3901185],[0.04013376],[0.040141042],[0.040149838],[0.04013493],[0.040134083],[0.040017467],[0.03965995]],"model_test_loss":0.07666975259780884,"input_size":18,"current_date_and_time":"2023-09-01_17-07-09","input_mean":[[19.16097],[0.00023039858],[0.024997516],[0.0015251928],[-0.006199064],[-0.00511049],[-0.0036440035],[0.008816405],[0.013828324],[0.023007024],[0.03203006],[0.001499254],[0.0015097901],[0.0015188308],[0.0013762622],[0.0012122631],[0.000992458],[0.00083205965]],"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":[[-1.8661245],[-1.5837955],[0.037068017],[0.004549992],[-0.0406839],[-3.848253],[-0.14788117]],"dense_1_W":[[1.2300965,2.5310688,-0.033882245,0.9913731,-1.4768931,-0.7604761,-0.016176367,1.7826718,0.97190374,-0.3524215,-0.12235129,0.7071725,0.08818652,-0.7926816,-1.0068728,-1.0829469,-0.41093853,0.41296145],[1.0410483,-2.4898872,0.031385656,-0.8418668,1.7300308,0.6604722,-0.22182828,-1.4516648,-0.7956896,-0.0052562924,0.3286437,-0.90743065,0.20010695,0.67364526,0.8678244,0.9458278,0.45917323,-0.4489016],[0.0042952006,-3.7682223,0.03752664,4.481959,-0.025753722,0.30079904,-0.80541074,-0.8990208,-2.967934,0.3142363,-2.034866,-0.29074013,-0.10882145,-1.6433034,-2.345314,0.3792549,0.5183762,-0.3828322],[0.0351331,0.4335407,-0.72822434,-1.1574517,0.33417597,-0.78198606,-1.2777231,0.73203385,0.5243073,0.3935317,1.6471862,-0.66806847,-1.2980176,-0.995225,0.578557,1.5086068,1.178342,0.093525246],[-0.034333024,0.2399623,0.7163214,0.4258642,0.051805,-0.27961543,0.13171966,-0.043525357,-0.11124441,0.7758175,-2.7231858,1.9812765,0.95424885,-0.516098,-0.3156276,-0.42034206,-0.43856654,-0.9159853],[-3.23608,0.62202907,-0.93510664,-0.31767273,-2.2818325,-0.97344154,-0.47527224,0.8959574,-0.07933676,-1.693229,0.29464307,1.5444574,0.3701407,-0.7764469,0.8500272,1.3425361,-1.7767322,-2.944946],[0.006447974,0.48928446,0.5253896,0.9540034,1.3740003,0.38989055,-0.19158112,-0.6142965,-1.4193783,-0.640289,2.1344078,-0.42348352,-0.5467218,0.13846552,-0.060432374,-0.4456313,0.39513004,-0.17451167]],"activation":"σ"},{"dense_2_W":[[0.75902075,1.1818918,0.018134926,-0.23670888,0.58994615,-0.3951398,1.2811865],[-0.08184867,0.43210924,0.42716455,-0.7389914,-0.42377943,0.07209329,0.11910895],[0.31956765,-0.7480974,-0.19422513,-0.552509,0.07628548,0.6062507,-0.7245184],[0.44447437,-0.041922443,0.13054374,0.43873626,0.6574541,-0.19836801,0.14220871],[-0.0037564328,-0.023460802,-0.6449217,0.5678689,0.5152597,-0.3669055,0.08844841],[0.409556,-0.89736575,0.58308125,-0.16765638,-0.2244067,-0.19765973,-0.13677762],[-2.7548218,3.2813652,1.3716445,-0.96946454,-0.47919014,0.23553993,-0.7080141],[-1.617764,-1.0463123,-0.82542264,0.027710665,0.9964338,-0.6431054,0.35499138],[0.742922,-0.4490962,-0.4472653,0.3055844,-0.051618654,0.53054106,0.6369738],[0.5263451,0.72935253,-1.4179851,-0.7053557,0.10821838,-1.4098617,0.006451496],[-0.32364398,0.039208733,0.77577096,-0.9521098,-1.4651095,-0.26427552,-0.2297292],[-0.5094321,-0.17350426,-0.05012927,-0.42607546,-0.0424127,-0.1761333,-0.87716746],[-0.07377011,-0.38419786,-0.05855057,-0.5455437,-0.9797012,-0.30153883,0.23297796]],"activation":"σ","dense_2_b":[[0.28105608],[0.062468283],[-0.008618305],[-0.010698113],[-0.022834778],[-0.19800517],[0.1661619],[-0.59834546],[0.022396281],[-0.39137623],[0.30498576],[-0.03527624],[0.02751272]]},{"dense_3_W":[[-0.0075695775,-0.27568746,0.09120304,-0.3263692,-0.4094352,-0.0785218,0.37749985,-0.3643959,0.5081887,-0.34113538,0.13756286,-0.17055227,0.43868554],[0.25493667,-0.3818253,-0.41074437,0.32864282,0.3402426,-0.13885908,-0.5030987,0.19186679,0.65157133,-0.14876194,-0.5428901,-0.08314285,-0.57639486],[0.57302797,-0.51000684,-0.18249922,-0.07923711,0.3147604,-0.16800596,-0.7434311,0.7116399,0.39529055,-0.40308496,0.15564886,-0.41269818,-0.55772877]],"activation":"identity","dense_3_b":[[0.033527393],[0.026104666],[0.027110972]]},{"dense_4_W":[[-0.087499,1.1460565,0.99249434]],"dense_4_b":[[0.025334533]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HONDA_ACCORD.json b/selfdrive/car/torque_data/lat_models/HONDA_ACCORD.json
new file mode 100644
index 000000000..bb7963bab
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HONDA_ACCORD.json
@@ -0,0 +1 @@
+{"input_std":[[9.558472],[1.1135993],[0.35501274],[0.045823593],[1.1077218],[1.1080649],[1.1080468],[1.0821772],[1.0575596],[1.0226434],[0.98659563],[0.045627955],[0.045635287],[0.04563911],[0.045467082],[0.045263745],[0.04491611],[0.044533264]],"model_test_loss":0.039052750915288925,"input_size":18,"current_date_and_time":"2023-08-05_18-06-12","input_mean":[[26.136148],[0.014033704],[0.008476357],[-0.007713262],[0.014445406],[0.015386044],[0.016355403],[0.020506991],[0.024135882],[0.026870549],[0.02935421],[-0.007780166],[-0.007770314],[-0.0077639683],[-0.0077210055],[-0.007739751],[-0.007798479],[-0.00789042]],"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.1487079],[4.2139845],[-0.5853092],[0.3086539],[0.032987785],[-4.7810106],[0.016952101]],"dense_1_W":[[0.033758555,1.0444518,3.6611536,-0.40075377,0.7095827,1.3611814,-2.1352289,0.96489286,1.8126475,-0.62583995,-1.966803,-0.1734821,0.15852115,-0.3967776,-0.14440706,0.8157315,0.17390618,-0.23260796],[2.1500878,-0.45053038,1.2581933,-0.05246604,0.5019536,1.7019817,-1.8193591,1.3068173,1.0780432,0.6126558,-1.1160796,0.19838658,-0.084695324,-1.2091074,0.5595109,0.74877197,0.30207658,-0.6453137],[0.458296,-0.21370786,0.0019734737,-0.30963984,0.8088786,-1.7420303,0.60466176,0.14915113,-0.12689793,0.052364115,-0.042618364,-0.5170238,0.26220888,0.18760274,0.37973043,0.15806,0.0022146539,-0.07045257],[-0.66763306,-0.4096175,-0.0016955894,0.04425929,0.21008201,-1.7331837,0.9467672,0.58569306,0.23827136,-0.2415081,-0.15301658,-0.28669143,-0.2599793,-0.11007419,0.6052918,0.17952923,0.24594603,-0.31397706],[1.0145541,-0.3317505,-1.4991609,0.013690285,-0.9575213,-1.383604,0.028956244,0.41788918,0.24457058,-0.094164655,-0.13030116,0.17948826,-0.03794582,0.01309437,0.35534826,-0.26917398,-0.29215142,0.27303904],[-2.7000756,0.31637338,1.4000112,0.08876083,0.6678543,0.9836755,-1.5750684,1.1129849,0.9943397,0.5684742,-1.1145275,0.5888766,-0.13174123,-0.9658693,-0.413828,0.7263344,0.11292254,-0.23350726],[-0.12401558,5.324601,7.171819,-0.19341947,2.5473533,3.2746146,3.0563648,3.367963,2.8771386,2.6749191,2.9917984,-0.14726077,-0.13394955,-0.76174796,1.426001,1.2234408,-0.7090158,-0.6628128]],"activation":"σ"},{"dense_2_W":[[0.5621434,0.992517,-0.6983796,-0.91716,-0.054338105,0.607339,0.45212823],[0.22474639,0.22895367,0.6111215,0.046989255,-0.030409865,-0.61481434,0.10029722],[0.16454774,-0.29756203,1.1110828,0.59235257,-0.18411039,-0.6023632,-0.23720202],[-0.3528499,-0.6570399,0.49941105,0.47395417,0.27583507,0.08116056,0.20804141],[0.07139761,-0.070093624,0.5590774,0.7634218,-0.49971566,0.5975401,0.7334796],[0.44444433,1.8885437,0.35532534,-0.82639766,1.279296,-0.86160696,2.6706583],[0.44448185,-0.24610248,-2.495731,-0.89490926,0.11747124,0.62402964,0.5182057],[0.23551048,0.42742857,-0.5775537,-0.6272091,-0.27731383,-0.09396491,-0.51651603],[0.42865852,0.32447976,-0.29923168,0.340756,0.013832209,0.41082326,0.21667421],[-0.32736444,0.4769656,0.977129,0.5856738,0.10249221,-0.54967755,-0.2428743],[0.25369433,-0.2204579,-1.0649059,-0.2733619,-0.049029216,0.4437149,-0.11450898],[-0.24868779,0.44613084,-0.27166238,0.5614397,0.5230158,-0.24676293,0.17946567],[-0.2634003,-0.48613355,-0.04385666,-0.65893304,-0.30746424,0.15454659,-0.53632504]],"activation":"σ","dense_2_b":[[0.19822486],[0.017528722],[-0.010497578],[-0.06445187],[-0.039755665],[0.17356244],[0.025937805],[0.023149397],[0.002431535],[0.006409766],[0.0033689209],[-0.057484128],[-0.2775116]]},{"dense_3_W":[[-0.647888,0.20968881,0.6033078,0.67215437,0.20472567,-0.14839841,0.13453817,-0.14604588,0.00843544,0.2830037,-0.54673946,0.60688186,-0.4934583],[-0.18505706,0.2708935,-0.37541804,-0.3327015,-0.14934263,-0.59043384,-0.5975454,-0.34455526,0.34356502,-0.1237087,0.032155972,-0.11825379,0.032004077],[-0.12307207,-0.14105205,-0.69863325,-0.65025413,-0.45728275,0.5245935,0.46122637,0.372422,0.2177389,-0.6267706,0.32869118,0.34049797,-0.5515101]],"activation":"identity","dense_3_b":[[0.028380467],[0.04344171],[-0.028022127]]},{"dense_4_W":[[-1.151408,-1.0946046,0.9045305]],"dense_4_b":[[-0.033447456]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HONDA_CIVIC.json b/selfdrive/car/torque_data/lat_models/HONDA_CIVIC.json
new file mode 100644
index 000000000..debdaaf7d
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HONDA_CIVIC.json
@@ -0,0 +1 @@
+{"input_std":[[8.880729],[1.3764424],[0.4036752],[0.044919465],[1.357929],[1.3648189],[1.3701559],[1.3636794],[1.3427843],[1.3031353],[1.2558507],[0.044844456],[0.04486737],[0.044886783],[0.044833656],[0.044710048],[0.04439941],[0.044009637]],"model_test_loss":0.03750712797045708,"input_size":18,"current_date_and_time":"2023-08-06_03-39-56","input_mean":[[23.76268],[0.025191484],[-0.0054714084],[-0.010682941],[0.027966013],[0.026647689],[0.025542766],[0.022714077],[0.020973299],[0.023003811],[0.02802845],[-0.010661417],[-0.010671549],[-0.010681824],[-0.0107730925],[-0.010828986],[-0.010959005],[-0.011070088]],"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":[[4.5776205],[-0.23610623],[0.105955176],[0.07035416],[-0.44049412],[-4.875287],[0.95284677]],"dense_1_W":[[2.6162603,0.96552926,-1.1709021,0.68316555,-0.83422256,-1.2780359,0.2215925,-0.363209,0.3182224,0.050232545,-0.16977811,0.15275992,0.01305875,-0.24862735,-0.3824611,-0.32907623,-0.08854755,0.29336992],[-0.033986192,-0.4997676,-3.4389174,0.7424149,0.664207,0.14749247,0.5930936,-0.7861187,-1.5643623,-0.66575646,1.7639327,-0.63187826,-0.30908775,0.22797343,0.36383292,-0.43728524,-0.08584815,0.0859059],[-0.399227,0.95630413,-0.00024232137,-0.15680003,-0.657746,0.88117325,-0.28739563,-0.40365663,0.13200954,0.17651056,-0.119062886,0.5858267,-0.21834603,-0.06490571,-0.011869801,-0.46006832,0.055071417,0.16692579],[-0.5654201,-0.9509558,0.00096591073,-0.043163724,0.4077403,-1.0859221,0.6999001,0.40714318,-0.08873732,-0.07508248,-0.009093482,-0.46344966,-0.19199978,0.4810677,0.48018777,-0.28993973,0.41181335,-0.27362508],[-0.027356783,-4.2967224,-0.03678484,-0.32151344,-0.73972255,-2.5777402,-3.2287362,-2.5549042,-1.4497441,-0.43103775,0.6453438,-0.17506233,-0.31516784,0.5563384,0.85075074,-0.57829696,-0.19835036,-0.024371902],[-2.47195,1.7926816,-1.1769953,0.16563822,-0.82507175,-1.0493809,-0.32214803,-1.1703736,0.2470295,0.2510944,-0.11734796,0.13303131,0.030326199,-0.00082738034,0.023316598,-0.33300236,-0.31752133,0.38321474],[2.1512134,1.7400922,-1.7055479,-0.3629506,-1.7764045,-0.28031406,-1.3791944,-0.80302006,-0.122044094,0.8002589,-0.3441996,-0.07645867,0.23166081,-0.38216463,0.64409703,0.11736102,0.22685654,-0.30116174]],"activation":"σ"},{"dense_2_W":[[-0.52089065,-0.064282656,0.9368965,-0.78820074,0.18612167,0.050849117,0.27317494],[0.71986425,0.006931284,-0.083075926,-1.1616415,0.027728708,-0.928848,0.83347905],[0.8144789,0.20632064,-0.71373665,-0.06819771,0.9545801,-0.4286985,0.42867258],[0.71121395,0.06992666,-0.8302117,0.07830932,0.25297147,0.0047203694,-0.0066684796],[-0.5690574,-0.14917742,-0.3785819,0.9758459,0.28018865,0.41372767,-0.21782406],[0.13315567,-0.4577933,-0.1426717,0.19464079,0.008886417,-0.116589725,0.08225403],[-0.9950312,-1.3679215,0.091107205,0.9272021,1.1016536,-1.3227009,-1.2095336],[-0.3986191,-0.9487305,0.38871515,-0.08156303,0.95174986,-0.6304789,0.13525334],[0.2225127,-0.2169731,0.9058736,-0.5802039,-0.24850035,-0.28582534,0.3907818],[-0.5881804,-0.044960845,-0.90182215,0.8056298,0.5574692,1.0463717,-0.5374416],[-1.2164664,-0.40320966,0.53783023,0.27278855,-0.49228838,-0.14903766,-0.8090045],[-1.2831542,0.4933893,0.021853147,0.071227364,-1.4159098,0.76011354,-0.8172033],[0.078262046,-0.5118518,0.22079428,-0.02778036,-0.222457,0.23040481,-0.66731334]],"activation":"σ","dense_2_b":[[0.05072228],[-0.1091474],[0.1004324],[0.021801215],[0.03440032],[-0.07559257],[0.18204498],[-0.008477362],[0.033497173],[-0.15622234],[-0.088286996],[-0.1264465],[-0.09580737]]},{"dense_3_W":[[-0.49234378,-0.12957415,0.5802615,0.4467619,0.590399,0.24340731,-0.5555279,-0.66425663,-0.4981453,0.60517937,-0.56258386,-0.26889455,-0.35886267],[-0.60045487,-0.55883497,-0.3071459,0.07875048,0.5536381,-0.32903612,0.14948905,0.46808386,0.28372547,0.3629737,0.22399715,-0.5433762,-0.15223768],[-0.46732837,0.03954109,0.09032384,-0.38590652,0.39412647,-0.153768,0.03560084,-0.11765058,0.35194537,0.3046047,-0.094702706,0.3176626,-0.32317603]],"activation":"identity","dense_3_b":[[0.051931284],[0.06253407],[0.04909886]]},{"dense_4_W":[[-1.265387,-0.37792373,-0.20574242]],"dense_4_b":[[-0.04775983]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HONDA_CIVIC_2022.json b/selfdrive/car/torque_data/lat_models/HONDA_CIVIC_2022.json
new file mode 100644
index 000000000..4a5872bce
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HONDA_CIVIC_2022.json
@@ -0,0 +1 @@
+{"input_std":[[8.358706],[1.0686424],[0.34114116],[0.044889364],[1.068699],[1.068358],[1.0675814],[1.045456],[1.0242518],[0.99177456],[0.9590156],[0.04477875],[0.04480059],[0.04482342],[0.04474932],[0.04458978],[0.044322193],[0.043946933]],"model_test_loss":0.035726360976696014,"input_size":18,"current_date_and_time":"2023-08-06_06-15-03","input_mean":[[24.615007],[-0.03660665],[0.0016246386],[-0.006489807],[-0.0361033],[-0.035993658],[-0.036171526],[-0.03401853],[-0.031212736],[-0.02772113],[-0.025683384],[-0.0064613656],[-0.0064720884],[-0.006487653],[-0.0065700756],[-0.0065773614],[-0.0066702664],[-0.0067906133]],"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":[[2.9387486],[1.7947302],[-2.419479],[-0.046714567],[-0.07710784],[-0.011005453],[2.2013001]],"dense_1_W":[[1.5500982,-0.562216,0.82173073,1.1276568,-1.1044303,2.0344303,-0.5962017,0.43611562,0.6137577,0.54552734,-0.40140414,0.13477002,-0.33703992,-0.995159,-0.5198411,0.6988811,0.23579559,-0.43389362],[1.9096831,0.4647536,-1.062686,-0.18994598,-0.7350096,1.1260368,-1.2783738,-0.017420385,-0.32890928,-0.6363917,0.1548712,0.10676455,0.18015237,-0.0953862,-0.13519493,0.2339727,0.07321837,-0.04309801],[-1.3224562,0.034447707,0.7349111,0.15789251,-0.54802585,0.91166073,-0.5362905,0.5046039,0.30484954,0.5900371,-0.38941008,0.33457753,-0.27889228,-0.6909375,-0.14148402,0.97603106,-0.13406259,-0.30469695],[-0.0017459231,-0.09968895,-0.014508084,0.23403876,0.836069,-1.5712544,0.19792208,0.34136322,0.15050764,-0.2420643,-0.05131571,-0.09686847,-0.47325152,0.21186271,0.033762608,0.17737845,0.0014673215,-0.12473483],[0.00029148505,-0.6372151,-0.0053334557,-0.05010357,0.99977154,-1.0182008,-0.14067085,0.3974594,-0.2723742,0.04584643,0.073329695,-0.34156838,-0.11684916,0.11896246,0.34009737,0.6478362,0.13086675,-0.43019354],[-0.0077469624,-0.1509263,-3.2484512,0.16014525,-0.5749223,-0.9640095,0.9543776,-0.7414716,-0.7872326,0.2741354,1.5463,-0.3455074,0.08961764,0.027934242,0.045294646,0.23221987,-0.1519019,8.7261986e-5],[2.0402718,-0.72642046,1.1085396,0.08754884,0.35070625,-0.522105,1.2273571,-0.049034014,0.7027618,0.56165534,-0.22607273,0.21941654,0.19681507,0.25899538,-1.0231488,-0.19570431,-0.065851234,0.37131593]],"activation":"σ"},{"dense_2_W":[[-0.60671103,-0.10295715,-0.2275175,0.703453,0.5107893,-0.019612279,0.060930736],[0.32735822,0.09359731,1.1961514,-0.5468047,-0.6979488,-0.8116451,-0.8816686],[0.28230911,0.26441634,0.32522315,-0.2709414,-0.97729933,-0.1853032,-0.6816012],[0.85672635,0.40473634,0.06306575,0.043324664,-0.09925389,-0.6707503,0.48766825],[0.3574693,0.24644808,0.8436976,-0.73305976,-0.87197644,-0.17207824,-0.34952453],[1.2755688,1.0824895,0.84866655,-0.5946056,-0.93967986,-0.64516634,0.18630773],[0.2624753,-0.12604286,-0.24697196,-0.36811814,0.14403982,0.43120542,0.1445742],[0.44066232,0.1534366,0.25932267,-0.65874845,-0.26324567,-0.31705675,-0.831388],[-0.030025106,-0.31389698,0.17181242,0.3696615,0.008856971,-0.5338608,-0.019544462],[0.053924862,0.46772835,0.94262034,-0.71287125,-1.2770078,0.48717985,0.09874367],[-0.5596553,0.1355415,-0.6685472,0.5694037,0.5835357,-0.050862506,-0.30772945],[0.26585215,0.15441975,-0.27715218,0.17482373,0.30534902,0.13441981,0.24543025],[-0.700537,-0.30525044,-0.40211698,0.23966432,-0.07130374,0.3517828,-0.30104256]],"activation":"σ","dense_2_b":[[0.0006462817],[-0.045901865],[-0.08447791],[0.018081808],[0.028199553],[0.15011074],[0.024169737],[-0.07767265],[0.003401174],[-0.09530233],[0.026245346],[-0.019555494],[0.029535577]]},{"dense_3_W":[[-0.4269903,0.38330346,0.3818396,-0.104428,-0.010993002,0.25576162,-0.14891353,0.5712297,0.43450522,-0.18818101,-0.40029064,0.113605164,-0.41539222],[-0.4444491,0.6585591,0.5286078,0.014278995,0.3499434,0.3896106,-0.37057588,0.058567323,-0.5987489,0.35249916,-0.5103405,-0.0007771231,-0.20807561],[-0.5559521,0.25394833,-0.35546854,0.4645985,0.3801913,0.20466149,-0.20871717,0.37793857,-0.093845844,0.5868493,0.12606087,-0.4579316,-0.5141172]],"activation":"identity","dense_3_b":[[-0.039426688],[-0.038285036],[-0.0388908]]},{"dense_4_W":[[0.98477775,0.89640814,0.94241107]],"dense_4_b":[[-0.040733967]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HONDA_CIVIC_BOSCH.json b/selfdrive/car/torque_data/lat_models/HONDA_CIVIC_BOSCH.json
new file mode 100644
index 000000000..2d65f4400
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HONDA_CIVIC_BOSCH.json
@@ -0,0 +1 @@
+{"input_std":[[9.261368],[1.1474106],[0.37148234],[0.044279538],[1.1430647],[1.1446478],[1.1447154],[1.1187278],[1.0942419],[1.0602791],[1.0217831],[0.04425829],[0.044268712],[0.04427185],[0.044111896],[0.04397081],[0.04367603],[0.043223266]],"model_test_loss":0.041262850165367126,"input_size":18,"current_date_and_time":"2023-08-05_23-22-02","input_mean":[[24.15998],[-0.008219966],[0.004739006],[-0.013221193],[-0.008523361],[-0.008609849],[-0.007986069],[-0.006765848],[-0.006281763],[-0.008096367],[-0.011848589],[-0.013220585],[-0.013206273],[-0.013198256],[-0.013279306],[-0.0133954],[-0.01351665],[-0.013652078]],"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.011715764],[-0.16971639],[0.44084886],[1.8919995],[-0.57473946],[0.3265129],[0.665929]],"dense_1_W":[[-0.035294082,0.58739567,0.0068268306,0.5267725,-1.3068384,2.0108788,-0.8904008,-0.86464506,0.8847079,0.49210623,-0.27763724,0.6851789,-0.11328691,-0.61491024,-0.7021547,0.0578637,0.082666315,0.0749281],[-0.08059325,-0.77528465,0.93356776,-1.1226226,0.030571632,1.2159668,-0.3739228,2.0636218,1.051139,0.24026142,-0.8241013,0.51684606,0.45198372,-0.85868824,0.9150932,0.14920434,0.0996434,-0.23813146],[1.05331,0.6632812,0.586634,0.10609487,-0.16541673,1.0143963,-0.6739981,0.43193975,0.5483419,0.020105261,-0.2659555,0.27416015,0.3780343,-0.38164294,-0.04144785,-0.49568477,-0.6130558,0.6570192],[1.4749159,0.076626115,-0.88682747,0.046201207,-0.23487571,-1.1125354,0.055821165,-0.57242775,-1.03109,0.059293248,0.2898471,-0.65886724,0.19274879,0.39950013,-0.10046821,0.34578046,0.20585975,-0.28454834],[-1.0492898,0.8025768,-0.019681327,0.11809792,-0.3740394,1.1517578,-0.6477998,-0.59586203,-1.4050065,-0.8667816,0.755093,-0.04370645,0.32285377,-0.16848978,-0.21646905,-0.34349748,-0.28047857,0.49415973],[0.056685824,0.9262534,-5.3872395,0.7328496,-1.2155392,-1.1581563,-0.12605561,-1.2297785,-0.95465136,1.0993868,1.4996752,-1.0285505,-0.33488074,0.33622772,0.34516957,-0.14087252,0.36723128,-0.2868416],[0.9570638,0.24864312,-0.017469333,0.54736155,-0.49265823,1.0806886,-0.30185512,0.02353294,-1.477074,-0.70588714,0.615638,-0.07056425,0.046274792,-0.32864115,-0.3693316,0.0012585309,-0.105926886,0.20974532]],"activation":"σ"},{"dense_2_W":[[0.79805297,0.07995367,0.33311036,-0.1088086,-0.28585342,-0.11676164,0.3217794],[-0.6564382,-0.650472,-0.32395652,0.48536372,-0.39954782,-0.9293625,-0.3131151],[0.065390795,-0.36014688,0.035044394,-0.47919765,-0.21676321,-0.68095744,-0.58225524],[-1.4269842,-0.22010052,0.762021,1.5709931,-0.39910436,1.7860814,1.1529905],[0.81025195,-0.19804797,0.2811143,-0.13832566,0.21581413,-0.2242298,0.10002656],[-2.4172528,-2.9861536,-2.1297307,-2.3552132,2.0055087,3.841171,-1.6320437],[-0.15224119,-0.008424982,-0.7476414,-0.7229817,0.34834322,-0.62080944,-0.6412587],[-0.32463408,0.056613863,-0.013071884,-0.057739817,0.5155227,0.12653896,0.14592259],[-0.5659917,-0.43365908,-0.31137735,-0.3897718,-0.26343766,0.8946887,-0.6234644],[-1.2267396,0.0675833,-0.036197066,-0.0106164375,-0.65109164,0.3789509,-0.7397455],[-0.47206897,-0.3735633,-0.4683122,0.17489713,-0.69122815,-0.68286866,-0.23052849],[0.92053163,0.41530177,0.23816848,-0.3726253,0.27367908,0.71565676,0.19845398],[0.22949272,0.53540593,0.100375816,0.39428094,0.19491827,-0.0047999,-0.036115997]],"activation":"σ","dense_2_b":[[-0.080741115],[-0.098717436],[-0.04195425],[0.57887644],[-0.0376275],[-0.7313109],[-0.15826389],[-0.03734272],[-0.17071353],[0.06530881],[-0.16700919],[-0.10229606],[-0.0077384445]]},{"dense_3_W":[[0.6059949,0.4993691,-0.0014475341,0.40003,-0.44542313,-0.71407944,0.2787467,0.16292632,-0.4138824,0.27650607,-0.27067518,-0.14248835,0.17812036],[0.13085166,0.48013842,0.34201995,0.64287025,-0.600294,0.86557233,-0.14552544,-0.08809264,0.41238344,0.7531989,0.587104,-0.4580716,-0.6428474],[0.61981463,-0.5255673,0.47925967,-0.6429044,0.02112309,0.09041386,0.27671653,-0.054121528,-0.24291937,-0.610705,0.07889088,0.042044822,0.39591196]],"activation":"identity","dense_3_b":[[0.007450639],[-0.024559],[0.020729255]]},{"dense_4_W":[[0.2550702,-1.0187347,1.2050446]],"dense_4_b":[[0.021735787]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HONDA_CLARITY.json b/selfdrive/car/torque_data/lat_models/HONDA_CLARITY.json
new file mode 100644
index 000000000..6a5716e62
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HONDA_CLARITY.json
@@ -0,0 +1 @@
+{"input_std":[[6.17857],[0.44787604],[0.5243947],[0.032028187],[0.44404522],[0.4443511],[0.44520274],[0.45595846],[0.4604483],[0.47209886],[0.4884655],[0.03209721],[0.03205],[0.03203256],[0.03195497],[0.031864975],[0.03177169],[0.03154828]],"model_test_loss":0.0009851785143837333,"input_size":18,"current_date_and_time":"2024-01-04_15-35-20","input_mean":[[21.90655],[-0.29117808],[-0.08760989],[-0.009034546],[-0.2664771],[-0.27346689],[-0.2819304],[-0.3144748],[-0.33650345],[-0.36093968],[-0.38976616],[-0.009162463],[-0.009145338],[-0.009107736],[-0.008843513],[-0.008647824],[-0.0083346395],[-0.007997973]],"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.06760431],[-0.2907365],[-0.4082806],[-0.20224898],[0.29265383],[0.26244283],[0.15451357]],"dense_1_W":[[0.014618384,0.37313232,0.035592113,-0.3403019,0.033235013,0.24829742,-0.49047577,0.28937504,-0.2026583,-0.2760167,0.21064562,0.08079155,0.11982211,0.042024616,-0.052886724,-0.06286289,-0.13398048,0.13160145],[-0.0048215007,0.30684328,0.020128243,-0.41616872,-0.20515934,-0.2511921,-0.13518195,0.37878683,0.26875132,0.113668166,-0.27679917,0.66174066,-0.052989658,-0.1855979,-0.02353523,-0.30120054,0.091657996,0.09602743],[-0.0042930744,-0.15373556,0.08812353,-0.31896785,0.019456651,-0.20545581,0.05433538,-0.23081444,0.43445846,0.11084425,-0.0024109932,-0.6938004,-1.024248,-0.4391781,-0.0550922,0.07583203,0.79354477,-1.8509296],[0.04390958,-0.18022121,-0.08688032,0.19231437,-0.14530687,-0.27636525,0.4690427,0.4344902,0.16017663,-0.25027603,-0.2452524,0.5537437,0.13898967,0.038036723,0.6355534,0.5031342,1.3155322,-0.14124991],[-0.006398488,-0.7886078,0.03451426,-0.054085355,0.25506452,0.4975867,1.0672406,-0.27192074,-0.91774124,0.2306121,-0.3410087,-0.16050793,0.15241678,-0.17949696,-0.31961542,0.22702731,0.419533,0.00035671022],[-0.0077034663,-0.78213346,-0.016133381,0.10805307,0.14032482,0.36524558,0.12367749,0.24540052,-0.059624504,-0.3247948,0.021967877,-0.039682694,-0.2721095,-0.10098841,0.21639878,-0.22641253,0.14136238,0.19991797],[-0.048534065,-0.20369655,0.07626118,-0.31831193,0.2750742,-0.2912584,0.088218614,0.09158782,0.06355577,-0.23128918,0.2086949,-0.44672933,0.2343581,-0.052767944,-0.26756912,-0.29403126,-0.0006949583,-0.3037349]],"activation":"σ"},{"dense_2_W":[[-0.19747548,0.3752813,0.005352072,0.22516197,-0.279574,-0.29499897,0.514051],[-0.23818707,-0.442092,0.21234472,-0.5240696,-0.666385,0.13287802,-0.70440364],[-0.12623425,-0.12563375,0.17045951,-0.4611073,0.13094379,-0.2603494,-0.578133],[-0.3201878,-0.472269,-0.45254824,-0.17459284,-0.13989829,-0.07893383,-0.15434109],[0.6313669,0.59430647,0.029979968,0.40872103,-0.6338095,-0.48483965,-0.16215326],[0.12921973,-0.35855725,-0.6317136,-0.24155544,0.018117908,0.6665686,-0.09261251],[-0.5263865,-0.500698,0.26361403,0.1989874,0.16189028,0.4017576,-0.50330746],[0.19345485,0.0116930995,-0.1151553,0.38370124,-0.51925737,-0.66009927,0.54345274],[-0.10049859,-0.07803794,-0.05125394,-0.5760374,0.22012971,-0.4562151,-0.24986024],[-0.035831526,0.17925176,0.08670547,-0.6276373,-0.24000542,0.09890566,0.005909479],[0.026487896,0.10827987,-0.5441871,0.10627476,-0.12671272,0.25334272,0.090102024],[0.11269248,-0.5982834,-0.20034944,-0.4165159,0.48223287,0.06892533,0.32945293],[0.14122471,-0.84526354,-0.102686554,-0.42417887,-0.056950103,-0.013891049,-0.043740742]],"activation":"σ","dense_2_b":[[0.021066276],[-0.18323943],[-0.08896128],[-0.059529945],[0.01516111],[-0.03864309],[-0.01915316],[0.0072613885],[-0.13141903],[-0.1963338],[-0.20056123],[-0.0918762],[-0.09109566]]},{"dense_3_W":[[-0.5145814,-0.15164766,0.41466355,0.5054458,-0.56660354,0.37653998,0.2958398,0.1300162,0.15582272,-0.14694406,0.089647524,0.0200251,-0.6487758],[0.18533824,-0.14857687,0.36485723,-0.25733942,-0.5232801,0.39276004,0.36414713,-0.54408604,-0.4820063,0.19759995,-0.12671192,0.39148358,0.189427],[0.5235357,-0.23839255,0.41131777,-0.43199104,-0.042662866,-0.042696618,-0.30467755,-0.119463064,-0.49081296,0.2406254,-0.07923712,-0.0021057576,-0.42410713]],"activation":"identity","dense_3_b":[[-0.036107603],[-0.036152013],[0.03689696]]},{"dense_4_W":[[-0.48288086,-0.87119794,0.8186898]],"dense_4_b":[[0.0358588]],"activation":"identity"}]}
diff --git a/selfdrive/car/torque_data/lat_models/HONDA_CRV_5G.json b/selfdrive/car/torque_data/lat_models/HONDA_CRV_5G.json
new file mode 100644
index 000000000..56b5e6782
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HONDA_CRV_5G.json
@@ -0,0 +1 @@
+{"input_std":[[9.079519],[1.117335],[0.32821873],[0.04513038],[1.1160785],[1.1158687],[1.1147403],[1.0893666],[1.0659956],[1.0314285],[0.99783367],[0.04497426],[0.044967793],[0.044959538],[0.04481279],[0.044600893],[0.044237226],[0.043830905]],"model_test_loss":0.05013991519808769,"input_size":18,"current_date_and_time":"2023-08-06_08-46-45","input_mean":[[24.945726],[0.056781527],[-0.006332743],[-0.0054867254],[0.057909872],[0.057552766],[0.05728289],[0.054190118],[0.05235296],[0.048357345],[0.0448629],[-0.005489833],[-0.005468405],[-0.005448704],[-0.005441959],[-0.0055107307],[-0.0055533946],[-0.005588048]],"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":[[-1.3742944],[2.0560386],[0.070786394],[0.08766052],[-7.2637663],[4.9462605],[0.020425294]],"dense_1_W":[[-0.88963157,0.47497272,1.1810282,0.6939777,-0.36621186,1.347931,-0.7933228,0.85621536,0.66951233,-0.11786804,-0.6730566,0.112765215,-0.28919625,-0.33895963,-0.62124485,0.25326887,0.21473351,-0.12489331],[1.223516,-0.036567718,-1.247157,0.09799731,-0.97558075,0.16902182,-1.0449882,-0.046705905,0.29223862,0.30116007,-0.09839103,0.46722287,-0.0449582,-0.39868206,0.07668579,-0.11536017,-0.0691049,0.10267897],[0.018545184,0.81794965,3.4399781,0.052234847,-0.4958513,0.38696352,-0.638153,0.87363166,0.86702484,0.7031613,-1.9006683,0.85754114,0.8998447,-0.52486235,-1.0076646,-0.66781485,0.2555468,0.17366274],[0.0037442108,1.4584165,0.0061913775,0.24082592,-0.7234466,1.0945269,-0.21835686,-0.038823094,-0.20537247,-0.4526858,0.3522938,0.7368147,-0.4907756,-0.72209734,-0.3003073,0.24139397,-0.27028123,0.28593597],[-3.720445,0.5471661,-2.9256604,-0.84999114,-0.35371152,-1.650107,-0.30913082,-1.5157434,-1.4253404,-0.5012027,1.8229349,-0.22352915,0.07850824,1.2852895,-0.17709053,0.0015369024,0.4303836,-0.3013633],[2.7063103,0.4795686,-2.1412866,-0.37747622,-0.52522975,-1.1443468,-0.3860132,-0.81000876,-0.8656079,-0.38408586,1.1732165,-0.33476815,0.35176495,0.67967117,-0.24029131,-0.15793729,0.59702957,-0.33229384],[0.003850781,1.0522044,0.0023779364,1.4077666,-0.2233461,-1.323892,0.2490657,0.9962225,-0.21043883,-0.48657963,0.0066762604,-0.8950598,-0.65639627,-0.10381974,-0.033756495,0.3061354,-0.09620744,0.075370125]],"activation":"σ"},{"dense_2_W":[[0.01117936,0.6720228,0.39750826,0.30468678,-0.34063298,0.11394216,-1.026796],[-0.07938874,-0.29046267,-0.15366286,-0.94418544,0.72881997,-0.072467156,1.1634737],[-0.7841681,-0.38053507,-0.48102236,-0.7339148,-0.94196475,-0.09320883,0.17724545],[-0.11575878,0.41173506,0.7931331,0.7659729,0.45459372,-0.4762705,0.04162107],[-0.54039043,-0.6239058,0.12097131,-1.0940313,0.6270558,0.8035503,0.8422599],[-0.006883268,0.1846561,0.4628913,0.89182067,-0.281233,-0.5460564,-0.49594778],[-0.37237987,-0.50528663,-0.34381047,-0.9888458,0.66827786,0.75729847,0.9049922],[-0.6351278,-0.39599782,-1.7942646,0.2172901,1.2180948,-1.0186263,-0.29467586],[0.098499954,-0.7321613,-0.4204465,-0.5589947,-0.49682683,0.02701407,-0.56642413],[-0.055568255,-1.0158917,-0.13512869,-0.75265217,0.32634935,-0.10900366,1.1009233],[0.9196104,-0.29001886,0.27778128,0.40752462,-0.71603805,-0.78771234,-0.2509219],[-0.27494332,-0.27294615,-0.87608117,-0.5456548,0.23442413,0.46402624,0.4014235],[-0.0657572,0.39627385,-0.032163464,0.37446278,0.30043706,-0.3939967,-0.17288771]],"activation":"σ","dense_2_b":[[-0.12896457],[-0.06757774],[-0.29207176],[0.057776056],[0.03819644],[-0.0075618257],[0.022483658],[-0.30520216],[-0.30780953],[-0.22291888],[0.073764615],[-0.11618854],[-0.0932309]]},{"dense_3_W":[[-0.20723751,0.46280366,0.37977389,-0.28764504,0.56071246,-0.42746708,0.743715,-0.41921702,0.39859435,0.35315046,-0.18542276,0.28128248,-0.18067148],[-0.6656129,-0.15142722,-0.022595402,-0.48696524,0.37018472,-0.6183299,0.50862163,0.035134673,-0.46468532,0.35520592,-0.6777795,0.2590716,0.46181098],[-0.32565305,0.33916017,-0.4280441,-0.21963115,0.6359937,-0.44887698,0.2442765,0.13551079,-0.47778323,-0.4541174,-0.59640217,0.13698937,-0.27695638]],"activation":"identity","dense_3_b":[[-0.07102677],[-0.02868969],[-0.030784609]]},{"dense_4_W":[[-1.024929,-0.3087716,-0.3174253]],"dense_4_b":[[0.053275082]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HONDA_CRV_HYBRID.json b/selfdrive/car/torque_data/lat_models/HONDA_CRV_HYBRID.json
new file mode 100644
index 000000000..afdbdefee
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HONDA_CRV_HYBRID.json
@@ -0,0 +1 @@
+{"input_std":[[9.167076],[0.8396103],[0.39224938],[0.038149882],[0.83500266],[0.8364939],[0.83795094],[0.8280286],[0.82101065],[0.80936265],[0.79514086],[0.03816296],[0.03813872],[0.0381162],[0.037860528],[0.037643477],[0.03726596],[0.036896862]],"model_test_loss":0.019166288897395134,"input_size":18,"current_date_and_time":"2023-08-06_11-19-09","input_mean":[[24.623522],[0.012142224],[-0.0077460455],[-0.0040752436],[0.01259905],[0.011912992],[0.011499013],[0.008575823],[0.006231978],[0.001843956],[-0.0011071449],[-0.0041566766],[-0.004162808],[-0.0041667568],[-0.0041206917],[-0.004187086],[-0.004389174],[-0.0045910473]],"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.10681055],[-0.05877009],[-5.810432],[0.108804524],[5.817238],[-1.4135033],[-0.04275369]],"dense_1_W":[[-0.010944928,0.298581,-0.0004137291,0.46320775,-0.68514436,1.5652411,-0.62197584,-0.70986384,-0.07209713,0.14426921,0.09893353,0.2957121,0.24033338,-0.63492715,-0.24635397,0.21067435,0.16446242,-0.4790833],[-0.002262276,-0.7669907,0.0011565682,0.2969979,0.11738408,-1.199179,0.32905388,0.35275638,-0.34200913,0.22103965,-0.188085,-0.00050096336,-0.36091766,0.18886286,0.356193,0.50661796,-0.18447432,-0.3530909],[-2.7729337,-0.046491493,-2.223908,0.51880556,-1.5391709,-1.8928696,1.8811203,0.22442053,-0.20638244,0.44581792,-0.10464485,-0.11026335,-0.41476744,0.71887964,-0.6184063,0.07461815,-0.70264786,0.5291843],[0.088751696,-0.7015499,-2.262332,0.07993792,-0.5452428,0.36403584,-0.888494,0.26214746,0.52286375,0.47499555,0.12439757,0.32842526,-0.22486946,-0.2082452,0.2083624,0.20134373,-0.26366135,0.040187743],[2.7838297,0.36513317,-2.2177417,0.17293313,-1.3490273,-1.395796,0.7361196,0.024529908,0.0147317415,0.50988925,-0.16947655,-0.14311421,-0.13544203,0.6211999,-0.28396562,-0.19654925,-0.4721205,0.44046035],[-1.0456268,0.006558085,0.029179003,-0.24681818,0.33209732,-0.31439346,1.0280732,1.6322477,0.33988294,-1.1288414,-0.7784953,-1.3079332,-0.922044,-0.7579679,-0.7932985,0.090359144,2.2930832,3.7051785],[-0.032393374,0.15797108,2.6865292,-0.022740832,0.7215196,0.9335919,-0.9160322,0.63953984,-0.10847628,-0.41109005,-0.58336747,0.8728414,0.2319681,-0.77523047,-0.6650054,-0.19625007,-0.0422657,0.4323157]],"activation":"σ"},{"dense_2_W":[[-1.0469242,2.310652,2.5330374,-1.1560289,0.87019974,-0.24008566,-2.4145112],[-1.5431111,1.6602669,1.4227277,0.44263628,2.124669,-0.881401,-1.636305],[-0.7812676,0.3887846,0.046831988,-0.0021416398,0.0068075457,0.26359168,-0.40856928],[0.5853211,-0.020535953,0.1977803,0.11166494,-0.7388882,-0.6265164,0.19296904],[-1.4384844,-0.07708128,-0.62513274,0.1822617,-0.83729374,-0.20433801,0.08106154],[0.79002935,-0.51513207,-0.17725268,0.70090765,-0.37455943,-0.00461776,0.6140211],[0.38233972,0.11824663,-0.048423085,-0.22234191,0.071728714,0.09328836,0.5405535],[1.0066482,0.12065403,-0.67822254,0.91310203,0.3381496,-0.46563134,0.6765602],[-0.058819644,0.04884941,0.44360304,-0.16011114,-0.493316,-0.18134312,0.31395072],[-1.1391008,1.2845155,0.65725374,-0.75513005,1.1359249,-0.5923027,-0.46509168],[-0.28455976,0.122011006,0.19924502,-0.016063396,-0.19426562,-0.7366286,-0.30496517],[-1.1961275,-0.44696903,0.2981926,-0.6047452,0.60021174,0.7954056,0.67303944],[0.66179645,-0.35565352,0.4263759,-0.23354627,-0.5218455,-0.14847569,-0.45979464]],"activation":"σ","dense_2_b":[[-0.70381194],[-0.41715994],[-0.18704335],[-0.20373428],[-0.23588026],[-0.022451308],[0.010537296],[0.10221664],[0.014627381],[0.060474735],[-0.033638965],[-0.051280532],[-0.20772089]]},{"dense_3_W":[[0.15796849,0.6079072,0.5830924,-0.5528727,-0.1478945,-0.27996355,-0.30358565,-0.6117205,0.22281085,0.6154891,0.0165758,0.616245,-0.5880501],[-0.1846488,-0.46482992,-0.33469623,-0.15623315,-0.20466302,0.642436,0.34555972,0.60815287,0.43956748,-0.5986671,0.3041771,-0.26802206,0.03272353],[-0.88071394,-0.01339668,-0.4710771,-0.08369313,-0.47736472,-0.29117015,0.5252153,0.36675686,0.37659007,-0.38053805,0.07111416,-0.030936832,-0.3208197]],"activation":"identity","dense_3_b":[[-0.04642651],[0.037014484],[0.055794742]]},{"dense_4_W":[[-0.5493109,0.48931855,0.5176042]],"dense_4_b":[[0.04616592]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HONDA_HRV.json b/selfdrive/car/torque_data/lat_models/HONDA_HRV.json
new file mode 100644
index 000000000..87a91229a
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HONDA_HRV.json
@@ -0,0 +1 @@
+{"input_std":[[7.1964235],[0.87585396],[0.34334365],[0.04189015],[0.88570154],[0.8828632],[0.8788816],[0.85152715],[0.8326557],[0.8105437],[0.790872],[0.041831378],[0.04184441],[0.041850727],[0.041653063],[0.041487437],[0.041109927],[0.0406368]],"model_test_loss":0.016751321032643318,"input_size":18,"current_date_and_time":"2023-08-06_13-52-18","input_mean":[[27.281948],[0.057562165],[0.025426663],[0.001435362],[0.049740613],[0.051872276],[0.053928934],[0.06504589],[0.07349952],[0.08201744],[0.088106535],[0.0013536362],[0.0013746973],[0.001394585],[0.0014019185],[0.001435841],[0.0014179434],[0.0013371226]],"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.0041493755],[0.21777502],[0.7115575],[-2.2624984],[0.10148076],[-1.9139864],[-2.6148589]],"dense_1_W":[[0.0027682746,-0.5923534,-0.0008324875,-0.96639884,-0.43687794,1.0992304,0.44394565,-0.15681875,-0.19448969,0.23627451,0.027064066,1.0438472,0.38998574,-0.3910353,0.07241692,-0.3872127,0.24487913,-0.00981091],[-0.0063605076,0.41579154,4.60037,0.15178576,-0.41990525,-0.9291791,-1.8990772,-1.2513685,1.3644165,1.6527833,0.822613,0.6267062,0.3986885,-0.65917814,-0.68864816,0.038168486,-0.43694118,0.5313064],[0.1826715,0.21753219,2.6482086,0.49831605,0.04197241,0.48248503,-0.85676134,-0.088123225,0.5933527,-0.101084374,-0.07996661,0.39820936,-0.25201222,-0.5013944,-0.18441774,0.085484736,-0.20741902,0.15278186],[0.20413034,0.7558973,0.0039974884,0.09515875,0.023952896,0.12318843,-0.24863702,0.28330338,0.598279,-0.0031794424,0.12692909,0.26882735,0.002343814,-0.20356114,-0.4958486,-0.2599618,-0.3243958,-0.15502147],[0.0008160921,-0.75155866,3.2958338,0.18005188,-0.48001406,-0.37221822,-0.014907395,0.34556574,-0.36695525,0.5220802,0.9252095,-0.6326275,0.31536806,0.40089336,-0.24786693,-0.16599582,0.26964852,-0.11618827],[-0.6374511,0.50671804,3.4275095,0.45084175,0.014429362,0.16759996,-0.40217194,-0.1596027,0.27413476,-0.020348325,0.03291187,0.29519597,0.0606238,-0.77494323,-0.04082934,-0.019097991,0.021767832,0.017387142],[0.24087234,-0.5286611,-0.0010711186,0.50206137,-0.37612498,-0.065321624,0.3152248,-0.3156515,-0.31909347,-0.5960725,0.07865838,-0.57626325,-0.28874642,0.36706463,0.55150944,0.021375967,0.53079313,0.0685934]],"activation":"σ"},{"dense_2_W":[[-0.61061996,-0.3219788,-0.61355484,-0.41679764,0.9514292,0.089833274,-0.08153515],[0.5216678,0.35865775,0.14493388,0.75064963,-0.9559691,-0.11178071,-0.26124665],[-0.07039463,-0.54774076,-0.7926992,-0.28961974,0.25917596,0.06013633,0.6089615],[-0.29096878,-0.55007404,-0.6435847,0.022112146,0.31680974,-0.22504552,0.35249886],[-0.6804567,-0.94920105,-0.8136485,0.3378733,0.597489,0.46872833,0.28344125],[-0.8909486,0.17668937,-0.50494355,-0.51266,0.76238817,-0.08368523,0.21360965],[-0.08500846,-1.3190831,-0.40328535,0.17221951,0.9102355,-0.42406878,-0.14185876],[0.41169032,0.12483639,-0.43139625,1.0178162,-0.7741975,0.49720922,-0.0029358894],[-0.11413294,0.35335183,0.5509884,0.60089856,-0.07613763,-0.18951175,-0.5859379],[-0.30574977,0.66385657,0.29187888,0.15835138,-0.13989422,0.93255055,0.16954228],[0.9125405,0.33926046,-0.45827863,0.20637102,-1.3337029,0.99624145,-0.6220122],[1.0066077,0.5247419,0.3793085,0.006325064,-0.7290911,-0.32310325,0.17187376],[-0.6349526,-0.62067527,-0.291574,0.05529339,0.7121756,-0.08375974,0.22644123]],"activation":"σ","dense_2_b":[[0.04084762],[-0.06363596],[0.024858473],[0.10673008],[0.13199006],[0.10104594],[-0.008044478],[-0.10162189],[-0.15080203],[-0.11178794],[-0.24866438],[-0.17219713],[-0.008406249]]},{"dense_3_W":[[0.40549794,-0.4494019,0.2861901,0.37104332,0.5890352,0.58301944,0.40222168,-0.49054152,-0.31034032,-0.07984426,-0.5973653,-0.20854333,0.5224267],[-0.6481895,0.81970197,-0.5651685,-0.54807013,-0.5982727,-0.21111657,-0.7437358,-0.18910314,-0.22034706,0.69472176,0.7825804,0.5047144,0.30723065],[-0.2815957,-0.25135168,-0.03530872,-0.47208393,-0.14322938,0.72277945,0.027914466,-0.113597095,-0.31811848,0.057283014,0.22687551,0.074457414,0.35829133]],"activation":"identity","dense_3_b":[[-0.064762406],[0.042542093],[0.06525171]]},{"dense_4_W":[[-1.0957879,0.49216008,-0.0023324802]],"dense_4_b":[[0.054476205]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HONDA_INSIGHT.json b/selfdrive/car/torque_data/lat_models/HONDA_INSIGHT.json
new file mode 100644
index 000000000..7125acea9
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HONDA_INSIGHT.json
@@ -0,0 +1 @@
+{"input_std":[[8.603165],[0.968196],[0.31648555],[0.043116625],[0.97207046],[0.97122186],[0.9696193],[0.9440986],[0.9209154],[0.89170784],[0.8635297],[0.0430813],[0.043076806],[0.043065626],[0.04281562],[0.042584687],[0.0422511],[0.041811552]],"model_test_loss":0.0409439355134964,"input_size":18,"current_date_and_time":"2023-07-18_02-56-25","input_mean":[[26.58399],[0.02317232],[0.002863659],[-0.0103310775],[0.023948237],[0.024388459],[0.024497893],[0.02269405],[0.02217117],[0.02469916],[0.02554692],[-0.01046288],[-0.010425196],[-0.010389729],[-0.0103868665],[-0.010423806],[-0.010380345],[-0.010442573]],"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":[[1.7315183],[-2.0931118],[-0.08195505],[-0.07830412],[0.17271917],[-4.8443527],[1.3409065]],"dense_1_W":[[1.3492318,0.050542787,-2.0778215,0.23633496,-0.18946455,0.08569419,-1.1538246,-0.56782997,-1.1068271,-0.28026178,0.6351039,-0.5325991,-0.16680008,-0.6554269,0.7481424,0.39339453,-0.037751142,0.12015114],[-0.8597578,1.2366588,1.7126143,-0.63454264,-0.43808976,0.8164015,-0.69233084,0.61550444,0.9666506,0.42250025,-0.7908081,0.5167161,0.30983937,0.048737403,-0.14529826,0.22033516,-0.09019369,-0.3203758],[0.051401302,1.1819376,5.170329,-0.33289638,-1.3051468,0.29249665,-0.37950587,0.86728233,1.2912674,0.83467674,-2.1016138,1.439997,0.83915204,0.022718783,-1.1455536,-0.6881879,-0.294737,0.1764151],[0.13776821,-0.616747,-0.0515103,0.09284325,0.5059833,-2.2745788,0.8794392,0.23675422,0.050319634,-0.16485108,0.022945715,-0.55973744,-0.19152954,0.5871755,0.48204577,0.43679258,0.084300846,-0.48278216],[0.32304537,-0.17996605,-0.050503615,0.057818476,-1.1874164,0.93133926,-1.135065,-0.2207176,0.5842914,0.26639673,-0.4034041,0.74324435,-0.26271045,0.25194508,-0.33687708,-0.11164587,-0.21532725,0.31314066],[-2.675871,0.18930794,0.004894184,0.36429468,-0.28649125,1.037061,-0.8956486,-0.2692209,0.13867386,0.14524221,-0.07555664,0.13616084,-0.29872495,0.0028986863,-0.50115776,0.32039323,0.062777095,-0.08310216],[0.82229155,0.4732484,1.5131059,0.062322427,-0.036212314,0.24138685,-0.46806708,0.7292275,1.3152804,0.55548984,-1.013016,0.65633196,0.2736623,-0.5331334,-0.49591142,0.22494234,0.028473936,-0.29246685]],"activation":"σ"},{"dense_2_W":[[-0.07206964,-0.69786,-0.3486531,0.48960513,-0.0696577,-0.49357864,0.2556807],[-0.2884806,-0.41657805,-0.3665416,0.15454409,-0.028397316,-0.2936546,-0.16180961],[0.803782,-0.27441671,0.8961105,-0.4721216,0.7000408,0.5584937,0.4574221],[0.2588418,0.21096861,-0.08602997,-0.7243836,0.6489519,1.1368387,-0.47698346],[0.5214179,-0.4379109,-0.10204686,0.5734521,-0.5929383,-0.35884753,0.059597526],[0.7346847,-0.71839786,-0.044602457,-1.2187109,-0.13774236,-2.6510515,-0.51899457],[-1.7133079,-4.6997886,-0.25009632,0.4603738,-0.87082464,3.0611444,-3.0963175],[-0.048846636,0.91797,-0.31641433,-0.20087503,0.10279341,0.38753894,-0.038774494],[0.15197727,-0.81371284,-0.12212125,0.7514405,0.32369855,-0.2520269,-0.50490427],[0.25197092,0.8954266,0.3530475,-0.9002343,-0.6774651,0.55687094,-0.2753792],[0.9715217,0.11435808,0.7430187,-0.18673508,0.24399346,0.75376093,0.18281539],[0.07828533,0.40924087,-0.0052447147,-0.87007385,-0.16614385,0.75889,-0.09113192],[-0.42538083,-0.6130854,-0.18442006,0.81436867,-0.4363763,-0.4421119,-0.20321086]],"activation":"σ","dense_2_b":[[0.21890728],[-0.08548715],[-0.08091435],[-0.101685315],[0.10115151],[-0.14451991],[0.54433477],[-0.21013816],[-0.0104931025],[-0.4982431],[-0.1676464],[-0.31867242],[0.17811179]]},{"dense_3_W":[[0.7400645,-0.16807431,-0.12028546,-0.58515614,0.34891638,-0.5609874,0.7747953,-0.06871472,-0.044812664,-0.26168486,-0.2864116,-0.4026426,0.7852125],[0.13187477,0.58926487,-0.62580276,-0.043964617,0.5385393,0.07869039,0.43877578,-0.6161494,0.4016125,-0.06597045,-0.4159714,0.23538205,0.7423825],[0.11068092,0.26080158,0.051800307,0.3499296,-0.56061244,0.5514093,-1.840586,-0.14135396,-0.050766982,0.4223278,0.39574477,0.30749676,-0.8040509]],"activation":"identity","dense_3_b":[[0.034426726],[0.022138074],[-0.039126255]]},{"dense_4_W":[[-0.8798318,-0.64988774,0.49071792]],"dense_4_b":[[-0.03172631]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HONDA_ODYSSEY.json b/selfdrive/car/torque_data/lat_models/HONDA_ODYSSEY.json
new file mode 100644
index 000000000..760d358b6
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HONDA_ODYSSEY.json
@@ -0,0 +1 @@
+{"input_std":[[8.67131],[1.0606116],[0.3141555],[0.047306955],[1.0598024],[1.059542],[1.058586],[1.0353245],[1.0132898],[0.98134106],[0.9488499],[0.0472228],[0.047223553],[0.04722212],[0.047007233],[0.04672726],[0.046201415],[0.045611456]],"model_test_loss":0.030893046408891678,"input_size":18,"current_date_and_time":"2023-08-06_16-03-17","input_mean":[[24.826109],[-0.0015730427],[-0.0024845933],[-0.006542893],[-0.0021615939],[-0.0027822834],[-0.0034116579],[-0.002972936],[-0.0019527061],[-0.0018800201],[-0.00055315095],[-0.0066206236],[-0.0066137947],[-0.0066051884],[-0.0065096957],[-0.00645474],[-0.0064896797],[-0.0065450436]],"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":[[2.0666385],[-2.1265264],[-0.009373159],[2.1585333],[0.037653618],[-0.017867725],[3.2116225]],"dense_1_W":[[1.1914837,-0.5645276,6.58303e-5,-0.11589882,0.37734768,-0.27381,-0.19863185,0.824706,0.4373293,-0.20449224,-0.15180561,0.35472932,0.3237236,-0.10154249,-0.578405,-0.2772973,0.10017485,0.25640446],[-1.0303509,0.29729548,1.9708672,-0.5768468,-0.028354015,0.42035812,0.3361436,0.3343814,0.37328744,0.8638404,-0.2677837,-0.15447378,0.49736965,-0.08687722,-0.66492444,-0.032154877,1.1899335,-0.48110774],[0.01983638,-0.24834296,-3.3855686,0.6749708,0.07187869,-0.024789268,0.37607005,-0.47755113,-1.0089839,-0.81658024,1.3305435,-0.97285813,-0.6226301,0.6422294,0.9579225,0.49827808,-0.48402268,-0.29993263],[1.2045997,0.62863886,0.0019727307,0.17700921,-0.8630537,0.98878884,-0.16361095,-0.29803157,-0.7254775,-0.15229262,0.3722205,-0.22486125,-0.06222317,-0.37571073,0.4424153,0.06388154,0.5859267,-0.56900877],[-0.013524671,0.31598365,0.0006406281,-0.25858632,-0.27701482,0.7357323,-0.35521507,-0.4483451,0.44878978,0.2829642,-0.2362616,0.62810344,-0.121423006,-0.38609955,0.0749125,-0.17727378,-0.38110465,0.35318217],[-0.0052065155,-0.5593012,0.002159691,-0.08422028,0.23008162,-1.022624,0.32955936,0.431307,-0.1006895,-0.030441636,-0.08401783,-0.3437167,-0.22863047,0.7158902,-0.17199361,0.09197799,0.19186375,-0.1833609],[1.4867296,-0.15920977,2.3333318,-0.23857078,-0.0040042745,1.2148064,0.10699171,0.22722282,0.5444096,1.349413,-0.47866884,0.40205494,-0.11314535,-0.5150614,-0.4630753,0.030254288,0.7952247,-0.2603006]],"activation":"σ"},{"dense_2_W":[[-0.17723514,-0.23341042,0.57393736,-0.4927488,-0.927548,0.58540887,-0.5868284],[0.66296387,0.29695207,0.20052847,-0.62608564,-1.0550549,1.0728254,0.0891513],[-0.16829221,-0.0679403,-0.36510104,0.23858383,1.1178643,-0.6089432,-0.31060657],[-1.8900537,-0.27381107,-0.5241167,-0.7089269,-1.1469728,-0.0641088,-0.41346708],[-0.51642907,-0.43836012,-0.31121448,0.47541407,1.169322,-0.2952497,-0.37012473],[0.8616518,0.12941492,-1.1983941,1.7177894,1.0778812,-1.3677566,1.5917606],[-0.407816,0.042307053,-0.53986156,0.5610484,0.7355027,-0.8320296,0.05677452],[1.4589415,-1.2519528,0.8708634,0.6212387,-0.9204132,1.7146589,0.13543351],[-0.055101812,-0.19029272,0.013408977,-0.46497017,-0.92594385,0.9864242,0.13991055],[0.5894197,-0.28149623,0.41216704,0.216877,-0.51424307,0.83235174,0.14314461],[-2.6734824,2.668342,-1.7240498,-1.0608208,0.54306996,-1.3263385,-0.19313851],[-0.82157856,-0.23220612,1.0158018,-2.0316136,0.06581752,0.7996686,-1.5219475],[0.5740489,0.18412288,-0.14555724,-0.5847231,-1.1873335,1.0647899,0.008006016]],"activation":"σ","dense_2_b":[[-0.29801813],[-0.25020108],[-0.022192547],[0.026752593],[-0.027117254],[0.30578387],[0.053404447],[0.23486306],[-0.07118241],[-0.09914868],[-0.18535325],[-0.32233533],[-0.04571355]]},{"dense_3_W":[[0.43566743,0.43129563,-0.6076586,-0.46461692,-0.40563574,-0.60545087,0.47773033,0.15361485,0.54101425,-0.14459106,-1.1077414,0.30648795,0.5856095],[0.07340811,-0.49523342,0.6213182,0.19087262,0.06972069,0.8834424,0.5443848,-0.50467765,-0.38180703,-0.4638601,0.65264165,-0.8575672,-0.5819035],[0.33573294,0.619451,-0.046216093,-0.66367626,-0.64414126,-0.084879674,-0.60994107,0.5997581,-0.2552046,0.10798684,-0.29609105,0.45087123,-0.3904423]],"activation":"identity","dense_3_b":[[0.064981125],[0.043677732],[-0.029785963]]},{"dense_4_W":[[-0.35612056,0.9586297,-0.2525408]],"dense_4_b":[[0.03888263]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HONDA_PILOT.json b/selfdrive/car/torque_data/lat_models/HONDA_PILOT.json
new file mode 100644
index 000000000..713bb4a0c
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HONDA_PILOT.json
@@ -0,0 +1 @@
+{"input_std":[[8.118591],[1.012343],[0.30252126],[0.04747358],[1.0110137],[1.0105052],[1.0093575],[0.98329234],[0.96060896],[0.93123335],[0.90310067],[0.04717917],[0.047231637],[0.047265887],[0.047122534],[0.046797972],[0.046346754],[0.045773227]],"model_test_loss":0.03557046875357628,"input_size":18,"current_date_and_time":"2023-08-06_17-27-23","input_mean":[[24.204573],[-0.024622405],[0.0015252293],[-0.0032674451],[-0.023904368],[-0.02417538],[-0.024461435],[-0.023585865],[-0.021832237],[-0.020321053],[-0.019801456],[-0.0032891335],[-0.0032849729],[-0.0032711467],[-0.0032068372],[-0.0030881383],[-0.0030222118],[-0.0030280964]],"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.7401334],[-4.296874],[0.051964045],[-1.5580355],[0.59131175],[0.9876563],[-0.059906512]],"dense_1_W":[[0.39198807,0.14618506,-0.0005603469,0.5384161,0.583554,0.90904,-0.9356289,-0.347572,0.054832783,-0.01266942,0.20926124,0.40405145,0.26462293,-0.5968776,-0.4170079,-0.24383324,-0.36820978,0.23693004],[-1.4237757,0.44019157,1.7405101,0.107415356,0.73406404,0.38215244,-0.6587738,0.6303781,0.9956125,0.3772358,-0.60114783,0.28546256,-0.21894793,-0.5291562,0.028785085,-0.0466827,-0.02260468,-0.14874777],[-0.011811628,0.5467675,3.1406043,-0.5367604,0.16197537,0.72486085,-1.0583096,0.6693704,0.23038347,0.16671906,-0.6996211,0.9920219,0.24508859,-0.8121351,-0.11340726,-0.124802016,0.0040163123,-0.03318359],[-0.89146703,-0.43514004,-1.1770084,-0.113605686,-0.2791039,-0.6336671,0.52206266,-0.37517008,-0.583943,0.13963065,0.10783694,-0.019744247,0.09936149,0.34897432,0.077529624,-0.12277383,-0.21316914,0.31482303],[-0.5459662,0.6174858,-1.5395053e-5,0.23975974,0.1680196,0.6688479,-0.5717515,-0.2257085,-0.37668842,0.37691414,0.016556103,0.5753194,0.43969232,-0.63690066,-0.79015404,0.094646364,-0.26196766,0.13351451],[1.219549,0.6434229,1.5366393,0.29663944,-0.1569686,0.1139518,1.0193243,0.13182868,0.1257156,0.4684622,-0.33492422,-0.1404477,-0.20704125,0.21394883,-0.60481495,0.20762968,-0.2884613,0.04056693],[0.0022561958,-0.10740119,-2.973164,-0.24940717,-0.11246171,-0.017514866,-1.2795074,-0.021132804,0.8575916,0.07600141,-0.029272523,0.5688567,0.09931985,-0.10324848,-0.2901189,-0.37775588,0.39807785,0.3334187]],"activation":"σ"},{"dense_2_W":[[0.5666278,0.1050696,0.5731484,-0.6657482,0.57242334,-0.6813752,0.650503],[-0.3233396,-0.44350263,-0.16690572,0.123169236,-0.8172176,0.5242723,-0.45013273],[-0.1649446,0.012782408,-0.80965835,0.28827253,-0.6245722,0.2006493,-1.087686],[0.96152276,0.35989368,0.22035821,-0.80648047,0.4686015,-0.6329297,-0.0023717843],[-0.11855806,-0.91366136,-0.90975124,0.47533065,0.41179633,0.05490874,0.1064329],[-0.73532724,-0.6584749,-0.5160826,0.34969312,0.062357668,0.13114415,-0.32903922],[-0.72250515,1.2826318,-1.2006475,0.9427826,-1.371755,0.20815341,-1.0248761],[-0.4109795,-0.64342046,-0.22680378,0.12261962,-0.15706545,0.4520076,-0.09530116],[0.5485182,0.3166386,0.60656774,-1.0352023,0.35866728,-0.37757927,-0.37554651],[-0.7688577,-0.31978396,-0.42268845,0.59393954,-0.4435929,0.47090167,-0.31540674],[-1.0920306,-1.0558451,0.11860894,0.49140632,-0.10677766,0.47734076,-0.398253],[-0.030640373,0.41173688,-0.98270494,0.5081087,-0.5071277,-0.3028872,-0.8938836],[0.4381069,0.943475,0.6218088,-0.742083,-0.38795125,-0.054727156,0.31301942]],"activation":"σ","dense_2_b":[[-0.09199342],[0.03208081],[-0.04846608],[-0.1532128],[-0.012221367],[-0.15162058],[0.14393868],[-0.17525378],[-0.38610223],[0.03283754],[0.02243522],[-0.046554077],[-0.10267613]]},{"dense_3_W":[[0.76260686,-0.14955303,-0.07697563,0.795136,-0.5793355,-0.39125565,-0.850312,0.054931063,0.53414947,-0.3139965,-0.5467518,-0.38860124,-0.034747276],[0.26200438,-0.37439495,-0.4377097,0.17163786,-0.30471745,0.30637982,0.06850715,-0.34865668,-0.35463956,-0.1303642,-0.39582416,-0.5477129,0.69954056],[-0.38012898,0.3671737,0.4092681,0.1147916,-0.33737427,0.28946012,-0.2992325,-0.067024715,0.4072253,-0.31171417,0.33009604,0.12577192,-0.27651602]],"activation":"identity","dense_3_b":[[0.05052462],[0.061525963],[0.01540329]]},{"dense_4_W":[[1.5063055,0.714805,0.00043001983]],"dense_4_b":[[0.047914207]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HONDA_RIDGELINE.json b/selfdrive/car/torque_data/lat_models/HONDA_RIDGELINE.json
new file mode 100644
index 000000000..3e53360cd
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HONDA_RIDGELINE.json
@@ -0,0 +1 @@
+{"input_std":[[8.957924],[1.0602055],[0.3483377],[0.044007655],[1.0696881],[1.0669217],[1.0629013],[1.022558],[0.99117285],[0.95355713],[0.91828537],[0.043950602],[0.043960184],[0.043955244],[0.04370865],[0.043465454],[0.04305762],[0.042518806]],"model_test_loss":0.03983215242624283,"input_size":18,"current_date_and_time":"2023-08-06_20-30-54","input_mean":[[24.622238],[0.017521156],[0.00757826],[0.0011451022],[0.016594924],[0.017204277],[0.018039215],[0.021406805],[0.02439622],[0.026556514],[0.028528417],[0.001193815],[0.0011970581],[0.0011935198],[0.0011202878],[0.001060377],[0.00095698517],[0.0008617843]],"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.07002942],[-0.16705358],[-2.9611764],[0.34919006],[0.515888],[-3.0217357],[-0.3703743]],"dense_1_W":[[-0.001037722,-0.23034889,0.00070932484,0.19091949,-0.35902733,-0.8921682,0.30972338,0.3144616,0.13060336,-0.1961081,-0.1309547,-0.729507,-0.079179555,0.49697357,0.02997426,0.37342516,-0.24386461,0.3236473],[0.9159012,-0.010550688,-2.401509,0.30691516,0.05056717,0.5097978,-1.1722806,0.17247927,0.34559217,-0.24330676,0.04055541,0.46409106,0.20967084,-0.82562864,-0.4943086,0.2081027,0.2530364,-0.0926206],[-0.93078494,0.5642841,2.5035574,-0.35270843,0.18849362,0.87544584,-0.2044937,0.73466784,0.47539774,0.07997192,-0.76057374,0.3159093,0.40554965,-0.5378864,-0.09868344,-0.3483285,0.16861473,0.19001411],[-0.8801367,-0.10308599,-2.2299495,0.04202499,-0.05023124,0.13920471,-0.78326404,0.39430746,0.23543742,0.14010431,-0.23845911,0.2567459,0.059797786,-0.57988393,0.113685064,0.14517607,0.16730362,-0.17216507],[0.14910753,-0.31030202,-2.4019601,0.1968272,-0.40163112,-0.23238596,0.6703164,0.07859055,-0.14317967,0.07362763,-0.04258365,-0.509903,-0.38269565,0.7657585,0.030617407,-0.11210979,0.30991936,-0.27056235],[-0.9013445,-0.74709606,-2.4476326,0.38786903,-0.3051019,-0.585037,0.06283271,-0.3787836,-0.61694026,-0.032208323,0.70738953,-0.2658627,-0.35824144,0.5567474,-0.033071913,0.1493693,-0.014829384,-0.16828252],[0.06442954,-0.869912,-2.9056792,0.1365006,0.16463475,-0.5906101,1.1546344,-0.06482889,-0.37295368,-0.1456135,0.2937723,-0.5213806,-0.57213086,0.38927227,0.49697468,0.21409509,0.63319594,-0.7391959]],"activation":"σ"},{"dense_2_W":[[-0.17591965,-0.07106175,-0.40103337,0.56516284,-0.6760929,-0.15387549,-0.89492965],[-0.45764968,-1.0195202,-0.41464484,-0.2810938,-0.028325718,0.09300495,0.35360244],[0.8125133,-0.54840755,-0.6930447,-0.89210993,0.56695956,0.44670337,0.5310144],[-1.0358114,0.33042994,0.11012975,0.23487902,0.24800783,-0.4299027,-0.46129325],[1.2276291,-0.5162977,0.22191486,0.16638434,0.23429595,-0.22487517,0.28309682],[1.0107075,-1.0881076,-1.008768,-0.5629702,-0.05878989,0.7923787,0.7309502],[0.49559563,-0.35230458,-0.7740999,0.02204071,0.24508348,0.075914145,0.75374156],[-0.21838671,0.42116773,0.5945599,0.30151197,-0.24432571,-0.46020442,-0.33258623],[-0.021219064,-0.25157404,-0.35190338,0.0668151,-0.6102883,0.1603531,-0.79725957],[0.0735072,0.5327899,-0.13316682,0.18007801,-0.7896261,0.08766711,-0.64606833],[0.6770077,-0.8900657,-0.26981142,-0.38599125,0.09799069,0.5758287,0.66643196],[-0.82503897,0.3003343,0.15965503,0.37416932,-0.644764,0.043236665,0.19912353],[-0.9234739,0.57710344,-0.4265305,0.3661275,-0.030128404,-0.4210636,-0.7627061]],"activation":"σ","dense_2_b":[[0.07509254],[-0.45370674],[-0.08009313],[-0.21234833],[-0.08377176],[-0.056009393],[-0.10460085],[-0.003972127],[-0.21230274],[-0.0108628925],[-0.14868702],[0.04881384],[0.053917274]]},{"dense_3_W":[[-0.43450725,0.28928438,0.63958466,0.26900065,0.59471947,0.045950003,-0.08964677,0.14317968,-0.1560713,0.4362775,0.6118739,-0.48017085,-0.17556131],[0.7623459,-0.3990245,-0.53529125,0.28715876,-0.25771093,0.25057483,-0.4946012,0.14644647,-0.02983568,-0.065986775,-0.55813897,0.34047204,0.29583102],[-0.093450435,-0.42808297,0.068437345,-0.1521326,0.11618435,0.6433002,0.44079673,-0.6619756,-0.2237737,-0.65349114,-0.118622996,-0.61334574,-0.14610668]],"activation":"identity","dense_3_b":[[-0.06914952],[0.05192733],[-0.03913266]]},{"dense_4_W":[[-0.4807093,1.1989409,-1.1321285]],"dense_4_b":[[0.044341844]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HYUNDAI_ELANTRA_2021.json b/selfdrive/car/torque_data/lat_models/HYUNDAI_ELANTRA_2021.json
new file mode 100644
index 000000000..bee1e8d93
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HYUNDAI_ELANTRA_2021.json
@@ -0,0 +1 @@
+{"input_std":[[8.738584],[1.5957829],[0.58238095],[0.048208784],[1.5838295],[1.5881729],[1.5908173],[1.5664002],[1.5340934],[1.4806168],[1.4221525],[0.047998115],[0.04803774],[0.048071872],[0.048102442],[0.04803064],[0.047811132],[0.04743304]],"model_test_loss":0.007402807008475065,"input_size":18,"current_date_and_time":"2023-08-06_22-19-42","input_mean":[[21.779322],[-0.078570016],[-0.0073580677],[-0.0065681813],[-0.07246284],[-0.0734754],[-0.07447408],[-0.07268334],[-0.069738925],[-0.06446174],[-0.057134904],[-0.0064781737],[-0.006475137],[-0.006476324],[-0.006474212],[-0.006491243],[-0.00650736],[-0.00642134]],"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":[[-2.1603358],[-0.419876],[0.084331356],[-0.07068766],[2.0145605],[-0.63310754],[1.434537]],"dense_1_W":[[-0.31878927,-0.47954968,-0.260915,-0.23391017,-0.14123324,-0.16656223,0.34148905,-0.55040246,0.048909064,-0.084660634,-0.05452977,-0.14122179,0.19401318,0.18124454,0.29322624,-0.11721254,0.058719337,0.049679324],[1.2746987,0.53341556,-0.5038306,-0.3943573,-0.3552817,0.6985798,-0.7583908,-0.071790285,0.10988926,-0.1613498,-0.43469277,0.20283195,0.37326258,-0.2713744,0.053292856,0.12493837,0.112449214,0.071374826],[-0.005748887,0.4395075,-0.023206176,-0.00010381389,0.10724853,0.79803634,-0.10418732,-0.17200217,0.07352905,-0.04382284,0.12897137,0.27188876,-0.2986032,0.1732639,-0.43260622,-0.13877538,0.108885035,0.037624177],[-0.009819267,0.7978249,3.3524475,0.21963945,-1.1893661,0.12886666,-0.12307468,-0.0057551884,0.89947134,0.2433565,-0.7049134,0.41656977,0.5013669,-0.4488184,-0.19362147,-0.21371745,-0.12667105,-0.11616998],[0.5350432,-0.6518214,-0.29382524,-0.186406,-0.17762733,-0.1445377,0.13506992,-0.35136354,0.24111918,-0.36675584,0.021335155,-0.05516007,-0.15420103,0.4554361,0.4533603,-0.34406003,0.006251238,0.1428859],[1.1166015,-0.29759768,0.48270738,0.43025842,0.0056440467,-0.4213741,0.4217568,0.15726581,0.074272975,0.1225627,0.32488325,-0.059570342,-0.34078333,0.076991476,-0.26384223,-0.06351244,0.1692961,-0.21616662],[0.098687425,-0.3278237,-0.21179028,0.0031954458,-0.20943744,-0.13822405,0.548112,-0.34726304,-0.3400807,0.25883827,-0.17620128,-0.36422935,0.52832425,-0.1289231,-0.026027037,0.18089916,0.1012807,-0.07116273]],"activation":"σ"},{"dense_2_W":[[1.3021795,-0.4139669,-0.7120532,-0.74666166,-0.18984732,0.048739053,-0.25614926],[-0.45348325,-0.5127636,-0.35794353,0.021264847,-0.73585445,0.02490475,-0.37029886],[-1.0356512,0.21161588,0.15873429,0.17991234,-0.3031208,0.07505193,-0.33505473],[1.5017016,-0.31481206,-1.1198424,-0.40624765,-0.09357655,0.51827437,-0.055450503],[-0.6468184,0.053211562,-0.6933904,-0.13317326,-0.24886934,-0.3967814,-0.6371098],[-0.41236708,0.3045984,0.51569694,0.026683038,-0.66206634,0.038440548,-0.3386708],[-0.58338356,-0.09002029,-0.13582824,0.008655593,-0.69411683,-0.21923552,-0.3192624],[-0.6897999,0.12905283,0.67996913,0.1456075,0.25029323,-0.34134966,-0.6459057],[-0.252227,0.043475367,-0.9427369,-0.14302255,-0.10663869,0.31176025,-0.35857844],[0.22877508,-0.5189181,-0.41833526,0.20187113,-0.1781152,-0.16428699,-0.2800521],[-0.65191513,0.44252837,0.6581859,0.25468537,-0.9424999,-0.32678768,-0.8593621],[0.43401113,-0.24967693,-0.281952,-0.284015,0.7110927,0.27138582,0.9720163],[-1.1512148,-0.18058608,0.45996955,-0.5937282,0.31828657,0.15207982,-0.22012103]],"activation":"σ","dense_2_b":[[0.0048766164],[-0.056708604],[-0.123050824],[-0.07202907],[-0.25869218],[-0.20529492],[-0.091088444],[-0.091022156],[-0.32449347],[-0.17546864],[-0.0612454],[0.04344016],[-0.074389376]]},{"dense_3_W":[[0.25576973,-0.575117,-0.6076316,0.36512917,-0.41574427,-0.40301278,-0.4620185,-0.5097215,0.122016355,0.3936914,-0.041409556,-0.059126735,0.07365807],[0.29514056,-0.25677466,-0.18109803,-0.030853858,-0.029449929,-0.28013232,-0.025037538,-0.4706025,0.02876151,-0.48724273,-0.6757201,0.6601352,-0.20265144],[-0.7641006,0.21497111,-0.28698337,-0.379376,-0.31239873,-0.26711258,0.02512146,-0.31214246,0.077003516,-0.18367848,0.6396449,-0.61027414,0.5836878]],"activation":"identity","dense_3_b":[[0.047669664],[0.041923303],[-0.020977087]]},{"dense_4_W":[[-0.6845342,-1.0030532,0.7527504]],"dense_4_b":[[-0.03611581]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HYUNDAI_ELANTRA_HEV_2021.json b/selfdrive/car/torque_data/lat_models/HYUNDAI_ELANTRA_HEV_2021.json
new file mode 100644
index 000000000..10e66ce04
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HYUNDAI_ELANTRA_HEV_2021.json
@@ -0,0 +1 @@
+{"input_std":[[9.910586],[1.4123459],[0.59487087],[0.03911551],[1.409979],[1.4115622],[1.411603],[1.3893355],[1.3640546],[1.3232217],[1.276401],[0.0390601],[0.039079115],[0.03908953],[0.039015334],[0.038927097],[0.038650174],[0.03832818]],"model_test_loss":0.007736066821962595,"input_size":18,"current_date_and_time":"2023-08-07_01-15-55","input_mean":[[22.795855],[-0.08798489],[0.01143446],[-0.009032234],[-0.09088829],[-0.090495676],[-0.09043885],[-0.08431701],[-0.0800931],[-0.07318552],[-0.065705255],[-0.009123672],[-0.009095005],[-0.009068311],[-0.008966204],[-0.008944961],[-0.008930321],[-0.008916563]],"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.1817923],[-3.718042],[-0.17253013],[1.0498631],[-2.7819123],[-0.40877423],[-0.1835958]],"dense_1_W":[[-0.051857583,1.3051457,3.4929137,-0.65374345,-1.1122645,-0.24794711,-0.3011514,-0.08444903,0.8605938,0.7186169,-0.99715984,0.579954,0.45131174,-0.5857832,-0.25104427,0.36404672,0.08432625,-0.118304946],[-1.1977811,-0.475098,-0.32292378,-0.4435726,-0.21691985,-0.45479798,0.93214303,-0.6325391,-0.057171293,-0.48693532,-0.058870036,0.043592565,0.29524007,0.19475447,-0.16399422,0.17714727,0.02705515,0.09614742],[0.0504194,0.37990266,0.039530136,0.04288842,0.036023762,0.50610423,-0.04245624,-0.08900527,-0.18667571,-0.136124,0.24658443,0.4461418,-0.21306992,-0.1905496,-0.24427558,0.019992698,-0.0458097,0.082212],[1.8970265,0.3291775,-0.45923525,-0.42205855,-0.4413092,0.022868842,-0.3697922,-0.2818066,-0.4076601,-0.3907717,-0.20571287,0.6031218,-0.23714252,-0.16817166,0.07743641,0.021997932,0.611759,-0.23154868],[-0.9974602,0.15397596,0.22610018,0.036102634,0.06823634,0.6489421,-0.41508022,0.35325828,-0.10202731,0.1711457,0.28493625,0.035079315,-0.4149946,0.08604628,0.117554076,0.10761524,0.08686444,-0.2359245],[-0.28764305,0.34052572,0.18389913,-0.017938213,-0.2068081,0.2519639,-0.7214537,0.29472184,0.27933893,0.27484724,-0.15843095,-0.037846185,0.316401,-0.09005458,-0.14835708,-0.19075473,-0.03951283,0.114958726],[-0.052516285,-0.16471781,0.17191207,-0.23444073,-0.022119049,-0.24730825,0.75023305,-0.40318617,-0.34178376,0.12554757,0.39539844,0.059354424,-0.44725272,0.4979164,0.060783666,-0.0009443115,0.11399086,-0.14107631]],"activation":"σ"},{"dense_2_W":[[0.15574715,0.106084,0.6234715,0.48498833,0.24288625,0.6844518,-0.61408937],[0.5661129,-0.5984536,0.79835355,0.3082054,-0.060715023,0.26763362,-0.016118767],[0.14648265,0.21900931,-1.1337527,0.16373587,-0.9757596,0.041679647,0.65339375],[-0.11193495,0.15425135,-0.22649455,0.4248423,-0.7341563,-0.15863545,0.44211566],[0.19026476,0.5881703,-1.0570571,0.34021673,-1.0282404,-0.26504597,0.28280511],[-0.8895008,0.8121495,-0.5693253,-0.77341056,0.33465576,-0.49232218,-0.11758821],[0.9326459,-0.36728933,0.24325472,1.0141891,0.16826893,0.2829455,-0.06759766],[-0.16648382,-0.44048628,0.39915726,0.06806857,1.0963099,-0.03239437,-0.6205627],[0.2911811,0.57449996,-0.9605739,0.043008372,-0.73384374,-0.6097065,0.45541903],[0.31353498,-0.08516989,0.8531249,0.013826798,0.6559815,0.18347614,-0.7929507],[-0.016170498,-0.18118915,-0.86683124,-0.34802145,-0.47758147,0.13393015,-0.17496912],[0.091279745,0.35503078,-1.1297911,0.2600009,-0.10615289,-0.7520532,0.5357286],[-1.2284657,0.86050045,-0.034789667,-1.018808,-0.06296706,-0.028193004,-0.4022851]],"activation":"σ","dense_2_b":[[-0.05504892],[0.01253799],[-0.062120188],[-0.051010966],[-0.08326587],[-0.2394042],[0.028907817],[-0.080568254],[0.03604939],[-0.12410697],[-0.01955361],[-0.051553864],[-0.18583551]]},{"dense_3_W":[[0.63645065,0.63501835,-0.66807485,-0.52668273,-0.28929064,-0.23005038,0.43932953,0.121157095,-0.7683699,0.4412728,-0.32547268,-0.71282554,-0.4370708],[-0.30129626,0.3909303,0.29454166,-0.1705362,0.48066851,0.06491059,-0.090611994,-0.08033778,0.3795498,-0.5508733,-0.32967407,0.38930234,0.2549319],[0.005347131,-0.5191341,-0.26486373,0.12736864,0.5334262,0.5237369,0.38844875,0.003590752,-0.26281914,0.01214623,-0.24618849,-0.056392476,-0.0030399126]],"activation":"identity","dense_3_b":[[0.015747098],[-0.13919984],[-0.0075076534]]},{"dense_4_W":[[1.3023344,-0.041308355,-0.00318671]],"dense_4_b":[[0.015396652]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HYUNDAI_GENESIS.json b/selfdrive/car/torque_data/lat_models/HYUNDAI_GENESIS.json
new file mode 100644
index 000000000..25ea1b538
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HYUNDAI_GENESIS.json
@@ -0,0 +1 @@
+{"input_std":[[6.5459266],[1.3150389],[0.55143183],[0.0433077],[1.3103489],[1.3122923],[1.3130105],[1.2928256],[1.2722898],[1.2458807],[1.2160609],[0.043061666],[0.04310888],[0.043158278],[0.04318699],[0.043118294],[0.042912837],[0.042521223]],"model_test_loss":0.008513328619301319,"input_size":18,"current_date_and_time":"2023-08-07_03-22-20","input_mean":[[28.507357],[0.10861685],[-0.013601736],[-0.0064216373],[0.110937536],[0.10975514],[0.10922218],[0.10294279],[0.09506291],[0.08270148],[0.068715945],[-0.006518178],[-0.006483864],[-0.0064613186],[-0.0065263556],[-0.0066083767],[-0.0067466046],[-0.006989514]],"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.09213746],[0.07837435],[-0.127023],[-3.701971],[0.02127427],[-1.6431203],[2.2172556]],"dense_1_W":[[-0.015300604,0.5825342,-0.05051114,-0.18122214,0.07876552,0.9315104,-0.6162402,0.016129851,0.010469424,-0.020838048,0.1523773,0.15082102,0.090840556,-0.28110996,-0.1849562,0.15245719,0.22167133,-0.14279774],[0.02588672,0.32077435,-0.006722575,-0.011324345,-0.5431526,0.77720726,-0.32035637,-0.036528517,0.21234833,0.12834615,-0.15494944,0.5575763,-0.31280997,0.0010270807,0.14701857,-0.5796583,-0.3692745,0.5129307],[-0.0071143424,0.15858999,0.05704565,0.18143037,0.10665202,0.79463303,-1.0030777,0.2742014,0.20928839,-0.016834116,-0.14212018,0.18155766,0.4066399,-0.36911637,-0.50523275,-0.22205615,0.03395741,0.21754928],[-0.91471785,-0.0921693,-0.48348656,-0.14060836,0.024012497,-0.018223943,-0.12564234,-0.15323682,-0.3923083,-0.38660574,-0.31491503,0.011104942,-0.050269924,-0.032277748,-0.20858657,-0.018367982,0.19149122,0.10155454],[0.002645861,-0.8126742,-2.6549594,0.3429386,-0.20882957,-0.07800046,1.2651403,0.20753327,-0.7863295,-0.38006702,0.40243247,-0.76908433,-0.23738272,0.14581157,-0.38623288,0.39540884,0.04323188,0.56106085],[-0.9343576,-0.3586926,0.48885745,-0.13841353,0.17987157,0.061989535,0.46451867,0.29794976,-0.008585158,0.35067263,0.529655,0.51325566,-0.010691093,0.24579975,-0.5215634,0.0016024356,0.093200974,-0.031658597],[0.8293412,-0.20795242,-0.4017055,-0.533866,0.06481363,-0.26879504,0.3793856,-0.471539,0.023038805,-0.48921797,-0.22237803,-0.25630578,-0.039906733,0.666029,-0.0033022463,-0.31751958,0.26048532,0.09580422]],"activation":"σ"},{"dense_2_W":[[-1.0194138,-0.4770013,-1.6248175,1.692745,0.9337828,0.8437085,-0.54136294],[-0.52307904,-0.3975833,-0.6281236,0.08257637,0.27855587,0.43421826,0.45445123],[-0.20069543,-0.41561922,-0.44643855,0.07080084,-0.5047794,0.030606043,0.30134434],[-0.47260144,-0.7754414,-0.77397937,0.25201085,-0.07254463,0.658033,0.5073921],[0.3583858,0.10549722,0.5157753,-0.14047585,-0.617101,0.01266099,-0.6511524],[-0.9189057,-1.0387809,-0.5919117,0.46444207,0.1477566,0.459492,-0.2141334],[0.6823633,0.32230988,-0.13244073,0.2521329,-0.5877716,0.24724948,-0.416414],[-1.1259369,-1.071255,-0.25267237,-0.15611424,-0.36670506,0.8724834,0.70592606],[-0.3924353,-0.48566842,-0.89685357,-0.118145935,0.5531914,-0.012460924,0.78037065],[0.22028138,0.3253433,0.69419026,-0.08042979,-0.053916857,-0.2591152,-0.7299852],[0.37642446,0.15646371,0.73757994,-0.17530896,0.03673549,-0.35259926,-0.61480165],[0.6373535,-0.17438105,0.09731847,-0.37075844,-0.66817486,0.2684939,-0.48366025],[-0.8707067,-0.44384053,-0.44201162,0.51280767,-0.21291855,0.090648316,0.46247554]],"activation":"σ","dense_2_b":[[-0.3433028],[-0.031133696],[-0.06321145],[-0.19336915],[0.029136015],[-0.03043773],[-0.08612019],[0.05573746],[0.27088183],[-0.027076768],[-0.045460623],[-0.23163527],[0.058642514]]},{"dense_3_W":[[0.25786313,0.56292504,0.20988815,-0.11078339,-0.77840126,0.58619094,0.01413026,0.5725057,0.1304814,-0.74678564,-0.2714909,0.0549931,0.36715108],[-0.81611776,-0.17429464,-0.21161298,-0.10920066,0.2845192,0.3519452,0.42357373,0.09085552,0.41325328,0.05708694,-0.14555562,0.13213179,-0.20445172],[0.19899562,0.10822825,-0.4272676,0.613673,0.33998376,-0.17425252,-0.64963627,-0.19976379,0.64160216,-0.4531084,-0.40512505,-0.49072832,0.52435446]],"activation":"identity","dense_3_b":[[-0.05059222],[-0.15303764],[-0.035763595]]},{"dense_4_W":[[-0.9634106,0.023092944,-0.42669016]],"dense_4_b":[[0.04803448]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HYUNDAI_IONIQ_5.json b/selfdrive/car/torque_data/lat_models/HYUNDAI_IONIQ_5.json
new file mode 100644
index 000000000..109e31675
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HYUNDAI_IONIQ_5.json
@@ -0,0 +1 @@
+{"input_std":[[9.469145],[1.4993936],[0.57071626],[0.04533063],[1.4846802],[1.4910924],[1.4950643],[1.4770368],[1.450109],[1.4059838],[1.3534893],[0.0450725],[0.04513867],[0.04519552],[0.04527874],[0.045279715],[0.045107212],[0.044762082]],"model_test_loss":0.011814278550446033,"input_size":18,"current_date_and_time":"2023-08-07_03-50-24","input_mean":[[22.163363],[-0.072142825],[-0.0025159488],[-0.006112024],[-0.069063514],[-0.06971331],[-0.0704586],[-0.0690143],[-0.06599702],[-0.060672827],[-0.053519193],[-0.006028869],[-0.0060502393],[-0.0060780053],[-0.006223877],[-0.0063924924],[-0.0066624186],[-0.006921035]],"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":[[-1.1967828],[1.3245456],[0.103971295],[-1.2520714],[-0.16602024],[-2.0981002],[-0.14066501]],"dense_1_W":[[-0.4214301,0.103772216,0.8929513,-0.18447745,-0.2701103,0.30181846,-0.36284757,0.21057971,-0.018612964,0.0593094,-0.16024835,0.1416867,-0.15246183,-0.3907173,-0.08361737,0.2765874,-0.1042719,0.12791668],[0.2745816,0.9077304,-0.011180789,-0.113791615,0.3160003,0.6698024,-0.6092146,-0.40735677,-0.053869486,0.12563229,0.2932765,0.4824642,0.22824322,-0.60383517,0.30220488,-0.049962338,-0.10605018,-0.088415876],[0.057883058,-0.04662177,0.68351626,-0.26972455,-0.43764362,-0.3083863,0.90403295,-0.09680003,-0.1232865,-0.18376413,0.0876113,-0.32598537,0.17061934,-0.039507188,0.030940559,0.22072437,-0.15162866,0.08447131],[-0.4781647,-0.22644347,-0.89709544,0.010036355,0.10885899,-0.12831874,0.32772595,0.41050613,-0.5090009,-0.107521385,0.26115948,-0.30580103,0.59975356,0.21102095,0.12877508,-0.07514449,-0.22881992,0.021187356],[0.011980259,0.655078,0.042019397,-0.39598337,-0.041903555,0.066606015,-0.36221957,0.049460504,0.3256252,0.043578107,-0.21974392,0.42173225,-0.007631104,-0.024107013,0.045484435,-0.3227939,-0.42450958,0.39688012],[-0.3749303,1.2016063,-0.0067011383,-0.14846599,0.07785109,0.20617402,0.023736777,-0.21452771,-0.34367922,0.24584025,0.24662304,0.051978063,0.2859072,-0.12438496,0.35116002,-0.25033846,0.10243457,-0.23285078],[0.010329517,-0.67234844,-3.8885512,0.32423398,0.45072496,0.7296973,0.38731125,-0.056170475,-0.81186455,-0.70703673,0.57100385,-0.9289139,0.09747156,-0.16550198,0.57601154,0.15654263,0.26841167,-0.023330638]],"activation":"σ"},{"dense_2_W":[[0.12735078,0.7578463,-0.8394619,-0.16871296,0.67499816,0.50618064,-0.036082815],[-0.9349809,0.49174136,0.64577276,0.8777052,-0.27532703,-1.3241053,0.92440283],[-0.88465834,-1.2536055,0.3215816,0.9998298,-0.78880596,0.3562564,0.29056188],[0.38568902,0.47334033,-0.39721346,-0.4981637,0.029624036,0.738565,-0.1316896],[-0.054050677,-0.34113935,0.34908327,0.3195855,-0.82633394,-0.4289165,-0.2309725],[-0.6001114,-0.48455656,0.088143736,0.6083232,-0.19328989,-0.6810937,0.45793325],[-0.04838382,-0.6484051,-0.373168,-0.47354728,-0.71413493,-0.10174487,0.009353199],[0.8382851,0.78388906,-0.7335581,-0.45394737,0.45634454,0.032309055,-0.18919362],[0.29141206,0.25385764,-0.36612022,-0.35426342,0.6002645,0.6095089,-0.22014005],[-0.29009074,-0.96834266,0.6976368,0.3486304,-0.2684134,-0.94937044,-0.25426298],[0.11204245,-1.096992,0.3850058,0.012738441,0.02725583,-0.9902537,0.24397202],[-0.33665514,-0.9425791,-0.08292521,0.23680806,-0.41410118,-0.24981315,0.34143913],[0.014888026,-0.03633883,0.665913,0.18707138,-0.85576785,-0.8612555,-0.39374956]],"activation":"σ","dense_2_b":[[-0.017777005],[0.23545785],[-0.15226115],[-0.047002222],[-0.08956424],[-0.059980016],[-0.13794045],[0.0060922517],[-0.3427262],[-0.07332524],[-0.21932544],[-0.22186531],[-0.076186255]]},{"dense_3_W":[[-0.7212533,0.5909567,0.60852754,0.30440143,0.5012994,-0.24762858,-0.66177696,0.15439416,-0.22291721,0.4902901,-0.34424105,-0.119624294,0.09342594],[0.44096592,-0.49161512,-0.6518094,0.6872087,-0.59066635,0.55458814,-0.36470622,0.4769713,-0.045274016,0.15205328,-0.5337833,-0.3563202,-0.15947717],[-0.7922449,0.5979252,0.5463646,-0.42703834,-0.019785186,0.51403254,0.4312795,-0.45969784,-0.33491063,0.21159784,0.3650792,0.1885672,0.5103654]],"activation":"identity","dense_3_b":[[-0.11362524],[0.06490415],[-0.09258138]]},{"dense_4_W":[[-0.34753174,0.23976417,-0.86662257]],"dense_4_b":[[0.07719801]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HYUNDAI_IONIQ_EV_LTD.json b/selfdrive/car/torque_data/lat_models/HYUNDAI_IONIQ_EV_LTD.json
new file mode 100644
index 000000000..0bb8fb0fe
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HYUNDAI_IONIQ_EV_LTD.json
@@ -0,0 +1 @@
+{"input_std":[[4.3663363],[1.0055081],[0.48724762],[0.041052617],[0.9967611],[1.000683],[1.0039185],[1.0006562],[0.9922954],[0.9760051],[0.96259797],[0.040620644],[0.040736996],[0.040861562],[0.041329786],[0.041552614],[0.04158318],[0.041458495]],"model_test_loss":0.007739691529422998,"input_size":18,"current_date_and_time":"2023-08-07_05-33-00","input_mean":[[21.149132],[0.04869401],[0.010550776],[-0.042260047],[0.04392769],[0.045757443],[0.04700402],[0.05030857],[0.046020832],[0.043477297],[0.04459311],[-0.042488344],[-0.042413425],[-0.042349935],[-0.0422564],[-0.042364012],[-0.04258541],[-0.042924497]],"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.2678127],[0.08612767],[-0.9489097],[0.706986],[-0.30796576],[-0.32985103],[0.080427095]],"dense_1_W":[[0.0036277466,0.51429325,1.0403895,-0.21717447,-0.43794936,-0.19047353,-0.64920795,-0.048046228,0.69371104,0.53239745,-0.7118019,0.6192604,0.5279617,-0.30141866,-0.19268416,-0.3834617,-0.04798644,0.15677519],[0.030118963,-0.13764045,-0.07282364,0.08246006,0.2705789,1.1211811,-0.57014453,-0.16758528,-0.2744678,0.09098098,0.30342337,-0.20622616,0.0074658724,0.117365144,-0.2300956,0.17353779,0.0072367247,-0.05224067],[-0.46240714,-0.814998,-0.15898485,0.23570561,0.2619672,-0.6533978,0.53975147,0.42714936,-0.15445922,-0.27475175,0.2855774,-0.6121087,-0.085973136,0.56669056,-0.24448115,0.47533005,-0.0016848596,-0.2630539],[0.48946816,-0.17746238,-0.16460344,-0.3096607,0.21007513,-0.51034343,0.029157858,-0.13090727,-0.09923416,0.38133857,-0.08658899,-0.37016922,-0.20602193,0.81421083,0.47483093,-0.30339777,0.043880396,-0.07612349],[0.010865774,-0.24699818,1.7088879,0.025180334,0.0171949,-0.8591754,0.41037732,-0.19206196,0.020423349,-0.07455425,0.17094779,-0.25438294,0.11110474,0.32507765,0.43417934,-0.011772227,0.14530338,-0.59843206],[0.027194558,0.63995826,-0.010129754,0.44069192,-0.1763659,-0.9194824,0.02155618,-0.12091762,-0.05442227,0.43881658,-0.3719806,-0.23903327,-0.20877454,0.41533244,-0.13582179,-0.14811464,-0.20708357,0.15655594],[-0.0028607307,0.34870997,2.821092,0.2508811,-1.035149,-0.465783,-1.5769824,0.18240027,1.7161161,1.8064464,-1.3023019,0.52437043,-0.00077510276,0.16097444,0.040497832,-0.045791112,-0.8714639,-0.1387739]],"activation":"σ"},{"dense_2_W":[[-0.4802455,-0.5064868,-0.2886249,-0.0686329,-0.27806887,-0.3524303,-0.80409414],[0.34504583,0.3495648,-0.7631179,-0.38251773,0.29856616,-0.26794648,-0.18538539],[0.6198588,-0.22676483,-0.35512465,0.12881657,-0.40367082,-0.9252802,-0.0002468375],[0.35880542,0.46389118,-0.8148363,-0.59149826,-0.5300025,0.20585157,-0.07116474],[-0.23429085,-0.62216985,0.59508204,0.4193159,-0.15182957,0.5141024,-0.41728604],[0.66723776,0.073733844,-0.070885584,-0.48375297,-0.45241132,-0.84997284,-0.031634018],[-0.5627967,-0.4777591,0.868787,0.17813006,0.21961252,0.14355378,-0.57126164],[-0.14685419,0.03656165,-0.7900763,-0.08400198,0.24159017,-0.85876423,-0.26216614],[-0.71358204,-0.689546,0.051773578,-0.0848018,0.18454298,0.22894992,-0.1594909],[-0.018925406,-0.706924,0.090921454,0.70733404,-0.1029515,0.4853316,-0.19676127],[0.3700011,0.58441055,0.019160673,-0.4851522,-0.5654224,-0.81087536,0.48571846],[-0.6824983,-0.010707942,-0.03845548,-0.24932735,0.10926147,-0.65549374,-0.13580413],[0.044423133,0.24843681,0.10453449,-0.5270328,-0.0071183904,-0.805887,0.016872479]],"activation":"σ","dense_2_b":[[-0.32894507],[-0.1402385],[-0.08289674],[0.058721446],[-0.08779582],[-0.08003288],[-0.0015345884],[-0.02523492],[0.00043462456],[-0.033334095],[-0.036279026],[-0.33189464],[-0.07644796]]},{"dense_3_W":[[0.13798034,-0.55931157,-0.057955276,-0.049440853,0.51565015,-0.01682391,0.30927873,-0.11561556,0.6672029,-0.07284992,-0.4854766,-0.14209567,-0.34877455],[-0.031582475,0.050488807,-0.24109462,-0.54226226,-0.22244236,-0.3798091,0.5201355,0.11588744,0.013117147,0.33739212,-0.23309216,-0.14616711,-0.5281888],[-0.076868005,-0.03763952,-0.29681742,-0.12974247,0.4806066,-0.04267054,0.51561165,-0.50798887,-0.13377365,0.61627406,-0.48184386,0.3136061,0.23230153]],"activation":"identity","dense_3_b":[[0.062304508],[0.06676691],[0.045753885]]},{"dense_4_W":[[-0.7684763,-1.1087472,-0.815416]],"dense_4_b":[[-0.05879514]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HYUNDAI_IONIQ_PHEV.json b/selfdrive/car/torque_data/lat_models/HYUNDAI_IONIQ_PHEV.json
new file mode 100644
index 000000000..81deb9f47
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HYUNDAI_IONIQ_PHEV.json
@@ -0,0 +1 @@
+{"input_std":[[7.896002],[1.2703207],[0.4862841],[0.043405883],[1.2591066],[1.2634319],[1.2668407],[1.2588236],[1.2390842],[1.196458],[1.1518458],[0.04327276],[0.043316394],[0.043354623],[0.043371588],[0.043337632],[0.043194752],[0.04294343]],"model_test_loss":0.0052194190211594105,"input_size":18,"current_date_and_time":"2023-08-07_06-24-33","input_mean":[[21.445068],[0.09960828],[0.007299674],[-0.0005310989],[0.09852017],[0.09864108],[0.09867044],[0.10080879],[0.10140148],[0.09866842],[0.095603466],[-0.00043161964],[-0.0004366571],[-0.00044840755],[-0.00056364527],[-0.0007040198],[-0.0009044244],[-0.0011604802]],"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.09470449],[3.0432646],[0.03450416],[-0.46021092],[1.1594877],[0.029558277],[1.8363751]],"dense_1_W":[[0.005493746,-0.3358011,0.0037607898,0.29596448,0.3943874,-1.0717398,0.5701757,0.016112054,-0.3643242,0.23849818,-0.075061426,-0.56350166,0.061684538,0.23258829,0.3412455,-0.086815886,0.09234655,-0.08318382],[0.5553914,1.0832955,0.025380384,-0.42384112,0.25218967,0.2652197,-0.08185232,0.14480954,-0.08236447,0.41922125,0.03566944,0.47901392,0.27303162,0.23061423,-0.48810846,-0.049590047,0.055590317,-0.0777213],[0.020737711,-1.0003403,-4.471138,0.18066612,0.8972061,0.281358,0.63211244,0.037308935,-0.27867937,-0.5369628,0.02718618,-0.8628528,-0.5999772,0.41523072,0.23050354,0.6017408,0.07975743,-0.02996209],[0.13376372,-2.1679244,0.024798622,-0.6729938,-0.54384416,-1.0513178,0.8737397,-0.41420826,0.114922546,-0.99975115,-0.08032563,-0.5233528,-0.047853615,0.95928097,-0.67657197,-0.6571614,0.3954971,0.7528502],[1.0411915,0.2750806,-0.017673122,-0.287801,-0.5224428,-0.17964116,-0.7069524,-0.38134468,-0.040215928,-0.100667715,-0.22424145,-0.011132579,0.045741584,0.25371146,-0.41912347,-0.07781668,0.072858974,0.3702856],[0.006503676,0.31328365,0.7664561,-0.6728464,0.3802759,0.44000676,-0.5781886,0.107931,-0.15678358,0.1777509,-0.48083207,0.49993676,-0.26356068,-0.6739486,0.0690044,0.28473458,-0.08100241,0.2141241],[0.6557612,-1.1317073,-0.01985534,0.2997433,-0.3100224,-0.5334095,0.59377813,-0.11130485,0.11088933,-0.23197712,-0.15815854,-0.38820937,0.05915133,-0.4817993,0.3789274,0.16070421,-0.20570633,0.1632214]],"activation":"σ"},{"dense_2_W":[[0.4679878,0.2634842,-0.028860494,-0.21427041,0.14012837,-0.5288975,-0.42545995],[-0.6775605,-0.4815579,-0.454403,-0.07230136,0.009694609,0.59333,-0.62719697],[-0.6382057,0.6997013,0.36473322,0.2414489,0.13382578,-0.18536665,-0.90939593],[-0.8748301,2.3719103,-1.56188,-1.8237168,2.1302335,1.2548504,-0.031323623],[0.503896,-0.679211,-0.6008442,0.60013664,0.17343543,0.17834695,0.24348144],[-0.13778792,0.15866904,-0.76191425,-0.5750008,-0.69259375,0.40918577,-1.4637057],[-0.52587533,-0.25144148,-0.31243584,-0.1940254,-0.25742918,0.22230358,-0.21316433],[-0.29734585,-0.21217649,-0.4547587,-0.4792317,0.52856797,0.5213185,0.07181257],[-0.007364429,0.007793841,-0.71918666,-0.005362996,0.23980153,-0.49275202,-0.6564195],[0.27902287,0.11022579,0.09352632,0.18805945,0.30498815,0.03035562,0.31641266],[0.65705526,-0.5266016,-0.022429584,0.18331312,-0.32305643,-0.007786143,-0.26408496],[-0.4082327,-0.25355664,-0.5861339,0.31163412,0.25877875,-0.75417554,-0.30994046],[0.5602024,-0.5399794,0.34386253,-0.40272358,-0.48508552,-0.18899718,0.17928903]],"activation":"σ","dense_2_b":[[-0.010232577],[-0.00023857807],[-0.034300473],[0.46175855],[-0.028856292],[-0.191977],[-0.23886801],[-0.003576378],[-0.22439884],[-0.009154732],[-0.014472028],[-0.22065732],[0.0036408578]]},{"dense_3_W":[[-0.30743915,-0.5722211,-0.48067984,-0.108277574,0.29175866,-0.51613647,-0.52692574,-0.06551988,-0.0476114,0.3618537,0.05102852,-0.27722335,0.5223134],[0.30818227,0.17767535,0.5113013,-0.25676715,-0.058021083,0.4884727,-0.23518495,0.43626583,-0.42181972,-0.047644824,-0.1406492,0.23160899,-0.44818217],[0.45361012,-0.51555586,-0.5169346,-0.2632498,0.44542933,-0.15754463,0.30686757,-0.56882674,0.065441564,0.3283218,0.18038327,0.1817784,0.5348782]],"activation":"identity","dense_3_b":[[0.012215524],[0.0026582293],[0.008550247]]},{"dense_4_W":[[-0.97812647,-0.12224905,-1.2473096]],"dense_4_b":[[-0.009789151]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HYUNDAI_KONA_EV.json b/selfdrive/car/torque_data/lat_models/HYUNDAI_KONA_EV.json
new file mode 100644
index 000000000..bb7619308
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HYUNDAI_KONA_EV.json
@@ -0,0 +1 @@
+{"input_std":[[8.222069],[1.4015005],[0.5433659],[0.046245173],[1.3907557],[1.3952589],[1.3979354],[1.3851876],[1.3639251],[1.3265828],[1.2794514],[0.04593869],[0.04602148],[0.04609722],[0.046142124],[0.04606174],[0.04579012],[0.045302678]],"model_test_loss":0.009272297844290733,"input_size":18,"current_date_and_time":"2023-08-07_07-41-26","input_mean":[[21.305267],[0.004457678],[0.0094668595],[-0.012420628],[0.004529341],[0.005278159],[0.005986334],[0.00870795],[0.010163208],[0.009530685],[0.008663278],[-0.012377954],[-0.01237566],[-0.012378746],[-0.012456359],[-0.012550046],[-0.012720126],[-0.012910544]],"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":[[-2.047097],[1.9158853],[0.17434227],[-0.97165537],[-0.10269022],[-0.9169131],[0.0008914754]],"dense_1_W":[[-0.88408405,1.235049,0.0426836,0.013424199,-0.08920125,-0.013397676,0.586178,-0.04885077,0.3810674,0.36573988,-0.3742023,-0.11406285,0.04956962,0.03306387,-0.10079546,-0.18288964,-0.018636217,0.16385865],[0.88075936,1.297032,0.032537315,-0.17033583,-0.09099818,0.4118023,0.12728553,0.14429076,0.1508224,0.15520132,-0.16594887,0.11192377,0.23395588,-0.301161,-0.2021957,-0.0027576552,0.08704741,0.086546],[0.7485217,0.44026893,-1.9140397,-0.17217009,0.059100352,-0.047859672,-0.5856153,0.44894385,0.22710915,-0.21913743,-0.29625463,0.322819,0.07943353,-0.022421572,-0.090653695,-0.444467,0.1394176,0.18164952],[0.4358342,-0.32757956,2.063401,0.20161365,-0.24610913,-0.3428621,0.6505693,0.016287383,-0.07427287,0.03351724,0.22633989,-0.3643204,-0.26658386,0.20206529,0.12288221,0.2783347,0.19327204,-0.36068434],[-0.0035009065,-0.72611684,-0.0082449615,-0.22654101,0.46806103,-0.34762052,-0.40569013,0.40099728,0.11805809,-0.16216965,-0.042650726,-0.89064217,0.21002078,0.642215,0.20523302,0.31924605,0.101329714,-0.13541093],[-0.41431567,0.11045769,2.0121331,-0.2800082,-0.054261006,0.11609053,-0.5194348,0.0039073634,0.18652305,-0.21063456,0.3278946,0.18608095,-0.043919813,0.063306555,-0.30901843,0.42117286,0.14100657,-0.16917707],[0.1144374,0.0647928,1.4224553,-0.33906898,-0.090644486,-0.5943667,-0.7509755,0.8212074,0.73758525,0.21148895,-0.4533185,0.18891388,0.058078196,-0.32458195,0.36525872,0.30673453,-0.21418211,-0.02886248]],"activation":"σ"},{"dense_2_W":[[-0.09611834,0.018518968,0.3276854,-0.29474196,0.07749839,-0.18393336,-0.108452864],[0.8463591,0.2765366,0.26273692,-0.542793,-1.3948811,0.38413918,0.13216402],[0.6448755,-0.9121937,-0.4041889,-0.44714126,-0.6450281,0.62885827,0.6442234],[-0.6492855,-0.59167993,-0.2413325,0.6629408,0.8960554,-0.16874227,-0.23902991],[0.25179657,-0.0052280165,-0.787087,-0.52129155,-0.7962139,0.5745307,0.5154668],[0.1658994,-0.14782484,-0.34189487,-0.24388146,0.26166263,-0.10471854,-0.98238224],[0.3014624,-0.11165519,0.1926479,-0.0071346364,0.12017147,-0.5179131,-0.42826292],[-1.3958447,1.0750867,0.51260227,0.5384232,-0.34655526,1.0435345,1.5503204],[0.40272388,0.12323784,0.24391593,-0.66794497,-0.92917013,0.24938683,0.35117647],[-0.37655634,-0.79549915,-0.7874939,0.049076214,0.16099943,-0.46943882,-0.46139815],[0.101291455,0.14885388,-0.42190292,0.31973553,0.7213091,-0.43006414,-0.27885658],[-0.32128662,-0.3569677,-0.5827871,-0.44924423,0.16653252,-0.70502335,-0.009819985],[-0.1346414,0.065946266,0.22599967,-0.71018034,-0.8050497,0.21156272,0.017037582]],"activation":"σ","dense_2_b":[[-0.15589215],[-0.28170976],[-0.38979664],[0.083457045],[-0.43890372],[-0.010706772],[-0.07441867],[-0.20225793],[-0.14819947],[-0.0007909137],[-0.0439504],[0.00047137964],[-0.0815142]]},{"dense_3_W":[[0.04960481,0.7185168,0.55996764,-1.1893424,0.63903844,-0.7087734,0.2795772,0.5947179,-0.12752935,-0.9978769,-0.25698617,-0.06704499,-0.04695985],[0.301456,-0.21193206,0.22014925,0.07238018,-0.24935168,-0.38614914,-0.53463185,0.41344443,0.122541234,0.4214228,0.2293029,0.506032,-0.25195587],[0.30665806,0.26296693,0.6493592,-0.4486736,-0.020275978,-0.3785944,-0.39404252,0.43909723,0.5369053,-0.4844059,-0.36188412,-0.6198387,0.2678705]],"activation":"identity","dense_3_b":[[-0.104795374],[-0.0101343505],[-0.022516306]]},{"dense_4_W":[[0.6437274,-0.14137705,0.8526488]],"dense_4_b":[[-0.020337932]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HYUNDAI_KONA_EV_2022.json b/selfdrive/car/torque_data/lat_models/HYUNDAI_KONA_EV_2022.json
new file mode 100644
index 000000000..4e71fbb64
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HYUNDAI_KONA_EV_2022.json
@@ -0,0 +1 @@
+{"input_std":[[8.980772],[1.3223853],[0.9268239],[0.024433661],[1.4122427],[1.3833307],[1.3508096],[1.2307118],[1.1849836],[1.1415477],[1.0909376],[0.024418019],[0.024408164],[0.024402233],[0.024252728],[0.024191827],[0.024145853],[0.023861935]],"model_test_loss":0.010252699255943298,"input_size":18,"current_date_and_time":"2023-09-01_20-45-00","input_mean":[[16.563862],[0.1111928],[0.6683766],[0.015079002],[0.0854696],[0.09152668],[0.09758363],[0.121493205],[0.14106716],[0.15788953],[0.16946313],[0.015242839],[0.01523548],[0.015225873],[0.015277851],[0.015472722],[0.015790224],[0.015869608]],"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.9736897],[-0.14363614],[0.085171],[-0.55840254],[0.055252872],[2.0375261],[-0.18923905]],"dense_1_W":[[1.5419508,0.4347514,0.022342844,-0.13883114,0.2409088,-0.12417678,-0.53509873,0.20153597,0.17858733,-0.19925015,0.06234279,0.24006103,-0.19976556,-0.18627135,0.45923752,-0.15200825,-0.08930177,-0.0050552515],[-0.030591678,0.13387124,0.17806397,-0.13424215,3.5386305,1.7213475,0.84962314,-2.7109919,-1.8677185,-0.9485388,0.11587285,-0.52675563,0.16423121,0.09590165,-0.005669875,0.12117092,-0.3104153,0.34291723],[-0.040051196,-0.90900606,0.033305887,0.48924676,-0.05219214,0.16458692,0.23944448,-0.65811116,-0.14248033,-0.040640995,0.23316579,-0.11273267,0.26166895,-0.3892416,0.20361155,-0.32397175,-0.04944256,0.12745105],[-1.8584498,0.5795085,0.0001561481,-0.3926851,-0.62748444,0.32592124,0.26113057,-0.18676938,0.15465672,-0.039395984,-0.11589895,0.3461765,-0.16687828,0.007636779,0.34468338,-0.24718969,-0.08537343,0.095972665],[0.008184925,0.29720604,0.12834367,0.24606115,-0.050453648,-0.14317429,0.01469496,0.10121035,-0.15977393,-0.071321785,0.14336964,0.1700991,0.15197535,-0.16201954,-0.27186736,-0.18587373,-0.29943192,0.31800416],[1.3913352,0.09059665,-0.06279646,0.282595,-0.5809931,0.06669835,0.31247872,0.33775496,-0.5383088,0.59837353,-0.45551175,0.69241804,-0.26237598,-0.25280276,-0.23810647,-0.60125524,0.035016667,0.40757436],[-0.020792918,0.8449914,-0.31495875,-0.18665223,0.2601113,0.23361494,-0.20227535,0.23019418,-0.36623937,-0.52237487,0.2838479,-0.23221277,0.23532006,-0.1258153,-0.1928124,0.17601454,0.39783114,-0.15201832]],"activation":"σ"},{"dense_2_W":[[0.47221714,0.016886314,-0.33116162,-0.06792718,0.35775667,-0.52708566,0.5025349],[0.9420784,-0.7130284,0.091753036,0.014161378,0.35075215,0.23026218,0.2984281],[0.1440958,-0.022310976,-0.63004696,0.21640168,0.8508171,-0.16760021,0.13965653],[-0.051360242,0.4106794,-0.88011396,0.61412853,0.7515858,-0.2784069,0.19800848],[0.5194753,0.046521883,-0.864117,-0.34576842,-0.21068099,-0.09319121,0.52076554],[-1.8818634,0.99190366,-0.5483396,0.07163825,-0.53633076,0.30430192,-0.43019328],[-1.7481059,1.364397,-0.05183877,0.26558736,-1.0966011,-0.21229754,-0.33233747],[-0.30067447,-0.19872609,0.59686613,-0.5647894,-1.0501944,0.8325608,-0.43664268],[0.59113705,1.348725,0.6290724,-0.6959389,-0.8086151,0.6735704,-0.24954763],[-0.4161925,-0.09258512,0.60084736,0.50538963,-0.20283572,-0.10547142,0.25737134],[0.26642272,0.27427554,-0.86675686,0.3761756,0.13520287,-0.49277586,0.023729336],[-0.057346545,0.40247637,-0.96133965,-0.24963704,0.4294661,-0.0321745,0.3121117],[-1.1896358,0.47296816,0.2525738,-0.41773388,-0.91891223,0.53242177,0.026586607]],"activation":"σ","dense_2_b":[[-0.06391301],[0.10446307],[-0.07552547],[-0.03267669],[-0.08992916],[-0.3635667],[-0.4151249],[0.16962343],[0.17003855],[-0.014166557],[-0.009087415],[-0.12204086],[-0.021121267]]},{"dense_3_W":[[0.11135484,-0.110632345,0.19104497,0.45092243,-0.58294576,-0.22749306,0.0548284,-0.20707788,-0.07605733,-0.5409419,0.18328355,0.36243346,0.48439535],[-0.4690379,-0.19305366,-0.2964049,-0.77543974,-0.26955664,0.62021655,0.51425976,0.6449075,0.6932653,0.29448414,-0.5598454,-0.47247913,0.639388],[-0.086130135,0.0662881,-0.39795497,-0.05040378,0.051303852,-0.38565347,0.81593895,0.65294117,0.45629048,-0.2787272,0.3136061,-0.34606743,0.6333548]],"activation":"identity","dense_3_b":[[-0.0200204],[-0.028796887],[-0.06285456]]},{"dense_4_W":[[-0.10954055,-0.93173796,-0.32423872]],"dense_4_b":[[0.031629298]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HYUNDAI_KONA_HEV.json b/selfdrive/car/torque_data/lat_models/HYUNDAI_KONA_HEV.json
new file mode 100644
index 000000000..efc9e3a29
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HYUNDAI_KONA_HEV.json
@@ -0,0 +1 @@
+{"input_std":[[6.320446],[1.4674793],[0.55242187],[0.033747878],[1.4499153],[1.4551026],[1.4600143],[1.4764196],[1.4860643],[1.4978211],[1.5023137],[0.033594012],[0.033627346],[0.03367146],[0.033806257],[0.033919122],[0.03404663],[0.03421485]],"model_test_loss":0.0031593828462064266,"input_size":18,"current_date_and_time":"2023-08-07_09-20-56","input_mean":[[16.720589],[-0.3453631],[-0.01988461],[-0.011758546],[-0.33604637],[-0.33879158],[-0.34137574],[-0.34826595],[-0.34946606],[-0.35428008],[-0.36132792],[-0.011764421],[-0.011732091],[-0.0117199095],[-0.011728072],[-0.011719623],[-0.011750716],[-0.011823986]],"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.50939155],[0.3405257],[1.6462622],[-0.10843948],[0.285203],[0.037651468],[1.8082677]],"dense_1_W":[[0.024142604,-0.21203998,0.026902797,-0.026592031,-0.5052848,0.08084745,0.060381155,0.07824176,0.1476794,-0.31446207,-0.05622627,-0.24280141,-0.013746504,0.012400391,0.17171621,0.29621166,-0.28375784,0.05738833],[0.1768927,-0.29521623,-0.025311217,-0.092430666,0.28460526,-0.617111,0.49956995,-0.3885511,-0.2726708,0.20527962,0.14372464,0.26093155,0.14992015,-0.31772944,0.08945775,-0.09835619,0.31046915,-0.10769861],[0.97614205,0.4236573,0.38003942,0.49241897,0.51790404,0.053766027,-0.80027264,0.26498482,0.05449548,-0.26899186,0.087867126,0.12839077,-0.05710694,-0.66316336,-0.0033742453,0.2792481,-0.11627638,-0.041489422],[-0.0015497641,0.8673382,3.263093,-0.1707162,-0.6192832,-0.67156154,-0.04999914,0.14607337,-0.06100974,0.58493054,0.15063228,-0.05193594,-0.29414734,0.3289635,0.39314392,0.074083135,-0.25906774,-0.1849865],[0.047487535,0.6483187,-0.012538455,-0.38905606,-0.18153276,0.44709945,-0.5075622,0.21219371,0.068916075,0.25938293,-0.17245348,0.1482799,0.40387914,-0.40022132,0.06770608,0.36847785,-0.026828244,-0.16214016],[0.037951373,0.24962443,0.020283377,-0.0035552767,0.30666018,0.1413196,-0.38893646,0.35808158,-0.032923326,-0.071178645,-0.048781518,0.5162438,0.4610186,-0.7228655,-0.49375764,-0.21811645,-0.19861159,0.40984872],[0.9250359,-0.70112437,-0.36471853,0.0054842713,-0.09402759,0.082544014,0.30093822,0.16678151,-0.2748682,0.18376616,0.04107111,-0.25604424,0.42679307,-0.053103805,0.16130999,-0.40664944,-0.032497868,0.13323294]],"activation":"σ"},{"dense_2_W":[[-0.90112615,-0.4810132,-0.08950426,0.36772704,0.4500673,0.052173443,-0.77481836],[-0.3288408,-0.36183703,0.39837834,-0.19830135,-0.0052449205,-0.4256783,-0.3807343],[0.15238899,-0.52871466,-0.98836666,-0.46207833,-0.9737017,-0.7437858,0.3818713],[-1.0859724,-0.48526433,0.24535194,0.05596006,0.093554944,0.21621844,-0.53195745],[-0.7163611,-0.30886292,0.12716919,-0.4154194,0.37423986,0.9259443,-0.379039],[0.19235164,-0.15816337,-0.017028,0.31888407,-0.28815588,-0.8377302,0.39304262],[0.47231472,-0.08212948,-0.7769114,-0.7738407,-0.48245203,-0.7427551,-0.27572083],[0.2869671,-0.016490303,-0.70185846,-0.34122148,-0.2529159,-0.1406588,-0.40547752],[0.20577213,0.14548963,-0.52808815,-0.30710357,-0.35618016,0.13128263,0.33525097],[-0.17195134,0.3418375,0.095633924,-0.17584541,0.12383485,-0.8438437,-0.021029431],[-1.5742979,-1.0980865,0.13949709,1.2328507,0.30790532,-0.25942948,-1.8909296],[-0.11482437,-0.42623624,-0.34017542,0.49576285,-0.00045646817,0.61140454,-0.84245527],[0.03065336,-0.3165987,0.31627032,0.23499563,-0.5419005,-0.6005879,-0.44092956]],"activation":"σ","dense_2_b":[[-0.06588],[-0.24751721],[-0.036043685],[-0.08081857],[0.042379994],[-0.12687257],[-0.1196205],[-0.103857085],[-0.11169459],[-0.13132711],[-0.12644218],[-0.14405167],[-0.09716702]]},{"dense_3_W":[[-0.25552472,0.4888721,0.66748166,-0.059414074,-0.47127432,0.0070313723,0.562616,0.4663864,-0.12562452,0.27339113,0.011626089,-0.3627435,-0.31609577],[0.31728745,-0.048127633,0.3010577,-0.029504294,-0.633934,0.2603854,0.015562987,0.09305088,0.3503609,-0.30416068,-0.382153,-0.5815462,0.3423376],[0.512647,0.6342511,-0.7857153,0.26010734,-0.111801334,-0.24562247,0.19410154,-0.17319192,-0.4143214,-0.04857833,0.5264786,-0.41035476,-0.4759939]],"activation":"identity","dense_3_b":[[-0.053302422],[-0.044913977],[0.05779919]]},{"dense_4_W":[[-1.0770125,-0.37417558,0.8556539]],"dense_4_b":[[0.050846685]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HYUNDAI_PALISADE.json b/selfdrive/car/torque_data/lat_models/HYUNDAI_PALISADE.json
new file mode 100644
index 000000000..9b5b6ebd4
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HYUNDAI_PALISADE.json
@@ -0,0 +1 @@
+{"input_std":[[9.083802],[1.4611669],[0.43209597],[0.045783427],[1.4580129],[1.4600974],[1.4606811],[1.4370847],[1.4046228],[1.3548353],[1.301345],[0.045653045],[0.045695912],[0.04572814],[0.0456723],[0.04552948],[0.045236606],[0.044802427]],"model_test_loss":0.010045606642961502,"input_size":18,"current_date_and_time":"2023-08-07_10-17-58","input_mean":[[24.140347],[-0.040326927],[-0.00495007],[-0.01144458],[-0.037586022],[-0.039033934],[-0.04007914],[-0.040745206],[-0.039911933],[-0.037505746],[-0.035948202],[-0.011471909],[-0.011470749],[-0.011468973],[-0.011477571],[-0.011519244],[-0.0115342615],[-0.011574338]],"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.0585553],[-0.8787027],[0.06662454],[2.4645643],[0.2145419],[0.14631574],[-0.0031928595]],"dense_1_W":[[0.01278659,-0.639175,-3.9059505,-0.26950234,0.48975742,0.053148586,0.06006899,-0.15871193,-0.35619113,-0.3069537,0.6460098,-0.3795686,-0.14707989,0.10753279,0.589496,0.054787833,0.26607925,-0.27329552],[-0.31426805,0.29352117,0.30446848,0.17738476,0.021804355,0.49185294,0.05479423,0.1745057,-0.0944745,0.35397518,0.3583849,0.06355244,0.3294988,-0.7301665,-0.1879947,-0.0022402736,0.104507774,-0.21638979],[-0.010307992,0.7934238,-0.0006794772,-0.1334464,0.02091189,0.47137254,-0.6551125,0.066525705,0.3651862,-0.07319468,-0.10373536,0.33364198,-0.039477788,-0.1740325,-0.17714831,-0.15961868,-0.0405952,0.074915186],[0.5847928,0.619816,0.4203029,-0.21235059,0.4265746,-0.1263166,0.009960476,0.11006678,0.6733238,0.42611405,0.19867067,0.45256436,-0.13085747,-0.36200306,-0.3105818,0.34042296,-0.31901485,-0.08410049],[-0.024490528,-0.65694225,4.6159083e-5,0.59398013,-0.025485305,-0.018133782,0.0042006616,0.10598254,-0.33271274,0.27812153,-0.08935339,-0.0016619482,-0.54040617,-0.14387926,0.5431834,-0.19388175,-0.13796277,0.058109537],[0.41040012,0.4720514,-0.542709,0.27897146,-0.21233134,-0.26147744,-0.7639464,-0.7849991,-0.8057104,-0.53855383,-0.26171803,-0.01974412,0.539449,-0.3167468,-0.058017753,0.100660756,-0.02376293,0.39652997],[0.0073618917,-0.6812269,0.00047164486,0.19503322,0.21642539,-0.3812711,0.54097396,-0.4161706,-0.13814282,-0.42284945,0.37063465,-0.22952643,-0.52888757,0.5929762,-0.282835,0.19850107,0.20221026,-0.1419231]],"activation":"σ"},{"dense_2_W":[[-0.34819424,0.13951385,1.2464662,0.28751788,-0.5187095,0.6976768,-0.62041533],[-0.41341007,0.2805276,0.6287094,0.6696396,-0.54532576,0.7615568,-0.6390846],[0.17430355,-0.57738274,-0.6883198,-0.18806155,0.3362078,-0.27881357,0.2574153],[0.34108973,0.22211717,0.459976,0.35180148,-0.33524066,-0.2489619,-0.8272582],[0.23007147,0.0818965,-0.6714039,-0.55786407,0.43846977,-0.3866686,-0.31287605],[-0.21214552,-0.6325544,0.042784553,-0.73854697,-0.072142266,-0.20286769,-0.17739548],[0.12742646,0.17059988,-0.30783626,-0.62666696,-0.36179522,-0.23354167,0.48441237],[0.070377834,-0.16169746,-0.01426584,-0.12767823,-0.36949772,-0.79047674,-0.5630477],[-0.3562291,0.82187784,0.6215501,0.7167505,-0.062617205,0.5100963,-0.31727344],[0.53031796,-0.74287415,-0.583841,0.35455438,0.5706749,0.34090075,0.40166008],[-0.041094325,-0.7450218,-0.34826657,-0.27569434,0.28963897,-0.6791988,0.4819029],[-0.45388228,0.8081112,0.19463012,-0.20301336,-0.8971776,0.51671964,-0.79728514],[-0.19061111,-0.41954494,-0.61557233,0.033694874,-0.4513763,-0.046573047,0.36615795]],"activation":"σ","dense_2_b":[[-0.05189404],[0.11612667],[0.03374365],[-0.09175077],[-0.118053235],[-0.009669963],[-0.24390511],[-0.42936447],[-0.13871671],[0.105076954],[0.060429294],[-0.08152692],[-0.32616025]]},{"dense_3_W":[[-0.5707046,0.15472998,0.32784146,-0.52660066,0.3508428,0.2326405,-0.12091264,-0.36666492,-0.16838528,0.60772735,0.5778285,-0.024338374,-0.4535548],[-0.18583268,0.4316364,-0.614212,0.296555,0.21492256,0.09027471,-0.22776076,-0.28093025,0.4677053,-0.2794905,-0.16121306,0.5220755,-0.49487323],[0.6430829,0.38659704,-0.25451958,0.014723727,0.23223996,-0.39363125,-0.48956293,-0.40315047,0.6391995,-0.611482,-0.321689,-0.52045226,-0.2960742]],"activation":"identity","dense_3_b":[[0.030546237],[-0.03303123],[-0.0085044755]]},{"dense_4_W":[[-1.0266056,1.0412261,0.11489299]],"dense_4_b":[[-0.03331707]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HYUNDAI_SANTA_FE.json b/selfdrive/car/torque_data/lat_models/HYUNDAI_SANTA_FE.json
new file mode 100644
index 000000000..f24dc4e6d
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HYUNDAI_SANTA_FE.json
@@ -0,0 +1 @@
+{"input_std":[[9.17877],[1.560403],[0.55696404],[0.04819407],[1.5485493],[1.551602],[1.5542839],[1.5297074],[1.4964435],[1.447148],[1.3966106],[0.047890175],[0.04795589],[0.04801992],[0.048169263],[0.04813858],[0.04792505],[0.047557294]],"model_test_loss":0.008605924434959888,"input_size":18,"current_date_and_time":"2023-08-07_13-18-55","input_mean":[[23.527355],[-0.09660584],[0.002421769],[-0.007888363],[-0.09495723],[-0.09453526],[-0.09517964],[-0.092055276],[-0.089080565],[-0.08710217],[-0.08428994],[-0.0079021575],[-0.007904708],[-0.007907821],[-0.007890973],[-0.007831142],[-0.007820599],[-0.0077761114]],"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":[[2.4574037],[-0.31610072],[0.06254806],[0.1658765],[-0.04939922],[-0.04379439],[-2.3606904]],"dense_1_W":[[0.4884821,0.4447991,0.27062133,0.29461905,-0.15870245,1.0499299,-0.67113316,0.14727078,0.46701437,-0.11520939,0.27191386,0.25705224,0.20442817,-0.5996387,-0.11848767,-0.22629784,0.10268118,-0.05196918],[-0.94526833,-0.06731887,0.36105722,-0.06478468,0.7274551,-0.787373,1.067588,-0.11700762,-0.18113732,-0.009122022,0.6951359,0.121739894,-0.31221318,0.43686992,0.19358343,-0.60511017,0.31918147,-0.16998838],[-0.0064108563,-1.0363407,-0.3657711,-0.03648839,0.25623804,-1.0107207,0.5950102,0.13701187,-0.03058584,-0.09836868,-0.47335115,-0.19476067,-0.25847888,0.24020503,0.27251944,-0.16899313,-0.10614574,0.20120943],[0.99380904,-0.13568194,0.37884694,0.2061394,0.25694898,-0.39774755,1.0660007,0.098927006,-0.11071541,-0.06035235,0.6582728,-0.1862874,-0.36728743,0.686768,-0.007125964,-0.43512365,0.21848302,-0.19364962],[-0.013903772,1.6984495,6.334462,-0.24601908,-0.88126016,-0.07609073,-0.6559659,0.5171736,1.2477276,0.13804865,-1.6805384,0.5297336,0.50917196,-0.35361633,-0.43783256,-0.16315787,0.09916458,0.19899222],[0.0027724826,-0.266893,0.009900119,0.1370816,-0.14222518,-0.7747496,0.40045345,-0.1508628,0.31491798,-0.11310718,-0.10476674,-0.5071864,0.27966213,0.071040496,0.17133062,0.3316448,-0.09659847,-0.028956251],[-0.46976677,0.2529768,0.2631776,0.29406658,-0.014786802,0.54289156,-0.2263323,0.34719956,0.24145603,-0.02186343,0.2373878,-0.0400574,0.016907027,0.0852952,-0.45880318,0.07774477,-0.08953317,-0.009223345]],"activation":"σ"},{"dense_2_W":[[0.06098307,-0.40966874,-0.17987315,-0.40513036,0.27261987,0.08310855,-0.5536096],[-0.691275,0.35682058,0.36383852,0.5730693,-0.25348198,0.5048341,-0.5584882],[-0.62200207,0.34269363,-0.37620154,0.39508444,-0.18625513,0.5273465,0.15910348],[-0.66713977,0.52275723,0.2329843,-0.39003682,-0.68911934,0.54985297,-0.1009992],[-0.6867374,-0.17710596,0.25754964,0.4175933,0.13662146,0.6200632,-0.7861373],[-0.09777525,-0.32259175,-0.6726679,-0.5632263,0.38548172,-0.78029376,0.8176162],[-0.7648048,0.50501686,0.48810425,-0.30770826,-0.13032949,-0.21508694,-0.5890472],[-0.21938957,-0.20063238,0.5301691,0.3849949,-0.2938749,0.58915985,-0.40684512],[0.09535999,-0.3482573,-0.028670665,-0.2520647,-0.18944943,-0.30540437,0.45314667],[-0.2825183,-0.18183878,0.43335834,-0.44332805,-0.14940064,0.075128734,-0.1811318],[0.29664114,-0.030906495,-0.37812403,-0.046466183,0.101335004,-0.53401035,0.79996306],[0.9250361,-0.67517155,-0.52387106,-0.2634134,-0.20555083,-0.812342,0.7927995],[0.22187099,-0.4586634,0.14067167,0.16797097,-0.51517123,-0.25366476,-0.0075834477]],"activation":"σ","dense_2_b":[[-0.16339622],[-0.06992213],[-0.14530285],[-0.21909085],[-0.18955792],[-0.123597145],[-0.114407286],[-0.06403072],[0.07467113],[-0.11460133],[-0.014573581],[0.15221187],[-0.2008074]]},{"dense_3_W":[[0.079248965,0.63441527,-0.037408806,0.5250491,0.1454134,0.033214454,-0.07036471,0.56555814,-0.26066884,-0.18814188,-0.19420856,-0.33199486,-0.17070732],[0.48755273,0.5925755,-0.089609005,0.2881994,0.09301222,-0.36505923,0.11187905,-0.18813112,-0.4484195,0.45447895,-0.46645686,-0.48254833,-0.48081368],[0.28768483,-0.50610393,-0.3329078,0.1855142,-0.32382408,0.25712836,-0.3997252,-0.4541148,0.69257694,-0.36352545,0.36789265,0.8448238,-0.36968893]],"activation":"identity","dense_3_b":[[-0.099045075],[-0.08617516],[0.0972388]]},{"dense_4_W":[[-0.9874007,-0.54182595,0.95884216]],"dense_4_b":[[0.09515336]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HYUNDAI_SANTA_FE_2022.json b/selfdrive/car/torque_data/lat_models/HYUNDAI_SANTA_FE_2022.json
new file mode 100644
index 000000000..b80f8eb8d
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HYUNDAI_SANTA_FE_2022.json
@@ -0,0 +1 @@
+{"input_std":[[8.994212],[1.3245196],[0.5245797],[0.042956702],[1.3203417],[1.3217984],[1.3220408],[1.2944245],[1.2665168],[1.2200946],[1.1748925],[0.0428153],[0.042849746],[0.042877868],[0.04289658],[0.042825807],[0.042584144],[0.042231884]],"model_test_loss":0.006699905265122652,"input_size":18,"current_date_and_time":"2023-08-07_15-02-41","input_mean":[[22.833767],[-0.0403752],[-0.023062065],[-0.003915003],[-0.03835354],[-0.039629113],[-0.04148385],[-0.050812945],[-0.058392923],[-0.07008045],[-0.08093289],[-0.0039168606],[-0.0039327657],[-0.0039458815],[-0.0040258327],[-0.0041203275],[-0.00426424],[-0.00439325]],"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.21267962],[-0.02729046],[-3.876878],[3.758936],[-0.094889574],[0.84803456],[1.0655135]],"dense_1_W":[[-0.01582406,1.491969,3.253744,-0.10518171,-0.19385417,0.78610295,-0.92538196,-0.33224037,0.3013307,-0.6688703,-0.19887793,0.114433184,0.15138905,-0.37872663,-0.26882437,0.53041375,0.5000704,-0.46208212],[0.0022284745,-0.44302207,0.0046756687,0.4405551,0.3678904,-1.3237227,0.94849795,-0.21979533,-0.354195,0.04168792,0.10481886,-0.14313328,0.09221937,0.62079024,-0.31655258,0.08006394,0.224768,-0.34386438],[-1.6695492,1.084495,0.12782213,-0.2916347,0.4173779,-0.012464437,-1.415515,0.46309748,0.14367689,-0.09085289,0.21108763,0.52149534,0.0030927972,-0.7394647,0.32236108,0.4132776,-0.08725703,-0.32379115],[1.7204846,0.99877,0.12921184,-0.5962452,0.11488813,0.7996907,-1.9083629,0.73996365,0.0138976555,-0.3083528,0.36691102,0.6522089,-0.30455202,-0.33463576,0.26659817,0.8397864,-0.53790885,-0.17022859],[0.01408686,0.30261004,0.021707801,-0.11919521,-0.11240657,1.2420307,-0.90936786,-0.13186933,-0.0830583,0.39522758,-0.15010051,0.67393625,0.37087741,-0.2007352,-0.70529145,-0.46263382,0.12367665,0.1901094],[0.22501494,1.2126215,-0.04891412,0.11348339,0.10659557,1.1126171,-0.6577273,0.0517829,0.034891758,0.16096263,0.016899597,0.53799254,0.19248869,-0.099386215,-0.24717341,0.1219544,0.1654292,-0.6051804],[0.29689962,-1.252187,0.051804602,0.028222922,-0.63980806,-0.693479,0.9105569,-0.05222635,-0.4362798,0.45733297,-0.29413572,-0.5301683,-0.6064637,0.42068645,-0.02681922,-0.020214137,0.22010683,0.34188196]],"activation":"σ"},{"dense_2_W":[[-0.6086301,0.2085108,0.37262338,-0.9238916,-0.39440706,-0.531614,-0.13330653],[0.3900694,0.25841695,-0.506336,-0.87635046,-0.23827943,-0.22281836,0.14377734],[0.39564994,-0.52945167,0.4045585,-0.22950102,0.66113174,-0.55567765,-0.7538522],[0.1472609,0.4034027,-0.39680183,-0.01948131,-0.06318282,-0.40607718,0.54647887],[0.40735146,-0.76506615,0.15106998,-0.04639545,0.2356493,0.34029764,0.58116305],[0.17658016,-0.48829883,0.8479261,0.103093006,-0.085700735,-0.05685383,0.12873933],[-0.58091015,-0.36427772,-0.119214594,-0.15918592,-0.77523655,-0.78004694,0.03406656],[0.42519712,-0.15369514,0.0024256515,0.7537345,0.12914199,-0.19718027,0.2781377],[0.38494098,-0.8098266,1.6810417,-0.4136923,-0.33961916,0.15786585,-1.5184373],[0.19256154,0.4130768,-0.31395087,-0.5005648,-0.51987,-0.34723067,-0.081991576],[-0.49874434,-0.6762422,-0.09994346,0.09899775,0.06528094,-0.75826293,-0.5126717],[-0.35837945,0.36765984,0.8528636,-0.3219268,0.03151658,0.19896397,0.34016657],[-0.20404705,0.35541695,0.0011049275,-0.0022879532,-0.64204615,-0.5036561,-0.035362314]],"activation":"σ","dense_2_b":[[0.036364183],[-0.00221331],[-0.117371835],[-0.097624525],[0.009239539],[-0.091520816],[-0.23231187],[-0.016982464],[-0.54738104],[0.04596814],[-0.24534227],[-0.005133318],[-0.022278212]]},{"dense_3_W":[[-0.6959402,0.31169927,0.53220147,0.19400354,-0.31628206,0.26289627,0.32454082,0.41816694,-0.31043547,-0.67317456,0.65171415,-0.30771238,0.09026865],[0.38488102,0.31554824,-0.70509696,0.3893292,-0.10749988,-0.40098265,0.18507135,-0.11758874,-0.0043080114,0.6012859,0.25160068,-0.42651844,0.48249626],[0.7162551,0.64301497,-0.36417845,-0.037450142,-0.45597866,0.15023938,-0.0077365125,0.0701791,-0.71762145,0.18638995,0.018750757,0.14510971,0.41565806]],"activation":"identity","dense_3_b":[[0.030530091],[-0.0479702],[-0.053273804]]},{"dense_4_W":[[0.5025325,-1.0537963,-0.85901815]],"dense_4_b":[[0.04645968]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HYUNDAI_SANTA_FE_HEV_2022.json b/selfdrive/car/torque_data/lat_models/HYUNDAI_SANTA_FE_HEV_2022.json
new file mode 100644
index 000000000..d11937978
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HYUNDAI_SANTA_FE_HEV_2022.json
@@ -0,0 +1 @@
+{"input_std":[[8.261341],[1.0799276],[0.47439072],[0.035921823],[1.0769413],[1.0782329],[1.078946],[1.0603385],[1.0393461],[1.0079743],[0.97282183],[0.03575561],[0.03581589],[0.03587639],[0.035916228],[0.03587763],[0.03574848],[0.03554262]],"model_test_loss":0.00492028146982193,"input_size":18,"current_date_and_time":"2023-08-07_15-53-19","input_mean":[[21.97073],[-0.029600525],[0.0032512692],[0.0019785082],[-0.031247197],[-0.030642778],[-0.030970285],[-0.027264683],[-0.02531458],[-0.023465578],[-0.022579186],[0.001951127],[0.0019527602],[0.0019488906],[0.001962819],[0.001987138],[0.0018675312],[0.0017249424]],"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":[[-3.245048],[3.3935277],[-0.15662995],[-0.014851185],[-0.09243428],[-0.004402729],[0.0380219]],"dense_1_W":[[-0.5481877,-1.1734215,-0.45120606,0.034027565,-0.12534843,-0.4320663,0.08604743,0.20808327,-0.46957174,-0.24812324,0.19450486,-0.2840027,-0.29063642,0.8850254,0.1337479,0.12512524,-0.11077451,-0.10846867],[0.55359775,-0.78132075,-0.45535302,0.04589877,-0.23332703,-0.6900583,0.27111268,-0.2906912,-0.26810634,-0.0014484213,0.012803484,-0.4214593,0.14392284,0.39275578,0.4591555,0.20790677,-0.47720864,0.03637555],[-0.001160366,0.07135902,0.020283442,-0.11026379,-0.3300407,1.1425788,-0.8465417,-0.14491843,0.10389491,-0.094203144,0.08786806,0.58249265,-0.31260887,-0.24686775,0.25243184,-0.12136195,-0.14665185,0.10891337],[0.00075157254,0.018735576,-0.015033022,0.2552897,-0.07354839,0.36636823,-0.5266892,0.12183493,0.06295568,0.08566852,-0.0952725,0.33919626,0.36296552,-0.376174,-0.39300168,0.07231392,-0.20756865,-0.050174374],[-0.000663185,0.6687934,-0.021183483,-0.20696321,0.28176227,0.8060634,-0.5820421,-0.17129976,-0.0828522,0.009332605,0.15914959,0.06899979,-0.071527235,-0.21463287,0.2533481,0.31726366,-0.07277975,-0.18115173],[0.0028130943,-1.0741395,-3.5949726,-0.08878999,0.21987598,0.103467554,0.6372202,0.32599628,-0.5349482,-0.4875307,0.49166214,-0.50000715,0.108137466,0.38457507,0.040603124,0.52961135,-0.122126095,-0.14863239],[0.0012397681,-0.8501431,0.004625623,0.39065698,0.3043851,-0.7930684,0.51580155,-0.047317076,-0.22162919,0.1124854,0.017583156,-0.33733293,-0.13366492,0.6077388,0.29493827,0.16720308,-0.41922003,-0.117570505]],"activation":"σ"},{"dense_2_W":[[-0.05502436,-0.66888684,0.065067135,0.53669417,-0.01893934,0.36197692,0.01791807],[0.59498864,0.6528727,-0.38318837,-0.45497322,-0.08562961,-0.31445232,0.69590557],[-0.41835263,0.04931508,0.0073655155,0.6559025,0.22435378,-0.42106333,0.13407917],[0.29046017,-0.09791975,-0.41265818,-0.49019828,-0.6872615,-0.26517653,-0.3567036],[0.13606516,0.44112694,-0.57032704,-0.13413966,0.0034367347,0.24891582,0.16898009],[0.011530882,-0.15070426,-0.46052173,0.5160092,-0.38340572,0.1328647,-0.18670098],[0.3382954,-0.22624794,0.028343266,-0.62450606,-0.059560556,-0.16521035,0.595776],[-0.5985326,-0.5175321,0.53653544,0.20450565,-0.12380274,-0.101402126,0.21046633],[-0.10918766,0.7896873,-0.6037477,-0.021383286,-0.36211497,0.5407418,0.30803818],[-0.38357767,0.13743253,0.5462274,0.33449608,0.58031,-0.44345102,-0.26854265],[0.5908161,-0.21907422,0.20983866,-0.4897011,-0.59968626,-0.065551214,0.5250327],[0.3375154,0.43778437,-0.31592417,-0.13451315,-1.0115412,-0.32253185,0.66413474],[0.09797849,-0.3698204,0.04279515,0.25717175,0.30788177,-0.25584602,0.19880241]],"activation":"σ","dense_2_b":[[0.003746753],[-0.08357698],[0.006304543],[-0.24605891],[-0.07121214],[-0.015032947],[-0.09400678],[-0.0024056516],[-0.010130554],[0.014799146],[-0.060003918],[-0.07540407],[-0.03000076]]},{"dense_3_W":[[0.017942075,-0.6212448,-0.12496728,0.14162916,-0.2248813,0.49471742,0.18174668,0.67305565,-0.181309,0.61732584,-0.27006516,-0.049796086,0.12735644],[0.3594483,-0.31422514,0.66338825,-0.41523233,-0.47088245,-0.28914762,-0.116269276,0.29540908,-0.6357099,0.3832997,-0.06724131,-0.5605163,0.09249603],[0.21089882,-0.26488605,0.433047,0.35239476,0.3053993,0.25026608,-0.4875768,-0.38531804,-0.30042005,0.68175066,-0.5961486,0.07390234,0.31267327]],"activation":"identity","dense_3_b":[[0.02659904],[0.034767646],[0.024563152]]},{"dense_4_W":[[0.6525578,1.0061679,0.50279385]],"dense_4_b":[[0.032301653]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HYUNDAI_SANTA_FE_PHEV_2022.json b/selfdrive/car/torque_data/lat_models/HYUNDAI_SANTA_FE_PHEV_2022.json
new file mode 100644
index 000000000..7e4f989f0
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HYUNDAI_SANTA_FE_PHEV_2022.json
@@ -0,0 +1 @@
+{"input_std":[[7.9325304],[1.0882362],[0.43774286],[0.04055885],[1.0919278],[1.0913655],[1.0900016],[1.0642537],[1.0437973],[1.014913],[0.9828307],[0.040379256],[0.04041959],[0.040456932],[0.04061512],[0.040622164],[0.040395677],[0.040053483]],"model_test_loss":0.012668303214013577,"input_size":18,"current_date_and_time":"2023-08-07_17-09-24","input_mean":[[22.347511],[-0.10092363],[0.011539685],[-0.024840366],[-0.10495763],[-0.104191564],[-0.103371926],[-0.0960919],[-0.088538796],[-0.081120916],[-0.073905],[-0.024927486],[-0.024909802],[-0.024889572],[-0.024763657],[-0.024654102],[-0.024695622],[-0.02485533]],"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":[[2.777723],[-0.21736239],[0.06858174],[0.028778331],[-0.1341363],[-3.286173],[0.05866324]],"dense_1_W":[[0.9532825,-0.57736486,-0.3511588,0.6824505,-0.024612838,-0.4149641,-0.2517366,-0.38986352,-0.041095104,-0.23648082,-0.22857088,-0.52361864,0.59133035,-0.016187055,-0.30439842,-0.008700108,0.37054965,-0.3851146],[-1.2131011,-0.040348757,-0.030648885,0.07944047,-0.5089448,-0.17325257,-0.35811424,-0.39610377,-0.3414392,0.13268204,0.036754124,0.244627,-0.18363807,-0.29357588,0.14597428,-0.07848809,0.117397904,-0.0066551454],[-0.33372527,-0.8653413,-0.0204796,0.15082183,0.21337464,-1.1272148,0.6884098,0.10593993,-0.21011119,-0.019475536,0.060115736,-0.7099037,-0.3675179,0.98888445,-0.0021350337,-0.0023339558,0.034033813,-0.08632464],[-0.0087699555,0.47234085,-0.003936672,-0.08932229,-0.15217909,0.76968,-0.6072722,0.19957112,-0.1826489,0.28319913,-0.11377978,0.5678719,0.0690483,-0.4572559,-0.256832,-0.19453537,-0.1292364,0.26785675],[-0.20146403,-0.6867957,-0.021399295,-0.09085224,-0.13374451,-0.95356876,0.7412253,-0.0020842238,-0.32998958,0.29012066,-0.12927385,-0.17273527,0.046919394,0.31265458,-0.0067970203,0.049638614,-0.1646258,0.1021922],[-1.0781149,-1.9831505,-0.39170006,0.6552042,0.2507927,-0.7482493,0.69903153,0.11317306,-0.44421217,-0.17660317,-0.19381957,-0.40258512,0.057917267,0.6132898,0.2122239,-0.68616545,-0.016808815,0.009621946],[0.07036603,0.6711271,3.090535,0.5774168,-1.0394694,0.01879839,-0.89210445,0.5525633,1.0586205,0.27921924,-0.4908341,0.3026311,0.51791734,-0.2981133,-0.38711485,-0.3440137,-0.20040374,-0.14860815]],"activation":"σ"},{"dense_2_W":[[0.053376287,-0.27212048,-0.592167,-0.66140467,0.123351865,-0.45312202,-0.5552815],[-0.15174036,0.3456475,-0.72808313,-0.16873683,-0.87532926,-0.19756816,0.010091597],[0.32735926,0.2430751,-0.49615663,0.71439725,-0.11260843,-0.43778282,0.48608312],[0.5652805,-0.25033778,0.47545195,-0.27911112,0.3687969,0.25403744,-0.3056421],[0.4027308,0.06937314,-0.008849847,-0.09499983,0.50666314,-0.021115543,-0.31085667],[0.15451042,0.16761723,0.14800774,0.6163942,-0.77986425,-0.58117247,0.40439337],[-0.52235144,0.37827665,-0.83033717,0.8296531,0.2544118,-0.37235376,-0.1002346],[0.09825943,-0.60037464,0.65948284,-1.2040564,0.6021252,0.091694914,0.21354105],[-0.31508094,0.2741653,-0.7038115,0.279092,-0.13322929,0.11963509,-0.14818548],[0.20600095,-0.076976694,0.21097696,-0.76661587,0.3835434,-0.05707485,0.10319275],[0.62171084,-0.24905708,0.5991603,-0.52393246,0.49378031,-0.1764447,-0.21842895],[-0.20955467,0.22948128,0.26585734,-0.95675725,-0.113945276,0.6225702,-0.500622],[0.16029201,0.49023697,-0.6596639,0.25944898,-0.21170011,-0.20044534,-0.0025964344]],"activation":"σ","dense_2_b":[[-0.2663133],[-0.10525206],[-0.011656664],[-0.15913439],[-0.09004699],[0.038266346],[0.051478483],[-0.2926297],[-0.24159859],[-0.120620705],[-0.11021781],[-0.33539078],[0.00798126]]},{"dense_3_W":[[0.16740364,-0.068965144,-0.3025593,0.50858945,0.5449389,-0.24625476,-0.49794698,0.29956707,-0.30424193,-0.008103076,0.58150756,0.0818273,0.01633671],[0.4533966,-0.42790514,-0.31081665,0.5545747,0.38430354,-0.67824066,-0.5380451,0.05798864,0.105315335,0.27879745,0.52759033,-0.06383929,-0.3282453],[-0.5254706,0.061006207,-0.26732418,-0.028615523,0.17779939,-0.3987639,-0.033597037,0.12323639,0.024477432,0.33606854,0.38722304,0.18485908,-0.4257627]],"activation":"identity","dense_3_b":[[-0.057745293],[-0.045989405],[-0.043302864]]},{"dense_4_W":[[-0.6202967,-0.6532501,-1.0174378]],"dense_4_b":[[0.047135167]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HYUNDAI_SONATA.json b/selfdrive/car/torque_data/lat_models/HYUNDAI_SONATA.json
new file mode 100644
index 000000000..52798259a
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HYUNDAI_SONATA.json
@@ -0,0 +1 @@
+{"input_std":[[9.547813],[1.7179168],[0.5423653],[0.04857022],[1.7059441],[1.7113246],[1.7139751],[1.6844511],[1.6431999],[1.577594],[1.5055375],[0.048473638],[0.048486643],[0.04849009],[0.048347536],[0.04814972],[0.047786575],[0.04731983]],"model_test_loss":0.011126813478767872,"input_size":18,"current_date_and_time":"2023-08-07_18-34-15","input_mean":[[22.614845],[-0.00978362],[0.007860732],[-0.004099437],[-0.010468512],[-0.010098754],[-0.009594586],[-0.0049946643],[-0.0015134194],[-0.0018012848],[-0.0024288695],[-0.0041544754],[-0.004141275],[-0.004129192],[-0.004074],[-0.004025116],[-0.0040029683],[-0.003983455]],"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.4171004],[-0.62944967],[-0.08636822],[-0.30957282],[3.1894078],[-0.18340014],[-4.048277]],"dense_1_W":[[0.7830174,0.40423092,-1.7773811,-0.25229105,0.0003897955,0.2650078,-0.94045377,0.057573486,0.43040198,-0.061492153,-0.42369962,0.2493666,0.35435918,-0.24786355,0.123617865,-0.15768188,-0.4915791,0.41757017],[0.619815,-0.15506315,1.7720731,-0.05022525,0.12061407,-0.23410659,0.26306555,0.18054493,-0.10822319,-0.23154925,0.4427835,-0.40612897,0.44821352,-0.035341486,-0.09733925,0.11400062,0.13623556,-0.1278016],[0.0040937522,0.5835935,1.5735953,0.27356768,-0.47593257,-0.19718215,-0.6375235,0.3991756,0.6010651,0.19663113,-0.2724361,0.35223562,-0.28804272,-0.37892044,0.06845918,0.056847498,-0.23999622,0.14147788],[-0.006181427,-0.23720662,-0.030143317,0.27507725,-0.11148783,-0.670752,0.1579785,0.26442546,0.11085281,0.24239433,-0.30806103,-0.5314182,-0.1411616,0.34547827,-0.0067492607,0.2582582,-0.13836917,-0.059036173],[1.3838778,-0.8232643,-0.65903485,-0.20286232,0.07595782,-0.2975871,-0.2668319,-0.03744175,0.113510124,-0.17166083,-0.08313555,-0.19053335,0.22615202,0.099687,0.11709183,-0.06939885,-0.0069061257,0.02360228],[-0.00030964141,-0.59983134,0.0024205807,0.29467705,0.14591737,-0.8452132,0.028352631,-0.06797188,0.13422364,-0.06122122,-0.033911128,-0.19677748,0.21639399,-0.129354,0.3151945,0.010129442,-0.27215233,0.23129506],[-1.5945044,-1.5621332,-0.7602714,-0.025857054,0.28057814,-0.49442625,0.22269996,0.06870841,-0.066471085,-0.1829744,-0.0109900115,-0.2925939,0.13089584,0.2586905,0.021742465,0.0035556427,-0.2523545,0.15750822]],"activation":"σ"},{"dense_2_W":[[0.38898003,0.28459147,-0.022235557,-0.05588795,-0.4079201,0.78092706,0.0055714543],[0.5199289,0.07141404,0.5414507,-0.5915534,-0.39409125,-1.0397701,0.052241296],[0.32463577,-0.49717766,0.90691876,-0.9024069,-0.0049516293,-0.23521297,-0.2842837],[0.06779803,-0.5377125,0.3489072,-0.6589233,0.59720504,-0.8664128,-0.46240392],[1.0705944,0.28698796,0.16739848,-1.4102764,-0.45103022,-1.1245655,0.02443754],[0.20335038,-0.35550895,-0.22385399,0.29430118,0.056962594,-0.32889187,0.2766028],[0.37825814,0.045224834,0.40632764,-0.71752423,-0.84244126,-0.29024214,-0.3171733],[-0.056005202,-0.73517215,-0.0016302611,-0.08258613,0.13173106,-0.25985387,-0.45403552],[0.31348822,0.22809805,-1.1925565,0.73849887,-0.015525387,0.27415907,-0.16705036],[-0.16721253,-0.42491084,-0.8744839,0.090021685,-0.09710444,0.04399626,0.08195919],[-0.4590442,-0.86837125,0.76154727,-0.09060192,-0.8167061,0.3736612,-0.8130611],[-0.59112096,0.09216977,-0.76166147,0.9278373,0.43625265,0.93052894,-0.07700069],[0.3458094,0.1986897,-0.7627924,0.16227825,0.63287425,0.23208074,0.6148371]],"activation":"σ","dense_2_b":[[-0.0482577],[-0.09234584],[-0.016399158],[0.12226299],[-0.018181449],[-0.35545182],[0.050414644],[-0.07713505],[-0.27168283],[-0.026214477],[-0.14412741],[-0.08454545],[-0.15548146]]},{"dense_3_W":[[-0.24532248,0.086403646,0.0035677804,-0.446846,0.3286197,-0.5002942,-0.36754543,-0.36412755,-0.3422447,0.5864908,-0.3555824,0.17768645,-0.16735056],[0.49285188,-0.5364999,-0.5982645,-0.60457116,-0.70168245,0.33897352,-0.5752503,-0.2724616,0.47930852,0.15553074,-0.31801456,0.7717742,0.6475729],[-0.54743356,-0.096405074,0.30723238,-0.14468278,0.25325117,-0.2991242,-0.32472578,-0.60785806,0.34220627,0.09930043,0.24098735,0.21893239,0.34784108]],"activation":"identity","dense_3_b":[[0.06423375],[0.04319534],[0.0022975653]]},{"dense_4_W":[[-0.5658915,-1.2441922,0.0075046057]],"dense_4_b":[[-0.047028013]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HYUNDAI_SONATA_HYBRID.json b/selfdrive/car/torque_data/lat_models/HYUNDAI_SONATA_HYBRID.json
new file mode 100644
index 000000000..e97167c48
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HYUNDAI_SONATA_HYBRID.json
@@ -0,0 +1 @@
+{"input_std":[[8.904712],[1.4085329],[0.50820595],[0.046452872],[1.4017634],[1.4044306],[1.4055834],[1.3812906],[1.3511641],[1.3032484],[1.2478882],[0.046305403],[0.046340212],[0.04636982],[0.046317764],[0.04617617],[0.04582262],[0.045322053]],"model_test_loss":0.011622299440205097,"input_size":18,"current_date_and_time":"2023-08-08_00-09-02","input_mean":[[22.673122],[-0.031736072],[0.007969155],[-0.013558],[-0.032557942],[-0.03305167],[-0.03298927],[-0.029548688],[-0.026128702],[-0.023727983],[-0.020936318],[-0.013552669],[-0.013538184],[-0.013526184],[-0.013537751],[-0.013667655],[-0.013909288],[-0.01411971]],"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":[[-3.9472544],[0.09100576],[0.07340574],[-0.6315094],[0.37090293],[0.18976328],[0.4189057]],"dense_1_W":[[-1.1817962,-1.553194,-2.9592962,0.64605,-0.7203815,-0.5482526,0.50757265,-0.721568,0.14788827,0.30028212,0.4398359,-0.5897631,-0.26421258,0.034407478,0.30330506,-0.15496844,0.25997123,-0.3066445],[0.058786348,-0.27546605,-2.8685112,0.26771522,-0.43513617,-0.2600268,0.58820564,-0.14542523,-0.08567567,-0.52094615,0.84956247,-0.0930839,-0.32848006,0.10680902,0.17591019,0.016146999,0.2344313,-0.24816336],[1.6007652,0.028163971,0.000641371,0.76986766,0.43884957,0.1650065,0.0068902513,0.05802695,0.027824534,-0.017033007,0.13403726,-0.42092884,0.06564483,-0.19293658,0.15149602,0.0152002005,0.4810689,-0.48326603],[-0.14626782,0.044463154,-0.030598573,0.09514202,0.029573362,0.5215925,-0.16921219,0.23771454,0.0925813,-0.22268316,0.1525121,-0.07805162,0.46790215,-0.34623843,-0.29796118,0.07368295,0.159104,-0.07751048],[1.5266113,-1.0623161,-0.0036699253,-0.033174455,0.05534692,0.58918065,-0.18993984,-0.4061732,0.1180316,-0.041908402,0.08485711,0.029580023,-0.2831808,-0.1555281,0.526601,-0.2898042,-0.45805973,0.31297514],[0.14919099,-0.9022488,-0.018481275,0.131622,0.17497712,-0.34224376,0.34405345,0.17506301,0.03541973,-0.12935044,0.048721306,-0.4446497,0.15578839,0.30417204,-0.111914314,-0.121121965,0.0929509,-0.017727112],[0.3040071,0.5304203,-0.0030280105,-0.020691369,-0.32636136,0.48215166,-0.24673954,0.032341566,0.1636895,0.13916636,-0.15661035,0.5669737,0.18278182,-0.6610388,-0.009479835,-0.2828995,0.15746541,0.07788113]],"activation":"σ"},{"dense_2_W":[[-0.34190053,-0.17745249,-0.15337539,0.27886426,0.69785804,-0.56094927,0.87852126],[0.4731782,0.33899984,-0.32553697,-0.5920245,-1.1791692,0.35757312,-1.2558827],[-0.17805865,-0.21635677,-0.082375415,0.42723528,0.44513035,-0.8980545,-0.15309213],[0.33529067,-0.05726452,-0.480721,-0.7930404,-0.69926023,0.8291907,-1.0018113],[-0.103077516,-1.2176032,-1.2135342,-0.18128513,-0.8239158,-1.0818433,0.37739542],[-0.016627673,-0.21135633,-0.07407072,-0.7603306,-0.2276791,1.0221021,-0.37553006],[0.31585032,0.14014794,0.72860646,0.022745533,-0.023529714,1.016683,0.16218413],[0.41354743,-0.30034938,-0.683525,0.302346,-0.41821057,-0.86687744,0.6552664],[0.1185467,-0.7869525,-0.43301994,0.2526739,-0.794169,-1.1868601,-0.19882572],[0.1250559,-0.57725024,-0.9392709,0.31270868,-0.6713074,-1.3244504,0.6004076],[-0.32635778,-0.025522923,-0.15778969,-0.76357174,-0.83400786,1.0821341,-0.69009364],[-0.18017006,0.31208438,0.18055223,0.13536966,0.37867144,-0.9807895,0.6815438],[-0.013808813,0.16385165,-0.34636796,0.37806544,-0.3967438,-0.69719434,0.17996557]],"activation":"σ","dense_2_b":[[0.067470364],[-0.26331186],[0.06993582],[-0.23382637],[-0.06892213],[-0.10123643],[-0.044926178],[-0.05964296],[-0.045392096],[-0.04618724],[0.16808233],[-0.003218339],[-0.07415678]]},{"dense_3_W":[[0.11602406,0.73329675,-0.17197938,0.64163977,-0.71038646,0.8112198,0.2608411,-0.6153334,-0.26859817,-0.67736506,0.33450362,-0.5620311,0.19605356],[-0.59497255,0.628338,0.24506254,0.019271871,-0.5683355,0.58888596,-0.36362818,0.41652063,-0.003895321,-0.26925486,-0.1982826,-0.32602772,0.5407099],[-0.57255495,0.2139631,-0.28807914,0.01145839,0.31905892,-0.15611991,0.47299016,-0.6717293,-0.11661602,0.32700828,0.41476637,0.13788031,-0.49381214]],"activation":"identity","dense_3_b":[[-0.023692269],[0.0855048],[-0.01574187]]},{"dense_4_W":[[-1.4620413,-0.09824631,-0.97454345]],"dense_4_b":[[0.0232099]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HYUNDAI_SONATA_LF.json b/selfdrive/car/torque_data/lat_models/HYUNDAI_SONATA_LF.json
new file mode 100644
index 000000000..971897d6f
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HYUNDAI_SONATA_LF.json
@@ -0,0 +1 @@
+{"input_std":[[7.697617],[1.0609225],[0.4379445],[0.037631202],[1.0623844],[1.0616655],[1.0594143],[1.0256116],[0.99824595],[0.9636123],[0.927896],[0.037490875],[0.037519626],[0.03754297],[0.03749497],[0.037434172],[0.03738278],[0.03713714]],"model_test_loss":0.015784617513418198,"input_size":18,"current_date_and_time":"2023-08-07_17-59-15","input_mean":[[22.772198],[-0.015615957],[-0.00096197607],[-0.0010119482],[-0.010546596],[-0.010836963],[-0.011236375],[-0.011094289],[-0.012648121],[-0.013635343],[-0.017397134],[-0.0010358563],[-0.0010145861],[-0.0010011211],[-0.0010085123],[-0.0010529933],[-0.00111335],[-0.001285189]],"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":[[-3.7229438],[-3.3683147],[-0.1282507],[-0.31550232],[-0.058664136],[-0.95240706],[-1.0986025]],"dense_1_W":[[-0.7789607,1.9123646,0.39085448,-0.76762176,0.14567389,0.8066052,-0.43277985,0.2297818,0.42394215,0.33902678,0.07674288,0.46162274,-0.30707216,-0.25233504,0.19915079,-0.3460779,-0.054854672,0.1426618],[-0.7302568,-1.7004513,-0.37651184,0.7811046,-0.6319955,-0.51594245,0.55498344,-0.18935819,-0.5285875,-0.24025975,-0.1379504,-0.2577349,0.15419608,0.12393667,-0.11645755,0.28632703,0.012518243,-0.093591586],[0.6120753,-0.042914443,-0.0007887555,-0.42378148,-0.44867167,-0.70841163,0.7576831,-0.0939431,0.27074918,0.111739814,-0.2615336,-0.97394973,-0.07050334,0.9536129,0.39760146,0.11356349,0.23691247,0.0036621983],[-0.012153974,2.5360656,3.6491127,-0.46920162,-1.7772331,-0.7169024,-1.3301034,-1.1953633,2.5687883,1.1499572,-0.9038787,0.6629773,0.34683412,-0.42444223,-0.25739744,-0.3469017,0.056961935,0.29270503],[0.017274002,0.5840407,-0.0023877379,-1.808923,0.3084969,1.3571715,-0.58538103,-0.2375718,0.09313133,0.6554645,-0.18251002,0.42035452,0.1955895,0.31606016,0.75343394,-0.13268644,0.11386261,-0.08166157],[-0.6063996,-0.5005416,-0.00912951,0.44437352,0.36323333,0.11949726,1.0753121,-0.31381848,-0.58282745,-0.09158226,0.44612095,-0.02124081,0.3982341,0.28105518,-0.5664151,-0.72633684,-0.068839945,-0.013206231],[0.8306485,0.08912472,-0.0052987277,0.64255923,0.7617923,0.7024269,-0.8749369,-0.058627207,-0.20296139,-0.30535534,0.43017447,0.85471725,-0.12971222,-0.4191892,-0.5445941,-0.6685368,0.036711175,-0.07217302]],"activation":"σ"},{"dense_2_W":[[-1.0357116,0.9065824,0.31460804,0.10403336,-0.74875206,0.45047748,-0.85107225],[-0.31625268,-0.4494891,-0.6104021,-1.392215,0.4076329,0.14704718,-1.4530859],[-0.42341897,-0.4814765,0.14645709,-0.46671197,-0.3856185,-0.13905132,-0.04437501],[-0.39645517,0.2137238,-0.42819747,-0.36393335,-0.40245435,-0.34181696,-0.02817246],[0.53853995,-0.4282784,0.22716291,-0.40256846,0.638609,0.15241797,0.37022516],[1.1081164,1.7182009,-0.90255654,-2.231287,-0.1349012,1.1165563,-1.5446924],[-0.5763982,-0.065446824,0.4192874,0.2743847,-0.90122163,0.02639325,-0.13482374],[-0.7385771,0.08592593,0.8796296,-0.23078102,-0.24460639,0.50752836,-0.08413138],[-0.10253753,-0.17410895,-0.73427474,0.27838975,0.50574356,0.08523981,0.3418018],[0.0016925063,-0.5907013,-0.85067403,0.30883756,0.4896555,0.11207346,-0.16476792],[-0.15516539,0.26878807,0.57642984,-0.83853066,-0.33322036,0.4774422,-0.9348281],[0.4693064,0.1862027,-0.6251714,0.25223947,0.41830084,-0.44884276,0.2828574],[0.10416213,-0.36627316,-0.822629,0.20704469,0.16795447,0.081779845,-0.4003506]],"activation":"σ","dense_2_b":[[0.20383972],[-0.31411672],[-0.22941822],[-0.028190762],[-0.031698458],[-0.6003632],[-0.15707792],[0.10450507],[-0.06457617],[-0.12753844],[-0.05697597],[-0.10512635],[-0.03311049]]},{"dense_3_W":[[0.6161703,-0.20014547,0.51343465,0.32414958,-0.4191405,-0.094090216,0.6916015,0.68653065,-0.46503648,-0.32374275,0.20278896,0.0272236,-0.40860736],[0.016187323,0.4218443,-0.39871958,-0.49440855,-0.20302232,0.7119994,-0.19964194,0.4442079,0.3104815,-0.5141474,-0.18292132,-0.009729394,-0.43212843],[-0.02621932,0.42008805,-0.41170013,-0.36279938,0.49049714,0.13969359,-0.38049182,0.22852893,-0.5885065,0.420613,0.49065357,-0.67078143,-0.24520677]],"activation":"identity","dense_3_b":[[-0.04161267],[-0.03253271],[-0.033194877]]},{"dense_4_W":[[-1.1191984,-0.70736027,-0.7379151]],"dense_4_b":[[0.038523376]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/HYUNDAI_TUCSON_4TH_GEN.json b/selfdrive/car/torque_data/lat_models/HYUNDAI_TUCSON_4TH_GEN.json
new file mode 100644
index 000000000..57b9f626a
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/HYUNDAI_TUCSON_4TH_GEN.json
@@ -0,0 +1 @@
+{"input_std":[[7.4087214],[1.0962394],[0.552085],[0.045840405],[1.0842694],[1.0885813],[1.0920763],[1.0729834],[1.0586178],[1.0390083],[1.0111257],[0.04568487],[0.045708325],[0.045725018],[0.045583706],[0.045519102],[0.045363124],[0.04511732]],"model_test_loss":0.0031460165046155453,"input_size":18,"current_date_and_time":"2023-08-08_03-31-08","input_mean":[[22.685059],[-0.04596198],[-0.0031675429],[-0.010991076],[-0.04475341],[-0.04535443],[-0.04585154],[-0.045443647],[-0.042782683],[-0.043330435],[-0.042112358],[-0.011107673],[-0.011077235],[-0.011044265],[-0.010814458],[-0.010676653],[-0.010754372],[-0.010827275]],"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":[[5.1307755],[-0.22914484],[-0.08857657],[0.011367913],[-5.177985],[2.9143384],[1.9856763]],"dense_1_W":[[1.2700648,2.4509182,0.42634973,-0.043660536,0.07598462,0.6747098,-1.1844238,-0.047003433,0.04515124,0.38031095,-0.29778752,0.19533536,-0.08757439,-0.33965743,0.66066694,0.11041075,-1.1397349,0.1881033],[-0.018975187,0.86162823,3.7638307,-0.51357865,0.43678054,0.40158442,-0.9920606,-0.42070356,0.2959596,-0.43891278,-0.022803979,0.972302,-0.3332229,-0.17261001,-0.3463398,0.23325261,0.049253233,0.020867042],[0.013230203,0.20721851,-0.005705704,-0.05253921,0.31700867,1.174462,-0.7808391,0.113812,0.07265435,-0.14510319,0.16861048,0.7564678,-0.031058798,0.115615994,-0.5682336,0.123778,-0.68434507,0.43895295],[0.010290787,0.12781261,-0.0023238414,-0.41893026,-0.35603276,1.2424941,-1.300665,0.528987,0.19249827,-0.0497169,-0.10521977,0.3558453,0.17937179,0.042039894,-0.69474906,-0.3783733,0.48399767,0.008863078],[-1.2171276,1.6279436,0.41698736,0.040549632,0.39905706,0.23700579,-0.4378377,-0.0051275906,0.23958966,0.23730484,-0.23500912,-0.0059611434,0.14673305,-0.28380656,0.46382582,-0.36074856,-0.3228667,-0.12749387],[0.5837035,-1.46317,-0.0014780383,0.05828605,0.6278459,-0.7193519,0.7438587,0.97596496,0.31377402,-0.5242437,0.07906513,0.06160492,0.053548303,0.31995016,-0.07082522,-0.648382,-0.29354775,0.5114841],[0.7796686,0.82628,-0.0014781661,0.08306547,-0.45119047,0.8933981,-0.6380061,-0.66575885,-0.43284875,0.24002665,0.13119845,-0.038445093,-0.056063775,-0.4277078,-0.019120147,0.74485147,0.2288264,-0.4735436]],"activation":"σ"},{"dense_2_W":[[-0.77505285,0.44785905,-0.4859164,-0.69656503,-0.3268532,-0.043176193,0.30929434],[-0.533772,0.92544174,0.6345639,0.38062403,1.4165294,-1.2982454,-0.9251346],[-0.29203573,-0.23658712,0.76349384,0.56426525,0.22437766,-0.375684,0.379061],[0.3641449,0.05223953,-0.22189741,0.45458284,0.025595745,0.20614897,-0.5833691],[-0.912483,-0.95896566,-0.32421297,-0.28912008,0.70729816,0.22977747,-1.0203142],[-1.0123776,-0.8513916,-0.5037631,-0.2299052,0.7295842,0.08601015,-0.9566463],[0.32550806,-0.6377905,0.4949481,0.108062916,0.9683189,-0.37003064,-0.11962097],[-0.17852181,-0.39138564,-0.094003476,-0.18062831,-0.9090928,1.1256458,-0.014201421],[-1.4999908,-0.7281591,0.02269345,-0.42794332,0.49982706,-0.16169797,-0.2747838],[-0.23206441,-0.45395112,-0.50797534,0.039583728,-0.51249075,0.042664643,-0.37662345],[-0.10693958,0.07380252,-0.0014285411,0.24690871,1.4165428,-0.9269869,-0.034422167],[0.38615483,-0.5410777,-0.09538446,0.5820919,0.2631145,-0.26281682,0.02736992],[0.29233518,0.044993673,-0.016566137,0.47320673,-0.22927615,-0.55325514,-0.14620171]],"activation":"σ","dense_2_b":[[0.22806741],[-0.58099383],[-0.14560527],[-0.22234294],[0.23043375],[0.33217996],[-0.14389473],[0.2759481],[0.13984576],[-0.22704253],[-0.27780655],[-0.21868534],[-0.4021424]]},{"dense_3_W":[[-0.81395864,0.69009596,0.594186,0.3081578,-0.8761271,-0.9944457,0.26057324,-0.49558344,-0.02225669,0.42718655,0.4395653,0.36918622,0.12211585],[0.36394253,-0.2486054,0.21003513,-0.69946647,0.4221953,0.36324582,0.09421991,0.4322135,0.3120558,0.15996966,-0.38080767,-0.10931592,-0.27037248],[-0.120345704,0.63140625,0.41101453,-0.48626202,-0.93907106,-0.19290596,0.12457818,0.051282577,-0.86917734,-0.68639874,0.7245342,-0.21468553,-0.09911791]],"activation":"identity","dense_3_b":[[-0.0466283],[-0.09009529],[-0.011769824]]},{"dense_4_W":[[0.9855905,-0.11999337,0.6430469]],"dense_4_b":[[-0.037628047]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/JEEP_GRAND_CHEROKEE.json b/selfdrive/car/torque_data/lat_models/JEEP_GRAND_CHEROKEE.json
new file mode 100644
index 000000000..cba87588f
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/JEEP_GRAND_CHEROKEE.json
@@ -0,0 +1 @@
+{"input_std":[[8.254862],[1.1385337],[0.41576585],[0.043710105],[1.1287707],[1.132625],[1.1353652],[1.1196473],[1.0987684],[1.0703217],[1.0421079],[0.04358062],[0.043615773],[0.043639626],[0.04353495],[0.04332622],[0.04291046],[0.042309582]],"model_test_loss":0.014948678202927113,"input_size":18,"current_date_and_time":"2023-08-08_08-31-33","input_mean":[[24.234503],[0.023715263],[0.0013837352],[-0.016846638],[0.024842778],[0.024989845],[0.024956135],[0.025811702],[0.027098333],[0.02575938],[0.025799232],[-0.016848726],[-0.016819052],[-0.016790438],[-0.016748805],[-0.016675282],[-0.016660813],[-0.016719952]],"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":[[1.1555274],[-1.2548984],[-0.4566681],[-1.6319039],[-0.14648859],[0.13250285],[0.9906875]],"dense_1_W":[[1.3423415,-0.24642485,0.006111532,0.012378954,0.82595116,-0.17717491,0.24821205,0.42500618,0.6834485,0.018730227,-0.1565104,0.09215833,-0.36679584,0.0047377744,0.24215446,0.43317646,-0.18074779,-0.17103945],[-0.5176677,-0.7046031,0.0015316915,0.14099175,-0.0733852,-0.6077859,0.2935369,-0.076649874,-0.110761255,0.051375758,-0.0816902,-0.05404265,-0.17823854,0.2719146,0.047899935,-0.5356291,0.31465584,0.016353693],[-0.111515455,0.7519741,4.21518,0.05408819,-1.119347,-0.20324452,-0.08807333,-1.244985,1.5230471,1.5096039,-0.717811,0.2608386,0.15778817,0.23581202,-0.56306803,0.31904206,-0.38444847,-0.19765459],[-0.5268752,0.76404643,-0.0017947298,-0.3977187,-0.22531988,0.6545117,-0.038231295,0.07132816,0.14574783,0.020449052,-0.010587621,0.0513172,0.25084835,-0.10950242,0.26603368,0.061757516,-0.2410503,0.07645558],[-0.00076164474,0.7578842,0.010459518,-0.12878841,-0.36717027,0.2933262,-0.9912176,0.64869034,0.30009547,0.2382631,-0.4692174,0.9048082,0.089927815,-0.3356697,-0.620122,-0.5221165,-0.043559503,0.49379468],[-0.013825502,0.7339534,-0.0039100796,-0.055555224,-0.0005979433,0.83517665,-0.20551458,0.24547431,0.40483287,0.01048875,-0.1659191,0.37662286,-0.18053651,-0.5086211,-0.052123472,-0.2253914,0.26272738,-0.00324899],[1.4422294,0.10161895,-0.009221952,0.0001851067,-0.5961213,0.35581017,-0.40002102,-0.57796574,-0.72453356,-0.2504394,0.40512785,0.33791512,0.23944646,-0.5331633,-0.10079834,-0.14660199,-0.12033143,0.26091284]],"activation":"σ"},{"dense_2_W":[[-0.7369561,0.02455093,-0.46102518,0.1283071,-0.7312183,0.10579285,-0.6936246],[-0.7311419,-0.749299,0.3388481,0.18734214,0.79592025,0.29745373,0.17872249],[-0.22437106,-0.45606863,0.29539058,0.5096125,0.5026677,0.12546055,0.85000384],[-1.3382739,-1.1157519,0.10686484,1.3033385,0.385738,0.17410201,-0.19884275],[-0.1854942,0.42922994,0.28422222,-1.1910807,-1.0079081,-0.23142847,8.624731e-5],[-0.39573595,-0.7930596,-0.130986,0.841052,0.45527455,0.13693747,0.12886971],[-0.73722404,1.5512154,-2.526512,0.409384,0.048512198,-0.16389945,-1.4609332],[-0.5329282,1.3224562,-0.89408386,0.12158089,-0.8545148,-0.67364424,-0.5871783],[0.8857724,0.6694776,-0.603088,-0.26001891,-0.79026496,-0.23295787,-0.30123875],[-0.10273737,-0.6942836,-0.45611718,1.081006,0.4116631,0.74641204,0.097880006],[1.5226238,1.1838912,-0.7302709,-0.74710697,-0.15506236,-0.9069341,0.47763306],[0.41078228,1.0947998,0.33479145,-1.2295458,-0.73588777,-0.35713267,-0.4043876],[0.051438108,-0.25903246,0.011029442,0.29265,0.4014094,-0.55543566,-0.45906964]],"activation":"σ","dense_2_b":[[-0.23664342],[-0.20603849],[-0.17615202],[-0.3781619],[0.0006889099],[-0.081270784],[0.25464833],[0.013770528],[0.22249864],[-0.026060008],[0.62564516],[0.11952428],[-0.12836026]]},{"dense_3_W":[[-0.074207924,-0.505883,-0.40938795,-0.59246546,0.7246955,-0.35897088,0.79559946,0.4252552,0.53429896,-0.7682427,0.41834652,0.73031914,0.09650071],[-0.49922326,0.3795509,-0.38837686,0.6977958,-0.5670746,0.28678024,-0.24660635,0.4053855,-0.20115663,0.21688443,-0.26936162,0.17709436,0.43220088],[-0.2724911,-0.0043004784,-0.3452385,0.35134262,-0.31723148,-0.32032728,-0.33450916,0.66542053,0.58240664,0.0893131,0.18599492,0.4492229,-0.58078444]],"activation":"identity","dense_3_b":[[-0.072912164],[0.02573561],[-0.051938336]]},{"dense_4_W":[[-1.0250915,0.18725124,-0.05788247]],"dense_4_b":[[0.0649493]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/JEEP_GRAND_CHEROKEE_2019.json b/selfdrive/car/torque_data/lat_models/JEEP_GRAND_CHEROKEE_2019.json
new file mode 100644
index 000000000..2942415d1
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/JEEP_GRAND_CHEROKEE_2019.json
@@ -0,0 +1 @@
+{"input_std":[[5.4780097],[1.2577926],[0.43811297],[0.051083397],[1.2457128],[1.2499636],[1.2529455],[1.2401595],[1.223894],[1.1997709],[1.1767297],[0.050826065],[0.0508941],[0.050945964],[0.050895486],[0.050689384],[0.05035568],[0.049934413]],"model_test_loss":0.011547946371138096,"input_size":18,"current_date_and_time":"2023-08-08_05-36-40","input_mean":[[27.111942],[-0.03980634],[-0.0022899704],[-0.006063226],[-0.03720769],[-0.03763983],[-0.038365092],[-0.03697022],[-0.03660629],[-0.03213649],[-0.029237831],[-0.0060009984],[-0.0060217986],[-0.0060452693],[-0.0060623847],[-0.0061068335],[-0.0060221725],[-0.006052836]],"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.12641694],[-0.33899814],[-0.25064033],[0.20345357],[-0.22338079],[-0.8124178],[0.16103578]],"dense_1_W":[[1.3942753,-0.3584407,-0.154166,0.022718882,0.5902439,-0.22766683,0.2832875,-0.22318293,-0.25568873,0.28416058,0.12970877,-0.500204,-0.5363517,0.45337692,-0.13542888,0.054177634,0.13246426,-0.022701526],[-0.005614037,-0.74243695,-0.024937803,-0.016466122,0.16694336,-0.79974186,1.0153489,-0.21336944,-0.3901125,0.23960757,0.0332596,-0.07577539,-0.42862704,0.4491737,0.17550863,0.31181923,-0.16353676,-0.07374046],[-0.0031423056,-0.57563585,0.017968522,0.3929503,-0.15378566,-0.63862056,0.15106781,-0.12307793,0.23466262,-0.24525358,-0.0012493497,-0.6446595,0.23389706,0.2918894,0.012215268,-0.17649019,0.35015333,-0.16645752],[0.04239965,0.5392046,4.068176,0.13729823,-0.68696815,-0.07966062,-0.088794686,-0.3782991,0.8575764,0.7636464,-0.54163724,0.9711964,-0.018747166,0.14241268,-0.38917318,-0.40814298,-0.3224793,-0.29323283],[0.8142449,-0.7080669,0.16443568,0.63644344,0.28831044,-0.24459267,0.6272347,0.22174281,0.1637401,-0.70512813,0.2843761,-0.16773595,-0.27920532,0.55365586,0.256064,0.11410076,-0.021043133,-0.39824295],[-1.6068854,-0.2603165,0.18158215,0.49356657,0.12779,0.17468308,0.25797316,0.08986019,-0.3094926,-0.6496034,0.49420497,0.34940144,-0.21054225,0.10816955,0.0055429307,0.37773353,-0.37752208,-0.09018268],[-0.7694553,-0.07489691,-0.16786428,-0.00053137547,0.4097508,-0.36562666,0.12501729,-0.19840546,-0.0126358615,0.039615765,0.18806833,-0.54327863,-0.51791424,0.0740618,0.22897214,-0.18245429,0.3604914,-0.09582553]],"activation":"σ"},{"dense_2_W":[[0.24724053,-0.8135549,-1.0432718,-0.47479427,0.23202157,-0.11595288,-0.8035583],[-0.3641042,-0.91288745,-0.17233254,0.062157948,0.012575541,-0.2614273,-0.5772882],[0.29817045,0.49287653,0.19307482,-0.8773637,0.06299248,0.41714546,0.44092533],[-0.22270527,-0.7510113,-0.320351,0.13680461,-0.70703113,-0.12383241,-0.13850203],[0.5840328,-1.1061023,-0.6563664,-0.8935429,-0.123855405,-0.70505697,-0.63111097],[0.99201673,0.9417266,0.9312267,-0.81133705,0.5478353,-0.04604467,0.02872271],[-0.26014936,-0.412083,-0.7116672,0.29321614,-0.5735676,0.29037717,-0.7531203],[-0.38308242,1.0270671,0.65335995,0.19699557,0.48486,0.23515755,-0.14074802],[-0.7378848,0.32173055,0.28095686,-1.3347943,-0.10628233,0.2015702,0.62443095],[0.47323346,-0.77164555,-1.1039329,0.018455347,-0.5227511,0.69003034,-0.2582299],[-0.7601159,-0.2633271,-1.0450773,0.6082064,-0.675639,-0.23727775,-0.028281933],[-0.72581375,-0.90512085,-0.6048286,0.46046877,-0.6226022,-0.07060259,-0.21025342],[0.216426,-1.0285689,-0.4780186,-0.22132304,-0.5840384,-0.53020334,0.15992962]],"activation":"σ","dense_2_b":[[0.15380488],[0.10775849],[-0.19009462],[0.13743988],[-0.026639858],[-0.07323958],[0.1744765],[-0.21176378],[-0.6805215],[0.025015425],[-0.07340503],[0.20637435],[-0.27417326]]},{"dense_3_W":[[-0.400137,-0.17929879,0.37570322,-0.41039902,-0.78768486,0.45827937,-0.33256137,0.5615223,0.31010586,-0.35362414,-0.12100718,-0.41779718,-0.6763564],[-0.029315872,0.38450587,0.65436715,0.5139883,0.5027268,-0.20125258,-0.6333471,-0.34089682,0.29030252,-0.47958472,-0.50353307,0.046102453,-0.1736601],[0.7619456,0.69776905,-0.5650997,0.6306316,0.2189477,-0.5332646,0.4607702,-0.63797,-0.0884034,0.2954164,0.25978985,0.40438277,-0.020070346]],"activation":"identity","dense_3_b":[[-0.039152775],[0.10458916],[0.05406968]]},{"dense_4_W":[[-0.4555721,0.005902641,1.1475917]],"dense_4_b":[[0.05754332]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/KIA_CEED.json b/selfdrive/car/torque_data/lat_models/KIA_CEED.json
new file mode 100644
index 000000000..56d771db4
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/KIA_CEED.json
@@ -0,0 +1 @@
+{"input_std":[[7.128073],[1.9819432],[0.67647],[0.03768782],[1.9757774],[1.983661],[1.9863665],[1.9118274],[1.8144435],[1.6810344],[1.5267222],[0.037616044],[0.03765301],[0.037677314],[0.03763337],[0.037550315],[0.037358243],[0.036996108]],"model_test_loss":0.008689496666193008,"input_size":18,"current_date_and_time":"2023-09-02_03-20-12","input_mean":[[14.68071],[0.021380786],[0.46259907],[-0.004524958],[0.022391],[0.022068378],[0.021636909],[0.017254867],[0.01384061],[0.011885543],[0.0075867935],[-0.0047742473],[-0.004707863],[-0.004638913],[-0.004404541],[-0.0042158943],[-0.004056291],[-0.0040879687]],"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":[[-1.1280082],[-1.1454269],[-0.5907967],[-0.09462522],[-1.5222621],[-0.06474111],[-0.18497786]],"dense_1_W":[[-0.7009141,-0.38039988,0.004431449,-0.012658321,-0.22134589,0.40167508,0.24670589,-0.16331027,-0.6081444,0.044047765,0.15884489,-0.28576955,0.5305393,-0.21158585,0.01631704,0.0164069,-0.04090381,0.03749079],[-1.2070944,0.33291462,-0.00065425114,-0.15011062,0.107518055,-0.18207166,-0.14097372,0.41454053,0.0068484033,-0.22716488,0.103904985,-0.09329521,-0.06751863,-0.041087177,0.60482687,-0.26763386,0.11107493,-0.1320544],[0.4323738,-0.7883933,0.018195441,0.1580461,-0.6474651,-0.6159256,-0.9379849,-0.37990838,0.68379474,1.044618,1.4096797,-0.40671948,0.1614424,-0.11615482,0.12993212,0.37938693,0.11391126,-0.3182603],[-0.13848633,0.090352476,0.01572969,0.3221026,1.8986752,1.4132906,1.0738622,-1.0810357,-1.1936059,-1.3231126,-0.6220339,0.24080239,-0.34178606,-0.17251074,0.07337686,-0.21869779,-0.14425553,0.15532547],[-1.3020873,-0.3577446,0.004843032,-0.19699144,0.61322373,0.27911437,0.032230213,-0.86169994,0.13983178,0.12466293,0.17854461,0.07389106,-0.24750361,0.07031268,0.20702806,0.16463912,0.10438393,-0.1978545],[-0.16901715,0.3392736,0.004554811,-0.27741778,0.45267153,-0.3854464,0.30139357,0.38105348,-0.54760116,-0.1830378,0.25936118,0.2037518,-0.045803245,0.18543306,-0.3661198,0.30218798,-0.18051952,0.088926606],[-0.04060996,-1.2018764,-0.0063867588,-0.1523224,-0.23714058,0.14187981,0.37231123,-0.21963619,0.48160625,-0.064321116,-0.08458865,0.098526716,-0.23027526,0.29377708,0.07306222,0.05420829,-0.027615033,0.032934707]],"activation":"σ"},{"dense_2_W":[[-0.9896441,-0.91121817,-1.3145435,1.5384254,-1.8210615,0.4096885,-0.6555594],[-0.5512578,0.706973,0.1739295,-0.2688923,0.0792371,0.2261899,-0.93914133],[-0.17643008,0.37539357,-0.52018803,-0.60483295,-0.40311056,0.00969808,-0.60566235],[0.5127232,-0.6856154,-0.38688743,0.5137769,0.043315798,-0.31914636,0.55572736],[-0.4251685,0.8384956,-0.44557106,-0.33929333,-0.2585186,0.5259269,-0.57586336],[-0.10946882,-0.59604675,-0.20513241,0.4133915,0.30031222,-0.061005022,0.73186797],[0.17562889,0.145244,-0.26974306,0.28159103,0.1361736,-0.8459545,0.5167652],[0.050689343,-0.7800611,0.38343653,0.51704615,-0.014367372,-0.110503346,0.6778625],[0.20051907,-0.08033896,-0.1346465,0.4862248,0.26726595,-0.49421996,0.058299515],[-0.6299042,0.62805223,-0.79595345,-1.3490283,0.5333974,0.47591394,-0.63695586],[-0.90749574,0.033430014,-0.9152016,-0.031571057,-0.5695399,0.42602757,-0.27167413],[-0.17134069,-0.100465134,0.49037132,-0.2590825,-0.40358037,0.59190834,-0.2740423],[0.4622381,-0.2463554,-0.19674955,-0.23713845,0.62164,-0.40453714,0.3900809]],"activation":"σ","dense_2_b":[[-0.16326958],[-0.049766444],[-0.07038124],[-0.11578319],[0.066625684],[-0.1020039],[-0.12042527],[0.06384306],[-0.14624113],[-0.08538901],[0.01569337],[0.09202553],[0.00027780043]]},{"dense_3_W":[[0.7518775,0.02956615,0.6283354,-0.04630323,-0.31706655,0.42018586,-0.10056567,-0.7526844,0.40103868,1.063733,0.057580598,0.4941196,-0.70732373],[0.27228886,0.64840984,-0.030330945,-0.5357204,0.562624,-0.42896906,-0.22066677,-0.5914074,-0.64570546,1.042475,0.021803057,0.59831506,-0.15360864],[-0.9862492,-0.22666612,0.13068162,0.7076782,-0.28517807,0.4069032,0.24799564,0.2690811,-0.46506408,-0.38062972,-0.8088552,-0.4484452,0.12431305]],"activation":"identity","dense_3_b":[[-0.09667684],[-0.03777417],[-0.07913758]]},{"dense_4_W":[[0.31394643,1.0359226,-0.3090591]],"dense_4_b":[[-0.04020227]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/KIA_EV6.json b/selfdrive/car/torque_data/lat_models/KIA_EV6.json
new file mode 100644
index 000000000..9e89e1b73
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/KIA_EV6.json
@@ -0,0 +1 @@
+{"input_std":[[8.864324],[1.195729],[0.5000528],[0.045503624],[1.1876615],[1.1897441],[1.1915259],[1.1731166],[1.1543447],[1.1241426],[1.0919412],[0.045285385],[0.045317214],[0.045348417],[0.04523818],[0.044993326],[0.044672333],[0.044197746]],"model_test_loss":0.010650141164660454,"input_size":18,"current_date_and_time":"2023-08-08_10-38-45","input_mean":[[22.725025],[-0.055808485],[0.001137117],[-0.015166062],[-0.053198244],[-0.053012587],[-0.05277475],[-0.05324079],[-0.05459143],[-0.05888146],[-0.061499923],[-0.015064281],[-0.015065552],[-0.015068696],[-0.015092874],[-0.015163227],[-0.015276051],[-0.015225322]],"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.8403706],[1.9263608],[-0.02353573],[0.13397901],[0.053899422],[-0.64194036],[1.533293]],"dense_1_W":[[1.215834,0.5290091,0.0010350833,0.58499736,0.13186142,-0.31402144,-0.21469525,0.38816625,0.23431656,0.29439512,-0.31795207,-0.4929344,0.027251905,0.4290527,-0.27181652,-0.25157085,-0.13006414,0.19127874],[0.2723699,1.2427698,0.0014152995,-0.43297893,-0.48355135,1.1187311,-0.24734323,-0.09894979,0.11120238,0.28424853,-0.010035362,1.1629834,-0.19423008,-1.0324532,0.13956966,0.09991054,0.112085946,-0.1749808],[-0.19893286,-0.17605188,-0.0030688597,0.05146822,0.27002192,-0.7286609,0.43610734,-0.14199519,-0.0853716,-0.101905815,0.073544376,-0.46090946,-0.18160121,0.4364794,0.10960736,0.04185993,0.26554465,-0.31036776],[-0.011314031,0.4353308,3.653043,-0.05127646,-0.1675842,0.31245592,-0.18524799,-0.27518684,0.44928986,0.26701117,-0.52353877,0.41049197,-0.26632294,-0.028535297,-0.29766062,-0.048215423,-0.3651719,0.3764775],[1.5780559,-0.08976564,-9.765889e-5,-0.26617634,0.24203834,-0.8669704,1.1116273,-0.0742143,-0.2221292,-0.054146104,0.16106835,-0.92289317,0.365733,0.5554041,0.15667431,0.3766961,0.2937706,-0.38773754],[-1.6040205,-0.47703403,0.002361407,0.07246606,0.53856707,-0.90088457,0.95031244,0.007901789,0.048565075,0.0043789237,0.04390007,-0.9249038,0.1373752,0.6529523,0.4923536,-0.27184066,0.13291296,-0.11895679],[0.2517245,-1.1308137,0.0034714418,0.1780916,0.10587542,-0.8159195,0.4059062,-0.03472441,-0.04591407,-0.26056758,-0.016641837,-0.5397002,0.108333215,0.5678768,0.039879672,-0.132191,-0.21716514,0.2923616]],"activation":"σ"},{"dense_2_W":[[-0.48967394,-0.51389205,0.113997415,0.016403848,0.5711787,0.15113378,0.4878009],[-0.2635089,0.21487024,-0.7652375,-0.8594565,0.295536,-0.23716962,-0.41961473],[-0.88732815,0.43693033,-1.120157,1.132662,0.06735183,-0.01847645,-2.4321022],[0.01924355,-0.03326971,-0.11982994,-0.620888,-0.33939648,0.13469471,0.18667164],[0.3868043,-0.32892308,0.5205381,-0.04860096,0.63565564,0.5115548,0.18762778],[-0.617038,-1.3592334,-0.1403255,-1.1278222,0.28842503,0.97025603,-0.17546569],[-0.55640936,-0.90946704,-0.37307426,-0.58689624,-0.29243192,0.10891342,-0.54093736],[-1.3703765,-0.16418502,-0.823949,1.6223699,-1.0620314,0.53991866,-2.127252],[-0.009325325,1.5309258,-0.16605411,0.7356731,-0.34463426,-0.6377375,-0.29067755],[-0.39712206,0.07344511,-0.75337785,0.14594577,-0.71447504,-0.70417905,-0.90238726],[-0.5242973,-0.42696825,0.40271243,0.5059833,0.7945543,0.64832735,0.23148233],[0.3530504,-0.88467205,0.88836426,0.33030617,0.049364965,0.01906914,0.4844055],[-0.4703546,-0.24426712,0.7923177,0.36024544,0.0022455095,0.052522115,0.8682579]],"activation":"σ","dense_2_b":[[-0.17262366],[-0.14012913],[0.12171151],[-0.18287124],[-0.20833604],[-0.1185827],[-0.17963924],[0.059548587],[0.52694756],[0.41090366],[-0.200375],[-0.20045975],[-0.153012]]},{"dense_3_W":[[-0.07465968,0.15956515,0.46311855,0.014608014,-0.444435,-0.7115352,-0.30661452,0.73835003,0.8836145,0.9389069,-0.5226219,-0.41022688,-0.41954798],[-0.60114104,0.003818114,0.17285155,0.044011418,-0.4042057,-0.7233705,-0.45021132,0.0065049254,0.3945897,0.92667377,0.58642626,-0.5636264,0.041805413],[-0.40279514,0.053986654,-0.03796396,-0.01619937,-0.3810127,0.20270245,-0.16480388,-0.09316253,-0.31165186,0.23359255,0.42131686,0.16401958,0.35183364]],"activation":"identity","dense_3_b":[[0.10906697],[0.11099494],[0.09338066]]},{"dense_4_W":[[1.0284308,0.2183279,-0.010448182]],"dense_4_b":[[0.106538475]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/KIA_K5_2021.json b/selfdrive/car/torque_data/lat_models/KIA_K5_2021.json
new file mode 100644
index 000000000..5256a3e1b
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/KIA_K5_2021.json
@@ -0,0 +1 @@
+{"input_std":[[8.854179],[1.1303082],[0.53015584],[0.03889556],[1.123932],[1.126327],[1.1281773],[1.1152551],[1.0980102],[1.0719626],[1.0425837],[0.038768984],[0.038817387],[0.03885716],[0.03881795],[0.03875846],[0.0386614],[0.038491134]],"model_test_loss":0.01249716430902481,"input_size":18,"current_date_and_time":"2023-08-08_13-08-15","input_mean":[[21.914545],[-0.06985225],[0.0069250595],[0.0074601127],[-0.072784856],[-0.07272125],[-0.07216228],[-0.06802319],[-0.062263846],[-0.055437304],[-0.047055077],[0.0074525527],[0.0074529466],[0.0074460334],[0.007305565],[0.0071349433],[0.006932451],[0.0067396]],"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.1328846],[-1.0045387],[-0.20393331],[0.34046453],[-2.9040704],[-0.88909465],[-1.0122662]],"dense_1_W":[[-0.009380342,0.39705235,-0.00044332718,-0.09147423,0.08871867,0.9096405,-0.59983367,-0.18780915,0.30827704,0.051737268,-0.026273916,0.1966064,-0.08228399,0.07654324,-0.22208402,-0.26681504,-0.0277596,0.20970288],[-0.61757046,-0.8588174,-0.23621607,-0.027208043,0.09026295,-0.43468106,0.6500065,0.006853881,-0.12466401,-0.47896266,-0.2195636,-0.4655939,0.2346326,0.25235915,0.21434762,-0.3650002,0.06806084,0.19297919],[0.010002054,-1.349585,-5.1705165,0.12756625,0.08521816,-0.98372036,0.43257916,-0.057569943,-0.54946965,0.96981055,1.5286827,-0.9813786,0.12952766,0.14352597,0.23754609,0.4159036,-0.0977373,0.048195776],[0.9575999,-0.14470491,0.31414202,-0.09178863,0.14425702,-0.61020595,0.9214482,-0.051314764,0.49639797,0.7580396,0.10446417,0.056817234,-0.1146647,0.19221032,0.121222705,-0.14470126,0.08769907,-0.25462785],[-0.88419044,0.9049013,0.3302875,-0.8633652,-0.44462034,0.61998045,-1.0550838,0.5917251,0.48678157,0.50562924,0.12007341,0.26738396,-0.017963672,0.30564892,0.19286638,0.40492755,-0.14467871,-0.2856948],[-1.3030186,-0.29781476,0.31140298,-0.17929639,0.12359713,0.34227288,0.38400793,-0.4179453,0.20848781,0.7742308,0.35219595,0.0028036782,0.4082305,-0.34966815,0.021426486,0.34787825,-0.19836852,-0.21195874],[-0.58479625,-0.23239343,-0.24123837,0.6287148,0.47498283,-0.7846575,0.8982925,-0.88446414,-0.22690499,-0.40089333,-0.053161245,-0.52477574,0.04346586,0.0012316491,-0.17584592,0.15376398,-0.23099528,0.21563265]],"activation":"σ"},{"dense_2_W":[[0.06019809,-0.17363435,0.009131735,-0.6226487,-0.26803654,-0.040024236,-0.56756294],[-0.14312544,0.49063408,-0.44845125,0.40217203,-0.18071179,0.4310444,0.43489814],[-0.24798368,-0.56137055,0.52847433,0.7304674,0.039464716,0.2093034,0.44131762],[0.811304,-0.7688727,-0.07781592,-0.26929495,0.06020161,0.10069685,-0.2413632],[0.5917001,-0.7344408,-0.7879752,-0.70411605,0.096649006,0.5307449,-0.5803427],[-0.17709559,0.57773626,-0.12374329,-0.39053938,0.05942479,0.36537674,0.3478097],[-0.57855505,0.43059486,-0.29216823,0.44024208,0.109462574,0.05103991,0.6366086],[2.143651,-0.36122483,-0.28893292,-1.1197438,0.8901433,-0.60585576,-0.6609203],[2.3569098,-1.4072812,0.41858813,-1.4579345,1.6088637,-0.65525293,-1.0169],[-0.4568836,0.46699843,0.4344656,-0.108972535,-0.5572416,0.22916758,-0.03445166],[0.726269,-0.7789017,-0.42420408,-0.6138444,0.5996936,0.19354253,-0.40971667],[0.16139944,0.33351776,0.44673514,0.25408468,-0.6194311,-0.102249816,0.24741264],[-0.2875433,0.15023352,-1.0662942,-1.5630789,0.52131546,0.17151031,-0.08705293]],"activation":"σ","dense_2_b":[[-0.056130372],[0.007243945],[-0.049758114],[-0.10406119],[-0.215356],[-0.033409223],[-0.003601784],[0.3017622],[0.28980875],[-0.08838445],[-0.027734138],[-0.04194128],[-0.18084925]]},{"dense_3_W":[[-0.3558706,0.27432942,0.24073915,0.4001887,-0.5080968,0.1751163,0.57690793,-0.34388652,-0.48687238,-0.15128407,-0.3315714,-0.41198158,-0.18070593],[-0.45770586,0.05980327,0.4270051,0.4770666,0.50269896,-0.25726086,0.48697513,0.34577233,-0.074373096,-0.40511134,0.45576844,0.02034731,-0.09106971],[0.4071002,-0.1986135,-0.46739143,0.5110455,-0.26348698,-0.15412426,-0.5601918,0.17882004,0.52172244,-0.3752082,0.43591946,-0.6359482,0.3153758]],"activation":"identity","dense_3_b":[[0.04088854],[-0.057896398],[-0.03347668]]},{"dense_4_W":[[-0.6996337,0.5206291,1.0165205]],"dense_4_b":[[-0.037676737]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/KIA_NIRO_EV.json b/selfdrive/car/torque_data/lat_models/KIA_NIRO_EV.json
new file mode 100644
index 000000000..915749356
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/KIA_NIRO_EV.json
@@ -0,0 +1 @@
+{"input_std":[[8.756613],[1.5469935],[0.5868461],[0.048539903],[1.5311569],[1.5367651],[1.5406994],[1.5197327],[1.4855404],[1.433774],[1.3787619],[0.048304897],[0.048386667],[0.048456155],[0.048535753],[0.048419178],[0.048049178],[0.047447804]],"model_test_loss":0.01072931382805109,"input_size":18,"current_date_and_time":"2023-08-08_14-01-31","input_mean":[[19.740038],[0.010453053],[-0.00983059],[-0.008197198],[0.011297055],[0.010507559],[0.009715306],[0.00675721],[0.005983052],[0.005432915],[0.0040853415],[-0.008249147],[-0.008247744],[-0.008244466],[-0.008281346],[-0.008300149],[-0.008453809],[-0.00865498]],"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":[[-3.7556062],[-2.0698571],[-4.225762],[-0.15726951],[-0.30065513],[-1.0648031],[1.8342476]],"dense_1_W":[[-1.7290211,-1.5173091,-0.23002613,-0.37698144,0.016258085,-0.8270681,1.3781465,-0.7642315,-0.6422404,0.2824734,-0.110180624,-0.3257264,0.5549623,-0.032036513,0.43426138,-0.0714845,0.2864038,-0.21663748],[1.9184333,0.671971,0.04794123,-0.25451732,-0.10465885,0.5573552,-0.37439582,0.24595505,-0.06845002,-0.041696787,-0.05226348,0.22399874,0.03275794,-0.070917316,-0.22555944,0.1414704,-0.0041139866,-0.00024242824],[-1.8817899,1.5202969,0.2509318,0.51012284,0.62497395,0.032136127,-0.979242,0.6263891,0.70745003,-0.31345257,0.18674128,0.12859097,0.07685459,-0.46171176,-0.2280601,-0.33504027,-0.4022656,0.4169894],[0.04874895,1.0698912,-0.029439794,0.07341402,0.3300274,0.7930807,-1.2549204,0.0783156,0.44667515,-0.044906255,-0.043870416,0.46820083,0.10374188,-0.53068924,-0.48136172,-0.074282564,0.12173919,0.0077482965],[-0.04342037,1.5612729,3.16704,-0.28737867,-0.79875565,-0.07702065,-1.1260544,-0.43122292,0.9323476,1.0069447,-0.97308475,1.2108004,-0.18733604,-0.6011836,0.18945155,-0.30365372,-0.16747494,0.19430496],[-0.31009704,1.1274835,0.09042992,-0.03338503,0.018458644,0.5902667,-0.24463883,-0.06990637,-0.159641,0.30669054,0.05195872,0.40048352,-0.029881949,-0.021455474,-0.6194718,-0.10056458,0.027914932,0.17777753],[-1.7739217,0.33766812,0.043878227,-0.7079486,0.070119634,1.0434483,-0.68583184,-0.19537714,0.06398747,0.16186452,-0.09159792,0.9890885,-0.08469821,-0.27189568,0.09402364,-0.43951192,-0.060028143,0.3246841]],"activation":"σ"},{"dense_2_W":[[1.3462045,0.59007597,-1.0555073,-0.72884923,0.30742645,-0.7919825,-0.79060274],[-0.94850713,0.08338297,-0.14278129,0.8774979,0.573835,0.043590613,0.47284335],[0.6373134,-0.7411809,-0.33538958,0.14371277,-0.37772784,0.16757706,-0.5341049],[-0.16109301,0.74011505,-0.12572628,-0.123916484,0.87228954,-0.0765876,0.09092019],[0.75033695,0.0969066,-0.60294336,-0.23090811,-0.39634117,0.18033504,-0.8499323],[-0.9217793,0.014436126,-0.6526303,-1.0338821,0.44630024,-0.17751805,-0.63913804],[-0.090204455,0.4812081,0.26368377,0.015731392,0.9630277,-0.17355147,-0.11038842],[0.0126234675,-0.63450015,-0.5070031,0.14078641,-0.73571676,0.008089552,0.03479742],[0.80792475,-0.66766584,0.23032701,-0.33161584,-1.2037598,0.2125056,-0.15969864],[-0.2423005,-0.74057645,-0.5435483,0.044129636,-0.69188356,0.08389628,0.16697945],[-1.5361837,0.30874377,1.1789893,0.6659148,-0.69351107,0.4415424,0.6480144],[-0.07204271,-1.221483,-0.92439497,0.7499748,-0.035351105,0.5684253,-0.67117625],[-1.017458,0.48187095,0.2618596,0.97278225,-0.55749303,0.423465,0.33408752]],"activation":"σ","dense_2_b":[[0.1838596],[-0.28277993],[0.11383015],[-0.23923337],[0.14975849],[0.014726325],[-0.16617869],[-0.029415732],[-0.118649684],[0.27848494],[-0.45202333],[-0.1126877],[-0.33022732]]},{"dense_3_W":[[-0.29903474,0.096304685,-0.46381262,-0.0082688145,-0.34521008,-0.72311455,0.260216,-0.3090884,-0.632807,-0.635328,0.6114854,-0.52489674,0.5849963],[-0.1397393,0.7307058,-0.24962811,0.54387295,-0.42753673,-0.5538375,0.39787623,0.073375665,0.29743633,-0.4567702,0.4831776,0.17509066,0.23498277],[0.17090236,-0.29356945,-0.030084739,0.1615791,0.08188441,-0.01872784,0.24252425,-0.23374312,-0.050307382,0.2272926,-0.600093,0.61274093,0.07305241]],"activation":"identity","dense_3_b":[[-0.015210137],[-0.05734997],[-0.043353032]]},{"dense_4_W":[[0.7804087,0.5536279,-0.040379304]],"dense_4_b":[[-0.031827074]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/KIA_NIRO_HEV_2021.json b/selfdrive/car/torque_data/lat_models/KIA_NIRO_HEV_2021.json
new file mode 100644
index 000000000..ce68ad35e
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/KIA_NIRO_HEV_2021.json
@@ -0,0 +1 @@
+{"input_std":[[8.597539],[1.589519],[0.8570558],[0.04863597],[1.6346245],[1.6241254],[1.6103257],[1.498106],[1.4157897],[1.3226876],[1.2293135],[0.048567627],[0.048607342],[0.04863673],[0.048688337],[0.0488638],[0.049082097],[0.049054746]],"model_test_loss":0.011536603793501854,"input_size":18,"current_date_and_time":"2023-09-02_06-52-47","input_mean":[[17.37028],[0.06026842],[0.506836],[0.00031705393],[0.06628794],[0.06474968],[0.0628686],[0.05320054],[0.04718131],[0.04658512],[0.051670313],[0.00045426827],[0.00041247738],[0.0003619111],[3.6777285e-5],[-0.00032301998],[-0.0005914742],[-0.00092334347]],"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.24682778],[-0.006299858],[0.0748293],[-0.5736973],[-0.256641],[-0.58670074],[-0.0044331043]],"dense_1_W":[[1.0383956,0.9127742,-1.7661572e-5,-0.119445495,0.33176455,0.03573714,-0.8297675,0.023340857,0.47458792,-0.40310016,0.05576016,0.45783523,0.14146096,-0.4043011,-0.40886042,-0.11232859,-0.08254774,0.23749773],[-0.010238037,0.30345035,0.11772968,0.042131707,0.3533758,0.16141611,-0.32165682,0.22163633,-0.44536677,0.12489661,0.11577652,-0.4645873,-0.17438301,0.28373742,0.5604936,0.18323892,-0.099337935,-0.2914466],[0.019332694,-0.9718337,0.1213718,-0.09318972,0.4252448,0.122399725,-0.18120395,0.11679359,0.08406331,-0.28711584,-0.055180494,0.3861118,-0.31324327,-0.20063293,-0.299365,0.17973764,0.18562388,0.011371533],[-0.011864931,-1.153027,-1.1015527,-0.09962848,0.015605152,0.3611728,0.13415214,-0.23815176,0.63666695,-0.11102109,-0.2912127,-0.53489137,0.41428724,0.08640866,0.18429007,0.3095773,0.068252586,0.18889964],[1.0551776,-0.36253345,-0.001785746,0.022279864,-0.25197285,0.18718459,0.10246457,-0.26064438,-0.30058408,0.2714863,0.002131989,-0.643216,0.37801188,0.10752107,0.50343543,0.07076738,0.08356163,-0.22799636],[-0.008646536,0.78340423,-1.1187115,-0.57623047,-0.35842294,-0.7300839,-1.0882407,1.38732,-0.015289124,0.102130026,-0.69328797,-0.026475098,0.11983873,0.14571564,0.058386486,0.48151672,0.45962128,-0.04454241],[0.0033251448,-0.377444,0.08040648,0.07891003,1.9698765,2.2291944,1.0210977,-1.7496017,-1.0250691,-1.4425315,-0.31541628,-0.023265995,-0.059444286,0.0109439315,0.27883554,0.19031176,-0.16854845,-0.020514654]],"activation":"σ"},{"dense_2_W":[[-0.024243228,-0.05255965,-0.7595463,-0.5176617,-0.0028400528,0.5175856,0.5519225],[-0.018462835,0.24686936,-0.51719195,-0.42296433,-0.2835181,-0.007122102,-0.1566434],[-0.8202002,-0.6762049,-0.21161737,0.6190111,0.8244078,-0.58753747,0.34383672],[0.7579045,0.30807158,-0.5150138,-0.39650717,-0.65510255,0.6530385,0.029368501],[0.19137707,0.47466335,-0.6506839,0.14364511,-0.9489478,0.21647897,-0.47036436],[-0.7764023,-0.48433128,-0.14451031,0.436359,0.86376953,0.06893752,-0.3654762],[-1.6003051,-1.3418225,0.8276233,0.10213565,-0.890929,-0.37858123,0.72083765],[0.28483543,0.26148677,-0.7699699,-0.5142481,0.13567218,0.5638172,0.44093132],[-0.79822946,0.13202399,-0.72469413,-0.28871945,-1.2221936,0.35103744,-0.97257113],[-0.43247938,-0.09032452,-0.71232784,-0.012452181,-0.36949623,0.040841173,0.21214984],[0.10710754,0.36228323,-0.47006533,-0.37733367,-1.2878665,0.47658426,-0.45390767],[0.24698155,0.2711014,0.075908944,-0.42958894,-0.23198445,-0.2069848,-0.3533442],[0.6337969,0.35413942,-0.7264216,-0.47986504,-0.21905626,0.6985329,0.2576043]],"activation":"σ","dense_2_b":[[-0.12635571],[-0.14632428],[0.038847096],[-0.07666457],[-0.1459678],[0.14029463],[-0.169782],[-0.23029572],[-0.10404744],[-0.142377],[-0.08718043],[-0.06485942],[-0.14547676]]},{"dense_3_W":[[-0.15735611,0.17262073,-0.8805252,0.51910555,0.2501827,-0.2835049,-0.11046073,-0.15481108,0.6115458,0.2226787,-0.03818101,0.042739924,0.53314],[-0.5296838,0.2718061,0.544608,-0.2170193,-0.30278963,0.3500211,0.77196777,-0.58984184,-0.3200903,0.25097454,-0.4622797,-0.41570127,0.052868128],[-0.103185855,0.026371501,0.77141577,-0.66143405,0.17981799,0.3885078,0.7312039,0.48614725,0.2583454,0.014793015,-0.5174716,-0.26699665,-0.017405592]],"activation":"identity","dense_3_b":[[-0.09996536],[0.10106084],[0.0681742]]},{"dense_4_W":[[1.3119884,-0.8955275,-0.28397295]],"dense_4_b":[[-0.096690625]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/KIA_NIRO_HEV_2ND_GEN.json b/selfdrive/car/torque_data/lat_models/KIA_NIRO_HEV_2ND_GEN.json
new file mode 100644
index 000000000..c01244be2
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/KIA_NIRO_HEV_2ND_GEN.json
@@ -0,0 +1 @@
+{"input_std":[[9.548942],[1.1556146],[0.5686091],[0.04125714],[1.1739614],[1.1698171],[1.1636059],[1.1330084],[1.1195551],[1.0984498],[1.052436],[0.041275118],[0.041270234],[0.041261356],[0.041291114],[0.041279677],[0.041211747],[0.04119539]],"model_test_loss":0.021393293514847755,"input_size":18,"current_date_and_time":"2023-09-02_07-27-02","input_mean":[[19.183447],[-0.061503228],[0.31750193],[-0.009586182],[-0.07582464],[-0.07115664],[-0.066330835],[-0.050047584],[-0.04131674],[-0.034985147],[-0.023530383],[-0.00953319],[-0.0095485365],[-0.00957056],[-0.009637397],[-0.009661676],[-0.009702404],[-0.009817304]],"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.11971723],[-2.06865],[-0.9273426],[0.2350055],[-0.039275352],[-0.6935257],[2.1106303]],"dense_1_W":[[-0.023465969,1.0403687,-0.0064599384,0.088695236,-2.572482,-1.9478124,-1.171903,3.2940629,2.2462277,0.7168309,-1.1020683,0.20056015,0.27593887,-0.26641613,-0.14360692,-0.7400961,0.00034045885,0.4156913],[-0.93346083,-1.4239619,-0.006503616,-0.22113818,-0.2023531,0.5193814,1.0461832,-0.3782537,0.29444095,-0.15030141,-0.5023597,0.16464102,0.7242057,-0.27950695,-0.3696878,-0.30749488,-0.47764552,0.76080126],[0.7568762,-0.981843,0.016051132,0.19062184,-0.90861064,-0.7826231,-0.2727878,-0.23859741,0.5777361,0.8479089,1.3446846,-0.44860214,0.23954475,-0.01972305,0.022940347,0.21341267,-0.041809097,-0.08129695],[-0.09766348,-0.6063554,0.0062130643,-0.03661122,-1.70968,-1.8175805,-2.0428705,1.8160136,1.7936941,1.4172349,0.45122316,0.4655184,-0.21158199,0.27250418,-0.25827283,-0.39359215,-0.2081721,0.463419],[0.008593872,-0.58326274,0.007718574,0.30187526,-0.93341124,-0.077753805,0.021100318,0.051944837,0.48332676,0.46354106,-0.6830866,-0.4099744,-0.23816824,0.20651065,0.4611754,0.027589535,0.42457825,-0.38316107],[0.47711346,1.1507468,-0.012431412,0.080158405,1.1602942,0.88804525,0.068638526,-0.049588755,-0.9131459,-0.90958065,-1.0101755,0.19905831,-0.12530342,-0.19841798,-0.21211796,0.1636958,0.23769926,-0.20800415],[0.9961328,-1.143366,-0.007048344,-0.38564992,-0.14137669,0.97105956,0.28828618,-0.38741222,0.11933695,0.042133637,-0.5720996,0.8045794,-0.14538643,-0.06855614,-0.025645649,-0.65618575,-0.23211053,0.7001129]],"activation":"σ"},{"dense_2_W":[[-0.21309559,-0.2557323,-0.37976655,0.4364266,-0.058041357,-0.10421585,-0.108383834],[-0.7912269,0.5097253,0.20453687,-0.53811145,0.99982816,-0.61565036,0.4312177],[-0.21263213,0.48694882,0.18081997,-0.8577293,0.73699605,0.030947331,0.18210255],[-0.58780706,0.68300354,0.09398714,-0.5269206,0.73805976,-0.80878305,0.48335037],[-0.64852566,-0.39090246,0.58450216,-0.46928614,-0.50298375,-0.07994645,0.053112958],[0.1690405,0.5960562,0.35752842,-0.87621987,0.32022333,-0.55614614,0.7826676],[0.71447146,-1.0444664,-0.4509489,0.911557,-0.7412179,0.54971963,-0.7381729],[-0.62482494,0.039678216,0.56063163,-0.3121521,0.15650049,-0.09051405,0.09062955],[0.0126393195,-0.06729555,0.37268206,-0.9645424,0.835795,-0.8074821,0.59585595],[-0.048607614,-0.53631896,-0.19049186,0.7581371,-0.61508256,0.115542084,-0.5422532],[-0.08638583,0.37238285,0.4352934,-0.9093409,0.3891405,-0.3895383,0.22890623],[0.6520517,-0.27878258,0.0021966984,-0.23270349,-0.9914703,0.48241284,-0.16072732],[-0.29694274,-0.17202643,-0.45471925,-0.048209682,0.030067155,-0.20176966,-0.34706435]],"activation":"σ","dense_2_b":[[0.040295675],[-0.14250198],[-0.28739277],[-0.18335883],[-0.12844329],[-0.23011152],[0.2616699],[-0.1555895],[-0.27772397],[-0.0050205495],[-0.17576194],[0.06814319],[-0.17360274]]},{"dense_3_W":[[0.096177064,-0.17084734,-0.35130522,-0.51758367,0.15829244,-0.57115465,0.74830765,-0.119700745,-0.28673345,-0.016819801,-0.21919145,0.6545112,-0.14663658],[0.49742782,0.74625164,-0.2345321,-0.48559803,0.1774502,0.3355754,-0.7141915,-0.16827786,0.5395194,-0.7827569,-0.40440023,-0.6389728,-0.24930853],[-0.66462135,0.3956486,-0.40556067,-0.3123342,0.21790422,0.5589044,0.38879392,0.26195037,-0.36978155,-0.21154313,0.3580779,-0.06915874,-0.32115373]],"activation":"identity","dense_3_b":[[0.09647246],[-0.073265985],[-0.08355868]]},{"dense_4_W":[[1.1780397,-0.3744698,-0.1993529]],"dense_4_b":[[0.091160975]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/KIA_OPTIMA_G4_FL.json b/selfdrive/car/torque_data/lat_models/KIA_OPTIMA_G4_FL.json
new file mode 100644
index 000000000..a50b54aea
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/KIA_OPTIMA_G4_FL.json
@@ -0,0 +1 @@
+{"input_std":[[8.072969],[1.0171603],[0.41435865],[0.03957447],[1.0044475],[1.008584],[1.0119401],[1.0073107],[0.9948095],[0.9757278],[0.95639443],[0.039412063],[0.03944304],[0.039477617],[0.03948857],[0.03934316],[0.03904568],[0.03871683]],"model_test_loss":0.00399219011887908,"input_size":18,"current_date_and_time":"2023-08-08_15-43-41","input_mean":[[24.085066],[-0.030361513],[0.01571064],[0.0007362445],[-0.03486706],[-0.033671357],[-0.032109205],[-0.027380893],[-0.02287623],[-0.021235751],[-0.01674745],[0.0006118474],[0.0006441443],[0.000670867],[0.00071249413],[0.0006996055],[0.0005505158],[0.00045551005]],"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.29917517],[2.1752317],[0.32517457],[-0.06200813],[0.008188257],[1.2145834],[-2.4042017]],"dense_1_W":[[-0.0036490457,-0.65203166,-3.709906,-0.16634864,1.2238234,0.1361604,0.240366,-0.0953384,-1.1778214,-0.7621931,0.9326918,-1.3709967,-0.15128233,0.2677267,0.46784538,0.9360938,0.58685464,-0.60191363],[1.0609311,0.5510001,-1.2266392,0.5077542,-0.5202491,-0.04500755,0.09848119,-0.3979558,-0.19270724,-0.5866649,0.46674842,-0.5607535,0.21799003,0.25507393,-0.1446887,-0.3699364,-0.26326817,0.43315932],[0.039737374,-0.43775582,-0.013289291,-0.05986628,0.21640529,-0.7568447,0.5309831,0.2114327,0.11197306,-0.40092763,0.14490385,-0.1755713,-0.15272588,0.46322745,-0.10017493,-0.06966308,0.32474706,-0.19110319],[-0.0077359895,-0.43185976,0.020387627,0.3265592,0.16767904,-0.9530752,0.1524309,0.20602113,0.034762584,0.45183882,-0.40128747,-0.9679819,0.09233684,0.69716626,0.0959531,0.20735793,-0.10194677,-0.14030074],[0.005168357,-0.21313071,0.020432683,0.21680814,0.47587946,-0.1672917,-0.123546526,-0.28546202,-0.004813474,-0.2626441,0.2583704,-0.83474374,-0.3071537,0.70293534,0.035514556,0.2111255,-0.03847577,0.2905034],[0.039810598,0.41122228,0.0123043675,0.21473739,-0.08381318,0.053156123,-0.22393204,-0.07659595,0.2492394,0.084608234,-0.1508309,0.27756575,0.06493508,-0.6980999,-0.10522976,0.33079267,-0.021852562,-0.09157679],[-1.0318242,0.3270962,-1.2316992,0.074966654,-0.18502301,-0.540268,0.3426544,-0.32328182,-0.15373465,-0.5543649,0.4255326,-0.54132384,0.019477716,0.59251136,-0.14564046,0.17376666,-0.41093257,0.3159194]],"activation":"σ"},{"dense_2_W":[[-0.4484687,0.33253923,-0.28966695,-0.4360591,-0.24771251,1.0544692,-0.3488148],[-0.29909408,-0.58351547,-0.3938109,-0.11950906,-0.29386395,0.45222434,-0.031188905],[-0.97125804,-0.47300208,-0.5902675,0.09844755,-0.16599008,-0.14055668,0.33186546],[0.81737274,0.7941663,0.38187075,0.057302717,-0.24998307,-0.4406886,-0.15471426],[-0.22012134,-0.4555382,-1.0191162,-0.7460106,0.0017525634,0.37398848,0.55178577],[0.6003996,-0.07378992,-0.4675678,-1.0309192,-0.51752794,0.7784243,-0.13258673],[0.22552104,-0.42843226,0.6672592,0.5094388,-0.0069568693,-0.588892,0.22089334],[-0.040460102,-0.20706566,-0.4015441,-0.049420606,-0.47037354,0.62529606,-0.3584826],[-0.15761071,-0.6566617,0.13922708,0.6777953,0.6173028,-0.5567125,0.55445105],[0.421519,0.0040071155,0.4716913,-0.402618,0.37349927,-0.79084456,0.7557055],[0.18809932,0.48851332,0.20340067,0.53080684,0.07949558,-0.32842007,-0.15802757],[0.29606518,-0.42963374,0.061094977,-0.6543071,0.17196162,0.013567186,-0.72136617],[0.27312186,0.011079551,-0.9998639,-0.99941546,-0.35501084,-0.013600225,0.5464308]],"activation":"σ","dense_2_b":[[0.13286552],[0.08703823],[-0.031739317],[-0.052825537],[0.031032594],[0.013313505],[-0.030027948],[0.14758036],[-0.17001471],[-0.3692113],[-0.033355612],[-0.051361687],[-0.11612391]]},{"dense_3_W":[[0.08565427,0.037936352,0.31202748,0.0936324,-0.3239269,0.21602823,-0.13447368,-0.25992858,0.57573473,0.22251351,0.5654894,-0.5865121,0.19499925],[-0.31933227,-0.5680997,-0.40374595,0.2146467,-0.23784715,-0.53895664,0.7452532,-0.5017336,0.32644337,0.19702537,0.4468465,-0.10311684,-0.27303612],[0.51040643,-0.20984694,-0.19069631,-0.41539454,0.4963756,0.2997042,0.44628504,0.45647708,0.13536462,-0.67746484,-0.40592772,-0.2442403,-0.14450295]],"activation":"identity","dense_3_b":[[-0.056019142],[0.060379148],[-0.009930268]]},{"dense_4_W":[[-0.04487324,-1.0755644,0.06984845]],"dense_4_b":[[-0.055896856]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/KIA_SELTOS.json b/selfdrive/car/torque_data/lat_models/KIA_SELTOS.json
new file mode 100644
index 000000000..f68b17ada
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/KIA_SELTOS.json
@@ -0,0 +1 @@
+{"input_std":[[6.5043],[1.2473463],[0.53390634],[0.048283435],[1.2437444],[1.2446332],[1.2450808],[1.2284776],[1.2033198],[1.1706628],[1.1364652],[0.048133977],[0.048158456],[0.048181333],[0.048161115],[0.047940608],[0.047484715],[0.046831056]],"model_test_loss":0.00607825955376029,"input_size":18,"current_date_and_time":"2023-08-08_16-08-39","input_mean":[[22.575022],[0.051328536],[-0.006913471],[-0.01011988],[0.05268152],[0.05299266],[0.05207647],[0.048002362],[0.043245066],[0.03809434],[0.035212684],[-0.010153537],[-0.010121024],[-0.01008983],[-0.010034731],[-0.010037355],[-0.010153356],[-0.010373143]],"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.5531221],[-0.5509416],[-1.445181],[0.28771853],[0.22789262],[1.434991],[0.0080130715]],"dense_1_W":[[-0.072858766,-0.25066936,0.001488759,0.17555322,0.07657381,-0.9037761,0.3106683,0.08651254,0.067195155,0.15176873,-0.20259917,-0.21302752,0.28982407,-0.43658245,0.015916249,0.11262799,0.11793564,-0.059966978],[0.43427393,0.08093749,0.0133838765,0.1622592,0.09717405,-0.83871514,0.5765018,-0.31165177,-0.15231861,-0.16858198,0.16277543,-0.60361624,0.17700994,0.33473372,0.38939148,-0.20558326,0.45074964,-0.25900662],[-0.74159485,0.30163378,0.22673568,0.14877096,-0.47694537,0.4062525,-0.13229688,0.1764854,-0.156683,-0.07724261,0.12065852,-0.07211137,-0.008046468,0.105538025,0.03403057,-0.40424374,0.101804785,0.09886794],[0.056292683,-0.44537598,0.0066523813,-0.36948034,0.0020229202,-0.23440255,-0.1426723,0.044855885,0.21266802,-0.04769602,-0.07245297,0.095258914,0.14331557,0.06311263,-0.081638,-0.13354753,-0.10685418,0.2744694],[-0.4399394,-0.24742912,0.015261683,0.036726598,0.21024184,-0.56052953,0.2644335,0.22065622,-0.49486712,-0.22668484,0.26602116,-0.027812555,-0.26319936,0.4370143,0.30383864,0.05929112,-0.278868,0.19924623],[0.7735669,0.71460426,0.22413033,-0.16059706,-0.6686849,0.07259404,0.16731831,-0.019293515,-0.071510345,-0.132955,0.10057606,0.3232639,0.11988385,-0.38480517,-0.09152796,0.0526992,0.22566798,-0.07503419],[-0.013013475,0.9049779,4.2753534,-0.7142396,-0.40504238,-0.4914329,-0.67501336,0.25923017,1.06321,0.6865681,-0.7837867,0.6691853,-0.14117423,-0.25011092,0.2118381,-0.4131931,0.0050245565,0.23714177]],"activation":"σ"},{"dense_2_W":[[0.83081543,0.7152437,-0.9272331,-0.058508083,0.5601877,-1.0513786,0.34386688],[-0.40297586,-0.20603098,-0.02151336,0.27510563,-0.72458434,-0.33728045,-0.39708093],[-1.0368242,-0.39495397,-0.43345797,-0.44247583,-0.31836608,0.47316584,-0.5714821],[-0.57493865,0.08437657,-0.13061555,-0.76476145,0.03340725,-0.026223348,-0.12614326],[-0.55024046,-0.6168174,-0.028391553,-0.18474647,-0.26115215,0.12521398,0.35426983],[0.39255112,0.5900703,-0.22482665,0.5707256,0.5464044,-0.71590644,-0.002837547],[0.25933468,0.5432395,-0.25603205,-0.023391314,0.17869925,-0.030074507,0.05608481],[-0.40570793,-0.8749095,0.7643032,-0.95808434,-0.292604,-0.31031305,0.5525302],[-0.7991779,-0.5244842,0.7676792,-0.2169589,-0.35757715,0.3793689,-0.18556851],[0.27159563,0.47496906,-0.8455038,0.3217735,0.56621623,-0.37803704,-0.3152324],[0.34084067,0.4475718,-0.45190004,0.6034602,0.19615944,-0.74282926,-0.3698053],[-0.12877308,-0.040314443,-0.07347546,-0.022651967,-0.35362196,-0.25663686,-0.03716333],[-0.12629175,0.18490966,0.3493096,-0.12202217,-0.87659836,0.84210044,0.7154535]],"activation":"σ","dense_2_b":[[-0.37709257],[-0.36266398],[0.041201413],[-0.2759538],[-0.045757968],[-0.32502013],[-0.116910934],[-0.0555258],[0.13395292],[-0.11479294],[-0.12865],[0.0017155915],[0.03419236]]},{"dense_3_W":[[-0.21281184,0.025354605,-0.38931814,0.4332946,0.34886065,-0.5425068,-0.45385525,0.5249028,0.8241498,-0.0018914028,-0.71546686,0.37642565,0.6025195],[-0.10640655,-0.15879385,0.8035984,-0.0676657,-0.45838603,-0.16732062,-0.10961278,0.47199112,0.05652834,-0.273728,-0.5767416,-0.26667383,0.25352108],[0.2845616,-0.20691596,-0.0674403,0.26220548,-0.5230078,-0.013668718,0.14580722,0.21254358,-0.455578,0.6447261,0.39926735,-0.578386,-0.07932991]],"activation":"identity","dense_3_b":[[0.046802334],[0.06993807],[-0.054334518]]},{"dense_4_W":[[0.86223423,0.7466944,-0.5962639]],"dense_4_b":[[0.05574729]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/KIA_SORENTO.json b/selfdrive/car/torque_data/lat_models/KIA_SORENTO.json
new file mode 100644
index 000000000..7cba3a0bd
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/KIA_SORENTO.json
@@ -0,0 +1 @@
+{"input_std":[[8.225504],[0.9862146],[0.4786618],[0.044386055],[0.9911494],[0.98926777],[0.9868219],[0.9688941],[0.95759606],[0.945508],[0.93368983],[0.04445444],[0.044414494],[0.044370808],[0.044087693],[0.04393713],[0.04383826],[0.04361526]],"model_test_loss":0.007047169841825962,"input_size":18,"current_date_and_time":"2023-08-08_17-49-22","input_mean":[[22.136208],[0.070861906],[-0.03981052],[-0.010668343],[0.080718815],[0.07792175],[0.07505944],[0.058528677],[0.045737457],[0.03174954],[0.021063231],[-0.010688668],[-0.010692572],[-0.010689235],[-0.010696851],[-0.01084794],[-0.0111111775],[-0.011500895]],"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":[[3.4361866],[0.8604132],[3.8839195],[-0.3530098],[-0.60368276],[0.18975182],[-0.14933607]],"dense_1_W":[[1.77373,0.502524,0.0018965496,-0.110705666,0.3420213,0.22547789,-0.29762477,0.0047542676,0.14169078,0.4244286,-0.26493979,0.77021676,0.0050104316,-0.45031142,-0.0891641,-0.3238069,-0.27745253,0.43920958],[-0.4554037,0.55976075,0.0024382551,-0.52546054,-0.35694334,0.31670326,-0.42664233,0.5528438,-0.02553557,-0.25557682,0.018628456,0.5487123,0.07868527,-0.44713297,0.2761562,0.01487938,-0.19466569,0.13075072],[1.9630107,-0.8828655,-0.003229503,0.096722186,0.11981852,-0.59655976,0.20542483,-0.09582429,-0.035594583,-0.0051746666,-0.00012015179,-0.31307888,-0.4298206,0.48810238,-0.19152062,0.65658826,0.10284727,-0.3608829],[0.0509072,-0.08480384,2.396337,0.02690105,-0.36376664,0.108113885,-0.308852,0.44377556,0.45792276,0.30328622,1.0544075,0.88695085,0.12360692,-0.119185396,-0.18221413,-0.5859372,-0.31101158,0.7223309],[0.28265178,0.32164347,0.0010089057,0.030570894,-0.30268112,0.8745566,-0.7895676,-0.08777498,0.4583039,0.3052894,-0.36076066,0.817972,-0.2626141,-0.4675079,-0.3099327,0.0030562575,-0.1641152,0.23820297],[0.019067027,-0.14309163,-1.8227177,0.047291636,0.32350194,0.20237854,1.0319531,0.03287445,-0.7612191,-0.9520363,-0.2104849,0.18699706,-0.27343786,0.21203913,0.1552981,-0.075778924,0.033884183,0.004781352],[0.10389948,-0.48800257,0.0021118661,-0.07135153,0.009598374,-0.5138354,0.51288474,-0.36974624,0.07902618,0.0439172,-0.019653676,-0.36099622,-0.046752088,0.59683883,-0.17708305,0.32293355,-0.07517723,-0.042607766]],"activation":"σ"},{"dense_2_W":[[0.096298866,-0.023356602,0.24766381,-0.68317467,0.4726718,-0.31475353,-0.74931395],[-0.048710193,-0.088762455,-0.26215088,-0.68562347,-0.09474713,0.28614464,0.25585324],[0.088518575,-0.29647326,-0.5624382,-0.42151505,0.9982967,-0.40049326,-0.4974512],[0.36501676,-0.53366756,0.296159,0.35532963,-0.47745422,-0.34653178,0.71060693],[-1.2016175,-0.62754,-0.3136847,-0.11115397,-0.40962538,-0.6096405,0.84929377],[-3.0193913,-2.1009915,-0.42303616,-1.5302383,-0.37101474,1.7938634,1.6035624],[-0.5427815,0.09416961,0.18964134,-0.70530283,1.0021083,0.1920392,-0.037322704],[0.0019868647,-0.08528146,-0.067309916,0.12519653,-0.92892164,-0.20166376,0.95873517],[-0.7638899,0.35672405,-1.1621267,0.39103174,1.1349736,-0.65880626,-1.0431181],[-0.17016599,-0.42968458,-0.5383481,-0.1613195,0.84924465,0.09490495,-0.16490082],[-0.7958531,-1.0898287,-0.21342301,0.3154297,-0.662309,-0.11026381,0.43740568],[-0.21438372,-0.023171034,-2.4562607,1.4170244,1.4787751,-1.4303266,-1.7063339],[-0.8461705,-0.8368954,-0.6641428,0.07786552,-0.85198885,0.16422716,0.5509807]],"activation":"σ","dense_2_b":[[-0.04843994],[-0.11621983],[-0.15534192],[-0.1777891],[-0.13141605],[0.45782998],[-0.038693666],[0.120798975],[-0.2962059],[-0.112060666],[-0.19976714],[-0.08506511],[-0.19297417]]},{"dense_3_W":[[0.06841162,-0.38602033,-0.44655094,-0.095605254,0.09524266,1.5977386,0.055025216,0.92095596,-1.0016881,0.001653223,0.22546917,-1.4391123,0.5747701],[-0.112245455,0.27487016,0.09106065,-0.5642001,-0.3326845,-1.0173982,0.6527395,0.1291596,0.18963833,0.07579223,0.08202421,0.39516202,-0.5810091],[0.62696713,-0.4055594,0.3906188,-0.22678788,-0.6915645,-0.62307024,0.27116132,-0.23976414,0.59970427,0.59344476,-0.5686633,1.0074819,-0.6300193]],"activation":"identity","dense_3_b":[[-0.015245617],[0.021583866],[0.0017865004]]},{"dense_4_W":[[-0.4391859,0.34876132,0.45405573]],"dense_4_b":[[0.011228666]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/KIA_SORENTO_4TH_GEN.json b/selfdrive/car/torque_data/lat_models/KIA_SORENTO_4TH_GEN.json
new file mode 100644
index 000000000..36c28370c
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/KIA_SORENTO_4TH_GEN.json
@@ -0,0 +1 @@
+{"input_std":[[7.8233147],[0.9782015],[0.41718537],[0.035352696],[0.9691626],[0.9718523],[0.9732458],[0.9550015],[0.93631965],[0.9095138],[0.88053274],[0.035256404],[0.03528126],[0.03530267],[0.03523645],[0.03513863],[0.035011794],[0.03486604]],"model_test_loss":0.012016833759844303,"input_size":18,"current_date_and_time":"2023-08-08_16-59-47","input_mean":[[23.676199],[0.046169933],[-0.0024152591],[-0.00083978643],[0.052181892],[0.050630625],[0.049394105],[0.04861944],[0.04347715],[0.037709467],[0.029363334],[-0.00079315034],[-0.00083242205],[-0.00086724694],[-0.00093634427],[-0.0010770531],[-0.0011623197],[-0.0013536707]],"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.34205592],[-0.6101867],[0.025273371],[2.7362225],[-0.3362331],[-0.22314112],[-0.42840534]],"dense_1_W":[[0.70273304,-0.07699354,0.004216056,-0.049642496,-0.1173342,-0.1843091,-0.514,0.301412,0.120716415,0.14159362,-0.26860958,0.22482587,-0.22099495,0.25595915,0.07369682,-0.30280155,-0.022244852,0.19049275],[-0.31632742,0.40738678,-0.0030173576,-0.14833613,-0.5414197,0.9335088,-0.3921892,0.074954435,-0.09115997,0.2769111,-0.164147,0.14919339,-0.16596842,0.19945244,-0.38358882,0.23962471,0.037440404,-0.055190288],[0.28026038,0.53400266,0.0009745513,0.14234091,-0.017792422,0.35154557,-0.54393846,-0.041059464,0.23289026,0.2371453,-0.22173151,0.32878917,-0.34945992,-0.17935802,-0.030065529,0.05598791,-0.16419156,0.06693432],[1.0627971,-0.69044113,-2.8159893,-0.11743469,0.06090651,-0.3309259,0.61224234,0.15625772,-0.35828912,-0.20305863,0.19095968,-0.38171795,0.088828474,0.45887148,-0.2708491,0.1556519,-0.33625215,0.20122494],[0.46239635,0.53465575,2.211843,0.16536956,0.27959237,0.03331173,-0.73842824,0.19596708,-0.17479798,0.15080513,-0.030420419,-0.2798054,0.38705692,-0.3063825,0.33478513,0.013453584,-0.30902138,0.09854831],[-0.07509558,0.06009354,0.0014442373,-0.37906444,-0.18389311,0.9123579,-0.23291315,-0.098106,0.17996079,-0.38929048,0.2669226,0.37405357,0.0829103,-0.12002334,-0.082380034,-0.19149263,0.17356545,0.021014312],[0.83645344,-0.12868191,2.8339524,0.66849464,0.2345121,-0.25139904,0.62862474,-0.14285043,-0.101333186,0.18938905,0.027926499,-0.30594265,-0.25533596,0.050244536,-0.12834157,0.20466578,0.14557889,-0.25508425]],"activation":"σ"},{"dense_2_W":[[0.2385943,-1.2497817,-0.4320098,-0.69494075,-0.15682808,-0.7165265,0.33271864],[-0.5953695,-0.94797826,-0.75910956,0.15720847,0.16028434,-0.42265445,-0.06788467],[0.013007017,-0.65603364,-0.54143244,-0.18851374,-0.48472962,-0.567826,-0.21415836],[-0.12800428,0.6126203,0.48534265,-0.0439459,0.3090983,0.6686178,0.06581577],[0.086700656,-0.7233699,-0.8339351,0.57965523,-0.0795262,-0.60835373,0.6064965],[-0.16711766,-0.5194217,-0.3638064,0.0828189,-0.19742145,-0.74326986,0.32982042],[-0.60902363,-0.54570323,-0.9682073,-0.22863796,-1.0575902,-0.7974728,0.09679575],[0.65101296,0.2940795,0.91902715,-0.3448089,0.7953689,-0.01467941,0.49614373],[-1.0385482,-0.7393712,-1.3759025,0.18227631,-1.3805835,-0.31249633,-0.33556783],[0.34581456,-0.657716,-0.2713684,0.86821914,-0.16907854,-1.0973026,0.6021319],[0.06327717,-0.08374516,0.2938722,-0.21229501,-0.08540833,0.84707147,0.17620224],[-0.3019964,0.7991158,0.15228769,-0.2151937,-0.01442734,0.6086916,-0.46539715],[-0.17123166,-1.3208861,-0.53291464,-0.768727,-0.22558156,-1.1115304,0.9095279]],"activation":"σ","dense_2_b":[[0.025361877],[0.115043625],[-0.19263957],[-0.15302731],[0.16757403],[-0.13207324],[0.2047931],[-0.023633512],[0.12663384],[0.21831232],[-0.10527339],[-0.07977336],[0.16238554]]},{"dense_3_W":[[-0.6029877,-0.001360625,-0.64843386,-0.024384713,-0.31931442,-0.2223872,-0.41601577,0.40875682,-0.6390585,-0.18351403,-0.22626987,-0.16342458,-0.5330356],[-0.9919812,-0.3600715,-0.23596478,0.014639649,0.05383371,-0.0056866687,-1.0682598,0.45604205,-0.13326848,-0.33690926,0.050030075,-0.28139764,-0.4887333],[-0.035192277,0.53870684,-0.28763992,-0.64913034,0.61716443,0.020962728,0.5046917,-0.6201238,0.081873566,0.4083527,-0.44538507,-0.638268,0.28089696]],"activation":"identity","dense_3_b":[[0.05839103],[-0.06695255],[-0.039935347]]},{"dense_4_W":[[1.2304412,0.24217309,-1.3306029]],"dense_4_b":[[0.0467045]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/KIA_SORENTO_HEV_4TH_GEN.json b/selfdrive/car/torque_data/lat_models/KIA_SORENTO_HEV_4TH_GEN.json
new file mode 100644
index 000000000..b3e5f0e36
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/KIA_SORENTO_HEV_4TH_GEN.json
@@ -0,0 +1 @@
+{"input_std":[[6.3644342],[0.84206194],[0.32837495],[0.0497152],[0.8371395],[0.8385447],[0.8395692],[0.829151],[0.8190757],[0.80348146],[0.7860103],[0.049369164],[0.04941689],[0.049452867],[0.0493644],[0.049244285],[0.04892234],[0.048490353]],"model_test_loss":0.012282345443964005,"input_size":18,"current_date_and_time":"2023-08-08_18-13-59","input_mean":[[18.745186],[0.058482915],[0.004100846],[-0.0101344995],[0.059071593],[0.060052983],[0.0608945],[0.058870878],[0.05506747],[0.051870324],[0.050613668],[-0.0101755485],[-0.010125563],[-0.010075055],[-0.010220342],[-0.010350309],[-0.01046635],[-0.010587991]],"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.26137024],[-0.8474335],[0.7221059],[-3.029152],[-3.0476334],[-0.50681853],[0.28089675]],"dense_1_W":[[0.118606314,0.25686783,-1.9051447,-0.7990428,-0.005979468,0.09638535,-0.8308289,0.51833004,-0.06402269,0.6971393,-0.6183026,0.6924021,0.12464697,0.043432377,-0.4148101,0.15270382,0.060744658,0.13626556],[-0.16419527,0.39643514,2.5732567,0.008115614,-0.28033996,0.43020484,-0.5210173,0.17210113,0.04305193,-0.15485092,-0.06430828,0.5110761,0.061184343,-0.39538494,-0.33624035,0.22553732,-0.36463583,0.28871256],[0.08022375,-0.1438102,2.275842,-0.34128058,-0.044324376,0.096882254,-0.010320051,0.23874547,-0.18070365,-0.08163477,-0.005464015,0.42233032,0.017914683,0.047668677,-0.22110505,-0.13801146,0.21807624,0.043199193],[-1.0983561,-1.3618904,-0.16421425,0.7119955,0.31953186,-0.022093425,-0.31532484,-0.20155048,-0.2332474,-0.5418476,0.23563766,-0.055656385,-0.3085361,0.27007875,0.12838498,-0.18988839,0.06709897,-0.1783812],[-1.1701652,1.2933975,0.1829548,-0.56762326,-0.21117829,0.32533327,-0.16175397,0.4003565,0.3450981,0.5221387,-0.26247823,-0.18100262,0.19747707,-0.020127997,-0.08322595,-0.06828175,0.17032392,0.079796456],[0.55186826,0.5894228,-0.0018529932,-0.14105065,-0.08741265,0.9153969,-0.5369019,-0.110670924,-0.1197868,-0.17400903,0.24264471,0.5258655,0.41813594,-0.97932565,-0.030922398,0.023046646,-0.2965142,0.17293993],[-0.53106797,0.6812101,0.003069036,0.013521579,-0.22647035,0.62607247,-0.21172582,-0.28151682,0.13779911,-0.18788983,0.14300823,0.5570215,-0.360614,-0.39254332,0.087255284,-0.17113407,0.00049219653,-0.022655595]],"activation":"σ"},{"dense_2_W":[[-0.5570222,-0.3558432,0.43228203,-0.69578755,-0.5209684,-0.3988039,-0.50713974],[-0.44423953,-0.5874194,-0.7323912,0.7715879,-0.41121703,-0.1318218,0.18571433],[-0.6390287,-1.387356,-0.36371973,0.9566006,0.119820826,-0.493032,0.24996151],[-0.18583159,0.6930251,0.17657615,-0.539559,0.16666687,-0.021469139,0.16992941],[-0.40057775,-0.42924806,0.31558606,-0.0009943814,-0.6159993,-0.6273195,-0.25029367],[-0.13757096,0.5006542,-0.21990159,-0.19693488,-0.39372584,-0.53963596,-1.0108879],[0.4223514,0.07548385,-0.010612892,-0.42543212,0.35533974,-0.11486922,0.89943194],[-0.16426279,0.6486941,-0.036648616,0.31983182,0.5339297,-0.086293764,-0.25488037],[0.3003831,0.17355344,0.20259908,0.3913868,-0.13287883,0.49564433,0.6325901],[-0.48450124,-0.122303,0.04608689,1.1349032,-0.7158418,-0.69535565,-0.4309579],[-0.017942823,-1.1588961,-1.7683665,0.11541567,0.7244163,-1.6989279,0.45806262],[-0.47665825,-0.6297304,0.14930177,0.03149848,-0.07129674,-0.594798,-0.27915043],[-0.69228166,0.49151105,0.71214664,-1.0289556,-0.55659735,-0.2014265,-1.69863]],"activation":"σ","dense_2_b":[[-0.24992906],[0.05137416],[-0.04471787],[-0.0656874],[0.03518997],[0.03586051],[-0.08755667],[-0.07071635],[-0.09519462],[0.38123006],[-0.14761746],[0.018471785],[-0.25193718]]},{"dense_3_W":[[0.17286126,0.5556709,0.46810713,0.4721513,-0.47047356,0.520569,-0.49622187,-0.49121454,-0.45540947,0.66542894,0.69841886,0.3982122,-0.25671947],[-0.22673589,-0.5611173,-0.089621924,0.1419429,-0.6225278,-0.1980974,0.45448488,-0.22727543,0.51839507,-0.101876915,-0.25131065,-0.25810936,-0.088802256],[0.07408502,-0.50601435,-0.07129802,0.68250656,-0.27145752,-0.33781096,0.42821127,0.10353291,0.29823735,-0.20758152,-0.16469304,-0.33839104,-0.72373396]],"activation":"identity","dense_3_b":[[-0.05540624],[0.050332494],[0.045503195]]},{"dense_4_W":[[-0.74805945,0.97596985,1.0388287]],"dense_4_b":[[0.04738765]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/KIA_SPORTAGE_5TH_GEN.json b/selfdrive/car/torque_data/lat_models/KIA_SPORTAGE_5TH_GEN.json
new file mode 100644
index 000000000..e51a7bfd6
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/KIA_SPORTAGE_5TH_GEN.json
@@ -0,0 +1 @@
+{"input_std":[[8.976727],[0.70075977],[0.5193822],[0.03042774],[0.69921887],[0.70013744],[0.7002965],[0.695902],[0.6933414],[0.67973745],[0.6627475],[0.030151172],[0.030225797],[0.0303137],[0.030544141],[0.03062558],[0.030789947],[0.030969843]],"model_test_loss":0.006343930959701538,"input_size":18,"current_date_and_time":"2023-08-08_19-27-16","input_mean":[[16.929798],[-0.07719816],[0.018166475],[-0.021377886],[-0.079235695],[-0.07809248],[-0.07658997],[-0.068645015],[-0.06328592],[-0.05931081],[-0.05909752],[-0.021333551],[-0.021345824],[-0.021356996],[-0.021575557],[-0.021667903],[-0.021827627],[-0.02195472]],"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.014880665],[-4.0546803],[4.039964],[-0.11868123],[0.15448645],[-1.107983],[1.1866902]],"dense_1_W":[[0.0020459956,0.33396527,-0.12089764,-0.09266742,-0.10447256,-0.9204386,0.6287741,-0.6056384,0.22843099,-0.036838837,0.06830062,-0.39476836,-0.25123098,0.16312656,0.52959627,0.44755596,-0.0060909246,-0.37075716],[-2.4018881,0.96303153,-0.011795681,-0.2927611,-0.56402475,0.09905826,-1.2417923,0.6909417,0.04634957,0.049870215,0.14829403,-0.24467021,0.098947786,0.60680634,-0.11770359,0.12915674,-0.28863087,0.106796],[2.4256525,1.437447,-0.012711781,0.2002033,-0.7284638,0.066629946,-1.2394707,0.30315024,0.19728456,-0.0064161224,0.16385247,-0.46458936,0.14064942,0.5783398,-0.52734655,0.12342225,-0.02771602,-0.024491971],[0.01097608,-0.027902901,-0.034374587,-0.3541097,0.5106101,0.76122844,-0.096962415,-0.6580167,-0.2428814,0.03086143,0.42839304,-0.1327025,0.22802521,0.23564328,-0.29380637,0.4714742,-0.12637857,-0.02005889],[-0.034812696,0.41839755,3.2609296,-0.42740518,-0.15298292,-0.00866209,-0.9877955,0.20124017,0.70070297,0.17947885,-0.23164096,0.28965604,-0.7283435,-0.2188886,0.7684531,0.19517736,0.2536015,-0.36128113],[-0.9371955,-0.44021863,-0.56623465,-0.32142237,0.72665215,0.002760211,1.794923,-0.5086798,-0.3332023,-0.46023577,0.28646132,0.021077845,-0.085969545,0.12202227,-0.0113952635,0.3216046,0.09244552,-0.3860546],[0.96695864,-0.30241808,0.58513,0.17075059,-0.22292358,-0.8550528,0.2879175,-0.43512177,-0.31959462,0.48480448,0.25879675,0.27618545,0.025451204,-0.122112915,-0.17442971,-0.3921672,0.06478193,0.40238667]],"activation":"σ"},{"dense_2_W":[[-0.044206314,-0.8398137,-0.64021885,-0.54042494,0.6175049,0.18352465,0.32354066],[0.43910313,-1.1964579,0.21669604,-0.65690404,-0.1722438,0.7105811,0.9846193],[-0.7918547,0.18124402,0.9972935,0.41970012,0.19829191,0.010471378,-0.43702286],[0.08539568,0.5138893,0.012154299,0.39407086,-0.2033074,0.2336377,0.07864137],[-0.57327664,1.5145365,0.055437118,0.44190773,0.09702478,-1.1895245,-0.6311017],[-0.44423488,1.5355299,0.024235807,0.16098042,0.29021573,-0.8679073,-0.9571557],[0.004154781,1.1336601,0.8133591,-0.50107414,0.031159671,0.22605118,-0.14536653],[0.007528867,-0.56511986,-0.3612175,-0.24699865,-0.3588984,0.07682657,0.65754634],[-0.23885256,0.037369203,-1.247802,-0.6006928,-0.26584128,0.70783955,0.31224442],[-0.7690314,0.500182,0.9671801,-0.31481332,0.67578256,-0.68111664,0.31868243],[0.6401129,-0.09492038,-0.6698544,-0.36198345,-0.5426654,-0.2671815,0.6592098],[0.7210531,-1.0498211,-0.22714017,-0.048228458,-0.37272957,0.26260805,0.70966876],[0.63982356,-0.29841152,-0.8246119,-0.47527993,-0.18812291,0.8096702,-0.06459521]],"activation":"σ","dense_2_b":[[-0.025994662],[0.15322399],[-0.07625017],[-0.02093097],[-0.5037285],[-0.3910864],[-0.2550051],[0.010986569],[-0.03674515],[-0.06740837],[-0.02110642],[0.203657],[-0.006955387]]},{"dense_3_W":[[0.13050179,-0.1750691,0.55030495,0.00817725,0.0064171855,0.037391666,-0.34142336,-0.3982381,-0.6864987,0.44729853,0.019040912,0.2000447,0.05393903],[-0.18140526,-0.7954796,0.4079409,0.11663361,0.7815968,0.6944582,0.29977924,0.37544534,-0.17576152,0.39384714,-0.40072137,-0.36830547,-0.2356481],[0.5863231,0.31058028,-0.7853302,-0.23653558,-0.35724676,-0.24529241,-0.29981402,0.3657695,0.7097211,-0.48353392,0.66631585,0.39028704,0.82543695]],"activation":"identity","dense_3_b":[[0.05991354],[0.027705792],[-0.10160021]]},{"dense_4_W":[[0.21156265,0.3147255,-0.69529635]],"dense_4_b":[[0.09139054]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/KIA_STINGER.json b/selfdrive/car/torque_data/lat_models/KIA_STINGER.json
new file mode 100644
index 000000000..e902464df
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/KIA_STINGER.json
@@ -0,0 +1 @@
+{"input_std":[[8.232792],[0.93400556],[0.47102702],[0.0364885],[0.9195544],[0.924241],[0.92906463],[0.92022413],[0.91261363],[0.9017492],[0.88828105],[0.036282632],[0.036326736],[0.036377504],[0.036556747],[0.03661433],[0.036583815],[0.036482345]],"model_test_loss":0.004662908613681793,"input_size":18,"current_date_and_time":"2023-08-08_21-56-04","input_mean":[[24.3614],[-0.1338536],[-0.00033556155],[-0.011434872],[-0.13066752],[-0.13287227],[-0.13457236],[-0.13018748],[-0.12908219],[-0.1285007],[-0.1288561],[-0.011373002],[-0.011407338],[-0.011437276],[-0.011411569],[-0.011443319],[-0.011484706],[-0.011544373]],"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":[[4.475858],[2.159764],[-0.061220553],[0.66681635],[-0.12575488],[-0.16302125],[-0.19944711]],"dense_1_W":[[1.086152,-0.8324169,-0.40090436,-0.69676965,0.07591572,-0.76153654,0.14704636,0.01003906,0.042237986,-0.13237216,0.010166433,-0.022998422,0.20724043,0.38396737,0.32619816,0.24285975,0.040859465,-0.15704209],[0.79297894,0.6081378,0.23360905,0.3370354,0.22393392,0.4906143,-0.30672908,-0.17856854,-0.25943467,-0.062457237,0.2529202,-0.0010873047,0.21262763,-0.5751331,-0.1401793,0.19357836,-0.55147094,0.32092294],[0.0029746895,-0.07445199,-0.009906404,-0.27658758,-0.3105713,1.3074434,-0.62331855,0.37446457,0.37921852,-0.076034345,-0.10986473,0.6444909,0.3060177,-0.34074512,-0.20372215,-0.4336765,-0.12278754,0.10387535],[-0.5095448,-0.72657496,-1.8959101,0.0026990066,-0.043687414,0.6157908,-0.9232839,0.5408708,0.51549035,0.19628379,-0.40704572,0.5014059,0.29025885,-0.7103715,-0.25765055,-0.30216625,0.5263961,-0.10350972],[-0.035269834,-0.043332044,-0.012723803,0.13811198,0.29201096,1.0091876,-0.8771376,0.18579352,-0.04488109,-0.17704397,0.23413378,0.19482689,0.20975055,-0.30010784,-0.35608566,-0.11924245,-0.050680783,0.22465675],[0.16372576,1.0684661,2.3885384,-0.4287634,0.70907384,0.0041387198,-1.4072537,-0.46730998,0.49696034,0.29660532,-0.27237156,0.50066346,0.015487968,-0.20723666,0.18176752,-0.10723471,-0.29568553,0.32300335],[-0.13845481,-0.49266118,-0.1540314,-0.26245895,0.5343135,-1.4516279,1.0021015,-0.034394637,-0.15333414,-0.23182547,0.20259102,-0.662138,0.034917697,1.1150106,0.17494841,-0.38734046,0.042199794,0.047024578]],"activation":"σ"},{"dense_2_W":[[0.16896504,-0.6318725,-0.24279357,-0.3490866,-0.46762058,-0.77701944,0.4309984],[0.3208485,-0.7041557,-0.71111524,-0.5957026,-0.13623692,-0.6515591,0.086047836],[-0.2776602,0.4528481,-0.17088494,-0.017503724,-0.32922515,0.08896287,0.44616765],[-0.5082411,-0.3947844,-0.3123438,-0.057989564,-0.27827948,-0.18070908,-0.18309323],[0.2809697,-0.37338483,0.65222776,-0.2953018,0.56409293,0.37588066,-0.1554319],[-0.56023234,-0.31079367,-0.08408593,0.20908839,0.10924668,-0.45463365,-0.6904562],[-0.80874884,-0.3383102,0.65157753,0.04253899,0.42724007,0.24657841,-0.5648559],[-0.3517047,-0.794073,-0.12099776,0.22774486,-0.23081534,0.2358734,0.24807717],[0.3229278,0.24695866,0.6025792,0.0022002668,0.32681346,0.54143,0.023995057],[0.45531654,0.27657107,-0.88627934,-0.57686245,-0.694657,0.27816367,0.3275702],[0.13451672,-4.2249675,-0.3837861,-0.6255863,-1.3373032,-1.6044973,3.5761082],[1.8231589,0.25132626,-0.5901763,0.246227,-1.138569,-0.8484137,1.5885205],[-0.32017943,-0.61674356,-0.49218202,-0.19713864,0.04268222,-0.5201525,-0.052188545]],"activation":"σ","dense_2_b":[[-0.052272886],[-0.11724032],[0.0015635947],[-0.00789324],[0.027887536],[-0.19823864],[-0.05784887],[-0.21397027],[0.004577288],[0.035433523],[0.12991314],[0.36998233],[-0.22823238]]},{"dense_3_W":[[0.2214185,0.117530905,0.07735763,-0.42819867,-0.40887833,0.053850636,-0.48472774,-0.2518017,-0.14455964,0.24991058,0.44975048,0.53486747,0.053818256],[0.4654577,0.13631766,-0.46057823,0.29975346,0.45944688,-0.43295076,0.47323555,0.55603576,-0.5924481,0.48736095,0.115073934,-0.056898475,-0.11687438],[-0.10070122,-0.5919317,0.3332405,-0.4515512,-0.44559675,0.47399083,-0.4619347,-0.37476748,0.5336691,0.34931633,0.3149243,0.08350989,0.5604568]],"activation":"identity","dense_3_b":[[-0.049824595],[-0.047182556],[-0.04280936]]},{"dense_4_W":[[-1.3079116,-0.3294201,-0.081988834]],"dense_4_b":[[0.051560275]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/KIA_STINGER_2022.json b/selfdrive/car/torque_data/lat_models/KIA_STINGER_2022.json
new file mode 100644
index 000000000..5bbf98eff
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/KIA_STINGER_2022.json
@@ -0,0 +1 @@
+{"input_std":[[6.871551],[0.99076307],[0.5212804],[0.034033],[0.99273914],[0.99082446],[0.99025035],[0.97448325],[0.9654756],[0.9608115],[0.9527273],[0.033883817],[0.033910338],[0.033948522],[0.03404775],[0.03394733],[0.033679023],[0.033345345]],"model_test_loss":0.004427366424351931,"input_size":18,"current_date_and_time":"2023-08-08_20-41-47","input_mean":[[18.534761],[-0.107549384],[0.0060349857],[-0.004051211],[-0.10914043],[-0.109205954],[-0.10822495],[-0.1059477],[-0.10361664],[-0.10045632],[-0.105254054],[-0.0040303078],[-0.0040611844],[-0.0040791193],[-0.0039875545],[-0.003919938],[-0.0038113499],[-0.0038577982]],"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.10420359],[-0.1057817],[-0.39223936],[-2.3496768],[-0.28235236],[-2.4502673],[0.03921215]],"dense_1_W":[[0.074189,-0.46536532,1.0744638,-0.0955078,0.28618422,-0.7533586,0.43112066,-0.16309841,0.008819428,0.3651173,0.16028656,-0.111217655,-0.09443299,0.6007408,-0.26957542,0.0102762515,-0.211533,0.20011066],[0.01304878,-1.1999677,0.018503658,-0.372737,0.6353846,0.8292781,0.1719466,0.035132185,-0.10863397,0.08928544,0.19234443,0.36751947,0.06552409,0.09331779,-0.00076240604,-0.45366123,-0.218846,0.31527466],[0.01300137,-0.41192222,-0.25047097,0.6152148,0.2306633,-0.38328096,-0.5728854,-0.49195603,-0.593413,0.16746691,-0.19081128,0.9538493,1.0308561,0.66020083,1.0559919,0.5171979,0.52770406,-0.3480374],[-0.7787808,-0.008312755,-0.1780567,-0.48370415,0.35223204,-0.5498642,0.29583552,-0.7346698,0.10713884,-0.1704408,0.11306947,-0.02356725,0.21382311,-0.17346635,0.5998714,-0.07053526,-0.09073403,0.092191376],[0.012029196,0.011908107,-0.2484767,1.264593,-0.85373944,-0.26193362,-0.660338,0.74062943,-0.28554145,-0.702825,-0.16722941,0.46179152,0.9958684,1.0726779,0.44082853,0.5114168,0.29967558,-0.1432011],[-0.76869935,0.34115568,0.17525065,0.15999442,-0.49437794,0.87348694,-0.5276255,0.17559843,0.17176434,0.18722947,-0.12719314,0.17408907,0.051208638,-0.14185886,-0.4593266,0.11995127,0.20499156,-0.1721416],[-0.04674022,-0.38118473,-1.4628186,-0.047094345,0.7261122,-0.046270296,0.81954944,-0.19116434,-0.5375223,-0.33290347,0.15070404,0.02437715,0.10229408,0.08374787,-0.0230739,-0.4579543,0.19219628,0.0668545]],"activation":"σ"},{"dense_2_W":[[0.14351524,-0.46819293,-0.4224769,-0.00477388,-0.019241339,-0.293288,-0.1430304],[0.013082477,-0.26986554,-0.13183518,-0.019898584,0.26537928,0.006188077,0.11345527],[0.7385166,-0.95441747,0.025136676,0.2132236,0.18503574,-1.2178441,0.01919843],[-0.2702514,-0.11104125,-0.62654877,-0.5112985,-0.38709098,-0.28173804,-0.08601629],[0.6713761,-0.22839609,-0.06097961,0.58245105,-0.6278035,-0.72068113,0.45237026],[-0.15852696,0.64257956,-0.55724066,0.21575698,0.22704268,0.6273873,0.011703053],[0.2014989,0.5201913,0.0019037927,-0.26834032,0.3011644,0.3858986,-0.528807],[0.46606636,-0.7134467,-0.048275437,1.742678,-0.4659715,-0.6684311,-0.139159],[0.15509929,-0.30987412,0.30098167,0.29494023,-0.37981874,-0.5524831,0.48631984],[0.14930598,0.34096712,-0.40304628,-0.4632963,0.04036466,0.5767117,-0.5780966],[0.31667084,-0.6918976,-0.00022687673,0.6150214,-0.45327514,-0.47609383,0.52913016],[0.246736,-0.3391219,0.104266286,-0.5017469,-0.018542334,0.12372901,-0.40627465],[-0.3095181,-0.40006125,-0.012567477,0.85648316,-0.17277096,-0.6989313,-0.0026190844]],"activation":"σ","dense_2_b":[[-0.31950915],[0.013885399],[-0.11509819],[0.0267938],[-0.018023722],[-0.012910115],[-0.027250042],[0.14641029],[-0.038134225],[-0.025109382],[-0.07372913],[-0.010580315],[-0.11711807]]},{"dense_3_W":[[0.20788044,0.033924606,-0.49926776,0.60941577,0.01432724,0.5210565,0.4180843,-0.25332364,-0.57750213,0.44128165,-0.3681372,0.36565867,-0.42293212],[-0.41391054,0.49958703,-0.41073647,0.074788004,-0.42877886,-0.39288726,0.07698003,0.2999807,-0.5140176,-0.23761888,-0.041945565,-0.54366297,0.10134992],[-0.06092816,-0.03296278,-0.10772118,-0.49357474,0.4073531,-0.56182015,-0.27668962,0.4813049,0.43785417,-0.38696533,0.3007674,-0.30370563,0.076707035]],"activation":"identity","dense_3_b":[[0.042803183],[0.06512138],[-0.045637704]]},{"dense_4_W":[[0.67749745,0.58833116,-1.2096345]],"dense_4_b":[[0.04982903]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/LEXUS_ES_TSS2.json b/selfdrive/car/torque_data/lat_models/LEXUS_ES_TSS2.json
new file mode 100644
index 000000000..57e7e301d
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/LEXUS_ES_TSS2.json
@@ -0,0 +1 @@
+{"input_std":[[9.041581],[1.1167691],[0.37027505],[0.04339891],[1.1085886],[1.1118982],[1.1143059],[1.1035876],[1.0856115],[1.0586617],[1.030805],[0.04334689],[0.043362875],[0.043374643],[0.04328665],[0.04312567],[0.04288237],[0.04255028]],"model_test_loss":0.00914697628468275,"input_size":18,"current_date_and_time":"2023-08-09_00-04-02","input_mean":[[24.044405],[-0.004445901],[0.0057743173],[-0.0008446529],[-0.0052520004],[-0.0049055307],[-0.004310624],[-0.0021481782],[-0.0005770088],[0.0025430974],[0.005762188],[-0.0008080605],[-0.00082908414],[-0.0008470768],[-0.0009064238],[-0.0009857891],[-0.0010071733],[-0.0010139564]],"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":[[4.3401184],[-4.1053653],[-0.010608114],[0.2289179],[-0.69536865],[-0.2987435],[-0.28003243]],"dense_1_W":[[1.7534523,-0.08379865,0.21821876,-0.111209184,0.18547846,0.70984817,-0.7669529,0.01540298,0.34365195,0.024990361,0.25576633,-0.04872505,0.058915216,-0.199681,-0.08895335,0.5293662,0.3860833,-0.47484013],[-1.6871309,-0.09608493,0.21602522,-0.25279704,0.15465249,0.53819185,-0.40238786,-0.01616075,0.06256271,0.22947508,0.23026761,0.24505456,0.014156367,-0.39275125,-0.00928132,0.6701992,0.068403155,-0.3019433],[0.004725199,-0.4235836,0.0013364913,0.15324596,0.42727017,-0.5808631,0.26156494,-0.20967181,-0.15404399,-0.09115835,0.18597606,-0.24034514,0.07084023,0.07770485,0.18210891,0.39121026,0.31440163,-0.5783728],[-0.19552681,-0.41310206,0.000722477,-0.0605445,0.701027,-1.3483342,0.5252242,-0.04271466,-0.11926105,0.18295698,-0.06785281,-0.47475234,-0.4607312,0.5883256,0.5187908,0.114911854,-0.25203437,0.08746814],[0.4152751,-0.14281093,0.7790405,-0.100202,0.28926933,-0.3125703,0.13834746,-0.3347568,0.43060276,0.55356705,-0.1735469,-0.11919702,-0.020521542,0.46576738,-0.06227651,0.036938347,-0.5694443,0.35215282],[0.3015953,-0.66961235,0.0007066811,0.419904,0.31045586,-0.9015735,0.7159605,-0.13024196,0.19127548,-0.18470418,0.06677055,-0.77706313,0.2998383,0.42251042,-0.21567652,-0.38658017,0.039470255,0.2681703],[-0.034314536,-1.076988,-3.4866838,-0.06330224,0.97281605,0.28214806,0.5845572,-0.5232068,-0.82733965,-0.2174799,0.6705298,-0.90485686,-0.048824865,0.40581775,0.6931158,0.17884906,0.25361615,-0.51271003]],"activation":"σ"},{"dense_2_W":[[-0.31351262,-0.32074958,0.8266476,0.8546215,0.3378021,-0.06759033,-0.46708575],[-0.8333776,-0.28922173,0.16795295,0.98310614,0.114590034,0.58432436,-0.13839144],[-0.6834294,-0.23853575,0.6451696,0.105569854,0.27903724,0.41774848,0.29000074],[-0.65618104,-0.20165549,-0.09106172,0.8227704,-0.23443276,0.53824764,0.47971424],[0.6953251,1.2419958,-0.79052114,-1.2340282,0.18634371,-0.6665756,0.107695915],[0.14654803,-0.19937792,-0.34062067,-0.7089461,0.40067112,-0.52197015,-0.085414894],[-0.2932009,2.5196638,-0.104791835,0.20051786,-2.2182112,-0.29118708,-2.7579544],[1.5122235,0.7356845,-0.89097416,-1.6861671,-0.033902757,-0.38292047,-0.13017933],[0.4886302,0.92094517,-0.91408855,-0.3532557,0.51951903,-0.95678043,-0.10919232],[-0.5293851,-0.20095,0.6889325,0.38757306,-0.377088,0.58944535,0.0955727],[-0.4349411,0.17035034,-0.15226962,-0.32203415,0.0838514,-0.059919562,0.04385721],[-0.26080495,-0.63391984,0.3301537,-0.1671539,-0.5050505,0.43088788,0.14715135],[0.45397362,0.3551525,-0.8346096,-0.65694994,-0.13430665,-0.31082925,-0.24663672]],"activation":"σ","dense_2_b":[[-0.15302955],[-0.15477453],[-0.1963815],[-0.2491886],[0.30184123],[-0.084158726],[-0.49648997],[0.67838836],[0.30030432],[-0.28645435],[-0.19416146],[-0.12059393],[0.36774662]]},{"dense_3_W":[[-0.30843228,-0.1345852,0.11176096,-0.5151945,0.29644585,0.12701263,0.0053969924,0.5684098,0.42676082,-0.370609,-0.16872759,-0.4540934,0.006954758],[0.43918204,0.6085673,0.51018596,0.6114487,-0.4061561,-0.1493339,-0.8047057,-0.18715277,-0.6292988,0.57502186,-0.1399395,-0.07194364,-0.8415874],[-0.39917964,0.53317773,-0.4621838,-0.015575044,0.50181717,-0.4820892,0.09182787,0.31296906,-0.39892152,-0.06316368,0.0068018823,0.37321454,-0.22843313]],"activation":"identity","dense_3_b":[[0.09777908],[-0.097871915],[0.098439135]]},{"dense_4_W":[[0.66679657,-0.8622704,0.007841214]],"dense_4_b":[[0.10087897]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/LEXUS_IS.json b/selfdrive/car/torque_data/lat_models/LEXUS_IS.json
new file mode 100644
index 000000000..322201260
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/LEXUS_IS.json
@@ -0,0 +1 @@
+{"input_std":[[7.9971128],[1.0977883],[0.45730543],[0.04923891],[1.089019],[1.0908507],[1.0933481],[1.0831064],[1.0687581],[1.0477011],[1.0263152],[0.04910758],[0.04913805],[0.04915577],[0.04904069],[0.0488613],[0.048416592],[0.047898013]],"model_test_loss":0.0029971429612487555,"input_size":18,"current_date_and_time":"2023-08-09_04-46-36","input_mean":[[28.262257],[0.00053741777],[0.007980467],[0.0073362947],[-0.002916855],[-0.0013664461],[0.00021708602],[0.0032231822],[0.007565537],[0.010730909],[0.014714129],[0.007122549],[0.0071928487],[0.0072572897],[0.007378812],[0.007430641],[0.007424608],[0.0074211424]],"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.13015555],[0.037057668],[-0.23104249],[0.32127166],[-0.1253072],[-0.6277245],[-0.1822209]],"dense_1_W":[[0.0022739936,0.15201275,-0.018758008,0.15420967,-0.6103832,1.253523,-0.6429536,-0.095406406,0.457949,-0.061857425,-0.09967628,0.34019652,-0.0124527775,-0.46103212,-0.41929677,0.31853652,-0.3198645,0.26396248],[0.016219854,0.2708034,-0.1250583,-0.3348056,-0.83736426,0.3921742,-0.35075605,0.30172172,0.24997391,0.45135334,-0.43142125,0.22985688,-0.40631214,-0.111362845,-0.5208431,0.004493165,0.4684426,0.6794704],[0.018668292,-1.0140254,-3.2794235,0.15160404,0.028701765,0.23249008,-0.1426395,0.43393394,-0.07807302,0.5009389,0.17505689,-0.7776797,-0.038091138,0.7018249,-0.21396264,0.011046297,0.13001016,-0.10944152],[0.3585128,-0.14987485,-0.13354455,-0.004226716,0.24764334,-0.858648,-0.007176733,-0.046182733,0.1446194,0.14181069,-0.1651582,-0.2749394,0.70667934,0.37523896,-0.2320659,-0.2591826,-0.20168015,0.28267252],[0.26727927,-0.41644073,-0.05738287,-0.011317095,0.4693145,-1.0781763,0.47786325,0.13199824,-0.1208562,-0.16208106,0.18948868,-1.007483,-0.48438329,0.07924176,0.80360824,0.66245914,0.16595826,-0.23646787],[-0.5315527,-0.023200141,-0.14639618,-0.2272303,0.064140245,-0.9595354,0.4488574,-0.16073947,-0.10355826,-0.061561897,0.069149286,-0.40911204,0.44534415,0.50131905,0.32962856,-0.22854826,0.1118126,-0.10387003],[0.45086104,0.62962455,0.05797986,-0.27834865,-0.03647285,0.58516073,-0.50903237,0.31138107,-0.46869588,-0.109248996,0.1444298,0.6807234,0.24872255,0.33425596,-0.46959794,-0.30864963,0.083699554,-0.24581586]],"activation":"σ"},{"dense_2_W":[[-0.47314742,0.30918634,0.6835903,0.33214816,0.41032484,-0.2974307,0.48068962],[-0.44719142,-0.3584287,-0.42897063,-0.0863155,0.32148045,-0.37775746,-0.35045746],[0.10737237,-0.107548736,0.40882415,-0.37991515,-0.35765076,0.6178046,-0.6659961],[0.5089876,-0.0018523282,0.47517067,-0.4635432,-0.51244944,-0.7637346,0.111460224],[0.009865635,-0.3599542,-0.08200983,-0.8016887,0.049183395,-0.55783385,-0.4132886],[0.21302545,0.24237937,0.2559324,-0.37488487,-0.8143479,-0.034766164,0.63836616],[0.06948995,0.5238659,-0.5756278,-0.34593225,-0.31828138,0.020820161,0.8075781],[0.264537,0.35211742,-0.2987492,-0.68384147,-0.37824905,0.12441704,-0.027348615],[0.18194555,-0.2742205,-0.7859905,-0.45490405,-0.6359722,0.30547658,-0.40839928],[-0.27246395,0.3188016,-0.6105616,-0.93436897,-0.120215744,0.019431151,-0.5015701],[-0.29636648,-0.44186333,-0.34854856,0.44886306,0.5337103,0.5365127,-0.5632916],[-0.24954297,-0.22443992,-0.15179092,0.51437247,0.24013738,0.43259284,-0.70645374],[0.4928545,0.18550447,0.22762263,0.29510337,0.3720493,0.37416783,-0.3423796]],"activation":"σ","dense_2_b":[[0.01935374],[0.0050131385],[-0.05235093],[0.046759594],[-0.12632822],[-0.027490286],[-0.024787772],[-0.044414002],[-0.123556636],[-0.14718735],[0.005641118],[-0.084211506],[-0.06420933]]},{"dense_3_W":[[-0.21112725,0.09418867,-0.44935966,0.3675701,-0.24375933,0.5796755,0.3944582,0.37292123,0.102567196,0.10260466,0.12603773,-0.6052102,-0.4585192],[0.033743866,-0.039306644,0.35334656,-0.42215514,-0.05132556,0.31450647,-0.30604413,0.12684399,-0.30334032,0.5066069,0.2883161,0.018579826,0.19727296],[0.5773127,0.44458362,0.37894127,-0.67509955,-0.4648014,-0.3175859,0.25752234,-0.57122767,-0.052177746,-0.57985467,0.56134444,-0.38693938,-0.35289878]],"activation":"identity","dense_3_b":[[-0.019124614],[0.012149713],[0.02416865]]},{"dense_4_W":[[0.85411745,-0.44846243,-0.8711393]],"dense_4_b":[[-0.020497099]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/LEXUS_NX.json b/selfdrive/car/torque_data/lat_models/LEXUS_NX.json
new file mode 100644
index 000000000..7c13f097e
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/LEXUS_NX.json
@@ -0,0 +1 @@
+{"input_std":[[7.6509843],[1.0640727],[0.43305442],[0.042583644],[1.0586958],[1.0597517],[1.0615927],[1.0452577],[1.0264294],[1.0022012],[0.97949535],[0.04246772],[0.042485926],[0.04249534],[0.042220093],[0.041864526],[0.041366912],[0.04084527]],"model_test_loss":0.009465457871556282,"input_size":18,"current_date_and_time":"2023-08-09_06-52-11","input_mean":[[24.357443],[-0.034125097],[-0.0049536517],[-0.011872438],[-0.03119763],[-0.03166454],[-0.03223406],[-0.03186475],[-0.030950857],[-0.030095048],[-0.03235388],[-0.011925372],[-0.011901585],[-0.01188047],[-0.011727326],[-0.011680916],[-0.011658311],[-0.01185102]],"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":[[1.1033378],[-0.26196438],[0.64087105],[0.0723818],[-0.033235934],[0.4940777],[-0.6624133]],"dense_1_W":[[0.17036144,0.70846754,-0.01288402,-0.31765887,-0.055238843,1.4783168,-1.0382427,0.09412714,-0.042508673,0.088409066,0.06366592,0.51934177,-0.2507901,-0.029035429,-0.40638945,0.18454157,-0.10026727,0.011903059],[0.0059481994,-0.4173155,-0.025032401,-0.17385283,0.42768398,-0.86849064,0.4772952,-0.28207323,0.45553952,-0.16625436,0.024320044,-0.3186513,0.04276512,0.058902144,0.67383,-0.41462952,0.32956126,-0.20091176],[0.50393635,-0.34078136,-1.1108505,-0.15240273,-0.34397945,-0.1046281,0.93492657,-0.0046718954,-0.35346282,0.18444361,0.09232944,-0.04991994,-0.43069664,0.04396726,0.5247936,0.38054457,-0.15464556,-0.072698794],[0.06292795,-0.49206024,1.0766574,0.3604547,0.33866602,-0.6243087,1.1562465,-0.22390123,-0.5481248,-0.046518486,0.25936723,-0.6421865,-0.103222616,0.3717842,0.18865198,0.22381376,-0.36329344,-0.12459951],[-0.018098533,1.1626849,7.7763515,0.3133824,-0.5978771,-0.6280122,-0.19266517,0.024776168,0.88816226,0.1488128,-0.4072811,0.8084272,0.2971273,-0.16158436,-0.36504307,-0.34449837,-0.5314731,-0.119041726],[0.12846576,-0.35670948,0.013853135,-0.075688206,0.18726085,-1.3245617,0.4279662,0.061345413,-0.11054695,-0.14311172,-0.0014835523,0.022838874,-0.11576593,0.39926448,-0.14371544,0.15646,0.11126016,0.03145696],[-0.31940654,0.05947834,-1.0866358,0.5663338,0.448577,-0.43552175,0.23205471,-0.35897624,-0.33488578,0.52830327,-0.011136929,-0.5225207,-0.56818086,0.44197837,0.20225807,0.1941536,-0.29525572,0.063295834]],"activation":"σ"},{"dense_2_W":[[-0.086325355,0.8016826,0.24832225,0.47240105,-0.46999067,0.6068118,-0.14119844],[-0.5582966,0.27016947,0.4639829,0.59999377,-0.37201896,0.7842096,0.28597522],[-0.27619955,-0.5730724,0.12383269,-0.3039288,0.123326324,-0.649525,-0.17117126],[1.4408953,-0.55869764,0.48217335,-0.18616202,1.0840948,0.16935517,-1.398959],[-0.66845334,-0.04818159,-0.3074986,-0.14507903,-0.382395,-0.22019714,-0.91304696],[-0.26608887,-0.5060071,-0.97440034,-0.35025296,0.8698175,-1.1775255,-0.030318461],[0.10986321,-0.8288251,-0.44233164,-0.3325045,0.2556111,-0.43471605,-0.35890812],[-0.1694278,0.047042966,-0.050367933,0.055317376,0.088589475,0.6182619,0.57370675],[0.93917805,-0.7993694,-0.21087216,-0.54964507,-0.060357884,-0.63951623,-0.236041],[0.40430954,-0.37087506,0.17056553,-0.9355302,0.12229527,-0.18960477,-0.10435068],[-0.05200265,-0.4987538,-0.31892672,-0.6532706,-0.6485076,-0.49172983,-0.77469736],[0.03723317,-0.48895985,-1.6575545,-0.027954731,0.53395647,-0.40768418,-0.80457896],[0.83523464,-0.9624459,0.10569231,-0.15287304,-0.58598167,-0.73237014,-0.28460762]],"activation":"σ","dense_2_b":[[0.02828117],[-0.05488203],[-0.27607742],[0.3004205],[-0.25380412],[-0.24068235],[-0.21541698],[-0.01097173],[0.21617699],[-0.081049286],[-0.12033645],[0.026889555],[0.32255155]]},{"dense_3_W":[[0.61514294,0.52475756,-0.3778977,-0.5686912,-0.56705767,-0.29328373,-0.14644307,0.5718381,-0.41984692,-0.19014074,-0.59977704,-0.64661556,-0.06085831],[-0.004403978,0.6136505,0.26742232,-0.14778873,0.28366107,0.0020191541,-0.17208292,0.33170637,-0.48983493,-0.3504383,0.26020375,0.0004651127,-0.8777239],[-0.25540027,-0.14768086,0.0147348475,0.34739557,-0.5552034,0.33083212,-0.25017375,-0.46695128,0.2878471,0.41177458,0.16511062,-0.06707549,0.49898487]],"activation":"identity","dense_3_b":[[0.062096752],[0.050615054],[-0.043884374]]},{"dense_4_W":[[-0.82545334,-0.75625134,0.20575939]],"dense_4_b":[[-0.053638227]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/LEXUS_NX_TSS2.json b/selfdrive/car/torque_data/lat_models/LEXUS_NX_TSS2.json
new file mode 100644
index 000000000..99ea2be6b
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/LEXUS_NX_TSS2.json
@@ -0,0 +1 @@
+{"input_std":[[8.147084],[1.086054],[0.37127572],[0.041630004],[1.0729798],[1.0772483],[1.0815692],[1.0805902],[1.0708296],[1.0535992],[1.0337878],[0.041566238],[0.041577842],[0.041586876],[0.04155611],[0.04150528],[0.041361168],[0.041143257]],"model_test_loss":0.0067100683227181435,"input_size":18,"current_date_and_time":"2023-08-09_08-07-39","input_mean":[[24.872166],[0.003932426],[-0.010966269],[-0.008132051],[0.0087015005],[0.0073090056],[0.0060250014],[0.0013043662],[0.0013662752],[0.0015136959],[0.0025651027],[-0.00813054],[-0.008112211],[-0.008098942],[-0.008128093],[-0.008089364],[-0.008116192],[-0.0082015265]],"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.9054255],[-0.28507137],[1.4240875],[0.02306676],[1.52593],[0.051342566],[-0.1610418]],"dense_1_W":[[-1.2814169,0.04502527,-0.24452247,-0.04534104,-0.22521678,0.12426732,-0.5100604,-0.1931805,-0.1757783,-0.71891594,0.26680607,0.33749202,-0.23968601,-0.4898723,0.4347295,-0.16316435,0.25191417,-0.040637583],[0.026426677,-0.5180133,-0.054280188,0.2787388,0.11506753,-0.7289032,1.0191976,-0.20389938,-0.12718956,-0.012505079,0.11661954,-0.20947376,-0.33647072,0.08544779,0.09467619,0.33146363,-0.09642059,-0.12805226],[0.4297043,-0.01532184,0.17760155,-0.11004306,-0.32989568,1.2537458,-0.2505036,-0.0105941985,-0.011504197,0.4410887,0.0021856735,-0.005641636,0.29666585,-0.013274171,-0.13881417,-0.022560775,-0.034353882,-0.016772056],[0.115859054,-0.69582313,0.008139212,0.10011219,0.35110396,-0.4720546,0.5779868,-0.2903919,-0.21940863,0.0279369,0.17058563,-0.69917786,0.3002438,0.18366155,0.35467052,0.10840391,-0.17159945,0.018160818],[0.22031884,-0.7193572,-0.18843435,0.09803419,0.3082459,-0.81420296,0.3980327,-0.044523235,0.05807009,-0.26365182,-0.07507196,-0.40902695,-0.13396262,0.41380468,0.18925877,-0.30483818,0.19883342,0.001749679],[0.17746796,0.81731343,-0.008930264,-0.34225407,-0.5971375,0.803859,-0.56055987,0.22442165,0.043888506,-0.28582388,0.07147745,0.6224109,0.025271881,-0.21175076,-0.3498934,0.1339036,-0.2896505,0.22109397],[-0.045657806,-0.7590582,-6.4479246,-0.38063437,0.36719322,0.23610972,-0.21581803,-0.29967567,-0.2673017,-0.34047002,0.9861421,-0.6061893,-0.1955559,0.54208314,0.6973659,0.06787787,0.08896528,-0.23932248]],"activation":"σ"},{"dense_2_W":[[-0.20833433,0.61933535,-0.800919,0.22723371,-0.090565115,-0.7945698,-0.13987784],[0.28559738,0.26079953,-0.15632679,-0.12129952,-0.289886,-0.21938595,-0.14360459],[0.95100516,0.07814724,0.0031976546,-0.75894195,-0.94153005,-0.7928424,-1.4411982],[-0.42705938,-0.8987026,0.06752999,-0.8046098,-0.51792544,-0.42536137,0.09767677],[0.19683614,-0.36086804,-0.014388864,-0.76707953,-0.8514832,0.26960486,-0.21758303],[-0.17587733,-0.5193636,-0.13756172,-0.44829637,-0.65762174,0.29082942,-0.008277407],[-0.3183399,-0.1665803,1.2876375,-0.0728533,0.30167028,1.2605048,-0.57462007],[0.3546879,0.35146946,-0.56283337,0.6228679,0.5594427,-0.19124825,-0.5252673],[-0.00087872695,-0.73673224,0.26480362,-0.72668016,-0.4297641,0.3408679,0.43822297],[-0.6492434,-0.5402448,-0.056282554,-0.08095678,-0.24393153,-0.7988477,-0.1693451],[-0.47922924,0.30153432,-0.7007562,0.39001682,0.10440299,-0.5656516,0.30876267],[0.9030477,-0.75241685,0.30403712,-1.1863935,-1.5607433,-0.5210042,-1.2099376],[0.09520087,-0.024397036,1.1286579,-0.4269453,0.06613633,1.022576,-0.42460024]],"activation":"σ","dense_2_b":[[0.068604216],[-0.07214453],[-0.23128065],[-0.11810941],[-0.113441095],[-0.066630945],[0.14084376],[-0.0044738725],[-0.22459178],[-0.2939405],[-0.04563305],[-0.05732056],[0.122370996]]},{"dense_3_W":[[0.37704808,0.6223934,-0.46660277,0.2654992,0.20017228,-0.33366653,-0.24672645,-0.32106653,0.56422967,-0.13366485,0.15189694,-0.2369768,-0.14679962],[-0.733396,-0.48898083,-0.3152747,0.08094783,0.33034948,0.599701,-0.27930403,-0.5709238,0.5841461,-0.06343237,-0.35778514,0.12911445,0.2698867],[-0.030497754,0.38693696,0.59045714,0.39527935,0.27385178,0.100422375,0.50604045,-0.398048,-0.12326097,0.0054453975,-0.7562181,0.5377892,0.3636564]],"activation":"identity","dense_3_b":[[0.038279504],[-0.05277531],[-0.07727225]]},{"dense_4_W":[[-0.21258786,0.8358761,1.1302456]],"dense_4_b":[[-0.062789865]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/LEXUS_RX.json b/selfdrive/car/torque_data/lat_models/LEXUS_RX.json
new file mode 100644
index 000000000..254191864
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/LEXUS_RX.json
@@ -0,0 +1 @@
+{"input_std":[[9.006951],[1.0661907],[0.4208536],[0.040620446],[1.0632395],[1.063527],[1.0637337],[1.0418845],[1.0213413],[0.9960982],[0.9659563],[0.04054981],[0.04057159],[0.04058309],[0.04049591],[0.040372174],[0.04013236],[0.039733175]],"model_test_loss":0.014225631952285767,"input_size":18,"current_date_and_time":"2023-08-09_14-33-01","input_mean":[[25.177166],[-0.026529262],[0.009477891],[0.0017629279],[-0.028283715],[-0.027773762],[-0.02699433],[-0.023891538],[-0.02269541],[-0.020438392],[-0.017402157],[0.0018114187],[0.0018036948],[0.0017961235],[0.0018093524],[0.0017814242],[0.0017387652],[0.0016870175]],"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":[[-1.3488934],[-0.25318402],[1.3796363],[-2.4763696],[0.17862964],[-2.581063],[0.0374099]],"dense_1_W":[[-1.9565458,0.43680963,0.06587548,0.042409927,0.3682261,-0.32550198,0.3935391,0.34101823,-0.19819863,-0.09118507,0.072811775,-0.55412966,0.22973019,0.5704431,0.10271992,0.10906355,0.18409586,-0.25245637],[0.010017396,-0.23327492,-0.025723774,-0.06732227,-0.1377613,-0.9790948,1.1363516,-0.004057807,-0.09313964,0.054035064,-0.04986635,-0.6889519,-0.43221784,0.85702723,0.469375,0.3359073,0.1845464,-0.47437343],[2.133775,0.8436303,0.06543569,-0.19301523,0.7682015,-0.71488863,0.44514364,0.121126205,-0.5451813,-0.23265283,0.36209187,-0.10944904,-0.10013678,0.8461928,0.47840348,-0.4829053,-0.15971945,0.19538315],[-0.762671,0.8158483,0.11918508,0.11182312,0.045061667,0.5209565,-0.017836645,0.19029039,0.05993828,0.14132203,-0.14783566,0.21835268,-0.37212574,0.021008398,-0.07471657,0.23310561,0.30849415,-0.32095852],[0.012362058,1.1697396,4.896626,-0.6752607,-1.293956,-0.6969285,-1.2943544,0.48185518,1.9836872,0.80383307,-0.67689174,1.464715,1.0810806,-0.6226654,0.5317476,-0.97188056,-0.93535984,-0.07797605],[-0.76108575,-0.96115094,-0.12517042,-0.023074046,0.21048824,-1.0002247,0.1298013,0.017577004,-0.04171292,-0.13762209,0.09954114,-0.4320813,0.051972903,0.5637555,-0.20373943,-0.0645255,-0.17654338,0.17915705],[0.012589448,-1.178468,0.16960609,-0.042218912,-0.313776,-1.1033659,-0.3083642,0.04046465,-0.69654006,-0.5194823,0.22638294,-0.115158446,0.1719876,0.6620813,-0.27977157,-0.6041283,-0.16925894,0.5477763]],"activation":"σ"},{"dense_2_W":[[0.2714706,0.59053195,-0.0041459124,-0.41285,-0.3072934,0.30405983,0.29765671],[-0.05261304,0.61104286,0.083263226,-0.2729422,-0.15758975,0.3245751,0.08180204],[0.11750135,-0.9169556,0.16402717,-0.47221494,0.013237812,-0.9444454,0.07540947],[0.14767434,-0.2879568,-0.23108272,0.41553706,-0.022354566,-0.7293346,-0.44255376],[0.30335668,0.37456387,0.3885767,-0.7781797,0.03455829,0.701339,-0.088443086],[-0.1726601,-0.85276175,-0.42082515,1.3459167,0.014372793,-1.1087767,0.25560606],[-0.22434108,-0.61502177,-0.77391124,0.58211446,0.70793843,-0.44423535,-0.10059737],[-0.24011742,-1.1389203,0.13803475,0.5802644,0.4245233,-0.4964158,-0.06763477],[0.17082813,0.26018152,0.2441558,-0.798921,-0.34764507,0.53820854,0.4687339],[-0.142942,0.1200522,-0.2755005,-0.44287127,0.12139864,0.7061747,0.30685058],[0.26870826,0.27511376,0.013270598,-0.38270554,-0.25317055,0.5880916,0.38201085],[-0.51288533,-0.74000406,0.041218568,0.23942995,-0.61270565,-0.35922202,-0.41015244],[-0.31531772,-0.6721873,-0.0041211997,0.44185337,0.094147496,-0.532301,-0.09608283]],"activation":"σ","dense_2_b":[[-0.13420725],[-0.006237683],[-0.29298192],[-0.16996942],[-0.24118775],[0.39525142],[0.12012915],[0.079633266],[-0.14625302],[0.017826455],[-0.25199854],[0.08497193],[0.11287382]]},{"dense_3_W":[[0.3236856,-0.11585646,0.37450194,-0.3883134,-0.12542132,0.117089026,-0.33960536,-0.51633084,0.15317307,-0.46796653,0.22769703,0.14106414,0.37199378],[-0.46536645,-0.21581124,0.21901791,0.11581306,0.0037904275,0.20201044,0.76395154,0.2692143,-0.08054871,0.3889979,0.13807094,0.58494323,0.6641779],[-0.31520608,-0.5903212,-0.0585899,0.1499463,-0.49658206,0.3555356,0.734374,0.46968886,-0.6641194,-0.6121126,-0.57470906,0.48789984,0.46722496]],"activation":"identity","dense_3_b":[[-0.010275512],[-0.05716576],[-0.03483528]]},{"dense_4_W":[[0.05533481,0.9485316,1.0639691]],"dense_4_b":[[-0.04380799]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/LEXUS_RX_TSS2.json b/selfdrive/car/torque_data/lat_models/LEXUS_RX_TSS2.json
new file mode 100644
index 000000000..4912d86a0
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/LEXUS_RX_TSS2.json
@@ -0,0 +1 @@
+{"input_std":[[8.48588],[0.9537726],[0.36582693],[0.043554034],[0.9464909],[0.94813603],[0.94916946],[0.9368726],[0.9235678],[0.90086037],[0.8777369],[0.043447778],[0.043471374],[0.043487635],[0.043498106],[0.043457054],[0.043319046],[0.043142088]],"model_test_loss":0.01665860041975975,"input_size":18,"current_date_and_time":"2023-08-09_17-03-58","input_mean":[[23.708097],[0.018138325],[0.0074228332],[-0.009125995],[0.016877966],[0.01722217],[0.017804503],[0.01873034],[0.018360198],[0.018759517],[0.02228655],[-0.009105863],[-0.009100863],[-0.0090915],[-0.009066759],[-0.009038707],[-0.009013525],[-0.008991696]],"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.010409239],[-0.0048437957],[1.1988333],[-0.13476348],[1.4858104],[-0.794262],[0.6790735]],"dense_1_W":[[-0.011625103,-0.3083069,-0.0026562517,8.90253e-5,0.24631822,-1.1913638,0.82102,-0.11153706,0.1505958,0.2899964,-0.27461168,-0.49880293,0.04710429,0.29354858,0.416012,-0.3435446,0.19979279,-0.12608024],[5.6495715e-5,0.28144145,0.42635885,-0.04114077,-0.0014621562,0.46131748,-0.5228703,0.41057003,0.33081797,0.34625557,-1.0916862,0.09432066,0.32492688,-0.056624148,-0.040471476,-0.5424953,-0.0072112447,0.28388345],[1.7090412,0.2002619,0.0026196167,0.26699355,0.071899444,0.049739193,0.1701057,0.42871216,-0.038330317,-0.011365764,-0.23889059,0.12167451,-0.393932,0.3747686,0.00017281089,-0.1975879,0.026008612,0.12001063],[0.0018485491,-1.0713278,-4.8827915,0.26486492,2.050632,0.16912486,-0.06104053,-0.11624062,-1.6869881,-1.0038092,1.237583,-0.84136367,-0.39167315,-0.30604422,0.44892347,0.5669582,0.034259807,0.35163558],[1.7980721,-0.4584174,-0.0022513545,-0.6307025,-0.14997724,0.72365683,-0.91590655,-0.31521827,0.11314583,0.38106278,-0.00602411,0.21668813,0.43501985,-0.45246387,-0.009387444,0.23703502,-0.14703332,0.0099657895],[-0.1358725,0.54878175,-0.0025949588,-0.12666118,-0.19501363,0.654152,-0.16454516,-0.08546684,0.1169596,0.49080434,-0.3239291,0.35493678,-0.10910667,-0.33374792,-0.24709627,0.114444494,0.27612403,-0.06697925],[0.13420698,0.50657654,-0.0042069573,0.045988888,-0.07106984,0.9937608,-0.6856747,-0.032089513,0.21678452,0.25315955,-0.18009213,0.6731982,-0.321046,-0.5262044,0.0499083,-0.21319143,-0.17084885,0.3188954]],"activation":"σ"},{"dense_2_W":[[-0.7456634,0.46501774,-0.6609165,-0.36825928,0.34470782,0.37473607,0.32698643],[0.8138239,-0.2721878,0.23626322,0.42493615,-0.49122226,0.11831825,-0.0014772185],[0.9073058,-0.24231595,-0.6257176,0.3009464,-0.9984163,-0.84967256,-0.9688514],[0.81139743,-0.3589047,-0.25483748,-0.008724137,-0.30143958,-0.55920064,-0.75189996],[1.2769561,-0.19255519,-0.5588862,0.4862281,-1.1403346,-0.9804591,-1.1165341],[-0.31463045,0.45179945,-0.24287948,-0.6230109,0.25823897,0.7043701,-0.22927245],[-1.008901,0.50820404,-0.73319477,-0.07753135,-0.3671213,0.6114657,0.06207998],[-0.5402591,-0.8133519,0.14899945,0.07088945,0.031132944,-0.13568036,-0.49520075],[-1.6630762,-0.06750191,-1.6710929,-0.14377673,-0.8075217,1.4285947,0.8853607],[-0.3978325,-0.20129038,-0.3479711,0.023103444,0.37153137,-0.3815196,-0.2664648],[0.22289358,0.35865685,-0.7157779,-0.28774455,-1.0286486,-1.0144361,-1.3272792],[1.084518,-0.7375414,0.45458505,-0.07111571,-0.6131045,0.0032512164,-0.5619188],[-1.4050175,0.33980614,-1.1927856,-0.46912205,-0.58342016,1.0496932,0.6457101]],"activation":"σ","dense_2_b":[[-0.06799501],[-0.14373808],[-0.1901882],[-0.15265658],[-0.22159524],[-0.07163111],[-0.12828404],[-0.37175685],[-0.48142236],[-0.34072894],[-0.10627754],[-0.048601486],[-0.29759893]]},{"dense_3_W":[[-0.04726544,-0.39426312,0.30152455,-0.13302766,0.118110485,-0.14255127,0.5374407,-0.020599457,-0.16083333,-0.14201048,0.047239352,0.38325223,0.15821639],[0.4946483,-0.34571862,-0.5582076,-0.5775158,-0.840619,0.24489452,0.33843094,-0.5029043,0.61864847,0.53716034,-0.54293144,-0.5770566,0.804303],[-0.68038666,0.06468416,0.5824173,0.06446385,0.5888793,-0.19427243,-0.3311894,-0.6022182,-0.77085805,0.42349538,0.5826747,0.58117974,-0.21141453]],"activation":"identity","dense_3_b":[[0.032147415],[0.045437515],[-0.028842183]]},{"dense_4_W":[[0.17054327,0.9154161,-0.7712217]],"dense_4_b":[[0.034591846]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/MAZDA_3.json b/selfdrive/car/torque_data/lat_models/MAZDA_3.json
new file mode 100644
index 000000000..91785773f
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/MAZDA_3.json
@@ -0,0 +1 @@
+{"input_std":[[7.469403],[0.5752973],[0.3025814],[0.027512576],[0.5745247],[0.5751064],[0.57497597],[0.56818837],[0.55998725],[0.5523634],[0.5432058],[0.027730573],[0.027652828],[0.027584106],[0.027332576],[0.027187975],[0.026960261],[0.026921367]],"model_test_loss":0.024072762578725815,"input_size":18,"current_date_and_time":"2024-01-04_17-43-34","input_mean":[[22.35999],[-0.30513376],[-0.05278297],[-0.015512917],[-0.29194897],[-0.29571798],[-0.29988596],[-0.3178012],[-0.32379964],[-0.33275104],[-0.33721825],[-0.015199247],[-0.015290173],[-0.015389486],[-0.015867714],[-0.016179392],[-0.016556518],[-0.016847862]],"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.3300024],[3.4020867],[0.8867904],[0.24398735],[-0.22297323],[0.8297959],[4.4060645]],"dense_1_W":[[0.5586716,0.19477035,0.014838485,-0.8819099,0.8490799,-0.8849248,0.5430739,-1.2464411,0.1032794,-0.35215527,-0.1541876,-0.6031729,-0.34809163,0.021685746,0.171801,0.17438643,0.7795394,0.71163744],[0.0023543302,-1.4088361,-0.20021366,-0.037758816,1.9830067,0.13815653,0.86535054,-0.81385386,-3.3036325,-2.9394522,-0.69543415,-0.6041395,-0.37588012,0.68224555,0.7861614,0.19097735,-0.9865116,0.3145854],[-0.960537,0.2949049,0.020091651,-0.9853115,0.6460172,-0.8868847,0.69357425,-1.453919,0.09689657,-0.20516564,-0.45445403,-0.76455826,-0.76449543,0.06314495,-0.06493274,0.81162876,0.80799454,0.93353367],[0.3291335,-1.8058063,0.01374078,-0.79195046,-0.45958978,1.0171918,-0.52610767,1.2541785,0.7763023,0.06388108,-1.230813,0.19347882,0.075406365,-0.97705686,-0.21693136,0.102006726,0.69212055,0.98111564],[0.0072148344,-1.9069422,-0.00010727675,-0.4882408,0.6680689,1.1360449,-1.0022873,1.2947347,0.35052946,0.3640997,0.37955928,0.14649878,-0.31742507,-0.044465248,-0.06055242,-0.45532945,-0.09595856,0.4186969],[0.0056863213,-0.29262394,-5.1591883,-0.6082099,0.6530366,0.81221175,1.3255913,0.12576282,-0.105110295,-0.79566103,-1.1739684,0.063307,0.035404827,0.27293137,0.11892293,-0.79880846,0.38751557,0.14072612],[-1.0780617,-1.3712662,-0.9741798,-0.5754835,0.35970378,-0.29184532,0.54759485,-0.5236218,-2.1269052,-2.3032513,-3.4586606,0.7505796,1.1786144,1.1765167,0.273957,-1.19514,-1.5335932,-1.8808447]],"activation":"σ"},{"dense_2_W":[[0.13640141,0.26249138,1.3706881,-0.67349094,-0.6853489,0.07761523,-0.20782757],[-1.561812,-1.1158333,0.45575863,0.05350467,0.11361368,-0.84576166,-1.5393691],[-0.4932355,0.23465966,-0.7953872,0.5806595,0.67311335,0.007322937,0.17559592],[0.34134263,-0.056415536,0.15007868,-0.3607064,-0.7849791,0.21608916,0.113307916],[0.2992458,0.18675353,0.43198323,-0.9817767,-0.78184605,0.17114773,-0.009282266],[-0.279027,-1.2797687,0.3050861,1.4301388,1.1050543,-0.32616624,-0.35091028],[-0.9362512,-0.41732854,-0.20699288,0.58766145,0.99819213,0.18219909,-0.1769925],[-0.9172841,-1.057063,-0.8472072,0.4978657,-0.025878131,0.62177205,-0.30631492],[0.51108074,-0.37056863,0.90701807,-0.3689084,-0.59172076,0.35379598,0.026690245],[-0.31872204,0.09643645,-0.40120426,0.73168164,0.033515673,-0.08508878,0.86411595],[-2.030154,0.4349391,0.9615393,-1.0150082,-0.7122496,-1.0493598,0.27227473],[-1.1227299,-1.6187482,0.22539543,-0.07183943,0.5167592,-0.097296976,-1.2421465],[0.6432161,0.38064235,-2.9676967,-1.1754779,0.1922527,-0.79099226,-1.7507246]],"activation":"σ","dense_2_b":[[0.34029007],[0.15721829],[-0.38075104],[-0.022835307],[0.00043023936],[-0.104654595],[0.06738647],[-0.010813514],[0.15167741],[-0.121652484],[-0.005833656],[0.0061091785],[0.4982022]]},{"dense_3_W":[[-0.20176695,-0.10482956,0.25416008,0.59829456,0.5850189,0.2088624,0.37909675,-0.19094692,-0.40086383,0.12073893,0.56499076,-0.039211515,-0.3167774],[-0.48269215,0.7165856,0.27029762,0.21725719,0.28123355,0.24939528,-0.3724709,-0.31746587,-0.2978945,-0.17932776,0.5278354,-0.41470852,0.3494488],[-0.87803674,0.67124027,0.37053418,-0.45549104,-0.4890647,0.6881532,0.6495497,0.535685,-0.80503774,0.42973304,0.5072987,0.4061022,-0.72803205]],"activation":"identity","dense_3_b":[[-0.055526532],[0.13907385],[-0.050069362]]},{"dense_4_W":[[0.043956995,0.018560354,0.78419465]],"dense_4_b":[[-0.034510687]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/MAZDA_CX5_2022.json b/selfdrive/car/torque_data/lat_models/MAZDA_CX5_2022.json
new file mode 100644
index 000000000..3cb6a37b1
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/MAZDA_CX5_2022.json
@@ -0,0 +1 @@
+{"input_std":[[8.853577],[1.1593435],[0.49393934],[0.047530506],[1.1528559],[1.1569644],[1.1598135],[1.1245039],[1.0973833],[1.0626532],[1.0269637],[0.047361173],[0.047408417],[0.047455847],[0.047535572],[0.047536217],[0.04739956],[0.04713172]],"model_test_loss":0.017221078276634216,"input_size":18,"current_date_and_time":"2023-08-09_18-22-21","input_mean":[[23.515398],[0.012237509],[-0.0044900486],[-0.010730645],[0.013944725],[0.013308859],[0.012569497],[0.011769375],[0.010604365],[0.010843918],[0.011256869],[-0.0107458485],[-0.010734076],[-0.010720637],[-0.010731344],[-0.01076948],[-0.010765305],[-0.01082986]],"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.199587],[-0.25501987],[-0.5037064],[-0.23722672],[0.22343779],[0.14423445],[-0.07885718]],"dense_1_W":[[1.2625326,0.16327555,0.0066552805,0.44784018,-0.124741316,0.79189295,-0.37784576,0.21143824,-0.52783173,-0.20586084,0.23246923,0.1308419,0.11561832,-0.55449927,-0.11027749,-0.18869302,-0.2170536,0.08424656],[-0.006859232,-0.086538136,-0.03269977,0.13604829,0.24823508,-0.5691345,0.670277,0.040435724,-0.16860203,-0.41622674,0.25470176,0.02203289,-0.23012973,0.39989966,-0.47250885,-0.10986197,0.20646292,0.02149021],[1.3279617,0.25124303,-0.007813492,-0.72305727,0.06114258,-0.8571762,0.063125186,-0.25974143,0.4144009,0.60714114,-0.46617725,-0.2852775,-0.0355692,0.5701069,0.69028735,0.27851647,-0.26454824,0.07074926],[0.022198461,1.6731384,0.037180465,0.765974,0.030372338,-0.7625096,2.1497931,-1.2226309,-1.9869789,-0.91440254,0.9935744,-0.3478071,0.53434056,-0.08860992,-0.28544557,-0.29930937,-0.5889199,0.4349971],[0.2660301,-0.86187685,8.6956774e-5,-0.016676437,-0.3185729,-0.8080561,1.0541335,0.12288944,0.1756726,-0.14763017,-0.09342803,0.17633434,-0.24657024,-0.3275839,0.37692598,0.048297286,0.19601016,-0.20960684],[0.15503937,0.78893465,-0.0035333869,-0.0016546088,0.18449067,0.46749434,-0.7731415,0.33954102,-0.035273015,-0.3853616,0.23819815,0.34393597,-0.057135757,0.15562473,-0.3307375,-0.28002447,-0.14485608,0.3072072],[-0.002361901,-1.5429035,-5.8346395,0.50011724,0.42428496,0.7945255,0.49649864,0.34323424,-0.9758048,-0.9413602,0.64176863,-0.59547406,-0.009193582,-0.36598718,0.48848686,-0.27432454,0.047451578,0.28842512]],"activation":"σ"},{"dense_2_W":[[0.46865103,-0.60989743,-0.03747131,-0.39046776,-0.057409145,-0.39815053,-0.59903854],[0.3293413,0.5657211,0.58408237,0.09847331,0.6722225,-0.5966699,0.43323725],[-1.1938511,0.3152245,-0.7231345,0.36246085,0.17062272,-0.9542798,0.42241877],[0.95589864,-0.5171128,-0.20689346,-0.2149552,-0.17504925,1.4507052,-0.458539],[0.6998986,-0.5149185,-0.41500762,-0.34256452,-0.59194785,0.68115014,0.022985162],[-0.58739376,0.5298398,0.35696748,-0.09943707,1.0701959,-0.8042608,-0.25183183],[-1.7204717,-0.5559019,-0.9794375,-2.4412615,0.009480803,-0.2547261,0.2289718],[0.6462851,-0.7868944,-0.9317859,-0.62466663,-0.11116908,0.48139545,-0.1042982],[0.7837947,-0.31750438,-0.61143816,-0.53003997,-0.8487594,0.52839005,0.071558826],[-0.6952866,-1.0207022,-0.8329126,-0.23308934,-0.103428386,0.37906075,-0.95636684],[-0.4912487,0.16609176,0.38974765,0.5311249,0.8187408,-0.9927307,-0.1320584],[-0.50672543,0.5862622,-0.2999275,-0.0069663594,0.18914229,-1.3985909,0.35376993],[-0.8134264,0.55566525,0.6216377,0.7941298,0.6479907,-1.2260833,-0.31804174]],"activation":"σ","dense_2_b":[[-0.19038986],[-0.16041437],[-0.5408977],[0.30586013],[0.085234426],[-0.10838832],[0.22506814],[0.0007744643],[0.13522272],[0.03689445],[-0.13003486],[-0.27763245],[-0.092821054]]},{"dense_3_W":[[-0.65185815,0.54327095,0.10433931,-0.116812855,-0.55839425,0.6606599,-0.59668356,-0.1460392,-0.4181811,-0.8674938,0.51525503,-0.23707807,0.29755294],[-0.09864905,-0.65130895,-0.7366327,0.44178113,0.7440715,-0.18855122,0.5229587,0.648026,0.7389669,0.58856255,-0.29644322,-0.56690645,-0.47691458],[-0.028702423,-0.025029318,0.3560928,0.08559789,-0.5590178,-0.21502936,0.4283347,0.14829901,0.15673526,-0.36272648,-0.21479517,0.23683308,0.39158282]],"activation":"identity","dense_3_b":[[-0.08270337],[-0.04420589],[-0.00881405]]},{"dense_4_W":[[-0.259468,1.106187,0.007629875]],"dense_4_b":[[-0.03991197]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/MAZDA_CX9 2021.json b/selfdrive/car/torque_data/lat_models/MAZDA_CX9 2021.json
new file mode 100644
index 000000000..bda8ada35
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/MAZDA_CX9 2021.json
@@ -0,0 +1 @@
+{"input_std":[[6.1377034],[1.0210788],[0.46911943],[0.04458394],[1.0146378],[1.0170907],[1.0187873],[0.99643576],[0.977885],[0.9539401],[0.9314358],[0.0443801],[0.044420015],[0.04446651],[0.04452825],[0.04450817],[0.04427827],[0.04390146]],"model_test_loss":0.016026578843593597,"input_size":18,"current_date_and_time":"2023-08-09_19-14-34","input_mean":[[26.721071],[0.05378143],[0.018124493],[-0.007393202],[0.048810303],[0.050282035],[0.052012227],[0.057080623],[0.05906103],[0.058861],[0.05875214],[-0.0075229136],[-0.0075009223],[-0.007483631],[-0.0074706767],[-0.0074925683],[-0.0075200107],[-0.0076175835]],"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.18089767],[0.49798125],[-0.24118638],[-2.1373975],[-0.16477053],[0.34568876],[-0.21016233]],"dense_1_W":[[0.074662894,-0.3669638,0.25222635,0.107843496,-0.10552656,-1.0399265,1.0163934,-0.48659247,-0.030600587,-0.11743266,0.14577629,-0.25742808,0.3170169,0.36954135,0.040227413,0.15968736,0.062263597,0.24831484],[0.08303395,-0.8697939,0.0030468423,0.15263641,0.107188724,-1.0068568,0.4416236,0.036292315,0.7619705,0.1695332,-0.57831824,-0.2111467,0.11940522,-0.041054823,0.35764664,-0.47026095,-0.069946416,0.27341142],[0.048043054,-0.31118855,-0.008299072,-0.11476858,0.33377898,-1.0105896,0.36259222,0.2396159,0.20328248,-0.12248921,-0.12638399,-0.4566413,0.09750506,0.07093791,0.55933607,0.010423586,0.10305094,-0.16882543],[-0.2943162,-1.6256222,0.0030186898,0.4355704,-0.11311622,-0.18757336,0.59179604,0.19876327,0.081539884,0.15316048,-0.29308975,-0.78554755,0.11605082,0.106179096,0.4265695,-0.16271093,0.005539031,0.02609059],[0.07329607,-0.8092628,0.25480765,0.29808077,-0.0061037876,0.42461434,-1.7734524,0.8508979,0.86776084,-0.23827028,-0.3394005,0.49403337,0.00061965705,-0.28957158,0.25209922,-0.109510385,0.030290708,0.40608874],[0.039265428,0.96887267,6.0339727,-0.10146958,-0.4268955,-0.99481356,-1.3445842,0.73430777,1.103279,1.2262536,-0.9347754,0.7603965,0.27957165,-0.72691447,0.079958566,0.21448162,-0.6384232,-0.037277497],[0.0016329347,0.16354942,0.002987302,-0.052555222,-0.22473752,-0.5058604,0.6229535,-0.047164608,-0.5693476,-0.26495168,0.29653648,-0.5010037,-0.11219094,0.25223202,0.52381283,0.6169986,0.023134451,-0.33158067]],"activation":"σ"},{"dense_2_W":[[-0.7412992,-0.7675937,-0.4397283,0.31320858,0.5621121,0.53991586,-0.35282382],[0.39020097,0.14299431,0.11215057,0.1305876,-0.9580759,-0.42531374,1.1606607],[-0.68442714,-0.5091107,-0.2732925,0.038994852,0.16016693,0.084352866,-0.40752736],[-0.3638797,-0.5586708,0.12934496,-0.89443725,0.3385314,-0.49931,-0.49778506],[0.15667213,0.2869896,0.11566534,0.8353921,-0.8303651,-0.67806315,0.37547386],[-0.44675717,-0.89146745,-0.51320916,-0.8497574,0.53292394,-0.22540878,0.27044648],[0.31874314,0.7925137,0.691313,0.43609503,-1.0456865,-0.121448435,0.54489106],[0.70710474,0.8615981,0.37050986,0.17309327,-1.0366682,-0.033383362,0.64695203],[-0.56060874,-0.75052696,-0.23543693,-0.5132341,0.22080141,0.1704808,0.16872974],[1.0095209,0.8009594,0.5537545,0.8833569,-1.1999682,0.31028512,0.18520752],[-0.9428297,-0.37537527,-0.59236115,0.33072037,0.26682293,0.41685763,-0.0841698],[-0.24776414,-0.16537917,-0.06624358,-0.47923082,-0.06637364,0.113684684,-0.5439529],[-0.83423465,0.46298993,-0.27318522,0.014554697,-0.37881574,-0.9102047,-0.4330378]],"activation":"σ","dense_2_b":[[-0.052797712],[-0.087834224],[0.14800552],[0.15060428],[-0.11083593],[0.17317224],[-0.16887216],[-0.27164057],[0.14738622],[-0.7614823],[0.007635959],[0.1378371],[-0.66434515]]},{"dense_3_W":[[0.36896288,-0.490786,0.16599391,0.47720614,-0.30545673,0.7379879,0.013581132,-0.32646582,0.558891,0.18879382,-0.37756246,-0.1875126,-0.124775544],[0.18666591,0.5846334,-0.10136687,-0.7394393,-0.2828246,-0.08108596,0.39981124,0.20680344,-0.37288138,0.27750582,-0.11473721,-0.57098895,0.4266538],[0.7361726,-0.58514285,0.7204545,0.106599934,-0.59268904,0.5647647,-0.45099103,-0.6198126,0.68592227,-0.25746143,0.43516034,0.27023137,0.36228538]],"activation":"identity","dense_3_b":[[-0.09970351],[-0.0810631],[0.07066309]]},{"dense_4_W":[[0.09306378,-0.5163019,0.9577329]],"dense_4_b":[[0.07198106]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/MAZDA_CX9.json b/selfdrive/car/torque_data/lat_models/MAZDA_CX9.json
new file mode 100644
index 000000000..1464ff4df
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/MAZDA_CX9.json
@@ -0,0 +1 @@
+{"test_dict":{"[0.0,-4.0,4.0,0.0,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.68026423,"[0.0,0.0,4.0,-0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.6623511,"[0.0,4.0,-4.0,-0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.7894848,"[40.0,4.0,4.0,0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.45772332,"[40.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.033177804,"[40.0,-4.0,4.0,0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.8652633,"[20.0,4.0,4.0,0.0,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.72988725,"[40.0,0.0,0.0,0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.33481875,"[20.0,-4.0,4.0,0.0,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.6028637,"[40.0,-4.0,0.0,0.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.6341075,"[40.0,-4.0,4.0,-0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.35337192,"[40.0,4.0,-4.0,0.0,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.5604581,"[0.0,4.0,-4.0,0.0,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.49662757,"[0.0,-4.0,-4.0,0.0,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.8983778,"[0.0,4.0,0.0,-0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.8291683,"[0.0,4.0,-4.0,0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.21059237,"[20.0,0.0,4.0,0.0,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.3554733,"[40.0,4.0,0.0,0.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.61752445,"[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.008872215,"[40.0,4.0,0.0,-0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.82794446,"[20.0,-4.0,0.0,0.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.722765,"[20.0,4.0,0.0,0.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.58601475,"[0.0,0.0,-4.0,0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.6585865,"[40.0,0.0,4.0,0.0,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.3415729,"[0.0,-4.0,0.0,0.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.7593987,"[0.0,4.0,0.0,0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.2533843,"[0.0,-4.0,4.0,-0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.36514503,"[20.0,-4.0,0.0,0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.9955126,"[40.0,-4.0,0.0,0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.9061998,"[40.0,-4.0,4.0,0.0,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.5863995,"[40.0,0.0,-4.0,0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.70988524,"[40.0,4.0,4.0,-0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.9357347,"[0.0,0.0,-4.0,0.0,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.40801805,"[0.0,4.0,4.0,0.0,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.7080684,"[40.0,-4.0,-4.0,0.0,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.8582784,"[40.0,0.0,4.0,0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.051181857,"[0.0,0.0,0.0,-0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.32222438,"[20.0,0.0,-4.0,0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.68954885,"[40.0,4.0,-4.0,-0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.81613845,"[0.0,4.0,0.0,0.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.5503567,"[0.0,-4.0,4.0,0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.95135486,"[40.0,-4.0,0.0,-0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.38768044,"[40.0,0.0,-4.0,-0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.121791795,"[20.0,-4.0,-4.0,-0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.60388947,"[40.0,-4.0,-4.0,-0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.58747494,"[20.0,4.0,4.0,0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.460676,"[0.0,0.0,4.0,0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.07276039,"[20.0,4.0,-4.0,-0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.7868223,"[0.0,-4.0,0.0,-0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.45431036,"[20.0,4.0,0.0,-0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.8425848,"[0.0,0.0,-4.0,-0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.09901318,"[20.0,4.0,0.0,0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.26556718,"[20.0,4.0,-4.0,0.0,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.51706076,"[40.0,4.0,-4.0,0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.22000633,"[20.0,0.0,4.0,0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.08331953,"[0.0,4.0,4.0,0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.4225998,"[20.0,4.0,-4.0,0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.20729552,"[40.0,0.0,0.0,-0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.21171938,"[20.0,-4.0,-4.0,0.0,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.8852378,"[0.0,4.0,4.0,-0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.9542402,"[20.0,0.0,0.0,-0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.2908706,"[20.0,0.0,0.0,0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.33962357,"[20.0,0.0,4.0,-0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.587801,"[40.0,0.0,-4.0,0.0,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.40549684,"[20.0,0.0,-4.0,-0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.13055985,"[20.0,4.0,4.0,-0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.93948686,"[20.0,-4.0,-4.0,0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.1222087,"[0.0,0.0,0.0,0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.2840799,"[20.0,0.0,-4.0,0.0,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.41804174,"[20.0,-4.0,4.0,0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.8638405,"[20.0,-4.0,4.0,-0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.3479214,"[0.0,-4.0,-4.0,0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.1160183,"[20.0,-4.0,0.0,-0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.4250751,"[0.0,0.0,4.0,0.0,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.37797537,"[40.0,4.0,4.0,0.0,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.74481004,"[0.0,-4.0,0.0,0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.0012709,"[40.0,0.0,4.0,-0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.5549363,"[20.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.013350483,"[0.0,-4.0,-4.0,-0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.59705853,"[40.0,4.0,0.0,0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.32066464,"[40.0,-4.0,-4.0,0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.1208482},"input_std":[[4.758569],[0.7551621],[1.1411846],[0.024509063],[0.7418195],[0.74795926],[0.75277853],[0.7348531],[0.7328033],[0.7360365],[0.73419976],[0.024163457],[0.02427521],[0.024369553],[0.024361141],[0.024596939],[0.02470201],[0.024847152]],"model_test_loss":0.011168484576046467,"input_size":18,"current_date_and_time":"2023-07-16_15-31-09","input_mean":[[24.214306],[-0.068722084],[0.13368857],[-0.012954545],[-0.0908967],[-0.08666857],[-0.07849512],[-0.042653743],[-0.027166469],[-0.009568535],[-0.001553267],[-0.013330359],[-0.013247636],[-0.013182787],[-0.013015977],[-0.013002344],[-0.012768261],[-0.012813394]],"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,"test_dict_zero_bias":{"[0.0,-4.0,4.0,0.0,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.63145995,"[0.0,0.0,4.0,-0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.6819694,"[0.0,4.0,-4.0,-0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.8772025,"[40.0,4.0,4.0,0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.55443954,"[40.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.024535596,"[40.0,-4.0,4.0,0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.7776458,"[20.0,4.0,4.0,0.0,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.82169604,"[40.0,0.0,0.0,0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.32655615,"[20.0,-4.0,4.0,0.0,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.52833325,"[40.0,-4.0,0.0,0.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.60248363,"[40.0,-4.0,4.0,-0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.2712959,"[40.0,4.0,-4.0,0.0,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.61627734,"[0.0,4.0,-4.0,0.0,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.57438755,"[0.0,-4.0,-4.0,0.0,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.8270569,"[0.0,4.0,0.0,-0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.89278406,"[0.0,4.0,-4.0,0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.2993996,"[20.0,0.0,4.0,0.0,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.39583528,"[40.0,4.0,0.0,0.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.6871477,"[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.0012517273,"[40.0,4.0,0.0,-0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.9093442,"[20.0,-4.0,0.0,0.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.70719516,"[20.0,4.0,0.0,0.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.61919284,"[0.0,0.0,-4.0,0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.6058605,"[40.0,0.0,4.0,0.0,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.38305718,"[0.0,-4.0,0.0,0.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.7314606,"[0.0,4.0,0.0,0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.31522623,"[0.0,-4.0,4.0,-0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.31417722,"[20.0,-4.0,0.0,0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.94576484,"[40.0,-4.0,0.0,0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.8632306,"[40.0,-4.0,4.0,0.0,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.50871336,"[40.0,0.0,-4.0,0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.66870224,"[40.0,4.0,4.0,-0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.0360692,"[0.0,0.0,-4.0,0.0,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.3741793,"[0.0,4.0,4.0,0.0,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.7720997,"[40.0,-4.0,-4.0,0.0,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.7928454,"[40.0,0.0,4.0,0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.09808446,"[0.0,0.0,0.0,-0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.31983182,"[20.0,0.0,-4.0,0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.63806283,"[40.0,4.0,-4.0,-0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.88232887,"[0.0,4.0,0.0,0.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.60230434,"[0.0,-4.0,4.0,0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.874546,"[40.0,-4.0,0.0,-0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.34882647,"[40.0,0.0,-4.0,-0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.10547972,"[20.0,-4.0,-4.0,-0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.52212185,"[40.0,-4.0,-4.0,-0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.51409614,"[20.0,4.0,4.0,0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.55887365,"[0.0,0.0,4.0,0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.08741653,"[20.0,4.0,-4.0,-0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.8739745,"[0.0,-4.0,0.0,-0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.42246366,"[20.0,4.0,0.0,-0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.8930687,"[0.0,0.0,-4.0,-0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.060002506,"[20.0,4.0,0.0,0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.3024186,"[20.0,4.0,-4.0,0.0,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.59369165,"[40.0,4.0,-4.0,0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.28634965,"[20.0,0.0,4.0,0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.12954244,"[0.0,4.0,4.0,0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.48957476,"[20.0,4.0,-4.0,0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.29448348,"[40.0,0.0,0.0,-0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.23015675,"[20.0,-4.0,-4.0,0.0,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.81391317,"[0.0,4.0,4.0,-0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.0366076,"[20.0,0.0,0.0,-0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.26818705,"[20.0,0.0,0.0,0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.34778464,"[20.0,0.0,4.0,-0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.6359127,"[40.0,0.0,-4.0,0.0,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.3900602,"[20.0,0.0,-4.0,-0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.09257127,"[20.0,4.0,4.0,-0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.0405408,"[20.0,-4.0,-4.0,0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.0238359,"[0.0,0.0,0.0,0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.27612492,"[20.0,0.0,-4.0,0.0,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.38687146,"[20.0,-4.0,4.0,0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.77963734,"[20.0,-4.0,4.0,-0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.26859418,"[0.0,-4.0,-4.0,0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.0187957,"[20.0,-4.0,0.0,-0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.4089293,"[0.0,0.0,4.0,0.0,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.38123727,"[40.0,4.0,4.0,0.0,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.83644295,"[0.0,-4.0,0.0,0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.9439602,"[40.0,0.0,4.0,-0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.60338587,"[20.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.04257779,"[0.0,-4.0,-4.0,-0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.5176249,"[40.0,4.0,0.0,0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.38916177,"[40.0,-4.0,-4.0,0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.0254881},"layers":[{"dense_1_b":[[-0.39623764],[0.14138116],[-0.2588534],[0.44002953],[0.22150832],[-1.471221],[1.091665]],"dense_1_W":[[-1.3643335,-0.39512777,0.49481088,-0.160357,-0.11053611,0.5127148,1.944503,-0.519241,-0.1717221,-2.2519088,0.85069805,0.16777276,0.046915065,0.07825442,-0.19920808,-0.093078785,0.22527768,-0.015349518],[0.07033132,-1.2395316,-0.015185883,0.049182996,-0.8706203,0.08936256,1.192001,0.73432046,-1.0403839,-0.99523735,0.18716313,-0.46670943,0.36377695,-0.06476297,0.29031602,-0.046463974,-0.0934093,-0.027420614],[0.036429238,0.25500375,-0.050834823,0.007870147,0.013165975,-0.2152336,-0.50505584,-0.57315665,0.43266997,0.2960198,-0.2809415,-0.16854034,-0.22267757,0.38213494,-0.32983685,0.22851394,-0.1784995,0.29428333],[0.031305227,-1.7722394,0.0051150094,-0.2393632,-0.429712,0.9946768,0.57891685,0.84168047,0.44816926,-1.2334055,0.5619671,0.3394732,-0.09925409,0.1931788,-0.7158236,-0.64525104,-0.15853617,0.7985537],[1.4468489,-0.79758126,-0.5674579,-0.089146346,0.15503111,-0.050696775,-0.41808343,-0.9180651,1.1887319,0.7490674,0.2818292,-0.05504427,0.09847831,0.24017516,-0.100371055,-0.26661357,-0.015151299,0.14749247],[-0.011997275,-0.01629248,0.0023960476,0.46332273,1.1773943,0.047555875,-1.0831845,-1.1777227,0.50374424,0.94301,-0.43155685,1.6632808,1.0289724,1.3457992,-1.3981099,0.21298541,-1.3651799,0.4583753],[-0.012068792,0.6946306,7.008868,-0.38002566,-0.8078394,-1.8026941,-1.6721241,2.1546853,0.7563132,0.12844934,0.21244754,0.028632099,-0.13106985,-0.14665121,0.10708859,1.0625329,-0.18022399,-0.35517347]],"activation":"σ"},{"dense_2_W":[[-0.10200387,-0.76644456,-0.30197436,0.88119465,0.039803542,0.35588643,-0.11579556],[-0.4315598,-0.18163718,-0.8021966,0.3789305,-0.60908353,0.2092475,-0.15666024],[0.24648495,0.5248265,1.1183228,-0.54292357,0.37333378,-0.621473,-0.2185636],[-0.44479766,0.061370973,-0.80736274,-0.06727713,-0.03573045,0.4296817,-0.6225945],[0.7770457,0.870017,0.6628652,-1.3054526,-0.24000858,-0.5467027,-0.63892704],[0.6606621,0.5903391,0.74629235,-0.30811584,0.9074003,-0.25882754,-0.49689066],[-0.61885303,-0.27397686,-0.32425815,0.5231217,0.0016664385,0.029230833,0.36123073],[0.116919406,-0.080033116,-0.80068344,0.17488338,-0.59637207,-0.25136593,-0.052427128],[-0.6091415,0.036435083,-0.31513107,1.0636747,-0.8583667,-0.050638534,-0.42107514],[-0.688126,-0.28585485,-0.74282986,0.07060043,-0.11225189,0.10933011,0.1853165],[-0.02946559,0.42606872,0.8841502,-0.08186191,0.5265807,-0.48210683,-0.32932183],[-0.103848316,-0.44215712,-0.32014853,0.7133248,-0.46932107,-0.47233966,0.028100768],[0.2052363,-0.19803643,0.61784434,-0.6395137,0.54827636,0.16492388,-0.25312033]],"activation":"σ","dense_2_b":[[-0.04292812],[-0.0074691507],[0.02623448],[-0.12690178],[-0.127359],[-0.0627155],[0.03455701],[-0.020989824],[0.17505483],[-0.009170552],[0.047454033],[-0.009859283],[-0.08406351]]},{"dense_3_W":[[-0.101136126,0.2837724,0.069948,-0.07415262,0.34190154,0.24395382,-0.19586,0.41830686,-0.3893048,-0.19336349,-0.14812821,-0.107784435,0.22945514],[0.32129276,-0.047892366,-0.15199028,0.40463585,-0.2276267,-0.27818957,0.14533494,0.21502836,-0.4884599,0.10375174,-0.41882825,0.47495985,-0.23964486],[-0.33068216,-0.40646386,0.3537997,-0.28240827,0.695928,0.32007056,-0.27887765,-0.47764063,-0.44847566,-0.5544643,0.4358929,-0.68283004,0.16520141]],"activation":"identity","dense_3_b":[[0.017270878],[-0.049352214],[0.051928796]]},{"dense_4_W":[[-0.18483475,0.37186217,-0.97547895]],"dense_4_b":[[-0.04841734]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/RAM_1500_5TH_GEN.json b/selfdrive/car/torque_data/lat_models/RAM_1500_5TH_GEN.json
new file mode 100644
index 000000000..4d77cc038
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/RAM_1500_5TH_GEN.json
@@ -0,0 +1 @@
+{"input_std":[[7.8681383],[1.2917701],[0.42320544],[0.051469278],[1.2847253],[1.2883313],[1.2900517],[1.2667522],[1.242907],[1.2112364],[1.176482],[0.051301446],[0.051339414],[0.051366985],[0.05125917],[0.05098003],[0.05050668],[0.04989228]],"model_test_loss":0.022552745416760445,"input_size":18,"current_date_and_time":"2023-08-10_00-52-59","input_mean":[[25.508078],[0.034453202],[0.01726827],[0.00056943524],[0.031399224],[0.032966],[0.034444243],[0.04235863],[0.049242016],[0.057398297],[0.06200239],[0.0005415381],[0.000549214],[0.00055187126],[0.00063792604],[0.00062618323],[0.00070369913],[0.0007498945]],"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.107602455],[0.2592419],[-0.1010373],[0.34598154],[0.8561106],[-0.15246718],[0.9970168]],"dense_1_W":[[0.0071956124,-0.8389715,0.0016946977,0.37401447,-0.27382085,-0.5530695,0.5881284,0.12836976,-0.094520785,-0.060450573,-0.028743897,-0.04453258,-0.09910858,-0.051995493,0.017620616,-0.013560951,0.18469654,-0.013240006],[1.3669219,-0.2384396,0.08245142,0.14269358,0.22758602,-0.093947925,0.5673605,-0.045786478,0.036916874,0.38647193,-0.30818498,-0.4555334,0.29512686,-0.24807432,0.4348693,-0.34444955,-0.11027862,0.016942881],[0.013133192,-1.1178136,0.034996957,0.48028773,0.09731058,-0.693922,0.49429983,0.01820859,-0.037673093,-0.13616005,0.02270395,-0.69734114,-0.07626221,0.2784788,0.007214682,0.07223958,-0.011835337,-0.070404634],[0.0054024686,0.52874875,3.438241,-0.21533473,-2.068417,-1.530317,-2.6102667,-1.1109601,2.2420053,3.6071155,1.1157349,0.3809812,0.5365094,-0.52533704,0.02788547,0.4045346,0.24486302,-1.008144],[1.682156,-0.052193947,-0.09770653,-0.45150465,0.2333314,-0.5347695,0.09825678,-0.01992122,-0.1994097,0.116743915,0.16566196,0.20611681,0.6852969,-0.45614037,0.27821264,0.09751711,-0.02198396,0.04035941],[-0.002443684,-0.78855264,-0.014614094,-0.026071582,-0.10583151,-0.38199013,1.0572444,-0.18948583,-0.35938174,0.013804459,0.15949139,-0.7269957,-0.20543943,0.52785945,0.2962705,0.26196185,0.21384726,-0.39327204],[1.5940213,0.11492236,0.090780675,-0.32562405,-0.034105282,0.53610796,-0.4663451,0.38666242,-0.17008422,0.10295398,-0.2042109,0.31005463,-0.28528133,-0.21527892,0.22701246,0.018739212,-0.024669824,-0.04890493]],"activation":"σ"},{"dense_2_W":[[0.6139993,0.3757347,-0.1356616,0.085909925,-0.12511243,0.15788122,-0.031210706],[0.4353305,0.18801172,0.12204481,-0.118660524,0.31724608,0.7373148,-0.5507885],[-1.3431091,0.006327765,-0.48985648,1.2948128,-0.1034634,-0.6535869,1.5181615],[-0.89554805,-0.0707852,-0.38398325,-0.99453413,0.23394457,-1.3053,0.70568514],[-1.060718,-0.08779857,-0.34332564,0.93365616,-1.0663359,-1.5535986,0.9410223],[0.3106728,0.011034138,0.2690925,0.20874923,0.3430892,0.7928498,-0.7562942],[-0.9156255,-0.59965265,-0.23466443,1.0020962,-1.8364218,-1.0228359,1.0616008],[-0.6956375,-0.44040835,-1.0947623,0.5968099,-0.049048502,-1.2266653,1.1614286],[0.3183038,-0.35872775,0.13763095,-0.28848255,-0.050387893,0.39608815,-0.54269797],[0.5095539,-0.24931525,0.40140435,-0.27532217,0.13700272,0.57273823,-0.6925308],[-0.32013652,-3.1370046,-2.7840195,1.34559,-0.84404,-0.6845122,-0.5461476],[-0.72196037,0.038392793,0.057249792,-0.44615316,-0.0024790815,-1.1388366,0.36243963],[0.67724824,0.28425425,0.12925239,-0.22140531,0.5270677,0.15986088,-0.1314976]],"activation":"σ","dense_2_b":[[-0.14464946],[-0.15859996],[0.65735745],[0.28288272],[0.48416847],[-0.120317705],[0.17381315],[1.3373141],[-0.15882145],[-0.21813588],[1.288298],[-0.09495147],[-0.11485835]]},{"dense_3_W":[[0.52467114,0.573881,-0.37257165,-0.2885695,-0.73502827,0.5044393,-0.35882697,-0.32937768,0.40931723,0.33977678,-0.3444813,0.08750891,0.54127914],[0.0466505,0.44103855,0.41321534,0.5304071,-0.15150255,-0.293208,-0.13094401,0.05617865,-0.2815031,-0.25879386,0.09075154,0.71288633,-0.43692803],[-0.40456718,0.20321198,0.27640694,0.09131404,-0.27206296,-0.24663389,-0.60239804,-0.46262908,-0.07054595,-0.2889505,-0.20886894,-0.095937446,-0.075776964]],"activation":"identity","dense_3_b":[[-0.1063788],[0.09727621],[-0.08167072]]},{"dense_4_W":[[-1.0752603,0.4178708,-0.3472837]],"dense_4_b":[[0.10501918]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/RAM_HD_5TH_GEN.json b/selfdrive/car/torque_data/lat_models/RAM_HD_5TH_GEN.json
new file mode 100644
index 000000000..0b9abe7fb
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/RAM_HD_5TH_GEN.json
@@ -0,0 +1 @@
+{"input_std":[[6.5132856],[1.3632272],[1.5413244],[0.03303396],[1.3259029],[1.3417274],[1.3554335],[1.3285728],[1.3114035],[1.2910824],[1.2723991],[0.03297938],[0.03299731],[0.033014063],[0.033058062],[0.033087354],[0.033028472],[0.032748375]],"model_test_loss":0.020962899550795555,"input_size":18,"current_date_and_time":"2023-09-02_21-03-03","input_mean":[[26.374321],[0.24099204],[0.0014719056],[-0.017563006],[0.24074426],[0.24266605],[0.2428761],[0.2323719],[0.23110531],[0.23507003],[0.24088627],[-0.017492866],[-0.01751848],[-0.017543415],[-0.01748686],[-0.01742368],[-0.017475272],[-0.01757139]],"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.079944834],[-0.3598381],[0.09434822],[-1.3233447],[0.1130735],[-0.45763284],[-0.6268566]],"dense_1_W":[[-0.073462725,-3.7294142,0.008516538,-0.1984018,0.6034948,1.8619602,2.1633458,-1.9060298,0.40978914,-0.37825182,0.611484,-0.36018258,0.27376932,0.3118703,0.036994077,0.21737134,-0.12771696,-0.040260702],[-0.20176645,0.57531285,-0.0084412275,-0.17881922,0.9809269,-0.16568676,-0.58166283,-0.1486564,0.70059836,-0.29893303,0.21570963,0.3508427,-0.3873581,0.06504418,-0.021596037,0.23897065,-0.22310819,0.10423835],[-0.06450743,-0.7734916,-7.4385157,0.34980673,2.380512,3.2428308,3.075309,-3.6599858,-2.5296397,-0.5446167,-0.94137996,-0.59157187,-0.07057616,0.11925076,0.08353299,0.38889635,-0.23567261,-0.1015343],[-0.28985357,-1.5797744,0.0060979226,-0.031419355,-0.400295,0.3806542,0.11740358,-0.0064864187,-0.12764077,-0.04428382,-0.07560065,0.17292799,0.12330137,-0.27197468,0.29182738,-0.2540429,0.13684034,-0.04889033],[-0.07832161,2.1902764,0.030133046,-0.30596706,-0.7210498,0.027130641,0.6432982,-0.046274744,-0.5472184,0.70929205,-0.24650635,0.53280306,-0.48029587,0.12250029,-0.11553079,-0.13253216,-0.029158924,0.18207467],[-2.8597453,-0.43466172,-0.18268725,-0.060400605,0.28060955,-0.18074062,-0.6875857,-0.38406757,-0.37214103,-0.9286758,-0.38446707,0.15134443,0.054654,0.48821846,-0.004988523,0.06868294,-0.033809625,-0.047231436],[-0.0017858031,-0.6662176,0.0051888903,-0.06294718,-0.90392506,-0.8541502,-0.16361657,0.08513459,-0.07875049,0.0790174,-0.13931915,0.0140639525,0.017838055,0.1625987,0.25675306,0.18861753,-0.18611054,-0.059609663]],"activation":"σ"},{"dense_2_W":[[-0.6968983,0.27608687,0.10406441,-0.024237338,-0.42272064,-0.013714595,-0.54531485],[-0.67445093,0.32921025,0.36817434,0.06642965,-0.042997025,-0.32730803,-0.5889611],[-0.340392,-0.03912806,0.46399808,-0.4680018,-0.49668282,0.16590515,0.21437873],[-0.46547934,0.07344197,-0.12238069,-0.0253223,0.49247265,-0.25569054,-0.57428217],[0.41493058,-0.27931592,-0.089011,0.08059608,-0.5250433,0.09186349,0.07772292],[-0.3727222,-0.15556182,0.3317168,-0.14912905,-0.17529897,0.48200855,0.6279147],[-0.31705967,0.10656132,0.34339988,-0.63882726,0.055984847,0.45991278,-0.6692897],[0.15874985,-0.119392134,-0.19742353,-0.60957354,0.18357219,0.28318337,-0.25417072],[-0.37113652,0.43916598,0.27193624,-0.520228,-0.2144683,0.3655652,-0.53570765],[0.83260417,-1.699712,2.6747808,1.3270547,-0.96657324,0.093039535,-0.45796528],[0.45241207,0.39900452,-0.50378394,-0.20505324,0.45373067,-0.19082053,-0.22071704],[-0.5270052,0.45971948,0.3313946,-0.29207435,0.1978061,0.19034018,-0.23600237],[0.9750541,-0.7961233,-0.0005789574,1.0066968,-0.9369118,0.042760722,0.18730567]],"activation":"σ","dense_2_b":[[-0.20384558],[-0.20811413],[-0.0037139736],[0.023454173],[-0.015772115],[-0.0065609645],[0.0068738465],[0.009471401],[0.003985857],[-0.9329477],[0.010725975],[-0.013339677],[-0.2815146]]},{"dense_3_W":[[-0.4011974,-0.33610415,0.13164108,0.33895674,0.06529623,-0.1580419,0.26291764,-0.24552977,-0.3933592,0.13941231,-0.35621086,0.5489147,-0.086336456],[0.1649218,-0.31881985,-0.48512995,0.2596072,-0.5807467,-0.19014847,0.5032025,-0.22611593,0.22070079,-0.30926946,0.35143164,0.12860067,0.1903238],[0.17895938,0.46517286,0.3067372,-0.06601107,-0.3844143,-0.499728,0.46086124,0.58410454,0.52920264,-0.4394692,0.23419406,0.01974897,-0.5022407]],"activation":"identity","dense_3_b":[[-0.0035552178],[-0.0043843286],[-0.0047028256]]},{"dense_4_W":[[0.80738455,0.86131907,1.2868857]],"dense_4_b":[[-0.0045010163]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/SKODA_KAROQ_MK1.json b/selfdrive/car/torque_data/lat_models/SKODA_KAROQ_MK1.json
new file mode 100644
index 000000000..b4ce6b0ba
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/SKODA_KAROQ_MK1.json
@@ -0,0 +1 @@
+{"test_dict":{"[0.0,-4.0,4.0,0.0,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.5380118,"[0.0,0.0,4.0,-0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.5668384,"[0.0,4.0,-4.0,-0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.49744788,"[40.0,4.0,4.0,0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":1.1069546,"[40.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.022589128,"[40.0,-4.0,4.0,0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.87991786,"[20.0,4.0,4.0,0.0,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":1.3465033,"[40.0,0.0,0.0,0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.35901418,"[20.0,-4.0,4.0,0.0,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.74537796,"[40.0,-4.0,0.0,0.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-1.0467105,"[40.0,-4.0,4.0,-0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.40654802,"[40.0,4.0,-4.0,0.0,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.22541186,"[0.0,4.0,-4.0,0.0,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.39508894,"[0.0,-4.0,-4.0,0.0,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-1.5349423,"[0.0,4.0,0.0,-0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.3032231,"[0.0,4.0,-4.0,0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.09337339,"[20.0,0.0,4.0,0.0,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.43609616,"[40.0,4.0,0.0,0.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":1.187037,"[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.03238472,"[40.0,4.0,0.0,-0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.3256767,"[20.0,-4.0,0.0,0.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-1.2560252,"[20.0,4.0,0.0,0.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":1.269817,"[0.0,0.0,-4.0,0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.90431225,"[40.0,0.0,4.0,0.0,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.39230934,"[0.0,-4.0,0.0,0.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-1.3635288,"[0.0,4.0,0.0,0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.9773381,"[0.0,-4.0,4.0,-0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.329567,"[20.0,-4.0,0.0,0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.3380291,"[40.0,-4.0,0.0,0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.2777746,"[40.0,-4.0,4.0,0.0,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.82472456,"[40.0,0.0,-4.0,0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.7643237,"[40.0,4.0,4.0,-0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.3661834,"[0.0,0.0,-4.0,0.0,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.849533,"[0.0,4.0,4.0,0.0,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":1.1835219,"[40.0,-4.0,-4.0,0.0,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-1.2257897,"[40.0,0.0,4.0,0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.032864716,"[0.0,0.0,0.0,-0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.32149622,"[20.0,0.0,-4.0,0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.88784707,"[40.0,4.0,-4.0,-0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.523679,"[0.0,4.0,0.0,0.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":1.157843,"[0.0,-4.0,4.0,0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.81264627,"[40.0,-4.0,0.0,-0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.847208,"[40.0,0.0,-4.0,-0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.5404857,"[20.0,-4.0,-4.0,-0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-1.2102542,"[40.0,-4.0,-4.0,-0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-1.2051469,"[20.0,4.0,4.0,0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":1.146302,"[0.0,0.0,4.0,0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.4661444,"[20.0,4.0,-4.0,-0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.49748513,"[0.0,-4.0,0.0,-0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-1.0818156,"[20.0,4.0,0.0,-0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.3345778,"[0.0,0.0,-4.0,-0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.347531,"[20.0,4.0,0.0,0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.8679907,"[20.0,4.0,-4.0,0.0,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.29394773,"[40.0,4.0,-4.0,0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.09643532,"[20.0,0.0,4.0,0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.19364843,"[0.0,4.0,4.0,0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":1.1680533,"[20.0,4.0,-4.0,0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.17557147,"[40.0,0.0,0.0,-0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.21844473,"[20.0,-4.0,-4.0,0.0,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-1.50774,"[0.0,4.0,4.0,-0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.3670707,"[20.0,0.0,0.0,-0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.40873116,"[20.0,0.0,0.0,0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.35878894,"[20.0,0.0,4.0,-0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.60975885,"[40.0,0.0,-4.0,0.0,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.55742276,"[20.0,0.0,-4.0,-0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.505599,"[20.0,4.0,4.0,-0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.3681715,"[20.0,-4.0,-4.0,0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.5387529,"[0.0,0.0,0.0,0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.35331953,"[20.0,0.0,-4.0,0.0,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.60687315,"[20.0,-4.0,4.0,0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.86639714,"[20.0,-4.0,4.0,-0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.27491,"[0.0,-4.0,-4.0,0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.5394888,"[20.0,-4.0,0.0,-0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.7878668,"[0.0,0.0,4.0,0.0,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.5126742,"[40.0,4.0,4.0,0.0,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":1.3503757,"[0.0,-4.0,0.0,0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.439768,"[40.0,0.0,4.0,-0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.5785763,"[20.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.010508742,"[0.0,-4.0,-4.0,-0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-1.2693633,"[40.0,4.0,0.0,0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.8410233,"[40.0,-4.0,-4.0,0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.5314865},"input_std":[[7.989791],[0.7320975],[0.5846287],[0.035815567],[0.7283375],[0.7326722],[0.7346924],[0.7248922],[0.73135966],[0.7329609],[0.7217711],[0.03612053],[0.036042064],[0.035952937],[0.035485364],[0.03517163],[0.034833923],[0.034284007]],"model_test_loss":0.008391334675252438,"input_size":18,"current_date_and_time":"2023-07-16_20-00-17","input_mean":[[20.655447],[0.024584128],[-0.044770714],[-0.0072627976],[0.031237675],[0.029807081],[0.028027987],[0.009196148],[0.008076342],[-0.0015783679],[-0.0010444114],[-0.0072330763],[-0.0072172945],[-0.0072000716],[-0.007262945],[-0.0073047676],[-0.007441227],[-0.0077096256]],"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,"test_dict_zero_bias":{"[0.0,-4.0,4.0,0.0,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.39948598,"[0.0,0.0,4.0,-0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.6295606,"[0.0,4.0,-4.0,-0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.65359616,"[40.0,4.0,4.0,0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":1.2675315,"[40.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.061416015,"[40.0,-4.0,4.0,0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.76222944,"[20.0,4.0,4.0,0.0,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":1.4814665,"[40.0,0.0,0.0,0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.33280456,"[20.0,-4.0,4.0,0.0,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.5849962,"[40.0,-4.0,0.0,0.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-1.0883316,"[40.0,-4.0,4.0,-0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.20698664,"[40.0,4.0,-4.0,0.0,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.33144438,"[0.0,4.0,-4.0,0.0,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.5527949,"[0.0,-4.0,-4.0,0.0,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-1.402524,"[0.0,4.0,0.0,-0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.1805307,"[0.0,4.0,-4.0,0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.094053596,"[20.0,0.0,4.0,0.0,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.5350164,"[40.0,4.0,0.0,0.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":1.342611,"[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.12336916,"[40.0,4.0,0.0,-0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.4533029,"[20.0,-4.0,0.0,0.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-1.2709537,"[20.0,4.0,0.0,0.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":1.2863967,"[0.0,0.0,-4.0,0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.85154873,"[40.0,0.0,4.0,0.0,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.55498785,"[0.0,-4.0,0.0,0.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-1.2663321,"[0.0,4.0,0.0,0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.8637229,"[0.0,-4.0,4.0,-0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.23138924,"[20.0,-4.0,0.0,0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.3381034,"[40.0,-4.0,0.0,0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.3081448,"[40.0,-4.0,4.0,0.0,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.69880867,"[40.0,0.0,-4.0,0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.7338842,"[40.0,4.0,4.0,-0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.5125997,"[0.0,0.0,-4.0,0.0,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.74419975,"[0.0,4.0,4.0,0.0,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":1.3198262,"[40.0,-4.0,-4.0,0.0,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-1.1027677,"[40.0,0.0,4.0,0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.11119664,"[0.0,0.0,0.0,-0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.21705788,"[20.0,0.0,-4.0,0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.8385861,"[40.0,4.0,-4.0,-0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.5986935,"[0.0,4.0,0.0,0.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":1.0079983,"[0.0,-4.0,4.0,0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.70014787,"[40.0,-4.0,0.0,-0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.80401677,"[40.0,0.0,-4.0,-0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.49810106,"[20.0,-4.0,-4.0,-0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-1.066942,"[40.0,-4.0,-4.0,-0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-1.0737326,"[20.0,4.0,4.0,0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":1.2979757,"[0.0,0.0,4.0,0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.56554705,"[20.0,4.0,-4.0,-0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.6396831,"[0.0,-4.0,0.0,-0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.9987763,"[20.0,4.0,0.0,-0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.3704159,"[0.0,0.0,-4.0,-0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.17107952,"[20.0,4.0,0.0,0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.89600575,"[20.0,4.0,-4.0,0.0,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.48579958,"[40.0,4.0,-4.0,0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.18861425,"[20.0,0.0,4.0,0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.36363924,"[0.0,4.0,4.0,0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":1.3085387,"[20.0,4.0,-4.0,0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.048344463,"[40.0,0.0,0.0,-0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.3228795,"[20.0,-4.0,-4.0,0.0,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-1.3889711,"[0.0,4.0,4.0,-0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.5090332,"[20.0,0.0,0.0,-0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.35560045,"[20.0,0.0,0.0,0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.45501107,"[20.0,0.0,4.0,-0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.70604444,"[40.0,0.0,-4.0,0.0,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.50033605,"[20.0,0.0,-4.0,-0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.37736052,"[20.0,4.0,4.0,-0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.5132567,"[20.0,-4.0,-4.0,0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.4097024,"[0.0,0.0,0.0,0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.40884608,"[20.0,0.0,-4.0,0.0,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.5351974,"[20.0,-4.0,4.0,0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.7473452,"[20.0,-4.0,4.0,-0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.13379052,"[0.0,-4.0,-4.0,0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.409246,"[20.0,-4.0,0.0,-0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.7862364,"[0.0,0.0,4.0,0.0,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.5806613,"[40.0,4.0,4.0,0.0,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":1.5019659,"[0.0,-4.0,0.0,0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.348442,"[40.0,0.0,4.0,-0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.69009113,"[20.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.08894949,"[0.0,-4.0,-4.0,-0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-1.1496372,"[40.0,4.0,0.0,0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.9766548,"[40.0,-4.0,-4.0,0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.4074421},"layers":[{"dense_1_b":[[1.2601088],[0.50795346],[-0.32973284],[-0.4278964],[-1.3286078],[0.99765503],[0.4339966]],"dense_1_W":[[0.39427435,1.5991782,0.0038050977,0.05548223,-0.04591027,-0.2224138,-0.627583,1.6541553,-0.17021364,0.0030925316,-0.277334,0.016327249,0.38390467,-0.043327343,-0.3199062,-0.24170461,-0.03311468,0.21610846],[2.0976179,-0.39388067,-0.02243466,-0.058260668,1.7147076,0.66427886,-0.5170263,-0.5367035,-0.5689552,0.20077214,0.29552126,-0.1721181,-0.46311033,-0.34615812,-0.0888081,-0.18715298,0.16055387,-0.35338402],[-1.5097122,0.621122,-0.105104305,-0.18648383,1.1042429,0.77002937,-0.6538228,-0.44171673,-1.0661969,-0.14405254,-0.44617876,0.24370627,-0.19782393,0.19933222,-0.35169846,0.094613805,0.40841854,-0.25420657],[-0.009321846,1.7888899,5.6288323,-0.05019591,-1.6935351,-1.3057272,-1.5961826,1.3134946,0.88433415,1.1306716,-0.14263214,-0.25278306,0.2156381,-0.15768535,0.17491388,0.10185023,-0.057640597,-0.037920576],[-0.6545767,-0.7725577,-0.043511603,0.39719597,0.44334525,-0.29454172,1.1796441,-0.43937585,-0.008846232,0.3591864,-0.6636783,-0.19979312,0.10855517,0.07740657,-0.16985726,-0.3615132,0.19928159,0.004342849],[0.43667847,-1.4340503,0.0061377757,0.02465778,-0.0052791275,-0.21163116,0.3254924,-0.83517593,0.3075678,-0.17314681,0.21212056,-0.5718453,0.25654393,0.030458353,0.27716112,0.18619251,-0.166307,-0.07792453],[0.6207286,-0.74188787,0.0014747722,0.19179606,0.21235986,0.023669226,1.3397173,-1.0746361,-0.6413778,0.07621638,0.2610392,-0.14456956,0.40803775,-0.25941938,0.1692598,-0.019315228,0.32499546,-0.2848976]],"activation":"σ"},{"dense_2_W":[[0.5846105,-1.1216323,0.012021069,0.519304,-1.2193648,-1.2420696,-0.9293579],[0.31864703,-0.029731255,0.39742234,0.43330926,-0.8345377,-0.45988193,-0.52471954],[-0.48068455,-0.14217594,-0.052064557,-0.05625134,0.531164,0.07339243,0.5302106],[-0.046448767,0.46001384,0.3322486,0.16847979,-0.012636936,-0.58880013,-0.039295547],[0.12264031,1.0059353,-0.25489268,-1.3256443,-1.3072578,-1.6475178,-0.24379867],[0.31735018,-0.26441798,-0.47050726,-0.44442534,0.295501,0.37262294,-0.3538891],[-0.16229963,-0.6157792,-0.3740346,0.06780694,0.21299857,-0.38519585,-0.64304954],[-0.57181144,0.0069005713,0.3935489,-0.05499202,0.48840258,0.091699615,-0.16876978],[-0.5405887,0.3622075,-0.65014505,-0.45285606,-0.744763,-0.6536307,-0.75167125],[-0.78169376,-0.41184205,-0.33792898,-0.32395944,-0.017056243,0.4648398,0.5686303],[0.75694907,-0.031489003,0.5235601,-0.03767089,-1.0404472,-0.4519171,-0.42058164],[0.7886114,0.5415332,0.15376541,0.5960243,-0.46606156,-0.8066629,-0.5520896],[-0.71171945,-0.42530975,-0.26570597,-0.23765114,0.702833,0.00345897,0.07370162]],"activation":"σ","dense_2_b":[[0.25844958],[-0.08529898],[-0.009525728],[-0.06614882],[-0.35542876],[0.0096092895],[-0.21220195],[-0.0058748396],[-0.17085731],[0.029518519],[-0.0972837],[0.04010498],[-0.0016747463]]},{"dense_3_W":[[-0.18374792,-0.50147384,-0.49204373,-0.5885765,0.39067307,0.540897,0.4194,0.56657135,0.32507578,0.05896129,-0.2124288,0.12981957,0.57857627],[-0.47317266,-0.6505695,0.60085654,-0.061350014,-0.4325399,-0.13409662,-0.28602767,-0.07301156,-0.21435276,0.73678,-0.27858484,-0.6291994,0.7327412],[-0.33367744,0.4530852,0.011034279,-0.47386295,-0.26150367,0.42310083,0.4337839,0.22710037,-0.19489768,0.16766186,0.013165514,0.4446457,0.35002133]],"activation":"identity","dense_3_b":[[0.026227264],[0.040914938],[0.029111717]]},{"dense_4_W":[[-0.19691564,-1.2166661,-0.37322426]],"dense_4_b":[[-0.03747132]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/SKODA_KODIAQ_MK1.json b/selfdrive/car/torque_data/lat_models/SKODA_KODIAQ_MK1.json
new file mode 100644
index 000000000..a4416943e
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/SKODA_KODIAQ_MK1.json
@@ -0,0 +1 @@
+{"input_std":[[8.8827505],[0.8142013],[0.43200606],[0.0335122],[0.8031897],[0.80755675],[0.8117341],[0.7966046],[0.78498024],[0.76929677],[0.7570983],[0.033453178],[0.033477545],[0.033494856],[0.033401415],[0.033346288],[0.033206854],[0.033045664]],"model_test_loss":0.014859683811664581,"input_size":18,"current_date_and_time":"2023-08-10_08-29-12","input_mean":[[21.130602],[-0.03657342],[-0.007161284],[-0.014905003],[-0.031632286],[-0.032585967],[-0.03383271],[-0.03620179],[-0.033439096],[-0.028820572],[-0.025867859],[-0.014983235],[-0.014939225],[-0.014891624],[-0.014817177],[-0.014846561],[-0.014888054],[-0.015024225]],"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.058770206],[-0.4304619],[-0.95764273],[0.9789649],[0.3071246],[-1.0843322],[0.29053277]],"dense_1_W":[[1.1150838,0.26620921,0.25107178,0.17738831,-0.023969606,-0.25568375,0.642087,-0.07235758,0.50214267,0.158553,-0.09377773,-0.22190028,-0.2522553,0.41755903,-0.18087326,0.00043216505,0.30621696,-0.21445055],[0.015974922,-0.84892243,-5.3681054,-0.050087623,-0.2124193,-0.42669013,-0.114291534,-0.23167059,0.030389197,0.10423019,0.94438344,-0.23461752,-0.038574662,0.0118201375,0.1480159,0.12792908,-0.10750315,0.12776713],[-0.5820234,-0.46031782,-0.16132316,-0.0877754,0.45185134,-1.3221487,0.9612837,-0.026405975,-0.2516217,-0.06304958,-0.007870968,-0.45073366,0.26110536,0.3053481,0.032379672,0.058629666,-0.16963068,0.04947794],[0.55877084,0.8845751,0.083844095,-0.5641011,-0.32626018,0.87646186,0.018245557,0.0067298566,0.19446261,-0.108108655,-0.006403946,0.045923747,-0.2118138,0.297809,0.30262896,-0.26306453,0.10386135,0.05455493],[1.2901627,-0.3996759,-0.28787684,0.18365255,0.053760547,0.09131756,-0.5133632,0.09711644,-0.6057078,-0.13895018,0.07327148,0.005111278,-0.07828046,-0.12552834,0.103638284,-0.18598253,0.030758386,0.011194429],[-0.4342015,0.51031667,0.1613037,-0.030471211,-0.47826028,0.91528296,-0.59053975,0.06803067,0.2916587,0.011835373,-0.01411119,0.39738727,-0.3548122,0.093028545,-0.5990489,0.45427456,0.20879458,-0.16441117],[0.24265775,-0.87913877,-0.073302165,0.13811685,0.17514472,-0.79730994,0.32166055,-0.056882083,-0.15787257,-0.026820026,0.09571887,-0.09280119,-0.31957984,0.5578229,-0.14536849,0.12825605,0.16227205,-0.22222283]],"activation":"σ"},{"dense_2_W":[[0.4287232,0.05141774,0.08859513,0.16694608,-0.25920102,-0.2550965,0.045888633],[-0.9586875,0.465085,-1.0644909,0.51924497,0.9285218,0.19630893,-0.8210365],[0.9428464,1.0110649,0.0912787,0.45720592,0.062315438,0.06551054,0.21646087],[-0.07554614,-0.20435923,1.3854393,-0.21705866,0.371234,-0.29250124,0.62470865],[-1.2622341,-2.4971948,0.16009766,-0.7064093,-1.3925549,0.670143,-0.65157413],[-0.2641713,0.1407864,-0.7451972,0.05855014,0.46847665,0.5723797,-0.2294421],[-0.2798032,-0.28557223,-0.9484105,0.7195964,0.5352625,1.0608548,-0.7886381],[0.85884315,0.05392705,0.63131255,-0.55358535,-0.62303364,-0.9995628,0.95493674],[-0.25178987,-0.46490377,-0.7359025,0.15180402,0.27750358,1.2637253,-1.2951062],[-0.16450088,-1.0085304,-0.35299447,-0.53890646,-0.97189784,0.22255774,-0.34916818],[0.017366037,-0.47484067,-0.9362656,0.73510003,0.57900065,1.098403,-0.34750253],[1.0237606,1.1220717,0.5213622,0.46244594,0.1062727,-0.8956484,0.4866493],[-0.54411316,-0.14556162,-0.49516523,-0.41195434,-0.012445791,0.29190034,0.08672975]],"activation":"σ","dense_2_b":[[-0.14722908],[0.09051571],[0.0073402002],[0.049312294],[-0.10615275],[-0.09993395],[0.14013591],[-0.09219207],[-0.04097555],[-0.44420165],[0.23860474],[0.12013257],[-0.11851125]]},{"dense_3_W":[[0.012701052,-0.76359975,-0.11508211,0.8544662,-0.78156996,-0.3141182,-0.53640413,0.8538724,-0.2971632,-0.16812785,-0.5316125,0.75913155,-0.26657495],[0.2436656,-0.53503543,-0.0021990442,0.45916784,-0.1381139,0.4441993,-0.05345697,-0.33151543,0.0037798227,-0.5038917,-0.15709756,0.02627418,0.5737324],[0.004380816,-0.7665436,0.4899415,0.62682587,-0.6219003,-0.4759317,-0.62745434,0.6913393,-0.47453716,0.23334874,-0.62208974,0.22364703,-0.43715024]],"activation":"identity","dense_3_b":[[0.13937238],[-0.015101592],[0.007283584]]},{"dense_4_W":[[-0.5961717,-0.32134253,-0.7058984]],"dense_4_b":[[0.008483538]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/SKODA_OCTAVIA_MK3.json b/selfdrive/car/torque_data/lat_models/SKODA_OCTAVIA_MK3.json
new file mode 100644
index 000000000..4f65316dc
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/SKODA_OCTAVIA_MK3.json
@@ -0,0 +1 @@
+{"input_std":[[9.094625],[0.9343503],[0.47275993],[0.039587528],[0.91534966],[0.92308986],[0.92961305],[0.9121938],[0.894315],[0.8712891],[0.84302557],[0.039629184],[0.03963656],[0.039634563],[0.039580777],[0.03957161],[0.039473023],[0.039480753]],"model_test_loss":0.010150332003831863,"input_size":18,"current_date_and_time":"2023-08-10_11-03-32","input_mean":[[21.930943],[-0.009137672],[0.004150357],[0.006063881],[-0.012747505],[-0.012902961],[-0.012921325],[-0.0107959015],[-0.009959326],[-0.007661503],[-0.0022189163],[0.005970253],[0.0059734355],[0.005978737],[0.0060841083],[0.0061559486],[0.006342566],[0.006470583]],"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":[[-1.0016042],[0.30121937],[0.5243282],[-0.37925154],[0.09780045],[-1.280653],[0.939577]],"dense_1_W":[[1.9456844,-0.23871988,-0.00096057716,-0.120664135,0.6110457,0.9801692,-0.49786648,-0.3335355,-0.16192155,0.2149353,0.18063189,-0.060477342,0.32169268,-0.21911122,-0.31224453,-0.06690952,-0.348577,0.2574717],[0.8044473,0.40910536,-0.00077739207,-0.1332547,-0.44118187,0.09815779,-1.422512,-0.1586437,0.00079494115,-0.27336416,0.036574032,0.10625827,0.2505548,-0.37372994,0.04841167,0.24479657,-0.18796268,0.14709403],[-1.9839507,-0.07971294,0.0019432222,-0.1465764,0.47511905,1.4785819,-0.6126462,-0.8653647,-0.006930718,-0.05133041,0.4208154,0.3623695,-0.07688759,-0.46326146,0.049198236,-0.29932696,-0.10871309,0.13249245],[-0.01090139,1.4570909,2.8342102,-0.48148742,0.35504207,0.8265004,0.22427893,-0.44684047,0.87371486,0.41123086,0.05926164,-0.3498932,-0.20314151,-0.4126248,0.6597188,0.18670116,-0.13712086,0.04479702],[-0.017381541,-0.7597381,-3.9741704,0.966278,-0.8725842,-1.0976232,1.3351153,0.36389372,0.6396286,-0.28108513,0.5655249,-0.3259955,0.2685084,0.3538014,-0.99265057,0.0020220215,0.08644423,-0.016739462],[-0.4040077,1.5493203,-0.0015337409,-0.057152465,-0.4507684,1.1744777,-0.84242934,0.26143765,0.5450927,-0.16338348,-0.12852266,-0.04006952,0.61630785,-0.35684994,-0.26787806,-0.173013,0.1754258,-0.055330947],[0.14463891,1.3947294,0.0005817746,-0.11709302,-0.47823873,0.9985025,-0.5435925,0.28843075,0.4257345,-0.07990765,-0.15169789,0.049027964,0.32417342,-0.14295861,-0.21804018,-0.1728184,0.25523916,-0.118601166]],"activation":"σ"},{"dense_2_W":[[-0.13598546,0.48721725,-0.8770504,-0.10435272,1.2942611,-0.6188507,-0.77000535],[0.2963742,-0.06368987,-0.6158674,0.5706844,-0.62964815,-0.6725343,-0.70922905],[-0.65155697,-0.40622166,0.22409256,-0.5447109,0.30369374,-0.6313153,-0.47783092],[-0.25578108,-0.23481992,0.6473863,-0.4388097,-0.16786619,-0.24785686,0.13121009],[-0.7862219,-0.51441395,0.14683217,0.16958761,0.822131,-0.8929698,-0.9890509],[-0.11013757,0.13794002,-0.2200882,-0.5511851,-0.7512739,-0.34854394,-0.20708162],[-0.26325488,-0.068378806,0.30052987,0.44717714,-0.19997324,0.36592284,0.37900636],[-0.56599057,-0.20042972,-0.51274085,0.27466905,0.329293,-0.9691359,-0.2049081],[-0.084157735,-0.6273445,0.22159277,-0.27066445,-0.27510265,-0.6879669,-0.9523734],[0.40842152,0.49088025,0.24065876,0.17004599,-0.26951402,0.06465446,0.33384213],[0.5391135,-0.5008811,0.4018758,0.16503108,-0.49227586,0.34286293,-0.2673176],[0.031132208,0.06428439,-0.086133376,0.35238424,-0.34203455,0.54796845,0.7357129],[0.060671475,0.49638665,0.6812915,-0.52441,0.41805837,0.5390166,-0.07453658]],"activation":"σ","dense_2_b":[[1.0358273],[-0.024130732],[0.059400935],[-0.027526159],[0.09260186],[-0.20580374],[-0.062025692],[0.39389342],[0.077137515],[-0.09825774],[-0.051716425],[-0.084061615],[-0.025274398]]},{"dense_3_W":[[-0.14006962,0.5902041,0.18080363,0.48413566,0.33100846,-0.11978409,-0.63116825,-0.13776208,0.29580384,-0.17148037,0.22820434,-0.15557605,0.31175599],[0.37938893,-0.13863787,0.45991153,-0.014412937,0.30609646,-0.023109397,-0.64584565,0.093050435,0.42860112,-0.40409505,-0.398128,-0.640976,-0.17863272],[-0.34660983,-0.50709665,-0.55247855,0.5898295,-0.4875454,-0.35633042,-0.19656834,-0.66706467,-0.4074692,-0.3361508,0.117474474,-0.3539698,0.6108807]],"activation":"identity","dense_3_b":[[-0.022861203],[-0.014076285],[0.034564495]]},{"dense_4_W":[[-0.60573244,-0.98281205,0.80961186]],"dense_4_b":[[0.019623742]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/SKODA_SUPERB_MK3.json b/selfdrive/car/torque_data/lat_models/SKODA_SUPERB_MK3.json
new file mode 100644
index 000000000..74f3bb7e6
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/SKODA_SUPERB_MK3.json
@@ -0,0 +1 @@
+{"input_std":[[11.005025],[0.97968346],[0.50101554],[0.038736638],[0.9587485],[0.9655901],[0.971756],[0.95295596],[0.9315219],[0.90679765],[0.8827432],[0.038590446],[0.03862441],[0.03865234],[0.03871767],[0.038792223],[0.03873497],[0.03861525]],"model_test_loss":0.010799731127917767,"input_size":18,"current_date_and_time":"2023-08-10_12-21-52","input_mean":[[22.878464],[0.031642012],[0.0168804],[0.009622783],[0.030209461],[0.030093499],[0.03104034],[0.038059395],[0.040959135],[0.040258918],[0.040640317],[0.009454411],[0.009486841],[0.009516454],[0.009592338],[0.009573765],[0.009518463],[0.009365908]],"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":[[-2.1818612],[-0.09344887],[-1.8393922],[1.848314],[1.0065805],[-0.08666866],[0.7747504]],"dense_1_W":[[-0.8857707,1.5844063,-2.7639117,0.8296629,-1.5801734,-1.389664,0.6718809,0.21833602,-0.3579308,0.031948198,0.036747955,0.14046027,-0.10389215,0.24267684,-0.58785427,-0.29687718,-0.071204364,0.17921484],[-0.016061021,-0.8927914,0.0014837141,0.16529202,-0.31931162,-1.5972285,1.0674282,0.50527793,0.00036276158,0.6643216,-0.70242655,0.23176064,-0.23684219,0.020929113,0.18165103,0.2728483,-0.077427186,-0.028263727],[-1.1033577,-1.4215872,0.010086168,-0.17611827,0.2112764,-0.69066954,-0.083308466,0.15166493,-0.22307171,-0.075834244,0.035160135,-0.26813668,-0.31942832,0.5206709,0.05213391,0.1393356,0.24755146,-0.20669232],[0.83160627,-1.0528738,0.010402418,-0.8488269,-0.097700946,-0.8356935,-0.030544959,-0.045691635,-0.12981445,-0.22643599,0.08581046,-0.099290386,-0.0029221023,0.43224323,0.16066676,0.23335454,0.26151142,-0.19559892],[1.6938869,0.33258435,0.011718149,0.5278453,0.4084221,0.054189947,0.6158366,0.5923816,0.31159598,-0.19908112,0.0759474,0.18903963,-0.16102462,-0.31830838,0.122031696,-0.5454575,0.14843899,0.0009889763],[-0.18688406,-1.837496,-0.024467822,-0.18667667,1.5253651,-0.87217486,0.6304656,-0.3631879,-0.93472433,-0.4855514,0.8494961,-0.29013696,0.11480595,-0.046378586,0.04579505,0.6772069,0.030312326,-0.2840396],[0.5354849,-0.16436046,-2.2868845,0.9490928,-1.1401188,-1.6175885,2.1010857,-0.067001574,0.09170741,0.23366773,-0.13356704,-0.38347217,-0.17166469,0.5771494,-0.16453075,-0.5179118,-0.2526112,0.2366501]],"activation":"σ"},{"dense_2_W":[[0.33937505,-0.3745738,-0.9080001,-0.67459136,-0.22434857,-0.68243057,0.15986687],[-0.4707506,0.3539919,0.7182431,0.32069924,0.52431095,0.47054338,0.32751095],[-1.0941919,-0.02285758,-0.6026077,-0.6543617,-1.1643189,-0.40606982,-0.530394],[0.4252591,0.47353566,-0.49499482,0.49766955,0.9336523,0.4235022,0.91593933],[0.5621498,0.24484019,0.066795506,-0.39081028,-0.2126147,-0.17618422,0.08806277],[-0.21437049,-0.086400345,-0.70952827,0.24951175,0.2172522,-0.935455,0.3494222],[-0.027205786,-0.3861311,-0.329584,0.3939693,0.21568625,-0.037430923,-0.44425386],[-0.8316691,-0.6763449,0.074327685,-0.473199,-0.55408454,-0.17554076,0.10902519],[0.24072582,-0.45537603,-0.5833832,0.25576162,0.19144523,-0.66718787,-0.2368218],[0.9988664,-0.3536028,-0.28179932,0.7269398,1.1277015,0.6262987,0.9872559],[-0.081231736,0.76173663,0.36381385,-0.087001294,0.15438923,-0.6396298,0.33097985],[0.37046397,0.6737554,-0.0037287436,0.1967084,0.20252821,0.25889185,-0.26074913],[-0.50508755,0.007956352,-0.56175256,0.4734349,0.11897713,-0.8310094,0.056679618]],"activation":"σ","dense_2_b":[[0.40672347],[-0.15762824],[0.54028726],[-0.06825271],[-0.14409027],[-0.24412309],[0.13284369],[0.13380992],[0.3824313],[-0.10148208],[-0.16163772],[-0.21077214],[0.2533245]]},{"dense_3_W":[[-1.1355319,0.3370882,-1.0809343,0.49130934,0.20389263,-0.79736996,-0.023168638,-0.094694644,-0.6435565,-0.079334155,-0.31444725,-0.088145025,-0.46537364],[-0.7897674,0.58977884,-0.6444405,0.5475269,0.0090896,0.1407256,-0.40847594,-0.47964928,-0.5811728,0.7200515,0.37270215,0.26434785,-0.682192],[0.07739398,0.37235165,-0.6278828,-0.1572289,0.14061572,-0.46377057,-0.18825918,-0.50748676,-0.5449003,-0.11498902,-0.10287988,0.50479686,0.14272374]],"activation":"identity","dense_3_b":[[0.019560132],[-0.021147352],[0.01810392]]},{"dense_4_W":[[-0.44403714,-0.84635425,-0.24351013]],"dense_4_b":[[0.015087563]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/SUBARU_ASCENT.json b/selfdrive/car/torque_data/lat_models/SUBARU_ASCENT.json
new file mode 100644
index 000000000..bb2bce72c
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/SUBARU_ASCENT.json
@@ -0,0 +1 @@
+{"input_std":[[8.758843],[1.3803611],[0.60948026],[0.045717984],[1.3632656],[1.3669009],[1.3716704],[1.3600131],[1.3428026],[1.3118118],[1.2692281],[0.04556848],[0.045585617],[0.045588113],[0.045418713],[0.04517924],[0.044783145],[0.04430147]],"model_test_loss":0.011302465572953224,"input_size":18,"current_date_and_time":"2023-08-10_14-53-35","input_mean":[[22.14633],[-0.09750815],[-0.016923292],[-0.008263297],[-0.09257404],[-0.093882],[-0.095394194],[-0.10115487],[-0.105775625],[-0.10726142],[-0.10426775],[-0.008418747],[-0.0083834],[-0.008342148],[-0.008217269],[-0.008256564],[-0.008261369],[-0.008310724]],"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.028778102],[-1.968203],[0.065823115],[1.8248968],[0.062292587],[-1.7103531],[-0.01996085]],"dense_1_W":[[0.0070845596,-0.60425925,0.13626827,0.58880633,-0.31271362,-0.61375195,0.66517067,0.22636458,-0.19881134,0.45755818,-0.34704024,-0.57213944,-0.011795754,-0.6249568,-0.1684797,0.32110855,-0.17260504,0.544297],[-0.728326,-0.6023388,-0.058824457,0.31488872,-0.22620982,-0.60898775,2.0038636,-0.3022711,-0.629738,0.02945903,0.13288042,-0.14117523,-0.017454179,-0.034289096,0.067219295,-0.25439438,-0.053118344,0.09879211],[-0.020241546,-0.32952714,0.010935147,0.13660449,0.22784045,0.9439816,-1.076848,0.3701509,0.02565278,-0.019304488,0.13404894,0.18276764,0.43549806,-0.29936683,-0.58802724,-0.17244393,0.059832945,0.14556362],[0.76759815,0.06043721,-0.05881449,0.0035122675,-0.10848625,0.052874193,0.8961308,-0.89096814,-0.38440028,-0.16148087,0.24437909,-0.3767321,0.020551253,0.5319493,-0.12341046,-0.055117548,-0.11515104,0.11642417],[0.035288017,-1.6319109,-6.531466,0.11385578,0.8703579,-0.2708121,0.03723273,0.90277404,-0.28877074,-0.044411846,0.10059958,-0.33312798,-0.5378801,0.12608767,0.355296,0.48987788,0.32266265,-0.3474462],[-0.7375854,0.057307318,0.058046028,0.19952175,0.46198282,0.466313,-1.1714203,-0.15773736,0.28007728,0.14972468,0.010271487,-0.10134099,0.1349294,-0.18732592,-0.0563053,0.050620757,0.048619322,-0.045900762],[-0.0032983767,-0.9483289,0.020740977,0.16430958,-0.05373888,-0.6577905,0.2967871,0.2897931,0.2731,-0.18671848,0.084359705,-0.005540786,-0.0081646815,0.12515508,-0.08342288,-0.052237507,0.26822442,-0.21108986]],"activation":"σ"},{"dense_2_W":[[-0.45338973,-0.20294967,0.5083342,-0.42460576,-0.63909435,0.4879755,0.012130023],[-0.2742753,-0.61631083,0.46697986,-0.45406902,-0.06088979,0.76950836,-0.4132321],[0.81678456,-1.1331547,0.32828367,-0.31268513,-0.8846842,0.6429822,-0.4893232],[0.879309,0.7746291,-0.6991977,-0.23530038,-0.67047966,-0.1361894,0.9743538],[0.31158212,-1.6510494,0.1974917,-0.33475468,-0.11659852,0.07471639,-0.0023190496],[-0.6007021,0.55620384,-0.050591104,0.6911001,0.50198555,-0.48155546,0.5246929],[-0.81362003,0.870096,-0.6034486,-1.8557204,-0.71382594,1.4265903,0.31279352],[0.6726662,0.87645346,-0.31120607,-0.057908148,-0.517195,-0.5856469,0.6892038],[-0.62789345,-0.81853545,0.31356138,-0.040097605,0.6366377,0.31337318,-0.79096055],[-0.7211644,1.0459608,0.061597116,0.3745668,0.37840834,-0.46162283,0.76644534],[0.3500098,1.3790991,-1.1291443,-0.20502144,0.2560334,0.01199343,-0.027191881],[0.65701747,-0.9248509,0.506126,-0.16672745,-0.42342398,-0.14072593,-0.6027308],[-0.67928207,-0.19559407,-0.040364254,-0.47893044,0.14672689,0.6760947,-0.5760793]],"activation":"σ","dense_2_b":[[-0.014492411],[0.07639171],[0.39956445],[-0.16650708],[-0.13319126],[-0.13508296],[-0.10059368],[-0.31607836],[-0.0461397],[-0.32838032],[-0.20038198],[0.037399642],[-0.039441753]]},{"dense_3_W":[[-0.33679157,-0.009600073,-0.9610766,0.7423044,-0.19008559,0.21044315,-0.7233725,-0.04264747,0.26311195,0.57560843,0.4490669,-0.4002034,-0.7852221],[0.4784453,0.67048156,0.70986277,-0.8041704,0.3298966,-0.34861046,0.2399805,-0.27719498,0.5779557,-0.22748941,-0.932461,0.3537534,0.24791418],[0.58087116,0.6521763,-0.35804045,-0.07539161,0.062361475,-0.29150185,0.23337866,-0.089632176,0.21668643,-0.28445706,-0.36395082,0.26074025,0.598436]],"activation":"identity","dense_3_b":[[-0.030428782],[-0.123883836],[-0.12339338]]},{"dense_4_W":[[-0.23482278,0.8056521,0.30850294]],"dense_4_b":[[-0.10144986]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/SUBARU_FORESTER.json b/selfdrive/car/torque_data/lat_models/SUBARU_FORESTER.json
new file mode 100644
index 000000000..f269e03b9
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/SUBARU_FORESTER.json
@@ -0,0 +1 @@
+{"input_std":[[8.800139],[1.4024142],[0.64793754],[0.04852409],[1.3756377],[1.3851136],[1.3934203],[1.3648111],[1.3329811],[1.3011713],[1.2632433],[0.04835437],[0.04840405],[0.04844234],[0.048357654],[0.0482471],[0.047991928],[0.047582824]],"model_test_loss":0.007408012170344591,"input_size":18,"current_date_and_time":"2023-08-10_16-38-20","input_mean":[[23.81501],[-0.049737465],[-0.012033205],[-0.007154475],[-0.042333253],[-0.04411629],[-0.046351664],[-0.046337746],[-0.0452032],[-0.0461177],[-0.04440744],[-0.007060857],[-0.0070801843],[-0.0070975143],[-0.0070964643],[-0.007056378],[-0.0070534865],[-0.0071490407]],"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.14959592],[0.15145145],[-0.31445217],[-1.278996],[0.042432982],[1.5067866],[-0.032994382]],"dense_1_W":[[0.007527928,-0.5552118,-0.033658482,-0.098787725,0.07584574,-0.9390659,0.81876254,0.20194316,0.43864456,-0.4218525,-0.039264686,0.16177176,-0.3515836,0.20080848,0.34289953,-0.09344094,-0.35971025,0.22003576],[0.09012296,0.46685427,0.0064236997,0.18229099,0.07276261,0.7347331,-1.3846129,0.22982895,0.4774952,-0.22901195,-0.07560122,0.29164892,0.25852647,-0.08081211,-0.041323017,-0.22754644,-0.36422738,-0.012168264],[-0.007923612,1.5721923,7.249816,0.24075961,0.25590533,-0.088694036,-1.1871089,-0.96667105,0.9330669,0.98532987,-1.0378566,0.5749717,-0.40850392,0.24602483,-0.63786286,-0.6482208,-0.15704682,0.6276128],[-0.963277,0.03193962,0.017269593,0.57181937,0.88669837,0.27691013,-1.8479526,0.38129202,0.73344886,-0.16890727,-0.1942604,0.950727,0.9030019,0.033808593,-0.89199686,-0.8695169,-0.48222977,-0.1936048],[0.003948569,-0.6626056,-0.026783565,0.24455325,0.13850336,-0.87496305,0.30995417,-0.12258559,0.627965,0.28786364,-0.36571527,-0.14854349,-0.048926286,-0.03496435,0.18779114,-0.090603314,0.06736233,-0.109832205],[1.1487782,0.404077,-0.03660598,-0.08010621,0.22780214,0.27421752,-1.7048142,0.8248977,0.32876998,0.15378678,-0.34877867,-0.92275876,-0.83582413,-0.37334695,0.31583604,0.31877267,0.8586441,0.715129],[0.0010568867,1.0778173,0.04372921,0.6322534,-0.1799248,-0.3518717,1.8120258,-1.5917265,-0.8620765,-0.35745504,0.2233659,-0.0019629926,0.28671154,0.32253462,-0.85555124,-0.21950537,-0.112213776,0.2568781]],"activation":"σ"},{"dense_2_W":[[0.10897138,-0.723212,0.03340947,-0.38988578,-0.31490615,-0.007838475,0.05767578],[0.124002986,-0.47957873,-0.6278711,-0.20655042,-0.17151697,-0.8776442,-0.36946294],[0.34166458,-0.6827676,0.36771443,-0.24060813,0.34594595,-0.74794686,0.22926417],[0.017008245,0.19041075,0.084082685,0.081093706,0.4542936,0.10335207,0.25682083],[0.5069386,0.24292083,-0.4515972,-0.18613566,0.21341953,-0.4916771,0.5676118],[-0.79913807,0.49238104,0.19868188,0.75191754,-0.41708577,-0.453282,-0.456025],[0.25128815,-0.63992566,-0.4836454,-0.3934495,0.094238296,-0.68461305,0.33668476],[0.01528515,0.78505975,0.5019243,-0.31464717,-0.74084806,0.8338816,0.1128433],[-0.51994556,0.15239593,-0.07230343,0.24837533,-0.6899928,0.0865479,-0.539543],[0.2825089,-0.38502663,0.44325826,-0.430329,0.21890175,0.1125448,-0.37878212],[0.16606337,0.54976463,0.36211267,0.32275504,-0.48639286,-0.25836277,-0.336691],[-0.06592535,0.7600238,-0.17236032,0.496856,-0.6375664,0.18681967,-0.40907857],[-0.28911406,-0.26927066,-0.5852496,-0.33134258,0.08002008,-0.1575813,0.27370805]],"activation":"σ","dense_2_b":[[-0.35370803],[-0.20628847],[-0.111258335],[-0.1018301],[-0.056314364],[-0.092298076],[-0.07329908],[-0.023466475],[0.112976246],[-0.077543356],[-0.033790935],[0.04352653],[-0.080127224]]},{"dense_3_W":[[-0.50061566,0.29911298,0.27225292,0.13542368,0.36572888,-0.65222454,0.3313954,-0.33749554,-0.6381314,0.39514777,-0.084563196,-0.4374779,0.39208907],[-0.14953244,-0.20290117,-0.599371,-0.1296707,-0.32913446,-0.37221158,-0.29940695,-0.34908745,0.2913214,0.17797685,0.25834674,0.75962204,-0.38031256],[-0.59162396,0.6006983,-0.23583624,-0.18037513,-0.533629,0.23406217,0.08210266,0.45098656,-0.05068087,-0.46481112,0.37245923,-0.113958105,0.26854116]],"activation":"identity","dense_3_b":[[-0.058710456],[0.06673158],[0.06627157]]},{"dense_4_W":[[-1.143745,1.012412,0.67946994]],"dense_4_b":[[0.060790185]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/SUBARU_IMPREZA.json b/selfdrive/car/torque_data/lat_models/SUBARU_IMPREZA.json
new file mode 100644
index 000000000..0bae6debe
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/SUBARU_IMPREZA.json
@@ -0,0 +1 @@
+{"input_std":[[8.554121],[1.0740528],[0.4476513],[0.042985532],[1.0663103],[1.0689878],[1.071583],[1.0549195],[1.0335085],[1.0030197],[0.9723682],[0.042850573],[0.042880993],[0.042904507],[0.04281879],[0.042651407],[0.04230733],[0.041820873]],"model_test_loss":0.022656971588730812,"input_size":18,"current_date_and_time":"2023-08-10_17-58-30","input_mean":[[22.76271],[-0.025877997],[0.0022960093],[-0.009181171],[-0.02727445],[-0.027402772],[-0.027459135],[-0.026559947],[-0.02817579],[-0.029742032],[-0.030806256],[-0.0091993585],[-0.00921486],[-0.009230055],[-0.009324119],[-0.00943795],[-0.009580347],[-0.009762122]],"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.5694719],[-0.20375408],[0.4239076],[-1.5491991],[-2.7061498],[1.5443199],[-3.3281188]],"dense_1_W":[[-0.1568525,1.7437768,5.172882,-1.1876678,-2.9987805,-0.5681597,-0.72784686,-0.56439,3.2104652,1.4470582,-1.4493226,1.616085,0.16703165,-0.029379552,-0.89520353,-0.08414323,0.035069145,0.27360746],[0.008605118,1.5699749,-0.034170814,-0.6517424,0.1554151,1.9415936,-0.6549746,-0.14080332,0.4873717,0.20128046,-0.07373715,0.72448504,-0.18958189,-0.3032506,-0.3716506,0.21436751,0.13051425,0.057122074],[0.15251416,-1.065147,-1.7042818,-0.18689084,1.1120772,-0.40736163,0.34153485,-0.06619109,-0.19624624,-0.5001997,0.3767836,-0.46413225,0.124430165,0.1741939,0.08300067,0.4339266,0.39133996,-0.4509936],[-1.9674213,0.08717078,0.029132722,-0.03513353,-0.2589703,1.6724654,-1.3558731,-0.1305793,-0.454886,-0.012608211,0.23873848,-0.34175423,0.23151904,0.7033776,-0.41631103,-0.5752804,-0.4836925,0.59687835],[-0.7207827,-0.5354017,-0.046089556,0.70448333,-0.36087984,-1.4759765,1.6575412,-0.75853246,-0.4408815,0.08790331,0.0717399,-0.33782014,-0.42041263,0.67508817,-0.24991857,-0.3216102,-0.41419834,0.3666627],[1.9532421,0.33528504,0.01916575,0.41987598,0.10209625,1.2647687,-1.4621202,0.04530512,-0.48216137,-0.5880018,0.5948106,-0.49690482,-0.012825885,0.407025,-0.21983282,-0.46802706,-0.1458972,0.21309836],[-0.7360502,0.09303879,0.05160484,-0.5698299,0.48270965,1.2655245,-1.0951636,0.7825874,0.5584368,-0.051464483,-0.10931349,0.18838416,0.48844352,-0.7061164,0.29695016,0.34917378,0.2150316,-0.281181]],"activation":"σ"},{"dense_2_W":[[-0.07180556,0.3327603,-0.38922572,0.48622698,0.09493802,0.26061895,0.23152085],[0.13407795,-0.67967266,0.05478834,-0.13644974,0.38578004,-0.13981605,-1.063277],[-0.015875516,-0.22446778,-0.25920233,-0.21318886,0.96766865,-0.20522757,-0.96453786],[0.08992157,0.18349336,0.0824512,-0.18648697,-0.5639966,0.38651267,0.2273873],[0.24735251,-0.2508453,0.11087025,0.45425788,-0.4750976,0.48374006,0.7154399],[-1.4328333,0.5445412,0.7513447,-0.29624668,1.3955733,-0.7848697,-0.35838512],[-1.3571904,0.019299721,0.74097097,0.21410283,0.48808393,-1.7108941,0.8460511],[0.34152254,-0.33008227,0.7538879,-0.782962,0.46280092,0.3184853,-1.060949],[-0.5959307,0.6231766,0.24205552,0.80450344,-0.20037276,0.2900327,0.34695983],[-0.04536962,-0.6977615,0.08347324,-0.3414067,0.76720893,0.07663101,-0.62674546],[-0.08212232,-0.48272756,-0.11815556,0.24696878,0.023860326,-0.47122,-0.32275018],[-2.5981476,-0.62226206,0.30502877,0.7207847,0.95814323,-0.7556528,0.5867901],[0.18742424,0.22045845,0.27814955,0.33897662,-0.19170812,0.03715238,0.15590559]],"activation":"σ","dense_2_b":[[-0.05376892],[0.23207775],[0.08851935],[-0.051318903],[-0.23005556],[-0.015357251],[0.06677577],[0.3493236],[0.010827263],[-0.029838517],[-0.059241645],[-0.45090887],[0.0051090852]]},{"dense_3_W":[[0.43776008,-0.4779542,-0.6273563,0.012430885,0.27310228,-0.6358059,-0.5068906,-0.45288852,0.5793986,-0.29245862,-0.21443059,-0.15231055,0.4353823],[0.24600616,0.26503375,-0.1618708,-0.22456193,-0.43281186,-0.17235023,-0.4949653,0.4828677,-0.109212846,-0.3444521,-0.46777263,0.5679082,-0.11389996],[0.5157795,0.24814758,-0.17129026,0.32940918,0.6862252,0.45439878,-0.3838788,-0.6090692,0.4296436,-0.07106129,0.5077451,-0.04794848,-0.5777281]],"activation":"identity","dense_3_b":[[0.0597104],[-0.036633834],[0.03006256]]},{"dense_4_W":[[1.408938,-0.40635464,0.28050324]],"dense_4_b":[[0.051838256]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/SUBARU_IMPREZA_2020.json b/selfdrive/car/torque_data/lat_models/SUBARU_IMPREZA_2020.json
new file mode 100644
index 000000000..56091f65a
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/SUBARU_IMPREZA_2020.json
@@ -0,0 +1 @@
+{"input_std":[[8.894573],[1.1526463],[0.49937436],[0.04181223],[1.1407756],[1.1450312],[1.1480577],[1.1401104],[1.123895],[1.1006547],[1.071595],[0.0416507],[0.041704524],[0.041748393],[0.04176903],[0.041703388],[0.041490186],[0.041185617]],"model_test_loss":0.013009187765419483,"input_size":18,"current_date_and_time":"2023-08-10_21-20-07","input_mean":[[24.805859],[0.0049672336],[0.0013684959],[-0.001192497],[0.0036358428],[0.0034303954],[0.004092047],[0.005534218],[0.0066732266],[0.004927845],[0.0062723476],[-0.0012077604],[-0.0011977365],[-0.0011862671],[-0.0011791526],[-0.0012019373],[-0.001338799],[-0.0015223476]],"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.042427626],[-2.5019999],[-0.0457297],[-0.7153923],[-0.7774993],[-0.06926592],[-2.4368992]],"dense_1_W":[[-0.0009291319,0.27767056,-0.07892523,-0.059060324,1.0241088,1.171279,-0.069413096,-0.12784159,0.058901682,-0.18805476,0.4193225,-0.3469123,0.42202514,-0.36080348,-0.7251315,-0.3008201,-0.033229448,-0.49506444],[-0.40471604,0.11814647,-0.1926038,0.0060851052,-1.1522694,-1.2816894,1.9390084,-0.5257205,-0.2785602,-0.118004374,-0.020688536,0.07099932,-0.389517,0.20363228,-0.030239882,0.6832831,-0.015321787,-0.26263818],[-0.00991332,-2.1251974,-3.9875517,0.5100302,2.949812,0.787714,0.90843993,-0.38894913,-2.0025148,-2.1428773,1.4694284,-0.76132494,-0.45982483,0.11538664,-0.18600582,0.46312463,0.7552948,-0.31822762],[-0.46726972,-0.9092647,1.3574834,0.18761194,-0.81670135,-1.0397257,1.2560849,-0.21459231,-0.1436863,-0.16160814,0.41930124,-0.32464686,0.17093562,-0.20039976,0.055896353,-0.4330081,0.52754503,0.12463856],[-0.5152346,0.50216174,1.3355443,-0.31773502,-0.46232986,-0.13133429,-1.4018828,-0.43890733,0.06662451,-0.043737113,0.3108043,0.19670644,-0.093163505,-0.28796571,-0.051473662,0.24918097,0.38881204,0.02669732],[-0.02088246,2.2406785,-0.22520858,-0.70286745,2.008803,1.9785228,0.02844807,0.97084755,0.49748123,0.7884559,0.14848712,0.87087315,0.40047103,-0.21100943,-0.21773107,0.57993966,0.16083455,-0.54391414],[-0.3943676,-0.26845726,0.19103855,0.21092215,1.200674,1.3899878,-2.1009598,0.73901653,0.24895392,0.09445688,0.020025935,-0.21680212,0.3247223,0.046129495,-0.4636503,-0.37354514,-0.05204169,0.26103115]],"activation":"σ"},{"dense_2_W":[[-0.29813394,0.97317356,0.18235527,0.5965462,-0.36117476,-0.357781,-0.6302886],[0.4669501,-0.26381913,-0.6718241,-0.55993664,0.75606084,-0.22786976,0.54741734],[0.45668933,-0.81978554,-0.4400848,-0.47736016,0.9749981,-0.41887143,0.5611882],[-0.23562466,-0.33685845,-0.63146794,-0.25962546,0.7455925,0.050860852,0.47903395],[0.11492595,0.39062494,-0.5413327,-0.040900126,-0.17837498,0.06629638,0.052479822],[0.3525208,0.28856075,-0.14136873,0.6413087,-0.51915973,-0.2774327,-0.9177848],[-0.17333238,0.8689579,-0.28932738,0.566288,0.11427143,0.06013824,-1.1550378],[-0.5458432,0.5894391,-0.047653124,0.15687895,0.33795092,-0.5042759,-0.22974871],[0.49124256,-0.7596094,-0.17393427,-0.37332547,0.025444454,0.34669602,0.47311735],[0.31282023,-1.2118286,0.017776541,-0.91698223,0.24819252,-0.0926613,1.2513487],[0.33180416,0.23580849,0.46787393,-0.09696695,-0.25229496,0.3558893,-0.6826248],[0.42314368,0.07992972,0.4903785,-0.3677389,-0.38366356,-0.34357548,-0.33236912],[-0.37016624,0.46486557,0.060417723,-0.48779157,0.024656558,-0.38848272,0.0547722]],"activation":"σ","dense_2_b":[[-0.0017060944],[0.016006682],[0.13619791],[0.01692232],[-0.2458614],[-0.01584404],[-0.11229285],[-0.037353944],[-0.0535534],[0.023917647],[-0.08311039],[-0.05629295],[-0.21274085]]},{"dense_3_W":[[0.4620643,0.1110241,-0.73991674,-0.04964699,-0.49397373,0.636488,-0.21777737,0.45773318,-0.31195316,0.26977688,-0.015185564,-0.0892626,-0.50908834],[-0.45361328,0.48187032,0.123036705,0.6407995,-0.29581347,-0.18150009,-0.42016354,-0.3740721,0.5890714,0.49763745,-0.43375558,-0.2785329,-0.33093747],[-0.034139745,0.07872775,0.14715545,0.5339573,-0.10824458,0.07166932,-0.20306881,0.021034054,-0.44093442,-0.24978448,-0.026970783,-0.16316907,-0.21309401]],"activation":"identity","dense_3_b":[[-0.012436828],[0.029966448],[0.10008727]]},{"dense_4_W":[[-0.48937565,1.0721666,0.037118435]],"dense_4_b":[[0.023898797]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/SUBARU_LEGACY.json b/selfdrive/car/torque_data/lat_models/SUBARU_LEGACY.json
new file mode 100644
index 000000000..33a50713e
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/SUBARU_LEGACY.json
@@ -0,0 +1 @@
+{"input_std":[[9.185515],[1.6282288],[0.35043508],[0.031132786],[1.7255819],[1.6982063],[1.6648296],[1.4761653],[1.3519272],[1.2236267],[1.1229782],[0.03105924],[0.031098329],[0.031127678],[0.031184744],[0.031371836],[0.031613626],[0.03144637]],"model_test_loss":0.04537874087691307,"input_size":18,"current_date_and_time":"2023-09-02_23-19-34","input_mean":[[16.421978],[-0.048192535],[-0.013311911],[-0.030576248],[-0.05147835],[-0.051736772],[-0.051158622],[-0.051310074],[-0.056091797],[-0.051997066],[-0.04342065],[-0.030474063],[-0.03050476],[-0.030556701],[-0.030765096],[-0.030835558],[-0.0308675],[-0.030843992]],"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.0047161067],[-0.15242413],[-2.1423926],[-3.0072546],[-0.8894896],[1.5538071],[-1.542048]],"dense_1_W":[[-0.012829974,0.30741772,-0.03263021,-0.085545234,1.1814696,0.5471415,0.9120527,-0.33152023,0.5066247,-0.5210931,0.5341946,0.09236861,-0.39759701,0.02910307,-0.00886832,0.41334194,-0.23273322,0.016523872],[0.047321085,-0.15492304,-0.077865265,-0.804299,-3.377934,-3.6115973,-2.283943,5.437118,2.2738755,-0.043271527,0.16104881,0.112040475,0.5114801,0.093201585,0.13260198,-0.2661622,0.1796879,0.04888338],[-1.5367671,2.3720562,-0.02027605,-0.025416356,-1.4381312,-0.9349471,0.24836966,1.367659,0.3289632,-0.055137575,0.12185219,0.45477563,-0.30157885,-0.07613766,0.12895256,0.12588494,-0.1591801,-0.22217746],[-1.3666407,-3.5649407,0.02042984,-0.38937125,1.3380835,1.9989939,-0.20659405,-1.5160191,-0.104439735,0.062092394,-0.15397424,0.093930446,0.3034801,-0.30530134,0.041498467,-0.06435006,0.07080854,0.327221],[0.8026996,-0.44736055,-0.050972164,0.20318426,-0.8092374,0.24752559,0.32302567,-0.094395876,0.22440033,-0.17859897,0.11948998,-0.26337075,-0.27740997,0.18380176,0.30512437,-0.06352904,0.14718251,-0.17162979],[2.457627,-1.4923394,0.028457003,-0.3990584,1.7863452,0.60998243,-0.42721242,-1.8455137,-1.4121356,-0.16493158,0.06486093,0.016970918,0.19106352,-0.2922308,0.05603943,-0.020587316,0.34736913,0.20459694],[1.1815331,0.36599845,0.06255039,0.0657659,0.4088365,0.41529664,-0.25315446,0.017450152,-0.30593964,0.3139144,-0.16692097,0.2685098,-0.086217225,-0.069303796,-0.12145663,-0.22734722,-0.023085613,0.11520361]],"activation":"σ"},{"dense_2_W":[[-0.5023888,-0.05802139,-0.66911775,0.296051,0.7713285,-0.18254815,-0.8283855],[0.44022453,-0.24643378,0.5062762,0.09133972,-0.45227736,0.05079313,0.06773168],[-0.6219036,-0.9433538,-1.0238923,1.3172559,1.1334529,0.6552401,-0.69087607],[0.6763754,-0.40709624,0.6232817,-0.1610244,-0.67904115,0.6493273,0.0906405],[-0.635346,0.0011620739,-0.37521043,-0.5111516,0.986075,-0.3832682,-0.14561039],[0.45462242,1.1686025,0.14032847,-0.9475063,1.0923766,1.6022182,0.2453258],[-0.32724923,-0.7897613,-0.9935628,0.802958,-0.08129205,-1.1719561,-0.7486108],[-0.22323135,0.66134214,1.1732999,-0.8910564,-0.95774484,-0.39924416,0.7293297],[0.29451057,0.15649314,0.27317175,-0.6156423,-0.5974088,-0.54637176,0.16324385],[0.39435184,0.47537956,0.44074118,-0.23361506,0.39577127,-0.44843742,-0.6463624],[-0.48006952,0.5896299,0.56584865,0.23956761,-0.61484444,0.47759032,0.35471997],[0.35922313,0.43721467,0.18760605,-0.351279,-0.6390551,-0.28927103,0.6187888],[0.073767446,-0.8790351,-0.68584126,1.1712487,-1.6569555,-1.2728544,-0.015573282]],"activation":"σ","dense_2_b":[[-0.09275836],[-0.13285246],[0.22685666],[-0.048346587],[0.04652798],[0.08532798],[-0.09150484],[-0.05462159],[-0.1709193],[0.219226],[-0.10487605],[-0.18386836],[-0.227306]]},{"dense_3_W":[[-0.31240308,-0.2003438,-0.49512723,-0.33559966,-0.11021345,0.423354,-0.36147565,0.46913844,-0.33863887,-0.33271542,0.5626256,-0.27749553,0.15109913],[-0.18263677,-0.16133335,0.554565,-0.3057925,0.50082487,-0.3123607,0.6251424,-0.6040641,-0.4718807,0.17380686,-0.2015293,-0.22039177,-0.13468805],[0.75125694,-0.24231063,0.33473507,-0.54747844,0.5980235,-0.27477667,0.7795829,-0.4155024,0.4370703,0.43257073,-0.10999617,-0.19784549,0.7787281]],"activation":"identity","dense_3_b":[[0.08514209],[0.12190986],[0.11714442]]},{"dense_4_W":[[0.08379805,-1.1299504,-0.99574506]],"dense_4_b":[[-0.117058024]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/SUBARU_LEGACY_PREGLOBAL.json b/selfdrive/car/torque_data/lat_models/SUBARU_LEGACY_PREGLOBAL.json
new file mode 100644
index 000000000..14e1e1d95
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/SUBARU_LEGACY_PREGLOBAL.json
@@ -0,0 +1 @@
+{"input_std":[[9.750777],[1.3186632],[2.4594376],[0.034155015],[1.3260336],[1.3216915],[1.3177336],[1.3116305],[1.2217928],[1.1049051],[0.97790134],[0.03409643],[0.034110934],[0.03412991],[0.03416529],[0.034136374],[0.03408451],[0.034057345]],"model_test_loss":0.02841777540743351,"input_size":18,"current_date_and_time":"2023-09-02_22-47-37","input_mean":[[17.672829],[-0.0015280318],[0.0008010262],[0.021118881],[0.0008383113],[-0.0005000338],[-0.0014255784],[-0.001504001],[-0.00013831415],[-0.0043903766],[-0.004224954],[0.02113117],[0.021122888],[0.02112144],[0.021065863],[0.020995975],[0.020819707],[0.02090924]],"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.4262147],[0.29442513],[0.13858001],[-3.6157753],[0.11054395],[-0.096514955],[-2.7481675]],"dense_1_W":[[-0.59550166,-0.08087835,-0.10044884,-0.030051881,-1.0114387,-0.7159067,1.0509298,-0.4646438,0.254099,0.27775934,-0.30958077,-0.2699965,0.020533659,-0.021311773,0.45812935,0.20583425,-0.17345557,-0.12265345],[-0.1814759,-2.6059172,0.027335435,0.031072548,1.9576696,1.9464822,1.3979335,-3.122393,-0.40338284,-0.811746,0.915118,-0.2758879,-0.018445456,0.10923238,0.3439007,-0.3658017,0.17968847,0.0085251825],[1.2159636,0.50295633,-0.29685062,0.10249312,-1.1345159,-0.60397,0.9025859,-1.4166268,-0.34669524,0.31230232,0.03311125,-0.4099096,0.22891928,0.0058932696,-0.03164047,0.28680435,0.056274787,-0.21163589],[-2.1782408,-2.652491,-0.6163189,0.014259274,0.46644354,-0.07303462,-0.16025148,-1.9173824,-0.34420478,0.248388,0.23158954,0.038577884,0.08229089,0.039497472,-0.21905439,-0.31795323,0.80569685,-0.35556743],[-0.39873397,1.0991853,-0.15771712,-0.44371212,0.6436306,0.014177862,-0.9923157,1.1680098,0.09227359,-0.3646184,0.17011096,0.10480483,0.5100492,-0.115318246,-0.6804572,0.09150676,0.35543084,-0.04518636],[1.815469,0.7312476,-0.32006833,-0.47156325,-0.8404111,0.18205363,-2.1965184,-1.2279189,-1.0787835,0.2947485,0.085848495,0.06514893,0.41874364,-0.2661748,0.28740934,0.4390194,-0.31817436,0.0123811625],[-1.3422207,4.2687964,-0.25304475,0.53945225,-1.3436658,-1.9831376,-2.5219822,2.4054382,-1.2978123,0.42630863,1.098409,-0.47248852,-0.705663,0.60417634,0.0360486,0.5381174,-0.0367325,-0.60039526]],"activation":"σ"},{"dense_2_W":[[0.6287387,0.6726734,1.2156233,0.14890462,-0.7355616,0.36218125,0.14466967],[-0.74637365,0.3812475,-0.6406179,0.28641817,-0.20450425,0.32207528,-0.3226913],[0.06755054,-0.27992728,-0.70488316,-0.25441137,0.31789666,0.04202117,0.4387319],[-0.1773071,-0.06993977,-0.67512244,-0.46879476,-0.2630911,-0.7062165,-0.45115414],[-0.6238654,-0.26688075,-0.6413995,-0.30508804,0.62488157,0.15856849,-0.036961198],[-0.30532292,0.023894563,-0.0064119864,-0.105837554,0.01626758,0.14256619,-0.60051453],[0.013258742,-0.17537804,-0.44187704,-0.03241884,0.571268,0.39274576,0.042168505],[-0.6181693,-0.27180657,-0.44550276,-0.00063514145,0.47017303,0.1071446,0.4154284],[0.3637543,0.29671773,0.32823008,0.29629824,-0.551112,0.14014855,-0.46638033],[0.588223,0.1280512,0.3159679,1.2631085,-1.279261,-1.4572979,-0.2884451],[0.08316952,-0.2914584,-0.76872176,0.22730377,0.02180895,0.13148995,-0.5355329],[0.6056482,2.9128945,-0.027976673,0.84820426,-0.9162752,-2.0459216,-4.1563354],[0.03169041,-0.17865568,-0.2586998,0.10826119,0.071472034,-0.3774936,0.22949137]],"activation":"σ","dense_2_b":[[0.015828583],[-0.088196956],[-0.09036952],[-0.1230372],[-0.055517223],[-0.119829975],[-0.08279668],[-0.04842878],[-0.2312968],[-0.60610735],[-0.10119338],[-0.82878107],[-0.119595364]]},{"dense_3_W":[[0.4161587,0.39951083,-0.0774412,0.24522696,-0.6132204,-0.09533373,-0.47129297,-0.41050985,0.23757468,0.23466793,0.1497136,0.592779,-0.14382078],[0.10526708,-0.5690179,-0.44247043,-0.37303323,-0.45616138,0.17351544,0.47270444,-0.49300864,-0.013277441,-0.06569539,-0.5149398,-0.006244119,0.17057294],[0.6019824,-0.120864384,0.43110284,-0.51825607,-0.12548478,-0.4957451,-0.4877988,-0.39608762,0.053494465,0.6998196,0.01679197,0.4730759,-0.08663315]],"activation":"identity","dense_3_b":[[0.095762156],[0.09659323],[0.09680739]]},{"dense_4_W":[[-0.63916916,-0.8716667,-0.6933614]],"dense_4_b":[[-0.09472361]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/SUBARU_OUTBACK.json b/selfdrive/car/torque_data/lat_models/SUBARU_OUTBACK.json
new file mode 100644
index 000000000..b18169a8f
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/SUBARU_OUTBACK.json
@@ -0,0 +1 @@
+{"input_std":[[8.573654],[1.1484252],[0.42591482],[0.04835451],[1.1461933],[1.1471832],[1.1470121],[1.1214072],[1.0991943],[1.0701101],[1.0406059],[0.048127588],[0.048172023],[0.048212342],[0.048246387],[0.04816156],[0.0479336],[0.047585495]],"model_test_loss":0.026417279615998268,"input_size":18,"current_date_and_time":"2023-08-10_23-04-26","input_mean":[[24.135065],[-0.042271867],[0.014178805],[-0.0037389072],[-0.046595708],[-0.04610125],[-0.04491835],[-0.03922049],[-0.035844963],[-0.028552856],[-0.025264736],[-0.003948662],[-0.0038945172],[-0.0038410625],[-0.0036192732],[-0.003510406],[-0.003390137],[-0.0033347548]],"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":[[2.6313527],[0.21449536],[-2.8833015],[0.08015413],[0.14096457],[-0.4543409],[0.08164727]],"dense_1_W":[[0.4385407,0.63463783,0.060082484,-0.4217529,0.07332441,1.2808025,-0.9600021,-0.07368351,0.7437968,0.13603747,-0.09279282,0.636986,0.15792926,-0.5835893,0.2658865,-0.07900949,-0.060865946,0.10794351],[-0.006779099,2.004387,6.8607817,-0.23751183,-1.6587999,0.09422444,-0.4874676,-0.5578516,0.5310813,1.6710776,-0.91060466,1.1751448,0.7926426,-0.19524321,-0.49832276,-0.68435484,-0.74160784,0.2320687],[-0.42611358,0.49704134,0.061547905,-0.31928867,0.5029787,0.8141926,-0.7419139,-0.19156225,0.8684419,0.06434307,-0.030311767,0.6344357,0.23724514,-0.786067,0.063948646,0.2718977,-0.096927255,0.02907163],[-0.0020692998,-1.7009348,0.038647033,0.13782075,0.0035963166,-1.8036139,1.506227,-0.012708647,-0.3238854,-0.11025291,0.08421155,-0.47822404,-0.21775703,0.98227096,0.5762303,-0.2504151,-0.04809817,-0.23663491],[1.6555676,-0.24368818,0.047565427,0.48294827,-0.24731039,1.2580825,-0.6229123,-0.16432685,-0.1041179,-0.058522437,0.10651611,0.31825465,0.34657153,-0.9056155,-0.25984085,-0.22779177,0.15267563,-0.16960645],[0.0037644738,2.2035384,-0.26136458,-0.24882643,1.9434549,2.1926913,1.2461177,1.196908,0.7997137,0.6749713,0.168482,0.024462335,0.3614625,0.2324969,0.38785332,0.30951214,-0.15484615,-0.023371682],[1.6319045,0.20060556,-0.046149492,0.25747207,0.40403402,-1.5326216,1.2633929,-0.11975938,-0.27659348,-0.01779074,0.17242773,-1.23197,-0.16269825,0.64393556,0.27350065,0.7107626,0.2205556,-0.44941023]],"activation":"σ"},{"dense_2_W":[[0.688743,-0.23856077,1.3524743,-1.0059541,0.48964348,0.16091633,-0.8487965],[-0.8221493,-0.6588716,-0.39466858,0.70084,-0.7679724,0.19794145,0.25073692],[-0.3579931,0.12520991,-0.061575927,-0.33722153,-8.587289e-6,-0.65669745,0.36834475],[-0.4896118,0.09266889,-0.091803305,0.58836436,-0.09530183,-0.29224685,-0.11824604],[1.4330658,0.47080937,0.83529705,-1.4794953,1.1691287,-0.38773456,-0.850906],[-0.17573813,0.15940154,-0.0883046,0.14367807,-0.2713903,-0.58145833,0.1813966],[0.16333255,-0.5058434,-0.151819,-0.31104934,-0.48204994,-0.5709609,0.1097057],[-0.11952788,1.132746,1.7155647,-1.0979568,0.5267555,-0.32039446,-1.5178013],[-0.6666372,-0.6210934,0.08266941,-0.26039764,-0.58124655,-0.1659565,0.012729861],[-0.81480265,-0.19473615,-0.09725363,-0.25143594,-0.18920764,0.05540429,0.08028312],[0.30783543,0.53514826,0.6950099,-0.83681816,0.28347406,0.09319918,-0.9719728],[-0.5300102,-0.09198815,-0.17771126,0.35486326,0.044223923,-0.62166435,0.06565767],[0.2399586,-0.4612763,-0.2989993,0.13399556,-0.853747,-0.038706385,0.35972396]],"activation":"σ","dense_2_b":[[-0.35425124],[0.109308064],[-0.031559847],[-0.0003400682],[-0.21089287],[-0.2585232],[-0.19723703],[-1.0296504],[0.08535486],[-0.0011093448],[-0.38453248],[0.01864399],[-0.022892497]]},{"dense_3_W":[[0.16066022,-0.45942912,-0.5723236,0.33713955,0.5059241,-0.35243854,0.2291558,0.025299186,-0.2669662,0.21250063,0.36912894,-0.59875554,-0.45286608],[-0.3987386,-0.2368262,-0.4920192,0.64763784,-0.16727564,-0.56451935,0.29059148,-0.33601287,-0.3881739,0.27909118,0.092289515,0.09268704,-0.16298614],[0.29671025,-0.6581518,0.3455493,-0.5484271,-0.058288824,0.041621033,-0.29955027,0.52763146,-0.6336574,-0.5787685,0.54040813,0.41626728,0.18120344]],"activation":"identity","dense_3_b":[[-0.0040779626],[0.020526942],[-0.0043588714]]},{"dense_4_W":[[1.1190621,-0.49331972,0.6428077]],"dense_4_b":[[-0.005149732]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/SUBARU_OUTBACK_PREGLOBAL.json b/selfdrive/car/torque_data/lat_models/SUBARU_OUTBACK_PREGLOBAL.json
new file mode 100644
index 000000000..de4835015
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/SUBARU_OUTBACK_PREGLOBAL.json
@@ -0,0 +1 @@
+{"input_std":[[7.13507],[0.8047875],[0.9592971],[0.03719803],[0.81574184],[0.8139086],[0.8110526],[0.7843396],[0.7788054],[0.7745202],[0.7777087],[0.036984026],[0.03703481],[0.03710598],[0.037252665],[0.03730232],[0.0371585],[0.036896]],"model_test_loss":0.007393167354166508,"input_size":18,"current_date_and_time":"2024-01-04_23-04-03","input_mean":[[19.339607],[-0.023407113],[0.017601725],[0.0026906498],[-0.038862906],[-0.034542315],[-0.030135728],[-0.026610933],[-0.02051616],[-0.01604727],[-0.013370617],[0.0026659176],[0.0026913318],[0.0026833338],[0.002521619],[0.0023918578],[0.0022160034],[0.0019911316]],"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.05245382],[0.035864953],[-0.039355293],[1.5467168],[0.5919037],[1.5804634],[-0.11111225]],"dense_1_W":[[-0.003914714,-0.16665092,0.8045877,0.42955527,0.042900115,0.3204456,0.35248685,0.6244836,0.37365505,0.1018958,-0.27139,0.36162248,0.29024374,0.44181496,-0.25224727,-0.61896217,0.049917817,0.03403082],[0.0018431861,0.1859696,0.15934391,0.28837445,-0.3073335,-0.8031571,0.23849526,0.082833655,-0.5834504,0.17749217,-0.030166363,-0.10682262,-0.4260385,-0.38520503,0.6312785,0.7124632,-0.22725351,-0.3664909],[0.00086988,0.9063901,0.20099123,0.08871661,-0.36750826,0.2198721,0.031094799,0.19992219,-0.5177974,0.046962358,0.08928185,0.26005623,0.34793183,-0.451968,-0.38569394,0.34223,-0.38488138,0.1793232],[0.8162148,0.29020473,0.18275267,-0.35776222,-0.28510228,0.46595475,-0.6616128,0.195398,0.26881757,0.059817094,-0.13620366,-0.4805491,-0.012386888,0.39424053,0.36542693,0.031057728,0.62587917,-0.565165],[0.037288748,-0.046608564,-0.060034525,0.67498976,-0.22178993,-0.8245154,0.23886381,-0.28326404,0.111875124,-0.77013075,-1.328114,1.0840845,0.9611771,0.2557407,0.3975159,0.8245138,1.562315,2.8953738],[0.8202544,-0.25984216,-0.19078176,0.13980138,0.51260155,-0.49194804,0.34185478,-0.21916452,-0.14230296,-0.06628551,0.1172867,0.020271447,0.29334098,0.2251678,-0.67696583,0.022016034,-0.59790677,0.5738815],[0.00095800374,0.050649557,-6.683648,-0.31581786,-0.32105008,0.5734178,1.9580009,-1.7619663,-0.7830262,-0.80728334,0.9367744,-0.1321611,-0.28173265,0.20762457,-0.046792764,0.3204709,0.7585857,-0.5031118]],"activation":"σ"},{"dense_2_W":[[0.06599863,-0.077938765,-0.46291193,0.23650317,-0.027708977,0.63160855,0.6188505],[0.36912426,0.15749967,-1.2303185,-1.2359545,-0.4095874,-0.4303089,0.922016],[0.08544567,-0.43779898,0.59003,0.5278192,-0.36819986,-0.5301048,-0.44207993],[0.5843524,0.8583482,-0.88859177,-0.8168985,0.12438766,0.36272177,-0.26470038],[-0.012072821,-0.110501334,0.20674299,-0.33450037,-0.34117457,-0.35198018,-0.2976915],[-0.16229798,0.27463567,-0.19243562,0.23463425,-0.40173936,1.0653771,0.6385723],[-0.5187056,-0.773393,0.43217546,0.65371454,0.03403764,-0.6496487,0.23940846],[0.37576345,0.26045048,-1.0047446,-0.353597,0.61323655,0.2752646,0.0003494541],[0.22740726,-0.9556307,0.15197575,-0.54765016,0.30160198,-0.34819916,0.30487126],[-0.5722699,-0.54196566,0.89174616,1.0433967,0.45892256,0.113816425,-0.2416469],[-0.5446902,-0.8540217,0.2916834,-0.47284833,0.36037326,-0.46815297,-0.5791224],[0.27263904,-1.359365,0.85842407,0.54602545,-0.17842472,-0.6866763,0.72361666],[-0.06596796,-0.30877677,1.0769781,0.58296657,-0.6865365,-0.34627205,-0.57615745]],"activation":"σ","dense_2_b":[[0.037269842],[-0.135715],[0.10579589],[0.0045449715],[-0.025380367],[0.13895194],[-0.04382961],[-0.057845958],[-0.19544882],[0.032584503],[-0.027338741],[-0.041977383],[0.15147693]]},{"dense_3_W":[[-0.5543271,-0.7858436,0.31829223,-0.61404854,0.37950537,-0.4407362,-0.10451055,-0.1897724,-0.006352851,0.38131055,0.313605,0.34909454,0.10177992],[0.408599,0.1036969,0.008981054,-0.26271266,-0.19486478,0.27475658,0.05352325,-0.21086176,-0.53847146,0.051870942,-0.105526984,0.55770934,0.2596486],[0.061677825,0.32905743,-0.71210945,0.16829975,0.2798448,0.4744422,-0.42504826,0.4273275,-0.07462389,-0.15490934,-0.61943233,-0.66081953,-0.4729292]],"activation":"identity","dense_3_b":[[-0.076288804],[-0.03769022],[0.10184652]]},{"dense_4_W":[[0.5649773,0.012187176,-1.0137211]],"dense_4_b":[[-0.08833705]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/TOYOTA_AVALON.json b/selfdrive/car/torque_data/lat_models/TOYOTA_AVALON.json
new file mode 100644
index 000000000..9ae1f90bb
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/TOYOTA_AVALON.json
@@ -0,0 +1 @@
+{"input_std":[[7.154972],[1.2219579],[0.5249089],[0.04609643],[1.2129667],[1.2152725],[1.2187766],[1.1979939],[1.1835413],[1.1609851],[1.131695],[0.045940075],[0.04595876],[0.045979664],[0.04583899],[0.045701966],[0.045422513],[0.045092262]],"model_test_loss":0.008101926185190678,"input_size":18,"current_date_and_time":"2023-08-10_23-56-46","input_mean":[[25.387062],[-0.10944313],[-0.008544132],[-0.00804191],[-0.107888475],[-0.10920066],[-0.110173844],[-0.1106636],[-0.109646805],[-0.109096535],[-0.105106495],[-0.008129847],[-0.00813124],[-0.008141087],[-0.008092408],[-0.008060575],[-0.008140952],[-0.0083157625]],"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.016645644],[-0.11951427],[-3.1821578],[-0.0059933704],[2.8677177],[0.031116206],[0.20521815]],"dense_1_W":[[0.00011691521,-0.0047739935,-0.0046798335,-0.23095101,0.67633355,-1.4215347,0.22167856,0.0051140105,-0.14782095,-0.18156183,0.16303727,-0.81555355,0.058726236,0.5032197,0.574162,0.18640463,0.21730764,-0.22049814],[-0.00011825084,0.4686856,-0.009756203,0.35097203,0.10730735,0.94829154,-0.6940468,0.19106765,0.12124054,0.025897067,-0.02768527,0.53336066,-0.23076952,-0.3619648,-0.4279046,0.022291774,0.13861004,0.018763274],[-0.7304196,-0.08818808,0.56801623,-0.09857474,0.34234688,1.0349541,-0.33047348,0.61446273,0.32419196,-0.050662857,0.2637253,0.20039666,-0.47378713,-0.3956067,0.009646421,0.390048,-0.008849323,-0.2498262],[0.0060903383,-0.49549666,-0.01697434,0.22030751,0.020088006,-1.0179988,0.80875695,0.441826,0.09327719,-0.029645108,-0.40414256,-0.45891628,-0.2560797,0.59599686,-0.012949928,0.30637464,-0.16429852,-0.077907525],[0.70374584,-0.01092509,0.540549,-0.40865657,0.1392593,1.3607061,-0.68692255,0.6964351,0.19591267,0.18743542,0.12110344,-0.008305118,0.15106158,-0.94731086,0.56679606,0.27371135,0.24476646,-0.47326928],[0.003219834,-0.25791815,0.1770013,0.058168087,1.0995903,-0.48271948,0.2528091,-0.021289961,0.10542952,0.6813602,0.28741544,0.007509176,-0.5195496,0.22631004,0.0013342625,-0.17950559,-0.054088753,0.010088536],[0.012934697,-0.99158263,-7.329649,-0.14901392,0.7383594,-0.13131715,1.0090424,-0.52978915,-1.10985,-0.26590362,0.9192803,-1.023092,-0.21835378,0.3614904,0.39267102,0.17742208,0.27959663,0.0059155384]],"activation":"σ"},{"dense_2_W":[[-0.16192931,-0.46922514,0.20061032,-0.22314207,-0.3545485,0.24491267,-0.17598084],[-0.6500808,0.5197684,-0.086435065,-0.06399719,0.93517494,-0.32023647,-0.2368111],[-0.85317075,0.6300723,0.9634644,-0.26148096,-0.30289555,-0.27350643,-0.3997722],[-0.9474749,1.5257666,-0.58592016,-0.20490168,1.7460821,-0.54258883,-0.72248006],[0.61233485,-0.52019024,-0.20221208,0.75963235,-0.63291365,-0.16668685,-0.14107104],[0.5829932,0.20956525,-0.5917082,0.334232,-0.5782333,-0.37722242,0.111714475],[0.3291867,-0.077928744,-0.13658442,-0.25665778,0.35779083,0.36474347,-0.293335],[-0.121685565,0.24806523,0.18834944,-0.46779516,-0.31577477,-0.22564404,-0.23130432],[0.4297668,-0.03992685,-0.7625169,0.4358002,0.46087322,0.59285825,0.27673835],[-0.47832817,0.57294714,0.25306076,-0.7069487,-0.017084602,0.052525472,-0.30928266],[0.7133705,-0.19208045,-0.30594656,0.40949252,-0.268573,0.33327693,-0.09717502],[-0.5436785,0.2889737,0.51880294,-0.56072646,0.9260692,0.107343785,-0.1836568],[-0.936714,0.88693315,1.2621549,-0.7801531,-0.4495786,-0.3362016,-0.5123693]],"activation":"σ","dense_2_b":[[0.011130354],[0.04997472],[-0.18216753],[0.3452406],[-0.02403721],[-0.06878961],[-0.004139792],[-0.2698251],[0.015881905],[-0.16309522],[-0.029837111],[0.04389526],[0.0100675905]]},{"dense_3_W":[[0.59172153,-0.13653415,-0.40732333,-0.29746622,0.42562142,0.1004339,-0.005074904,0.06819323,0.40120095,-0.28921607,0.5362933,-0.52448,-0.6777314],[0.2645431,0.3248634,-0.5370929,0.124842614,-0.29716966,0.063039936,0.011938057,0.31424755,0.38555825,-0.09687765,-0.33130735,-0.3187058,0.33251473],[-0.19941787,-0.4079571,-0.42453167,-0.505169,-0.03318176,0.3900114,0.53974134,-0.019272683,0.004807314,0.32995415,0.29342985,-0.40301663,0.2627771]],"activation":"identity","dense_3_b":[[0.04678321],[-0.041011743],[0.04454892]]},{"dense_4_W":[[-1.0930591,0.32782602,-0.2925129]],"dense_4_b":[[-0.047076307]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/TOYOTA_AVALON_2019.json b/selfdrive/car/torque_data/lat_models/TOYOTA_AVALON_2019.json
new file mode 100644
index 000000000..82716f590
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/TOYOTA_AVALON_2019.json
@@ -0,0 +1 @@
+{"input_std":[[7.541552],[0.9650358],[0.3616818],[0.0328642],[0.9578452],[0.96073836],[0.96248627],[0.9491477],[0.9337077],[0.908715],[0.8812584],[0.032887284],[0.03287074],[0.032852463],[0.03271584],[0.03264729],[0.032499015],[0.03240248]],"model_test_loss":0.008866102434694767,"input_size":18,"current_date_and_time":"2023-08-11_00-47-36","input_mean":[[27.210583],[0.020935686],[-0.008948258],[-0.0069724205],[0.023982191],[0.02277414],[0.021633722],[0.018200217],[0.016092353],[0.01634521],[0.017552482],[-0.0069776564],[-0.0069683734],[-0.0069624],[-0.006934479],[-0.006922422],[-0.0069089876],[-0.0069400943]],"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.13328256],[-0.19930688],[1.0697682],[-0.5783517],[-1.5640957],[-0.92074555],[0.96863127]],"dense_1_W":[[-0.06047806,0.59424174,0.13268892,-0.21197622,-1.1050072,1.247896,-0.24135092,0.1444364,0.14218198,-0.2759823,-0.18579857,0.7423415,0.22738951,-0.2590543,-0.6573962,-0.107646905,-0.07558396,0.037075613],[-0.058194548,1.2433497,5.1614676,-0.020125298,-0.25091216,0.578058,-0.16740562,0.6148966,0.31894976,-0.42848128,-1.5423061,0.5142165,0.0080127595,-0.24593866,-0.23782809,-0.28146613,-0.10563642,0.2612805],[0.7431013,-0.52715963,-0.0064738155,-0.08120712,-0.10666046,-0.039603,-0.2889496,-0.27379817,-0.18491645,-0.2114326,-0.031808507,0.067143545,0.24152419,-0.46100402,0.12406786,0.5035436,0.19000971,-0.40269852],[-0.093319766,-3.5038989,0.026366359,-0.10428085,-1.5910784,-2.6836565,-1.729896,-1.2727953,-0.6854482,-1.3142506,-0.82473946,-0.24805659,0.30157104,0.10064682,-0.2649021,-0.45221263,-0.003649908,0.3906365],[-0.19653389,-1.1956127,-0.0013261554,0.20242849,0.5268085,-1.1662431,0.5995818,-0.21107472,0.035844564,-0.37587917,-0.010125557,-0.5800509,0.2748382,0.28321275,0.2552108,-0.22593613,0.1699103,-0.20041217],[-1.6779865,0.010922188,0.2911208,-0.18096207,0.6596778,-0.7872427,1.278464,0.4307826,-0.2584428,-0.3280948,-0.16272934,-0.3561698,0.31419376,0.30760053,0.45000735,-0.60065556,0.07380751,-0.7342767],[0.22576395,-1.2693808,0.00051059003,0.22724408,0.53528285,-1.052841,0.42936927,0.15097113,-0.21617922,-0.10659611,-0.13288835,-0.32452956,-0.29022405,0.43584242,0.565457,-0.4026171,0.10766105,-0.16005303]],"activation":"σ"},{"dense_2_W":[[0.40149835,0.36675823,-0.29831505,0.37289986,-0.6039201,-0.027274264,-1.1339715],[0.95495695,-1.3851566,0.358178,0.49656358,-1.2546502,-1.3234615,-0.39220563],[-0.84305114,0.33130413,-0.39270082,0.1366223,0.8356403,-0.71874714,0.6702931],[0.32502848,0.22423606,-0.3198426,0.69494843,-0.84058,-0.57765996,-1.1503054],[-0.55475,-1.0512786,-0.467161,0.23049785,1.171586,0.24218969,-0.14599386],[0.27919522,-0.6080323,0.83328724,0.4167502,-0.11279212,-0.19312277,1.0808055],[-0.98002326,-0.06683307,0.073704205,-0.7713237,0.36600292,0.32792312,-1.2809395],[-0.099299915,0.7157585,-0.69559073,-0.74590826,0.03745077,0.67139316,-1.3220712],[-1.1977009,-1.1743606,-0.8824673,0.82422435,1.4812046,0.54254943,-0.24748902],[-0.94787806,0.20738822,-0.0680158,-0.47344378,0.016936,-1.4717607,0.38640186],[-0.27705613,0.5600628,-1.2770342,-1.2288101,0.3837186,0.54160005,-1.0739172],[1.0531577,0.14682527,0.31090853,-0.22525707,-0.51124835,-0.16686235,-0.69970435],[0.54132354,-0.55377156,0.16552292,0.4777185,-0.91318285,-0.39976725,-0.8804106]],"activation":"σ","dense_2_b":[[-0.15207723],[-0.4524892],[-0.31112808],[-0.14511883],[-0.2907099],[0.035733145],[-0.59132564],[-0.091714524],[-0.3527001],[-0.18239608],[-0.123493806],[0.0051953667],[-0.010544346]]},{"dense_3_W":[[0.39324093,0.2485198,0.08692321,-0.18120968,-0.0657239,-0.034891907,0.5671789,0.31177345,-0.93040633,0.09452528,-0.25895926,-0.034117304,0.25137582],[0.25416353,0.0061438996,0.28148532,0.6699385,-0.74332523,-0.50077397,-0.46912852,0.711142,-0.830241,0.33939067,-0.19935456,0.069085754,0.578044],[-0.30625167,-0.4704901,0.5801462,-0.38525173,0.31889287,0.25167635,-0.11409451,-0.62698126,0.7056928,0.44565654,-0.42508173,-0.60673165,-0.41772822]],"activation":"identity","dense_3_b":[[-0.068453945],[-0.056202423],[0.09645773]]},{"dense_4_W":[[0.16098852,0.15347017,-0.7822183]],"dense_4_b":[[-0.068720676]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/TOYOTA_AVALON_TSS2.json b/selfdrive/car/torque_data/lat_models/TOYOTA_AVALON_TSS2.json
new file mode 100644
index 000000000..4d6b4af06
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/TOYOTA_AVALON_TSS2.json
@@ -0,0 +1 @@
+{"input_std":[[8.376422],[1.2837375],[0.54391617],[0.049378082],[1.2814487],[1.2804018],[1.2795964],[1.2587454],[1.2385764],[1.21357],[1.1835355],[0.049072966],[0.049108904],[0.049148303],[0.049186878],[0.04908979],[0.048760086],[0.048228707]],"model_test_loss":0.009066876024007797,"input_size":18,"current_date_and_time":"2023-08-11_02-01-41","input_mean":[[23.067575],[-0.03366158],[0.0044186297],[3.4665016e-5],[-0.033809688],[-0.03444663],[-0.03468704],[-0.03309283],[-0.032493494],[-0.034124184],[-0.029784737],[-0.00010160864],[-7.466988e-5],[-4.264505e-5],[5.8855418e-5],[0.000106093255],[7.4934855e-5],[4.8816368e-5]],"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.1810939],[0.052338526],[-0.030882858],[0.033140995],[2.9087296],[-2.895278],[0.054216754]],"dense_1_W":[[-0.022466678,-0.079283744,0.015348881,-0.093145974,-0.50897855,1.1005377,-0.3424491,0.16023882,0.24858536,-0.28342143,0.08719842,0.11321456,0.25237224,-0.3242571,-0.16660848,0.08039433,0.2296425,-0.12092014],[-0.010926074,-0.5342929,0.014211034,-0.22288138,0.12526701,-0.6431979,0.11048157,-0.027558114,0.5129509,0.031701602,-0.28270888,-0.3469483,-0.0359589,0.3054121,0.42384326,-0.21366577,0.24789678,-0.21054278],[0.0015054089,-1.0920098,-4.1715555,0.42466384,0.8594457,-0.057574112,0.195077,-0.14336777,-0.934818,-0.14249723,1.1195656,-0.50157344,-0.34849435,0.4064381,-0.10914302,-0.09259135,-0.043489303,0.17882638],[0.00050957524,-0.5727624,0.02629925,0.039537206,0.07295519,-1.0905142,0.65514714,-0.22721705,0.10285973,0.015500398,-0.07354051,0.10782978,-0.2973014,0.10234221,0.40134785,0.31354493,0.075327724,-0.033144545],[1.1313975,0.27665266,0.21540989,0.474714,-0.542695,0.45748472,-0.534559,0.33019224,-0.00932876,0.37130055,0.01740698,-0.07030619,0.3058859,-0.33302706,-0.18166807,0.05664913,-0.020655787,-0.18409492],[-1.1192006,0.46339068,0.21362849,0.07990121,-0.11141043,0.052170627,-0.7601721,0.25794908,0.29454672,-0.019299706,0.18099277,-0.069216594,0.12746179,0.16600643,-0.2266845,0.04666312,0.26312882,-0.34587502],[-0.033930384,-0.5281495,-0.02478823,0.35514218,0.37443575,-0.93885845,0.8630589,0.32345197,-0.43721947,-0.22540626,0.31314182,-0.19791576,-0.45503795,0.42438814,0.15826641,0.10125901,-0.2744716,-0.007187695]],"activation":"σ"},{"dense_2_W":[[1.0154629,-0.040800903,-0.29480615,-0.579116,0.63008493,-0.16830389,-0.52992606],[-0.44676533,0.70518833,0.22363839,0.3335365,0.15123695,-0.5413408,-0.18469663],[-0.15817617,0.34588996,0.3173453,0.2432257,0.2876003,-0.55385196,0.09101465],[0.30243352,-0.56498605,-0.47895545,-0.24933416,-0.20325784,0.55106956,0.04037954],[0.03340286,-0.7613887,0.005524847,-0.34229973,0.020817522,0.70795476,-0.58045375],[0.32800585,-0.61029744,-0.37881643,-0.0494688,0.6649441,0.5878182,-0.693103],[-0.78130317,0.32768852,0.0486751,0.6938225,-0.6449391,0.19077687,-0.20455292],[-0.003070534,-0.25178492,-0.1787414,-0.18577683,-0.855277,0.05078717,-0.23962548],[-0.8574637,-0.55484927,0.11038485,-0.22769281,-0.8112205,-0.5803483,0.39239252],[-0.02281288,-0.18713373,-0.18762249,-0.36472616,0.6542259,0.41985798,-0.57571363],[-0.37003383,-0.7053904,0.16818082,-0.6309228,-0.42156786,0.28068355,-0.52919596],[0.7441994,-0.606726,-0.21135445,-1.1177553,-0.23082832,0.5370549,-0.3296431],[-0.82947385,0.6298715,-0.0031728123,0.59570336,-0.2874936,-0.56689715,0.31978017]],"activation":"σ","dense_2_b":[[0.12730335],[-0.017174786],[0.008333773],[-0.1725905],[-0.08095016],[0.022734491],[-0.03200295],[-0.2865707],[-0.23485084],[-0.041974284],[-0.26037046],[0.00494856],[-0.008746482]]},{"dense_3_W":[[0.5768022,-0.69957966,-0.57344234,0.18022925,0.18167411,0.10279416,-0.60731447,0.57294464,-0.15860513,0.55548793,-0.0742402,-0.03724561,-0.46468896],[-0.6463308,-0.08468973,-0.057763796,-0.15337418,-0.5244671,-0.41263047,0.41524106,0.17037424,-0.16188715,-0.28470117,0.10638861,-0.22415741,0.76425564],[-0.30938473,0.20329902,0.43855524,0.0105835125,-0.13655424,-0.32343802,0.59270227,0.6068919,0.56710804,0.56215036,-0.60497534,-0.4761755,-0.007562395]],"activation":"identity","dense_3_b":[[-0.028258],[0.046470042],[0.021202732]]},{"dense_4_W":[[0.7616137,-1.0874788,-0.41413057]],"dense_4_b":[[-0.037305925]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/TOYOTA_CAMRY.json b/selfdrive/car/torque_data/lat_models/TOYOTA_CAMRY.json
new file mode 100644
index 000000000..112a02973
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/TOYOTA_CAMRY.json
@@ -0,0 +1 @@
+{"input_std":[[8.383597],[1.5203282],[0.5082514],[0.0518889],[1.5132513],[1.5174434],[1.5199335],[1.4851471],[1.4453254],[1.3881189],[1.3348266],[0.051785868],[0.051798876],[0.051812388],[0.051785596],[0.051688608],[0.051483054],[0.051126033]],"model_test_loss":0.009930684231221676,"input_size":18,"current_date_and_time":"2023-08-11_08-01-58","input_mean":[[25.470009],[0.0042077163],[-0.0003353114],[-0.0023303148],[0.0042589367],[0.0040556374],[0.0040202853],[0.0027058893],[0.0012695856],[0.0030413663],[0.005136044],[-0.002385892],[-0.0023771315],[-0.0023616166],[-0.0023057486],[-0.0023015393],[-0.0022862742],[-0.0023375773]],"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":[[-1.2718573],[0.15701862],[3.248821],[-3.5744123],[0.004125263],[-0.7583393],[-0.037708215]],"dense_1_W":[[-0.2879904,1.5954516,-0.0046582473,0.06479758,0.29433665,0.8528065,-0.6544351,-0.4978888,-0.0794865,0.468229,-0.05461509,0.9035509,0.15841998,-0.54152334,-0.4469752,0.07425236,-0.11780557,0.12198392],[0.006679829,0.40255344,0.009154457,-0.16641183,-0.39951205,1.4443473,-0.9139237,-0.057986554,-0.11843848,-0.0044754846,0.0925529,0.5124026,-0.0049318043,-0.2537788,-0.14938481,-0.224736,0.047049627,0.13330497],[1.7283604,-0.05969189,1.0530555,0.27028522,0.47397172,0.5086671,-0.63976616,-0.19285004,0.49581873,0.13492277,0.20006694,0.06384355,0.24601626,-0.3723971,-0.032245487,-0.13195412,0.31266445,-0.18301867],[-1.8633327,0.22747979,1.1220167,-0.02145294,0.28228733,0.85233575,-0.9075951,0.069776304,-0.18778838,0.56500834,0.1422919,0.41182467,0.2542804,-0.911527,0.53582734,0.023306668,0.07635535,-0.1735968],[0.022620516,-2.0202289,-4.6984797,0.37025738,1.6879617,-0.1484365,0.5125165,-0.90959346,-1.2976298,0.01080667,1.3414408,-0.295309,-0.27262625,0.2460714,0.11705216,0.34596816,-0.040567875,-0.3704739],[-0.1562062,-1.5769467,0.00974286,0.12022318,-0.060521524,-0.64386684,0.3535075,0.28329223,0.20385851,-0.23411226,-0.05331302,-0.43988168,-0.62577605,0.77806795,0.18664421,-0.41524816,0.19130825,0.045515057],[0.0025923399,-0.49789965,0.0048285224,0.0648064,0.5884254,-1.1329092,0.41850495,-0.10409346,-0.48019585,0.07617594,0.13875124,-0.41700658,-0.12853211,0.72437525,0.18255632,0.032605115,0.12712069,-0.07419187]],"activation":"σ"},{"dense_2_W":[[-0.7156104,-0.68829536,-0.7385952,0.55841655,0.26912323,0.6066667,-0.12475776],[-0.511934,-0.9153065,-0.6389169,0.3585597,0.2839266,0.5098371,0.50414217],[0.2944038,0.5859187,-0.5172965,0.3677821,0.054128557,-0.08085657,-0.89583373],[0.33193415,-0.5547596,-0.023806248,-0.48235148,-0.221697,0.033068255,0.5705964],[-0.46894178,-0.10590048,0.21662314,-0.040064402,-0.3858671,-0.44947234,0.59122],[-0.60725653,0.3228978,0.1861176,-0.2924726,0.42708892,-0.082993455,0.22582808],[-0.2562046,0.8381702,0.31616238,0.24505608,-0.12987854,-0.6930256,-0.76575553],[0.61845154,0.60325474,-0.575144,0.40564325,-0.714385,-0.21887647,-0.94107187],[-0.54684615,0.11815464,-0.6585375,-0.25468546,-0.09934533,0.117599614,-0.38795406],[0.16209334,-0.35611826,-0.15108901,-0.21047153,-0.3256097,0.28901953,0.80304426],[0.027611624,0.50159204,0.619658,-0.12446912,-0.59465826,-0.037129514,-0.21241622],[0.27525434,0.5680337,-0.107110925,0.24088366,0.043958385,-0.86346936,-0.64997584],[-0.024266828,-0.11527472,0.3829225,-0.17169206,0.08911536,-0.8643167,0.06748397]],"activation":"σ","dense_2_b":[[-0.17570926],[-0.14594816],[-0.05026906],[0.027095933],[-0.04517862],[0.06473192],[-0.028851002],[-0.12211885],[-0.27259725],[0.014737305],[0.02095205],[-0.070182],[-0.09559173]]},{"dense_3_W":[[0.4202054,0.703193,-0.3041087,0.48369282,0.1436207,0.37104702,-0.63816553,-0.58745027,0.13683067,0.5385481,-0.46124828,-0.5352316,0.19800703],[-0.86401147,-0.18695252,0.62547266,-0.68338186,0.10880029,0.3713409,0.027055534,0.41835827,0.27228013,0.11604386,-0.0106600085,0.20140606,-0.10059595],[0.056002628,0.035810802,-0.3965656,0.3976536,0.1726735,0.31009713,-0.09359465,-0.0209684,-0.26736382,-0.1666654,-0.5963385,0.03144756,-0.447781]],"activation":"identity","dense_3_b":[[0.022595499],[-0.16177715],[0.034701686]]},{"dense_4_W":[[-1.0497395,0.08801628,-0.6607149]],"dense_4_b":[[-0.026550818]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/TOYOTA_CAMRY_TSS2.json b/selfdrive/car/torque_data/lat_models/TOYOTA_CAMRY_TSS2.json
new file mode 100644
index 000000000..3b3aae741
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/TOYOTA_CAMRY_TSS2.json
@@ -0,0 +1 @@
+{"input_std":[[8.547318],[1.4036797],[0.56934917],[0.04350854],[1.398559],[1.4011317],[1.40228],[1.3770106],[1.348263],[1.3074721],[1.2626077],[0.04330501],[0.043371696],[0.04343371],[0.04348332],[0.043410856],[0.04321263],[0.042814735]],"model_test_loss":0.008338634856045246,"input_size":18,"current_date_and_time":"2023-08-11_11-04-26","input_mean":[[23.64889],[-0.08561094],[0.015752671],[-0.004257724],[-0.08625081],[-0.08638373],[-0.08567994],[-0.077275604],[-0.06842236],[-0.056570813],[-0.04640004],[-0.004200933],[-0.004198378],[-0.004202762],[-0.004259174],[-0.004245101],[-0.0042204647],[-0.00425349]],"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":[[1.1003305],[-0.9280888],[-0.27994263],[-0.03601646],[1.0726995],[1.5954292],[-0.07318528]],"dense_1_W":[[0.6028892,-0.5008186,-0.024919089,-0.12623027,-0.4729594,-0.38648638,0.2822896,0.09087385,0.01636962,0.024747238,-0.29404536,-0.18406688,-0.31876472,0.48221767,0.5086306,-0.06562299,-0.21337883,0.11643904],[-1.1941831,0.17382993,0.22181809,0.23333201,0.5458071,-0.43223855,0.5926918,0.3491883,0.1278165,0.50286424,-0.43537652,0.19344032,-0.26665846,0.11812404,-0.28001395,-0.3216877,-0.14064364,0.15485847],[0.07623883,1.5235251,6.7465596,-0.13723375,-0.80104774,-0.61400336,-0.39275688,0.5211227,0.37626675,0.3823852,-0.80926275,0.23730527,0.34998953,0.20261207,-0.464487,-0.30715373,-0.26015738,0.43704194],[0.12629938,-0.28819624,-0.09535608,0.16085212,-0.16898133,-0.6793061,0.43381187,-0.2702881,0.065844,-0.1441075,0.040372517,-0.117076926,-0.32687485,0.5354,-0.1250812,-0.19841617,0.3460908,-0.06750503],[0.4682372,0.59703195,0.034524012,-0.006926566,0.060249697,1.3168854,-0.9804278,0.074283265,-0.18839869,-0.07103339,0.32018688,0.041558877,-0.04179399,0.012026822,-0.15508115,-0.1332163,0.27430537,-0.18467638],[1.3037213,0.2139271,0.22422606,0.17373297,0.19543481,0.09874217,0.3998748,0.6430583,0.08877143,-0.05584769,-0.13569269,-0.4579002,0.12869297,0.39104635,-0.1829238,-0.2530643,-0.1974048,0.08369768],[0.088082924,-0.44940168,-0.19933243,0.07069701,0.7149304,-1.0380019,0.71266985,-0.4369744,-0.552529,-0.23388147,0.6032971,-0.16139722,-0.3540249,-0.026191853,0.60969,0.28289405,0.11056004,-0.31100357]],"activation":"σ"},{"dense_2_W":[[-0.6133522,0.1761722,-0.71424717,-0.0936426,0.8682251,-0.24639517,-0.30397138],[0.34320208,-1.0336052,-0.4439255,-0.2739278,0.3367824,-0.3631442,-0.98396087],[-1.6413774,0.08594568,0.71144843,-1.0480727,-0.11629067,-1.6811962,-0.8675772],[0.47143686,0.089915365,0.26338518,0.68463236,-0.97531956,0.32513487,0.65076643],[-0.87128234,0.064365715,0.1303472,-0.75249237,-0.25511387,-0.7430213,-0.28605184],[-0.7603966,-0.29632324,0.0682258,-0.7471322,0.5153051,-0.53268844,-0.21521862],[-0.3656277,-0.07363712,0.18693501,-0.9983321,0.69527906,-0.45794705,-1.0309372],[0.2617154,0.46204823,-0.6687536,0.82395816,-0.88860583,-0.33870435,0.4618431],[-0.39958304,-0.23751055,-0.8149946,0.19134824,-1.4698569,-0.43517134,0.62668824],[-1.4046016,2.1539013,-3.988871,-0.39821678,-1.9340425,-2.1167135,-1.0858109],[0.38306925,0.64414614,-0.5527955,0.6701854,-0.68190986,-0.18758336,0.7660656],[-0.82904243,-0.2745322,0.2605575,-1.0301431,0.27432004,-0.93553334,-0.739551],[-0.23676038,0.9406503,-1.986441,-0.4191224,-1.5621673,-0.88484937,0.3910027]],"activation":"σ","dense_2_b":[[-0.027016891],[0.08464052],[0.028135099],[-0.38301256],[-0.3638506],[-0.040266816],[0.16827495],[-0.36882532],[-0.40422207],[0.02508533],[-0.56583065],[0.09229101],[-0.416409]]},{"dense_3_W":[[0.0040040226,-0.6369987,-0.71731246,0.6850001,0.09157595,-0.41231555,-0.90613884,0.46305528,0.5752972,0.6877244,0.514109,-0.35633194,0.5317168],[0.1646857,0.52076554,0.14491199,-0.7185544,-0.07474149,0.60757786,0.53968096,-0.19788566,0.4318167,-0.51503956,-0.30411977,0.5457501,0.3619558],[-0.47842056,0.16373217,-1.109826,0.52913445,-0.5961691,-0.18387295,0.009211785,0.38275075,0.036590163,0.72789955,0.15105984,-0.82491213,0.72040874]],"activation":"identity","dense_3_b":[[-0.1681641],[0.029928174],[-0.06739022]]},{"dense_4_W":[[-0.72666985,0.20831722,-0.5900348]],"dense_4_b":[[0.07989163]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/TOYOTA_CHR.json b/selfdrive/car/torque_data/lat_models/TOYOTA_CHR.json
new file mode 100644
index 000000000..90ff54f85
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/TOYOTA_CHR.json
@@ -0,0 +1 @@
+{"input_std":[[7.266456],[1.0311108],[0.42161182],[0.035121582],[1.0182426],[1.0210766],[1.024199],[1.0197712],[1.0053324],[0.98283356],[0.95835906],[0.03495412],[0.034997974],[0.03503269],[0.035035565],[0.034975693],[0.034770522],[0.034426987]],"model_test_loss":0.011608563363552094,"input_size":18,"current_date_and_time":"2023-08-11_04-58-44","input_mean":[[25.311535],[-0.031563792],[0.0060295113],[0.0037024636],[-0.034909807],[-0.034477167],[-0.03452592],[-0.032167524],[-0.028398417],[-0.025096538],[-0.02253926],[0.0035288066],[0.0035584755],[0.0035877393],[0.0036529114],[0.0036560637],[0.003644573],[0.0036541703]],"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.06250458],[0.7717496],[2.6856744],[-3.0798275],[-0.047530472],[-0.1521214],[-0.86107486]],"dense_1_W":[[-0.0058309548,1.6388441,6.026957,-0.7815384,-3.1444395,0.29995996,-0.6111942,1.4489828,1.5309435,0.9753039,-2.0177133,0.991274,0.99092865,-0.50581515,0.16233689,-0.99065316,-0.67018527,0.90234095],[-0.42814094,-0.57456744,0.0007794493,0.023858974,0.11595472,-1.2281862,0.6903777,0.243981,0.38887268,-0.085606225,-0.22763428,-0.020143623,-0.5932556,0.34875482,0.60443676,-0.12836404,0.1324796,-0.18602186],[1.1931428,0.05919804,0.05402463,-0.55798566,-0.36006367,0.7021459,-0.3192777,-0.27177683,0.6936569,1.2172635,0.96187454,0.38691327,0.35159546,0.032515947,0.16563621,-0.22681683,-0.04875851,-0.2965481],[-1.2964138,-0.2337551,0.0634739,-0.31843027,-0.3538266,1.1500596,-0.8726868,0.0036669122,1.0422454,1.1141241,0.9607149,0.40760738,0.06241413,0.11646168,-0.073522024,0.22547582,-0.30052686,-0.31555784],[0.0072235786,0.5063357,0.9562675,-0.48209998,-0.27141708,1.5686616,-1.061574,0.5231472,1.0100089,0.05071974,-1.886694,0.41332957,-0.06334984,-0.97750497,0.6102102,0.22696678,-0.06319088,0.0048847888],[0.006333134,1.688374,-0.0095348805,-0.66412175,0.28531587,2.01203,-0.1819137,-0.7547143,-0.31330884,0.35432032,0.33640975,0.016374094,-0.13819215,-0.15855257,0.40649945,0.33540976,-0.0046302704,-0.35495433],[0.4090967,-0.19826725,-0.0013017637,-0.5116933,0.38453588,-1.7476666,0.8353978,0.15093791,-0.14092202,0.31026828,-0.26896203,-0.28421417,-0.206051,0.5156937,0.7495738,0.24013326,-0.16817766,-0.15013888]],"activation":"σ"},{"dense_2_W":[[-0.28553647,0.51897234,0.3232974,-0.14583516,-0.6494069,-0.18854451,0.45899993],[-0.18945166,-0.7805358,0.21762379,0.06925927,0.1412742,-0.54521996,-0.49447703],[0.41819847,0.7103663,-0.36324528,-0.54330885,-0.2780997,-0.21234678,0.45622718],[0.45189,-0.30940267,0.2796695,-0.10068664,0.33236605,0.39892736,-0.23690474],[-0.00033029245,-0.2876081,0.21365881,-0.263795,-0.7780459,0.21173872,0.754661],[-0.4982613,-0.41572687,0.6875971,0.3845866,-0.026780535,0.85438734,-1.1519399],[-0.4147085,0.22912927,-0.54870033,0.3551388,-0.4057759,-0.1996842,0.34155196],[-0.46657288,-0.743298,-0.65183616,-0.358357,0.16232346,0.19327608,-0.015862346],[-0.5780829,0.48190355,0.42865816,-0.360802,-0.6834505,0.55482894,0.14401308],[0.51356256,-0.76134664,-0.3057201,0.3803027,-0.00610297,0.3648528,-1.0003062],[-0.690029,0.5113393,-0.7087683,0.38381904,-0.08314878,-0.2460164,-0.0017047548],[-0.2095539,-0.88663155,-0.05008726,0.3074065,0.52681,-0.06860818,-0.748798],[-0.44802594,-0.3936492,0.163376,-0.55659366,-0.3931171,-0.76979935,0.38669378]],"activation":"σ","dense_2_b":[[-0.017743433],[-0.26510626],[-0.018595928],[-0.17289363],[0.02423361],[-0.006021742],[-0.0071125105],[-0.2604571],[0.09466738],[-0.0020451464],[-0.07033006],[-0.2086756],[-0.26478064]]},{"dense_3_W":[[-0.53581256,-0.22029524,-0.03227938,0.33162057,0.11482841,0.61525244,-0.26008266,0.6051382,0.45775265,0.43236297,-0.58764994,-0.07332099,-0.5288951],[-0.18867671,0.37646073,-0.3081562,0.23591055,-0.38460404,0.13270791,-0.61747444,-0.24434201,-0.16632886,0.723561,-0.37653255,0.03962427,-0.027843077],[0.30763236,-0.4282034,-0.46785048,0.21578372,0.20392036,0.38424364,0.31873167,0.18515399,-0.6173425,0.64338654,-0.038045872,0.49573293,0.5208863]],"activation":"identity","dense_3_b":[[-0.009245349],[-0.0014893641],[-0.022675076]]},{"dense_4_W":[[0.41954702,1.1624148,0.5703593]],"dense_4_b":[[-0.004366342]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/TOYOTA_CHR_TSS2.json b/selfdrive/car/torque_data/lat_models/TOYOTA_CHR_TSS2.json
new file mode 100644
index 000000000..d7b16b706
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/TOYOTA_CHR_TSS2.json
@@ -0,0 +1 @@
+{"input_std":[[7.92219],[1.0339159],[0.6051184],[0.040277395],[1.0160568],[1.0193809],[1.0235395],[0.9978284],[0.9780647],[0.953401],[0.92466515],[0.04011991],[0.040149756],[0.040181845],[0.040220965],[0.040193263],[0.039972864],[0.039762717]],"model_test_loss":0.010501861572265625,"input_size":18,"current_date_and_time":"2023-08-11_06-39-21","input_mean":[[22.015877],[0.016454747],[-0.0035791518],[-0.006060402],[0.017588632],[0.018613027],[0.01872038],[0.01622388],[0.013543572],[0.008158607],[0.0060163783],[-0.0061950283],[-0.006164029],[-0.006132473],[-0.0060454626],[-0.006085043],[-0.0062024957],[-0.006308306]],"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.08562436],[-0.13248813],[-0.6056908],[3.7711034],[-4.002061],[-1.0201851],[0.7905752]],"dense_1_W":[[0.008472031,1.9303364,5.75964,-1.236273,-1.9233848,-0.20769979,-0.50922215,0.77782845,0.93831205,1.015304,-1.6144773,0.83374774,0.7880719,-0.17530817,-0.22706063,-0.8191557,-0.19291312,0.83966184],[-0.007752059,-1.7240039,0.08638296,0.4374327,0.8499669,-0.58740795,0.44271347,-0.43893647,-0.79377645,-0.470287,0.6905167,-0.25326452,0.004325121,0.4151441,-0.20191722,-0.93765545,0.24482074,0.20686845],[-0.73755896,0.25490418,1.6415513,0.61049616,0.10450067,-0.005047854,0.26623517,-0.40121377,-0.57618237,-0.105919234,0.49663854,-0.18851577,0.003680681,0.07382204,-0.7838218,-1.418447,-0.8041371,0.06338623],[1.506414,-0.7172249,-0.26160046,-0.3195705,0.061357655,-1.2254318,1.7426652,-0.39996,-0.8630745,-0.0965681,0.1755039,-0.43433473,0.072750255,0.7390096,0.6420074,-0.6429821,-0.19715068,0.40123448],[-1.462788,-0.25966784,-0.25197747,-0.74088174,-0.39430162,-0.6678362,1.4408759,-0.8539805,-0.67458963,-0.0025512646,0.098765895,-1.3845773,0.84524035,1.4456284,0.8360301,-0.89562434,-0.39231324,0.55299884],[0.96476454,-0.5160151,-0.058161568,0.09431531,0.24567744,-1.7172141,0.87807894,0.32966504,0.13244158,0.0830991,-0.20607454,-0.7199951,-0.3938647,1.0462891,0.21604428,0.09326921,0.23194839,-0.21566468],[-1.0580249,-0.091983035,-0.06607944,-0.14238882,-0.032799177,-1.615105,0.88772935,-0.1148385,0.30407813,0.14823009,-0.25907746,-0.43574435,-0.119376965,0.4874739,0.5467528,0.2210292,-0.21703728,0.02701344]],"activation":"σ"},{"dense_2_W":[[-0.34801432,0.25854328,-0.10087859,0.91155136,0.47692245,0.386249,-0.07805484],[-0.114083804,0.08665275,-0.40829253,0.5105505,0.50143373,0.42545924,0.43460196],[-0.07745485,0.19914009,0.59899527,-0.86949354,-0.60257334,-0.27688003,-0.39490694],[-0.35776904,-0.09782943,-0.3387631,-0.6445889,-0.13637964,0.037489194,-0.4306386],[0.3664335,0.082265064,-0.3529968,-0.21454561,-0.690712,-0.40638104,-0.22740813],[-0.0052428595,0.06399636,-0.4362087,0.3643625,0.1340138,0.880946,0.51570714],[-0.42193365,-0.1661316,-0.4134133,0.069665395,-0.19969232,-0.49261189,-0.5509127],[0.429386,-0.04167956,0.069151536,0.054689564,-0.50504297,-0.5080177,-0.41438618],[0.61227196,-0.043998886,0.32082903,-0.45597827,-0.52242905,-0.10526631,-0.43464538],[-0.23791881,0.37427938,0.07763096,0.38759655,0.6870389,-0.2448108,0.22891921],[0.28850517,0.116395116,0.22972369,-0.40831333,0.26074657,-1.0264262,-0.5928814],[-0.8139447,-0.14806162,0.15462387,-0.42620218,-1.2090021,0.666371,-0.6178426],[-0.63677526,0.8647508,0.5548903,0.1261759,0.304771,0.28499243,-0.14660935]],"activation":"σ","dense_2_b":[[-0.21753441],[-0.5461314],[0.105829634],[0.15688233],[0.18240593],[-0.6977311],[0.17758703],[0.21791771],[0.110497065],[-0.45180324],[0.19605672],[-0.012792069],[-0.2483234]]},{"dense_3_W":[[-0.075603865,-0.4466055,0.2090132,0.44769254,0.5857853,-0.0886282,0.6599453,0.52339387,0.18296923,-0.4225845,0.26281965,-0.10703673,-0.6357655],[0.6664568,0.21380727,-0.21715312,-0.17340335,-0.029390512,0.43210483,-0.19127384,-0.4889734,-0.27069238,-0.16609475,-0.29695383,-0.6717075,0.570048],[-0.49318448,-0.535808,0.0617476,-0.29404658,0.3541034,-0.5322448,0.15549439,0.55970424,0.3449248,0.16689838,0.35094023,0.17978139,0.0012035011]],"activation":"identity","dense_3_b":[[0.009320866],[-0.014181249],[-0.008072699]]},{"dense_4_W":[[0.9121412,-0.99914575,0.15805192]],"dense_4_b":[[0.015280737]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/TOYOTA_COROLLA.json b/selfdrive/car/torque_data/lat_models/TOYOTA_COROLLA.json
new file mode 100644
index 000000000..20e865048
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/TOYOTA_COROLLA.json
@@ -0,0 +1 @@
+{"input_std":[[8.101178],[1.576821],[0.6001426],[0.05129009],[1.5563219],[1.5635437],[1.5707226],[1.5433452],[1.5103695],[1.4539864],[1.3962219],[0.051048342],[0.051107466],[0.051158227],[0.051144693],[0.05100346],[0.05054137],[0.049878743]],"model_test_loss":0.0073623862117528915,"input_size":18,"current_date_and_time":"2023-08-11_16-04-06","input_mean":[[24.654629],[-0.08590741],[-0.0009184312],[-4.0871888e-5],[-0.081669286],[-0.08285683],[-0.085108146],[-0.08099603],[-0.07861437],[-0.07853552],[-0.07747747],[-6.709087e-5],[-5.751621e-5],[-5.7667265e-5],[-0.000100658726],[-0.00015130512],[-0.000163422],[-0.0002661297]],"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.21534623],[-0.118863985],[-0.3162109],[-0.008301526],[-0.20225163],[-0.81838286],[-0.44373506]],"dense_1_W":[[-0.010962684,1.3271043,-0.2114807,-0.23165482,-0.46575153,1.4799869,-0.1840072,-0.33480445,-0.25981382,0.6701327,-0.23557165,0.70862395,-0.25953412,-0.40407246,0.21034719,0.26426816,0.26048476,-0.37272432],[0.063116424,-0.37950125,0.07257917,-0.3190763,-0.24379982,1.2784098,-0.7842402,0.43258125,-0.052969795,-0.12413401,0.06709847,0.2559667,0.22473153,-0.22734967,0.023825992,0.016029818,-0.028326835,0.059578158],[-0.3016696,-0.075852886,0.0527521,-0.011209507,-0.6228015,1.1113851,-0.34559983,0.22142892,0.2554701,-0.2911173,0.057123005,-0.021941856,0.38191658,-0.26981074,-0.23588574,-0.13898829,0.22445364,-0.04848302],[0.05634534,-0.51824033,-0.003713693,0.08173703,0.16384764,-0.88854563,0.7730121,0.17500255,0.047530588,-0.5229133,0.20252858,-0.44388622,0.25572473,0.42722487,-0.1655544,-0.104584515,0.3827446,-0.14453594],[-0.0098065995,1.1461085,4.4271894,0.28766564,-0.67997473,-0.41923288,-0.65402234,0.04776276,0.7062483,0.22435577,-0.3855223,1.1025202,0.38395193,-0.13660425,-1.0991157,-0.9289552,0.24331227,0.12602676],[0.064604074,0.09815192,0.04449264,0.167245,0.10047873,0.8369896,-1.0633512,-0.02719515,0.48547852,0.00025195925,-0.115980625,0.22939739,-0.16308971,-0.2363354,0.035979815,0.039715026,-0.31373924,0.16439395],[0.14448808,0.42794606,0.023460679,-0.03131989,-0.18359396,0.92956793,-0.62810725,0.051745564,-0.007592588,-0.2550739,0.22733083,0.4052302,0.21245979,-0.54544073,-0.47292453,-0.01651716,0.28038526,-0.06726948]],"activation":"σ"},{"dense_2_W":[[0.3185951,0.38238007,0.50007355,-0.44696733,-0.18833564,0.49253,0.5151739],[-0.75351256,-0.02323625,0.15045765,1.1255723,-0.22760838,-0.5423463,-0.39320955],[0.5941869,0.6002208,0.67094994,0.1078536,-0.21703981,0.5121481,-0.044793326],[-0.18639438,-0.77096725,0.06640158,0.31278,-0.1791094,0.005353212,-0.7920676],[-0.5254911,-0.34967858,-0.04295217,-0.09182358,-0.49522772,-0.29707804,-0.26805338],[-0.11694704,-0.5764714,-0.77232236,0.83998466,0.2796507,-0.6095662,-0.6371917],[0.4697945,-0.81612813,0.41819504,0.0026271453,-1.0698678,-0.44858027,-0.71943],[0.032202445,-0.36785793,-0.89155453,0.91260713,0.26696843,-0.8249699,-0.7184577],[0.14048702,-0.056610133,0.32802385,-0.046393655,-0.78281575,-0.81149364,-0.6811588],[-0.15381347,0.34545475,0.3851575,-0.18525209,0.6611936,0.46200687,0.029352214],[-0.27863827,-0.90037704,0.31005386,-0.06176267,-0.49294484,-0.47007585,-0.21173601],[-0.5374982,-0.098829664,-0.25622907,0.6391975,0.0902377,-0.5835498,-0.6351781],[0.18176489,-0.1428339,0.6578572,-0.7403219,0.44002348,0.21766058,-0.061404295]],"activation":"σ","dense_2_b":[[-0.19657324],[0.20226727],[-0.10386356],[-0.010249704],[-0.094468534],[0.15300958],[-0.060326923],[0.024111554],[-0.15287803],[-0.29019067],[-0.05875744],[0.12496516],[-0.08454377]]},{"dense_3_W":[[-0.2886454,0.5095047,-0.57979405,0.36372662,0.13746898,0.34730884,0.6172098,0.14228286,-0.2412701,0.024884012,0.52553844,0.1899192,-0.2080911],[0.723521,0.30430666,-0.48175433,-0.18722822,0.17053263,-0.046900373,0.32055286,-0.28427157,-0.559016,0.6173524,0.38790986,-0.58535457,0.20128798],[-0.38595572,-0.74244434,0.6686922,-0.7516655,0.11421817,-0.66320103,0.02764821,-0.48069245,-0.52054244,0.78038347,-0.008231983,-0.19960494,0.5328335]],"activation":"identity","dense_3_b":[[-0.08028006],[0.05776726],[0.01632964]]},{"dense_4_W":[[-1.2012991,0.5136856,0.2434981]],"dense_4_b":[[0.07582895]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/TOYOTA_COROLLA_TSS2.json b/selfdrive/car/torque_data/lat_models/TOYOTA_COROLLA_TSS2.json
new file mode 100644
index 000000000..eeb64e65a
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/TOYOTA_COROLLA_TSS2.json
@@ -0,0 +1 @@
+{"input_std":[[9.754316],[1.5248336],[0.56031793],[0.049654935],[1.5070868],[1.5136857],[1.5187283],[1.4884274],[1.4468032],[1.3927733],[1.3395035],[0.049471103],[0.049509283],[0.049545065],[0.049528807],[0.049440794],[0.049183726],[0.048698023]],"model_test_loss":0.01838030107319355,"input_size":18,"current_date_and_time":"2023-08-11_23-49-46","input_mean":[[22.216816],[-0.068382844],[-0.0003495027],[-0.009731857],[-0.06888316],[-0.06969439],[-0.07004197],[-0.06833163],[-0.062542245],[-0.054059293],[-0.046969976],[-0.0098139495],[-0.009790095],[-0.009772296],[-0.009818108],[-0.009930541],[-0.010102344],[-0.010210523]],"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.071733765],[-2.3017254],[-0.002747584],[-0.16260307],[-0.039528668],[1.2633095],[0.40724456]],"dense_1_W":[[0.14254493,0.7560598,0.0022538262,0.026828635,-1.0626036,1.6978638,-0.58277315,-0.532054,0.13709316,0.08024807,-0.01103483,0.7790654,-0.36199996,-0.27354154,-0.40135407,0.112546146,-0.12273542,0.17872572],[-0.75257075,1.8171842,-1.4895765,0.6856587,-1.047781,-2.1456847,1.0205821,-1.1760736,-0.51131254,-0.1572458,0.3351541,-0.8285507,-0.10711446,0.89037967,-0.5866782,0.046956923,-0.018645424,0.15313248],[0.04169559,-0.58989626,-6.2346396,0.21148093,1.0282952,-0.15679906,0.015086645,-0.4938231,-0.98810667,-0.8081533,1.2733475,-1.0567358,-0.6226471,-0.07101477,1.028134,0.7304045,0.7475682,-0.87618846],[0.00729714,-1.1409336,0.00029273634,0.021291457,0.47364047,-1.0528986,0.6670064,-0.31857133,-0.2512035,-0.14272158,0.29329458,-0.47188643,-0.18927035,0.7875639,0.17967238,0.47387323,-0.0324174,-0.19277702],[0.13785772,-0.30069488,0.002800617,0.31292388,0.408026,-1.1410295,0.61747766,0.056347255,-0.16441363,0.14121056,-0.08929794,-0.39708617,-0.2790936,0.44575593,0.28871247,-0.30545992,-0.063934155,0.045969535],[0.9263208,-0.0041096397,-1.2649248,-0.22491741,-0.7898359,-0.6432323,0.46669382,-0.69405776,-0.039997756,-0.059218984,0.16558072,-0.21184966,-0.06702091,0.2703531,0.22768503,0.39336708,-0.25291198,0.07505179],[-0.007783014,-2.9238482,0.010547396,-0.17914231,-0.9764414,-1.8973196,-2.0817938,-0.5377732,-0.8602919,-0.92122966,-1.1030004,-0.061209604,0.05769448,-0.2639501,-0.011335088,0.0692365,0.37218606,-0.34912306]],"activation":"σ"},{"dense_2_W":[[-1.2037164,0.82475835,0.58777946,-0.41806436,-0.07912497,-0.9752202,0.43038344],[-0.87383485,1.7625434,-0.9010436,0.04913966,-0.80236125,-0.8888718,-1.1724374],[-1.149093,0.588674,-0.79056436,0.5840478,-0.6800404,-2.3066614,-0.30252007],[-0.7044807,-0.3438525,0.18204984,0.9572669,0.17036141,-0.4475017,-0.10285365],[-0.35474542,-0.91775477,0.16575153,-0.6729545,0.004384356,-0.5627307,0.20499422],[-0.62687695,-0.89932716,-0.40928647,0.004326587,0.10205387,-0.38104382,0.05874869],[0.20604928,0.56815124,-0.031190628,-0.6709605,-0.70632714,0.3854373,-0.38627437],[-0.32655486,-0.48946378,-0.27688035,-0.28829703,-0.28283417,-1.2973477,-0.30639303],[0.95871663,0.015167555,-0.4939611,-0.82378834,-0.6367465,0.11321682,0.36064836],[0.17759234,-0.05241082,-0.9149439,-0.5095627,-0.028105808,-0.1622127,-0.56177574],[0.9313323,-0.7414045,-0.10210027,-0.6010315,-0.9564538,-0.379816,0.40230134],[-0.09108528,0.32599035,-0.026278114,0.36614916,0.5561161,0.84679973,0.47440732],[-1.5251282,1.6984508,0.8223704,-0.14148536,-0.21781565,-1.3052686,0.55815554]],"activation":"σ","dense_2_b":[[-0.5853772],[-0.1194652],[0.09660614],[-0.20516787],[-0.2301157],[-0.33061823],[-0.039316446],[-0.11710167],[-0.029613337],[-0.25951824],[0.089471936],[-0.0013098614],[-0.92236656]]},{"dense_3_W":[[-0.20270818,0.6552373,0.9410651,-0.7787618,-0.18410496,0.016181383,0.62408584,-0.3269968,0.7875554,-0.40091902,0.7076024,-0.21312849,-1.0302222],[0.27061725,-0.13254738,-0.19332989,-0.070887744,-0.23539513,-0.14211313,-0.56738764,-0.3196864,-0.56094,0.17847942,-0.31821814,0.57166994,0.60353655],[0.5228776,-0.36678898,-0.47331262,0.4382709,0.092253216,0.38762012,-0.44059324,-0.44392672,-0.19738796,-0.43091238,-0.8047946,0.5009608,-0.23722588]],"activation":"identity","dense_3_b":[[-0.08095956],[0.10173851],[0.10956224]]},{"dense_4_W":[[0.48155427,-0.78180456,-0.52694654]],"dense_4_b":[[-0.0919536]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/TOYOTA_HIGHLANDER.json b/selfdrive/car/torque_data/lat_models/TOYOTA_HIGHLANDER.json
new file mode 100644
index 000000000..a9250081a
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/TOYOTA_HIGHLANDER.json
@@ -0,0 +1 @@
+{"input_std":[[8.59148],[1.2493986],[0.5269206],[0.041249365],[1.2364323],[1.2408036],[1.244121],[1.2149953],[1.1840745],[1.139739],[1.0999022],[0.04111617],[0.041138012],[0.04116289],[0.041093722],[0.04103911],[0.040840328],[0.04053395]],"model_test_loss":0.013219255954027176,"input_size":18,"current_date_and_time":"2023-08-12_04-15-52","input_mean":[[22.762989],[0.029107802],[-0.0036903925],[-0.0018161334],[0.02989136],[0.030132128],[0.029675554],[0.031246228],[0.032991253],[0.033477113],[0.031189695],[-0.0017968083],[-0.001822502],[-0.0018435197],[-0.0018475861],[-0.0018452929],[-0.0018318946],[-0.001845115]],"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.24648063],[-2.376559],[1.1662444],[-0.26554593],[-0.32742506],[1.4806708],[-0.0031550017]],"dense_1_W":[[-0.0022086294,-0.40385738,-1.160377,0.058853727,-0.45829934,-0.9892548,0.7024091,-0.026199905,0.1490116,-0.15794931,0.3758965,0.049813736,0.32553354,0.32745218,-0.17973755,0.050215364,-0.19431834,0.20708089],[-0.9471611,-0.7732935,0.0040800874,0.5742045,-0.18457998,-1.2835798,0.6246207,-0.14899649,0.18967356,-0.065814145,-0.15127227,-0.3386243,-0.23807645,0.6077654,-0.5328684,-0.30787334,0.28645578,0.14132696],[1.0173131,0.3188301,0.0074244044,0.61990887,0.7274369,-0.93646467,1.0704489,0.76136214,-0.32295448,-0.01725006,0.07569445,0.18620366,-0.17104647,0.29966894,-0.70542735,-0.7354604,0.016799392,0.30154032],[-0.20962188,-1.311333,-0.0026445198,0.17922984,0.531851,-1.5825989,0.7938387,0.0066229375,-0.09016458,-0.30289832,0.17271148,-0.47236636,-0.30804113,0.6233303,0.12623943,-0.0055988682,-0.043602336,0.06712645],[-0.020458225,-0.42885244,-0.0038395484,-0.10207273,-0.015277347,-1.4454521,1.3775421,-0.118530035,-0.22922382,0.17729308,-0.09748722,-0.89088255,-0.178599,0.85357165,0.35415354,0.43488976,0.04118875,-0.33566797],[0.8193772,-0.6007122,-0.0017037725,0.13282925,-0.11202925,-0.929353,0.317924,-0.11701756,0.10553851,-0.3365874,0.0851421,-0.054551814,0.0054372363,0.36028123,-0.2594373,-0.61298895,0.37971976,0.19868912],[0.008058829,1.6243702,6.4016485,-0.019551624,-1.5234914,-0.4204991,-1.3425288,-0.4094253,2.030977,1.4565194,-0.8323464,1.296278,0.47479084,-0.09157813,-1.1762311,-0.8872532,-0.12166119,0.38413718]],"activation":"σ"},{"dense_2_W":[[-0.28090087,0.74190426,-0.28707552,0.516355,1.334883,0.4357577,0.2586334],[-0.34608322,-0.33025268,0.0999196,-0.5887224,-0.6075646,0.64398736,0.3338182],[-0.31348327,-0.8770239,-0.6024458,-0.6178695,-0.6372776,-0.72627634,-0.16278459],[-0.3722624,-1.0817293,0.42359433,-0.33799604,0.10361065,0.7388388,1.3176775],[-0.29480588,0.7901369,0.17133124,0.4799114,0.85245687,-0.013445694,0.14533967],[-0.87411815,-0.16010237,-1.4885652,-0.29839927,-0.20605023,-1.562838,0.5986846],[-0.73472345,0.338243,-0.9374241,0.02173104,-0.7596491,0.6785289,-0.20274258],[-0.2997788,0.2209799,0.48596287,0.78598267,0.9243628,0.023341166,-0.43850183],[0.4222353,0.5027177,1.0574167,0.43871415,0.28589502,0.78985494,-0.5190039],[-0.18783973,-0.56768733,0.050845794,-0.28815973,-0.94438463,-0.2522084,0.32373685],[-0.106311925,-0.35109058,-1.1950349,-1.3491938,-0.63636744,-0.85660255,0.65720135],[0.11469332,0.6067198,-0.0036478473,-0.1060145,0.81046635,-0.43815076,-0.32849914],[0.02783019,-0.4614942,-0.2623803,-0.9181543,-0.88305587,0.06497931,-0.5045385]],"activation":"σ","dense_2_b":[[-0.15510015],[0.2342048],[0.15416661],[0.7777073],[-0.13564527],[0.14683509],[0.024061315],[-0.08486859],[-0.11236216],[0.14123017],[0.1472493],[-0.2562387],[0.1431819]]},{"dense_3_W":[[-0.39276794,-0.16104949,-0.6395178,-0.085208185,0.073711544,-0.10194128,0.45973158,0.53386575,0.3106653,0.012114314,-0.73890895,-0.1875676,-0.678936],[0.7250477,-0.36109838,-0.2772502,-0.73887503,0.37471095,-0.6863193,-0.5893201,0.13003068,0.5410711,-0.3264668,-0.8585225,0.46357864,-0.7054099],[0.12821884,-0.55353826,-0.29466185,0.21078463,0.06601266,-0.4738428,-0.10462136,0.5951863,-0.07738918,-0.641871,0.18521658,0.1677981,-0.252422]],"activation":"identity","dense_3_b":[[0.04069802],[0.026384773],[0.020536864]]},{"dense_4_W":[[-0.29379988,-1.0209042,-0.20056948]],"dense_4_b":[[-0.02549032]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/TOYOTA_HIGHLANDER_TSS2.json b/selfdrive/car/torque_data/lat_models/TOYOTA_HIGHLANDER_TSS2.json
new file mode 100644
index 000000000..ed522a375
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/TOYOTA_HIGHLANDER_TSS2.json
@@ -0,0 +1 @@
+{"input_std":[[9.797211],[1.4073237],[0.45344877],[0.04491299],[1.3987288],[1.4015741],[1.4033431],[1.3713129],[1.3358603],[1.2864146],[1.2356204],[0.044730604],[0.04476502],[0.04479927],[0.044761524],[0.04463559],[0.04441582],[0.04400734]],"model_test_loss":0.01496149692684412,"input_size":18,"current_date_and_time":"2023-08-12_05-44-01","input_mean":[[23.06539],[0.022372128],[-0.018723505],[-0.0037287462],[0.025849355],[0.024471685],[0.022525933],[0.017384581],[0.017084958],[0.015315184],[0.014839374],[-0.0038067892],[-0.0038066467],[-0.0038155483],[-0.0038835425],[-0.003969397],[-0.004126497],[-0.004283849]],"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":[[-5.0399375],[0.66340405],[-0.08379381],[-0.1257602],[0.30399242],[-4.494502],[0.27936158]],"dense_1_W":[[-2.5363288,-0.57757294,0.0027555253,-0.69334877,0.13913916,0.38319087,0.95406264,-0.95457584,-0.033972528,-0.21526104,-0.67382884,0.1485172,0.4771976,0.18877178,-0.16290484,-0.016111093,-0.40084124,0.40098542],[-0.10251014,0.90069646,0.0015895946,-0.29654703,-0.49717396,1.268891,-0.8686852,0.106027365,-0.08154456,0.054320164,-0.0015901169,0.28086966,0.37089986,-0.39758688,0.089162976,-0.20091611,-0.019581586,0.1379176],[-0.0021139083,-0.5681109,0.0045096576,0.37979248,0.21457663,-1.1264517,1.0069007,-0.28261423,-0.2431941,0.19875054,0.0066458527,0.109028324,-0.3649011,0.09212255,0.49301502,-0.059227098,0.07381374,-0.17722736],[0.008648403,0.87794864,3.1009352,0.21482791,-0.8084606,0.18275541,0.3635672,-0.08733222,0.9668826,0.25053218,-1.0132065,0.3902859,0.59336084,0.04232025,-1.0975246,-0.20822704,-0.42172226,0.30119237],[-0.1216848,-0.9771412,-0.017562695,0.23040251,0.120802276,-0.26227885,0.70101273,-0.29537383,0.036361422,-0.3592869,0.32375747,-0.17707966,-0.4159238,0.05444697,0.37961268,0.26376435,-0.019785738,-0.23029959],[-2.2624679,0.24792579,-0.003632164,0.46374714,-0.43607607,0.033397473,-0.29120448,0.24237801,0.22114673,0.041112114,0.76203763,0.109556496,-0.29734334,-0.6331814,0.29980987,0.17154595,0.35740486,-0.4158375],[-0.034173463,-0.5125805,0.011909321,-0.24246725,-0.007852726,-0.9268454,0.438557,-0.2839944,0.24563706,0.2190338,-0.2901443,-0.34727386,0.33995688,0.16540235,0.28732327,-0.35981894,0.041257735,0.058045775]],"activation":"σ"},{"dense_2_W":[[-0.1993436,0.701577,-0.41372073,-0.09332039,-0.36059406,0.77733815,-0.833145],[-1.5271622,1.5048598,-0.77010024,0.07560495,-0.71047103,1.3006324,-0.5117385],[0.46061924,-0.008243548,-0.85892344,1.2595167,-0.948924,2.2698135,-1.942301],[0.061940253,-0.31634828,0.0798406,0.34763846,0.021756,-0.46359214,-0.07392033],[-0.2696488,-0.40507072,0.19450307,-0.6713937,0.40933418,0.14875686,-0.03199306],[0.014884351,-0.18024068,0.36034963,0.07164113,0.0156314,0.371164,-0.27950096],[-1.5902536,1.8198748,-0.7683764,1.3738456,-0.092035376,-0.3063631,-0.5351149],[-0.1981007,-0.3395727,0.57789916,0.21266969,-0.19264036,0.3517743,0.2045635],[-0.25479048,-0.42085296,0.2920033,0.060998514,0.1293151,0.31961867,-0.46009016],[0.3049363,-0.22684415,-0.034080368,0.0790401,0.61918515,0.29823962,0.09349991],[-0.4494046,0.31757298,-0.4080604,0.20879479,-0.44578844,0.58260244,-0.096968025],[-0.21508828,0.32704902,-0.51432735,0.7326623,-0.6550922,1.1410198,-0.62732315],[0.12526976,-0.09556271,0.63842154,-0.61208946,0.3558117,-0.23578581,0.62607837]],"activation":"σ","dense_2_b":[[-0.017869094],[0.36151597],[-0.1958973],[-0.023889307],[-0.0017105008],[-0.03132981],[0.2619224],[-0.013072357],[-0.013901752],[0.023021301],[-0.13436924],[-0.46172282],[-0.04681776]]},{"dense_3_W":[[-0.052120414,0.029567413,-0.66409993,0.094393685,0.31642377,0.10608072,-0.3086923,-0.040440086,0.03381829,0.66097414,-0.4579581,-0.51134187,0.57541263],[0.5851281,-0.17931658,-0.4185391,0.1195394,0.36722615,-0.21088938,-0.32132354,0.42602026,-0.47596413,-0.3402495,-0.26624802,-0.5764113,0.0354186],[-0.6289345,-0.8272402,-0.0011975961,0.18056613,0.063398294,-0.034670547,-0.5280208,0.43154517,0.0023103878,0.2373611,-0.08228515,0.107933424,-0.03365145]],"activation":"identity","dense_3_b":[[0.053374246],[-0.03893916],[0.06737692]]},{"dense_4_W":[[-1.0474417,0.35237366,-0.9325995]],"dense_4_b":[[-0.057818808]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/TOYOTA_MIRAI.json b/selfdrive/car/torque_data/lat_models/TOYOTA_MIRAI.json
new file mode 100644
index 000000000..e1a890e78
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/TOYOTA_MIRAI.json
@@ -0,0 +1 @@
+{"input_std":[[8.621243],[1.130312],[0.5516336],[0.041195676],[1.126876],[1.1290765],[1.1299986],[1.1140016],[1.0942802],[1.061783],[1.0278625],[0.041149452],[0.041160367],[0.041163765],[0.041012943],[0.04082218],[0.04049875],[0.040250767]],"model_test_loss":0.010191036388278008,"input_size":18,"current_date_and_time":"2023-08-12_10-54-52","input_mean":[[23.69867],[-0.09237417],[-0.024359873],[0.005003234],[-0.08491814],[-0.08716023],[-0.08930154],[-0.09497029],[-0.09355577],[-0.09201378],[-0.08880379],[0.005034295],[0.0050175954],[0.004999444],[0.0049864235],[0.004929149],[0.0046412693],[0.0043429676]],"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":[[-1.0368268],[-0.6035686],[-0.37980628],[-0.38712236],[-0.31054008],[-0.35742834],[-0.1745767]],"dense_1_W":[[-0.30988532,0.94676775,0.06835736,-0.20904909,-0.31267637,0.4459532,-0.75116515,0.18319201,-0.16871549,0.01450603,0.094541326,0.19128986,0.094970584,-0.10434261,-0.12030237,0.08215967,-0.0004368318,-0.008146429],[-0.33773926,-0.57431877,-0.082528114,0.034690164,0.29717553,-1.3232597,1.2727411,-0.00825284,0.058543384,0.08819038,-0.25790802,0.36763,-0.3964585,-0.25440165,0.26645663,0.1723957,-0.13807693,0.016459083],[-0.643219,-0.52567714,0.16125901,0.35280794,-0.27486697,1.1864855,-0.64119214,0.28674185,0.24847941,-0.064988114,0.18981163,0.030853774,0.2485369,-0.36588603,-0.2141448,-0.24320458,0.054182176,0.08016488],[1.8329483,0.19176741,0.3630878,0.8177945,1.0301634,-0.8391618,0.029882386,0.28434104,-0.2605399,0.032751296,0.7037072,0.12650606,-0.5634059,-0.14148597,-0.14909759,-0.23083402,0.19594365,-0.15800387],[1.6136711,-0.023185488,-0.330168,-0.64757305,-0.7903925,0.3184771,-0.125178,0.5074217,-0.091587566,-0.15822329,-0.59075946,0.099624775,0.28776196,0.25979534,-0.31621882,0.2251791,0.16301762,0.015307925],[-0.012423788,1.3620756,3.723387,-0.09946844,-2.2505002,-0.6505167,-0.3025472,1.0916159,1.1659752,0.5379025,-0.8302681,0.2763101,0.3852661,0.03025497,-0.38073367,-0.20023987,-0.20818618,0.33501345],[0.035275426,0.13343032,-0.01315199,-0.16700771,-0.012076806,1.0922886,-0.46189055,0.04980423,0.22884117,0.08929184,-0.13899224,0.27415225,0.107125394,-0.21544056,-0.15122053,0.015403071,-0.16977242,0.05957028]],"activation":"σ"},{"dense_2_W":[[-0.32195273,-0.80007017,-0.047992315,0.00076893583,0.086762525,-0.2853599,-0.46519622],[-0.8466131,0.8392215,-0.625954,0.53587455,-0.05725867,0.48061028,-1.0681951],[0.6704792,-0.88257265,0.048325025,-0.11247827,-0.5555944,0.48655844,0.15341099],[-0.73055834,0.18692662,-0.0051072617,-0.28417185,-0.79494137,-1.1081446,0.3546513],[0.6564168,-0.9941641,-0.012599699,0.055534486,0.1949257,0.11912132,0.67601776],[-0.92568284,0.19816734,0.006052384,0.5773367,-0.58242613,-0.10242073,-0.62971866],[0.026353309,-0.101803504,-0.13243441,0.11023436,-0.18115512,-0.31580073,0.35157788],[0.024816064,0.74383426,-0.6058626,0.1693422,0.13700868,-0.34494787,-0.2539183],[-0.6846791,0.70265,-0.30746013,-0.5157588,-0.22700436,-0.56013364,-0.05191689],[-0.044140954,0.0018182937,0.14246152,-0.66603386,-0.27544877,-0.9813431,0.020237492],[-0.25419834,1.060303,-0.05096676,-0.4194434,-0.34662414,-0.66279954,-0.45178506],[0.35331485,-0.35900408,0.12481251,-0.69748133,-0.11242132,0.0421719,0.95737815],[-0.18702975,-0.19013745,-0.59367853,0.335176,0.036005035,0.045245975,-0.4265972]],"activation":"σ","dense_2_b":[[-0.30476797],[-0.195294],[-0.25333008],[-0.10860839],[-0.2226989],[-0.032822598],[-0.011119534],[-0.055506833],[-0.029588649],[-0.3181418],[0.07300559],[-0.06738982],[-0.15821727]]},{"dense_3_W":[[0.034150075,0.57094276,-0.48878017,0.5112273,-0.18092011,0.5353878,-0.11806307,0.3421746,0.47612357,0.52546614,0.15649377,0.1728523,0.4344787],[0.121647194,0.3492057,0.17216049,0.41008264,-0.7363858,0.18355447,-0.514776,-0.17685267,-0.14863887,-0.03910745,0.48813453,-0.7858287,-0.2943318],[0.33316976,0.06313858,0.2317506,0.47803766,-0.19028156,-0.13142887,-0.5406721,-0.3424372,-0.3295334,0.5573225,-0.1931224,0.24481794,-0.14382799]],"activation":"identity","dense_3_b":[[-0.10088669],[-0.08613214],[0.09071597]]},{"dense_4_W":[[-1.2123189,-1.2992013,0.67285275]],"dense_4_b":[[0.09299899]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/TOYOTA_PRIUS.json b/selfdrive/car/torque_data/lat_models/TOYOTA_PRIUS.json
new file mode 100644
index 000000000..0b66eb099
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/TOYOTA_PRIUS.json
@@ -0,0 +1 @@
+{"input_std":[[9.762099],[1.487393],[0.60882616],[0.045595963],[1.4832315],[1.4860536],[1.486883],[1.4329017],[1.3824382],[1.3180021],[1.2599565],[0.045492638],[0.04550747],[0.04551469],[0.04532005],[0.045169514],[0.044900604],[0.04442004]],"model_test_loss":0.023460322991013527,"input_size":18,"current_date_and_time":"2023-08-12_11-56-57","input_mean":[[22.102732],[-0.036377847],[0.008207928],[-0.00759032],[-0.039697252],[-0.039314914],[-0.038734905],[-0.03351559],[-0.029701687],[-0.02374894],[-0.019018527],[-0.0075716134],[-0.0075744586],[-0.007576846],[-0.007673164],[-0.0077769123],[-0.007848316],[-0.007871212]],"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":[[-1.2464235],[0.36032724],[3.2142584],[-0.6124687],[-0.3444237],[0.84660757],[2.4967933]],"dense_1_W":[[0.48956943,-1.0167718,0.00075395213,0.31859773,0.35728282,-1.7345634,1.4772928,0.22698121,-0.008497222,-0.2401796,0.06579528,-0.9262515,0.41439727,0.08820266,0.18549742,0.15475516,0.28202718,-0.3306144],[-0.01902877,1.317417,5.2883816,-0.0048064315,-1.1207271,0.14153387,-0.48907554,0.5965518,1.3317474,0.93645155,-1.5463351,0.8940235,0.01715244,-0.09698201,-0.79124266,-0.60062087,-0.5283351,0.48210177],[1.6799453,1.0875803,0.7233399,-0.1154038,0.13903706,0.6666519,-0.57941824,1.110945,0.8287281,-0.39736634,0.014497336,0.8294811,-0.24227042,-0.8082123,-0.11531884,0.3998047,0.38992816,-0.4658866],[-0.0093339095,-0.5626546,-6.469625,-0.24272315,1.8790531,1.1458817,1.6199373,-0.19717191,-2.2601504,-1.494756,-0.0270969,-0.83446693,0.017938558,0.20106375,0.4829865,-0.20796809,0.36888748,0.11745824],[-0.047758993,-3.753541,-0.18051493,-0.1676101,0.06609924,-0.8893684,-0.49023744,-1.0407737,-1.7489501,-1.3261193,-0.87734985,-0.39572844,0.64688593,0.5416982,-0.38286057,-0.97357833,-0.100056775,0.65565544],[-0.5856627,-0.59970623,0.0013667468,-0.121420965,-0.036623403,-0.898132,0.6988883,0.062262405,-0.06344699,-0.09589227,0.0075431895,-0.70993936,0.20738071,0.40989095,0.48009038,0.008462325,0.07712684,-0.15405595],[1.4587147,-1.1636585,-0.6985848,0.15750197,-0.38945892,-0.008756978,0.24255253,-0.8265293,-0.7826147,0.05190376,0.17086956,-0.6203985,-0.076512754,0.65016216,0.08441122,-0.1163062,-0.10427384,0.15624847]],"activation":"σ"},{"dense_2_W":[[-1.632233,0.37712488,0.4133944,-0.49261183,0.4405689,-0.7207189,-0.38359222],[-0.8616621,-0.24084182,-0.9289986,-0.018349092,-2.5249062,1.1182486,-1.4555736],[-1.3167355,0.7074618,0.21640916,-1.1284393,0.46383277,-0.13820471,-0.9500447],[-0.92115754,-0.59398055,0.20591407,0.14233942,0.32264933,-1.0047222,0.5837284],[-0.19402613,-0.29334325,-1.0017632,-1.2045952,-1.4455371,1.3564488,-1.236838],[1.0292754,0.18309414,-0.60503435,-0.67400736,-0.025801765,1.5835614,-0.18880595],[-0.08803988,0.85121155,1.2177777,-0.7774471,-0.15086989,-0.46124795,0.47848985],[1.1849687,-0.86750364,-0.43640986,0.5167854,-0.0021778047,0.67761177,-0.039286524],[-0.53804636,-0.047613166,-0.43315673,1.0911809,-0.8549513,-1.652081,-0.3882718],[-0.7047395,-0.45552897,0.29509792,-0.18719345,-0.106475934,-0.82755125,-0.3893937],[-0.57848173,-0.24025704,0.64958143,0.42696828,-0.4415749,-0.83788425,0.5138786],[-1.049563,0.35799855,0.37039617,-0.7668992,-0.1432876,-0.07057645,-1.404517],[0.8964256,-0.7548794,0.4873239,0.77339566,0.51797086,-0.043386698,0.9278152]],"activation":"σ","dense_2_b":[[-0.090917155],[-0.019869018],[-0.2314992],[-0.3312451],[-0.111754775],[-0.020750022],[0.201929],[-0.09248944],[-0.12347164],[0.07316307],[-0.045670044],[0.038350813],[-0.18804084]]},{"dense_3_W":[[-0.031516537,-0.15004298,-0.18322755,-0.49024573,-0.26840314,-0.21953586,0.4307271,0.6146507,-0.13160063,0.5342723,-0.47197735,0.3113398,-0.17237346],[-0.08184883,0.48368433,-0.5115264,-0.38417426,0.8723999,-0.29197934,0.050145645,-0.76852167,0.28836453,0.057352327,0.47973254,0.25683725,-0.18866217],[-0.5150742,-0.38569307,-0.65030956,-0.5188455,-0.23875389,0.4727463,-0.512049,0.80167,-0.69323355,-0.5246097,-0.35622385,0.00080956175,0.41679603]],"activation":"identity","dense_3_b":[[0.005088476],[-0.02459968],[0.076397985]]},{"dense_4_W":[[-0.09449419,0.40851843,-0.86686087]],"dense_4_b":[[-0.053760864]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/TOYOTA_PRIUS_2017_b'8965B47070x00x00x00x00x00x00'.json b/selfdrive/car/torque_data/lat_models/TOYOTA_PRIUS_2017_b'8965B47070x00x00x00x00x00x00'.json
new file mode 100644
index 000000000..b0e40d3bc
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/TOYOTA_PRIUS_2017_b'8965B47070x00x00x00x00x00x00'.json
@@ -0,0 +1 @@
+{"input_std":[[9.993096],[1.5129169],[0.5292781],[0.04735161],[1.4937518],[1.5009559],[1.5065974],[1.4822813],[1.4460584],[1.3909396],[1.3364335],[0.047238417],[0.047255352],[0.04726677],[0.04720177],[0.047057327],[0.046800528],[0.046432514]],"model_test_loss":0.02137083187699318,"input_size":18,"current_date_and_time":"2023-08-12_14-47-11","input_mean":[[21.92725],[-0.05898304],[0.0055398513],[-0.010017767],[-0.05939448],[-0.0591323],[-0.05851898],[-0.054530293],[-0.04864468],[-0.03953879],[-0.033812713],[-0.010021071],[-0.010010929],[-0.010004903],[-0.009986946],[-0.010029537],[-0.010210251],[-0.010435901]],"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.7096349],[-2.2459192],[1.8050286],[0.14590603],[-0.21259946],[-0.4865897],[1.0180423]],"dense_1_W":[[-0.044355545,-0.86803615,-5.470682,0.7662393,2.2697113,0.20532803,0.7032451,-1.0900831,-1.6173851,-1.3596452,1.1005849,-0.6813092,-0.3240795,-0.1764869,-0.049160894,0.72827965,0.515452,-0.7062596],[-1.1831604,-0.62358975,-0.0026339197,0.44086918,-0.13777687,-1.6426544,0.7253186,0.21613201,-0.33259863,-0.30798477,-0.3028476,-0.6908554,-0.26595157,-0.034876596,0.27096295,0.12958722,0.28949723,-0.13089034],[1.129321,-0.1758684,-0.016361756,-0.10424338,-1.0363773,-0.9705366,0.7942455,-0.14791845,-0.4966791,-0.14422588,-0.39332545,-0.4259459,-0.18380871,0.013830062,0.29699945,0.06683513,0.43560967,-0.118786275],[-0.17347103,-1.1811129,-0.0033009297,-0.21089908,0.5171898,-0.897144,0.44509307,-0.106434815,-0.28461242,-0.4546323,0.11333945,-0.42986956,-0.46928948,0.63054854,0.28181624,0.14660357,-0.021812595,0.05028003],[0.007173049,-0.70618355,-1.4873191,0.58662444,-0.089591786,-1.1213539,-0.47290862,-0.51822674,0.0023703398,0.2661958,1.152991,0.08745119,0.581388,0.3216495,0.05185744,-0.47252813,-0.24824727,0.051313765],[0.06722459,-0.70006377,-0.003337988,0.18606693,0.5765867,-1.6360734,0.96973306,0.05009269,-0.029201366,0.17914243,-0.20576404,-0.3237746,-0.289676,0.26199174,0.35764173,0.1982268,-0.094512984,-0.064385064],[1.4187667,0.23352993,0.015063511,-0.32947004,0.76953924,-0.5759871,0.85416406,0.6099805,0.14313644,-0.0988441,0.43220612,0.40879938,0.055067588,0.46557856,-0.18368772,-0.54336697,0.18179518,-0.084707245]],"activation":"σ"},{"dense_2_W":[[0.5947046,0.111288555,0.5850431,0.62112284,-0.078394376,0.24245393,0.32209224],[-1.8208972,-0.592816,-1.642084,-0.38896674,0.5061991,0.19109774,-1.5200887],[0.025273113,-0.08020302,-0.41331917,-0.022847144,0.6140032,0.10955139,0.35156295],[-0.50207645,-0.009498558,0.5945049,0.09697446,-0.6907574,-0.44700485,-0.69720614],[0.023978695,0.4353877,-0.6338232,0.066216335,0.5071922,0.72722405,-0.37157634],[0.22281975,0.30087987,0.10793576,0.6051096,-0.050377756,0.06560134,0.19566649],[0.3174169,-0.5281018,-0.3769352,-0.9404693,-0.38535568,0.047176104,-0.29524794],[-0.01142797,-0.8428373,0.61943024,-0.07822464,-0.27282074,-1.3535438,-0.027685491],[-0.1500802,-0.7242349,-0.30430663,-0.9526516,0.07655578,-0.72111547,-0.26857635],[-0.812532,0.026910001,0.31951103,0.13876708,-0.52592987,-0.28904262,-0.7990699],[0.43766123,-1.7336309,0.24968149,-1.029645,-0.074033834,-1.2529281,-0.030552762],[-0.33508214,-0.42931655,0.42052394,0.17153797,0.019656077,-0.109691635,-0.8664852],[-2.0966787,-0.025330383,-1.3079646,-0.22694683,-0.28807703,0.07181863,-1.555939]],"activation":"σ","dense_2_b":[[-0.019173387],[0.12807891],[0.0059481813],[-0.17893082],[-0.051502828],[-0.02974034],[-0.02933723],[-0.0073013883],[0.22854811],[-0.202757],[0.043750115],[-0.28998128],[0.23772466]]},{"dense_3_W":[[-0.3590014,0.24275887,-0.008422746,0.5422629,-0.6242663,-0.45372233,0.2612047,0.42095724,0.65564615,0.24925809,-0.024278162,-0.009784553,0.2571832],[0.5248679,0.040475123,-0.10563131,0.51980525,0.6735201,0.606566,-0.4731102,0.38770038,-0.1824653,0.12611738,-0.4370857,-0.6336852,-0.24878174],[-0.24122173,-0.7736854,0.54332715,-0.3138175,-0.3822715,0.051808015,-0.5872665,-0.6603135,-0.71875435,-0.22510114,-0.56668365,0.3377473,-0.81265104]],"activation":"identity","dense_3_b":[[-0.024711734],[0.022470985],[0.04454885]]},{"dense_4_W":[[0.7645119,-0.6550188,-0.91781116]],"dense_4_b":[[-0.03211836]],"activation":"identity"}]}
diff --git a/selfdrive/car/torque_data/lat_models/TOYOTA_PRIUS_TSS2.json b/selfdrive/car/torque_data/lat_models/TOYOTA_PRIUS_TSS2.json
new file mode 100644
index 000000000..489abe369
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/TOYOTA_PRIUS_TSS2.json
@@ -0,0 +1 @@
+{"input_std":[[9.993096],[1.5129169],[0.5292781],[0.04735161],[1.4937518],[1.5009559],[1.5065974],[1.4822813],[1.4460584],[1.3909396],[1.3364335],[0.047238417],[0.047255352],[0.04726677],[0.04720177],[0.047057327],[0.046800528],[0.046432514]],"model_test_loss":0.02137083187699318,"input_size":18,"current_date_and_time":"2023-08-12_14-47-11","input_mean":[[21.92725],[-0.05898304],[0.0055398513],[-0.010017767],[-0.05939448],[-0.0591323],[-0.05851898],[-0.054530293],[-0.04864468],[-0.03953879],[-0.033812713],[-0.010021071],[-0.010010929],[-0.010004903],[-0.009986946],[-0.010029537],[-0.010210251],[-0.010435901]],"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.7096349],[-2.2459192],[1.8050286],[0.14590603],[-0.21259946],[-0.4865897],[1.0180423]],"dense_1_W":[[-0.044355545,-0.86803615,-5.470682,0.7662393,2.2697113,0.20532803,0.7032451,-1.0900831,-1.6173851,-1.3596452,1.1005849,-0.6813092,-0.3240795,-0.1764869,-0.049160894,0.72827965,0.515452,-0.7062596],[-1.1831604,-0.62358975,-0.0026339197,0.44086918,-0.13777687,-1.6426544,0.7253186,0.21613201,-0.33259863,-0.30798477,-0.3028476,-0.6908554,-0.26595157,-0.034876596,0.27096295,0.12958722,0.28949723,-0.13089034],[1.129321,-0.1758684,-0.016361756,-0.10424338,-1.0363773,-0.9705366,0.7942455,-0.14791845,-0.4966791,-0.14422588,-0.39332545,-0.4259459,-0.18380871,0.013830062,0.29699945,0.06683513,0.43560967,-0.118786275],[-0.17347103,-1.1811129,-0.0033009297,-0.21089908,0.5171898,-0.897144,0.44509307,-0.106434815,-0.28461242,-0.4546323,0.11333945,-0.42986956,-0.46928948,0.63054854,0.28181624,0.14660357,-0.021812595,0.05028003],[0.007173049,-0.70618355,-1.4873191,0.58662444,-0.089591786,-1.1213539,-0.47290862,-0.51822674,0.0023703398,0.2661958,1.152991,0.08745119,0.581388,0.3216495,0.05185744,-0.47252813,-0.24824727,0.051313765],[0.06722459,-0.70006377,-0.003337988,0.18606693,0.5765867,-1.6360734,0.96973306,0.05009269,-0.029201366,0.17914243,-0.20576404,-0.3237746,-0.289676,0.26199174,0.35764173,0.1982268,-0.094512984,-0.064385064],[1.4187667,0.23352993,0.015063511,-0.32947004,0.76953924,-0.5759871,0.85416406,0.6099805,0.14313644,-0.0988441,0.43220612,0.40879938,0.055067588,0.46557856,-0.18368772,-0.54336697,0.18179518,-0.084707245]],"activation":"σ"},{"dense_2_W":[[0.5947046,0.111288555,0.5850431,0.62112284,-0.078394376,0.24245393,0.32209224],[-1.8208972,-0.592816,-1.642084,-0.38896674,0.5061991,0.19109774,-1.5200887],[0.025273113,-0.08020302,-0.41331917,-0.022847144,0.6140032,0.10955139,0.35156295],[-0.50207645,-0.009498558,0.5945049,0.09697446,-0.6907574,-0.44700485,-0.69720614],[0.023978695,0.4353877,-0.6338232,0.066216335,0.5071922,0.72722405,-0.37157634],[0.22281975,0.30087987,0.10793576,0.6051096,-0.050377756,0.06560134,0.19566649],[0.3174169,-0.5281018,-0.3769352,-0.9404693,-0.38535568,0.047176104,-0.29524794],[-0.01142797,-0.8428373,0.61943024,-0.07822464,-0.27282074,-1.3535438,-0.027685491],[-0.1500802,-0.7242349,-0.30430663,-0.9526516,0.07655578,-0.72111547,-0.26857635],[-0.812532,0.026910001,0.31951103,0.13876708,-0.52592987,-0.28904262,-0.7990699],[0.43766123,-1.7336309,0.24968149,-1.029645,-0.074033834,-1.2529281,-0.030552762],[-0.33508214,-0.42931655,0.42052394,0.17153797,0.019656077,-0.109691635,-0.8664852],[-2.0966787,-0.025330383,-1.3079646,-0.22694683,-0.28807703,0.07181863,-1.555939]],"activation":"σ","dense_2_b":[[-0.019173387],[0.12807891],[0.0059481813],[-0.17893082],[-0.051502828],[-0.02974034],[-0.02933723],[-0.0073013883],[0.22854811],[-0.202757],[0.043750115],[-0.28998128],[0.23772466]]},{"dense_3_W":[[-0.3590014,0.24275887,-0.008422746,0.5422629,-0.6242663,-0.45372233,0.2612047,0.42095724,0.65564615,0.24925809,-0.024278162,-0.009784553,0.2571832],[0.5248679,0.040475123,-0.10563131,0.51980525,0.6735201,0.606566,-0.4731102,0.38770038,-0.1824653,0.12611738,-0.4370857,-0.6336852,-0.24878174],[-0.24122173,-0.7736854,0.54332715,-0.3138175,-0.3822715,0.051808015,-0.5872665,-0.6603135,-0.71875435,-0.22510114,-0.56668365,0.3377473,-0.81265104]],"activation":"identity","dense_3_b":[[-0.024711734],[0.022470985],[0.04454885]]},{"dense_4_W":[[0.7645119,-0.6550188,-0.91781116]],"dense_4_b":[[-0.03211836]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/TOYOTA_PRIUS_V.json b/selfdrive/car/torque_data/lat_models/TOYOTA_PRIUS_V.json
new file mode 100644
index 000000000..e591efd50
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/TOYOTA_PRIUS_V.json
@@ -0,0 +1 @@
+{"input_std":[[8.246218],[1.5180237],[1.1132214],[0.032814745],[1.5758848],[1.5594358],[1.5396744],[1.4333483],[1.3656113],[1.2911646],[1.211073],[0.032817718],[0.032821406],[0.032829028],[0.03273625],[0.03268472],[0.03245208],[0.032211557]],"model_test_loss":0.011019937694072723,"input_size":18,"current_date_and_time":"2023-09-03_04-36-00","input_mean":[[16.336061],[-0.044645034],[0.06438527],[-0.015354921],[-0.055193648],[-0.05405257],[-0.051184133],[-0.0345687],[-0.027733065],[-0.022407],[-0.018130124],[-0.015424534],[-0.015413215],[-0.015394557],[-0.01529056],[-0.015231228],[-0.015114382],[-0.014972076]],"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.001179121],[-0.0008084346],[1.0273217],[0.8665842],[-1.7917292],[0.5846544],[1.8503871]],"dense_1_W":[[0.0008713786,0.10571419,-0.009768912,0.20203193,0.06539419,0.8834566,-1.064991,0.8917164,0.2740178,-0.29560176,0.046367835,-0.06696189,-0.15079989,-0.10306829,0.15937875,-0.32234034,0.11896804,0.013798418],[0.0032703213,0.3225856,-0.017178465,-0.3818704,0.3018395,0.30094728,-0.41512567,0.38405526,-0.1570511,-0.014270626,0.080081746,0.6354644,0.35888773,-0.43707213,-0.32447734,0.023193512,-0.16756727,0.20933074],[1.5627879,-0.37140134,0.63836944,-0.3830291,0.72145224,-0.3836591,0.11257197,0.21017507,0.26833218,0.25539163,0.5186593,-0.15651038,0.41176555,0.45905823,-0.42902833,0.06326807,0.3629456,-0.30402216],[1.6168094,0.40822932,-0.66605085,0.22799215,-0.69717556,0.34626734,-0.0059232763,-0.54218775,-0.055495918,-0.3768063,-0.48113772,-0.018525612,-0.5950303,0.2557122,-0.18825729,0.22983,0.005579068,0.06161027],[-1.1495299,-0.7586535,-0.5353385,0.025521036,1.087006,-1.0086828,-0.17635801,0.4568657,-0.091241084,-0.5215724,-0.2604748,0.045887616,0.11212669,-0.25279886,-0.14159086,-0.033089254,0.0029795568,0.1999646],[-0.051524103,-0.51501364,11.658313,0.13625003,-1.3843681,-1.6409664,-2.668583,3.1511652,2.57322,0.51289797,-0.38707766,0.10578343,-0.40109116,-0.31546983,0.07539781,0.3615562,0.073550805,-0.14806822],[1.1748914,-0.7219464,-0.5470881,-0.003681565,0.49025726,-0.4171505,0.0072592692,0.024163779,0.024890631,-0.41618225,-0.32244092,-0.19234161,-0.16784292,0.34389323,-0.06989565,-0.12501281,-0.030100992,0.20458347]],"activation":"σ"},{"dense_2_W":[[-0.4868388,-0.61673963,1.4286674,-0.039495535,0.45262775,-1.0424562,1.5454369],[-0.6074346,-1.011816,0.046624646,-0.78734446,2.3072171,-1.3779964,0.8569677],[0.47693276,0.71271104,-0.2390285,-0.038990125,0.12270858,0.20493168,-0.45892665],[0.38512126,0.61106217,-0.41512227,0.46455616,-0.0570659,0.04394896,-0.13119707],[-1.2577482,-0.6138713,0.6549672,-0.65091866,0.5145879,0.3818217,0.53431696],[0.56899303,0.10398351,0.45342615,-0.053685065,-0.104297765,0.09119562,-0.6285316],[-1.0771691,-0.25324076,0.37886608,0.1173106,0.47042668,0.14671373,0.08761732],[-0.3019003,-0.86725014,0.91806465,0.18018398,0.77627605,-0.93972605,1.2739382],[0.62885785,0.7373836,0.016257606,0.023142297,-0.47996506,-0.52089614,-0.113337025],[0.22219604,0.67318004,-0.08316116,0.34620377,-0.6612502,0.034009792,-0.64690715],[-0.23770024,-0.50766915,-0.09670405,-1.216913,1.2701161,-1.6846908,-0.22704105],[0.59986305,0.5738209,-0.19015375,0.421755,0.26094252,-0.04966739,-0.62614566],[0.6166309,0.091970205,-0.12472761,0.28889042,-0.21862288,-0.36297256,-0.44079408]],"activation":"σ","dense_2_b":[[0.19794257],[-0.03969422],[-0.0656537],[-0.062498007],[-0.035217416],[-0.016953804],[-0.0943835],[0.053581137],[-0.03426556],[-0.003272987],[-0.075658314],[-0.07952997],[-0.0015540265]]},{"dense_3_W":[[0.024692904,0.58683085,-0.567369,-0.37911305,0.67811406,-0.15265317,0.6610765,0.4359995,-0.6584148,-0.6708834,0.7197889,-0.4486733,-0.1747178],[0.14699566,-0.6474973,0.2763736,0.28756335,-0.3922964,-0.04845914,0.18625976,-0.26840127,0.6112173,0.3658983,-0.651653,-0.42875016,-0.09464588],[-0.7110688,0.24306618,0.19536833,-0.20736542,-0.025801487,0.17186794,-0.44581038,-0.31020266,-0.16066518,0.029663702,0.22836117,0.06264115,0.15486911]],"activation":"identity","dense_3_b":[[-0.016370883],[0.0127013195],[0.026499491]]},{"dense_4_W":[[-0.8554128,0.2766906,0.524841]],"dense_4_b":[[0.019940862]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/TOYOTA_RAV4.json b/selfdrive/car/torque_data/lat_models/TOYOTA_RAV4.json
new file mode 100644
index 000000000..ba434a6eb
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/TOYOTA_RAV4.json
@@ -0,0 +1 @@
+{"input_std":[[8.785079],[1.3448962],[0.51876175],[0.047479864],[1.3252879],[1.331087],[1.3371022],[1.3088783],[1.2807853],[1.2440304],[1.2056386],[0.04731712],[0.04733776],[0.047359645],[0.04723333],[0.047111828],[0.046843447],[0.046379473]],"model_test_loss":0.01724853552877903,"input_size":18,"current_date_and_time":"2023-08-12_15-17-06","input_mean":[[24.85061],[-0.047142796],[0.0005701203],[-0.008726335],[-0.04417392],[-0.045567565],[-0.046358094],[-0.04118768],[-0.039137643],[-0.03847798],[-0.035704315],[-0.008584033],[-0.008594763],[-0.008609622],[-0.008570998],[-0.008600623],[-0.008706975],[-0.008697191]],"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":[[-1.0296891],[-1.922514],[-1.149494],[0.022265209],[-0.052071013],[-0.032673564],[-1.9946277]],"dense_1_W":[[-1.8791502,-0.45478737,0.07119253,0.016805792,-0.38664973,1.3035942,-0.542431,0.047575254,-0.22030126,0.13161159,-0.07229064,0.36489004,-0.2386385,-0.23712136,0.034654524,-0.2886649,0.10312662,-0.047390282],[-0.66666186,-0.48720443,-0.11072515,0.094074145,-0.061216515,-1.2182275,0.8426725,-0.10592509,-0.21448702,-0.056960933,0.04259483,-0.7316568,0.20460397,0.42091593,0.15927365,-0.17348117,0.19803195,-0.18829267],[-1.8703458,0.30746105,-0.06834135,0.27911848,0.2422295,-0.6888701,-0.012127967,-0.15067418,0.5743117,0.07311509,-0.16059698,-0.15502444,-0.41604456,0.42384803,0.43910763,-0.17972651,-0.40040898,0.3014311],[-0.019090334,-0.76574296,0.09397271,0.10988411,0.51672286,-2.172949,1.0367043,-0.0839209,-0.58819324,0.16455668,-0.01100052,-0.7896944,-0.2134588,0.98234737,0.034016434,0.36617452,-0.035145547,-0.25804156],[-0.0018639659,-0.9749377,5.5816774,-0.23225898,-0.12594639,-0.9363593,1.234414,0.34805998,-0.08151865,0.107896045,-0.037450574,-0.27116403,-0.30569962,0.7310664,-0.58886266,0.20576492,0.49676666,0.072158925],[-0.019030262,1.2230272,5.830608,-0.41493434,-0.23800562,0.18280193,-1.5482132,-0.0852967,0.70929605,0.31744578,-0.51722443,1.0640428,0.19439188,-0.6710601,-0.2801976,-0.35409272,0.003487162,0.361651],[-0.649294,0.45132867,0.11169535,-0.06450987,0.17274019,1.0169406,-0.8244322,0.08305402,0.30460912,0.13607553,-0.12671345,0.31371805,-0.0019661803,-0.10996772,-0.15226273,0.090185925,-0.3348226,0.27420557]],"activation":"σ"},{"dense_2_W":[[0.6609678,-0.22481585,0.040954396,-0.31495926,-0.19392742,0.10244233,-0.08746393],[-0.7082068,0.86338276,-0.11436686,0.12848611,0.20935868,0.15040098,-1.1645155],[-0.22602943,0.793938,0.18418907,0.72948813,0.6846751,-0.6348888,-1.0778567],[0.53014493,-0.45450902,-0.35092524,-0.5569319,0.12838417,-0.13627666,0.5994005],[-0.17350997,0.7593281,0.7799434,-0.39523655,0.20372757,-0.834957,-0.38898385],[-0.70416707,0.22460131,0.085097484,0.78984326,0.2471842,-0.30347177,-0.58072823],[0.33662602,-0.7904104,-0.60286903,-0.16468751,-0.11612247,0.53005517,0.5211252],[-0.7082711,-0.46435446,-0.75132966,-0.29705703,-1.024626,-0.2615332,-0.20701897],[0.35671562,-0.02681799,0.6840728,-0.2612279,-0.08365274,-0.9705286,-0.605018],[0.62429255,0.0521647,-0.35856178,-0.4051332,-0.5179798,0.46409982,-0.052206893],[0.36666667,-0.5527411,-0.20863053,-0.6491323,0.06274223,0.4735839,0.22757712],[-0.012209164,0.5899906,0.46180722,0.48860443,0.58372164,-0.25489396,-0.895847],[-0.12133152,0.70728445,-0.4158088,0.7696778,0.1290468,-0.5404793,-0.33367673]],"activation":"σ","dense_2_b":[[0.08061271],[-0.19563875],[-0.24664785],[-0.12486449],[-0.2303988],[-0.07568345],[0.037712026],[-0.11140529],[-0.23779462],[0.034758605],[-0.11953955],[-0.21795286],[-0.21500231]]},{"dense_3_W":[[0.16741616,-0.5169601,-0.6872919,-0.3394973,0.08778304,0.27198112,0.7472469,0.11274346,-0.53623766,0.4801037,-0.17826463,0.07536674,0.6185708],[0.4108729,-0.3526092,0.1731832,0.5833954,-0.5591321,-0.5981915,0.7000401,0.37615168,-0.4772691,0.23866276,0.26305285,-0.48178422,-0.15993476],[0.53497106,-0.27460927,-0.65378416,-0.22805771,-0.005714031,-0.46566615,0.8224319,-0.0432606,-0.23549485,0.26196745,0.4718395,-0.6079023,-0.5116151]],"activation":"identity","dense_3_b":[[0.04784515],[0.063176766],[0.085746326]]},{"dense_4_W":[[0.3336722,0.86872417,0.6722818]],"dense_4_b":[[0.065143235]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/TOYOTA_RAV4H.json b/selfdrive/car/torque_data/lat_models/TOYOTA_RAV4H.json
new file mode 100644
index 000000000..149960002
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/TOYOTA_RAV4H.json
@@ -0,0 +1 @@
+{"input_std":[[8.89405],[1.3264774],[0.49399376],[0.04498591],[1.3162512],[1.3196412],[1.3221577],[1.2921615],[1.262814],[1.2265766],[1.1900893],[0.044859875],[0.044887066],[0.04489899],[0.044722132],[0.044534575],[0.044196904],[0.043708563]],"model_test_loss":0.013147538527846336,"input_size":18,"current_date_and_time":"2023-08-12_21-45-51","input_mean":[[22.843279],[-0.12455614],[-0.0014007707],[-0.0064704656],[-0.1233025],[-0.12350357],[-0.12400504],[-0.1251842],[-0.12609619],[-0.12369014],[-0.12037224],[-0.006532242],[-0.006518202],[-0.006506443],[-0.006487807],[-0.006539525],[-0.0065615526],[-0.0066139703]],"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.8076376],[-0.12330158],[0.8896142],[-0.13590556],[-4.1826344],[-0.77730286],[4.5746274]],"dense_1_W":[[-0.97973573,0.15226786,0.02845066,0.04827065,-0.025662262,1.7772363,-1.5355376,0.0989295,0.30149132,0.029098786,-0.074183464,0.39862457,-0.10540373,-0.14476654,-0.36632246,-0.3054467,0.15272646,0.07390829],[0.015743697,0.78862613,-0.019669378,-0.12546545,0.009684494,1.3956969,-1.2900923,0.19209127,0.14444686,-0.21074831,0.16892369,0.61990404,0.23663369,-0.8836119,-0.42096013,0.119372375,-0.07889601,0.09642731],[-1.1188109,-0.42021284,-0.027942661,0.14205936,-0.07868929,-0.7710287,0.73801935,0.014988501,-0.069595,-0.35983253,0.24104616,-0.45208368,0.057623267,0.5596988,-0.21029097,-0.045526307,0.32178107,-0.12184607],[-0.013647176,1.3307436,4.6095624,-0.34334475,-0.8587218,-0.12885869,-0.8174357,-0.11078273,1.2218881,0.6008918,-0.6915159,1.311084,0.16892083,-0.3056882,0.08437484,-0.63590443,-0.4589061,-0.0745741],[-1.9673253,-1.4414742,-0.2586987,0.2226021,0.5694981,-1.5805218,0.5769138,-0.00886291,-0.060155656,-0.100935824,-0.13228646,-0.39160243,-0.40697894,0.7586441,0.09374963,0.055745218,-0.22303872,-0.037225552],[0.010619068,2.72878,-0.1893567,-0.27490807,0.50076294,1.516001,0.3651039,0.7132457,0.22416064,0.38899446,0.33117044,0.3081755,0.3069668,-0.8289943,-0.08180179,0.6579218,0.3046304,-0.066973075],[1.9517641,-1.27614,-0.25992838,0.26618478,0.082289934,-0.697544,0.0861543,-0.04430833,-0.1666379,-0.06128522,-0.12283561,-0.34772325,0.10666418,-0.18634178,0.41480446,0.21883197,-0.314464,-0.09010557]],"activation":"σ"},{"dense_2_W":[[-0.6846211,-1.4150484,0.62999135,0.3430101,1.278193,-0.7957307,1.0221282],[0.16265254,-0.2179754,-0.03812709,-0.97449124,-0.69266665,-0.13029383,-0.6855177],[0.67744255,0.7218722,-0.15119076,-0.36107507,-0.6168378,0.3564611,-0.14333059],[0.44798878,0.054440223,-0.12721358,0.11809645,-0.061688833,0.04752611,0.13841292],[0.22670254,0.36689356,-0.44299468,0.53176785,0.3255846,-0.5087834,-0.24648738],[-1.1769708,-1.0265867,1.0046444,0.3265467,1.2754724,-0.6967977,1.0338258],[-0.07486774,-0.5789648,0.18375583,0.08036335,0.17746748,0.4459745,-0.28357828],[-0.98316115,-0.82948774,1.1131235,-0.30703646,0.70785904,-0.18001986,0.71042156],[0.10901459,0.64697224,-0.36924043,0.8418233,-0.18619084,-0.3438453,-0.58111745],[-0.13789596,-0.28369164,-0.24692981,-0.6745289,-0.83434075,0.4034985,-0.2338089],[0.5772887,-0.30526567,-0.8162497,0.44525668,0.23674823,0.12436892,-0.7137595],[-0.59163356,-0.21955788,0.26342097,-1.3260666,1.5348077,-0.15188397,-0.24587795],[-0.864029,-0.23358338,-0.21427485,-0.45828933,-0.8476076,0.7652582,0.07033687]],"activation":"σ","dense_2_b":[[-0.2084633],[-0.3401461],[0.03563889],[-0.019227123],[0.033816546],[-0.21475661],[-0.108693056],[0.0054793637],[-0.055306572],[-0.3065528],[-0.067040265],[-0.22550777],[-0.33363193]]},{"dense_3_W":[[-0.27252012,0.28291574,0.104386985,-0.27400178,0.03230503,-0.36361536,0.03550164,-0.098785385,0.5028087,0.15802625,0.25782102,-0.3110525,0.3512787],[-0.35834575,-0.20253947,0.08262887,0.49909568,0.40528995,-0.21334086,0.27457196,-0.6656153,-0.24731882,0.07225506,0.18140426,0.56584823,-0.53368413],[0.44071397,0.39182287,-0.45943233,-0.42492127,-0.5459261,0.56124943,0.37052932,0.3689143,-0.69441694,0.41806287,-0.031108733,0.5795106,0.5095399]],"activation":"identity","dense_3_b":[[0.044206124],[0.04141924],[-0.087050036]]},{"dense_4_W":[[0.7859495,0.4201428,-0.711207]],"dense_4_b":[[0.048112456]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/TOYOTA_RAV4_TSS2.json b/selfdrive/car/torque_data/lat_models/TOYOTA_RAV4_TSS2.json
new file mode 100644
index 000000000..155aa2771
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/TOYOTA_RAV4_TSS2.json
@@ -0,0 +1 @@
+{"input_std":[[9.244548],[1.5275985],[0.6107275],[0.046586774],[1.4886055],[1.5034448],[1.516418],[1.4891112],[1.4557259],[1.4174078],[1.3739654],[0.046419684],[0.046444356],[0.046451736],[0.046329428],[0.046216674],[0.04595779],[0.04549419]],"model_test_loss":0.012242425233125687,"input_size":18,"current_date_and_time":"2023-08-12_17-12-26","input_mean":[[22.124489],[-0.06681358],[-0.0017872587],[-0.007304861],[-0.068287455],[-0.06810858],[-0.068098135],[-0.06760926],[-0.064708285],[-0.06156465],[-0.05595117],[-0.00735773],[-0.0073575596],[-0.0073616607],[-0.007393436],[-0.0074092923],[-0.007485401],[-0.007535655]],"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":[[2.1266818],[1.2665837],[-0.0057515856],[0.021575607],[3.145306],[-0.015559701],[0.023866596]],"dense_1_W":[[1.8619034,0.2318498,0.010758091,0.17204547,0.178258,0.8156095,-1.2977135,-0.4021356,0.015441509,0.051510673,0.08473766,0.25257683,-0.08047843,-0.5401921,0.37597016,-0.25112596,0.11061834,-0.04145345],[0.6234877,0.39512575,0.029949188,-0.06756969,0.3141993,1.1970576,-0.9448964,0.4692527,0.4956762,-0.30381662,0.07292307,-0.11752247,-0.20445238,0.27772313,0.2778997,-0.20992711,-0.023655668,-0.03751188],[-0.09121854,-0.6526218,-0.008271368,-0.030463165,0.084578365,-1.1863025,0.71669704,-0.15648295,0.17038843,0.16980262,-0.2854215,-0.39527944,-0.29325402,0.4517195,0.58793545,-0.078027494,0.112520106,-0.19935027],[0.04239312,1.1436936,5.7977223,-1.2159046,-1.0222747,-0.018097226,-0.37114885,0.30876333,0.6447345,0.05005192,-0.3040888,0.3811603,0.53224164,-0.033966746,0.17231053,0.052680492,0.23297076,-0.20054573],[2.028991,-0.054335885,-0.050801482,0.22889599,0.034708247,-1.0235145,1.2738502,0.19607924,-0.6348713,0.3133455,-0.0084064,0.021044038,-0.19193278,0.24242897,-0.3887398,0.1055326,-0.14184418,0.124946855],[-0.15122393,0.6909391,-0.03846719,-0.2270961,-0.37185147,1.1930336,-0.83393574,0.019238736,-0.21900049,0.11245591,0.06722247,0.12010414,0.40301353,-0.5959846,-0.014899062,0.31775734,0.16264969,-0.20392336],[0.01964954,0.28060383,0.26928812,0.262222,-0.11968318,0.7917884,-0.94788104,0.24767427,0.5285209,0.20321472,-0.57217216,0.20230694,0.0041204365,-0.14682977,-0.1698623,-0.464828,-0.13932788,0.25505906]],"activation":"σ"},{"dense_2_W":[[0.07229978,0.043845255,-0.56071085,-0.37639382,-0.40895855,0.75563765,0.8920604],[-0.068550885,-0.2143043,0.8185382,-0.26352042,0.5178714,-0.88407123,-0.11102227],[0.80396324,0.084928855,1.9896538,-1.2700796,1.9254806,-0.6978969,-0.66902035],[-3.2066817,-1.9363941,0.8663164,-1.005594,-0.19276151,0.18454145,-0.32200423],[0.2388041,-0.3560892,-0.6499542,0.27040178,-0.4285769,0.50025755,0.4411526],[-0.5105194,0.6164994,0.40899366,-0.6055838,0.6227542,-0.3112731,-0.7521502],[-0.32484958,-0.49589607,-0.44490832,-0.23112644,-0.27562693,-0.39052173,0.1971162],[0.412541,0.319048,-0.79024744,-0.2737245,-0.6196046,0.015550856,0.43303803],[-0.28605422,-0.13784991,-0.24433006,-0.17126347,0.14660196,-0.3652191,0.36726522],[0.24914217,-0.5839129,1.1011901,0.48133576,1.1741915,-1.2662312,-0.41844484],[-1.4900029,-1.4929997,-0.24996275,-0.50023335,-0.65646017,-0.5239063,-0.16179247],[-2.2904916,-1.4458047,-0.10081112,-0.33487344,-0.16292852,-0.32974166,-0.41704106],[-0.12204984,-0.049235914,-0.7661266,0.20250078,-0.19582883,0.2884153,0.6099948]],"activation":"σ","dense_2_b":[[0.11034473],[0.04505026],[0.45456424],[1.1033564],[0.020434767],[-0.061051648],[-0.030366903],[0.06634181],[-0.039427042],[-0.17920223],[-0.12165889],[-0.071725644],[0.0007172712]]},{"dense_3_W":[[0.037582874,0.3922276,0.15515213,0.32579648,0.0045574703,-0.08303329,-0.35669035,-0.2959597,0.22798133,-0.00853858,0.26190194,-0.2177828,-0.051661514],[-0.6728899,0.60465753,0.37104872,0.84813213,-0.75632805,0.4609253,-0.123116,-0.16484596,-0.043769807,0.29626662,0.4587799,0.3421823,-0.5048559],[-0.31732032,-0.24499367,0.5200649,0.16775814,0.11487889,0.5378913,0.294093,-0.5565743,-0.33720338,0.0644005,-0.47207704,0.24707094,-0.1313763]],"activation":"identity","dense_3_b":[[-0.06704118],[-0.07568502],[-0.06689809]]},{"dense_4_W":[[-0.38717636,-1.245721,-0.60878205]],"dense_4_b":[[0.07232816]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/TOYOTA_RAV4_TSS2_2022.json b/selfdrive/car/torque_data/lat_models/TOYOTA_RAV4_TSS2_2022.json
new file mode 100644
index 000000000..07bdba6c4
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/TOYOTA_RAV4_TSS2_2022.json
@@ -0,0 +1 @@
+{"input_std":[[9.080224],[1.5475338],[0.6496774],[0.04879169],[1.5158907],[1.5278002],[1.5390717],[1.5098101],[1.4782969],[1.4340739],[1.3853667],[0.04868462],[0.048710395],[0.048738956],[0.048690505],[0.048625976],[0.048370127],[0.047957957]],"model_test_loss":0.008909840136766434,"input_size":18,"current_date_and_time":"2023-08-13_03-33-40","input_mean":[[23.622572],[0.010716067],[0.014080395],[-0.00545363],[0.00681623],[0.008023216],[0.008976955],[0.015593329],[0.018596267],[0.022246595],[0.02417008],[-0.0054850946],[-0.0054803547],[-0.0054753944],[-0.0054708053],[-0.005519239],[-0.005560871],[-0.005648205]],"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.5925863],[0.6910273],[0.0029014468],[0.043235566],[-0.055107236],[3.6387718],[3.6793168]],"dense_1_W":[[0.24347192,0.0785397,-0.030702522,0.19405046,-0.09431407,1.6046176,-1.1419742,0.19336075,-0.062058806,0.14076506,-0.0068204296,0.27706286,0.0753339,-0.4532859,-0.35606033,0.21351701,-0.18941605,0.044432733],[-0.45700783,-0.062406845,-0.031097766,-0.5659944,0.024210662,1.39045,-0.9837826,0.11537844,0.2825425,0.046704102,-0.061710272,0.50674444,0.19582161,-0.10567522,-0.08106667,-0.1992534,-0.21138985,0.24457377],[0.007203359,-1.2377197,-4.586871,-0.11203177,0.5719472,0.0427435,0.5389759,0.26149252,-0.57496494,-0.524192,0.57842165,-0.22961466,-0.37423873,0.35315713,-0.10196228,0.2160896,0.4271714,0.017925069],[-0.0054053566,1.579078,-0.06120463,-0.20971349,0.046022303,0.93902045,-0.78088397,0.02447776,-0.07060164,-0.06981518,0.1699867,0.10647593,-0.24200302,0.018979385,-0.0083929775,0.18985271,0.13718374,-0.088825986],[0.095188886,0.6861187,0.10568597,-0.1301086,-0.7698879,0.83482885,-0.5525881,0.38867232,0.224815,-0.09360383,-0.16623642,0.5329297,-0.023406014,0.19236702,-0.75461245,-0.46940014,0.32178688,0.16902733],[1.5707638,0.61578625,0.23603536,-0.10848588,-0.02725563,0.6388082,-0.88916034,0.20878781,0.15096506,-0.07481069,0.050539907,0.08200025,0.027791992,-0.33376747,0.32451573,0.21383548,-0.019029131,-0.1541287],[1.5059847,-0.55344844,-0.24463375,0.061645243,0.0208355,-0.6283204,1.0164922,-0.39539093,-0.3376693,0.14381117,0.014864233,0.15729472,-0.36920083,0.09105627,0.22073188,-0.3185754,0.1361389,0.0030957134]],"activation":"σ"},{"dense_2_W":[[0.8278061,0.00944368,-0.47221076,0.5170837,0.5817161,-0.28623572,-1.3400604],[-1.1041138,-0.63026905,0.07870919,-0.08548198,-0.400506,-0.27927935,0.3597091],[0.27548513,0.17060155,-0.43422616,0.46099278,0.14646465,0.4412418,0.29597026],[-0.19179592,0.59959507,-0.45964202,-0.03809237,0.574291,0.57724786,-0.9947663],[0.9136712,0.04980523,-0.6333211,0.30888626,0.3298961,-0.24825113,-0.99664354],[0.3825098,0.8290921,0.63622355,0.5099953,-0.3108262,0.32984248,-0.41125965],[0.2868915,0.2814047,-0.35160798,0.19865306,0.22140126,0.53437257,-0.19641446],[-1.1109287,0.3453166,0.32968,-1.0854727,-0.5026547,-0.061587382,1.7998439],[0.098573364,0.6721182,-0.35533735,-0.09068599,0.18878801,1.0343286,0.09213373],[-0.23218085,-0.16048461,0.6798084,-0.64267206,-0.8845718,-1.8911213,0.5121272],[-0.54387015,-0.23149288,-0.30668664,-0.20229974,-0.30891183,-0.5950911,-0.1115899],[-0.25720352,-0.55898094,-1.0450321,-0.4148398,-0.31979793,-0.07070874,-0.10942721],[0.34567067,0.8965103,0.050285354,-0.1771556,0.119312696,0.3056499,-0.6886853]],"activation":"σ","dense_2_b":[[-0.39942527],[0.30935934],[-0.16508539],[-0.13897029],[-0.5619027],[-0.24792555],[-0.107184075],[0.5673597],[-0.21446894],[0.51320654],[0.042424392],[-0.15152127],[-0.24059872]]},{"dense_3_W":[[0.4104882,-0.23413022,0.5933587,0.5129894,-0.017641984,0.35903862,0.13990471,-0.6462935,0.53985685,0.037760712,-0.46011966,-0.48272845,-0.33265826],[-0.56515414,0.7211797,0.3708711,0.09521525,-0.016219772,-0.7927581,0.04320575,0.08196957,-0.177058,0.63587785,-0.34107837,0.37444627,-0.13801615],[0.5979246,-0.8661764,0.29252937,0.59611315,0.30349368,-0.11060929,0.22178161,-0.45007005,0.12280302,-1.1837198,-0.28847334,0.091526695,0.4002503]],"activation":"identity","dense_3_b":[[-0.1171355],[0.0760098],[-0.07621718]]},{"dense_4_W":[[0.17640126,-0.5432617,0.8457692]],"dense_4_b":[[-0.072637506]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/TOYOTA_SIENNA.json b/selfdrive/car/torque_data/lat_models/TOYOTA_SIENNA.json
new file mode 100644
index 000000000..b4434402e
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/TOYOTA_SIENNA.json
@@ -0,0 +1 @@
+{"input_std":[[8.918778],[1.18101],[0.4847478],[0.043674015],[1.1728041],[1.1765499],[1.1794695],[1.1464957],[1.1177075],[1.0766566],[1.0377958],[0.043550335],[0.043581747],[0.043604773],[0.043512594],[0.043391723],[0.043109246],[0.04262905]],"model_test_loss":0.019605522975325584,"input_size":18,"current_date_and_time":"2023-08-13_05-28-32","input_mean":[[23.596626],[0.013376228],[-0.0037806714],[-0.008489553],[0.016799761],[0.015916478],[0.014968346],[0.017682353],[0.020881005],[0.020992402],[0.023326145],[-0.008438655],[-0.008450099],[-0.008462553],[-0.008476181],[-0.008486343],[-0.008576075],[-0.008670038]],"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.91207904],[0.7103613],[0.30726305],[0.11740969],[0.12186458],[-0.089792214],[0.06848248]],"dense_1_W":[[0.020942407,1.0916185,-0.035626575,-0.19509457,-0.0901391,1.0375599,-0.89480263,0.027181128,0.114876896,-0.20307554,0.19653901,0.8226537,-0.28726602,-0.47241193,-0.02529027,-0.009867712,0.20832253,-0.0335081],[0.38768068,-0.9086627,0.040084302,0.06681411,-0.5178006,-0.611777,0.92066157,-0.1505088,0.074445166,0.11541756,-0.24584451,-0.81897855,0.51056355,0.27303597,0.1812634,-0.22068554,0.071845666,-0.07549679],[1.3191843,-0.43101233,0.051205434,0.2787163,-0.4157239,0.42948318,-0.72137564,-0.8753717,0.10624811,0.19340889,-0.15060128,0.2269076,0.03174035,-0.31100953,-0.19166663,-0.011060635,-0.3349901,0.2901877],[-0.0024979762,0.3740953,-0.026280953,-0.15654075,0.37215605,0.7620479,-1.0498856,0.13035084,0.13929886,0.05248367,-0.013822444,0.7085953,-0.03154278,-0.29324126,-0.62358975,-0.16771367,-0.21831672,0.22877951],[0.044033404,-0.99224085,-6.7608223,0.09225139,0.9311651,0.447325,0.42661807,0.63310313,-1.7500018,-0.85278213,0.90037066,-1.4607582,-0.38572705,-0.10530333,0.5061062,1.1270607,0.23219815,-0.09795198],[0.016819429,-0.0675717,0.115480825,0.07103152,0.17985629,1.1815296,-1.396273,0.18709117,0.09204313,0.37937552,-0.3416136,0.28142554,0.1835832,-0.75639856,0.27877346,0.049574222,-0.23444256,0.09973523],[-0.06906837,0.8551471,2.6089625,-0.38896835,0.3064237,0.04883363,-0.6118971,-0.37577873,0.916318,0.8206204,-0.8979492,0.18177088,0.34715304,-0.33680785,0.031479146,-0.49667355,-0.33899838,-0.04839657]],"activation":"σ"},{"dense_2_W":[[0.7524287,-0.05320505,0.6631399,0.29110217,-0.3867475,0.48622686,-0.00068926124],[0.6857002,-0.98820657,-0.2477931,0.8487134,-0.008759584,0.8539056,-0.70714766],[-0.191401,-1.1044568,-0.17453948,0.28428176,-0.27107534,0.52109903,0.5684942],[-0.72152793,9.4716466e-5,0.25969005,-0.29246745,-0.27407894,-0.5809119,-0.1386064],[-0.28868115,0.3303369,-0.19686596,-0.14941077,0.08329269,-0.49868903,0.2623254],[-0.47855794,0.38120317,0.15302673,-0.45370772,-0.0976872,-0.2544275,-0.22887231],[0.8629054,-1.2646538,0.13799493,0.40030012,0.16298352,0.30507365,-0.035486612],[-0.1548037,0.88181823,-0.19526346,-0.6244504,0.5790799,-0.7090568,0.17455493],[-0.4086325,0.8128156,-0.02595779,-0.8348639,0.1865987,-0.23320554,0.21458188],[-0.70075643,0.18467374,-0.39847013,0.20729409,0.4069853,-1.0749724,-0.23987985],[-0.19175854,-1.101704,0.658868,0.8334482,-0.007937357,0.06116572,0.35555303],[0.899429,-0.23285869,0.36268023,0.2628838,-0.41170016,0.18388364,0.59954256],[0.42720664,-0.1498553,1.1578981,0.16925347,-0.97467273,0.46834058,0.34074527]],"activation":"σ","dense_2_b":[[-0.1311147],[-0.4101757],[-0.33761725],[0.06426192],[0.026971094],[0.075724326],[-0.34481454],[0.16628559],[0.10305307],[0.049283274],[-0.24880186],[-0.16108623],[-0.10672651]]},{"dense_3_W":[[-0.47907722,-0.21759209,0.3713241,0.39441383,-0.44695204,0.17124303,0.11321267,0.3969347,0.1906832,-0.40338823,0.12479244,-0.50514024,0.5594875],[-0.5839251,-0.25829744,-0.427433,0.4940799,0.6102448,0.6181168,-0.3990338,0.7514002,0.44554126,0.50229466,-0.51888025,-0.38270754,-0.26896998],[0.21696098,-0.24028769,-0.43294132,-0.49181503,0.07244864,-0.15500332,-0.39558488,0.5280436,0.6300974,0.096077316,-0.16075748,0.3209584,-0.61387634]],"activation":"identity","dense_3_b":[[0.021643605],[0.047753386],[0.053921573]]},{"dense_4_W":[[-0.0368371,-1.1304644,-0.17004102]],"dense_4_b":[[-0.049882997]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/VOLKSWAGEN_ARTEON_MK1.json b/selfdrive/car/torque_data/lat_models/VOLKSWAGEN_ARTEON_MK1.json
new file mode 100644
index 000000000..af5a0b305
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/VOLKSWAGEN_ARTEON_MK1.json
@@ -0,0 +1 @@
+{"input_std":[[8.971252],[0.79798824],[0.43347803],[0.037114248],[0.78899115],[0.7920018],[0.7952441],[0.7838899],[0.7732425],[0.75980055],[0.74578863],[0.037029333],[0.03706021],[0.03708885],[0.03716895],[0.037208397],[0.03723585],[0.037244312]],"model_test_loss":0.012649175710976124,"input_size":18,"current_date_and_time":"2023-08-13_07-16-53","input_mean":[[24.854122],[-0.006721379],[0.0023459543],[-0.006867375],[-0.0071832123],[-0.007095632],[-0.007283813],[-0.004851204],[-0.0015341335],[-0.0011585834],[0.0014295956],[-0.0069056926],[-0.0069126263],[-0.0069173565],[-0.0070006466],[-0.007102198],[-0.007207536],[-0.0073172078]],"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.10305949],[0.5548119],[0.8664678],[-0.04213392],[-1.4110198],[3.2694256],[-1.438837]],"dense_1_W":[[-0.017599747,-0.22520265,0.0010882277,-0.21759078,0.043246184,-0.9120944,0.44394338,-0.012739085,0.17955783,0.3519492,-0.3748205,-0.29586455,0.36217418,0.21715508,-0.045080207,0.10746157,0.16058546,-0.12644011],[1.4859476,-0.13243331,-0.072786994,-0.09156684,0.026185557,0.30754617,-0.07915964,-0.33238035,0.29930684,-0.59904677,-0.40220875,0.34915185,0.2151253,-0.12978148,-1.0024906,0.4784506,-0.08319207,0.21361434],[0.61979795,0.1759033,-3.648246,-0.18301606,-0.7338996,-0.6487156,0.8492735,-0.7052067,-0.86969215,0.2841932,1.4843231,0.25467336,-0.34080935,-0.18149482,0.70439994,-0.26088372,0.11387163,-0.1455975],[0.00995094,-1.2382029,0.0006843731,0.328307,0.8130543,-1.2957187,0.8368335,0.20426522,-0.19153069,-0.4943369,0.41151458,-0.014479602,-0.4382999,0.10004458,0.060025815,0.16917846,0.09463592,-0.21017851],[-0.8206324,0.8908584,0.037517052,-0.49712715,-0.40263394,0.24845587,-0.85499966,0.26955003,-0.06266273,0.28861195,0.12733743,0.31250095,0.119576685,-0.04005291,-0.029234378,0.02662434,0.2687243,-0.1394794],[1.2793154,1.0802419,0.059386734,-0.3855319,-0.78512937,0.15505423,-0.8329386,0.6772395,-0.1311195,0.51412123,0.050203018,-0.037745327,0.38920268,-0.41889575,0.17929426,0.54237133,0.14844449,-0.3822895],[-0.93515563,0.036150783,-4.184579,0.31975636,-0.5608153,-0.832857,0.39901984,-0.45331565,-0.5904826,0.33153397,1.4625467,-0.1966311,-0.35478687,0.13788807,0.2924618,-0.15482849,0.01944506,-0.113643706]],"activation":"σ"},{"dense_2_W":[[0.90550905,-0.2773451,0.060318053,0.78804654,-1.0699619,-0.84802955,0.44153836],[0.77794725,-0.38085982,-0.0049121855,0.35357663,0.00038228062,0.18574685,0.04339034],[-0.92243797,0.38560665,0.09517251,-0.9013531,0.2996133,0.54987377,-0.028735504],[-1.1287217,0.640262,-0.5085255,-1.4166275,1.5218314,0.056655124,0.33818102],[0.15446381,0.38593677,0.3441797,0.98853666,-0.9087163,-0.0742472,0.46354288],[-0.55011004,-0.019922681,-0.18926652,-0.6645979,0.6695093,0.7484288,-0.16677399],[-0.7513268,-0.72154254,-0.3784182,-0.16664356,0.09576955,0.08568184,-0.4769783],[0.08747015,-0.46323332,-0.20250341,-0.7033233,-0.48815915,-0.43857226,-0.20034243],[0.16640607,-0.19463709,-0.041607287,0.30393028,-0.33860773,0.13123538,0.19249742],[-0.6888612,0.1613833,-0.42137414,-0.5399623,0.5414041,0.16113918,0.10748585],[-0.86522615,0.59193206,-0.37166557,-1.1033491,0.8927235,0.81606954,-0.031116843],[0.28607032,0.24378045,-0.021820918,0.6145389,0.15344414,0.019805284,-0.16341789],[-1.0509629,0.058839537,0.22750644,-0.6949402,0.3670632,0.044007428,0.0669319]],"activation":"σ","dense_2_b":[[-0.18253872],[-0.0115240505],[-0.06430214],[0.2490044],[-0.2796968],[0.0028060132],[-0.09268421],[-0.28672373],[-0.080230884],[0.03859358],[0.14165422],[-0.12646787],[-0.1059743]]},{"dense_3_W":[[0.8398946,-0.07856656,0.1706828,-0.86333686,0.59561944,0.03616052,0.18146847,0.4525631,-0.08213228,0.131641,-0.49378744,-0.44430527,-0.12233779],[-0.06611764,0.49632278,0.2623391,0.49564347,0.11883829,-0.49934706,-0.13390465,-0.6451669,-0.45365545,-0.0060165436,0.45882273,-0.38588116,-0.08209023],[0.85171545,0.69498104,-0.5135337,-0.30856863,0.22390914,-0.47711673,-0.21191199,-0.21027334,0.047864415,-0.4271364,-0.27338186,0.08179979,-0.39165765]],"activation":"identity","dense_3_b":[[0.04059178],[-0.05657044],[0.08936293]]},{"dense_4_W":[[-0.1893341,0.2177843,-1.285145]],"dense_4_b":[[-0.08146231]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/VOLKSWAGEN_ATLAS_MK1.json b/selfdrive/car/torque_data/lat_models/VOLKSWAGEN_ATLAS_MK1.json
new file mode 100644
index 000000000..f3cf6c089
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/VOLKSWAGEN_ATLAS_MK1.json
@@ -0,0 +1 @@
+{"input_std":[[8.807038],[1.1578474],[0.462717],[0.04096329],[1.1326288],[1.1411434],[1.150276],[1.1401542],[1.1256609],[1.1028374],[1.0771434],[0.040799636],[0.040834032],[0.04086527],[0.040849086],[0.040718287],[0.040424738],[0.040075604]],"model_test_loss":0.011358999647200108,"input_size":18,"current_date_and_time":"2023-08-13_09-26-52","input_mean":[[24.574387],[-0.042787574],[-0.0084383935],[-0.008247784],[-0.04005291],[-0.04116906],[-0.04206258],[-0.04518047],[-0.045766264],[-0.047523264],[-0.048847865],[-0.008307315],[-0.008303847],[-0.008298328],[-0.008317524],[-0.008355838],[-0.00843378],[-0.008587674]],"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.5398485],[0.25783718],[0.41557038],[-1.7976782],[0.53406316],[-0.63385665],[-1.917262]],"dense_1_W":[[-0.4253817,0.22663599,1.0573925,-0.003105988,-0.096334025,0.6529197,-1.1694652,0.3467033,0.24922119,-0.3803986,0.08890094,0.061100043,-0.017730042,-0.11883982,0.13428102,-0.0348934,-0.0068453453,-0.007779446],[-0.008402637,-3.3132567,-0.21813557,0.071411654,-1.1415226,-1.6578175,-0.637207,-1.3461175,-0.6741953,0.16755764,0.2779039,0.11480545,-0.1803503,0.34613702,0.0859196,-0.29474613,-0.042490523,-0.01820469],[-0.4971483,0.098119624,-1.0920941,0.16022453,0.21241802,0.6172494,-0.9755981,0.035779636,0.0041822596,0.31914288,-0.18518393,-0.26218906,0.23453258,0.014359854,-0.06966559,-0.0034770474,-0.26081735,0.17178555],[-0.25480956,1.3900709,-0.0011070514,-0.06342647,-0.10887336,0.7041751,0.2328101,0.04183806,-0.033468023,0.028824355,0.071826614,0.098379195,0.32470608,-0.19180217,-0.5554726,-0.2217316,0.10789431,0.07102663],[-0.49687034,-0.6059788,1.1368431,0.11400577,0.4183632,-0.9394553,0.7815931,0.067233406,0.1662752,-0.13292359,0.051417153,-0.7103316,0.24026254,0.35937056,0.45720938,-0.5001579,0.1221688,-0.060943875],[-0.44913447,-0.4765777,-1.0624616,0.50197846,0.086886585,-0.17574842,0.9428897,-0.32340288,-0.06547519,-0.04256699,0.15002339,-0.5190985,0.11296826,0.2678741,-0.4129183,-0.016196959,0.10317533,-0.04792584],[-0.25692594,-1.3502828,-0.0009460109,-0.0050777984,0.46374944,-1.0939615,-0.40397272,0.14855485,-0.0076834555,-0.08402314,-0.048022572,-0.3868957,-0.03253632,0.29881552,0.5705721,0.1640352,-0.11509783,-0.05596482]],"activation":"σ"},{"dense_2_W":[[-0.16952407,0.08702787,0.6493835,0.27430746,-0.0071199476,-0.19580856,-0.2091579],[-0.1470845,-0.33079877,-0.5467495,0.41160226,-0.4971588,-0.5109554,-0.123111665],[0.7788407,0.12949619,0.46349248,0.13599767,-0.5738747,-0.20808762,-0.06685508],[0.87942976,-0.68710035,0.46623912,0.08075862,-0.31713346,-0.69495225,-0.42125878],[-0.5606583,0.49643534,-0.51900244,-0.48461094,0.31940943,0.18362813,0.8575088],[-0.2532001,-0.51093,0.25305697,-0.54165125,0.53601104,0.9598262,0.9526221],[-0.5665034,0.62428737,-0.07754291,-1.1295077,0.024450528,0.5505611,0.527919],[-0.17602344,-0.28039378,0.020311655,0.22711796,-0.68551284,-0.7996287,-0.6079852],[0.43893847,-0.7567556,0.10027089,-0.15151227,0.014879642,-0.31855884,-0.34122738],[-0.7633393,-0.07543374,-0.3050713,-0.97557557,0.37339172,0.8250897,0.7215346],[-1.2275901,0.62176853,0.03411873,-0.5092338,0.25704694,0.53235847,0.22089346],[0.23248282,-0.26544097,0.5072489,0.94194096,-0.44382775,-0.7462538,-1.0142152],[-1.2566365,0.09855355,-0.39514026,-1.0510743,0.48289242,0.4580382,0.30374187]],"activation":"σ","dense_2_b":[[0.013570737],[-0.17418918],[0.028351136],[0.12490911],[-0.16577649],[0.042069126],[-0.035789013],[-0.13899207],[-0.08848456],[-0.07905907],[-0.19632997],[0.038965493],[-0.12647548]]},{"dense_3_W":[[0.24081455,-0.44363257,-0.55115354,-0.030922456,-0.008375877,-0.123510234,0.2126219,-0.46798712,0.2711133,0.56804013,0.1574471,0.33433697,0.38691574],[-0.4032797,0.39321384,-0.3401627,-0.7603349,0.47812653,0.23157345,0.78344727,0.15922022,0.17650013,0.6928251,0.6137232,-0.7369166,-0.103489414],[-0.24215305,-0.40328485,-0.6077818,-0.28876036,0.56822276,0.63360524,-0.08002663,-0.23342833,-0.5187577,0.4915526,-0.17775443,-0.78564095,0.31357977]],"activation":"identity","dense_3_b":[[-0.07463631],[-0.05884157],[-0.03089778]]},{"dense_4_W":[[-0.15029056,-0.63581127,-0.55734146]],"dense_4_b":[[0.04723571]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/VOLKSWAGEN_GOLF_MK7.json b/selfdrive/car/torque_data/lat_models/VOLKSWAGEN_GOLF_MK7.json
new file mode 100644
index 000000000..e3d324afa
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/VOLKSWAGEN_GOLF_MK7.json
@@ -0,0 +1 @@
+{"input_std":[[9.664428],[1.2828087],[0.5358907],[0.04414606],[1.2693248],[1.2751942],[1.279506],[1.249834],[1.2184678],[1.1758597],[1.1319114],[0.04403217],[0.0440777],[0.044111222],[0.044084232],[0.043969695],[0.043677997],[0.043272585]],"model_test_loss":0.016808032989501953,"input_size":18,"current_date_and_time":"2023-08-13_11-43-31","input_mean":[[22.16122],[-0.05841703],[-0.0061066514],[-0.0040392894],[-0.056604024],[-0.05809211],[-0.059522722],[-0.060071282],[-0.059294432],[-0.05636808],[-0.054283537],[-0.004062983],[-0.0040673376],[-0.00406957],[-0.0040102745],[-0.0040264064],[-0.003949198],[-0.003894113]],"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":[[4.512272],[0.8451728],[0.061952885],[0.07117082],[0.0969589],[0.23836812],[-0.029027848]],"dense_1_W":[[2.3165002,-0.7564795,1.4717923,-0.31413803,1.6675323,0.7277529,-1.1163065,-0.019299118,-0.1405304,0.8572948,0.56036603,-0.41108173,-0.12570381,-0.014715486,1.132798,1.0821382,-0.75086635,-0.35031655],[0.9444606,-0.09898757,-0.6954507,0.30675238,-0.08984852,-0.49343133,0.9157946,-0.5570431,-0.3888742,-0.38986117,0.12952603,0.028433489,-0.024435973,-0.1049456,-0.38290912,-0.05392889,-0.015835924,0.14950559],[0.004741928,-1.5810053,0.03134019,0.3235661,1.2505218,-0.083220154,-0.3910901,-0.8460092,-0.74598694,-0.37966868,0.34051073,-0.39719552,-0.07352532,-0.06360439,0.34146932,0.10839794,0.43644786,-0.45806086],[0.00825958,0.47619736,-0.0059394315,-0.06315062,0.3332019,0.8162596,-0.6886139,-0.8321713,-0.23199448,0.13788818,0.27222332,-0.018768186,0.12005634,-0.03360056,-0.010549495,-0.05684962,-0.19241822,0.1521788],[-0.047451854,-0.3197287,-5.9774647,0.67842066,-1.8699528,-1.0736765,-0.22953252,-0.1705645,0.69078326,0.7744919,1.5346897,-0.06659277,-0.33114743,0.1330023,-0.0021685867,-0.14816211,-0.12463087,-0.098877035],[1.5630089,-0.14997533,-1.073808,-0.1734846,-0.3877676,0.683071,-0.9419817,0.057117645,-0.025376081,-0.29716906,-0.39132732,-0.0028707278,0.16397685,-0.19498843,-0.21398357,-0.013821919,0.44912493,-0.16607592],[0.009814496,-2.0713215,-0.044856403,-0.038243193,1.7569181,-0.7712438,-0.08035733,-0.38236764,-0.58137965,0.6674234,0.14389913,-0.6378334,0.14240614,0.24506636,0.6603566,0.014824286,-0.12690313,-0.14285208]],"activation":"σ"},{"dense_2_W":[[-0.42124227,0.33840093,0.44210997,-0.70910984,0.262287,0.18302582,-0.18371895],[-0.29685995,0.5138454,0.755978,0.22568974,-0.43676186,-0.49223867,0.47472122],[-0.2976625,-0.5638202,-0.346919,0.40578872,-0.039912287,0.77207106,-0.8657158],[-0.16169663,0.5898756,0.15860432,-0.48896188,0.14635944,-0.5558217,0.42120898],[0.27724966,-0.5185015,0.32158753,0.6277213,0.057304412,0.3086919,0.21024327],[0.03701429,-0.23197533,-0.30162218,0.72801787,-0.17062007,0.009803557,-0.5481523],[0.4629019,0.4786117,-0.14833471,-0.23350595,-0.29458895,-0.19023602,0.39070475],[0.9625968,-0.97766685,-0.9581983,1.2819734,-0.6076433,0.37645784,-0.79039747],[-0.13950962,-0.20756534,-0.31952453,0.6251145,-0.0893907,0.340857,-0.70461744],[-0.064140044,0.67090803,0.27711052,-0.44350907,0.5274457,0.26619676,-0.29007584],[-0.6253565,-0.072836235,-0.04700242,-0.5451034,-0.37668335,-0.15641896,-0.3610751],[-0.41676444,-0.32975447,0.09918825,0.1933214,0.114000455,0.21399117,0.6502726],[-0.20933664,0.18370156,0.6303221,-0.34840557,0.10767048,-0.12880816,0.43370107]],"activation":"σ","dense_2_b":[[-0.03087346],[0.083590284],[-0.12312114],[-0.015689747],[-0.03287778],[0.07682254],[-0.065336995],[0.29234254],[-0.08852307],[-0.013764559],[-0.2412543],[-0.016014475],[-0.056882493]]},{"dense_3_W":[[-0.17269112,-0.5855207,0.30247316,-0.3700723,0.5919556,0.34082454,-0.5857902,0.71309996,0.2776839,-0.639282,0.30003944,-0.20085171,-0.20065042],[-0.45765534,0.2437524,0.1612162,-0.505311,-0.10535189,0.53285104,-0.035850286,0.6772977,0.32458842,-0.028878551,-0.14009416,-0.08665312,-0.637454],[-0.19389966,0.029339047,-0.64755374,-0.22215632,-0.07883323,-0.5064457,0.13198881,0.22710016,-0.51746994,-0.3380553,0.19166663,0.023132537,0.14991826]],"activation":"identity","dense_3_b":[[-0.007823971],[-0.0085836565],[0.026530033]]},{"dense_4_W":[[0.93978757,0.73359257,-0.55248207]],"dense_4_b":[[-0.011260626]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/VOLKSWAGEN_JETTA_MK7.json b/selfdrive/car/torque_data/lat_models/VOLKSWAGEN_JETTA_MK7.json
new file mode 100644
index 000000000..829cfc644
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/VOLKSWAGEN_JETTA_MK7.json
@@ -0,0 +1 @@
+{"input_std":[[9.103015],[1.0622845],[0.49049565],[0.040089965],[1.0459728],[1.0516889],[1.056568],[1.0408956],[1.019547],[0.99288225],[0.971193],[0.04002349],[0.040028628],[0.040033314],[0.040071882],[0.04004624],[0.039898124],[0.03964297]],"model_test_loss":0.017716435715556145,"input_size":18,"current_date_and_time":"2023-08-13_20-52-08","input_mean":[[23.148537],[0.033288945],[-0.0069383495],[0.006664864],[0.03740209],[0.036363255],[0.035049323],[0.035006184],[0.036647633],[0.039277017],[0.043880757],[0.006671388],[0.0066857547],[0.0066986936],[0.0067147585],[0.006739247],[0.0067356247],[0.006714203]],"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.6366688],[-0.56371534],[-0.14571653],[-1.4455271],[0.07993529],[-0.0736673],[-0.3548013]],"dense_1_W":[[-1.3113872,0.76172936,0.016918765,0.16224551,0.094115384,0.32684585,-0.19450265,-0.13789567,0.04242289,-0.15509766,0.13169524,-0.13143206,0.032396875,-0.3091977,-0.26571655,-0.13967507,-0.065433465,0.15276721],[-0.07811718,1.0454074,8.495185,-0.7922316,-0.51769626,0.1606819,0.13209969,0.20275009,0.09197654,0.39435092,-0.8629015,0.48206797,0.43022737,0.085256994,-0.39034274,-0.29939228,0.26249692,0.21062453],[-0.0062007825,2.1868382,0.015541467,-0.49308324,-1.4422244,1.0147123,-0.78595483,0.5242463,0.32791784,-0.008197891,-0.23073053,0.31578735,-0.15602784,0.14793761,-0.23083985,0.052981053,0.004748488,0.13156143],[1.2384007,0.6278066,-0.009660281,0.40833205,0.37839705,1.1528418,-1.1164012,-0.32824138,-0.30145752,0.3350114,0.0860737,0.07817285,-0.18830507,-0.33780572,-0.513321,-0.07987069,-0.20404594,0.2723732],[0.0037708185,1.6037707,-0.018128129,0.14369644,1.3666841,1.1831751,1.1010982,1.5845065,1.3880488,0.9383163,0.6016751,0.32569328,0.05112049,-0.3200393,0.6177238,0.070831224,-0.3571441,-0.025784306],[0.0020605826,0.40808862,-0.0019806053,-0.22798932,0.4128132,1.312186,-2.012465,-0.18998149,0.38222578,0.034227915,-0.007133824,0.09108775,0.41027293,-0.35144845,0.41214025,0.18282686,-0.1982243,-0.29242274],[-0.11462315,0.14389442,1.7229052,-0.49408183,0.8118903,0.98040986,-0.1475524,0.32353425,-0.4042175,-0.4816111,-0.08436794,0.30240852,0.011541781,-0.27904144,-0.16726047,0.13386558,0.13543732,0.051627796]],"activation":"σ"},{"dense_2_W":[[-0.30253688,0.01659866,-0.5824275,-0.55473965,-0.65702754,0.4192852,-0.11081115],[0.42800114,-0.20567572,0.73502725,-0.3303795,0.5659001,0.33262393,-0.20845625],[-0.3169161,0.124995895,0.15316603,-0.3496913,0.25013453,0.83376133,0.08400041],[-1.9621079,1.3082521,-0.8913488,0.17462318,0.90885985,-0.7408587,-0.09095186],[0.65295506,-1.0685686,-0.3590795,-1.0821314,0.52553105,-0.33879203,-0.70096666],[0.3209469,-0.25117752,-0.6676659,0.04474845,-0.34462446,-0.6437361,0.2751733],[-0.16672656,0.05766618,0.020867005,-0.14019237,0.19822632,0.58170456,0.371152],[-0.16170846,-0.28313425,-0.72305113,-0.21175383,-0.091973335,0.069761746,-0.13998356],[-0.121987164,0.051230323,0.6086433,0.0826418,0.3024844,0.36294287,0.11378607],[0.23916546,0.32369035,0.29166648,-0.5202349,-0.25274298,0.05645988,0.004484808],[0.476144,-0.20375697,0.7744821,-0.20136273,-0.1997987,0.5086857,-0.13244303],[-0.5018623,0.0039712084,-1.3228892,-0.35630298,0.5103365,0.29102045,-0.42318186],[0.47396633,-0.5094677,-0.7413271,-0.0389592,-1.0502282,0.050273117,0.13152136]],"activation":"σ","dense_2_b":[[0.08725935],[-0.07465063],[0.03314263],[-0.37226093],[-0.023633253],[0.1155244],[-0.035357073],[0.23985702],[-0.20116974],[-0.31014088],[-0.10752753],[0.28552514],[-0.040062964]]},{"dense_3_W":[[-0.6032763,0.62711155,-0.018731741,-0.4367009,-0.33474848,-0.5986305,0.3242449,-0.5550633,0.03024249,0.37429914,0.5477163,-0.11621696,-0.06627925],[0.57853127,-0.07147071,-0.45605588,0.090353325,0.6903964,-0.054210514,0.117629945,-0.07430856,-0.63455236,0.17655165,0.17357552,0.5822009,0.35904822],[0.017287904,-0.4711383,0.31602967,-0.5097068,0.18833941,0.2322238,0.6586847,-0.3739661,-0.35619813,-0.50459105,0.065162025,-0.047679372,-0.048519257]],"activation":"identity","dense_3_b":[[0.030126056],[-0.038708143],[0.07066878]]},{"dense_4_W":[[1.1202317,-1.0828689,0.09244317]],"dense_4_b":[[0.034058213]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/VOLKSWAGEN_PASSAT_MK8.json b/selfdrive/car/torque_data/lat_models/VOLKSWAGEN_PASSAT_MK8.json
new file mode 100644
index 000000000..420f806e6
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/VOLKSWAGEN_PASSAT_MK8.json
@@ -0,0 +1 @@
+{"input_std":[[10.3052],[1.1070998],[0.5069369],[0.037658893],[1.0964528],[1.0996523],[1.102182],[1.0794489],[1.0610045],[1.0333265],[1.00464],[0.037511136],[0.03756209],[0.037611235],[0.037606418],[0.03751489],[0.037262734],[0.03702075]],"model_test_loss":0.012260119430720806,"input_size":18,"current_date_and_time":"2023-08-13_22-59-06","input_mean":[[21.415882],[0.017556097],[-0.004099798],[-0.003401093],[0.020456757],[0.019209672],[0.01819574],[0.01823048],[0.019393403],[0.02141286],[0.022404209],[-0.0034443606],[-0.0034451415],[-0.0034438162],[-0.00339113],[-0.003406753],[-0.003565579],[-0.0037500844]],"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":[[-1.3709847],[-6.2942357],[0.09346686],[6.5184207],[-1.5861837],[-0.014835897],[0.027714923]],"dense_1_W":[[-0.5551179,2.6619074,-0.00640388,0.13290244,-1.037943,0.7656338,0.4283093,0.37328,0.26634002,-0.13999927,-0.15548675,0.097528294,-0.3680248,0.25233808,-0.08934639,-0.015347149,-0.11909841,0.111676104],[-3.5742025,-0.40220144,-1.3790281,0.5485811,-0.050429426,-0.45648634,0.7774281,-1.1217349,-0.6165576,0.1251687,-0.20120902,-0.4511548,-0.13060598,0.22547151,-0.016303696,-0.20157799,0.09675224,-0.07398645],[-0.0012344504,1.1922354,-0.0048953234,0.2634142,-0.6455366,1.3841971,-0.45204964,0.1695878,0.063574985,0.10271839,-0.10217061,-0.08847725,-0.13457958,-0.4961231,-0.5403963,-0.34123054,-0.017704021,0.515054],[3.7061737,-0.9532865,-1.424426,0.6954919,-0.022263907,-0.5896788,1.3645809,-1.1818194,-0.56429285,0.19767563,-0.25111258,0.020198058,-0.52572525,-0.16691986,0.31276083,-0.55734074,0.41006702,-0.19204228],[-0.60735714,-3.3537095,-0.0038090213,0.5654296,1.0198475,-0.6862546,0.08697712,-0.5121695,-0.3346962,0.17586575,0.22113432,-0.08847206,-0.3487319,-0.14522201,0.23490162,-0.18125007,0.10122172,-0.13981529],[0.0017254709,0.62618876,-0.0013352685,-0.0367472,0.040667597,1.5291207,-1.528107,-0.38684332,0.16372706,-0.2591873,0.28832328,0.3641689,-0.24908063,0.1472321,-0.119317986,-0.06420556,0.2222137,-0.2624101],[0.0055754874,-1.8040034,-3.361559,1.0961792,-0.3001131,-0.9308391,1.4269178,0.22353382,-0.4215277,-0.15384597,1.3272976,-0.34549853,-0.6220911,0.38486806,-0.33497638,-0.35858622,0.34940526,-0.16165465]],"activation":"σ"},{"dense_2_W":[[-0.5476146,1.6963724,-1.6546803,0.5176808,0.5235883,-0.97987354,0.7380813],[-0.36497906,-0.2612212,-0.016376352,0.10838414,0.073292136,0.0015826789,-0.50295585],[0.6298286,-0.46785268,-0.16137074,-0.07789413,0.27898172,0.3285615,0.4176234],[0.5922487,-0.34946433,-0.048434507,-0.0985068,-0.6583057,1.0643016,-0.46150544],[0.73731494,-0.6556301,0.81423277,-0.6606677,-0.36022863,0.2516511,-0.49312246],[-0.6430194,-0.41603965,-0.10390351,-0.49625757,0.10309995,-0.22808753,-0.30847374],[0.39266315,-0.15612036,-0.58519137,0.49023283,0.09567495,-1.016928,0.08579332],[0.34867492,0.1914456,-0.21379824,0.041593276,-0.5044442,0.9609127,-0.4119613],[0.37885004,-0.37522417,0.56330055,-0.53145355,-0.91467786,0.5687067,-0.043723527],[-0.57495284,0.46496224,-0.4232346,-0.3390447,0.03577091,0.086310275,-0.06801427],[0.37579545,-0.5779554,-0.16705948,-0.33729044,0.04347679,-0.5497756,-0.24243224],[0.5380365,-0.29537776,0.15974742,-0.5128796,-0.23003492,0.6015878,-0.20965582],[-0.9828622,0.75779086,-1.3404784,1.6249025,0.44636276,-0.6208371,0.7130451]],"activation":"σ","dense_2_b":[[-0.3861388],[0.0100793],[0.05162594],[-0.022311607],[-0.009086858],[-0.23065013],[-0.07641792],[-0.026186304],[-0.23643298],[-0.03883572],[0.021982284],[0.0043940307],[-0.09819139]]},{"dense_3_W":[[0.6619464,0.47387305,-0.55588114,-0.4830425,-0.53887093,0.47769704,0.343591,0.23760638,-0.19049422,0.46038502,0.3466442,-0.52039224,-0.02187165],[0.037034765,-0.5791299,-0.46348968,0.33793876,-0.1364937,-0.17524627,0.48086503,-0.31004375,0.11112415,0.4982084,0.36429304,-0.0013359467,0.5441025],[-0.3904947,0.44045958,-0.18596323,0.615597,-0.032387026,-0.014983241,-0.649624,0.26271734,0.26629633,-0.062090363,-0.37463444,0.5122715,-0.24724658]],"activation":"identity","dense_3_b":[[-0.02654226],[-0.035016984],[0.028202571]]},{"dense_4_W":[[-0.2911369,-0.77550566,0.7692582]],"dense_4_b":[[0.03128059]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/VOLKSWAGEN_PASSAT_NMS.json b/selfdrive/car/torque_data/lat_models/VOLKSWAGEN_PASSAT_NMS.json
new file mode 100644
index 000000000..f80e89d1e
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/VOLKSWAGEN_PASSAT_NMS.json
@@ -0,0 +1 @@
+{"test_dict":{"[0.0,-4.0,4.0,0.0,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.835412,"[0.0,0.0,4.0,-0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.2336276,"[0.0,4.0,-4.0,-0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-1.2189443,"[40.0,4.0,4.0,0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":1.0102171,"[40.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.030764546,"[40.0,-4.0,4.0,0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.7043263,"[20.0,4.0,4.0,0.0,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":1.0948871,"[40.0,0.0,0.0,0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.23544258,"[20.0,-4.0,4.0,0.0,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.63234776,"[40.0,-4.0,0.0,0.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.85114586,"[40.0,-4.0,4.0,-0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.5361517,"[40.0,4.0,-4.0,0.0,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.6150184,"[0.0,4.0,-4.0,0.0,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-1.2294357,"[0.0,-4.0,-4.0,0.0,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-2.1777012,"[0.0,4.0,0.0,-0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.1220803,"[0.0,4.0,-4.0,0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.256643,"[20.0,0.0,4.0,0.0,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.42655924,"[40.0,4.0,0.0,0.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.82392097,"[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.20633036,"[40.0,4.0,0.0,-0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.8738396,"[20.0,-4.0,0.0,0.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-1.0698426,"[20.0,4.0,0.0,0.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":1.0190142,"[0.0,0.0,-4.0,0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-2.2355235,"[40.0,0.0,4.0,0.0,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.11299175,"[0.0,-4.0,0.0,0.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-1.7797719,"[0.0,4.0,0.0,0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":1.0755801,"[0.0,-4.0,4.0,-0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.90929884,"[20.0,-4.0,0.0,0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.1290616,"[40.0,-4.0,0.0,0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.9102107,"[40.0,-4.0,4.0,0.0,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.63283235,"[40.0,0.0,-4.0,0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.2970404,"[40.0,4.0,4.0,-0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.0833684,"[0.0,0.0,-4.0,0.0,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-2.1911933,"[0.0,4.0,4.0,0.0,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":1.201447,"[40.0,-4.0,-4.0,0.0,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.9321379,"[40.0,0.0,4.0,0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.098811716,"[0.0,0.0,0.0,-0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.22733232,"[20.0,0.0,-4.0,0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.4293779,"[40.0,4.0,-4.0,-0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.6842653,"[0.0,4.0,0.0,0.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":1.1035659,"[0.0,-4.0,4.0,0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.7793283,"[40.0,-4.0,0.0,-0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.7686179,"[40.0,0.0,-4.0,-0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.107880056,"[20.0,-4.0,-4.0,-0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-1.0867288,"[40.0,-4.0,-4.0,-0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.86887354,"[20.0,4.0,4.0,0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":1.0619769,"[0.0,0.0,4.0,0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":1.1285523,"[20.0,4.0,-4.0,-0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.69223654,"[0.0,-4.0,0.0,-0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-1.7518216,"[20.0,4.0,0.0,-0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.0596709,"[0.0,0.0,-4.0,-0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-2.11871,"[20.0,4.0,0.0,0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.9609706,"[20.0,4.0,-4.0,0.0,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.6211437,"[40.0,4.0,-4.0,0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.52062637,"[20.0,0.0,4.0,0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.2104128,"[0.0,4.0,4.0,0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":1.1836823,"[20.0,4.0,-4.0,0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.5248347,"[40.0,0.0,0.0,-0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.292731,"[20.0,-4.0,-4.0,0.0,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-1.138114,"[0.0,4.0,4.0,-0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.2132114,"[20.0,0.0,0.0,-0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.27300417,"[20.0,0.0,0.0,0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.26868293,"[20.0,0.0,4.0,-0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.64426357,"[40.0,0.0,-4.0,0.0,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.08701679,"[20.0,0.0,-4.0,-0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.024351712,"[20.0,4.0,4.0,-0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.1174083,"[20.0,-4.0,-4.0,0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.1745512,"[0.0,0.0,0.0,0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.63085973,"[20.0,0.0,-4.0,0.0,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.18953863,"[20.0,-4.0,4.0,0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.70560896,"[20.0,-4.0,4.0,-0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.53338933,"[0.0,-4.0,-4.0,0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-2.187799,"[20.0,-4.0,0.0,-0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.9880617,"[0.0,0.0,4.0,0.0,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":1.1916934,"[40.0,4.0,4.0,0.0,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":1.0533769,"[0.0,-4.0,0.0,0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.7911664,"[40.0,0.0,4.0,-0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.34528437,"[20.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.00016171113,"[0.0,-4.0,-4.0,-0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-2.161565,"[40.0,4.0,0.0,0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.75353914,"[40.0,-4.0,-4.0,0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.97723967},"input_std":[[8.338225],[1.408846],[1.0394787],[0.03335341],[1.3959996],[1.4030461],[1.407399],[1.384101],[1.3516284],[1.3079585],[1.2541819],[0.033312354],[0.033323247],[0.033341203],[0.033303928],[0.033300698],[0.033334702],[0.0333457]],"model_test_loss":0.016627496108412743,"input_size":18,"current_date_and_time":"2023-07-17_12-56-04","input_mean":[[16.703712],[0.10588005],[-0.010265364],[-0.029445024],[0.10293076],[0.104083925],[0.105137445],[0.10571949],[0.10239706],[0.09606354],[0.09232913],[-0.02939694],[-0.029403588],[-0.02942391],[-0.02959834],[-0.029817479],[-0.030200344],[-0.030651137]],"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,"test_dict_zero_bias":{"[0.0,-4.0,4.0,0.0,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.0787524,"[0.0,0.0,4.0,-0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.35174394,"[0.0,4.0,-4.0,-0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.41936088,"[40.0,4.0,4.0,0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":1.2337253,"[40.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.13621223,"[40.0,-4.0,4.0,0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.49109936,"[20.0,4.0,4.0,0.0,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":1.439525,"[40.0,0.0,0.0,0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.13884512,"[20.0,-4.0,4.0,0.0,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.53931737,"[40.0,-4.0,0.0,0.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.73874366,"[40.0,-4.0,4.0,-0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.35439628,"[40.0,4.0,-4.0,0.0,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.8166686,"[0.0,4.0,-4.0,0.0,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.47153878,"[0.0,-4.0,-4.0,0.0,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-1.9580405,"[0.0,4.0,0.0,-0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.36217993,"[0.0,4.0,-4.0,0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.5416738,"[20.0,0.0,4.0,0.0,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":1.2621055,"[40.0,4.0,0.0,0.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":1.131006,"[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.7893468,"[40.0,4.0,0.0,-0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.1926978,"[20.0,-4.0,0.0,0.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-1.1279483,"[20.0,4.0,0.0,0.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":1.3684851,"[0.0,0.0,-4.0,0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.3094211,"[40.0,0.0,4.0,0.0,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.3712977,"[0.0,-4.0,0.0,0.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-1.7667332,"[0.0,4.0,0.0,0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.27987432,"[0.0,-4.0,4.0,-0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.041331887,"[20.0,-4.0,0.0,0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.1544355,"[40.0,-4.0,0.0,0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.7870656,"[40.0,-4.0,4.0,0.0,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.43408832,"[40.0,0.0,-4.0,0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.23026863,"[40.0,4.0,4.0,-0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.3094313,"[0.0,0.0,-4.0,0.0,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-1.0644252,"[0.0,4.0,4.0,0.0,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.7976848,"[40.0,-4.0,-4.0,0.0,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.99903697,"[40.0,0.0,4.0,0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.15177456,"[0.0,0.0,0.0,-0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.492374,"[20.0,0.0,-4.0,0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.3808361,"[40.0,4.0,-4.0,-0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.9073831,"[0.0,4.0,0.0,0.0,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.32916206,"[0.0,-4.0,4.0,0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-0.106909096,"[40.0,-4.0,0.0,-0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.6694711,"[40.0,0.0,-4.0,-0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.2106556,"[20.0,-4.0,-4.0,-0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-1.4411385,"[40.0,-4.0,-4.0,-0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.9513951,"[20.0,4.0,4.0,0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":1.412755,"[0.0,0.0,4.0,0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.2576269,"[20.0,4.0,-4.0,-0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.36055696,"[0.0,-4.0,0.0,-0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-1.6838698,"[20.0,4.0,0.0,-0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.3918278,"[0.0,0.0,-4.0,-0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-0.8520211,"[20.0,4.0,0.0,0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":1.3348066,"[20.0,4.0,-4.0,0.0,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.29837233,"[40.0,4.0,-4.0,0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.697657,"[20.0,0.0,4.0,0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":1.1919205,"[0.0,4.0,4.0,0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.7850812,"[20.0,4.0,-4.0,0.2,5.2,4.8,4.4,2.8,1.6,0.0,-2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.21019909,"[40.0,0.0,0.0,-0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.42828774,"[20.0,-4.0,-4.0,0.0,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-1.4563662,"[0.0,4.0,4.0,-0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.8075129,"[20.0,0.0,0.0,-0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.7073532,"[20.0,0.0,0.0,0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.047708154,"[20.0,0.0,4.0,-0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.3243128,"[40.0,0.0,-4.0,0.0,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-0.003768146,"[20.0,0.0,-4.0,-0.2,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-1.211508,"[20.0,4.0,4.0,-0.2,2.8,3.2,3.6,5.2,6.4,8.0,10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":1.4588401,"[20.0,-4.0,-4.0,0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.4644309,"[0.0,0.0,0.0,0.2,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.0761973,"[20.0,0.0,-4.0,0.0,1.2,0.8,0.4,-1.2,-2.4,-4.0,-6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":-1.3106804,"[20.0,-4.0,4.0,0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":0.5213471,"[20.0,-4.0,4.0,-0.2,-5.2,-4.8,-4.4,-2.8,-1.6,0.0,2.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.5822113,"[0.0,-4.0,-4.0,0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.9868801,"[20.0,-4.0,0.0,-0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-1.0855144,"[0.0,0.0,4.0,0.0,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.31297475,"[40.0,4.0,4.0,0.0,2.8,3.2,3.6,5.2,6.4,8.0,10.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":1.2781342,"[0.0,-4.0,0.0,0.2,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,-4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.8265104,"[40.0,0.0,4.0,-0.2,-1.2,-0.8,-0.4,1.2,2.4,4.0,6.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":0.6158317,"[20.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]":0.37998584,"[0.0,-4.0,-4.0,-0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2,-0.2]":-1.9141586,"[40.0,4.0,0.0,0.2,4.0,4.0,4.0,4.0,4.0,4.0,4.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":1.0466149,"[40.0,-4.0,-4.0,0.2,-2.8,-3.2,-3.6,-5.2,-6.4,-8.0,-10.0,0.2,0.2,0.2,0.2,0.2,0.2,0.2]":-1.0325543},"layers":[{"dense_1_b":[[-2.837288],[-6.5732856],[-0.36112186],[-2.4264846],[-0.53084093],[-0.17624182],[5.4556284]],"dense_1_W":[[-2.3625484,0.70262957,-0.39007878,-0.52770585,0.35169983,-0.35000876,-0.12762427,-1.0095628,-0.83572966,-0.730048,0.6743538,-0.39424068,0.3901122,0.36599886,-0.011965084,0.045552857,0.4666889,-0.3256988],[-3.6053147,-0.31673837,0.66194737,0.3903138,0.98095685,1.2762904,-1.3785179,-1.296343,0.71970254,0.3438452,0.031964917,0.058328565,-0.058488294,-0.33832067,-0.12332722,0.165694,-0.020551614,-0.050333176],[-0.0041524894,0.520019,-0.04355893,-0.05094888,0.60922056,-1.3748976,0.3093316,-1.0256472,0.19658932,0.052907944,0.0067435564,-0.2945121,0.08360483,0.2436637,0.22430366,-0.12585463,0.044775117,-0.054093584],[-1.7719781,-1.0094852,0.5476492,0.15155911,-0.22202487,0.5499667,-0.17507018,1.3075997,0.97578096,0.32534385,-0.32253557,0.19911957,-0.004920554,-0.44574377,0.3794811,-0.23206042,-0.24507338,0.17988442],[-0.096019216,-2.8020802,0.1768002,-0.11615186,1.0867412,-0.4728857,-0.73343986,-1.899336,-1.1828195,1.287238,0.2246014,-0.3443722,0.40425447,0.11932455,0.0037963327,0.3826241,-0.32104075,0.03184444],[0.18515867,0.15802903,11.005427,0.41247886,-2.3798037,-0.84801793,-0.80931455,1.2942814,1.7535613,0.6347409,1.4362186,0.296623,-0.022977732,-0.60491437,0.034293108,-0.08022964,-0.004915833,-0.13788682],[3.219948,-0.5069822,0.39000142,0.34811074,0.6547,0.5350491,-0.30209413,-0.7547057,0.37530193,-0.46802387,0.3797982,0.29564524,-0.28160524,-0.464101,-0.055149645,0.29884568,-0.052221056,-0.08509861]],"activation":"σ"},{"dense_2_W":[[-0.6509598,0.29119527,0.4522418,0.67029077,0.31190413,0.24329087,-0.13738276],[-0.9829914,3.5774024,-1.8433813,1.6228933,-1.0542817,0.96605825,0.16334952],[-0.07484317,1.7878124,-1.9842395,1.3015918,-0.045502957,0.29070792,0.23896325],[-0.017372472,0.5585439,0.38864908,-0.11616016,0.5211495,0.2445178,-0.0821982],[-2.9980035,3.602488,-0.73448294,0.5120281,-1.5761098,1.7105227,2.7474566],[-1.0895693,-0.061832696,1.3823732,0.36133802,-0.51309395,0.6033679,0.18768047],[-0.8188117,0.44345558,1.1498142,0.86907035,-0.38104993,0.18720235,-0.23738712],[0.06584014,-0.61574376,-1.1880105,-0.40490726,-0.46003637,-0.014412597,0.44476265],[2.0212123,1.1144648,-1.0255187,0.9472248,-0.3807562,-3.1219852,-3.644532],[0.0436852,2.2160454,-1.5884769,1.0859653,-0.51730025,0.06356327,0.016509296],[-1.2976134,3.8786354,-1.172869,1.3448112,-1.3144706,1.0707655,0.20357744],[0.3019769,-0.77098906,0.3424374,-0.59369296,0.26005548,-0.20149492,-0.72477216],[0.31829432,0.14789248,-0.20679975,-1.3688983,0.721357,-1.155302,-0.35438472]],"activation":"σ","dense_2_b":[[-0.034817904],[-0.39495024],[-0.16561012],[0.023161512],[0.054840133],[-0.034001518],[-0.05686173],[-0.026203524],[-0.6473888],[0.28907722],[-0.38862142],[-0.091984995],[0.02006307]]},{"dense_3_W":[[-0.2560296,-0.47561207,-0.2180975,0.2697371,-0.28709534,-0.2907532,0.06514903,-0.08777709,0.07678251,-0.14984281,0.20281981,0.027406089,0.26574254],[0.30667484,0.5253529,0.52860755,0.22304007,0.63340044,-0.8269798,-0.36970806,-0.1585502,-1.241306,0.16619857,0.5249275,-0.19621038,0.32695386],[-0.64127594,0.27470827,0.028331403,-0.32301947,0.6665432,-0.8246224,-0.33862486,0.38033482,-1.4627537,0.2530845,0.40247354,-0.49841896,0.30732566]],"activation":"identity","dense_3_b":[[0.06380872],[-0.13593788],[-0.05554244]]},{"dense_4_W":[[-0.17066109,0.67130095,0.99185157]],"dense_4_b":[[-0.057568375]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/lat_models/VOLKSWAGEN_TIGUAN_MK2.json b/selfdrive/car/torque_data/lat_models/VOLKSWAGEN_TIGUAN_MK2.json
new file mode 100644
index 000000000..2f0c99541
--- /dev/null
+++ b/selfdrive/car/torque_data/lat_models/VOLKSWAGEN_TIGUAN_MK2.json
@@ -0,0 +1 @@
+{"input_std":[[8.782441],[1.1398275],[0.4609802],[0.04271673],[1.1238744],[1.1299343],[1.1346341],[1.1119426],[1.0859472],[1.0505929],[1.01332],[0.042612497],[0.042648252],[0.042672537],[0.042585343],[0.042469293],[0.042215183],[0.04179356]],"model_test_loss":0.018630679696798325,"input_size":18,"current_date_and_time":"2023-08-14_01-59-38","input_mean":[[22.468307],[-0.0059960946],[-0.008688168],[-0.003941978],[-0.004109974],[-0.0052409726],[-0.0066701453],[-0.010034277],[-0.013358513],[-0.011732898],[-0.0112503925],[-0.0039730547],[-0.0039907545],[-0.004007257],[-0.0040642004],[-0.004142748],[-0.004199409],[-0.0042553144]],"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.22421235],[0.022291217],[0.015709542],[-0.04664034],[-0.036350474],[-0.24544194],[-0.04896989]],"dense_1_W":[[-0.015455264,0.35899833,6.998555,0.81398284,0.34668404,0.50750834,-0.30584475,0.6416511,-0.5377552,-0.026296293,-0.6502898,0.43909717,-0.27295533,-0.76501244,-0.5884351,0.22982346,-0.26877192,0.26560456],[-0.01508568,1.8268416,0.00402336,0.2784217,-0.7716931,0.46446714,-0.11456723,0.10766974,0.30401927,-0.085616745,-0.15998937,0.44400185,-0.48933145,-0.23811713,-0.440158,-0.10242332,0.051594254,0.12977812],[-0.009739386,-2.6971612,0.001168384,-0.35022622,0.65414,-0.717214,-0.44903016,-0.49311733,-0.43150806,0.06219255,0.23182331,-0.44158918,-0.49226075,0.47947824,0.6467593,0.34515625,0.09018108,-0.47900265],[1.0840801,-0.7623997,-0.005088885,-0.52213657,-0.22831856,-0.6294846,-1.2465742,0.3222685,0.020507088,-0.024931427,-0.24259277,0.08206772,0.21676067,-0.41708487,0.50989604,0.33494267,-0.079637915,-0.14551927],[0.004391417,-0.10370217,0.0014306986,-0.072918385,-0.63637805,-1.1973468,0.5230291,-0.05261172,0.25703079,0.041062124,-0.34666935,0.0939909,-0.48456657,0.08325979,0.5252982,-0.10210225,-0.12507002,0.05711295],[-0.010150519,0.47018084,1.575968,-0.12638067,0.58264244,1.1620525,-0.6418302,-0.022278491,0.5091847,-0.16685116,0.074821465,0.22004989,-0.099773616,-0.5007223,-0.09964562,0.46015504,0.21582201,-0.23595089],[1.1357191,0.7709306,0.003718608,0.6016892,0.7352459,0.33387783,1.0426474,0.12312558,-0.49904007,0.032169387,0.37637976,-0.05813148,-0.49427262,0.49914685,-0.2028158,-0.5950836,0.2782391,0.028333709]],"activation":"σ"},{"dense_2_W":[[0.43099108,-0.40067255,0.15829495,-0.48378208,0.396984,-0.1558594,-0.1562694],[0.6452132,0.40809157,-0.5897283,1.2150947,-0.6793519,0.78984624,0.66217726],[-1.0487145,-0.15708125,0.48070663,-1.294668,0.44506454,-1.0924927,-1.3423347],[-0.0905496,-0.39283985,-0.560608,-0.4611327,-0.3925291,0.005858116,0.5098873],[-1.3053528,-0.17654762,1.1515645,1.4426079,1.0838766,-0.6442153,1.756127],[-0.34371176,1.1574818,0.017585738,0.20476972,-0.463017,-0.22401343,-0.5996214],[0.20533562,0.79994386,-0.8060774,0.17529243,-0.38612595,0.03759143,-0.22778784],[-0.10523058,1.0248777,-0.5244927,0.58016795,-0.48161384,0.2411753,-0.3102547],[0.041490827,-0.12094459,0.44139338,0.123947956,0.5913839,-0.50927347,0.82576096],[-0.17784683,-0.7949691,0.6407812,0.36980206,-0.045769464,-0.15805046,0.27670377],[0.13153441,-0.9403638,0.2306892,-0.18441507,0.34671855,-0.074668296,0.5032],[-0.04615598,0.71520805,-0.0030287886,-0.17552495,-0.19403128,0.21251689,0.24918763],[0.2859375,-0.5510105,0.31645826,-0.15235336,0.62049425,0.14673771,0.11173112]],"activation":"σ","dense_2_b":[[-0.20544042],[0.14436114],[-0.12040931],[-0.16554375],[0.36716554],[0.17168364],[-0.065600924],[-0.01176559],[-0.03528442],[0.037511505],[-0.11677802],[-0.035834227],[-0.17063564]]},{"dense_3_W":[[-0.3723276,0.4951858,-0.17594789,0.31653145,-0.09435181,0.45912716,-0.30004933,0.41055498,-0.21392249,0.35937718,-0.10425309,-0.2715391,-0.5834551],[-0.25541237,-0.58331114,0.4694298,-0.14703207,0.7632458,-0.35720977,-0.26993504,-0.5713957,0.020457853,0.012436012,-0.049483325,0.1666998,0.33925256],[0.45550138,0.12273135,0.51411545,0.43389788,0.0037848332,-0.41984108,-0.10243085,-0.56994265,0.24741924,0.44959965,0.5980098,-0.37595576,0.34953722]],"activation":"identity","dense_3_b":[[0.048041742],[-0.07375918],[-0.090859294]]},{"dense_4_W":[[0.09198451,-1.1679362,-0.9176557]],"dense_4_b":[[0.08128402]],"activation":"identity"}]}
\ No newline at end of file
diff --git a/selfdrive/car/torque_data/override.toml b/selfdrive/car/torque_data/override.toml
index 4610f590d..b37817b4c 100644
--- a/selfdrive/car/torque_data/override.toml
+++ b/selfdrive/car/torque_data/override.toml
@@ -44,6 +44,7 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"]
"CADILLAC_ESCALADE_ESV_2019" = [1.15, 1.3, 0.2]
"CADILLAC_XT4" = [1.45, 1.6, 0.2]
"CHEVROLET_BOLT_EUV" = [2.0, 2.0, 0.05]
+"CHEVROLET_MALIBU_CC" = [1.85, 1.85, 0.075]
"CHEVROLET_SILVERADO" = [1.9, 1.9, 0.112]
"CHEVROLET_TRAILBLAZER" = [1.33, 1.9, 0.16]
"CHEVROLET_TRAVERSE" = [1.33, 1.33, 0.18]
diff --git a/selfdrive/car/torque_data/params.toml b/selfdrive/car/torque_data/params.toml
index 34cfd0e06..b0ac39f39 100644
--- a/selfdrive/car/torque_data/params.toml
+++ b/selfdrive/car/torque_data/params.toml
@@ -14,6 +14,7 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"]
"HONDA_ACCORD" = [1.6893333799149202, 0.3246749081720698, 0.2120497022936265]
"HONDA_CIVIC_BOSCH" = [1.691708637466905, 0.40132900729454185, 0.25460295304024094]
"HONDA_CIVIC" = [1.6528895627785531, 0.4018518740819229, 0.25458812851328544]
+"HONDA_CLARITY" = [1.6528895627785531, 0.4018518740819229, 0.25458812851328544]
"HONDA_CRV" = [0.7667141440182675, 0.5927571534745969, 0.40909087636157127]
"HONDA_CRV_5G" = [2.01323205142022, 0.2700612209345081, 0.2238412881331528]
"HONDA_CRV_HYBRID" = [2.072034634644233, 0.7152085160516978, 0.20237105008376083]
diff --git a/selfdrive/car/torque_data/substitute.toml b/selfdrive/car/torque_data/substitute.toml
index 310e9c5be..1525bf114 100644
--- a/selfdrive/car/torque_data/substitute.toml
+++ b/selfdrive/car/torque_data/substitute.toml
@@ -9,6 +9,8 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"]
"TOYOTA_ALPHARD_TSS2" = "TOYOTA_SIENNA"
"TOYOTA_PRIUS_V" = "TOYOTA_PRIUS"
+"TOYOTA_RAV4_PRIME" = "TOYOTA_RAV4_TSS2"
+"TOYOTA_SIENNA_4TH_GEN" = "TOYOTA_RAV4_TSS2"
"LEXUS_IS" = "LEXUS_NX"
"LEXUS_CTH" = "LEXUS_NX"
"LEXUS_ES" = "TOYOTA_CAMRY"
@@ -61,8 +63,9 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"]
"CHEVROLET_SUBURBAN" = "CHEVROLET_SILVERADO"
"CHEVROLET_SUBURBAN_CC" = "CHEVROLET_SILVERADO"
"GMC_YUKON_CC" = "CHEVROLET_SILVERADO"
+"CHEVROLET_TRAX" = "CHEVROLET_VOLT"
"CADILLAC_CT6_CC" = "CHEVROLET_VOLT"
-"CADILLAC_XT5_CC" = "CHEVROLET_EQUINOX"
+"CADILLAC_XT5_CC" = "GMC_ACADIA"
"SKODA_FABIA_MK4" = "VOLKSWAGEN_GOLF_MK7"
"SKODA_OCTAVIA_MK3" = "SKODA_SUPERB_MK3"
diff --git a/selfdrive/car/toyota/carcontroller.py b/selfdrive/car/toyota/carcontroller.py
index f9b7a478e..bda632f4e 100644
--- a/selfdrive/car/toyota/carcontroller.py
+++ b/selfdrive/car/toyota/carcontroller.py
@@ -1,16 +1,35 @@
+import math
+import numpy as np
+
from cereal import car
-from openpilot.common.numpy_fast import clip
-from openpilot.selfdrive.car import apply_meas_steer_torque_limits, apply_std_steer_angle_limits, common_fault_avoidance, make_can_msg
+from openpilot.common.filter_simple import FirstOrderFilter
+from openpilot.common.numpy_fast import clip, interp
+from openpilot.common.realtime import DT_CTRL
+from openpilot.selfdrive.car import carlog, apply_meas_steer_torque_limits, apply_std_steer_angle_limits, common_fault_avoidance, create_gas_interceptor_command, make_can_msg, rate_limit
+from openpilot.selfdrive.car.secoc import add_mac, build_sync_mac
from openpilot.selfdrive.car.interfaces import CarControllerBase
from openpilot.selfdrive.car.toyota import toyotacan
from openpilot.selfdrive.car.toyota.values import CAR, STATIC_DSU_MSGS, NO_STOP_TIMER_CAR, TSS2_CAR, \
- CarControllerParams, ToyotaFlags, \
- UNSUPPORTED_DSU_CAR
+ MIN_ACC_SPEED, PEDAL_TRANSITION, CarControllerParams, ToyotaFlags, \
+ UNSUPPORTED_DSU_CAR, STOP_AND_GO_CAR
+from openpilot.selfdrive.controls.lib.drive_helpers import CRUISE_LONG_PRESS
+from openpilot.selfdrive.controls.lib.pid import PIDController
from opendbc.can.packer import CANPacker
+from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_acceleration import get_max_allowed_accel
+
+LongCtrlState = car.CarControl.Actuators.LongControlState
SteerControlType = car.CarParams.SteerControlType
VisualAlert = car.CarControl.HUDControl.VisualAlert
+ACCELERATION_DUE_TO_GRAVITY = 9.81 # m/s^2
+
+# The up limit allows the brakes/gas to unwind quickly leaving a stop,
+# the down limit roughly matches the rate of ACCEL_NET, reducing PCM compensation windup
+ACCEL_WINDUP_LIMIT = 4.0 * DT_CTRL * 3 # m/s^2 / frame
+ACCEL_WINDDOWN_LIMIT = -4.0 * DT_CTRL * 3 # m/s^2 / frame
+ACCEL_PID_UNWIND = 0.03 * DT_CTRL * 3 # m/s^2 / frame
+
# LKA limits
# EPS faults if you apply torque while the steering rate is above 100 deg/s for too long
MAX_STEER_RATE = 100 # deg/s
@@ -24,6 +43,20 @@ MAX_USER_TORQUE = 500
MAX_LTA_ANGLE = 94.9461 # deg
MAX_LTA_DRIVER_TORQUE_ALLOWANCE = 150 # slightly above steering pressed allows some resistance when changing lanes
+# Lock / unlock door commands - Credit goes to AlexandreSato!
+LOCK_CMD = b"\x40\x05\x30\x11\x00\x80\x00\x00"
+UNLOCK_CMD = b"\x40\x05\x30\x11\x00\x40\x00\x00"
+
+PARK = car.CarState.GearShifter.park
+
+def get_long_tune(CP, params):
+ kiBP = [2., 5.]
+ kiV = [0.5, 0.25]
+
+ return PIDController(0.0, (kiBP, kiV), k_f=1.0,
+ pos_limit=params.ACCEL_MAX, neg_limit=params.ACCEL_MIN,
+ rate=1 / (DT_CTRL * 3))
+
class CarController(CarControllerBase):
def __init__(self, dbc_name, CP, VM):
@@ -35,22 +68,66 @@ class CarController(CarControllerBase):
self.alert_active = False
self.last_standstill = False
self.standstill_req = False
+ self.permit_braking = True
self.steer_rate_counter = 0
self.distance_button = 0
+ # *** start long control state ***
+ self.long_pid = get_long_tune(self.CP, self.params)
+
+ self.aego = FirstOrderFilter(0.0, 0.25, DT_CTRL * 3)
+ self.pitch = FirstOrderFilter(0, 0.5, DT_CTRL)
+
+ self.accel = 0
+ self.prev_accel = 0
+ # *** end long control state ***
+
self.packer = CANPacker(dbc_name)
- self.gas = 0
- self.accel = 0
+
+ self.secoc_lka_message_counter = 0
+ self.secoc_lta_message_counter = 0
+ self.secoc_prev_reset_counter = 0
+
+ # FrogPilot variables
+ self.stock_max_accel = self.params.ACCEL_MAX
+
+ self.doors_locked = False
+ self.reverse_cruise_active = False
+
+ self.cruise_timer = 0
+ self.previous_set_speed = 0
+
+ def update(self, CC, CS, now_nanos, frogpilot_toggles):
+ if frogpilot_toggles.sport_plus:
+ self.params.ACCEL_MAX = min(frogpilot_toggles.max_desired_acceleration, get_max_allowed_accel(CS.out.vEgo))
+ self.long_pid.pos_limit = self.params.ACCEL_MAX
+ else:
+ self.params.ACCEL_MAX = min(frogpilot_toggles.max_desired_acceleration, self.stock_max_accel)
+ self.long_pid.pos_limit = self.params.ACCEL_MAX
- def update(self, CC, CS, now_nanos):
actuators = CC.actuators
+ stopping = actuators.longControlState == LongCtrlState.stopping
hud_control = CC.hudControl
pcm_cancel_cmd = CC.cruiseControl.cancel
lat_active = CC.latActive and abs(CS.out.steeringTorque) < MAX_USER_TORQUE
+ if len(CC.orientationNED) == 3:
+ self.pitch.update(CC.orientationNED[1])
+
# *** control msgs ***
can_sends = []
+ # *** handle secoc reset counter increase ***
+ if self.CP.flags & ToyotaFlags.SECOC.value:
+ if CS.secoc_synchronization['RESET_CNT'] != self.secoc_prev_reset_counter:
+ self.secoc_lka_message_counter = 0
+ self.secoc_lta_message_counter = 0
+ self.secoc_prev_reset_counter = CS.secoc_synchronization['RESET_CNT']
+
+ expected_mac = build_sync_mac(self.secoc_key, int(CS.secoc_synchronization['TRIP_CNT']), int(CS.secoc_synchronization['RESET_CNT']))
+ if int(CS.secoc_synchronization['AUTHENTICATOR']) != expected_mac:
+ carlog.error("SecOC synchronization MAC mismatch, wrong key?")
+
# *** steer torque ***
new_steer = int(round(actuators.steer * self.params.STEER_MAX))
apply_steer = apply_meas_steer_torque_limits(new_steer, self.last_steer, CS.out.steeringTorqueEps, self.params)
@@ -84,7 +161,16 @@ class CarController(CarControllerBase):
# toyota can trace shows STEERING_LKA at 42Hz, with counter adding alternatively 1 and 2;
# sending it at 100Hz seem to allow a higher rate limit, as the rate limit seems imposed
# on consecutive messages
- can_sends.append(toyotacan.create_steer_command(self.packer, apply_steer, apply_steer_req))
+ steer_command = toyotacan.create_steer_command(self.packer, apply_steer, apply_steer_req)
+ if self.CP.flags & ToyotaFlags.SECOC.value:
+ # TODO: check if this slow and needs to be done by the CANPacker
+ steer_command = add_mac(self.secoc_key,
+ int(CS.secoc_synchronization['TRIP_CNT']),
+ int(CS.secoc_synchronization['RESET_CNT']),
+ self.secoc_lka_message_counter,
+ steer_command)
+ self.secoc_lka_message_counter += 1
+ can_sends.append(steer_command)
# STEERING_LTA does not seem to allow more rate by sending faster, and may wind up easier
if self.frame % 2 == 0 and self.CP.carFingerprint in TSS2_CAR:
@@ -99,13 +185,44 @@ class CarController(CarControllerBase):
can_sends.append(toyotacan.create_lta_steer_command(self.packer, self.CP.steerControlType, self.last_angle,
lta_active, self.frame // 2, torque_wind_down))
+ if self.CP.flags & ToyotaFlags.SECOC.value:
+ lta_steer_2 = toyotacan.create_lta_steer_command_2(self.packer, self.frame // 2)
+ lta_steer_2 = add_mac(self.secoc_key,
+ int(CS.secoc_synchronization['TRIP_CNT']),
+ int(CS.secoc_synchronization['RESET_CNT']),
+ self.secoc_lta_message_counter,
+ lta_steer_2)
+ self.secoc_lta_message_counter += 1
+ can_sends.append(lta_steer_2)
+
# *** gas and brake ***
- pcm_accel_cmd = clip(actuators.accel, self.params.ACCEL_MIN, self.params.ACCEL_MAX)
+ if self.CP.enableGasInterceptor and CC.longActive and self.CP.carFingerprint not in STOP_AND_GO_CAR:
+ MAX_INTERCEPTOR_GAS = 0.5
+ # RAV4 has very sensitive gas pedal
+ if self.CP.carFingerprint == CAR.TOYOTA_RAV4:
+ PEDAL_SCALE = interp(CS.out.vEgo, [0.0, MIN_ACC_SPEED, MIN_ACC_SPEED + PEDAL_TRANSITION], [0.15, 0.3, 0.0])
+ elif self.CP.carFingerprint == CAR.TOYOTA_COROLLA:
+ PEDAL_SCALE = interp(CS.out.vEgo, [0.0, MIN_ACC_SPEED, MIN_ACC_SPEED + PEDAL_TRANSITION], [0.3, 0.4, 0.0])
+ else:
+ PEDAL_SCALE = interp(CS.out.vEgo, [0.0, MIN_ACC_SPEED, MIN_ACC_SPEED + PEDAL_TRANSITION], [0.4, 0.5, 0.0])
+ # offset for creep and windbrake
+ pedal_offset = interp(CS.out.vEgo, [0.0, 2.3, MIN_ACC_SPEED + PEDAL_TRANSITION], [-.4, 0.0, 0.2])
+ pedal_command = PEDAL_SCALE * (actuators.accel + pedal_offset)
+ interceptor_gas_cmd = clip(pedal_command, 0., MAX_INTERCEPTOR_GAS)
+ elif self.CP.enableGasInterceptor and CC.longActive and self.CP.carFingerprint in STOP_AND_GO_CAR and actuators.accel > 0.0:
+ interceptor_gas_cmd = 0.12 if CS.out.standstill else 0.
+ else:
+ interceptor_gas_cmd = 0.
+
+ if self.frame % 2 == 0 and self.CP.enableGasInterceptor and self.CP.openpilotLongitudinalControl:
+ # send exactly zero if gas cmd is zero. Interceptor will send the max between read value and gas cmd.
+ # This prevents unexpected pedal range rescaling
+ can_sends.append(create_gas_interceptor_command(self.packer, interceptor_gas_cmd, self.frame // 2))
# on entering standstill, send standstill request
- if CS.out.standstill and not self.last_standstill and (self.CP.carFingerprint not in NO_STOP_TIMER_CAR):
+ if CS.out.standstill and not self.last_standstill and (self.CP.carFingerprint not in NO_STOP_TIMER_CAR or self.CP.enableGasInterceptor):
self.standstill_req = True
- if CS.pcm_acc_status != 8:
+ if CS.pcm_acc_status != 8 or frogpilot_toggles.sng_hack:
# pcm entered standstill or it's disabled
self.standstill_req = False
@@ -114,28 +231,77 @@ class CarController(CarControllerBase):
# handle UI messages
fcw_alert = hud_control.visualAlert == VisualAlert.fcw
steer_alert = hud_control.visualAlert in (VisualAlert.steerRequired, VisualAlert.ldw)
+ lead = hud_control.leadVisible or CS.out.vEgo < 12. # at low speed we always assume the lead is present so ACC can be engaged
- # we can spam can to cancel the system even if we are using lat only control
- if (self.frame % 3 == 0 and self.CP.openpilotLongitudinalControl) or pcm_cancel_cmd:
- lead = hud_control.leadVisible or CS.out.vEgo < 12. # at low speed we always assume the lead is present so ACC can be engaged
+ if self.CP.openpilotLongitudinalControl:
+ if self.frame % 3 == 0:
+ # Press distance button until we are at the correct bar length. Only change while enabled to avoid skipping startup popup
+ if self.frame % 6 == 0 and self.CP.openpilotLongitudinalControl:
+ desired_distance = 4 - hud_control.leadDistanceBars
+ if CS.out.cruiseState.enabled and CS.pcm_follow_distance != desired_distance:
+ self.distance_button = not self.distance_button
+ else:
+ self.distance_button = 0
- # Press distance button until we are at the correct bar length. Only change while enabled to avoid skipping startup popup
- if self.frame % 6 == 0 and self.CP.openpilotLongitudinalControl:
- desired_distance = 4 - hud_control.leadDistanceBars
- if CS.out.cruiseState.enabled and CS.pcm_follow_distance != desired_distance:
- self.distance_button = not self.distance_button
+ # internal PCM gas command can get stuck unwinding from negative accel so we apply a generous rate limit
+ pcm_accel_cmd = actuators.accel
+ if CC.longActive:
+ pcm_accel_cmd = rate_limit(pcm_accel_cmd, self.prev_accel, ACCEL_WINDDOWN_LIMIT, ACCEL_WINDUP_LIMIT)
+ self.prev_accel = pcm_accel_cmd
+
+ # calculate amount of acceleration PCM should apply to reach target, given pitch.
+ # clipped to only include downhill angles, avoids erroneously unsetting PERMIT_BRAKING when stopping on uphills
+ accel_due_to_pitch = math.sin(min(self.pitch.x, 0.0)) * ACCELERATION_DUE_TO_GRAVITY
+ # TODO: on uphills this sometimes sets PERMIT_BRAKING low not considering the creep force
+ net_acceleration_request = pcm_accel_cmd + accel_due_to_pitch
+
+ # GVC does not overshoot ego acceleration when starting from stop, but still has a similar delay
+ if not self.CP.flags & ToyotaFlags.SECOC.value:
+ a_ego_blended = interp(CS.out.vEgo, [1.0, 2.0], [CS.gvc, CS.out.aEgo])
else:
- self.distance_button = 0
+ a_ego_blended = CS.out.aEgo
- # Lexus IS uses a different cancellation message
- if pcm_cancel_cmd and self.CP.carFingerprint in UNSUPPORTED_DSU_CAR:
- can_sends.append(toyotacan.create_acc_cancel_command(self.packer))
- elif self.CP.openpilotLongitudinalControl:
- can_sends.append(toyotacan.create_accel_command(self.packer, pcm_accel_cmd, pcm_cancel_cmd, self.standstill_req, lead, CS.acc_type, fcw_alert,
- self.distance_button))
+ # wind down integral when approaching target for step changes and smooth ramps to reduce overshoot
+ prev_aego = self.aego.x
+ self.aego.update(a_ego_blended)
+ j_ego = (self.aego.x - prev_aego) / (DT_CTRL * 3)
+
+ future_t = float(np.interp(CS.out.vEgo, [2., 5.], [0.25, 0.5]))
+ a_ego_future = a_ego_blended + j_ego * future_t
+
+ if CC.longActive:
+ # constantly slowly unwind integral to recover from large temporary errors
+ self.long_pid.i -= ACCEL_PID_UNWIND * float(np.sign(self.long_pid.i))
+
+ error_future = pcm_accel_cmd - a_ego_future
+ pcm_accel_cmd = self.long_pid.update(error_future,
+ speed=CS.out.vEgo,
+ feedforward=pcm_accel_cmd,
+ freeze_integrator=actuators.longControlState != LongCtrlState.pid)
+ else:
+ self.long_pid.reset()
+
+ # Along with rate limiting positive jerk above, this greatly improves gas response time
+ # Consider the net acceleration request that the PCM should be applying (pitch included)
+ net_acceleration_request_min = min(actuators.accel + accel_due_to_pitch, net_acceleration_request)
+ if net_acceleration_request_min < 0.2 or stopping or not CC.longActive:
+ self.permit_braking = True
+ elif net_acceleration_request_min > 0.3:
+ self.permit_braking = False
+
+ pcm_accel_cmd = clip(pcm_accel_cmd, self.params.ACCEL_MIN, self.params.ACCEL_MAX)
+
+ can_sends.append(toyotacan.create_accel_command(self.packer, pcm_accel_cmd, pcm_cancel_cmd, self.permit_braking, self.standstill_req, lead,
+ CS.acc_type, fcw_alert, self.distance_button, self.reverse_cruise_active))
self.accel = pcm_accel_cmd
- else:
- can_sends.append(toyotacan.create_accel_command(self.packer, 0, pcm_cancel_cmd, False, lead, CS.acc_type, False, self.distance_button))
+
+ else:
+ # we can spam can to cancel the system even if we are using lat only control
+ if pcm_cancel_cmd:
+ if self.CP.carFingerprint in UNSUPPORTED_DSU_CAR:
+ can_sends.append(toyotacan.create_acc_cancel_command(self.packer))
+ else:
+ can_sends.append(toyotacan.create_accel_command(self.packer, 0, pcm_cancel_cmd, True, False, lead, CS.acc_type, False, self.distance_button, self.reverse_cruise_active))
# *** hud ui ***
if self.CP.carFingerprint != CAR.TOYOTA_PRIUS_V:
@@ -154,7 +320,7 @@ class CarController(CarControllerBase):
if self.frame % 20 == 0 or send_ui:
can_sends.append(toyotacan.create_ui_command(self.packer, steer_alert, pcm_cancel_cmd, hud_control.leftLaneVisible,
hud_control.rightLaneVisible, hud_control.leftLaneDepart,
- hud_control.rightLaneDepart, CC.enabled, CS.lkas_hud))
+ hud_control.rightLaneDepart, CC.enabled, CS.lkas_hud, lat_active))
if (self.frame % 100 == 0 or send_ui) and (self.CP.enableDsu or self.CP.flags & ToyotaFlags.DISABLE_RADAR.value):
can_sends.append(toyotacan.create_fcw_command(self.packer, fcw_alert))
@@ -173,7 +339,27 @@ class CarController(CarControllerBase):
new_actuators.steerOutputCan = apply_steer
new_actuators.steeringAngleDeg = self.last_angle
new_actuators.accel = self.accel
- new_actuators.gas = self.gas
+
+ # FrogPilot Toyota carcontroller functions
+ if False: #self.previous_set_speed != CS.out.cruiseState.speedCluster:
+ self.cruise_timer = CRUISE_LONG_PRESS
+ elif self.cruise_timer > 0:
+ self.cruise_timer -= 1
+ else:
+ self.previous_set_speed = CS.out.cruiseState.speedCluster
+
+ # Lock doors when in drive / unlock doors when in park
+ if not self.doors_locked and CS.out.gearShifter != PARK:
+ if frogpilot_toggles.lock_doors:
+ can_sends.append(make_can_msg(0x750, LOCK_CMD, 0))
+ self.doors_locked = True
+ elif self.doors_locked and CS.out.gearShifter == PARK:
+ if frogpilot_toggles.unlock_doors:
+ can_sends.append(make_can_msg(0x750, UNLOCK_CMD, 0))
+ self.doors_locked = False
+
+ self.reverse_cruise_active = frogpilot_toggles.reverse_cruise_increase
+ self.reverse_cruise_active &= self.cruise_timer <= 0
self.frame += 1
return new_actuators, can_sends
diff --git a/selfdrive/car/toyota/carstate.py b/selfdrive/car/toyota/carstate.py
index 8315f24ae..586bd8134 100644
--- a/selfdrive/car/toyota/carstate.py
+++ b/selfdrive/car/toyota/carstate.py
@@ -1,6 +1,6 @@
import copy
-from cereal import car
+from cereal import car, custom
from openpilot.common.conversions import Conversions as CV
from openpilot.common.numpy_fast import mean
from openpilot.common.filter_simple import FirstOrderFilter
@@ -9,7 +9,7 @@ from opendbc.can.can_define import CANDefine
from opendbc.can.parser import CANParser
from openpilot.selfdrive.car.interfaces import CarStateBase
from openpilot.selfdrive.car.toyota.values import ToyotaFlags, CAR, DBC, STEER_THRESHOLD, NO_STOP_TIMER_CAR, \
- TSS2_CAR, RADAR_ACC_CAR, EPS_SCALE, UNSUPPORTED_DSU_CAR
+ TSS2_CAR, RADAR_ACC_CAR, EPS_SCALE, UNSUPPORTED_DSU_CAR, SECOC_CAR
SteerControlType = car.CarParams.SteerControlType
@@ -25,15 +25,35 @@ TEMP_STEER_FAULTS = (0, 9, 11, 21, 25)
PERM_STEER_FAULTS = (3, 17)
+# Traffic signals for Speed Limit Controller - Credit goes to the DragonPilot team!
+@staticmethod
+def calculate_speed_limit(cp_cam, frogpilot_toggles):
+ signals = ["TSGN1", "SPDVAL1", "SPLSGN1", "TSGN2", "SPLSGN2", "TSGN3", "SPLSGN3", "TSGN4", "SPLSGN4"]
+ traffic_signals = {signal: cp_cam.vl["RSA1"].get(signal, cp_cam.vl["RSA2"].get(signal)) for signal in signals}
+
+ tsgn1 = traffic_signals.get("TSGN1")
+ spdval1 = traffic_signals.get("SPDVAL1")
+
+ if tsgn1 == 1 and not frogpilot_toggles.force_mph_dashboard:
+ return spdval1 * CV.KPH_TO_MS
+ elif tsgn1 == 36 or frogpilot_toggles.force_mph_dashboard:
+ return spdval1 * CV.MPH_TO_MS
+ return 0
+
+
class CarState(CarStateBase):
def __init__(self, CP):
super().__init__(CP)
can_define = CANDefine(DBC[CP.carFingerprint]["pt"])
- self.shifter_values = can_define.dv["GEAR_PACKET"]["GEAR"]
self.eps_torque_scale = EPS_SCALE[CP.carFingerprint] / 100.
self.cluster_speed_hyst_gap = CV.KPH_TO_MS / 2.
self.cluster_min_speed = CV.KPH_TO_MS / 2.
+ if CP.flags & ToyotaFlags.SECOC.value:
+ self.shifter_values = can_define.dv["GEAR_PACKET_HYBRID"]["GEAR"]
+ else:
+ self.shifter_values = can_define.dv["GEAR_PACKET"]["GEAR"]
+
# On cars with cp.vl["STEER_TORQUE_SENSOR"]["STEER_ANGLE"]
# the signal is zeroed to where the steering angle is at start.
# Need to apply an offset as soon as the steering angle measurements are both received
@@ -48,9 +68,23 @@ class CarState(CarStateBase):
self.low_speed_lockout = False
self.acc_type = 1
self.lkas_hud = {}
+ self.gvc = 0.0
+ self.secoc_synchronization = None
- def update(self, cp, cp_cam):
+ # FrogPilot variables
+ self.latActive_previous = False
+ self.needs_angle_offset_zss = True
+
+ self.angle_offset_zss = 0
+ self.zorro_steer_value = 0
+
+ def update(self, cp, cp_cam, CC, frogpilot_toggles):
ret = car.CarState.new_message()
+ fp_ret = custom.FrogPilotCarState.new_message()
+ cp_acc = cp_cam if self.CP.carFingerprint in (TSS2_CAR - RADAR_ACC_CAR) else cp
+
+ if not self.CP.flags & ToyotaFlags.SECOC.value:
+ self.gvc = cp.vl["VSC1S07"]["GVC"]
ret.doorOpen = any([cp.vl["BODY_CONTROL_STATE"]["DOOR_OPEN_FL"], cp.vl["BODY_CONTROL_STATE"]["DOOR_OPEN_FR"],
cp.vl["BODY_CONTROL_STATE"]["DOOR_OPEN_RL"], cp.vl["BODY_CONTROL_STATE"]["DOOR_OPEN_RR"]])
@@ -60,7 +94,22 @@ class CarState(CarStateBase):
ret.brakePressed = cp.vl["BRAKE_MODULE"]["BRAKE_PRESSED"] != 0
ret.brakeHoldActive = cp.vl["ESP_CONTROL"]["BRAKE_HOLD_ACTIVE"] == 1
- ret.gasPressed = cp.vl["PCM_CRUISE"]["GAS_RELEASED"] == 0
+ if self.CP.flags & ToyotaFlags.SECOC.value:
+ self.secoc_synchronization = copy.copy(cp.vl["SECOC_SYNCHRONIZATION"])
+ ret.gas = cp.vl["GAS_PEDAL"]["GAS_PEDAL_USER"]
+ ret.gasPressed = cp.vl["GAS_PEDAL"]["GAS_PEDAL_USER"] > 0
+ can_gear = int(cp.vl["GEAR_PACKET_HYBRID"]["GEAR"])
+ else:
+ if self.CP.enableGasInterceptor:
+ ret.gas = (cp.vl["GAS_SENSOR"]["INTERCEPTOR_GAS"] + cp.vl["GAS_SENSOR"]["INTERCEPTOR_GAS2"]) // 2
+ ret.gasPressed = ret.gas > 805
+ else:
+ ret.gasPressed = cp.vl["PCM_CRUISE"]["GAS_RELEASED"] == 0 # TODO: these also have GAS_PEDAL, come back and unify
+ can_gear = int(cp.vl["GEAR_PACKET"]["GEAR"])
+ if not self.CP.enableDsu and not self.CP.flags & ToyotaFlags.DISABLE_RADAR.value:
+ ret.stockAeb = bool(cp_acc.vl["PRE_COLLISION"]["PRECOLLISION_ACTIVE"] and cp_acc.vl["PRE_COLLISION"]["FORCE"] < -1e-5)
+ if self.CP.carFingerprint != CAR.TOYOTA_MIRAI:
+ ret.engineRpm = cp.vl["ENGINE_RPM"]["RPM"]
ret.wheelSpeeds = self.get_wheel_speeds(
cp.vl["WHEEL_SPEEDS"]["WHEEL_SPEED_FL"],
@@ -70,7 +119,7 @@ class CarState(CarStateBase):
)
ret.vEgoRaw = mean([ret.wheelSpeeds.fl, ret.wheelSpeeds.fr, ret.wheelSpeeds.rl, ret.wheelSpeeds.rr])
ret.vEgo, ret.aEgo = self.update_speed_kf(ret.vEgoRaw)
- ret.vEgoCluster = ret.vEgo * 1.015 # minimum of all the cars
+ ret.vEgoCluster = ret.vEgo * frogpilot_toggles.cluster_offset
ret.standstill = abs(ret.vEgoRaw) < 1e-3
@@ -91,14 +140,10 @@ class CarState(CarStateBase):
ret.steeringAngleOffsetDeg = self.angle_offset.x
ret.steeringAngleDeg = torque_sensor_angle_deg - self.angle_offset.x
- can_gear = int(cp.vl["GEAR_PACKET"]["GEAR"])
ret.gearShifter = self.parse_gear_shifter(self.shifter_values.get(can_gear, None))
ret.leftBlinker = cp.vl["BLINKERS_STATE"]["TURN_SIGNALS"] == 1
ret.rightBlinker = cp.vl["BLINKERS_STATE"]["TURN_SIGNALS"] == 2
- if self.CP.carFingerprint != CAR.TOYOTA_MIRAI:
- ret.engineRpm = cp.vl["ENGINE_RPM"]["RPM"]
-
ret.steeringTorque = cp.vl["STEER_TORQUE_SENSOR"]["STEER_TORQUE_DRIVER"]
ret.steeringTorqueEps = cp.vl["STEER_TORQUE_SENSOR"]["STEER_TORQUE_EPS"] * self.eps_torque_scale
# we could use the override bit from dbc, but it's triggered at too high torque values
@@ -129,8 +174,6 @@ class CarState(CarStateBase):
conversion_factor = CV.KPH_TO_MS if is_metric else CV.MPH_TO_MS
ret.cruiseState.speedCluster = cluster_set_speed * conversion_factor
- cp_acc = cp_cam if self.CP.carFingerprint in (TSS2_CAR - RADAR_ACC_CAR) else cp
-
if self.CP.carFingerprint in TSS2_CAR and not self.CP.flags & ToyotaFlags.DISABLE_RADAR.value:
if not (self.CP.flags & ToyotaFlags.SMART_DSU.value):
self.acc_type = cp_acc.vl["ACC_CONTROL"]["ACC_TYPE"]
@@ -154,9 +197,6 @@ class CarState(CarStateBase):
ret.genericToggle = bool(cp.vl["LIGHT_STALK"]["AUTO_HIGH_BEAM"])
ret.espDisabled = cp.vl["ESP_CONTROL"]["TC_DISABLED"] != 0
- if not self.CP.enableDsu and not self.CP.flags & ToyotaFlags.DISABLE_RADAR.value:
- ret.stockAeb = bool(cp_acc.vl["PRE_COLLISION"]["PRECOLLISION_ACTIVE"] and cp_acc.vl["PRE_COLLISION"]["FORCE"] < -1e-5)
-
if self.CP.enableBsm:
ret.leftBlindspot = (cp.vl["BSM"]["L_ADJACENT"] == 1) or (cp.vl["BSM"]["L_APPROACHING"] == 1)
ret.rightBlindspot = (cp.vl["BSM"]["R_ADJACENT"] == 1) or (cp.vl["BSM"]["R_APPROACHING"] == 1)
@@ -175,12 +215,50 @@ class CarState(CarStateBase):
else:
self.distance_button = cp.vl["SDSU"]["FD_BUTTON"]
- return ret
+ # FrogPilot CarState functions
+ fp_ret.brakeLights = bool(cp.vl["ESP_CONTROL"]["BRAKE_LIGHTS_ACC"])
+
+ self.cruise_decreased_previously = self.cruise_decreased
+ self.cruise_decreased = self.pcm_acc_status == 10
+ self.cruise_increased_previously = self.cruise_increased
+ self.cruise_increased = self.pcm_acc_status == 9
+
+ fp_ret.dashboardSpeedLimit = calculate_speed_limit(cp_cam, frogpilot_toggles)
+
+ fp_ret.ecoGear = cp.vl["GEAR_PACKET"]['ECON_ON'] == 1
+ fp_ret.sportGear = cp.vl["GEAR_PACKET"]['SPORT_ON_2' if self.CP.flags & ToyotaFlags.NO_DSU else 'SPORT_ON'] == 1
+
+ self.lkas_previously_enabled = self.lkas_enabled
+ if self.CP.carFingerprint != CAR.TOYOTA_PRIUS_V:
+ self.lkas_enabled = self.lkas_hud.get("LDA_ON_MESSAGE") == 1
+
+ # ZSS Support - Credit goes to Erich!
+ if self.CP.flags & ToyotaFlags.ZSS:
+ if abs(torque_sensor_angle_deg) > 1e-3:
+ self.accurate_steer_angle_seen = True
+
+ if CC.latActive and not self.latActive_previous:
+ self.needs_angle_offset_zss = True
+ self.latActive_previous = CC.latActive
+
+ if self.needs_angle_offset_zss:
+ zorro_steer = cp.vl["SECONDARY_STEER_ANGLE"]["ZORRO_STEER"]
+ if abs(ret.steeringAngleDeg) > 1e-3 and abs(zorro_steer) > 1e-3:
+ self.needs_angle_offset_zss = False
+ self.angle_offset_zss = zorro_steer - ret.steeringAngleDeg
+ self.zorro_steer_value = cp.vl["SECONDARY_STEER_ANGLE"]["ZORRO_STEER"] - self.angle_offset_zss
+
+ if not self.needs_angle_offset_zss:
+ if abs(ret.steeringAngleDeg - self.zorro_steer_value) > 4.0:
+ ret.steeringAngleDeg = ret.steeringAngleDeg
+ else:
+ ret.steeringAngleDeg = self.zorro_steer_value
+
+ return ret, fp_ret
@staticmethod
def get_can_parser(CP):
messages = [
- ("GEAR_PACKET", 1),
("LIGHT_STALK", 1),
("BLINKERS_STATE", 0.15),
("BODY_CONTROL_STATE", 3),
@@ -195,8 +273,20 @@ class CarState(CarStateBase):
("STEER_TORQUE_SENSOR", 50),
]
- if CP.carFingerprint != CAR.TOYOTA_MIRAI:
- messages.append(("ENGINE_RPM", 42))
+ if CP.flags & ToyotaFlags.SECOC.value:
+ messages += [
+ ("GEAR_PACKET_HYBRID", 60),
+ ("SECOC_SYNCHRONIZATION", 10),
+ ("GAS_PEDAL", 42),
+ ]
+ else:
+ messages.append(("VSC1S07", 20))
+ if CP.carFingerprint not in [CAR.TOYOTA_MIRAI]:
+ messages.append(("ENGINE_RPM", 42))
+
+ messages += [
+ ("GEAR_PACKET", 1),
+ ]
if CP.carFingerprint in UNSUPPORTED_DSU_CAR:
messages.append(("DSU_CRUISE", 5))
@@ -204,6 +294,10 @@ class CarState(CarStateBase):
else:
messages.append(("PCM_CRUISE_2", 33))
+ # add gas interceptor reading if we are using it
+ if CP.enableGasInterceptor:
+ messages.append(("GAS_SENSOR", 50))
+
if CP.enableBsm:
messages.append(("BSM", 1))
@@ -226,12 +320,20 @@ class CarState(CarStateBase):
("SDSU", 100),
]
+ if CP.flags & ToyotaFlags.ZSS:
+ messages += [("SECONDARY_STEER_ANGLE", 0)]
+
return CANParser(DBC[CP.carFingerprint]["pt"], messages, 0)
@staticmethod
def get_cam_can_parser(CP):
messages = []
+ messages += [
+ ("RSA1", 0),
+ ("RSA2", 0),
+ ]
+
if CP.carFingerprint != CAR.TOYOTA_PRIUS_V:
messages += [
("LKAS_HUD", 1),
@@ -239,9 +341,14 @@ class CarState(CarStateBase):
if CP.carFingerprint in (TSS2_CAR - RADAR_ACC_CAR):
messages += [
- ("PRE_COLLISION", 33),
("ACC_CONTROL", 33),
("PCS_HUD", 1),
]
+ # TODO: Figure out new layout of the PRE_COLLISION message
+ if not CP.flags & ToyotaFlags.SECOC.value:
+ messages += [
+ ("PRE_COLLISION", 33),
+ ]
+
return CANParser(DBC[CP.carFingerprint]["pt"], messages, 2)
diff --git a/selfdrive/car/toyota/fingerprints.py b/selfdrive/car/toyota/fingerprints.py
index 0866a4d43..ec9cdbb07 100644
--- a/selfdrive/car/toyota/fingerprints.py
+++ b/selfdrive/car/toyota/fingerprints.py
@@ -89,6 +89,7 @@ FW_VERSIONS = {
(Ecu.fwdRadar, 0x750, 0xf): [
b'\x018821F6201200\x00\x00\x00\x00',
b'\x018821F6201300\x00\x00\x00\x00',
+ b'\x018821F6201400\x00\x00\x00\x00',
],
(Ecu.fwdCamera, 0x750, 0x6d): [
b'\x028646F4104100\x00\x00\x00\x008646G3304000\x00\x00\x00\x00',
@@ -109,6 +110,7 @@ FW_VERSIONS = {
b'\x018966306Q6000\x00\x00\x00\x00',
b'\x018966333N1100\x00\x00\x00\x00',
b'\x018966333N4300\x00\x00\x00\x00',
+ b'\x018966333P3000\x00\x00\x00\x00',
b'\x018966333P3100\x00\x00\x00\x00',
b'\x018966333P3200\x00\x00\x00\x00',
b'\x018966333P4200\x00\x00\x00\x00',
@@ -126,6 +128,7 @@ FW_VERSIONS = {
b'\x018966333X0000\x00\x00\x00\x00',
b'\x018966333X4000\x00\x00\x00\x00',
b'\x01896633T16000\x00\x00\x00\x00',
+ b'\x01896633TA2000\x00\x00\x00\x00',
b'\x028966306B2100\x00\x00\x00\x00897CF3302002\x00\x00\x00\x00',
b'\x028966306B2300\x00\x00\x00\x00897CF3302002\x00\x00\x00\x00',
b'\x028966306B2500\x00\x00\x00\x00897CF3302002\x00\x00\x00\x00',
@@ -158,14 +161,17 @@ FW_VERSIONS = {
b'8821F0605200 ',
b'8821F0606200 ',
b'8821F0607200 ',
+ b'8821F0607300 ',
b'8821F0608000 ',
b'8821F0608200 ',
+ b'8821F0608300 ',
b'8821F0609000 ',
b'8821F0609100 ',
],
(Ecu.abs, 0x7b0, None): [
b'F152606210\x00\x00\x00\x00\x00\x00',
b'F152606230\x00\x00\x00\x00\x00\x00',
+ b'F152606260\x00\x00\x00\x00\x00\x00',
b'F152606270\x00\x00\x00\x00\x00\x00',
b'F152606290\x00\x00\x00\x00\x00\x00',
b'F152606410\x00\x00\x00\x00\x00\x00',
@@ -188,6 +194,7 @@ FW_VERSIONS = {
b'8965B33581\x00\x00\x00\x00\x00\x00',
b'8965B33611\x00\x00\x00\x00\x00\x00',
b'8965B33621\x00\x00\x00\x00\x00\x00',
+ b'8965B33630\x00\x00\x00\x00\x00\x00',
],
(Ecu.fwdRadar, 0x750, 0xf): [
b'8821F0601200 ',
@@ -203,8 +210,10 @@ FW_VERSIONS = {
b'8821F0605200 ',
b'8821F0606200 ',
b'8821F0607200 ',
+ b'8821F0607300 ',
b'8821F0608000 ',
b'8821F0608200 ',
+ b'8821F0608300 ',
b'8821F0609000 ',
b'8821F0609100 ',
],
@@ -234,6 +243,7 @@ FW_VERSIONS = {
b'\x01F152606390\x00\x00\x00\x00\x00\x00',
b'\x01F152606400\x00\x00\x00\x00\x00\x00',
b'\x01F152606431\x00\x00\x00\x00\x00\x00',
+ b'\x01F152633E11\x00\x00\x00\x00\x00\x00',
b'F152633310\x00\x00\x00\x00\x00\x00',
b'F152633D00\x00\x00\x00\x00\x00\x00',
b'F152633D60\x00\x00\x00\x00\x00\x00',
@@ -251,6 +261,7 @@ FW_VERSIONS = {
b'\x018966306T4000\x00\x00\x00\x00',
b'\x018966306T4100\x00\x00\x00\x00',
b'\x018966306V1000\x00\x00\x00\x00',
+ b'\x018966333Z1000\x00\x00\x00\x00',
b'\x01896633T20000\x00\x00\x00\x00',
],
(Ecu.fwdRadar, 0x750, 0xf): [
@@ -266,6 +277,7 @@ FW_VERSIONS = {
b'\x028646F3305200\x00\x00\x00\x008646G5301200\x00\x00\x00\x00',
b'\x028646F3305300\x00\x00\x00\x008646G3304000\x00\x00\x00\x00',
b'\x028646F3305300\x00\x00\x00\x008646G5301200\x00\x00\x00\x00',
+ b'\x028646F3305400\x00\x00\x00\x008646G3304000\x00\x00\x00\x00',
b'\x028646F3305500\x00\x00\x00\x008646G3304000\x00\x00\x00\x00',
],
},
@@ -314,6 +326,7 @@ FW_VERSIONS = {
b'F1526F4073\x00\x00\x00\x00\x00\x00',
b'F1526F4121\x00\x00\x00\x00\x00\x00',
b'F1526F4122\x00\x00\x00\x00\x00\x00',
+ b'F1526F4190\x00\x00\x00\x00\x00\x00',
],
(Ecu.eps, 0x7a1, None): [
b'8965B10011\x00\x00\x00\x00\x00\x00',
@@ -330,6 +343,7 @@ FW_VERSIONS = {
b'\x033F401200\x00\x00\x00\x00\x00\x00\x00\x00A0202000\x00\x00\x00\x00\x00\x00\x00\x00895231203202\x00\x00\x00\x00',
b'\x033F424000\x00\x00\x00\x00\x00\x00\x00\x00A0202000\x00\x00\x00\x00\x00\x00\x00\x00895231203202\x00\x00\x00\x00',
b'\x033F424000\x00\x00\x00\x00\x00\x00\x00\x00A0202000\x00\x00\x00\x00\x00\x00\x00\x00895231203302\x00\x00\x00\x00',
+ b'\x033F435000\x00\x00\x00\x00\x00\x00\x00\x00A0202000\x00\x00\x00\x00\x00\x00\x00\x00895231203302\x00\x00\x00\x00',
],
(Ecu.fwdRadar, 0x750, 0xf): [
b'8821F0W01000 ',
@@ -384,6 +398,7 @@ FW_VERSIONS = {
(Ecu.fwdCamera, 0x750, 0x6d): [
b'\x028646FF410200\x00\x00\x00\x008646GF408200\x00\x00\x00\x00',
b'\x028646FF411100\x00\x00\x00\x008646GF409000\x00\x00\x00\x00',
+ b'\x028646FF413000\x00\x00\x00\x008646GF411000\x00\x00\x00\x00',
b'\x028646FF413100\x00\x00\x00\x008646GF411100\x00\x00\x00\x00',
],
},
@@ -424,6 +439,7 @@ FW_VERSIONS = {
CAR.TOYOTA_COROLLA_TSS2: {
(Ecu.engine, 0x700, None): [
b'\x01896630A22000\x00\x00\x00\x00',
+ b'\x01896630A42000\x00\x00\x00\x00',
b'\x01896630ZG2000\x00\x00\x00\x00',
b'\x01896630ZG5000\x00\x00\x00\x00',
b'\x01896630ZG5100\x00\x00\x00\x00',
@@ -436,6 +452,7 @@ FW_VERSIONS = {
b'\x01896630ZU8000\x00\x00\x00\x00',
b'\x01896630ZU9000\x00\x00\x00\x00',
b'\x01896630ZX4000\x00\x00\x00\x00',
+ b'\x01896630ZX7100\x00\x00\x00\x00',
b'\x018966312L8000\x00\x00\x00\x00',
b'\x018966312M0000\x00\x00\x00\x00',
b'\x018966312M9000\x00\x00\x00\x00',
@@ -511,11 +528,13 @@ FW_VERSIONS = {
b'\x018965B1254000\x00\x00\x00\x00',
b'\x018965B1255000\x00\x00\x00\x00',
b'\x018965B1256000\x00\x00\x00\x00',
+ b'\x018965B1270000\x00\x00\x00\x00',
b'8965B12361\x00\x00\x00\x00\x00\x00',
b'8965B12451\x00\x00\x00\x00\x00\x00',
b'8965B16011\x00\x00\x00\x00\x00\x00',
b'8965B16101\x00\x00\x00\x00\x00\x00',
b'8965B16170\x00\x00\x00\x00\x00\x00',
+ b'8965B16260\x00\x00\x00\x00\x00\x00',
b'8965B76012\x00\x00\x00\x00\x00\x00',
b'8965B76050\x00\x00\x00\x00\x00\x00',
b'8965B76091\x00\x00\x00\x00\x00\x00',
@@ -530,6 +549,7 @@ FW_VERSIONS = {
b'\x01F15260A010\x00\x00\x00\x00\x00\x00',
b'\x01F15260A050\x00\x00\x00\x00\x00\x00',
b'\x01F15260A070\x00\x00\x00\x00\x00\x00',
+ b'\x01F15260A33000\x00\x00\x00\x00',
b'\x01F152612641\x00\x00\x00\x00\x00\x00',
b'\x01F152612651\x00\x00\x00\x00\x00\x00',
b'\x01F152612862\x00\x00\x00\x00\x00\x00',
@@ -589,6 +609,7 @@ FW_VERSIONS = {
b'\x028646F1601100\x00\x00\x00\x008646G2601400\x00\x00\x00\x00',
b'\x028646F1601200\x00\x00\x00\x008646G2601400\x00\x00\x00\x00',
b'\x028646F1601300\x00\x00\x00\x008646G2601400\x00\x00\x00\x00',
+ b'\x028646F1601500\x00\x00\x00\x008646G2601400\x00\x00\x00\x00',
b'\x028646F4203400\x00\x00\x00\x008646G2601200\x00\x00\x00\x00',
b'\x028646F76020C0\x00\x00\x00\x008646G26011A0\x00\x00\x00\x00',
b'\x028646F7603100\x00\x00\x00\x008646G2601200\x00\x00\x00\x00',
@@ -642,6 +663,7 @@ FW_VERSIONS = {
(Ecu.dsu, 0x791, None): [
b'881510E01100\x00\x00\x00\x00',
b'881510E01200\x00\x00\x00\x00',
+ b'881510E02100\x00\x00\x00\x00',
b'881510E02200\x00\x00\x00\x00',
],
(Ecu.fwdRadar, 0x750, 0xf): [
@@ -706,11 +728,13 @@ FW_VERSIONS = {
b'\x01896630EE7000\x00\x00\x00\x00',
b'\x01896630EF8000\x00\x00\x00\x00',
b'\x01896630EG3000\x00\x00\x00\x00',
+ b'\x01896630EG3100\x00\x00\x00\x00',
b'\x01896630EG5000\x00\x00\x00\x00',
b'\x02896630E66000\x00\x00\x00\x00897CF4801001\x00\x00\x00\x00',
b'\x02896630E66100\x00\x00\x00\x00897CF4801001\x00\x00\x00\x00',
b'\x02896630EB3000\x00\x00\x00\x00897CF4801001\x00\x00\x00\x00',
b'\x02896630EB3100\x00\x00\x00\x00897CF4801001\x00\x00\x00\x00',
+ b'\x02896630EB3200\x00\x00\x00\x00897CF4801001\x00\x00\x00\x00',
],
(Ecu.fwdRadar, 0x750, 0xf): [
b'\x018821F3301400\x00\x00\x00\x00',
@@ -734,6 +758,7 @@ FW_VERSIONS = {
b'\x018966353Q2300\x00\x00\x00\x00',
b'\x018966353Q4000\x00\x00\x00\x00',
b'\x018966353R1100\x00\x00\x00\x00',
+ b'\x018966353R7000\x00\x00\x00\x00',
b'\x018966353R7100\x00\x00\x00\x00',
b'\x018966353R8000\x00\x00\x00\x00',
b'\x018966353R8100\x00\x00\x00\x00',
@@ -796,6 +821,7 @@ FW_VERSIONS = {
b'\x018821F6201400\x00\x00\x00\x00',
],
(Ecu.fwdCamera, 0x750, 0x6d): [
+ b'\x028646F5303300\x00\x00\x00\x008646G3304000\x00\x00\x00\x00',
b'\x028646F5303300\x00\x00\x00\x008646G5301200\x00\x00\x00\x00',
b'\x028646F5303400\x00\x00\x00\x008646G3304000\x00\x00\x00\x00',
],
@@ -848,6 +874,7 @@ FW_VERSIONS = {
b'\x038966347A3000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00897CF4701003\x00\x00\x00\x00',
b'\x038966347A3000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00897CF4707001\x00\x00\x00\x00',
b'\x038966347B6000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00897CF4710001\x00\x00\x00\x00',
+ b'\x038966347B7000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00897CF1203001\x00\x00\x00\x00',
b'\x038966347B7000\x00\x00\x00\x008966A4703000\x00\x00\x00\x00897CF4710001\x00\x00\x00\x00',
],
(Ecu.eps, 0x7a1, None): [
@@ -993,6 +1020,33 @@ FW_VERSIONS = {
b'8646F4204000\x00\x00\x00\x00',
],
},
+ CAR.TOYOTA_RAV4_PRIME: {
+ (Ecu.engine, 0x700, None): [
+ b'\x018966342S7000\x00\x00\x00\x00',
+ b'\x018966342Z1000\x00\x00\x00\x00',
+ b'\x018966342Z1100\x00\x00\x00\x00',
+ b'\x01896634AJ7000\x00\x00\x00\x00',
+ ],
+ (Ecu.abs, 0x7b0, None): [
+ b'\x01F15264228300\x00\x00\x00\x00',
+ b'\x01F15264228500\x00\x00\x00\x00',
+ b'\x01F15264284100\x00\x00\x00\x00',
+ b'\x01F152642F3000\x00\x00\x00\x00',
+ ],
+ (Ecu.eps, 0x7a1, None): [
+ b'\x018965B4209000\x00\x00\x00\x00',
+ b'\x018965B4233100\x00\x00\x00\x00',
+ ],
+ (Ecu.fwdRadar, 0x750, 0xf): [
+ b'\x018821F3301400\x00\x00\x00\x00',
+ b'\x018821F6201400\x00\x00\x00\x00',
+ ],
+ (Ecu.fwdCamera, 0x750, 0x6d): [
+ b'\x028646F4205200\x00\x00\x00\x008646G4202000\x00\x00\x00\x00',
+ b'\x028646F4205300\x00\x00\x00\x008646G4202100\x00\x00\x00\x00',
+ b'\x028646F4210100\x00\x00\x00\x008646G3305000\x00\x00\x00\x00',
+ ],
+ },
CAR.TOYOTA_RAV4_TSS2: {
(Ecu.engine, 0x700, None): [
b'\x01896630R58000\x00\x00\x00\x00',
@@ -1142,6 +1196,7 @@ FW_VERSIONS = {
},
CAR.TOYOTA_RAV4_TSS2_2023: {
(Ecu.abs, 0x7b0, None): [
+ b'\x01F15260R440\x00\x00\x00\x00\x00\x00',
b'\x01F15260R450\x00\x00\x00\x00\x00\x00',
b'\x01F15260R50000\x00\x00\x00\x00',
b'\x01F15260R51000\x00\x00\x00\x00',
@@ -1163,6 +1218,7 @@ FW_VERSIONS = {
b'\x01896634AE1001\x00\x00\x00\x00',
b'\x01896634AF0000\x00\x00\x00\x00',
b'\x01896634AJ2000\x00\x00\x00\x00',
+ b'\x01896634AJ3000\x00\x00\x00\x00',
b'\x01896634AL5000\x00\x00\x00\x00',
b'\x01896634AL6000\x00\x00\x00\x00',
b'\x01896634AL8000\x00\x00\x00\x00',
@@ -1173,6 +1229,7 @@ FW_VERSIONS = {
(Ecu.fwdCamera, 0x750, 0x6d): [
b'\x028646F0R05100\x00\x00\x00\x008646G0R02100\x00\x00\x00\x00',
b'\x028646F0R05200\x00\x00\x00\x008646G0R02200\x00\x00\x00\x00',
+ b'\x028646F0R05300\x00\x00\x00\x008646G0R02300\x00\x00\x00\x00',
b'\x028646F0R11000\x00\x00\x00\x008646G0R04000\x00\x00\x00\x00',
],
},
@@ -1212,21 +1269,46 @@ FW_VERSIONS = {
b'8646F0801100\x00\x00\x00\x00',
],
},
+ CAR.TOYOTA_SIENNA_4TH_GEN: {
+ (Ecu.engine, 0x700, None): [
+ b'\x01896630841000\x00\x00\x00\x00',
+ b'\x01896630857101\x00\x00\x00\x00',
+ b'\x01896630864000\x00\x00\x00\x00',
+ ],
+ (Ecu.abs, 0x7b0, None): [
+ b'\x01F15260815100\x00\x00\x00\x00',
+ b'\x01F15260815300\x00\x00\x00\x00',
+ ],
+ (Ecu.eps, 0x7a1, None): [
+ b'\x018965B4509100\x00\x00\x00\x00',
+ ],
+ (Ecu.fwdRadar, 0x750, 0xf): [
+ b'\x018821F3301500\x00\x00\x00\x00',
+ ],
+ (Ecu.fwdCamera, 0x750, 0x6d): [
+ b'\x028646F0802200\x00\x00\x00\x008646G4202100\x00\x00\x00\x00',
+ b'\x028646F0802300\x00\x00\x00\x008646G4202100\x00\x00\x00\x00',
+ b'\x028646F0802400\x00\x00\x00\x008646G4202100\x00\x00\x00\x00',
+ ],
+ },
CAR.LEXUS_CTH: {
(Ecu.dsu, 0x791, None): [
b'881517601100\x00\x00\x00\x00',
+ b'881517602000\x00\x00\x00\x00',
],
(Ecu.abs, 0x7b0, None): [
b'F152676144\x00\x00\x00\x00\x00\x00',
],
(Ecu.engine, 0x7e0, None): [
b'\x0237635000\x00\x00\x00\x00\x00\x00\x00\x00A4701000\x00\x00\x00\x00\x00\x00\x00\x00',
+ b'\x0237641000\x00\x00\x00\x00\x00\x00\x00\x00A4701000\x00\x00\x00\x00\x00\x00\x00\x00',
],
(Ecu.fwdRadar, 0x750, 0xf): [
b'8821F4702300\x00\x00\x00\x00',
],
(Ecu.fwdCamera, 0x750, 0x6d): [
b'8646F7601100\x00\x00\x00\x00',
+ b'8646F7601200\x00\x00\x00\x00',
],
},
CAR.LEXUS_ES_TSS2: {
@@ -1238,6 +1320,7 @@ FW_VERSIONS = {
b'\x01896633T07000\x00\x00\x00\x00',
b'\x01896633T38000\x00\x00\x00\x00',
b'\x01896633T58000\x00\x00\x00\x00',
+ b'\x01896633T63000\x00\x00\x00\x00',
b'\x028966333S8000\x00\x00\x00\x00897CF3302002\x00\x00\x00\x00',
b'\x028966333S8000\x00\x00\x00\x00897CF3305001\x00\x00\x00\x00',
b'\x028966333T0100\x00\x00\x00\x00897CF3305001\x00\x00\x00\x00',
@@ -1261,6 +1344,7 @@ FW_VERSIONS = {
b'8965B33252\x00\x00\x00\x00\x00\x00',
b'8965B33590\x00\x00\x00\x00\x00\x00',
b'8965B33690\x00\x00\x00\x00\x00\x00',
+ b'8965B33702\x00\x00\x00\x00\x00\x00',
b'8965B33721\x00\x00\x00\x00\x00\x00',
],
(Ecu.fwdRadar, 0x750, 0xf): [
@@ -1274,6 +1358,7 @@ FW_VERSIONS = {
],
(Ecu.fwdCamera, 0x750, 0x6d): [
b'\x028646F0610000\x00\x00\x00\x008646G3304000\x00\x00\x00\x00',
+ b'\x028646F0610100\x00\x00\x00\x008646G3304000\x00\x00\x00\x00',
b'\x028646F33030D0\x00\x00\x00\x008646G26011A0\x00\x00\x00\x00',
b'\x028646F3303100\x00\x00\x00\x008646G26011A0\x00\x00\x00\x00',
b'\x028646F3303200\x00\x00\x00\x008646G26011A0\x00\x00\x00\x00',
@@ -1282,6 +1367,7 @@ FW_VERSIONS = {
b'\x028646F3304300\x00\x00\x00\x008646G2601500\x00\x00\x00\x00',
b'\x028646F3309100\x00\x00\x00\x008646G3304000\x00\x00\x00\x00',
b'\x028646F3309100\x00\x00\x00\x008646G5301200\x00\x00\x00\x00',
+ b'\x028646F3309400\x00\x00\x00\x008646G3304000\x00\x00\x00\x00',
],
},
CAR.LEXUS_ES: {
@@ -1470,6 +1556,7 @@ FW_VERSIONS = {
b'\x01896630E36100\x00\x00\x00\x00',
b'\x01896630E36200\x00\x00\x00\x00',
b'\x01896630E36300\x00\x00\x00\x00',
+ b'\x01896630E36600\x00\x00\x00\x00',
b'\x01896630E37100\x00\x00\x00\x00',
b'\x01896630E37200\x00\x00\x00\x00',
b'\x01896630E37300\x00\x00\x00\x00',
@@ -1481,11 +1568,13 @@ FW_VERSIONS = {
b'\x01896630EA3300\x00\x00\x00\x00',
b'\x01896630EA3400\x00\x00\x00\x00',
b'\x01896630EA4100\x00\x00\x00\x00',
+ b'\x01896630EA4200\x00\x00\x00\x00',
b'\x01896630EA4300\x00\x00\x00\x00',
b'\x01896630EA4400\x00\x00\x00\x00',
b'\x01896630EA6300\x00\x00\x00\x00',
b'\x018966348R1300\x00\x00\x00\x00',
b'\x018966348R8500\x00\x00\x00\x00',
+ b'\x018966348R9300\x00\x00\x00\x00',
b'\x018966348W1300\x00\x00\x00\x00',
b'\x018966348W2300\x00\x00\x00\x00',
],
@@ -1574,6 +1663,7 @@ FW_VERSIONS = {
b'\x02348X8000\x00\x00\x00\x00\x00\x00\x00\x00A4802000\x00\x00\x00\x00\x00\x00\x00\x00',
b'\x02348Y3000\x00\x00\x00\x00\x00\x00\x00\x00A4802000\x00\x00\x00\x00\x00\x00\x00\x00',
b'\x0234D14000\x00\x00\x00\x00\x00\x00\x00\x00A4802000\x00\x00\x00\x00\x00\x00\x00\x00',
+ b'\x0234D15000\x00\x00\x00\x00\x00\x00\x00\x00A4802000\x00\x00\x00\x00\x00\x00\x00\x00',
b'\x0234D16000\x00\x00\x00\x00\x00\x00\x00\x00A4802000\x00\x00\x00\x00\x00\x00\x00\x00',
],
(Ecu.abs, 0x7b0, None): [
@@ -1628,6 +1718,7 @@ FW_VERSIONS = {
b'8965B47070\x00\x00\x00\x00\x00\x00',
],
(Ecu.fwdRadar, 0x750, 0xf): [
+ b'\x018821F3301300\x00\x00\x00\x00',
b'\x018821F3301400\x00\x00\x00\x00',
],
(Ecu.fwdCamera, 0x750, 0x6d): [
diff --git a/selfdrive/car/toyota/interface.py b/selfdrive/car/toyota/interface.py
index 98f63597e..077a1720e 100644
--- a/selfdrive/car/toyota/interface.py
+++ b/selfdrive/car/toyota/interface.py
@@ -1,24 +1,26 @@
-from cereal import car
+from cereal import car, custom
from panda import Panda
from panda.python import uds
from openpilot.selfdrive.car.toyota.values import Ecu, CAR, DBC, ToyotaFlags, CarControllerParams, TSS2_CAR, RADAR_ACC_CAR, NO_DSU_CAR, \
- MIN_ACC_SPEED, EPS_SCALE, UNSUPPORTED_DSU_CAR, NO_STOP_TIMER_CAR, ANGLE_CONTROL_CAR
+ MIN_ACC_SPEED, EPS_SCALE, UNSUPPORTED_DSU_CAR, NO_STOP_TIMER_CAR, ANGLE_CONTROL_CAR, STOP_AND_GO_CAR
from openpilot.selfdrive.car import create_button_events, get_safety_config
from openpilot.selfdrive.car.disable_ecu import disable_ecu
from openpilot.selfdrive.car.interfaces import CarInterfaceBase
+from openpilot.selfdrive.frogpilot.frogpilot_variables import params
+
ButtonType = car.CarState.ButtonEvent.Type
+FrogPilotButtonType = custom.FrogPilotCarState.ButtonEvent.Type
EventName = car.CarEvent.EventName
SteerControlType = car.CarParams.SteerControlType
-
class CarInterface(CarInterfaceBase):
@staticmethod
def get_pid_accel_limits(CP, current_speed, cruise_speed):
- return CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX
+ return CarControllerParams(CP).ACCEL_MIN, CarControllerParams(CP).ACCEL_MAX
@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 = "toyota"
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.toyota)]
ret.safetyConfigs[0].safetyParam = EPS_SCALE[candidate]
@@ -27,6 +29,10 @@ class CarInterface(CarInterfaceBase):
if DBC[candidate]["pt"] == "toyota_new_mc_pt_generated":
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_TOYOTA_ALT_BRAKE
+ if ret.flags & ToyotaFlags.SECOC.value:
+ ret.secOcRequired = True
+ ret.safetyConfigs[0].safetyParam |= Panda.FLAG_TOYOTA_SECOC
+
if candidate in ANGLE_CONTROL_CAR:
ret.steerControlType = SteerControlType.angle
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_TOYOTA_LTA
@@ -42,8 +48,6 @@ class CarInterface(CarInterfaceBase):
ret.stoppingControl = False # Toyota starts braking more when it thinks you want to stop
- stop_and_go = candidate in TSS2_CAR
-
# Detect smartDSU, which intercepts ACC_CMD from the DSU (or radar) allowing openpilot to send it
# 0x2AA is sent by a similar device which intercepts the radar instead of DSU on NO_DSU_CARs
if 0x2FF in fingerprint[0] or (0x2AA in fingerprint[0] and candidate in NO_DSU_CAR):
@@ -57,24 +61,23 @@ class CarInterface(CarInterfaceBase):
ret.enableDsu = len(found_ecus) > 0 and Ecu.dsu not in found_ecus and candidate not in (NO_DSU_CAR | UNSUPPORTED_DSU_CAR) \
and not (ret.flags & ToyotaFlags.SMART_DSU)
+ if Ecu.hybrid in found_ecus:
+ ret.flags |= ToyotaFlags.HYBRID.value
+
if candidate == CAR.TOYOTA_PRIUS:
- stop_and_go = True
# Only give steer angle deadzone to for bad angle sensor prius
for fw in car_fw:
if fw.ecu == "eps" and not fw.fwVersion == b'8965B47060\x00\x00\x00\x00\x00\x00':
ret.steerActuatorDelay = 0.25
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning, steering_angle_deadzone_deg=0.2)
+ if 0x23 in fingerprint[0]: # Detect if ZSS is present
+ ret.flags |= ToyotaFlags.ZSS.value
+
elif candidate in (CAR.LEXUS_RX, CAR.LEXUS_RX_TSS2):
- stop_and_go = True
ret.wheelSpeedFactor = 1.035
- elif candidate in (CAR.TOYOTA_AVALON, CAR.TOYOTA_AVALON_2019, CAR.TOYOTA_AVALON_TSS2):
- # starting from 2019, all Avalon variants have stop and go
- # https://engage.toyota.com/static/images/toyota_safety_sense/TSS_Applicability_Chart.pdf
- stop_and_go = candidate != CAR.TOYOTA_AVALON
-
- elif candidate in (CAR.TOYOTA_RAV4_TSS2, CAR.TOYOTA_RAV4_TSS2_2022, CAR.TOYOTA_RAV4_TSS2_2023):
+ elif candidate in (CAR.TOYOTA_RAV4_TSS2, CAR.TOYOTA_RAV4_TSS2_2022, CAR.TOYOTA_RAV4_TSS2_2023, CAR.TOYOTA_RAV4_PRIME, CAR.TOYOTA_SIENNA_4TH_GEN):
ret.lateralTuning.init('pid')
ret.lateralTuning.pid.kiBP = [0.0]
ret.lateralTuning.pid.kpBP = [0.0]
@@ -91,15 +94,6 @@ class CarInterface(CarInterfaceBase):
ret.lateralTuning.pid.kf = 0.00004
break
- elif candidate in (CAR.TOYOTA_CHR, CAR.TOYOTA_CAMRY, CAR.TOYOTA_SIENNA, CAR.LEXUS_CTH, CAR.LEXUS_NX):
- # TODO: Some of these platforms are not advertised to have full range ACC, are they similar to SNG_WITHOUT_DSU cars?
- stop_and_go = True
-
- # TODO: these models can do stop and go, but unclear if it requires sDSU or unplugging DSU.
- # For now, don't list stop and go functionality in the docs
- if ret.flags & ToyotaFlags.SNG_WITHOUT_DSU:
- stop_and_go = stop_and_go or bool(ret.flags & ToyotaFlags.SMART_DSU.value) or (ret.enableDsu and not docs)
-
ret.centerToFront = ret.wheelbase * 0.44
# TODO: Some TSS-P platforms have BSM, but are flipped based on region or driving direction.
@@ -131,26 +125,35 @@ class CarInterface(CarInterfaceBase):
# - TSS2 radar ACC cars w/ smartDSU installed
# - TSS2 radar ACC cars w/o smartDSU installed (disables radar)
# - TSS-P DSU-less cars w/ CAN filter installed (no radar parser yet)
- ret.openpilotLongitudinalControl = use_sdsu or ret.enableDsu or candidate in (TSS2_CAR - RADAR_ACC_CAR) or bool(ret.flags & ToyotaFlags.DISABLE_RADAR.value)
+
+ if ret.flags & ToyotaFlags.SECOC.value:
+ ret.openpilotLongitudinalControl = False
+ else:
+ ret.openpilotLongitudinalControl = use_sdsu or ret.enableDsu or candidate in (TSS2_CAR - RADAR_ACC_CAR) or bool(ret.flags & ToyotaFlags.DISABLE_RADAR.value)
+ ret.openpilotLongitudinalControl &= not disable_openpilot_long
+
ret.autoResumeSng = ret.openpilotLongitudinalControl and candidate in NO_STOP_TIMER_CAR
+ ret.enableGasInterceptor = 0x201 in fingerprint[0] and ret.openpilotLongitudinalControl
if not ret.openpilotLongitudinalControl:
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_TOYOTA_STOCK_LONGITUDINAL
+ if ret.enableGasInterceptor:
+ ret.safetyConfigs[0].safetyParam |= Panda.FLAG_TOYOTA_GAS_INTERCEPTOR
+
# 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.
- ret.minEnableSpeed = -1. if stop_and_go else MIN_ACC_SPEED
+ ret.minEnableSpeed = -1. if (candidate in STOP_AND_GO_CAR or ret.enableGasInterceptor) else MIN_ACC_SPEED
- tune = ret.longitudinalTuning
- if candidate in TSS2_CAR:
- tune.kpV = [0.0]
- tune.kiV = [0.5]
- ret.vEgoStopping = 0.25
- ret.vEgoStarting = 0.25
- ret.stoppingDecelRate = 0.3 # reach stopping target smoothly
- else:
- tune.kiBP = [0., 5., 35.]
- tune.kiV = [3.6, 2.4, 1.5]
+ ret.flags |= ToyotaFlags.RAISED_ACCEL_LIMIT.value
+
+ ret.vEgoStopping = 0.25
+ ret.vEgoStarting = 0.25
+ ret.stoppingDecelRate = 0.3 # reach stopping target smoothly
+
+ # Hybrids have much quicker longitudinal actuator response
+ if ret.flags & ToyotaFlags.HYBRID.value:
+ ret.longitudinalActuatorDelay = 0.05
return ret
@@ -162,11 +165,16 @@ class CarInterface(CarInterfaceBase):
disable_ecu(logcan, sendcan, bus=0, addr=0x750, sub_addr=0xf, com_cont_req=communication_control)
# returns a car.CarState
- def _update(self, c):
- ret = self.CS.update(self.cp, self.cp_cam)
+ def _update(self, c, frogpilot_toggles):
+ ret, fp_ret = self.CS.update(self.cp, self.cp_cam, c, frogpilot_toggles)
if self.CP.carFingerprint in (TSS2_CAR - RADAR_ACC_CAR) or (self.CP.flags & ToyotaFlags.SMART_DSU and not self.CP.flags & ToyotaFlags.RADAR_CAN_FILTER):
- ret.buttonEvents = create_button_events(self.CS.distance_button, self.CS.prev_distance_button, {1: ButtonType.gapAdjustCruise})
+ ret.buttonEvents = [
+ *create_button_events(self.CS.cruise_decreased, self.CS.cruise_decreased_previously, {1: ButtonType.decelCruise}),
+ *create_button_events(self.CS.cruise_increased, self.CS.cruise_increased_previously, {1: ButtonType.accelCruise}),
+ *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 = self.create_common_events(ret)
@@ -177,7 +185,7 @@ class CarInterface(CarInterfaceBase):
events.add(EventName.vehicleSensorsInvalid)
if self.CP.openpilotLongitudinalControl:
- if ret.cruiseState.standstill and not ret.brakePressed:
+ if ret.cruiseState.standstill and not ret.brakePressed and not self.CP.enableGasInterceptor:
events.add(EventName.resumeRequired)
if self.CS.low_speed_lockout:
events.add(EventName.lowSpeedLockout)
@@ -192,4 +200,4 @@ class CarInterface(CarInterfaceBase):
ret.events = events.to_msg()
- return ret
+ return ret, fp_ret
diff --git a/selfdrive/car/toyota/toyotacan.py b/selfdrive/car/toyota/toyotacan.py
index 1cc99b41b..5d633fc95 100644
--- a/selfdrive/car/toyota/toyotacan.py
+++ b/selfdrive/car/toyota/toyotacan.py
@@ -33,22 +33,52 @@ def create_lta_steer_command(packer, steer_control_type, steer_angle, steer_req,
return packer.make_can_msg("STEERING_LTA", 0, values)
-def create_accel_command(packer, accel, pcm_cancel, standstill_req, lead, acc_type, fcw_alert, distance):
+def create_lta_steer_command_2(packer, frame):
+ values = {
+ "COUNTER": frame + 128,
+ }
+ return packer.make_can_msg("STEERING_LTA_2", 0, values)
+
+
+def create_accel_command(packer, accel, pcm_cancel, permit_braking, standstill_req, lead, acc_type, fcw_alert, distance, reverse_cruise_active):
# TODO: find the exact canceling bit that does not create a chime
values = {
"ACCEL_CMD": accel,
"ACC_TYPE": acc_type,
"DISTANCE": distance,
"MINI_CAR": lead,
- "PERMIT_BRAKING": 1,
+ "PERMIT_BRAKING": permit_braking,
"RELEASE_STANDSTILL": not standstill_req,
"CANCEL_REQ": pcm_cancel,
- "ALLOW_LONG_PRESS": 1,
+ "ALLOW_LONG_PRESS": 2 if reverse_cruise_active else 1,
"ACC_CUT_IN": fcw_alert, # only shown when ACC enabled
}
return packer.make_can_msg("ACC_CONTROL", 0, values)
+def create_pcs_commands(packer, accel, active, mass):
+ values1 = {
+ "COUNTER": 0,
+ "FORCE": round(min(accel, 0) * mass * 2),
+ "STATE": 3 if active else 0,
+ "BRAKE_STATUS": 0,
+ "PRECOLLISION_ACTIVE": 1 if active else 0,
+ }
+ msg1 = packer.make_can_msg("PRE_COLLISION", 0, values1)
+
+ values2 = {
+ "DSS1GDRV": min(accel, 0), # accel
+ "PCSALM": 1 if active else 0, # goes high same time as PRECOLLISION_ACTIVE
+ "IBTRGR": 1 if active else 0, # unknown
+ "PBATRGR": 1 if active else 0, # noisy actuation bit?
+ "PREFILL": 1 if active else 0, # goes on and off before DSS1GDRV
+ "AVSTRGR": 1 if active else 0,
+ }
+ msg2 = packer.make_can_msg("PRE_COLLISION_2", 0, values2)
+
+ return [msg1, msg2]
+
+
def create_acc_cancel_command(packer):
values = {
"GAS_RELEASED": 0,
@@ -73,13 +103,13 @@ def create_fcw_command(packer, fcw):
return packer.make_can_msg("PCS_HUD", 0, values)
-def create_ui_command(packer, steer, chime, left_line, right_line, left_lane_depart, right_lane_depart, enabled, stock_lkas_hud):
+def create_ui_command(packer, steer, chime, left_line, right_line, left_lane_depart, right_lane_depart, enabled, stock_lkas_hud, lat_active):
values = {
"TWO_BEEPS": chime,
"LDA_ALERT": steer,
- "RIGHT_LINE": 3 if right_lane_depart else 1 if right_line else 2,
- "LEFT_LINE": 3 if left_lane_depart else 1 if left_line else 2,
- "BARRIERS": 1 if enabled else 0,
+ "RIGHT_LINE": 0 if not lat_active else 3 if right_lane_depart else 1 if right_line else 2,
+ "LEFT_LINE": 0 if not lat_active else 3 if left_lane_depart else 1 if left_line else 2,
+ "BARRIERS": 1 if lat_active else 0,
# static signals
"SET_ME_X02": 2,
diff --git a/selfdrive/car/toyota/values.py b/selfdrive/car/toyota/values.py
index 2e781ad0a..6fd0885c6 100644
--- a/selfdrive/car/toyota/values.py
+++ b/selfdrive/car/toyota/values.py
@@ -16,9 +16,6 @@ PEDAL_TRANSITION = 10. * CV.MPH_TO_MS
class CarControllerParams:
- ACCEL_MAX = 1.5 # m/s2, lower than allowed 2.0 m/s2 for tuning reasons
- ACCEL_MIN = -3.5 # m/s2
-
STEER_STEP = 1
STEER_MAX = 1500
STEER_ERROR_MAX = 350 # max delta between torque cmd and torque motor
@@ -33,7 +30,13 @@ class CarControllerParams:
ANGLE_RATE_LIMIT_DOWN = AngleRateLimit(speed_bp=[5, 25], angle_v=[0.36, 0.26])
def __init__(self, CP):
- if CP.lateralTuning.which == 'torque':
+ if CP.flags & ToyotaFlags.RAISED_ACCEL_LIMIT:
+ self.ACCEL_MAX = 2.0
+ else:
+ self.ACCEL_MAX = 1.5 # m/s2, lower than allowed 2.0 m/s^2 for tuning reasons
+ self.ACCEL_MIN = -3.5 # m/s2
+
+ if CP.lateralTuning.which() == 'torque':
self.STEER_DELTA_UP = 15 # 1.0s time to peak torque
self.STEER_DELTA_DOWN = 25 # always lower than 45 otherwise the Rav4 faults (Prius seems ok with 50)
else:
@@ -44,9 +47,7 @@ class CarControllerParams:
class ToyotaFlags(IntFlag):
# Detected flags
HYBRID = 1
- SMART_DSU = 2
DISABLE_RADAR = 4
- RADAR_CAN_FILTER = 1024
# Static flags
TSS2 = 8
@@ -56,9 +57,16 @@ class ToyotaFlags(IntFlag):
# these cars use the Lane Tracing Assist (LTA) message for lateral control
ANGLE_CONTROL = 128
NO_STOP_TIMER = 256
- # these cars are speculated to allow stop and go when the DSU is unplugged or disabled with sDSU
+ # these cars are speculated to allow stop and go when the DSU is unplugged
SNG_WITHOUT_DSU = 512
+ # these cars can utilize 2.0 m/s^2
+ RAISED_ACCEL_LIMIT = 1024
+ SECOC = 2048
+ # FrogPilot Toyota flags
+ RADAR_CAN_FILTER = 4096
+ SMART_DSU = 8192
+ ZSS = 16384
class Footnote(Enum):
CAMRY = CarFootnote(
@@ -246,6 +254,14 @@ class CAR(Platforms):
TOYOTA_RAV4_TSS2.specs,
flags=ToyotaFlags.RADAR_ACC | ToyotaFlags.ANGLE_CONTROL,
)
+ TOYOTA_RAV4_PRIME = PlatformConfig(
+ # TODO: Enable this docs entry when it can be suppressed from openpilot CARS.md
+ # [ToyotaCarDocs("Toyota RAV4 Prime 2021-23", min_enable_speed=MIN_ACC_SPEED)],
+ [],
+ CarSpecs(mass=4372. * CV.LB_TO_KG, wheelbase=2.68, steerRatio=16.88, tireStiffnessFactor=0.5533),
+ dbc_dict('toyota_rav4_prime_generated', 'toyota_tss2_adas'),
+ flags=ToyotaFlags.TSS2 | ToyotaFlags.NO_STOP_TIMER | ToyotaFlags.NO_DSU | ToyotaFlags.SECOC,
+ )
TOYOTA_MIRAI = ToyotaTSS2PlatformConfig( # TSS 2.5
[ToyotaCarDocs("Toyota Mirai 2021")],
CarSpecs(mass=4300. * CV.LB_TO_KG, wheelbase=2.91, steerRatio=14.8, tireStiffnessFactor=0.8),
@@ -256,6 +272,14 @@ class CAR(Platforms):
dbc_dict('toyota_tnga_k_pt_generated', 'toyota_adas'),
flags=ToyotaFlags.NO_STOP_TIMER,
)
+ TOYOTA_SIENNA_4TH_GEN = PlatformConfig(
+ # TODO: Enable this docs entry when it can be suppressed from openpilot CARS.md
+ # [ToyotaCarDocs("Toyota Sienna 2021-23", min_enable_speed=MIN_ACC_SPEED)],
+ [],
+ CarSpecs(mass=4625. * CV.LB_TO_KG, wheelbase=3.06, steerRatio=17.8, tireStiffnessFactor=0.444),
+ dbc_dict('toyota_rav4_prime_generated', 'toyota_tss2_adas'),
+ flags=ToyotaFlags.TSS2 | ToyotaFlags.NO_STOP_TIMER | ToyotaFlags.NO_DSU | ToyotaFlags.SECOC,
+ )
# Lexus
LEXUS_CTH = PlatformConfig(
@@ -274,7 +298,7 @@ class CAR(Platforms):
LEXUS_ES_TSS2 = ToyotaTSS2PlatformConfig(
[
ToyotaCarDocs("Lexus ES 2019-24"),
- ToyotaCarDocs("Lexus ES Hybrid 2019-24", video_link="https://youtu.be/BZ29osRVJeg?t=12"),
+ ToyotaCarDocs("Lexus ES Hybrid 2019-25", video_link="https://youtu.be/BZ29osRVJeg?t=12"),
],
LEXUS_ES.specs,
)
@@ -539,6 +563,7 @@ FW_QUERY_CONFIG = FwQueryConfig(
# Hybrid control computer can be on 0x7e2 (KWP) or 0x7d2 (UDS) depending on platform
(Ecu.hybrid, 0x7e2, None), # Hybrid Control Assembly & Computer
+ (Ecu.hybrid, 0x7d2, None), # Hybrid Control Assembly & Computer
(Ecu.srs, 0x780, None), # SRS Airbag
# Transmission is combined with engine on some platforms, such as TSS-P RAV4
(Ecu.transmission, 0x701, None),
@@ -569,7 +594,12 @@ RADAR_ACC_CAR = CAR.with_flags(ToyotaFlags.RADAR_ACC)
ANGLE_CONTROL_CAR = CAR.with_flags(ToyotaFlags.ANGLE_CONTROL)
+SECOC_CAR = CAR.with_flags(ToyotaFlags.SECOC)
+
# no resume button press required
NO_STOP_TIMER_CAR = CAR.with_flags(ToyotaFlags.NO_STOP_TIMER)
+STOP_AND_GO_CAR = TSS2_CAR | {CAR.TOYOTA_PRIUS, CAR.TOYOTA_PRIUS_V, CAR.TOYOTA_RAV4H, CAR.LEXUS_RX, CAR.TOYOTA_CHR, CAR.TOYOTA_CAMRY, CAR.TOYOTA_HIGHLANDER,
+ CAR.TOYOTA_SIENNA, CAR.LEXUS_CTH, CAR.LEXUS_NX, CAR.TOYOTA_MIRAI, CAR.TOYOTA_AVALON_2019}
+
DBC = CAR.create_dbc_map()
diff --git a/selfdrive/car/volkswagen/carcontroller.py b/selfdrive/car/volkswagen/carcontroller.py
index a4e0c8946..802a0ce4e 100644
--- a/selfdrive/car/volkswagen/carcontroller.py
+++ b/selfdrive/car/volkswagen/carcontroller.py
@@ -8,6 +8,8 @@ from openpilot.selfdrive.car.interfaces import CarControllerBase
from openpilot.selfdrive.car.volkswagen import mqbcan, pqcan
from openpilot.selfdrive.car.volkswagen.values import CANBUS, CarControllerParams, VolkswagenFlags
+from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_acceleration import get_max_allowed_accel
+
VisualAlert = car.CarControl.HUDControl.VisualAlert
LongCtrlState = car.CarControl.Actuators.LongControlState
@@ -27,7 +29,7 @@ class CarController(CarControllerBase):
self.hca_frame_timer_running = 0
self.hca_frame_same_torque = 0
- def update(self, CC, CS, now_nanos):
+ def update(self, CC, CS, now_nanos, frogpilot_toggles):
actuators = CC.actuators
hud_control = CC.hudControl
can_sends = []
@@ -80,7 +82,10 @@ class CarController(CarControllerBase):
if self.frame % self.CCP.ACC_CONTROL_STEP == 0 and self.CP.openpilotLongitudinalControl:
acc_control = self.CCS.acc_control_value(CS.out.cruiseState.available, CS.out.accFaulted, CC.longActive)
- accel = clip(actuators.accel, self.CCP.ACCEL_MIN, self.CCP.ACCEL_MAX) if CC.longActive else 0
+ if frogpilot_toggles.sport_plus:
+ accel = clip(actuators.accel, self.CCP.ACCEL_MIN, min(frogpilot_toggles.max_desired_acceleration, get_max_allowed_accel(CS.out.vEgo))) if CC.longActive else 0
+ else:
+ accel = clip(actuators.accel, self.CCP.ACCEL_MIN, min(frogpilot_toggles.max_desired_acceleration, self.CCP.ACCEL_MAX)) if CC.longActive else 0
stopping = actuators.longControlState == LongCtrlState.stopping
starting = actuators.longControlState == LongCtrlState.pid and (CS.esp_hold_confirmation or CS.out.vEgo < self.CP.vEgoStopping)
can_sends.extend(self.CCS.create_acc_accel_control(self.packer_pt, CANBUS.pt, CS.acc_type, CC.longActive, accel,
diff --git a/selfdrive/car/volkswagen/carstate.py b/selfdrive/car/volkswagen/carstate.py
index ec6403496..4a6122093 100644
--- a/selfdrive/car/volkswagen/carstate.py
+++ b/selfdrive/car/volkswagen/carstate.py
@@ -1,5 +1,5 @@
import numpy as np
-from cereal import car
+from cereal import car, custom
from openpilot.common.conversions import Conversions as CV
from openpilot.selfdrive.car.interfaces import CarStateBase
from opendbc.can.parser import CANParser
@@ -32,11 +32,12 @@ class CarState(CarStateBase):
return button_events
- def update(self, pt_cp, cam_cp, ext_cp, trans_type):
+ def update(self, pt_cp, cam_cp, ext_cp, trans_type, frogpilot_toggles):
if self.CP.flags & VolkswagenFlags.PQ:
- return self.update_pq(pt_cp, cam_cp, ext_cp, trans_type)
+ return self.update_pq(pt_cp, cam_cp, ext_cp, trans_type, frogpilot_toggles)
ret = car.CarState.new_message()
+ fp_ret = custom.FrogPilotCarState.new_message()
# Update vehicle speed and acceleration from ABS wheel speeds.
ret.wheelSpeeds = self.get_wheel_speeds(
pt_cp.vl["ESP_19"]["ESP_VL_Radgeschw_02"],
@@ -152,11 +153,18 @@ class CarState(CarStateBase):
# Digital instrument clusters expect the ACC HUD lead car distance to be scaled differently
self.upscale_lead_car_signal = bool(pt_cp.vl["Kombi_03"]["KBI_Variante"])
- self.frame += 1
- return ret
+ # FrogPilot CarState functions
+ fp_ret.brakeLights = bool(pt_cp.vl["ESP_05"]['ESP_Status_Bremsdruck'])
- def update_pq(self, pt_cp, cam_cp, ext_cp, trans_type):
+ self.prev_distance_button = self.distance_button
+ self.distance_button = bool(pt_cp.vl["GRA_ACC_01"]["GRA_Verstellung_Zeitluecke"])
+
+ self.frame += 1
+ return ret, fp_ret
+
+ def update_pq(self, pt_cp, cam_cp, ext_cp, trans_type, frogpilot_toggles):
ret = car.CarState.new_message()
+ fp_ret = custom.FrogPilotCarState.new_message()
# Update vehicle speed and acceleration from ABS wheel speeds.
ret.wheelSpeeds = self.get_wheel_speeds(
pt_cp.vl["Bremse_3"]["Radgeschw__VL_4_1"],
@@ -251,8 +259,14 @@ class CarState(CarStateBase):
# Additional safety checks performed in CarInterface.
ret.espDisabled = bool(pt_cp.vl["Bremse_1"]["ESP_Passiv_getastet"])
+ # FrogPilot CarState functions
+ fp_ret.brakeLights = bool(pt_cp.vl["Motor_2"]['Bremstestschalter'])
+
+ self.prev_distance_button = self.distance_button
+ self.distance_button = bool(pt_cp.vl["GRA_Neu"]["GRA_Zeitluecke"])
+
self.frame += 1
- return ret
+ return ret, fp_ret
def update_hca_state(self, hca_status):
# Treat INITIALIZING and FAULT as temporary for worst likely EPS recovery time, for cars without factory Lane Assist
diff --git a/selfdrive/car/volkswagen/interface.py b/selfdrive/car/volkswagen/interface.py
index 77e56875b..ce35ac840 100644
--- a/selfdrive/car/volkswagen/interface.py
+++ b/selfdrive/car/volkswagen/interface.py
@@ -20,7 +20,7 @@ class CarInterface(CarInterfaceBase):
self.cp_ext = self.cp_cam
@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 = "volkswagen"
ret.radarUnavailable = True
@@ -101,8 +101,8 @@ class CarInterface(CarInterfaceBase):
return ret
# returns a car.CarState
- def _update(self, c):
- ret = self.CS.update(self.cp, self.cp_cam, self.cp_ext, self.CP.transmissionType)
+ def _update(self, c, frogpilot_toggles):
+ ret, fp_ret = self.CS.update(self.cp, self.cp_cam, self.cp_ext, self.CP.transmissionType, frogpilot_toggles)
events = self.create_common_events(ret, extra_gears=[GearShifter.eco, GearShifter.sport, GearShifter.manumatic],
pcm_enable=not self.CS.CP.openpilotLongitudinalControl,
@@ -127,5 +127,4 @@ class CarInterface(CarInterfaceBase):
ret.events = events.to_msg()
- return ret
-
+ return ret, fp_ret
diff --git a/selfdrive/classic_modeld/SConscript b/selfdrive/classic_modeld/SConscript
new file mode 100644
index 000000000..2260b5b57
--- /dev/null
+++ b/selfdrive/classic_modeld/SConscript
@@ -0,0 +1,74 @@
+import glob
+
+Import('env', 'envCython', 'arch', 'cereal', 'messaging', 'common', 'gpucommon', 'visionipc', 'transformations')
+lenv = env.Clone()
+lenvCython = envCython.Clone()
+
+libs = [cereal, messaging, visionipc, gpucommon, common, 'capnp', 'zmq', 'kj', 'pthread']
+frameworks = []
+
+common_src = [
+ "models/commonmodel.cc",
+ "transforms/loadyuv.cc",
+ "transforms/transform.cc",
+]
+
+thneed_src_common = [
+ "thneed/thneed_common.cc",
+ "thneed/serialize.cc",
+]
+
+thneed_src_qcom = thneed_src_common + ["thneed/thneed_qcom2.cc"]
+thneed_src_pc = thneed_src_common + ["thneed/thneed_pc.cc"]
+thneed_src = thneed_src_qcom if arch == "larch64" else thneed_src_pc
+
+# SNPE except on Mac and ARM Linux
+snpe_lib = []
+if arch != "Darwin" and arch != "aarch64":
+ common_src += ['runners/snpemodel.cc']
+ snpe_lib += ['SNPE']
+
+# OpenCL is a framework on Mac
+if arch == "Darwin":
+ frameworks += ['OpenCL']
+else:
+ libs += ['OpenCL']
+
+# Set path definitions
+for pathdef, fn in {'TRANSFORM': 'transforms/transform.cl', 'LOADYUV': 'transforms/loadyuv.cl'}.items():
+ for xenv in (lenv, lenvCython):
+ xenv['CXXFLAGS'].append(f'-D{pathdef}_PATH=\\"{File(fn).abspath}\\"')
+
+# Compile cython
+snpe_rpath_qcom = "/data/pythonpath/third_party/snpe/larch64"
+snpe_rpath_pc = f"{Dir('#').abspath}/third_party/snpe/x86_64-linux-clang"
+snpe_rpath = lenvCython['RPATH'] + [snpe_rpath_qcom if arch == "larch64" else snpe_rpath_pc]
+
+cython_libs = envCython["LIBS"] + libs
+snpemodel_lib = lenv.Library('snpemodel', ['runners/snpemodel.cc'])
+commonmodel_lib = lenv.Library('commonmodel', common_src)
+
+lenvCython.Program('runners/runmodel_pyx.so', 'runners/runmodel_pyx.pyx', LIBS=cython_libs, FRAMEWORKS=frameworks)
+lenvCython.Program('runners/snpemodel_pyx.so', 'runners/snpemodel_pyx.pyx', LIBS=[snpemodel_lib, snpe_lib, *cython_libs], FRAMEWORKS=frameworks, RPATH=snpe_rpath)
+lenvCython.Program('models/commonmodel_pyx.so', 'models/commonmodel_pyx.pyx', LIBS=[commonmodel_lib, *cython_libs], FRAMEWORKS=frameworks)
+
+tinygrad_files = ["#"+x for x in glob.glob(env.Dir("#tinygrad_repo").relpath + "/**", recursive=True, root_dir=env.Dir("#").abspath)]
+
+# Get model metadata
+fn = File("models/supercombo").abspath
+cmd = f'python3 {Dir("#selfdrive/classic_modeld").abspath}/get_model_metadata.py {fn}.onnx'
+lenv.Command(fn + "_metadata.pkl", [fn + ".onnx"] + tinygrad_files, cmd)
+
+# Build thneed model
+if arch == "larch64" or GetOption('pc_thneed'):
+ tinygrad_opts = []
+ if not GetOption('pc_thneed'):
+ # use FLOAT16 on device for speed + don't cache the CL kernels for space
+ tinygrad_opts += ["FLOAT16=1", "PYOPENCL_NO_CACHE=1"]
+ cmd = f"cd {Dir('#').abspath}/tinygrad_repo && " + ' '.join(tinygrad_opts) + f" python3 openpilot/compile2.py {fn}.onnx {fn}.thneed"
+
+ lenv.Command(fn + ".thneed", [fn + ".onnx"] + tinygrad_files, cmd)
+
+ thneed_lib = env.SharedLibrary('thneed', thneed_src, LIBS=[gpucommon, common, 'zmq', 'OpenCL', 'dl'])
+ thneedmodel_lib = env.Library('thneedmodel', ['runners/thneedmodel.cc'])
+ lenvCython.Program('runners/thneedmodel_pyx.so', 'runners/thneedmodel_pyx.pyx', LIBS=envCython["LIBS"]+[thneedmodel_lib, thneed_lib, gpucommon, common, 'dl', 'zmq', 'OpenCL'])
diff --git a/selfdrive/classic_modeld/__init__.py b/selfdrive/classic_modeld/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/selfdrive/classic_modeld/classic_modeld b/selfdrive/classic_modeld/classic_modeld
new file mode 100755
index 000000000..3153c81ef
--- /dev/null
+++ b/selfdrive/classic_modeld/classic_modeld
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
+cd "$DIR/../../"
+
+if [ -f "$DIR/libthneed.so" ]; then
+ export LD_PRELOAD="$DIR/libthneed.so"
+fi
+
+exec "$DIR/classic_modeld.py" "$@"
diff --git a/selfdrive/classic_modeld/classic_modeld.py b/selfdrive/classic_modeld/classic_modeld.py
new file mode 100755
index 000000000..b41953523
--- /dev/null
+++ b/selfdrive/classic_modeld/classic_modeld.py
@@ -0,0 +1,355 @@
+#!/usr/bin/env python3
+import os
+import time
+import pickle
+import numpy as np
+import cereal.messaging as messaging
+from cereal import car, log
+from pathlib import Path
+from setproctitle import setproctitle
+from cereal.messaging import PubMaster, SubMaster
+from msgq.visionipc import VisionIpcClient, VisionStreamType, VisionBuf
+from openpilot.common.swaglog import cloudlog
+from openpilot.common.params import Params
+from openpilot.common.filter_simple import FirstOrderFilter
+from openpilot.common.realtime import config_realtime_process
+from openpilot.common.transformations.camera import DEVICE_CAMERAS
+from openpilot.common.transformations.model import get_warp_matrix
+from openpilot.system import sentry
+from openpilot.selfdrive.car.car_helpers import get_demo_car_params
+from openpilot.selfdrive.controls.lib.desire_helper import DesireHelper
+from openpilot.selfdrive.classic_modeld.runners import ModelRunner, Runtime
+from openpilot.selfdrive.classic_modeld.parse_model_outputs import Parser
+from openpilot.selfdrive.classic_modeld.fill_model_msg import fill_model_msg, fill_pose_msg, PublishState
+from openpilot.selfdrive.classic_modeld.constants import ModelConstants
+from openpilot.selfdrive.classic_modeld.models.commonmodel_pyx import ModelFrame, CLContext
+
+from openpilot.selfdrive.frogpilot.frogpilot_variables import METADATAS_PATH, MODELS_PATH, get_frogpilot_toggles
+
+PROCESS_NAME = "selfdrive.classic_modeld.classic_modeld"
+SEND_RAW_PRED = os.getenv('SEND_RAW_PRED')
+
+MODEL_PATHS = {
+ ModelRunner.THNEED: Path(__file__).parent / 'models/supercombo.thneed',
+ ModelRunner.ONNX: Path(__file__).parent / 'models/supercombo.onnx'}
+
+class FrameMeta:
+ frame_id: int = 0
+ timestamp_sof: int = 0
+ timestamp_eof: int = 0
+
+ def __init__(self, vipc=None):
+ if vipc is not None:
+ self.frame_id, self.timestamp_sof, self.timestamp_eof = vipc.frame_id, vipc.timestamp_sof, vipc.timestamp_eof
+
+class ModelState:
+ frame: ModelFrame
+ wide_frame: ModelFrame
+ inputs: dict[str, np.ndarray]
+ output: np.ndarray
+ prev_desire: np.ndarray # for tracking the rising edge of the pulse
+ model: ModelRunner
+
+ def __init__(self, context: CLContext, model: str, model_version: str):
+ # FrogPilot variables
+ MODEL_PATHS[ModelRunner.THNEED] = MODELS_PATH / f'{model}.thneed'
+
+ with open(METADATAS_PATH / f'supercombo_metadata_{model_version}.pkl', 'rb') as f:
+ model_metadata = pickle.load(f)
+
+ input_shapes = model_metadata.get('input_shapes')
+ self.navigation = 'nav_features' in input_shapes and 'nav_instructions' in input_shapes
+ self.radarless = 'radar_tracks' in input_shapes
+
+ self.frame = ModelFrame(context)
+ self.wide_frame = ModelFrame(context)
+ self.prev_desire = np.zeros(ModelConstants.DESIRE_LEN, dtype=np.float32)
+ self.inputs = {
+ 'desire': np.zeros(ModelConstants.DESIRE_LEN * (ModelConstants.HISTORY_BUFFER_LEN+1), dtype=np.float32),
+ 'traffic_convention': np.zeros(ModelConstants.TRAFFIC_CONVENTION_LEN, dtype=np.float32),
+ 'lateral_control_params': np.zeros(ModelConstants.LATERAL_CONTROL_PARAMS_LEN, dtype=np.float32),
+ 'prev_desired_curv': np.zeros(ModelConstants.PREV_DESIRED_CURV_LEN * (ModelConstants.HISTORY_BUFFER_LEN+1), dtype=np.float32),
+ **({'nav_features': np.zeros(ModelConstants.NAV_FEATURE_LEN, dtype=np.float32),
+ 'nav_instructions': np.zeros(ModelConstants.NAV_INSTRUCTION_LEN, dtype=np.float32)} if self.navigation else {}),
+ 'features_buffer': np.zeros(ModelConstants.HISTORY_BUFFER_LEN * ModelConstants.FEATURE_LEN, dtype=np.float32),
+ **({'radar_tracks': np.zeros(ModelConstants.RADAR_TRACKS_LEN * ModelConstants.RADAR_TRACKS_WIDTH, dtype=np.float32)} if self.radarless else {}),
+ }
+
+ self.output_slices = model_metadata['output_slices']
+ net_output_size = model_metadata['output_shapes']['outputs'][1]
+ self.output = np.zeros(net_output_size, dtype=np.float32)
+ self.parser = Parser()
+
+ self.model = ModelRunner(MODEL_PATHS, self.output, Runtime.GPU, False, context)
+ self.model.addInput("input_imgs", None)
+ self.model.addInput("big_input_imgs", None)
+ for k,v in self.inputs.items():
+ self.model.addInput(k, v)
+
+ def slice_outputs(self, model_outputs: np.ndarray) -> dict[str, np.ndarray]:
+ parsed_model_outputs = {k: model_outputs[np.newaxis, v] for k,v in self.output_slices.items()}
+ if SEND_RAW_PRED:
+ parsed_model_outputs['raw_pred'] = model_outputs.copy()
+ return parsed_model_outputs
+
+ def run(self, buf: VisionBuf, wbuf: VisionBuf, transform: np.ndarray, transform_wide: np.ndarray,
+ inputs: dict[str, np.ndarray], prepare_only: bool) -> dict[str, np.ndarray] | None:
+ # Model decides when action is completed, so desire input is just a pulse triggered on rising edge
+ inputs['desire'][0] = 0
+ self.inputs['desire'][:-ModelConstants.DESIRE_LEN] = self.inputs['desire'][ModelConstants.DESIRE_LEN:]
+ self.inputs['desire'][-ModelConstants.DESIRE_LEN:] = np.where(inputs['desire'] - self.prev_desire > .99, inputs['desire'], 0)
+ self.prev_desire[:] = inputs['desire']
+
+ self.inputs['traffic_convention'][:] = inputs['traffic_convention']
+ self.inputs['lateral_control_params'][:] = inputs['lateral_control_params']
+
+ if self.navigation:
+ self.inputs['nav_features'][:] = inputs['nav_features']
+ self.inputs['nav_instructions'][:] = inputs['nav_instructions']
+
+ if self.radarless:
+ self.inputs['radar_tracks'][:] = inputs['radar_tracks']
+
+ # if getCLBuffer is not None, frame will be None
+ self.model.setInputBuffer("input_imgs", self.frame.prepare(buf, transform.flatten(), self.model.getCLBuffer("input_imgs")))
+ if wbuf is not None:
+ self.model.setInputBuffer("big_input_imgs", self.wide_frame.prepare(wbuf, transform_wide.flatten(), self.model.getCLBuffer("big_input_imgs")))
+
+ if prepare_only:
+ return None
+
+ self.model.execute()
+ outputs = self.parser.parse_outputs(self.slice_outputs(self.output))
+
+ self.inputs['features_buffer'][:-ModelConstants.FEATURE_LEN] = self.inputs['features_buffer'][ModelConstants.FEATURE_LEN:]
+ self.inputs['features_buffer'][-ModelConstants.FEATURE_LEN:] = outputs['hidden_state'][0, :]
+ self.inputs['prev_desired_curv'][:-ModelConstants.PREV_DESIRED_CURV_LEN] = self.inputs['prev_desired_curv'][ModelConstants.PREV_DESIRED_CURV_LEN:]
+ self.inputs['prev_desired_curv'][-ModelConstants.PREV_DESIRED_CURV_LEN:] = outputs['desired_curvature'][0, :]
+ return outputs
+
+
+def main(demo=False):
+ # FrogPilot variables
+ frogpilot_toggles = get_frogpilot_toggles()
+
+ model_name = frogpilot_toggles.model
+ model_version = frogpilot_toggles.model_version
+
+ cloudlog.warning("classic_modeld init")
+
+ sentry.set_tag("daemon", PROCESS_NAME)
+ cloudlog.bind(daemon=PROCESS_NAME)
+ setproctitle(PROCESS_NAME)
+ config_realtime_process(7, 54)
+
+ cloudlog.warning("setting up CL context")
+ cl_context = CLContext()
+ cloudlog.warning("CL context ready; loading model")
+ model = ModelState(cl_context, model_name, model_version)
+ cloudlog.warning("models loaded, classic_modeld starting")
+
+ # visionipc clients
+ while True:
+ available_streams = VisionIpcClient.available_streams("camerad", block=False)
+ if available_streams:
+ use_extra_client = VisionStreamType.VISION_STREAM_WIDE_ROAD in available_streams and VisionStreamType.VISION_STREAM_ROAD in available_streams
+ main_wide_camera = VisionStreamType.VISION_STREAM_ROAD not in available_streams
+ break
+ time.sleep(.1)
+
+ vipc_client_main_stream = VisionStreamType.VISION_STREAM_WIDE_ROAD if main_wide_camera else VisionStreamType.VISION_STREAM_ROAD
+ vipc_client_main = VisionIpcClient("camerad", vipc_client_main_stream, True, cl_context)
+ vipc_client_extra = VisionIpcClient("camerad", VisionStreamType.VISION_STREAM_WIDE_ROAD, False, cl_context)
+ cloudlog.warning(f"vision stream set up, main_wide_camera: {main_wide_camera}, use_extra_client: {use_extra_client}")
+
+ while not vipc_client_main.connect(False):
+ time.sleep(0.1)
+ while use_extra_client and not vipc_client_extra.connect(False):
+ time.sleep(0.1)
+
+ cloudlog.warning(f"connected main cam with buffer size: {vipc_client_main.buffer_len} ({vipc_client_main.width} x {vipc_client_main.height})")
+ if use_extra_client:
+ cloudlog.warning(f"connected extra cam with buffer size: {vipc_client_extra.buffer_len} ({vipc_client_extra.width} x {vipc_client_extra.height})")
+
+ # messaging
+ pm = PubMaster(["modelV2", "cameraOdometry"])
+ sm = SubMaster(["deviceState", "carState", "roadCameraState", "liveCalibration", "driverMonitoringState", "navModel", "navInstruction", "carControl", "liveTracks", "frogpilotPlan"])
+
+ publish_state = PublishState()
+ params = Params()
+
+ # setup filter to track dropped frames
+ frame_dropped_filter = FirstOrderFilter(0., 10., 1. / ModelConstants.MODEL_FREQ)
+ frame_id = 0
+ last_vipc_frame_id = 0
+ run_count = 0
+
+ model_transform_main = np.zeros((3, 3), dtype=np.float32)
+ model_transform_extra = np.zeros((3, 3), dtype=np.float32)
+ live_calib_seen = False
+ nav_features = np.zeros(ModelConstants.NAV_FEATURE_LEN, dtype=np.float32)
+ nav_instructions = np.zeros(ModelConstants.NAV_INSTRUCTION_LEN, dtype=np.float32)
+ buf_main, buf_extra = None, None
+ meta_main = FrameMeta()
+ meta_extra = FrameMeta()
+
+
+ if demo:
+ CP = get_demo_car_params()
+ else:
+ with car.CarParams.from_bytes(params.get("CarParams", block=True)) as msg:
+ CP = msg
+ cloudlog.info("classic_modeld got CarParams: %s", CP.carName)
+
+ # TODO this needs more thought, use .2s extra for now to estimate other delays
+ steer_delay = CP.steerActuatorDelay + .2
+
+ DH = DesireHelper()
+
+ while True:
+ # Keep receiving frames until we are at least 1 frame ahead of previous extra frame
+ while meta_main.timestamp_sof < meta_extra.timestamp_sof + 25000000:
+ buf_main = vipc_client_main.recv()
+ meta_main = FrameMeta(vipc_client_main)
+ if buf_main is None:
+ break
+
+ if buf_main is None:
+ cloudlog.debug("vipc_client_main no frame")
+ continue
+
+ if use_extra_client:
+ # Keep receiving extra frames until frame id matches main camera
+ while True:
+ buf_extra = vipc_client_extra.recv()
+ meta_extra = FrameMeta(vipc_client_extra)
+ if buf_extra is None or meta_main.timestamp_sof < meta_extra.timestamp_sof + 25000000:
+ break
+
+ if buf_extra is None:
+ cloudlog.debug("vipc_client_extra no frame")
+ continue
+
+ if abs(meta_main.timestamp_sof - meta_extra.timestamp_sof) > 10000000:
+ cloudlog.error(f"frames out of sync! main: {meta_main.frame_id} ({meta_main.timestamp_sof / 1e9:.5f}),\
+ extra: {meta_extra.frame_id} ({meta_extra.timestamp_sof / 1e9:.5f})")
+
+ else:
+ # Use single camera
+ buf_extra = buf_main
+ meta_extra = meta_main
+
+ sm.update(0)
+ desire = DH.desire
+ is_rhd = sm["driverMonitoringState"].isRHD
+ frame_id = sm["roadCameraState"].frameId
+ lateral_control_params = np.array([sm["carState"].vEgo, steer_delay], dtype=np.float32)
+ if sm.updated["liveCalibration"] and sm.seen['roadCameraState'] and sm.seen['deviceState']:
+ device_from_calib_euler = np.array(sm["liveCalibration"].rpyCalib, dtype=np.float32)
+ dc = DEVICE_CAMERAS[(str(sm['deviceState'].deviceType), str(sm['roadCameraState'].sensor))]
+ model_transform_main = get_warp_matrix(device_from_calib_euler, dc.ecam.intrinsics if main_wide_camera else dc.fcam.intrinsics, False).astype(np.float32)
+ model_transform_extra = get_warp_matrix(device_from_calib_euler, dc.ecam.intrinsics, True).astype(np.float32)
+ live_calib_seen = True
+
+ traffic_convention = np.zeros(2)
+ traffic_convention[int(is_rhd)] = 1
+
+ vec_desire = np.zeros(ModelConstants.DESIRE_LEN, dtype=np.float32)
+ if desire >= 0 and desire < ModelConstants.DESIRE_LEN:
+ vec_desire[desire] = 1
+
+ # Enable/disable nav features
+ timestamp_llk = sm["navModel"].locationMonoTime
+ nav_valid = sm.valid["navModel"] # and (nanos_since_boot() - timestamp_llk < 1e9)
+ nav_enabled = nav_valid and model.navigation
+
+ if not nav_enabled:
+ nav_features[:] = 0
+ nav_instructions[:] = 0
+
+ if nav_enabled and sm.updated["navModel"]:
+ nav_features = np.array(sm["navModel"].features)
+
+ if nav_enabled and sm.updated["navInstruction"]:
+ nav_instructions[:] = 0
+ for maneuver in sm["navInstruction"].allManeuvers:
+ distance_idx = 25 + int(maneuver.distance / 20)
+ direction_idx = 0
+ if maneuver.modifier in ("left", "slight left", "sharp left"):
+ direction_idx = 1
+ if maneuver.modifier in ("right", "slight right", "sharp right"):
+ direction_idx = 2
+ if 0 <= distance_idx < 50:
+ nav_instructions[distance_idx*3 + direction_idx] = 1
+
+ radar_tracks = np.zeros(ModelConstants.RADAR_TRACKS_LEN * ModelConstants.RADAR_TRACKS_WIDTH, dtype=np.float32)
+ if sm.updated["liveTracks"]:
+ for i, track in enumerate(sm["liveTracks"]):
+ if i >= ModelConstants.RADAR_TRACKS_LEN:
+ break
+ vec_index = i * ModelConstants.RADAR_TRACKS_WIDTH
+ radar_tracks[vec_index:vec_index+ModelConstants.RADAR_TRACKS_WIDTH] = [track.dRel, track.yRel, track.vRel]
+
+ # tracked dropped frames
+ vipc_dropped_frames = max(0, meta_main.frame_id - last_vipc_frame_id - 1)
+ frames_dropped = frame_dropped_filter.update(min(vipc_dropped_frames, 10))
+ if run_count < 10: # let frame drops warm up
+ frame_dropped_filter.x = 0.
+ frames_dropped = 0.
+ run_count = run_count + 1
+
+ frame_drop_ratio = frames_dropped / (1 + frames_dropped)
+ prepare_only = vipc_dropped_frames > 0
+ if prepare_only:
+ cloudlog.error(f"skipping model eval. Dropped {vipc_dropped_frames} frames")
+
+ inputs:dict[str, np.ndarray] = {
+ 'desire': vec_desire,
+ 'traffic_convention': traffic_convention,
+ 'lateral_control_params': lateral_control_params,
+ **({'nav_features': nav_features, 'nav_instructions': nav_instructions} if model.navigation else {}),
+ **({'radar_tracks': radar_tracks} if model.radarless else {}),
+ }
+
+ mt1 = time.perf_counter()
+ model_output = model.run(buf_main, buf_extra, model_transform_main, model_transform_extra, inputs, prepare_only)
+ mt2 = time.perf_counter()
+ model_execution_time = mt2 - mt1
+
+ if model_output is not None:
+ modelv2_send = messaging.new_message('modelV2')
+ posenet_send = messaging.new_message('cameraOdometry')
+ fill_model_msg(modelv2_send, model_output, publish_state, meta_main.frame_id, meta_extra.frame_id, frame_id, frame_drop_ratio,
+ meta_main.timestamp_eof, timestamp_llk, model_execution_time, live_calib_seen, nav_enabled)
+
+ desire_state = modelv2_send.modelV2.meta.desireState
+ l_lane_change_prob = desire_state[log.Desire.laneChangeLeft]
+ r_lane_change_prob = desire_state[log.Desire.laneChangeRight]
+ lane_change_prob = l_lane_change_prob + r_lane_change_prob
+ DH.update(sm['carState'], sm['carControl'].latActive, lane_change_prob, sm['frogpilotPlan'], frogpilot_toggles)
+ modelv2_send.modelV2.meta.laneChangeState = DH.lane_change_state
+ modelv2_send.modelV2.meta.laneChangeDirection = DH.lane_change_direction
+ modelv2_send.modelV2.meta.turnDirection = DH.turn_direction
+
+ fill_pose_msg(posenet_send, model_output, meta_main.frame_id, vipc_dropped_frames, meta_main.timestamp_eof, live_calib_seen)
+ pm.send('modelV2', modelv2_send)
+ pm.send('cameraOdometry', posenet_send)
+
+ last_vipc_frame_id = meta_main.frame_id
+
+ # Update FrogPilot parameters
+ if sm['frogpilotPlan'].togglesUpdated:
+ frogpilot_toggles = get_frogpilot_toggles()
+
+if __name__ == "__main__":
+ try:
+ import argparse
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--demo', action='store_true', help='A boolean for demo mode.')
+ args = parser.parse_args()
+ main(demo=args.demo)
+ except KeyboardInterrupt:
+ cloudlog.warning(f"child {PROCESS_NAME} got SIGINT")
+ except Exception:
+ sentry.capture_exception()
+ raise
diff --git a/selfdrive/classic_modeld/constants.py b/selfdrive/classic_modeld/constants.py
new file mode 100644
index 000000000..c710d92b7
--- /dev/null
+++ b/selfdrive/classic_modeld/constants.py
@@ -0,0 +1,85 @@
+import numpy as np
+
+def index_function(idx, max_val=192, max_idx=32):
+ return (max_val) * ((idx/max_idx)**2)
+
+class ModelConstants:
+ # time and distance indices
+ IDX_N = 33
+ T_IDXS = [index_function(idx, max_val=10.0) for idx in range(IDX_N)]
+ X_IDXS = [index_function(idx, max_val=192.0) for idx in range(IDX_N)]
+ LEAD_T_IDXS = [0., 2., 4., 6., 8., 10.]
+ LEAD_T_OFFSETS = [0., 2., 4.]
+ META_T_IDXS = [2., 4., 6., 8., 10.]
+
+ # model inputs constants
+ MODEL_FREQ = 20
+ FEATURE_LEN = 512
+ HISTORY_BUFFER_LEN = 99
+ DESIRE_LEN = 8
+ TRAFFIC_CONVENTION_LEN = 2
+ NAV_FEATURE_LEN = 256
+ NAV_INSTRUCTION_LEN = 150
+ LAT_PLANNER_STATE_LEN = 4
+ LATERAL_CONTROL_PARAMS_LEN = 2
+ PREV_DESIRED_CURV_LEN = 1
+ RADAR_TRACKS_LEN = 64
+
+ # model outputs constants
+ FCW_THRESHOLDS_5MS2 = np.array([.05, .05, .15, .15, .15], dtype=np.float32)
+ FCW_THRESHOLDS_3MS2 = np.array([.7, .7], dtype=np.float32)
+ FCW_5MS2_PROBS_WIDTH = 5
+ FCW_3MS2_PROBS_WIDTH = 2
+
+ DISENGAGE_WIDTH = 5
+ POSE_WIDTH = 6
+ WIDE_FROM_DEVICE_WIDTH = 3
+ LEAD_WIDTH = 4
+ LANE_LINES_WIDTH = 2
+ ROAD_EDGES_WIDTH = 2
+ PLAN_WIDTH = 15
+ DESIRE_PRED_WIDTH = 8
+ LAT_PLANNER_SOLUTION_WIDTH = 4
+ DESIRED_CURV_WIDTH = 1
+ RADAR_TRACKS_WIDTH = 3
+
+ NUM_LANE_LINES = 4
+ NUM_ROAD_EDGES = 2
+
+ LEAD_TRAJ_LEN = 6
+ DESIRE_PRED_LEN = 4
+
+ PLAN_MHP_N = 5
+ LEAD_MHP_N = 2
+ PLAN_MHP_SELECTION = 1
+ LEAD_MHP_SELECTION = 3
+
+ FCW_THRESHOLD_5MS2_HIGH = 0.15
+ FCW_THRESHOLD_5MS2_LOW = 0.05
+ FCW_THRESHOLD_3MS2 = 0.7
+
+ CONFIDENCE_BUFFER_LEN = 5
+ RYG_GREEN = 0.01165
+ RYG_YELLOW = 0.06157
+
+# model outputs slices
+class Plan:
+ POSITION = slice(0, 3)
+ VELOCITY = slice(3, 6)
+ ACCELERATION = slice(6, 9)
+ T_FROM_CURRENT_EULER = slice(9, 12)
+ ORIENTATION_RATE = slice(12, 15)
+
+class Meta:
+ ENGAGED = slice(0, 1)
+ # next 2, 4, 6, 8, 10 seconds
+ GAS_DISENGAGE = slice(1, 36, 7)
+ BRAKE_DISENGAGE = slice(2, 36, 7)
+ STEER_OVERRIDE = slice(3, 36, 7)
+ HARD_BRAKE_3 = slice(4, 36, 7)
+ HARD_BRAKE_4 = slice(5, 36, 7)
+ HARD_BRAKE_5 = slice(6, 36, 7)
+ GAS_PRESS = slice(7, 36, 7)
+ # next 0, 2, 4, 6, 8, 10 seconds
+ LEFT_BLINKER = slice(36, 48, 2)
+ RIGHT_BLINKER = slice(37, 48, 2)
diff --git a/selfdrive/classic_modeld/dmonitoringmodeld.py b/selfdrive/classic_modeld/dmonitoringmodeld.py
new file mode 100644
index 000000000..3d736c0cb
--- /dev/null
+++ b/selfdrive/classic_modeld/dmonitoringmodeld.py
@@ -0,0 +1,156 @@
+#!/usr/bin/env python3
+import os
+import gc
+import math
+import time
+import ctypes
+import numpy as np
+from pathlib import Path
+
+from cereal import messaging
+from cereal.messaging import PubMaster, SubMaster
+from msgq.visionipc import VisionIpcClient, VisionStreamType, VisionBuf
+from openpilot.common.swaglog import cloudlog
+from openpilot.common.params import Params
+from openpilot.common.realtime import set_realtime_priority
+from openpilot.selfdrive.classic_modeld.runners import ModelRunner, Runtime
+from openpilot.selfdrive.classic_modeld.models.commonmodel_pyx import sigmoid
+
+CALIB_LEN = 3
+REG_SCALE = 0.25
+MODEL_WIDTH = 1440
+MODEL_HEIGHT = 960
+OUTPUT_SIZE = 84
+SEND_RAW_PRED = os.getenv('SEND_RAW_PRED')
+MODEL_PATHS = {
+ ModelRunner.SNPE: Path(__file__).parent / 'models/dmonitoring_model_q.dlc',
+ ModelRunner.ONNX: Path(__file__).parent / 'models/dmonitoring_model.onnx'}
+
+class DriverStateResult(ctypes.Structure):
+ _fields_ = [
+ ("face_orientation", ctypes.c_float*3),
+ ("face_position", ctypes.c_float*3),
+ ("face_orientation_std", ctypes.c_float*3),
+ ("face_position_std", ctypes.c_float*3),
+ ("face_prob", ctypes.c_float),
+ ("_unused_a", ctypes.c_float*8),
+ ("left_eye_prob", ctypes.c_float),
+ ("_unused_b", ctypes.c_float*8),
+ ("right_eye_prob", ctypes.c_float),
+ ("left_blink_prob", ctypes.c_float),
+ ("right_blink_prob", ctypes.c_float),
+ ("sunglasses_prob", ctypes.c_float),
+ ("occluded_prob", ctypes.c_float),
+ ("ready_prob", ctypes.c_float*4),
+ ("not_ready_prob", ctypes.c_float*2)]
+
+class DMonitoringModelResult(ctypes.Structure):
+ _fields_ = [
+ ("driver_state_lhd", DriverStateResult),
+ ("driver_state_rhd", DriverStateResult),
+ ("poor_vision_prob", ctypes.c_float),
+ ("wheel_on_right_prob", ctypes.c_float)]
+
+class ModelState:
+ inputs: dict[str, np.ndarray]
+ output: np.ndarray
+ model: ModelRunner
+
+ def __init__(self):
+ assert ctypes.sizeof(DMonitoringModelResult) == OUTPUT_SIZE * ctypes.sizeof(ctypes.c_float)
+ self.output = np.zeros(OUTPUT_SIZE, dtype=np.float32)
+ self.inputs = {
+ 'input_img': np.zeros(MODEL_HEIGHT * MODEL_WIDTH, dtype=np.uint8),
+ 'calib': np.zeros(CALIB_LEN, dtype=np.float32)}
+
+ self.model = ModelRunner(MODEL_PATHS, self.output, Runtime.DSP, True, None)
+ self.model.addInput("input_img", None)
+ self.model.addInput("calib", self.inputs['calib'])
+
+ def run(self, buf:VisionBuf, calib:np.ndarray) -> tuple[np.ndarray, float]:
+ self.inputs['calib'][:] = calib
+
+ v_offset = buf.height - MODEL_HEIGHT
+ h_offset = (buf.width - MODEL_WIDTH) // 2
+ buf_data = buf.data.reshape(-1, buf.stride)
+ input_data = self.inputs['input_img'].reshape(MODEL_HEIGHT, MODEL_WIDTH)
+ input_data[:] = buf_data[v_offset:v_offset+MODEL_HEIGHT, h_offset:h_offset+MODEL_WIDTH]
+
+ t1 = time.perf_counter()
+ self.model.setInputBuffer("input_img", self.inputs['input_img'].view(np.float32))
+ self.model.execute()
+ t2 = time.perf_counter()
+ return self.output, t2 - t1
+
+
+def fill_driver_state(msg, ds_result: DriverStateResult):
+ msg.faceOrientation = [x * REG_SCALE for x in ds_result.face_orientation]
+ msg.faceOrientationStd = [math.exp(x) for x in ds_result.face_orientation_std]
+ msg.facePosition = [x * REG_SCALE for x in ds_result.face_position[:2]]
+ msg.facePositionStd = [math.exp(x) for x in ds_result.face_position_std[:2]]
+ msg.faceProb = sigmoid(ds_result.face_prob)
+ msg.leftEyeProb = sigmoid(ds_result.left_eye_prob)
+ msg.rightEyeProb = sigmoid(ds_result.right_eye_prob)
+ msg.leftBlinkProb = sigmoid(ds_result.left_blink_prob)
+ msg.rightBlinkProb = sigmoid(ds_result.right_blink_prob)
+ msg.sunglassesProb = sigmoid(ds_result.sunglasses_prob)
+ msg.occludedProb = sigmoid(ds_result.occluded_prob)
+ msg.readyProb = [sigmoid(x) for x in ds_result.ready_prob]
+ msg.notReadyProb = [sigmoid(x) for x in ds_result.not_ready_prob]
+
+def get_driverstate_packet(model_output: np.ndarray, frame_id: int, location_ts: int, execution_time: float, dsp_execution_time: float):
+ model_result = ctypes.cast(model_output.ctypes.data, ctypes.POINTER(DMonitoringModelResult)).contents
+ msg = messaging.new_message('driverStateV2', valid=True)
+ ds = msg.driverStateV2
+ ds.frameId = frame_id
+ ds.modelExecutionTime = execution_time
+ ds.dspExecutionTime = dsp_execution_time
+ ds.poorVisionProb = sigmoid(model_result.poor_vision_prob)
+ ds.wheelOnRightProb = sigmoid(model_result.wheel_on_right_prob)
+ ds.rawPredictions = model_output.tobytes() if SEND_RAW_PRED else b''
+ fill_driver_state(ds.leftDriverData, model_result.driver_state_lhd)
+ fill_driver_state(ds.rightDriverData, model_result.driver_state_rhd)
+ return msg
+
+
+def main():
+ gc.disable()
+ set_realtime_priority(1)
+
+ model = ModelState()
+ cloudlog.warning("models loaded, dmonitoringmodeld starting")
+ Params().put_bool("DmModelInitialized", True)
+
+ cloudlog.warning("connecting to driver stream")
+ vipc_client = VisionIpcClient("camerad", VisionStreamType.VISION_STREAM_DRIVER, True)
+ while not vipc_client.connect(False):
+ time.sleep(0.1)
+ assert vipc_client.is_connected()
+ cloudlog.warning(f"connected with buffer size: {vipc_client.buffer_len}")
+
+ sm = SubMaster(["liveCalibration"])
+ pm = PubMaster(["driverStateV2"])
+
+ calib = np.zeros(CALIB_LEN, dtype=np.float32)
+ # last = 0
+
+ while True:
+ buf = vipc_client.recv()
+ if buf is None:
+ continue
+
+ sm.update(0)
+ if sm.updated["liveCalibration"]:
+ calib[:] = np.array(sm["liveCalibration"].rpyCalib)
+
+ t1 = time.perf_counter()
+ model_output, dsp_execution_time = model.run(buf, calib)
+ t2 = time.perf_counter()
+
+ pm.send("driverStateV2", get_driverstate_packet(model_output, vipc_client.frame_id, vipc_client.timestamp_sof, t2 - t1, dsp_execution_time))
+ # print("dmonitoring process: %.2fms, from last %.2fms\n" % (t2 - t1, t1 - last))
+ # last = t1
+
+
+if __name__ == "__main__":
+ main()
diff --git a/selfdrive/classic_modeld/fill_model_msg.py b/selfdrive/classic_modeld/fill_model_msg.py
new file mode 100644
index 000000000..07f4d7235
--- /dev/null
+++ b/selfdrive/classic_modeld/fill_model_msg.py
@@ -0,0 +1,205 @@
+import os
+import capnp
+import numpy as np
+from cereal import log
+from openpilot.selfdrive.classic_modeld.constants import ModelConstants, Plan, Meta
+
+SEND_RAW_PRED = os.getenv('SEND_RAW_PRED')
+
+ConfidenceClass = log.ModelDataV2.ConfidenceClass
+
+class PublishState:
+ def __init__(self):
+ self.disengage_buffer = np.zeros(ModelConstants.CONFIDENCE_BUFFER_LEN*ModelConstants.DISENGAGE_WIDTH, dtype=np.float32)
+ self.prev_brake_5ms2_probs = np.zeros(ModelConstants.FCW_5MS2_PROBS_WIDTH, dtype=np.float32)
+ self.prev_brake_3ms2_probs = np.zeros(ModelConstants.FCW_3MS2_PROBS_WIDTH, dtype=np.float32)
+
+def fill_xyzt(builder, t, x, y, z, x_std=None, y_std=None, z_std=None):
+ builder.t = t
+ builder.x = x.tolist()
+ builder.y = y.tolist()
+ builder.z = z.tolist()
+ if x_std is not None:
+ builder.xStd = x_std.tolist()
+ if y_std is not None:
+ builder.yStd = y_std.tolist()
+ if z_std is not None:
+ builder.zStd = z_std.tolist()
+
+def fill_xyvat(builder, t, x, y, v, a, x_std=None, y_std=None, v_std=None, a_std=None):
+ builder.t = t
+ builder.x = x.tolist()
+ builder.y = y.tolist()
+ builder.v = v.tolist()
+ builder.a = a.tolist()
+ if x_std is not None:
+ builder.xStd = x_std.tolist()
+ if y_std is not None:
+ builder.yStd = y_std.tolist()
+ if v_std is not None:
+ builder.vStd = v_std.tolist()
+ if a_std is not None:
+ builder.aStd = a_std.tolist()
+
+def fill_model_msg(msg: capnp._DynamicStructBuilder, net_output_data: dict[str, np.ndarray], publish_state: PublishState,
+ vipc_frame_id: int, vipc_frame_id_extra: int, frame_id: int, frame_drop: float,
+ timestamp_eof: int, timestamp_llk: int, model_execution_time: float, valid: bool, nav_enabled: bool) -> None:
+ frame_age = frame_id - vipc_frame_id if frame_id > vipc_frame_id else 0
+ msg.valid = valid
+
+ modelV2 = msg.modelV2
+ modelV2.frameId = vipc_frame_id
+ modelV2.frameIdExtra = vipc_frame_id_extra
+ modelV2.frameAge = frame_age
+ modelV2.frameDropPerc = frame_drop * 100
+ modelV2.timestampEof = timestamp_eof
+ modelV2.modelExecutionTime = model_execution_time
+ modelV2.navEnabled = nav_enabled
+
+ # plan
+ position = modelV2.position
+ fill_xyzt(position, ModelConstants.T_IDXS, *net_output_data['plan'][0,:,Plan.POSITION].T, *net_output_data['plan_stds'][0,:,Plan.POSITION].T)
+ velocity = modelV2.velocity
+ fill_xyzt(velocity, ModelConstants.T_IDXS, *net_output_data['plan'][0,:,Plan.VELOCITY].T)
+ acceleration = modelV2.acceleration
+ fill_xyzt(acceleration, ModelConstants.T_IDXS, *net_output_data['plan'][0,:,Plan.ACCELERATION].T)
+ orientation = modelV2.orientation
+ fill_xyzt(orientation, ModelConstants.T_IDXS, *net_output_data['plan'][0,:,Plan.T_FROM_CURRENT_EULER].T)
+ orientation_rate = modelV2.orientationRate
+ fill_xyzt(orientation_rate, ModelConstants.T_IDXS, *net_output_data['plan'][0,:,Plan.ORIENTATION_RATE].T)
+
+ # lateral planning
+ action = modelV2.action
+ action.desiredCurvature = float(net_output_data['desired_curvature'][0,0])
+
+ # times at X_IDXS according to model plan
+ PLAN_T_IDXS = [np.nan] * ModelConstants.IDX_N
+ PLAN_T_IDXS[0] = 0.0
+ plan_x = net_output_data['plan'][0,:,Plan.POSITION][:,0].tolist()
+ for xidx in range(1, ModelConstants.IDX_N):
+ tidx = 0
+ # increment tidx until we find an element that's further away than the current xidx
+ while tidx < ModelConstants.IDX_N - 1 and plan_x[tidx+1] < ModelConstants.X_IDXS[xidx]:
+ tidx += 1
+ if tidx == ModelConstants.IDX_N - 1:
+ # if the Plan doesn't extend far enough, set plan_t to the max value (10s), then break
+ PLAN_T_IDXS[xidx] = ModelConstants.T_IDXS[ModelConstants.IDX_N - 1]
+ break
+ # interpolate to find `t` for the current xidx
+ current_x_val = plan_x[tidx]
+ next_x_val = plan_x[tidx+1]
+ p = (ModelConstants.X_IDXS[xidx] - current_x_val) / (next_x_val - current_x_val) if abs(next_x_val - current_x_val) > 1e-9 else float('nan')
+ PLAN_T_IDXS[xidx] = p * ModelConstants.T_IDXS[tidx+1] + (1 - p) * ModelConstants.T_IDXS[tidx]
+
+ # lane lines
+ modelV2.init('laneLines', 6)
+ lane_probs = net_output_data['lane_lines_prob'][0,1::2].tolist()
+ for i in range(6):
+ lane_line = modelV2.laneLines[i]
+ if i < 4:
+ fill_xyzt(lane_line, PLAN_T_IDXS, np.array(ModelConstants.X_IDXS), net_output_data['lane_lines'][0,i,:,0], net_output_data['lane_lines'][0,i,:,1])
+ elif i == 4:
+ if lane_probs[0] > 0:
+ leftLane_x = 0.5 * (net_output_data['lane_lines'][0,0,:,0] + net_output_data['lane_lines'][0,1,:,0])
+ leftLane_y = 0.5 * (net_output_data['lane_lines'][0,0,:,1] + net_output_data['lane_lines'][0,1,:,1])
+ fill_xyzt(lane_line, PLAN_T_IDXS, np.array(ModelConstants.X_IDXS), leftLane_x, leftLane_y)
+ else:
+ fill_xyzt(lane_line, PLAN_T_IDXS, np.empty((0,)), np.empty((0,)), np.empty((0,)))
+ elif i == 5:
+ if lane_probs[3] > 0:
+ rightLane_x = 0.5 * (net_output_data['lane_lines'][0,2,:,0] + net_output_data['lane_lines'][0,3,:,0])
+ rightLane_y = 0.5 * (net_output_data['lane_lines'][0,2,:,1] + net_output_data['lane_lines'][0,3,:,1])
+ fill_xyzt(lane_line, PLAN_T_IDXS, np.array(ModelConstants.X_IDXS), rightLane_x, rightLane_y)
+ else:
+ fill_xyzt(lane_line, PLAN_T_IDXS, np.empty((0,)), np.empty((0,)), np.empty((0,)))
+ modelV2.laneLineStds = net_output_data['lane_lines_stds'][0,:,0,0].tolist()
+ modelV2.laneLineProbs = lane_probs
+
+ # road edges
+ modelV2.init('roadEdges', 2)
+ for i in range(2):
+ road_edge = modelV2.roadEdges[i]
+ fill_xyzt(road_edge, PLAN_T_IDXS, np.array(ModelConstants.X_IDXS), net_output_data['road_edges'][0,i,:,0], net_output_data['road_edges'][0,i,:,1])
+ modelV2.roadEdgeStds = net_output_data['road_edges_stds'][0,:,0,0].tolist()
+
+ # leads
+ modelV2.init('leadsV3', 3)
+ for i in range(3):
+ lead = modelV2.leadsV3[i]
+ fill_xyvat(lead, ModelConstants.LEAD_T_IDXS, *net_output_data['lead'][0,i].T, *net_output_data['lead_stds'][0,i].T)
+ lead.prob = net_output_data['lead_prob'][0,i].tolist()
+ lead.probTime = ModelConstants.LEAD_T_OFFSETS[i]
+
+ # meta
+ meta = modelV2.meta
+ meta.desireState = net_output_data['desire_state'][0].reshape(-1).tolist()
+ meta.desirePrediction = net_output_data['desire_pred'][0].reshape(-1).tolist()
+ meta.engagedProb = net_output_data['meta'][0,Meta.ENGAGED].item()
+ meta.init('disengagePredictions')
+ disengage_predictions = meta.disengagePredictions
+ disengage_predictions.t = ModelConstants.META_T_IDXS
+ disengage_predictions.brakeDisengageProbs = net_output_data['meta'][0,Meta.BRAKE_DISENGAGE].tolist()
+ disengage_predictions.gasDisengageProbs = net_output_data['meta'][0,Meta.GAS_DISENGAGE].tolist()
+ disengage_predictions.steerOverrideProbs = net_output_data['meta'][0,Meta.STEER_OVERRIDE].tolist()
+ disengage_predictions.brake3MetersPerSecondSquaredProbs = net_output_data['meta'][0,Meta.HARD_BRAKE_3].tolist()
+ disengage_predictions.brake4MetersPerSecondSquaredProbs = net_output_data['meta'][0,Meta.HARD_BRAKE_4].tolist()
+ disengage_predictions.brake5MetersPerSecondSquaredProbs = net_output_data['meta'][0,Meta.HARD_BRAKE_5].tolist()
+
+ publish_state.prev_brake_5ms2_probs[:-1] = publish_state.prev_brake_5ms2_probs[1:]
+ publish_state.prev_brake_5ms2_probs[-1] = net_output_data['meta'][0,Meta.HARD_BRAKE_5][0]
+ publish_state.prev_brake_3ms2_probs[:-1] = publish_state.prev_brake_3ms2_probs[1:]
+ publish_state.prev_brake_3ms2_probs[-1] = net_output_data['meta'][0,Meta.HARD_BRAKE_3][0]
+ hard_brake_predicted = (publish_state.prev_brake_5ms2_probs > ModelConstants.FCW_THRESHOLDS_5MS2).all() and \
+ (publish_state.prev_brake_3ms2_probs > ModelConstants.FCW_THRESHOLDS_3MS2).all()
+ meta.hardBrakePredicted = hard_brake_predicted.item()
+
+ # temporal pose
+ temporal_pose = modelV2.temporalPose
+ temporal_pose.trans = net_output_data['sim_pose'][0,:ModelConstants.POSE_WIDTH//2].tolist()
+ temporal_pose.transStd = net_output_data['sim_pose_stds'][0,:ModelConstants.POSE_WIDTH//2].tolist()
+ temporal_pose.rot = net_output_data['sim_pose'][0,ModelConstants.POSE_WIDTH//2:].tolist()
+ temporal_pose.rotStd = net_output_data['sim_pose_stds'][0,ModelConstants.POSE_WIDTH//2:].tolist()
+
+ # confidence
+ if vipc_frame_id % (2*ModelConstants.MODEL_FREQ) == 0:
+ # any disengage prob
+ brake_disengage_probs = net_output_data['meta'][0,Meta.BRAKE_DISENGAGE]
+ gas_disengage_probs = net_output_data['meta'][0,Meta.GAS_DISENGAGE]
+ steer_override_probs = net_output_data['meta'][0,Meta.STEER_OVERRIDE]
+ any_disengage_probs = 1-((1-brake_disengage_probs)*(1-gas_disengage_probs)*(1-steer_override_probs))
+ # independent disengage prob for each 2s slice
+ ind_disengage_probs = np.r_[any_disengage_probs[0], np.diff(any_disengage_probs) / (1 - any_disengage_probs[:-1])]
+ # rolling buf for 2, 4, 6, 8, 10s
+ publish_state.disengage_buffer[:-ModelConstants.DISENGAGE_WIDTH] = publish_state.disengage_buffer[ModelConstants.DISENGAGE_WIDTH:]
+ publish_state.disengage_buffer[-ModelConstants.DISENGAGE_WIDTH:] = ind_disengage_probs
+
+ score = 0.
+ for i in range(ModelConstants.DISENGAGE_WIDTH):
+ score += publish_state.disengage_buffer[i*ModelConstants.DISENGAGE_WIDTH+ModelConstants.DISENGAGE_WIDTH-1-i].item() / ModelConstants.DISENGAGE_WIDTH
+ if score < ModelConstants.RYG_GREEN:
+ modelV2.confidence = ConfidenceClass.green
+ elif score < ModelConstants.RYG_YELLOW:
+ modelV2.confidence = ConfidenceClass.yellow
+ else:
+ modelV2.confidence = ConfidenceClass.red
+
+ # raw prediction if enabled
+ if SEND_RAW_PRED:
+ modelV2.rawPredictions = net_output_data['raw_pred'].tobytes()
+
+def fill_pose_msg(msg: capnp._DynamicStructBuilder, net_output_data: dict[str, np.ndarray],
+ vipc_frame_id: int, vipc_dropped_frames: int, timestamp_eof: int, live_calib_seen: bool) -> None:
+ msg.valid = live_calib_seen & (vipc_dropped_frames < 1)
+ cameraOdometry = msg.cameraOdometry
+
+ cameraOdometry.frameId = vipc_frame_id
+ cameraOdometry.timestampEof = timestamp_eof
+
+ cameraOdometry.trans = net_output_data['pose'][0,:3].tolist()
+ cameraOdometry.rot = net_output_data['pose'][0,3:].tolist()
+ cameraOdometry.wideFromDeviceEuler = net_output_data['wide_from_device_euler'][0,:].tolist()
+ cameraOdometry.roadTransformTrans = net_output_data['road_transform'][0,:3].tolist()
+ cameraOdometry.transStd = net_output_data['pose_stds'][0,:3].tolist()
+ cameraOdometry.rotStd = net_output_data['pose_stds'][0,3:].tolist()
+ cameraOdometry.wideFromDeviceEulerStd = net_output_data['wide_from_device_euler_stds'][0,:].tolist()
+ cameraOdometry.roadTransformTransStd = net_output_data['road_transform_stds'][0,:3].tolist()
diff --git a/selfdrive/classic_modeld/get_model_metadata.py b/selfdrive/classic_modeld/get_model_metadata.py
new file mode 100644
index 000000000..144860204
--- /dev/null
+++ b/selfdrive/classic_modeld/get_model_metadata.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+import sys
+import pathlib
+import onnx
+import codecs
+import pickle
+
+def get_name_and_shape(value_info:onnx.ValueInfoProto) -> tuple[str, tuple[int,...]]:
+ shape = tuple([int(dim.dim_value) for dim in value_info.type.tensor_type.shape.dim])
+ name = value_info.name
+ return name, shape
+
+if __name__ == "__main__":
+ model_path = pathlib.Path(sys.argv[1])
+ model = onnx.load(str(model_path))
+ i = [x.key for x in model.metadata_props].index('output_slices')
+ output_slices = model.metadata_props[i].value
+
+ metadata = {}
+ metadata['output_slices'] = pickle.loads(codecs.decode(output_slices.encode(), "base64"))
+ metadata['input_shapes'] = dict([get_name_and_shape(x) for x in model.graph.input])
+ metadata['output_shapes'] = dict([get_name_and_shape(x) for x in model.graph.output])
+
+ metadata_path = model_path.parent / (model_path.stem + '_metadata.pkl')
+ with open(metadata_path, 'wb') as f:
+ pickle.dump(metadata, f)
+
+ print(f'saved metadata to {metadata_path}')
diff --git a/selfdrive/classic_modeld/libthneed.so b/selfdrive/classic_modeld/libthneed.so
new file mode 100644
index 000000000..d55745b50
Binary files /dev/null and b/selfdrive/classic_modeld/libthneed.so differ
diff --git a/selfdrive/classic_modeld/models/README.md b/selfdrive/classic_modeld/models/README.md
new file mode 100644
index 000000000..fa12d6867
--- /dev/null
+++ b/selfdrive/classic_modeld/models/README.md
@@ -0,0 +1,62 @@
+## Neural networks in openpilot
+To view the architecture of the ONNX networks, you can use [netron](https://netron.app/)
+
+## Supercombo
+### Supercombo input format (Full size: 799906 x float32)
+* **image stream**
+ * Two consecutive images (256 * 512 * 3 in RGB) recorded at 20 Hz : 393216 = 2 * 6 * 128 * 256
+ * Each 256 * 512 image is represented in YUV420 with 6 channels : 6 * 128 * 256
+ * Channels 0,1,2,3 represent the full-res Y channel and are represented in numpy as Y[::2, ::2], Y[::2, 1::2], Y[1::2, ::2], and Y[1::2, 1::2]
+ * Channel 4 represents the half-res U channel
+ * Channel 5 represents the half-res V channel
+* **wide image stream**
+ * Two consecutive images (256 * 512 * 3 in RGB) recorded at 20 Hz : 393216 = 2 * 6 * 128 * 256
+ * Each 256 * 512 image is represented in YUV420 with 6 channels : 6 * 128 * 256
+ * Channels 0,1,2,3 represent the full-res Y channel and are represented in numpy as Y[::2, ::2], Y[::2, 1::2], Y[1::2, ::2], and Y[1::2, 1::2]
+ * Channel 4 represents the half-res U channel
+ * Channel 5 represents the half-res V channel
+* **desire**
+ * one-hot encoded buffer to command model to execute certain actions, bit needs to be sent for the past 5 seconds (at 20FPS) : 100 * 8
+* **traffic convention**
+ * one-hot encoded vector to tell model whether traffic is right-hand or left-hand traffic : 2
+* **feature buffer**
+ * A buffer of intermediate features that gets appended to the current feature to form a 5 seconds temporal context (at 20FPS) : 99 * 512
+
+
+### Supercombo output format (Full size: XXX x float32)
+Read [here](https://github.com/commaai/openpilot/blob/90af436a121164a51da9fa48d093c29f738adf6a/selfdrive/classic_modeld/models/driving.h#L236) for more.
+
+
+## Driver Monitoring Model
+* .onnx model can be run with onnx runtimes
+* .dlc file is a pre-quantized model and only runs on qualcomm DSPs
+
+### input format
+* single image W = 1440 H = 960 luminance channel (Y) from the planar YUV420 format:
+ * full input size is 1440 * 960 = 1382400
+ * normalized ranging from 0.0 to 1.0 in float32 (onnx runner) or ranging from 0 to 255 in uint8 (snpe runner)
+* camera calibration angles (roll, pitch, yaw) from liveCalibration: 3 x float32 inputs
+
+### output format
+* 84 x float32 outputs = 2 + 41 * 2 ([parsing example](https://github.com/commaai/openpilot/blob/22ce4e17ba0d3bfcf37f8255a4dd1dc683fe0c38/selfdrive/classic_modeld/models/dmonitoring.cc#L33))
+ * for each person in the front seats (2 * 41)
+ * face pose: 12 = 6 + 6
+ * face orientation [pitch, yaw, roll] in camera frame: 3
+ * face position [dx, dy] relative to image center: 2
+ * normalized face size: 1
+ * standard deviations for above outputs: 6
+ * face visible probability: 1
+ * eyes: 20 = (8 + 1) + (8 + 1) + 1 + 1
+ * eye position and size, and their standard deviations: 8
+ * eye visible probability: 1
+ * eye closed probability: 1
+ * wearing sunglasses probability: 1
+ * face occluded probability: 1
+ * touching wheel probability: 1
+ * paying attention probability: 1
+ * (deprecated) distracted probabilities: 2
+ * using phone probability: 1
+ * distracted probability: 1
+ * common outputs 2
+ * poor camera vision probability: 1
+ * left hand drive probability: 1
diff --git a/selfdrive/classic_modeld/models/__init__.py b/selfdrive/classic_modeld/models/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/selfdrive/classic_modeld/models/commonmodel.pxd b/selfdrive/classic_modeld/models/commonmodel.pxd
new file mode 100644
index 000000000..b67e866fb
--- /dev/null
+++ b/selfdrive/classic_modeld/models/commonmodel.pxd
@@ -0,0 +1,20 @@
+# distutils: language = c++
+
+from msgq.visionipc.visionipc cimport cl_device_id, cl_context, cl_mem
+
+cdef extern from "common/mat.h":
+ cdef struct mat3:
+ float v[9]
+
+cdef extern from "common/clutil.h":
+ cdef unsigned long CL_DEVICE_TYPE_DEFAULT
+ cl_device_id cl_get_device_id(unsigned long)
+ cl_context cl_create_context(cl_device_id)
+
+cdef extern from "selfdrive/classic_modeld/models/commonmodel.h":
+ float sigmoid(float)
+
+ cppclass ModelFrame:
+ int buf_size
+ ModelFrame(cl_device_id, cl_context)
+ float * prepare(cl_mem, int, int, int, int, mat3, cl_mem*)
diff --git a/selfdrive/classic_modeld/models/commonmodel_pyx.cpp b/selfdrive/classic_modeld/models/commonmodel_pyx.cpp
new file mode 100644
index 000000000..11f638902
--- /dev/null
+++ b/selfdrive/classic_modeld/models/commonmodel_pyx.cpp
@@ -0,0 +1,32064 @@
+/* Generated by Cython 3.0.8 */
+
+/* BEGIN: Cython Metadata
+{
+ "distutils": {
+ "depends": [
+ "common/clutil.h",
+ "common/mat.h",
+ "msgq/visionipc/visionbuf.h",
+ "msgq/visionipc/visionipc.h",
+ "msgq/visionipc/visionipc_client.h",
+ "msgq/visionipc/visionipc_server.h",
+ "selfdrive/classic_modeld/models/commonmodel.h"
+ ],
+ "language": "c++",
+ "name": "selfdrive.classic_modeld.models.commonmodel_pyx",
+ "sources": [
+ "/data/openpilot/selfdrive/classic_modeld/models/commonmodel_pyx.pyx"
+ ]
+ },
+ "module_name": "selfdrive.classic_modeld.models.commonmodel_pyx"
+}
+END: Cython Metadata */
+
+#ifndef PY_SSIZE_T_CLEAN
+#define PY_SSIZE_T_CLEAN
+#endif /* PY_SSIZE_T_CLEAN */
+#if defined(CYTHON_LIMITED_API) && 0
+ #ifndef Py_LIMITED_API
+ #if CYTHON_LIMITED_API+0 > 0x03030000
+ #define Py_LIMITED_API CYTHON_LIMITED_API
+ #else
+ #define Py_LIMITED_API 0x03030000
+ #endif
+ #endif
+#endif
+
+#include "Python.h"
+#ifndef Py_PYTHON_H
+ #error Python headers needed to compile C extensions, please install development version of Python.
+#elif PY_VERSION_HEX < 0x02070000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
+ #error Cython requires Python 2.7+ or Python 3.3+.
+#else
+#if defined(CYTHON_LIMITED_API) && CYTHON_LIMITED_API
+#define __PYX_EXTRA_ABI_MODULE_NAME "limited"
+#else
+#define __PYX_EXTRA_ABI_MODULE_NAME ""
+#endif
+#define CYTHON_ABI "3_0_8" __PYX_EXTRA_ABI_MODULE_NAME
+#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
+#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."
+#define CYTHON_HEX_VERSION 0x030008F0
+#define CYTHON_FUTURE_DIVISION 1
+#include
+#ifndef offsetof
+ #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
+#endif
+#if !defined(_WIN32) && !defined(WIN32) && !defined(MS_WINDOWS)
+ #ifndef __stdcall
+ #define __stdcall
+ #endif
+ #ifndef __cdecl
+ #define __cdecl
+ #endif
+ #ifndef __fastcall
+ #define __fastcall
+ #endif
+#endif
+#ifndef DL_IMPORT
+ #define DL_IMPORT(t) t
+#endif
+#ifndef DL_EXPORT
+ #define DL_EXPORT(t) t
+#endif
+#define __PYX_COMMA ,
+#ifndef HAVE_LONG_LONG
+ #define HAVE_LONG_LONG
+#endif
+#ifndef PY_LONG_LONG
+ #define PY_LONG_LONG LONG_LONG
+#endif
+#ifndef Py_HUGE_VAL
+ #define Py_HUGE_VAL HUGE_VAL
+#endif
+#define __PYX_LIMITED_VERSION_HEX PY_VERSION_HEX
+#if defined(GRAALVM_PYTHON)
+ /* For very preliminary testing purposes. Most variables are set the same as PyPy.
+ The existence of this section does not imply that anything works or is even tested */
+ #define CYTHON_COMPILING_IN_PYPY 0
+ #define CYTHON_COMPILING_IN_CPYTHON 0
+ #define CYTHON_COMPILING_IN_LIMITED_API 0
+ #define CYTHON_COMPILING_IN_GRAAL 1
+ #define CYTHON_COMPILING_IN_NOGIL 0
+ #undef CYTHON_USE_TYPE_SLOTS
+ #define CYTHON_USE_TYPE_SLOTS 0
+ #undef CYTHON_USE_TYPE_SPECS
+ #define CYTHON_USE_TYPE_SPECS 0
+ #undef CYTHON_USE_PYTYPE_LOOKUP
+ #define CYTHON_USE_PYTYPE_LOOKUP 0
+ #if PY_VERSION_HEX < 0x03050000
+ #undef CYTHON_USE_ASYNC_SLOTS
+ #define CYTHON_USE_ASYNC_SLOTS 0
+ #elif !defined(CYTHON_USE_ASYNC_SLOTS)
+ #define CYTHON_USE_ASYNC_SLOTS 1
+ #endif
+ #undef CYTHON_USE_PYLIST_INTERNALS
+ #define CYTHON_USE_PYLIST_INTERNALS 0
+ #undef CYTHON_USE_UNICODE_INTERNALS
+ #define CYTHON_USE_UNICODE_INTERNALS 0
+ #undef CYTHON_USE_UNICODE_WRITER
+ #define CYTHON_USE_UNICODE_WRITER 0
+ #undef CYTHON_USE_PYLONG_INTERNALS
+ #define CYTHON_USE_PYLONG_INTERNALS 0
+ #undef CYTHON_AVOID_BORROWED_REFS
+ #define CYTHON_AVOID_BORROWED_REFS 1
+ #undef CYTHON_ASSUME_SAFE_MACROS
+ #define CYTHON_ASSUME_SAFE_MACROS 0
+ #undef CYTHON_UNPACK_METHODS
+ #define CYTHON_UNPACK_METHODS 0
+ #undef CYTHON_FAST_THREAD_STATE
+ #define CYTHON_FAST_THREAD_STATE 0
+ #undef CYTHON_FAST_GIL
+ #define CYTHON_FAST_GIL 0
+ #undef CYTHON_METH_FASTCALL
+ #define CYTHON_METH_FASTCALL 0
+ #undef CYTHON_FAST_PYCALL
+ #define CYTHON_FAST_PYCALL 0
+ #ifndef CYTHON_PEP487_INIT_SUBCLASS
+ #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3)
+ #endif
+ #undef CYTHON_PEP489_MULTI_PHASE_INIT
+ #define CYTHON_PEP489_MULTI_PHASE_INIT 1
+ #undef CYTHON_USE_MODULE_STATE
+ #define CYTHON_USE_MODULE_STATE 0
+ #undef CYTHON_USE_TP_FINALIZE
+ #define CYTHON_USE_TP_FINALIZE 0
+ #undef CYTHON_USE_DICT_VERSIONS
+ #define CYTHON_USE_DICT_VERSIONS 0
+ #undef CYTHON_USE_EXC_INFO_STACK
+ #define CYTHON_USE_EXC_INFO_STACK 0
+ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
+ #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
+ #endif
+#elif defined(PYPY_VERSION)
+ #define CYTHON_COMPILING_IN_PYPY 1
+ #define CYTHON_COMPILING_IN_CPYTHON 0
+ #define CYTHON_COMPILING_IN_LIMITED_API 0
+ #define CYTHON_COMPILING_IN_GRAAL 0
+ #define CYTHON_COMPILING_IN_NOGIL 0
+ #undef CYTHON_USE_TYPE_SLOTS
+ #define CYTHON_USE_TYPE_SLOTS 0
+ #ifndef CYTHON_USE_TYPE_SPECS
+ #define CYTHON_USE_TYPE_SPECS 0
+ #endif
+ #undef CYTHON_USE_PYTYPE_LOOKUP
+ #define CYTHON_USE_PYTYPE_LOOKUP 0
+ #if PY_VERSION_HEX < 0x03050000
+ #undef CYTHON_USE_ASYNC_SLOTS
+ #define CYTHON_USE_ASYNC_SLOTS 0
+ #elif !defined(CYTHON_USE_ASYNC_SLOTS)
+ #define CYTHON_USE_ASYNC_SLOTS 1
+ #endif
+ #undef CYTHON_USE_PYLIST_INTERNALS
+ #define CYTHON_USE_PYLIST_INTERNALS 0
+ #undef CYTHON_USE_UNICODE_INTERNALS
+ #define CYTHON_USE_UNICODE_INTERNALS 0
+ #undef CYTHON_USE_UNICODE_WRITER
+ #define CYTHON_USE_UNICODE_WRITER 0
+ #undef CYTHON_USE_PYLONG_INTERNALS
+ #define CYTHON_USE_PYLONG_INTERNALS 0
+ #undef CYTHON_AVOID_BORROWED_REFS
+ #define CYTHON_AVOID_BORROWED_REFS 1
+ #undef CYTHON_ASSUME_SAFE_MACROS
+ #define CYTHON_ASSUME_SAFE_MACROS 0
+ #undef CYTHON_UNPACK_METHODS
+ #define CYTHON_UNPACK_METHODS 0
+ #undef CYTHON_FAST_THREAD_STATE
+ #define CYTHON_FAST_THREAD_STATE 0
+ #undef CYTHON_FAST_GIL
+ #define CYTHON_FAST_GIL 0
+ #undef CYTHON_METH_FASTCALL
+ #define CYTHON_METH_FASTCALL 0
+ #undef CYTHON_FAST_PYCALL
+ #define CYTHON_FAST_PYCALL 0
+ #ifndef CYTHON_PEP487_INIT_SUBCLASS
+ #define CYTHON_PEP487_INIT_SUBCLASS (PY_MAJOR_VERSION >= 3)
+ #endif
+ #if PY_VERSION_HEX < 0x03090000
+ #undef CYTHON_PEP489_MULTI_PHASE_INIT
+ #define CYTHON_PEP489_MULTI_PHASE_INIT 0
+ #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
+ #define CYTHON_PEP489_MULTI_PHASE_INIT 1
+ #endif
+ #undef CYTHON_USE_MODULE_STATE
+ #define CYTHON_USE_MODULE_STATE 0
+ #undef CYTHON_USE_TP_FINALIZE
+ #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00)
+ #undef CYTHON_USE_DICT_VERSIONS
+ #define CYTHON_USE_DICT_VERSIONS 0
+ #undef CYTHON_USE_EXC_INFO_STACK
+ #define CYTHON_USE_EXC_INFO_STACK 0
+ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
+ #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
+ #endif
+#elif defined(CYTHON_LIMITED_API)
+ #ifdef Py_LIMITED_API
+ #undef __PYX_LIMITED_VERSION_HEX
+ #define __PYX_LIMITED_VERSION_HEX Py_LIMITED_API
+ #endif
+ #define CYTHON_COMPILING_IN_PYPY 0
+ #define CYTHON_COMPILING_IN_CPYTHON 0
+ #define CYTHON_COMPILING_IN_LIMITED_API 1
+ #define CYTHON_COMPILING_IN_GRAAL 0
+ #define CYTHON_COMPILING_IN_NOGIL 0
+ #undef CYTHON_CLINE_IN_TRACEBACK
+ #define CYTHON_CLINE_IN_TRACEBACK 0
+ #undef CYTHON_USE_TYPE_SLOTS
+ #define CYTHON_USE_TYPE_SLOTS 0
+ #undef CYTHON_USE_TYPE_SPECS
+ #define CYTHON_USE_TYPE_SPECS 1
+ #undef CYTHON_USE_PYTYPE_LOOKUP
+ #define CYTHON_USE_PYTYPE_LOOKUP 0
+ #undef CYTHON_USE_ASYNC_SLOTS
+ #define CYTHON_USE_ASYNC_SLOTS 0
+ #undef CYTHON_USE_PYLIST_INTERNALS
+ #define CYTHON_USE_PYLIST_INTERNALS 0
+ #undef CYTHON_USE_UNICODE_INTERNALS
+ #define CYTHON_USE_UNICODE_INTERNALS 0
+ #ifndef CYTHON_USE_UNICODE_WRITER
+ #define CYTHON_USE_UNICODE_WRITER 0
+ #endif
+ #undef CYTHON_USE_PYLONG_INTERNALS
+ #define CYTHON_USE_PYLONG_INTERNALS 0
+ #ifndef CYTHON_AVOID_BORROWED_REFS
+ #define CYTHON_AVOID_BORROWED_REFS 0
+ #endif
+ #undef CYTHON_ASSUME_SAFE_MACROS
+ #define CYTHON_ASSUME_SAFE_MACROS 0
+ #undef CYTHON_UNPACK_METHODS
+ #define CYTHON_UNPACK_METHODS 0
+ #undef CYTHON_FAST_THREAD_STATE
+ #define CYTHON_FAST_THREAD_STATE 0
+ #undef CYTHON_FAST_GIL
+ #define CYTHON_FAST_GIL 0
+ #undef CYTHON_METH_FASTCALL
+ #define CYTHON_METH_FASTCALL 0
+ #undef CYTHON_FAST_PYCALL
+ #define CYTHON_FAST_PYCALL 0
+ #ifndef CYTHON_PEP487_INIT_SUBCLASS
+ #define CYTHON_PEP487_INIT_SUBCLASS 1
+ #endif
+ #undef CYTHON_PEP489_MULTI_PHASE_INIT
+ #define CYTHON_PEP489_MULTI_PHASE_INIT 0
+ #undef CYTHON_USE_MODULE_STATE
+ #define CYTHON_USE_MODULE_STATE 1
+ #ifndef CYTHON_USE_TP_FINALIZE
+ #define CYTHON_USE_TP_FINALIZE 0
+ #endif
+ #undef CYTHON_USE_DICT_VERSIONS
+ #define CYTHON_USE_DICT_VERSIONS 0
+ #undef CYTHON_USE_EXC_INFO_STACK
+ #define CYTHON_USE_EXC_INFO_STACK 0
+ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
+ #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
+ #endif
+#elif defined(Py_GIL_DISABLED) || defined(Py_NOGIL)
+ #define CYTHON_COMPILING_IN_PYPY 0
+ #define CYTHON_COMPILING_IN_CPYTHON 0
+ #define CYTHON_COMPILING_IN_LIMITED_API 0
+ #define CYTHON_COMPILING_IN_GRAAL 0
+ #define CYTHON_COMPILING_IN_NOGIL 1
+ #ifndef CYTHON_USE_TYPE_SLOTS
+ #define CYTHON_USE_TYPE_SLOTS 1
+ #endif
+ #undef CYTHON_USE_PYTYPE_LOOKUP
+ #define CYTHON_USE_PYTYPE_LOOKUP 0
+ #ifndef CYTHON_USE_ASYNC_SLOTS
+ #define CYTHON_USE_ASYNC_SLOTS 1
+ #endif
+ #undef CYTHON_USE_PYLIST_INTERNALS
+ #define CYTHON_USE_PYLIST_INTERNALS 0
+ #ifndef CYTHON_USE_UNICODE_INTERNALS
+ #define CYTHON_USE_UNICODE_INTERNALS 1
+ #endif
+ #undef CYTHON_USE_UNICODE_WRITER
+ #define CYTHON_USE_UNICODE_WRITER 0
+ #undef CYTHON_USE_PYLONG_INTERNALS
+ #define CYTHON_USE_PYLONG_INTERNALS 0
+ #ifndef CYTHON_AVOID_BORROWED_REFS
+ #define CYTHON_AVOID_BORROWED_REFS 0
+ #endif
+ #ifndef CYTHON_ASSUME_SAFE_MACROS
+ #define CYTHON_ASSUME_SAFE_MACROS 1
+ #endif
+ #ifndef CYTHON_UNPACK_METHODS
+ #define CYTHON_UNPACK_METHODS 1
+ #endif
+ #undef CYTHON_FAST_THREAD_STATE
+ #define CYTHON_FAST_THREAD_STATE 0
+ #undef CYTHON_FAST_PYCALL
+ #define CYTHON_FAST_PYCALL 0
+ #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
+ #define CYTHON_PEP489_MULTI_PHASE_INIT 1
+ #endif
+ #ifndef CYTHON_USE_TP_FINALIZE
+ #define CYTHON_USE_TP_FINALIZE 1
+ #endif
+ #undef CYTHON_USE_DICT_VERSIONS
+ #define CYTHON_USE_DICT_VERSIONS 0
+ #undef CYTHON_USE_EXC_INFO_STACK
+ #define CYTHON_USE_EXC_INFO_STACK 0
+#else
+ #define CYTHON_COMPILING_IN_PYPY 0
+ #define CYTHON_COMPILING_IN_CPYTHON 1
+ #define CYTHON_COMPILING_IN_LIMITED_API 0
+ #define CYTHON_COMPILING_IN_GRAAL 0
+ #define CYTHON_COMPILING_IN_NOGIL 0
+ #ifndef CYTHON_USE_TYPE_SLOTS
+ #define CYTHON_USE_TYPE_SLOTS 1
+ #endif
+ #ifndef CYTHON_USE_TYPE_SPECS
+ #define CYTHON_USE_TYPE_SPECS 0
+ #endif
+ #ifndef CYTHON_USE_PYTYPE_LOOKUP
+ #define CYTHON_USE_PYTYPE_LOOKUP 1
+ #endif
+ #if PY_MAJOR_VERSION < 3
+ #undef CYTHON_USE_ASYNC_SLOTS
+ #define CYTHON_USE_ASYNC_SLOTS 0
+ #elif !defined(CYTHON_USE_ASYNC_SLOTS)
+ #define CYTHON_USE_ASYNC_SLOTS 1
+ #endif
+ #ifndef CYTHON_USE_PYLONG_INTERNALS
+ #define CYTHON_USE_PYLONG_INTERNALS 1
+ #endif
+ #ifndef CYTHON_USE_PYLIST_INTERNALS
+ #define CYTHON_USE_PYLIST_INTERNALS 1
+ #endif
+ #ifndef CYTHON_USE_UNICODE_INTERNALS
+ #define CYTHON_USE_UNICODE_INTERNALS 1
+ #endif
+ #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
+ #undef CYTHON_USE_UNICODE_WRITER
+ #define CYTHON_USE_UNICODE_WRITER 0
+ #elif !defined(CYTHON_USE_UNICODE_WRITER)
+ #define CYTHON_USE_UNICODE_WRITER 1
+ #endif
+ #ifndef CYTHON_AVOID_BORROWED_REFS
+ #define CYTHON_AVOID_BORROWED_REFS 0
+ #endif
+ #ifndef CYTHON_ASSUME_SAFE_MACROS
+ #define CYTHON_ASSUME_SAFE_MACROS 1
+ #endif
+ #ifndef CYTHON_UNPACK_METHODS
+ #define CYTHON_UNPACK_METHODS 1
+ #endif
+ #ifndef CYTHON_FAST_THREAD_STATE
+ #define CYTHON_FAST_THREAD_STATE 1
+ #endif
+ #ifndef CYTHON_FAST_GIL
+ #define CYTHON_FAST_GIL (PY_MAJOR_VERSION < 3 || PY_VERSION_HEX >= 0x03060000 && PY_VERSION_HEX < 0x030C00A6)
+ #endif
+ #ifndef CYTHON_METH_FASTCALL
+ #define CYTHON_METH_FASTCALL (PY_VERSION_HEX >= 0x030700A1)
+ #endif
+ #ifndef CYTHON_FAST_PYCALL
+ #define CYTHON_FAST_PYCALL 1
+ #endif
+ #ifndef CYTHON_PEP487_INIT_SUBCLASS
+ #define CYTHON_PEP487_INIT_SUBCLASS 1
+ #endif
+ #if PY_VERSION_HEX < 0x03050000
+ #undef CYTHON_PEP489_MULTI_PHASE_INIT
+ #define CYTHON_PEP489_MULTI_PHASE_INIT 0
+ #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
+ #define CYTHON_PEP489_MULTI_PHASE_INIT 1
+ #endif
+ #ifndef CYTHON_USE_MODULE_STATE
+ #define CYTHON_USE_MODULE_STATE 0
+ #endif
+ #if PY_VERSION_HEX < 0x030400a1
+ #undef CYTHON_USE_TP_FINALIZE
+ #define CYTHON_USE_TP_FINALIZE 0
+ #elif !defined(CYTHON_USE_TP_FINALIZE)
+ #define CYTHON_USE_TP_FINALIZE 1
+ #endif
+ #if PY_VERSION_HEX < 0x030600B1
+ #undef CYTHON_USE_DICT_VERSIONS
+ #define CYTHON_USE_DICT_VERSIONS 0
+ #elif !defined(CYTHON_USE_DICT_VERSIONS)
+ #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX < 0x030C00A5)
+ #endif
+ #if PY_VERSION_HEX < 0x030700A3
+ #undef CYTHON_USE_EXC_INFO_STACK
+ #define CYTHON_USE_EXC_INFO_STACK 0
+ #elif !defined(CYTHON_USE_EXC_INFO_STACK)
+ #define CYTHON_USE_EXC_INFO_STACK 1
+ #endif
+ #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
+ #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
+ #endif
+#endif
+#if !defined(CYTHON_FAST_PYCCALL)
+#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
+#endif
+#if !defined(CYTHON_VECTORCALL)
+#define CYTHON_VECTORCALL (CYTHON_FAST_PYCCALL && PY_VERSION_HEX >= 0x030800B1)
+#endif
+#define CYTHON_BACKPORT_VECTORCALL (CYTHON_METH_FASTCALL && PY_VERSION_HEX < 0x030800B1)
+#if CYTHON_USE_PYLONG_INTERNALS
+ #if PY_MAJOR_VERSION < 3
+ #include "longintrepr.h"
+ #endif
+ #undef SHIFT
+ #undef BASE
+ #undef MASK
+ #ifdef SIZEOF_VOID_P
+ enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
+ #endif
+#endif
+#ifndef __has_attribute
+ #define __has_attribute(x) 0
+#endif
+#ifndef __has_cpp_attribute
+ #define __has_cpp_attribute(x) 0
+#endif
+#ifndef CYTHON_RESTRICT
+ #if defined(__GNUC__)
+ #define CYTHON_RESTRICT __restrict__
+ #elif defined(_MSC_VER) && _MSC_VER >= 1400
+ #define CYTHON_RESTRICT __restrict
+ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define CYTHON_RESTRICT restrict
+ #else
+ #define CYTHON_RESTRICT
+ #endif
+#endif
+#ifndef CYTHON_UNUSED
+ #if defined(__cplusplus)
+ /* for clang __has_cpp_attribute(maybe_unused) is true even before C++17
+ * but leads to warnings with -pedantic, since it is a C++17 feature */
+ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
+ #if __has_cpp_attribute(maybe_unused)
+ #define CYTHON_UNUSED [[maybe_unused]]
+ #endif
+ #endif
+ #endif
+#endif
+#ifndef CYTHON_UNUSED
+# if defined(__GNUC__)
+# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
+# define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+# define CYTHON_UNUSED
+# endif
+#endif
+#ifndef CYTHON_UNUSED_VAR
+# if defined(__cplusplus)
+ template void CYTHON_UNUSED_VAR( const T& ) { }
+# else
+# define CYTHON_UNUSED_VAR(x) (void)(x)
+# endif
+#endif
+#ifndef CYTHON_MAYBE_UNUSED_VAR
+ #define CYTHON_MAYBE_UNUSED_VAR(x) CYTHON_UNUSED_VAR(x)
+#endif
+#ifndef CYTHON_NCP_UNUSED
+# if CYTHON_COMPILING_IN_CPYTHON
+# define CYTHON_NCP_UNUSED
+# else
+# define CYTHON_NCP_UNUSED CYTHON_UNUSED
+# endif
+#endif
+#ifndef CYTHON_USE_CPP_STD_MOVE
+ #if defined(__cplusplus) && (\
+ __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600))
+ #define CYTHON_USE_CPP_STD_MOVE 1
+ #else
+ #define CYTHON_USE_CPP_STD_MOVE 0
+ #endif
+#endif
+#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
+#ifdef _MSC_VER
+ #ifndef _MSC_STDINT_H_
+ #if _MSC_VER < 1300
+ typedef unsigned char uint8_t;
+ typedef unsigned short uint16_t;
+ typedef unsigned int uint32_t;
+ #else
+ typedef unsigned __int8 uint8_t;
+ typedef unsigned __int16 uint16_t;
+ typedef unsigned __int32 uint32_t;
+ #endif
+ #endif
+ #if _MSC_VER < 1300
+ #ifdef _WIN64
+ typedef unsigned long long __pyx_uintptr_t;
+ #else
+ typedef unsigned int __pyx_uintptr_t;
+ #endif
+ #else
+ #ifdef _WIN64
+ typedef unsigned __int64 __pyx_uintptr_t;
+ #else
+ typedef unsigned __int32 __pyx_uintptr_t;
+ #endif
+ #endif
+#else
+ #include
+ typedef uintptr_t __pyx_uintptr_t;
+#endif
+#ifndef CYTHON_FALLTHROUGH
+ #if defined(__cplusplus)
+ /* for clang __has_cpp_attribute(fallthrough) is true even before C++17
+ * but leads to warnings with -pedantic, since it is a C++17 feature */
+ #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
+ #if __has_cpp_attribute(fallthrough)
+ #define CYTHON_FALLTHROUGH [[fallthrough]]
+ #endif
+ #endif
+ #ifndef CYTHON_FALLTHROUGH
+ #if __has_cpp_attribute(clang::fallthrough)
+ #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
+ #elif __has_cpp_attribute(gnu::fallthrough)
+ #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
+ #endif
+ #endif
+ #endif
+ #ifndef CYTHON_FALLTHROUGH
+ #if __has_attribute(fallthrough)
+ #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
+ #else
+ #define CYTHON_FALLTHROUGH
+ #endif
+ #endif
+ #if defined(__clang__) && defined(__apple_build_version__)
+ #if __apple_build_version__ < 7000000
+ #undef CYTHON_FALLTHROUGH
+ #define CYTHON_FALLTHROUGH
+ #endif
+ #endif
+#endif
+#ifdef __cplusplus
+ template
+ struct __PYX_IS_UNSIGNED_IMPL {static const bool value = T(0) < T(-1);};
+ #define __PYX_IS_UNSIGNED(type) (__PYX_IS_UNSIGNED_IMPL::value)
+#else
+ #define __PYX_IS_UNSIGNED(type) (((type)-1) > 0)
+#endif
+#if CYTHON_COMPILING_IN_PYPY == 1
+ #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x030A0000)
+#else
+ #define __PYX_NEED_TP_PRINT_SLOT (PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000)
+#endif
+#define __PYX_REINTERPRET_FUNCION(func_pointer, other_pointer) ((func_pointer)(void(*)(void))(other_pointer))
+
+#ifndef __cplusplus
+ #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
+#endif
+#ifndef CYTHON_INLINE
+ #if defined(__clang__)
+ #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
+ #else
+ #define CYTHON_INLINE inline
+ #endif
+#endif
+template
+void __Pyx_call_destructor(T& x) {
+ x.~T();
+}
+template
+class __Pyx_FakeReference {
+ public:
+ __Pyx_FakeReference() : ptr(NULL) { }
+ __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { }
+ T *operator->() { return ptr; }
+ T *operator&() { return ptr; }
+ operator T&() { return *ptr; }
+ template bool operator ==(const U& other) const { return *ptr == other; }
+ template bool operator !=(const U& other) const { return *ptr != other; }
+ template bool operator==(const __Pyx_FakeReference& other) const { return *ptr == *other.ptr; }
+ template bool operator!=(const __Pyx_FakeReference& other) const { return *ptr != *other.ptr; }
+ private:
+ T *ptr;
+};
+
+#define __PYX_BUILD_PY_SSIZE_T "n"
+#define CYTHON_FORMAT_SSIZE_T "z"
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
+ #define __Pyx_DefaultClassType PyClass_Type
+ #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
+ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+#else
+ #define __Pyx_BUILTIN_MODULE_NAME "builtins"
+ #define __Pyx_DefaultClassType PyType_Type
+#if CYTHON_COMPILING_IN_LIMITED_API
+ static CYTHON_INLINE PyObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f,
+ PyObject *code, PyObject *c, PyObject* n, PyObject *v,
+ PyObject *fv, PyObject *cell, PyObject* fn,
+ PyObject *name, int fline, PyObject *lnos) {
+ PyObject *exception_table = NULL;
+ PyObject *types_module=NULL, *code_type=NULL, *result=NULL;
+ #if __PYX_LIMITED_VERSION_HEX < 0x030B0000
+ PyObject *version_info;
+ PyObject *py_minor_version = NULL;
+ #endif
+ long minor_version = 0;
+ PyObject *type, *value, *traceback;
+ PyErr_Fetch(&type, &value, &traceback);
+ #if __PYX_LIMITED_VERSION_HEX >= 0x030B0000
+ minor_version = 11;
+ #else
+ if (!(version_info = PySys_GetObject("version_info"))) goto end;
+ if (!(py_minor_version = PySequence_GetItem(version_info, 1))) goto end;
+ minor_version = PyLong_AsLong(py_minor_version);
+ Py_DECREF(py_minor_version);
+ if (minor_version == -1 && PyErr_Occurred()) goto end;
+ #endif
+ if (!(types_module = PyImport_ImportModule("types"))) goto end;
+ if (!(code_type = PyObject_GetAttrString(types_module, "CodeType"))) goto end;
+ if (minor_version <= 7) {
+ (void)p;
+ result = PyObject_CallFunction(code_type, "iiiiiOOOOOOiOO", a, k, l, s, f, code,
+ c, n, v, fn, name, fline, lnos, fv, cell);
+ } else if (minor_version <= 10) {
+ result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOiOO", a,p, k, l, s, f, code,
+ c, n, v, fn, name, fline, lnos, fv, cell);
+ } else {
+ if (!(exception_table = PyBytes_FromStringAndSize(NULL, 0))) goto end;
+ result = PyObject_CallFunction(code_type, "iiiiiiOOOOOOOiOO", a,p, k, l, s, f, code,
+ c, n, v, fn, name, name, fline, lnos, exception_table, fv, cell);
+ }
+ end:
+ Py_XDECREF(code_type);
+ Py_XDECREF(exception_table);
+ Py_XDECREF(types_module);
+ if (type) {
+ PyErr_Restore(type, value, traceback);
+ }
+ return result;
+ }
+ #ifndef CO_OPTIMIZED
+ #define CO_OPTIMIZED 0x0001
+ #endif
+ #ifndef CO_NEWLOCALS
+ #define CO_NEWLOCALS 0x0002
+ #endif
+ #ifndef CO_VARARGS
+ #define CO_VARARGS 0x0004
+ #endif
+ #ifndef CO_VARKEYWORDS
+ #define CO_VARKEYWORDS 0x0008
+ #endif
+ #ifndef CO_ASYNC_GENERATOR
+ #define CO_ASYNC_GENERATOR 0x0200
+ #endif
+ #ifndef CO_GENERATOR
+ #define CO_GENERATOR 0x0020
+ #endif
+ #ifndef CO_COROUTINE
+ #define CO_COROUTINE 0x0080
+ #endif
+#elif PY_VERSION_HEX >= 0x030B0000
+ static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int p, int k, int l, int s, int f,
+ PyObject *code, PyObject *c, PyObject* n, PyObject *v,
+ PyObject *fv, PyObject *cell, PyObject* fn,
+ PyObject *name, int fline, PyObject *lnos) {
+ PyCodeObject *result;
+ PyObject *empty_bytes = PyBytes_FromStringAndSize("", 0);
+ if (!empty_bytes) return NULL;
+ result =
+ #if PY_VERSION_HEX >= 0x030C0000
+ PyUnstable_Code_NewWithPosOnlyArgs
+ #else
+ PyCode_NewWithPosOnlyArgs
+ #endif
+ (a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, name, fline, lnos, empty_bytes);
+ Py_DECREF(empty_bytes);
+ return result;
+ }
+#elif PY_VERSION_HEX >= 0x030800B2 && !CYTHON_COMPILING_IN_PYPY
+ #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
+ PyCode_NewWithPosOnlyArgs(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+#else
+ #define __Pyx_PyCode_New(a, p, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
+ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
+#endif
+#endif
+#if PY_VERSION_HEX >= 0x030900A4 || defined(Py_IS_TYPE)
+ #define __Pyx_IS_TYPE(ob, type) Py_IS_TYPE(ob, type)
+#else
+ #define __Pyx_IS_TYPE(ob, type) (((const PyObject*)ob)->ob_type == (type))
+#endif
+#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_Is)
+ #define __Pyx_Py_Is(x, y) Py_Is(x, y)
+#else
+ #define __Pyx_Py_Is(x, y) ((x) == (y))
+#endif
+#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsNone)
+ #define __Pyx_Py_IsNone(ob) Py_IsNone(ob)
+#else
+ #define __Pyx_Py_IsNone(ob) __Pyx_Py_Is((ob), Py_None)
+#endif
+#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsTrue)
+ #define __Pyx_Py_IsTrue(ob) Py_IsTrue(ob)
+#else
+ #define __Pyx_Py_IsTrue(ob) __Pyx_Py_Is((ob), Py_True)
+#endif
+#if PY_VERSION_HEX >= 0x030A00B1 || defined(Py_IsFalse)
+ #define __Pyx_Py_IsFalse(ob) Py_IsFalse(ob)
+#else
+ #define __Pyx_Py_IsFalse(ob) __Pyx_Py_Is((ob), Py_False)
+#endif
+#define __Pyx_NoneAsNull(obj) (__Pyx_Py_IsNone(obj) ? NULL : (obj))
+#if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
+ #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
+#else
+ #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
+#endif
+#ifndef CO_COROUTINE
+ #define CO_COROUTINE 0x80
+#endif
+#ifndef CO_ASYNC_GENERATOR
+ #define CO_ASYNC_GENERATOR 0x200
+#endif
+#ifndef Py_TPFLAGS_CHECKTYPES
+ #define Py_TPFLAGS_CHECKTYPES 0
+#endif
+#ifndef Py_TPFLAGS_HAVE_INDEX
+ #define Py_TPFLAGS_HAVE_INDEX 0
+#endif
+#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
+ #define Py_TPFLAGS_HAVE_NEWBUFFER 0
+#endif
+#ifndef Py_TPFLAGS_HAVE_FINALIZE
+ #define Py_TPFLAGS_HAVE_FINALIZE 0
+#endif
+#ifndef Py_TPFLAGS_SEQUENCE
+ #define Py_TPFLAGS_SEQUENCE 0
+#endif
+#ifndef Py_TPFLAGS_MAPPING
+ #define Py_TPFLAGS_MAPPING 0
+#endif
+#ifndef METH_STACKLESS
+ #define METH_STACKLESS 0
+#endif
+#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
+ #ifndef METH_FASTCALL
+ #define METH_FASTCALL 0x80
+ #endif
+ typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
+ typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
+ Py_ssize_t nargs, PyObject *kwnames);
+#else
+ #define __Pyx_PyCFunctionFast _PyCFunctionFast
+ #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
+#endif
+#if CYTHON_METH_FASTCALL
+ #define __Pyx_METH_FASTCALL METH_FASTCALL
+ #define __Pyx_PyCFunction_FastCall __Pyx_PyCFunctionFast
+ #define __Pyx_PyCFunction_FastCallWithKeywords __Pyx_PyCFunctionFastWithKeywords
+#else
+ #define __Pyx_METH_FASTCALL METH_VARARGS
+ #define __Pyx_PyCFunction_FastCall PyCFunction
+ #define __Pyx_PyCFunction_FastCallWithKeywords PyCFunctionWithKeywords
+#endif
+#if CYTHON_VECTORCALL
+ #define __pyx_vectorcallfunc vectorcallfunc
+ #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET PY_VECTORCALL_ARGUMENTS_OFFSET
+ #define __Pyx_PyVectorcall_NARGS(n) PyVectorcall_NARGS((size_t)(n))
+#elif CYTHON_BACKPORT_VECTORCALL
+ typedef PyObject *(*__pyx_vectorcallfunc)(PyObject *callable, PyObject *const *args,
+ size_t nargsf, PyObject *kwnames);
+ #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET ((size_t)1 << (8 * sizeof(size_t) - 1))
+ #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(((size_t)(n)) & ~__Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET))
+#else
+ #define __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET 0
+ #define __Pyx_PyVectorcall_NARGS(n) ((Py_ssize_t)(n))
+#endif
+#if PY_MAJOR_VERSION >= 0x030900B1
+#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_CheckExact(func)
+#else
+#define __Pyx_PyCFunction_CheckExact(func) PyCFunction_Check(func)
+#endif
+#define __Pyx_CyOrPyCFunction_Check(func) PyCFunction_Check(func)
+#if CYTHON_COMPILING_IN_CPYTHON
+#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) (((PyCFunctionObject*)(func))->m_ml->ml_meth)
+#elif !CYTHON_COMPILING_IN_LIMITED_API
+#define __Pyx_CyOrPyCFunction_GET_FUNCTION(func) PyCFunction_GET_FUNCTION(func)
+#endif
+#if CYTHON_COMPILING_IN_CPYTHON
+#define __Pyx_CyOrPyCFunction_GET_FLAGS(func) (((PyCFunctionObject*)(func))->m_ml->ml_flags)
+static CYTHON_INLINE PyObject* __Pyx_CyOrPyCFunction_GET_SELF(PyObject *func) {
+ return (__Pyx_CyOrPyCFunction_GET_FLAGS(func) & METH_STATIC) ? NULL : ((PyCFunctionObject*)func)->m_self;
+}
+#endif
+static CYTHON_INLINE int __Pyx__IsSameCFunction(PyObject *func, void *cfunc) {
+#if CYTHON_COMPILING_IN_LIMITED_API
+ return PyCFunction_Check(func) && PyCFunction_GetFunction(func) == (PyCFunction) cfunc;
+#else
+ return PyCFunction_Check(func) && PyCFunction_GET_FUNCTION(func) == (PyCFunction) cfunc;
+#endif
+}
+#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCFunction(func, cfunc)
+#if __PYX_LIMITED_VERSION_HEX < 0x030900B1
+ #define __Pyx_PyType_FromModuleAndSpec(m, s, b) ((void)m, PyType_FromSpecWithBases(s, b))
+ typedef PyObject *(*__Pyx_PyCMethod)(PyObject *, PyTypeObject *, PyObject *const *, size_t, PyObject *);
+#else
+ #define __Pyx_PyType_FromModuleAndSpec(m, s, b) PyType_FromModuleAndSpec(m, s, b)
+ #define __Pyx_PyCMethod PyCMethod
+#endif
+#ifndef METH_METHOD
+ #define METH_METHOD 0x200
+#endif
+#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
+ #define PyObject_Malloc(s) PyMem_Malloc(s)
+ #define PyObject_Free(p) PyMem_Free(p)
+ #define PyObject_Realloc(p) PyMem_Realloc(p)
+#endif
+#if CYTHON_COMPILING_IN_LIMITED_API
+ #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
+ #define __Pyx_PyFrame_SetLineNumber(frame, lineno)
+#else
+ #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
+ #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
+#endif
+#if CYTHON_COMPILING_IN_LIMITED_API
+ #define __Pyx_PyThreadState_Current PyThreadState_Get()
+#elif !CYTHON_FAST_THREAD_STATE
+ #define __Pyx_PyThreadState_Current PyThreadState_GET()
+#elif PY_VERSION_HEX >= 0x030d00A1
+ #define __Pyx_PyThreadState_Current PyThreadState_GetUnchecked()
+#elif PY_VERSION_HEX >= 0x03060000
+ #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
+#elif PY_VERSION_HEX >= 0x03000000
+ #define __Pyx_PyThreadState_Current PyThreadState_GET()
+#else
+ #define __Pyx_PyThreadState_Current _PyThreadState_Current
+#endif
+#if CYTHON_COMPILING_IN_LIMITED_API
+static CYTHON_INLINE void *__Pyx_PyModule_GetState(PyObject *op)
+{
+ void *result;
+ result = PyModule_GetState(op);
+ if (!result)
+ Py_FatalError("Couldn't find the module state");
+ return result;
+}
+#endif
+#define __Pyx_PyObject_GetSlot(obj, name, func_ctype) __Pyx_PyType_GetSlot(Py_TYPE(obj), name, func_ctype)
+#if CYTHON_COMPILING_IN_LIMITED_API
+ #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((func_ctype) PyType_GetSlot((type), Py_##name))
+#else
+ #define __Pyx_PyType_GetSlot(type, name, func_ctype) ((type)->name)
+#endif
+#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
+#include "pythread.h"
+#define Py_tss_NEEDS_INIT 0
+typedef int Py_tss_t;
+static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
+ *key = PyThread_create_key();
+ return 0;
+}
+static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
+ Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
+ *key = Py_tss_NEEDS_INIT;
+ return key;
+}
+static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
+ PyObject_Free(key);
+}
+static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
+ return *key != Py_tss_NEEDS_INIT;
+}
+static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
+ PyThread_delete_key(*key);
+ *key = Py_tss_NEEDS_INIT;
+}
+static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
+ return PyThread_set_key_value(*key, value);
+}
+static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
+ return PyThread_get_key_value(*key);
+}
+#endif
+#if PY_MAJOR_VERSION < 3
+ #if CYTHON_COMPILING_IN_PYPY
+ #if PYPY_VERSION_NUM < 0x07030600
+ #if defined(__cplusplus) && __cplusplus >= 201402L
+ [[deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")]]
+ #elif defined(__GNUC__) || defined(__clang__)
+ __attribute__ ((__deprecated__("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6")))
+ #elif defined(_MSC_VER)
+ __declspec(deprecated("`with nogil:` inside a nogil function will not release the GIL in PyPy2 < 7.3.6"))
+ #endif
+ static CYTHON_INLINE int PyGILState_Check(void) {
+ return 0;
+ }
+ #else // PYPY_VERSION_NUM < 0x07030600
+ #endif // PYPY_VERSION_NUM < 0x07030600
+ #else
+ static CYTHON_INLINE int PyGILState_Check(void) {
+ PyThreadState * tstate = _PyThreadState_Current;
+ return tstate && (tstate == PyGILState_GetThisThreadState());
+ }
+ #endif
+#endif
+#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030d0000 || defined(_PyDict_NewPresized)
+#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
+#else
+#define __Pyx_PyDict_NewPresized(n) PyDict_New()
+#endif
+#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
+#else
+ #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
+ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
+#endif
+#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX > 0x030600B4 && PY_VERSION_HEX < 0x030d0000 && CYTHON_USE_UNICODE_INTERNALS
+#define __Pyx_PyDict_GetItemStrWithError(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
+static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStr(PyObject *dict, PyObject *name) {
+ PyObject *res = __Pyx_PyDict_GetItemStrWithError(dict, name);
+ if (res == NULL) PyErr_Clear();
+ return res;
+}
+#elif PY_MAJOR_VERSION >= 3 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07020000)
+#define __Pyx_PyDict_GetItemStrWithError PyDict_GetItemWithError
+#define __Pyx_PyDict_GetItemStr PyDict_GetItem
+#else
+static CYTHON_INLINE PyObject * __Pyx_PyDict_GetItemStrWithError(PyObject *dict, PyObject *name) {
+#if CYTHON_COMPILING_IN_PYPY
+ return PyDict_GetItem(dict, name);
+#else
+ PyDictEntry *ep;
+ PyDictObject *mp = (PyDictObject*) dict;
+ long hash = ((PyStringObject *) name)->ob_shash;
+ assert(hash != -1);
+ ep = (mp->ma_lookup)(mp, name, hash);
+ if (ep == NULL) {
+ return NULL;
+ }
+ return ep->me_value;
+#endif
+}
+#define __Pyx_PyDict_GetItemStr PyDict_GetItem
+#endif
+#if CYTHON_USE_TYPE_SLOTS
+ #define __Pyx_PyType_GetFlags(tp) (((PyTypeObject *)tp)->tp_flags)
+ #define __Pyx_PyType_HasFeature(type, feature) ((__Pyx_PyType_GetFlags(type) & (feature)) != 0)
+ #define __Pyx_PyObject_GetIterNextFunc(obj) (Py_TYPE(obj)->tp_iternext)
+#else
+ #define __Pyx_PyType_GetFlags(tp) (PyType_GetFlags((PyTypeObject *)tp))
+ #define __Pyx_PyType_HasFeature(type, feature) PyType_HasFeature(type, feature)
+ #define __Pyx_PyObject_GetIterNextFunc(obj) PyIter_Next
+#endif
+#if CYTHON_COMPILING_IN_LIMITED_API
+ #define __Pyx_SetItemOnTypeDict(tp, k, v) PyObject_GenericSetAttr((PyObject*)tp, k, v)
+#else
+ #define __Pyx_SetItemOnTypeDict(tp, k, v) PyDict_SetItem(tp->tp_dict, k, v)
+#endif
+#if CYTHON_USE_TYPE_SPECS && PY_VERSION_HEX >= 0x03080000
+#define __Pyx_PyHeapTypeObject_GC_Del(obj) {\
+ PyTypeObject *type = Py_TYPE((PyObject*)obj);\
+ assert(__Pyx_PyType_HasFeature(type, Py_TPFLAGS_HEAPTYPE));\
+ PyObject_GC_Del(obj);\
+ Py_DECREF(type);\
+}
+#else
+#define __Pyx_PyHeapTypeObject_GC_Del(obj) PyObject_GC_Del(obj)
+#endif
+#if CYTHON_COMPILING_IN_LIMITED_API
+ #define CYTHON_PEP393_ENABLED 1
+ #define __Pyx_PyUnicode_READY(op) (0)
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GetLength(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_ReadChar(u, i)
+ #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((void)u, 1114111U)
+ #define __Pyx_PyUnicode_KIND(u) ((void)u, (0))
+ #define __Pyx_PyUnicode_DATA(u) ((void*)u)
+ #define __Pyx_PyUnicode_READ(k, d, i) ((void)k, PyUnicode_ReadChar((PyObject*)(d), i))
+ #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GetLength(u))
+#elif PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
+ #define CYTHON_PEP393_ENABLED 1
+ #if PY_VERSION_HEX >= 0x030C0000
+ #define __Pyx_PyUnicode_READY(op) (0)
+ #else
+ #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
+ 0 : _PyUnicode_Ready((PyObject *)(op)))
+ #endif
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
+ #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
+ #define __Pyx_PyUnicode_KIND(u) ((int)PyUnicode_KIND(u))
+ #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
+ #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
+ #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, (Py_UCS4) ch)
+ #if PY_VERSION_HEX >= 0x030C0000
+ #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
+ #else
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
+ #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
+ #else
+ #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
+ #endif
+ #endif
+#else
+ #define CYTHON_PEP393_ENABLED 0
+ #define PyUnicode_1BYTE_KIND 1
+ #define PyUnicode_2BYTE_KIND 2
+ #define PyUnicode_4BYTE_KIND 4
+ #define __Pyx_PyUnicode_READY(op) (0)
+ #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
+ #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
+ #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535U : 1114111U)
+ #define __Pyx_PyUnicode_KIND(u) ((int)sizeof(Py_UNICODE))
+ #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
+ #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
+ #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = (Py_UNICODE) ch)
+ #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
+#endif
+#if CYTHON_COMPILING_IN_PYPY
+ #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
+#else
+ #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
+ #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
+ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
+#endif
+#if CYTHON_COMPILING_IN_PYPY
+ #if !defined(PyUnicode_DecodeUnicodeEscape)
+ #define PyUnicode_DecodeUnicodeEscape(s, size, errors) PyUnicode_Decode(s, size, "unicode_escape", errors)
+ #endif
+ #if !defined(PyUnicode_Contains) || (PY_MAJOR_VERSION == 2 && PYPY_VERSION_NUM < 0x07030500)
+ #undef PyUnicode_Contains
+ #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
+ #endif
+ #if !defined(PyByteArray_Check)
+ #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
+ #endif
+ #if !defined(PyObject_Format)
+ #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
+ #endif
+#endif
+#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
+#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
+#else
+ #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
+#endif
+#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
+ #define PyObject_ASCII(o) PyObject_Repr(o)
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBaseString_Type PyUnicode_Type
+ #define PyStringObject PyUnicodeObject
+ #define PyString_Type PyUnicode_Type
+ #define PyString_Check PyUnicode_Check
+ #define PyString_CheckExact PyUnicode_CheckExact
+#ifndef PyObject_Unicode
+ #define PyObject_Unicode PyObject_Str
+#endif
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
+ #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
+#else
+ #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
+ #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
+#endif
+#if CYTHON_COMPILING_IN_CPYTHON
+ #define __Pyx_PySequence_ListKeepNew(obj)\
+ (likely(PyList_CheckExact(obj) && Py_REFCNT(obj) == 1) ? __Pyx_NewRef(obj) : PySequence_List(obj))
+#else
+ #define __Pyx_PySequence_ListKeepNew(obj) PySequence_List(obj)
+#endif
+#ifndef PySet_CheckExact
+ #define PySet_CheckExact(obj) __Pyx_IS_TYPE(obj, &PySet_Type)
+#endif
+#if PY_VERSION_HEX >= 0x030900A4
+ #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
+ #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
+#else
+ #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
+ #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
+#endif
+#if CYTHON_ASSUME_SAFE_MACROS
+ #define __Pyx_PySequence_ITEM(o, i) PySequence_ITEM(o, i)
+ #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
+ #define __Pyx_PyTuple_SET_ITEM(o, i, v) (PyTuple_SET_ITEM(o, i, v), (0))
+ #define __Pyx_PyList_SET_ITEM(o, i, v) (PyList_SET_ITEM(o, i, v), (0))
+ #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_GET_SIZE(o)
+ #define __Pyx_PyList_GET_SIZE(o) PyList_GET_SIZE(o)
+ #define __Pyx_PySet_GET_SIZE(o) PySet_GET_SIZE(o)
+ #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_GET_SIZE(o)
+ #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_GET_SIZE(o)
+#else
+ #define __Pyx_PySequence_ITEM(o, i) PySequence_GetItem(o, i)
+ #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
+ #define __Pyx_PyTuple_SET_ITEM(o, i, v) PyTuple_SetItem(o, i, v)
+ #define __Pyx_PyList_SET_ITEM(o, i, v) PyList_SetItem(o, i, v)
+ #define __Pyx_PyTuple_GET_SIZE(o) PyTuple_Size(o)
+ #define __Pyx_PyList_GET_SIZE(o) PyList_Size(o)
+ #define __Pyx_PySet_GET_SIZE(o) PySet_Size(o)
+ #define __Pyx_PyBytes_GET_SIZE(o) PyBytes_Size(o)
+ #define __Pyx_PyByteArray_GET_SIZE(o) PyByteArray_Size(o)
+#endif
+#if PY_VERSION_HEX >= 0x030d00A1
+ #define __Pyx_PyImport_AddModuleRef(name) PyImport_AddModuleRef(name)
+#else
+ static CYTHON_INLINE PyObject *__Pyx_PyImport_AddModuleRef(const char *name) {
+ PyObject *module = PyImport_AddModule(name);
+ Py_XINCREF(module);
+ return module;
+ }
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyIntObject PyLongObject
+ #define PyInt_Type PyLong_Type
+ #define PyInt_Check(op) PyLong_Check(op)
+ #define PyInt_CheckExact(op) PyLong_CheckExact(op)
+ #define __Pyx_Py3Int_Check(op) PyLong_Check(op)
+ #define __Pyx_Py3Int_CheckExact(op) PyLong_CheckExact(op)
+ #define PyInt_FromString PyLong_FromString
+ #define PyInt_FromUnicode PyLong_FromUnicode
+ #define PyInt_FromLong PyLong_FromLong
+ #define PyInt_FromSize_t PyLong_FromSize_t
+ #define PyInt_FromSsize_t PyLong_FromSsize_t
+ #define PyInt_AsLong PyLong_AsLong
+ #define PyInt_AS_LONG PyLong_AS_LONG
+ #define PyInt_AsSsize_t PyLong_AsSsize_t
+ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
+ #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
+ #define PyNumber_Int PyNumber_Long
+#else
+ #define __Pyx_Py3Int_Check(op) (PyLong_Check(op) || PyInt_Check(op))
+ #define __Pyx_Py3Int_CheckExact(op) (PyLong_CheckExact(op) || PyInt_CheckExact(op))
+#endif
+#if PY_MAJOR_VERSION >= 3
+ #define PyBoolObject PyLongObject
+#endif
+#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
+ #ifndef PyUnicode_InternFromString
+ #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
+ #endif
+#endif
+#if PY_VERSION_HEX < 0x030200A4
+ typedef long Py_hash_t;
+ #define __Pyx_PyInt_FromHash_t PyInt_FromLong
+ #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
+#else
+ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
+ #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
+#endif
+#if CYTHON_USE_ASYNC_SLOTS
+ #if PY_VERSION_HEX >= 0x030500B1
+ #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
+ #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
+ #else
+ #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
+ #endif
+#else
+ #define __Pyx_PyType_AsAsync(obj) NULL
+#endif
+#ifndef __Pyx_PyAsyncMethodsStruct
+ typedef struct {
+ unaryfunc am_await;
+ unaryfunc am_aiter;
+ unaryfunc am_anext;
+ } __Pyx_PyAsyncMethodsStruct;
+#endif
+
+#if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
+ #if !defined(_USE_MATH_DEFINES)
+ #define _USE_MATH_DEFINES
+ #endif
+#endif
+#include
+#ifdef NAN
+#define __PYX_NAN() ((float) NAN)
+#else
+static CYTHON_INLINE float __PYX_NAN() {
+ float value;
+ memset(&value, 0xFF, sizeof(value));
+ return value;
+}
+#endif
+#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
+#define __Pyx_truncl trunc
+#else
+#define __Pyx_truncl truncl
+#endif
+
+#define __PYX_MARK_ERR_POS(f_index, lineno) \
+ { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
+#define __PYX_ERR(f_index, lineno, Ln_error) \
+ { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
+
+#ifdef CYTHON_EXTERN_C
+ #undef __PYX_EXTERN_C
+ #define __PYX_EXTERN_C CYTHON_EXTERN_C
+#elif defined(__PYX_EXTERN_C)
+ #ifdef _MSC_VER
+ #pragma message ("Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.")
+ #else
+ #warning Please do not define the '__PYX_EXTERN_C' macro externally. Use 'CYTHON_EXTERN_C' instead.
+ #endif
+#else
+ #define __PYX_EXTERN_C extern "C++"
+#endif
+
+#define __PYX_HAVE__selfdrive__classic_modeld__models__commonmodel_pyx
+#define __PYX_HAVE_API__selfdrive__classic_modeld__models__commonmodel_pyx
+/* Early includes */
+#include
+#include
+#include "ios"
+#include "new"
+#include "stdexcept"
+#include "typeinfo"
+#include
+#include
+
+ #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600)
+ // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully
+ #include
+
+ namespace cython_std {
+ template typename std::remove_reference::type&& move(T& t) noexcept { return std::move(t); }
+ template typename std::remove_reference::type&& move(T&& t) noexcept { return std::move(t); }
+ }
+
+ #endif
+
+#include
+#include
+#include "msgq/visionipc/visionbuf.h"
+#include "msgq/visionipc/visionipc.h"
+#include "msgq/visionipc/visionipc_server.h"
+#include "msgq/visionipc/visionipc_client.h"
+#include
+
+ /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */
+
+#include "numpy/arrayobject.h"
+#include "numpy/ndarrayobject.h"
+#include "numpy/ndarraytypes.h"
+#include "numpy/arrayscalars.h"
+#include "numpy/ufuncobject.h"
+#include "common/mat.h"
+#include "common/clutil.h"
+#include "selfdrive/classic_modeld/models/commonmodel.h"
+#include "pythread.h"
+#include
+#ifdef _OPENMP
+#include
+#endif /* _OPENMP */
+
+#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
+#define CYTHON_WITHOUT_ASSERTIONS
+#endif
+
+typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
+ const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
+
+#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 1
+#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
+#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
+#define __PYX_DEFAULT_STRING_ENCODING "ascii"
+#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
+#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#define __Pyx_uchar_cast(c) ((unsigned char)c)
+#define __Pyx_long_cast(x) ((long)x)
+#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
+ (sizeof(type) < sizeof(Py_ssize_t)) ||\
+ (sizeof(type) > sizeof(Py_ssize_t) &&\
+ likely(v < (type)PY_SSIZE_T_MAX ||\
+ v == (type)PY_SSIZE_T_MAX) &&\
+ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
+ v == (type)PY_SSIZE_T_MIN))) ||\
+ (sizeof(type) == sizeof(Py_ssize_t) &&\
+ (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
+ v == (type)PY_SSIZE_T_MAX))) )
+static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
+ return (size_t) i < (size_t) limit;
+}
+#if defined (__cplusplus) && __cplusplus >= 201103L
+ #include
+ #define __Pyx_sst_abs(value) std::abs(value)
+#elif SIZEOF_INT >= SIZEOF_SIZE_T
+ #define __Pyx_sst_abs(value) abs(value)
+#elif SIZEOF_LONG >= SIZEOF_SIZE_T
+ #define __Pyx_sst_abs(value) labs(value)
+#elif defined (_MSC_VER)
+ #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
+#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+ #define __Pyx_sst_abs(value) llabs(value)
+#elif defined (__GNUC__)
+ #define __Pyx_sst_abs(value) __builtin_llabs(value)
+#else
+ #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
+#endif
+static CYTHON_INLINE Py_ssize_t __Pyx_ssize_strlen(const char *s);
+static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
+static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
+static CYTHON_INLINE PyObject* __Pyx_PyByteArray_FromString(const char*);
+#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
+#define __Pyx_PyBytes_FromString PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
+#if PY_MAJOR_VERSION < 3
+ #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
+#else
+ #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
+ #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
+#endif
+#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
+#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
+#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
+#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
+#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
+#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
+#define __Pyx_PyObject_AsWritableString(s) ((char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_AsWritableSString(s) ((signed char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*)(__pyx_uintptr_t) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
+#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
+#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
+#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
+#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
+#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
+#if CYTHON_COMPILING_IN_LIMITED_API
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const wchar_t *u)
+{
+ const wchar_t *u_end = u;
+ while (*u_end++) ;
+ return (size_t)(u_end - u - 1);
+}
+#else
+static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
+{
+ const Py_UNICODE *u_end = u;
+ while (*u_end++) ;
+ return (size_t)(u_end - u - 1);
+}
+#endif
+#define __Pyx_PyUnicode_FromOrdinal(o) PyUnicode_FromOrdinal((int)o)
+#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
+#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
+#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
+#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
+#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
+static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
+static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
+static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
+static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
+#define __Pyx_PySequence_Tuple(obj)\
+ (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
+static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
+static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
+static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
+#if CYTHON_ASSUME_SAFE_MACROS
+#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
+#else
+#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
+#endif
+#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
+#if PY_MAJOR_VERSION >= 3
+#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
+#else
+#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
+#endif
+#if CYTHON_USE_PYLONG_INTERNALS
+ #if PY_VERSION_HEX >= 0x030C00A7
+ #ifndef _PyLong_SIGN_MASK
+ #define _PyLong_SIGN_MASK 3
+ #endif
+ #ifndef _PyLong_NON_SIZE_BITS
+ #define _PyLong_NON_SIZE_BITS 3
+ #endif
+ #define __Pyx_PyLong_Sign(x) (((PyLongObject*)x)->long_value.lv_tag & _PyLong_SIGN_MASK)
+ #define __Pyx_PyLong_IsNeg(x) ((__Pyx_PyLong_Sign(x) & 2) != 0)
+ #define __Pyx_PyLong_IsNonNeg(x) (!__Pyx_PyLong_IsNeg(x))
+ #define __Pyx_PyLong_IsZero(x) (__Pyx_PyLong_Sign(x) & 1)
+ #define __Pyx_PyLong_IsPos(x) (__Pyx_PyLong_Sign(x) == 0)
+ #define __Pyx_PyLong_CompactValueUnsigned(x) (__Pyx_PyLong_Digits(x)[0])
+ #define __Pyx_PyLong_DigitCount(x) ((Py_ssize_t) (((PyLongObject*)x)->long_value.lv_tag >> _PyLong_NON_SIZE_BITS))
+ #define __Pyx_PyLong_SignedDigitCount(x)\
+ ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x))
+ #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue)
+ #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x)
+ #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x)
+ #else
+ #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS))
+ #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0])
+ #endif
+ typedef Py_ssize_t __Pyx_compact_pylong;
+ typedef size_t __Pyx_compact_upylong;
+ #else
+ #define __Pyx_PyLong_IsNeg(x) (Py_SIZE(x) < 0)
+ #define __Pyx_PyLong_IsNonNeg(x) (Py_SIZE(x) >= 0)
+ #define __Pyx_PyLong_IsZero(x) (Py_SIZE(x) == 0)
+ #define __Pyx_PyLong_IsPos(x) (Py_SIZE(x) > 0)
+ #define __Pyx_PyLong_CompactValueUnsigned(x) ((Py_SIZE(x) == 0) ? 0 : __Pyx_PyLong_Digits(x)[0])
+ #define __Pyx_PyLong_DigitCount(x) __Pyx_sst_abs(Py_SIZE(x))
+ #define __Pyx_PyLong_SignedDigitCount(x) Py_SIZE(x)
+ #define __Pyx_PyLong_IsCompact(x) (Py_SIZE(x) == 0 || Py_SIZE(x) == 1 || Py_SIZE(x) == -1)
+ #define __Pyx_PyLong_CompactValue(x)\
+ ((Py_SIZE(x) == 0) ? (sdigit) 0 : ((Py_SIZE(x) < 0) ? -(sdigit)__Pyx_PyLong_Digits(x)[0] : (sdigit)__Pyx_PyLong_Digits(x)[0]))
+ typedef sdigit __Pyx_compact_pylong;
+ typedef digit __Pyx_compact_upylong;
+ #endif
+ #if PY_VERSION_HEX >= 0x030C00A5
+ #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->long_value.ob_digit)
+ #else
+ #define __Pyx_PyLong_Digits(x) (((PyLongObject*)x)->ob_digit)
+ #endif
+#endif
+#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
+#include
+static int __Pyx_sys_getdefaultencoding_not_ascii;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ PyObject* ascii_chars_u = NULL;
+ PyObject* ascii_chars_b = NULL;
+ const char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ if (strcmp(default_encoding_c, "ascii") == 0) {
+ __Pyx_sys_getdefaultencoding_not_ascii = 0;
+ } else {
+ char ascii_chars[128];
+ int c;
+ for (c = 0; c < 128; c++) {
+ ascii_chars[c] = (char) c;
+ }
+ __Pyx_sys_getdefaultencoding_not_ascii = 1;
+ ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
+ if (!ascii_chars_u) goto bad;
+ ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
+ if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
+ PyErr_Format(
+ PyExc_ValueError,
+ "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
+ default_encoding_c);
+ goto bad;
+ }
+ Py_DECREF(ascii_chars_u);
+ Py_DECREF(ascii_chars_b);
+ }
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ Py_XDECREF(ascii_chars_u);
+ Py_XDECREF(ascii_chars_b);
+ return -1;
+}
+#endif
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
+#else
+#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
+#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
+#include
+static char* __PYX_DEFAULT_STRING_ENCODING;
+static int __Pyx_init_sys_getdefaultencoding_params(void) {
+ PyObject* sys;
+ PyObject* default_encoding = NULL;
+ char* default_encoding_c;
+ sys = PyImport_ImportModule("sys");
+ if (!sys) goto bad;
+ default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
+ Py_DECREF(sys);
+ if (!default_encoding) goto bad;
+ default_encoding_c = PyBytes_AsString(default_encoding);
+ if (!default_encoding_c) goto bad;
+ __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
+ if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
+ strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
+ Py_DECREF(default_encoding);
+ return 0;
+bad:
+ Py_XDECREF(default_encoding);
+ return -1;
+}
+#endif
+#endif
+
+
+/* Test for GCC > 2.95 */
+#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
+ #define likely(x) __builtin_expect(!!(x), 1)
+ #define unlikely(x) __builtin_expect(!!(x), 0)
+#else /* !__GNUC__ or GCC < 2.95 */
+ #define likely(x) (x)
+ #define unlikely(x) (x)
+#endif /* __GNUC__ */
+static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
+
+#if !CYTHON_USE_MODULE_STATE
+static PyObject *__pyx_m = NULL;
+#endif
+static int __pyx_lineno;
+static int __pyx_clineno = 0;
+static const char * __pyx_cfilenm = __FILE__;
+static const char *__pyx_filename;
+
+/* Header.proto */
+#if !defined(CYTHON_CCOMPLEX)
+ #if defined(__cplusplus)
+ #define CYTHON_CCOMPLEX 1
+ #elif (defined(_Complex_I) && !defined(_MSC_VER)) || ((defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_COMPLEX__) && !defined(_MSC_VER))
+ #define CYTHON_CCOMPLEX 1
+ #else
+ #define CYTHON_CCOMPLEX 0
+ #endif
+#endif
+#if CYTHON_CCOMPLEX
+ #ifdef __cplusplus
+ #include
+ #else
+ #include
+ #endif
+#endif
+#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
+ #undef _Complex_I
+ #define _Complex_I 1.0fj
+#endif
+
+/* #### Code section: filename_table ### */
+
+static const char *__pyx_f[] = {
+ "",
+ "selfdrive/classic_modeld/models/commonmodel_pyx.pyx",
+ "__init__.cython-30.pxd",
+ "msgq/visionipc/visionipc_pyx.pxd",
+ "type.pxd",
+};
+/* #### Code section: utility_code_proto_before_types ### */
+/* ForceInitThreads.proto */
+#ifndef __PYX_FORCE_INIT_THREADS
+ #define __PYX_FORCE_INIT_THREADS 0
+#endif
+
+/* NoFastGil.proto */
+#define __Pyx_PyGILState_Ensure PyGILState_Ensure
+#define __Pyx_PyGILState_Release PyGILState_Release
+#define __Pyx_FastGIL_Remember()
+#define __Pyx_FastGIL_Forget()
+#define __Pyx_FastGilFuncInit()
+
+/* BufferFormatStructs.proto */
+struct __Pyx_StructField_;
+#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
+typedef struct {
+ const char* name;
+ struct __Pyx_StructField_* fields;
+ size_t size;
+ size_t arraysize[8];
+ int ndim;
+ char typegroup;
+ char is_unsigned;
+ int flags;
+} __Pyx_TypeInfo;
+typedef struct __Pyx_StructField_ {
+ __Pyx_TypeInfo* type;
+ const char* name;
+ size_t offset;
+} __Pyx_StructField;
+typedef struct {
+ __Pyx_StructField* field;
+ size_t parent_offset;
+} __Pyx_BufFmt_StackElem;
+typedef struct {
+ __Pyx_StructField root;
+ __Pyx_BufFmt_StackElem* head;
+ size_t fmt_offset;
+ size_t new_count, enc_count;
+ size_t struct_alignment;
+ int is_complex;
+ char enc_type;
+ char new_packmode;
+ char enc_packmode;
+ char is_valid_array;
+} __Pyx_BufFmt_Context;
+
+/* Atomics.proto */
+#include
+#ifndef CYTHON_ATOMICS
+ #define CYTHON_ATOMICS 1
+#endif
+#define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS
+#define __pyx_atomic_int_type int
+#define __pyx_nonatomic_int_type int
+#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
+ (__STDC_VERSION__ >= 201112L) &&\
+ !defined(__STDC_NO_ATOMICS__))
+ #include
+#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
+ (__cplusplus >= 201103L) ||\
+ (defined(_MSC_VER) && _MSC_VER >= 1700)))
+ #include
+#endif
+#if CYTHON_ATOMICS && (defined(__STDC_VERSION__) &&\
+ (__STDC_VERSION__ >= 201112L) &&\
+ !defined(__STDC_NO_ATOMICS__) &&\
+ ATOMIC_INT_LOCK_FREE == 2)
+ #undef __pyx_atomic_int_type
+ #define __pyx_atomic_int_type atomic_int
+ #define __pyx_atomic_incr_aligned(value) atomic_fetch_add_explicit(value, 1, memory_order_relaxed)
+ #define __pyx_atomic_decr_aligned(value) atomic_fetch_sub_explicit(value, 1, memory_order_acq_rel)
+ #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
+ #pragma message ("Using standard C atomics")
+ #elif defined(__PYX_DEBUG_ATOMICS)
+ #warning "Using standard C atomics"
+ #endif
+#elif CYTHON_ATOMICS && (defined(__cplusplus) && (\
+ (__cplusplus >= 201103L) ||\
+\
+ (defined(_MSC_VER) && _MSC_VER >= 1700)) &&\
+ ATOMIC_INT_LOCK_FREE == 2)
+ #undef __pyx_atomic_int_type
+ #define __pyx_atomic_int_type std::atomic_int
+ #define __pyx_atomic_incr_aligned(value) std::atomic_fetch_add_explicit(value, 1, std::memory_order_relaxed)
+ #define __pyx_atomic_decr_aligned(value) std::atomic_fetch_sub_explicit(value, 1, std::memory_order_acq_rel)
+ #if defined(__PYX_DEBUG_ATOMICS) && defined(_MSC_VER)
+ #pragma message ("Using standard C++ atomics")
+ #elif defined(__PYX_DEBUG_ATOMICS)
+ #warning "Using standard C++ atomics"
+ #endif
+#elif CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\
+ (__GNUC_MINOR__ > 1 ||\
+ (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2))))
+ #define __pyx_atomic_incr_aligned(value) __sync_fetch_and_add(value, 1)
+ #define __pyx_atomic_decr_aligned(value) __sync_fetch_and_sub(value, 1)
+ #ifdef __PYX_DEBUG_ATOMICS
+ #warning "Using GNU atomics"
+ #endif
+#elif CYTHON_ATOMICS && defined(_MSC_VER)
+ #include
+ #undef __pyx_atomic_int_type
+ #define __pyx_atomic_int_type long
+ #undef __pyx_nonatomic_int_type
+ #define __pyx_nonatomic_int_type long
+ #pragma intrinsic (_InterlockedExchangeAdd)
+ #define __pyx_atomic_incr_aligned(value) _InterlockedExchangeAdd(value, 1)
+ #define __pyx_atomic_decr_aligned(value) _InterlockedExchangeAdd(value, -1)
+ #ifdef __PYX_DEBUG_ATOMICS
+ #pragma message ("Using MSVC atomics")
+ #endif
+#else
+ #undef CYTHON_ATOMICS
+ #define CYTHON_ATOMICS 0
+ #ifdef __PYX_DEBUG_ATOMICS
+ #warning "Not using atomics"
+ #endif
+#endif
+#if CYTHON_ATOMICS
+ #define __pyx_add_acquisition_count(memview)\
+ __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview))
+ #define __pyx_sub_acquisition_count(memview)\
+ __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview))
+#else
+ #define __pyx_add_acquisition_count(memview)\
+ __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
+ #define __pyx_sub_acquisition_count(memview)\
+ __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
+#endif
+
+/* MemviewSliceStruct.proto */
+struct __pyx_memoryview_obj;
+typedef struct {
+ struct __pyx_memoryview_obj *memview;
+ char *data;
+ Py_ssize_t shape[8];
+ Py_ssize_t strides[8];
+ Py_ssize_t suboffsets[8];
+} __Pyx_memviewslice;
+#define __Pyx_MemoryView_Len(m) (m.shape[0])
+
+/* #### Code section: numeric_typedefs ### */
+
+/* "../../usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":730
+ * # in Cython to enable them only on the right systems.
+ *
+ * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
+ * ctypedef npy_int16 int16_t
+ * ctypedef npy_int32 int32_t
+ */
+typedef npy_int8 __pyx_t_5numpy_int8_t;
+
+/* "../../usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":731
+ *
+ * ctypedef npy_int8 int8_t
+ * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
+ * ctypedef npy_int32 int32_t
+ * ctypedef npy_int64 int64_t
+ */
+typedef npy_int16 __pyx_t_5numpy_int16_t;
+
+/* "../../usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":732
+ * ctypedef npy_int8 int8_t
+ * ctypedef npy_int16 int16_t
+ * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
+ * ctypedef npy_int64 int64_t
+ * #ctypedef npy_int96 int96_t
+ */
+typedef npy_int32 __pyx_t_5numpy_int32_t;
+
+/* "../../usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":733
+ * ctypedef npy_int16 int16_t
+ * ctypedef npy_int32 int32_t
+ * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
+ * #ctypedef npy_int96 int96_t
+ * #ctypedef npy_int128 int128_t
+ */
+typedef npy_int64 __pyx_t_5numpy_int64_t;
+
+/* "../../usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":737
+ * #ctypedef npy_int128 int128_t
+ *
+ * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
+ * ctypedef npy_uint16 uint16_t
+ * ctypedef npy_uint32 uint32_t
+ */
+typedef npy_uint8 __pyx_t_5numpy_uint8_t;
+
+/* "../../usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":738
+ *
+ * ctypedef npy_uint8 uint8_t
+ * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
+ * ctypedef npy_uint32 uint32_t
+ * ctypedef npy_uint64 uint64_t
+ */
+typedef npy_uint16 __pyx_t_5numpy_uint16_t;
+
+/* "../../usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":739
+ * ctypedef npy_uint8 uint8_t
+ * ctypedef npy_uint16 uint16_t
+ * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
+ * ctypedef npy_uint64 uint64_t
+ * #ctypedef npy_uint96 uint96_t
+ */
+typedef npy_uint32 __pyx_t_5numpy_uint32_t;
+
+/* "../../usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":740
+ * ctypedef npy_uint16 uint16_t
+ * ctypedef npy_uint32 uint32_t
+ * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
+ * #ctypedef npy_uint96 uint96_t
+ * #ctypedef npy_uint128 uint128_t
+ */
+typedef npy_uint64 __pyx_t_5numpy_uint64_t;
+
+/* "../../usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":744
+ * #ctypedef npy_uint128 uint128_t
+ *
+ * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
+ * ctypedef npy_float64 float64_t
+ * #ctypedef npy_float80 float80_t
+ */
+typedef npy_float32 __pyx_t_5numpy_float32_t;
+
+/* "../../usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":745
+ *
+ * ctypedef npy_float32 float32_t
+ * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
+ * #ctypedef npy_float80 float80_t
+ * #ctypedef npy_float128 float128_t
+ */
+typedef npy_float64 __pyx_t_5numpy_float64_t;
+
+/* "../../usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":754
+ * # The int types are mapped a bit surprising --
+ * # numpy.int corresponds to 'l' and numpy.long to 'q'
+ * ctypedef npy_long int_t # <<<<<<<<<<<<<<
+ * ctypedef npy_longlong longlong_t
+ *
+ */
+typedef npy_long __pyx_t_5numpy_int_t;
+
+/* "../../usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":755
+ * # numpy.int corresponds to 'l' and numpy.long to 'q'
+ * ctypedef npy_long int_t
+ * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
+ *
+ * ctypedef npy_ulong uint_t
+ */
+typedef npy_longlong __pyx_t_5numpy_longlong_t;
+
+/* "../../usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":757
+ * ctypedef npy_longlong longlong_t
+ *
+ * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
+ * ctypedef npy_ulonglong ulonglong_t
+ *
+ */
+typedef npy_ulong __pyx_t_5numpy_uint_t;
+
+/* "../../usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":758
+ *
+ * ctypedef npy_ulong uint_t
+ * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
+ *
+ * ctypedef npy_intp intp_t
+ */
+typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
+
+/* "../../usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":760
+ * ctypedef npy_ulonglong ulonglong_t
+ *
+ * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
+ * ctypedef npy_uintp uintp_t
+ *
+ */
+typedef npy_intp __pyx_t_5numpy_intp_t;
+
+/* "../../usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":761
+ *
+ * ctypedef npy_intp intp_t
+ * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
+ *
+ * ctypedef npy_double float_t
+ */
+typedef npy_uintp __pyx_t_5numpy_uintp_t;
+
+/* "../../usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":763
+ * ctypedef npy_uintp uintp_t
+ *
+ * ctypedef npy_double float_t # <<<<<<<<<<<<<<
+ * ctypedef npy_double double_t
+ * ctypedef npy_longdouble longdouble_t
+ */
+typedef npy_double __pyx_t_5numpy_float_t;
+
+/* "../../usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":764
+ *
+ * ctypedef npy_double float_t
+ * ctypedef npy_double double_t # <<<<<<<<<<<<<<
+ * ctypedef npy_longdouble longdouble_t
+ *
+ */
+typedef npy_double __pyx_t_5numpy_double_t;
+
+/* "../../usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":765
+ * ctypedef npy_double float_t
+ * ctypedef npy_double double_t
+ * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
+ *
+ * ctypedef npy_cfloat cfloat_t
+ */
+typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
+/* #### Code section: complex_type_declarations ### */
+/* Declarations.proto */
+#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
+ #ifdef __cplusplus
+ typedef ::std::complex< float > __pyx_t_float_complex;
+ #else
+ typedef float _Complex __pyx_t_float_complex;
+ #endif
+#else
+ typedef struct { float real, imag; } __pyx_t_float_complex;
+#endif
+static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
+
+/* Declarations.proto */
+#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
+ #ifdef __cplusplus
+ typedef ::std::complex< double > __pyx_t_double_complex;
+ #else
+ typedef double _Complex __pyx_t_double_complex;
+ #endif
+#else
+ typedef struct { double real, imag; } __pyx_t_double_complex;
+#endif
+static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
+
+/* #### Code section: type_declarations ### */
+
+/*--- Type declarations ---*/
+struct __pyx_obj_4msgq_9visionipc_13visionipc_pyx_CLContext;
+struct __pyx_obj_4msgq_9visionipc_13visionipc_pyx_VisionBuf;
+struct __pyx_obj_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLContext;
+struct __pyx_obj_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLMem;
+struct __pyx_obj_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_ModelFrame;
+struct __pyx_array_obj;
+struct __pyx_MemviewEnum_obj;
+struct __pyx_memoryview_obj;
+struct __pyx_memoryviewslice_obj;
+
+/* "../../usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":767
+ * ctypedef npy_longdouble longdouble_t
+ *
+ * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
+ * ctypedef npy_cdouble cdouble_t
+ * ctypedef npy_clongdouble clongdouble_t
+ */
+typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
+
+/* "../../usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":768
+ *
+ * ctypedef npy_cfloat cfloat_t
+ * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
+ * ctypedef npy_clongdouble clongdouble_t
+ *
+ */
+typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
+
+/* "../../usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":769
+ * ctypedef npy_cfloat cfloat_t
+ * ctypedef npy_cdouble cdouble_t
+ * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
+ *
+ * ctypedef npy_cdouble complex_t
+ */
+typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
+
+/* "../../usr/local/pyenv/versions/3.11.4/lib/python3.11/site-packages/numpy/__init__.cython-30.pxd":771
+ * ctypedef npy_clongdouble clongdouble_t
+ *
+ * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
+ *
+ * cdef inline object PyArray_MultiIterNew1(a):
+ */
+typedef npy_cdouble __pyx_t_5numpy_complex_t;
+
+/* "msgq/visionipc/visionipc_pyx.pxd":7
+ * from .visionipc cimport cl_device_id, cl_context
+ *
+ * cdef class CLContext: # <<<<<<<<<<<<<<
+ * cdef cl_device_id device_id
+ * cdef cl_context context
+ */
+struct __pyx_obj_4msgq_9visionipc_13visionipc_pyx_CLContext {
+ PyObject_HEAD
+ cl_device_id device_id;
+ cl_context context;
+};
+
+
+/* "msgq/visionipc/visionipc_pyx.pxd":11
+ * cdef cl_context context
+ *
+ * cdef class VisionBuf: # <<<<<<<<<<<<<<
+ * cdef cppVisionBuf * buf
+ *
+ */
+struct __pyx_obj_4msgq_9visionipc_13visionipc_pyx_VisionBuf {
+ PyObject_HEAD
+ struct __pyx_vtabstruct_4msgq_9visionipc_13visionipc_pyx_VisionBuf *__pyx_vtab;
+ VisionBuf *buf;
+};
+
+
+/* "selfdrive/classic_modeld/models/commonmodel_pyx.pxd":6
+ * from msgq.visionipc.visionipc_pyx cimport CLContext as BaseCLContext
+ *
+ * cdef class CLContext(BaseCLContext): # <<<<<<<<<<<<<<
+ * pass
+ *
+ */
+struct __pyx_obj_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLContext {
+ struct __pyx_obj_4msgq_9visionipc_13visionipc_pyx_CLContext __pyx_base;
+};
+
+
+/* "selfdrive/classic_modeld/models/commonmodel_pyx.pxd":9
+ * pass
+ *
+ * cdef class CLMem: # <<<<<<<<<<<<<<
+ * cdef cl_mem * mem
+ *
+ */
+struct __pyx_obj_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLMem {
+ PyObject_HEAD
+ struct __pyx_vtabstruct_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLMem *__pyx_vtab;
+ cl_mem *mem;
+};
+
+
+/* "selfdrive/classic_modeld/models/commonmodel_pyx.pyx":28
+ * return mem
+ *
+ * cdef class ModelFrame: # <<<<<<<<<<<<<<
+ * cdef cppModelFrame * frame
+ *
+ */
+struct __pyx_obj_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_ModelFrame {
+ PyObject_HEAD
+ ModelFrame *frame;
+};
+
+
+/* "View.MemoryView":114
+ * @cython.collection_type("sequence")
+ * @cname("__pyx_array")
+ * cdef class array: # <<<<<<<<<<<<<<
+ *
+ * cdef:
+ */
+struct __pyx_array_obj {
+ PyObject_HEAD
+ struct __pyx_vtabstruct_array *__pyx_vtab;
+ char *data;
+ Py_ssize_t len;
+ char *format;
+ int ndim;
+ Py_ssize_t *_shape;
+ Py_ssize_t *_strides;
+ Py_ssize_t itemsize;
+ PyObject *mode;
+ PyObject *_format;
+ void (*callback_free_data)(void *);
+ int free_data;
+ int dtype_is_object;
+};
+
+
+/* "View.MemoryView":302
+ *
+ * @cname('__pyx_MemviewEnum')
+ * cdef class Enum(object): # <<<<<<<<<<<<<<
+ * cdef object name
+ * def __init__(self, name):
+ */
+struct __pyx_MemviewEnum_obj {
+ PyObject_HEAD
+ PyObject *name;
+};
+
+
+/* "View.MemoryView":337
+ *
+ * @cname('__pyx_memoryview')
+ * cdef class memoryview: # <<<<<<<<<<<<<<
+ *
+ * cdef object obj
+ */
+struct __pyx_memoryview_obj {
+ PyObject_HEAD
+ struct __pyx_vtabstruct_memoryview *__pyx_vtab;
+ PyObject *obj;
+ PyObject *_size;
+ PyObject *_array_interface;
+ PyThread_type_lock lock;
+ __pyx_atomic_int_type acquisition_count;
+ Py_buffer view;
+ int flags;
+ int dtype_is_object;
+ __Pyx_TypeInfo *typeinfo;
+};
+
+
+/* "View.MemoryView":952
+ * @cython.collection_type("sequence")
+ * @cname('__pyx_memoryviewslice')
+ * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
+ * "Internal class for passing memoryview slices to Python"
+ *
+ */
+struct __pyx_memoryviewslice_obj {
+ struct __pyx_memoryview_obj __pyx_base;
+ __Pyx_memviewslice from_slice;
+ PyObject *from_object;
+ PyObject *(*to_object_func)(char *);
+ int (*to_dtype_func)(char *, PyObject *);
+};
+
+
+
+/* "msgq/visionipc/visionipc_pyx.pxd":11
+ * cdef cl_context context
+ *
+ * cdef class VisionBuf: # <<<<<<<<<<<<<<
+ * cdef cppVisionBuf * buf
+ *
+ */
+
+struct __pyx_vtabstruct_4msgq_9visionipc_13visionipc_pyx_VisionBuf {
+ PyObject *(*create)(VisionBuf *);
+};
+static struct __pyx_vtabstruct_4msgq_9visionipc_13visionipc_pyx_VisionBuf *__pyx_vtabptr_4msgq_9visionipc_13visionipc_pyx_VisionBuf;
+
+
+/* "selfdrive/classic_modeld/models/commonmodel_pyx.pyx":21
+ * self.context = cl_create_context(self.device_id)
+ *
+ * cdef class CLMem: # <<<<<<<<<<<<<<
+ * @staticmethod
+ * cdef create(void * cmem):
+ */
+
+struct __pyx_vtabstruct_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLMem {
+ PyObject *(*create)(void *);
+};
+static struct __pyx_vtabstruct_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLMem *__pyx_vtabptr_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLMem;
+
+
+/* "View.MemoryView":114
+ * @cython.collection_type("sequence")
+ * @cname("__pyx_array")
+ * cdef class array: # <<<<<<<<<<<<<<
+ *
+ * cdef:
+ */
+
+struct __pyx_vtabstruct_array {
+ PyObject *(*get_memview)(struct __pyx_array_obj *);
+};
+static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
+
+
+/* "View.MemoryView":337
+ *
+ * @cname('__pyx_memoryview')
+ * cdef class memoryview: # <<<<<<<<<<<<<<
+ *
+ * cdef object obj
+ */
+
+struct __pyx_vtabstruct_memoryview {
+ char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
+ PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
+ PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
+ PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
+ PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
+ PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
+ PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
+ PyObject *(*_get_base)(struct __pyx_memoryview_obj *);
+};
+static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
+
+
+/* "View.MemoryView":952
+ * @cython.collection_type("sequence")
+ * @cname('__pyx_memoryviewslice')
+ * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
+ * "Internal class for passing memoryview slices to Python"
+ *
+ */
+
+struct __pyx_vtabstruct__memoryviewslice {
+ struct __pyx_vtabstruct_memoryview __pyx_base;
+};
+static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
+/* #### Code section: utility_code_proto ### */
+
+/* --- Runtime support code (head) --- */
+/* Refnanny.proto */
+#ifndef CYTHON_REFNANNY
+ #define CYTHON_REFNANNY 0
+#endif
+#if CYTHON_REFNANNY
+ typedef struct {
+ void (*INCREF)(void*, PyObject*, Py_ssize_t);
+ void (*DECREF)(void*, PyObject*, Py_ssize_t);
+ void (*GOTREF)(void*, PyObject*, Py_ssize_t);
+ void (*GIVEREF)(void*, PyObject*, Py_ssize_t);
+ void* (*SetupContext)(const char*, Py_ssize_t, const char*);
+ void (*FinishContext)(void**);
+ } __Pyx_RefNannyAPIStruct;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
+ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
+ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
+#ifdef WITH_THREAD
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)\
+ if (acquire_gil) {\
+ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
+ PyGILState_Release(__pyx_gilstate_save);\
+ } else {\
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__));\
+ }
+ #define __Pyx_RefNannyFinishContextNogil() {\
+ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
+ __Pyx_RefNannyFinishContext();\
+ PyGILState_Release(__pyx_gilstate_save);\
+ }
+#else
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)\
+ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), (__LINE__), (__FILE__))
+ #define __Pyx_RefNannyFinishContextNogil() __Pyx_RefNannyFinishContext()
+#endif
+ #define __Pyx_RefNannyFinishContextNogil() {\
+ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
+ __Pyx_RefNannyFinishContext();\
+ PyGILState_Release(__pyx_gilstate_save);\
+ }
+ #define __Pyx_RefNannyFinishContext()\
+ __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
+ #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
+ #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
+ #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
+ #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), (__LINE__))
+ #define __Pyx_XINCREF(r) do { if((r) == NULL); else {__Pyx_INCREF(r); }} while(0)
+ #define __Pyx_XDECREF(r) do { if((r) == NULL); else {__Pyx_DECREF(r); }} while(0)
+ #define __Pyx_XGOTREF(r) do { if((r) == NULL); else {__Pyx_GOTREF(r); }} while(0)
+ #define __Pyx_XGIVEREF(r) do { if((r) == NULL); else {__Pyx_GIVEREF(r);}} while(0)
+#else
+ #define __Pyx_RefNannyDeclarations
+ #define __Pyx_RefNannySetupContext(name, acquire_gil)
+ #define __Pyx_RefNannyFinishContextNogil()
+ #define __Pyx_RefNannyFinishContext()
+ #define __Pyx_INCREF(r) Py_INCREF(r)
+ #define __Pyx_DECREF(r) Py_DECREF(r)
+ #define __Pyx_GOTREF(r)
+ #define __Pyx_GIVEREF(r)
+ #define __Pyx_XINCREF(r) Py_XINCREF(r)
+ #define __Pyx_XDECREF(r) Py_XDECREF(r)
+ #define __Pyx_XGOTREF(r)
+ #define __Pyx_XGIVEREF(r)
+#endif
+#define __Pyx_Py_XDECREF_SET(r, v) do {\
+ PyObject *tmp = (PyObject *) r;\
+ r = v; Py_XDECREF(tmp);\
+ } while (0)
+#define __Pyx_XDECREF_SET(r, v) do {\
+ PyObject *tmp = (PyObject *) r;\
+ r = v; __Pyx_XDECREF(tmp);\
+ } while (0)
+#define __Pyx_DECREF_SET(r, v) do {\
+ PyObject *tmp = (PyObject *) r;\
+ r = v; __Pyx_DECREF(tmp);\
+ } while (0)
+#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
+#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
+
+/* PyErrExceptionMatches.proto */
+#if CYTHON_FAST_THREAD_STATE
+#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
+static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
+#else
+#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
+#endif
+
+/* PyThreadStateGet.proto */
+#if CYTHON_FAST_THREAD_STATE
+#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
+#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
+#if PY_VERSION_HEX >= 0x030C00A6
+#define __Pyx_PyErr_Occurred() (__pyx_tstate->current_exception != NULL)
+#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->current_exception ? (PyObject*) Py_TYPE(__pyx_tstate->current_exception) : (PyObject*) NULL)
+#else
+#define __Pyx_PyErr_Occurred() (__pyx_tstate->curexc_type != NULL)
+#define __Pyx_PyErr_CurrentExceptionType() (__pyx_tstate->curexc_type)
+#endif
+#else
+#define __Pyx_PyThreadState_declare
+#define __Pyx_PyThreadState_assign
+#define __Pyx_PyErr_Occurred() (PyErr_Occurred() != NULL)
+#define __Pyx_PyErr_CurrentExceptionType() PyErr_Occurred()
+#endif
+
+/* PyErrFetchRestore.proto */
+#if CYTHON_FAST_THREAD_STATE
+#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
+#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
+#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
+#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
+#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
+static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
+static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
+#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A6
+#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
+#else
+#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
+#endif
+#else
+#define __Pyx_PyErr_Clear() PyErr_Clear()
+#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
+#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
+#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
+#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
+#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
+#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
+#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
+#endif
+
+/* PyObjectGetAttrStr.proto */
+#if CYTHON_USE_TYPE_SLOTS
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
+#else
+#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
+#endif
+
+/* PyObjectGetAttrStrNoError.proto */
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
+
+/* GetBuiltinName.proto */
+static PyObject *__Pyx_GetBuiltinName(PyObject *name);
+
+/* TupleAndListFromArray.proto */
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyList_FromArray(PyObject *const *src, Py_ssize_t n);
+static CYTHON_INLINE PyObject* __Pyx_PyTuple_FromArray(PyObject *const *src, Py_ssize_t n);
+#endif
+
+/* IncludeStringH.proto */
+#include
+
+/* BytesEquals.proto */
+static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
+
+/* UnicodeEquals.proto */
+static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
+
+/* fastcall.proto */
+#if CYTHON_AVOID_BORROWED_REFS
+ #define __Pyx_Arg_VARARGS(args, i) PySequence_GetItem(args, i)
+#elif CYTHON_ASSUME_SAFE_MACROS
+ #define __Pyx_Arg_VARARGS(args, i) PyTuple_GET_ITEM(args, i)
+#else
+ #define __Pyx_Arg_VARARGS(args, i) PyTuple_GetItem(args, i)
+#endif
+#if CYTHON_AVOID_BORROWED_REFS
+ #define __Pyx_Arg_NewRef_VARARGS(arg) __Pyx_NewRef(arg)
+ #define __Pyx_Arg_XDECREF_VARARGS(arg) Py_XDECREF(arg)
+#else
+ #define __Pyx_Arg_NewRef_VARARGS(arg) arg
+ #define __Pyx_Arg_XDECREF_VARARGS(arg)
+#endif
+#define __Pyx_NumKwargs_VARARGS(kwds) PyDict_Size(kwds)
+#define __Pyx_KwValues_VARARGS(args, nargs) NULL
+#define __Pyx_GetKwValue_VARARGS(kw, kwvalues, s) __Pyx_PyDict_GetItemStrWithError(kw, s)
+#define __Pyx_KwargsAsDict_VARARGS(kw, kwvalues) PyDict_Copy(kw)
+#if CYTHON_METH_FASTCALL
+ #define __Pyx_Arg_FASTCALL(args, i) args[i]
+ #define __Pyx_NumKwargs_FASTCALL(kwds) PyTuple_GET_SIZE(kwds)
+ #define __Pyx_KwValues_FASTCALL(args, nargs) ((args) + (nargs))
+ static CYTHON_INLINE PyObject * __Pyx_GetKwValue_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues, PyObject *s);
+#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
+ CYTHON_UNUSED static PyObject *__Pyx_KwargsAsDict_FASTCALL(PyObject *kwnames, PyObject *const *kwvalues);
+ #else
+ #define __Pyx_KwargsAsDict_FASTCALL(kw, kwvalues) _PyStack_AsDict(kwvalues, kw)
+ #endif
+ #define __Pyx_Arg_NewRef_FASTCALL(arg) arg /* no-op, __Pyx_Arg_FASTCALL is direct and this needs
+ to have the same reference counting */
+ #define __Pyx_Arg_XDECREF_FASTCALL(arg)
+#else
+ #define __Pyx_Arg_FASTCALL __Pyx_Arg_VARARGS
+ #define __Pyx_NumKwargs_FASTCALL __Pyx_NumKwargs_VARARGS
+ #define __Pyx_KwValues_FASTCALL __Pyx_KwValues_VARARGS
+ #define __Pyx_GetKwValue_FASTCALL __Pyx_GetKwValue_VARARGS
+ #define __Pyx_KwargsAsDict_FASTCALL __Pyx_KwargsAsDict_VARARGS
+ #define __Pyx_Arg_NewRef_FASTCALL(arg) __Pyx_Arg_NewRef_VARARGS(arg)
+ #define __Pyx_Arg_XDECREF_FASTCALL(arg) __Pyx_Arg_XDECREF_VARARGS(arg)
+#endif
+#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+#define __Pyx_ArgsSlice_VARARGS(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_VARARGS(args, start), stop - start)
+#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) __Pyx_PyTuple_FromArray(&__Pyx_Arg_FASTCALL(args, start), stop - start)
+#else
+#define __Pyx_ArgsSlice_VARARGS(args, start, stop) PyTuple_GetSlice(args, start, stop)
+#define __Pyx_ArgsSlice_FASTCALL(args, start, stop) PyTuple_GetSlice(args, start, stop)
+#endif
+
+/* RaiseArgTupleInvalid.proto */
+static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
+ Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
+
+/* RaiseDoubleKeywords.proto */
+static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
+
+/* ParseKeywords.proto */
+static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues,
+ PyObject **argnames[],
+ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,
+ const char* function_name);
+
+/* ArgTypeTest.proto */
+#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
+ ((likely(__Pyx_IS_TYPE(obj, type) | (none_allowed && (obj == Py_None)))) ? 1 :\
+ __Pyx__ArgTypeTest(obj, type, name, exact))
+static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
+
+/* RaiseException.proto */
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
+
+/* PyFunctionFastCall.proto */
+#if CYTHON_FAST_PYCALL
+#if !CYTHON_VECTORCALL
+#define __Pyx_PyFunction_FastCall(func, args, nargs)\
+ __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
+static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
+#endif
+#define __Pyx_BUILD_ASSERT_EXPR(cond)\
+ (sizeof(char [1 - 2*!(cond)]) - 1)
+#ifndef Py_MEMBER_SIZE
+#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
+#endif
+#if !CYTHON_VECTORCALL
+#if PY_VERSION_HEX >= 0x03080000
+ #include "frameobject.h"
+#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
+ #ifndef Py_BUILD_CORE
+ #define Py_BUILD_CORE 1
+ #endif
+ #include "internal/pycore_frame.h"
+#endif
+ #define __Pxy_PyFrame_Initialize_Offsets()
+ #define __Pyx_PyFrame_GetLocalsplus(frame) ((frame)->f_localsplus)
+#else
+ static size_t __pyx_pyframe_localsplus_offset = 0;
+ #include "frameobject.h"
+ #define __Pxy_PyFrame_Initialize_Offsets()\
+ ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
+ (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
+ #define __Pyx_PyFrame_GetLocalsplus(frame)\
+ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
+#endif
+#endif
+#endif
+
+/* PyObjectCall.proto */
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
+#else
+#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
+#endif
+
+/* PyObjectCallMethO.proto */
+#if CYTHON_COMPILING_IN_CPYTHON
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
+#endif
+
+/* PyObjectFastCall.proto */
+#define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, (size_t)(nargs), NULL)
+static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, size_t nargs, PyObject *kwargs);
+
+/* RaiseUnexpectedTypeError.proto */
+static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj);
+
+/* GCCDiagnostics.proto */
+#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
+#define __Pyx_HAS_GCC_DIAGNOSTIC
+#endif
+
+/* BuildPyUnicode.proto */
+static PyObject* __Pyx_PyUnicode_BuildFromAscii(Py_ssize_t ulength, char* chars, int clength,
+ int prepend_sign, char padding_char);
+
+/* CIntToPyUnicode.proto */
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_int(int value, Py_ssize_t width, char padding_char, char format_char);
+
+/* CIntToPyUnicode.proto */
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_Py_ssize_t(Py_ssize_t value, Py_ssize_t width, char padding_char, char format_char);
+
+/* JoinPyUnicode.proto */
+static PyObject* __Pyx_PyUnicode_Join(PyObject* value_tuple, Py_ssize_t value_count, Py_ssize_t result_ulength,
+ Py_UCS4 max_char);
+
+/* StrEquals.proto */
+#if PY_MAJOR_VERSION >= 3
+#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
+#else
+#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
+#endif
+
+/* PyObjectFormatSimple.proto */
+#if CYTHON_COMPILING_IN_PYPY
+ #define __Pyx_PyObject_FormatSimple(s, f) (\
+ likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
+ PyObject_Format(s, f))
+#elif PY_MAJOR_VERSION < 3
+ #define __Pyx_PyObject_FormatSimple(s, f) (\
+ likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
+ likely(PyString_CheckExact(s)) ? PyUnicode_FromEncodedObject(s, NULL, "strict") :\
+ PyObject_Format(s, f))
+#elif CYTHON_USE_TYPE_SLOTS
+ #define __Pyx_PyObject_FormatSimple(s, f) (\
+ likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
+ likely(PyLong_CheckExact(s)) ? PyLong_Type.tp_repr(s) :\
+ likely(PyFloat_CheckExact(s)) ? PyFloat_Type.tp_repr(s) :\
+ PyObject_Format(s, f))
+#else
+ #define __Pyx_PyObject_FormatSimple(s, f) (\
+ likely(PyUnicode_CheckExact(s)) ? (Py_INCREF(s), s) :\
+ PyObject_Format(s, f))
+#endif
+
+CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
+/* GetAttr.proto */
+static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
+
+/* GetItemInt.proto */
+#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
+ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
+ __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
+ (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
+ __Pyx_GetItemInt_Generic(o, to_py_func(i))))
+#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
+ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
+ __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
+ (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
+ int wraparound, int boundscheck);
+#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
+ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
+ __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
+ (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
+ int wraparound, int boundscheck);
+static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
+static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
+ int is_list, int wraparound, int boundscheck);
+
+/* PyObjectCallOneArg.proto */
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
+
+/* ObjectGetItem.proto */
+#if CYTHON_USE_TYPE_SLOTS
+static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key);
+#else
+#define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
+#endif
+
+/* KeywordStringCheck.proto */
+static int __Pyx_CheckKeywordStrings(PyObject *kw, const char* function_name, int kw_allowed);
+
+/* DivInt[Py_ssize_t].proto */
+static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);
+
+/* UnaryNegOverflows.proto */
+#define __Pyx_UNARY_NEG_WOULD_OVERFLOW(x)\
+ (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
+
+/* GetAttr3.proto */
+static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
+
+/* PyDictVersioning.proto */
+#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
+#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
+#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
+#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
+ (version_var) = __PYX_GET_DICT_VERSION(dict);\
+ (cache_var) = (value);
+#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
+ static PY_UINT64_T __pyx_dict_version = 0;\
+ static PyObject *__pyx_dict_cached_value = NULL;\
+ if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
+ (VAR) = __pyx_dict_cached_value;\
+ } else {\
+ (VAR) = __pyx_dict_cached_value = (LOOKUP);\
+ __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
+ }\
+}
+static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
+static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
+static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
+#else
+#define __PYX_GET_DICT_VERSION(dict) (0)
+#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
+#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
+#endif
+
+/* GetModuleGlobalName.proto */
+#if CYTHON_USE_DICT_VERSIONS
+#define __Pyx_GetModuleGlobalName(var, name) do {\
+ static PY_UINT64_T __pyx_dict_version = 0;\
+ static PyObject *__pyx_dict_cached_value = NULL;\
+ (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
+ (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
+ __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
+} while(0)
+#define __Pyx_GetModuleGlobalNameUncached(var, name) do {\
+ PY_UINT64_T __pyx_dict_version;\
+ PyObject *__pyx_dict_cached_value;\
+ (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
+} while(0)
+static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
+#else
+#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
+#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
+static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
+#endif
+
+/* AssertionsEnabled.proto */
+#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
+ #define __Pyx_init_assertions_enabled() (0)
+ #define __pyx_assertions_enabled() (1)
+#elif CYTHON_COMPILING_IN_LIMITED_API || (CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030C0000)
+ static int __pyx_assertions_enabled_flag;
+ #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag)
+ static int __Pyx_init_assertions_enabled(void) {
+ PyObject *builtins, *debug, *debug_str;
+ int flag;
+ builtins = PyEval_GetBuiltins();
+ if (!builtins) goto bad;
+ debug_str = PyUnicode_FromStringAndSize("__debug__", 9);
+ if (!debug_str) goto bad;
+ debug = PyObject_GetItem(builtins, debug_str);
+ Py_DECREF(debug_str);
+ if (!debug) goto bad;
+ flag = PyObject_IsTrue(debug);
+ Py_DECREF(debug);
+ if (flag == -1) goto bad;
+ __pyx_assertions_enabled_flag = flag;
+ return 0;
+ bad:
+ __pyx_assertions_enabled_flag = 1;
+ return -1;
+ }
+#else
+ #define __Pyx_init_assertions_enabled() (0)
+ #define __pyx_assertions_enabled() (!Py_OptimizeFlag)
+#endif
+
+/* RaiseTooManyValuesToUnpack.proto */
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
+
+/* RaiseNeedMoreValuesToUnpack.proto */
+static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
+
+/* RaiseNoneIterError.proto */
+static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
+
+/* ExtTypeTest.proto */
+static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
+
+/* GetTopmostException.proto */
+#if CYTHON_USE_EXC_INFO_STACK && CYTHON_FAST_THREAD_STATE
+static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
+#endif
+
+/* SaveResetException.proto */
+#if CYTHON_FAST_THREAD_STATE
+#define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
+static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
+#define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
+static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
+#else
+#define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
+#define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
+#endif
+
+/* GetException.proto */
+#if CYTHON_FAST_THREAD_STATE
+#define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
+static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
+#else
+static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
+#endif
+
+/* SwapException.proto */
+#if CYTHON_FAST_THREAD_STATE
+#define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
+static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
+#else
+static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
+#endif
+
+/* Import.proto */
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
+
+/* ImportDottedModule.proto */
+static PyObject *__Pyx_ImportDottedModule(PyObject *name, PyObject *parts_tuple);
+#if PY_MAJOR_VERSION >= 3
+static PyObject *__Pyx_ImportDottedModule_WalkParts(PyObject *module, PyObject *name, PyObject *parts_tuple);
+#endif
+
+/* FastTypeChecks.proto */
+#if CYTHON_COMPILING_IN_CPYTHON
+#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
+#define __Pyx_TypeCheck2(obj, type1, type2) __Pyx_IsAnySubtype2(Py_TYPE(obj), (PyTypeObject *)type1, (PyTypeObject *)type2)
+static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
+static CYTHON_INLINE int __Pyx_IsAnySubtype2(PyTypeObject *cls, PyTypeObject *a, PyTypeObject *b);
+static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
+static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
+#else
+#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
+#define __Pyx_TypeCheck2(obj, type1, type2) (PyObject_TypeCheck(obj, (PyTypeObject *)type1) || PyObject_TypeCheck(obj, (PyTypeObject *)type2))
+#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
+#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
+#endif
+#define __Pyx_PyErr_ExceptionMatches2(err1, err2) __Pyx_PyErr_GivenExceptionMatches2(__Pyx_PyErr_CurrentExceptionType(), err1, err2)
+#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
+
+CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+/* ListCompAppend.proto */
+#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
+static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
+ PyListObject* L = (PyListObject*) list;
+ Py_ssize_t len = Py_SIZE(list);
+ if (likely(L->allocated > len)) {
+ Py_INCREF(x);
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
+ L->ob_item[len] = x;
+ #else
+ PyList_SET_ITEM(list, len, x);
+ #endif
+ __Pyx_SET_SIZE(list, len + 1);
+ return 0;
+ }
+ return PyList_Append(list, x);
+}
+#else
+#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
+#endif
+
+/* PySequenceMultiply.proto */
+#define __Pyx_PySequence_Multiply_Left(mul, seq) __Pyx_PySequence_Multiply(seq, mul)
+static CYTHON_INLINE PyObject* __Pyx_PySequence_Multiply(PyObject *seq, Py_ssize_t mul);
+
+/* SetItemInt.proto */
+#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
+ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
+ __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
+ (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
+ __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
+static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
+static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
+ int is_list, int wraparound, int boundscheck);
+
+/* RaiseUnboundLocalError.proto */
+static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
+
+/* DivInt[long].proto */
+static CYTHON_INLINE long __Pyx_div_long(long, long);
+
+/* PySequenceContains.proto */
+static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
+ int result = PySequence_Contains(seq, item);
+ return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
+}
+
+/* ImportFrom.proto */
+static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
+
+/* HasAttr.proto */
+#if __PYX_LIMITED_VERSION_HEX >= 0x030d00A1
+#define __Pyx_HasAttr(o, n) PyObject_HasAttrWithError(o, n)
+#else
+static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
+#endif
+
+/* ListAppend.proto */
+#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
+static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
+ PyListObject* L = (PyListObject*) list;
+ Py_ssize_t len = Py_SIZE(list);
+ if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
+ Py_INCREF(x);
+ #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030d0000
+ L->ob_item[len] = x;
+ #else
+ PyList_SET_ITEM(list, len, x);
+ #endif
+ __Pyx_SET_SIZE(list, len + 1);
+ return 0;
+ }
+ return PyList_Append(list, x);
+}
+#else
+#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
+#endif
+
+/* PyObjectCall2Args.proto */
+static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
+
+/* PyObjectGetMethod.proto */
+static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
+
+/* PyObjectCallMethod1.proto */
+static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
+
+/* StringJoin.proto */
+#if PY_MAJOR_VERSION < 3
+#define __Pyx_PyString_Join __Pyx_PyBytes_Join
+#define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
+#else
+#define __Pyx_PyString_Join PyUnicode_Join
+#define __Pyx_PyBaseString_Join PyUnicode_Join
+#endif
+static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);
+
+/* CIntToPyUnicode.proto */
+static CYTHON_INLINE PyObject* __Pyx_PyUnicode_From_size_t(size_t value, Py_ssize_t width, char padding_char, char format_char);
+
+/* PyObjectCallNoArg.proto */
+static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
+
+/* BufferIndexError.proto */
+static void __Pyx_RaiseBufferIndexError(int axis);
+
+/* PyObject_GenericGetAttrNoDict.proto */
+#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
+static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
+#else
+#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
+#endif
+
+/* PyObject_GenericGetAttr.proto */
+#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
+static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
+#else
+#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
+#endif
+
+/* TypeImport.proto */
+#ifndef __PYX_HAVE_RT_ImportType_proto_3_0_8
+#define __PYX_HAVE_RT_ImportType_proto_3_0_8
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
+#include
+#endif
+#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || __cplusplus >= 201103L
+#define __PYX_GET_STRUCT_ALIGNMENT_3_0_8(s) alignof(s)
+#else
+#define __PYX_GET_STRUCT_ALIGNMENT_3_0_8(s) sizeof(void*)
+#endif
+enum __Pyx_ImportType_CheckSize_3_0_8 {
+ __Pyx_ImportType_CheckSize_Error_3_0_8 = 0,
+ __Pyx_ImportType_CheckSize_Warn_3_0_8 = 1,
+ __Pyx_ImportType_CheckSize_Ignore_3_0_8 = 2
+};
+static PyTypeObject *__Pyx_ImportType_3_0_8(PyObject* module, const char *module_name, const char *class_name, size_t size, size_t alignment, enum __Pyx_ImportType_CheckSize_3_0_8 check_size);
+#endif
+
+/* IncludeStructmemberH.proto */
+#include
+
+/* FixUpExtensionType.proto */
+#if CYTHON_USE_TYPE_SPECS
+static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject *type);
+#endif
+
+/* PyObjectCallMethod0.proto */
+static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
+
+/* ValidateBasesTuple.proto */
+#if CYTHON_COMPILING_IN_CPYTHON || CYTHON_COMPILING_IN_LIMITED_API || CYTHON_USE_TYPE_SPECS
+static int __Pyx_validate_bases_tuple(const char *type_name, Py_ssize_t dictoffset, PyObject *bases);
+#endif
+
+/* PyType_Ready.proto */
+CYTHON_UNUSED static int __Pyx_PyType_Ready(PyTypeObject *t);
+
+/* SetupReduce.proto */
+#if !CYTHON_COMPILING_IN_LIMITED_API
+static int __Pyx_setup_reduce(PyObject* type_obj);
+#endif
+
+/* SetVTable.proto */
+static int __Pyx_SetVtable(PyTypeObject* typeptr , void* vtable);
+
+/* GetVTable.proto */
+static void* __Pyx_GetVtable(PyTypeObject *type);
+
+/* MergeVTables.proto */
+#if !CYTHON_COMPILING_IN_LIMITED_API
+static int __Pyx_MergeVtables(PyTypeObject *type);
+#endif
+
+/* FetchSharedCythonModule.proto */
+static PyObject *__Pyx_FetchSharedCythonABIModule(void);
+
+/* FetchCommonType.proto */
+#if !CYTHON_USE_TYPE_SPECS
+static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
+#else
+static PyTypeObject* __Pyx_FetchCommonTypeFromSpec(PyObject *module, PyType_Spec *spec, PyObject *bases);
+#endif
+
+/* PyMethodNew.proto */
+#if CYTHON_COMPILING_IN_LIMITED_API
+static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
+ PyObject *typesModule=NULL, *methodType=NULL, *result=NULL;
+ CYTHON_UNUSED_VAR(typ);
+ if (!self)
+ return __Pyx_NewRef(func);
+ typesModule = PyImport_ImportModule("types");
+ if (!typesModule) return NULL;
+ methodType = PyObject_GetAttrString(typesModule, "MethodType");
+ Py_DECREF(typesModule);
+ if (!methodType) return NULL;
+ result = PyObject_CallFunctionObjArgs(methodType, func, self, NULL);
+ Py_DECREF(methodType);
+ return result;
+}
+#elif PY_MAJOR_VERSION >= 3
+static PyObject *__Pyx_PyMethod_New(PyObject *func, PyObject *self, PyObject *typ) {
+ CYTHON_UNUSED_VAR(typ);
+ if (!self)
+ return __Pyx_NewRef(func);
+ return PyMethod_New(func, self);
+}
+#else
+ #define __Pyx_PyMethod_New PyMethod_New
+#endif
+
+/* PyVectorcallFastCallDict.proto */
+#if CYTHON_METH_FASTCALL
+static CYTHON_INLINE PyObject *__Pyx_PyVectorcall_FastCallDict(PyObject *func, __pyx_vectorcallfunc vc, PyObject *const *args, size_t nargs, PyObject *kw);
+#endif
+
+/* CythonFunctionShared.proto */
+#define __Pyx_CyFunction_USED
+#define __Pyx_CYFUNCTION_STATICMETHOD 0x01
+#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
+#define __Pyx_CYFUNCTION_CCLASS 0x04
+#define __Pyx_CYFUNCTION_COROUTINE 0x08
+#define __Pyx_CyFunction_GetClosure(f)\
+ (((__pyx_CyFunctionObject *) (f))->func_closure)
+#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
+ #define __Pyx_CyFunction_GetClassObj(f)\
+ (((__pyx_CyFunctionObject *) (f))->func_classobj)
+#else
+ #define __Pyx_CyFunction_GetClassObj(f)\
+ ((PyObject*) ((PyCMethodObject *) (f))->mm_class)
+#endif
+#define __Pyx_CyFunction_SetClassObj(f, classobj)\
+ __Pyx__CyFunction_SetClassObj((__pyx_CyFunctionObject *) (f), (classobj))
+#define __Pyx_CyFunction_Defaults(type, f)\
+ ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
+#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
+ ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
+typedef struct {
+#if CYTHON_COMPILING_IN_LIMITED_API
+ PyObject_HEAD
+ PyObject *func;
+#elif PY_VERSION_HEX < 0x030900B1
+ PyCFunctionObject func;
+#else
+ PyCMethodObject func;
+#endif
+#if CYTHON_BACKPORT_VECTORCALL
+ __pyx_vectorcallfunc func_vectorcall;
+#endif
+#if PY_VERSION_HEX < 0x030500A0 || CYTHON_COMPILING_IN_LIMITED_API
+ PyObject *func_weakreflist;
+#endif
+ PyObject *func_dict;
+ PyObject *func_name;
+ PyObject *func_qualname;
+ PyObject *func_doc;
+ PyObject *func_globals;
+ PyObject *func_code;
+ PyObject *func_closure;
+#if PY_VERSION_HEX < 0x030900B1 || CYTHON_COMPILING_IN_LIMITED_API
+ PyObject *func_classobj;
+#endif
+ void *defaults;
+ int defaults_pyobjects;
+ size_t defaults_size;
+ int flags;
+ PyObject *defaults_tuple;
+ PyObject *defaults_kwdict;
+ PyObject *(*defaults_getter)(PyObject *);
+ PyObject *func_annotations;
+ PyObject *func_is_coroutine;
+} __pyx_CyFunctionObject;
+#undef __Pyx_CyOrPyCFunction_Check
+#define __Pyx_CyFunction_Check(obj) __Pyx_TypeCheck(obj, __pyx_CyFunctionType)
+#define __Pyx_CyOrPyCFunction_Check(obj) __Pyx_TypeCheck2(obj, __pyx_CyFunctionType, &PyCFunction_Type)
+#define __Pyx_CyFunction_CheckExact(obj) __Pyx_IS_TYPE(obj, __pyx_CyFunctionType)
+static CYTHON_INLINE int __Pyx__IsSameCyOrCFunction(PyObject *func, void *cfunc);
+#undef __Pyx_IsSameCFunction
+#define __Pyx_IsSameCFunction(func, cfunc) __Pyx__IsSameCyOrCFunction(func, cfunc)
+static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
+ int flags, PyObject* qualname,
+ PyObject *closure,
+ PyObject *module, PyObject *globals,
+ PyObject* code);
+static CYTHON_INLINE void __Pyx__CyFunction_SetClassObj(__pyx_CyFunctionObject* f, PyObject* classobj);
+static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
+ size_t size,
+ int pyobjects);
+static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
+ PyObject *tuple);
+static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
+ PyObject *dict);
+static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
+ PyObject *dict);
+static int __pyx_CyFunction_init(PyObject *module);
+#if CYTHON_METH_FASTCALL
+static PyObject * __Pyx_CyFunction_Vectorcall_NOARGS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
+static PyObject * __Pyx_CyFunction_Vectorcall_O(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
+static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
+static PyObject * __Pyx_CyFunction_Vectorcall_FASTCALL_KEYWORDS_METHOD(PyObject *func, PyObject *const *args, size_t nargsf, PyObject *kwnames);
+#if CYTHON_BACKPORT_VECTORCALL
+#define __Pyx_CyFunction_func_vectorcall(f) (((__pyx_CyFunctionObject*)f)->func_vectorcall)
+#else
+#define __Pyx_CyFunction_func_vectorcall(f) (((PyCFunctionObject*)f)->vectorcall)
+#endif
+#endif
+
+/* CythonFunction.proto */
+static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
+ int flags, PyObject* qualname,
+ PyObject *closure,
+ PyObject *module, PyObject *globals,
+ PyObject* code);
+
+/* CLineInTraceback.proto */
+#ifdef CYTHON_CLINE_IN_TRACEBACK
+#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
+#else
+static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
+#endif
+
+/* CodeObjectCache.proto */
+#if !CYTHON_COMPILING_IN_LIMITED_API
+typedef struct {
+ PyCodeObject* code_object;
+ int code_line;
+} __Pyx_CodeObjectCacheEntry;
+struct __Pyx_CodeObjectCache {
+ int count;
+ int max_count;
+ __Pyx_CodeObjectCacheEntry* entries;
+};
+static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
+static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
+static PyCodeObject *__pyx_find_code_object(int code_line);
+static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
+#endif
+
+/* AddTraceback.proto */
+static void __Pyx_AddTraceback(const char *funcname, int c_line,
+ int py_line, const char *filename);
+
+#if PY_MAJOR_VERSION < 3
+ static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
+ static void __Pyx_ReleaseBuffer(Py_buffer *view);
+#else
+ #define __Pyx_GetBuffer PyObject_GetBuffer
+ #define __Pyx_ReleaseBuffer PyBuffer_Release
+#endif
+
+
+/* BufferStructDeclare.proto */
+typedef struct {
+ Py_ssize_t shape, strides, suboffsets;
+} __Pyx_Buf_DimInfo;
+typedef struct {
+ size_t refcount;
+ Py_buffer pybuffer;
+} __Pyx_Buffer;
+typedef struct {
+ __Pyx_Buffer *rcbuffer;
+ char *data;
+ __Pyx_Buf_DimInfo diminfo[8];
+} __Pyx_LocalBuf_ND;
+
+/* MemviewSliceIsContig.proto */
+static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);
+
+/* OverlappingSlices.proto */
+static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
+ __Pyx_memviewslice *slice2,
+ int ndim, size_t itemsize);
+
+/* IsLittleEndian.proto */
+static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
+
+/* BufferFormatCheck.proto */
+static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
+static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
+ __Pyx_BufFmt_StackElem* stack,
+ __Pyx_TypeInfo* type);
+
+/* TypeInfoCompare.proto */
+static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
+
+/* MemviewSliceValidateAndInit.proto */
+static int __Pyx_ValidateAndInit_memviewslice(
+ int *axes_specs,
+ int c_or_f_flag,
+ int buf_flags,
+ int ndim,
+ __Pyx_TypeInfo *dtype,
+ __Pyx_BufFmt_StackElem stack[],
+ __Pyx_memviewslice *memviewslice,
+ PyObject *original_obj);
+
+/* ObjectToMemviewSlice.proto */
+static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject *, int writable_flag);
+
+/* MemviewDtypeToObject.proto */
+static CYTHON_INLINE PyObject *__pyx_memview_get_nn___pyx_t_5numpy_float32_t(const char *itemp);
+static CYTHON_INLINE int __pyx_memview_set_nn___pyx_t_5numpy_float32_t(const char *itemp, PyObject *obj);
+
+/* RealImag.proto */
+#if CYTHON_CCOMPLEX
+ #ifdef __cplusplus
+ #define __Pyx_CREAL(z) ((z).real())
+ #define __Pyx_CIMAG(z) ((z).imag())
+ #else
+ #define __Pyx_CREAL(z) (__real__(z))
+ #define __Pyx_CIMAG(z) (__imag__(z))
+ #endif
+#else
+ #define __Pyx_CREAL(z) ((z).real)
+ #define __Pyx_CIMAG(z) ((z).imag)
+#endif
+#if defined(__cplusplus) && CYTHON_CCOMPLEX\
+ && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
+ #define __Pyx_SET_CREAL(z,x) ((z).real(x))
+ #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
+#else
+ #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
+ #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
+#endif
+
+/* Arithmetic.proto */
+#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
+ #define __Pyx_c_eq_float(a, b) ((a)==(b))
+ #define __Pyx_c_sum_float(a, b) ((a)+(b))
+ #define __Pyx_c_diff_float(a, b) ((a)-(b))
+ #define __Pyx_c_prod_float(a, b) ((a)*(b))
+ #define __Pyx_c_quot_float(a, b) ((a)/(b))
+ #define __Pyx_c_neg_float(a) (-(a))
+ #ifdef __cplusplus
+ #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
+ #define __Pyx_c_conj_float(z) (::std::conj(z))
+ #if 1
+ #define __Pyx_c_abs_float(z) (::std::abs(z))
+ #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
+ #endif
+ #else
+ #define __Pyx_c_is_zero_float(z) ((z)==0)
+ #define __Pyx_c_conj_float(z) (conjf(z))
+ #if 1
+ #define __Pyx_c_abs_float(z) (cabsf(z))
+ #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
+ #endif
+ #endif
+#else
+ static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
+ static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
+ static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
+ static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
+ static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
+ static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
+ static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
+ static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
+ #if 1
+ static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
+ static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
+ #endif
+#endif
+
+/* Arithmetic.proto */
+#if CYTHON_CCOMPLEX && (1) && (!0 || __cplusplus)
+ #define __Pyx_c_eq_double(a, b) ((a)==(b))
+ #define __Pyx_c_sum_double(a, b) ((a)+(b))
+ #define __Pyx_c_diff_double(a, b) ((a)-(b))
+ #define __Pyx_c_prod_double(a, b) ((a)*(b))
+ #define __Pyx_c_quot_double(a, b) ((a)/(b))
+ #define __Pyx_c_neg_double(a) (-(a))
+ #ifdef __cplusplus
+ #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
+ #define __Pyx_c_conj_double(z) (::std::conj(z))
+ #if 1
+ #define __Pyx_c_abs_double(z) (::std::abs(z))
+ #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
+ #endif
+ #else
+ #define __Pyx_c_is_zero_double(z) ((z)==0)
+ #define __Pyx_c_conj_double(z) (conj(z))
+ #if 1
+ #define __Pyx_c_abs_double(z) (cabs(z))
+ #define __Pyx_c_pow_double(a, b) (cpow(a, b))
+ #endif
+ #endif
+#else
+ static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
+ static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
+ static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
+ static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
+ static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
+ static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
+ static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
+ static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
+ #if 1
+ static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
+ static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
+ #endif
+#endif
+
+/* MemviewSliceCopyTemplate.proto */
+static __Pyx_memviewslice
+__pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
+ const char *mode, int ndim,
+ size_t sizeof_dtype, int contig_flag,
+ int dtype_is_object);
+
+/* MemviewSliceInit.proto */
+#define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
+#define __Pyx_MEMVIEW_DIRECT 1
+#define __Pyx_MEMVIEW_PTR 2
+#define __Pyx_MEMVIEW_FULL 4
+#define __Pyx_MEMVIEW_CONTIG 8
+#define __Pyx_MEMVIEW_STRIDED 16
+#define __Pyx_MEMVIEW_FOLLOW 32
+#define __Pyx_IS_C_CONTIG 1
+#define __Pyx_IS_F_CONTIG 2
+static int __Pyx_init_memviewslice(
+ struct __pyx_memoryview_obj *memview,
+ int ndim,
+ __Pyx_memviewslice *memviewslice,
+ int memview_is_new_reference);
+static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
+ __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock);
+static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
+ __pyx_atomic_int_type *acquisition_count, PyThread_type_lock lock);
+#define __pyx_get_slice_count_pointer(memview) (&memview->acquisition_count)
+#define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
+#define __PYX_XCLEAR_MEMVIEW(slice, have_gil) __Pyx_XCLEAR_MEMVIEW(slice, have_gil, __LINE__)
+static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
+static CYTHON_INLINE void __Pyx_XCLEAR_MEMVIEW(__Pyx_memviewslice *, int, int);
+
+/* TypeInfoToFormat.proto */
+struct __pyx_typeinfo_string {
+ char string[3];
+};
+static struct __pyx_typeinfo_string __Pyx_TypeInfoToFormat(__Pyx_TypeInfo *type);
+
+/* CIntFromPy.proto */
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
+
+/* None.proto */
+#include
+
+/* CIntFromPy.proto */
+static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
+
+/* CIntToPy.proto */
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
+
+/* CIntToPy.proto */
+static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
+
+/* CIntFromPy.proto */
+static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
+
+/* FormatTypeName.proto */
+#if CYTHON_COMPILING_IN_LIMITED_API
+typedef PyObject *__Pyx_TypeName;
+#define __Pyx_FMT_TYPENAME "%U"
+static __Pyx_TypeName __Pyx_PyType_GetName(PyTypeObject* tp);
+#define __Pyx_DECREF_TypeName(obj) Py_XDECREF(obj)
+#else
+typedef const char *__Pyx_TypeName;
+#define __Pyx_FMT_TYPENAME "%.200s"
+#define __Pyx_PyType_GetName(tp) ((tp)->tp_name)
+#define __Pyx_DECREF_TypeName(obj)
+#endif
+
+/* CheckBinaryVersion.proto */
+static unsigned long __Pyx_get_runtime_version(void);
+static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt_version, int allow_newer);
+
+/* InitStrings.proto */
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
+
+/* #### Code section: module_declarations ### */
+static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
+static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
+static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
+static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
+static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/
+static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
+static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
+static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
+static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self); /* proto*/
+static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
+static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
+static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto*/
+static CYTHON_INLINE PyObject *__pyx_f_5numpy_7ndarray_4base_base(PyArrayObject *__pyx_v_self); /* proto*/
+static CYTHON_INLINE PyArray_Descr *__pyx_f_5numpy_7ndarray_5descr_descr(PyArrayObject *__pyx_v_self); /* proto*/
+static CYTHON_INLINE int __pyx_f_5numpy_7ndarray_4ndim_ndim(PyArrayObject *__pyx_v_self); /* proto*/
+static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_5shape_shape(PyArrayObject *__pyx_v_self); /* proto*/
+static CYTHON_INLINE npy_intp *__pyx_f_5numpy_7ndarray_7strides_strides(PyArrayObject *__pyx_v_self); /* proto*/
+static CYTHON_INLINE npy_intp __pyx_f_5numpy_7ndarray_4size_size(PyArrayObject *__pyx_v_self); /* proto*/
+static CYTHON_INLINE char *__pyx_f_5numpy_7ndarray_4data_data(PyArrayObject *__pyx_v_self); /* proto*/
+static PyObject *__pyx_f_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_5CLMem_create(void *__pyx_v_cmem); /* proto*/
+
+/* Module declarations from "libc.string" */
+
+/* Module declarations from "libcpp.string" */
+
+/* Module declarations from "libcpp.vector" */
+
+/* Module declarations from "libcpp.utility" */
+
+/* Module declarations from "libcpp.set" */
+
+/* Module declarations from "libc.stdint" */
+
+/* Module declarations from "libcpp" */
+
+/* Module declarations from "msgq.visionipc.visionipc" */
+
+/* Module declarations from "msgq.visionipc.visionipc_pyx" */
+
+/* Module declarations from "libc.stdio" */
+
+/* Module declarations from "__builtin__" */
+
+/* Module declarations from "cpython.type" */
+
+/* Module declarations from "cpython" */
+
+/* Module declarations from "cpython.object" */
+
+/* Module declarations from "cpython.ref" */
+
+/* Module declarations from "numpy" */
+
+/* Module declarations from "numpy" */
+
+/* Module declarations from "selfdrive.classic_modeld.models.commonmodel" */
+
+/* Module declarations from "selfdrive.classic_modeld.models.commonmodel_pyx" */
+static PyObject *__pyx_collections_abc_Sequence = 0;
+static PyObject *generic = 0;
+static PyObject *strided = 0;
+static PyObject *indirect = 0;
+static PyObject *contiguous = 0;
+static PyObject *indirect_contiguous = 0;
+static int __pyx_memoryview_thread_locks_used;
+static PyThread_type_lock __pyx_memoryview_thread_locks[8];
+static int __pyx_array_allocate_buffer(struct __pyx_array_obj *); /*proto*/
+static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
+static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
+static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
+static PyObject *_unellipsify(PyObject *, int); /*proto*/
+static int assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
+static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
+static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
+static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
+static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
+static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
+static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
+static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
+static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
+static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
+static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
+static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
+static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
+static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
+static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
+static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
+static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
+static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
+static int __pyx_memoryview_err_dim(PyObject *, PyObject *, int); /*proto*/
+static int __pyx_memoryview_err(PyObject *, PyObject *); /*proto*/
+static int __pyx_memoryview_err_no_memory(void); /*proto*/
+static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
+static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
+static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
+static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
+static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
+static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
+static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
+static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
+static PyObject *__pyx_format_from_typeinfo(__Pyx_TypeInfo *); /*proto*/
+/* #### Code section: typeinfo ### */
+static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float32_t = { "float32_t", NULL, sizeof(__pyx_t_5numpy_float32_t), { 0 }, 0, 'R', 0, 0 };
+static __Pyx_TypeInfo __Pyx_TypeInfo_float = { "float", NULL, sizeof(float), { 0 }, 0, 'R', 0, 0 };
+/* #### Code section: before_global_var ### */
+#define __Pyx_MODULE_NAME "selfdrive.classic_modeld.models.commonmodel_pyx"
+extern int __pyx_module_is_main_selfdrive__classic_modeld__models__commonmodel_pyx;
+int __pyx_module_is_main_selfdrive__classic_modeld__models__commonmodel_pyx = 0;
+
+/* Implementation of "selfdrive.classic_modeld.models.commonmodel_pyx" */
+/* #### Code section: global_var ### */
+static PyObject *__pyx_builtin_TypeError;
+static PyObject *__pyx_builtin___import__;
+static PyObject *__pyx_builtin_ValueError;
+static PyObject *__pyx_builtin_MemoryError;
+static PyObject *__pyx_builtin_enumerate;
+static PyObject *__pyx_builtin_range;
+static PyObject *__pyx_builtin_AssertionError;
+static PyObject *__pyx_builtin_Ellipsis;
+static PyObject *__pyx_builtin_id;
+static PyObject *__pyx_builtin_IndexError;
+static PyObject *__pyx_builtin_ImportError;
+/* #### Code section: string_decls ### */
+static const char __pyx_k_[] = ": ";
+static const char __pyx_k_O[] = "O";
+static const char __pyx_k_T[] = "T{";
+ static const char __pyx_k_c[] = "c";
+ static const char __pyx_k_x[] = "x";
+ static const char __pyx_k__2[] = ".";
+ static const char __pyx_k__3[] = "*";
+ static const char __pyx_k__6[] = "'";
+ static const char __pyx_k__7[] = ")";
+ static const char __pyx_k__9[] = "^";
+ static const char __pyx_k_gc[] = "gc";
+ static const char __pyx_k_id[] = "id";
+ static const char __pyx_k_np[] = "np";
+ static const char __pyx_k__10[] = "";
+ static const char __pyx_k__11[] = ":";
+static const char __pyx_k__12[] = "}";
+static const char __pyx_k__13[] = "(";
+static const char __pyx_k__14[] = ",";
+static const char __pyx_k__40[] = "?";
+static const char __pyx_k_abc[] = "abc";
+static const char __pyx_k_and[] = " and ";
+static const char __pyx_k_buf[] = "buf";
+static const char __pyx_k_got[] = " (got ";
+static const char __pyx_k_new[] = "__new__";
+static const char __pyx_k_obj[] = "obj";
+static const char __pyx_k_sys[] = "sys";
+static const char __pyx_k_base[] = "base";
+static const char __pyx_k_data[] = "data";
+static const char __pyx_k_dict[] = "__dict__";
+static const char __pyx_k_join[] = "join";
+static const char __pyx_k_main[] = "__main__";
+static const char __pyx_k_mode[] = "mode";
+static const char __pyx_k_name[] = "name";
+static const char __pyx_k_ndim[] = "ndim";
+static const char __pyx_k_pack[] = "pack";
+static const char __pyx_k_self[] = "self";
+static const char __pyx_k_size[] = "size";
+static const char __pyx_k_spec[] = "__spec__";
+static const char __pyx_k_step[] = "step";
+static const char __pyx_k_stop[] = "stop";
+static const char __pyx_k_test[] = "__test__";
+static const char __pyx_k_ASCII[] = "ASCII";
+static const char __pyx_k_CLMem[] = "CLMem";
+static const char __pyx_k_class[] = "__class__";
+static const char __pyx_k_count[] = "count";
+static const char __pyx_k_error[] = "error";
+static const char __pyx_k_flags[] = "flags";
+static const char __pyx_k_index[] = "index";
+static const char __pyx_k_numpy[] = "numpy";
+static const char __pyx_k_range[] = "range";
+static const char __pyx_k_shape[] = "shape";
+static const char __pyx_k_start[] = "start";
+static const char __pyx_k_width[] = "width";
+static const char __pyx_k_enable[] = "enable";
+static const char __pyx_k_encode[] = "encode";
+static const char __pyx_k_format[] = "format";
+static const char __pyx_k_height[] = "height";
+static const char __pyx_k_import[] = "__import__";
+static const char __pyx_k_name_2[] = "__name__";
+static const char __pyx_k_output[] = "output";
+static const char __pyx_k_pickle[] = "pickle";
+static const char __pyx_k_reduce[] = "__reduce__";
+static const char __pyx_k_stride[] = "stride";
+static const char __pyx_k_struct[] = "struct";
+static const char __pyx_k_unpack[] = "unpack";
+static const char __pyx_k_update[] = "update";
+static const char __pyx_k_asarray[] = "asarray";
+static const char __pyx_k_context[] = "context";
+static const char __pyx_k_disable[] = "disable";
+static const char __pyx_k_fortran[] = "fortran";
+static const char __pyx_k_memview[] = "memview";
+static const char __pyx_k_prepare[] = "prepare";
+static const char __pyx_k_sigmoid[] = "sigmoid";
+static const char __pyx_k_Ellipsis[] = "Ellipsis";
+static const char __pyx_k_Sequence[] = "Sequence";
+static const char __pyx_k_getstate[] = "__getstate__";
+static const char __pyx_k_itemsize[] = "itemsize";
+static const char __pyx_k_pyx_type[] = "__pyx_type";
+static const char __pyx_k_register[] = "register";
+static const char __pyx_k_setstate[] = "__setstate__";
+static const char __pyx_k_CLContext[] = "CLContext";
+static const char __pyx_k_TypeError[] = "TypeError";
+static const char __pyx_k_enumerate[] = "enumerate";
+static const char __pyx_k_isenabled[] = "isenabled";
+static const char __pyx_k_pyx_state[] = "__pyx_state";
+static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
+static const char __pyx_k_uv_offset[] = "uv_offset";
+static const char __pyx_k_IndexError[] = "IndexError";
+static const char __pyx_k_ModelFrame[] = "ModelFrame";
+static const char __pyx_k_ValueError[] = "ValueError";
+static const char __pyx_k_projection[] = "projection";
+static const char __pyx_k_pyx_result[] = "__pyx_result";
+static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
+static const char __pyx_k_ImportError[] = "ImportError";
+static const char __pyx_k_MemoryError[] = "MemoryError";
+static const char __pyx_k_PickleError[] = "PickleError";
+static const char __pyx_k_collections[] = "collections";
+static const char __pyx_k_cprojection[] = "cprojection";
+static const char __pyx_k_initializing[] = "_initializing";
+static const char __pyx_k_is_coroutine[] = "_is_coroutine";
+static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
+static const char __pyx_k_stringsource[] = "";
+static const char __pyx_k_version_info[] = "version_info";
+static const char __pyx_k_class_getitem[] = "__class_getitem__";
+static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
+static const char __pyx_k_AssertionError[] = "AssertionError";
+static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
+static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
+static const char __pyx_k_collections_abc[] = "collections.abc";
+static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
+static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
+static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
+static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
+static const char __pyx_k_ModelFrame_prepare[] = "ModelFrame.prepare";
+static const char __pyx_k_asyncio_coroutines[] = "asyncio.coroutines";
+static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
+static const char __pyx_k_strided_and_direct[] = "";
+static const char __pyx_k_strided_and_indirect[] = "";
+static const char __pyx_k_CLMem___reduce_cython[] = "CLMem.__reduce_cython__";
+static const char __pyx_k_Invalid_shape_in_axis[] = "Invalid shape in axis ";
+static const char __pyx_k_contiguous_and_direct[] = "";
+static const char __pyx_k_Cannot_index_with_type[] = "Cannot index with type '";
+static const char __pyx_k_MemoryView_of_r_object[] = "";
+static const char __pyx_k_CLMem___setstate_cython[] = "CLMem.__setstate_cython__";
+static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "";
+static const char __pyx_k_contiguous_and_indirect[] = "";
+static const char __pyx_k_CLContext___reduce_cython[] = "CLContext.__reduce_cython__";
+static const char __pyx_k_Dimension_d_is_not_direct[] = "Dimension %d is not direct";
+static const char __pyx_k_Index_out_of_bounds_axis_d[] = "Index out of bounds (axis %d)";
+static const char __pyx_k_ModelFrame___reduce_cython[] = "ModelFrame.__reduce_cython__";
+static const char __pyx_k_CLContext___setstate_cython[] = "CLContext.__setstate_cython__";
+static const char __pyx_k_Step_may_not_be_zero_axis_d[] = "Step may not be zero (axis %d)";
+static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
+static const char __pyx_k_ModelFrame___setstate_cython[] = "ModelFrame.__setstate_cython__";
+static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
+static const char __pyx_k_strided_and_direct_or_indirect[] = "";
+static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
+static const char __pyx_k_self_mem_cannot_be_converted_to[] = "self.mem cannot be converted to a Python object for pickling";
+static const char __pyx_k_selfdrive_classic_modeld_models[] = "selfdrive/classic_modeld/models/commonmodel_pyx.pyx";
+static const char __pyx_k_All_dimensions_preceding_dimensi[] = "All dimensions preceding dimension %d must be indexed and not sliced";
+static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
+static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
+static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview";
+static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview";
+static const char __pyx_k_Cannot_transpose_memoryview_with[] = "Cannot transpose memoryview with indirect dimensions";
+static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
+static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0x82a3537, 0x6ae9995, 0xb068931) = (name))";
+static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
+static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got ";
+static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis ";
+static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
+static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension ";
+static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
+static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
+static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
+static const char __pyx_k_selfdrive_classic_modeld_models_2[] = "selfdrive.classic_modeld.models.commonmodel_pyx";
+/* #### Code section: decls ### */
+static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */
+static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
+static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
+static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
+static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
+static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */
+static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
+static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
+static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
+static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */
+static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
+static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
+static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
+static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
+static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
+static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
+static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
+static PyObject *__pyx_pf_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_sigmoid(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
+static int __pyx_pf_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_9CLContext___cinit__(struct __pyx_obj_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLContext *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_9CLContext_2__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLContext *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_9CLContext_4__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLContext *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
+static PyObject *__pyx_pf_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_5CLMem___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLMem *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_5CLMem_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLMem *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
+static int __pyx_pf_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_10ModelFrame___cinit__(struct __pyx_obj_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_ModelFrame *__pyx_v_self, struct __pyx_obj_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLContext *__pyx_v_context); /* proto */
+static void __pyx_pf_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_10ModelFrame_2__dealloc__(struct __pyx_obj_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_ModelFrame *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_10ModelFrame_4prepare(struct __pyx_obj_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_ModelFrame *__pyx_v_self, struct __pyx_obj_4msgq_9visionipc_13visionipc_pyx_VisionBuf *__pyx_v_buf, __Pyx_memviewslice __pyx_v_projection, struct __pyx_obj_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLMem *__pyx_v_output); /* proto */
+static PyObject *__pyx_pf_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_10ModelFrame_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_ModelFrame *__pyx_v_self); /* proto */
+static PyObject *__pyx_pf_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_10ModelFrame_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_ModelFrame *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
+static PyObject *__pyx_tp_new_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLMem(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_ModelFrame(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
+/* #### Code section: late_includes ### */
+/* #### Code section: module_state ### */
+typedef struct {
+ PyObject *__pyx_d;
+ PyObject *__pyx_b;
+ PyObject *__pyx_cython_runtime;
+ PyObject *__pyx_empty_tuple;
+ PyObject *__pyx_empty_bytes;
+ PyObject *__pyx_empty_unicode;
+ #ifdef __Pyx_CyFunction_USED
+ PyTypeObject *__pyx_CyFunctionType;
+ #endif
+ #ifdef __Pyx_FusedFunction_USED
+ PyTypeObject *__pyx_FusedFunctionType;
+ #endif
+ #ifdef __Pyx_Generator_USED
+ PyTypeObject *__pyx_GeneratorType;
+ #endif
+ #ifdef __Pyx_IterableCoroutine_USED
+ PyTypeObject *__pyx_IterableCoroutineType;
+ #endif
+ #ifdef __Pyx_Coroutine_USED
+ PyTypeObject *__pyx_CoroutineAwaitType;
+ #endif
+ #ifdef __Pyx_Coroutine_USED
+ PyTypeObject *__pyx_CoroutineType;
+ #endif
+ #if CYTHON_USE_MODULE_STATE
+ #endif
+ #if CYTHON_USE_MODULE_STATE
+ #endif
+ #if CYTHON_USE_MODULE_STATE
+ #endif
+ #if CYTHON_USE_MODULE_STATE
+ #endif
+ #if CYTHON_USE_MODULE_STATE
+ #endif
+ #if CYTHON_USE_MODULE_STATE
+ #endif
+ #if CYTHON_USE_MODULE_STATE
+ #endif
+ #if CYTHON_USE_MODULE_STATE
+ #endif
+ #if CYTHON_USE_MODULE_STATE
+ #endif
+ PyTypeObject *__pyx_ptype_4msgq_9visionipc_13visionipc_pyx_CLContext;
+ PyTypeObject *__pyx_ptype_4msgq_9visionipc_13visionipc_pyx_VisionBuf;
+ #if CYTHON_USE_MODULE_STATE
+ #endif
+ #if CYTHON_USE_MODULE_STATE
+ #endif
+ #if CYTHON_USE_MODULE_STATE
+ #endif
+ PyTypeObject *__pyx_ptype_7cpython_4type_type;
+ #if CYTHON_USE_MODULE_STATE
+ #endif
+ #if CYTHON_USE_MODULE_STATE
+ #endif
+ #if CYTHON_USE_MODULE_STATE
+ #endif
+ #if CYTHON_USE_MODULE_STATE
+ #endif
+ #if CYTHON_USE_MODULE_STATE
+ #endif
+ PyTypeObject *__pyx_ptype_5numpy_dtype;
+ PyTypeObject *__pyx_ptype_5numpy_flatiter;
+ PyTypeObject *__pyx_ptype_5numpy_broadcast;
+ PyTypeObject *__pyx_ptype_5numpy_ndarray;
+ PyTypeObject *__pyx_ptype_5numpy_generic;
+ PyTypeObject *__pyx_ptype_5numpy_number;
+ PyTypeObject *__pyx_ptype_5numpy_integer;
+ PyTypeObject *__pyx_ptype_5numpy_signedinteger;
+ PyTypeObject *__pyx_ptype_5numpy_unsignedinteger;
+ PyTypeObject *__pyx_ptype_5numpy_inexact;
+ PyTypeObject *__pyx_ptype_5numpy_floating;
+ PyTypeObject *__pyx_ptype_5numpy_complexfloating;
+ PyTypeObject *__pyx_ptype_5numpy_flexible;
+ PyTypeObject *__pyx_ptype_5numpy_character;
+ PyTypeObject *__pyx_ptype_5numpy_ufunc;
+ #if CYTHON_USE_MODULE_STATE
+ #endif
+ #if CYTHON_USE_MODULE_STATE
+ PyObject *__pyx_type_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLContext;
+ PyObject *__pyx_type_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLMem;
+ PyObject *__pyx_type_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_ModelFrame;
+ PyObject *__pyx_type___pyx_array;
+ PyObject *__pyx_type___pyx_MemviewEnum;
+ PyObject *__pyx_type___pyx_memoryview;
+ PyObject *__pyx_type___pyx_memoryviewslice;
+ #endif
+ PyTypeObject *__pyx_ptype_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLContext;
+ PyTypeObject *__pyx_ptype_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLMem;
+ PyTypeObject *__pyx_ptype_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_ModelFrame;
+ PyTypeObject *__pyx_array_type;
+ PyTypeObject *__pyx_MemviewEnum_type;
+ PyTypeObject *__pyx_memoryview_type;
+ PyTypeObject *__pyx_memoryviewslice_type;
+ PyObject *__pyx_kp_u_;
+ PyObject *__pyx_n_s_ASCII;
+ PyObject *__pyx_kp_s_All_dimensions_preceding_dimensi;
+ PyObject *__pyx_n_s_AssertionError;
+ PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
+ PyObject *__pyx_n_s_CLContext;
+ PyObject *__pyx_n_s_CLContext___reduce_cython;
+ PyObject *__pyx_n_s_CLContext___setstate_cython;
+ PyObject *__pyx_n_s_CLMem;
+ PyObject *__pyx_n_s_CLMem___reduce_cython;
+ PyObject *__pyx_n_s_CLMem___setstate_cython;
+ PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
+ PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
+ PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
+ PyObject *__pyx_kp_u_Cannot_index_with_type;
+ PyObject *__pyx_kp_s_Cannot_transpose_memoryview_with;
+ PyObject *__pyx_kp_s_Dimension_d_is_not_direct;
+ PyObject *__pyx_n_s_Ellipsis;
+ PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
+ PyObject *__pyx_n_s_ImportError;
+ PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0;
+ PyObject *__pyx_n_s_IndexError;
+ PyObject *__pyx_kp_s_Index_out_of_bounds_axis_d;
+ PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
+ PyObject *__pyx_kp_u_Invalid_mode_expected_c_or_fortr;
+ PyObject *__pyx_kp_u_Invalid_shape_in_axis;
+ PyObject *__pyx_n_s_MemoryError;
+ PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
+ PyObject *__pyx_kp_s_MemoryView_of_r_object;
+ PyObject *__pyx_n_s_ModelFrame;
+ PyObject *__pyx_n_s_ModelFrame___reduce_cython;
+ PyObject *__pyx_n_s_ModelFrame___setstate_cython;
+ PyObject *__pyx_n_s_ModelFrame_prepare;
+ PyObject *__pyx_n_b_O;
+ PyObject *__pyx_kp_u_Out_of_bounds_on_buffer_access_a;
+ PyObject *__pyx_n_s_PickleError;
+ PyObject *__pyx_n_s_Sequence;
+ PyObject *__pyx_kp_s_Step_may_not_be_zero_axis_d;
+ PyObject *__pyx_kp_b_T;
+ PyObject *__pyx_n_s_TypeError;
+ PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
+ PyObject *__pyx_n_s_ValueError;
+ PyObject *__pyx_n_s_View_MemoryView;
+ PyObject *__pyx_kp_b__10;
+ PyObject *__pyx_kp_b__11;
+ PyObject *__pyx_kp_b__12;
+ PyObject *__pyx_kp_u__13;
+ PyObject *__pyx_kp_u__14;
+ PyObject *__pyx_kp_u__2;
+ PyObject *__pyx_n_s__3;
+ PyObject *__pyx_n_s__40;
+ PyObject *__pyx_kp_u__6;
+ PyObject *__pyx_kp_u__7;
+ PyObject *__pyx_kp_b__9;
+ PyObject *__pyx_n_s_abc;
+ PyObject *__pyx_n_s_allocate_buffer;
+ PyObject *__pyx_kp_u_and;
+ PyObject *__pyx_n_s_asarray;
+ PyObject *__pyx_n_s_asyncio_coroutines;
+ PyObject *__pyx_n_s_base;
+ PyObject *__pyx_n_s_buf;
+ PyObject *__pyx_n_s_c;
+ PyObject *__pyx_n_u_c;
+ PyObject *__pyx_n_s_class;
+ PyObject *__pyx_n_s_class_getitem;
+ PyObject *__pyx_n_s_cline_in_traceback;
+ PyObject *__pyx_n_s_collections;
+ PyObject *__pyx_kp_s_collections_abc;
+ PyObject *__pyx_n_s_context;
+ PyObject *__pyx_kp_s_contiguous_and_direct;
+ PyObject *__pyx_kp_s_contiguous_and_indirect;
+ PyObject *__pyx_n_s_count;
+ PyObject *__pyx_n_s_cprojection;
+ PyObject *__pyx_n_s_data;
+ PyObject *__pyx_n_s_dict;
+ PyObject *__pyx_kp_u_disable;
+ PyObject *__pyx_n_s_dtype_is_object;
+ PyObject *__pyx_kp_u_enable;
+ PyObject *__pyx_n_s_encode;
+ PyObject *__pyx_n_s_enumerate;
+ PyObject *__pyx_n_s_error;
+ PyObject *__pyx_n_s_flags;
+ PyObject *__pyx_n_s_format;
+ PyObject *__pyx_n_s_fortran;
+ PyObject *__pyx_n_u_fortran;
+ PyObject *__pyx_kp_u_gc;
+ PyObject *__pyx_n_s_getstate;
+ PyObject *__pyx_kp_u_got;
+ PyObject *__pyx_kp_u_got_differing_extents_in_dimensi;
+ PyObject *__pyx_n_s_height;
+ PyObject *__pyx_n_s_id;
+ PyObject *__pyx_n_s_import;
+ PyObject *__pyx_n_s_index;
+ PyObject *__pyx_n_s_initializing;
+ PyObject *__pyx_n_s_is_coroutine;
+ PyObject *__pyx_kp_u_isenabled;
+ PyObject *__pyx_n_s_itemsize;
+ PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
+ PyObject *__pyx_n_s_join;
+ PyObject *__pyx_n_s_main;
+ PyObject *__pyx_n_s_memview;
+ PyObject *__pyx_n_s_mode;
+ PyObject *__pyx_n_s_name;
+ PyObject *__pyx_n_s_name_2;
+ PyObject *__pyx_n_s_ndim;
+ PyObject *__pyx_n_s_new;
+ PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
+ PyObject *__pyx_n_s_np;
+ PyObject *__pyx_n_s_numpy;
+ PyObject *__pyx_kp_u_numpy_core_multiarray_failed_to;
+ PyObject *__pyx_kp_u_numpy_core_umath_failed_to_impor;
+ PyObject *__pyx_n_s_obj;
+ PyObject *__pyx_n_s_output;
+ PyObject *__pyx_n_s_pack;
+ PyObject *__pyx_n_s_pickle;
+ PyObject *__pyx_n_s_prepare;
+ PyObject *__pyx_n_s_projection;
+ PyObject *__pyx_n_s_pyx_PickleError;
+ PyObject *__pyx_n_s_pyx_checksum;
+ PyObject *__pyx_n_s_pyx_result;
+ PyObject *__pyx_n_s_pyx_state;
+ PyObject *__pyx_n_s_pyx_type;
+ PyObject *__pyx_n_s_pyx_unpickle_Enum;
+ PyObject *__pyx_n_s_pyx_vtable;
+ PyObject *__pyx_n_s_range;
+ PyObject *__pyx_n_s_reduce;
+ PyObject *__pyx_n_s_reduce_cython;
+ PyObject *__pyx_n_s_reduce_ex;
+ PyObject *__pyx_n_s_register;
+ PyObject *__pyx_n_s_self;
+ PyObject *__pyx_kp_s_self_mem_cannot_be_converted_to;
+ PyObject *__pyx_kp_s_selfdrive_classic_modeld_models;
+ PyObject *__pyx_n_s_selfdrive_classic_modeld_models_2;
+ PyObject *__pyx_n_s_setstate;
+ PyObject *__pyx_n_s_setstate_cython;
+ PyObject *__pyx_n_s_shape;
+ PyObject *__pyx_n_s_sigmoid;
+ PyObject *__pyx_n_s_size;
+ PyObject *__pyx_n_s_spec;
+ PyObject *__pyx_n_s_start;
+ PyObject *__pyx_n_s_step;
+ PyObject *__pyx_n_s_stop;
+ PyObject *__pyx_n_s_stride;
+ PyObject *__pyx_kp_s_strided_and_direct;
+ PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
+ PyObject *__pyx_kp_s_strided_and_indirect;
+ PyObject *__pyx_kp_s_stringsource;
+ PyObject *__pyx_n_s_struct;
+ PyObject *__pyx_n_s_sys;
+ PyObject *__pyx_n_s_test;
+ PyObject *__pyx_kp_s_unable_to_allocate_array_data;
+ PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
+ PyObject *__pyx_n_s_unpack;
+ PyObject *__pyx_n_s_update;
+ PyObject *__pyx_n_s_uv_offset;
+ PyObject *__pyx_n_s_version_info;
+ PyObject *__pyx_n_s_width;
+ PyObject *__pyx_n_s_x;
+ PyObject *__pyx_int_0;
+ PyObject *__pyx_int_1;
+ PyObject *__pyx_int_3;
+ PyObject *__pyx_int_112105877;
+ PyObject *__pyx_int_136983863;
+ PyObject *__pyx_int_184977713;
+ PyObject *__pyx_int_neg_1;
+ PyObject *__pyx_slice__5;
+ PyObject *__pyx_tuple__4;
+ PyObject *__pyx_tuple__8;
+ PyObject *__pyx_tuple__15;
+ PyObject *__pyx_tuple__16;
+ PyObject *__pyx_tuple__17;
+ PyObject *__pyx_tuple__18;
+ PyObject *__pyx_tuple__19;
+ PyObject *__pyx_tuple__20;
+ PyObject *__pyx_tuple__21;
+ PyObject *__pyx_tuple__22;
+ PyObject *__pyx_tuple__23;
+ PyObject *__pyx_tuple__24;
+ PyObject *__pyx_tuple__25;
+ PyObject *__pyx_tuple__26;
+ PyObject *__pyx_tuple__28;
+ PyObject *__pyx_tuple__30;
+ PyObject *__pyx_tuple__32;
+ PyObject *__pyx_tuple__36;
+ PyObject *__pyx_codeobj__27;
+ PyObject *__pyx_codeobj__29;
+ PyObject *__pyx_codeobj__31;
+ PyObject *__pyx_codeobj__33;
+ PyObject *__pyx_codeobj__34;
+ PyObject *__pyx_codeobj__35;
+ PyObject *__pyx_codeobj__37;
+ PyObject *__pyx_codeobj__38;
+ PyObject *__pyx_codeobj__39;
+} __pyx_mstate;
+
+#if CYTHON_USE_MODULE_STATE
+#ifdef __cplusplus
+namespace {
+ extern struct PyModuleDef __pyx_moduledef;
+} /* anonymous namespace */
+#else
+static struct PyModuleDef __pyx_moduledef;
+#endif
+
+#define __pyx_mstate(o) ((__pyx_mstate *)__Pyx_PyModule_GetState(o))
+
+#define __pyx_mstate_global (__pyx_mstate(PyState_FindModule(&__pyx_moduledef)))
+
+#define __pyx_m (PyState_FindModule(&__pyx_moduledef))
+#else
+static __pyx_mstate __pyx_mstate_global_static =
+#ifdef __cplusplus
+ {};
+#else
+ {0};
+#endif
+static __pyx_mstate *__pyx_mstate_global = &__pyx_mstate_global_static;
+#endif
+/* #### Code section: module_state_clear ### */
+#if CYTHON_USE_MODULE_STATE
+static int __pyx_m_clear(PyObject *m) {
+ __pyx_mstate *clear_module_state = __pyx_mstate(m);
+ if (!clear_module_state) return 0;
+ Py_CLEAR(clear_module_state->__pyx_d);
+ Py_CLEAR(clear_module_state->__pyx_b);
+ Py_CLEAR(clear_module_state->__pyx_cython_runtime);
+ Py_CLEAR(clear_module_state->__pyx_empty_tuple);
+ Py_CLEAR(clear_module_state->__pyx_empty_bytes);
+ Py_CLEAR(clear_module_state->__pyx_empty_unicode);
+ #ifdef __Pyx_CyFunction_USED
+ Py_CLEAR(clear_module_state->__pyx_CyFunctionType);
+ #endif
+ #ifdef __Pyx_FusedFunction_USED
+ Py_CLEAR(clear_module_state->__pyx_FusedFunctionType);
+ #endif
+ Py_CLEAR(clear_module_state->__pyx_ptype_4msgq_9visionipc_13visionipc_pyx_CLContext);
+ Py_CLEAR(clear_module_state->__pyx_ptype_4msgq_9visionipc_13visionipc_pyx_VisionBuf);
+ Py_CLEAR(clear_module_state->__pyx_ptype_7cpython_4type_type);
+ Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_dtype);
+ Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flatiter);
+ Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_broadcast);
+ Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ndarray);
+ Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_generic);
+ Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_number);
+ Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_integer);
+ Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_signedinteger);
+ Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_unsignedinteger);
+ Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_inexact);
+ Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_floating);
+ Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_complexfloating);
+ Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_flexible);
+ Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_character);
+ Py_CLEAR(clear_module_state->__pyx_ptype_5numpy_ufunc);
+ Py_CLEAR(clear_module_state->__pyx_ptype_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLContext);
+ Py_CLEAR(clear_module_state->__pyx_type_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLContext);
+ Py_CLEAR(clear_module_state->__pyx_ptype_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLMem);
+ Py_CLEAR(clear_module_state->__pyx_type_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLMem);
+ Py_CLEAR(clear_module_state->__pyx_ptype_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_ModelFrame);
+ Py_CLEAR(clear_module_state->__pyx_type_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_ModelFrame);
+ Py_CLEAR(clear_module_state->__pyx_array_type);
+ Py_CLEAR(clear_module_state->__pyx_type___pyx_array);
+ Py_CLEAR(clear_module_state->__pyx_MemviewEnum_type);
+ Py_CLEAR(clear_module_state->__pyx_type___pyx_MemviewEnum);
+ Py_CLEAR(clear_module_state->__pyx_memoryview_type);
+ Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryview);
+ Py_CLEAR(clear_module_state->__pyx_memoryviewslice_type);
+ Py_CLEAR(clear_module_state->__pyx_type___pyx_memoryviewslice);
+ Py_CLEAR(clear_module_state->__pyx_kp_u_);
+ Py_CLEAR(clear_module_state->__pyx_n_s_ASCII);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_All_dimensions_preceding_dimensi);
+ Py_CLEAR(clear_module_state->__pyx_n_s_AssertionError);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_Buffer_view_does_not_expose_stri);
+ Py_CLEAR(clear_module_state->__pyx_n_s_CLContext);
+ Py_CLEAR(clear_module_state->__pyx_n_s_CLContext___reduce_cython);
+ Py_CLEAR(clear_module_state->__pyx_n_s_CLContext___setstate_cython);
+ Py_CLEAR(clear_module_state->__pyx_n_s_CLMem);
+ Py_CLEAR(clear_module_state->__pyx_n_s_CLMem___reduce_cython);
+ Py_CLEAR(clear_module_state->__pyx_n_s_CLMem___setstate_cython);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_Can_only_create_a_buffer_that_is);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_assign_to_read_only_memor);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_create_writable_memory_vi);
+ Py_CLEAR(clear_module_state->__pyx_kp_u_Cannot_index_with_type);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_Cannot_transpose_memoryview_with);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_Dimension_d_is_not_direct);
+ Py_CLEAR(clear_module_state->__pyx_n_s_Ellipsis);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_Empty_shape_tuple_for_cython_arr);
+ Py_CLEAR(clear_module_state->__pyx_n_s_ImportError);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0);
+ Py_CLEAR(clear_module_state->__pyx_n_s_IndexError);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_Index_out_of_bounds_axis_d);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_Indirect_dimensions_not_supporte);
+ Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_mode_expected_c_or_fortr);
+ Py_CLEAR(clear_module_state->__pyx_kp_u_Invalid_shape_in_axis);
+ Py_CLEAR(clear_module_state->__pyx_n_s_MemoryError);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_MemoryView_of_r_at_0x_x);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_MemoryView_of_r_object);
+ Py_CLEAR(clear_module_state->__pyx_n_s_ModelFrame);
+ Py_CLEAR(clear_module_state->__pyx_n_s_ModelFrame___reduce_cython);
+ Py_CLEAR(clear_module_state->__pyx_n_s_ModelFrame___setstate_cython);
+ Py_CLEAR(clear_module_state->__pyx_n_s_ModelFrame_prepare);
+ Py_CLEAR(clear_module_state->__pyx_n_b_O);
+ Py_CLEAR(clear_module_state->__pyx_kp_u_Out_of_bounds_on_buffer_access_a);
+ Py_CLEAR(clear_module_state->__pyx_n_s_PickleError);
+ Py_CLEAR(clear_module_state->__pyx_n_s_Sequence);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_Step_may_not_be_zero_axis_d);
+ Py_CLEAR(clear_module_state->__pyx_kp_b_T);
+ Py_CLEAR(clear_module_state->__pyx_n_s_TypeError);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_Unable_to_convert_item_to_object);
+ Py_CLEAR(clear_module_state->__pyx_n_s_ValueError);
+ Py_CLEAR(clear_module_state->__pyx_n_s_View_MemoryView);
+ Py_CLEAR(clear_module_state->__pyx_kp_b__10);
+ Py_CLEAR(clear_module_state->__pyx_kp_b__11);
+ Py_CLEAR(clear_module_state->__pyx_kp_b__12);
+ Py_CLEAR(clear_module_state->__pyx_kp_u__13);
+ Py_CLEAR(clear_module_state->__pyx_kp_u__14);
+ Py_CLEAR(clear_module_state->__pyx_kp_u__2);
+ Py_CLEAR(clear_module_state->__pyx_n_s__3);
+ Py_CLEAR(clear_module_state->__pyx_n_s__40);
+ Py_CLEAR(clear_module_state->__pyx_kp_u__6);
+ Py_CLEAR(clear_module_state->__pyx_kp_u__7);
+ Py_CLEAR(clear_module_state->__pyx_kp_b__9);
+ Py_CLEAR(clear_module_state->__pyx_n_s_abc);
+ Py_CLEAR(clear_module_state->__pyx_n_s_allocate_buffer);
+ Py_CLEAR(clear_module_state->__pyx_kp_u_and);
+ Py_CLEAR(clear_module_state->__pyx_n_s_asarray);
+ Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines);
+ Py_CLEAR(clear_module_state->__pyx_n_s_base);
+ Py_CLEAR(clear_module_state->__pyx_n_s_buf);
+ Py_CLEAR(clear_module_state->__pyx_n_s_c);
+ Py_CLEAR(clear_module_state->__pyx_n_u_c);
+ Py_CLEAR(clear_module_state->__pyx_n_s_class);
+ Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem);
+ Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback);
+ Py_CLEAR(clear_module_state->__pyx_n_s_collections);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_collections_abc);
+ Py_CLEAR(clear_module_state->__pyx_n_s_context);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_contiguous_and_direct);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_contiguous_and_indirect);
+ Py_CLEAR(clear_module_state->__pyx_n_s_count);
+ Py_CLEAR(clear_module_state->__pyx_n_s_cprojection);
+ Py_CLEAR(clear_module_state->__pyx_n_s_data);
+ Py_CLEAR(clear_module_state->__pyx_n_s_dict);
+ Py_CLEAR(clear_module_state->__pyx_kp_u_disable);
+ Py_CLEAR(clear_module_state->__pyx_n_s_dtype_is_object);
+ Py_CLEAR(clear_module_state->__pyx_kp_u_enable);
+ Py_CLEAR(clear_module_state->__pyx_n_s_encode);
+ Py_CLEAR(clear_module_state->__pyx_n_s_enumerate);
+ Py_CLEAR(clear_module_state->__pyx_n_s_error);
+ Py_CLEAR(clear_module_state->__pyx_n_s_flags);
+ Py_CLEAR(clear_module_state->__pyx_n_s_format);
+ Py_CLEAR(clear_module_state->__pyx_n_s_fortran);
+ Py_CLEAR(clear_module_state->__pyx_n_u_fortran);
+ Py_CLEAR(clear_module_state->__pyx_kp_u_gc);
+ Py_CLEAR(clear_module_state->__pyx_n_s_getstate);
+ Py_CLEAR(clear_module_state->__pyx_kp_u_got);
+ Py_CLEAR(clear_module_state->__pyx_kp_u_got_differing_extents_in_dimensi);
+ Py_CLEAR(clear_module_state->__pyx_n_s_height);
+ Py_CLEAR(clear_module_state->__pyx_n_s_id);
+ Py_CLEAR(clear_module_state->__pyx_n_s_import);
+ Py_CLEAR(clear_module_state->__pyx_n_s_index);
+ Py_CLEAR(clear_module_state->__pyx_n_s_initializing);
+ Py_CLEAR(clear_module_state->__pyx_n_s_is_coroutine);
+ Py_CLEAR(clear_module_state->__pyx_kp_u_isenabled);
+ Py_CLEAR(clear_module_state->__pyx_n_s_itemsize);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_itemsize_0_for_cython_array);
+ Py_CLEAR(clear_module_state->__pyx_n_s_join);
+ Py_CLEAR(clear_module_state->__pyx_n_s_main);
+ Py_CLEAR(clear_module_state->__pyx_n_s_memview);
+ Py_CLEAR(clear_module_state->__pyx_n_s_mode);
+ Py_CLEAR(clear_module_state->__pyx_n_s_name);
+ Py_CLEAR(clear_module_state->__pyx_n_s_name_2);
+ Py_CLEAR(clear_module_state->__pyx_n_s_ndim);
+ Py_CLEAR(clear_module_state->__pyx_n_s_new);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_no_default___reduce___due_to_non);
+ Py_CLEAR(clear_module_state->__pyx_n_s_np);
+ Py_CLEAR(clear_module_state->__pyx_n_s_numpy);
+ Py_CLEAR(clear_module_state->__pyx_kp_u_numpy_core_multiarray_failed_to);
+ Py_CLEAR(clear_module_state->__pyx_kp_u_numpy_core_umath_failed_to_impor);
+ Py_CLEAR(clear_module_state->__pyx_n_s_obj);
+ Py_CLEAR(clear_module_state->__pyx_n_s_output);
+ Py_CLEAR(clear_module_state->__pyx_n_s_pack);
+ Py_CLEAR(clear_module_state->__pyx_n_s_pickle);
+ Py_CLEAR(clear_module_state->__pyx_n_s_prepare);
+ Py_CLEAR(clear_module_state->__pyx_n_s_projection);
+ Py_CLEAR(clear_module_state->__pyx_n_s_pyx_PickleError);
+ Py_CLEAR(clear_module_state->__pyx_n_s_pyx_checksum);
+ Py_CLEAR(clear_module_state->__pyx_n_s_pyx_result);
+ Py_CLEAR(clear_module_state->__pyx_n_s_pyx_state);
+ Py_CLEAR(clear_module_state->__pyx_n_s_pyx_type);
+ Py_CLEAR(clear_module_state->__pyx_n_s_pyx_unpickle_Enum);
+ Py_CLEAR(clear_module_state->__pyx_n_s_pyx_vtable);
+ Py_CLEAR(clear_module_state->__pyx_n_s_range);
+ Py_CLEAR(clear_module_state->__pyx_n_s_reduce);
+ Py_CLEAR(clear_module_state->__pyx_n_s_reduce_cython);
+ Py_CLEAR(clear_module_state->__pyx_n_s_reduce_ex);
+ Py_CLEAR(clear_module_state->__pyx_n_s_register);
+ Py_CLEAR(clear_module_state->__pyx_n_s_self);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_self_mem_cannot_be_converted_to);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_selfdrive_classic_modeld_models);
+ Py_CLEAR(clear_module_state->__pyx_n_s_selfdrive_classic_modeld_models_2);
+ Py_CLEAR(clear_module_state->__pyx_n_s_setstate);
+ Py_CLEAR(clear_module_state->__pyx_n_s_setstate_cython);
+ Py_CLEAR(clear_module_state->__pyx_n_s_shape);
+ Py_CLEAR(clear_module_state->__pyx_n_s_sigmoid);
+ Py_CLEAR(clear_module_state->__pyx_n_s_size);
+ Py_CLEAR(clear_module_state->__pyx_n_s_spec);
+ Py_CLEAR(clear_module_state->__pyx_n_s_start);
+ Py_CLEAR(clear_module_state->__pyx_n_s_step);
+ Py_CLEAR(clear_module_state->__pyx_n_s_stop);
+ Py_CLEAR(clear_module_state->__pyx_n_s_stride);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_direct);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_direct_or_indirect);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_strided_and_indirect);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_stringsource);
+ Py_CLEAR(clear_module_state->__pyx_n_s_struct);
+ Py_CLEAR(clear_module_state->__pyx_n_s_sys);
+ Py_CLEAR(clear_module_state->__pyx_n_s_test);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_unable_to_allocate_array_data);
+ Py_CLEAR(clear_module_state->__pyx_kp_s_unable_to_allocate_shape_and_str);
+ Py_CLEAR(clear_module_state->__pyx_n_s_unpack);
+ Py_CLEAR(clear_module_state->__pyx_n_s_update);
+ Py_CLEAR(clear_module_state->__pyx_n_s_uv_offset);
+ Py_CLEAR(clear_module_state->__pyx_n_s_version_info);
+ Py_CLEAR(clear_module_state->__pyx_n_s_width);
+ Py_CLEAR(clear_module_state->__pyx_n_s_x);
+ Py_CLEAR(clear_module_state->__pyx_int_0);
+ Py_CLEAR(clear_module_state->__pyx_int_1);
+ Py_CLEAR(clear_module_state->__pyx_int_3);
+ Py_CLEAR(clear_module_state->__pyx_int_112105877);
+ Py_CLEAR(clear_module_state->__pyx_int_136983863);
+ Py_CLEAR(clear_module_state->__pyx_int_184977713);
+ Py_CLEAR(clear_module_state->__pyx_int_neg_1);
+ Py_CLEAR(clear_module_state->__pyx_slice__5);
+ Py_CLEAR(clear_module_state->__pyx_tuple__4);
+ Py_CLEAR(clear_module_state->__pyx_tuple__8);
+ Py_CLEAR(clear_module_state->__pyx_tuple__15);
+ Py_CLEAR(clear_module_state->__pyx_tuple__16);
+ Py_CLEAR(clear_module_state->__pyx_tuple__17);
+ Py_CLEAR(clear_module_state->__pyx_tuple__18);
+ Py_CLEAR(clear_module_state->__pyx_tuple__19);
+ Py_CLEAR(clear_module_state->__pyx_tuple__20);
+ Py_CLEAR(clear_module_state->__pyx_tuple__21);
+ Py_CLEAR(clear_module_state->__pyx_tuple__22);
+ Py_CLEAR(clear_module_state->__pyx_tuple__23);
+ Py_CLEAR(clear_module_state->__pyx_tuple__24);
+ Py_CLEAR(clear_module_state->__pyx_tuple__25);
+ Py_CLEAR(clear_module_state->__pyx_tuple__26);
+ Py_CLEAR(clear_module_state->__pyx_tuple__28);
+ Py_CLEAR(clear_module_state->__pyx_tuple__30);
+ Py_CLEAR(clear_module_state->__pyx_tuple__32);
+ Py_CLEAR(clear_module_state->__pyx_tuple__36);
+ Py_CLEAR(clear_module_state->__pyx_codeobj__27);
+ Py_CLEAR(clear_module_state->__pyx_codeobj__29);
+ Py_CLEAR(clear_module_state->__pyx_codeobj__31);
+ Py_CLEAR(clear_module_state->__pyx_codeobj__33);
+ Py_CLEAR(clear_module_state->__pyx_codeobj__34);
+ Py_CLEAR(clear_module_state->__pyx_codeobj__35);
+ Py_CLEAR(clear_module_state->__pyx_codeobj__37);
+ Py_CLEAR(clear_module_state->__pyx_codeobj__38);
+ Py_CLEAR(clear_module_state->__pyx_codeobj__39);
+ return 0;
+}
+#endif
+/* #### Code section: module_state_traverse ### */
+#if CYTHON_USE_MODULE_STATE
+static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
+ __pyx_mstate *traverse_module_state = __pyx_mstate(m);
+ if (!traverse_module_state) return 0;
+ Py_VISIT(traverse_module_state->__pyx_d);
+ Py_VISIT(traverse_module_state->__pyx_b);
+ Py_VISIT(traverse_module_state->__pyx_cython_runtime);
+ Py_VISIT(traverse_module_state->__pyx_empty_tuple);
+ Py_VISIT(traverse_module_state->__pyx_empty_bytes);
+ Py_VISIT(traverse_module_state->__pyx_empty_unicode);
+ #ifdef __Pyx_CyFunction_USED
+ Py_VISIT(traverse_module_state->__pyx_CyFunctionType);
+ #endif
+ #ifdef __Pyx_FusedFunction_USED
+ Py_VISIT(traverse_module_state->__pyx_FusedFunctionType);
+ #endif
+ Py_VISIT(traverse_module_state->__pyx_ptype_4msgq_9visionipc_13visionipc_pyx_CLContext);
+ Py_VISIT(traverse_module_state->__pyx_ptype_4msgq_9visionipc_13visionipc_pyx_VisionBuf);
+ Py_VISIT(traverse_module_state->__pyx_ptype_7cpython_4type_type);
+ Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_dtype);
+ Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flatiter);
+ Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_broadcast);
+ Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ndarray);
+ Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_generic);
+ Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_number);
+ Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_integer);
+ Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_signedinteger);
+ Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_unsignedinteger);
+ Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_inexact);
+ Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_floating);
+ Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_complexfloating);
+ Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_flexible);
+ Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_character);
+ Py_VISIT(traverse_module_state->__pyx_ptype_5numpy_ufunc);
+ Py_VISIT(traverse_module_state->__pyx_ptype_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLContext);
+ Py_VISIT(traverse_module_state->__pyx_type_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLContext);
+ Py_VISIT(traverse_module_state->__pyx_ptype_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLMem);
+ Py_VISIT(traverse_module_state->__pyx_type_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLMem);
+ Py_VISIT(traverse_module_state->__pyx_ptype_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_ModelFrame);
+ Py_VISIT(traverse_module_state->__pyx_type_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_ModelFrame);
+ Py_VISIT(traverse_module_state->__pyx_array_type);
+ Py_VISIT(traverse_module_state->__pyx_type___pyx_array);
+ Py_VISIT(traverse_module_state->__pyx_MemviewEnum_type);
+ Py_VISIT(traverse_module_state->__pyx_type___pyx_MemviewEnum);
+ Py_VISIT(traverse_module_state->__pyx_memoryview_type);
+ Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryview);
+ Py_VISIT(traverse_module_state->__pyx_memoryviewslice_type);
+ Py_VISIT(traverse_module_state->__pyx_type___pyx_memoryviewslice);
+ Py_VISIT(traverse_module_state->__pyx_kp_u_);
+ Py_VISIT(traverse_module_state->__pyx_n_s_ASCII);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_All_dimensions_preceding_dimensi);
+ Py_VISIT(traverse_module_state->__pyx_n_s_AssertionError);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_Buffer_view_does_not_expose_stri);
+ Py_VISIT(traverse_module_state->__pyx_n_s_CLContext);
+ Py_VISIT(traverse_module_state->__pyx_n_s_CLContext___reduce_cython);
+ Py_VISIT(traverse_module_state->__pyx_n_s_CLContext___setstate_cython);
+ Py_VISIT(traverse_module_state->__pyx_n_s_CLMem);
+ Py_VISIT(traverse_module_state->__pyx_n_s_CLMem___reduce_cython);
+ Py_VISIT(traverse_module_state->__pyx_n_s_CLMem___setstate_cython);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_Can_only_create_a_buffer_that_is);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_assign_to_read_only_memor);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_create_writable_memory_vi);
+ Py_VISIT(traverse_module_state->__pyx_kp_u_Cannot_index_with_type);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_Cannot_transpose_memoryview_with);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_Dimension_d_is_not_direct);
+ Py_VISIT(traverse_module_state->__pyx_n_s_Ellipsis);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_Empty_shape_tuple_for_cython_arr);
+ Py_VISIT(traverse_module_state->__pyx_n_s_ImportError);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0);
+ Py_VISIT(traverse_module_state->__pyx_n_s_IndexError);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_Index_out_of_bounds_axis_d);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_Indirect_dimensions_not_supporte);
+ Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_mode_expected_c_or_fortr);
+ Py_VISIT(traverse_module_state->__pyx_kp_u_Invalid_shape_in_axis);
+ Py_VISIT(traverse_module_state->__pyx_n_s_MemoryError);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_MemoryView_of_r_at_0x_x);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_MemoryView_of_r_object);
+ Py_VISIT(traverse_module_state->__pyx_n_s_ModelFrame);
+ Py_VISIT(traverse_module_state->__pyx_n_s_ModelFrame___reduce_cython);
+ Py_VISIT(traverse_module_state->__pyx_n_s_ModelFrame___setstate_cython);
+ Py_VISIT(traverse_module_state->__pyx_n_s_ModelFrame_prepare);
+ Py_VISIT(traverse_module_state->__pyx_n_b_O);
+ Py_VISIT(traverse_module_state->__pyx_kp_u_Out_of_bounds_on_buffer_access_a);
+ Py_VISIT(traverse_module_state->__pyx_n_s_PickleError);
+ Py_VISIT(traverse_module_state->__pyx_n_s_Sequence);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_Step_may_not_be_zero_axis_d);
+ Py_VISIT(traverse_module_state->__pyx_kp_b_T);
+ Py_VISIT(traverse_module_state->__pyx_n_s_TypeError);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_Unable_to_convert_item_to_object);
+ Py_VISIT(traverse_module_state->__pyx_n_s_ValueError);
+ Py_VISIT(traverse_module_state->__pyx_n_s_View_MemoryView);
+ Py_VISIT(traverse_module_state->__pyx_kp_b__10);
+ Py_VISIT(traverse_module_state->__pyx_kp_b__11);
+ Py_VISIT(traverse_module_state->__pyx_kp_b__12);
+ Py_VISIT(traverse_module_state->__pyx_kp_u__13);
+ Py_VISIT(traverse_module_state->__pyx_kp_u__14);
+ Py_VISIT(traverse_module_state->__pyx_kp_u__2);
+ Py_VISIT(traverse_module_state->__pyx_n_s__3);
+ Py_VISIT(traverse_module_state->__pyx_n_s__40);
+ Py_VISIT(traverse_module_state->__pyx_kp_u__6);
+ Py_VISIT(traverse_module_state->__pyx_kp_u__7);
+ Py_VISIT(traverse_module_state->__pyx_kp_b__9);
+ Py_VISIT(traverse_module_state->__pyx_n_s_abc);
+ Py_VISIT(traverse_module_state->__pyx_n_s_allocate_buffer);
+ Py_VISIT(traverse_module_state->__pyx_kp_u_and);
+ Py_VISIT(traverse_module_state->__pyx_n_s_asarray);
+ Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines);
+ Py_VISIT(traverse_module_state->__pyx_n_s_base);
+ Py_VISIT(traverse_module_state->__pyx_n_s_buf);
+ Py_VISIT(traverse_module_state->__pyx_n_s_c);
+ Py_VISIT(traverse_module_state->__pyx_n_u_c);
+ Py_VISIT(traverse_module_state->__pyx_n_s_class);
+ Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem);
+ Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback);
+ Py_VISIT(traverse_module_state->__pyx_n_s_collections);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_collections_abc);
+ Py_VISIT(traverse_module_state->__pyx_n_s_context);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_contiguous_and_direct);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_contiguous_and_indirect);
+ Py_VISIT(traverse_module_state->__pyx_n_s_count);
+ Py_VISIT(traverse_module_state->__pyx_n_s_cprojection);
+ Py_VISIT(traverse_module_state->__pyx_n_s_data);
+ Py_VISIT(traverse_module_state->__pyx_n_s_dict);
+ Py_VISIT(traverse_module_state->__pyx_kp_u_disable);
+ Py_VISIT(traverse_module_state->__pyx_n_s_dtype_is_object);
+ Py_VISIT(traverse_module_state->__pyx_kp_u_enable);
+ Py_VISIT(traverse_module_state->__pyx_n_s_encode);
+ Py_VISIT(traverse_module_state->__pyx_n_s_enumerate);
+ Py_VISIT(traverse_module_state->__pyx_n_s_error);
+ Py_VISIT(traverse_module_state->__pyx_n_s_flags);
+ Py_VISIT(traverse_module_state->__pyx_n_s_format);
+ Py_VISIT(traverse_module_state->__pyx_n_s_fortran);
+ Py_VISIT(traverse_module_state->__pyx_n_u_fortran);
+ Py_VISIT(traverse_module_state->__pyx_kp_u_gc);
+ Py_VISIT(traverse_module_state->__pyx_n_s_getstate);
+ Py_VISIT(traverse_module_state->__pyx_kp_u_got);
+ Py_VISIT(traverse_module_state->__pyx_kp_u_got_differing_extents_in_dimensi);
+ Py_VISIT(traverse_module_state->__pyx_n_s_height);
+ Py_VISIT(traverse_module_state->__pyx_n_s_id);
+ Py_VISIT(traverse_module_state->__pyx_n_s_import);
+ Py_VISIT(traverse_module_state->__pyx_n_s_index);
+ Py_VISIT(traverse_module_state->__pyx_n_s_initializing);
+ Py_VISIT(traverse_module_state->__pyx_n_s_is_coroutine);
+ Py_VISIT(traverse_module_state->__pyx_kp_u_isenabled);
+ Py_VISIT(traverse_module_state->__pyx_n_s_itemsize);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_itemsize_0_for_cython_array);
+ Py_VISIT(traverse_module_state->__pyx_n_s_join);
+ Py_VISIT(traverse_module_state->__pyx_n_s_main);
+ Py_VISIT(traverse_module_state->__pyx_n_s_memview);
+ Py_VISIT(traverse_module_state->__pyx_n_s_mode);
+ Py_VISIT(traverse_module_state->__pyx_n_s_name);
+ Py_VISIT(traverse_module_state->__pyx_n_s_name_2);
+ Py_VISIT(traverse_module_state->__pyx_n_s_ndim);
+ Py_VISIT(traverse_module_state->__pyx_n_s_new);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_no_default___reduce___due_to_non);
+ Py_VISIT(traverse_module_state->__pyx_n_s_np);
+ Py_VISIT(traverse_module_state->__pyx_n_s_numpy);
+ Py_VISIT(traverse_module_state->__pyx_kp_u_numpy_core_multiarray_failed_to);
+ Py_VISIT(traverse_module_state->__pyx_kp_u_numpy_core_umath_failed_to_impor);
+ Py_VISIT(traverse_module_state->__pyx_n_s_obj);
+ Py_VISIT(traverse_module_state->__pyx_n_s_output);
+ Py_VISIT(traverse_module_state->__pyx_n_s_pack);
+ Py_VISIT(traverse_module_state->__pyx_n_s_pickle);
+ Py_VISIT(traverse_module_state->__pyx_n_s_prepare);
+ Py_VISIT(traverse_module_state->__pyx_n_s_projection);
+ Py_VISIT(traverse_module_state->__pyx_n_s_pyx_PickleError);
+ Py_VISIT(traverse_module_state->__pyx_n_s_pyx_checksum);
+ Py_VISIT(traverse_module_state->__pyx_n_s_pyx_result);
+ Py_VISIT(traverse_module_state->__pyx_n_s_pyx_state);
+ Py_VISIT(traverse_module_state->__pyx_n_s_pyx_type);
+ Py_VISIT(traverse_module_state->__pyx_n_s_pyx_unpickle_Enum);
+ Py_VISIT(traverse_module_state->__pyx_n_s_pyx_vtable);
+ Py_VISIT(traverse_module_state->__pyx_n_s_range);
+ Py_VISIT(traverse_module_state->__pyx_n_s_reduce);
+ Py_VISIT(traverse_module_state->__pyx_n_s_reduce_cython);
+ Py_VISIT(traverse_module_state->__pyx_n_s_reduce_ex);
+ Py_VISIT(traverse_module_state->__pyx_n_s_register);
+ Py_VISIT(traverse_module_state->__pyx_n_s_self);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_self_mem_cannot_be_converted_to);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_selfdrive_classic_modeld_models);
+ Py_VISIT(traverse_module_state->__pyx_n_s_selfdrive_classic_modeld_models_2);
+ Py_VISIT(traverse_module_state->__pyx_n_s_setstate);
+ Py_VISIT(traverse_module_state->__pyx_n_s_setstate_cython);
+ Py_VISIT(traverse_module_state->__pyx_n_s_shape);
+ Py_VISIT(traverse_module_state->__pyx_n_s_sigmoid);
+ Py_VISIT(traverse_module_state->__pyx_n_s_size);
+ Py_VISIT(traverse_module_state->__pyx_n_s_spec);
+ Py_VISIT(traverse_module_state->__pyx_n_s_start);
+ Py_VISIT(traverse_module_state->__pyx_n_s_step);
+ Py_VISIT(traverse_module_state->__pyx_n_s_stop);
+ Py_VISIT(traverse_module_state->__pyx_n_s_stride);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_direct);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_direct_or_indirect);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_strided_and_indirect);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_stringsource);
+ Py_VISIT(traverse_module_state->__pyx_n_s_struct);
+ Py_VISIT(traverse_module_state->__pyx_n_s_sys);
+ Py_VISIT(traverse_module_state->__pyx_n_s_test);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_unable_to_allocate_array_data);
+ Py_VISIT(traverse_module_state->__pyx_kp_s_unable_to_allocate_shape_and_str);
+ Py_VISIT(traverse_module_state->__pyx_n_s_unpack);
+ Py_VISIT(traverse_module_state->__pyx_n_s_update);
+ Py_VISIT(traverse_module_state->__pyx_n_s_uv_offset);
+ Py_VISIT(traverse_module_state->__pyx_n_s_version_info);
+ Py_VISIT(traverse_module_state->__pyx_n_s_width);
+ Py_VISIT(traverse_module_state->__pyx_n_s_x);
+ Py_VISIT(traverse_module_state->__pyx_int_0);
+ Py_VISIT(traverse_module_state->__pyx_int_1);
+ Py_VISIT(traverse_module_state->__pyx_int_3);
+ Py_VISIT(traverse_module_state->__pyx_int_112105877);
+ Py_VISIT(traverse_module_state->__pyx_int_136983863);
+ Py_VISIT(traverse_module_state->__pyx_int_184977713);
+ Py_VISIT(traverse_module_state->__pyx_int_neg_1);
+ Py_VISIT(traverse_module_state->__pyx_slice__5);
+ Py_VISIT(traverse_module_state->__pyx_tuple__4);
+ Py_VISIT(traverse_module_state->__pyx_tuple__8);
+ Py_VISIT(traverse_module_state->__pyx_tuple__15);
+ Py_VISIT(traverse_module_state->__pyx_tuple__16);
+ Py_VISIT(traverse_module_state->__pyx_tuple__17);
+ Py_VISIT(traverse_module_state->__pyx_tuple__18);
+ Py_VISIT(traverse_module_state->__pyx_tuple__19);
+ Py_VISIT(traverse_module_state->__pyx_tuple__20);
+ Py_VISIT(traverse_module_state->__pyx_tuple__21);
+ Py_VISIT(traverse_module_state->__pyx_tuple__22);
+ Py_VISIT(traverse_module_state->__pyx_tuple__23);
+ Py_VISIT(traverse_module_state->__pyx_tuple__24);
+ Py_VISIT(traverse_module_state->__pyx_tuple__25);
+ Py_VISIT(traverse_module_state->__pyx_tuple__26);
+ Py_VISIT(traverse_module_state->__pyx_tuple__28);
+ Py_VISIT(traverse_module_state->__pyx_tuple__30);
+ Py_VISIT(traverse_module_state->__pyx_tuple__32);
+ Py_VISIT(traverse_module_state->__pyx_tuple__36);
+ Py_VISIT(traverse_module_state->__pyx_codeobj__27);
+ Py_VISIT(traverse_module_state->__pyx_codeobj__29);
+ Py_VISIT(traverse_module_state->__pyx_codeobj__31);
+ Py_VISIT(traverse_module_state->__pyx_codeobj__33);
+ Py_VISIT(traverse_module_state->__pyx_codeobj__34);
+ Py_VISIT(traverse_module_state->__pyx_codeobj__35);
+ Py_VISIT(traverse_module_state->__pyx_codeobj__37);
+ Py_VISIT(traverse_module_state->__pyx_codeobj__38);
+ Py_VISIT(traverse_module_state->__pyx_codeobj__39);
+ return 0;
+}
+#endif
+/* #### Code section: module_state_defines ### */
+#define __pyx_d __pyx_mstate_global->__pyx_d
+#define __pyx_b __pyx_mstate_global->__pyx_b
+#define __pyx_cython_runtime __pyx_mstate_global->__pyx_cython_runtime
+#define __pyx_empty_tuple __pyx_mstate_global->__pyx_empty_tuple
+#define __pyx_empty_bytes __pyx_mstate_global->__pyx_empty_bytes
+#define __pyx_empty_unicode __pyx_mstate_global->__pyx_empty_unicode
+#ifdef __Pyx_CyFunction_USED
+#define __pyx_CyFunctionType __pyx_mstate_global->__pyx_CyFunctionType
+#endif
+#ifdef __Pyx_FusedFunction_USED
+#define __pyx_FusedFunctionType __pyx_mstate_global->__pyx_FusedFunctionType
+#endif
+#ifdef __Pyx_Generator_USED
+#define __pyx_GeneratorType __pyx_mstate_global->__pyx_GeneratorType
+#endif
+#ifdef __Pyx_IterableCoroutine_USED
+#define __pyx_IterableCoroutineType __pyx_mstate_global->__pyx_IterableCoroutineType
+#endif
+#ifdef __Pyx_Coroutine_USED
+#define __pyx_CoroutineAwaitType __pyx_mstate_global->__pyx_CoroutineAwaitType
+#endif
+#ifdef __Pyx_Coroutine_USED
+#define __pyx_CoroutineType __pyx_mstate_global->__pyx_CoroutineType
+#endif
+#if CYTHON_USE_MODULE_STATE
+#endif
+#if CYTHON_USE_MODULE_STATE
+#endif
+#if CYTHON_USE_MODULE_STATE
+#endif
+#if CYTHON_USE_MODULE_STATE
+#endif
+#if CYTHON_USE_MODULE_STATE
+#endif
+#if CYTHON_USE_MODULE_STATE
+#endif
+#if CYTHON_USE_MODULE_STATE
+#endif
+#if CYTHON_USE_MODULE_STATE
+#endif
+#if CYTHON_USE_MODULE_STATE
+#endif
+#define __pyx_ptype_4msgq_9visionipc_13visionipc_pyx_CLContext __pyx_mstate_global->__pyx_ptype_4msgq_9visionipc_13visionipc_pyx_CLContext
+#define __pyx_ptype_4msgq_9visionipc_13visionipc_pyx_VisionBuf __pyx_mstate_global->__pyx_ptype_4msgq_9visionipc_13visionipc_pyx_VisionBuf
+#if CYTHON_USE_MODULE_STATE
+#endif
+#if CYTHON_USE_MODULE_STATE
+#endif
+#if CYTHON_USE_MODULE_STATE
+#endif
+#define __pyx_ptype_7cpython_4type_type __pyx_mstate_global->__pyx_ptype_7cpython_4type_type
+#if CYTHON_USE_MODULE_STATE
+#endif
+#if CYTHON_USE_MODULE_STATE
+#endif
+#if CYTHON_USE_MODULE_STATE
+#endif
+#if CYTHON_USE_MODULE_STATE
+#endif
+#if CYTHON_USE_MODULE_STATE
+#endif
+#define __pyx_ptype_5numpy_dtype __pyx_mstate_global->__pyx_ptype_5numpy_dtype
+#define __pyx_ptype_5numpy_flatiter __pyx_mstate_global->__pyx_ptype_5numpy_flatiter
+#define __pyx_ptype_5numpy_broadcast __pyx_mstate_global->__pyx_ptype_5numpy_broadcast
+#define __pyx_ptype_5numpy_ndarray __pyx_mstate_global->__pyx_ptype_5numpy_ndarray
+#define __pyx_ptype_5numpy_generic __pyx_mstate_global->__pyx_ptype_5numpy_generic
+#define __pyx_ptype_5numpy_number __pyx_mstate_global->__pyx_ptype_5numpy_number
+#define __pyx_ptype_5numpy_integer __pyx_mstate_global->__pyx_ptype_5numpy_integer
+#define __pyx_ptype_5numpy_signedinteger __pyx_mstate_global->__pyx_ptype_5numpy_signedinteger
+#define __pyx_ptype_5numpy_unsignedinteger __pyx_mstate_global->__pyx_ptype_5numpy_unsignedinteger
+#define __pyx_ptype_5numpy_inexact __pyx_mstate_global->__pyx_ptype_5numpy_inexact
+#define __pyx_ptype_5numpy_floating __pyx_mstate_global->__pyx_ptype_5numpy_floating
+#define __pyx_ptype_5numpy_complexfloating __pyx_mstate_global->__pyx_ptype_5numpy_complexfloating
+#define __pyx_ptype_5numpy_flexible __pyx_mstate_global->__pyx_ptype_5numpy_flexible
+#define __pyx_ptype_5numpy_character __pyx_mstate_global->__pyx_ptype_5numpy_character
+#define __pyx_ptype_5numpy_ufunc __pyx_mstate_global->__pyx_ptype_5numpy_ufunc
+#if CYTHON_USE_MODULE_STATE
+#endif
+#if CYTHON_USE_MODULE_STATE
+#define __pyx_type_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLContext __pyx_mstate_global->__pyx_type_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLContext
+#define __pyx_type_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLMem __pyx_mstate_global->__pyx_type_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLMem
+#define __pyx_type_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_ModelFrame __pyx_mstate_global->__pyx_type_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_ModelFrame
+#define __pyx_type___pyx_array __pyx_mstate_global->__pyx_type___pyx_array
+#define __pyx_type___pyx_MemviewEnum __pyx_mstate_global->__pyx_type___pyx_MemviewEnum
+#define __pyx_type___pyx_memoryview __pyx_mstate_global->__pyx_type___pyx_memoryview
+#define __pyx_type___pyx_memoryviewslice __pyx_mstate_global->__pyx_type___pyx_memoryviewslice
+#endif
+#define __pyx_ptype_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLContext __pyx_mstate_global->__pyx_ptype_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLContext
+#define __pyx_ptype_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLMem __pyx_mstate_global->__pyx_ptype_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_CLMem
+#define __pyx_ptype_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_ModelFrame __pyx_mstate_global->__pyx_ptype_9selfdrive_14classic_modeld_6models_15commonmodel_pyx_ModelFrame
+#define __pyx_array_type __pyx_mstate_global->__pyx_array_type
+#define __pyx_MemviewEnum_type __pyx_mstate_global->__pyx_MemviewEnum_type
+#define __pyx_memoryview_type __pyx_mstate_global->__pyx_memoryview_type
+#define __pyx_memoryviewslice_type __pyx_mstate_global->__pyx_memoryviewslice_type
+#define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_
+#define __pyx_n_s_ASCII __pyx_mstate_global->__pyx_n_s_ASCII
+#define __pyx_kp_s_All_dimensions_preceding_dimensi __pyx_mstate_global->__pyx_kp_s_All_dimensions_preceding_dimensi
+#define __pyx_n_s_AssertionError __pyx_mstate_global->__pyx_n_s_AssertionError
+#define __pyx_kp_s_Buffer_view_does_not_expose_stri __pyx_mstate_global->__pyx_kp_s_Buffer_view_does_not_expose_stri
+#define __pyx_n_s_CLContext __pyx_mstate_global->__pyx_n_s_CLContext
+#define __pyx_n_s_CLContext___reduce_cython __pyx_mstate_global->__pyx_n_s_CLContext___reduce_cython
+#define __pyx_n_s_CLContext___setstate_cython __pyx_mstate_global->__pyx_n_s_CLContext___setstate_cython
+#define __pyx_n_s_CLMem __pyx_mstate_global->__pyx_n_s_CLMem
+#define __pyx_n_s_CLMem___reduce_cython __pyx_mstate_global->__pyx_n_s_CLMem___reduce_cython
+#define __pyx_n_s_CLMem___setstate_cython __pyx_mstate_global->__pyx_n_s_CLMem___setstate_cython
+#define __pyx_kp_s_Can_only_create_a_buffer_that_is __pyx_mstate_global->__pyx_kp_s_Can_only_create_a_buffer_that_is
+#define __pyx_kp_s_Cannot_assign_to_read_only_memor __pyx_mstate_global->__pyx_kp_s_Cannot_assign_to_read_only_memor
+#define __pyx_kp_s_Cannot_create_writable_memory_vi __pyx_mstate_global->__pyx_kp_s_Cannot_create_writable_memory_vi
+#define __pyx_kp_u_Cannot_index_with_type __pyx_mstate_global->__pyx_kp_u_Cannot_index_with_type
+#define __pyx_kp_s_Cannot_transpose_memoryview_with __pyx_mstate_global->__pyx_kp_s_Cannot_transpose_memoryview_with
+#define __pyx_kp_s_Dimension_d_is_not_direct __pyx_mstate_global->__pyx_kp_s_Dimension_d_is_not_direct
+#define __pyx_n_s_Ellipsis __pyx_mstate_global->__pyx_n_s_Ellipsis
+#define __pyx_kp_s_Empty_shape_tuple_for_cython_arr __pyx_mstate_global->__pyx_kp_s_Empty_shape_tuple_for_cython_arr
+#define __pyx_n_s_ImportError __pyx_mstate_global->__pyx_n_s_ImportError
+#define __pyx_kp_s_Incompatible_checksums_0x_x_vs_0 __pyx_mstate_global->__pyx_kp_s_Incompatible_checksums_0x_x_vs_0
+#define __pyx_n_s_IndexError __pyx_mstate_global->__pyx_n_s_IndexError
+#define __pyx_kp_s_Index_out_of_bounds_axis_d __pyx_mstate_global->__pyx_kp_s_Index_out_of_bounds_axis_d
+#define __pyx_kp_s_Indirect_dimensions_not_supporte __pyx_mstate_global->__pyx_kp_s_Indirect_dimensions_not_supporte
+#define __pyx_kp_u_Invalid_mode_expected_c_or_fortr __pyx_mstate_global->__pyx_kp_u_Invalid_mode_expected_c_or_fortr
+#define __pyx_kp_u_Invalid_shape_in_axis __pyx_mstate_global->__pyx_kp_u_Invalid_shape_in_axis
+#define __pyx_n_s_MemoryError __pyx_mstate_global->__pyx_n_s_MemoryError
+#define __pyx_kp_s_MemoryView_of_r_at_0x_x __pyx_mstate_global->__pyx_kp_s_MemoryView_of_r_at_0x_x
+#define __pyx_kp_s_MemoryView_of_r_object __pyx_mstate_global->__pyx_kp_s_MemoryView_of_r_object
+#define __pyx_n_s_ModelFrame __pyx_mstate_global->__pyx_n_s_ModelFrame
+#define __pyx_n_s_ModelFrame___reduce_cython __pyx_mstate_global->__pyx_n_s_ModelFrame___reduce_cython
+#define __pyx_n_s_ModelFrame___setstate_cython __pyx_mstate_global->__pyx_n_s_ModelFrame___setstate_cython
+#define __pyx_n_s_ModelFrame_prepare __pyx_mstate_global->__pyx_n_s_ModelFrame_prepare
+#define __pyx_n_b_O __pyx_mstate_global->__pyx_n_b_O
+#define __pyx_kp_u_Out_of_bounds_on_buffer_access_a __pyx_mstate_global->__pyx_kp_u_Out_of_bounds_on_buffer_access_a
+#define __pyx_n_s_PickleError __pyx_mstate_global->__pyx_n_s_PickleError
+#define __pyx_n_s_Sequence __pyx_mstate_global->__pyx_n_s_Sequence
+#define __pyx_kp_s_Step_may_not_be_zero_axis_d __pyx_mstate_global->__pyx_kp_s_Step_may_not_be_zero_axis_d
+#define __pyx_kp_b_T __pyx_mstate_global->__pyx_kp_b_T
+#define __pyx_n_s_TypeError __pyx_mstate_global->__pyx_n_s_TypeError
+#define __pyx_kp_s_Unable_to_convert_item_to_object __pyx_mstate_global->__pyx_kp_s_Unable_to_convert_item_to_object
+#define __pyx_n_s_ValueError __pyx_mstate_global->__pyx_n_s_ValueError
+#define __pyx_n_s_View_MemoryView __pyx_mstate_global->__pyx_n_s_View_MemoryView
+#define __pyx_kp_b__10 __pyx_mstate_global->__pyx_kp_b__10
+#define __pyx_kp_b__11 __pyx_mstate_global->__pyx_kp_b__11
+#define __pyx_kp_b__12 __pyx_mstate_global->__pyx_kp_b__12
+#define __pyx_kp_u__13 __pyx_mstate_global->__pyx_kp_u__13
+#define __pyx_kp_u__14 __pyx_mstate_global->__pyx_kp_u__14
+#define __pyx_kp_u__2 __pyx_mstate_global->__pyx_kp_u__2
+#define __pyx_n_s__3 __pyx_mstate_global->__pyx_n_s__3
+#define __pyx_n_s__40 __pyx_mstate_global->__pyx_n_s__40
+#define __pyx_kp_u__6 __pyx_mstate_global->__pyx_kp_u__6
+#define __pyx_kp_u__7 __pyx_mstate_global->__pyx_kp_u__7
+#define __pyx_kp_b__9 __pyx_mstate_global->__pyx_kp_b__9
+#define __pyx_n_s_abc __pyx_mstate_global->__pyx_n_s_abc
+#define __pyx_n_s_allocate_buffer __pyx_mstate_global->__pyx_n_s_allocate_buffer
+#define __pyx_kp_u_and __pyx_mstate_global->__pyx_kp_u_and
+#define __pyx_n_s_asarray __pyx_mstate_global->__pyx_n_s_asarray
+#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines
+#define __pyx_n_s_base __pyx_mstate_global->__pyx_n_s_base
+#define __pyx_n_s_buf __pyx_mstate_global->__pyx_n_s_buf
+#define __pyx_n_s_c __pyx_mstate_global->__pyx_n_s_c
+#define __pyx_n_u_c __pyx_mstate_global->__pyx_n_u_c
+#define __pyx_n_s_class __pyx_mstate_global->__pyx_n_s_class
+#define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem
+#define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback
+#define __pyx_n_s_collections __pyx_mstate_global->__pyx_n_s_collections
+#define __pyx_kp_s_collections_abc __pyx_mstate_global->__pyx_kp_s_collections_abc
+#define __pyx_n_s_context __pyx_mstate_global->__pyx_n_s_context
+#define __pyx_kp_s_contiguous_and_direct __pyx_mstate_global->__pyx_kp_s_contiguous_and_direct
+#define __pyx_kp_s_contiguous_and_indirect __pyx_mstate_global->__pyx_kp_s_contiguous_and_indirect
+#define __pyx_n_s_count __pyx_mstate_global->__pyx_n_s_count
+#define __pyx_n_s_cprojection __pyx_mstate_global->__pyx_n_s_cprojection
+#define __pyx_n_s_data __pyx_mstate_global->__pyx_n_s_data
+#define __pyx_n_s_dict __pyx_mstate_global->__pyx_n_s_dict
+#define __pyx_kp_u_disable __pyx_mstate_global->__pyx_kp_u_disable
+#define __pyx_n_s_dtype_is_object __pyx_mstate_global->__pyx_n_s_dtype_is_object
+#define __pyx_kp_u_enable __pyx_mstate_global->__pyx_kp_u_enable
+#define __pyx_n_s_encode __pyx_mstate_global->__pyx_n_s_encode
+#define __pyx_n_s_enumerate __pyx_mstate_global->__pyx_n_s_enumerate
+#define __pyx_n_s_error __pyx_mstate_global->__pyx_n_s_error
+#define __pyx_n_s_flags __pyx_mstate_global->__pyx_n_s_flags
+#define __pyx_n_s_format __pyx_mstate_global->__pyx_n_s_format
+#define __pyx_n_s_fortran __pyx_mstate_global->__pyx_n_s_fortran
+#define __pyx_n_u_fortran __pyx_mstate_global->__pyx_n_u_fortran
+#define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc
+#define __pyx_n_s_getstate __pyx_mstate_global->__pyx_n_s_getstate
+#define __pyx_kp_u_got __pyx_mstate_global->__pyx_kp_u_got
+#define __pyx_kp_u_got_differing_extents_in_dimensi __pyx_mstate_global->__pyx_kp_u_got_differing_extents_in_dimensi
+#define __pyx_n_s_height __pyx_mstate_global->__pyx_n_s_height
+#define __pyx_n_s_id __pyx_mstate_global->__pyx_n_s_id
+#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import
+#define __pyx_n_s_index __pyx_mstate_global->__pyx_n_s_index
+#define __pyx_n_s_initializing __pyx_mstate_global->__pyx_n_s_initializing
+#define __pyx_n_s_is_coroutine __pyx_mstate_global->__pyx_n_s_is_coroutine
+#define __pyx_kp_u_isenabled __pyx_mstate_global->__pyx_kp_u_isenabled
+#define __pyx_n_s_itemsize __pyx_mstate_global->__pyx_n_s_itemsize
+#define __pyx_kp_s_itemsize_0_for_cython_array __pyx_mstate_global->__pyx_kp_s_itemsize_0_for_cython_array
+#define __pyx_n_s_join __pyx_mstate_global->__pyx_n_s_join
+#define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main
+#define __pyx_n_s_memview __pyx_mstate_global->__pyx_n_s_memview
+#define __pyx_n_s_mode __pyx_mstate_global->__pyx_n_s_mode
+#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name
+#define __pyx_n_s_name_2 __pyx_mstate_global->__pyx_n_s_name_2
+#define __pyx_n_s_ndim __pyx_mstate_global->__pyx_n_s_ndim
+#define __pyx_n_s_new __pyx_mstate_global->__pyx_n_s_new
+#define __pyx_kp_s_no_default___reduce___due_to_non __pyx_mstate_global->__pyx_kp_s_no_default___reduce___due_to_non
+#define __pyx_n_s_np __pyx_mstate_global->__pyx_n_s_np
+#define __pyx_n_s_numpy __pyx_mstate_global->__pyx_n_s_numpy
+#define __pyx_kp_u_numpy_core_multiarray_failed_to __pyx_mstate_global->__pyx_kp_u_numpy_core_multiarray_failed_to
+#define __pyx_kp_u_numpy_core_umath_failed_to_impor __pyx_mstate_global->__pyx_kp_u_numpy_core_umath_failed_to_impor
+#define __pyx_n_s_obj __pyx_mstate_global->__pyx_n_s_obj
+#define __pyx_n_s_output __pyx_mstate_global->__pyx_n_s_output
+#define __pyx_n_s_pack __pyx_mstate_global->__pyx_n_s_pack
+#define __pyx_n_s_pickle __pyx_mstate_global->__pyx_n_s_pickle
+#define __pyx_n_s_prepare __pyx_mstate_global->__pyx_n_s_prepare
+#define __pyx_n_s_projection __pyx_mstate_global->__pyx_n_s_projection
+#define __pyx_n_s_pyx_PickleError __pyx_mstate_global->__pyx_n_s_pyx_PickleError
+#define __pyx_n_s_pyx_checksum __pyx_mstate_global->__pyx_n_s_pyx_checksum
+#define __pyx_n_s_pyx_result __pyx_mstate_global->__pyx_n_s_pyx_result
+#define __pyx_n_s_pyx_state __pyx_mstate_global->__pyx_n_s_pyx_state
+#define __pyx_n_s_pyx_type __pyx_mstate_global->__pyx_n_s_pyx_type
+#define __pyx_n_s_pyx_unpickle_Enum __pyx_mstate_global->__pyx_n_s_pyx_unpickle_Enum
+#define __pyx_n_s_pyx_vtable __pyx_mstate_global->__pyx_n_s_pyx_vtable
+#define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range
+#define __pyx_n_s_reduce __pyx_mstate_global->__pyx_n_s_reduce
+#define __pyx_n_s_reduce_cython __pyx_mstate_global->__pyx_n_s_reduce_cython
+#define __pyx_n_s_reduce_ex __pyx_mstate_global->__pyx_n_s_reduce_ex
+#define __pyx_n_s_register __pyx_mstate_global->__pyx_n_s_register
+#define __pyx_n_s_self __pyx_mstate_global->__pyx_n_s_self
+#define __pyx_kp_s_self_mem_cannot_be_converted_to __pyx_mstate_global->__pyx_kp_s_self_mem_cannot_be_converted_to
+#define __pyx_kp_s_selfdrive_classic_modeld_models __pyx_mstate_global->__pyx_kp_s_selfdrive_classic_modeld_models
+#define __pyx_n_s_selfdrive_classic_modeld_models_2 __pyx_mstate_global->__pyx_n_s_selfdrive_classic_modeld_models_2
+#define __pyx_n_s_setstate __pyx_mstate_global->__pyx_n_s_setstate
+#define __pyx_n_s_setstate_cython __pyx_mstate_global->__pyx_n_s_setstate_cython
+#define __pyx_n_s_shape __pyx_mstate_global->__pyx_n_s_shape
+#define __pyx_n_s_sigmoid __pyx_mstate_global->__pyx_n_s_sigmoid
+#define __pyx_n_s_size __pyx_mstate_global->__pyx_n_s_size
+#define __pyx_n_s_spec __pyx_mstate_global->__pyx_n_s_spec
+#define __pyx_n_s_start __pyx_mstate_global->__pyx_n_s_start
+#define __pyx_n_s_step __pyx_mstate_global->__pyx_n_s_step
+#define __pyx_n_s_stop __pyx_mstate_global->__pyx_n_s_stop
+#define __pyx_n_s_stride __pyx_mstate_global->__pyx_n_s_stride
+#define __pyx_kp_s_strided_and_direct __pyx_mstate_global->__pyx_kp_s_strided_and_direct
+#define __pyx_kp_s_strided_and_direct_or_indirect __pyx_mstate_global->__pyx_kp_s_strided_and_direct_or_indirect
+#define __pyx_kp_s_strided_and_indirect __pyx_mstate_global->__pyx_kp_s_strided_and_indirect
+#define __pyx_kp_s_stringsource __pyx_mstate_global->__pyx_kp_s_stringsource
+#define __pyx_n_s_struct __pyx_mstate_global->__pyx_n_s_struct
+#define __pyx_n_s_sys __pyx_mstate_global->__pyx_n_s_sys
+#define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test
+#define __pyx_kp_s_unable_to_allocate_array_data __pyx_mstate_global->__pyx_kp_s_unable_to_allocate_array_data
+#define __pyx_kp_s_unable_to_allocate_shape_and_str __pyx_mstate_global->__pyx_kp_s_unable_to_allocate_shape_and_str
+#define __pyx_n_s_unpack __pyx_mstate_global->__pyx_n_s_unpack
+#define __pyx_n_s_update __pyx_mstate_global->__pyx_n_s_update
+#define __pyx_n_s_uv_offset __pyx_mstate_global->__pyx_n_s_uv_offset
+#define __pyx_n_s_version_info __pyx_mstate_global->__pyx_n_s_version_info
+#define __pyx_n_s_width __pyx_mstate_global->__pyx_n_s_width
+#define __pyx_n_s_x __pyx_mstate_global->__pyx_n_s_x
+#define __pyx_int_0 __pyx_mstate_global->__pyx_int_0
+#define __pyx_int_1 __pyx_mstate_global->__pyx_int_1
+#define __pyx_int_3 __pyx_mstate_global->__pyx_int_3
+#define __pyx_int_112105877 __pyx_mstate_global->__pyx_int_112105877
+#define __pyx_int_136983863 __pyx_mstate_global->__pyx_int_136983863
+#define __pyx_int_184977713 __pyx_mstate_global->__pyx_int_184977713
+#define __pyx_int_neg_1 __pyx_mstate_global->__pyx_int_neg_1
+#define __pyx_slice__5 __pyx_mstate_global->__pyx_slice__5
+#define __pyx_tuple__4 __pyx_mstate_global->__pyx_tuple__4
+#define __pyx_tuple__8 __pyx_mstate_global->__pyx_tuple__8
+#define __pyx_tuple__15 __pyx_mstate_global->__pyx_tuple__15
+#define __pyx_tuple__16 __pyx_mstate_global->__pyx_tuple__16
+#define __pyx_tuple__17 __pyx_mstate_global->__pyx_tuple__17
+#define __pyx_tuple__18 __pyx_mstate_global->__pyx_tuple__18
+#define __pyx_tuple__19 __pyx_mstate_global->__pyx_tuple__19
+#define __pyx_tuple__20 __pyx_mstate_global->__pyx_tuple__20
+#define __pyx_tuple__21 __pyx_mstate_global->__pyx_tuple__21
+#define __pyx_tuple__22 __pyx_mstate_global->__pyx_tuple__22
+#define __pyx_tuple__23 __pyx_mstate_global->__pyx_tuple__23
+#define __pyx_tuple__24 __pyx_mstate_global->__pyx_tuple__24
+#define __pyx_tuple__25 __pyx_mstate_global->__pyx_tuple__25
+#define __pyx_tuple__26 __pyx_mstate_global->__pyx_tuple__26
+#define __pyx_tuple__28 __pyx_mstate_global->__pyx_tuple__28
+#define __pyx_tuple__30 __pyx_mstate_global->__pyx_tuple__30
+#define __pyx_tuple__32 __pyx_mstate_global->__pyx_tuple__32
+#define __pyx_tuple__36 __pyx_mstate_global->__pyx_tuple__36
+#define __pyx_codeobj__27 __pyx_mstate_global->__pyx_codeobj__27
+#define __pyx_codeobj__29 __pyx_mstate_global->__pyx_codeobj__29
+#define __pyx_codeobj__31 __pyx_mstate_global->__pyx_codeobj__31
+#define __pyx_codeobj__33 __pyx_mstate_global->__pyx_codeobj__33
+#define __pyx_codeobj__34 __pyx_mstate_global->__pyx_codeobj__34
+#define __pyx_codeobj__35 __pyx_mstate_global->__pyx_codeobj__35
+#define __pyx_codeobj__37 __pyx_mstate_global->__pyx_codeobj__37
+#define __pyx_codeobj__38 __pyx_mstate_global->__pyx_codeobj__38
+#define __pyx_codeobj__39 __pyx_mstate_global->__pyx_codeobj__39
+/* #### Code section: module_code ### */
+
+/* "View.MemoryView":131
+ * cdef bint dtype_is_object
+ *
+ * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
+ * mode="c", bint allocate_buffer=True):
+ *
+ */
+
+/* Python wrapper */
+static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_shape = 0;
+ Py_ssize_t __pyx_v_itemsize;
+ PyObject *__pyx_v_format = 0;
+ PyObject *__pyx_v_mode = 0;
+ int __pyx_v_allocate_buffer;
+ CYTHON_UNUSED Py_ssize_t __pyx_nargs;
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject* values[5] = {0,0,0,0,0};
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
+ #if CYTHON_ASSUME_SAFE_MACROS
+ __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
+ #else
+ __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
+ #endif
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ {
+ PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0};
+ values[3] = __Pyx_Arg_NewRef_VARARGS(((PyObject *)__pyx_n_s_c));
+ if (__pyx_kwds) {
+ Py_ssize_t kw_args;
+ switch (__pyx_nargs) {
+ case 5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
+ CYTHON_FALLTHROUGH;
+ case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
+ CYTHON_FALLTHROUGH;
+ case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
+ CYTHON_FALLTHROUGH;
+ case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
+ CYTHON_FALLTHROUGH;
+ case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
+ switch (__pyx_nargs) {
+ case 0:
+ if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_shape)) != 0)) {
+ (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
+ kw_args--;
+ }
+ else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 131, __pyx_L3_error)
+ else goto __pyx_L5_argtuple_error;
+ CYTHON_FALLTHROUGH;
+ case 1:
+ if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_itemsize)) != 0)) {
+ (void)__Pyx_Arg_NewRef_VARARGS(values[1]);
+ kw_args--;
+ }
+ else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 131, __pyx_L3_error)
+ else {
+ __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(0, 131, __pyx_L3_error)
+ }
+ CYTHON_FALLTHROUGH;
+ case 2:
+ if (likely((values[2] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_format)) != 0)) {
+ (void)__Pyx_Arg_NewRef_VARARGS(values[2]);
+ kw_args--;
+ }
+ else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 131, __pyx_L3_error)
+ else {
+ __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(0, 131, __pyx_L3_error)
+ }
+ CYTHON_FALLTHROUGH;
+ case 3:
+ if (kw_args > 0) {
+ PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_mode);
+ if (value) { values[3] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
+ else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 131, __pyx_L3_error)
+ }
+ CYTHON_FALLTHROUGH;
+ case 4:
+ if (kw_args > 0) {
+ PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_allocate_buffer);
+ if (value) { values[4] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
+ else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 131, __pyx_L3_error)
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ const Py_ssize_t kwd_pos_args = __pyx_nargs;
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(0, 131, __pyx_L3_error)
+ }
+ } else {
+ switch (__pyx_nargs) {
+ case 5: values[4] = __Pyx_Arg_VARARGS(__pyx_args, 4);
+ CYTHON_FALLTHROUGH;
+ case 4: values[3] = __Pyx_Arg_VARARGS(__pyx_args, 3);
+ CYTHON_FALLTHROUGH;
+ case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
+ values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
+ values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
+ break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ }
+ __pyx_v_shape = ((PyObject*)values[0]);
+ __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 131, __pyx_L3_error)
+ __pyx_v_format = values[2];
+ __pyx_v_mode = values[3];
+ if (values[4]) {
+ __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L3_error)
+ } else {
+
+ /* "View.MemoryView":132
+ *
+ * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
+ * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<<
+ *
+ * cdef int idx
+ */
+ __pyx_v_allocate_buffer = ((int)1);
+ }
+ }
+ goto __pyx_L6_skip;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, __pyx_nargs); __PYX_ERR(0, 131, __pyx_L3_error)
+ __pyx_L6_skip:;
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L3_error:;
+ {
+ Py_ssize_t __pyx_temp;
+ for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
+ __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
+ }
+ }
+ __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return -1;
+ __pyx_L4_argument_unpacking_done:;
+ if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(0, 131, __pyx_L1_error)
+ if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
+ PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(0, 131, __pyx_L1_error)
+ }
+ __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer);
+
+ /* "View.MemoryView":131
+ * cdef bint dtype_is_object
+ *
+ * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
+ * mode="c", bint allocate_buffer=True):
+ *
+ */
+
+ /* function exit code */
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __pyx_r = -1;
+ __pyx_L0:;
+ {
+ Py_ssize_t __pyx_temp;
+ for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
+ __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
+ }
+ }
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) {
+ int __pyx_v_idx;
+ Py_ssize_t __pyx_v_dim;
+ char __pyx_v_order;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ Py_ssize_t __pyx_t_1;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ int __pyx_t_7;
+ char *__pyx_t_8;
+ Py_ssize_t __pyx_t_9;
+ Py_UCS4 __pyx_t_10;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__cinit__", 0);
+ __Pyx_INCREF(__pyx_v_format);
+
+ /* "View.MemoryView":137
+ * cdef Py_ssize_t dim
+ *
+ * self.ndim = len(shape) # <<<<<<<<<<<<<<
+ * self.itemsize = itemsize
+ *
+ */
+ if (unlikely(__pyx_v_shape == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
+ __PYX_ERR(0, 137, __pyx_L1_error)
+ }
+ __pyx_t_1 = __Pyx_PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 137, __pyx_L1_error)
+ __pyx_v_self->ndim = ((int)__pyx_t_1);
+
+ /* "View.MemoryView":138
+ *
+ * self.ndim = len(shape)
+ * self.itemsize = itemsize # <<<<<<<<<<<<<<
+ *
+ * if not self.ndim:
+ */
+ __pyx_v_self->itemsize = __pyx_v_itemsize;
+
+ /* "View.MemoryView":140
+ * self.itemsize = itemsize
+ *
+ * if not self.ndim: # <<<<<<<<<<<<<<
+ * raise ValueError, "Empty shape tuple for cython.array"
+ *
+ */
+ __pyx_t_2 = (!(__pyx_v_self->ndim != 0));
+ if (unlikely(__pyx_t_2)) {
+
+ /* "View.MemoryView":141
+ *
+ * if not self.ndim:
+ * raise ValueError, "Empty shape tuple for cython.array" # <<<<<<<<<<<<<<
+ *
+ * if itemsize <= 0:
+ */
+ __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Empty_shape_tuple_for_cython_arr, 0, 0);
+ __PYX_ERR(0, 141, __pyx_L1_error)
+
+ /* "View.MemoryView":140
+ * self.itemsize = itemsize
+ *
+ * if not self.ndim: # <<<<<<<<<<<<<<
+ * raise ValueError, "Empty shape tuple for cython.array"
+ *
+ */
+ }
+
+ /* "View.MemoryView":143
+ * raise ValueError, "Empty shape tuple for cython.array"
+ *
+ * if itemsize <= 0: # <<<<<<<<<<<<<<
+ * raise ValueError, "itemsize <= 0 for cython.array"
+ *
+ */
+ __pyx_t_2 = (__pyx_v_itemsize <= 0);
+ if (unlikely(__pyx_t_2)) {
+
+ /* "View.MemoryView":144
+ *
+ * if itemsize <= 0:
+ * raise ValueError, "itemsize <= 0 for cython.array" # <<<<<<<<<<<<<<
+ *
+ * if not isinstance(format, bytes):
+ */
+ __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_itemsize_0_for_cython_array, 0, 0);
+ __PYX_ERR(0, 144, __pyx_L1_error)
+
+ /* "View.MemoryView":143
+ * raise ValueError, "Empty shape tuple for cython.array"
+ *
+ * if itemsize <= 0: # <<<<<<<<<<<<<<
+ * raise ValueError, "itemsize <= 0 for cython.array"
+ *
+ */
+ }
+
+ /* "View.MemoryView":146
+ * raise ValueError, "itemsize <= 0 for cython.array"
+ *
+ * if not isinstance(format, bytes): # <<<<<<<<<<<<<<
+ * format = format.encode('ASCII')
+ * self._format = format # keep a reference to the byte string
+ */
+ __pyx_t_2 = PyBytes_Check(__pyx_v_format);
+ __pyx_t_3 = (!__pyx_t_2);
+ if (__pyx_t_3) {
+
+ /* "View.MemoryView":147
+ *
+ * if not isinstance(format, bytes):
+ * format = format.encode('ASCII') # <<<<<<<<<<<<<<
+ * self._format = format # keep a reference to the byte string
+ * self.format = self._format
+ */
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 147, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = NULL;
+ __pyx_t_7 = 0;
+ #if CYTHON_UNPACK_METHODS
+ if (likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_6)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_6);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ __pyx_t_7 = 1;
+ }
+ }
+ #endif
+ {
+ PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_n_s_ASCII};
+ __pyx_t_4 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_7, 1+__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 147, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_4);
+ __pyx_t_4 = 0;
+
+ /* "View.MemoryView":146
+ * raise ValueError, "itemsize <= 0 for cython.array"
+ *
+ * if not isinstance(format, bytes): # <<<<<<<<<<<<<<
+ * format = format.encode('ASCII')
+ * self._format = format # keep a reference to the byte string
+ */
+ }
+
+ /* "View.MemoryView":148
+ * if not isinstance(format, bytes):
+ * format = format.encode('ASCII')
+ * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<<
+ * self.format = self._format
+ *
+ */
+ if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_v_format))) __PYX_ERR(0, 148, __pyx_L1_error)
+ __pyx_t_4 = __pyx_v_format;
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ __Pyx_GOTREF(__pyx_v_self->_format);
+ __Pyx_DECREF(__pyx_v_self->_format);
+ __pyx_v_self->_format = ((PyObject*)__pyx_t_4);
+ __pyx_t_4 = 0;
+
+ /* "View.MemoryView":149
+ * format = format.encode('ASCII')
+ * self._format = format # keep a reference to the byte string
+ * self.format = self._format # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ if (unlikely(__pyx_v_self->_format == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
+ __PYX_ERR(0, 149, __pyx_L1_error)
+ }
+ __pyx_t_8 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_8) && PyErr_Occurred())) __PYX_ERR(0, 149, __pyx_L1_error)
+ __pyx_v_self->format = __pyx_t_8;
+
+ /* "View.MemoryView":152
+ *
+ *
+ * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<<
+ * self._strides = self._shape + self.ndim
+ *
+ */
+ __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
+
+ /* "View.MemoryView":153
+ *
+ * self._shape = PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
+ * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<<
+ *
+ * if not self._shape:
+ */
+ __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
+
+ /* "View.MemoryView":155
+ * self._strides = self._shape + self.ndim
+ *
+ * if not self._shape: # <<<<<<<<<<<<<<
+ * raise MemoryError, "unable to allocate shape and strides."
+ *
+ */
+ __pyx_t_3 = (!(__pyx_v_self->_shape != 0));
+ if (unlikely(__pyx_t_3)) {
+
+ /* "View.MemoryView":156
+ *
+ * if not self._shape:
+ * raise MemoryError, "unable to allocate shape and strides." # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_Raise(__pyx_builtin_MemoryError, __pyx_kp_s_unable_to_allocate_shape_and_str, 0, 0);
+ __PYX_ERR(0, 156, __pyx_L1_error)
+
+ /* "View.MemoryView":155
+ * self._strides = self._shape + self.ndim
+ *
+ * if not self._shape: # <<<<<<<<<<<<<<
+ * raise MemoryError, "unable to allocate shape and strides."
+ *
+ */
+ }
+
+ /* "View.MemoryView":159
+ *
+ *
+ * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<<
+ * if dim <= 0:
+ * raise ValueError, f"Invalid shape in axis {idx}: {dim}."
+ */
+ __pyx_t_7 = 0;
+ __pyx_t_4 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_4);
+ __pyx_t_1 = 0;
+ for (;;) {
+ {
+ Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_4);
+ #if !CYTHON_ASSUME_SAFE_MACROS
+ if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 159, __pyx_L1_error)
+ #endif
+ if (__pyx_t_1 >= __pyx_temp) break;
+ }
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely((0 < 0))) __PYX_ERR(0, 159, __pyx_L1_error)
+ #else
+ __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 159, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ #endif
+ __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 159, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __pyx_v_dim = __pyx_t_9;
+ __pyx_v_idx = __pyx_t_7;
+ __pyx_t_7 = (__pyx_t_7 + 1);
+
+ /* "View.MemoryView":160
+ *
+ * for idx, dim in enumerate(shape):
+ * if dim <= 0: # <<<<<<<<<<<<<<
+ * raise ValueError, f"Invalid shape in axis {idx}: {dim}."
+ * self._shape[idx] = dim
+ */
+ __pyx_t_3 = (__pyx_v_dim <= 0);
+ if (unlikely(__pyx_t_3)) {
+
+ /* "View.MemoryView":161
+ * for idx, dim in enumerate(shape):
+ * if dim <= 0:
+ * raise ValueError, f"Invalid shape in axis {idx}: {dim}." # <<<<<<<<<<<<<<
+ * self._shape[idx] = dim
+ *
+ */
+ __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 161, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_9 = 0;
+ __pyx_t_10 = 127;
+ __Pyx_INCREF(__pyx_kp_u_Invalid_shape_in_axis);
+ __pyx_t_9 += 22;
+ __Pyx_GIVEREF(__pyx_kp_u_Invalid_shape_in_axis);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Invalid_shape_in_axis);
+ __pyx_t_6 = __Pyx_PyUnicode_From_int(__pyx_v_idx, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 161, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6);
+ __pyx_t_6 = 0;
+ __Pyx_INCREF(__pyx_kp_u_);
+ __pyx_t_9 += 2;
+ __Pyx_GIVEREF(__pyx_kp_u_);
+ PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u_);
+ __pyx_t_6 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 161, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_9 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6);
+ __Pyx_GIVEREF(__pyx_t_6);
+ PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_6);
+ __pyx_t_6 = 0;
+ __Pyx_INCREF(__pyx_kp_u__2);
+ __pyx_t_9 += 1;
+ __Pyx_GIVEREF(__pyx_kp_u__2);
+ PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_kp_u__2);
+ __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_5, 5, __pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 161, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_6, 0, 0);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __PYX_ERR(0, 161, __pyx_L1_error)
+
+ /* "View.MemoryView":160
+ *
+ * for idx, dim in enumerate(shape):
+ * if dim <= 0: # <<<<<<<<<<<<<<
+ * raise ValueError, f"Invalid shape in axis {idx}: {dim}."
+ * self._shape[idx] = dim
+ */
+ }
+
+ /* "View.MemoryView":162
+ * if dim <= 0:
+ * raise ValueError, f"Invalid shape in axis {idx}: {dim}."
+ * self._shape[idx] = dim # <<<<<<<<<<<<<<
+ *
+ * cdef char order
+ */
+ (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
+
+ /* "View.MemoryView":159
+ *
+ *
+ * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<<
+ * if dim <= 0:
+ * raise ValueError, f"Invalid shape in axis {idx}: {dim}."
+ */
+ }
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+
+ /* "View.MemoryView":165
+ *
+ * cdef char order
+ * if mode == 'c': # <<<<<<<<<<<<<<
+ * order = b'C'
+ * self.mode = u'c'
+ */
+ __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 165, __pyx_L1_error)
+ if (__pyx_t_3) {
+
+ /* "View.MemoryView":166
+ * cdef char order
+ * if mode == 'c':
+ * order = b'C' # <<<<<<<<<<<<<<
+ * self.mode = u'c'
+ * elif mode == 'fortran':
+ */
+ __pyx_v_order = 'C';
+
+ /* "View.MemoryView":167
+ * if mode == 'c':
+ * order = b'C'
+ * self.mode = u'c' # <<<<<<<<<<<<<<
+ * elif mode == 'fortran':
+ * order = b'F'
+ */
+ __Pyx_INCREF(__pyx_n_u_c);
+ __Pyx_GIVEREF(__pyx_n_u_c);
+ __Pyx_GOTREF(__pyx_v_self->mode);
+ __Pyx_DECREF(__pyx_v_self->mode);
+ __pyx_v_self->mode = __pyx_n_u_c;
+
+ /* "View.MemoryView":165
+ *
+ * cdef char order
+ * if mode == 'c': # <<<<<<<<<<<<<<
+ * order = b'C'
+ * self.mode = u'c'
+ */
+ goto __pyx_L11;
+ }
+
+ /* "View.MemoryView":168
+ * order = b'C'
+ * self.mode = u'c'
+ * elif mode == 'fortran': # <<<<<<<<<<<<<<
+ * order = b'F'
+ * self.mode = u'fortran'
+ */
+ __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely((__pyx_t_3 < 0))) __PYX_ERR(0, 168, __pyx_L1_error)
+ if (likely(__pyx_t_3)) {
+
+ /* "View.MemoryView":169
+ * self.mode = u'c'
+ * elif mode == 'fortran':
+ * order = b'F' # <<<<<<<<<<<<<<
+ * self.mode = u'fortran'
+ * else:
+ */
+ __pyx_v_order = 'F';
+
+ /* "View.MemoryView":170
+ * elif mode == 'fortran':
+ * order = b'F'
+ * self.mode = u'fortran' # <<<<<<<<<<<<<<
+ * else:
+ * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}"
+ */
+ __Pyx_INCREF(__pyx_n_u_fortran);
+ __Pyx_GIVEREF(__pyx_n_u_fortran);
+ __Pyx_GOTREF(__pyx_v_self->mode);
+ __Pyx_DECREF(__pyx_v_self->mode);
+ __pyx_v_self->mode = __pyx_n_u_fortran;
+
+ /* "View.MemoryView":168
+ * order = b'C'
+ * self.mode = u'c'
+ * elif mode == 'fortran': # <<<<<<<<<<<<<<
+ * order = b'F'
+ * self.mode = u'fortran'
+ */
+ goto __pyx_L11;
+ }
+
+ /* "View.MemoryView":172
+ * self.mode = u'fortran'
+ * else:
+ * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}" # <<<<<<<<<<<<<<
+ *
+ * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order)
+ */
+ /*else*/ {
+ __pyx_t_4 = __Pyx_PyObject_FormatSimple(__pyx_v_mode, __pyx_empty_unicode); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 172, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_6 = __Pyx_PyUnicode_Concat(__pyx_kp_u_Invalid_mode_expected_c_or_fortr, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 172, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_6, 0, 0);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __PYX_ERR(0, 172, __pyx_L1_error)
+ }
+ __pyx_L11:;
+
+ /* "View.MemoryView":174
+ * raise ValueError, f"Invalid mode, expected 'c' or 'fortran', got {mode}"
+ *
+ * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order) # <<<<<<<<<<<<<<
+ *
+ * self.free_data = allocate_buffer
+ */
+ __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order);
+
+ /* "View.MemoryView":176
+ * self.len = fill_contig_strides_array(self._shape, self._strides, itemsize, self.ndim, order)
+ *
+ * self.free_data = allocate_buffer # <<<<<<<<<<<<<<
+ * self.dtype_is_object = format == b'O'
+ *
+ */
+ __pyx_v_self->free_data = __pyx_v_allocate_buffer;
+
+ /* "View.MemoryView":177
+ *
+ * self.free_data = allocate_buffer
+ * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<<
+ *
+ * if allocate_buffer:
+ */
+ __pyx_t_6 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 177, __pyx_L1_error)
+ __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_v_self->dtype_is_object = __pyx_t_3;
+
+ /* "View.MemoryView":179
+ * self.dtype_is_object = format == b'O'
+ *
+ * if allocate_buffer: # <<<<<<<<<<<<<<
+ * _allocate_buffer(self)
+ *
+ */
+ if (__pyx_v_allocate_buffer) {
+
+ /* "View.MemoryView":180
+ *
+ * if allocate_buffer:
+ * _allocate_buffer(self) # <<<<<<<<<<<<<<
+ *
+ * @cname('getbuffer')
+ */
+ __pyx_t_7 = __pyx_array_allocate_buffer(__pyx_v_self); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 180, __pyx_L1_error)
+
+ /* "View.MemoryView":179
+ * self.dtype_is_object = format == b'O'
+ *
+ * if allocate_buffer: # <<<<<<<<<<<<<<
+ * _allocate_buffer(self)
+ *
+ */
+ }
+
+ /* "View.MemoryView":131
+ * cdef bint dtype_is_object
+ *
+ * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
+ * mode="c", bint allocate_buffer=True):
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_format);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":182
+ * _allocate_buffer(self)
+ *
+ * @cname('getbuffer') # <<<<<<<<<<<<<<
+ * def __getbuffer__(self, Py_buffer *info, int flags):
+ * cdef int bufmode = -1
+ */
+
+/* Python wrapper */
+CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+CYTHON_UNUSED static int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+ int __pyx_v_bufmode;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ char *__pyx_t_2;
+ Py_ssize_t __pyx_t_3;
+ int __pyx_t_4;
+ Py_ssize_t *__pyx_t_5;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ if (unlikely(__pyx_v_info == NULL)) {
+ PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
+ return -1;
+ }
+ __Pyx_RefNannySetupContext("__getbuffer__", 0);
+ __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(__pyx_v_info->obj);
+
+ /* "View.MemoryView":184
+ * @cname('getbuffer')
+ * def __getbuffer__(self, Py_buffer *info, int flags):
+ * cdef int bufmode = -1 # <<<<<<<<<<<<<<
+ * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS):
+ * if self.mode == u"c":
+ */
+ __pyx_v_bufmode = -1;
+
+ /* "View.MemoryView":185
+ * def __getbuffer__(self, Py_buffer *info, int flags):
+ * cdef int bufmode = -1
+ * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<<
+ * if self.mode == u"c":
+ * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
+ */
+ __pyx_t_1 = ((__pyx_v_flags & ((PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS) | PyBUF_ANY_CONTIGUOUS)) != 0);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":186
+ * cdef int bufmode = -1
+ * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS):
+ * if self.mode == u"c": # <<<<<<<<<<<<<<
+ * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
+ * elif self.mode == u"fortran":
+ */
+ __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 186, __pyx_L1_error)
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":187
+ * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS):
+ * if self.mode == u"c":
+ * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
+ * elif self.mode == u"fortran":
+ * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
+ */
+ __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
+
+ /* "View.MemoryView":186
+ * cdef int bufmode = -1
+ * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS):
+ * if self.mode == u"c": # <<<<<<<<<<<<<<
+ * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
+ * elif self.mode == u"fortran":
+ */
+ goto __pyx_L4;
+ }
+
+ /* "View.MemoryView":188
+ * if self.mode == u"c":
+ * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
+ * elif self.mode == u"fortran": # <<<<<<<<<<<<<<
+ * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
+ * if not (flags & bufmode):
+ */
+ __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 188, __pyx_L1_error)
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":189
+ * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
+ * elif self.mode == u"fortran":
+ * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
+ * if not (flags & bufmode):
+ * raise ValueError, "Can only create a buffer that is contiguous in memory."
+ */
+ __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
+
+ /* "View.MemoryView":188
+ * if self.mode == u"c":
+ * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
+ * elif self.mode == u"fortran": # <<<<<<<<<<<<<<
+ * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
+ * if not (flags & bufmode):
+ */
+ }
+ __pyx_L4:;
+
+ /* "View.MemoryView":190
+ * elif self.mode == u"fortran":
+ * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
+ * if not (flags & bufmode): # <<<<<<<<<<<<<<
+ * raise ValueError, "Can only create a buffer that is contiguous in memory."
+ * info.buf = self.data
+ */
+ __pyx_t_1 = (!((__pyx_v_flags & __pyx_v_bufmode) != 0));
+ if (unlikely(__pyx_t_1)) {
+
+ /* "View.MemoryView":191
+ * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
+ * if not (flags & bufmode):
+ * raise ValueError, "Can only create a buffer that is contiguous in memory." # <<<<<<<<<<<<<<
+ * info.buf = self.data
+ * info.len = self.len
+ */
+ __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Can_only_create_a_buffer_that_is, 0, 0);
+ __PYX_ERR(0, 191, __pyx_L1_error)
+
+ /* "View.MemoryView":190
+ * elif self.mode == u"fortran":
+ * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
+ * if not (flags & bufmode): # <<<<<<<<<<<<<<
+ * raise ValueError, "Can only create a buffer that is contiguous in memory."
+ * info.buf = self.data
+ */
+ }
+
+ /* "View.MemoryView":185
+ * def __getbuffer__(self, Py_buffer *info, int flags):
+ * cdef int bufmode = -1
+ * if flags & (PyBUF_C_CONTIGUOUS | PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS): # <<<<<<<<<<<<<<
+ * if self.mode == u"c":
+ * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
+ */
+ }
+
+ /* "View.MemoryView":192
+ * if not (flags & bufmode):
+ * raise ValueError, "Can only create a buffer that is contiguous in memory."
+ * info.buf = self.data # <<<<<<<<<<<<<<
+ * info.len = self.len
+ *
+ */
+ __pyx_t_2 = __pyx_v_self->data;
+ __pyx_v_info->buf = __pyx_t_2;
+
+ /* "View.MemoryView":193
+ * raise ValueError, "Can only create a buffer that is contiguous in memory."
+ * info.buf = self.data
+ * info.len = self.len # <<<<<<<<<<<<<<
+ *
+ * if flags & PyBUF_STRIDES:
+ */
+ __pyx_t_3 = __pyx_v_self->len;
+ __pyx_v_info->len = __pyx_t_3;
+
+ /* "View.MemoryView":195
+ * info.len = self.len
+ *
+ * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
+ * info.ndim = self.ndim
+ * info.shape = self._shape
+ */
+ __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":196
+ *
+ * if flags & PyBUF_STRIDES:
+ * info.ndim = self.ndim # <<<<<<<<<<<<<<
+ * info.shape = self._shape
+ * info.strides = self._strides
+ */
+ __pyx_t_4 = __pyx_v_self->ndim;
+ __pyx_v_info->ndim = __pyx_t_4;
+
+ /* "View.MemoryView":197
+ * if flags & PyBUF_STRIDES:
+ * info.ndim = self.ndim
+ * info.shape = self._shape # <<<<<<<<<<<<<<
+ * info.strides = self._strides
+ * else:
+ */
+ __pyx_t_5 = __pyx_v_self->_shape;
+ __pyx_v_info->shape = __pyx_t_5;
+
+ /* "View.MemoryView":198
+ * info.ndim = self.ndim
+ * info.shape = self._shape
+ * info.strides = self._strides # <<<<<<<<<<<<<<
+ * else:
+ * info.ndim = 1
+ */
+ __pyx_t_5 = __pyx_v_self->_strides;
+ __pyx_v_info->strides = __pyx_t_5;
+
+ /* "View.MemoryView":195
+ * info.len = self.len
+ *
+ * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
+ * info.ndim = self.ndim
+ * info.shape = self._shape
+ */
+ goto __pyx_L6;
+ }
+
+ /* "View.MemoryView":200
+ * info.strides = self._strides
+ * else:
+ * info.ndim = 1 # <<<<<<<<<<<<<<
+ * info.shape = &self.len if flags & PyBUF_ND else NULL
+ * info.strides = NULL
+ */
+ /*else*/ {
+ __pyx_v_info->ndim = 1;
+
+ /* "View.MemoryView":201
+ * else:
+ * info.ndim = 1
+ * info.shape = &self.len if flags & PyBUF_ND else NULL # <<<<<<<<<<<<<<
+ * info.strides = NULL
+ *
+ */
+ __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
+ if (__pyx_t_1) {
+ __pyx_t_5 = (&__pyx_v_self->len);
+ } else {
+ __pyx_t_5 = NULL;
+ }
+ __pyx_v_info->shape = __pyx_t_5;
+
+ /* "View.MemoryView":202
+ * info.ndim = 1
+ * info.shape = &self.len if flags & PyBUF_ND else NULL
+ * info.strides = NULL # <<<<<<<<<<<<<<
+ *
+ * info.suboffsets = NULL
+ */
+ __pyx_v_info->strides = NULL;
+ }
+ __pyx_L6:;
+
+ /* "View.MemoryView":204
+ * info.strides = NULL
+ *
+ * info.suboffsets = NULL # <<<<<<<<<<<<<<
+ * info.itemsize = self.itemsize
+ * info.readonly = 0
+ */
+ __pyx_v_info->suboffsets = NULL;
+
+ /* "View.MemoryView":205
+ *
+ * info.suboffsets = NULL
+ * info.itemsize = self.itemsize # <<<<<<<<<<<<<<
+ * info.readonly = 0
+ * info.format = self.format if flags & PyBUF_FORMAT else NULL
+ */
+ __pyx_t_3 = __pyx_v_self->itemsize;
+ __pyx_v_info->itemsize = __pyx_t_3;
+
+ /* "View.MemoryView":206
+ * info.suboffsets = NULL
+ * info.itemsize = self.itemsize
+ * info.readonly = 0 # <<<<<<<<<<<<<<
+ * info.format = self.format if flags & PyBUF_FORMAT else NULL
+ * info.obj = self
+ */
+ __pyx_v_info->readonly = 0;
+
+ /* "View.MemoryView":207
+ * info.itemsize = self.itemsize
+ * info.readonly = 0
+ * info.format = self.format if flags & PyBUF_FORMAT else NULL # <<<<<<<<<<<<<<
+ * info.obj = self
+ *
+ */
+ __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
+ if (__pyx_t_1) {
+ __pyx_t_2 = __pyx_v_self->format;
+ } else {
+ __pyx_t_2 = NULL;
+ }
+ __pyx_v_info->format = __pyx_t_2;
+
+ /* "View.MemoryView":208
+ * info.readonly = 0
+ * info.format = self.format if flags & PyBUF_FORMAT else NULL
+ * info.obj = self # <<<<<<<<<<<<<<
+ *
+ * def __dealloc__(array self):
+ */
+ __Pyx_INCREF((PyObject *)__pyx_v_self);
+ __Pyx_GIVEREF((PyObject *)__pyx_v_self);
+ __Pyx_GOTREF(__pyx_v_info->obj);
+ __Pyx_DECREF(__pyx_v_info->obj);
+ __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
+
+ /* "View.MemoryView":182
+ * _allocate_buffer(self)
+ *
+ * @cname('getbuffer') # <<<<<<<<<<<<<<
+ * def __getbuffer__(self, Py_buffer *info, int flags):
+ * cdef int bufmode = -1
+ */
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ if (__pyx_v_info->obj != NULL) {
+ __Pyx_GOTREF(__pyx_v_info->obj);
+ __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
+ }
+ goto __pyx_L2;
+ __pyx_L0:;
+ if (__pyx_v_info->obj == Py_None) {
+ __Pyx_GOTREF(__pyx_v_info->obj);
+ __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
+ }
+ __pyx_L2:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":210
+ * info.obj = self
+ *
+ * def __dealloc__(array self): # <<<<<<<<<<<<<<
+ * if self.callback_free_data != NULL:
+ * self.callback_free_data(self.data)
+ */
+
+/* Python wrapper */
+static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+}
+
+static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
+ int __pyx_t_1;
+ int __pyx_t_2;
+
+ /* "View.MemoryView":211
+ *
+ * def __dealloc__(array self):
+ * if self.callback_free_data != NULL: # <<<<<<<<<<<<<<
+ * self.callback_free_data(self.data)
+ * elif self.free_data and self.data is not NULL:
+ */
+ __pyx_t_1 = (__pyx_v_self->callback_free_data != NULL);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":212
+ * def __dealloc__(array self):
+ * if self.callback_free_data != NULL:
+ * self.callback_free_data(self.data) # <<<<<<<<<<<<<<
+ * elif self.free_data and self.data is not NULL:
+ * if self.dtype_is_object:
+ */
+ __pyx_v_self->callback_free_data(__pyx_v_self->data);
+
+ /* "View.MemoryView":211
+ *
+ * def __dealloc__(array self):
+ * if self.callback_free_data != NULL: # <<<<<<<<<<<<<<
+ * self.callback_free_data(self.data)
+ * elif self.free_data and self.data is not NULL:
+ */
+ goto __pyx_L3;
+ }
+
+ /* "View.MemoryView":213
+ * if self.callback_free_data != NULL:
+ * self.callback_free_data(self.data)
+ * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<<
+ * if self.dtype_is_object:
+ * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
+ */
+ if (__pyx_v_self->free_data) {
+ } else {
+ __pyx_t_1 = __pyx_v_self->free_data;
+ goto __pyx_L4_bool_binop_done;
+ }
+ __pyx_t_2 = (__pyx_v_self->data != NULL);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L4_bool_binop_done:;
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":214
+ * self.callback_free_data(self.data)
+ * elif self.free_data and self.data is not NULL:
+ * if self.dtype_is_object: # <<<<<<<<<<<<<<
+ * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
+ * free(self.data)
+ */
+ if (__pyx_v_self->dtype_is_object) {
+
+ /* "View.MemoryView":215
+ * elif self.free_data and self.data is not NULL:
+ * if self.dtype_is_object:
+ * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False) # <<<<<<<<<<<<<<
+ * free(self.data)
+ * PyObject_Free(self._shape)
+ */
+ __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
+
+ /* "View.MemoryView":214
+ * self.callback_free_data(self.data)
+ * elif self.free_data and self.data is not NULL:
+ * if self.dtype_is_object: # <<<<<<<<<<<<<<
+ * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
+ * free(self.data)
+ */
+ }
+
+ /* "View.MemoryView":216
+ * if self.dtype_is_object:
+ * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
+ * free(self.data) # <<<<<<<<<<<<<<
+ * PyObject_Free(self._shape)
+ *
+ */
+ free(__pyx_v_self->data);
+
+ /* "View.MemoryView":213
+ * if self.callback_free_data != NULL:
+ * self.callback_free_data(self.data)
+ * elif self.free_data and self.data is not NULL: # <<<<<<<<<<<<<<
+ * if self.dtype_is_object:
+ * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
+ */
+ }
+ __pyx_L3:;
+
+ /* "View.MemoryView":217
+ * refcount_objects_in_slice(self.data, self._shape, self._strides, self.ndim, inc=False)
+ * free(self.data)
+ * PyObject_Free(self._shape) # <<<<<<<<<<<<<<
+ *
+ * @property
+ */
+ PyObject_Free(__pyx_v_self->_shape);
+
+ /* "View.MemoryView":210
+ * info.obj = self
+ *
+ * def __dealloc__(array self): # <<<<<<<<<<<<<<
+ * if self.callback_free_data != NULL:
+ * self.callback_free_data(self.data)
+ */
+
+ /* function exit code */
+}
+
+/* "View.MemoryView":219
+ * PyObject_Free(self._shape)
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def memview(self):
+ * return self.get_memview()
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 1);
+
+ /* "View.MemoryView":221
+ * @property
+ * def memview(self):
+ * return self.get_memview() # <<<<<<<<<<<<<<
+ *
+ * @cname('get_memview')
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":219
+ * PyObject_Free(self._shape)
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def memview(self):
+ * return self.get_memview()
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":224
+ *
+ * @cname('get_memview')
+ * cdef get_memview(self): # <<<<<<<<<<<<<<
+ * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
+ * return memoryview(self, flags, self.dtype_is_object)
+ */
+
+static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
+ int __pyx_v_flags;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("get_memview", 1);
+
+ /* "View.MemoryView":225
+ * @cname('get_memview')
+ * cdef get_memview(self):
+ * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<<
+ * return memoryview(self, flags, self.dtype_is_object)
+ *
+ */
+ __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
+
+ /* "View.MemoryView":226
+ * cdef get_memview(self):
+ * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
+ * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<<
+ *
+ * def __len__(self):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 226, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF((PyObject *)__pyx_v_self);
+ __Pyx_GIVEREF((PyObject *)__pyx_v_self);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self))) __PYX_ERR(0, 226, __pyx_L1_error);
+ __Pyx_GIVEREF(__pyx_t_1);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error);
+ __Pyx_GIVEREF(__pyx_t_2);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(0, 226, __pyx_L1_error);
+ __pyx_t_1 = 0;
+ __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":224
+ *
+ * @cname('get_memview')
+ * cdef get_memview(self): # <<<<<<<<<<<<<<
+ * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
+ * return memoryview(self, flags, self.dtype_is_object)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":228
+ * return memoryview(self, flags, self.dtype_is_object)
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self._shape[0]
+ *
+ */
+
+/* Python wrapper */
+static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
+static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ Py_ssize_t __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
+ Py_ssize_t __pyx_r;
+
+ /* "View.MemoryView":229
+ *
+ * def __len__(self):
+ * return self._shape[0] # <<<<<<<<<<<<<<
+ *
+ * def __getattr__(self, attr):
+ */
+ __pyx_r = (__pyx_v_self->_shape[0]);
+ goto __pyx_L0;
+
+ /* "View.MemoryView":228
+ * return memoryview(self, flags, self.dtype_is_object)
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * return self._shape[0]
+ *
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ return __pyx_r;
+}
+
+/* "View.MemoryView":231
+ * return self._shape[0]
+ *
+ * def __getattr__(self, attr): # <<<<<<<<<<<<<<
+ * return getattr(self.memview, attr)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
+static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__getattr__", 1);
+
+ /* "View.MemoryView":232
+ *
+ * def __getattr__(self, attr):
+ * return getattr(self.memview, attr) # <<<<<<<<<<<<<<
+ *
+ * def __getitem__(self, item):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 232, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":231
+ * return self._shape[0]
+ *
+ * def __getattr__(self, attr): # <<<<<<<<<<<<<<
+ * return getattr(self.memview, attr)
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":234
+ * return getattr(self.memview, attr)
+ *
+ * def __getitem__(self, item): # <<<<<<<<<<<<<<
+ * return self.memview[item]
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
+static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__getitem__", 1);
+
+ /* "View.MemoryView":235
+ *
+ * def __getitem__(self, item):
+ * return self.memview[item] # <<<<<<<<<<<<<<
+ *
+ * def __setitem__(self, item, value):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":234
+ * return getattr(self.memview, attr)
+ *
+ * def __getitem__(self, item): # <<<<<<<<<<<<<<
+ * return self.memview[item]
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":237
+ * return self.memview[item]
+ *
+ * def __setitem__(self, item, value): # <<<<<<<<<<<<<<
+ * self.memview[item] = value
+ *
+ */
+
+/* Python wrapper */
+static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__setitem__", 1);
+
+ /* "View.MemoryView":238
+ *
+ * def __setitem__(self, item, value):
+ * self.memview[item] = value # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (unlikely((PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0))) __PYX_ERR(0, 238, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "View.MemoryView":237
+ * return self.memview[item]
+ *
+ * def __setitem__(self, item, value): # <<<<<<<<<<<<<<
+ * self.memview[item] = value
+ *
+ */
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":1
+ * def __reduce_cython__(self): # <<<<<<<<<<<<<<
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ * def __setstate_cython__(self, __pyx_state):
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+); /*proto*/
+static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+) {
+ #if !CYTHON_METH_FASTCALL
+ CYTHON_UNUSED Py_ssize_t __pyx_nargs;
+ #endif
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
+ #if !CYTHON_METH_FASTCALL
+ #if CYTHON_ASSUME_SAFE_MACROS
+ __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
+ #else
+ __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
+ #endif
+ #endif
+ __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
+ if (unlikely(__pyx_nargs > 0)) {
+ __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;}
+ if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL;
+ __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__reduce_cython__", 1);
+
+ /* "(tree fragment)":2
+ * def __reduce_cython__(self):
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<<
+ * def __setstate_cython__(self, __pyx_state):
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ */
+ __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0);
+ __PYX_ERR(0, 2, __pyx_L1_error)
+
+ /* "(tree fragment)":1
+ * def __reduce_cython__(self): # <<<<<<<<<<<<<<
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ * def __setstate_cython__(self, __pyx_state):
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":3
+ * def __reduce_cython__(self):
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+); /*proto*/
+static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+) {
+ CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
+ #if !CYTHON_METH_FASTCALL
+ CYTHON_UNUSED Py_ssize_t __pyx_nargs;
+ #endif
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject* values[1] = {0};
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
+ #if !CYTHON_METH_FASTCALL
+ #if CYTHON_ASSUME_SAFE_MACROS
+ __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
+ #else
+ __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
+ #endif
+ #endif
+ __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
+ {
+ PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
+ if (__pyx_kwds) {
+ Py_ssize_t kw_args;
+ switch (__pyx_nargs) {
+ case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
+ switch (__pyx_nargs) {
+ case 0:
+ if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
+ (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
+ kw_args--;
+ }
+ else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3, __pyx_L3_error)
+ else goto __pyx_L5_argtuple_error;
+ }
+ if (unlikely(kw_args > 0)) {
+ const Py_ssize_t kwd_pos_args = __pyx_nargs;
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(0, 3, __pyx_L3_error)
+ }
+ } else if (unlikely(__pyx_nargs != 1)) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
+ }
+ __pyx_v___pyx_state = values[0];
+ }
+ goto __pyx_L6_skip;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3, __pyx_L3_error)
+ __pyx_L6_skip:;
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L3_error:;
+ {
+ Py_ssize_t __pyx_temp;
+ for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
+ __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
+ }
+ }
+ __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v___pyx_state);
+
+ /* function exit code */
+ {
+ Py_ssize_t __pyx_temp;
+ for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
+ __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
+ }
+ }
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__setstate_cython__", 1);
+
+ /* "(tree fragment)":4
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ * def __setstate_cython__(self, __pyx_state):
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<<
+ */
+ __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0);
+ __PYX_ERR(0, 4, __pyx_L1_error)
+
+ /* "(tree fragment)":3
+ * def __reduce_cython__(self):
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":248
+ *
+ * @cname("__pyx_array_allocate_buffer")
+ * cdef int _allocate_buffer(array self) except -1: # <<<<<<<<<<<<<<
+ *
+ *
+ */
+
+static int __pyx_array_allocate_buffer(struct __pyx_array_obj *__pyx_v_self) {
+ Py_ssize_t __pyx_v_i;
+ PyObject **__pyx_v_p;
+ int __pyx_r;
+ int __pyx_t_1;
+ Py_ssize_t __pyx_t_2;
+ Py_ssize_t __pyx_t_3;
+ Py_ssize_t __pyx_t_4;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+
+ /* "View.MemoryView":254
+ * cdef PyObject **p
+ *
+ * self.free_data = True # <<<<<<<<<<<<<<
+ * self.data = malloc(self.len)
+ * if not self.data:
+ */
+ __pyx_v_self->free_data = 1;
+
+ /* "View.MemoryView":255
+ *
+ * self.free_data = True
+ * self.data = malloc(self.len) # <<<<<<<<<<<<<<
+ * if not self.data:
+ * raise MemoryError, "unable to allocate array data."
+ */
+ __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));
+
+ /* "View.MemoryView":256
+ * self.free_data = True
+ * self.data = malloc(self.len)
+ * if not self.data: # <<<<<<<<<<<<<<
+ * raise MemoryError, "unable to allocate array data."
+ *
+ */
+ __pyx_t_1 = (!(__pyx_v_self->data != 0));
+ if (unlikely(__pyx_t_1)) {
+
+ /* "View.MemoryView":257
+ * self.data = malloc(self.len)
+ * if not self.data:
+ * raise MemoryError, "unable to allocate array data." # <<<<<<<<<<<<<<
+ *
+ * if self.dtype_is_object:
+ */
+ __Pyx_Raise(__pyx_builtin_MemoryError, __pyx_kp_s_unable_to_allocate_array_data, 0, 0);
+ __PYX_ERR(0, 257, __pyx_L1_error)
+
+ /* "View.MemoryView":256
+ * self.free_data = True
+ * self.data = malloc(self.len)
+ * if not self.data: # <<<<<<<<<<<<<<
+ * raise MemoryError, "unable to allocate array data."
+ *
+ */
+ }
+
+ /* "View.MemoryView":259
+ * raise MemoryError, "unable to allocate array data."
+ *
+ * if self.dtype_is_object: # <<<<<<<<<<<<<<
+ * p = self.data
+ * for i in range(self.len // self.itemsize):
+ */
+ if (__pyx_v_self->dtype_is_object) {
+
+ /* "View.MemoryView":260
+ *
+ * if self.dtype_is_object:
+ * p = self.data # <<<<<<<<<<<<<<
+ * for i in range(self.len // self.itemsize):
+ * p[i] = Py_None
+ */
+ __pyx_v_p = ((PyObject **)__pyx_v_self->data);
+
+ /* "View.MemoryView":261
+ * if self.dtype_is_object:
+ * p = self.data
+ * for i in range(self.len // self.itemsize): # <<<<<<<<<<<<<<
+ * p[i] = Py_None
+ * Py_INCREF(Py_None)
+ */
+ if (unlikely(__pyx_v_self->itemsize == 0)) {
+ PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
+ __PYX_ERR(0, 261, __pyx_L1_error)
+ }
+ else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_self->itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
+ PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
+ __PYX_ERR(0, 261, __pyx_L1_error)
+ }
+ __pyx_t_2 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_self->itemsize);
+ __pyx_t_3 = __pyx_t_2;
+ for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
+ __pyx_v_i = __pyx_t_4;
+
+ /* "View.MemoryView":262
+ * p = self.data
+ * for i in range(self.len // self.itemsize):
+ * p[i] = Py_None # <<<<<<<<<<<<<<
+ * Py_INCREF(Py_None)
+ * return 0
+ */
+ (__pyx_v_p[__pyx_v_i]) = Py_None;
+
+ /* "View.MemoryView":263
+ * for i in range(self.len // self.itemsize):
+ * p[i] = Py_None
+ * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
+ * return 0
+ *
+ */
+ Py_INCREF(Py_None);
+ }
+
+ /* "View.MemoryView":259
+ * raise MemoryError, "unable to allocate array data."
+ *
+ * if self.dtype_is_object: # <<<<<<<<<<<<<<
+ * p = self.data
+ * for i in range(self.len // self.itemsize):
+ */
+ }
+
+ /* "View.MemoryView":264
+ * p[i] = Py_None
+ * Py_INCREF(Py_None)
+ * return 0 # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_r = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":248
+ *
+ * @cname("__pyx_array_allocate_buffer")
+ * cdef int _allocate_buffer(array self) except -1: # <<<<<<<<<<<<<<
+ *
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("View.MemoryView._allocate_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ return __pyx_r;
+}
+
+/* "View.MemoryView":268
+ *
+ * @cname("__pyx_array_new")
+ * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): # <<<<<<<<<<<<<<
+ * cdef array result
+ * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string.
+ */
+
+static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_c_mode, char *__pyx_v_buf) {
+ struct __pyx_array_obj *__pyx_v_result = 0;
+ PyObject *__pyx_v_mode = 0;
+ struct __pyx_array_obj *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("array_cwrapper", 1);
+
+ /* "View.MemoryView":270
+ * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf):
+ * cdef array result
+ * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string. # <<<<<<<<<<<<<<
+ *
+ * if buf is NULL:
+ */
+ __pyx_t_2 = ((__pyx_v_c_mode[0]) == 'f');
+ if (__pyx_t_2) {
+ __Pyx_INCREF(__pyx_n_s_fortran);
+ __pyx_t_1 = __pyx_n_s_fortran;
+ } else {
+ __Pyx_INCREF(__pyx_n_s_c);
+ __pyx_t_1 = __pyx_n_s_c;
+ }
+ __pyx_v_mode = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "View.MemoryView":272
+ * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string.
+ *
+ * if buf is NULL: # <<<<<<<<<<<<<<
+ * result = array.__new__(array, shape, itemsize, format, mode)
+ * else:
+ */
+ __pyx_t_2 = (__pyx_v_buf == NULL);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":273
+ *
+ * if buf is NULL:
+ * result = array.__new__(array, shape, itemsize, format, mode) # <<<<<<<<<<<<<<
+ * else:
+ * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False)
+ */
+ __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 273, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 273, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = PyTuple_New(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 273, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_INCREF(__pyx_v_shape);
+ __Pyx_GIVEREF(__pyx_v_shape);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_shape)) __PYX_ERR(0, 273, __pyx_L1_error);
+ __Pyx_GIVEREF(__pyx_t_1);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __PYX_ERR(0, 273, __pyx_L1_error);
+ __Pyx_GIVEREF(__pyx_t_3);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3)) __PYX_ERR(0, 273, __pyx_L1_error);
+ __Pyx_INCREF(__pyx_v_mode);
+ __Pyx_GIVEREF(__pyx_v_mode);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_mode)) __PYX_ERR(0, 273, __pyx_L1_error);
+ __pyx_t_1 = 0;
+ __pyx_t_3 = 0;
+ __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_array_type), __pyx_t_4, NULL)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 273, __pyx_L1_error)
+ __Pyx_GOTREF((PyObject *)__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3);
+ __pyx_t_3 = 0;
+
+ /* "View.MemoryView":272
+ * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string.
+ *
+ * if buf is NULL: # <<<<<<<<<<<<<<
+ * result = array.__new__(array, shape, itemsize, format, mode)
+ * else:
+ */
+ goto __pyx_L3;
+ }
+
+ /* "View.MemoryView":275
+ * result = array.__new__(array, shape, itemsize, format, mode)
+ * else:
+ * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False) # <<<<<<<<<<<<<<
+ * result.data = buf
+ *
+ */
+ /*else*/ {
+ __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 275, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 275, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_v_shape);
+ __Pyx_GIVEREF(__pyx_v_shape);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shape)) __PYX_ERR(0, 275, __pyx_L1_error);
+ __Pyx_GIVEREF(__pyx_t_3);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3)) __PYX_ERR(0, 275, __pyx_L1_error);
+ __Pyx_GIVEREF(__pyx_t_4);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_4)) __PYX_ERR(0, 275, __pyx_L1_error);
+ __Pyx_INCREF(__pyx_v_mode);
+ __Pyx_GIVEREF(__pyx_v_mode);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_v_mode)) __PYX_ERR(0, 275, __pyx_L1_error);
+ __pyx_t_3 = 0;
+ __pyx_t_4 = 0;
+ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 275, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(0, 275, __pyx_L1_error)
+ __pyx_t_3 = ((PyObject *)__pyx_tp_new_array(((PyTypeObject *)__pyx_array_type), __pyx_t_1, __pyx_t_4)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 275, __pyx_L1_error)
+ __Pyx_GOTREF((PyObject *)__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_3);
+ __pyx_t_3 = 0;
+
+ /* "View.MemoryView":276
+ * else:
+ * result = array.__new__(array, shape, itemsize, format, mode, allocate_buffer=False)
+ * result.data = buf # <<<<<<<<<<<<<<
+ *
+ * return result
+ */
+ __pyx_v_result->data = __pyx_v_buf;
+ }
+ __pyx_L3:;
+
+ /* "View.MemoryView":278
+ * result.data = buf
+ *
+ * return result # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF((PyObject *)__pyx_r);
+ __Pyx_INCREF((PyObject *)__pyx_v_result);
+ __pyx_r = __pyx_v_result;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":268
+ *
+ * @cname("__pyx_array_new")
+ * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, char *c_mode, char *buf): # <<<<<<<<<<<<<<
+ * cdef array result
+ * cdef str mode = "fortran" if c_mode[0] == b'f' else "c" # this often comes from a constant C string.
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF((PyObject *)__pyx_v_result);
+ __Pyx_XDECREF(__pyx_v_mode);
+ __Pyx_XGIVEREF((PyObject *)__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":304
+ * cdef class Enum(object):
+ * cdef object name
+ * def __init__(self, name): # <<<<<<<<<<<<<<
+ * self.name = name
+ * def __repr__(self):
+ */
+
+/* Python wrapper */
+static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_name = 0;
+ CYTHON_UNUSED Py_ssize_t __pyx_nargs;
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject* values[1] = {0};
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
+ #if CYTHON_ASSUME_SAFE_MACROS
+ __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
+ #else
+ __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
+ #endif
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ {
+ PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
+ if (__pyx_kwds) {
+ Py_ssize_t kw_args;
+ switch (__pyx_nargs) {
+ case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
+ switch (__pyx_nargs) {
+ case 0:
+ if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_name)) != 0)) {
+ (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
+ kw_args--;
+ }
+ else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 304, __pyx_L3_error)
+ else goto __pyx_L5_argtuple_error;
+ }
+ if (unlikely(kw_args > 0)) {
+ const Py_ssize_t kwd_pos_args = __pyx_nargs;
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(0, 304, __pyx_L3_error)
+ }
+ } else if (unlikely(__pyx_nargs != 1)) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
+ }
+ __pyx_v_name = values[0];
+ }
+ goto __pyx_L6_skip;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 304, __pyx_L3_error)
+ __pyx_L6_skip:;
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L3_error:;
+ {
+ Py_ssize_t __pyx_temp;
+ for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
+ __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
+ }
+ }
+ __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return -1;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
+
+ /* function exit code */
+ {
+ Py_ssize_t __pyx_temp;
+ for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
+ __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
+ }
+ }
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__init__", 1);
+
+ /* "View.MemoryView":305
+ * cdef object name
+ * def __init__(self, name):
+ * self.name = name # <<<<<<<<<<<<<<
+ * def __repr__(self):
+ * return self.name
+ */
+ __Pyx_INCREF(__pyx_v_name);
+ __Pyx_GIVEREF(__pyx_v_name);
+ __Pyx_GOTREF(__pyx_v_self->name);
+ __Pyx_DECREF(__pyx_v_self->name);
+ __pyx_v_self->name = __pyx_v_name;
+
+ /* "View.MemoryView":304
+ * cdef class Enum(object):
+ * cdef object name
+ * def __init__(self, name): # <<<<<<<<<<<<<<
+ * self.name = name
+ * def __repr__(self):
+ */
+
+ /* function exit code */
+ __pyx_r = 0;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":306
+ * def __init__(self, name):
+ * self.name = name
+ * def __repr__(self): # <<<<<<<<<<<<<<
+ * return self.name
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__repr__", 1);
+
+ /* "View.MemoryView":307
+ * self.name = name
+ * def __repr__(self):
+ * return self.name # <<<<<<<<<<<<<<
+ *
+ * cdef generic = Enum("")
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_self->name);
+ __pyx_r = __pyx_v_self->name;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":306
+ * def __init__(self, name):
+ * self.name = name
+ * def __repr__(self): # <<<<<<<<<<<<<<
+ * return self.name
+ *
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":1
+ * def __reduce_cython__(self): # <<<<<<<<<<<<<<
+ * cdef tuple state
+ * cdef object _dict
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+); /*proto*/
+static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+) {
+ #if !CYTHON_METH_FASTCALL
+ CYTHON_UNUSED Py_ssize_t __pyx_nargs;
+ #endif
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
+ #if !CYTHON_METH_FASTCALL
+ #if CYTHON_ASSUME_SAFE_MACROS
+ __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
+ #else
+ __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
+ #endif
+ #endif
+ __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
+ if (unlikely(__pyx_nargs > 0)) {
+ __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;}
+ if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL;
+ __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
+ PyObject *__pyx_v_state = 0;
+ PyObject *__pyx_v__dict = 0;
+ int __pyx_v_use_setstate;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__reduce_cython__", 1);
+
+ /* "(tree fragment)":5
+ * cdef object _dict
+ * cdef bint use_setstate
+ * state = (self.name,) # <<<<<<<<<<<<<<
+ * _dict = getattr(self, '__dict__', None)
+ * if _dict is not None:
+ */
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_v_self->name);
+ __Pyx_GIVEREF(__pyx_v_self->name);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name)) __PYX_ERR(0, 5, __pyx_L1_error);
+ __pyx_v_state = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "(tree fragment)":6
+ * cdef bint use_setstate
+ * state = (self.name,)
+ * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
+ * if _dict is not None:
+ * state += (_dict,)
+ */
+ __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v__dict = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "(tree fragment)":7
+ * state = (self.name,)
+ * _dict = getattr(self, '__dict__', None)
+ * if _dict is not None: # <<<<<<<<<<<<<<
+ * state += (_dict,)
+ * use_setstate = True
+ */
+ __pyx_t_2 = (__pyx_v__dict != Py_None);
+ if (__pyx_t_2) {
+
+ /* "(tree fragment)":8
+ * _dict = getattr(self, '__dict__', None)
+ * if _dict is not None:
+ * state += (_dict,) # <<<<<<<<<<<<<<
+ * use_setstate = True
+ * else:
+ */
+ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(__pyx_v__dict);
+ __Pyx_GIVEREF(__pyx_v__dict);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict)) __PYX_ERR(0, 8, __pyx_L1_error);
+ __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 8, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_3));
+ __pyx_t_3 = 0;
+
+ /* "(tree fragment)":9
+ * if _dict is not None:
+ * state += (_dict,)
+ * use_setstate = True # <<<<<<<<<<<<<<
+ * else:
+ * use_setstate = self.name is not None
+ */
+ __pyx_v_use_setstate = 1;
+
+ /* "(tree fragment)":7
+ * state = (self.name,)
+ * _dict = getattr(self, '__dict__', None)
+ * if _dict is not None: # <<<<<<<<<<<<<<
+ * state += (_dict,)
+ * use_setstate = True
+ */
+ goto __pyx_L3;
+ }
+
+ /* "(tree fragment)":11
+ * use_setstate = True
+ * else:
+ * use_setstate = self.name is not None # <<<<<<<<<<<<<<
+ * if use_setstate:
+ * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state
+ */
+ /*else*/ {
+ __pyx_t_2 = (__pyx_v_self->name != Py_None);
+ __pyx_v_use_setstate = __pyx_t_2;
+ }
+ __pyx_L3:;
+
+ /* "(tree fragment)":12
+ * else:
+ * use_setstate = self.name is not None
+ * if use_setstate: # <<<<<<<<<<<<<<
+ * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state
+ * else:
+ */
+ if (__pyx_v_use_setstate) {
+
+ /* "(tree fragment)":13
+ * use_setstate = self.name is not None
+ * if use_setstate:
+ * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state # <<<<<<<<<<<<<<
+ * else:
+ * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(0, 13, __pyx_L1_error);
+ __Pyx_INCREF(__pyx_int_136983863);
+ __Pyx_GIVEREF(__pyx_int_136983863);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_136983863)) __PYX_ERR(0, 13, __pyx_L1_error);
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None)) __PYX_ERR(0, 13, __pyx_L1_error);
+ __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 13, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_3);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error);
+ __Pyx_GIVEREF(__pyx_t_1);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error);
+ __Pyx_INCREF(__pyx_v_state);
+ __Pyx_GIVEREF(__pyx_v_state);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_state)) __PYX_ERR(0, 13, __pyx_L1_error);
+ __pyx_t_3 = 0;
+ __pyx_t_1 = 0;
+ __pyx_r = __pyx_t_4;
+ __pyx_t_4 = 0;
+ goto __pyx_L0;
+
+ /* "(tree fragment)":12
+ * else:
+ * use_setstate = self.name is not None
+ * if use_setstate: # <<<<<<<<<<<<<<
+ * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state
+ * else:
+ */
+ }
+
+ /* "(tree fragment)":15
+ * return __pyx_unpickle_Enum, (type(self), 0x82a3537, None), state
+ * else:
+ * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state) # <<<<<<<<<<<<<<
+ * def __setstate_cython__(self, __pyx_state):
+ * __pyx_unpickle_Enum__set_state(self, __pyx_state)
+ */
+ /*else*/ {
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 15, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))))) __PYX_ERR(0, 15, __pyx_L1_error);
+ __Pyx_INCREF(__pyx_int_136983863);
+ __Pyx_GIVEREF(__pyx_int_136983863);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_136983863)) __PYX_ERR(0, 15, __pyx_L1_error);
+ __Pyx_INCREF(__pyx_v_state);
+ __Pyx_GIVEREF(__pyx_v_state);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state)) __PYX_ERR(0, 15, __pyx_L1_error);
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_4);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4)) __PYX_ERR(0, 15, __pyx_L1_error);
+ __Pyx_GIVEREF(__pyx_t_1);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error);
+ __pyx_t_4 = 0;
+ __pyx_t_1 = 0;
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "(tree fragment)":1
+ * def __reduce_cython__(self): # <<<<<<<<<<<<<<
+ * cdef tuple state
+ * cdef object _dict
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_state);
+ __Pyx_XDECREF(__pyx_v__dict);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":16
+ * else:
+ * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state)
+ * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
+ * __pyx_unpickle_Enum__set_state(self, __pyx_state)
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+); /*proto*/
+static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+) {
+ PyObject *__pyx_v___pyx_state = 0;
+ #if !CYTHON_METH_FASTCALL
+ CYTHON_UNUSED Py_ssize_t __pyx_nargs;
+ #endif
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject* values[1] = {0};
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
+ #if !CYTHON_METH_FASTCALL
+ #if CYTHON_ASSUME_SAFE_MACROS
+ __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
+ #else
+ __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
+ #endif
+ #endif
+ __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
+ {
+ PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
+ if (__pyx_kwds) {
+ Py_ssize_t kw_args;
+ switch (__pyx_nargs) {
+ case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
+ switch (__pyx_nargs) {
+ case 0:
+ if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
+ (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
+ kw_args--;
+ }
+ else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 16, __pyx_L3_error)
+ else goto __pyx_L5_argtuple_error;
+ }
+ if (unlikely(kw_args > 0)) {
+ const Py_ssize_t kwd_pos_args = __pyx_nargs;
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(0, 16, __pyx_L3_error)
+ }
+ } else if (unlikely(__pyx_nargs != 1)) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
+ }
+ __pyx_v___pyx_state = values[0];
+ }
+ goto __pyx_L6_skip;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 16, __pyx_L3_error)
+ __pyx_L6_skip:;
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L3_error:;
+ {
+ Py_ssize_t __pyx_temp;
+ for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
+ __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
+ }
+ }
+ __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v___pyx_state);
+
+ /* function exit code */
+ {
+ Py_ssize_t __pyx_temp;
+ for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
+ __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
+ }
+ }
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__setstate_cython__", 1);
+
+ /* "(tree fragment)":17
+ * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state)
+ * def __setstate_cython__(self, __pyx_state):
+ * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
+ */
+ if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_v___pyx_state))) __PYX_ERR(0, 17, __pyx_L1_error)
+ __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "(tree fragment)":16
+ * else:
+ * return __pyx_unpickle_Enum, (type(self), 0x82a3537, state)
+ * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
+ * __pyx_unpickle_Enum__set_state(self, __pyx_state)
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":349
+ * cdef __Pyx_TypeInfo *typeinfo
+ *
+ * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<<
+ * self.obj = obj
+ * self.flags = flags
+ */
+
+/* Python wrapper */
+static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_obj = 0;
+ int __pyx_v_flags;
+ int __pyx_v_dtype_is_object;
+ CYTHON_UNUSED Py_ssize_t __pyx_nargs;
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject* values[3] = {0,0,0};
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
+ #if CYTHON_ASSUME_SAFE_MACROS
+ __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
+ #else
+ __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return -1;
+ #endif
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ {
+ PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
+ if (__pyx_kwds) {
+ Py_ssize_t kw_args;
+ switch (__pyx_nargs) {
+ case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
+ CYTHON_FALLTHROUGH;
+ case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
+ CYTHON_FALLTHROUGH;
+ case 1: values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = __Pyx_NumKwargs_VARARGS(__pyx_kwds);
+ switch (__pyx_nargs) {
+ case 0:
+ if (likely((values[0] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_obj)) != 0)) {
+ (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
+ kw_args--;
+ }
+ else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 349, __pyx_L3_error)
+ else goto __pyx_L5_argtuple_error;
+ CYTHON_FALLTHROUGH;
+ case 1:
+ if (likely((values[1] = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_flags)) != 0)) {
+ (void)__Pyx_Arg_NewRef_VARARGS(values[1]);
+ kw_args--;
+ }
+ else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 349, __pyx_L3_error)
+ else {
+ __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(0, 349, __pyx_L3_error)
+ }
+ CYTHON_FALLTHROUGH;
+ case 2:
+ if (kw_args > 0) {
+ PyObject* value = __Pyx_GetKwValue_VARARGS(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_dtype_is_object);
+ if (value) { values[2] = __Pyx_Arg_NewRef_VARARGS(value); kw_args--; }
+ else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 349, __pyx_L3_error)
+ }
+ }
+ if (unlikely(kw_args > 0)) {
+ const Py_ssize_t kwd_pos_args = __pyx_nargs;
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__cinit__") < 0)) __PYX_ERR(0, 349, __pyx_L3_error)
+ }
+ } else {
+ switch (__pyx_nargs) {
+ case 3: values[2] = __Pyx_Arg_VARARGS(__pyx_args, 2);
+ CYTHON_FALLTHROUGH;
+ case 2: values[1] = __Pyx_Arg_VARARGS(__pyx_args, 1);
+ values[0] = __Pyx_Arg_VARARGS(__pyx_args, 0);
+ break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ }
+ __pyx_v_obj = values[0];
+ __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 349, __pyx_L3_error)
+ if (values[2]) {
+ __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 349, __pyx_L3_error)
+ } else {
+ __pyx_v_dtype_is_object = ((int)0);
+ }
+ }
+ goto __pyx_L6_skip;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, __pyx_nargs); __PYX_ERR(0, 349, __pyx_L3_error)
+ __pyx_L6_skip:;
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L3_error:;
+ {
+ Py_ssize_t __pyx_temp;
+ for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
+ __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
+ }
+ }
+ __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return -1;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);
+
+ /* function exit code */
+ {
+ Py_ssize_t __pyx_temp;
+ for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
+ __Pyx_Arg_XDECREF_VARARGS(values[__pyx_temp]);
+ }
+ }
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ Py_intptr_t __pyx_t_4;
+ size_t __pyx_t_5;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__cinit__", 1);
+
+ /* "View.MemoryView":350
+ *
+ * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
+ * self.obj = obj # <<<<<<<<<<<<<<
+ * self.flags = flags
+ * if type(self) is memoryview or obj is not None:
+ */
+ __Pyx_INCREF(__pyx_v_obj);
+ __Pyx_GIVEREF(__pyx_v_obj);
+ __Pyx_GOTREF(__pyx_v_self->obj);
+ __Pyx_DECREF(__pyx_v_self->obj);
+ __pyx_v_self->obj = __pyx_v_obj;
+
+ /* "View.MemoryView":351
+ * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
+ * self.obj = obj
+ * self.flags = flags # <<<<<<<<<<<<<<
+ * if type(self) is memoryview or obj is not None:
+ * __Pyx_GetBuffer(obj, &self.view, flags)
+ */
+ __pyx_v_self->flags = __pyx_v_flags;
+
+ /* "View.MemoryView":352
+ * self.obj = obj
+ * self.flags = flags
+ * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<<
+ * __Pyx_GetBuffer(obj, &self.view, flags)
+ * if self.view.obj == NULL:
+ */
+ __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
+ if (!__pyx_t_2) {
+ } else {
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L4_bool_binop_done;
+ }
+ __pyx_t_2 = (__pyx_v_obj != Py_None);
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L4_bool_binop_done:;
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":353
+ * self.flags = flags
+ * if type(self) is memoryview or obj is not None:
+ * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<<
+ * if self.view.obj == NULL:
+ * (<__pyx_buffer *> &self.view).obj = Py_None
+ */
+ __pyx_t_3 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 353, __pyx_L1_error)
+
+ /* "View.MemoryView":354
+ * if type(self) is memoryview or obj is not None:
+ * __Pyx_GetBuffer(obj, &self.view, flags)
+ * if self.view.obj == NULL: # <<<<<<<<<<<<<<
+ * (<__pyx_buffer *> &self.view).obj = Py_None
+ * Py_INCREF(Py_None)
+ */
+ __pyx_t_1 = (((PyObject *)__pyx_v_self->view.obj) == NULL);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":355
+ * __Pyx_GetBuffer(obj, &self.view, flags)
+ * if self.view.obj == NULL:
+ * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<<
+ * Py_INCREF(Py_None)
+ *
+ */
+ ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
+
+ /* "View.MemoryView":356
+ * if self.view.obj == NULL:
+ * (<__pyx_buffer *> &self.view).obj = Py_None
+ * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
+ *
+ * if not __PYX_CYTHON_ATOMICS_ENABLED():
+ */
+ Py_INCREF(Py_None);
+
+ /* "View.MemoryView":354
+ * if type(self) is memoryview or obj is not None:
+ * __Pyx_GetBuffer(obj, &self.view, flags)
+ * if self.view.obj == NULL: # <<<<<<<<<<<<<<
+ * (<__pyx_buffer *> &self.view).obj = Py_None
+ * Py_INCREF(Py_None)
+ */
+ }
+
+ /* "View.MemoryView":352
+ * self.obj = obj
+ * self.flags = flags
+ * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<<
+ * __Pyx_GetBuffer(obj, &self.view, flags)
+ * if self.view.obj == NULL:
+ */
+ }
+
+ /* "View.MemoryView":358
+ * Py_INCREF(Py_None)
+ *
+ * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<<
+ * global __pyx_memoryview_thread_locks_used
+ * if __pyx_memoryview_thread_locks_used < 8:
+ */
+ __pyx_t_1 = (!__PYX_CYTHON_ATOMICS_ENABLED());
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":360
+ * if not __PYX_CYTHON_ATOMICS_ENABLED():
+ * global __pyx_memoryview_thread_locks_used
+ * if __pyx_memoryview_thread_locks_used < 8: # <<<<<<<<<<<<<<
+ * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
+ * __pyx_memoryview_thread_locks_used += 1
+ */
+ __pyx_t_1 = (__pyx_memoryview_thread_locks_used < 8);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":361
+ * global __pyx_memoryview_thread_locks_used
+ * if __pyx_memoryview_thread_locks_used < 8:
+ * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<<
+ * __pyx_memoryview_thread_locks_used += 1
+ * if self.lock is NULL:
+ */
+ __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
+
+ /* "View.MemoryView":362
+ * if __pyx_memoryview_thread_locks_used < 8:
+ * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
+ * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<<
+ * if self.lock is NULL:
+ * self.lock = PyThread_allocate_lock()
+ */
+ __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
+
+ /* "View.MemoryView":360
+ * if not __PYX_CYTHON_ATOMICS_ENABLED():
+ * global __pyx_memoryview_thread_locks_used
+ * if __pyx_memoryview_thread_locks_used < 8: # <<<<<<<<<<<<<<
+ * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
+ * __pyx_memoryview_thread_locks_used += 1
+ */
+ }
+
+ /* "View.MemoryView":363
+ * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
+ * __pyx_memoryview_thread_locks_used += 1
+ * if self.lock is NULL: # <<<<<<<<<<<<<<
+ * self.lock = PyThread_allocate_lock()
+ * if self.lock is NULL:
+ */
+ __pyx_t_1 = (__pyx_v_self->lock == NULL);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":364
+ * __pyx_memoryview_thread_locks_used += 1
+ * if self.lock is NULL:
+ * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<<
+ * if self.lock is NULL:
+ * raise MemoryError
+ */
+ __pyx_v_self->lock = PyThread_allocate_lock();
+
+ /* "View.MemoryView":365
+ * if self.lock is NULL:
+ * self.lock = PyThread_allocate_lock()
+ * if self.lock is NULL: # <<<<<<<<<<<<<<
+ * raise MemoryError
+ *
+ */
+ __pyx_t_1 = (__pyx_v_self->lock == NULL);
+ if (unlikely(__pyx_t_1)) {
+
+ /* "View.MemoryView":366
+ * self.lock = PyThread_allocate_lock()
+ * if self.lock is NULL:
+ * raise MemoryError # <<<<<<<<<<<<<<
+ *
+ * if flags & PyBUF_FORMAT:
+ */
+ PyErr_NoMemory(); __PYX_ERR(0, 366, __pyx_L1_error)
+
+ /* "View.MemoryView":365
+ * if self.lock is NULL:
+ * self.lock = PyThread_allocate_lock()
+ * if self.lock is NULL: # <<<<<<<<<<<<<<
+ * raise MemoryError
+ *
+ */
+ }
+
+ /* "View.MemoryView":363
+ * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
+ * __pyx_memoryview_thread_locks_used += 1
+ * if self.lock is NULL: # <<<<<<<<<<<<<<
+ * self.lock = PyThread_allocate_lock()
+ * if self.lock is NULL:
+ */
+ }
+
+ /* "View.MemoryView":358
+ * Py_INCREF(Py_None)
+ *
+ * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<<
+ * global __pyx_memoryview_thread_locks_used
+ * if __pyx_memoryview_thread_locks_used < 8:
+ */
+ }
+
+ /* "View.MemoryView":368
+ * raise MemoryError
+ *
+ * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
+ * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
+ * else:
+ */
+ __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":369
+ *
+ * if flags & PyBUF_FORMAT:
+ * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<<
+ * else:
+ * self.dtype_is_object = dtype_is_object
+ */
+ __pyx_t_2 = ((__pyx_v_self->view.format[0]) == 'O');
+ if (__pyx_t_2) {
+ } else {
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L12_bool_binop_done;
+ }
+ __pyx_t_2 = ((__pyx_v_self->view.format[1]) == '\x00');
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L12_bool_binop_done:;
+ __pyx_v_self->dtype_is_object = __pyx_t_1;
+
+ /* "View.MemoryView":368
+ * raise MemoryError
+ *
+ * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
+ * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
+ * else:
+ */
+ goto __pyx_L11;
+ }
+
+ /* "View.MemoryView":371
+ * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
+ * else:
+ * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<<
+ *
+ * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0
+ */
+ /*else*/ {
+ __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
+ }
+ __pyx_L11:;
+
+ /* "View.MemoryView":373
+ * self.dtype_is_object = dtype_is_object
+ *
+ * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0 # <<<<<<<<<<<<<<
+ * self.typeinfo = NULL
+ *
+ */
+ #ifndef CYTHON_WITHOUT_ASSERTIONS
+ if (unlikely(__pyx_assertions_enabled())) {
+ __pyx_t_4 = ((Py_intptr_t)((void *)(&__pyx_v_self->acquisition_count)));
+ __pyx_t_5 = (sizeof(__pyx_atomic_int_type));
+ if (unlikely(__pyx_t_5 == 0)) {
+ PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
+ __PYX_ERR(0, 373, __pyx_L1_error)
+ }
+ __pyx_t_1 = ((__pyx_t_4 % __pyx_t_5) == 0);
+ if (unlikely(!__pyx_t_1)) {
+ __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
+ __PYX_ERR(0, 373, __pyx_L1_error)
+ }
+ }
+ #else
+ if ((1)); else __PYX_ERR(0, 373, __pyx_L1_error)
+ #endif
+
+ /* "View.MemoryView":374
+ *
+ * assert (&self.acquisition_count) % sizeof(__pyx_atomic_int_type) == 0
+ * self.typeinfo = NULL # <<<<<<<<<<<<<<
+ *
+ * def __dealloc__(memoryview self):
+ */
+ __pyx_v_self->typeinfo = NULL;
+
+ /* "View.MemoryView":349
+ * cdef __Pyx_TypeInfo *typeinfo
+ *
+ * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<<
+ * self.obj = obj
+ * self.flags = flags
+ */
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":376
+ * self.typeinfo = NULL
+ *
+ * def __dealloc__(memoryview self): # <<<<<<<<<<<<<<
+ * if self.obj is not None:
+ * __Pyx_ReleaseBuffer(&self.view)
+ */
+
+/* Python wrapper */
+static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+}
+
+static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
+ int __pyx_v_i;
+ int __pyx_t_1;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ int __pyx_t_4;
+ PyThread_type_lock __pyx_t_5;
+ PyThread_type_lock __pyx_t_6;
+
+ /* "View.MemoryView":377
+ *
+ * def __dealloc__(memoryview self):
+ * if self.obj is not None: # <<<<<<<<<<<<<<
+ * __Pyx_ReleaseBuffer(&self.view)
+ * elif (<__pyx_buffer *> &self.view).obj == Py_None:
+ */
+ __pyx_t_1 = (__pyx_v_self->obj != Py_None);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":378
+ * def __dealloc__(memoryview self):
+ * if self.obj is not None:
+ * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<<
+ * elif (<__pyx_buffer *> &self.view).obj == Py_None:
+ *
+ */
+ __Pyx_ReleaseBuffer((&__pyx_v_self->view));
+
+ /* "View.MemoryView":377
+ *
+ * def __dealloc__(memoryview self):
+ * if self.obj is not None: # <<<<<<<<<<<<<<
+ * __Pyx_ReleaseBuffer(&self.view)
+ * elif (<__pyx_buffer *> &self.view).obj == Py_None:
+ */
+ goto __pyx_L3;
+ }
+
+ /* "View.MemoryView":379
+ * if self.obj is not None:
+ * __Pyx_ReleaseBuffer(&self.view)
+ * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<<
+ *
+ * (<__pyx_buffer *> &self.view).obj = NULL
+ */
+ __pyx_t_1 = (((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":381
+ * elif (<__pyx_buffer *> &self.view).obj == Py_None:
+ *
+ * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<<
+ * Py_DECREF(Py_None)
+ *
+ */
+ ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
+
+ /* "View.MemoryView":382
+ *
+ * (<__pyx_buffer *> &self.view).obj = NULL
+ * Py_DECREF(Py_None) # <<<<<<<<<<<<<<
+ *
+ * cdef int i
+ */
+ Py_DECREF(Py_None);
+
+ /* "View.MemoryView":379
+ * if self.obj is not None:
+ * __Pyx_ReleaseBuffer(&self.view)
+ * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<<
+ *
+ * (<__pyx_buffer *> &self.view).obj = NULL
+ */
+ }
+ __pyx_L3:;
+
+ /* "View.MemoryView":386
+ * cdef int i
+ * global __pyx_memoryview_thread_locks_used
+ * if self.lock != NULL: # <<<<<<<<<<<<<<
+ * for i in range(__pyx_memoryview_thread_locks_used):
+ * if __pyx_memoryview_thread_locks[i] is self.lock:
+ */
+ __pyx_t_1 = (__pyx_v_self->lock != NULL);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":387
+ * global __pyx_memoryview_thread_locks_used
+ * if self.lock != NULL:
+ * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<<
+ * if __pyx_memoryview_thread_locks[i] is self.lock:
+ * __pyx_memoryview_thread_locks_used -= 1
+ */
+ __pyx_t_2 = __pyx_memoryview_thread_locks_used;
+ __pyx_t_3 = __pyx_t_2;
+ for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
+ __pyx_v_i = __pyx_t_4;
+
+ /* "View.MemoryView":388
+ * if self.lock != NULL:
+ * for i in range(__pyx_memoryview_thread_locks_used):
+ * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<<
+ * __pyx_memoryview_thread_locks_used -= 1
+ * if i != __pyx_memoryview_thread_locks_used:
+ */
+ __pyx_t_1 = ((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":389
+ * for i in range(__pyx_memoryview_thread_locks_used):
+ * if __pyx_memoryview_thread_locks[i] is self.lock:
+ * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<<
+ * if i != __pyx_memoryview_thread_locks_used:
+ * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
+ */
+ __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
+
+ /* "View.MemoryView":390
+ * if __pyx_memoryview_thread_locks[i] is self.lock:
+ * __pyx_memoryview_thread_locks_used -= 1
+ * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<<
+ * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
+ * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
+ */
+ __pyx_t_1 = (__pyx_v_i != __pyx_memoryview_thread_locks_used);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":392
+ * if i != __pyx_memoryview_thread_locks_used:
+ * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
+ * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<<
+ * break
+ * else:
+ */
+ __pyx_t_5 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
+ __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
+
+ /* "View.MemoryView":391
+ * __pyx_memoryview_thread_locks_used -= 1
+ * if i != __pyx_memoryview_thread_locks_used:
+ * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<<
+ * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
+ * break
+ */
+ (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_5;
+ (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_6;
+
+ /* "View.MemoryView":390
+ * if __pyx_memoryview_thread_locks[i] is self.lock:
+ * __pyx_memoryview_thread_locks_used -= 1
+ * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<<
+ * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
+ * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
+ */
+ }
+
+ /* "View.MemoryView":393
+ * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
+ * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
+ * break # <<<<<<<<<<<<<<
+ * else:
+ * PyThread_free_lock(self.lock)
+ */
+ goto __pyx_L6_break;
+
+ /* "View.MemoryView":388
+ * if self.lock != NULL:
+ * for i in range(__pyx_memoryview_thread_locks_used):
+ * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<<
+ * __pyx_memoryview_thread_locks_used -= 1
+ * if i != __pyx_memoryview_thread_locks_used:
+ */
+ }
+ }
+ /*else*/ {
+
+ /* "View.MemoryView":395
+ * break
+ * else:
+ * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<<
+ *
+ * cdef char *get_item_pointer(memoryview self, object index) except NULL:
+ */
+ PyThread_free_lock(__pyx_v_self->lock);
+ }
+ __pyx_L6_break:;
+
+ /* "View.MemoryView":386
+ * cdef int i
+ * global __pyx_memoryview_thread_locks_used
+ * if self.lock != NULL: # <<<<<<<<<<<<<<
+ * for i in range(__pyx_memoryview_thread_locks_used):
+ * if __pyx_memoryview_thread_locks[i] is self.lock:
+ */
+ }
+
+ /* "View.MemoryView":376
+ * self.typeinfo = NULL
+ *
+ * def __dealloc__(memoryview self): # <<<<<<<<<<<<<<
+ * if self.obj is not None:
+ * __Pyx_ReleaseBuffer(&self.view)
+ */
+
+ /* function exit code */
+}
+
+/* "View.MemoryView":397
+ * PyThread_free_lock(self.lock)
+ *
+ * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<<
+ * cdef Py_ssize_t dim
+ * cdef char *itemp = self.view.buf
+ */
+
+static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
+ Py_ssize_t __pyx_v_dim;
+ char *__pyx_v_itemp;
+ PyObject *__pyx_v_idx = NULL;
+ char *__pyx_r;
+ __Pyx_RefNannyDeclarations
+ Py_ssize_t __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ Py_ssize_t __pyx_t_3;
+ PyObject *(*__pyx_t_4)(PyObject *);
+ PyObject *__pyx_t_5 = NULL;
+ Py_ssize_t __pyx_t_6;
+ char *__pyx_t_7;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("get_item_pointer", 1);
+
+ /* "View.MemoryView":399
+ * cdef char *get_item_pointer(memoryview self, object index) except NULL:
+ * cdef Py_ssize_t dim
+ * cdef char *itemp = self.view.buf # <<<<<<<<<<<<<<
+ *
+ * for dim, idx in enumerate(index):
+ */
+ __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);
+
+ /* "View.MemoryView":401
+ * cdef char *itemp = self.view.buf
+ *
+ * for dim, idx in enumerate(index): # <<<<<<<<<<<<<<
+ * itemp = pybuffer_index(&self.view, itemp, idx, dim)
+ *
+ */
+ __pyx_t_1 = 0;
+ if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
+ __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2);
+ __pyx_t_3 = 0;
+ __pyx_t_4 = NULL;
+ } else {
+ __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 401, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 401, __pyx_L1_error)
+ }
+ for (;;) {
+ if (likely(!__pyx_t_4)) {
+ if (likely(PyList_CheckExact(__pyx_t_2))) {
+ {
+ Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
+ #if !CYTHON_ASSUME_SAFE_MACROS
+ if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 401, __pyx_L1_error)
+ #endif
+ if (__pyx_t_3 >= __pyx_temp) break;
+ }
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(0, 401, __pyx_L1_error)
+ #else
+ __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 401, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ #endif
+ } else {
+ {
+ Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
+ #if !CYTHON_ASSUME_SAFE_MACROS
+ if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 401, __pyx_L1_error)
+ #endif
+ if (__pyx_t_3 >= __pyx_temp) break;
+ }
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(0, 401, __pyx_L1_error)
+ #else
+ __pyx_t_5 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 401, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ #endif
+ }
+ } else {
+ __pyx_t_5 = __pyx_t_4(__pyx_t_2);
+ if (unlikely(!__pyx_t_5)) {
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
+ else __PYX_ERR(0, 401, __pyx_L1_error)
+ }
+ break;
+ }
+ __Pyx_GOTREF(__pyx_t_5);
+ }
+ __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
+ __pyx_t_5 = 0;
+ __pyx_v_dim = __pyx_t_1;
+ __pyx_t_1 = (__pyx_t_1 + 1);
+
+ /* "View.MemoryView":402
+ *
+ * for dim, idx in enumerate(index):
+ * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<<
+ *
+ * return itemp
+ */
+ __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 402, __pyx_L1_error)
+ __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(0, 402, __pyx_L1_error)
+ __pyx_v_itemp = __pyx_t_7;
+
+ /* "View.MemoryView":401
+ * cdef char *itemp = self.view.buf
+ *
+ * for dim, idx in enumerate(index): # <<<<<<<<<<<<<<
+ * itemp = pybuffer_index(&self.view, itemp, idx, dim)
+ *
+ */
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "View.MemoryView":404
+ * itemp = pybuffer_index(&self.view, itemp, idx, dim)
+ *
+ * return itemp # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_r = __pyx_v_itemp;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":397
+ * PyThread_free_lock(self.lock)
+ *
+ * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<<
+ * cdef Py_ssize_t dim
+ * cdef char *itemp = self.view.buf
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_idx);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":407
+ *
+ *
+ * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<<
+ * if index is Ellipsis:
+ * return self
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
+static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
+ PyObject *__pyx_v_have_slices = NULL;
+ PyObject *__pyx_v_indices = NULL;
+ char *__pyx_v_itemp;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ char *__pyx_t_5;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__getitem__", 1);
+
+ /* "View.MemoryView":408
+ *
+ * def __getitem__(memoryview self, object index):
+ * if index is Ellipsis: # <<<<<<<<<<<<<<
+ * return self
+ *
+ */
+ __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":409
+ * def __getitem__(memoryview self, object index):
+ * if index is Ellipsis:
+ * return self # <<<<<<<<<<<<<<
+ *
+ * have_slices, indices = _unellipsify(index, self.view.ndim)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF((PyObject *)__pyx_v_self);
+ __pyx_r = ((PyObject *)__pyx_v_self);
+ goto __pyx_L0;
+
+ /* "View.MemoryView":408
+ *
+ * def __getitem__(memoryview self, object index):
+ * if index is Ellipsis: # <<<<<<<<<<<<<<
+ * return self
+ *
+ */
+ }
+
+ /* "View.MemoryView":411
+ * return self
+ *
+ * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
+ *
+ * cdef char *itemp
+ */
+ __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 411, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (likely(__pyx_t_2 != Py_None)) {
+ PyObject* sequence = __pyx_t_2;
+ Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
+ if (unlikely(size != 2)) {
+ if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ __PYX_ERR(0, 411, __pyx_L1_error)
+ }
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
+ __Pyx_INCREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_t_4);
+ #else
+ __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 411, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 411, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ #endif
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ } else {
+ __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 411, __pyx_L1_error)
+ }
+ __pyx_v_have_slices = __pyx_t_3;
+ __pyx_t_3 = 0;
+ __pyx_v_indices = __pyx_t_4;
+ __pyx_t_4 = 0;
+
+ /* "View.MemoryView":414
+ *
+ * cdef char *itemp
+ * if have_slices: # <<<<<<<<<<<<<<
+ * return memview_slice(self, indices)
+ * else:
+ */
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 414, __pyx_L1_error)
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":415
+ * cdef char *itemp
+ * if have_slices:
+ * return memview_slice(self, indices) # <<<<<<<<<<<<<<
+ * else:
+ * itemp = self.get_item_pointer(indices)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 415, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":414
+ *
+ * cdef char *itemp
+ * if have_slices: # <<<<<<<<<<<<<<
+ * return memview_slice(self, indices)
+ * else:
+ */
+ }
+
+ /* "View.MemoryView":417
+ * return memview_slice(self, indices)
+ * else:
+ * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<<
+ * return self.convert_item_to_object(itemp)
+ *
+ */
+ /*else*/ {
+ __pyx_t_5 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_5 == ((char *)NULL))) __PYX_ERR(0, 417, __pyx_L1_error)
+ __pyx_v_itemp = __pyx_t_5;
+
+ /* "View.MemoryView":418
+ * else:
+ * itemp = self.get_item_pointer(indices)
+ * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<<
+ *
+ * def __setitem__(memoryview self, object index, object value):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 418, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "View.MemoryView":407
+ *
+ *
+ * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<<
+ * if index is Ellipsis:
+ * return self
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_have_slices);
+ __Pyx_XDECREF(__pyx_v_indices);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":420
+ * return self.convert_item_to_object(itemp)
+ *
+ * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<<
+ * if self.view.readonly:
+ * raise TypeError, "Cannot assign to read-only memoryview"
+ */
+
+/* Python wrapper */
+static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
+static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
+ PyObject *__pyx_v_have_slices = NULL;
+ PyObject *__pyx_v_obj = NULL;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_t_4;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__setitem__", 0);
+ __Pyx_INCREF(__pyx_v_index);
+
+ /* "View.MemoryView":421
+ *
+ * def __setitem__(memoryview self, object index, object value):
+ * if self.view.readonly: # <<<<<<<<<<<<<<
+ * raise TypeError, "Cannot assign to read-only memoryview"
+ *
+ */
+ if (unlikely(__pyx_v_self->view.readonly)) {
+
+ /* "View.MemoryView":422
+ * def __setitem__(memoryview self, object index, object value):
+ * if self.view.readonly:
+ * raise TypeError, "Cannot assign to read-only memoryview" # <<<<<<<<<<<<<<
+ *
+ * have_slices, index = _unellipsify(index, self.view.ndim)
+ */
+ __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_Cannot_assign_to_read_only_memor, 0, 0);
+ __PYX_ERR(0, 422, __pyx_L1_error)
+
+ /* "View.MemoryView":421
+ *
+ * def __setitem__(memoryview self, object index, object value):
+ * if self.view.readonly: # <<<<<<<<<<<<<<
+ * raise TypeError, "Cannot assign to read-only memoryview"
+ *
+ */
+ }
+
+ /* "View.MemoryView":424
+ * raise TypeError, "Cannot assign to read-only memoryview"
+ *
+ * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
+ *
+ * if have_slices:
+ */
+ __pyx_t_1 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 424, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (likely(__pyx_t_1 != Py_None)) {
+ PyObject* sequence = __pyx_t_1;
+ Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
+ if (unlikely(size != 2)) {
+ if (size > 2) __Pyx_RaiseTooManyValuesError(2);
+ else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
+ __PYX_ERR(0, 424, __pyx_L1_error)
+ }
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
+ __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1);
+ __Pyx_INCREF(__pyx_t_2);
+ __Pyx_INCREF(__pyx_t_3);
+ #else
+ __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 424, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 424, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ #endif
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ } else {
+ __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 424, __pyx_L1_error)
+ }
+ __pyx_v_have_slices = __pyx_t_2;
+ __pyx_t_2 = 0;
+ __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_3);
+ __pyx_t_3 = 0;
+
+ /* "View.MemoryView":426
+ * have_slices, index = _unellipsify(index, self.view.ndim)
+ *
+ * if have_slices: # <<<<<<<<<<<<<<
+ * obj = self.is_slice(value)
+ * if obj:
+ */
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 426, __pyx_L1_error)
+ if (__pyx_t_4) {
+
+ /* "View.MemoryView":427
+ *
+ * if have_slices:
+ * obj = self.is_slice(value) # <<<<<<<<<<<<<<
+ * if obj:
+ * self.setitem_slice_assignment(self[index], obj)
+ */
+ __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 427, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_obj = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "View.MemoryView":428
+ * if have_slices:
+ * obj = self.is_slice(value)
+ * if obj: # <<<<<<<<<<<<<<
+ * self.setitem_slice_assignment(self[index], obj)
+ * else:
+ */
+ __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely((__pyx_t_4 < 0))) __PYX_ERR(0, 428, __pyx_L1_error)
+ if (__pyx_t_4) {
+
+ /* "View.MemoryView":429
+ * obj = self.is_slice(value)
+ * if obj:
+ * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<<
+ * else:
+ * self.setitem_slice_assign_scalar(self[index], value)
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 429, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_1, __pyx_v_obj); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 429, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+
+ /* "View.MemoryView":428
+ * if have_slices:
+ * obj = self.is_slice(value)
+ * if obj: # <<<<<<<<<<<<<<
+ * self.setitem_slice_assignment(self[index], obj)
+ * else:
+ */
+ goto __pyx_L5;
+ }
+
+ /* "View.MemoryView":431
+ * self.setitem_slice_assignment(self[index], obj)
+ * else:
+ * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<<
+ * else:
+ * self.setitem_indexed(index, value)
+ */
+ /*else*/ {
+ __pyx_t_3 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 431, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(0, 431, __pyx_L1_error)
+ __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_3), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 431, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ __pyx_L5:;
+
+ /* "View.MemoryView":426
+ * have_slices, index = _unellipsify(index, self.view.ndim)
+ *
+ * if have_slices: # <<<<<<<<<<<<<<
+ * obj = self.is_slice(value)
+ * if obj:
+ */
+ goto __pyx_L4;
+ }
+
+ /* "View.MemoryView":433
+ * self.setitem_slice_assign_scalar(self[index], value)
+ * else:
+ * self.setitem_indexed(index, value) # <<<<<<<<<<<<<<
+ *
+ * cdef is_slice(self, obj):
+ */
+ /*else*/ {
+ __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 433, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ }
+ __pyx_L4:;
+
+ /* "View.MemoryView":420
+ * return self.convert_item_to_object(itemp)
+ *
+ * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<<
+ * if self.view.readonly:
+ * raise TypeError, "Cannot assign to read-only memoryview"
+ */
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_have_slices);
+ __Pyx_XDECREF(__pyx_v_obj);
+ __Pyx_XDECREF(__pyx_v_index);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":435
+ * self.setitem_indexed(index, value)
+ *
+ * cdef is_slice(self, obj): # <<<<<<<<<<<<<<
+ * if not isinstance(obj, memoryview):
+ * try:
+ */
+
+static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ int __pyx_t_9;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("is_slice", 0);
+ __Pyx_INCREF(__pyx_v_obj);
+
+ /* "View.MemoryView":436
+ *
+ * cdef is_slice(self, obj):
+ * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<<
+ * try:
+ * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
+ */
+ __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
+ __pyx_t_2 = (!__pyx_t_1);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":437
+ * cdef is_slice(self, obj):
+ * if not isinstance(obj, memoryview):
+ * try: # <<<<<<<<<<<<<<
+ * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
+ * self.dtype_is_object)
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
+ __Pyx_XGOTREF(__pyx_t_3);
+ __Pyx_XGOTREF(__pyx_t_4);
+ __Pyx_XGOTREF(__pyx_t_5);
+ /*try:*/ {
+
+ /* "View.MemoryView":438
+ * if not isinstance(obj, memoryview):
+ * try:
+ * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<<
+ * self.dtype_is_object)
+ * except TypeError:
+ */
+ __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 438, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_6);
+
+ /* "View.MemoryView":439
+ * try:
+ * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
+ * self.dtype_is_object) # <<<<<<<<<<<<<<
+ * except TypeError:
+ * return None
+ */
+ __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 439, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+
+ /* "View.MemoryView":438
+ * if not isinstance(obj, memoryview):
+ * try:
+ * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<<
+ * self.dtype_is_object)
+ * except TypeError:
+ */
+ __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 438, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __Pyx_INCREF(__pyx_v_obj);
+ __Pyx_GIVEREF(__pyx_v_obj);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj)) __PYX_ERR(0, 438, __pyx_L4_error);
+ __Pyx_GIVEREF(__pyx_t_6);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6)) __PYX_ERR(0, 438, __pyx_L4_error);
+ __Pyx_GIVEREF(__pyx_t_7);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7)) __PYX_ERR(0, 438, __pyx_L4_error);
+ __pyx_t_6 = 0;
+ __pyx_t_7 = 0;
+ __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 438, __pyx_L4_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
+ __pyx_t_7 = 0;
+
+ /* "View.MemoryView":437
+ * cdef is_slice(self, obj):
+ * if not isinstance(obj, memoryview):
+ * try: # <<<<<<<<<<<<<<
+ * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
+ * self.dtype_is_object)
+ */
+ }
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ goto __pyx_L9_try_end;
+ __pyx_L4_error:;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
+
+ /* "View.MemoryView":440
+ * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
+ * self.dtype_is_object)
+ * except TypeError: # <<<<<<<<<<<<<<
+ * return None
+ *
+ */
+ __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
+ if (__pyx_t_9) {
+ __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(0, 440, __pyx_L6_except_error)
+ __Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_8);
+ __Pyx_XGOTREF(__pyx_t_6);
+
+ /* "View.MemoryView":441
+ * self.dtype_is_object)
+ * except TypeError:
+ * return None # <<<<<<<<<<<<<<
+ *
+ * return obj
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ goto __pyx_L7_except_return;
+ }
+ goto __pyx_L6_except_error;
+
+ /* "View.MemoryView":437
+ * cdef is_slice(self, obj):
+ * if not isinstance(obj, memoryview):
+ * try: # <<<<<<<<<<<<<<
+ * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
+ * self.dtype_is_object)
+ */
+ __pyx_L6_except_error:;
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
+ goto __pyx_L1_error;
+ __pyx_L7_except_return:;
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_XGIVEREF(__pyx_t_5);
+ __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
+ goto __pyx_L0;
+ __pyx_L9_try_end:;
+ }
+
+ /* "View.MemoryView":436
+ *
+ * cdef is_slice(self, obj):
+ * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<<
+ * try:
+ * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
+ */
+ }
+
+ /* "View.MemoryView":443
+ * return None
+ *
+ * return obj # <<<<<<<<<<<<<<
+ *
+ * cdef setitem_slice_assignment(self, dst, src):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_obj);
+ __pyx_r = __pyx_v_obj;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":435
+ * self.setitem_indexed(index, value)
+ *
+ * cdef is_slice(self, obj): # <<<<<<<<<<<<<<
+ * if not isinstance(obj, memoryview):
+ * try:
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_obj);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":445
+ * return obj
+ *
+ * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<<
+ * cdef __Pyx_memviewslice dst_slice
+ * cdef __Pyx_memviewslice src_slice
+ */
+
+static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
+ __Pyx_memviewslice __pyx_v_dst_slice;
+ __Pyx_memviewslice __pyx_v_src_slice;
+ __Pyx_memviewslice __pyx_v_msrc;
+ __Pyx_memviewslice __pyx_v_mdst;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_memviewslice *__pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_t_3;
+ int __pyx_t_4;
+ int __pyx_t_5;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("setitem_slice_assignment", 1);
+
+ /* "View.MemoryView":448
+ * cdef __Pyx_memviewslice dst_slice
+ * cdef __Pyx_memviewslice src_slice
+ * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0] # <<<<<<<<<<<<<<
+ * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0]
+ *
+ */
+ if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(0, 448, __pyx_L1_error)
+ __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(0, 448, __pyx_L1_error)
+ __pyx_v_msrc = (__pyx_t_1[0]);
+
+ /* "View.MemoryView":449
+ * cdef __Pyx_memviewslice src_slice
+ * cdef __Pyx_memviewslice msrc = get_slice_from_memview(src, &src_slice)[0]
+ * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0] # <<<<<<<<<<<<<<
+ *
+ * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object)
+ */
+ if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(0, 449, __pyx_L1_error)
+ __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(0, 449, __pyx_L1_error)
+ __pyx_v_mdst = (__pyx_t_1[0]);
+
+ /* "View.MemoryView":451
+ * cdef __Pyx_memviewslice mdst = get_slice_from_memview(dst, &dst_slice)[0]
+ *
+ * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<<
+ *
+ * cdef setitem_slice_assign_scalar(self, memoryview dst, value):
+ */
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 451, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 451, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 451, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 451, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_5 = __pyx_memoryview_copy_contents(__pyx_v_msrc, __pyx_v_mdst, __pyx_t_3, __pyx_t_4, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 451, __pyx_L1_error)
+
+ /* "View.MemoryView":445
+ * return obj
+ *
+ * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<<
+ * cdef __Pyx_memviewslice dst_slice
+ * cdef __Pyx_memviewslice src_slice
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":453
+ * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object)
+ *
+ * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<<
+ * cdef int array[128]
+ * cdef void *tmp = NULL
+ */
+
+static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
+ int __pyx_v_array[0x80];
+ void *__pyx_v_tmp;
+ void *__pyx_v_item;
+ __Pyx_memviewslice *__pyx_v_dst_slice;
+ __Pyx_memviewslice __pyx_v_tmp_slice;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_memviewslice *__pyx_t_1;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_t_4;
+ int __pyx_t_5;
+ char const *__pyx_t_6;
+ PyObject *__pyx_t_7 = NULL;
+ PyObject *__pyx_t_8 = NULL;
+ PyObject *__pyx_t_9 = NULL;
+ PyObject *__pyx_t_10 = NULL;
+ PyObject *__pyx_t_11 = NULL;
+ PyObject *__pyx_t_12 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 1);
+
+ /* "View.MemoryView":455
+ * cdef setitem_slice_assign_scalar(self, memoryview dst, value):
+ * cdef int array[128]
+ * cdef void *tmp = NULL # <<<<<<<<<<<<<<
+ * cdef void *item
+ *
+ */
+ __pyx_v_tmp = NULL;
+
+ /* "View.MemoryView":460
+ * cdef __Pyx_memviewslice *dst_slice
+ * cdef __Pyx_memviewslice tmp_slice
+ * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<<
+ *
+ * if self.view.itemsize > sizeof(array):
+ */
+ __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(0, 460, __pyx_L1_error)
+ __pyx_v_dst_slice = __pyx_t_1;
+
+ /* "View.MemoryView":462
+ * dst_slice = get_slice_from_memview(dst, &tmp_slice)
+ *
+ * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<<
+ * tmp = PyMem_Malloc(self.view.itemsize)
+ * if tmp == NULL:
+ */
+ __pyx_t_2 = (((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array)));
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":463
+ *
+ * if self.view.itemsize > sizeof(array):
+ * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<<
+ * if tmp == NULL:
+ * raise MemoryError
+ */
+ __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
+
+ /* "View.MemoryView":464
+ * if self.view.itemsize > sizeof(array):
+ * tmp = PyMem_Malloc(self.view.itemsize)
+ * if tmp == NULL: # <<<<<<<<<<<<<<
+ * raise MemoryError
+ * item = tmp
+ */
+ __pyx_t_2 = (__pyx_v_tmp == NULL);
+ if (unlikely(__pyx_t_2)) {
+
+ /* "View.MemoryView":465
+ * tmp = PyMem_Malloc(self.view.itemsize)
+ * if tmp == NULL:
+ * raise MemoryError # <<<<<<<<<<<<<<
+ * item = tmp
+ * else:
+ */
+ PyErr_NoMemory(); __PYX_ERR(0, 465, __pyx_L1_error)
+
+ /* "View.MemoryView":464
+ * if self.view.itemsize > sizeof(array):
+ * tmp = PyMem_Malloc(self.view.itemsize)
+ * if tmp == NULL: # <<<<<<<<<<<<<<
+ * raise MemoryError
+ * item = tmp
+ */
+ }
+
+ /* "View.MemoryView":466
+ * if tmp == NULL:
+ * raise MemoryError
+ * item = tmp # <<<<<<<<<<<<<<
+ * else:
+ * item = array
+ */
+ __pyx_v_item = __pyx_v_tmp;
+
+ /* "View.MemoryView":462
+ * dst_slice = get_slice_from_memview(dst, &tmp_slice)
+ *
+ * if self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<<
+ * tmp = PyMem_Malloc(self.view.itemsize)
+ * if tmp == NULL:
+ */
+ goto __pyx_L3;
+ }
+
+ /* "View.MemoryView":468
+ * item = tmp
+ * else:
+ * item = array # <<<<<<<<<<<<<<
+ *
+ * try:
+ */
+ /*else*/ {
+ __pyx_v_item = ((void *)__pyx_v_array);
+ }
+ __pyx_L3:;
+
+ /* "View.MemoryView":470
+ * item = array
+ *
+ * try: # <<<<<<<<<<<<<<
+ * if self.dtype_is_object:
+ * ( item)[0] = value
+ */
+ /*try:*/ {
+
+ /* "View.MemoryView":471
+ *
+ * try:
+ * if self.dtype_is_object: # <<<<<<<<<<<<<<
+ * ( item)[0] = value
+ * else:
+ */
+ if (__pyx_v_self->dtype_is_object) {
+
+ /* "View.MemoryView":472
+ * try:
+ * if self.dtype_is_object:
+ * ( item)[0] = value # <<<<<<<<<<<<<<
+ * else:
+ * self.assign_item_from_object( item, value)
+ */
+ (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
+
+ /* "View.MemoryView":471
+ *
+ * try:
+ * if self.dtype_is_object: # <<<<<<<<<<<<<<
+ * ( item)[0] = value
+ * else:
+ */
+ goto __pyx_L8;
+ }
+
+ /* "View.MemoryView":474
+ * ( item)[0] = value
+ * else:
+ * self.assign_item_from_object( item, value) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ /*else*/ {
+ __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 474, __pyx_L6_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
+ __pyx_L8:;
+
+ /* "View.MemoryView":478
+ *
+ *
+ * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<<
+ * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
+ * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
+ */
+ __pyx_t_2 = (__pyx_v_self->view.suboffsets != NULL);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":479
+ *
+ * if self.view.suboffsets != NULL:
+ * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<<
+ * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
+ * item, self.dtype_is_object)
+ */
+ __pyx_t_4 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(0, 479, __pyx_L6_error)
+
+ /* "View.MemoryView":478
+ *
+ *
+ * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<<
+ * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
+ * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
+ */
+ }
+
+ /* "View.MemoryView":480
+ * if self.view.suboffsets != NULL:
+ * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
+ * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<<
+ * item, self.dtype_is_object)
+ * finally:
+ */
+ __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object);
+ }
+
+ /* "View.MemoryView":483
+ * item, self.dtype_is_object)
+ * finally:
+ * PyMem_Free(tmp) # <<<<<<<<<<<<<<
+ *
+ * cdef setitem_indexed(self, index, value):
+ */
+ /*finally:*/ {
+ /*normal exit:*/{
+ PyMem_Free(__pyx_v_tmp);
+ goto __pyx_L7;
+ }
+ __pyx_L6_error:;
+ /*exception exit:*/{
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
+ __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
+ if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
+ if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_7);
+ __Pyx_XGOTREF(__pyx_t_8);
+ __Pyx_XGOTREF(__pyx_t_9);
+ __Pyx_XGOTREF(__pyx_t_10);
+ __Pyx_XGOTREF(__pyx_t_11);
+ __Pyx_XGOTREF(__pyx_t_12);
+ __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
+ {
+ PyMem_Free(__pyx_v_tmp);
+ }
+ if (PY_MAJOR_VERSION >= 3) {
+ __Pyx_XGIVEREF(__pyx_t_10);
+ __Pyx_XGIVEREF(__pyx_t_11);
+ __Pyx_XGIVEREF(__pyx_t_12);
+ __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
+ }
+ __Pyx_XGIVEREF(__pyx_t_7);
+ __Pyx_XGIVEREF(__pyx_t_8);
+ __Pyx_XGIVEREF(__pyx_t_9);
+ __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
+ __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
+ __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
+ goto __pyx_L1_error;
+ }
+ __pyx_L7:;
+ }
+
+ /* "View.MemoryView":453
+ * memoryview_copy_contents(msrc, mdst, src.ndim, dst.ndim, self.dtype_is_object)
+ *
+ * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<<
+ * cdef int array[128]
+ * cdef void *tmp = NULL
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":485
+ * PyMem_Free(tmp)
+ *
+ * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<<
+ * cdef char *itemp = self.get_item_pointer(index)
+ * self.assign_item_from_object(itemp, value)
+ */
+
+static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
+ char *__pyx_v_itemp;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ char *__pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("setitem_indexed", 1);
+
+ /* "View.MemoryView":486
+ *
+ * cdef setitem_indexed(self, index, value):
+ * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<<
+ * self.assign_item_from_object(itemp, value)
+ *
+ */
+ __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(0, 486, __pyx_L1_error)
+ __pyx_v_itemp = __pyx_t_1;
+
+ /* "View.MemoryView":487
+ * cdef setitem_indexed(self, index, value):
+ * cdef char *itemp = self.get_item_pointer(index)
+ * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<<
+ *
+ * cdef convert_item_to_object(self, char *itemp):
+ */
+ __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 487, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "View.MemoryView":485
+ * PyMem_Free(tmp)
+ *
+ * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<<
+ * cdef char *itemp = self.get_item_pointer(index)
+ * self.assign_item_from_object(itemp, value)
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":489
+ * self.assign_item_from_object(itemp, value)
+ *
+ * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
+ * """Only used if instantiated manually by the user, or if Cython doesn't
+ * know how to convert the type"""
+ */
+
+static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
+ PyObject *__pyx_v_struct = NULL;
+ PyObject *__pyx_v_bytesitem = 0;
+ PyObject *__pyx_v_result = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ PyObject *__pyx_t_6 = NULL;
+ PyObject *__pyx_t_7 = NULL;
+ int __pyx_t_8;
+ Py_ssize_t __pyx_t_9;
+ int __pyx_t_10;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("convert_item_to_object", 1);
+
+ /* "View.MemoryView":492
+ * """Only used if instantiated manually by the user, or if Cython doesn't
+ * know how to convert the type"""
+ * import struct # <<<<<<<<<<<<<<
+ * cdef bytes bytesitem
+ *
+ */
+ __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_struct, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 492, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_struct = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "View.MemoryView":495
+ * cdef bytes bytesitem
+ *
+ * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<<
+ * try:
+ * result = struct.unpack(self.view.format, bytesitem)
+ */
+ __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "View.MemoryView":496
+ *
+ * bytesitem = itemp[:self.view.itemsize]
+ * try: # <<<<<<<<<<<<<<
+ * result = struct.unpack(self.view.format, bytesitem)
+ * except struct.error:
+ */
+ {
+ __Pyx_PyThreadState_declare
+ __Pyx_PyThreadState_assign
+ __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
+ __Pyx_XGOTREF(__pyx_t_2);
+ __Pyx_XGOTREF(__pyx_t_3);
+ __Pyx_XGOTREF(__pyx_t_4);
+ /*try:*/ {
+
+ /* "View.MemoryView":497
+ * bytesitem = itemp[:self.view.itemsize]
+ * try:
+ * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<<
+ * except struct.error:
+ * raise ValueError, "Unable to convert item to object"
+ */
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 497, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 497, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_7 = NULL;
+ __pyx_t_8 = 0;
+ #if CYTHON_UNPACK_METHODS
+ if (likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_7)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_7);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ __pyx_t_8 = 1;
+ }
+ }
+ #endif
+ {
+ PyObject *__pyx_callargs[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
+ __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_8, 2+__pyx_t_8);
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 497, __pyx_L3_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ __pyx_v_result = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "View.MemoryView":496
+ *
+ * bytesitem = itemp[:self.view.itemsize]
+ * try: # <<<<<<<<<<<<<<
+ * result = struct.unpack(self.view.format, bytesitem)
+ * except struct.error:
+ */
+ }
+
+ /* "View.MemoryView":501
+ * raise ValueError, "Unable to convert item to object"
+ * else:
+ * if len(self.view.format) == 1: # <<<<<<<<<<<<<<
+ * return result[0]
+ * return result
+ */
+ /*else:*/ {
+ __pyx_t_9 = __Pyx_ssize_strlen(__pyx_v_self->view.format); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 501, __pyx_L5_except_error)
+ __pyx_t_10 = (__pyx_t_9 == 1);
+ if (__pyx_t_10) {
+
+ /* "View.MemoryView":502
+ * else:
+ * if len(self.view.format) == 1:
+ * return result[0] # <<<<<<<<<<<<<<
+ * return result
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 502, __pyx_L5_except_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L6_except_return;
+
+ /* "View.MemoryView":501
+ * raise ValueError, "Unable to convert item to object"
+ * else:
+ * if len(self.view.format) == 1: # <<<<<<<<<<<<<<
+ * return result[0]
+ * return result
+ */
+ }
+
+ /* "View.MemoryView":503
+ * if len(self.view.format) == 1:
+ * return result[0]
+ * return result # <<<<<<<<<<<<<<
+ *
+ * cdef assign_item_from_object(self, char *itemp, object value):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_result);
+ __pyx_r = __pyx_v_result;
+ goto __pyx_L6_except_return;
+ }
+ __pyx_L3_error:;
+ __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
+
+ /* "View.MemoryView":498
+ * try:
+ * result = struct.unpack(self.view.format, bytesitem)
+ * except struct.error: # <<<<<<<<<<<<<<
+ * raise ValueError, "Unable to convert item to object"
+ * else:
+ */
+ __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_6);
+ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 498, __pyx_L5_except_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_7);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_6);
+ __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0;
+ if (__pyx_t_8) {
+ __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(0, 498, __pyx_L5_except_error)
+ __Pyx_XGOTREF(__pyx_t_6);
+ __Pyx_XGOTREF(__pyx_t_5);
+ __Pyx_XGOTREF(__pyx_t_1);
+
+ /* "View.MemoryView":499
+ * result = struct.unpack(self.view.format, bytesitem)
+ * except struct.error:
+ * raise ValueError, "Unable to convert item to object" # <<<<<<<<<<<<<<
+ * else:
+ * if len(self.view.format) == 1:
+ */
+ __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Unable_to_convert_item_to_object, 0, 0);
+ __PYX_ERR(0, 499, __pyx_L5_except_error)
+ }
+ goto __pyx_L5_except_error;
+
+ /* "View.MemoryView":496
+ *
+ * bytesitem = itemp[:self.view.itemsize]
+ * try: # <<<<<<<<<<<<<<
+ * result = struct.unpack(self.view.format, bytesitem)
+ * except struct.error:
+ */
+ __pyx_L5_except_error:;
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
+ goto __pyx_L1_error;
+ __pyx_L6_except_return:;
+ __Pyx_XGIVEREF(__pyx_t_2);
+ __Pyx_XGIVEREF(__pyx_t_3);
+ __Pyx_XGIVEREF(__pyx_t_4);
+ __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
+ goto __pyx_L0;
+ }
+
+ /* "View.MemoryView":489
+ * self.assign_item_from_object(itemp, value)
+ *
+ * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
+ * """Only used if instantiated manually by the user, or if Cython doesn't
+ * know how to convert the type"""
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_struct);
+ __Pyx_XDECREF(__pyx_v_bytesitem);
+ __Pyx_XDECREF(__pyx_v_result);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":505
+ * return result
+ *
+ * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
+ * """Only used if instantiated manually by the user, or if Cython doesn't
+ * know how to convert the type"""
+ */
+
+static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
+ PyObject *__pyx_v_struct = NULL;
+ char __pyx_v_c;
+ PyObject *__pyx_v_bytesvalue = 0;
+ Py_ssize_t __pyx_v_i;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ PyObject *__pyx_t_4 = NULL;
+ PyObject *__pyx_t_5 = NULL;
+ int __pyx_t_6;
+ Py_ssize_t __pyx_t_7;
+ PyObject *__pyx_t_8 = NULL;
+ char *__pyx_t_9;
+ char *__pyx_t_10;
+ char *__pyx_t_11;
+ char *__pyx_t_12;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("assign_item_from_object", 1);
+
+ /* "View.MemoryView":508
+ * """Only used if instantiated manually by the user, or if Cython doesn't
+ * know how to convert the type"""
+ * import struct # <<<<<<<<<<<<<<
+ * cdef char c
+ * cdef bytes bytesvalue
+ */
+ __pyx_t_1 = __Pyx_ImportDottedModule(__pyx_n_s_struct, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_v_struct = __pyx_t_1;
+ __pyx_t_1 = 0;
+
+ /* "View.MemoryView":513
+ * cdef Py_ssize_t i
+ *
+ * if isinstance(value, tuple): # <<<<<<<<<<<<<<
+ * bytesvalue = struct.pack(self.view.format, *value)
+ * else:
+ */
+ __pyx_t_2 = PyTuple_Check(__pyx_v_value);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":514
+ *
+ * if isinstance(value, tuple):
+ * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<<
+ * else:
+ * bytesvalue = struct.pack(self.view.format, value)
+ */
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 514, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 514, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 514, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_3);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3)) __PYX_ERR(0, 514, __pyx_L1_error);
+ __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 514, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 514, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 514, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(0, 514, __pyx_L1_error)
+ __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3);
+ __pyx_t_3 = 0;
+
+ /* "View.MemoryView":513
+ * cdef Py_ssize_t i
+ *
+ * if isinstance(value, tuple): # <<<<<<<<<<<<<<
+ * bytesvalue = struct.pack(self.view.format, *value)
+ * else:
+ */
+ goto __pyx_L3;
+ }
+
+ /* "View.MemoryView":516
+ * bytesvalue = struct.pack(self.view.format, *value)
+ * else:
+ * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<<
+ *
+ * for i, c in enumerate(bytesvalue):
+ */
+ /*else*/ {
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 516, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_4 = NULL;
+ __pyx_t_6 = 0;
+ #if CYTHON_UNPACK_METHODS
+ if (likely(PyMethod_Check(__pyx_t_5))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
+ __Pyx_INCREF(__pyx_t_4);
+ __Pyx_INCREF(function);
+ __Pyx_DECREF_SET(__pyx_t_5, function);
+ __pyx_t_6 = 1;
+ }
+ }
+ #endif
+ {
+ PyObject *__pyx_callargs[3] = {__pyx_t_4, __pyx_t_1, __pyx_v_value};
+ __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_5, __pyx_callargs+1-__pyx_t_6, 2+__pyx_t_6);
+ __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 516, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("bytes", __pyx_t_3))) __PYX_ERR(0, 516, __pyx_L1_error)
+ __pyx_v_bytesvalue = ((PyObject*)__pyx_t_3);
+ __pyx_t_3 = 0;
+ }
+ __pyx_L3:;
+
+ /* "View.MemoryView":518
+ * bytesvalue = struct.pack(self.view.format, value)
+ *
+ * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
+ * itemp[i] = c
+ *
+ */
+ __pyx_t_7 = 0;
+ if (unlikely(__pyx_v_bytesvalue == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
+ __PYX_ERR(0, 518, __pyx_L1_error)
+ }
+ __Pyx_INCREF(__pyx_v_bytesvalue);
+ __pyx_t_8 = __pyx_v_bytesvalue;
+ __pyx_t_10 = PyBytes_AS_STRING(__pyx_t_8);
+ __pyx_t_11 = (__pyx_t_10 + PyBytes_GET_SIZE(__pyx_t_8));
+ for (__pyx_t_12 = __pyx_t_10; __pyx_t_12 < __pyx_t_11; __pyx_t_12++) {
+ __pyx_t_9 = __pyx_t_12;
+ __pyx_v_c = (__pyx_t_9[0]);
+
+ /* "View.MemoryView":519
+ *
+ * for i, c in enumerate(bytesvalue):
+ * itemp[i] = c # <<<<<<<<<<<<<<
+ *
+ * @cname('getbuffer')
+ */
+ __pyx_v_i = __pyx_t_7;
+
+ /* "View.MemoryView":518
+ * bytesvalue = struct.pack(self.view.format, value)
+ *
+ * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
+ * itemp[i] = c
+ *
+ */
+ __pyx_t_7 = (__pyx_t_7 + 1);
+
+ /* "View.MemoryView":519
+ *
+ * for i, c in enumerate(bytesvalue):
+ * itemp[i] = c # <<<<<<<<<<<<<<
+ *
+ * @cname('getbuffer')
+ */
+ (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
+ }
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+
+ /* "View.MemoryView":505
+ * return result
+ *
+ * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
+ * """Only used if instantiated manually by the user, or if Cython doesn't
+ * know how to convert the type"""
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_struct);
+ __Pyx_XDECREF(__pyx_v_bytesvalue);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":521
+ * itemp[i] = c
+ *
+ * @cname('getbuffer') # <<<<<<<<<<<<<<
+ * def __getbuffer__(self, Py_buffer *info, int flags):
+ * if flags & PyBUF_WRITABLE and self.view.readonly:
+ */
+
+/* Python wrapper */
+CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
+CYTHON_UNUSED static int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ Py_ssize_t *__pyx_t_3;
+ char *__pyx_t_4;
+ void *__pyx_t_5;
+ int __pyx_t_6;
+ Py_ssize_t __pyx_t_7;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ if (unlikely(__pyx_v_info == NULL)) {
+ PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
+ return -1;
+ }
+ __Pyx_RefNannySetupContext("__getbuffer__", 0);
+ __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(__pyx_v_info->obj);
+
+ /* "View.MemoryView":523
+ * @cname('getbuffer')
+ * def __getbuffer__(self, Py_buffer *info, int flags):
+ * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<<
+ * raise ValueError, "Cannot create writable memory view from read-only memoryview"
+ *
+ */
+ __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
+ if (__pyx_t_2) {
+ } else {
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L4_bool_binop_done;
+ }
+ __pyx_t_1 = __pyx_v_self->view.readonly;
+ __pyx_L4_bool_binop_done:;
+ if (unlikely(__pyx_t_1)) {
+
+ /* "View.MemoryView":524
+ * def __getbuffer__(self, Py_buffer *info, int flags):
+ * if flags & PyBUF_WRITABLE and self.view.readonly:
+ * raise ValueError, "Cannot create writable memory view from read-only memoryview" # <<<<<<<<<<<<<<
+ *
+ * if flags & PyBUF_ND:
+ */
+ __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Cannot_create_writable_memory_vi, 0, 0);
+ __PYX_ERR(0, 524, __pyx_L1_error)
+
+ /* "View.MemoryView":523
+ * @cname('getbuffer')
+ * def __getbuffer__(self, Py_buffer *info, int flags):
+ * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<<
+ * raise ValueError, "Cannot create writable memory view from read-only memoryview"
+ *
+ */
+ }
+
+ /* "View.MemoryView":526
+ * raise ValueError, "Cannot create writable memory view from read-only memoryview"
+ *
+ * if flags & PyBUF_ND: # <<<<<<<<<<<<<<
+ * info.shape = self.view.shape
+ * else:
+ */
+ __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":527
+ *
+ * if flags & PyBUF_ND:
+ * info.shape = self.view.shape # <<<<<<<<<<<<<<
+ * else:
+ * info.shape = NULL
+ */
+ __pyx_t_3 = __pyx_v_self->view.shape;
+ __pyx_v_info->shape = __pyx_t_3;
+
+ /* "View.MemoryView":526
+ * raise ValueError, "Cannot create writable memory view from read-only memoryview"
+ *
+ * if flags & PyBUF_ND: # <<<<<<<<<<<<<<
+ * info.shape = self.view.shape
+ * else:
+ */
+ goto __pyx_L6;
+ }
+
+ /* "View.MemoryView":529
+ * info.shape = self.view.shape
+ * else:
+ * info.shape = NULL # <<<<<<<<<<<<<<
+ *
+ * if flags & PyBUF_STRIDES:
+ */
+ /*else*/ {
+ __pyx_v_info->shape = NULL;
+ }
+ __pyx_L6:;
+
+ /* "View.MemoryView":531
+ * info.shape = NULL
+ *
+ * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
+ * info.strides = self.view.strides
+ * else:
+ */
+ __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":532
+ *
+ * if flags & PyBUF_STRIDES:
+ * info.strides = self.view.strides # <<<<<<<<<<<<<<
+ * else:
+ * info.strides = NULL
+ */
+ __pyx_t_3 = __pyx_v_self->view.strides;
+ __pyx_v_info->strides = __pyx_t_3;
+
+ /* "View.MemoryView":531
+ * info.shape = NULL
+ *
+ * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
+ * info.strides = self.view.strides
+ * else:
+ */
+ goto __pyx_L7;
+ }
+
+ /* "View.MemoryView":534
+ * info.strides = self.view.strides
+ * else:
+ * info.strides = NULL # <<<<<<<<<<<<<<
+ *
+ * if flags & PyBUF_INDIRECT:
+ */
+ /*else*/ {
+ __pyx_v_info->strides = NULL;
+ }
+ __pyx_L7:;
+
+ /* "View.MemoryView":536
+ * info.strides = NULL
+ *
+ * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<<
+ * info.suboffsets = self.view.suboffsets
+ * else:
+ */
+ __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":537
+ *
+ * if flags & PyBUF_INDIRECT:
+ * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<<
+ * else:
+ * info.suboffsets = NULL
+ */
+ __pyx_t_3 = __pyx_v_self->view.suboffsets;
+ __pyx_v_info->suboffsets = __pyx_t_3;
+
+ /* "View.MemoryView":536
+ * info.strides = NULL
+ *
+ * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<<
+ * info.suboffsets = self.view.suboffsets
+ * else:
+ */
+ goto __pyx_L8;
+ }
+
+ /* "View.MemoryView":539
+ * info.suboffsets = self.view.suboffsets
+ * else:
+ * info.suboffsets = NULL # <<<<<<<<<<<<<<
+ *
+ * if flags & PyBUF_FORMAT:
+ */
+ /*else*/ {
+ __pyx_v_info->suboffsets = NULL;
+ }
+ __pyx_L8:;
+
+ /* "View.MemoryView":541
+ * info.suboffsets = NULL
+ *
+ * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
+ * info.format = self.view.format
+ * else:
+ */
+ __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":542
+ *
+ * if flags & PyBUF_FORMAT:
+ * info.format = self.view.format # <<<<<<<<<<<<<<
+ * else:
+ * info.format = NULL
+ */
+ __pyx_t_4 = __pyx_v_self->view.format;
+ __pyx_v_info->format = __pyx_t_4;
+
+ /* "View.MemoryView":541
+ * info.suboffsets = NULL
+ *
+ * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
+ * info.format = self.view.format
+ * else:
+ */
+ goto __pyx_L9;
+ }
+
+ /* "View.MemoryView":544
+ * info.format = self.view.format
+ * else:
+ * info.format = NULL # <<<<<<<<<<<<<<
+ *
+ * info.buf = self.view.buf
+ */
+ /*else*/ {
+ __pyx_v_info->format = NULL;
+ }
+ __pyx_L9:;
+
+ /* "View.MemoryView":546
+ * info.format = NULL
+ *
+ * info.buf = self.view.buf # <<<<<<<<<<<<<<
+ * info.ndim = self.view.ndim
+ * info.itemsize = self.view.itemsize
+ */
+ __pyx_t_5 = __pyx_v_self->view.buf;
+ __pyx_v_info->buf = __pyx_t_5;
+
+ /* "View.MemoryView":547
+ *
+ * info.buf = self.view.buf
+ * info.ndim = self.view.ndim # <<<<<<<<<<<<<<
+ * info.itemsize = self.view.itemsize
+ * info.len = self.view.len
+ */
+ __pyx_t_6 = __pyx_v_self->view.ndim;
+ __pyx_v_info->ndim = __pyx_t_6;
+
+ /* "View.MemoryView":548
+ * info.buf = self.view.buf
+ * info.ndim = self.view.ndim
+ * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<<
+ * info.len = self.view.len
+ * info.readonly = self.view.readonly
+ */
+ __pyx_t_7 = __pyx_v_self->view.itemsize;
+ __pyx_v_info->itemsize = __pyx_t_7;
+
+ /* "View.MemoryView":549
+ * info.ndim = self.view.ndim
+ * info.itemsize = self.view.itemsize
+ * info.len = self.view.len # <<<<<<<<<<<<<<
+ * info.readonly = self.view.readonly
+ * info.obj = self
+ */
+ __pyx_t_7 = __pyx_v_self->view.len;
+ __pyx_v_info->len = __pyx_t_7;
+
+ /* "View.MemoryView":550
+ * info.itemsize = self.view.itemsize
+ * info.len = self.view.len
+ * info.readonly = self.view.readonly # <<<<<<<<<<<<<<
+ * info.obj = self
+ *
+ */
+ __pyx_t_1 = __pyx_v_self->view.readonly;
+ __pyx_v_info->readonly = __pyx_t_1;
+
+ /* "View.MemoryView":551
+ * info.len = self.view.len
+ * info.readonly = self.view.readonly
+ * info.obj = self # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_INCREF((PyObject *)__pyx_v_self);
+ __Pyx_GIVEREF((PyObject *)__pyx_v_self);
+ __Pyx_GOTREF(__pyx_v_info->obj);
+ __Pyx_DECREF(__pyx_v_info->obj);
+ __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
+
+ /* "View.MemoryView":521
+ * itemp[i] = c
+ *
+ * @cname('getbuffer') # <<<<<<<<<<<<<<
+ * def __getbuffer__(self, Py_buffer *info, int flags):
+ * if flags & PyBUF_WRITABLE and self.view.readonly:
+ */
+
+ /* function exit code */
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ if (__pyx_v_info->obj != NULL) {
+ __Pyx_GOTREF(__pyx_v_info->obj);
+ __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
+ }
+ goto __pyx_L2;
+ __pyx_L0:;
+ if (__pyx_v_info->obj == Py_None) {
+ __Pyx_GOTREF(__pyx_v_info->obj);
+ __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
+ }
+ __pyx_L2:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":554
+ *
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def T(self):
+ * cdef _memoryviewslice result = memoryview_copy(self)
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
+ struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 1);
+
+ /* "View.MemoryView":556
+ * @property
+ * def T(self):
+ * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<<
+ * transpose_memslice(&result.from_slice)
+ * return result
+ */
+ __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 556, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(0, 556, __pyx_L1_error)
+ __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "View.MemoryView":557
+ * def T(self):
+ * cdef _memoryviewslice result = memoryview_copy(self)
+ * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<<
+ * return result
+ *
+ */
+ __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 557, __pyx_L1_error)
+
+ /* "View.MemoryView":558
+ * cdef _memoryviewslice result = memoryview_copy(self)
+ * transpose_memslice(&result.from_slice)
+ * return result # <<<<<<<<<<<<<<
+ *
+ * @property
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF((PyObject *)__pyx_v_result);
+ __pyx_r = ((PyObject *)__pyx_v_result);
+ goto __pyx_L0;
+
+ /* "View.MemoryView":554
+ *
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def T(self):
+ * cdef _memoryviewslice result = memoryview_copy(self)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF((PyObject *)__pyx_v_result);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":560
+ * return result
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def base(self):
+ * return self._get_base()
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 1);
+
+ /* "View.MemoryView":562
+ * @property
+ * def base(self):
+ * return self._get_base() # <<<<<<<<<<<<<<
+ *
+ * cdef _get_base(self):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->_get_base(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 562, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":560
+ * return result
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def base(self):
+ * return self._get_base()
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":564
+ * return self._get_base()
+ *
+ * cdef _get_base(self): # <<<<<<<<<<<<<<
+ * return self.obj
+ *
+ */
+
+static PyObject *__pyx_memoryview__get_base(struct __pyx_memoryview_obj *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("_get_base", 1);
+
+ /* "View.MemoryView":565
+ *
+ * cdef _get_base(self):
+ * return self.obj # <<<<<<<<<<<<<<
+ *
+ * @property
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_self->obj);
+ __pyx_r = __pyx_v_self->obj;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":564
+ * return self._get_base()
+ *
+ * cdef _get_base(self): # <<<<<<<<<<<<<<
+ * return self.obj
+ *
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":567
+ * return self.obj
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def shape(self):
+ * return tuple([length for length in self.view.shape[:self.view.ndim]])
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
+ Py_ssize_t __pyx_7genexpr__pyx_v_length;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ Py_ssize_t *__pyx_t_2;
+ Py_ssize_t *__pyx_t_3;
+ Py_ssize_t *__pyx_t_4;
+ PyObject *__pyx_t_5 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 1);
+
+ /* "View.MemoryView":569
+ * @property
+ * def shape(self):
+ * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<<
+ *
+ * @property
+ */
+ __Pyx_XDECREF(__pyx_r);
+ { /* enter inner scope */
+ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 569, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
+ for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
+ __pyx_t_2 = __pyx_t_4;
+ __pyx_7genexpr__pyx_v_length = (__pyx_t_2[0]);
+ __pyx_t_5 = PyInt_FromSsize_t(__pyx_7genexpr__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 569, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 569, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ }
+ } /* exit inner scope */
+ __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 569, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_r = __pyx_t_5;
+ __pyx_t_5 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":567
+ * return self.obj
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def shape(self):
+ * return tuple([length for length in self.view.shape[:self.view.ndim]])
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":571
+ * return tuple([length for length in self.view.shape[:self.view.ndim]])
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def strides(self):
+ * if self.view.strides == NULL:
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
+ Py_ssize_t __pyx_8genexpr1__pyx_v_stride;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ Py_ssize_t *__pyx_t_3;
+ Py_ssize_t *__pyx_t_4;
+ Py_ssize_t *__pyx_t_5;
+ PyObject *__pyx_t_6 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 1);
+
+ /* "View.MemoryView":573
+ * @property
+ * def strides(self):
+ * if self.view.strides == NULL: # <<<<<<<<<<<<<<
+ *
+ * raise ValueError, "Buffer view does not expose strides"
+ */
+ __pyx_t_1 = (__pyx_v_self->view.strides == NULL);
+ if (unlikely(__pyx_t_1)) {
+
+ /* "View.MemoryView":575
+ * if self.view.strides == NULL:
+ *
+ * raise ValueError, "Buffer view does not expose strides" # <<<<<<<<<<<<<<
+ *
+ * return tuple([stride for stride in self.view.strides[:self.view.ndim]])
+ */
+ __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Buffer_view_does_not_expose_stri, 0, 0);
+ __PYX_ERR(0, 575, __pyx_L1_error)
+
+ /* "View.MemoryView":573
+ * @property
+ * def strides(self):
+ * if self.view.strides == NULL: # <<<<<<<<<<<<<<
+ *
+ * raise ValueError, "Buffer view does not expose strides"
+ */
+ }
+
+ /* "View.MemoryView":577
+ * raise ValueError, "Buffer view does not expose strides"
+ *
+ * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<<
+ *
+ * @property
+ */
+ __Pyx_XDECREF(__pyx_r);
+ { /* enter inner scope */
+ __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 577, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
+ for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
+ __pyx_t_3 = __pyx_t_5;
+ __pyx_8genexpr1__pyx_v_stride = (__pyx_t_3[0]);
+ __pyx_t_6 = PyInt_FromSsize_t(__pyx_8genexpr1__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 577, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 577, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ } /* exit inner scope */
+ __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 577, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_r = __pyx_t_6;
+ __pyx_t_6 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":571
+ * return tuple([length for length in self.view.shape[:self.view.ndim]])
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def strides(self):
+ * if self.view.strides == NULL:
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":579
+ * return tuple([stride for stride in self.view.strides[:self.view.ndim]])
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def suboffsets(self):
+ * if self.view.suboffsets == NULL:
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
+ Py_ssize_t __pyx_8genexpr2__pyx_v_suboffset;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ Py_ssize_t *__pyx_t_3;
+ Py_ssize_t *__pyx_t_4;
+ Py_ssize_t *__pyx_t_5;
+ PyObject *__pyx_t_6 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 1);
+
+ /* "View.MemoryView":581
+ * @property
+ * def suboffsets(self):
+ * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<<
+ * return (-1,) * self.view.ndim
+ *
+ */
+ __pyx_t_1 = (__pyx_v_self->view.suboffsets == NULL);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":582
+ * def suboffsets(self):
+ * if self.view.suboffsets == NULL:
+ * return (-1,) * self.view.ndim # <<<<<<<<<<<<<<
+ *
+ * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = __Pyx_PySequence_Multiply(__pyx_tuple__4, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 582, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":581
+ * @property
+ * def suboffsets(self):
+ * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<<
+ * return (-1,) * self.view.ndim
+ *
+ */
+ }
+
+ /* "View.MemoryView":584
+ * return (-1,) * self.view.ndim
+ *
+ * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<<
+ *
+ * @property
+ */
+ __Pyx_XDECREF(__pyx_r);
+ { /* enter inner scope */
+ __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 584, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_4 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
+ for (__pyx_t_5 = __pyx_v_self->view.suboffsets; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
+ __pyx_t_3 = __pyx_t_5;
+ __pyx_8genexpr2__pyx_v_suboffset = (__pyx_t_3[0]);
+ __pyx_t_6 = PyInt_FromSsize_t(__pyx_8genexpr2__pyx_v_suboffset); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 584, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 584, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ }
+ } /* exit inner scope */
+ __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 584, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_r = __pyx_t_6;
+ __pyx_t_6 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":579
+ * return tuple([stride for stride in self.view.strides[:self.view.ndim]])
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def suboffsets(self):
+ * if self.view.suboffsets == NULL:
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_6);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":586
+ * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def ndim(self):
+ * return self.view.ndim
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 1);
+
+ /* "View.MemoryView":588
+ * @property
+ * def ndim(self):
+ * return self.view.ndim # <<<<<<<<<<<<<<
+ *
+ * @property
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 588, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":586
+ * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def ndim(self):
+ * return self.view.ndim
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":590
+ * return self.view.ndim
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def itemsize(self):
+ * return self.view.itemsize
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 1);
+
+ /* "View.MemoryView":592
+ * @property
+ * def itemsize(self):
+ * return self.view.itemsize # <<<<<<<<<<<<<<
+ *
+ * @property
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 592, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":590
+ * return self.view.ndim
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def itemsize(self):
+ * return self.view.itemsize
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":594
+ * return self.view.itemsize
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def nbytes(self):
+ * return self.size * self.view.itemsize
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 1);
+
+ /* "View.MemoryView":596
+ * @property
+ * def nbytes(self):
+ * return self.size * self.view.itemsize # <<<<<<<<<<<<<<
+ *
+ * @property
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 596, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 596, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 596, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_r = __pyx_t_3;
+ __pyx_t_3 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":594
+ * return self.view.itemsize
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def nbytes(self):
+ * return self.size * self.view.itemsize
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":598
+ * return self.size * self.view.itemsize
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def size(self):
+ * if self._size is None:
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
+ PyObject *__pyx_v_result = NULL;
+ PyObject *__pyx_v_length = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ Py_ssize_t *__pyx_t_2;
+ Py_ssize_t *__pyx_t_3;
+ Py_ssize_t *__pyx_t_4;
+ PyObject *__pyx_t_5 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__get__", 1);
+
+ /* "View.MemoryView":600
+ * @property
+ * def size(self):
+ * if self._size is None: # <<<<<<<<<<<<<<
+ * result = 1
+ *
+ */
+ __pyx_t_1 = (__pyx_v_self->_size == Py_None);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":601
+ * def size(self):
+ * if self._size is None:
+ * result = 1 # <<<<<<<<<<<<<<
+ *
+ * for length in self.view.shape[:self.view.ndim]:
+ */
+ __Pyx_INCREF(__pyx_int_1);
+ __pyx_v_result = __pyx_int_1;
+
+ /* "View.MemoryView":603
+ * result = 1
+ *
+ * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<<
+ * result *= length
+ *
+ */
+ __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
+ for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
+ __pyx_t_2 = __pyx_t_4;
+ __pyx_t_5 = PyInt_FromSsize_t((__pyx_t_2[0])); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 603, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_5);
+ __pyx_t_5 = 0;
+
+ /* "View.MemoryView":604
+ *
+ * for length in self.view.shape[:self.view.ndim]:
+ * result *= length # <<<<<<<<<<<<<<
+ *
+ * self._size = result
+ */
+ __pyx_t_5 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 604, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5);
+ __pyx_t_5 = 0;
+ }
+
+ /* "View.MemoryView":606
+ * result *= length
+ *
+ * self._size = result # <<<<<<<<<<<<<<
+ *
+ * return self._size
+ */
+ __Pyx_INCREF(__pyx_v_result);
+ __Pyx_GIVEREF(__pyx_v_result);
+ __Pyx_GOTREF(__pyx_v_self->_size);
+ __Pyx_DECREF(__pyx_v_self->_size);
+ __pyx_v_self->_size = __pyx_v_result;
+
+ /* "View.MemoryView":600
+ * @property
+ * def size(self):
+ * if self._size is None: # <<<<<<<<<<<<<<
+ * result = 1
+ *
+ */
+ }
+
+ /* "View.MemoryView":608
+ * self._size = result
+ *
+ * return self._size # <<<<<<<<<<<<<<
+ *
+ * def __len__(self):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_self->_size);
+ __pyx_r = __pyx_v_self->_size;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":598
+ * return self.size * self.view.itemsize
+ *
+ * @property # <<<<<<<<<<<<<<
+ * def size(self):
+ * if self._size is None:
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_result);
+ __Pyx_XDECREF(__pyx_v_length);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":610
+ * return self._size
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * if self.view.ndim >= 1:
+ * return self.view.shape[0]
+ */
+
+/* Python wrapper */
+static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
+static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ Py_ssize_t __pyx_r;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
+ Py_ssize_t __pyx_r;
+ int __pyx_t_1;
+
+ /* "View.MemoryView":611
+ *
+ * def __len__(self):
+ * if self.view.ndim >= 1: # <<<<<<<<<<<<<<
+ * return self.view.shape[0]
+ *
+ */
+ __pyx_t_1 = (__pyx_v_self->view.ndim >= 1);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":612
+ * def __len__(self):
+ * if self.view.ndim >= 1:
+ * return self.view.shape[0] # <<<<<<<<<<<<<<
+ *
+ * return 0
+ */
+ __pyx_r = (__pyx_v_self->view.shape[0]);
+ goto __pyx_L0;
+
+ /* "View.MemoryView":611
+ *
+ * def __len__(self):
+ * if self.view.ndim >= 1: # <<<<<<<<<<<<<<
+ * return self.view.shape[0]
+ *
+ */
+ }
+
+ /* "View.MemoryView":614
+ * return self.view.shape[0]
+ *
+ * return 0 # <<<<<<<<<<<<<<
+ *
+ * def __repr__(self):
+ */
+ __pyx_r = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":610
+ * return self._size
+ *
+ * def __len__(self): # <<<<<<<<<<<<<<
+ * if self.view.ndim >= 1:
+ * return self.view.shape[0]
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ return __pyx_r;
+}
+
+/* "View.MemoryView":616
+ * return 0
+ *
+ * def __repr__(self): # <<<<<<<<<<<<<<
+ * return "" % (self.base.__class__.__name__,
+ * id(self))
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__repr__", 1);
+
+ /* "View.MemoryView":617
+ *
+ * def __repr__(self):
+ * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<<
+ * id(self))
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 617, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 617, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 617, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "View.MemoryView":618
+ * def __repr__(self):
+ * return "" % (self.base.__class__.__name__,
+ * id(self)) # <<<<<<<<<<<<<<
+ *
+ * def __str__(self):
+ */
+ __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 618, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+
+ /* "View.MemoryView":617
+ *
+ * def __repr__(self):
+ * return "" % (self.base.__class__.__name__, # <<<<<<<<<<<<<<
+ * id(self))
+ *
+ */
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 617, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_1);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 617, __pyx_L1_error);
+ __Pyx_GIVEREF(__pyx_t_2);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2)) __PYX_ERR(0, 617, __pyx_L1_error);
+ __pyx_t_1 = 0;
+ __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 617, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":616
+ * return 0
+ *
+ * def __repr__(self): # <<<<<<<<<<<<<<
+ * return "" % (self.base.__class__.__name__,
+ * id(self))
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":620
+ * id(self))
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * return "" % (self.base.__class__.__name__,)
+ *
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__str__", 1);
+
+ /* "View.MemoryView":621
+ *
+ * def __str__(self):
+ * return "" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 621, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 621, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 621, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 621, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_1);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1)) __PYX_ERR(0, 621, __pyx_L1_error);
+ __pyx_t_1 = 0;
+ __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 621, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":620
+ * id(self))
+ *
+ * def __str__(self): # <<<<<<<<<<<<<<
+ * return "" % (self.base.__class__.__name__,)
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":624
+ *
+ *
+ * def is_c_contig(self): # <<<<<<<<<<<<<<
+ * cdef __Pyx_memviewslice *mslice
+ * cdef __Pyx_memviewslice tmp
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+); /*proto*/
+static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+) {
+ #if !CYTHON_METH_FASTCALL
+ CYTHON_UNUSED Py_ssize_t __pyx_nargs;
+ #endif
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
+ #if !CYTHON_METH_FASTCALL
+ #if CYTHON_ASSUME_SAFE_MACROS
+ __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
+ #else
+ __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
+ #endif
+ #endif
+ __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
+ if (unlikely(__pyx_nargs > 0)) {
+ __Pyx_RaiseArgtupleInvalid("is_c_contig", 1, 0, 0, __pyx_nargs); return NULL;}
+ if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "is_c_contig", 0))) return NULL;
+ __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
+ __Pyx_memviewslice *__pyx_v_mslice;
+ __Pyx_memviewslice __pyx_v_tmp;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_memviewslice *__pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("is_c_contig", 1);
+
+ /* "View.MemoryView":627
+ * cdef __Pyx_memviewslice *mslice
+ * cdef __Pyx_memviewslice tmp
+ * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
+ * return slice_is_contig(mslice[0], 'C', self.view.ndim)
+ *
+ */
+ __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(0, 627, __pyx_L1_error)
+ __pyx_v_mslice = __pyx_t_1;
+
+ /* "View.MemoryView":628
+ * cdef __Pyx_memviewslice tmp
+ * mslice = get_slice_from_memview(self, &tmp)
+ * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<<
+ *
+ * def is_f_contig(self):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 628, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":624
+ *
+ *
+ * def is_c_contig(self): # <<<<<<<<<<<<<<
+ * cdef __Pyx_memviewslice *mslice
+ * cdef __Pyx_memviewslice tmp
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":630
+ * return slice_is_contig(mslice[0], 'C', self.view.ndim)
+ *
+ * def is_f_contig(self): # <<<<<<<<<<<<<<
+ * cdef __Pyx_memviewslice *mslice
+ * cdef __Pyx_memviewslice tmp
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+); /*proto*/
+static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+) {
+ #if !CYTHON_METH_FASTCALL
+ CYTHON_UNUSED Py_ssize_t __pyx_nargs;
+ #endif
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
+ #if !CYTHON_METH_FASTCALL
+ #if CYTHON_ASSUME_SAFE_MACROS
+ __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
+ #else
+ __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
+ #endif
+ #endif
+ __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
+ if (unlikely(__pyx_nargs > 0)) {
+ __Pyx_RaiseArgtupleInvalid("is_f_contig", 1, 0, 0, __pyx_nargs); return NULL;}
+ if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "is_f_contig", 0))) return NULL;
+ __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
+ __Pyx_memviewslice *__pyx_v_mslice;
+ __Pyx_memviewslice __pyx_v_tmp;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_memviewslice *__pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("is_f_contig", 1);
+
+ /* "View.MemoryView":633
+ * cdef __Pyx_memviewslice *mslice
+ * cdef __Pyx_memviewslice tmp
+ * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
+ * return slice_is_contig(mslice[0], 'F', self.view.ndim)
+ *
+ */
+ __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(0, 633, __pyx_L1_error)
+ __pyx_v_mslice = __pyx_t_1;
+
+ /* "View.MemoryView":634
+ * cdef __Pyx_memviewslice tmp
+ * mslice = get_slice_from_memview(self, &tmp)
+ * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<<
+ *
+ * def copy(self):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 634, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":630
+ * return slice_is_contig(mslice[0], 'C', self.view.ndim)
+ *
+ * def is_f_contig(self): # <<<<<<<<<<<<<<
+ * cdef __Pyx_memviewslice *mslice
+ * cdef __Pyx_memviewslice tmp
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":636
+ * return slice_is_contig(mslice[0], 'F', self.view.ndim)
+ *
+ * def copy(self): # <<<<<<<<<<<<<<
+ * cdef __Pyx_memviewslice mslice
+ * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+); /*proto*/
+static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+) {
+ #if !CYTHON_METH_FASTCALL
+ CYTHON_UNUSED Py_ssize_t __pyx_nargs;
+ #endif
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("copy (wrapper)", 0);
+ #if !CYTHON_METH_FASTCALL
+ #if CYTHON_ASSUME_SAFE_MACROS
+ __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
+ #else
+ __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
+ #endif
+ #endif
+ __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
+ if (unlikely(__pyx_nargs > 0)) {
+ __Pyx_RaiseArgtupleInvalid("copy", 1, 0, 0, __pyx_nargs); return NULL;}
+ if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy", 0))) return NULL;
+ __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
+ __Pyx_memviewslice __pyx_v_mslice;
+ int __pyx_v_flags;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_memviewslice __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("copy", 1);
+
+ /* "View.MemoryView":638
+ * def copy(self):
+ * cdef __Pyx_memviewslice mslice
+ * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<<
+ *
+ * slice_copy(self, &mslice)
+ */
+ __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
+
+ /* "View.MemoryView":640
+ * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
+ *
+ * slice_copy(self, &mslice) # <<<<<<<<<<<<<<
+ * mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
+ * self.view.itemsize,
+ */
+ __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
+
+ /* "View.MemoryView":641
+ *
+ * slice_copy(self, &mslice)
+ * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<<
+ * self.view.itemsize,
+ * flags|PyBUF_C_CONTIGUOUS,
+ */
+ __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 641, __pyx_L1_error)
+ __pyx_v_mslice = __pyx_t_1;
+
+ /* "View.MemoryView":646
+ * self.dtype_is_object)
+ *
+ * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<<
+ *
+ * def copy_fortran(self):
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 646, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":636
+ * return slice_is_contig(mslice[0], 'F', self.view.ndim)
+ *
+ * def copy(self): # <<<<<<<<<<<<<<
+ * cdef __Pyx_memviewslice mslice
+ * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":648
+ * return memoryview_copy_from_slice(self, &mslice)
+ *
+ * def copy_fortran(self): # <<<<<<<<<<<<<<
+ * cdef __Pyx_memviewslice src, dst
+ * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+); /*proto*/
+static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+) {
+ #if !CYTHON_METH_FASTCALL
+ CYTHON_UNUSED Py_ssize_t __pyx_nargs;
+ #endif
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
+ #if !CYTHON_METH_FASTCALL
+ #if CYTHON_ASSUME_SAFE_MACROS
+ __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
+ #else
+ __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
+ #endif
+ #endif
+ __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
+ if (unlikely(__pyx_nargs > 0)) {
+ __Pyx_RaiseArgtupleInvalid("copy_fortran", 1, 0, 0, __pyx_nargs); return NULL;}
+ if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "copy_fortran", 0))) return NULL;
+ __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
+ __Pyx_memviewslice __pyx_v_src;
+ __Pyx_memviewslice __pyx_v_dst;
+ int __pyx_v_flags;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_memviewslice __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("copy_fortran", 1);
+
+ /* "View.MemoryView":650
+ * def copy_fortran(self):
+ * cdef __Pyx_memviewslice src, dst
+ * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<<
+ *
+ * slice_copy(self, &src)
+ */
+ __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
+
+ /* "View.MemoryView":652
+ * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
+ *
+ * slice_copy(self, &src) # <<<<<<<<<<<<<<
+ * dst = slice_copy_contig(&src, "fortran", self.view.ndim,
+ * self.view.itemsize,
+ */
+ __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
+
+ /* "View.MemoryView":653
+ *
+ * slice_copy(self, &src)
+ * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<<
+ * self.view.itemsize,
+ * flags|PyBUF_F_CONTIGUOUS,
+ */
+ __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 653, __pyx_L1_error)
+ __pyx_v_dst = __pyx_t_1;
+
+ /* "View.MemoryView":658
+ * self.dtype_is_object)
+ *
+ * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 658, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":648
+ * return memoryview_copy_from_slice(self, &mslice)
+ *
+ * def copy_fortran(self): # <<<<<<<<<<<<<<
+ * cdef __Pyx_memviewslice src, dst
+ * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":1
+ * def __reduce_cython__(self): # <<<<<<<<<<<<<<
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ * def __setstate_cython__(self, __pyx_state):
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+); /*proto*/
+static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+) {
+ #if !CYTHON_METH_FASTCALL
+ CYTHON_UNUSED Py_ssize_t __pyx_nargs;
+ #endif
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
+ #if !CYTHON_METH_FASTCALL
+ #if CYTHON_ASSUME_SAFE_MACROS
+ __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
+ #else
+ __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
+ #endif
+ #endif
+ __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
+ if (unlikely(__pyx_nargs > 0)) {
+ __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;}
+ if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL;
+ __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__reduce_cython__", 1);
+
+ /* "(tree fragment)":2
+ * def __reduce_cython__(self):
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<<
+ * def __setstate_cython__(self, __pyx_state):
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ */
+ __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0);
+ __PYX_ERR(0, 2, __pyx_L1_error)
+
+ /* "(tree fragment)":1
+ * def __reduce_cython__(self): # <<<<<<<<<<<<<<
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ * def __setstate_cython__(self, __pyx_state):
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":3
+ * def __reduce_cython__(self):
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+); /*proto*/
+static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+) {
+ CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
+ #if !CYTHON_METH_FASTCALL
+ CYTHON_UNUSED Py_ssize_t __pyx_nargs;
+ #endif
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject* values[1] = {0};
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
+ #if !CYTHON_METH_FASTCALL
+ #if CYTHON_ASSUME_SAFE_MACROS
+ __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
+ #else
+ __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
+ #endif
+ #endif
+ __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
+ {
+ PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
+ if (__pyx_kwds) {
+ Py_ssize_t kw_args;
+ switch (__pyx_nargs) {
+ case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
+ switch (__pyx_nargs) {
+ case 0:
+ if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
+ (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
+ kw_args--;
+ }
+ else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3, __pyx_L3_error)
+ else goto __pyx_L5_argtuple_error;
+ }
+ if (unlikely(kw_args > 0)) {
+ const Py_ssize_t kwd_pos_args = __pyx_nargs;
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(0, 3, __pyx_L3_error)
+ }
+ } else if (unlikely(__pyx_nargs != 1)) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
+ }
+ __pyx_v___pyx_state = values[0];
+ }
+ goto __pyx_L6_skip;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3, __pyx_L3_error)
+ __pyx_L6_skip:;
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L3_error:;
+ {
+ Py_ssize_t __pyx_temp;
+ for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
+ __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
+ }
+ }
+ __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v___pyx_state);
+
+ /* function exit code */
+ {
+ Py_ssize_t __pyx_temp;
+ for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
+ __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
+ }
+ }
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__setstate_cython__", 1);
+
+ /* "(tree fragment)":4
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ * def __setstate_cython__(self, __pyx_state):
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<<
+ */
+ __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0);
+ __PYX_ERR(0, 4, __pyx_L1_error)
+
+ /* "(tree fragment)":3
+ * def __reduce_cython__(self):
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":662
+ *
+ * @cname('__pyx_memoryview_new')
+ * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<<
+ * cdef memoryview result = memoryview(o, flags, dtype_is_object)
+ * result.typeinfo = typeinfo
+ */
+
+static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
+ struct __pyx_memoryview_obj *__pyx_v_result = 0;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("memoryview_cwrapper", 1);
+
+ /* "View.MemoryView":663
+ * @cname('__pyx_memoryview_new')
+ * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
+ * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<<
+ * result.typeinfo = typeinfo
+ * return result
+ */
+ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 663, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 663, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 663, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_v_o);
+ __Pyx_GIVEREF(__pyx_v_o);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o)) __PYX_ERR(0, 663, __pyx_L1_error);
+ __Pyx_GIVEREF(__pyx_t_1);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1)) __PYX_ERR(0, 663, __pyx_L1_error);
+ __Pyx_GIVEREF(__pyx_t_2);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(0, 663, __pyx_L1_error);
+ __pyx_t_1 = 0;
+ __pyx_t_2 = 0;
+ __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 663, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
+ __pyx_t_2 = 0;
+
+ /* "View.MemoryView":664
+ * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
+ * cdef memoryview result = memoryview(o, flags, dtype_is_object)
+ * result.typeinfo = typeinfo # <<<<<<<<<<<<<<
+ * return result
+ *
+ */
+ __pyx_v_result->typeinfo = __pyx_v_typeinfo;
+
+ /* "View.MemoryView":665
+ * cdef memoryview result = memoryview(o, flags, dtype_is_object)
+ * result.typeinfo = typeinfo
+ * return result # <<<<<<<<<<<<<<
+ *
+ * @cname('__pyx_memoryview_check')
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF((PyObject *)__pyx_v_result);
+ __pyx_r = ((PyObject *)__pyx_v_result);
+ goto __pyx_L0;
+
+ /* "View.MemoryView":662
+ *
+ * @cname('__pyx_memoryview_new')
+ * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<<
+ * cdef memoryview result = memoryview(o, flags, dtype_is_object)
+ * result.typeinfo = typeinfo
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF((PyObject *)__pyx_v_result);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":668
+ *
+ * @cname('__pyx_memoryview_check')
+ * cdef inline bint memoryview_check(object o) noexcept: # <<<<<<<<<<<<<<
+ * return isinstance(o, memoryview)
+ *
+ */
+
+static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
+ int __pyx_r;
+ int __pyx_t_1;
+
+ /* "View.MemoryView":669
+ * @cname('__pyx_memoryview_check')
+ * cdef inline bint memoryview_check(object o) noexcept:
+ * return isinstance(o, memoryview) # <<<<<<<<<<<<<<
+ *
+ * cdef tuple _unellipsify(object index, int ndim):
+ */
+ __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
+ __pyx_r = __pyx_t_1;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":668
+ *
+ * @cname('__pyx_memoryview_check')
+ * cdef inline bint memoryview_check(object o) noexcept: # <<<<<<<<<<<<<<
+ * return isinstance(o, memoryview)
+ *
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ return __pyx_r;
+}
+
+/* "View.MemoryView":671
+ * return isinstance(o, memoryview)
+ *
+ * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<<
+ * """
+ * Replace all ellipses with full slices and fill incomplete indices with
+ */
+
+static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
+ Py_ssize_t __pyx_v_idx;
+ PyObject *__pyx_v_tup = NULL;
+ PyObject *__pyx_v_result = NULL;
+ int __pyx_v_have_slices;
+ int __pyx_v_seen_ellipsis;
+ PyObject *__pyx_v_item = NULL;
+ Py_ssize_t __pyx_v_nslices;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ Py_ssize_t __pyx_t_4;
+ Py_ssize_t __pyx_t_5;
+ Py_UCS4 __pyx_t_6;
+ PyObject *__pyx_t_7 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("_unellipsify", 1);
+
+ /* "View.MemoryView":677
+ * """
+ * cdef Py_ssize_t idx
+ * tup = index if isinstance(index, tuple) else (index,) # <<<<<<<<<<<<<<
+ *
+ * result = [slice(None)] * ndim
+ */
+ __pyx_t_2 = PyTuple_Check(__pyx_v_index);
+ if (__pyx_t_2) {
+ __Pyx_INCREF(((PyObject*)__pyx_v_index));
+ __pyx_t_1 = __pyx_v_index;
+ } else {
+ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 677, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(__pyx_v_index);
+ __Pyx_GIVEREF(__pyx_v_index);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index)) __PYX_ERR(0, 677, __pyx_L1_error);
+ __pyx_t_1 = __pyx_t_3;
+ __pyx_t_3 = 0;
+ }
+ __pyx_v_tup = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "View.MemoryView":679
+ * tup = index if isinstance(index, tuple) else (index,)
+ *
+ * result = [slice(None)] * ndim # <<<<<<<<<<<<<<
+ * have_slices = False
+ * seen_ellipsis = False
+ */
+ __pyx_t_1 = PyList_New(1 * ((__pyx_v_ndim<0) ? 0:__pyx_v_ndim)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 679, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ { Py_ssize_t __pyx_temp;
+ for (__pyx_temp=0; __pyx_temp < __pyx_v_ndim; __pyx_temp++) {
+ __Pyx_INCREF(__pyx_slice__5);
+ __Pyx_GIVEREF(__pyx_slice__5);
+ if (__Pyx_PyList_SET_ITEM(__pyx_t_1, __pyx_temp, __pyx_slice__5)) __PYX_ERR(0, 679, __pyx_L1_error);
+ }
+ }
+ __pyx_v_result = ((PyObject*)__pyx_t_1);
+ __pyx_t_1 = 0;
+
+ /* "View.MemoryView":680
+ *
+ * result = [slice(None)] * ndim
+ * have_slices = False # <<<<<<<<<<<<<<
+ * seen_ellipsis = False
+ * idx = 0
+ */
+ __pyx_v_have_slices = 0;
+
+ /* "View.MemoryView":681
+ * result = [slice(None)] * ndim
+ * have_slices = False
+ * seen_ellipsis = False # <<<<<<<<<<<<<<
+ * idx = 0
+ * for item in tup:
+ */
+ __pyx_v_seen_ellipsis = 0;
+
+ /* "View.MemoryView":682
+ * have_slices = False
+ * seen_ellipsis = False
+ * idx = 0 # <<<<<<<<<<<<<<
+ * for item in tup:
+ * if item is Ellipsis:
+ */
+ __pyx_v_idx = 0;
+
+ /* "View.MemoryView":683
+ * seen_ellipsis = False
+ * idx = 0
+ * for item in tup: # <<<<<<<<<<<<<<
+ * if item is Ellipsis:
+ * if not seen_ellipsis:
+ */
+ if (unlikely(__pyx_v_tup == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
+ __PYX_ERR(0, 683, __pyx_L1_error)
+ }
+ __pyx_t_1 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_1);
+ __pyx_t_4 = 0;
+ for (;;) {
+ {
+ Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
+ #if !CYTHON_ASSUME_SAFE_MACROS
+ if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 683, __pyx_L1_error)
+ #endif
+ if (__pyx_t_4 >= __pyx_temp) break;
+ }
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely((0 < 0))) __PYX_ERR(0, 683, __pyx_L1_error)
+ #else
+ __pyx_t_3 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 683, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ #endif
+ __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_3);
+ __pyx_t_3 = 0;
+
+ /* "View.MemoryView":684
+ * idx = 0
+ * for item in tup:
+ * if item is Ellipsis: # <<<<<<<<<<<<<<
+ * if not seen_ellipsis:
+ * idx += ndim - len(tup)
+ */
+ __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":685
+ * for item in tup:
+ * if item is Ellipsis:
+ * if not seen_ellipsis: # <<<<<<<<<<<<<<
+ * idx += ndim - len(tup)
+ * seen_ellipsis = True
+ */
+ __pyx_t_2 = (!__pyx_v_seen_ellipsis);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":686
+ * if item is Ellipsis:
+ * if not seen_ellipsis:
+ * idx += ndim - len(tup) # <<<<<<<<<<<<<<
+ * seen_ellipsis = True
+ * have_slices = True
+ */
+ if (unlikely(__pyx_v_tup == Py_None)) {
+ PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
+ __PYX_ERR(0, 686, __pyx_L1_error)
+ }
+ __pyx_t_5 = __Pyx_PyTuple_GET_SIZE(__pyx_v_tup); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 686, __pyx_L1_error)
+ __pyx_v_idx = (__pyx_v_idx + (__pyx_v_ndim - __pyx_t_5));
+
+ /* "View.MemoryView":687
+ * if not seen_ellipsis:
+ * idx += ndim - len(tup)
+ * seen_ellipsis = True # <<<<<<<<<<<<<<
+ * have_slices = True
+ * else:
+ */
+ __pyx_v_seen_ellipsis = 1;
+
+ /* "View.MemoryView":685
+ * for item in tup:
+ * if item is Ellipsis:
+ * if not seen_ellipsis: # <<<<<<<<<<<<<<
+ * idx += ndim - len(tup)
+ * seen_ellipsis = True
+ */
+ }
+
+ /* "View.MemoryView":688
+ * idx += ndim - len(tup)
+ * seen_ellipsis = True
+ * have_slices = True # <<<<<<<<<<<<<<
+ * else:
+ * if isinstance(item, slice):
+ */
+ __pyx_v_have_slices = 1;
+
+ /* "View.MemoryView":684
+ * idx = 0
+ * for item in tup:
+ * if item is Ellipsis: # <<<<<<<<<<<<<<
+ * if not seen_ellipsis:
+ * idx += ndim - len(tup)
+ */
+ goto __pyx_L5;
+ }
+
+ /* "View.MemoryView":690
+ * have_slices = True
+ * else:
+ * if isinstance(item, slice): # <<<<<<<<<<<<<<
+ * have_slices = True
+ * elif not PyIndex_Check(item):
+ */
+ /*else*/ {
+ __pyx_t_2 = PySlice_Check(__pyx_v_item);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":691
+ * else:
+ * if isinstance(item, slice):
+ * have_slices = True # <<<<<<<<<<<<<<
+ * elif not PyIndex_Check(item):
+ * raise TypeError, f"Cannot index with type '{type(item)}'"
+ */
+ __pyx_v_have_slices = 1;
+
+ /* "View.MemoryView":690
+ * have_slices = True
+ * else:
+ * if isinstance(item, slice): # <<<<<<<<<<<<<<
+ * have_slices = True
+ * elif not PyIndex_Check(item):
+ */
+ goto __pyx_L7;
+ }
+
+ /* "View.MemoryView":692
+ * if isinstance(item, slice):
+ * have_slices = True
+ * elif not PyIndex_Check(item): # <<<<<<<<<<<<<<
+ * raise TypeError, f"Cannot index with type '{type(item)}'"
+ * result[idx] = item
+ */
+ __pyx_t_2 = (!(PyIndex_Check(__pyx_v_item) != 0));
+ if (unlikely(__pyx_t_2)) {
+
+ /* "View.MemoryView":693
+ * have_slices = True
+ * elif not PyIndex_Check(item):
+ * raise TypeError, f"Cannot index with type '{type(item)}'" # <<<<<<<<<<<<<<
+ * result[idx] = item
+ * idx += 1
+ */
+ __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 693, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_5 = 0;
+ __pyx_t_6 = 127;
+ __Pyx_INCREF(__pyx_kp_u_Cannot_index_with_type);
+ __pyx_t_5 += 24;
+ __Pyx_GIVEREF(__pyx_kp_u_Cannot_index_with_type);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Cannot_index_with_type);
+ __pyx_t_7 = __Pyx_PyObject_FormatSimple(((PyObject *)Py_TYPE(__pyx_v_item)), __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 693, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_6 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) > __pyx_t_6) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_7) : __pyx_t_6;
+ __pyx_t_5 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_7);
+ __Pyx_GIVEREF(__pyx_t_7);
+ PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7);
+ __pyx_t_7 = 0;
+ __Pyx_INCREF(__pyx_kp_u__6);
+ __pyx_t_5 += 1;
+ __Pyx_GIVEREF(__pyx_kp_u__6);
+ PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__6);
+ __pyx_t_7 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 693, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_Raise(__pyx_builtin_TypeError, __pyx_t_7, 0, 0);
+ __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+ __PYX_ERR(0, 693, __pyx_L1_error)
+
+ /* "View.MemoryView":692
+ * if isinstance(item, slice):
+ * have_slices = True
+ * elif not PyIndex_Check(item): # <<<<<<<<<<<<<<
+ * raise TypeError, f"Cannot index with type '{type(item)}'"
+ * result[idx] = item
+ */
+ }
+ __pyx_L7:;
+
+ /* "View.MemoryView":694
+ * elif not PyIndex_Check(item):
+ * raise TypeError, f"Cannot index with type '{type(item)}'"
+ * result[idx] = item # <<<<<<<<<<<<<<
+ * idx += 1
+ *
+ */
+ if (unlikely((__Pyx_SetItemInt(__pyx_v_result, __pyx_v_idx, __pyx_v_item, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1) < 0))) __PYX_ERR(0, 694, __pyx_L1_error)
+ }
+ __pyx_L5:;
+
+ /* "View.MemoryView":695
+ * raise TypeError, f"Cannot index with type '{type(item)}'"
+ * result[idx] = item
+ * idx += 1 # <<<<<<<<<<<<<<
+ *
+ * nslices = ndim - idx
+ */
+ __pyx_v_idx = (__pyx_v_idx + 1);
+
+ /* "View.MemoryView":683
+ * seen_ellipsis = False
+ * idx = 0
+ * for item in tup: # <<<<<<<<<<<<<<
+ * if item is Ellipsis:
+ * if not seen_ellipsis:
+ */
+ }
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+
+ /* "View.MemoryView":697
+ * idx += 1
+ *
+ * nslices = ndim - idx # <<<<<<<<<<<<<<
+ * return have_slices or nslices, tuple(result)
+ *
+ */
+ __pyx_v_nslices = (__pyx_v_ndim - __pyx_v_idx);
+
+ /* "View.MemoryView":698
+ *
+ * nslices = ndim - idx
+ * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<<
+ *
+ * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1:
+ */
+ __Pyx_XDECREF(__pyx_r);
+ if (!__pyx_v_have_slices) {
+ } else {
+ __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 698, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_1 = __pyx_t_7;
+ __pyx_t_7 = 0;
+ goto __pyx_L9_bool_binop_done;
+ }
+ __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 698, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_1 = __pyx_t_7;
+ __pyx_t_7 = 0;
+ __pyx_L9_bool_binop_done:;
+ __pyx_t_7 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 698, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_7);
+ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 698, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_1);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 698, __pyx_L1_error);
+ __Pyx_GIVEREF(__pyx_t_7);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7)) __PYX_ERR(0, 698, __pyx_L1_error);
+ __pyx_t_1 = 0;
+ __pyx_t_7 = 0;
+ __pyx_r = ((PyObject*)__pyx_t_3);
+ __pyx_t_3 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":671
+ * return isinstance(o, memoryview)
+ *
+ * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<<
+ * """
+ * Replace all ellipses with full slices and fill incomplete indices with
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_7);
+ __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF(__pyx_v_tup);
+ __Pyx_XDECREF(__pyx_v_result);
+ __Pyx_XDECREF(__pyx_v_item);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":700
+ * return have_slices or nslices, tuple(result)
+ *
+ * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<<
+ * for suboffset in suboffsets[:ndim]:
+ * if suboffset >= 0:
+ */
+
+static int assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
+ Py_ssize_t __pyx_v_suboffset;
+ int __pyx_r;
+ Py_ssize_t *__pyx_t_1;
+ Py_ssize_t *__pyx_t_2;
+ Py_ssize_t *__pyx_t_3;
+ int __pyx_t_4;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+
+ /* "View.MemoryView":701
+ *
+ * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1:
+ * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<<
+ * if suboffset >= 0:
+ * raise ValueError, "Indirect dimensions not supported"
+ */
+ __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
+ for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
+ __pyx_t_1 = __pyx_t_3;
+ __pyx_v_suboffset = (__pyx_t_1[0]);
+
+ /* "View.MemoryView":702
+ * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1:
+ * for suboffset in suboffsets[:ndim]:
+ * if suboffset >= 0: # <<<<<<<<<<<<<<
+ * raise ValueError, "Indirect dimensions not supported"
+ * return 0 # return type just used as an error flag
+ */
+ __pyx_t_4 = (__pyx_v_suboffset >= 0);
+ if (unlikely(__pyx_t_4)) {
+
+ /* "View.MemoryView":703
+ * for suboffset in suboffsets[:ndim]:
+ * if suboffset >= 0:
+ * raise ValueError, "Indirect dimensions not supported" # <<<<<<<<<<<<<<
+ * return 0 # return type just used as an error flag
+ *
+ */
+ __Pyx_Raise(__pyx_builtin_ValueError, __pyx_kp_s_Indirect_dimensions_not_supporte, 0, 0);
+ __PYX_ERR(0, 703, __pyx_L1_error)
+
+ /* "View.MemoryView":702
+ * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1:
+ * for suboffset in suboffsets[:ndim]:
+ * if suboffset >= 0: # <<<<<<<<<<<<<<
+ * raise ValueError, "Indirect dimensions not supported"
+ * return 0 # return type just used as an error flag
+ */
+ }
+ }
+
+ /* "View.MemoryView":704
+ * if suboffset >= 0:
+ * raise ValueError, "Indirect dimensions not supported"
+ * return 0 # return type just used as an error flag # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_r = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":700
+ * return have_slices or nslices, tuple(result)
+ *
+ * cdef int assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim) except -1: # <<<<<<<<<<<<<<
+ * for suboffset in suboffsets[:ndim]:
+ * if suboffset >= 0:
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __pyx_L0:;
+ return __pyx_r;
+}
+
+/* "View.MemoryView":711
+ *
+ * @cname('__pyx_memview_slice')
+ * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<<
+ * cdef int new_ndim = 0, suboffset_dim = -1, dim
+ * cdef bint negative_step
+ */
+
+static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
+ int __pyx_v_new_ndim;
+ int __pyx_v_suboffset_dim;
+ int __pyx_v_dim;
+ __Pyx_memviewslice __pyx_v_src;
+ __Pyx_memviewslice __pyx_v_dst;
+ __Pyx_memviewslice *__pyx_v_p_src;
+ struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
+ __Pyx_memviewslice *__pyx_v_p_dst;
+ int *__pyx_v_p_suboffset_dim;
+ Py_ssize_t __pyx_v_start;
+ Py_ssize_t __pyx_v_stop;
+ Py_ssize_t __pyx_v_step;
+ Py_ssize_t __pyx_v_cindex;
+ int __pyx_v_have_start;
+ int __pyx_v_have_stop;
+ int __pyx_v_have_step;
+ PyObject *__pyx_v_index = NULL;
+ struct __pyx_memoryview_obj *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ struct __pyx_memoryview_obj *__pyx_t_3;
+ char *__pyx_t_4;
+ int __pyx_t_5;
+ Py_ssize_t __pyx_t_6;
+ PyObject *(*__pyx_t_7)(PyObject *);
+ PyObject *__pyx_t_8 = NULL;
+ Py_ssize_t __pyx_t_9;
+ int __pyx_t_10;
+ Py_ssize_t __pyx_t_11;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("memview_slice", 1);
+
+ /* "View.MemoryView":712
+ * @cname('__pyx_memview_slice')
+ * cdef memoryview memview_slice(memoryview memview, object indices):
+ * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<<
+ * cdef bint negative_step
+ * cdef __Pyx_memviewslice src, dst
+ */
+ __pyx_v_new_ndim = 0;
+ __pyx_v_suboffset_dim = -1;
+
+ /* "View.MemoryView":719
+ *
+ *
+ * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<<
+ *
+ * cdef _memoryviewslice memviewsliceobj
+ */
+ (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));
+
+ /* "View.MemoryView":723
+ * cdef _memoryviewslice memviewsliceobj
+ *
+ * assert memview.view.ndim > 0 # <<<<<<<<<<<<<<
+ *
+ * if isinstance(memview, _memoryviewslice):
+ */
+ #ifndef CYTHON_WITHOUT_ASSERTIONS
+ if (unlikely(__pyx_assertions_enabled())) {
+ __pyx_t_1 = (__pyx_v_memview->view.ndim > 0);
+ if (unlikely(!__pyx_t_1)) {
+ __Pyx_Raise(__pyx_builtin_AssertionError, 0, 0, 0);
+ __PYX_ERR(0, 723, __pyx_L1_error)
+ }
+ }
+ #else
+ if ((1)); else __PYX_ERR(0, 723, __pyx_L1_error)
+ #endif
+
+ /* "View.MemoryView":725
+ * assert memview.view.ndim > 0
+ *
+ * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
+ * memviewsliceobj = memview
+ * p_src = &memviewsliceobj.from_slice
+ */
+ __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":726
+ *
+ * if isinstance(memview, _memoryviewslice):
+ * memviewsliceobj = memview # <<<<<<<<<<<<<<
+ * p_src = &memviewsliceobj.from_slice
+ * else:
+ */
+ if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(0, 726, __pyx_L1_error)
+ __pyx_t_2 = ((PyObject *)__pyx_v_memview);
+ __Pyx_INCREF(__pyx_t_2);
+ __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
+ __pyx_t_2 = 0;
+
+ /* "View.MemoryView":727
+ * if isinstance(memview, _memoryviewslice):
+ * memviewsliceobj = memview
+ * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<<
+ * else:
+ * slice_copy(memview, &src)
+ */
+ __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
+
+ /* "View.MemoryView":725
+ * assert memview.view.ndim > 0
+ *
+ * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
+ * memviewsliceobj = memview
+ * p_src = &memviewsliceobj.from_slice
+ */
+ goto __pyx_L3;
+ }
+
+ /* "View.MemoryView":729
+ * p_src = &memviewsliceobj.from_slice
+ * else:
+ * slice_copy(memview, &src) # <<<<<<<<<<<<<<
+ * p_src = &src
+ *
+ */
+ /*else*/ {
+ __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
+
+ /* "View.MemoryView":730
+ * else:
+ * slice_copy(memview, &src)
+ * p_src = &src # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_v_p_src = (&__pyx_v_src);
+ }
+ __pyx_L3:;
+
+ /* "View.MemoryView":736
+ *
+ *
+ * dst.memview = p_src.memview # <<<<<<<<<<<<<<
+ * dst.data = p_src.data
+ *
+ */
+ __pyx_t_3 = __pyx_v_p_src->memview;
+ __pyx_v_dst.memview = __pyx_t_3;
+
+ /* "View.MemoryView":737
+ *
+ * dst.memview = p_src.memview
+ * dst.data = p_src.data # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_4 = __pyx_v_p_src->data;
+ __pyx_v_dst.data = __pyx_t_4;
+
+ /* "View.MemoryView":742
+ *
+ *
+ * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<<
+ * cdef int *p_suboffset_dim = &suboffset_dim
+ * cdef Py_ssize_t start, stop, step, cindex
+ */
+ __pyx_v_p_dst = (&__pyx_v_dst);
+
+ /* "View.MemoryView":743
+ *
+ * cdef __Pyx_memviewslice *p_dst = &dst
+ * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<<
+ * cdef Py_ssize_t start, stop, step, cindex
+ * cdef bint have_start, have_stop, have_step
+ */
+ __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
+
+ /* "View.MemoryView":747
+ * cdef bint have_start, have_stop, have_step
+ *
+ * for dim, index in enumerate(indices): # <<<<<<<<<<<<<<
+ * if PyIndex_Check(index):
+ * cindex = index
+ */
+ __pyx_t_5 = 0;
+ if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
+ __pyx_t_2 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_2);
+ __pyx_t_6 = 0;
+ __pyx_t_7 = NULL;
+ } else {
+ __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 747, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_7 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 747, __pyx_L1_error)
+ }
+ for (;;) {
+ if (likely(!__pyx_t_7)) {
+ if (likely(PyList_CheckExact(__pyx_t_2))) {
+ {
+ Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
+ #if !CYTHON_ASSUME_SAFE_MACROS
+ if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 747, __pyx_L1_error)
+ #endif
+ if (__pyx_t_6 >= __pyx_temp) break;
+ }
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ __pyx_t_8 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 747, __pyx_L1_error)
+ #else
+ __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 747, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ #endif
+ } else {
+ {
+ Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
+ #if !CYTHON_ASSUME_SAFE_MACROS
+ if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 747, __pyx_L1_error)
+ #endif
+ if (__pyx_t_6 >= __pyx_temp) break;
+ }
+ #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
+ __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_8); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 747, __pyx_L1_error)
+ #else
+ __pyx_t_8 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 747, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ #endif
+ }
+ } else {
+ __pyx_t_8 = __pyx_t_7(__pyx_t_2);
+ if (unlikely(!__pyx_t_8)) {
+ PyObject* exc_type = PyErr_Occurred();
+ if (exc_type) {
+ if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
+ else __PYX_ERR(0, 747, __pyx_L1_error)
+ }
+ break;
+ }
+ __Pyx_GOTREF(__pyx_t_8);
+ }
+ __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_8);
+ __pyx_t_8 = 0;
+ __pyx_v_dim = __pyx_t_5;
+ __pyx_t_5 = (__pyx_t_5 + 1);
+
+ /* "View.MemoryView":748
+ *
+ * for dim, index in enumerate(indices):
+ * if PyIndex_Check(index): # <<<<<<<<<<<<<<
+ * cindex = index
+ * slice_memviewslice(
+ */
+ __pyx_t_1 = (PyIndex_Check(__pyx_v_index) != 0);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":749
+ * for dim, index in enumerate(indices):
+ * if PyIndex_Check(index):
+ * cindex = index # <<<<<<<<<<<<<<
+ * slice_memviewslice(
+ * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
+ */
+ __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 749, __pyx_L1_error)
+ __pyx_v_cindex = __pyx_t_9;
+
+ /* "View.MemoryView":750
+ * if PyIndex_Check(index):
+ * cindex = index
+ * slice_memviewslice( # <<<<<<<<<<<<<<
+ * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
+ * dim, new_ndim, p_suboffset_dim,
+ */
+ __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_cindex, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 750, __pyx_L1_error)
+
+ /* "View.MemoryView":748
+ *
+ * for dim, index in enumerate(indices):
+ * if PyIndex_Check(index): # <<<<<<<<<<<<<<
+ * cindex = index
+ * slice_memviewslice(
+ */
+ goto __pyx_L6;
+ }
+
+ /* "View.MemoryView":756
+ * 0, 0, 0, # have_{start,stop,step}
+ * False)
+ * elif index is None: # <<<<<<<<<<<<<<
+ * p_dst.shape[new_ndim] = 1
+ * p_dst.strides[new_ndim] = 0
+ */
+ __pyx_t_1 = (__pyx_v_index == Py_None);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":757
+ * False)
+ * elif index is None:
+ * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<<
+ * p_dst.strides[new_ndim] = 0
+ * p_dst.suboffsets[new_ndim] = -1
+ */
+ (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
+
+ /* "View.MemoryView":758
+ * elif index is None:
+ * p_dst.shape[new_ndim] = 1
+ * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<<
+ * p_dst.suboffsets[new_ndim] = -1
+ * new_ndim += 1
+ */
+ (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
+
+ /* "View.MemoryView":759
+ * p_dst.shape[new_ndim] = 1
+ * p_dst.strides[new_ndim] = 0
+ * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<<
+ * new_ndim += 1
+ * else:
+ */
+ (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
+
+ /* "View.MemoryView":760
+ * p_dst.strides[new_ndim] = 0
+ * p_dst.suboffsets[new_ndim] = -1
+ * new_ndim += 1 # <<<<<<<<<<<<<<
+ * else:
+ * start = index.start or 0
+ */
+ __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
+
+ /* "View.MemoryView":756
+ * 0, 0, 0, # have_{start,stop,step}
+ * False)
+ * elif index is None: # <<<<<<<<<<<<<<
+ * p_dst.shape[new_ndim] = 1
+ * p_dst.strides[new_ndim] = 0
+ */
+ goto __pyx_L6;
+ }
+
+ /* "View.MemoryView":762
+ * new_ndim += 1
+ * else:
+ * start = index.start or 0 # <<<<<<<<<<<<<<
+ * stop = index.stop or 0
+ * step = index.step or 0
+ */
+ /*else*/ {
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 762, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 762, __pyx_L1_error)
+ if (!__pyx_t_1) {
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ } else {
+ __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 762, __pyx_L1_error)
+ __pyx_t_9 = __pyx_t_11;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ goto __pyx_L7_bool_binop_done;
+ }
+ __pyx_t_9 = 0;
+ __pyx_L7_bool_binop_done:;
+ __pyx_v_start = __pyx_t_9;
+
+ /* "View.MemoryView":763
+ * else:
+ * start = index.start or 0
+ * stop = index.stop or 0 # <<<<<<<<<<<<<<
+ * step = index.step or 0
+ *
+ */
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 763, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 763, __pyx_L1_error)
+ if (!__pyx_t_1) {
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ } else {
+ __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 763, __pyx_L1_error)
+ __pyx_t_9 = __pyx_t_11;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ goto __pyx_L9_bool_binop_done;
+ }
+ __pyx_t_9 = 0;
+ __pyx_L9_bool_binop_done:;
+ __pyx_v_stop = __pyx_t_9;
+
+ /* "View.MemoryView":764
+ * start = index.start or 0
+ * stop = index.stop or 0
+ * step = index.step or 0 # <<<<<<<<<<<<<<
+ *
+ * have_start = index.start is not None
+ */
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 764, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely((__pyx_t_1 < 0))) __PYX_ERR(0, 764, __pyx_L1_error)
+ if (!__pyx_t_1) {
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ } else {
+ __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_t_8); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 764, __pyx_L1_error)
+ __pyx_t_9 = __pyx_t_11;
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ goto __pyx_L11_bool_binop_done;
+ }
+ __pyx_t_9 = 0;
+ __pyx_L11_bool_binop_done:;
+ __pyx_v_step = __pyx_t_9;
+
+ /* "View.MemoryView":766
+ * step = index.step or 0
+ *
+ * have_start = index.start is not None # <<<<<<<<<<<<<<
+ * have_stop = index.stop is not None
+ * have_step = index.step is not None
+ */
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 766, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_1 = (__pyx_t_8 != Py_None);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_v_have_start = __pyx_t_1;
+
+ /* "View.MemoryView":767
+ *
+ * have_start = index.start is not None
+ * have_stop = index.stop is not None # <<<<<<<<<<<<<<
+ * have_step = index.step is not None
+ *
+ */
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 767, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_1 = (__pyx_t_8 != Py_None);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_v_have_stop = __pyx_t_1;
+
+ /* "View.MemoryView":768
+ * have_start = index.start is not None
+ * have_stop = index.stop is not None
+ * have_step = index.step is not None # <<<<<<<<<<<<<<
+ *
+ * slice_memviewslice(
+ */
+ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 768, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_8);
+ __pyx_t_1 = (__pyx_t_8 != Py_None);
+ __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+ __pyx_v_have_step = __pyx_t_1;
+
+ /* "View.MemoryView":770
+ * have_step = index.step is not None
+ *
+ * slice_memviewslice( # <<<<<<<<<<<<<<
+ * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
+ * dim, new_ndim, p_suboffset_dim,
+ */
+ __pyx_t_10 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 770, __pyx_L1_error)
+
+ /* "View.MemoryView":776
+ * have_start, have_stop, have_step,
+ * True)
+ * new_ndim += 1 # <<<<<<<<<<<<<<
+ *
+ * if isinstance(memview, _memoryviewslice):
+ */
+ __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
+ }
+ __pyx_L6:;
+
+ /* "View.MemoryView":747
+ * cdef bint have_start, have_stop, have_step
+ *
+ * for dim, index in enumerate(indices): # <<<<<<<<<<<<<<
+ * if PyIndex_Check(index):
+ * cindex = index
+ */
+ }
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+
+ /* "View.MemoryView":778
+ * new_ndim += 1
+ *
+ * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
+ * return memoryview_fromslice(dst, new_ndim,
+ * memviewsliceobj.to_object_func,
+ */
+ __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":779
+ *
+ * if isinstance(memview, _memoryviewslice):
+ * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<<
+ * memviewsliceobj.to_object_func,
+ * memviewsliceobj.to_dtype_func,
+ */
+ __Pyx_XDECREF((PyObject *)__pyx_r);
+
+ /* "View.MemoryView":780
+ * if isinstance(memview, _memoryviewslice):
+ * return memoryview_fromslice(dst, new_ndim,
+ * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<<
+ * memviewsliceobj.to_dtype_func,
+ * memview.dtype_is_object)
+ */
+ if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(0, 780, __pyx_L1_error) }
+
+ /* "View.MemoryView":781
+ * return memoryview_fromslice(dst, new_ndim,
+ * memviewsliceobj.to_object_func,
+ * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<<
+ * memview.dtype_is_object)
+ * else:
+ */
+ if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(0, 781, __pyx_L1_error) }
+
+ /* "View.MemoryView":779
+ *
+ * if isinstance(memview, _memoryviewslice):
+ * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<<
+ * memviewsliceobj.to_object_func,
+ * memviewsliceobj.to_dtype_func,
+ */
+ __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 779, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_memoryview_type))))) __PYX_ERR(0, 779, __pyx_L1_error)
+ __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2);
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":778
+ * new_ndim += 1
+ *
+ * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
+ * return memoryview_fromslice(dst, new_ndim,
+ * memviewsliceobj.to_object_func,
+ */
+ }
+
+ /* "View.MemoryView":784
+ * memview.dtype_is_object)
+ * else:
+ * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<<
+ * memview.dtype_is_object)
+ *
+ */
+ /*else*/ {
+ __Pyx_XDECREF((PyObject *)__pyx_r);
+
+ /* "View.MemoryView":785
+ * else:
+ * return memoryview_fromslice(dst, new_ndim, NULL, NULL,
+ * memview.dtype_is_object) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_2 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 784, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+
+ /* "View.MemoryView":784
+ * memview.dtype_is_object)
+ * else:
+ * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<<
+ * memview.dtype_is_object)
+ *
+ */
+ if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_memoryview_type))))) __PYX_ERR(0, 784, __pyx_L1_error)
+ __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_2);
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "View.MemoryView":711
+ *
+ * @cname('__pyx_memview_slice')
+ * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<<
+ * cdef int new_ndim = 0, suboffset_dim = -1, dim
+ * cdef bint negative_step
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_8);
+ __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
+ __Pyx_XDECREF(__pyx_v_index);
+ __Pyx_XGIVEREF((PyObject *)__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":793
+ *
+ * @cname('__pyx_memoryview_slice_memviewslice')
+ * cdef int slice_memviewslice( # <<<<<<<<<<<<<<
+ * __Pyx_memviewslice *dst,
+ * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
+ */
+
+static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) {
+ Py_ssize_t __pyx_v_new_shape;
+ int __pyx_v_negative_step;
+ int __pyx_r;
+ int __pyx_t_1;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ #ifdef WITH_THREAD
+ PyGILState_STATE __pyx_gilstate_save;
+ #endif
+
+ /* "View.MemoryView":813
+ * cdef bint negative_step
+ *
+ * if not is_slice: # <<<<<<<<<<<<<<
+ *
+ * if start < 0:
+ */
+ __pyx_t_1 = (!__pyx_v_is_slice);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":815
+ * if not is_slice:
+ *
+ * if start < 0: # <<<<<<<<<<<<<<
+ * start += shape
+ * if not 0 <= start < shape:
+ */
+ __pyx_t_1 = (__pyx_v_start < 0);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":816
+ *
+ * if start < 0:
+ * start += shape # <<<<<<<<<<<<<<
+ * if not 0 <= start < shape:
+ * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim)
+ */
+ __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
+
+ /* "View.MemoryView":815
+ * if not is_slice:
+ *
+ * if start < 0: # <<<<<<<<<<<<<<
+ * start += shape
+ * if not 0 <= start < shape:
+ */
+ }
+
+ /* "View.MemoryView":817
+ * if start < 0:
+ * start += shape
+ * if not 0 <= start < shape: # <<<<<<<<<<<<<<
+ * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim)
+ * else:
+ */
+ __pyx_t_1 = (0 <= __pyx_v_start);
+ if (__pyx_t_1) {
+ __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
+ }
+ __pyx_t_2 = (!__pyx_t_1);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":818
+ * start += shape
+ * if not 0 <= start < shape:
+ * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<<
+ * else:
+ *
+ */
+ __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_kp_s_Index_out_of_bounds_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 818, __pyx_L1_error)
+
+ /* "View.MemoryView":817
+ * if start < 0:
+ * start += shape
+ * if not 0 <= start < shape: # <<<<<<<<<<<<<<
+ * _err_dim(PyExc_IndexError, "Index out of bounds (axis %d)", dim)
+ * else:
+ */
+ }
+
+ /* "View.MemoryView":813
+ * cdef bint negative_step
+ *
+ * if not is_slice: # <<<<<<<<<<<<<<
+ *
+ * if start < 0:
+ */
+ goto __pyx_L3;
+ }
+
+ /* "View.MemoryView":821
+ * else:
+ *
+ * if have_step: # <<<<<<<<<<<<<<
+ * negative_step = step < 0
+ * if step == 0:
+ */
+ /*else*/ {
+ __pyx_t_2 = (__pyx_v_have_step != 0);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":822
+ *
+ * if have_step:
+ * negative_step = step < 0 # <<<<<<<<<<<<<<
+ * if step == 0:
+ * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim)
+ */
+ __pyx_v_negative_step = (__pyx_v_step < 0);
+
+ /* "View.MemoryView":823
+ * if have_step:
+ * negative_step = step < 0
+ * if step == 0: # <<<<<<<<<<<<<<
+ * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim)
+ * else:
+ */
+ __pyx_t_2 = (__pyx_v_step == 0);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":824
+ * negative_step = step < 0
+ * if step == 0:
+ * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<<
+ * else:
+ * negative_step = False
+ */
+ __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_ValueError, __pyx_kp_s_Step_may_not_be_zero_axis_d, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 824, __pyx_L1_error)
+
+ /* "View.MemoryView":823
+ * if have_step:
+ * negative_step = step < 0
+ * if step == 0: # <<<<<<<<<<<<<<
+ * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim)
+ * else:
+ */
+ }
+
+ /* "View.MemoryView":821
+ * else:
+ *
+ * if have_step: # <<<<<<<<<<<<<<
+ * negative_step = step < 0
+ * if step == 0:
+ */
+ goto __pyx_L6;
+ }
+
+ /* "View.MemoryView":826
+ * _err_dim(PyExc_ValueError, "Step may not be zero (axis %d)", dim)
+ * else:
+ * negative_step = False # <<<<<<<<<<<<<<
+ * step = 1
+ *
+ */
+ /*else*/ {
+ __pyx_v_negative_step = 0;
+
+ /* "View.MemoryView":827
+ * else:
+ * negative_step = False
+ * step = 1 # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_v_step = 1;
+ }
+ __pyx_L6:;
+
+ /* "View.MemoryView":830
+ *
+ *
+ * if have_start: # <<<<<<<<<<<<<<
+ * if start < 0:
+ * start += shape
+ */
+ __pyx_t_2 = (__pyx_v_have_start != 0);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":831
+ *
+ * if have_start:
+ * if start < 0: # <<<<<<<<<<<<<<
+ * start += shape
+ * if start < 0:
+ */
+ __pyx_t_2 = (__pyx_v_start < 0);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":832
+ * if have_start:
+ * if start < 0:
+ * start += shape # <<<<<<<<<<<<<<
+ * if start < 0:
+ * start = 0
+ */
+ __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
+
+ /* "View.MemoryView":833
+ * if start < 0:
+ * start += shape
+ * if start < 0: # <<<<<<<<<<<<<<
+ * start = 0
+ * elif start >= shape:
+ */
+ __pyx_t_2 = (__pyx_v_start < 0);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":834
+ * start += shape
+ * if start < 0:
+ * start = 0 # <<<<<<<<<<<<<<
+ * elif start >= shape:
+ * if negative_step:
+ */
+ __pyx_v_start = 0;
+
+ /* "View.MemoryView":833
+ * if start < 0:
+ * start += shape
+ * if start < 0: # <<<<<<<<<<<<<<
+ * start = 0
+ * elif start >= shape:
+ */
+ }
+
+ /* "View.MemoryView":831
+ *
+ * if have_start:
+ * if start < 0: # <<<<<<<<<<<<<<
+ * start += shape
+ * if start < 0:
+ */
+ goto __pyx_L9;
+ }
+
+ /* "View.MemoryView":835
+ * if start < 0:
+ * start = 0
+ * elif start >= shape: # <<<<<<<<<<<<<<
+ * if negative_step:
+ * start = shape - 1
+ */
+ __pyx_t_2 = (__pyx_v_start >= __pyx_v_shape);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":836
+ * start = 0
+ * elif start >= shape:
+ * if negative_step: # <<<<<<<<<<<<<<
+ * start = shape - 1
+ * else:
+ */
+ if (__pyx_v_negative_step) {
+
+ /* "View.MemoryView":837
+ * elif start >= shape:
+ * if negative_step:
+ * start = shape - 1 # <<<<<<<<<<<<<<
+ * else:
+ * start = shape
+ */
+ __pyx_v_start = (__pyx_v_shape - 1);
+
+ /* "View.MemoryView":836
+ * start = 0
+ * elif start >= shape:
+ * if negative_step: # <<<<<<<<<<<<<<
+ * start = shape - 1
+ * else:
+ */
+ goto __pyx_L11;
+ }
+
+ /* "View.MemoryView":839
+ * start = shape - 1
+ * else:
+ * start = shape # <<<<<<<<<<<<<<
+ * else:
+ * if negative_step:
+ */
+ /*else*/ {
+ __pyx_v_start = __pyx_v_shape;
+ }
+ __pyx_L11:;
+
+ /* "View.MemoryView":835
+ * if start < 0:
+ * start = 0
+ * elif start >= shape: # <<<<<<<<<<<<<<
+ * if negative_step:
+ * start = shape - 1
+ */
+ }
+ __pyx_L9:;
+
+ /* "View.MemoryView":830
+ *
+ *
+ * if have_start: # <<<<<<<<<<<<<<
+ * if start < 0:
+ * start += shape
+ */
+ goto __pyx_L8;
+ }
+
+ /* "View.MemoryView":841
+ * start = shape
+ * else:
+ * if negative_step: # <<<<<<<<<<<<<<
+ * start = shape - 1
+ * else:
+ */
+ /*else*/ {
+ if (__pyx_v_negative_step) {
+
+ /* "View.MemoryView":842
+ * else:
+ * if negative_step:
+ * start = shape - 1 # <<<<<<<<<<<<<<
+ * else:
+ * start = 0
+ */
+ __pyx_v_start = (__pyx_v_shape - 1);
+
+ /* "View.MemoryView":841
+ * start = shape
+ * else:
+ * if negative_step: # <<<<<<<<<<<<<<
+ * start = shape - 1
+ * else:
+ */
+ goto __pyx_L12;
+ }
+
+ /* "View.MemoryView":844
+ * start = shape - 1
+ * else:
+ * start = 0 # <<<<<<<<<<<<<<
+ *
+ * if have_stop:
+ */
+ /*else*/ {
+ __pyx_v_start = 0;
+ }
+ __pyx_L12:;
+ }
+ __pyx_L8:;
+
+ /* "View.MemoryView":846
+ * start = 0
+ *
+ * if have_stop: # <<<<<<<<<<<<<<
+ * if stop < 0:
+ * stop += shape
+ */
+ __pyx_t_2 = (__pyx_v_have_stop != 0);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":847
+ *
+ * if have_stop:
+ * if stop < 0: # <<<<<<<<<<<<<<
+ * stop += shape
+ * if stop < 0:
+ */
+ __pyx_t_2 = (__pyx_v_stop < 0);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":848
+ * if have_stop:
+ * if stop < 0:
+ * stop += shape # <<<<<<<<<<<<<<
+ * if stop < 0:
+ * stop = 0
+ */
+ __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
+
+ /* "View.MemoryView":849
+ * if stop < 0:
+ * stop += shape
+ * if stop < 0: # <<<<<<<<<<<<<<
+ * stop = 0
+ * elif stop > shape:
+ */
+ __pyx_t_2 = (__pyx_v_stop < 0);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":850
+ * stop += shape
+ * if stop < 0:
+ * stop = 0 # <<<<<<<<<<<<<<
+ * elif stop > shape:
+ * stop = shape
+ */
+ __pyx_v_stop = 0;
+
+ /* "View.MemoryView":849
+ * if stop < 0:
+ * stop += shape
+ * if stop < 0: # <<<<<<<<<<<<<<
+ * stop = 0
+ * elif stop > shape:
+ */
+ }
+
+ /* "View.MemoryView":847
+ *
+ * if have_stop:
+ * if stop < 0: # <<<<<<<<<<<<<<
+ * stop += shape
+ * if stop < 0:
+ */
+ goto __pyx_L14;
+ }
+
+ /* "View.MemoryView":851
+ * if stop < 0:
+ * stop = 0
+ * elif stop > shape: # <<<<<<<<<<<<<<
+ * stop = shape
+ * else:
+ */
+ __pyx_t_2 = (__pyx_v_stop > __pyx_v_shape);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":852
+ * stop = 0
+ * elif stop > shape:
+ * stop = shape # <<<<<<<<<<<<<<
+ * else:
+ * if negative_step:
+ */
+ __pyx_v_stop = __pyx_v_shape;
+
+ /* "View.MemoryView":851
+ * if stop < 0:
+ * stop = 0
+ * elif stop > shape: # <<<<<<<<<<<<<<
+ * stop = shape
+ * else:
+ */
+ }
+ __pyx_L14:;
+
+ /* "View.MemoryView":846
+ * start = 0
+ *
+ * if have_stop: # <<<<<<<<<<<<<<
+ * if stop < 0:
+ * stop += shape
+ */
+ goto __pyx_L13;
+ }
+
+ /* "View.MemoryView":854
+ * stop = shape
+ * else:
+ * if negative_step: # <<<<<<<<<<<<<<
+ * stop = -1
+ * else:
+ */
+ /*else*/ {
+ if (__pyx_v_negative_step) {
+
+ /* "View.MemoryView":855
+ * else:
+ * if negative_step:
+ * stop = -1 # <<<<<<<<<<<<<<
+ * else:
+ * stop = shape
+ */
+ __pyx_v_stop = -1L;
+
+ /* "View.MemoryView":854
+ * stop = shape
+ * else:
+ * if negative_step: # <<<<<<<<<<<<<<
+ * stop = -1
+ * else:
+ */
+ goto __pyx_L16;
+ }
+
+ /* "View.MemoryView":857
+ * stop = -1
+ * else:
+ * stop = shape # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ /*else*/ {
+ __pyx_v_stop = __pyx_v_shape;
+ }
+ __pyx_L16:;
+ }
+ __pyx_L13:;
+
+ /* "View.MemoryView":861
+ *
+ * with cython.cdivision(True):
+ * new_shape = (stop - start) // step # <<<<<<<<<<<<<<
+ *
+ * if (stop - start) - step * new_shape:
+ */
+ __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
+
+ /* "View.MemoryView":863
+ * new_shape = (stop - start) // step
+ *
+ * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<<
+ * new_shape += 1
+ *
+ */
+ __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":864
+ *
+ * if (stop - start) - step * new_shape:
+ * new_shape += 1 # <<<<<<<<<<<<<<
+ *
+ * if new_shape < 0:
+ */
+ __pyx_v_new_shape = (__pyx_v_new_shape + 1);
+
+ /* "View.MemoryView":863
+ * new_shape = (stop - start) // step
+ *
+ * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<<
+ * new_shape += 1
+ *
+ */
+ }
+
+ /* "View.MemoryView":866
+ * new_shape += 1
+ *
+ * if new_shape < 0: # <<<<<<<<<<<<<<
+ * new_shape = 0
+ *
+ */
+ __pyx_t_2 = (__pyx_v_new_shape < 0);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":867
+ *
+ * if new_shape < 0:
+ * new_shape = 0 # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_v_new_shape = 0;
+
+ /* "View.MemoryView":866
+ * new_shape += 1
+ *
+ * if new_shape < 0: # <<<<<<<<<<<<<<
+ * new_shape = 0
+ *
+ */
+ }
+
+ /* "View.MemoryView":870
+ *
+ *
+ * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<<
+ * dst.shape[new_ndim] = new_shape
+ * dst.suboffsets[new_ndim] = suboffset
+ */
+ (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
+
+ /* "View.MemoryView":871
+ *
+ * dst.strides[new_ndim] = stride * step
+ * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<<
+ * dst.suboffsets[new_ndim] = suboffset
+ *
+ */
+ (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
+
+ /* "View.MemoryView":872
+ * dst.strides[new_ndim] = stride * step
+ * dst.shape[new_ndim] = new_shape
+ * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
+ }
+ __pyx_L3:;
+
+ /* "View.MemoryView":875
+ *
+ *
+ * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<<
+ * dst.data += start * stride
+ * else:
+ */
+ __pyx_t_2 = ((__pyx_v_suboffset_dim[0]) < 0);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":876
+ *
+ * if suboffset_dim[0] < 0:
+ * dst.data += start * stride # <<<<<<<<<<<<<<
+ * else:
+ * dst.suboffsets[suboffset_dim[0]] += start * stride
+ */
+ __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
+
+ /* "View.MemoryView":875
+ *
+ *
+ * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<<
+ * dst.data += start * stride
+ * else:
+ */
+ goto __pyx_L19;
+ }
+
+ /* "View.MemoryView":878
+ * dst.data += start * stride
+ * else:
+ * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<<
+ *
+ * if suboffset >= 0:
+ */
+ /*else*/ {
+ __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
+ (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
+ }
+ __pyx_L19:;
+
+ /* "View.MemoryView":880
+ * dst.suboffsets[suboffset_dim[0]] += start * stride
+ *
+ * if suboffset >= 0: # <<<<<<<<<<<<<<
+ * if not is_slice:
+ * if new_ndim == 0:
+ */
+ __pyx_t_2 = (__pyx_v_suboffset >= 0);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":881
+ *
+ * if suboffset >= 0:
+ * if not is_slice: # <<<<<<<<<<<<<<
+ * if new_ndim == 0:
+ * dst.data = ( dst.data)[0] + suboffset
+ */
+ __pyx_t_2 = (!__pyx_v_is_slice);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":882
+ * if suboffset >= 0:
+ * if not is_slice:
+ * if new_ndim == 0: # <<<<<<<<<<<<<<
+ * dst.data = ( dst.data)[0] + suboffset
+ * else:
+ */
+ __pyx_t_2 = (__pyx_v_new_ndim == 0);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":883
+ * if not is_slice:
+ * if new_ndim == 0:
+ * dst.data = ( dst.data)[0] + suboffset # <<<<<<<<<<<<<<
+ * else:
+ * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d "
+ */
+ __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
+
+ /* "View.MemoryView":882
+ * if suboffset >= 0:
+ * if not is_slice:
+ * if new_ndim == 0: # <<<<<<<<<<<<<<
+ * dst.data = ( dst.data)[0] + suboffset
+ * else:
+ */
+ goto __pyx_L22;
+ }
+
+ /* "View.MemoryView":885
+ * dst.data = ( dst.data)[0] + suboffset
+ * else:
+ * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<<
+ * "must be indexed and not sliced", dim)
+ * else:
+ */
+ /*else*/ {
+
+ /* "View.MemoryView":886
+ * else:
+ * _err_dim(PyExc_IndexError, "All dimensions preceding dimension %d "
+ * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<<
+ * else:
+ * suboffset_dim[0] = new_ndim
+ */
+ __pyx_t_3 = __pyx_memoryview_err_dim(PyExc_IndexError, __pyx_kp_s_All_dimensions_preceding_dimensi, __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 885, __pyx_L1_error)
+ }
+ __pyx_L22:;
+
+ /* "View.MemoryView":881
+ *
+ * if suboffset >= 0:
+ * if not is_slice: # <<<<<<<<<<<<<<
+ * if new_ndim == 0:
+ * dst.data = ( dst.data)[0] + suboffset
+ */
+ goto __pyx_L21;
+ }
+
+ /* "View.MemoryView":888
+ * "must be indexed and not sliced", dim)
+ * else:
+ * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<<
+ *
+ * return 0
+ */
+ /*else*/ {
+ (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
+ }
+ __pyx_L21:;
+
+ /* "View.MemoryView":880
+ * dst.suboffsets[suboffset_dim[0]] += start * stride
+ *
+ * if suboffset >= 0: # <<<<<<<<<<<<<<
+ * if not is_slice:
+ * if new_ndim == 0:
+ */
+ }
+
+ /* "View.MemoryView":890
+ * suboffset_dim[0] = new_ndim
+ *
+ * return 0 # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_r = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":793
+ *
+ * @cname('__pyx_memoryview_slice_memviewslice')
+ * cdef int slice_memviewslice( # <<<<<<<<<<<<<<
+ * __Pyx_memviewslice *dst,
+ * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ #ifdef WITH_THREAD
+ __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
+ #endif
+ __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ #ifdef WITH_THREAD
+ __Pyx_PyGILState_Release(__pyx_gilstate_save);
+ #endif
+ __pyx_L0:;
+ return __pyx_r;
+}
+
+/* "View.MemoryView":896
+ *
+ * @cname('__pyx_pybuffer_index')
+ * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<<
+ * Py_ssize_t dim) except NULL:
+ * cdef Py_ssize_t shape, stride, suboffset = -1
+ */
+
+static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
+ Py_ssize_t __pyx_v_shape;
+ Py_ssize_t __pyx_v_stride;
+ Py_ssize_t __pyx_v_suboffset;
+ Py_ssize_t __pyx_v_itemsize;
+ char *__pyx_v_resultp;
+ char *__pyx_r;
+ __Pyx_RefNannyDeclarations
+ Py_ssize_t __pyx_t_1;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ Py_UCS4 __pyx_t_4;
+ PyObject *__pyx_t_5 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("pybuffer_index", 1);
+
+ /* "View.MemoryView":898
+ * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
+ * Py_ssize_t dim) except NULL:
+ * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<<
+ * cdef Py_ssize_t itemsize = view.itemsize
+ * cdef char *resultp
+ */
+ __pyx_v_suboffset = -1L;
+
+ /* "View.MemoryView":899
+ * Py_ssize_t dim) except NULL:
+ * cdef Py_ssize_t shape, stride, suboffset = -1
+ * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<<
+ * cdef char *resultp
+ *
+ */
+ __pyx_t_1 = __pyx_v_view->itemsize;
+ __pyx_v_itemsize = __pyx_t_1;
+
+ /* "View.MemoryView":902
+ * cdef char *resultp
+ *
+ * if view.ndim == 0: # <<<<<<<<<<<<<<
+ * shape = view.len // itemsize
+ * stride = itemsize
+ */
+ __pyx_t_2 = (__pyx_v_view->ndim == 0);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":903
+ *
+ * if view.ndim == 0:
+ * shape = view.len // itemsize # <<<<<<<<<<<<<<
+ * stride = itemsize
+ * else:
+ */
+ if (unlikely(__pyx_v_itemsize == 0)) {
+ PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
+ __PYX_ERR(0, 903, __pyx_L1_error)
+ }
+ else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(__Pyx_UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
+ PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
+ __PYX_ERR(0, 903, __pyx_L1_error)
+ }
+ __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
+
+ /* "View.MemoryView":904
+ * if view.ndim == 0:
+ * shape = view.len // itemsize
+ * stride = itemsize # <<<<<<<<<<<<<<
+ * else:
+ * shape = view.shape[dim]
+ */
+ __pyx_v_stride = __pyx_v_itemsize;
+
+ /* "View.MemoryView":902
+ * cdef char *resultp
+ *
+ * if view.ndim == 0: # <<<<<<<<<<<<<<
+ * shape = view.len // itemsize
+ * stride = itemsize
+ */
+ goto __pyx_L3;
+ }
+
+ /* "View.MemoryView":906
+ * stride = itemsize
+ * else:
+ * shape = view.shape[dim] # <<<<<<<<<<<<<<
+ * stride = view.strides[dim]
+ * if view.suboffsets != NULL:
+ */
+ /*else*/ {
+ __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
+
+ /* "View.MemoryView":907
+ * else:
+ * shape = view.shape[dim]
+ * stride = view.strides[dim] # <<<<<<<<<<<<<<
+ * if view.suboffsets != NULL:
+ * suboffset = view.suboffsets[dim]
+ */
+ __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
+
+ /* "View.MemoryView":908
+ * shape = view.shape[dim]
+ * stride = view.strides[dim]
+ * if view.suboffsets != NULL: # <<<<<<<<<<<<<<
+ * suboffset = view.suboffsets[dim]
+ *
+ */
+ __pyx_t_2 = (__pyx_v_view->suboffsets != NULL);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":909
+ * stride = view.strides[dim]
+ * if view.suboffsets != NULL:
+ * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<<
+ *
+ * if index < 0:
+ */
+ __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
+
+ /* "View.MemoryView":908
+ * shape = view.shape[dim]
+ * stride = view.strides[dim]
+ * if view.suboffsets != NULL: # <<<<<<<<<<<<<<
+ * suboffset = view.suboffsets[dim]
+ *
+ */
+ }
+ }
+ __pyx_L3:;
+
+ /* "View.MemoryView":911
+ * suboffset = view.suboffsets[dim]
+ *
+ * if index < 0: # <<<<<<<<<<<<<<
+ * index += view.shape[dim]
+ * if index < 0:
+ */
+ __pyx_t_2 = (__pyx_v_index < 0);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":912
+ *
+ * if index < 0:
+ * index += view.shape[dim] # <<<<<<<<<<<<<<
+ * if index < 0:
+ * raise IndexError, f"Out of bounds on buffer access (axis {dim})"
+ */
+ __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
+
+ /* "View.MemoryView":913
+ * if index < 0:
+ * index += view.shape[dim]
+ * if index < 0: # <<<<<<<<<<<<<<
+ * raise IndexError, f"Out of bounds on buffer access (axis {dim})"
+ *
+ */
+ __pyx_t_2 = (__pyx_v_index < 0);
+ if (unlikely(__pyx_t_2)) {
+
+ /* "View.MemoryView":914
+ * index += view.shape[dim]
+ * if index < 0:
+ * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<<
+ *
+ * if index >= shape:
+ */
+ __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 914, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 = 0;
+ __pyx_t_4 = 127;
+ __Pyx_INCREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a);
+ __pyx_t_1 += 37;
+ __Pyx_GIVEREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a);
+ PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_Out_of_bounds_on_buffer_access_a);
+ __pyx_t_5 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 914, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_5);
+ __Pyx_GIVEREF(__pyx_t_5);
+ PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
+ __pyx_t_5 = 0;
+ __Pyx_INCREF(__pyx_kp_u__7);
+ __pyx_t_1 += 1;
+ __Pyx_GIVEREF(__pyx_kp_u__7);
+ PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u__7);
+ __pyx_t_5 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 914, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_5, 0, 0);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __PYX_ERR(0, 914, __pyx_L1_error)
+
+ /* "View.MemoryView":913
+ * if index < 0:
+ * index += view.shape[dim]
+ * if index < 0: # <<<<<<<<<<<<<<
+ * raise IndexError, f"Out of bounds on buffer access (axis {dim})"
+ *
+ */
+ }
+
+ /* "View.MemoryView":911
+ * suboffset = view.suboffsets[dim]
+ *
+ * if index < 0: # <<<<<<<<<<<<<<
+ * index += view.shape[dim]
+ * if index < 0:
+ */
+ }
+
+ /* "View.MemoryView":916
+ * raise IndexError, f"Out of bounds on buffer access (axis {dim})"
+ *
+ * if index >= shape: # <<<<<<<<<<<<<<
+ * raise IndexError, f"Out of bounds on buffer access (axis {dim})"
+ *
+ */
+ __pyx_t_2 = (__pyx_v_index >= __pyx_v_shape);
+ if (unlikely(__pyx_t_2)) {
+
+ /* "View.MemoryView":917
+ *
+ * if index >= shape:
+ * raise IndexError, f"Out of bounds on buffer access (axis {dim})" # <<<<<<<<<<<<<<
+ *
+ * resultp = bufp + index * stride
+ */
+ __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 917, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_5);
+ __pyx_t_1 = 0;
+ __pyx_t_4 = 127;
+ __Pyx_INCREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a);
+ __pyx_t_1 += 37;
+ __Pyx_GIVEREF(__pyx_kp_u_Out_of_bounds_on_buffer_access_a);
+ PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_u_Out_of_bounds_on_buffer_access_a);
+ __pyx_t_3 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_dim, 0, ' ', 'd'); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 917, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_1 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_3);
+ __Pyx_GIVEREF(__pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
+ __pyx_t_3 = 0;
+ __Pyx_INCREF(__pyx_kp_u__7);
+ __pyx_t_1 += 1;
+ __Pyx_GIVEREF(__pyx_kp_u__7);
+ PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_kp_u__7);
+ __pyx_t_3 = __Pyx_PyUnicode_Join(__pyx_t_5, 3, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 917, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+ __Pyx_Raise(__pyx_builtin_IndexError, __pyx_t_3, 0, 0);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __PYX_ERR(0, 917, __pyx_L1_error)
+
+ /* "View.MemoryView":916
+ * raise IndexError, f"Out of bounds on buffer access (axis {dim})"
+ *
+ * if index >= shape: # <<<<<<<<<<<<<<
+ * raise IndexError, f"Out of bounds on buffer access (axis {dim})"
+ *
+ */
+ }
+
+ /* "View.MemoryView":919
+ * raise IndexError, f"Out of bounds on buffer access (axis {dim})"
+ *
+ * resultp = bufp + index * stride # <<<<<<<<<<<<<<
+ * if suboffset >= 0:
+ * resultp = ( resultp)[0] + suboffset
+ */
+ __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
+
+ /* "View.MemoryView":920
+ *
+ * resultp = bufp + index * stride
+ * if suboffset >= 0: # <<<<<<<<<<<<<<
+ * resultp = ( resultp)[0] + suboffset
+ *
+ */
+ __pyx_t_2 = (__pyx_v_suboffset >= 0);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":921
+ * resultp = bufp + index * stride
+ * if suboffset >= 0:
+ * resultp = ( resultp)[0] + suboffset # <<<<<<<<<<<<<<
+ *
+ * return resultp
+ */
+ __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
+
+ /* "View.MemoryView":920
+ *
+ * resultp = bufp + index * stride
+ * if suboffset >= 0: # <<<<<<<<<<<<<<
+ * resultp = ( resultp)[0] + suboffset
+ *
+ */
+ }
+
+ /* "View.MemoryView":923
+ * resultp = ( resultp)[0] + suboffset
+ *
+ * return resultp # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_r = __pyx_v_resultp;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":896
+ *
+ * @cname('__pyx_pybuffer_index')
+ * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<<
+ * Py_ssize_t dim) except NULL:
+ * cdef Py_ssize_t shape, stride, suboffset = -1
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_XDECREF(__pyx_t_5);
+ __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":929
+ *
+ * @cname('__pyx_memslice_transpose')
+ * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: # <<<<<<<<<<<<<<
+ * cdef int ndim = memslice.memview.view.ndim
+ *
+ */
+
+static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
+ int __pyx_v_ndim;
+ Py_ssize_t *__pyx_v_shape;
+ Py_ssize_t *__pyx_v_strides;
+ int __pyx_v_i;
+ int __pyx_v_j;
+ int __pyx_r;
+ int __pyx_t_1;
+ Py_ssize_t *__pyx_t_2;
+ long __pyx_t_3;
+ long __pyx_t_4;
+ Py_ssize_t __pyx_t_5;
+ Py_ssize_t __pyx_t_6;
+ int __pyx_t_7;
+ int __pyx_t_8;
+ int __pyx_t_9;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ #ifdef WITH_THREAD
+ PyGILState_STATE __pyx_gilstate_save;
+ #endif
+
+ /* "View.MemoryView":930
+ * @cname('__pyx_memslice_transpose')
+ * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil:
+ * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<<
+ *
+ * cdef Py_ssize_t *shape = memslice.shape
+ */
+ __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
+ __pyx_v_ndim = __pyx_t_1;
+
+ /* "View.MemoryView":932
+ * cdef int ndim = memslice.memview.view.ndim
+ *
+ * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<<
+ * cdef Py_ssize_t *strides = memslice.strides
+ *
+ */
+ __pyx_t_2 = __pyx_v_memslice->shape;
+ __pyx_v_shape = __pyx_t_2;
+
+ /* "View.MemoryView":933
+ *
+ * cdef Py_ssize_t *shape = memslice.shape
+ * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_2 = __pyx_v_memslice->strides;
+ __pyx_v_strides = __pyx_t_2;
+
+ /* "View.MemoryView":937
+ *
+ * cdef int i, j
+ * for i in range(ndim // 2): # <<<<<<<<<<<<<<
+ * j = ndim - 1 - i
+ * strides[i], strides[j] = strides[j], strides[i]
+ */
+ __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
+ __pyx_t_4 = __pyx_t_3;
+ for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
+ __pyx_v_i = __pyx_t_1;
+
+ /* "View.MemoryView":938
+ * cdef int i, j
+ * for i in range(ndim // 2):
+ * j = ndim - 1 - i # <<<<<<<<<<<<<<
+ * strides[i], strides[j] = strides[j], strides[i]
+ * shape[i], shape[j] = shape[j], shape[i]
+ */
+ __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
+
+ /* "View.MemoryView":939
+ * for i in range(ndim // 2):
+ * j = ndim - 1 - i
+ * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<<
+ * shape[i], shape[j] = shape[j], shape[i]
+ *
+ */
+ __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
+ __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
+ (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
+ (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
+
+ /* "View.MemoryView":940
+ * j = ndim - 1 - i
+ * strides[i], strides[j] = strides[j], strides[i]
+ * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<<
+ *
+ * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
+ */
+ __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
+ __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
+ (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
+ (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
+
+ /* "View.MemoryView":942
+ * shape[i], shape[j] = shape[j], shape[i]
+ *
+ * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<<
+ * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions")
+ *
+ */
+ __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0);
+ if (!__pyx_t_8) {
+ } else {
+ __pyx_t_7 = __pyx_t_8;
+ goto __pyx_L6_bool_binop_done;
+ }
+ __pyx_t_8 = ((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0);
+ __pyx_t_7 = __pyx_t_8;
+ __pyx_L6_bool_binop_done:;
+ if (__pyx_t_7) {
+
+ /* "View.MemoryView":943
+ *
+ * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
+ * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<<
+ *
+ * return 0
+ */
+ __pyx_t_9 = __pyx_memoryview_err(PyExc_ValueError, __pyx_kp_s_Cannot_transpose_memoryview_with); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 943, __pyx_L1_error)
+
+ /* "View.MemoryView":942
+ * shape[i], shape[j] = shape[j], shape[i]
+ *
+ * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<<
+ * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions")
+ *
+ */
+ }
+ }
+
+ /* "View.MemoryView":945
+ * _err(PyExc_ValueError, "Cannot transpose memoryview with indirect dimensions")
+ *
+ * return 0 # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_r = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":929
+ *
+ * @cname('__pyx_memslice_transpose')
+ * cdef int transpose_memslice(__Pyx_memviewslice *memslice) except -1 nogil: # <<<<<<<<<<<<<<
+ * cdef int ndim = memslice.memview.view.ndim
+ *
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ #ifdef WITH_THREAD
+ __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
+ #endif
+ __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ #ifdef WITH_THREAD
+ __Pyx_PyGILState_Release(__pyx_gilstate_save);
+ #endif
+ __pyx_L0:;
+ return __pyx_r;
+}
+
+/* "View.MemoryView":963
+ * cdef int (*to_dtype_func)(char *, object) except 0
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1)
+ *
+ */
+
+/* Python wrapper */
+static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
+ __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
+ __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+}
+
+static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
+
+ /* "View.MemoryView":964
+ *
+ * def __dealloc__(self):
+ * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<<
+ *
+ * cdef convert_item_to_object(self, char *itemp):
+ */
+ __PYX_XCLEAR_MEMVIEW((&__pyx_v_self->from_slice), 1);
+
+ /* "View.MemoryView":963
+ * cdef int (*to_dtype_func)(char *, object) except 0
+ *
+ * def __dealloc__(self): # <<<<<<<<<<<<<<
+ * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1)
+ *
+ */
+
+ /* function exit code */
+}
+
+/* "View.MemoryView":966
+ * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1)
+ *
+ * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
+ * if self.to_object_func != NULL:
+ * return self.to_object_func(itemp)
+ */
+
+static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("convert_item_to_object", 1);
+
+ /* "View.MemoryView":967
+ *
+ * cdef convert_item_to_object(self, char *itemp):
+ * if self.to_object_func != NULL: # <<<<<<<<<<<<<<
+ * return self.to_object_func(itemp)
+ * else:
+ */
+ __pyx_t_1 = (__pyx_v_self->to_object_func != NULL);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":968
+ * cdef convert_item_to_object(self, char *itemp):
+ * if self.to_object_func != NULL:
+ * return self.to_object_func(itemp) # <<<<<<<<<<<<<<
+ * else:
+ * return memoryview.convert_item_to_object(self, itemp)
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 968, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":967
+ *
+ * cdef convert_item_to_object(self, char *itemp):
+ * if self.to_object_func != NULL: # <<<<<<<<<<<<<<
+ * return self.to_object_func(itemp)
+ * else:
+ */
+ }
+
+ /* "View.MemoryView":970
+ * return self.to_object_func(itemp)
+ * else:
+ * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<<
+ *
+ * cdef assign_item_from_object(self, char *itemp, object value):
+ */
+ /*else*/ {
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 970, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_r = __pyx_t_2;
+ __pyx_t_2 = 0;
+ goto __pyx_L0;
+ }
+
+ /* "View.MemoryView":966
+ * __PYX_XCLEAR_MEMVIEW(&self.from_slice, 1)
+ *
+ * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
+ * if self.to_object_func != NULL:
+ * return self.to_object_func(itemp)
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":972
+ * return memoryview.convert_item_to_object(self, itemp)
+ *
+ * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
+ * if self.to_dtype_func != NULL:
+ * self.to_dtype_func(itemp, value)
+ */
+
+static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ int __pyx_t_2;
+ PyObject *__pyx_t_3 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("assign_item_from_object", 1);
+
+ /* "View.MemoryView":973
+ *
+ * cdef assign_item_from_object(self, char *itemp, object value):
+ * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<<
+ * self.to_dtype_func(itemp, value)
+ * else:
+ */
+ __pyx_t_1 = (__pyx_v_self->to_dtype_func != NULL);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":974
+ * cdef assign_item_from_object(self, char *itemp, object value):
+ * if self.to_dtype_func != NULL:
+ * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<<
+ * else:
+ * memoryview.assign_item_from_object(self, itemp, value)
+ */
+ __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(0, 974, __pyx_L1_error)
+
+ /* "View.MemoryView":973
+ *
+ * cdef assign_item_from_object(self, char *itemp, object value):
+ * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<<
+ * self.to_dtype_func(itemp, value)
+ * else:
+ */
+ goto __pyx_L3;
+ }
+
+ /* "View.MemoryView":976
+ * self.to_dtype_func(itemp, value)
+ * else:
+ * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<<
+ *
+ * cdef _get_base(self):
+ */
+ /*else*/ {
+ __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 976, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ }
+ __pyx_L3:;
+
+ /* "View.MemoryView":972
+ * return memoryview.convert_item_to_object(self, itemp)
+ *
+ * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
+ * if self.to_dtype_func != NULL:
+ * self.to_dtype_func(itemp, value)
+ */
+
+ /* function exit code */
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":978
+ * memoryview.assign_item_from_object(self, itemp, value)
+ *
+ * cdef _get_base(self): # <<<<<<<<<<<<<<
+ * return self.from_object
+ *
+ */
+
+static PyObject *__pyx_memoryviewslice__get_base(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("_get_base", 1);
+
+ /* "View.MemoryView":979
+ *
+ * cdef _get_base(self):
+ * return self.from_object # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF(__pyx_v_self->from_object);
+ __pyx_r = __pyx_v_self->from_object;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":978
+ * memoryview.assign_item_from_object(self, itemp, value)
+ *
+ * cdef _get_base(self): # <<<<<<<<<<<<<<
+ * return self.from_object
+ *
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":1
+ * def __reduce_cython__(self): # <<<<<<<<<<<<<<
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ * def __setstate_cython__(self, __pyx_state):
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+); /*proto*/
+static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+) {
+ #if !CYTHON_METH_FASTCALL
+ CYTHON_UNUSED Py_ssize_t __pyx_nargs;
+ #endif
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
+ #if !CYTHON_METH_FASTCALL
+ #if CYTHON_ASSUME_SAFE_MACROS
+ __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
+ #else
+ __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
+ #endif
+ #endif
+ __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
+ if (unlikely(__pyx_nargs > 0)) {
+ __Pyx_RaiseArgtupleInvalid("__reduce_cython__", 1, 0, 0, __pyx_nargs); return NULL;}
+ if (unlikely(__pyx_kwds) && __Pyx_NumKwargs_FASTCALL(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__reduce_cython__", 0))) return NULL;
+ __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
+
+ /* function exit code */
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__reduce_cython__", 1);
+
+ /* "(tree fragment)":2
+ * def __reduce_cython__(self):
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<<
+ * def __setstate_cython__(self, __pyx_state):
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ */
+ __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0);
+ __PYX_ERR(0, 2, __pyx_L1_error)
+
+ /* "(tree fragment)":1
+ * def __reduce_cython__(self): # <<<<<<<<<<<<<<
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ * def __setstate_cython__(self, __pyx_state):
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "(tree fragment)":3
+ * def __reduce_cython__(self):
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ */
+
+/* Python wrapper */
+static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+); /*proto*/
+static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self,
+#if CYTHON_METH_FASTCALL
+PyObject *const *__pyx_args, Py_ssize_t __pyx_nargs, PyObject *__pyx_kwds
+#else
+PyObject *__pyx_args, PyObject *__pyx_kwds
+#endif
+) {
+ CYTHON_UNUSED PyObject *__pyx_v___pyx_state = 0;
+ #if !CYTHON_METH_FASTCALL
+ CYTHON_UNUSED Py_ssize_t __pyx_nargs;
+ #endif
+ CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
+ PyObject* values[1] = {0};
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ PyObject *__pyx_r = 0;
+ __Pyx_RefNannyDeclarations
+ __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
+ #if !CYTHON_METH_FASTCALL
+ #if CYTHON_ASSUME_SAFE_MACROS
+ __pyx_nargs = PyTuple_GET_SIZE(__pyx_args);
+ #else
+ __pyx_nargs = PyTuple_Size(__pyx_args); if (unlikely(__pyx_nargs < 0)) return NULL;
+ #endif
+ #endif
+ __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs);
+ {
+ PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_state,0};
+ if (__pyx_kwds) {
+ Py_ssize_t kw_args;
+ switch (__pyx_nargs) {
+ case 1: values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
+ CYTHON_FALLTHROUGH;
+ case 0: break;
+ default: goto __pyx_L5_argtuple_error;
+ }
+ kw_args = __Pyx_NumKwargs_FASTCALL(__pyx_kwds);
+ switch (__pyx_nargs) {
+ case 0:
+ if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_pyx_state)) != 0)) {
+ (void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
+ kw_args--;
+ }
+ else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 3, __pyx_L3_error)
+ else goto __pyx_L5_argtuple_error;
+ }
+ if (unlikely(kw_args > 0)) {
+ const Py_ssize_t kwd_pos_args = __pyx_nargs;
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__setstate_cython__") < 0)) __PYX_ERR(0, 3, __pyx_L3_error)
+ }
+ } else if (unlikely(__pyx_nargs != 1)) {
+ goto __pyx_L5_argtuple_error;
+ } else {
+ values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0);
+ }
+ __pyx_v___pyx_state = values[0];
+ }
+ goto __pyx_L6_skip;
+ __pyx_L5_argtuple_error:;
+ __Pyx_RaiseArgtupleInvalid("__setstate_cython__", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 3, __pyx_L3_error)
+ __pyx_L6_skip:;
+ goto __pyx_L4_argument_unpacking_done;
+ __pyx_L3_error:;
+ {
+ Py_ssize_t __pyx_temp;
+ for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
+ __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
+ }
+ }
+ __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __Pyx_RefNannyFinishContext();
+ return NULL;
+ __pyx_L4_argument_unpacking_done:;
+ __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), __pyx_v___pyx_state);
+
+ /* function exit code */
+ {
+ Py_ssize_t __pyx_temp;
+ for (__pyx_temp=0; __pyx_temp < (Py_ssize_t)(sizeof(values)/sizeof(values[0])); ++__pyx_temp) {
+ __Pyx_Arg_XDECREF_FASTCALL(values[__pyx_temp]);
+ }
+ }
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("__setstate_cython__", 1);
+
+ /* "(tree fragment)":4
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ * def __setstate_cython__(self, __pyx_state):
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__" # <<<<<<<<<<<<<<
+ */
+ __Pyx_Raise(__pyx_builtin_TypeError, __pyx_kp_s_no_default___reduce___due_to_non, 0, 0);
+ __PYX_ERR(0, 4, __pyx_L1_error)
+
+ /* "(tree fragment)":3
+ * def __reduce_cython__(self):
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
+ * raise TypeError, "no default __reduce__ due to non-trivial __cinit__"
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":999
+ *
+ * @cname('__pyx_memoryview_fromslice')
+ * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<<
+ * int ndim,
+ * object (*to_object_func)(char *),
+ */
+
+static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) {
+ struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
+ Py_ssize_t __pyx_v_suboffset;
+ PyObject *__pyx_v_length = NULL;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ PyObject *__pyx_t_3 = NULL;
+ __Pyx_TypeInfo *__pyx_t_4;
+ Py_buffer __pyx_t_5;
+ Py_ssize_t *__pyx_t_6;
+ Py_ssize_t *__pyx_t_7;
+ Py_ssize_t *__pyx_t_8;
+ Py_ssize_t __pyx_t_9;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("memoryview_fromslice", 1);
+
+ /* "View.MemoryView":1007
+ * cdef _memoryviewslice result
+ *
+ * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<<
+ * return None
+ *
+ */
+ __pyx_t_1 = (((PyObject *)__pyx_v_memviewslice.memview) == Py_None);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":1008
+ *
+ * if memviewslice.memview == Py_None:
+ * return None # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+ goto __pyx_L0;
+
+ /* "View.MemoryView":1007
+ * cdef _memoryviewslice result
+ *
+ * if memviewslice.memview == Py_None: # <<<<<<<<<<<<<<
+ * return None
+ *
+ */
+ }
+
+ /* "View.MemoryView":1013
+ *
+ *
+ * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object) # <<<<<<<<<<<<<<
+ *
+ * result.from_slice = memviewslice
+ */
+ __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1013, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1013, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_INCREF(Py_None);
+ __Pyx_GIVEREF(Py_None);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None)) __PYX_ERR(0, 1013, __pyx_L1_error);
+ __Pyx_INCREF(__pyx_int_0);
+ __Pyx_GIVEREF(__pyx_int_0);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0)) __PYX_ERR(0, 1013, __pyx_L1_error);
+ __Pyx_GIVEREF(__pyx_t_2);
+ if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2)) __PYX_ERR(0, 1013, __pyx_L1_error);
+ __pyx_t_2 = 0;
+ __pyx_t_2 = ((PyObject *)__pyx_tp_new__memoryviewslice(((PyTypeObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1013, __pyx_L1_error)
+ __Pyx_GOTREF((PyObject *)__pyx_t_2);
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
+ __pyx_t_2 = 0;
+
+ /* "View.MemoryView":1015
+ * result = _memoryviewslice.__new__(_memoryviewslice, None, 0, dtype_is_object)
+ *
+ * result.from_slice = memviewslice # <<<<<<<<<<<<<<
+ * __PYX_INC_MEMVIEW(&memviewslice, 1)
+ *
+ */
+ __pyx_v_result->from_slice = __pyx_v_memviewslice;
+
+ /* "View.MemoryView":1016
+ *
+ * result.from_slice = memviewslice
+ * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<<
+ *
+ * result.from_object = ( memviewslice.memview)._get_base()
+ */
+ __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
+
+ /* "View.MemoryView":1018
+ * __PYX_INC_MEMVIEW(&memviewslice, 1)
+ *
+ * result.from_object = ( memviewslice.memview)._get_base() # <<<<<<<<<<<<<<
+ * result.typeinfo = memviewslice.memview.typeinfo
+ *
+ */
+ __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->__pyx_vtab)->_get_base(((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1018, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_GIVEREF(__pyx_t_2);
+ __Pyx_GOTREF(__pyx_v_result->from_object);
+ __Pyx_DECREF(__pyx_v_result->from_object);
+ __pyx_v_result->from_object = __pyx_t_2;
+ __pyx_t_2 = 0;
+
+ /* "View.MemoryView":1019
+ *
+ * result.from_object = ( memviewslice.memview)._get_base()
+ * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<<
+ *
+ * result.view = memviewslice.memview.view
+ */
+ __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
+ __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
+
+ /* "View.MemoryView":1021
+ * result.typeinfo = memviewslice.memview.typeinfo
+ *
+ * result.view = memviewslice.memview.view # <<<<<<<<<<<<<<
+ * result.view.buf = memviewslice.data
+ * result.view.ndim = ndim
+ */
+ __pyx_t_5 = __pyx_v_memviewslice.memview->view;
+ __pyx_v_result->__pyx_base.view = __pyx_t_5;
+
+ /* "View.MemoryView":1022
+ *
+ * result.view = memviewslice.memview.view
+ * result.view.buf = memviewslice.data # <<<<<<<<<<<<<<
+ * result.view.ndim = ndim
+ * (<__pyx_buffer *> &result.view).obj = Py_None
+ */
+ __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);
+
+ /* "View.MemoryView":1023
+ * result.view = memviewslice.memview.view
+ * result.view.buf = memviewslice.data
+ * result.view.ndim = ndim # <<<<<<<<<<<<<<
+ * (<__pyx_buffer *> &result.view).obj = Py_None
+ * Py_INCREF(Py_None)
+ */
+ __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
+
+ /* "View.MemoryView":1024
+ * result.view.buf = memviewslice.data
+ * result.view.ndim = ndim
+ * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<<
+ * Py_INCREF(Py_None)
+ *
+ */
+ ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
+
+ /* "View.MemoryView":1025
+ * result.view.ndim = ndim
+ * (<__pyx_buffer *> &result.view).obj = Py_None
+ * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
+ *
+ * if (memviewslice.memview).flags & PyBUF_WRITABLE:
+ */
+ Py_INCREF(Py_None);
+
+ /* "View.MemoryView":1027
+ * Py_INCREF(Py_None)
+ *
+ * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<<
+ * result.flags = PyBUF_RECORDS
+ * else:
+ */
+ __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":1028
+ *
+ * if (memviewslice.memview).flags & PyBUF_WRITABLE:
+ * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<<
+ * else:
+ * result.flags = PyBUF_RECORDS_RO
+ */
+ __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
+
+ /* "View.MemoryView":1027
+ * Py_INCREF(Py_None)
+ *
+ * if (memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<<
+ * result.flags = PyBUF_RECORDS
+ * else:
+ */
+ goto __pyx_L4;
+ }
+
+ /* "View.MemoryView":1030
+ * result.flags = PyBUF_RECORDS
+ * else:
+ * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<<
+ *
+ * result.view.shape = result.from_slice.shape
+ */
+ /*else*/ {
+ __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
+ }
+ __pyx_L4:;
+
+ /* "View.MemoryView":1032
+ * result.flags = PyBUF_RECORDS_RO
+ *
+ * result.view.shape = result.from_slice.shape # <<<<<<<<<<<<<<
+ * result.view.strides = result.from_slice.strides
+ *
+ */
+ __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
+
+ /* "View.MemoryView":1033
+ *
+ * result.view.shape = result.from_slice.shape
+ * result.view.strides = result.from_slice.strides # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
+
+ /* "View.MemoryView":1036
+ *
+ *
+ * result.view.suboffsets = NULL # <<<<<<<<<<<<<<
+ * for suboffset in result.from_slice.suboffsets[:ndim]:
+ * if suboffset >= 0:
+ */
+ __pyx_v_result->__pyx_base.view.suboffsets = NULL;
+
+ /* "View.MemoryView":1037
+ *
+ * result.view.suboffsets = NULL
+ * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<<
+ * if suboffset >= 0:
+ * result.view.suboffsets = result.from_slice.suboffsets
+ */
+ __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
+ for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
+ __pyx_t_6 = __pyx_t_8;
+ __pyx_v_suboffset = (__pyx_t_6[0]);
+
+ /* "View.MemoryView":1038
+ * result.view.suboffsets = NULL
+ * for suboffset in result.from_slice.suboffsets[:ndim]:
+ * if suboffset >= 0: # <<<<<<<<<<<<<<
+ * result.view.suboffsets = result.from_slice.suboffsets
+ * break
+ */
+ __pyx_t_1 = (__pyx_v_suboffset >= 0);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":1039
+ * for suboffset in result.from_slice.suboffsets[:ndim]:
+ * if suboffset >= 0:
+ * result.view.suboffsets = result.from_slice.suboffsets # <<<<<<<<<<<<<<
+ * break
+ *
+ */
+ __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
+
+ /* "View.MemoryView":1040
+ * if suboffset >= 0:
+ * result.view.suboffsets = result.from_slice.suboffsets
+ * break # <<<<<<<<<<<<<<
+ *
+ * result.view.len = result.view.itemsize
+ */
+ goto __pyx_L6_break;
+
+ /* "View.MemoryView":1038
+ * result.view.suboffsets = NULL
+ * for suboffset in result.from_slice.suboffsets[:ndim]:
+ * if suboffset >= 0: # <<<<<<<<<<<<<<
+ * result.view.suboffsets = result.from_slice.suboffsets
+ * break
+ */
+ }
+ }
+ __pyx_L6_break:;
+
+ /* "View.MemoryView":1042
+ * break
+ *
+ * result.view.len = result.view.itemsize # <<<<<<<<<<<<<<
+ * for length in result.view.shape[:ndim]:
+ * result.view.len *= length
+ */
+ __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
+ __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
+
+ /* "View.MemoryView":1043
+ *
+ * result.view.len = result.view.itemsize
+ * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<<
+ * result.view.len *= length
+ *
+ */
+ __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
+ for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
+ __pyx_t_6 = __pyx_t_8;
+ __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1043, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
+ __pyx_t_2 = 0;
+
+ /* "View.MemoryView":1044
+ * result.view.len = result.view.itemsize
+ * for length in result.view.shape[:ndim]:
+ * result.view.len *= length # <<<<<<<<<<<<<<
+ *
+ * result.to_object_func = to_object_func
+ */
+ __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1044, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_2);
+ __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1044, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_3);
+ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+ __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 1044, __pyx_L1_error)
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
+ }
+
+ /* "View.MemoryView":1046
+ * result.view.len *= length
+ *
+ * result.to_object_func = to_object_func # <<<<<<<<<<<<<<
+ * result.to_dtype_func = to_dtype_func
+ *
+ */
+ __pyx_v_result->to_object_func = __pyx_v_to_object_func;
+
+ /* "View.MemoryView":1047
+ *
+ * result.to_object_func = to_object_func
+ * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<<
+ *
+ * return result
+ */
+ __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
+
+ /* "View.MemoryView":1049
+ * result.to_dtype_func = to_dtype_func
+ *
+ * return result # <<<<<<<<<<<<<<
+ *
+ * @cname('__pyx_memoryview_get_slice_from_memoryview')
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __Pyx_INCREF((PyObject *)__pyx_v_result);
+ __pyx_r = ((PyObject *)__pyx_v_result);
+ goto __pyx_L0;
+
+ /* "View.MemoryView":999
+ *
+ * @cname('__pyx_memoryview_fromslice')
+ * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<<
+ * int ndim,
+ * object (*to_object_func)(char *),
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_XDECREF(__pyx_t_3);
+ __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XDECREF((PyObject *)__pyx_v_result);
+ __Pyx_XDECREF(__pyx_v_length);
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":1052
+ *
+ * @cname('__pyx_memoryview_get_slice_from_memoryview')
+ * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<<
+ * __Pyx_memviewslice *mslice) except NULL:
+ * cdef _memoryviewslice obj
+ */
+
+static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
+ struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
+ __Pyx_memviewslice *__pyx_r;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *__pyx_t_2 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("get_slice_from_memview", 1);
+
+ /* "View.MemoryView":1055
+ * __Pyx_memviewslice *mslice) except NULL:
+ * cdef _memoryviewslice obj
+ * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
+ * obj = memview
+ * return &obj.from_slice
+ */
+ __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":1056
+ * cdef _memoryviewslice obj
+ * if isinstance(memview, _memoryviewslice):
+ * obj = memview # <<<<<<<<<<<<<<
+ * return &obj.from_slice
+ * else:
+ */
+ if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(0, 1056, __pyx_L1_error)
+ __pyx_t_2 = ((PyObject *)__pyx_v_memview);
+ __Pyx_INCREF(__pyx_t_2);
+ __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
+ __pyx_t_2 = 0;
+
+ /* "View.MemoryView":1057
+ * if isinstance(memview, _memoryviewslice):
+ * obj = memview
+ * return &obj.from_slice # <<<<<<<<<<<<<<
+ * else:
+ * slice_copy(memview, mslice)
+ */
+ __pyx_r = (&__pyx_v_obj->from_slice);
+ goto __pyx_L0;
+
+ /* "View.MemoryView":1055
+ * __Pyx_memviewslice *mslice) except NULL:
+ * cdef _memoryviewslice obj
+ * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
+ * obj = memview
+ * return &obj.from_slice
+ */
+ }
+
+ /* "View.MemoryView":1059
+ * return &obj.from_slice
+ * else:
+ * slice_copy(memview, mslice) # <<<<<<<<<<<<<<
+ * return mslice
+ *
+ */
+ /*else*/ {
+ __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
+
+ /* "View.MemoryView":1060
+ * else:
+ * slice_copy(memview, mslice)
+ * return mslice # <<<<<<<<<<<<<<
+ *
+ * @cname('__pyx_memoryview_slice_copy')
+ */
+ __pyx_r = __pyx_v_mslice;
+ goto __pyx_L0;
+ }
+
+ /* "View.MemoryView":1052
+ *
+ * @cname('__pyx_memoryview_get_slice_from_memoryview')
+ * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<<
+ * __Pyx_memviewslice *mslice) except NULL:
+ * cdef _memoryviewslice obj
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_2);
+ __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ __pyx_L0:;
+ __Pyx_XDECREF((PyObject *)__pyx_v_obj);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":1063
+ *
+ * @cname('__pyx_memoryview_slice_copy')
+ * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: # <<<<<<<<<<<<<<
+ * cdef int dim
+ * cdef (Py_ssize_t*) shape, strides, suboffsets
+ */
+
+static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
+ int __pyx_v_dim;
+ Py_ssize_t *__pyx_v_shape;
+ Py_ssize_t *__pyx_v_strides;
+ Py_ssize_t *__pyx_v_suboffsets;
+ Py_ssize_t *__pyx_t_1;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ int __pyx_t_4;
+ Py_ssize_t __pyx_t_5;
+ int __pyx_t_6;
+
+ /* "View.MemoryView":1067
+ * cdef (Py_ssize_t*) shape, strides, suboffsets
+ *
+ * shape = memview.view.shape # <<<<<<<<<<<<<<
+ * strides = memview.view.strides
+ * suboffsets = memview.view.suboffsets
+ */
+ __pyx_t_1 = __pyx_v_memview->view.shape;
+ __pyx_v_shape = __pyx_t_1;
+
+ /* "View.MemoryView":1068
+ *
+ * shape = memview.view.shape
+ * strides = memview.view.strides # <<<<<<<<<<<<<<
+ * suboffsets = memview.view.suboffsets
+ *
+ */
+ __pyx_t_1 = __pyx_v_memview->view.strides;
+ __pyx_v_strides = __pyx_t_1;
+
+ /* "View.MemoryView":1069
+ * shape = memview.view.shape
+ * strides = memview.view.strides
+ * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<<
+ *
+ * dst.memview = <__pyx_memoryview *> memview
+ */
+ __pyx_t_1 = __pyx_v_memview->view.suboffsets;
+ __pyx_v_suboffsets = __pyx_t_1;
+
+ /* "View.MemoryView":1071
+ * suboffsets = memview.view.suboffsets
+ *
+ * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<<
+ * dst.data = memview.view.buf
+ *
+ */
+ __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);
+
+ /* "View.MemoryView":1072
+ *
+ * dst.memview = <__pyx_memoryview *> memview
+ * dst.data = memview.view.buf # <<<<<<<<<<<<<<
+ *
+ * for dim in range(memview.view.ndim):
+ */
+ __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);
+
+ /* "View.MemoryView":1074
+ * dst.data = memview.view.buf
+ *
+ * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<<
+ * dst.shape[dim] = shape[dim]
+ * dst.strides[dim] = strides[dim]
+ */
+ __pyx_t_2 = __pyx_v_memview->view.ndim;
+ __pyx_t_3 = __pyx_t_2;
+ for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
+ __pyx_v_dim = __pyx_t_4;
+
+ /* "View.MemoryView":1075
+ *
+ * for dim in range(memview.view.ndim):
+ * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<<
+ * dst.strides[dim] = strides[dim]
+ * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
+ */
+ (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
+
+ /* "View.MemoryView":1076
+ * for dim in range(memview.view.ndim):
+ * dst.shape[dim] = shape[dim]
+ * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<<
+ * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
+ *
+ */
+ (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
+
+ /* "View.MemoryView":1077
+ * dst.shape[dim] = shape[dim]
+ * dst.strides[dim] = strides[dim]
+ * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<<
+ *
+ * @cname('__pyx_memoryview_copy_object')
+ */
+ __pyx_t_6 = (__pyx_v_suboffsets != 0);
+ if (__pyx_t_6) {
+ __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
+ } else {
+ __pyx_t_5 = -1L;
+ }
+ (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
+ }
+
+ /* "View.MemoryView":1063
+ *
+ * @cname('__pyx_memoryview_slice_copy')
+ * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst) noexcept: # <<<<<<<<<<<<<<
+ * cdef int dim
+ * cdef (Py_ssize_t*) shape, strides, suboffsets
+ */
+
+ /* function exit code */
+}
+
+/* "View.MemoryView":1080
+ *
+ * @cname('__pyx_memoryview_copy_object')
+ * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<<
+ * "Create a new memoryview object"
+ * cdef __Pyx_memviewslice memviewslice
+ */
+
+static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
+ __Pyx_memviewslice __pyx_v_memviewslice;
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("memoryview_copy", 1);
+
+ /* "View.MemoryView":1083
+ * "Create a new memoryview object"
+ * cdef __Pyx_memviewslice memviewslice
+ * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<<
+ * return memoryview_copy_from_slice(memview, &memviewslice)
+ *
+ */
+ __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
+
+ /* "View.MemoryView":1084
+ * cdef __Pyx_memviewslice memviewslice
+ * slice_copy(memview, &memviewslice)
+ * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<<
+ *
+ * @cname('__pyx_memoryview_copy_object_from_slice')
+ */
+ __Pyx_XDECREF(__pyx_r);
+ __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1084, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_r = __pyx_t_1;
+ __pyx_t_1 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":1080
+ *
+ * @cname('__pyx_memoryview_copy_object')
+ * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<<
+ * "Create a new memoryview object"
+ * cdef __Pyx_memviewslice memviewslice
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":1087
+ *
+ * @cname('__pyx_memoryview_copy_object_from_slice')
+ * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<<
+ * """
+ * Create a new memoryview object from a given memoryview object and slice.
+ */
+
+static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
+ PyObject *(*__pyx_v_to_object_func)(char *);
+ int (*__pyx_v_to_dtype_func)(char *, PyObject *);
+ PyObject *__pyx_r = NULL;
+ __Pyx_RefNannyDeclarations
+ int __pyx_t_1;
+ PyObject *(*__pyx_t_2)(char *);
+ int (*__pyx_t_3)(char *, PyObject *);
+ PyObject *__pyx_t_4 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 1);
+
+ /* "View.MemoryView":1094
+ * cdef int (*to_dtype_func)(char *, object) except 0
+ *
+ * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
+ * to_object_func = (<_memoryviewslice> memview).to_object_func
+ * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
+ */
+ __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":1095
+ *
+ * if isinstance(memview, _memoryviewslice):
+ * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<<
+ * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
+ * else:
+ */
+ __pyx_t_2 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
+ __pyx_v_to_object_func = __pyx_t_2;
+
+ /* "View.MemoryView":1096
+ * if isinstance(memview, _memoryviewslice):
+ * to_object_func = (<_memoryviewslice> memview).to_object_func
+ * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<<
+ * else:
+ * to_object_func = NULL
+ */
+ __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
+ __pyx_v_to_dtype_func = __pyx_t_3;
+
+ /* "View.MemoryView":1094
+ * cdef int (*to_dtype_func)(char *, object) except 0
+ *
+ * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
+ * to_object_func = (<_memoryviewslice> memview).to_object_func
+ * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
+ */
+ goto __pyx_L3;
+ }
+
+ /* "View.MemoryView":1098
+ * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
+ * else:
+ * to_object_func = NULL # <<<<<<<<<<<<<<
+ * to_dtype_func = NULL
+ *
+ */
+ /*else*/ {
+ __pyx_v_to_object_func = NULL;
+
+ /* "View.MemoryView":1099
+ * else:
+ * to_object_func = NULL
+ * to_dtype_func = NULL # <<<<<<<<<<<<<<
+ *
+ * return memoryview_fromslice(memviewslice[0], memview.view.ndim,
+ */
+ __pyx_v_to_dtype_func = NULL;
+ }
+ __pyx_L3:;
+
+ /* "View.MemoryView":1101
+ * to_dtype_func = NULL
+ *
+ * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<<
+ * to_object_func, to_dtype_func,
+ * memview.dtype_is_object)
+ */
+ __Pyx_XDECREF(__pyx_r);
+
+ /* "View.MemoryView":1103
+ * return memoryview_fromslice(memviewslice[0], memview.view.ndim,
+ * to_object_func, to_dtype_func,
+ * memview.dtype_is_object) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_4 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1101, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_r = __pyx_t_4;
+ __pyx_t_4 = 0;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":1087
+ *
+ * @cname('__pyx_memoryview_copy_object_from_slice')
+ * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<<
+ * """
+ * Create a new memoryview object from a given memoryview object and slice.
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = 0;
+ __pyx_L0:;
+ __Pyx_XGIVEREF(__pyx_r);
+ __Pyx_RefNannyFinishContext();
+ return __pyx_r;
+}
+
+/* "View.MemoryView":1109
+ *
+ *
+ * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<<
+ * return -arg if arg < 0 else arg
+ *
+ */
+
+static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
+ Py_ssize_t __pyx_r;
+ Py_ssize_t __pyx_t_1;
+ int __pyx_t_2;
+
+ /* "View.MemoryView":1110
+ *
+ * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil:
+ * return -arg if arg < 0 else arg # <<<<<<<<<<<<<<
+ *
+ * @cname('__pyx_get_best_slice_order')
+ */
+ __pyx_t_2 = (__pyx_v_arg < 0);
+ if (__pyx_t_2) {
+ __pyx_t_1 = (-__pyx_v_arg);
+ } else {
+ __pyx_t_1 = __pyx_v_arg;
+ }
+ __pyx_r = __pyx_t_1;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":1109
+ *
+ *
+ * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) noexcept nogil: # <<<<<<<<<<<<<<
+ * return -arg if arg < 0 else arg
+ *
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ return __pyx_r;
+}
+
+/* "View.MemoryView":1113
+ *
+ * @cname('__pyx_get_best_slice_order')
+ * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: # <<<<<<<<<<<<<<
+ * """
+ * Figure out the best memory access order for a given slice.
+ */
+
+static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
+ int __pyx_v_i;
+ Py_ssize_t __pyx_v_c_stride;
+ Py_ssize_t __pyx_v_f_stride;
+ char __pyx_r;
+ int __pyx_t_1;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ int __pyx_t_4;
+
+ /* "View.MemoryView":1118
+ * """
+ * cdef int i
+ * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<<
+ * cdef Py_ssize_t f_stride = 0
+ *
+ */
+ __pyx_v_c_stride = 0;
+
+ /* "View.MemoryView":1119
+ * cdef int i
+ * cdef Py_ssize_t c_stride = 0
+ * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<<
+ *
+ * for i in range(ndim - 1, -1, -1):
+ */
+ __pyx_v_f_stride = 0;
+
+ /* "View.MemoryView":1121
+ * cdef Py_ssize_t f_stride = 0
+ *
+ * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
+ * if mslice.shape[i] > 1:
+ * c_stride = mslice.strides[i]
+ */
+ for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
+ __pyx_v_i = __pyx_t_1;
+
+ /* "View.MemoryView":1122
+ *
+ * for i in range(ndim - 1, -1, -1):
+ * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
+ * c_stride = mslice.strides[i]
+ * break
+ */
+ __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":1123
+ * for i in range(ndim - 1, -1, -1):
+ * if mslice.shape[i] > 1:
+ * c_stride = mslice.strides[i] # <<<<<<<<<<<<<<
+ * break
+ *
+ */
+ __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
+
+ /* "View.MemoryView":1124
+ * if mslice.shape[i] > 1:
+ * c_stride = mslice.strides[i]
+ * break # <<<<<<<<<<<<<<
+ *
+ * for i in range(ndim):
+ */
+ goto __pyx_L4_break;
+
+ /* "View.MemoryView":1122
+ *
+ * for i in range(ndim - 1, -1, -1):
+ * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
+ * c_stride = mslice.strides[i]
+ * break
+ */
+ }
+ }
+ __pyx_L4_break:;
+
+ /* "View.MemoryView":1126
+ * break
+ *
+ * for i in range(ndim): # <<<<<<<<<<<<<<
+ * if mslice.shape[i] > 1:
+ * f_stride = mslice.strides[i]
+ */
+ __pyx_t_1 = __pyx_v_ndim;
+ __pyx_t_3 = __pyx_t_1;
+ for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
+ __pyx_v_i = __pyx_t_4;
+
+ /* "View.MemoryView":1127
+ *
+ * for i in range(ndim):
+ * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
+ * f_stride = mslice.strides[i]
+ * break
+ */
+ __pyx_t_2 = ((__pyx_v_mslice->shape[__pyx_v_i]) > 1);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":1128
+ * for i in range(ndim):
+ * if mslice.shape[i] > 1:
+ * f_stride = mslice.strides[i] # <<<<<<<<<<<<<<
+ * break
+ *
+ */
+ __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
+
+ /* "View.MemoryView":1129
+ * if mslice.shape[i] > 1:
+ * f_stride = mslice.strides[i]
+ * break # <<<<<<<<<<<<<<
+ *
+ * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
+ */
+ goto __pyx_L7_break;
+
+ /* "View.MemoryView":1127
+ *
+ * for i in range(ndim):
+ * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
+ * f_stride = mslice.strides[i]
+ * break
+ */
+ }
+ }
+ __pyx_L7_break:;
+
+ /* "View.MemoryView":1131
+ * break
+ *
+ * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<<
+ * return 'C'
+ * else:
+ */
+ __pyx_t_2 = (abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride));
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":1132
+ *
+ * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
+ * return 'C' # <<<<<<<<<<<<<<
+ * else:
+ * return 'F'
+ */
+ __pyx_r = 'C';
+ goto __pyx_L0;
+
+ /* "View.MemoryView":1131
+ * break
+ *
+ * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<<
+ * return 'C'
+ * else:
+ */
+ }
+
+ /* "View.MemoryView":1134
+ * return 'C'
+ * else:
+ * return 'F' # <<<<<<<<<<<<<<
+ *
+ * @cython.cdivision(True)
+ */
+ /*else*/ {
+ __pyx_r = 'F';
+ goto __pyx_L0;
+ }
+
+ /* "View.MemoryView":1113
+ *
+ * @cname('__pyx_get_best_slice_order')
+ * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) noexcept nogil: # <<<<<<<<<<<<<<
+ * """
+ * Figure out the best memory access order for a given slice.
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ return __pyx_r;
+}
+
+/* "View.MemoryView":1137
+ *
+ * @cython.cdivision(True)
+ * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<<
+ * char *dst_data, Py_ssize_t *dst_strides,
+ * Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
+ */
+
+static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
+ CYTHON_UNUSED Py_ssize_t __pyx_v_i;
+ CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
+ Py_ssize_t __pyx_v_dst_extent;
+ Py_ssize_t __pyx_v_src_stride;
+ Py_ssize_t __pyx_v_dst_stride;
+ int __pyx_t_1;
+ int __pyx_t_2;
+ Py_ssize_t __pyx_t_3;
+ Py_ssize_t __pyx_t_4;
+ Py_ssize_t __pyx_t_5;
+
+ /* "View.MemoryView":1144
+ *
+ * cdef Py_ssize_t i
+ * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<<
+ * cdef Py_ssize_t dst_extent = dst_shape[0]
+ * cdef Py_ssize_t src_stride = src_strides[0]
+ */
+ __pyx_v_src_extent = (__pyx_v_src_shape[0]);
+
+ /* "View.MemoryView":1145
+ * cdef Py_ssize_t i
+ * cdef Py_ssize_t src_extent = src_shape[0]
+ * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<<
+ * cdef Py_ssize_t src_stride = src_strides[0]
+ * cdef Py_ssize_t dst_stride = dst_strides[0]
+ */
+ __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
+
+ /* "View.MemoryView":1146
+ * cdef Py_ssize_t src_extent = src_shape[0]
+ * cdef Py_ssize_t dst_extent = dst_shape[0]
+ * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<<
+ * cdef Py_ssize_t dst_stride = dst_strides[0]
+ *
+ */
+ __pyx_v_src_stride = (__pyx_v_src_strides[0]);
+
+ /* "View.MemoryView":1147
+ * cdef Py_ssize_t dst_extent = dst_shape[0]
+ * cdef Py_ssize_t src_stride = src_strides[0]
+ * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<<
+ *
+ * if ndim == 1:
+ */
+ __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
+
+ /* "View.MemoryView":1149
+ * cdef Py_ssize_t dst_stride = dst_strides[0]
+ *
+ * if ndim == 1: # <<<<<<<<<<<<<<
+ * if (src_stride > 0 and dst_stride > 0 and
+ * src_stride == itemsize == dst_stride):
+ */
+ __pyx_t_1 = (__pyx_v_ndim == 1);
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":1150
+ *
+ * if ndim == 1:
+ * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
+ * src_stride == itemsize == dst_stride):
+ * memcpy(dst_data, src_data, itemsize * dst_extent)
+ */
+ __pyx_t_2 = (__pyx_v_src_stride > 0);
+ if (__pyx_t_2) {
+ } else {
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L5_bool_binop_done;
+ }
+ __pyx_t_2 = (__pyx_v_dst_stride > 0);
+ if (__pyx_t_2) {
+ } else {
+ __pyx_t_1 = __pyx_t_2;
+ goto __pyx_L5_bool_binop_done;
+ }
+
+ /* "View.MemoryView":1151
+ * if ndim == 1:
+ * if (src_stride > 0 and dst_stride > 0 and
+ * src_stride == itemsize == dst_stride): # <<<<<<<<<<<<<<
+ * memcpy(dst_data, src_data, itemsize * dst_extent)
+ * else:
+ */
+ __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
+ if (__pyx_t_2) {
+ __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
+ }
+ __pyx_t_1 = __pyx_t_2;
+ __pyx_L5_bool_binop_done:;
+
+ /* "View.MemoryView":1150
+ *
+ * if ndim == 1:
+ * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
+ * src_stride == itemsize == dst_stride):
+ * memcpy(dst_data, src_data, itemsize * dst_extent)
+ */
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":1152
+ * if (src_stride > 0 and dst_stride > 0 and
+ * src_stride == itemsize == dst_stride):
+ * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<<
+ * else:
+ * for i in range(dst_extent):
+ */
+ (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
+
+ /* "View.MemoryView":1150
+ *
+ * if ndim == 1:
+ * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
+ * src_stride == itemsize == dst_stride):
+ * memcpy(dst_data, src_data, itemsize * dst_extent)
+ */
+ goto __pyx_L4;
+ }
+
+ /* "View.MemoryView":1154
+ * memcpy(dst_data, src_data, itemsize * dst_extent)
+ * else:
+ * for i in range(dst_extent): # <<<<<<<<<<<<<<
+ * memcpy(dst_data, src_data, itemsize)
+ * src_data += src_stride
+ */
+ /*else*/ {
+ __pyx_t_3 = __pyx_v_dst_extent;
+ __pyx_t_4 = __pyx_t_3;
+ for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
+ __pyx_v_i = __pyx_t_5;
+
+ /* "View.MemoryView":1155
+ * else:
+ * for i in range(dst_extent):
+ * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<<
+ * src_data += src_stride
+ * dst_data += dst_stride
+ */
+ (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
+
+ /* "View.MemoryView":1156
+ * for i in range(dst_extent):
+ * memcpy(dst_data, src_data, itemsize)
+ * src_data += src_stride # <<<<<<<<<<<<<<
+ * dst_data += dst_stride
+ * else:
+ */
+ __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
+
+ /* "View.MemoryView":1157
+ * memcpy(dst_data, src_data, itemsize)
+ * src_data += src_stride
+ * dst_data += dst_stride # <<<<<<<<<<<<<<
+ * else:
+ * for i in range(dst_extent):
+ */
+ __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
+ }
+ }
+ __pyx_L4:;
+
+ /* "View.MemoryView":1149
+ * cdef Py_ssize_t dst_stride = dst_strides[0]
+ *
+ * if ndim == 1: # <<<<<<<<<<<<<<
+ * if (src_stride > 0 and dst_stride > 0 and
+ * src_stride == itemsize == dst_stride):
+ */
+ goto __pyx_L3;
+ }
+
+ /* "View.MemoryView":1159
+ * dst_data += dst_stride
+ * else:
+ * for i in range(dst_extent): # <<<<<<<<<<<<<<
+ * _copy_strided_to_strided(src_data, src_strides + 1,
+ * dst_data, dst_strides + 1,
+ */
+ /*else*/ {
+ __pyx_t_3 = __pyx_v_dst_extent;
+ __pyx_t_4 = __pyx_t_3;
+ for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
+ __pyx_v_i = __pyx_t_5;
+
+ /* "View.MemoryView":1160
+ * else:
+ * for i in range(dst_extent):
+ * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<<
+ * dst_data, dst_strides + 1,
+ * src_shape + 1, dst_shape + 1,
+ */
+ _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize);
+
+ /* "View.MemoryView":1164
+ * src_shape + 1, dst_shape + 1,
+ * ndim - 1, itemsize)
+ * src_data += src_stride # <<<<<<<<<<<<<<
+ * dst_data += dst_stride
+ *
+ */
+ __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
+
+ /* "View.MemoryView":1165
+ * ndim - 1, itemsize)
+ * src_data += src_stride
+ * dst_data += dst_stride # <<<<<<<<<<<<<<
+ *
+ * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
+ */
+ __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
+ }
+ }
+ __pyx_L3:;
+
+ /* "View.MemoryView":1137
+ *
+ * @cython.cdivision(True)
+ * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<<
+ * char *dst_data, Py_ssize_t *dst_strides,
+ * Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
+ */
+
+ /* function exit code */
+}
+
+/* "View.MemoryView":1167
+ * dst_data += dst_stride
+ *
+ * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
+ * __Pyx_memviewslice *dst,
+ * int ndim, size_t itemsize) noexcept nogil:
+ */
+
+static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
+
+ /* "View.MemoryView":1170
+ * __Pyx_memviewslice *dst,
+ * int ndim, size_t itemsize) noexcept nogil:
+ * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<<
+ * src.shape, dst.shape, ndim, itemsize)
+ *
+ */
+ _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize);
+
+ /* "View.MemoryView":1167
+ * dst_data += dst_stride
+ *
+ * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
+ * __Pyx_memviewslice *dst,
+ * int ndim, size_t itemsize) noexcept nogil:
+ */
+
+ /* function exit code */
+}
+
+/* "View.MemoryView":1174
+ *
+ * @cname('__pyx_memoryview_slice_get_size')
+ * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: # <<<<<<<<<<<<<<
+ * "Return the size of the memory occupied by the slice in number of bytes"
+ * cdef Py_ssize_t shape, size = src.memview.view.itemsize
+ */
+
+static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
+ Py_ssize_t __pyx_v_shape;
+ Py_ssize_t __pyx_v_size;
+ Py_ssize_t __pyx_r;
+ Py_ssize_t __pyx_t_1;
+ Py_ssize_t *__pyx_t_2;
+ Py_ssize_t *__pyx_t_3;
+ Py_ssize_t *__pyx_t_4;
+
+ /* "View.MemoryView":1176
+ * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil:
+ * "Return the size of the memory occupied by the slice in number of bytes"
+ * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<<
+ *
+ * for shape in src.shape[:ndim]:
+ */
+ __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
+ __pyx_v_size = __pyx_t_1;
+
+ /* "View.MemoryView":1178
+ * cdef Py_ssize_t shape, size = src.memview.view.itemsize
+ *
+ * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<<
+ * size *= shape
+ *
+ */
+ __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
+ for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
+ __pyx_t_2 = __pyx_t_4;
+ __pyx_v_shape = (__pyx_t_2[0]);
+
+ /* "View.MemoryView":1179
+ *
+ * for shape in src.shape[:ndim]:
+ * size *= shape # <<<<<<<<<<<<<<
+ *
+ * return size
+ */
+ __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
+ }
+
+ /* "View.MemoryView":1181
+ * size *= shape
+ *
+ * return size # <<<<<<<<<<<<<<
+ *
+ * @cname('__pyx_fill_contig_strides_array')
+ */
+ __pyx_r = __pyx_v_size;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":1174
+ *
+ * @cname('__pyx_memoryview_slice_get_size')
+ * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) noexcept nogil: # <<<<<<<<<<<<<<
+ * "Return the size of the memory occupied by the slice in number of bytes"
+ * cdef Py_ssize_t shape, size = src.memview.view.itemsize
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ return __pyx_r;
+}
+
+/* "View.MemoryView":1184
+ *
+ * @cname('__pyx_fill_contig_strides_array')
+ * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<<
+ * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
+ * int ndim, char order) noexcept nogil:
+ */
+
+static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) {
+ int __pyx_v_idx;
+ Py_ssize_t __pyx_r;
+ int __pyx_t_1;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ int __pyx_t_4;
+
+ /* "View.MemoryView":1193
+ * cdef int idx
+ *
+ * if order == 'F': # <<<<<<<<<<<<<<
+ * for idx in range(ndim):
+ * strides[idx] = stride
+ */
+ __pyx_t_1 = (__pyx_v_order == 'F');
+ if (__pyx_t_1) {
+
+ /* "View.MemoryView":1194
+ *
+ * if order == 'F':
+ * for idx in range(ndim): # <<<<<<<<<<<<<<
+ * strides[idx] = stride
+ * stride *= shape[idx]
+ */
+ __pyx_t_2 = __pyx_v_ndim;
+ __pyx_t_3 = __pyx_t_2;
+ for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
+ __pyx_v_idx = __pyx_t_4;
+
+ /* "View.MemoryView":1195
+ * if order == 'F':
+ * for idx in range(ndim):
+ * strides[idx] = stride # <<<<<<<<<<<<<<
+ * stride *= shape[idx]
+ * else:
+ */
+ (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
+
+ /* "View.MemoryView":1196
+ * for idx in range(ndim):
+ * strides[idx] = stride
+ * stride *= shape[idx] # <<<<<<<<<<<<<<
+ * else:
+ * for idx in range(ndim - 1, -1, -1):
+ */
+ __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
+ }
+
+ /* "View.MemoryView":1193
+ * cdef int idx
+ *
+ * if order == 'F': # <<<<<<<<<<<<<<
+ * for idx in range(ndim):
+ * strides[idx] = stride
+ */
+ goto __pyx_L3;
+ }
+
+ /* "View.MemoryView":1198
+ * stride *= shape[idx]
+ * else:
+ * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
+ * strides[idx] = stride
+ * stride *= shape[idx]
+ */
+ /*else*/ {
+ for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
+ __pyx_v_idx = __pyx_t_2;
+
+ /* "View.MemoryView":1199
+ * else:
+ * for idx in range(ndim - 1, -1, -1):
+ * strides[idx] = stride # <<<<<<<<<<<<<<
+ * stride *= shape[idx]
+ *
+ */
+ (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
+
+ /* "View.MemoryView":1200
+ * for idx in range(ndim - 1, -1, -1):
+ * strides[idx] = stride
+ * stride *= shape[idx] # <<<<<<<<<<<<<<
+ *
+ * return stride
+ */
+ __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
+ }
+ }
+ __pyx_L3:;
+
+ /* "View.MemoryView":1202
+ * stride *= shape[idx]
+ *
+ * return stride # <<<<<<<<<<<<<<
+ *
+ * @cname('__pyx_memoryview_copy_data_to_temp')
+ */
+ __pyx_r = __pyx_v_stride;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":1184
+ *
+ * @cname('__pyx_fill_contig_strides_array')
+ * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<<
+ * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
+ * int ndim, char order) noexcept nogil:
+ */
+
+ /* function exit code */
+ __pyx_L0:;
+ return __pyx_r;
+}
+
+/* "View.MemoryView":1205
+ *
+ * @cname('__pyx_memoryview_copy_data_to_temp')
+ * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
+ * __Pyx_memviewslice *tmpslice,
+ * char order,
+ */
+
+static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) {
+ int __pyx_v_i;
+ void *__pyx_v_result;
+ size_t __pyx_v_itemsize;
+ size_t __pyx_v_size;
+ void *__pyx_r;
+ Py_ssize_t __pyx_t_1;
+ int __pyx_t_2;
+ int __pyx_t_3;
+ struct __pyx_memoryview_obj *__pyx_t_4;
+ int __pyx_t_5;
+ int __pyx_t_6;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ #ifdef WITH_THREAD
+ PyGILState_STATE __pyx_gilstate_save;
+ #endif
+
+ /* "View.MemoryView":1216
+ * cdef void *result
+ *
+ * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<<
+ * cdef size_t size = slice_get_size(src, ndim)
+ *
+ */
+ __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
+ __pyx_v_itemsize = __pyx_t_1;
+
+ /* "View.MemoryView":1217
+ *
+ * cdef size_t itemsize = src.memview.view.itemsize
+ * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<<
+ *
+ * result = malloc(size)
+ */
+ __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
+
+ /* "View.MemoryView":1219
+ * cdef size_t size = slice_get_size(src, ndim)
+ *
+ * result = malloc(size) # <<<<<<<<<<<<<<
+ * if not result:
+ * _err_no_memory()
+ */
+ __pyx_v_result = malloc(__pyx_v_size);
+
+ /* "View.MemoryView":1220
+ *
+ * result = malloc(size)
+ * if not result: # <<<<<<<<<<<<<<
+ * _err_no_memory()
+ *
+ */
+ __pyx_t_2 = (!(__pyx_v_result != 0));
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":1221
+ * result = malloc(size)
+ * if not result:
+ * _err_no_memory() # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_t_3 = __pyx_memoryview_err_no_memory(); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(0, 1221, __pyx_L1_error)
+
+ /* "View.MemoryView":1220
+ *
+ * result = malloc(size)
+ * if not result: # <<<<<<<<<<<<<<
+ * _err_no_memory()
+ *
+ */
+ }
+
+ /* "View.MemoryView":1224
+ *
+ *
+ * tmpslice.data = result # <<<<<<<<<<<<<<
+ * tmpslice.memview = src.memview
+ * for i in range(ndim):
+ */
+ __pyx_v_tmpslice->data = ((char *)__pyx_v_result);
+
+ /* "View.MemoryView":1225
+ *
+ * tmpslice.data = result
+ * tmpslice.memview = src.memview # <<<<<<<<<<<<<<
+ * for i in range(ndim):
+ * tmpslice.shape[i] = src.shape[i]
+ */
+ __pyx_t_4 = __pyx_v_src->memview;
+ __pyx_v_tmpslice->memview = __pyx_t_4;
+
+ /* "View.MemoryView":1226
+ * tmpslice.data = result
+ * tmpslice.memview = src.memview
+ * for i in range(ndim): # <<<<<<<<<<<<<<
+ * tmpslice.shape[i] = src.shape[i]
+ * tmpslice.suboffsets[i] = -1
+ */
+ __pyx_t_3 = __pyx_v_ndim;
+ __pyx_t_5 = __pyx_t_3;
+ for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
+ __pyx_v_i = __pyx_t_6;
+
+ /* "View.MemoryView":1227
+ * tmpslice.memview = src.memview
+ * for i in range(ndim):
+ * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<<
+ * tmpslice.suboffsets[i] = -1
+ *
+ */
+ (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
+
+ /* "View.MemoryView":1228
+ * for i in range(ndim):
+ * tmpslice.shape[i] = src.shape[i]
+ * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<<
+ *
+ * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order)
+ */
+ (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
+ }
+
+ /* "View.MemoryView":1230
+ * tmpslice.suboffsets[i] = -1
+ *
+ * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, ndim, order) # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order));
+
+ /* "View.MemoryView":1233
+ *
+ *
+ * for i in range(ndim): # <<<<<<<<<<<<<<
+ * if tmpslice.shape[i] == 1:
+ * tmpslice.strides[i] = 0
+ */
+ __pyx_t_3 = __pyx_v_ndim;
+ __pyx_t_5 = __pyx_t_3;
+ for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
+ __pyx_v_i = __pyx_t_6;
+
+ /* "View.MemoryView":1234
+ *
+ * for i in range(ndim):
+ * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<<
+ * tmpslice.strides[i] = 0
+ *
+ */
+ __pyx_t_2 = ((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":1235
+ * for i in range(ndim):
+ * if tmpslice.shape[i] == 1:
+ * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<<
+ *
+ * if slice_is_contig(src[0], order, ndim):
+ */
+ (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
+
+ /* "View.MemoryView":1234
+ *
+ * for i in range(ndim):
+ * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<<
+ * tmpslice.strides[i] = 0
+ *
+ */
+ }
+ }
+
+ /* "View.MemoryView":1237
+ * tmpslice.strides[i] = 0
+ *
+ * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<<
+ * memcpy(result, src.data, size)
+ * else:
+ */
+ __pyx_t_2 = __pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim);
+ if (__pyx_t_2) {
+
+ /* "View.MemoryView":1238
+ *
+ * if slice_is_contig(src[0], order, ndim):
+ * memcpy(result, src.data, size) # <<<<<<<<<<<<<<
+ * else:
+ * copy_strided_to_strided(src, tmpslice, ndim, itemsize)
+ */
+ (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
+
+ /* "View.MemoryView":1237
+ * tmpslice.strides[i] = 0
+ *
+ * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<<
+ * memcpy(result, src.data, size)
+ * else:
+ */
+ goto __pyx_L9;
+ }
+
+ /* "View.MemoryView":1240
+ * memcpy(result, src.data, size)
+ * else:
+ * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<<
+ *
+ * return result
+ */
+ /*else*/ {
+ copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
+ }
+ __pyx_L9:;
+
+ /* "View.MemoryView":1242
+ * copy_strided_to_strided(src, tmpslice, ndim, itemsize)
+ *
+ * return result # <<<<<<<<<<<<<<
+ *
+ *
+ */
+ __pyx_r = __pyx_v_result;
+ goto __pyx_L0;
+
+ /* "View.MemoryView":1205
+ *
+ * @cname('__pyx_memoryview_copy_data_to_temp')
+ * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
+ * __Pyx_memviewslice *tmpslice,
+ * char order,
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ #ifdef WITH_THREAD
+ __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
+ #endif
+ __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = NULL;
+ #ifdef WITH_THREAD
+ __Pyx_PyGILState_Release(__pyx_gilstate_save);
+ #endif
+ __pyx_L0:;
+ return __pyx_r;
+}
+
+/* "View.MemoryView":1247
+ *
+ * @cname('__pyx_memoryview_err_extents')
+ * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<<
+ * Py_ssize_t extent2) except -1 with gil:
+ * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})"
+ */
+
+static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
+ int __pyx_r;
+ __Pyx_RefNannyDeclarations
+ PyObject *__pyx_t_1 = NULL;
+ Py_ssize_t __pyx_t_2;
+ Py_UCS4 __pyx_t_3;
+ PyObject *__pyx_t_4 = NULL;
+ int __pyx_lineno = 0;
+ const char *__pyx_filename = NULL;
+ int __pyx_clineno = 0;
+ #ifdef WITH_THREAD
+ PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
+ #endif
+ __Pyx_RefNannySetupContext("_err_extents", 0);
+
+ /* "View.MemoryView":1249
+ * cdef int _err_extents(int i, Py_ssize_t extent1,
+ * Py_ssize_t extent2) except -1 with gil:
+ * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})" # <<<<<<<<<<<<<<
+ *
+ * @cname('__pyx_memoryview_err_dim')
+ */
+ __pyx_t_1 = PyTuple_New(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1249, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_1);
+ __pyx_t_2 = 0;
+ __pyx_t_3 = 127;
+ __Pyx_INCREF(__pyx_kp_u_got_differing_extents_in_dimensi);
+ __pyx_t_2 += 35;
+ __Pyx_GIVEREF(__pyx_kp_u_got_differing_extents_in_dimensi);
+ PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_u_got_differing_extents_in_dimensi);
+ __pyx_t_4 = __Pyx_PyUnicode_From_int(__pyx_v_i, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1249, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4);
+ __pyx_t_4 = 0;
+ __Pyx_INCREF(__pyx_kp_u_got);
+ __pyx_t_2 += 6;
+ __Pyx_GIVEREF(__pyx_kp_u_got);
+ PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_kp_u_got);
+ __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent1, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1249, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4);
+ __pyx_t_4 = 0;
+ __Pyx_INCREF(__pyx_kp_u_and);
+ __pyx_t_2 += 5;
+ __Pyx_GIVEREF(__pyx_kp_u_and);
+ PyTuple_SET_ITEM(__pyx_t_1, 4, __pyx_kp_u_and);
+ __pyx_t_4 = __Pyx_PyUnicode_From_Py_ssize_t(__pyx_v_extent2, 0, ' ', 'd'); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1249, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_2 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_4);
+ __Pyx_GIVEREF(__pyx_t_4);
+ PyTuple_SET_ITEM(__pyx_t_1, 5, __pyx_t_4);
+ __pyx_t_4 = 0;
+ __Pyx_INCREF(__pyx_kp_u__7);
+ __pyx_t_2 += 1;
+ __Pyx_GIVEREF(__pyx_kp_u__7);
+ PyTuple_SET_ITEM(__pyx_t_1, 6, __pyx_kp_u__7);
+ __pyx_t_4 = __Pyx_PyUnicode_Join(__pyx_t_1, 7, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1249, __pyx_L1_error)
+ __Pyx_GOTREF(__pyx_t_4);
+ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+ __Pyx_Raise(__pyx_builtin_ValueError, __pyx_t_4, 0, 0);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __PYX_ERR(0, 1249, __pyx_L1_error)
+
+ /* "View.MemoryView":1247
+ *
+ * @cname('__pyx_memoryview_err_extents')
+ * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<<
+ * Py_ssize_t extent2) except -1 with gil:
+ * raise ValueError, f"got differing extents in dimension {i} (got {extent1} and {extent2})"
+ */
+
+ /* function exit code */
+ __pyx_L1_error:;
+ __Pyx_XDECREF(__pyx_t_1);
+ __Pyx_XDECREF(__pyx_t_4);
+ __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
+ __pyx_r = -1;
+ __Pyx_RefNannyFinishContext();
+ #ifdef WITH_THREAD
+ __Pyx_PyGILState_Release(__pyx_gilstate_save);
+ #endif
+ return __pyx_r;
+}
+
+/* "View.MemoryView":1252
+ *
+ * @cname('__pyx_memoryview_err_dim')
+ * cdef int _err_dim(PyObject *error, str msg, int dim) except -1 with gil: # <<<<<<<<<<<<<<
+ * raise