Added AdditionalDistance constant

This commit is contained in:
Joel Moriana 2022-05-05 12:06:39 +02:00 committed by Axel1092
parent 4d5d3a9169
commit e563a1e605
3 changed files with 12 additions and 6 deletions

View File

@ -63,14 +63,16 @@ void UStopSignComponent::InitializeSign(const carla::road::Map &Map)
// Get min and max
double LaneLength = Map.GetLane(box_waypoint).GetLength();
double LaneDistance = Map.GetLane(box_waypoint).GetDistance();
// Safe distance to avoid overlapping the bounding box with the intersection
float AdditionalDistance = 1.5f;
if(lane < 0)
{
box_waypoint.s = FMath::Clamp(box_waypoint.s - (BoxLength + 1.5f),
box_waypoint.s = FMath::Clamp(box_waypoint.s - (BoxLength + AdditionalDistance),
LaneDistance + epsilon, LaneDistance + LaneLength - epsilon);
}
else
{
box_waypoint.s = FMath::Clamp(box_waypoint.s + (BoxLength + 1.5f),
box_waypoint.s = FMath::Clamp(box_waypoint.s + (BoxLength + AdditionalDistance),
LaneDistance + epsilon, LaneDistance + LaneLength - epsilon);
}
FTransform BoxTransform = Map.ComputeTransform(box_waypoint);

View File

@ -65,14 +65,16 @@ void UTrafficLightComponent::InitializeSign(const carla::road::Map &Map)
// Get min and max
double LaneLength = Map.GetLane(signal_waypoint).GetLength();
double LaneDistance = Map.GetLane(signal_waypoint).GetDistance();
// Safe distance to avoid overlapping the bounding box with the intersection
float AdditionalDistance = 1.5f;
if(lane < 0)
{
signal_waypoint.s = FMath::Clamp(signal_waypoint.s - (BoxLength + 1.5f),
signal_waypoint.s = FMath::Clamp(signal_waypoint.s - (BoxLength + AdditionalDistance),
LaneDistance + epsilon, LaneDistance + LaneLength - epsilon);
}
else
{
signal_waypoint.s = FMath::Clamp(signal_waypoint.s + (BoxLength + 1.5f),
signal_waypoint.s = FMath::Clamp(signal_waypoint.s + (BoxLength + AdditionalDistance),
LaneDistance + epsilon, LaneDistance + LaneLength - epsilon);
}
FTransform BoxTransform = Map.ComputeTransform(signal_waypoint);

View File

@ -65,14 +65,16 @@ void UYieldSignComponent::InitializeSign(const carla::road::Map &Map)
// Get min and max
double LaneLength = Map.GetLane(box_waypoint).GetLength();
double LaneDistance = Map.GetLane(box_waypoint).GetDistance();
// Safe distance to avoid overlapping the bounding box with the intersection
float AdditionalDistance = 1.5f;
if(lane < 0)
{
box_waypoint.s = FMath::Clamp(box_waypoint.s - (BoxLength + 1.5f),
box_waypoint.s = FMath::Clamp(box_waypoint.s - (BoxLength + AdditionalDistance),
LaneDistance + epsilon, LaneDistance + LaneLength - epsilon);
}
else
{
box_waypoint.s = FMath::Clamp(box_waypoint.s + (BoxLength + 1.5f),
box_waypoint.s = FMath::Clamp(box_waypoint.s + (BoxLength + AdditionalDistance),
LaneDistance + epsilon, LaneDistance + LaneLength - epsilon);
}
FTransform BoxTransform = Map.ComputeTransform(box_waypoint);