Implemented parameter for OSM mode.
This commit is contained in:
parent
d240c8dca6
commit
bc5871330a
|
@ -133,6 +133,10 @@ void Parameters::SetHybridPhysicsRadius(const float radius) {
|
|||
hybrid_physics_radius.store(new_radius);
|
||||
}
|
||||
|
||||
void Parameters::SetOSMMode(const bool mode_switch) {
|
||||
osm_mode.store(mode_switch);
|
||||
}
|
||||
|
||||
//////////////////////////////////// GETTERS //////////////////////////////////
|
||||
|
||||
float Parameters::GetHybridPhysicsRadius() const {
|
||||
|
@ -269,5 +273,10 @@ bool Parameters::GetHybridPhysicsMode() const {
|
|||
return hybrid_physics_mode.load();
|
||||
}
|
||||
|
||||
bool Parameters::GetOSMMode() {
|
||||
|
||||
return osm_mode.load();
|
||||
}
|
||||
|
||||
} // namespace traffic_manager
|
||||
} // namespace carla
|
||||
|
|
|
@ -64,6 +64,8 @@ private:
|
|||
std::atomic<bool> hybrid_physics_mode{false};
|
||||
/// Hybrid physics radius.
|
||||
std::atomic<float> hybrid_physics_radius {70.0};
|
||||
/// Parameter specifying Open Street Map mode.
|
||||
std::atomic<bool> osm_mode {false};
|
||||
|
||||
public:
|
||||
Parameters();
|
||||
|
@ -126,6 +128,9 @@ public:
|
|||
/// Method to set hybrid physics radius.
|
||||
void SetHybridPhysicsRadius(const float radius);
|
||||
|
||||
/// Method to set Open Street Map mode.
|
||||
void SetOSMMode(const bool mode_switch);
|
||||
|
||||
///////////////////////////////// GETTERS /////////////////////////////////////
|
||||
|
||||
/// Method to retrieve hybrid physics radius.
|
||||
|
@ -170,6 +175,9 @@ public:
|
|||
/// Method to retrieve hybrid physics mode.
|
||||
bool GetHybridPhysicsMode() const;
|
||||
|
||||
/// Method to get Open Street Map mode.
|
||||
bool GetOSMMode();
|
||||
|
||||
/// Synchronous mode time out variable.
|
||||
std::chrono::duration<double, std::milli> synchronous_time_out;
|
||||
};
|
||||
|
|
|
@ -57,6 +57,14 @@ public:
|
|||
return (_port > 1023);
|
||||
}
|
||||
|
||||
/// Method to set Open Street Map mode.
|
||||
void SetOSMMode(const bool mode_switch) {
|
||||
TrafficManagerBase* tm_ptr = GetTM(_port);
|
||||
if (tm_ptr != nullptr) {
|
||||
tm_ptr->SetOSMMode(mode_switch);
|
||||
}
|
||||
}
|
||||
|
||||
/// This method sets the hybrid physics mode.
|
||||
void SetHybridPhysicsMode(const bool mode_switch) {
|
||||
TrafficManagerBase* tm_ptr = GetTM(_port);
|
||||
|
|
|
@ -104,6 +104,9 @@ public:
|
|||
/// Method to set hybrid physics radius.
|
||||
virtual void SetHybridPhysicsRadius(const float radius) = 0;
|
||||
|
||||
/// Method to set Open Street Map mode.
|
||||
virtual void SetOSMMode(const bool mode_switch) = 0;
|
||||
|
||||
protected:
|
||||
|
||||
};
|
||||
|
|
|
@ -193,6 +193,12 @@ public:
|
|||
_client->call("set_hybrid_physics_radius", radius);
|
||||
}
|
||||
|
||||
/// Method to set Open Street Map mode.
|
||||
void SetOSMMode(const bool mode_switch) {
|
||||
DEBUG_ASSERT(_client != nullptr);
|
||||
_client->call("set_osm_mode", mode_switch);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/// RPC client.
|
||||
|
|
|
@ -338,6 +338,10 @@ void TrafficManagerLocal::SetHybridPhysicsRadius(const float radius) {
|
|||
parameters.SetHybridPhysicsRadius(radius);
|
||||
}
|
||||
|
||||
void TrafficManagerLocal::SetOSMMode(const bool mode_switch) {
|
||||
parameters.SetOSMMode(mode_switch);
|
||||
}
|
||||
|
||||
bool TrafficManagerLocal::CheckAllFrozen(TLGroup tl_to_freeze) {
|
||||
for (auto &elem : tl_to_freeze) {
|
||||
if (!elem->IsFrozen() || elem->GetState() != TLS::Red) {
|
||||
|
|
|
@ -214,6 +214,9 @@ public:
|
|||
|
||||
/// Method to set hybrid physics radius.
|
||||
void SetHybridPhysicsRadius(const float radius);
|
||||
|
||||
/// Method to set Open Street Map mode.
|
||||
void SetOSMMode(const bool mode_switch);
|
||||
};
|
||||
|
||||
} // namespace traffic_manager
|
||||
|
|
|
@ -181,6 +181,10 @@ void TrafficManagerRemote::SetHybridPhysicsRadius(const float radius) {
|
|||
client.SetHybridPhysicsRadius(radius);
|
||||
}
|
||||
|
||||
void TrafficManagerRemote::SetOSMMode(const bool mode_switch) {
|
||||
client.SetOSMMode(mode_switch);
|
||||
}
|
||||
|
||||
void TrafficManagerRemote::ResetAllTrafficLights() {
|
||||
client.ResetAllTrafficLights();
|
||||
}
|
||||
|
|
|
@ -102,6 +102,9 @@ public:
|
|||
/// Method to set hybrid physics radius.
|
||||
void SetHybridPhysicsRadius(const float radius);
|
||||
|
||||
/// Method to set Open Street Map mode.
|
||||
void SetOSMMode(const bool mode_switch);
|
||||
|
||||
/// Method to provide synchronous tick
|
||||
bool SynchronousTick();
|
||||
|
||||
|
|
|
@ -163,6 +163,11 @@ public:
|
|||
tm->SetHybridPhysicsRadius(radius);
|
||||
});
|
||||
|
||||
/// Method to set hybrid physics radius.
|
||||
server->bind("set_osm_mode", [=](const bool mode_switch) {
|
||||
tm->SetHybridPhysicsRadius(mode_switch);
|
||||
});
|
||||
|
||||
/// Method to set synchronous mode.
|
||||
server->bind("set_synchronous_mode", [=](const bool mode) {
|
||||
tm->SetSynchronousMode(mode);
|
||||
|
|
|
@ -33,5 +33,6 @@ void export_trafficmanager() {
|
|||
.def("set_percentage_keep_right_rule", &carla::traffic_manager::TrafficManager::SetKeepRightPercentage)
|
||||
.def("set_synchronous_mode", &carla::traffic_manager::TrafficManager::SetSynchronousMode)
|
||||
.def("set_hybrid_physics_mode", &carla::traffic_manager::TrafficManager::SetHybridPhysicsMode)
|
||||
.def("set_hybrid_physics_radius", &carla::traffic_manager::TrafficManager::SetHybridPhysicsRadius);
|
||||
.def("set_hybrid_physics_radius", &carla::traffic_manager::TrafficManager::SetHybridPhysicsRadius)
|
||||
.def("set_osm_mode", &carla::traffic_manager::TrafficManager::SetOSMMode);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue