CARLA
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:
+ Collaboration 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 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. More...
 
void ApplyAckermannControllerSettings (const rpc::AckermannControllerSettings &settings)
 Apply Ackermann control settings to this vehicle. More...
 
void ApplyControl (const Control &control)
 Apply control to this vehicle. More...
 
void ApplyPhysicsControl (const PhysicsControl &physics_control)
 Apply physics control to this vehicle. More...
 
void CloseDoor (const VehicleDoor door_idx)
 Close a door in this vehicle. More...
 
void EnableCarSim (std::string simfile_path)
 Enables CarSim simulation if it is availiable. More...
 
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. More...
 
Control GetControl () const
 Return the control last applied to this vehicle. More...
 
rpc::VehicleFailureState GetFailureState () const
 Returns the failure state of the vehicle. More...
 
LightState GetLightState () const
 Return the current open lights (LightState) of this vehicle. More...
 
PhysicsControl GetPhysicsControl () const
 Return the physics control last applied to this vehicle. More...
 
float GetSpeedLimit () const
 Return the speed limit currently affecting this vehicle. More...
 
SharedPtr< TrafficLightGetTrafficLight () const
 Retrieve the traffic light actor currently affecting this vehicle. More...
 
rpc::TrafficLightState GetTrafficLightState () const
 Return the state of the traffic light currently affecting this vehicle. More...
 
float GetWheelSteerAngle (WheelLocation wheel_location)
 Return a Rotation from a wheel of the vehicle. More...
 
bool IsAtTrafficLight ()
 Return whether a traffic light is affecting this vehicle. More...
 
void OpenDoor (const VehicleDoor door_idx)
 Open a door in this vehicle. More...
 
void SetAutopilot (bool enabled=true, uint16_t tm_port=TM_DEFAULT_PORT)
 Switch on/off this vehicle's autopilot. More...
 
void SetLightState (const LightState &light_state)
 Sets a LightState to this vehicle. More...
 
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) More...
 
void ShowDebugTelemetry (bool enabled=true)
 Switch on/off this vehicle's autopilot. More...
 
void UseCarSimRoad (bool enabled)
 Enables the use of CarSim internal road definition instead of unreal's. More...
 
 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. More...
 
void AddForce (const geom::Vector3D &force)
 Add force to the actor at its center of mass. More...
 
void AddForce (const geom::Vector3D &force, const geom::Vector3D &location)
 Add force to the actor at certain location. More...
 
void AddImpulse (const geom::Vector3D &vector)
 Add impulse to the actor at its center of mass. More...
 
void AddImpulse (const geom::Vector3D &impulse, const geom::Vector3D &location)
 Add impulse to the actor at certain location. More...
 
void AddTorque (const geom::Vector3D &vector)
 Add a torque to the actor. More...
 
virtual bool Destroy ()
 Tell the simulator to destroy this Actor, and return whether the actor was successfully destroyed. More...
 
void DisableConstantVelocity ()
 Disable the constant velocity mode. More...
 
void EnableConstantVelocity (const geom::Vector3D &vector)
 Enable a constant velocity mode. More...
 
geom::Vector3D GetAcceleration () const
 Return the current 3D acceleration of the actor. More...
 
rpc::ActorState GetActorState () const
 
geom::Vector3D GetAngularVelocity () const
 Return the current 3D angular velocity of the actor. More...
 
geom::Location GetLocation () const
 Return the current location of the actor. More...
 
geom::Transform GetTransform () const
 Return the current transform of the actor. More...
 
geom::Vector3D GetVelocity () const
 Return the current 3D velocity of the actor. More...
 
bool IsActive () const
 
bool IsAlive () const
 
bool IsDormant () const
 
const auto & Serialize () const
 
void SetEnableGravity (bool enabled=true)
 Enable or disable gravity on this actor. More...
 
void SetLocation (const geom::Location &location)
 Teleport the actor to location. More...
 
void SetSimulatePhysics (bool enabled=true)
 Enable or disable physics simulation on this actor. More...
 
void SetTargetAngularVelocity (const geom::Vector3D &vector)
 Set the angular velocity of the actor before applying physics. More...
 
void SetTargetVelocity (const geom::Vector3D &vector)
 Set the actor velocity before applying physics. More...
 
void SetTransform (const geom::Transform &transform)
 Teleport and rotate the actor to transform. More...
 
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< ActorGetParent () const
 
ActorId GetParentId () const
 
const std::vector< uint8_t > & GetSemanticTags () const
 
const std::string & GetTypeId () const
 
World GetWorld () const
 

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::ActorGetActorDescription () const
 
const geom::BoundingBoxGetBoundingBox () const
 
EpisodeProxyGetEpisode ()
 
const EpisodeProxyGetEpisode () const
 

Detailed Description

Definition at line 32 of file Vehicle.h.

Member Typedef Documentation

◆ AckermannControl

Definition at line 36 of file Vehicle.h.

◆ Control

Definition at line 35 of file Vehicle.h.

◆ LightState

Definition at line 38 of file Vehicle.h.

◆ PhysicsControl

Definition at line 37 of file Vehicle.h.

◆ TM

Definition at line 39 of file Vehicle.h.

◆ VehicleDoor

Definition at line 40 of file Vehicle.h.

◆ WheelLocation

Definition at line 41 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().

+ Here is the call graph for this function:

◆ 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().

+ Here is the call graph for this function:

◆ ApplyControl()

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

Apply control to this vehicle.

Definition at line 51 of file Vehicle.cpp.

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

+ Here is the call graph for this function:

◆ 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().

+ Here is the call graph for this function:

◆ 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().

+ Here is the call graph for this function:

◆ EnableCarSim()

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

Enables CarSim simulation if it is availiable.

Definition at line 123 of file Vehicle.cpp.

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

+ Here is the call graph for this function:

◆ EnableChronoPhysics()

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

Definition at line 131 of file Vehicle.cpp.

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

+ Here is the call graph for this function:

◆ 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().

+ Here is the call graph for this function:

◆ 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 94 of file Vehicle.cpp.

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetFailureState()

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

Returns the failure state of the vehicle.

Definition at line 147 of file Vehicle.cpp.

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

+ Here is the call graph for this function:

◆ 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 102 of file Vehicle.cpp.

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

+ Here is the call graph for this function:

◆ 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 98 of file Vehicle.cpp.

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

+ Here is the call graph for this function:

◆ 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 106 of file Vehicle.cpp.

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

Referenced by carla::traffic_manager::ALSM::UpdateUnregisteredActorsData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetTrafficLight()

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

Retrieve the traffic light actor currently affecting this vehicle.

Definition at line 118 of file Vehicle.cpp.

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

+ Here is the call graph for this function:

◆ 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 110 of file Vehicle.cpp.

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

+ Here is the call graph for this function:

◆ 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().

+ Here is the call graph for this function:

◆ 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 114 of file Vehicle.cpp.

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

+ Here is the call graph for this function:

◆ OpenDoor()

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

Open a door in this vehicle.

Definition at line 74 of file Vehicle.cpp.

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

+ Here is the call graph for this function:

◆ SetAutopilot()

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

Switch on/off this vehicle's autopilot.

Definition at line 38 of file Vehicle.cpp.

References carla::client::detail::ActorState::GetEpisode(), carla::traffic_manager::TrafficManager::RegisterVehicles(), and carla::traffic_manager::TrafficManager::UnregisterVehicles().

+ Here is the call graph for this function:

◆ SetLightState()

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

Sets a LightState to this vehicle.

Definition at line 82 of file Vehicle.cpp.

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

+ Here is the call graph for this function:

◆ 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().

+ Here is the call graph for this function:

◆ 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().

+ Here is the call graph for this function:

◆ UseCarSimRoad()

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

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

Definition at line 127 of file Vehicle.cpp.

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

+ Here is the call graph for this function:

Member Data Documentation

◆ _control

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

Definition at line 147 of file Vehicle.h.

Referenced by ApplyControl().

◆ _is_control_sticky

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

Definition at line 145 of file Vehicle.h.

Referenced by ApplyControl().


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