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