CARLA
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
carla::client::Vehicle Class Reference

#include <Vehicle.h>

+ Inheritance diagram for carla::client::Vehicle:

Public Types

using AckermannControl = rpc::VehicleAckermannControl
 
using Control = rpc::VehicleControl
 
using LightState = rpc::VehicleLightState::LightState
 
using PhysicsControl = rpc::VehiclePhysicsControl
 
using TelemetryData = rpc::VehicleTelemetryData
 
using TM = traffic_manager::TrafficManager
 
using VehicleDoor = rpc::VehicleDoor
 
using WheelLocation = carla::rpc::VehicleWheelLocation
 

Public Member Functions

void ApplyAckermannControl (const AckermannControl &control)
 Apply control to this vehicle.
 
void ApplyAckermannControllerSettings (const rpc::AckermannControllerSettings &settings)
 Apply Ackermann control settings to this vehicle.
 
void ApplyControl (const Control &control)
 Apply control to this vehicle.
 
void ApplyPhysicsControl (const PhysicsControl &physics_control)
 Apply physics control to this vehicle.
 
void CloseDoor (const VehicleDoor door_idx)
 Close a door in this vehicle.
 
void EnableCarSim (std::string simfile_path)
 Enables CarSim simulation if it is availiable.
 
void EnableChronoPhysics (uint64_t MaxSubsteps, float MaxSubstepDeltaTime, std::string VehicleJSON="", std::string PowertrainJSON="", std::string TireJSON="", std::string BaseJSONPath="")
 
rpc::AckermannControllerSettings GetAckermannControllerSettings () const
 Return the last Ackermann controller settings applied to this vehicle.
 
Control GetControl () const
 Return the control last applied to this vehicle.
 
rpc::VehicleFailureState GetFailureState () const
 Returns the failure state of the vehicle.
 
LightState GetLightState () const
 Return the current open lights (LightState) of this vehicle.
 
PhysicsControl GetPhysicsControl () const
 Return the physics control last applied to this vehicle.
 
float GetSpeedLimit () const
 Return the speed limit currently affecting this vehicle.
 
TelemetryData GetTelemetryData () const
 Return the runtime telemetry of this vehicle: forward speed, last applied control inputs, engine RPM, current gear, and per-wheel lateral slip, longitudinal slip, and angular velocity sourced from the Chaos vehicle physics state.
 
SharedPtr< TrafficLight > GetTrafficLight () const
 Retrieve the traffic light actor currently affecting this vehicle.
 
rpc::TrafficLightState GetTrafficLightState () const
 Return the state of the traffic light currently affecting this vehicle.
 
std::vector< geom::Transform > GetVehicleBoneWorldTransforms () const
 
float GetWheelPitchAngle (WheelLocation wheel_location)
 Return the spin angle of a wheel, in degrees.
 
float GetWheelSteerAngle (WheelLocation wheel_location)
 Return a Rotation from a wheel of the vehicle.
 
float GetWheelSuspensionOffset (WheelLocation wheel_location)
 Return the suspension compression of a wheel, in meters.
 
bool IsAtTrafficLight ()
 Return whether a traffic light is affecting this vehicle.
 
void OpenDoor (const VehicleDoor door_idx)
 Open a door in this vehicle.
 
void SetAutopilot (bool enabled=true, uint16_t tm_port=TM_DEFAULT_PORT)
 Switch on/off this vehicle's autopilot.
 
void SetLightState (const LightState &light_state)
 Sets a LightState to this vehicle.
 
void SetWheelAnimationOverride (bool enabled)
 Enables or disables the wheel animation override, in which the wheels show only the values set through the wheel setters (affects the bones of the car skeleton, not the physics)
 
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)
 
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 SetWheelSuspensionOffset (WheelLocation wheel_location, float offset)
 Sets the suspension compression of a wheel, in meters (affects the bone of the car skeleton, not the physics)
 
void ShowDebugTelemetry (bool enabled=true)
 Switch on/off this vehicle's autopilot.
 
void UseCarSimRoad (bool enabled)
 Enables the use of CarSim internal road definition instead of unreal's.
 
 Vehicle (ActorInitializer init)
 
- Public Member Functions inherited from carla::client::Actor
 Actor (ActorInitializer init)
 
void AddAngularImpulse (const geom::Vector3D &vector)
 Add angular impulse to the actor.
 
void AddForce (const geom::Vector3D &force)
 Add force to the actor at its center of mass.
 
void AddForce (const geom::Vector3D &force, const geom::Vector3D &location)
 Add force to the actor at certain location.
 
void AddImpulse (const geom::Vector3D &impulse, const geom::Vector3D &location)
 Add impulse to the actor at certain location.
 
void AddImpulse (const geom::Vector3D &vector)
 Add impulse to the actor at its center of mass.
 
void AddTorque (const geom::Vector3D &vector)
 Add a torque to the actor.
 
void ApplyTexture (const rpc::MaterialParameter &MaterialParameter, const rpc::TextureColor &Texture)
 
void ApplyTexture (const rpc::MaterialParameter &MaterialParameter, const rpc::TextureFloatColor &Texture)
 
virtual bool Destroy ()
 Tell the simulator to destroy this Actor, and return whether the actor was successfully destroyed.
 
void DisableConstantAcceleration ()
 Disable the constant acceleration mode.
 
void DisableConstantVelocity ()
 Disable the constant velocity mode.
 
void EnableConstantAcceleration (const geom::Vector3D &vector)
 Enable a constant acceleration mode (direct acceleration, no pedal input)
 
void EnableConstantVelocity (const geom::Vector3D &vector)
 Enable a constant velocity mode.
 
geom::Vector3D GetAcceleration () const
 Return the current 3D acceleration of the actor.
 
std::string GetActorClassName () const
 Return the name of the underlying actor's Unreal class.
 
std::string GetActorName () const
 Return the name of the underlying Unreal actor.
 
rpc::ActorState GetActorState () const
 
geom::Vector3D GetAngularVelocity () const
 Return the current 3D angular velocity of the actor.
 
std::vector< std::string > GetBoneNames () const
 Return the names of every bone reachable from the actor's first skinned mesh component.
 
std::vector< geom::Transform > GetBoneRelativeTransforms () const
 Return the component-space transforms of every bone reachable from the actor's skinned mesh components.
 
std::vector< geom::Transform > GetBoneWorldTransforms () const
 Return the world-space transforms of every bone reachable from the actor's skinned mesh components.
 
std::vector< std::string > GetComponentNames () const
 Return the names of every actor component attached to the actor.
 
geom::Transform GetComponentRelativeTransform (const std::string &component_name) const
 Return the parent-relative transform of the scene component named component_name attached to the actor.
 
geom::Transform GetComponentWorldTransform (const std::string &component_name) const
 Return the world-space transform of the scene component named component_name attached to the actor.
 
geom::Location GetLocation () const
 Return the current location of the actor.
 
std::vector< std::string > GetSocketNames () const
 Return the names of every socket on every scene component attached to the actor.
 
std::vector< geom::Transform > GetSocketRelativeTransforms () const
 Return the actor-relative transforms of every socket on every scene component attached to the actor.
 
std::vector< geom::Transform > GetSocketWorldTransforms () const
 Return the world-space transforms of every socket on every scene component attached to the actor.
 
geom::Transform GetTransform () const
 Return the current transform of the actor.
 
geom::Vector3D GetVelocity () const
 Return the current 3D velocity of the actor.
 
bool IsActive () const
 
bool IsAlive () const
 
bool IsDormant () const
 
const auto & Serialize () const
 
void SetActorDead ()
 Set actor as dead and starts his life span.
 
void SetCollisions (bool enabled=true)
 Enable or disable collisions on this actor.
 
void SetEnableGravity (bool enabled=true)
 Enable or disable gravity on this actor.
 
void SetLocation (const geom::Location &location)
 Teleport the actor to location.
 
void SetSimulatePhysics (bool enabled=true)
 Enable or disable physics simulation on this actor.
 
void SetTargetAngularVelocity (const geom::Vector3D &vector)
 Set the angular velocity of the actor before applying physics.
 
void SetTargetVelocity (const geom::Vector3D &vector)
 Set the actor velocity before applying physics.
 
void SetTransform (const geom::Transform &transform)
 Teleport and rotate the actor to transform.
 
virtual ~Actor ()=default
 
- Public Member Functions inherited from carla::client::detail::ActorState
const std::vector< ActorAttributeValue > & GetAttributes () const
 
const std::string & GetDisplayId () const
 
ActorId GetId () const
 
SharedPtr< Actor > GetParent () const
 
ActorId GetParentId () const
 
const std::vector< uint8_t > & GetSemanticTags () const
 
uint64_t GetSpawnFrame () const
 Frame of the last world snapshot this client had received when the spawn of this actor was acknowledged by the server; unset for looked-up handles.
 
const std::string & GetTypeId () const
 
World GetWorld () const
 
bool WasSpawnedByThisClient () const
 Whether this handle was returned by a spawn call of this client, as opposed to being looked up (get_actor, get_actors, parent, spectator).
 

Private Attributes

Control _control
 
const bool _is_control_sticky
 

Additional Inherited Members

- Protected Member Functions inherited from carla::client::detail::ActorState
 ActorState (rpc::Actor description, EpisodeProxy episode)
 
const rpc::Actor & GetActorDescription () const
 
const geom::BoundingBox & GetBoundingBox () const
 
EpisodeProxy & GetEpisode ()
 
const EpisodeProxy & GetEpisode () const
 

Detailed Description

Definition at line 33 of file Vehicle.h.

Member Typedef Documentation

◆ AckermannControl

Definition at line 37 of file Vehicle.h.

◆ Control

Definition at line 36 of file Vehicle.h.

◆ LightState

Definition at line 40 of file Vehicle.h.

◆ PhysicsControl

Definition at line 38 of file Vehicle.h.

◆ TelemetryData

Definition at line 39 of file Vehicle.h.

◆ TM

Definition at line 41 of file Vehicle.h.

◆ VehicleDoor

Definition at line 42 of file Vehicle.h.

◆ WheelLocation

Definition at line 43 of file Vehicle.h.

Constructor & Destructor Documentation

◆ Vehicle()

carla::client::Vehicle::Vehicle ( ActorInitializer  init)
explicit

Definition at line 34 of file Vehicle.cpp.

Member Function Documentation

◆ ApplyAckermannControl()

void carla::client::Vehicle::ApplyAckermannControl ( const AckermannControl &  control)

Apply control to this vehicle.

Definition at line 58 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

◆ ApplyAckermannControllerSettings()

void carla::client::Vehicle::ApplyAckermannControllerSettings ( const rpc::AckermannControllerSettings &  settings)

Apply Ackermann control settings to this vehicle.

Definition at line 66 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

◆ ApplyControl()

void carla::client::Vehicle::ApplyControl ( const Control &  control)

◆ ApplyPhysicsControl()

void carla::client::Vehicle::ApplyPhysicsControl ( const PhysicsControl &  physics_control)

Apply physics control to this vehicle.

Definition at line 70 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

◆ CloseDoor()

void carla::client::Vehicle::CloseDoor ( const VehicleDoor  door_idx)

Close a door in this vehicle.

Definition at line 78 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

◆ EnableCarSim()

void carla::client::Vehicle::EnableCarSim ( std::string  simfile_path)

Enables CarSim simulation if it is availiable.

Definition at line 151 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

◆ EnableChronoPhysics()

void carla::client::Vehicle::EnableChronoPhysics ( uint64_t  MaxSubsteps,
float  MaxSubstepDeltaTime,
std::string  VehicleJSON = "",
std::string  PowertrainJSON = "",
std::string  TireJSON = "",
std::string  BaseJSONPath = "" 
)

◆ GetAckermannControllerSettings()

rpc::AckermannControllerSettings carla::client::Vehicle::GetAckermannControllerSettings ( ) const

Return the last Ackermann controller settings applied to this vehicle.

Warning
This function does call the simulator.

Definition at line 62 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

◆ GetControl()

Vehicle::Control carla::client::Vehicle::GetControl ( ) const

Return the control last applied to this vehicle.

Note
This function does not call the simulator, it returns the data received in the last tick.

Definition at line 114 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Referenced by carla::rss::RssCheck::GetSteeringAngle().

◆ GetFailureState()

rpc::VehicleFailureState carla::client::Vehicle::GetFailureState ( ) const

Returns the failure state of the vehicle.

Definition at line 175 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

◆ GetLightState()

Vehicle::LightState carla::client::Vehicle::GetLightState ( ) const

Return the current open lights (LightState) of this vehicle.

Note
This function does not call the simulator, it returns the data received in the last tick.

Definition at line 126 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

◆ GetPhysicsControl()

Vehicle::PhysicsControl carla::client::Vehicle::GetPhysicsControl ( ) const

Return the physics control last applied to this vehicle.

Warning
This function does call the simulator.

Definition at line 118 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

◆ GetSpeedLimit()

float carla::client::Vehicle::GetSpeedLimit ( ) const

Return the speed limit currently affecting this vehicle.

Note
This function does not call the simulator, it returns the data received in the last tick.

Definition at line 134 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

◆ GetTelemetryData()

Vehicle::TelemetryData carla::client::Vehicle::GetTelemetryData ( ) const

Return the runtime telemetry of this vehicle: forward speed, last applied control inputs, engine RPM, current gear, and per-wheel lateral slip, longitudinal slip, and angular velocity sourced from the Chaos vehicle physics state.

Warning
This function does call the simulator.

Definition at line 122 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

◆ GetTrafficLight()

SharedPtr< TrafficLight > carla::client::Vehicle::GetTrafficLight ( ) const

Retrieve the traffic light actor currently affecting this vehicle.

Definition at line 146 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), carla::client::detail::ActorState::GetWorld(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

◆ GetTrafficLightState()

rpc::TrafficLightState carla::client::Vehicle::GetTrafficLightState ( ) const

Return the state of the traffic light currently affecting this vehicle.

Returns
Green If no traffic light is affecting the vehicle.
Note
This function does not call the simulator, it returns the data received in the last tick.

Definition at line 138 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

◆ GetVehicleBoneWorldTransforms()

std::vector< geom::Transform > carla::client::Vehicle::GetVehicleBoneWorldTransforms ( ) const

◆ GetWheelPitchAngle()

float carla::client::Vehicle::GetWheelPitchAngle ( WheelLocation  wheel_location)

Return the spin angle of a wheel, in degrees.

Definition at line 98 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

◆ GetWheelSteerAngle()

float carla::client::Vehicle::GetWheelSteerAngle ( WheelLocation  wheel_location)

Return a Rotation from a wheel of the vehicle.

Note
The function returns the rotation of the vehicle based on the it's physics

Definition at line 90 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

◆ GetWheelSuspensionOffset()

float carla::client::Vehicle::GetWheelSuspensionOffset ( WheelLocation  wheel_location)

Return the suspension compression of a wheel, in meters.

Definition at line 106 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

◆ IsAtTrafficLight()

bool carla::client::Vehicle::IsAtTrafficLight ( )

Return whether a traffic light is affecting this vehicle.

Note
This function does not call the simulator, it returns the data received in the last tick.

Definition at line 142 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

◆ OpenDoor()

void carla::client::Vehicle::OpenDoor ( const VehicleDoor  door_idx)

◆ SetAutopilot()

void carla::client::Vehicle::SetAutopilot ( bool  enabled = true,
uint16_t  tm_port = TM_DEFAULT_PORT 
)

◆ SetLightState()

void carla::client::Vehicle::SetLightState ( const LightState &  light_state)

◆ SetWheelAnimationOverride()

void carla::client::Vehicle::SetWheelAnimationOverride ( bool  enabled)

Enables or disables the wheel animation override, in which the wheels show only the values set through the wheel setters (affects the bones of the car skeleton, not the physics)

Definition at line 110 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

◆ SetWheelPitchAngle()

void carla::client::Vehicle::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)

Definition at line 94 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

◆ SetWheelSteerDirection()

void carla::client::Vehicle::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)

Definition at line 86 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

◆ SetWheelSuspensionOffset()

void carla::client::Vehicle::SetWheelSuspensionOffset ( WheelLocation  wheel_location,
float  offset 
)

Sets the suspension compression of a wheel, in meters (affects the bone of the car skeleton, not the physics)

Definition at line 102 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

◆ ShowDebugTelemetry()

void carla::client::Vehicle::ShowDebugTelemetry ( bool  enabled = true)

Switch on/off this vehicle's autopilot.

Definition at line 47 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

◆ UseCarSimRoad()

void carla::client::Vehicle::UseCarSimRoad ( bool  enabled)

Enables the use of CarSim internal road definition instead of unreal's.

Definition at line 155 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), and carla::client::detail::EpisodeProxyImpl< PointerT >::Lock().

Member Data Documentation

◆ _control

Control carla::client::Vehicle::_control
private

Definition at line 176 of file Vehicle.h.

Referenced by ApplyControl().

◆ _is_control_sticky

const bool carla::client::Vehicle::_is_control_sticky
private

Definition at line 174 of file Vehicle.h.

Referenced by ApplyControl().


The documentation for this class was generated from the following files: