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 GetEpisode().
Lock()->SetWheelPitchAngle(*
this, wheel_location, angle_in_deg);
99 return GetEpisode().
Lock()->GetWheelPitchAngle(*
this, wheel_location);
103 GetEpisode().
Lock()->SetWheelSuspensionOffset(*
this, wheel_location, offset);
107 return GetEpisode().
Lock()->GetWheelSuspensionOffset(*
this, wheel_location);
115 return GetEpisode().
Lock()->GetActorSnapshot(*this).state.vehicle_data.control;
127 return GetEpisode().
Lock()->GetVehicleLightState(*this).GetLightStateEnum();
135 return GetEpisode().
Lock()->GetActorSnapshot(*this).state.vehicle_data.speed_limit;
139 return GetEpisode().
Lock()->GetActorSnapshot(*this).state.vehicle_data.traffic_light_state;
143 return GetEpisode().
Lock()->GetActorSnapshot(*this).state.vehicle_data.has_traffic_light;
147 auto id =
GetEpisode().
Lock()->GetActorSnapshot(*this).state.vehicle_data.traffic_light_id;
148 return std::static_pointer_cast<TrafficLight>(
GetWorld().GetActor(
id));
160 uint64_t MaxSubsteps,
161 float MaxSubstepDeltaTime,
162 std::string VehicleJSON,
163 std::string PowertrainJSON,
164 std::string TireJSON,
165 std::string BaseJSONPath) {
176 return GetEpisode().
Lock()->GetActorSnapshot(*this).state.vehicle_data.failure_state;
Used to initialize Actor classes.
Actor(ActorInitializer init)
rpc::VehicleTelemetryData TelemetryData
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 runtime telemetry of this vehicle: forward speed, last applied control inputs,...
void ApplyControl(const Control &control)
Apply control to this vehicle.
void SetWheelAnimationOverride(bool enabled)
Enables or disables the wheel animation override, in which the wheels show only the values set throug...
rpc::VehiclePhysicsControl PhysicsControl
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.
rpc::VehicleAckermannControl AckermannControl
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.
float GetWheelSuspensionOffset(WheelLocation wheel_location)
Return the suspension compression of a wheel, in meters.
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.
void SetWheelPitchAngle(WheelLocation wheel_location, float angle_in_deg)
Sets the spin angle of a wheel, in degrees (affects the bone of the car skeleton, not the physics).
SharedPtr< TrafficLight > GetTrafficLight() const
Retrieve the traffic light actor currently affecting this vehicle.
void SetWheelSuspensionOffset(WheelLocation wheel_location, float offset)
Sets the suspension compression of a wheel, in meters (affects the bone of the car skeleton,...
rpc::VehicleControl Control
Control GetControl() const
Return the control last applied to this vehicle.
std::vector< geom::Transform > GetVehicleBoneWorldTransforms() const
void UseCarSimRoad(bool enabled)
Enables the use of CarSim internal road definition instead of unreal's.
carla::rpc::VehicleWheelLocation WheelLocation
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="")
float GetWheelPitchAngle(WheelLocation wheel_location)
Return the spin angle of a wheel, in degrees.
rpc::VehicleLightState::LightState LightState
rpc::VehicleDoor VehicleDoor
void SetLightState(const LightState &light_state)
Sets a LightState to this vehicle.
rpc::VehicleFailureState GetFailureState() const
Returns the failure state of the vehicle.
traffic_manager::TrafficManager TM
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()
const std::vector< ActorAttributeValue > & GetAttributes() const
SharedPtrType Lock() const
Same as TryLock but never return nullptr.
Defines the physical appearance of a vehicle whitch is obtained by the sensors.
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.
std::shared_ptr< T > SharedPtr
traffic_manager::TrafficManager TM