35#include "vehicle2/PxVehicleFunctions.h"
36#include "vehicle2/PxVehicleParams.h"
37#include "vehicle2/PxVehicleComponent.h"
39#include "vehicle2/braking/PxVehicleBrakingFunctions.h"
40#include "vehicle2/commands/PxVehicleCommandHelpers.h"
41#include "vehicle2/rigidBody/PxVehicleRigidBodyStates.h"
42#include "vehicle2/steering/PxVehicleSteeringFunctions.h"
43#include "vehicle2/steering/PxVehicleSteeringParams.h"
44#include "vehicle2/wheel/PxVehicleWheelStates.h"
45#include "vehicle2/wheel/PxVehicleWheelParams.h"
46#include "vehicle2/tire/PxVehicleTireStates.h"
48#include "PxVehicleDrivetrainStates.h"
49#include "PxVehicleDrivetrainFunctions.h"
51#include "common/PxProfileZone.h"
60struct PxVehicleBrakeCommandResponseParams;
61struct PxVehicleDirectDriveThrottleCommandResponseParams;
117 PX_PROFILE_ZONE(
"PxVehicleDirectDriveCommandResponseComponent::update", 0);
132 brakeResponseParams, throttleResponseParams, steerResponseParams, ackermannParams,
133 commands, transmissionCommands,
135 brakeResponseStates, throttleResponseStates, steerResponseStates);
139 for (PxU32 i = 0; i < axleDescription->
nbWheels; i++)
143 PxVehicleBrakeCommandResponseUpdate(
144 commands->
brakes, commands->nbBrakes, longitudinalSpeed,
145 wheelId, brakeResponseParams,
146 brakeResponseStates[wheelId]);
148 PxVehicleDirectDriveThrottleCommandResponseUpdate(
149 commands->
throttle, *transmissionCommands, longitudinalSpeed,
150 wheelId, *throttleResponseParams,
151 throttleResponseStates[wheelId]);
153 PxVehicleSteerCommandResponseUpdate(
154 commands->
steer, longitudinalSpeed,
155 wheelId, *steerResponseParams,
156 steerResponseStates[wheelId]);
158 if (ackermannParams.size > 0)
159 PxVehicleAckermannSteerUpdate(
161 *steerResponseParams, ackermannParams,
162 steerResponseStates);
206 PX_PROFILE_ZONE(
"PxVehicleDirectDriveActuationStateComponent::update", 0);
215 brakeResponseStates, throttleResponseStates,
218 for (PxU32 i = 0; i < axleDescription->
nbWheels; i++)
221 PxVehicleDirectDriveActuationStateUpdate(
222 brakeResponseStates[wheelId], throttleResponseStates[wheelId],
223 actuationStates[wheelId]);
243 virtual void getDataForDirectDrivetrainComponent(
256 PX_PROFILE_ZONE(
"PxVehicleDirectDrivetrainComponent::update", 0);
266 getDataForDirectDrivetrainComponent(axleDescription,
267 brakeResponseStates, throttleResponseStates,
268 wheelParams, actuationStates, tireForces,
269 wheelRigidBody1dStates);
271 for (PxU32 i = 0; i < axleDescription->
nbWheels; i++)
275 PxVehicleDirectDriveUpdate(
276 wheelParams[wheelId], actuationStates[wheelId],
277 brakeResponseStates[wheelId], throttleResponseStates[wheelId],
280 wheelRigidBody1dStates[wheelId]);
360 PX_PROFILE_ZONE(
"PxVehicleEngineDriveCommandResponseComponent::update", 0);
382 brakeResponseParams, steerResponseParams, ackermannParams,
383 gearboxParams, clutchResponseParams, engineParams, rigidBodyState,
384 engineState, autoboxParams,
385 commands, transmissionCommands,
386 brakeResponseStates, throttleResponseState,
388 gearboxResponseState, clutchResponseState, autoboxState);
401 PX_ASSERT(engineParams);
402 PX_ASSERT(engineState);
403 PX_ASSERT(autoboxState);
405 PxVehicleAutoBoxUpdate(
406 *engineParams, *gearboxParams, *autoboxParams,
407 *engineState, *gearboxResponseState, dt,
417 for (PxU32 i = 0; i < axleDescription->
nbWheels; i++)
420 PxVehicleBrakeCommandResponseUpdate(
421 commandsTmp.
brakes, commandsTmp.nbBrakes, longitudinalSpeed,
422 wheelId, brakeResponseParams,
423 brakeResponseStates[i]);
427 PxVehicleGearCommandResponseUpdate(
430 *gearboxResponseState);
433 PxVehicleClutchCommandResponseLinearUpdate(
434 transmissionCommandsTmp.
clutch,
435 *clutchResponseParams,
436 *clutchResponseState);
439 PxVehicleEngineDriveThrottleCommandResponseLinearUpdate(
441 *throttleResponseState);
444 for (PxU32 i = 0; i < axleDescription->
nbWheels; i++)
447 PxVehicleSteerCommandResponseUpdate(commandsTmp.
steer, longitudinalSpeed, wheelId, *steerResponseParams, steerResponseStates[i]);
449 if (ackermannParams.size > 0)
450 PxVehicleAckermannSteerUpdate(commandsTmp.
steer, *steerResponseParams, ackermannParams, steerResponseStates);
467 virtual void getDataForMultiWheelDriveDifferentialStateComponent(
477 PX_PROFILE_ZONE(
"PxVehicleMultiWheelDriveDifferentialStateComponent::update", 0);
483 getDataForMultiWheelDriveDifferentialStateComponent(axleDescription,
484 differentialParams, differentialState);
486 PxVehicleDifferentialStateUpdate(
507 virtual void getDataForFourWheelDriveDifferentialStateComponent(
519 PX_PROFILE_ZONE(
"PxVehicleFourWheelDriveDifferentialStateComponent::update", 0);
527 getDataForFourWheelDriveDifferentialStateComponent(axleDescription, differentialParams,
528 wheelRigidbody1dStates,
529 differentialState, wheelConstraintGroupState);
531 PxVehicleDifferentialStateUpdate(
532 *axleDescription, *differentialParams,
533 wheelRigidbody1dStates, dt,
534 *differentialState, *wheelConstraintGroupState);
576 PX_PROFILE_ZONE(
"PxVehicleTankDriveDifferentialStateComponent::update", 0);
587 transmissionCommands,
590 differentialState, constraintGroupState);
592 PxVehicleDifferentialStateUpdate(
594 wheelParams, *differentialParams,
595 transmissionCommands->
thrusts[0], transmissionCommands->
thrusts[1],
596 *differentialState, *constraintGroupState);
615 virtual void getDataForLegacyFourWheelDriveDifferentialStateComponent(
626 PX_PROFILE_ZONE(
"PxVehicleLegacyFourWheelDriveDifferentialStateComponent::update", 0);
633 getDataForLegacyFourWheelDriveDifferentialStateComponent(axleDescription, differentialParams,
634 wheelRigidbody1dStates,
637 PxVehicleDifferentialStateUpdate(
638 *differentialParams, wheelRigidbody1dStates,
657 virtual void getDataForEngineDriveActuationStateComponent(
672 PX_PROFILE_ZONE(
"PxVehicleEngineDriveActuationStateComponent::update", 0);
683 getDataForEngineDriveActuationStateComponent(axleDescription, gearboxParams,
684 brakeResponseStates, throttleResponseState,
685 gearboxState, differentialState, clutchResponseState,
688 PxVehicleEngineDriveActuationStateUpdate(
692 *throttleResponseState,
693 *gearboxState, *differentialState, *clutchResponseState,
756 PX_PROFILE_ZONE(
"PxVehicleEngineDrivetrainComponent::update", 0);
776 engineParams, clutchParams, gearboxParams,
777 brakeResponseStates, actuationStates, tireForces,
778 throttleResponseState, clutchResponseState, differentialState, constraintGroupState,
779 wheelRigidBody1dStates, engineState, gearboxState, clutchState);
781 PxVehicleGearboxUpdate(*gearboxParams, dt, *gearboxState);
783 PxVehicleEngineDrivetrainUpdate(
786 *engineParams, *clutchParams, *gearboxParams,
787 brakeResponseStates, actuationStates,
789 *gearboxState, *throttleResponseState, *clutchResponseState, *differentialState, constraintGroupState,
791 wheelRigidBody1dStates, *engineState, *clutchState);
Definition PxVehicleComponent.h:45
Determine the actuation state for each wheel of a direct drive vehicle.
Definition PxVehicleDrivetrainComponents.h:177
virtual bool update(const PxReal dt, const PxVehicleSimulationContext &context)
Compute the actuation state for each wheel given the brake, handbrake and throttle states....
Definition PxVehicleDrivetrainComponents.h:201
virtual void getDataForDirectDriveActuationStateComponent(const PxVehicleAxleDescription *&axleDescription, PxVehicleArrayData< const PxReal > &brakeResponseStates, PxVehicleArrayData< const PxReal > &throttleResponseStates, PxVehicleArrayData< PxVehicleWheelActuationState > &actuationStates)=0
Provide vehicle data items for this component.
Forward the applicable set of control values for a direct drive vehicle to a command response state f...
Definition PxVehicleDrivetrainComponents.h:75
virtual void getDataForDirectDriveCommandResponseComponent(const PxVehicleAxleDescription *&axleDescription, PxVehicleSizedArrayData< const PxVehicleBrakeCommandResponseParams > &brakeResponseParams, const PxVehicleDirectDriveThrottleCommandResponseParams *&throttleResponseParams, const PxVehicleSteerCommandResponseParams *&steerResponseParams, PxVehicleSizedArrayData< const PxVehicleAckermannParams > &ackermannParams, const PxVehicleCommandState *&commands, const PxVehicleDirectDriveTransmissionCommandState *&transmissionCommands, const PxVehicleRigidBodyState *&rigidBodyState, PxVehicleArrayData< PxReal > &brakeResponseStates, PxVehicleArrayData< PxReal > &throttleResponseStates, PxVehicleArrayData< PxReal > &steerResponseStates)=0
Provide vehicle data items for this component.
virtual bool update(const PxReal dt, const PxVehicleSimulationContext &context)
Compute a per wheel response to the input brake/handbrake/throttle/steer commands and determine if ...
Definition PxVehicleDrivetrainComponents.h:112
Forward integrate the angular speed of each wheel on a vehicle by integrating the brake and drive tor...
Definition PxVehicleDrivetrainComponents.h:237
virtual bool update(const PxReal dt, const PxVehicleSimulationContext &context)
Update function for a vehicle component.
Definition PxVehicleDrivetrainComponents.h:252
Determine the actuation state for each wheel for a vehicle propelled by engine torque.
Definition PxVehicleDrivetrainComponents.h:651
virtual bool update(const PxReal dt, const PxVehicleSimulationContext &context)
Update function for a vehicle component.
Definition PxVehicleDrivetrainComponents.h:667
Forward the applicable set of control values for a vehicle driven by an engine to a command response ...
Definition PxVehicleDrivetrainComponents.h:303
virtual bool update(const PxReal dt, const PxVehicleSimulationContext &context)
Update function for a vehicle component.
Definition PxVehicleDrivetrainComponents.h:355
virtual void getDataForEngineDriveCommandResponseComponent(const PxVehicleAxleDescription *&axleDescription, PxVehicleSizedArrayData< const PxVehicleBrakeCommandResponseParams > &brakeResponseParams, const PxVehicleSteerCommandResponseParams *&steerResponseParams, PxVehicleSizedArrayData< const PxVehicleAckermannParams > &ackermannParams, const PxVehicleGearboxParams *&gearboxParams, const PxVehicleClutchCommandResponseParams *&clutchResponseParams, const PxVehicleEngineParams *&engineParams, const PxVehicleRigidBodyState *&rigidBodyState, const PxVehicleEngineState *&engineState, const PxVehicleAutoboxParams *&autoboxParams, const PxVehicleCommandState *&commands, const PxVehicleEngineDriveTransmissionCommandState *&transmissionCommands, PxVehicleArrayData< PxReal > &brakeResponseStates, PxVehicleEngineDriveThrottleCommandResponseState *&throttleResponseState, PxVehicleArrayData< PxReal > &steerResponseStates, PxVehicleGearboxState *&gearboxResponseState, PxVehicleClutchCommandResponseState *&clutchResponseState, PxVehicleAutoboxState *&autoboxState)=0
Provide vehicle data items for this component.
Forward integrate the angular speed of each wheel and of the engine, accounting for the state of the ...
Definition PxVehicleDrivetrainComponents.h:707
virtual void getDataForEngineDrivetrainComponent(const PxVehicleAxleDescription *&axleDescription, PxVehicleArrayData< const PxVehicleWheelParams > &wheelParams, const PxVehicleEngineParams *&engineParams, const PxVehicleClutchParams *&clutchParams, const PxVehicleGearboxParams *&gearboxParams, PxVehicleArrayData< const PxReal > &brakeResponseStates, PxVehicleArrayData< const PxVehicleWheelActuationState > &actuationStates, PxVehicleArrayData< const PxVehicleTireForce > &tireForces, const PxVehicleEngineDriveThrottleCommandResponseState *&throttleResponseState, const PxVehicleClutchCommandResponseState *&clutchResponseState, const PxVehicleDifferentialState *&differentialState, const PxVehicleWheelConstraintGroupState *&constraintGroupState, PxVehicleArrayData< PxVehicleWheelRigidBody1dState > &wheelRigidBody1dStates, PxVehicleEngineState *&engineState, PxVehicleGearboxState *&gearboxState, PxVehicleClutchSlipState *&clutchState)=0
Provide vehicle data items for this component.
virtual bool update(const PxReal dt, const PxVehicleSimulationContext &context)
Update function for a vehicle component.
Definition PxVehicleDrivetrainComponents.h:752
Compute the per wheel drive torque split of a differential delivering torque to multiple wheels with ...
Definition PxVehicleDrivetrainComponents.h:501
virtual bool update(const PxReal dt, const PxVehicleSimulationContext &context)
Update function for a vehicle component.
Definition PxVehicleDrivetrainComponents.h:514
Compute the per wheel drive torque split of a four wheel drive differential.
Definition PxVehicleDrivetrainComponents.h:609
virtual bool update(const PxReal dt, const PxVehicleSimulationContext &context)
Update function for a vehicle component.
Definition PxVehicleDrivetrainComponents.h:621
Compute the per wheel drive torque split of a multi-wheel drive differential.
Definition PxVehicleDrivetrainComponents.h:461
virtual bool update(const PxReal dt, const PxVehicleSimulationContext &context)
Update function for a vehicle component.
Definition PxVehicleDrivetrainComponents.h:472
Compute the per wheel drive torque split of a tank drive differential.
Definition PxVehicleDrivetrainComponents.h:545
virtual void getDataForTankDriveDifferentialStateComponent(const PxVehicleAxleDescription *&axleDescription, const PxVehicleTankDriveTransmissionCommandState *&transmissionCommands, PxVehicleArrayData< const PxVehicleWheelParams > &wheelParams, const PxVehicleTankDriveDifferentialParams *&differentialParams, PxVehicleDifferentialState *&differentialState, PxVehicleWheelConstraintGroupState *&constraintGroupState)=0
Provide vehicle data items for this component.
virtual bool update(const PxReal dt, const PxVehicleSimulationContext &context)
Update function for a vehicle component.
Definition PxVehicleDrivetrainComponents.h:571
#define PX_DEPRECATED
Definition PxPreprocessor.h:418
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Helper struct to pass array type data to vehice components and functions.
Definition PxVehicleParams.h:249
Definition PxVehicleDrivetrainParams.h:404
Definition PxVehicleDrivetrainStates.h:122
Definition PxVehicleParams.h:53
PxU32 wheelIdsInAxleOrder[PxVehicleLimits::eMAX_NB_WHEELS]
The list of all wheel ids on the vehicle.
Definition PxVehicleParams.h:149
PxU32 nbWheels
The number of wheels on the vehicle.
Definition PxVehicleParams.h:150
Specifies the maximum clutch strength that occurs when the clutch pedal is fully disengaged and the c...
Definition PxVehicleDrivetrainParams.h:84
Definition PxVehicleDrivetrainStates.h:46
The clutch connects two plates together. One plate rotates with the speed of the engine....
Definition PxVehicleDrivetrainParams.h:141
The clutch is modelled as two spinning plates with one connected to the wheels through the gearing an...
Definition PxVehicleDrivetrainStates.h:266
A description of the state of commands that are applied to the vehicle.
Definition PxVehicleCommandStates.h:53
PxReal throttle
The instantaneous state of the throttle controller in range [0,1] with 1 denoting fully pressed and 0...
Definition PxVehicleCommandStates.h:56
PxReal steer
The instantaneous state of the steer controller in range [-1,1].
Definition PxVehicleCommandStates.h:57
PxReal brakes[2]
The instantaneous state of the brake controllers in range [0,1] with 1 denoting fully pressed and 0 f...
Definition PxVehicleCommandStates.h:54
Definition PxVehicleDrivetrainStates.h:143
Distribute a throttle response to the wheels of a direct drive vehicle.
Definition PxVehicleDrivetrainParams.h:57
A description of the state of transmission-related commands that are applied to a vehicle with direct...
Definition PxVehicleCommandStates.h:69
Definition PxVehicleDrivetrainStates.h:57
A description of the state of transmission-related commands that are applied to a vehicle with engine...
Definition PxVehicleCommandStates.h:92
PxU32 targetGear
The desired gear of the input gear controller.
Definition PxVehicleCommandStates.h:108
@ eAUTOMATIC_GEAR
Special gear value to denote the automatic shift mode (often referred to as DRIVE).
Definition PxVehicleCommandStates.h:104
PxReal clutch
The instantaneous state of the clutch controller in range [0,1] with 1 denoting fully pressed and 0 f...
Definition PxVehicleCommandStates.h:107
Definition PxVehicleDrivetrainParams.h:192
Definition PxVehicleDrivetrainStates.h:67
Definition PxVehicleDrivetrainParams.h:471
PxVehicleFourWheelDriveDifferentialParams specifies the wheels that are to receive drive torque from ...
Definition PxVehicleDrivetrainParams.h:672
Definition PxVehicleDrivetrainParams.h:320
Definition PxVehicleDrivetrainStates.h:85
PxU32 targetGear
Target gear (different from current gear if a gear change is underway)
Definition PxVehicleDrivetrainStates.h:94
PxVehicleMultiWheelDriveDifferentialParams specifies the wheels that are to receive drive torque from...
Definition PxVehicleDrivetrainParams.h:600
Definition PxVehicleRigidBodyStates.h:47
PX_FORCE_INLINE PxReal getLongitudinalSpeed(const PxVehicleFrame &frame) const
Compute the longitudinal speed of the rigid body transformed to the world frame.
Definition PxVehicleRigidBodyStates.h:87
Definition PxVehicleParams.h:672
Definition PxVehicleParams.h:369
Distribute a steer response to the wheels of a vehicle.
Definition PxVehicleSteeringParams.h:58
A description of a tank differential.
Definition PxVehicleDrivetrainParams.h:853
A description of the state of transmission-related commands that are applied to a vehicle with tank d...
Definition PxVehicleCommandStates.h:120
PxReal thrusts[2]
The wheels of each tank track are either all connected to thrusts[0] or all connected to thrusts[1].
Definition PxVehicleCommandStates.h:126
Specify groups of wheels that are to be constrained to have pre-determined angular velocity relations...
Definition PxVehicleDrivetrainStates.h:179