Added reset all traffic lights function.
This commit is contained in:
parent
f1dd2d77fa
commit
a75fc59eb0
|
@ -150,6 +150,10 @@ namespace client {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void World::ResetAllTrafficLights() {
|
||||||
|
_episode.Lock()->ResetAllTrafficLights();
|
||||||
|
}
|
||||||
|
|
||||||
SharedPtr<LightManager> World::GetLightManager() const {
|
SharedPtr<LightManager> World::GetLightManager() const {
|
||||||
return _episode.Lock()->GetLightManager();
|
return _episode.Lock()->GetLightManager();
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,6 +138,8 @@ namespace client {
|
||||||
|
|
||||||
SharedPtr<Actor> GetTrafficLight(const Landmark& landmark) const;
|
SharedPtr<Actor> GetTrafficLight(const Landmark& landmark) const;
|
||||||
|
|
||||||
|
void ResetAllTrafficLights();
|
||||||
|
|
||||||
SharedPtr<LightManager> GetLightManager() const;
|
SharedPtr<LightManager> GetLightManager() const;
|
||||||
|
|
||||||
DebugHelper MakeDebugHelper() const {
|
DebugHelper MakeDebugHelper() const {
|
||||||
|
|
|
@ -326,6 +326,10 @@ namespace detail {
|
||||||
_pimpl->AsyncCall("reset_traffic_light_group", traffic_light);
|
_pimpl->AsyncCall("reset_traffic_light_group", traffic_light);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Client::ResetAllTrafficLights() {
|
||||||
|
_pimpl->AsyncCall("reset_all_traffic_lights");
|
||||||
|
}
|
||||||
|
|
||||||
void Client::FreezeAllTrafficLights(bool frozen) {
|
void Client::FreezeAllTrafficLights(bool frozen) {
|
||||||
_pimpl->AsyncCall("freeze_all_traffic_lights", frozen);
|
_pimpl->AsyncCall("freeze_all_traffic_lights", frozen);
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,6 +205,8 @@ namespace detail {
|
||||||
void ResetTrafficLightGroup(
|
void ResetTrafficLightGroup(
|
||||||
rpc::ActorId traffic_light);
|
rpc::ActorId traffic_light);
|
||||||
|
|
||||||
|
void ResetAllTrafficLights();
|
||||||
|
|
||||||
void FreezeAllTrafficLights(bool frozen);
|
void FreezeAllTrafficLights(bool frozen);
|
||||||
|
|
||||||
/// Returns a list of pairs where the firts element is the vehicle ID
|
/// Returns a list of pairs where the firts element is the vehicle ID
|
||||||
|
|
|
@ -473,6 +473,10 @@ namespace detail {
|
||||||
_client.ResetTrafficLightGroup(trafficLight.GetId());
|
_client.ResetTrafficLightGroup(trafficLight.GetId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResetAllTrafficLights() {
|
||||||
|
_client.ResetAllTrafficLights();
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<ActorId> GetGroupTrafficLights(TrafficLight &trafficLight) {
|
std::vector<ActorId> GetGroupTrafficLights(TrafficLight &trafficLight) {
|
||||||
return _client.GetGroupTrafficLights(trafficLight.GetId());
|
return _client.GetGroupTrafficLights(trafficLight.GetId());
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,6 +202,7 @@ void export_world() {
|
||||||
.def("set_pedestrians_cross_factor", CALL_WITHOUT_GIL_1(cc::World, SetPedestriansCrossFactor, float), (arg("percentage")))
|
.def("set_pedestrians_cross_factor", CALL_WITHOUT_GIL_1(cc::World, SetPedestriansCrossFactor, float), (arg("percentage")))
|
||||||
.def("get_traffic_sign", CONST_CALL_WITHOUT_GIL_1(cc::World, GetTrafficSign, cc::Landmark), arg("landmark"))
|
.def("get_traffic_sign", CONST_CALL_WITHOUT_GIL_1(cc::World, GetTrafficSign, cc::Landmark), arg("landmark"))
|
||||||
.def("get_traffic_light", CONST_CALL_WITHOUT_GIL_1(cc::World, GetTrafficLight, cc::Landmark), arg("landmark"))
|
.def("get_traffic_light", CONST_CALL_WITHOUT_GIL_1(cc::World, GetTrafficLight, cc::Landmark), arg("landmark"))
|
||||||
|
.def("reset_all_traffic_lights", &cc::World::ResetAllTrafficLights)
|
||||||
.def("get_lightmanager", CONST_CALL_WITHOUT_GIL(cc::World, GetLightManager))
|
.def("get_lightmanager", CONST_CALL_WITHOUT_GIL(cc::World, GetLightManager))
|
||||||
.def("freeze_all_traffic_lights", &cc::World::FreezeAllTrafficLights, (arg("frozen")))
|
.def("freeze_all_traffic_lights", &cc::World::FreezeAllTrafficLights, (arg("frozen")))
|
||||||
.def("get_level_bbs", &GetLevelBBs, (arg("actor_type")=cr::CityObjectLabel::None))
|
.def("get_level_bbs", &GetLevelBBs, (arg("actor_type")=cr::CityObjectLabel::None))
|
||||||
|
|
|
@ -906,6 +906,16 @@ void FCarlaServer::FPimpl::BindActions()
|
||||||
return R<void>::Success();
|
return R<void>::Success();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BIND_SYNC(reset_all_traffic_lights) << [this]() -> R<void>
|
||||||
|
{
|
||||||
|
REQUIRE_CARLA_EPISODE();
|
||||||
|
for (TActorIterator<ATrafficLightGroup> It(Episode->GetWorld()); It; ++It)
|
||||||
|
{
|
||||||
|
It->ResetGroup();
|
||||||
|
}
|
||||||
|
return R<void>::Success();
|
||||||
|
};
|
||||||
|
|
||||||
BIND_SYNC(freeze_all_traffic_lights) << [this]
|
BIND_SYNC(freeze_all_traffic_lights) << [this]
|
||||||
(bool frozen) -> R<void>
|
(bool frozen) -> R<void>
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue