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 117 commits into
base: master-new
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
abe78de
HKG: Car Port for Kia EV9 2024 (HDA2 & LFA2)
sunnyhaibin Jan 28, 2025
12885af
Update CARS.md
sunnyhaibin Jan 28, 2025
525c308
fix
sunnyhaibin Jan 28, 2025
3cdc754
remove for now
sunnyhaibin Jan 28, 2025
52986ce
test route
sunnyhaibin Jan 28, 2025
c686f5a
Merge remote-tracking branch 'commaai/opendbc/master' into ev9-new
sunnyhaibin Feb 22, 2025
cddb5fa
Merge remote-tracking branch 'commaai/opendbc/master' into ev9-new
sunnyhaibin Feb 22, 2025
143ff07
Merge remote-tracking branch 'commaai/opendbc/master' into ev9-new
sunnyhaibin Feb 22, 2025
3896d11
no more list
sunnyhaibin Feb 22, 2025
0af01cf
more flags
sunnyhaibin Feb 22, 2025
c47a4fc
not needed
sunnyhaibin Feb 22, 2025
7292fc8
rename
sunnyhaibin Feb 22, 2025
dd9b1ed
angle steering safety flag
sunnyhaibin Feb 22, 2025
8df4845
init safety for angle steering
sunnyhaibin Feb 22, 2025
3a774be
match api
sunnyhaibin Feb 22, 2025
7fcaa6d
cleanup angle control can sends
sunnyhaibin Feb 22, 2025
69888e1
use what was working before
sunnyhaibin Feb 22, 2025
d389455
move around
sunnyhaibin Feb 23, 2025
d162e71
update array of samples for steering angle
sunnyhaibin Feb 23, 2025
4c73c79
use MDPS|STEERING_ANGLE
sunnyhaibin Feb 23, 2025
9b434a3
bsm cleanup
sunnyhaibin Feb 23, 2025
f1a153f
Merge remote-tracking branch 'commaai/opendbc/master' into ev9-new
sunnyhaibin Feb 23, 2025
8ba1487
match
sunnyhaibin Feb 23, 2025
65bd109
remove
sunnyhaibin Feb 23, 2025
f88fb73
lower limits
sunnyhaibin Feb 23, 2025
b0f9946
new steering msg
sunnyhaibin Feb 23, 2025
552c54c
update driver torque faster
sunnyhaibin Feb 23, 2025
d89356f
fix angle related sampling
sunnyhaibin Feb 23, 2025
8f163d2
print
sunnyhaibin Feb 23, 2025
87e1cae
Revert "print"
sunnyhaibin Feb 23, 2025
8ea43b8
Merge remote-tracking branch 'commaai/opendbc/master' into ev9-new
sunnyhaibin Feb 24, 2025
e44c96a
fix dbc
sunnyhaibin Feb 24, 2025
90555ec
spacing
sunnyhaibin Feb 24, 2025
3bbec02
no checksum needed
sunnyhaibin Feb 24, 2025
1295fee
Merge remote-tracking branch 'commaai/opendbc/master' into ev9-new
sunnyhaibin Feb 24, 2025
98084c7
Merge branch 'master' into ev9-new
sunnyhaibin Feb 24, 2025
fcdf3c7
Merge remote-tracking branch 'commaai/opendbc/master' into ev9-new
sunnyhaibin Feb 24, 2025
bc4b2e1
init angle steering test
sunnyhaibin Feb 25, 2025
06d9b8c
fix steering angle extraction
sunnyhaibin Feb 25, 2025
90d6caf
Merge remote-tracking branch 'commaai/opendbc/master' into ev9-new
sunnyhaibin Feb 25, 2025
effbfc6
no need
sunnyhaibin Feb 25, 2025
a24cfca
correct dbc
sunnyhaibin Feb 25, 2025
6a02452
do this
sunnyhaibin Feb 25, 2025
62bcec6
Merge branch 'master' into ev9-new
sunnyhaibin Feb 25, 2025
7000504
Merge remote-tracking branch 'commaai/opendbc/master' into ev9-new
sunnyhaibin Feb 25, 2025
efe0a22
Merge remote-tracking branch 'commaai/opendbc/master' into ev9-new
sunnyhaibin Feb 25, 2025
76c00c7
fix
sunnyhaibin Feb 25, 2025
67dfc5e
Merge remote-tracking branch 'commaai/opendbc/master' into ev9-new
sunnyhaibin Feb 27, 2025
d7c8f3e
cherry pick #1850
sunnyhaibin Feb 27, 2025
95d8de4
allow 1 to be sent
sunnyhaibin Feb 27, 2025
ecc2097
some labeling
sshane Feb 27, 2025
a4823e7
use toyota limits
sshane Feb 27, 2025
29b0aa7
same torque ~= same lateral accel at all speeds
sshane Feb 27, 2025
ce8d9ee
remove complexity for simplicity
sshane Feb 27, 2025
967f828
this comment didn't make any sense
sshane Feb 27, 2025
2e31530
make torque/angle exclusive
sshane Feb 27, 2025
12bef8c
make it clear
sshane Feb 27, 2025
5225f46
Merge remote-tracking branch 'upstream/master' into ev9-new
sshane Feb 28, 2025
c83f49d
clip angle or joystick can cause it to wrap around...
sshane Feb 28, 2025
df4f00e
down here
sshane Feb 28, 2025
57bec98
adjust limits using toyota's torque error as reference and fix override
sshane Feb 28, 2025
3e06d8e
simplify
sshane Feb 28, 2025
68b6976
clean up reference
sshane Feb 28, 2025
0a8609d
wrong too
sshane Feb 28, 2025
1dbd179
redundant
sshane Feb 28, 2025
6bc2496
this is always true, both 1 and 2 are not 0 or 3...
sshane Feb 28, 2025
3d35302
fix wheel speed parsing
sshane Feb 28, 2025
4e5500c
fix compile
sshane Feb 28, 2025
72117e1
Merge remote-tracking branch 'upstream/master' into ev9-new
sshane Feb 28, 2025
c2b67dd
use new apply_std_steer_angle_limits
sshane Feb 28, 2025
0b040e2
Merge remote-tracking branch 'upstream/master' into ev9-new
sshane Feb 28, 2025
ced97ae
fix blocked messages while disengaged and > 180 degrees
sshane Feb 28, 2025
9be3ce4
Merge remote-tracking branch 'upstream/master' into ev9-new
sshane Feb 28, 2025
10feb87
Merge remote-tracking branch 'upstream/master' into ev9-new
sshane Feb 28, 2025
93e03ec
only the EV9 we tested for now
sshane Feb 28, 2025
2f9d97a
format
sshane Feb 28, 2025
abe6d71
?
sshane Feb 28, 2025
e9b0998
lower min torque and fix test
sshane Feb 28, 2025
866d1b8
this was always wrong
sshane Feb 28, 2025
e08b61c
partially fix - stash
sshane Feb 28, 2025
2d274ed
Revert "partially fix - stash"
sshane Feb 28, 2025
555981f
Merge remote-tracking branch 'upstream/master' into ev9-new
sshane Feb 28, 2025
ad1ab89
clean up and fix
sshane Feb 28, 2025
a84b530
start torque safety
sshane Feb 28, 2025
f601365
Revert "start torque safety"
sshane Mar 1, 2025
66d0eb7
fixes
sshane Mar 1, 2025
7ca250d
rename
sshane Mar 1, 2025
4582121
adjust limits
sshane Mar 1, 2025
54899f5
Merge remote-tracking branch 'upstream/master' into ev9-new
sshane Mar 1, 2025
c8f9128
rm
sshane Mar 1, 2025
228a397
more reasonable limits and fix EPS fault
sshane Mar 1, 2025
06094db
add fault and active signals
sshane Mar 1, 2025
dcf79f6
check it
sshane Mar 1, 2025
42d84ff
new angle limit API
sshane Mar 1, 2025
a89c767
fix
sshane Mar 1, 2025
f719d6e
fix
sshane Mar 1, 2025
428d35c
fix
sshane Mar 1, 2025
8779c76
revert
sshane Mar 1, 2025
742b956
add more fingerprints
sunnyhaibin Mar 7, 2025
3db676c
Safety Replay: add Hyundai Legacy to steering message checks (#2005)
sunnyhaibin Mar 17, 2025
54e4a12
Merge remote-tracking branch 'commaai/opendbc/master' into ev9-new
sunnyhaibin Mar 17, 2025
163b5cd
Update fingerprints.py (#76)
jonjander Mar 17, 2025
3dcd3a2
Merge remote-tracking branch 'origin/ev9-new' into ioniq5-pe-with-syn…
devtekve Mar 22, 2025
209b8da
Add support for Hyundai Ioniq 5 PE (HDA II) 2025+
devtekve Mar 22, 2025
eedb28c
Update torque override for HYUNDAI_IONIQ_5_PE
devtekve Mar 22, 2025
6fb3726
"Update Hyundai CAN FD angle rate lookup tables"
devtekve Mar 22, 2025
30b77ee
"Simplify Hyundai CAN FD steering angle rate lookups
devtekve Mar 22, 2025
4ba0005
Merge branch 'master-new' into ioniq5-pe-with-sync-2-redo
devtekve Mar 23, 2025
14c662e
Add test route for Hyundai Ioniq 5 PE and remove Kia EV9
devtekve Mar 23, 2025
e26c432
Update Hyundai steering angle rate limits
devtekve Mar 23, 2025
bc22be9
Refactor curvature-based steering angle and torque logic.
devtekve Mar 27, 2025
a57650b
Adjust curvature handling and filtering parameters
devtekve Mar 27, 2025
e1b2a0c
Adjust curvature handling and filtering parameters
devtekve Mar 28, 2025
0b79c41
Update Hyundai steering angle limits for improved performance
devtekve Mar 29, 2025
c295617
Adjust torque scaling for curvature in Hyundai carcontroller.
devtekve Mar 30, 2025
c6ee9a3
Adjust Hyundai CAN-FD steering angle and rate limits
devtekve Mar 30, 2025
f8e3ca7
Optimize torque scaling by incorporating speed multiplier
devtekve Mar 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
init safety for angle steering
sunnyhaibin committed Feb 22, 2025
commit 8df4845ac051125d9ec366fe0ec9bad3e05e2bd3
29 changes: 27 additions & 2 deletions opendbc/safety/safety/safety_hyundai_canfd.h
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@

static bool hyundai_canfd_alt_buttons = false;
static bool hyundai_canfd_lka_steering_alt = false;
static bool hyundai_canfd_angle_steering = false;

static int hyundai_canfd_get_lka_addr(void) {
return hyundai_canfd_lka_steering_alt ? 0x110 : 0x50;
@@ -133,6 +134,16 @@ static bool hyundai_canfd_tx_hook(const CANPacket_t *to_send) {
.max_invalid_request_frames = 2,
.min_valid_request_rt_interval = 810000, // 810ms; a ~10% buffer on cutting every 90 frames
.has_steer_req_tolerance = true,

.angle_deg_to_can = 10,
.angle_rate_up_lookup = {
{0., 5., 25.},
{2.5, 1.5, 0.2}
},
.angle_rate_down_lookup = {
{0., 5., 25.},
{5., 2.0, 0.3}
},
};

bool tx = true;
@@ -144,8 +155,20 @@ static bool hyundai_canfd_tx_hook(const CANPacket_t *to_send) {
int desired_torque = (((GET_BYTE(to_send, 6) & 0xFU) << 7U) | (GET_BYTE(to_send, 5) >> 1U)) - 1024U;
bool steer_req = GET_BIT(to_send, 52U);

if (steer_torque_cmd_checks(desired_torque, steer_req, HYUNDAI_CANFD_STEERING_LIMITS)) {
tx = false;
if (hyundai_canfd_angle_steering) {
int angle_steer_req = GET_BYTE(to_send, 9) & 0x30U;
int desired_angle = (((GET_BYTE(to_send, 10) & 0x3FU) << 8) | GET_BYTE(to_send, 11));
desired_angle = to_signed(desired_angle, 14);

bool angle_steer_control_enabled = angle_steer_req != 2U;

if (steer_angle_cmd_checks(desired_angle, angle_steer_control_enabled, HYUNDAI_CANFD_STEERING_LIMITS)) {
tx = false;
}
} else {
if (steer_torque_cmd_checks(desired_torque, steer_req, HYUNDAI_CANFD_STEERING_LIMITS)) {
tx = false;
}
}
}

@@ -223,6 +246,7 @@ static int hyundai_canfd_fwd_hook(int bus_num, int addr) {
static safety_config hyundai_canfd_init(uint16_t param) {
const int HYUNDAI_PARAM_CANFD_LKA_STEERING_ALT = 128;
const int HYUNDAI_PARAM_CANFD_ALT_BUTTONS = 32;
const int HYUNDAI_PARAM_CANFD_ANGLE_STEERING = 256;

static const CanMsg HYUNDAI_CANFD_LKA_STEERING_TX_MSGS[] = {
{0x50, 0, 16}, // LKAS
@@ -265,6 +289,7 @@ static safety_config hyundai_canfd_init(uint16_t param) {
gen_crc_lookup_table_16(0x1021, hyundai_canfd_crc_lut);
hyundai_canfd_alt_buttons = GET_FLAG(param, HYUNDAI_PARAM_CANFD_ALT_BUTTONS);
hyundai_canfd_lka_steering_alt = GET_FLAG(param, HYUNDAI_PARAM_CANFD_LKA_STEERING_ALT);
hyundai_canfd_angle_steering = GET_FLAG(param, HYUNDAI_PARAM_CANFD_ANGLE_STEERING);

// no long for radar-SCC with LFA steering yet
if (!hyundai_canfd_lka_steering && !hyundai_camera_scc) {