Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Ioniq5 pe with sync #70

Draft
wants to merge 131 commits into
base: master-new
Choose a base branch
from
Draft

WIP Ioniq5 pe with sync #70

wants to merge 131 commits into from

Conversation

devtekve
Copy link

@devtekve devtekve commented Mar 1, 2025

Requires #68

Summary by Sourcery

Adds support for angle-based steering control for Hyundai CAN-FD vehicles, specifically the Ioniq 5 PE and Kia EV9. This includes new safety checks, parameter adjustments, and message creation logic to handle angle-based commands instead of torque-based commands. Also updates the car fingerprint to include the Ioniq 5 PE.

New Features:

  • Adds angle-based steering control for Hyundai CAN-FD vehicles.
  • Adds support for Ioniq 5 PE and Kia EV9.

Tests:

  • Adds tests for angle-based steering control.

Replaced KIA_EV9 entry with HYUNDAI_IONIQ_5_PE in the torque override configuration. Adjusted the values to align with the updated specifications for this model.
Revised the angle_rate_up_lookup and angle_rate_down_lookup tables to include more detailed points. This enhances the granularity and accuracy of angle rate calculations for safer and smoother operation.
Reduced the number of lookup table points for steering angle rate up and down in Hyundai CAN FD safety. This change simplifies the implementation while preserving the intended functionality and behavior."
Added a new test route for the Hyundai Ioniq 5 PE with LKA steering, HDA2, and LFA2. Also removed the test route for the Kia EV9 as it is no longer needed. These changes ensure the test routes remain relevant and up-to-date.
@devtekve devtekve force-pushed the ioniq5-pe-with-sync branch from a940844 to 14c662e Compare March 23, 2025 09:54
Simplified the lookup tables for angle rates and adjusted values for smoother steering transitions. These changes aim to optimize control behavior and improve system performance.
Introduced dynamic torque scaling based on curvature for smoother and more adaptive steering control. Replaced raw curvature inputs with filtered curvature for enhanced stability and reduced noise in steering angle calculations. Removed unused speed scaling logic to simplify the lateral control flow.
Updated curvature breakpoints in Hyundai carcontroller to improve torque scaling for curved driving. Slightly refined the filter coefficient in lateral control for smoother curvature filtering and more accurate steering adjustments.
Updated curvature breakpoints and torque scaling for improved control in sharp turns. Increased filter alpha for faster curvature response while maintaining system stability.
Revised steering angle limit parameters to refine control dynamics. Adjusted breakpoints and scaling factors to better align with real-world handling and ensure smoother operation. Removed previous values by commenting them out for reference.
Updated curvature breakpoints and corresponding torque values for finer control. This enhances steering behavior, especially during moderate to high curvature scenarios.
Updated steering angle rate lookup tables and thresholds in safety and vehicle values to optimize control responsiveness. These changes refine rate transitions for better alignment with system expectations.
Introduced a speed-dependent multiplier for torque scaling to improve steering control based on vehicle speed. This adjustment interpolates torque values more dynamically, ensuring better handling and responsiveness at varying speeds.
Introduced `intended_angle` for better readability and clarity in the steering angle calculation process. This change improves maintainability while preserving existing functionality. Applied smoothing now uses the newly defined `intended_angle`.

Add HKG angle smoothing factor for steering adjustments

Introduced a new parameter, `HkgTuningAngleSmoothingFactor`, to apply exponential moving average (EMA) smoothing to steering angle changes, reducing sudden adjustments. Added associated UI controls, parameter persistence, and integration into Hyundai carcontroller logic for improved steering stability.
@devtekve devtekve force-pushed the ioniq5-pe-with-sync branch from c74f44f to 3460ff4 Compare April 3, 2025 21:07
devtekve added 14 commits April 3, 2025 23:31
Refactored the calculation and application of the steering angle to improve code clarity and ensure smoother transitions. Removed unused parameter update logic in `latcontrol_angle.py` and enhanced handling of driver overrides in `carcontroller.py`.
# Conflicts:
#	opendbc/safety/safety/safety_hyundai_canfd.h
#	opendbc/safety/tests/test_hyundai_canfd.py
Reorganized torque computation logic to improve readability and maintainability. Consolidated curvature breakpoints and base torque values into parameters, ensuring consistency and flexibility. Adjusted speed multiplier and torque scaling for smoother control and better tuning.
Introduce separate angle tuning controls for HKG vehicles, including smoothing factor, min torque, and max torque parameters. Refactor developer panel to integrate the new settings into a dedicated UI panel, enhancing modularity and customization capabilities.
Introduced "HkgTuningOverridingCycles" for configurable user override torque ramp-down cycles. Updated relevant logic in torque control and UI settings to handle the new parameter. This improves flexibility in adjusting steering torque override behavior.
Updated `BASE_TORQUE_VALUES` to refine torque application across curvature ranges. This change aims to enhance steering precision and overall vehicle handling.
Replaced hardcoded torque percentages with dynamic computation based on curvature and speed. Moved speed multiplier and torque values into the main controller for better flexibility and tuning. Removed redundant `BASE_TORQUE_VALUES` from `values.py`.
Added constraints to ensure the target torque stays within defined ANGLE_MIN_TORQUE and ANGLE_MAX_TORQUE values. This prevents unsafe torque levels and improves system reliability.
Revised the input validation to ensure stricter checks and prevent potential edge-case errors. This enhances overall robustness and improves user experience by rejecting invalid data promptly.
Implemented a variable smoothing factor for steering angle adjustments based on vehicle speed. Added new parameters `SMOOTHING_ANGLE_VEGO_MATRIX` and `SMOOTHING_ANGLE_ALPHA_MATRIX` for dynamic interpolation. This enhances control precision and stability at varying speeds.
Replaced direct access to `params` with instance variables for torque parameters to improve code clarity and maintainability. Updated smoothing factor description in angle tuning settings to include speed-related behavior. This enhances readability and prepares for further tuning adjustments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants