Add general method for recording all vehicle types
This commit is contained in:
parent
3b86f58e68
commit
de7e9bf030
|
@ -218,39 +218,23 @@ void ACarlaRecorder::AddVehicleWheelsAnimation(FCarlaActor *CarlaActor)
|
|||
|
||||
CarlaRecorderAnimWheels Record;
|
||||
Record.DatabaseId = CarlaActor->GetActorId();
|
||||
Record.WheelValues.reserve(WheeledVehicleMovementComponent->Wheels.Num());
|
||||
|
||||
WheelInfo FL;
|
||||
FL.Location = EVehicleWheelLocation::FL_Wheel;
|
||||
FL.SteeringAngle = CarlaVehicle->GetWheelSteerAngle(FL.Location);
|
||||
FL.TireRotation = WheeledVehicleMovementComponent->Wheels[static_cast<uint8>(FL.Location)]->GetRotationAngle();
|
||||
|
||||
WheelInfo FR;
|
||||
FR.Location = EVehicleWheelLocation::FR_Wheel;
|
||||
FR.SteeringAngle = CarlaVehicle->GetWheelSteerAngle(FR.Location);
|
||||
FR.TireRotation = WheeledVehicleMovementComponent->Wheels[static_cast<uint8>(FR.Location)]->GetRotationAngle();
|
||||
|
||||
WheelInfo BL;
|
||||
BL.Location = EVehicleWheelLocation::BL_Wheel;
|
||||
BL.SteeringAngle = CarlaVehicle->GetWheelSteerAngle(BL.Location);
|
||||
BL.TireRotation = WheeledVehicleMovementComponent->Wheels[static_cast<uint8>(BL.Location)]->GetRotationAngle();
|
||||
|
||||
WheelInfo BR;
|
||||
BR.Location = EVehicleWheelLocation::BR_Wheel;
|
||||
BR.SteeringAngle = CarlaVehicle->GetWheelSteerAngle(BR.Location);
|
||||
BR.TireRotation = WheeledVehicleMovementComponent->Wheels[static_cast<uint8>(BR.Location)]->GetRotationAngle();
|
||||
|
||||
Record.WheelValues.reserve(4);
|
||||
Record.WheelValues.push_back(FL);
|
||||
Record.WheelValues.push_back(FR);
|
||||
Record.WheelValues.push_back(BL);
|
||||
Record.WheelValues.push_back(BR);
|
||||
uint8 i = 0;
|
||||
for (auto Wheel : WheeledVehicleMovementComponent->Wheels)
|
||||
{
|
||||
WheelInfo Info;
|
||||
Info.Location = static_cast<EVehicleWheelLocation>(i);
|
||||
Info.SteeringAngle = CarlaVehicle->GetWheelSteerAngle(Info.Location);
|
||||
Info.TireRotation = Wheel->GetRotationAngle();
|
||||
Record.WheelValues.push_back(Info);
|
||||
++i;
|
||||
}
|
||||
|
||||
AddAnimVehicleWheels(Record);
|
||||
|
||||
if (CarlaVehicle->IsTwoWheeledVehicle())
|
||||
{
|
||||
|
||||
|
||||
AddAnimBiker(CarlaRecorderAnimBiker
|
||||
{
|
||||
CarlaActor->GetActorId(),
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "VehicleAnimInstance.h"
|
||||
#include "PhysicsEngine/PhysicsConstraintComponent.h"
|
||||
#include "MovementComponents/BaseCarlaMovementComponent.h"
|
||||
|
||||
|
||||
|
||||
#include "FoliageInstancedStaticMeshComponent.h"
|
||||
#include "CoreMinimal.h"
|
||||
|
@ -47,6 +47,8 @@ enum class EVehicleWheelLocation : uint8 {
|
|||
FR_Wheel = 1,
|
||||
BL_Wheel = 2,
|
||||
BR_Wheel = 3,
|
||||
ML_Wheel = 4,
|
||||
MR_Wheel = 5,
|
||||
//Use for bikes and bicycles
|
||||
Front_Wheel = 0,
|
||||
Back_Wheel = 1,
|
||||
|
@ -326,7 +328,7 @@ private:
|
|||
|
||||
/// Current state of the vehicle controller (for debugging purposes).
|
||||
UPROPERTY(Category = "AI Controller", VisibleAnywhere)
|
||||
ECarlaWheeledVehicleState State = ECarlaWheeledVehicleState::UNKNOWN;
|
||||
ECarlaWheeledVehicleState State = ECarlaWheeledVehicleState::UNKNOWN;
|
||||
|
||||
UPROPERTY(Category = "CARLA Wheeled Vehicle", EditAnywhere)
|
||||
UVehicleVelocityControl* VelocityControl;
|
||||
|
@ -355,12 +357,12 @@ private:
|
|||
public:
|
||||
UPROPERTY(Category = "CARLA Wheeled Vehicle", EditDefaultsOnly)
|
||||
float DetectionSize { 750.0f };
|
||||
|
||||
|
||||
UPROPERTY(Category = "CARLA Wheeled Vehicle", VisibleAnywhere, BlueprintReadOnly)
|
||||
FBox FoliageBoundingBox;
|
||||
|
||||
UPROPERTY(Category = "CARLA Wheeled Vehicle", EditAnywhere)
|
||||
UBoxComponent *VehicleBounds;
|
||||
UBoxComponent *VehicleBounds;
|
||||
|
||||
UFUNCTION()
|
||||
FBox GetDetectionBox() const;
|
||||
|
@ -372,14 +374,14 @@ public:
|
|||
void UpdateDetectionBox();
|
||||
|
||||
UFUNCTION()
|
||||
const TArray<int32> GetFoliageInstancesCloseToVehicle(const UInstancedStaticMeshComponent* Component) const;
|
||||
const TArray<int32> GetFoliageInstancesCloseToVehicle(const UInstancedStaticMeshComponent* Component) const;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void DrawFoliageBoundingBox() const;
|
||||
|
||||
|
||||
UFUNCTION()
|
||||
FBoxSphereBounds GetBoxSphereBounds() const;
|
||||
|
||||
|
||||
UFUNCTION()
|
||||
bool IsInVehicleRange(const FVector& Location) const;
|
||||
|
||||
|
@ -412,7 +414,7 @@ public:
|
|||
//-------------------------------------------
|
||||
|
||||
UPROPERTY(Category="CARLA Wheeled Vehicle", VisibleAnywhere)
|
||||
bool bIsNWVehicle = false;
|
||||
bool bIsNWVehicle = false;
|
||||
|
||||
void SetRolloverFlag();
|
||||
|
||||
|
|
Loading…
Reference in New Issue