CC longitudinal control
Co-Authored-By: Eric Brown <13560103+nworb-cire@users.noreply.github.com>
This commit is contained in:
@@ -32,26 +32,26 @@ const CanMsg GM_ASCM_TX_MSGS[] = {{0x180, 0, 4}, {0x409, 0, 7}, {0x40A, 0, 7}, {
|
|||||||
{0x315, 2, 5}, // ch bus
|
{0x315, 2, 5}, // ch bus
|
||||||
{0x104c006c, 3, 3}, {0x10400060, 3, 5}}; // gmlan
|
{0x104c006c, 3, 3}, {0x10400060, 3, 5}}; // gmlan
|
||||||
|
|
||||||
const CanMsg GM_CAM_TX_MSGS[] = {{0x180, 0, 4}, // pt bus
|
const CanMsg GM_CAM_TX_MSGS[] = {{0x180, 0, 4}, {0x1E1, 0, 7}, // pt bus
|
||||||
{0x1E1, 2, 7}, {0x184, 2, 8}}; // camera bus
|
{0x1E1, 2, 7}, {0x184, 2, 8}}; // camera bus
|
||||||
|
|
||||||
|
const CanMsg GM_CAM_LONG_TX_MSGS[] = {{0x180, 0, 4}, {0x315, 0, 5}, {0x2CB, 0, 8}, {0x370, 0, 6}, // pt bus
|
||||||
|
{0x1E1, 2, 7}, {0x184, 2, 8}}; // camera bus
|
||||||
|
|
||||||
const CanMsg GM_SDGM_TX_MSGS[] = {{0x180, 0, 4}, {0x1E1, 0, 7}, // pt bus
|
const CanMsg GM_SDGM_TX_MSGS[] = {{0x180, 0, 4}, {0x1E1, 0, 7}, // pt bus
|
||||||
{0x184, 2, 8}}; // camera bus
|
{0x184, 2, 8}}; // camera bus
|
||||||
|
|
||||||
const CanMsg GM_CAM_LONG_TX_MSGS[] = {{0x180, 0, 4}, {0x315, 0, 5}, {0x2CB, 0, 8}, {0x370, 0, 6}, // pt bus
|
const CanMsg GM_CC_LONG_TX_MSGS[] = {{0x180, 0, 4}, {0x1E1, 0, 7}, // pt bus
|
||||||
{0x184, 2, 8}}; // camera bus
|
{0x184, 2, 8}, {0x1E1, 2, 7}}; // camera bus
|
||||||
|
|
||||||
// TODO: do checksum and counter checks. Add correct timestep, 0.1s for now.
|
// TODO: do checksum and counter checks. Add correct timestep, 0.1s for now.
|
||||||
RxCheck gm_rx_checks[] = {
|
RxCheck gm_rx_checks[] = {
|
||||||
{.msg = {{0x184, 0, 8, .frequency = 10U}, { 0 }, { 0 }}},
|
{.msg = {{0x184, 0, 8, .frequency = 10U}, { 0 }, { 0 }}},
|
||||||
{.msg = {{0x34A, 0, 5, .frequency = 10U}, { 0 }, { 0 }}},
|
{.msg = {{0x34A, 0, 5, .frequency = 10U}, { 0 }, { 0 }}},
|
||||||
{.msg = {{0x1E1, 0, 7, .frequency = 10U}, // Non-SDGM Car
|
{.msg = {{0x1E1, 0, 7, .frequency = 10U}, // Non-SDGM Car
|
||||||
{0x1E1, 2, 7, .frequency = 10U}}}, // SDGM Car
|
{0x1E1, 2, 7, .frequency = 100000U}}}, // SDGM Car
|
||||||
{.msg = {{0xF1, 0, 6, .frequency = 10U}, // Non-SDGM Car
|
{.msg = {{0xF1, 0, 6, .frequency = 10U}, // Non-SDGM Car
|
||||||
{0xF1, 2, 6, .frequency = 10U}}}, // SDGM Car
|
{0xF1, 2, 6, .frequency = 100000U}}}, // SDGM Car
|
||||||
{.msg = {{0xBE, 0, 6, .frequency = 10U}, // Volt, Silverado, Acadia Denali
|
|
||||||
{0xBE, 0, 7, .frequency = 10U}, // Bolt EUV
|
|
||||||
{0xBE, 0, 8, .frequency = 10U}}}, // Escalade
|
|
||||||
{.msg = {{0x1C4, 0, 8, .frequency = 10U}, { 0 }, { 0 }}},
|
{.msg = {{0x1C4, 0, 8, .frequency = 10U}, { 0 }, { 0 }}},
|
||||||
{.msg = {{0xC9, 0, 8, .frequency = 10U}, { 0 }, { 0 }}},
|
{.msg = {{0xC9, 0, 8, .frequency = 10U}, { 0 }, { 0 }}},
|
||||||
};
|
};
|
||||||
@@ -59,6 +59,7 @@ RxCheck gm_rx_checks[] = {
|
|||||||
const uint16_t GM_PARAM_HW_CAM = 1;
|
const uint16_t GM_PARAM_HW_CAM = 1;
|
||||||
const uint16_t GM_PARAM_HW_CAM_LONG = 2;
|
const uint16_t GM_PARAM_HW_CAM_LONG = 2;
|
||||||
const uint16_t GM_PARAM_HW_SDGM = 4;
|
const uint16_t GM_PARAM_HW_SDGM = 4;
|
||||||
|
const uint16_t GM_PARAM_CC_LONG = 8;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
GM_BTN_UNPRESS = 1,
|
GM_BTN_UNPRESS = 1,
|
||||||
@@ -70,6 +71,7 @@ enum {
|
|||||||
enum {GM_ASCM, GM_CAM, GM_SDGM} gm_hw = GM_ASCM;
|
enum {GM_ASCM, GM_CAM, GM_SDGM} gm_hw = GM_ASCM;
|
||||||
bool gm_cam_long = false;
|
bool gm_cam_long = false;
|
||||||
bool gm_pcm_cruise = false;
|
bool gm_pcm_cruise = false;
|
||||||
|
bool gm_cc_long = false;
|
||||||
|
|
||||||
static void handle_gm_wheel_buttons(CANPacket_t *to_push) {
|
static void handle_gm_wheel_buttons(CANPacket_t *to_push) {
|
||||||
int button = (GET_BYTE(to_push, 5) & 0x70U) >> 4;
|
int button = (GET_BYTE(to_push, 5) & 0x70U) >> 4;
|
||||||
@@ -113,7 +115,7 @@ static void gm_rx_hook(CANPacket_t *to_push) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ACC steering wheel buttons (GM_CAM and GM_SDGM are tied to the PCM)
|
// ACC steering wheel buttons (GM_CAM and GM_SDGM are tied to the PCM)
|
||||||
if ((addr == 0x1E1) && (!gm_pcm_cruise || gas_interceptor_detected || gm_cc_long) && (gm_hw != GM_SDGM)) {
|
if ((addr == 0x1E1) && (!gm_pcm_cruise || gm_cc_long) && (gm_hw != GM_SDGM)) {
|
||||||
handle_gm_wheel_buttons(to_push);
|
handle_gm_wheel_buttons(to_push);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,7 +185,7 @@ static bool gm_tx_hook(CANPacket_t *to_send) {
|
|||||||
// GAS/REGEN: safety check
|
// GAS/REGEN: safety check
|
||||||
if (addr == 0x2CB) {
|
if (addr == 0x2CB) {
|
||||||
bool apply = GET_BIT(to_send, 0U) != 0U;
|
bool apply = GET_BIT(to_send, 0U) != 0U;
|
||||||
int gas_regen = ((GET_BYTE(to_send, 1) & 0x1U) << 13) + ((GET_BYTE(to_send, 2) & 0xFFU) << 5) + ((GET_BYTE(to_send, 3) & 0xF8U) >> 3);
|
int gas_regen = ((GET_BYTE(to_send, 2) & 0x7FU) << 5) + ((GET_BYTE(to_send, 3) & 0xF8U) >> 3);
|
||||||
|
|
||||||
bool violation = false;
|
bool violation = false;
|
||||||
// Allow apply bit in pre-enabled and overriding states
|
// Allow apply bit in pre-enabled and overriding states
|
||||||
@@ -196,11 +198,16 @@ static bool gm_tx_hook(CANPacket_t *to_send) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BUTTONS: used for resume spamming and cruise cancellation with stock longitudinal
|
// BUTTONS: used for resume spamming and cruise cancellation with stock longitudinal
|
||||||
if ((addr == 0x1E1) && gm_pcm_cruise) {
|
if ((addr == 0x1E1) && (gm_pcm_cruise || gm_cc_long)) {
|
||||||
int button = (GET_BYTE(to_send, 5) >> 4) & 0x7U;
|
int button = (GET_BYTE(to_send, 5) >> 4) & 0x7U;
|
||||||
|
|
||||||
bool allowed_cancel = (button == 6) && cruise_engaged_prev;
|
bool allowed_btn = (button == GM_BTN_CANCEL) && cruise_engaged_prev;
|
||||||
if (!allowed_cancel) {
|
// For standard CC, allow spamming of SET / RESUME
|
||||||
|
if (gm_cc_long) {
|
||||||
|
allowed_btn |= cruise_engaged_prev && (button == GM_BTN_SET || button == GM_BTN_RESUME || button == GM_BTN_UNPRESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!allowed_btn) {
|
||||||
tx = false;
|
tx = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -250,16 +257,22 @@ static safety_config gm_init(uint16_t param) {
|
|||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ALLOW_DEBUG
|
gm_cc_long = GET_FLAG(param, GM_PARAM_CC_LONG);
|
||||||
gm_cam_long = GET_FLAG(param, GM_PARAM_HW_CAM_LONG);
|
gm_cam_long = GET_FLAG(param, GM_PARAM_HW_CAM_LONG) && !gm_cc_long;
|
||||||
#endif
|
gm_pcm_cruise = ((gm_hw == GM_CAM) && (!gm_cam_long || gm_cc_long) && !gm_force_ascm && !gm_pedal_long) || (gm_hw == GM_SDGM);
|
||||||
gm_pcm_cruise = (gm_hw == GM_CAM) && !gm_cam_long || (gm_hw == GM_SDGM);
|
|
||||||
|
|
||||||
safety_config ret = BUILD_SAFETY_CFG(gm_rx_checks, GM_ASCM_TX_MSGS);
|
safety_config ret = BUILD_SAFETY_CFG(gm_rx_checks, GM_ASCM_TX_MSGS);
|
||||||
if (gm_hw == GM_CAM) {
|
if (gm_hw == GM_CAM) {
|
||||||
ret = gm_cam_long ? BUILD_SAFETY_CFG(gm_rx_checks, GM_CAM_LONG_TX_MSGS) : BUILD_SAFETY_CFG(gm_rx_checks, GM_CAM_TX_MSGS);
|
if (gm_cc_long) {
|
||||||
|
ret = BUILD_SAFETY_CFG(gm_rx_checks, GM_CC_LONG_TX_MSGS);
|
||||||
|
} else if (gm_cam_long) {
|
||||||
|
ret = BUILD_SAFETY_CFG(gm_rx_checks, GM_CAM_LONG_TX_MSGS);
|
||||||
|
} else {
|
||||||
|
ret = BUILD_SAFETY_CFG(gm_rx_checks, GM_CAM_TX_MSGS);
|
||||||
|
}
|
||||||
} else if (gm_hw == GM_SDGM) {
|
} else if (gm_hw == GM_SDGM) {
|
||||||
ret = BUILD_SAFETY_CFG(gm_rx_checks, GM_SDGM_TX_MSGS);
|
ret = BUILD_SAFETY_CFG(gm_rx_checks, GM_SDGM_TX_MSGS);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -229,6 +229,7 @@ class Panda:
|
|||||||
FLAG_GM_HW_CAM = 1
|
FLAG_GM_HW_CAM = 1
|
||||||
FLAG_GM_HW_CAM_LONG = 2
|
FLAG_GM_HW_CAM_LONG = 2
|
||||||
FLAG_GM_HW_SDGM = 4
|
FLAG_GM_HW_SDGM = 4
|
||||||
|
FLAG_GM_CC_LONG = 8
|
||||||
FLAG_GM_HW_ASCM_LONG = 16
|
FLAG_GM_HW_ASCM_LONG = 16
|
||||||
|
|
||||||
FLAG_FORD_LONG_CONTROL = 1
|
FLAG_FORD_LONG_CONTROL = 1
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ from openpilot.selfdrive.car.gm.values import DBC, CanBus, CarControllerParams,
|
|||||||
VisualAlert = car.CarControl.HUDControl.VisualAlert
|
VisualAlert = car.CarControl.HUDControl.VisualAlert
|
||||||
NetworkLocation = car.CarParams.NetworkLocation
|
NetworkLocation = car.CarParams.NetworkLocation
|
||||||
LongCtrlState = car.CarControl.Actuators.LongControlState
|
LongCtrlState = car.CarControl.Actuators.LongControlState
|
||||||
|
GearShifter = car.CarState.GearShifter
|
||||||
|
TransmissionType = car.CarParams.TransmissionType
|
||||||
|
|
||||||
# Camera cancels up to 0.1s after brake is pressed, ECM allows 0.5s
|
# Camera cancels up to 0.1s after brake is pressed, ECM allows 0.5s
|
||||||
CAMERA_CANCEL_DELAY_FRAMES = 10
|
CAMERA_CANCEL_DELAY_FRAMES = 10
|
||||||
@@ -24,10 +26,12 @@ class CarController:
|
|||||||
self.apply_steer_last = 0
|
self.apply_steer_last = 0
|
||||||
self.apply_gas = 0
|
self.apply_gas = 0
|
||||||
self.apply_brake = 0
|
self.apply_brake = 0
|
||||||
|
self.apply_speed = 0
|
||||||
self.frame = 0
|
self.frame = 0
|
||||||
self.last_steer_frame = 0
|
self.last_steer_frame = 0
|
||||||
self.last_button_frame = 0
|
self.last_button_frame = 0
|
||||||
self.cancel_counter = 0
|
self.cancel_counter = 0
|
||||||
|
self.pedal_steady = 0.
|
||||||
|
|
||||||
self.lka_steering_cmd_counter = 0
|
self.lka_steering_cmd_counter = 0
|
||||||
self.lka_icon_status_last = (False, False)
|
self.lka_icon_status_last = (False, False)
|
||||||
@@ -106,6 +110,10 @@ class CarController:
|
|||||||
|
|
||||||
at_full_stop = CC.longActive and CS.out.standstill
|
at_full_stop = CC.longActive and CS.out.standstill
|
||||||
near_stop = CC.longActive and (CS.out.vEgo < self.params.NEAR_STOP_BRAKE_PHASE)
|
near_stop = CC.longActive and (CS.out.vEgo < self.params.NEAR_STOP_BRAKE_PHASE)
|
||||||
|
if self.CP.flags & GMFlags.CC_LONG.value:
|
||||||
|
if CC.longActive and CS.out.vEgo > self.CP.minEnableSpeed:
|
||||||
|
# Using extend instead of append since the message is only sent intermittently
|
||||||
|
can_sends.extend(gmcan.create_gm_cc_spam_command(self.packer_pt, self, CS, actuators))
|
||||||
if self.CP.carFingerprint not in CC_ONLY_CAR:
|
if self.CP.carFingerprint not in CC_ONLY_CAR:
|
||||||
friction_brake_bus = CanBus.CHASSIS
|
friction_brake_bus = CanBus.CHASSIS
|
||||||
# GM Camera exceptions
|
# GM Camera exceptions
|
||||||
@@ -167,6 +175,7 @@ class CarController:
|
|||||||
new_actuators.steerOutputCan = self.apply_steer_last
|
new_actuators.steerOutputCan = self.apply_steer_last
|
||||||
new_actuators.gas = self.apply_gas
|
new_actuators.gas = self.apply_gas
|
||||||
new_actuators.brake = self.apply_brake
|
new_actuators.brake = self.apply_brake
|
||||||
|
new_actuators.speed = self.apply_speed
|
||||||
|
|
||||||
self.frame += 1
|
self.frame += 1
|
||||||
return new_actuators, can_sends
|
return new_actuators, can_sends
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
|
import math
|
||||||
|
|
||||||
|
from openpilot.common.conversions import Conversions as CV
|
||||||
|
from openpilot.common.realtime import DT_CTRL
|
||||||
from openpilot.selfdrive.car import make_can_msg
|
from openpilot.selfdrive.car import make_can_msg
|
||||||
from openpilot.selfdrive.car.gm.values import CAR
|
from openpilot.selfdrive.car.gm.values import CAR, CruiseButtons, CanBus
|
||||||
|
|
||||||
|
|
||||||
def create_buttons(packer, bus, idx, button):
|
def create_buttons(packer, bus, idx, button):
|
||||||
@@ -171,3 +175,45 @@ def create_lka_icon_command(bus, active, critical, steer):
|
|||||||
else:
|
else:
|
||||||
dat = b"\x00\x00\x00"
|
dat = b"\x00\x00\x00"
|
||||||
return make_can_msg(0x104c006c, dat, bus)
|
return make_can_msg(0x104c006c, dat, bus)
|
||||||
|
|
||||||
|
|
||||||
|
def create_gm_cc_spam_command(packer, controller, CS, actuators):
|
||||||
|
# TODO: Cleanup the timing - normal is every 30ms...
|
||||||
|
|
||||||
|
cruiseBtn = CruiseButtons.INIT
|
||||||
|
|
||||||
|
# if controller.params_.get_bool("IsMetric"):
|
||||||
|
# accel = actuators.accel * CV.MS_TO_KPH # m/s/s to km/h/s
|
||||||
|
# else:
|
||||||
|
# accel = actuators.accel * CV.MS_TO_MPH # m/s/s to mph/s
|
||||||
|
accel = actuators.accel * CV.MS_TO_MPH # m/s/s to mph/s
|
||||||
|
speedSetPoint = int(round(CS.out.cruiseState.speed * CV.MS_TO_MPH))
|
||||||
|
|
||||||
|
RATE_UP_MAX = 0.2 # may be lower on new/euro cars
|
||||||
|
RATE_DOWN_MAX = 0.2 # may be lower on new/euro cars
|
||||||
|
|
||||||
|
if speedSetPoint == CS.CP.minEnableSpeed and accel < -1:
|
||||||
|
cruiseBtn = CruiseButtons.CANCEL
|
||||||
|
controller.apply_speed = 0
|
||||||
|
rate = 0.04
|
||||||
|
elif accel < 0:
|
||||||
|
cruiseBtn = CruiseButtons.DECEL_SET
|
||||||
|
rate = max(-1 / accel, RATE_DOWN_MAX)
|
||||||
|
controller.apply_speed = speedSetPoint - 1
|
||||||
|
elif accel > 0:
|
||||||
|
cruiseBtn = CruiseButtons.RES_ACCEL
|
||||||
|
rate = max(1 / accel, RATE_UP_MAX)
|
||||||
|
controller.apply_speed = speedSetPoint + 1
|
||||||
|
else:
|
||||||
|
controller.apply_speed = speedSetPoint
|
||||||
|
rate = float('inf')
|
||||||
|
|
||||||
|
# Check rlogs closely - our message shouldn't show up on the pt bus for us
|
||||||
|
# Or bus 2, since we're forwarding... but I think it does
|
||||||
|
# TODO: Cleanup the timing - normal is every 30ms...
|
||||||
|
if (cruiseBtn != CruiseButtons.INIT) and ((controller.frame - controller.last_button_frame) * DT_CTRL > rate):
|
||||||
|
controller.last_button_frame = controller.frame
|
||||||
|
idx = (CS.buttons_counter + 1) % 4 # Need to predict the next idx for '22-23 EUV
|
||||||
|
return [create_buttons(packer, CanBus.POWERTRAIN, idx, cruiseBtn)]
|
||||||
|
else:
|
||||||
|
return []
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class CarInterface(CarInterfaceBase):
|
|||||||
ret.longitudinalTuning.kiBP = [0.]
|
ret.longitudinalTuning.kiBP = [0.]
|
||||||
|
|
||||||
if candidate in CAMERA_ACC_CAR:
|
if candidate in CAMERA_ACC_CAR:
|
||||||
ret.experimentalLongitudinalAvailable = True
|
ret.experimentalLongitudinalAvailable = candidate not in CC_ONLY_CAR
|
||||||
ret.networkLocation = NetworkLocation.fwdCamera
|
ret.networkLocation = NetworkLocation.fwdCamera
|
||||||
ret.radarUnavailable = True # no radar
|
ret.radarUnavailable = True # no radar
|
||||||
ret.pcmCruise = True
|
ret.pcmCruise = True
|
||||||
@@ -311,6 +311,26 @@ class CarInterface(CarInterfaceBase):
|
|||||||
ret.steerRatio = 17.7
|
ret.steerRatio = 17.7
|
||||||
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
|
CarInterfaceBase.configure_torque_tune(candidate, ret.lateralTuning)
|
||||||
|
|
||||||
|
elif candidate in CC_ONLY_CAR:
|
||||||
|
ret.flags |= GMFlags.CC_LONG.value
|
||||||
|
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_CC_LONG
|
||||||
|
ret.radarUnavailable = True
|
||||||
|
ret.experimentalLongitudinalAvailable = False
|
||||||
|
ret.minEnableSpeed = 24 * CV.MPH_TO_MS
|
||||||
|
ret.openpilotLongitudinalControl = True
|
||||||
|
ret.pcmCruise = False
|
||||||
|
|
||||||
|
ret.longitudinalTuning.deadzoneBP = [0.]
|
||||||
|
ret.longitudinalTuning.deadzoneV = [0.56] # == 2 km/h/s, 1.25 mph/s
|
||||||
|
ret.stoppingDecelRate = 11.18 # == 25 mph/s (.04 rate)
|
||||||
|
ret.longitudinalActuatorDelayLowerBound = 1. # TODO: measure this
|
||||||
|
ret.longitudinalActuatorDelayUpperBound = 2.
|
||||||
|
|
||||||
|
ret.longitudinalTuning.kpBP = [10.7, 10.8, 28.] # 10.7 m/s == 24 mph
|
||||||
|
ret.longitudinalTuning.kpV = [0., 20., 20.] # set lower end to 0 since we can't drive below that speed
|
||||||
|
ret.longitudinalTuning.kiBP = [0.]
|
||||||
|
ret.longitudinalTuning.kiV = [0.1]
|
||||||
|
|
||||||
if candidate in CC_ONLY_CAR:
|
if candidate in CC_ONLY_CAR:
|
||||||
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_NO_ACC
|
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_GM_NO_ACC
|
||||||
|
|
||||||
@@ -350,6 +370,9 @@ class CarInterface(CarInterfaceBase):
|
|||||||
if ret.vEgo < self.CP.minSteerSpeed:
|
if ret.vEgo < self.CP.minSteerSpeed:
|
||||||
events.add(EventName.belowSteerSpeed)
|
events.add(EventName.belowSteerSpeed)
|
||||||
|
|
||||||
|
if (self.CP.flags & GMFlags.CC_LONG.value) and ret.vEgo < self.CP.minEnableSpeed and ret.cruiseState.enabled:
|
||||||
|
events.add(EventName.speedTooLow)
|
||||||
|
|
||||||
ret.events = events.to_msg()
|
ret.events = events.to_msg()
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ class CanBus:
|
|||||||
DROPPED = 192
|
DROPPED = 192
|
||||||
|
|
||||||
class GMFlags(IntFlag):
|
class GMFlags(IntFlag):
|
||||||
|
CC_LONG = 2
|
||||||
NO_ACCELERATOR_POS_MSG = 8
|
NO_ACCELERATOR_POS_MSG = 8
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -645,6 +645,9 @@ class Controls:
|
|||||||
t_since_plan = (self.sm.frame - self.sm.rcv_frame['longitudinalPlan']) * DT_CTRL
|
t_since_plan = (self.sm.frame - self.sm.rcv_frame['longitudinalPlan']) * DT_CTRL
|
||||||
actuators.accel = self.LoC.update(CC.longActive, CS, long_plan, pid_accel_limits, t_since_plan)
|
actuators.accel = self.LoC.update(CC.longActive, CS, long_plan, pid_accel_limits, t_since_plan)
|
||||||
|
|
||||||
|
if len(long_plan.speeds):
|
||||||
|
actuators.speed = long_plan.speeds[-1]
|
||||||
|
|
||||||
# Steering PID loop and lateral MPC
|
# Steering PID loop and lateral MPC
|
||||||
self.desired_curvature, self.desired_curvature_rate = get_lag_adjusted_curvature(self.CP, CS.vEgo,
|
self.desired_curvature, self.desired_curvature_rate = get_lag_adjusted_curvature(self.CP, CS.vEgo,
|
||||||
lat_plan.psis,
|
lat_plan.psis,
|
||||||
|
|||||||
Reference in New Issue
Block a user