16 #if defined(__clang__) 17 # pragma clang diagnostic push 18 # pragma clang diagnostic ignored "-Wshadow" 21 #include "chrono/physics/ChSystemNSC.h" 22 #include "chrono_vehicle/ChVehicleModelData.h" 23 #include "chrono_vehicle/ChTerrain.h" 24 #include "chrono_vehicle/driver/ChDataDriver.h" 25 #include "chrono_vehicle/wheeled_vehicle/vehicle/WheeledVehicle.h" 27 #if defined(__clang__) 28 # pragma clang diagnostic pop 34 #include "ChronoMovementComponent.generated.h" 37 class UERayCastTerrain :
public chrono::vehicle::ChTerrain
40 chrono::vehicle::ChVehicle* ChronoVehicle;
44 std::pair<bool, FHitResult> GetTerrainProperties(
const FVector &
Location)
const;
45 virtual double GetHeight(
const chrono::ChVector<>& loc)
const override;
46 virtual chrono::ChVector<> GetNormal(
const chrono::ChVector<>& loc)
const override;
47 virtual float GetCoefficientFriction(
const chrono::ChVector<>& loc)
const override;
51 UCLASS(Blueprintable, meta=(BlueprintSpawnableComponent) )
57 chrono::ChSystemNSC Sys;
58 std::shared_ptr<chrono::vehicle::WheeledVehicle>
Vehicle;
59 std::shared_ptr<UERayCastTerrain> Terrain;
62 uint64_t MaxSubsteps = 10;
63 float MaxSubstepDeltaTime = 0.01;
65 FString VehicleJSON =
"hmmwv/vehicle/HMMWV_Vehicle.json";
66 FString PowertrainJSON =
"hmmwv/powertrain/HMMWV_ShaftsPowertrain.json";
67 FString TireJSON =
"hmmwv/tire/HMMWV_Pac02Tire.json";
68 FString BaseJSONPath =
"";
73 static void CreateChronoMovementComponent(
76 float MaxSubstepDeltaTime,
77 FString VehicleJSON =
"",
78 FString PowertrainJSON =
"",
79 FString TireJSON =
"",
80 FString BaseJSONPath =
"");
83 virtual void BeginPlay()
override;
85 void InitializeChronoVehicle();
89 void TickComponent(
float DeltaTime,
91 FActorComponentTickFunction* ThisTickFunction)
override;
93 void AdvanceChronoSimulation(
float StepSize);
95 virtual FVector GetVelocity()
const override;
97 virtual int32 GetVehicleCurrentGear()
const override;
99 virtual float GetVehicleForwardSpeed()
const override;
101 virtual void EndPlay(
const EEndPlayReason::Type EndPlayReason)
override;
106 void DisableChronoPhysics();
111 FVector NormalImpulse,
112 const FHitResult &Hit);
120 int32 OtherBodyIndex,
122 const FHitResult & SweepResult);
carla::SharedPtr< cc::Actor > Actor
Base class for CARLA wheeled vehicles.
FVehicleControl VehicleControl