Fixed waypoint bug + new speed limits

This commit is contained in:
Guillermo 2022-06-27 16:31:56 +02:00 committed by Axel1092
parent e2cc3cc58e
commit 10160da614
3 changed files with 29 additions and 0 deletions

View File

@ -1,5 +1,7 @@
## Latest
* Fixed bug causing traffic signals at the end points of a road to sometimes create malformed waypoints.
* Added the speed limits for 100, 110 and 120 Km/h.
* Fixed bug at `Vehicle.get_traffic_light_state()` and `Vehicle.is_at_traffic_light()` causing vehicles to temporarily not lose the information of a traffic light if they moved away from it before it turned green.
* Fixed bug causing the `Vehicle.get_traffic_light_state()` function not notify about the green to yellow and yellow to red light state changes.
* Fixed bug causing the `Vehicle.is_at_traffic_light()` function to return *false* if the traffic light was green.

View File

@ -546,6 +546,9 @@ namespace road {
const Waypoint waypoint,
const double distance) const {
RELEASE_ASSERT(distance > 0.0);
if (distance <= EPSILON) {
return {waypoint};
}
const auto &lane = GetLane(waypoint);
const bool forward = (waypoint.lane_id <= 0);
const double signed_distance = forward ? distance : -distance;
@ -579,6 +582,9 @@ namespace road {
const Waypoint waypoint,
const double distance) const {
RELEASE_ASSERT(distance > 0.0);
if (distance <= EPSILON) {
return {waypoint};
}
const auto &lane = GetLane(waypoint);
const bool forward = !(waypoint.lane_id <= 0);
const double signed_distance = forward ? distance : -distance;

View File

@ -98,6 +98,27 @@ ATrafficLightManager::ATrafficLightManager()
TSubclassOf<AActor> SpeedLimitModel = SpeedLimit90Finder.Class;
SpeedLimitModels.Add("90", SpeedLimitModel);
}
static ConstructorHelpers::FClassFinder<AActor> SpeedLimit100Finder(
TEXT( "/Game/Carla/Static/TrafficSign/BP_SpeedLimit100" ) );
if (SpeedLimit100Finder.Succeeded())
{
TSubclassOf<AActor> SpeedLimitModel = SpeedLimit100Finder.Class;
SpeedLimitModels.Add("100", SpeedLimitModel);
}
static ConstructorHelpers::FClassFinder<AActor> SpeedLimit110Finder(
TEXT( "/Game/Carla/Static/TrafficSign/BP_SpeedLimit110" ) );
if (SpeedLimit110Finder.Succeeded())
{
TSubclassOf<AActor> SpeedLimitModel = SpeedLimit110Finder.Class;
SpeedLimitModels.Add("110", SpeedLimitModel);
}
static ConstructorHelpers::FClassFinder<AActor> SpeedLimit120Finder(
TEXT( "/Game/Carla/Static/TrafficSign/BP_SpeedLimit120" ) );
if (SpeedLimit120Finder.Succeeded())
{
TSubclassOf<AActor> SpeedLimitModel = SpeedLimit120Finder.Class;
SpeedLimitModels.Add("120", SpeedLimitModel);
}
TrafficLightGroupMissingId = -2;
}