Merge branch 'master' into mqb-long

mqb-long
Jason Young 3 years ago
commit 635cafbf77
  1. 2
      opendbc
  2. 9
      selfdrive/car/hyundai/carcontroller.py
  3. 14
      selfdrive/car/hyundai/hyundaican.py
  4. 10
      selfdrive/car/hyundai/interface.py
  5. 3
      selfdrive/controls/lib/longitudinal_planner.py
  6. 2
      selfdrive/test/process_replay/ref_commit
  7. 60
      selfdrive/ui/qt/offroad/settings.cc
  8. 9
      selfdrive/ui/qt/widgets/controls.h
  9. 20
      selfdrive/ui/translations/main_ja.ts
  10. 20
      selfdrive/ui/translations/main_ko.ts
  11. 20
      selfdrive/ui/translations/main_pt-BR.ts
  12. 20
      selfdrive/ui/translations/main_zh-CHS.ts
  13. 20
      selfdrive/ui/translations/main_zh-CHT.ts

@ -1 +1 @@
Subproject commit 83d4cb9fd871a563f4a0af0102992c0b52c94310
Subproject commit e95ed311c10547026143b539a33341425cbec9ea

@ -1,6 +1,6 @@
from cereal import car
from common.conversions import Conversions as CV
from common.numpy_fast import clip, interp
from common.numpy_fast import clip
from common.realtime import DT_CTRL
from opendbc.can.packer import CANPacker
from selfdrive.car import apply_std_steer_torque_limits
@ -123,12 +123,9 @@ class CarController:
if self.frame % 2 == 0 and self.CP.openpilotLongitudinalControl:
accel = actuators.accel
jerk = 0
if CC.longActive:
jerk = clip(2.0 * (accel - CS.out.aEgo), -12.7, 12.7)
if accel < 0:
accel = interp(accel - CS.out.aEgo, [-1.0, -0.5], [2 * accel, accel])
#TODO unclear if this is needed
jerk = 3.0 if actuators.longControlState == LongCtrlState.pid else 1.0
accel = clip(accel, CarControllerParams.ACCEL_MIN, CarControllerParams.ACCEL_MAX)

@ -94,7 +94,7 @@ def create_lfahda_mfc(packer, enabled, hda_set_speed=0):
}
return packer.make_can_msg("LFAHDA_MFC", 0, values)
def create_acc_commands(packer, enabled, accel, jerk, idx, lead_visible, set_speed, stopping, gas_pressed):
def create_acc_commands(packer, enabled, accel, upper_jerk, idx, lead_visible, set_speed, stopping, gas_pressed):
commands = []
scc11_values = {
@ -102,12 +102,12 @@ def create_acc_commands(packer, enabled, accel, jerk, idx, lead_visible, set_spe
"TauGapSet": 4,
"VSetDis": set_speed if enabled else 0,
"AliveCounterACC": idx % 0x10,
"ObjValid": 0, # TODO: these two bits may allow for better longitudinal control
"ACC_ObjStatus": 0,
"ObjValid": 1, # close lead makes controls tighter
"ACC_ObjStatus": 1, # close lead makes controls tighter
"ACC_ObjLatPos": 0,
"ACC_ObjRelSpd": 0,
"ACC_ObjDist": 0,
}
"ACC_ObjDist": 1, # close lead makes controls tighter
}
commands.append(packer.make_can_msg("SCC11", 0, scc11_values))
scc12_values = {
@ -125,8 +125,8 @@ def create_acc_commands(packer, enabled, accel, jerk, idx, lead_visible, set_spe
scc14_values = {
"ComfortBandUpper": 0.0, # stock usually is 0 but sometimes uses higher values
"ComfortBandLower": 0.0, # stock usually is 0 but sometimes uses higher values
"JerkUpperLimit": max(jerk, 1.0) if not stopping else 0, # stock usually is 1.0 but sometimes uses higher values
"JerkLowerLimit": max(-jerk, 1.0), # stock usually is 0.5 but sometimes uses higher values
"JerkUpperLimit": upper_jerk, # stock usually is 1.0 but sometimes uses higher values
"JerkLowerLimit": 5.0, # stock usually is 0.5 but sometimes uses higher values
"ACCMode": 2 if enabled and gas_pressed else 1 if enabled else 4, # stock will always be 4 instead of 0 after first disengage
"ObjGap": 2 if lead_visible else 0, # 5: >30, m, 4: 25-30 m, 3: 20-25 m, 2: < 20 m, 0: no lead
}

@ -43,13 +43,15 @@ class CarInterface(CarInterfaceBase):
tire_stiffness_factor = 1.
ret.stoppingControl = True
ret.vEgoStopping = 1.0
ret.startingState = True
ret.vEgoStarting = 0.1
ret.startAccel = 2.0
ret.longitudinalTuning.kpV = [0.1]
ret.longitudinalTuning.kpV = [0.5]
ret.longitudinalTuning.kiV = [0.0]
ret.stopAccel = 0.0
ret.longitudinalActuatorDelayUpperBound = 1.0 # s
ret.longitudinalActuatorDelayLowerBound = 0.5 # s
ret.longitudinalActuatorDelayUpperBound = 0.5 # s
if candidate in (CAR.SANTA_FE, CAR.SANTA_FE_2022, CAR.SANTA_FE_HEV_2022, CAR.SANTA_FE_PHEV_2022):
ret.lateralTuning.pid.kf = 0.00005
ret.mass = 3982. * CV.LB_TO_KG + STD_CARGO_KG

@ -66,7 +66,8 @@ class LongitudinalPlanner:
self.solverExecutionTime = 0.0
def read_param(self):
self.mpc.mode = 'blended' if self.params.get_bool('EndToEndLong') else 'acc'
e2e = self.params.get_bool('EndToEndLong') and self.CP.openpilotLongitudinalControl
self.mpc.mode = 'blended' if e2e else 'acc'
def parse_model(self, model_msg):
if (len(model_msg.position.x) == 33 and

@ -1 +1 @@
8137b41a0520d2b4a0ca223f9934957ae21695e5
bd712b78c1ef351343b60e7ea527d09583e8acb7

@ -65,6 +65,12 @@ TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) {
"",
"../assets/offroad/icon_road.png",
},
{
"ExperimentalLongitudinalEnabled",
tr("Experimental openpilot longitudinal control"),
tr("<b>WARNING: openpilot longitudinal control is experimental for this car and will disable AEB.</b>"),
"../assets/offroad/icon_speed_limit.png",
},
#ifdef ENABLE_MAPS
{
"NavSettingTime24h",
@ -92,23 +98,7 @@ TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) {
toggles[param.toStdString()] = toggle;
}
QObject::connect(toggles["EndToEndLong"], &ParamControl::toggleFlipped, [=](bool state) {
auto cp_bytes = params.get("CarParamsPersistent");
if (!cp_bytes.empty()) {
AlignedBuffer aligned_buf;
capnp::FlatArrayMessageReader cmsg(aligned_buf.align(cp_bytes.data(), cp_bytes.size()));
cereal::CarParams::Reader CP = cmsg.getRoot<cereal::CarParams>();
if (CP.getExperimentalLongitudinalAvailable()) {
params.putBool("ExperimentalLongitudinalEnabled", state);
} else {
params.remove("ExperimentalLongitudinalEnabled");
}
} else {
params.remove("ExperimentalLongitudinalEnabled");
}
});
connect(uiState(), &UIState::offroadTransition, [=]() {
connect(toggles["ExperimentalLongitudinalEnabled"], &ToggleControl::toggleFlipped, [=]() {
updateToggles();
});
}
@ -118,8 +108,8 @@ void TogglesPanel::showEvent(QShowEvent *event) {
}
void TogglesPanel::updateToggles() {
// update e2e toggle
auto toggle = toggles["EndToEndLong"];
auto e2e_toggle = toggles["EndToEndLong"];
auto op_long_toggle = toggles["ExperimentalLongitudinalEnabled"];
const QString e2e_description = tr("Let the driving model control the gas and brakes. openpilot will drive as it thinks a human would. Super experimental.");
auto cp_bytes = params.get("CarParamsPersistent");
@ -128,29 +118,31 @@ void TogglesPanel::updateToggles() {
capnp::FlatArrayMessageReader cmsg(aligned_buf.align(cp_bytes.data(), cp_bytes.size()));
cereal::CarParams::Reader CP = cmsg.getRoot<cereal::CarParams>();
const bool exp_long = CP.getExperimentalLongitudinalAvailable();
const bool op_long = CP.getOpenpilotLongitudinalControl() && !CP.getExperimentalLongitudinalAvailable();
if (!CP.getExperimentalLongitudinalAvailable()) {
params.remove("ExperimentalLongitudinalEnabled");
}
op_long_toggle->setVisible(CP.getExperimentalLongitudinalAvailable());
if (op_long) {
const bool op_long = CP.getOpenpilotLongitudinalControl() && !CP.getExperimentalLongitudinalAvailable();
const bool exp_long_enabled = CP.getExperimentalLongitudinalAvailable() && params.getBool("ExperimentalLongitudinalEnabled");
if (op_long || exp_long_enabled) {
// normal description and toggle
params.remove("ExperimentalLongitudinalEnabled");
toggle->setDescription(e2e_description);
} else if (exp_long) {
toggle->setDescription("<b>WARNING: openpilot longitudinal control is experimental for this car and will disable AEB.</b><br><br>" + e2e_description);
if (params.getBool("EndToEndLong") && !params.getBool("ExperimentalLongitudinalEnabled")) {
params.remove("EndToEndLong");
}
e2e_toggle->setEnabled(true);
e2e_toggle->setDescription(e2e_description);
} else {
// no long for now
e2e_toggle->setEnabled(false);
params.remove("EndToEndLong");
params.remove("ExperimentalLongitudinalEnabled");
toggle->setDescription("<b>openpilot longitudinal control is not currently available for this car.</b><br><br>" + e2e_description);
const QString no_long = "openpilot longitudinal control is not currently available for this car.";
const QString exp_long = "Enable experimental longitudinal control to enable this.";
e2e_toggle->setDescription("<b>" + (CP.getExperimentalLongitudinalAvailable() ? exp_long : no_long) + "</b><br><br>" + e2e_description);
}
toggle->refresh();
toggle->setEnabled(op_long || (exp_long && !uiState()->scene.started));
e2e_toggle->refresh();
} else {
toggle->setDescription(e2e_description);
e2e_toggle->setDescription(e2e_description);
op_long_toggle->setVisible(false);
}
}

@ -164,9 +164,12 @@ private:
QPainter p(this);
p.setPen(Qt::gray);
for (int i = 0; i < inner_layout.count() - 1; ++i) {
QRect r = inner_layout.itemAt(i)->geometry();
int bottom = r.bottom() + inner_layout.spacing() / 2;
p.drawLine(r.left() + 40, bottom, r.right() - 40, bottom);
QWidget *widget = inner_layout.itemAt(i)->widget();
if (widget->isVisible()) {
QRect r = inner_layout.itemAt(i)->geometry();
int bottom = r.bottom() + inner_layout.spacing() / 2;
p.drawLine(r.left() + 40, bottom, r.right() - 40, bottom);
}
}
}
QVBoxLayout outer_layout;

@ -108,7 +108,7 @@
<context>
<name>DevicePanel</name>
<message>
<location filename="../qt/offroad/settings.cc" line="+159"/>
<location filename="../qt/offroad/settings.cc" line="+151"/>
<source>Dongle ID</source>
<translation> (Dongle ID)</translation>
</message>
@ -1153,7 +1153,7 @@ location set</source>
<context>
<name>TogglesPanel</name>
<message>
<location filename="../qt/offroad/settings.cc" line="-332"/>
<location filename="../qt/offroad/settings.cc" line="-324"/>
<source>Enable openpilot</source>
<translation>openpilot </translation>
</message>
@ -1198,12 +1198,22 @@ location set</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+59"/>
<location line="+6"/>
<source>Experimental openpilot longitudinal control</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>&lt;b&gt;WARNING: openpilot longitudinal control is experimental for this car and will disable AEB.&lt;/b&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+42"/>
<source>Let the driving model control the gas and brakes. openpilot will drive as it thinks a human would. Super experimental.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="-65"/>
<location line="-55"/>
<source>Disengage On Accelerator Pedal</source>
<translation> openpilot </translation>
</message>
@ -1213,7 +1223,7 @@ location set</source>
<translation> openpilot </translation>
</message>
<message>
<location line="+12"/>
<location line="+18"/>
<source>Show ETA in 24h Format</source>
<translation>24</translation>
</message>

@ -108,7 +108,7 @@
<context>
<name>DevicePanel</name>
<message>
<location filename="../qt/offroad/settings.cc" line="+159"/>
<location filename="../qt/offroad/settings.cc" line="+151"/>
<source>Dongle ID</source>
<translation>Dongle ID</translation>
</message>
@ -1153,7 +1153,7 @@ location set</source>
<context>
<name>TogglesPanel</name>
<message>
<location filename="../qt/offroad/settings.cc" line="-332"/>
<location filename="../qt/offroad/settings.cc" line="-324"/>
<source>Enable openpilot</source>
<translation>openpilot </translation>
</message>
@ -1198,12 +1198,22 @@ location set</source>
<translation>🌮 e2e long ( ) 🌮 </translation>
</message>
<message>
<location line="+59"/>
<location line="+6"/>
<source>Experimental openpilot longitudinal control</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>&lt;b&gt;WARNING: openpilot longitudinal control is experimental for this car and will disable AEB.&lt;/b&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+42"/>
<source>Let the driving model control the gas and brakes. openpilot will drive as it thinks a human would. Super experimental.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="-65"/>
<location line="-55"/>
<source>Disengage On Accelerator Pedal</source>
<translation> </translation>
</message>
@ -1213,7 +1223,7 @@ location set</source>
<translation> openpilot이 .</translation>
</message>
<message>
<location line="+12"/>
<location line="+18"/>
<source>Show ETA in 24h Format</source>
<translation>24 </translation>
</message>

@ -108,7 +108,7 @@
<context>
<name>DevicePanel</name>
<message>
<location filename="../qt/offroad/settings.cc" line="+159"/>
<location filename="../qt/offroad/settings.cc" line="+151"/>
<source>Dongle ID</source>
<translation>Dongle ID</translation>
</message>
@ -1157,7 +1157,7 @@ trabalho definido</translation>
<context>
<name>TogglesPanel</name>
<message>
<location filename="../qt/offroad/settings.cc" line="-332"/>
<location filename="../qt/offroad/settings.cc" line="-324"/>
<source>Enable openpilot</source>
<translation>Ativar openpilot</translation>
</message>
@ -1202,12 +1202,22 @@ trabalho definido</translation>
<translation>🌮 End-to-end longitudinal (experimental) 🌮</translation>
</message>
<message>
<location line="+59"/>
<location line="+6"/>
<source>Experimental openpilot longitudinal control</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>&lt;b&gt;WARNING: openpilot longitudinal control is experimental for this car and will disable AEB.&lt;/b&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+42"/>
<source>Let the driving model control the gas and brakes. openpilot will drive as it thinks a human would. Super experimental.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="-65"/>
<location line="-55"/>
<source>Disengage On Accelerator Pedal</source>
<translation>Desacionar Com Pedal Do Acelerador</translation>
</message>
@ -1217,7 +1227,7 @@ trabalho definido</translation>
<translation>Quando ativado, pressionar o pedal do acelerador desacionará o openpilot.</translation>
</message>
<message>
<location line="+12"/>
<location line="+18"/>
<source>Show ETA in 24h Format</source>
<translation>Mostrar ETA em formato 24h</translation>
</message>

@ -108,7 +108,7 @@
<context>
<name>DevicePanel</name>
<message>
<location filename="../qt/offroad/settings.cc" line="+159"/>
<location filename="../qt/offroad/settings.cc" line="+151"/>
<source>Dongle ID</source>
<translation>IDDongle ID</translation>
</message>
@ -1151,7 +1151,7 @@ location set</source>
<context>
<name>TogglesPanel</name>
<message>
<location filename="../qt/offroad/settings.cc" line="-332"/>
<location filename="../qt/offroad/settings.cc" line="-324"/>
<source>Enable openpilot</source>
<translation>openpilot</translation>
</message>
@ -1196,12 +1196,22 @@ location set</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+59"/>
<location line="+6"/>
<source>Experimental openpilot longitudinal control</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>&lt;b&gt;WARNING: openpilot longitudinal control is experimental for this car and will disable AEB.&lt;/b&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+42"/>
<source>Let the driving model control the gas and brakes. openpilot will drive as it thinks a human would. Super experimental.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="-65"/>
<location line="-55"/>
<source>Disengage On Accelerator Pedal</source>
<translation></translation>
</message>
@ -1211,7 +1221,7 @@ location set</source>
<translation>openpilot</translation>
</message>
<message>
<location line="+12"/>
<location line="+18"/>
<source>Show ETA in 24h Format</source>
<translation>24</translation>
</message>

@ -108,7 +108,7 @@
<context>
<name>DevicePanel</name>
<message>
<location filename="../qt/offroad/settings.cc" line="+159"/>
<location filename="../qt/offroad/settings.cc" line="+151"/>
<source>Dongle ID</source>
<translation>Dongle ID</translation>
</message>
@ -1153,7 +1153,7 @@ location set</source>
<context>
<name>TogglesPanel</name>
<message>
<location filename="../qt/offroad/settings.cc" line="-332"/>
<location filename="../qt/offroad/settings.cc" line="-324"/>
<source>Enable openpilot</source>
<translation> openpilot</translation>
</message>
@ -1198,12 +1198,22 @@ location set</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+59"/>
<location line="+6"/>
<source>Experimental openpilot longitudinal control</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>&lt;b&gt;WARNING: openpilot longitudinal control is experimental for this car and will disable AEB.&lt;/b&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+42"/>
<source>Let the driving model control the gas and brakes. openpilot will drive as it thinks a human would. Super experimental.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="-65"/>
<location line="-55"/>
<source>Disengage On Accelerator Pedal</source>
<translation></translation>
</message>
@ -1213,7 +1223,7 @@ location set</source>
<translation> openpilot </translation>
</message>
<message>
<location line="+12"/>
<location line="+18"/>
<source>Show ETA in 24h Format</source>
<translation> 24 </translation>
</message>

Loading…
Cancel
Save