Fixes from review
This commit is contained in:
parent
938ee194d8
commit
b7a1c8ad6a
|
@ -60,7 +60,7 @@ namespace detail {
|
|||
}
|
||||
}
|
||||
_simulator.lock()->ApplyBatchSync(std::move(commands), false);
|
||||
|
||||
|
||||
// check if any agent has been killed
|
||||
bool alive;
|
||||
for (auto handle : *walkers) {
|
||||
|
|
|
@ -46,8 +46,8 @@ namespace nav {
|
|||
double time;
|
||||
bool check_for_trafficlight;
|
||||
SharedPtr<carla::client::TrafficLight> actor;
|
||||
WalkerEventStopAndCheck(double duration) : time(duration),
|
||||
check_for_trafficlight(true)
|
||||
WalkerEventStopAndCheck(double duration) : time(duration),
|
||||
check_for_trafficlight(true)
|
||||
{};
|
||||
};
|
||||
|
||||
|
|
|
@ -288,7 +288,8 @@ namespace nav {
|
|||
// check traffic lights only
|
||||
if (actor.description.id == "traffic.traffic_light") {
|
||||
// get the TL actor
|
||||
SharedPtr<carla::client::TrafficLight> tl = boost::static_pointer_cast<carla::client::TrafficLight>(world.GetActor(actor.id));
|
||||
SharedPtr<carla::client::TrafficLight> tl =
|
||||
boost::static_pointer_cast<carla::client::TrafficLight>(world.GetActor(actor.id));
|
||||
// get the waypoints where the TL affects
|
||||
std::vector<SharedPtr<carla::client::Waypoint>> list = tl->GetStopWaypoints();
|
||||
for (auto &way : list) {
|
||||
|
@ -302,22 +303,24 @@ namespace nav {
|
|||
|
||||
|
||||
// return the trafficlight affecting that position
|
||||
SharedPtr<carla::client::TrafficLight> WalkerManager::GetTrafficLightAffecting(carla::geom::Location UnrealPos, float max_distance) {
|
||||
float min_dist = std::numeric_limits<float>::infinity();
|
||||
SharedPtr<carla::client::TrafficLight> actor;
|
||||
for (auto &&item : _traffic_lights) {
|
||||
float dist = UnrealPos.DistanceSquared(item.second);
|
||||
if (dist < min_dist) {
|
||||
min_dist = dist;
|
||||
actor = item.first;
|
||||
SharedPtr<carla::client::TrafficLight> WalkerManager::GetTrafficLightAffecting(
|
||||
carla::geom::Location UnrealPos,
|
||||
float max_distance) {
|
||||
float min_dist = std::numeric_limits<float>::infinity();
|
||||
SharedPtr<carla::client::TrafficLight> actor;
|
||||
for (auto &&item : _traffic_lights) {
|
||||
float dist = UnrealPos.DistanceSquared(item.second);
|
||||
if (dist < min_dist) {
|
||||
min_dist = dist;
|
||||
actor = item.first;
|
||||
}
|
||||
}
|
||||
// if distance is not in the limit, then reject the trafficlight
|
||||
if (max_distance < 0.0f || min_dist <= max_distance * max_distance) {
|
||||
return actor;
|
||||
} else {
|
||||
return SharedPtr<carla::client::TrafficLight>();
|
||||
}
|
||||
}
|
||||
// if distance is not in the limit, then reject the trafficlight
|
||||
if (max_distance < 0.0f || min_dist <= max_distance * max_distance) {
|
||||
return actor;
|
||||
} else {
|
||||
return SharedPtr<carla::client::TrafficLight>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ public:
|
|||
ECarlaServerResponse AddActorTorque(const FVector& Torque);
|
||||
|
||||
virtual ECarlaServerResponse SetActorSimulatePhysics(bool bEnabled);
|
||||
|
||||
|
||||
virtual ECarlaServerResponse SetActorCollisions(bool bEnabled);
|
||||
|
||||
virtual ECarlaServerResponse SetActorEnableGravity(bool bEnabled);
|
||||
|
|
Loading…
Reference in New Issue