35#include "foundation/PxFoundation.h"
36#include "vehicle2/PxVehicleLimits.h"
37#include "vehicle2/PxVehicleParams.h"
57 eMAX_NB_SPEED_RESPONSES = 64
85 eMAX_NB_COMMAND_VALUES = 8
107 const PxReal commandValue = commandValueSpeedResponses.
commandValue;
108 const PxReal* speeds = commandValueSpeedResponses.
speedResponses.xVals;
109 const PxReal* responses = commandValueSpeedResponses.
speedResponses.yVals;
110 const PxU16 nb = PxU16(commandValueSpeedResponses.
speedResponses.nbDataPairs);
112 PX_CHECK_AND_RETURN_VAL(commandValue >= 0.0f && commandValue <= 1.0f,
"PxVehicleCommandAndResponseTable::commandValue must be in range (0,1)",
false);
114 PX_CHECK_AND_RETURN_VAL(
nbCommandValues < eMAX_NB_COMMAND_VALUES,
"PxVehicleNonLinearCommandResponse::addResponse - exceeded maximum number of command responses",
false);
116 PX_CHECK_AND_RETURN_VAL(((
nbSpeedResponses + nb) <= PxVehicleCommandValueResponseTable::eMAX_NB_SPEED_RESPONSES),
"PxVehicleNonLinearCommandResponse::addResponse - exceeded maximum number of command responses",
false);
118 PX_CHECK_AND_RETURN_VAL((0 ==
nbCommandValues) || (commandValue >
commandValues[
nbCommandValues - 1]),
"PxVehicleNonLinearCommandResponse::addResponse - command must be part of a a monotonically increasing series",
false);
120 PX_CHECK_AND_RETURN_VAL(nb > 0,
"PxVehicleNonLinearCommandResponse::addResponse - each command response must have at least 1 point",
false);
123 for (PxU32 i = 1; i < nb; i++)
125 PX_CHECK_AND_RETURN_VAL(speeds[i] > speeds[i - 1],
"PxVehicleNonLinearCommandResponse::addResponse - speeds array must be a monotonically increasing series",
false);
126 PX_CHECK_AND_RETURN_VAL(responses[i] >= 0.0f && responses[i] <= 1.0f ,
"PxVehicleNonLinearCommandResponse::addResponse - response must be in range (0,1)",
false);
145 PxReal
speedResponses[PxVehicleCommandValueResponseTable::eMAX_NB_SPEED_RESPONSES * 2];
Definition PxVehicleCommandParams.h:80
PxU16 nbSpeedRenponsesPerCommandValue[eMAX_NB_COMMAND_VALUES]
The ith command value has N speed responses with N = nbSpeedRenponsesPerCommandValue[i].
Definition PxVehicleCommandParams.h:160
PxReal commandValues[eMAX_NB_COMMAND_VALUES]
The command values.
Definition PxVehicleCommandParams.h:165
PxU16 nbCommandValues
The number of command values.
Definition PxVehicleCommandParams.h:170
PxU16 speedResponsesPerCommandValue[eMAX_NB_COMMAND_VALUES]
The table of speed responses for the ith command value begins at speedResponses[2*speedResponsesPerCo...
Definition PxVehicleCommandParams.h:155
bool addResponse(const PxVehicleCommandValueResponseTable &commandValueSpeedResponses)
Add a table of normalised response vs speed and associated it with a specified command value.
Definition PxVehicleCommandParams.h:105
PxReal speedResponses[PxVehicleCommandValueResponseTable::eMAX_NB_SPEED_RESPONSES *2]
A ragged array of speeds and normalized responses.
Definition PxVehicleCommandParams.h:145
PxU16 nbSpeedResponses
The number of speeds and normalized responses.
Definition PxVehicleCommandParams.h:150
Express a function as a sequence of points {(x, y)} that form a piecewise polynomial.
Definition PxVehicleParams.h:808
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
PX_FORCE_INLINE void * PxMemCopy(void *dest, const void *src, PxU32 count)
Copies the bytes of one memory block to another. The memory blocks must not overlap.
Definition PxMemory.h:83
A description of the per wheel response to an input command.
Definition PxVehicleCommandParams.h:177
PxReal wheelResponseMultipliers[PxVehicleLimits::eMAX_NB_WHEELS]
A description of the per wheel response multiplier to an input command.
Definition PxVehicleCommandParams.h:187
PxF32 maxResponse
The maximum response that occurs when the wheel response multiplier has value 1.0 and nonlinearRespon...
Definition PxVehicleCommandParams.h:192
PxVehicleCommandNonLinearResponseParams nonlinearResponse
A nonlinear response to command value expressed as a lookup table of normalized response as a functio...
Definition PxVehicleCommandParams.h:182
Each command value may be associated with a table specifying a normalized response as a function of l...
Definition PxVehicleCommandParams.h:54
PxVehicleFixedSizeLookupTable< PxReal, eMAX_NB_SPEED_RESPONSES > speedResponses
A lookup table specifying the normalised response to the specified command value as a function of lon...
Definition PxVehicleCommandParams.h:71
PxReal commandValue
The command value associated with the table of speed responses.
Definition PxVehicleCommandParams.h:63