Skip to content
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

Safe distance label lateral #525

Merged
merged 13 commits into from
Jun 7, 2021
Merged

Safe distance label lateral #525

merged 13 commits into from
Jun 7, 2021

Conversation

juloberno
Copy link
Contributor

  • Label Safe Distance: now includes option to calculate lateral safe distance
  • GetFrontRear now truly considers lateral difference offset with option to restrict it to lane polygon or not
  • Fixes in FrenetState and SingleTrackLaneChange controller (not working for intersection scenario)
  • Fix wrapping of primitives ConstAccStayLane

Copy link
Contributor

@klemense1 klemense1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems mostly fine, can you please elaborate on the lateral acceleration equations?

bark/commons/transformation/frenet_state.hpp Show resolved Hide resolved
@@ -50,7 +50,11 @@ BehaviorLaneChangeRuleBased::FrontRearAgents(
const ObservedWorld& observed_world,
const LaneCorridorPtr& lane_corr) const {
AgentInformation front_info, rear_info;
const auto& front_rear = observed_world.GetAgentFrontRear(lane_corr);
double lateral_difference_threshold = 100; // do not restrict regarding lateral diff
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the unit? meter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this not be externally settable via the parameter server?

bark/models/dynamic/single_track.hpp Show resolved Hide resolved
bark/models/dynamic/single_track.hpp Outdated Show resolved Hide resolved
@@ -50,7 +50,11 @@ BehaviorLaneChangeRuleBased::FrontRearAgents(
const ObservedWorld& observed_world,
const LaneCorridorPtr& lane_corr) const {
AgentInformation front_info, rear_info;
const auto& front_rear = observed_world.GetAgentFrontRear(lane_corr);
double lateral_difference_threshold = 100; // do not restrict regarding lateral diff
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this not be externally settable via the parameter server?

@@ -158,7 +191,7 @@ inline double CalculateSteeringAngle(const SingleTrackModelPtr& model,

FrenetState f_state = FrenetState(state_front, ref_line);
double vel = state(StateDefinition::VEL_POSITION);
double delta = -NormToPI(f_state.angle) + atan2(-gain * f_state.lat, vel);
double delta = +NormToPI(f_state.angle) + atan2(-gain * f_state.lat, vel);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for a + sign

@@ -461,6 +461,7 @@ def drawLaneCorridor(self, lane_corridor, color=None):
color = "blue"
self.drawPolygon2d(lane_corridor.polygon, color=color,
facecolor=color, alpha=.3, zorder=2)
self.drawLine2d(lane_corridor.center_line, "k")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could draw the center line in the same color as the lane corridor

@@ -162,10 +138,13 @@ bool SafeDistanceLabelFunction::CheckSafeDistance(
double t_stop_f = -v_f / a_f;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this assumes linear acceleration. would it not be better to use v=1/2at^2


import numpy as np
import itertools

# Name and Output Directory
# CHANGE THIS #
map_name = "DR_CHN_Merging_ZS_partial_v04_lower_edited"
map_name = "left_turn_rural"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use map that is publicly available, so one can e.g. visualize the lane corridor and understand the concept

@juloberno juloberno merged commit 6a96c41 into master Jun 7, 2021
@juloberno juloberno deleted the safe_distance_label_lateral branch June 15, 2022 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants