IQ.Pilot Prebuilt Release @ 7a91404
This commit is contained in:
18
artifacts/package_runtime/iqdbc/car/psa/psacan.py
Normal file
18
artifacts/package_runtime/iqdbc/car/psa/psacan.py
Normal file
@@ -0,0 +1,18 @@
|
||||
def psa_checksum(address: int, sig, d: bytearray) -> int:
|
||||
chk_ini = {0x452: 0x4, 0x38D: 0x7, 0x42D: 0xC}.get(address, 0xB)
|
||||
byte = sig.start_bit // 8
|
||||
d[byte] &= 0x0F if sig.start_bit % 8 >= 4 else 0xF0
|
||||
checksum = sum((b >> 4) + (b & 0xF) for b in d)
|
||||
return (chk_ini - checksum) & 0xF
|
||||
|
||||
|
||||
def create_lka_steering(packer, lat_active: bool, apply_angle: float, status: int):
|
||||
values = {
|
||||
'DRIVE': 1,
|
||||
'STATUS': status,
|
||||
'LXA_ACTIVATION': 1,
|
||||
'TORQUE_FACTOR': lat_active * 100,
|
||||
'SET_ANGLE': apply_angle,
|
||||
}
|
||||
|
||||
return packer.make_can_msg('LANE_KEEP_ASSIST', 0, values)
|
||||
Reference in New Issue
Block a user