Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit 1d3bd30

Browse files
authored
Merge pull request #9 from eFiniLan/0813-model
0813 model - Cont.
2 parents e48bf0e + 77a4f19 commit 1d3bd30

File tree

3 files changed

+6
-37
lines changed

3 files changed

+6
-37
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ I encourage users to consider purchasing a [comma 3](https://shop.comma.ai) for
4242
* Services are not optimized for resource usage, and using all services may result in overheating issues.
4343
* Language files can only be generated in a PC due to missing Qt5 tools.
4444
* webjoystick is disabled as it requires additional python modules. (aiohttp and others)
45-
* Starting from August 7th, 2023, comma has removed ESP/GPS support from Pandas. You can find more details about this change in this link.
45+
* Starting from August 7th, 2023, comma has removed ESP/GPS support from Pandas. You can find more details about this change in this [link](https://github.com/commaai/panda/commit/c66b98b2a67441faa4cfcd36c3c9d9f90474cd08).
4646
* Going forward, I will focus solely on maintaining the safety aspects of the code, ensuring that vehicle support and safety declarations remain up to date.
47+
* For safety concern, End-to-End / vision only longitudinal control only available in 0.8.16 driving model.
4748

4849

4950
## Configuration

selfdrive/controls/lib/legacy_lateral_planner.py

+1-35
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from openpilot.selfdrive.controls.lib.desire_helper import DesireHelper
1010
import cereal.messaging as messaging
1111
from cereal import log
12-
from openpilot.common.params import Params
1312

1413
STEER_RATE_COST = {
1514
"chrysler": 0.7,
@@ -29,9 +28,6 @@ class LateralPlanner:
2928
def __init__(self, CP, debug=False):
3029
self.LP = LanePlanner()
3130
self.DH = DesireHelper()
32-
self._dp_lat_lane_priority_mode = Params().get_bool("dp_lat_lane_priority_mode")
33-
self._dp_lat_lane_priority_mode_active = False
34-
self._dp_lat_lane_priority_mode_active_prev = False
3531

3632
self.last_cloudlog_t = 0
3733
try:
@@ -45,8 +41,6 @@ def __init__(self, CP, debug=False):
4541
self.plan_yaw = np.zeros((TRAJECTORY_SIZE,))
4642
self.t_idxs = np.arange(TRAJECTORY_SIZE)
4743
self.y_pts = np.zeros(TRAJECTORY_SIZE)
48-
# dp // mapd - for vision turn controller
49-
self._d_path_w_lines_xyz = np.zeros((TRAJECTORY_SIZE, 3))
5044

5145
self.lat_mpc = LateralMpc()
5246
self.reset_mpc(np.zeros(4))
@@ -78,11 +72,7 @@ def update(self, sm):
7872
self.LP.lll_prob *= self.DH.lane_change_ll_prob
7973
self.LP.rll_prob *= self.DH.lane_change_ll_prob
8074

81-
# dp - check laneline prob when priority is on
8275
use_laneline = False
83-
if self._dp_lat_lane_priority_mode:
84-
self._update_laneless_laneline_mode()
85-
use_laneline = self._dp_lat_lane_priority_mode_active
8676

8777
# Calculate final driving path and set MPC costs
8878
if use_laneline:
@@ -95,8 +85,6 @@ def update(self, sm):
9585
heading_cost = interp(v_ego, [5.0, 10.0], [MPC_COST_LAT.HEADING, 0.0])
9686
self.lat_mpc.set_weights(path_cost, heading_cost, self.steer_rate_cost)
9787

98-
self._d_path_w_lines_xyz = d_path_xyz
99-
10088
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])
10189
heading_pts = np.interp(v_ego * self.t_idxs[:LAT_MPC_N + 1], np.linalg.norm(self.path_xyz, axis=1), self.plan_yaw)
10290
self.y_pts = y_pts
@@ -146,30 +134,8 @@ def publish(self, sm, pm):
146134
lateralPlan.solverExecutionTime = self.lat_mpc.solve_time
147135

148136
lateralPlan.desire = self.DH.desire
149-
lateralPlan.useLaneLines = self._dp_lat_lane_priority_mode and self._dp_lat_lane_priority_mode_active
137+
lateralPlan.useLaneLines = False
150138
lateralPlan.laneChangeState = self.DH.lane_change_state
151139
lateralPlan.laneChangeDirection = self.DH.lane_change_direction
152140

153141
pm.send('lateralPlan', plan_send)
154-
155-
# dp - extension
156-
plan_ext_send = messaging.new_message('lateralPlanExt')
157-
158-
lateralPlanExt = plan_ext_send.lateralPlanExt
159-
# for vision turn controller
160-
lateralPlanExt.dPathWLinesX = [float(x) for x in self._d_path_w_lines_xyz[:, 0]]
161-
lateralPlanExt.dPathWLinesY = [float(y) for y in self._d_path_w_lines_xyz[:, 1]]
162-
163-
pm.send('lateralPlanExt', plan_ext_send)
164-
165-
def _update_laneless_laneline_mode(self):
166-
# decide what mode should we use
167-
if (self.LP.lll_prob + self.LP.rll_prob)/2 < 0.3:
168-
self._dp_lat_lane_priority_mode_active = False
169-
if (self.LP.lll_prob + self.LP.rll_prob)/2 > 0.5:
170-
self._dp_lat_lane_priority_mode_active = True
171-
172-
# perform reset mpc
173-
if self._dp_lat_lane_priority_mode_active != self._dp_lat_lane_priority_mode_active_prev:
174-
self.reset_mpc()
175-
self._dp_lat_lane_priority_mode_active_prev = self._dp_lat_lane_priority_mode_active

selfdrive/controls/plannerd.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def plannerd_thread(sm=None, pm=None):
4747

4848
longitudinal_planner = LongitudinalPlanner(CP)
4949
lateral_planner = LateralPlanner(CP, debug=debug_mode)
50+
is_old_model = Params().get_bool("dp_0813")
5051

5152
if sm is None:
5253
sm = messaging.SubMaster(['carControl', 'carState', 'controlsState', 'radarState', 'modelV2'],
@@ -63,7 +64,8 @@ def plannerd_thread(sm=None, pm=None):
6364
lateral_planner.publish(sm, pm)
6465
longitudinal_planner.update(sm)
6566
longitudinal_planner.publish(sm, pm)
66-
publish_ui_plan(sm, pm, lateral_planner, longitudinal_planner)
67+
if not is_old_model:
68+
publish_ui_plan(sm, pm, lateral_planner, longitudinal_planner)
6769

6870
def main(sm=None, pm=None):
6971
plannerd_thread(sm, pm)

0 commit comments

Comments
 (0)