CARLA
Loading...
Searching...
No Matches
ACarlaWheeledVehicleNW Class Reference

Base class for CARLA wheeled vehicles. More...

#include <CarlaWheeledVehicleNW.h>

Inheritance diagram for ACarlaWheeledVehicleNW:

Public Member Functions

Constructor and destructor
 ACarlaWheeledVehicleNW (const FObjectInitializer &ObjectInitializer)
 ~ACarlaWheeledVehicleNW ()
Public Member Functions inherited from ACarlaWheeledVehicle
 ACarlaWheeledVehicle (const FObjectInitializer &ObjectInitializer)
 ~ACarlaWheeledVehicle ()
UChaosWheeledVehicleMovementComponent * GetChaosWheeledVehicleMovementComponent () const
 Get chaos wheeled vehicle movement component casted.
const FVehicleControl & GetVehicleControl () const
 Vehicle control currently applied to this vehicle.
const FVehicleAckermannControl & GetVehicleAckermannControl () const
 Vehicle Ackermann control currently applied to this vehicle.
FTransform GetVehicleTransform () const
 Transform of the vehicle.
float GetVehicleForwardSpeed () const
 Forward speed in cm/s. Might be negative if goes backwards.
FVector GetVehicleOrientation () const
 Orientation vector of the vehicle, pointing forward.
int32 GetVehicleCurrentGear () const
 Active gear of the vehicle.
FTransform GetVehicleBoundingBoxTransform () const
 Transform of the vehicle's bounding box relative to the vehicle.
FVector GetVehicleBoundingBoxExtent () const
 Extent of the vehicle's bounding box.
UBoxComponent * GetVehicleBoundingBox () const
 Get vehicle's bounding box component.
float GetMaximumSteerAngle () const
 Get the maximum angle at which the front wheel can steer.
void ApplyVehicleControl (const FVehicleControl &Control, EVehicleInputPriority Priority)
void ApplyVehicleAckermannControl (const FVehicleAckermannControl &AckermannControl, EVehicleInputPriority Priority)
bool IsAckermannControlActive () const
void ActivateVelocityControl (const FVector &Velocity)
void DeactivateVelocityControl ()
void ActivateAccelerationControl (const FVector &Acceleration)
void DeactivateAccelerationControl ()
void ApplyVehicleAccelerationControl (float LongitudinalAccelerationMps2, float Steer, float SteerSpeed)
 Apply control from Autoware /control/command/control_cmd (acceleration [m/s^2] + steering).
void ShowDebugTelemetry (bool Enabled)
void FlushVehicleControl ()
void SetThrottleInput (float Value)
void SetSteeringInput (float Value)
void SetBrakeInput (float Value)
void SetReverse (bool Value)
void ToggleReverse ()
void SetHandbrakeInput (bool Value)
void HoldHandbrake ()
void ReleaseHandbrake ()
TArray< float > GetWheelsFrictionScale ()
void SetWheelsFrictionScale (TArray< float > &WheelsFrictionScale)
void SetCarlaMovementComponent (UBaseCarlaMovementComponent *MoementComponent)
template<typename T = UBaseCarlaMovementComponent>
T * GetCarlaMovementComponent () const
void SetAIVehicleState (ECarlaWheeledVehicleState InState)
ECarlaWheeledVehicleState GetAIVehicleState () const
FVehiclePhysicsControl GetVehiclePhysicsControl () const
FVehicleTelemetryData GetVehicleTelemetryData () const
 Returns a snapshot of the vehicle's runtime telemetry: 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.
FVector GetCenterOfMass (UChaosWheeledVehicleMovementComponent &VehicleMovComponent) const
FAckermannControllerSettings GetAckermannControllerSettings () const
void RestoreVehiclePhysicsControl ()
FVehicleLightState GetVehicleLightState () const
void ApplyVehiclePhysicsControl (const FVehiclePhysicsControl &PhysicsControl)
void SetCenterOfMass (UChaosWheeledVehicleMovementComponent &VehicleMovComponent, const FVehiclePhysicsControl &PhysicsControl)
void ApplyAckermannControllerSettings (const FAckermannControllerSettings &AckermannControllerSettings)
void SetSimulatePhysics (bool enabled)
void SetVehicleLightState (const FVehicleLightState &LightState)
void SetFailureState (const carla::rpc::VehicleFailureState &FailureState)
bool IsTwoWheeledVehicle ()
virtual bool IsTwoWheeledVehicle_Implementation ()
FTransform GetCachedVehicleSocketWorldTransform (FName SocketName) const
 Cached, extrapolated world transform of ANY socket on the vehicle mesh (Seat, HandlerLeftSocket, HandlerRightSocket, LeftPedalSocket, RightPedalSocket, ...), captured from OnRiderBoneTransformsFinalized (which fires late enough in the frame to reliably see this frame's real, physics-updated position – confirmed by logging it against the vehicle's actual movement, always smooth, never stale).
float GetPedalRotation () const
 Two-wheeled vehicles spin a decorative pedal/crank bone (in the vehicle mesh's own Anim Blueprint, unrelated to the rider) via a looping Timeline whose curve doesn't start and end at the same value – every loop the Timeline restarts, the bone's rotation pops instantly back to the curve's start value instead of continuing smoothly, and the rider's foot IK (which targets a socket on that bone) pops along with it.
void PrintROS2Message (const char *Message)
FBox GetDetectionBox () const
float GetDetectionSize () const
void UpdateDetectionBox ()
const TArray< int32 > GetFoliageInstancesCloseToVehicle (const UInstancedStaticMeshComponent *Component) const
void DrawFoliageBoundingBox () const
FBoxSphereBounds GetBoxSphereBounds () const
bool IsInVehicleRange (const FVector &Location) const
void SetWheelSteerDirection (EVehicleWheelLocation WheelLocation, float AngleInDeg)
 Set the rotation of the car wheels indicated by the user 0 = FL_VehicleWheel, 1 = FR_VehicleWheel, 2 = BL_VehicleWheel, 3 = BR_VehicleWheel NOTE : This is purely aesthetic.
float GetWheelSteerAngle (EVehicleWheelLocation WheelLocation)
void SetWheelPitchAngle (EVehicleWheelLocation WheelLocation, float AngleInDeg)
 Spin angle of a wheel, in degrees. Purely visual, wheel animation override only.
float GetWheelPitchAngle (EVehicleWheelLocation WheelLocation)
void SetWheelSuspensionOffset (EVehicleWheelLocation WheelLocation, float OffsetInCm)
 Suspension compression of a wheel, in cm.
float GetWheelSuspensionOffset (EVehicleWheelLocation WheelLocation)
void SetWheelAnimationOverride (bool bEnabled)
 While the wheel animation is overridden the wheels show only the values set through the wheel setters, whether or not Chaos simulates the vehicle.
bool IsWheelAnimationOverridden () const
const TArray< FWheelAnimationData > & GetOverriddenWheelPoses () const
 Indexed like the movement component's WheelSetups.
bool IsSimulatedByChaos () const
 Whether the Chaos vehicle simulation is moving this vehicle.
bool HasWheel (int32 WheelIndex) const
bool HasCarlaVehicleAnimation () const
 Whether the animation blueprint derives from UCarlaVehicleAnimationInstance, which is what draws the overridden wheel poses.
float GetWheelRadius (int32 WheelIndex) const
 Radius of the wheel at WheelIndex, in cm, as last applied through the physics control.
FVector GetWheelSuspensionAxis (int32 WheelIndex) const
 Unit vector, component space, along which the wheel's suspension drops.
FWheelAnimationData GetDrawnWheelPose (int32 WheelIndex) const
 Wheel pose the animation instance drew this frame (else GetWheelPose); what secondaries must draw.
void OpenDoor (const EVehicleDoor DoorIdx)
void CloseDoor (const EVehicleDoor DoorIdx)
void OpenDoorPhys (const EVehicleDoor DoorIdx)
void CloseDoorPhys (const EVehicleDoor DoorIdx)
void RecordDoorChange (const EVehicleDoor DoorIdx, const bool bIsOpen)
TArray< TPair< int32, FTransform > > GetOpenDoorPoses () const
 Every door open now (a physics body of its own while open), by door index, with its pose relative to the vehicle.
void SetMirroredDoorPoses (const TArray< TPair< int32, FTransform > > &OpenDoors)
 Multi-GPU secondary: shows these doors open, at these poses relative to the vehicle, and every other door closed.
virtual FVector GetVelocity () const override
void SetMirroredMotion (const FVector &Velocity, float ForwardSpeed)
 Multi-GPU secondary: the primary's motion of the vehicle this one mirrors (world frame, cm/s), which GetVelocity and GetVehicleForwardSpeed report instead of this body's: a mirror never moves on its own.
void ClearMirroredMotion ()
bool HasMirroredMotion () const
void SetMirroredDrivetrain (int32 Gear, bool bManualGearShift, bool bSimulatingPhysics)
 Multi-GPU secondary: the primary's gear, which GetVehicleCurrentGear reports instead of the idle drivetrain's, its manual gear shift, and whether the primary's body simulates physics.
bool GetMirroredManualGearShift () const
bool IsMirroredSimulatingPhysics () const
FPoseSnapshot GetWorldTransformedPose ()
void SetRolloverFlag ()
carla::rpc::VehicleFailureState GetFailureState () const
float GetSpeedAnim () const
void SetSpeedAnim (float Speed)
float GetRotationAnim () const
void SetRotationAnim (float Rotation)

Additional Inherited Members

static FRotator GetPhysicsConstraintAngle (UPhysicsConstraintComponent *Component)
static void SetPhysicsConstraintAngle (UPhysicsConstraintComponent *Component, const FRotator &NewAngle)
FName RiderMeshComponentName = TEXT("SkeletalMesh")
 Two-wheeled vehicles (bikes/motorcycles) embed their rider as a SkeletalMeshComponent (named RiderMeshComponentName) meant to sit on VehicleMeshSeatSocketName.
FName VehicleMeshSeatSocketName = TEXT("Seat")
float RiderSeatSmoothingSpeed = 10.0f
 Chaos suspension has small, real, high-frequency vertical jitter on the vehicle mesh every frame (visible as the rider's torso/hip bouncing, the seat popping the rider up) – physically real, not a bug, but the seat-lock's hard snap transmits it 1:1 to the rider with zero smoothing.
FRotator RiderSeatRelativeRotationOffset = FRotator(0.0f, -90.0f, 15.0f)
 The rider mesh's rest pose isn't authored to sit flush with the socket's own local axes – its component template ships with this exact relative rotation baked in (no translation), so the seat-lock composes it on top of the socket's world transform instead of using the bare socket transform, which twisted the pose.
float PedalRotationDegreesPerCm = 0.5f
 Degrees the pedal bone rotates per centimeter of real vehicle travel (see GetPedalRotation).
struct  InputControl
float DetectionSize { 750.0f }
FBox FoliageBoundingBox
TObjectPtr< UBoxComponent > VehicleBounds
float CarSimOriginOffset = 150.f
bool bIsNWVehicle = false
float SpeedAnim { 0.0f }
float RotationAnim { 0.0f }
FPoseSnapshot WorldTransformedPose
virtual void BeginPlay () override
virtual void TickActor (float DeltaTime, enum ELevelTick TickType, FActorTickFunction &ThisTickFunction) override
virtual void EndPlay (const EEndPlayReason::Type EndPlayReason)
void RefreshLightState (const FVehicleLightState &VehicleLightState)
void AdjustVehicleBounds ()
void ResetConstraints ()
TArray< FName > ConstraintComponentNames
float DoorOpenStrength = 100.0f

Detailed Description

Base class for CARLA wheeled vehicles.

Definition at line 15 of file CarlaWheeledVehicleNW.h.

Constructor & Destructor Documentation

◆ ACarlaWheeledVehicleNW()

ACarlaWheeledVehicleNW::ACarlaWheeledVehicleNW ( const FObjectInitializer & ObjectInitializer)

Definition at line 11 of file CarlaWheeledVehicleNW.cpp.

References ACarlaWheeledVehicle::bIsNWVehicle.

◆ ~ACarlaWheeledVehicleNW()

ACarlaWheeledVehicleNW::~ACarlaWheeledVehicleNW ( )

Definition at line 18 of file CarlaWheeledVehicleNW.cpp.


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