24 template <
typename AttributesT>
26 for (
auto &&attribute : attributes) {
27 if (attribute.GetId() ==
"sticky_control") {
28 return attribute.template As<bool>();
59 GetEpisode().
Lock()->ApplyAckermannControlToVehicle(*
this, control);
67 GetEpisode().
Lock()->ApplyAckermannControllerSettings(*
this, settings);
71 GetEpisode().
Lock()->ApplyPhysicsControlToVehicle(*
this, physics_control);
87 GetEpisode().
Lock()->SetWheelSteerDirection(*
this, wheel_location, angle_in_deg);
91 return GetEpisode().
Lock()->GetWheelSteerAngle(*
this, wheel_location);
95 return GetEpisode().
Lock()->GetActorSnapshot(*this).state.vehicle_data.control;
103 return GetEpisode().
Lock()->GetVehicleLightState(*this).GetLightStateEnum();
107 return GetEpisode().
Lock()->GetActorSnapshot(*this).state.vehicle_data.speed_limit;
111 return GetEpisode().
Lock()->GetActorSnapshot(*this).state.vehicle_data.traffic_light_state;
115 return GetEpisode().
Lock()->GetActorSnapshot(*this).state.vehicle_data.has_traffic_light;
119 auto id =
GetEpisode().
Lock()->GetActorSnapshot(*this).state.vehicle_data.traffic_light_id;
120 return boost::static_pointer_cast<TrafficLight>(
GetWorld().GetActor(
id));
132 uint64_t MaxSubsteps,
133 float MaxSubstepDeltaTime,
134 std::string VehicleJSON,
135 std::string PowertrainJSON,
136 std::string TireJSON,
137 std::string BaseJSONPath) {
148 return GetEpisode().
Lock()->GetActorSnapshot(*this).state.vehicle_data.failure_state;
SharedPtr< TrafficLight > GetTrafficLight() const
Retrieve the traffic light actor currently affecting this vehicle.
Vehicle(ActorInitializer init)
float GetWheelSteerAngle(WheelLocation wheel_location)
Return a Rotation from a wheel of the vehicle.
void SetAutopilot(bool enabled=true, uint16_t tm_port=TM_DEFAULT_PORT)
Switch on/off this vehicle's autopilot.
void EnableCarSim(std::string simfile_path)
Enables CarSim simulation if it is availiable.
float GetSpeedLimit() const
Return the speed limit currently affecting this vehicle.
rpc::VehicleFailureState GetFailureState() const
Returns the failure state of the vehicle.
void EnableChronoPhysics(uint64_t MaxSubsteps, float MaxSubstepDeltaTime, std::string VehicleJSON="", std::string PowertrainJSON="", std::string TireJSON="", std::string BaseJSONPath="")
const bool _is_control_sticky
boost::shared_ptr< T > SharedPtr
Use this SharedPtr (boost::shared_ptr) to keep compatibility with boost::python, but it would be nice...
This file contains definitions of common data structures used in traffic manager. ...
EpisodeProxy & GetEpisode()
void RegisterVehicles(const std::vector< ActorPtr > &actor_list)
This method registers a vehicle with the traffic manager.
static bool GetControlIsSticky(const AttributesT &attributes)
LightState GetLightState() const
Return the current open lights (LightState) of this vehicle.
Used to initialize Actor classes.
Control GetControl() const
Return the control last applied to this vehicle.
bool IsAtTrafficLight()
Return whether a traffic light is affecting this vehicle.
void ApplyAckermannControllerSettings(const rpc::AckermannControllerSettings &settings)
Apply Ackermann control settings to this vehicle.
void UnregisterVehicles(const std::vector< ActorPtr > &actor_list)
This method unregisters a vehicle from traffic manager.
rpc::AckermannControllerSettings GetAckermannControllerSettings() const
Return the last Ackermann controller settings applied to this vehicle.
This class integrates all the various stages of the traffic manager appropriately using messengers...
rpc::TrafficLightState GetTrafficLightState() const
Return the state of the traffic light currently affecting this vehicle.
LightState
Can be used as flags.
void ApplyControl(const Control &control)
Apply control to this vehicle.
void SetLightState(const LightState &light_state)
Sets a LightState to this vehicle.
PhysicsControl GetPhysicsControl() const
Return the physics control last applied to this vehicle.
void ShowDebugTelemetry(bool enabled=true)
Switch on/off this vehicle's autopilot.
void ApplyPhysicsControl(const PhysicsControl &physics_control)
Apply physics control to this vehicle.
Represents an actor in the simulation.
void SetWheelSteerDirection(WheelLocation wheel_location, float angle_in_deg)
Sets a Rotation to a wheel of the vehicle (affects the bone of the car skeleton, not the physics) ...
void OpenDoor(const VehicleDoor door_idx)
Open a door in this vehicle.
SharedPtrType Lock() const
Same as TryLock but never return nullptr.
Defines the physical appearance of a vehicle whitch is obtained by the sensors.
void ApplyAckermannControl(const AckermannControl &control)
Apply control to this vehicle.
void UseCarSimRoad(bool enabled)
Enables the use of CarSim internal road definition instead of unreal's.
void CloseDoor(const VehicleDoor door_idx)
Close a door in this vehicle.