Co-authored-by: Cameron Clough <cameronjclough@gmail.com>
pull/27089/head
Shane Smiskol 3 years ago
parent e445112f17
commit 929304af71
  1. 3
      selfdrive/car/ford/carcontroller.py
  2. 29
      selfdrive/car/ford/fordcan.py

@ -84,8 +84,7 @@ class CarController:
self.apply_angle_last = apply_angle self.apply_angle_last = apply_angle
can_sends.append(create_lka_msg(self.packer, 0, 0)) can_sends.append(create_lka_msg(self.packer, 0, 0))
can_sends.append(create_lat_ctl_msg(self.packer, lca_rq, ramp_type, precision, can_sends.append(create_lat_ctl_msg(self.packer, lca_rq, ramp_type, precision, 0, path_angle, 0, 0))
0, path_angle, 0, 0))
### ui ### ### ui ###
send_ui = (self.main_on_last != main_on) or (self.lkas_enabled_last != CC.latActive) or (self.steer_alert_last != steer_alert) send_ui = (self.main_on_last != main_on) or (self.lkas_enabled_last != CC.latActive) or (self.steer_alert_last != steer_alert)

@ -25,24 +25,25 @@ def create_lka_msg(packer, angle_deg: float, curvature: float):
return packer.make_can_msg("Lane_Assist_Data1", CANBUS.main, values) return packer.make_can_msg("Lane_Assist_Data1", CANBUS.main, values)
def create_lat_ctl_msg(packer, lca_rq: int, ramp_type: int, precision: int, path_offset: float, path_angle: float, curvature_rate: float, curvature: float): def create_lat_ctl_msg(packer, lca_rq: int, ramp_type: int, precision: int, path_offset: float, path_angle: float,
curvature: float, curvature_rate: float):
""" """
Creates a CAN message for the Ford TJA/LCA Command. Creates a CAN message for the Ford TJA/LCA Command.
This command can apply "Lane Centering" manoeuvres: continuous lane centering for traffic jam This command can apply "Lane Centering" manoeuvres: continuous lane centering for traffic jam assist and highway
assist and highway driving. It is not subject to the PSCM lockout. driving. It is not subject to the PSCM lockout.
Ford lane centering command uses a third order polynomial to describe the road centerline. The Ford lane centering command uses a third order polynomial to describe the road centerline. The polynomial is defined
polynomial is defined by the following coefficients: by the following coefficients:
c0: lateral offset between the vehicle and the centerline (positive is right) c0: lateral offset between the vehicle and the centerline (positive is right)
c1: heading angle between the vehicle and the centerline (positive is right) c1: heading angle between the vehicle and the centerline (positive is right)
c2: curvature of the centerline (positive is left) c2: curvature of the centerline (positive is left)
c3: rate of change of curvature of the centerline c3: rate of change of curvature of the centerline
As the PSCM combines this information with other sensor data, such as the vehicle's yaw rate and As the PSCM combines this information with other sensor data, such as the vehicle's yaw rate and speed, the steering
speed, the steering angle cannot be easily controlled. angle cannot be easily controlled.
The PSCM should be configured to accept TJA/LCA commands before these commands will be processed. The PSCM should be configured to accept TJA/LCA commands before these commands will be processed. This can be done
This can be done using tools such as Forscan. using tools such as Forscan.
Frequency is 20Hz. Frequency is 20Hz.
""" """
@ -108,16 +109,15 @@ def create_lkas_ui_msg(packer, main_on: bool, enabled: bool, steer_alert: bool,
values = { values = {
**stock_values, **stock_values,
"LaActvStats_D_Dsply": lines, # LKAS status (lines) [0|31] "LaActvStats_D_Dsply": lines, # LKAS status (lines) [0|31]
"LaHandsOff_D_Dsply": hands_on_wheel_dsply, # 0=HandsOn, 1=Level1 (w/o chime), 2=Level2 (w/ chime), 3=Suppressed "LaHandsOff_D_Dsply": hands_on_wheel_dsply, # 0=HandsOn, 1=Level1 (w/o chime), 2=Level2 (w/ chime), 3=Suppressed
} }
return packer.make_can_msg("IPMA_Data", CANBUS.main, values) return packer.make_can_msg("IPMA_Data", CANBUS.main, values)
def create_acc_ui_msg(packer, main_on: bool, enabled: bool, hud_control, stock_values: dict): def create_acc_ui_msg(packer, main_on: bool, enabled: bool, hud_control, stock_values: dict):
""" """
Creates a CAN message for the Ford IPC adaptive cruise, forward collision warning and traffic jam Creates a CAN message for the Ford IPC adaptive cruise, forward collision warning and traffic jam assist status.
assist status.
Stock functionality is maintained by passing through unmodified signals. Stock functionality is maintained by passing through unmodified signals.
@ -149,7 +149,8 @@ def create_acc_ui_msg(packer, main_on: bool, enabled: bool, hud_control, stock_v
return packer.make_can_msg("ACCDATA_3", CANBUS.main, values) return packer.make_can_msg("ACCDATA_3", CANBUS.main, values)
def create_button_msg(packer, stock_values: dict, cancel=False, resume=False, tja_toggle=False, bus: int = CANBUS.camera): def create_button_msg(packer, stock_values: dict, cancel=False, resume=False, tja_toggle=False,
bus: int = CANBUS.camera):
""" """
Creates a CAN message for the Ford SCCM buttons/switches. Creates a CAN message for the Ford SCCM buttons/switches.

Loading…
Cancel
Save