New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
simpler logic? #16
Comments
Hi eFini, Thanks for looking into this! Just tested this today and it worked great. Each profile's behavior is working as expected. I think nothing else needs to be added and should be ready for release. I will refactor this in future updates as well. Thanks for the awesome work too! :) |
Hey eFini, I just took another look of the logic we have and it seems like we might have the modes flipped. 🙂 So with the current code:
# Turn off lanes during lane change
if self.desire == log.LateralPlan.Desire.laneChangeRight or self.desire == log.LateralPlan.Desire.laneChangeLeft:
self.LP.lll_prob *= self.lane_change_ll_prob
self.LP.rll_prob *= self.lane_change_ll_prob
if self.get_dlp_laneless_mode(): # Method returns TRUE - User/DLP wants to use Laneless/e2e
# laneline logic
# Below executes Laneline model in lateral planner instead
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)
# Displays *Laneless* onroad instead
self.laneless_mode_is_e2e = True # store auto mode value
else: # Method returns FALSE - User/DLP wants to use Laneline
# laneless logic
# Below executes Laneless/e2e model in lateral planner instead
d_path_xyz = self.path_xyz
path_cost = np.clip(abs(self.path_xyz[0, 1] / self.path_xyz_stds[0, 1]), 0.5, 1.5) * MPC_COST_LAT.PATH
# 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.0])
self.lat_mpc.set_weights(path_cost, heading_cost, self.steer_rate_cost)
# Displays *Laneline* onroad instead
self.laneless_mode_is_e2e = False # store auto mode value I flipped the logic to use and display the correct model and state when the method is called. Can you please take a look and let me know if it looks okay? # Turn off lanes during lane change
if self.desire == log.LateralPlan.Desire.laneChangeRight or self.desire == log.LateralPlan.Desire.laneChangeLeft:
self.LP.lll_prob *= self.lane_change_ll_prob
self.LP.rll_prob *= self.lane_change_ll_prob
if self.get_dlp_laneless_mode(): # Method returns TRUE - User/DLP wants to use Laneless/e2e
# laneless logic
# Below executes Laneless/e2e model in lateral planner correctly
d_path_xyz = self.path_xyz
path_cost = np.clip(abs(self.path_xyz[0, 1] / self.path_xyz_stds[0, 1]), 0.5, 1.5) * MPC_COST_LAT.PATH
# 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.0])
self.lat_mpc.set_weights(path_cost, heading_cost, self.steer_rate_cost)
# Displays *Laneless* onroad correctly
self.laneless_mode_is_e2e = True # store auto mode value
else: # Method returns FALSE - User/DLP wants to use Laneline
# laneline logic
# Below executes Laneline model in lateral planner correctly
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)
# Displays *Laneline* onroad correctly
self.laneless_mode_is_e2e = False # store auto mode value Thanks! :) |
Resolved. |
https://github.com/sunnyhaibin/openpilot/blob/f106563174bba424f3afa0c83006fbf11034eba4/selfdrive/controls/lib/lateral_planner.py#L184
Hey Sunny,
I've simplified your DLP code a bit (too many repeated codes), could you please take a look and let me know if anything is missing?
thanks for the awesome work! :)
The text was updated successfully, but these errors were encountered: