Ram 1500 (#24878)
* RamInit
* bump submodules
* lil cleanup
* clean up carstate formatting and platform grouping
make tuple
* give it a gold torque star (looks around 2.4 from rough data)
* Dasm Fault
* bump panda
* more cleanup
* cleanup car state
* more cleanup
* some fixes
* remove more stuff
* fix angle signal scaling and fix lkas control bit
* bump panda
* update those
* same limits as pacifica
* cleanup hud alert building
* better fault logic
* fix rate
* set ahb
* bring that back
* update refs
Co-authored-by: Jonathan <jraycec@gmail.com>
Co-authored-by: Shane Smiskol <shane@smiskol.com>
Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: 9b0acacf5e
taco
parent
eb31508af0
commit
7d042460a4
13 changed files with 226 additions and 141 deletions
@ -1 +1 @@ |
||||
Subproject commit 6c0d0b43c239b89baa83b4a1885d0ce21ab2335e |
||||
Subproject commit fae3ee2e8161d34a7c1939503e583db9b85e5402 |
@ -1,56 +1,69 @@ |
||||
from cereal import car |
||||
from selfdrive.car import make_can_msg |
||||
|
||||
from selfdrive.car.chrysler.values import RAM_CARS |
||||
|
||||
GearShifter = car.CarState.GearShifter |
||||
VisualAlert = car.CarControl.HUDControl.VisualAlert |
||||
|
||||
def create_lkas_hud(packer, gear, lkas_active, hud_alert, hud_count, lkas_car_model): |
||||
# LKAS_HUD 0x2a6 (678) Controls what lane-keeping icon is displayed. |
||||
def create_lkas_hud(packer, CP, lkas_active, hud_alert, hud_count, car_model, auto_high_beam): |
||||
# LKAS_HUD - Controls what lane-keeping icon is displayed |
||||
|
||||
# == Color == |
||||
# 0 hidden? |
||||
# 1 white |
||||
# 2 green |
||||
# 3 ldw |
||||
|
||||
# == Lines == |
||||
# 03 white Lines |
||||
# 04 grey lines |
||||
# 09 left lane close |
||||
# 0A right lane close |
||||
# 0B left Lane very close |
||||
# 0C right Lane very close |
||||
# 0D left cross cross |
||||
# 0E right lane cross |
||||
|
||||
if hud_alert in (VisualAlert.steerRequired, VisualAlert.ldw): |
||||
msg = b'\x00\x00\x00\x03\x00\x00\x00\x00' |
||||
return make_can_msg(0x2a6, msg, 0) |
||||
# == Alerts == |
||||
# 7 Normal |
||||
# 6 lane departure place hands on wheel |
||||
|
||||
color = 1 # default values are for park or neutral in 2017 are 0 0, but trying 1 1 for 2019 |
||||
lines = 1 |
||||
alerts = 0 |
||||
color = 2 if lkas_active else 1 |
||||
lines = 3 if lkas_active else 0 |
||||
alerts = 7 if lkas_active else 0 |
||||
|
||||
if hud_count < (1 * 4): # first 3 seconds, 4Hz |
||||
alerts = 1 |
||||
# CAR.PACIFICA_2018_HYBRID and CAR.PACIFICA_2019_HYBRID |
||||
# had color = 1 and lines = 1 but trying 2017 hybrid style for now. |
||||
if gear in (GearShifter.drive, GearShifter.reverse, GearShifter.low): |
||||
if lkas_active: |
||||
color = 2 # control active, display green. |
||||
lines = 6 |
||||
else: |
||||
color = 1 # control off, display white. |
||||
lines = 1 |
||||
|
||||
if hud_alert in (VisualAlert.ldw, VisualAlert.steerRequired): |
||||
color = 4 |
||||
lines = 0 |
||||
alerts = 6 |
||||
|
||||
values = { |
||||
"LKAS_ICON_COLOR": color, # byte 0, last 2 bits |
||||
"CAR_MODEL": lkas_car_model, # byte 1 |
||||
"LKAS_LANE_LINES": lines, # byte 2, last 4 bits |
||||
"LKAS_ALERTS": alerts, # byte 3, last 4 bits |
||||
} |
||||
"LKAS_ICON_COLOR": color, |
||||
"CAR_MODEL": car_model, |
||||
"LKAS_LANE_LINES": lines, |
||||
"LKAS_ALERTS": alerts, |
||||
} |
||||
|
||||
if CP.carFingerprint in RAM_CARS: |
||||
values['AUTO_HIGH_BEAM_ON'] = auto_high_beam |
||||
|
||||
return packer.make_can_msg("DAS_6", 0, values) # 0x2a6 |
||||
return packer.make_can_msg("DAS_6", 0, values) |
||||
|
||||
|
||||
def create_lkas_command(packer, apply_steer, moving_fast, frame): |
||||
# LKAS_COMMAND 0x292 (658) Lane-keeping signal to turn the wheel. |
||||
def create_lkas_command(packer, CP, apply_steer, lat_active, frame): |
||||
# LKAS_COMMAND Lane-keeping signal to turn the wheel |
||||
enabled_val = 2 if CP.carFingerprint in RAM_CARS else 1 |
||||
values = { |
||||
"STEERING_TORQUE": apply_steer, |
||||
"LKAS_CONTROL_BIT": int(moving_fast), |
||||
"COUNTER": frame % 0x10, |
||||
"LKAS_CONTROL_BIT": enabled_val if lat_active else 0, |
||||
} |
||||
return packer.make_can_msg("LKAS_COMMAND", 0, values) |
||||
return packer.make_can_msg("LKAS_COMMAND", 0, values, frame % 0x10) |
||||
|
||||
|
||||
def create_cruise_buttons(packer, frame, cancel=False): |
||||
def create_cruise_buttons(packer, frame, bus, cancel=False): |
||||
values = { |
||||
"ACC_Cancel": cancel, |
||||
"COUNTER": frame % 0x10, |
||||
} |
||||
return packer.make_can_msg("CRUISE_BUTTONS", 0, values) |
||||
return packer.make_can_msg("CRUISE_BUTTONS", bus, values, frame % 0x10) |
||||
|
@ -1 +1 @@ |
||||
b904e52e9de4ff7b2bd7f6af8b19abaf4957e6cc |
||||
ebe7f1285ec60f522179606d483a198535c0e83a |
Loading…
Reference in new issue