Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion selfdrive/car/body/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ def get_params(candidate, fingerprint=None, car_fw=None, disable_radar=False):
ret.minSteerSpeed = -math.inf
ret.maxLateralAccel = math.inf # TODO: set to a reasonable value
ret.steerRatio = 0.5
ret.steerRateCost = 0.5
ret.steerLimitTimer = 1.0
ret.steerActuatorDelay = 0.

Expand Down
1 change: 0 additions & 1 deletion selfdrive/car/chrysler/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, disa
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.15, 0.30], [0.03, 0.05]]
ret.lateralTuning.pid.kf = 0.00006 # full torque for 10 deg at 80mph means 0.00007818594
ret.steerActuatorDelay = 0.1
ret.steerRateCost = 0.7
ret.steerLimitTimer = 0.4

if candidate in (CAR.JEEP_CHEROKEE, CAR.JEEP_CHEROKEE_2019):
Expand Down
1 change: 0 additions & 1 deletion selfdrive/car/ford/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, disa
# LCA can steer down to zero
ret.minSteerSpeed = 0.

ret.steerRateCost = 1.0
ret.centerToFront = ret.wheelbase * 0.44

ret.rotationalInertia = scale_rot_inertia(ret.mass, ret.wheelbase)
Expand Down
1 change: 0 additions & 1 deletion selfdrive/car/gm/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, disa
ret.lateralTuning.pid.kiBP, ret.lateralTuning.pid.kpBP = [[0.], [0.]]
ret.lateralTuning.pid.kpV, ret.lateralTuning.pid.kiV = [[0.2], [0.00]]
ret.lateralTuning.pid.kf = 0.00004 # full torque for 20 deg at 80mph means 0.00007818594
ret.steerRateCost = 1.0
ret.steerActuatorDelay = 0.1 # Default delay, not measured yet

ret.longitudinalTuning.kpBP = [5., 35.]
Expand Down
1 change: 0 additions & 1 deletion selfdrive/car/honda/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[], disabl
tire_stiffness_factor=tire_stiffness_factor)

ret.steerActuatorDelay = 0.1
ret.steerRateCost = 0.5
ret.steerLimitTimer = 0.8

return ret
Expand Down
1 change: 0 additions & 1 deletion selfdrive/car/hyundai/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[], disabl
ret.dashcamOnly = not os.path.exists('/data/enable-ev6')

ret.steerActuatorDelay = 0.1 # Default delay
ret.steerRateCost = 0.5
ret.steerLimitTimer = 0.4
tire_stiffness_factor = 1.

Expand Down
1 change: 0 additions & 1 deletion selfdrive/car/mazda/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, disa
ret.dashcamOnly = candidate not in (CAR.CX5_2022, CAR.CX9_2021)

ret.steerActuatorDelay = 0.1
ret.steerRateCost = 1.0
ret.steerLimitTimer = 0.8
tire_stiffness_factor = 0.70 # not optimized yet

Expand Down
1 change: 0 additions & 1 deletion selfdrive/car/nissan/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, disa
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.nissan)]

ret.steerLimitTimer = 1.0
ret.steerRateCost = 0.5

ret.steerActuatorDelay = 0.1

Expand Down
1 change: 0 additions & 1 deletion selfdrive/car/subaru/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, disa

ret.dashcamOnly = candidate in PREGLOBAL_CARS

ret.steerRateCost = 0.7
ret.steerLimitTimer = 0.4

if candidate == CAR.ASCENT:
Expand Down
1 change: 0 additions & 1 deletion selfdrive/car/tesla/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, disa

ret.steerLimitTimer = 1.0
ret.steerActuatorDelay = 0.25
ret.steerRateCost = 0.5

if candidate in (CAR.AP2_MODELS, CAR.AP1_MODELS):
ret.mass = 2100. + STD_CARGO_KG
Expand Down
1 change: 0 additions & 1 deletion selfdrive/car/tests/test_car_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def test_car_interfaces(self, car_name):
assert car_interface

self.assertGreater(car_params.mass, 1)
self.assertGreater(car_params.steerRateCost, 1e-3)

if car_params.steerControlType != car.CarParams.SteerControlType.angle:
tuning = car_params.lateralTuning.which()
Expand Down
1 change: 0 additions & 1 deletion selfdrive/car/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ def test_car_params(self):

# make sure car params are within a valid range
self.assertGreater(self.CP.mass, 1)
self.assertGreater(self.CP.steerRateCost, 1e-3)

if self.CP.steerControlType != car.CarParams.SteerControlType.angle:
tuning = self.CP.lateralTuning.which()
Expand Down
1 change: 0 additions & 1 deletion selfdrive/car/toyota/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=[], disabl
ret.mass = 4305. * CV.LB_TO_KG + STD_CARGO_KG
set_lat_tune(ret.lateralTuning, LatTunes.PID_J)

ret.steerRateCost = 1.
ret.centerToFront = ret.wheelbase * 0.44

# TODO: get actual value, for now starting with reasonable value for
Expand Down
1 change: 0 additions & 1 deletion selfdrive/car/volkswagen/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def get_params(candidate, fingerprint=gen_empty_fingerprint(), car_fw=None, disa
# Global lateral tuning defaults, can be overridden per-vehicle

ret.steerActuatorDelay = 0.1
ret.steerRateCost = 1.0
ret.steerLimitTimer = 0.4
ret.steerRatio = 15.6 # Let the params learner figure this out
tire_stiffness_factor = 1.0 # Let the params learner figure this out
Expand Down
9 changes: 4 additions & 5 deletions selfdrive/controls/lib/lateral_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@


class LateralPlanner:
def __init__(self, CP, use_lanelines=True, wide_camera=False):
def __init__(self, use_lanelines=True, wide_camera=False):
self.use_lanelines = use_lanelines
self.LP = LanePlanner(wide_camera)
self.DH = DesireHelper()

self.last_cloudlog_t = 0
self.steer_rate_cost = CP.steerRateCost
self.solution_invalid_cnt = 0

self.path_xyz = np.zeros((TRAJECTORY_SIZE, 3))
Expand Down Expand Up @@ -59,12 +58,12 @@ def update(self, sm):
# Calculate final driving path and set MPC costs
if self.use_lanelines:
d_path_xyz = self.LP.get_d_path(v_ego, self.t_idxs, self.path_xyz)
self.lat_mpc.set_weights(MPC_COST_LAT.PATH, MPC_COST_LAT.HEADING, self.steer_rate_cost)
self.lat_mpc.set_weights(MPC_COST_LAT.PATH, MPC_COST_LAT.HEADING, MPC_COST_LAT.STEER_RATE)
else:
d_path_xyz = self.path_xyz
# Heading cost is useful at low speed, otherwise end of plan can be off-heading
heading_cost = interp(v_ego, [5.0, 10.0], [MPC_COST_LAT.HEADING, 0.15])
self.lat_mpc.set_weights(MPC_COST_LAT.PATH, heading_cost, self.steer_rate_cost)
self.lat_mpc.set_weights(MPC_COST_LAT.PATH, heading_cost, MPC_COST_LAT.STEER_RATE)

y_pts = np.interp(v_ego * self.t_idxs[:LAT_MPC_N + 1], np.linalg.norm(d_path_xyz, axis=1), d_path_xyz[:, 1])
heading_pts = np.interp(v_ego * self.t_idxs[:LAT_MPC_N + 1], np.linalg.norm(self.path_xyz, axis=1), self.plan_yaw)
Expand All @@ -79,7 +78,7 @@ def update(self, sm):
y_pts,
heading_pts)
# init state for next
# mpc.u_sol is the desired curvature rate given x0 curv state.
# mpc.u_sol is the desired curvature rate given x0 curv state.
# with x0[3] = measured_curvature, this would be the actual desired rate.
# instead, interpolate x_sol so that x0[3] is the desired curvature for lat_control.
self.x0[3] = interp(DT_MDL, self.t_idxs[:LAT_MPC_N + 1], self.lat_mpc.x_sol[:, 3])
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/controls/plannerd.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def plannerd_thread(sm=None, pm=None):
cloudlog.event("e2e mode", on=use_lanelines)

longitudinal_planner = Planner(CP)
lateral_planner = LateralPlanner(CP, use_lanelines=use_lanelines, wide_camera=wide_camera)
lateral_planner = LateralPlanner(use_lanelines=use_lanelines, wide_camera=wide_camera)

if sm is None:
sm = messaging.SubMaster(['carState', 'controlsState', 'radarState', 'modelV2'],
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/modeld/models/driving.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ struct ModelOutput {

constexpr int OUTPUT_SIZE = sizeof(ModelOutput) / sizeof(float);
#ifdef TEMPORAL
constexpr int TEMPORAL_SIZE = 512;
constexpr int TEMPORAL_SIZE = 512+256;
#else
constexpr int TEMPORAL_SIZE = 0;
#endif
Expand Down
4 changes: 2 additions & 2 deletions selfdrive/modeld/models/supercombo.dlc
Git LFS file not shown
4 changes: 2 additions & 2 deletions selfdrive/modeld/models/supercombo.onnx
Git LFS file not shown
2 changes: 1 addition & 1 deletion selfdrive/modeld/thneed/compile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "selfdrive/modeld/thneed/thneed.h"
#include "system/hardware/hw.h"

#define TEMPORAL_SIZE 512
#define TEMPORAL_SIZE 512+256
#define DESIRE_LEN 8
#define TRAFFIC_CONVENTION_LEN 2

Expand Down
8 changes: 4 additions & 4 deletions selfdrive/modeld/thneed/optimizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

extern map<cl_program, string> g_program_source;

static int is_same_size_image(cl_mem a, cl_mem b) {
/*static int is_same_size_image(cl_mem a, cl_mem b) {
size_t a_width, a_height, a_depth, a_array_size, a_row_pitch, a_slice_pitch;
clGetImageInfo(a, CL_IMAGE_WIDTH, sizeof(a_width), &a_width, NULL);
clGetImageInfo(a, CL_IMAGE_HEIGHT, sizeof(a_height), &a_height, NULL);
Expand All @@ -29,7 +29,7 @@ static int is_same_size_image(cl_mem a, cl_mem b) {
return (a_width == b_width) && (a_height == b_height) &&
(a_depth == b_depth) && (a_array_size == b_array_size) &&
(a_row_pitch == b_row_pitch) && (a_slice_pitch == b_slice_pitch);
}
}*/

static cl_mem make_image_like(cl_context context, cl_mem val) {
cl_image_format format;
Expand Down Expand Up @@ -138,7 +138,7 @@ int Thneed::optimize() {

// delete useless copy layers
// saves ~0.7 ms
if (kq[i]->name == "concatenation" || kq[i]->name == "flatten") {
/*if (kq[i]->name == "concatenation" || kq[i]->name == "flatten") {
string in = kq[i]->args[kq[i]->get_arg_num("input")];
string out = kq[i]->args[kq[i]->get_arg_num("output")];
if (is_same_size_image(*(cl_mem*)in.data(), *(cl_mem*)out.data())) {
Expand All @@ -148,7 +148,7 @@ int Thneed::optimize() {

kq.erase(kq.begin()+i); --i;
}
}
}*/

// NOTE: if activations/accumulation are done in the wrong order, this will be wrong

Expand Down
2 changes: 1 addition & 1 deletion selfdrive/test/process_replay/model_replay_ref_commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
512a9d4596c8faba304d6f7ded2ce77837357b65
629eaa7b26d1721a71547f9de880f99732cb27f3
2 changes: 1 addition & 1 deletion selfdrive/test/process_replay/ref_commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1d66eed104dbc124c4e5679f5dddf40197b86ce9
ed1dfb8b155ebcd8fdad4e06462b3bb7869fc67b