mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-04 15:56:08 +08:00
interfaces/apply: follow capnp best practices (#23371)
This commit is contained in:
@@ -212,7 +212,8 @@ class CarInterface(CarInterfaceBase):
|
||||
return self.CS.out
|
||||
|
||||
def apply(self, c):
|
||||
hud_v_cruise = c.hudControl.setSpeed
|
||||
hud_control = c.hudControl
|
||||
hud_v_cruise = hud_control.setSpeed
|
||||
if hud_v_cruise > 70:
|
||||
hud_v_cruise = 0
|
||||
|
||||
@@ -222,8 +223,8 @@ class CarInterface(CarInterfaceBase):
|
||||
|
||||
ret = self.CC.update(enabled, self.CS, self.frame,
|
||||
c.actuators,
|
||||
hud_v_cruise, c.hudControl.lanesVisible,
|
||||
c.hudControl.leadVisible, c.hudControl.visualAlert)
|
||||
hud_v_cruise, hud_control.lanesVisible,
|
||||
hud_control.leadVisible, hud_control.visualAlert)
|
||||
|
||||
self.frame += 1
|
||||
return ret
|
||||
|
||||
@@ -432,8 +432,9 @@ class CarInterface(CarInterfaceBase):
|
||||
# pass in a car.CarControl
|
||||
# to be called @ 100hz
|
||||
def apply(self, c):
|
||||
if c.hudControl.speedVisible:
|
||||
hud_v_cruise = c.hudControl.setSpeed * CV.MS_TO_KPH
|
||||
hud_control = c.hudControl
|
||||
if hud_control.speedVisible:
|
||||
hud_v_cruise = hud_control.setSpeed * CV.MS_TO_KPH
|
||||
else:
|
||||
hud_v_cruise = 255
|
||||
|
||||
@@ -441,9 +442,9 @@ class CarInterface(CarInterfaceBase):
|
||||
c.actuators,
|
||||
c.cruiseControl.cancel,
|
||||
hud_v_cruise,
|
||||
c.hudControl.lanesVisible,
|
||||
hud_show_car=c.hudControl.leadVisible,
|
||||
hud_alert=c.hudControl.visualAlert)
|
||||
hud_control.lanesVisible,
|
||||
hud_show_car=hud_control.leadVisible,
|
||||
hud_alert=hud_control.visualAlert)
|
||||
|
||||
self.frame += 1
|
||||
return ret
|
||||
|
||||
@@ -347,8 +347,9 @@ class CarInterface(CarInterfaceBase):
|
||||
return self.CS.out
|
||||
|
||||
def apply(self, c):
|
||||
hud_control = c.hudControl
|
||||
ret = self.CC.update(c.enabled, self.CS, self.frame, c.actuators,
|
||||
c.cruiseControl.cancel, c.hudControl.visualAlert, c.hudControl.setSpeed, c.hudControl.leftLaneVisible,
|
||||
c.hudControl.rightLaneVisible, c.hudControl.leftLaneDepart, c.hudControl.rightLaneDepart)
|
||||
c.cruiseControl.cancel, hud_control.visualAlert, hud_control.setSpeed, hud_control.leftLaneVisible,
|
||||
hud_control.rightLaneVisible, hud_control.leftLaneDepart, hud_control.rightLaneDepart)
|
||||
self.frame += 1
|
||||
return ret
|
||||
|
||||
@@ -78,9 +78,10 @@ class CarInterface(CarInterfaceBase):
|
||||
return self.CS.out
|
||||
|
||||
def apply(self, c):
|
||||
hud_control = c.hudControl
|
||||
ret = self.CC.update(c.enabled, self.CS, self.frame, c.actuators,
|
||||
c.cruiseControl.cancel, c.hudControl.visualAlert,
|
||||
c.hudControl.leftLaneVisible, c.hudControl.rightLaneVisible,
|
||||
c.hudControl.leftLaneDepart, c.hudControl.rightLaneDepart)
|
||||
c.cruiseControl.cancel, hud_control.visualAlert,
|
||||
hud_control.leftLaneVisible, hud_control.rightLaneVisible,
|
||||
hud_control.leftLaneDepart, hud_control.rightLaneDepart)
|
||||
self.frame += 1
|
||||
return ret
|
||||
|
||||
@@ -122,8 +122,9 @@ class CarInterface(CarInterfaceBase):
|
||||
return self.CS.out
|
||||
|
||||
def apply(self, c):
|
||||
hud_control = c.hudControl
|
||||
ret = self.CC.update(c.enabled, self.CS, self.frame, c.actuators,
|
||||
c.cruiseControl.cancel, c.hudControl.visualAlert,
|
||||
c.hudControl.leftLaneVisible, c.hudControl.rightLaneVisible, c.hudControl.leftLaneDepart, c.hudControl.rightLaneDepart)
|
||||
c.cruiseControl.cancel, hud_control.visualAlert,
|
||||
hud_control.leftLaneVisible, hud_control.rightLaneVisible, hud_control.leftLaneDepart, hud_control.rightLaneDepart)
|
||||
self.frame += 1
|
||||
return ret
|
||||
|
||||
@@ -287,11 +287,12 @@ class CarInterface(CarInterfaceBase):
|
||||
# pass in a car.CarControl
|
||||
# to be called @ 100hz
|
||||
def apply(self, c):
|
||||
hud_control = c.hudControl
|
||||
ret = self.CC.update(c.enabled, c.active, self.CS, self.frame,
|
||||
c.actuators, c.cruiseControl.cancel,
|
||||
c.hudControl.visualAlert, c.hudControl.leftLaneVisible,
|
||||
c.hudControl.rightLaneVisible, c.hudControl.leadVisible,
|
||||
c.hudControl.leftLaneDepart, c.hudControl.rightLaneDepart)
|
||||
hud_control.visualAlert, hud_control.leftLaneVisible,
|
||||
hud_control.rightLaneVisible, hud_control.leadVisible,
|
||||
hud_control.leftLaneDepart, hud_control.rightLaneDepart)
|
||||
|
||||
self.frame += 1
|
||||
return ret
|
||||
|
||||
@@ -216,11 +216,12 @@ class CarInterface(CarInterfaceBase):
|
||||
return self.CS.out
|
||||
|
||||
def apply(self, c):
|
||||
hud_control = c.hudControl
|
||||
ret = self.CC.update(c.enabled, self.CS, self.frame, self.ext_bus, c.actuators,
|
||||
c.hudControl.visualAlert,
|
||||
c.hudControl.leftLaneVisible,
|
||||
c.hudControl.rightLaneVisible,
|
||||
c.hudControl.leftLaneDepart,
|
||||
c.hudControl.rightLaneDepart)
|
||||
hud_control.visualAlert,
|
||||
hud_control.leftLaneVisible,
|
||||
hud_control.rightLaneVisible,
|
||||
hud_control.leftLaneDepart,
|
||||
hud_control.rightLaneDepart)
|
||||
self.frame += 1
|
||||
return ret
|
||||
|
||||
Reference in New Issue
Block a user