PhysX SDK 3.2 API Reference: PxVehicleComponents.h Source File

PhysX SDK 3.2 API

PxVehicleComponents.h

Go to the documentation of this file.
00001 // This code contains NVIDIA Confidential Information and is disclosed to you 
00002 // under a form of NVIDIA software license agreement provided separately to you.
00003 //
00004 // Notice
00005 // NVIDIA Corporation and its licensors retain all intellectual property and
00006 // proprietary rights in and to this software and related documentation and 
00007 // any modifications thereto. Any use, reproduction, disclosure, or 
00008 // distribution of this software and related documentation without an express 
00009 // license agreement from NVIDIA Corporation is strictly prohibited.
00010 // 
00011 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
00012 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
00013 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
00014 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
00015 //
00016 // Information and code furnished is believed to be accurate and reliable.
00017 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
00018 // information or for any infringement of patents or other rights of third parties that may
00019 // result from its use. No license is granted by implication or otherwise under any patent
00020 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
00021 // This code supersedes and replaces all information previously supplied.
00022 // NVIDIA Corporation products are not authorized for use as critical
00023 // components in life support devices or systems without express written approval of
00024 // NVIDIA Corporation.
00025 //
00026 // Copyright (c) 2008-2012 NVIDIA Corporation. All rights reserved.
00027 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
00028 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.  
00029 
00030 #ifndef PX_VEHICLE_CORE_COMPONENTS_H
00031 #define PX_VEHICLE_CORE_COMPONENTS_H
00032 
00036 #include "foundation/PxVec3.h"
00037 #include "common/PxCoreUtilityTypes.h"
00038 
00039 #ifndef PX_DOXYGEN
00040 namespace physx
00041 {
00042 #endif
00043 
00044 class PxVehicleChassisData
00045 {
00046 public:
00047 
00048     friend class PxVehicleDriveSimData4W;
00049 
00050     PxVehicleChassisData()
00051         :   mMOI(PxVec3(0,0,0)),
00052             mMass(1500),
00053             mCMOffset(PxVec3(0,0,0))
00054     {
00055     }
00056 
00060     PxVec3 mMOI;
00061 
00065     PxReal mMass;
00066 
00070     PxVec3 mCMOffset;
00071 
00072 private:
00073 
00074     PxReal pad;
00075 
00076     bool isValid() const;
00077 };
00078 PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleChassisData)& 0x0f));
00079 
00080 class PxVehicleEngineData
00081 {
00082 public:
00083 
00084     friend class PxVehicleDriveSimData;
00085 
00086     enum
00087     {
00088         eMAX_NUM_ENGINE_TORQUE_CURVE_ENTRIES = 8
00089     };
00090 
00091     PxVehicleEngineData()
00092         :   mPeakTorque(500.0f),
00093             mMaxOmega(600.0f),
00094             mDampingRateFullThrottle(0.15f),
00095             mDampingRateZeroThrottleClutchEngaged(2.0f),
00096             mDampingRateZeroThrottleClutchDisengaged(0.35f)
00097     {
00098         mTorqueCurve.addPair(0.0f, 0.8f);
00099         mTorqueCurve.addPair(0.33f, 1.0f);
00100         mTorqueCurve.addPair(1.0f, 0.8f);
00101 
00102         mRecipMaxOmega=1.0f/mMaxOmega;
00103     }
00104 
00108     PxFixedSizeLookupTable<eMAX_NUM_ENGINE_TORQUE_CURVE_ENTRIES> mTorqueCurve;
00109 
00117     PxReal mPeakTorque;
00118 
00123     PxReal mMaxOmega;
00124 
00132     PxReal mDampingRateFullThrottle;
00133 
00141     PxReal mDampingRateZeroThrottleClutchEngaged;
00142 
00150     PxReal mDampingRateZeroThrottleClutchDisengaged;
00151 
00155     PX_FORCE_INLINE PxReal getRecipMaxOmega() const {return mRecipMaxOmega;}
00156 
00157 private:
00158 
00164     PxReal mRecipMaxOmega;
00165 
00166     PxReal mPad[2];
00167 
00168     bool isValid() const;
00169 
00170 };
00171 PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleEngineData)& 0x0f));
00172 
00173 class PxVehicleGearsData
00174 {
00175 public:
00176 
00177     friend class PxVehicleDriveSimData;
00178 
00179     enum
00180     {
00181         eREVERSE=0,
00182         eNEUTRAL,
00183         eFIRST,
00184         eSECOND,
00185         eTHIRD,
00186         eFOURTH,
00187         eFIFTH,
00188         eSIXTH,
00189         eSEVENTH,
00190         eEIGHTH,
00191         eNINTH,
00192         eTENTH,
00193         eELEVENTH,
00194         eTWELFTH,
00195         eTHIRTEENTH,
00196         eFOURTEENTH,
00197         eFIFTEENTH,
00198         eSIXTEENTH,
00199         eSEVENTEENTH,
00200         eEIGHTEENTH,
00201         eNINETEENTH,
00202         eTWENTIETH,
00203         eTWENTYFIRST,
00204         eTWENTYSECOND,
00205         eTWENTYTHIRD,
00206         eTWENTYFOURTH,
00207         eTWENTYFIFTH,
00208         eTWENTYSIXTH,
00209         eTWENTYSEVENTH,
00210         eTWENTYEIGHTH,
00211         eTWENTYNINTH,
00212         eTHIRTIETH,
00213         eMAX_NUM_GEAR_RATIOS
00214     };
00215 
00216     PxVehicleGearsData()
00217         :   mFinalRatio(4.0f),
00218             mNumRatios(7),
00219             mSwitchTime(0.5f)
00220     {
00221         mRatios[PxVehicleGearsData::eREVERSE]=-4.0f;
00222         mRatios[PxVehicleGearsData::eNEUTRAL]=0.0f;
00223         mRatios[PxVehicleGearsData::eFIRST]=4.0f;
00224         mRatios[PxVehicleGearsData::eSECOND]=2.0f;
00225         mRatios[PxVehicleGearsData::eTHIRD]=1.5f;
00226         mRatios[PxVehicleGearsData::eFOURTH]=1.1f;
00227         mRatios[PxVehicleGearsData::eFIFTH]=1.0f;
00228     }
00229 
00234     PxReal mRatios[eMAX_NUM_GEAR_RATIOS];
00235 
00240     PxReal mFinalRatio;
00241 
00246     PxU32 mNumRatios;
00247     
00252     PxReal mSwitchTime;
00253 
00254 private:
00255 
00256     PxReal mPad;
00257 
00258     bool isValid() const;
00259 };
00260 PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleGearsData)& 0x0f));
00261 
00262 class PxVehicleAutoBoxData
00263 {
00264 public:
00265 
00266     friend class PxVehicleDriveSimData;
00267 
00268     PxVehicleAutoBoxData()
00269     {
00270         for(PxU32 i=0;i<PxVehicleGearsData::eMAX_NUM_GEAR_RATIOS;i++)
00271         {
00272             mUpRatios[i]=0.65f;
00273             mDownRatios[i]=0.50f;
00274         }
00275         //Not sure how important this is but we want to kick out of neutral very quickly.
00276         mUpRatios[PxVehicleGearsData::eNEUTRAL]=0.15f;
00277         //Set the latency time in an unused element of one of the arrays.
00278         mDownRatios[PxVehicleGearsData::eREVERSE]=2.0f; 
00279     }
00280     
00285     PxReal mUpRatios[PxVehicleGearsData::eMAX_NUM_GEAR_RATIOS];
00286 
00291     PxReal mDownRatios[PxVehicleGearsData::eMAX_NUM_GEAR_RATIOS];
00292 
00298     void setLatency(const PxReal latency) 
00299     { 
00300         mDownRatios[PxVehicleGearsData::eREVERSE]=latency;
00301     }
00302 
00307     PxReal getLatency() const 
00308     { 
00309         return mDownRatios[PxVehicleGearsData::eREVERSE];
00310     }
00311 
00312 private:
00313 
00314     bool isValid() const;
00315 };
00316 PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleAutoBoxData)& 0x0f));
00317 
00318 class PxVehicleDifferential4WData
00319 {
00320 public:
00321 
00322     friend class PxVehicleDriveSimData4W;
00323 
00324     enum
00325     {
00326         eDIFF_TYPE_LS_4WD,          //limited slip differential for car with 4 driven wheels
00327         eDIFF_TYPE_LS_FRONTWD,      //limited slip differential for car with front-wheel drive
00328         eDIFF_TYPE_LS_REARWD,       //limited slip differential for car with rear-wheel drive
00329         eDIFF_TYPE_OPEN_4WD,        //open differential for car with 4 driven wheels 
00330         eDIFF_TYPE_OPEN_FRONTWD,    //open differential for car with front-wheel drive
00331         eDIFF_TYPE_OPEN_REARWD,     //open differentila for car with rear-wheel drive
00332         eMAX_NUM_DIFF_TYPES
00333     };
00334 
00335     PxVehicleDifferential4WData()
00336         :   mFrontRearSplit(0.45f),
00337             mFrontLeftRightSplit(0.5f),
00338             mRearLeftRightSplit(0.5f),
00339             mCentreBias(1.3f),
00340             mFrontBias(1.3f),
00341             mRearBias(1.3f),
00342             mType(PxVehicleDifferential4WData::eDIFF_TYPE_LS_4WD)
00343     {
00344     }
00345 
00351     PxReal mFrontRearSplit;
00352 
00358     PxReal mFrontLeftRightSplit;
00359 
00365     PxReal mRearLeftRightSplit;
00366 
00372     PxReal mCentreBias;
00373 
00379     PxReal mFrontBias;
00380 
00386     PxReal mRearBias;
00387 
00392     PxU32 mType;
00393 
00394 private:
00395 
00396     PxReal mPad[1];
00397 
00398     bool isValid() const;
00399 };
00400 PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleDifferential4WData)& 0x0f));
00401 
00402 class PxVehicleAckermannGeometryData
00403 {
00404 public:
00405 
00406     friend class PxVehicleDriveSimData4W;
00407 
00408     PxVehicleAckermannGeometryData()
00409         :   mAccuracy(1.0f),
00410             mFrontWidth(0.0f),      //Must be filled out 
00411             mRearWidth(0.0f),       //Must be filled out
00412             mAxleSeparation(0.0f)   //Must be filled out
00413     {
00414     }
00415 
00422     PxReal mAccuracy;
00423 
00428     PxReal mFrontWidth;     
00429 
00434     PxReal mRearWidth;      
00435 
00440     PxReal mAxleSeparation; 
00441 
00442 private:
00443 
00444     bool isValid() const;
00445 };
00446 PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleAckermannGeometryData)& 0x0f));
00447 
00448 class PxVehicleClutchData
00449 {
00450 public:
00451 
00452     friend class PxVehicleDriveSimData;
00453 
00454     PxVehicleClutchData()
00455         :   mStrength(10.0f)
00456     {
00457     }
00458 
00466     PxReal mStrength;
00467 
00468 private:
00469 
00470     PxReal mPad[3];
00471 
00472     bool isValid() const;
00473 };
00474 PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleClutchData)& 0x0f));
00475 
00476 
00486 class PxVehicleTireLoadFilterData
00487 {
00488 public:
00489 
00490     friend class PxVehicleWheelsSimData;
00491 
00492     PxVehicleTireLoadFilterData()
00493         :   mMinNormalisedLoad(-0.25f),
00494             mMaxNormalisedLoad(3.0f),
00495             mMaxFilteredNormalisedLoad(3.0f)
00496     {
00497         mDenominator=1.0f/(mMaxNormalisedLoad - mMinNormalisedLoad);
00498     }
00499 
00503     PxReal mMinNormalisedLoad; 
00504 
00508     PxReal mMaxNormalisedLoad;
00509         
00513     PxReal mMaxFilteredNormalisedLoad;
00514 
00515     PX_FORCE_INLINE PxReal getDenominator() const {return mDenominator;}
00516 
00517 private:
00518 
00522     //1.0f/(mMaxNormalisedLoad-mMinNormalisedLoad) for quick calculations
00523     PxReal mDenominator;
00524 
00525     bool isValid() const;
00526 };
00527 PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleTireLoadFilterData)& 0x0f));
00528 
00529 class PxVehicleWheelData
00530 {
00531 public:
00532 
00533     friend class PxVehicleWheels4SimData;
00534 
00535     PxVehicleWheelData()
00536         :   mRadius(0.0f),              //Must be filled out
00537             mWidth(0.0f),
00538             mMass(20.0f),
00539             mMOI(0.0f),                 //Must be filled out
00540             mDampingRate(0.25f),
00541             mMaxBrakeTorque(1500.0f),
00542             mMaxHandBrakeTorque(0.0f),  
00543             mMaxSteer(0.0f),            
00544             mToeAngle(0.0f),
00545             mRecipRadius(0.0f),         //Must be filled out
00546             mRecipMOI(0.0f)             //Must be filled out
00547     {
00548     }
00549 
00554     PxReal mRadius;
00555 
00560     PxReal mWidth;
00561 
00566     PxReal mMass;
00567 
00572     PxReal mMOI;
00573 
00577     PxReal mDampingRate;
00578 
00583     PxReal mMaxBrakeTorque;
00584 
00589     PxReal mMaxHandBrakeTorque;
00590 
00595     PxReal mMaxSteer;
00596 
00601     PxReal mToeAngle;//in radians
00602 
00607     PX_FORCE_INLINE PxReal getRecipRadius() const {return mRecipRadius;}
00608 
00609 
00614     PX_FORCE_INLINE PxReal getRecipMOI() const {return mRecipMOI;}
00615 
00616 private:
00617 
00623     PxReal mRecipRadius;
00624 
00630     PxReal mRecipMOI;
00631 
00632     PxReal mPad[1];
00633 
00634     bool isValid() const;
00635 };
00636 PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleWheelData)& 0x0f));
00637 
00638 class PxVehicleSuspensionData
00639 {
00640 public:
00641 
00642     friend class PxVehicleWheels4SimData;
00643 
00644     PxVehicleSuspensionData()
00645         :   mSpringStrength(0.0f),
00646             mSpringDamperRate(0.0f),
00647             mMaxCompression(0.3f),
00648             mMaxDroop(0.1f),
00649             mSprungMass(0.0f)
00650     {
00651     }
00652 
00657     PxReal mSpringStrength;
00658 
00663     PxReal mSpringDamperRate;
00664 
00669     PxReal mMaxCompression;
00670 
00675     PxReal mMaxDroop;
00676 
00681     PxReal mSprungMass;
00682 
00683 private:
00684 
00685     PxReal mPad[3];
00686 
00687     bool isValid() const;
00688 };
00689 PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleSuspensionData)& 0x0f));
00690 
00691 class PxVehicleTireData
00692 {
00693 public:
00694 
00695     friend class PxVehicleWheels4SimData;
00696 
00697     PxVehicleTireData()
00698         :   mLatStiffX(2.0f),
00699             mLatStiffY(0.3125f*(180.0f / PxPi)),
00700             mLongitudinalStiffnessPerUnitGravity(1000.0f),
00701             mCamberStiffness(1.0f*(180.0f / PxPi)),
00702             mType(0)
00703     {
00704         mFrictionVsSlipGraph[0][0]=0.0f;
00705         mFrictionVsSlipGraph[0][1]=1.0f;
00706         mFrictionVsSlipGraph[1][0]=0.1f;
00707         mFrictionVsSlipGraph[1][1]=1.0f;
00708         mFrictionVsSlipGraph[2][0]=1.0f;
00709         mFrictionVsSlipGraph[2][1]=1.0f;
00710 
00711         mRecipLongitudinalStiffnessPerUnitGravity=1.0f/mLongitudinalStiffnessPerUnitGravity;
00712         mFrictionVsSlipGraphRecipx1Minusx0=1.0f/(mFrictionVsSlipGraph[1][0]-mFrictionVsSlipGraph[0][0]);
00713         mFrictionVsSlipGraphRecipx2Minusx1=1.0f/(mFrictionVsSlipGraph[2][0]-mFrictionVsSlipGraph[1][0]);
00714     }
00715 
00722     PxReal mLatStiffX;
00723 
00730     PxReal mLatStiffY;
00731 
00737     PxReal mLongitudinalStiffnessPerUnitGravity;
00738 
00743     PxReal mCamberStiffness;
00744 
00755     PxReal mFrictionVsSlipGraph[3][2];
00756 
00761     PxU32 mType;
00762 
00767     PX_FORCE_INLINE PxReal getRecipLongitudinalStiffnessPerUnitGravity() const {return mRecipLongitudinalStiffnessPerUnitGravity;}
00768 
00773     PX_FORCE_INLINE PxReal getFrictionVsSlipGraphRecipx1Minusx0() const {return mFrictionVsSlipGraphRecipx1Minusx0;}
00774 
00779     PX_FORCE_INLINE PxReal getFrictionVsSlipGraphRecipx2Minusx1() const {return mFrictionVsSlipGraphRecipx2Minusx1;}
00780 
00781 private:
00782 
00788     PxReal mRecipLongitudinalStiffnessPerUnitGravity;
00789 
00795     PxReal mFrictionVsSlipGraphRecipx1Minusx0;
00796 
00802     PxReal mFrictionVsSlipGraphRecipx2Minusx1;
00803 
00804     PxReal mPad[2];
00805 
00806     bool isValid() const;
00807 };
00808 PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleTireData)& 0x0f));
00809 
00810 #ifndef PX_DOXYGEN
00811 } // namespace physx
00812 #endif
00813 
00815 #endif //PX_VEHICLE_CORE_COMPONENTS_H


Copyright © 2008-2012 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com