PhysX SDK 3.2 API Reference: PxVehicleUtilTelemetry.h Source File

PhysX SDK 3.2 API

PxVehicleUtilTelemetry.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_UTILSTELEMETRY_H
00031 #define PX_VEHICLE_UTILSTELEMETRY_H
00032 
00036 #include "vehicle/PxVehicleSDK.h"
00037 #include "foundation/PxSimpleTypes.h"
00038 #include "foundation/PxVec3.h"
00039 
00040 #ifndef PX_DOXYGEN
00041 namespace physx
00042 {
00043 #endif
00044 
00045 #if PX_DEBUG_VEHICLE_ON
00046 
00047 class PxVehicleGraphDesc
00048 {
00049 
00050     friend class PxVehicleGraph;
00051 
00052     PxVehicleGraphDesc();
00053 
00058     PxReal mPosX;
00059 
00064     PxReal mPosY;
00065 
00070     PxReal mSizeX;
00071 
00076     PxReal mSizeY;
00077 
00081     PxVec3 mBackgroundColor;
00082 
00086     PxReal mAlpha;
00087 
00088 private:
00089 
00090     bool isValid() const;
00091 };
00092 
00093 struct PxVehicleGraphChannelDesc
00094 {
00095 public:
00096 
00097     friend class PxVehicleGraph;
00098 
00099     PxVehicleGraphChannelDesc();
00100 
00104     PxReal mMinY;
00105 
00109     PxReal mMaxY;
00110 
00115     PxReal mMidY;
00116 
00120     PxVec3 mColorLow;
00121 
00125     PxVec3 mColorHigh;
00126 
00130     char* mTitle;
00131 
00132 private:
00133 
00134     bool isValid() const;
00135 };
00136 
00137 class PxVehicleGraph
00138 {
00139 public:
00140 
00141     friend class PxVehicleTelemetryData;
00142     friend class PxVehicleUpdate;
00143 
00144     enum
00145     {
00146         eMAX_NUM_SAMPLES=256
00147     };
00148 
00149     enum
00150     {
00151         eMAX_NUM_TITLE_CHARS=256
00152     };
00153 
00154     enum
00155     {
00156         eCHANNEL_JOUNCE=0,
00157         eCHANNEL_SUSPFORCE,
00158         eCHANNEL_TIRELOAD,
00159         eCHANNEL_NORMALIZED_TIRELOAD,
00160         eCHANNEL_WHEEL_OMEGA, 
00161         eCHANNEL_TIRE_FRICTION,
00162         eCHANNEL_TIRE_LONG_SLIP,
00163         eCHANNEL_NORM_TIRE_LONG_FORCE,
00164         eCHANNEL_TIRE_LAT_SLIP,
00165         eCHANNEL_NORM_TIRE_LAT_FORCE,
00166         eCHANNEL_NORM_TIRE_ALIGNING_MOMENT,
00167         eMAX_NUM_WHEEL_CHANNELS
00168     };
00169 
00170     enum
00171     {
00172         eCHANNEL_ENGINE_REVS=0,
00173         eCHANNEL_ENGINE_DRIVE_TORQUE,
00174         eCHANNEL_CLUTCH_SLIP,
00175         eCHANNEL_ACCEL_CONTROL,                 //TANK_ACCEL
00176         eCHANNEL_BRAKE_CONTROL,                 //TANK_BRAKE_LEFT
00177         eCHANNEL_HANDBRAKE_CONTROL,             //TANK_BRAKE_RIGHT
00178         eCHANNEL_STEER_LEFT_CONTROL,            //TANK_THRUST_LEFT
00179         eCHANNEL_STEER_RIGHT_CONTROL,           //TANK_THRUST_RIGHT
00180         eCHANNEL_GEAR_RATIO,
00181         eMAX_NUM_ENGINE_CHANNELS
00182     };
00183 
00184     enum
00185     {
00186         eMAX_NUM_CHANNELS=12
00187     };
00188 
00189     enum eGraphType
00190     {
00191         eGRAPH_TYPE_WHEEL=0,
00192         eGRAPH_TYPE_ENGINE
00193     };
00194 
00198     void setup(const PxVehicleGraphDesc& desc, const eGraphType graphType);
00199 
00203     void clearRecordedChannelData();
00204 
00208     const PxVec3& getBackgroundColor() const {return mBackgroundColor;}
00209 
00213     PxReal getBackgroundAlpha() const {return mBackgroundAlpha;}
00214 
00218     void getBackgroundCoords(PxReal& xMin, PxReal& yMin, PxReal& xMax, PxReal& yMax) const {xMin = mBackgroundMinX;xMax = mBackgroundMaxX;yMin = mBackgroundMinY;yMax = mBackgroundMaxY;}
00219 
00226     void computeGraphChannel(const PxU32 channel, PxReal* xy, PxVec3* colors, char* title) const;
00227 
00228 private:
00229 
00230     //Min and max of each sample.
00231     PxReal mChannelMinY[eMAX_NUM_CHANNELS];
00232     PxReal mChannelMaxY[eMAX_NUM_CHANNELS];
00233     //Discriminate between high and low values with different colors.
00234     PxReal mChannelMidY[eMAX_NUM_CHANNELS];
00235     //Different colors for values than midY and less than midY.
00236     PxVec3 mChannelColorLow[eMAX_NUM_CHANNELS];
00237     PxVec3 mChannelColorHigh[eMAX_NUM_CHANNELS];
00238     //Title of graph
00239     char mChannelTitle[eMAX_NUM_CHANNELS][eMAX_NUM_TITLE_CHARS];
00240     //Graph data.
00241     PxReal mChannelSamples[eMAX_NUM_CHANNELS][eMAX_NUM_SAMPLES];
00242 
00243     //Background color,alpha,coords
00244     PxVec3 mBackgroundColor;
00245     PxReal mBackgroundAlpha;
00246     PxReal mBackgroundMinX;
00247     PxReal mBackgroundMaxX;
00248     PxReal mBackgroundMinY;
00249     PxReal mBackgroundMaxY;
00250 
00251     PxU32 mSampleTide;
00252 
00253     PxU32 mNumChannels;
00254 
00255     PxU32 mPad[2];
00256 
00257 
00258     void setup
00259         (const PxF32 graphSizeX, const PxF32 graphSizeY,
00260         const PxF32 engineGraphPosX, const PxF32 engineGraphPosY,
00261         const PxF32* const wheelGraphPosX, const PxF32* const wheelGraphPosY,
00262         const PxVec3& backgroundColor, const PxVec3& lineColorHigh, const PxVec3& lineColorLow);
00263 
00264     void updateTimeSlice(const PxReal* const samples);
00265 
00266     void setChannel(PxVehicleGraphChannelDesc& desc, const PxU32 channel);
00267 
00268     void setupEngineGraph
00269         (const PxF32 sizeX, const PxF32 sizeY, const PxF32 posX, const PxF32 posY, 
00270         const PxVec3& backgoundColor, const PxVec3& lineColorHigh, const PxVec3& lineColorLow);
00271 
00272     void setupWheelGraph
00273         (const PxF32 sizeX, const PxF32 sizeY, const PxF32 posX, const PxF32 posY, 
00274         const PxVec3& backgoundColor, const PxVec3& lineColorHigh, const PxVec3& lineColorLow);
00275 
00276     PxVehicleGraph();
00277     ~PxVehicleGraph();
00278 };
00279 PX_COMPILE_TIME_ASSERT(PxU32(PxVehicleGraph::eMAX_NUM_CHANNELS) >= PxU32(PxVehicleGraph::eMAX_NUM_WHEEL_CHANNELS) && PxU32(PxVehicleGraph::eMAX_NUM_CHANNELS) >= PxU32(PxVehicleGraph::eMAX_NUM_ENGINE_CHANNELS));
00280 PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleGraph) & 15));
00281 
00282 class PxVehicleTelemetryData
00283 {
00284 public:
00285 
00286     friend class PxVehicleUpdate;
00287 
00292     static PxVehicleTelemetryData* allocate(const PxU32 numWheels);
00293 
00298     void free();
00299 
00303     void setup
00304         (const PxReal graphSizeX, const PxReal graphSizeY,
00305          const PxReal engineGraphPosX, const PxReal engineGraphPosY,
00306          const PxReal* const wheelGraphPosX, const PxReal* const wheelGraphPosY,
00307          const PxVec3& backGroundColor, const PxVec3& lineColorHigh, const PxVec3& lineColorLow);
00308 
00312     void clear();
00313 
00317     const PxVehicleGraph& getEngineGraph() const {return *mEngineGraph;}
00318 
00322     PxU32 getNumWheelGraphs() const {return mNumActiveWheels;}
00323 
00327     const PxVehicleGraph& getWheelGraph(const PxU32 k) const {return mWheelGraphs[k];}
00328 
00332     const PxVec3* getTireforceAppPoints() const {return mTireforceAppPoints;}
00333 
00337     const PxVec3* getSuspforceAppPoints() const {return mSuspforceAppPoints;}
00338 
00339 private:
00340 
00346     PxVehicleGraph* mEngineGraph;
00347 
00353     PxVehicleGraph* mWheelGraphs;
00354 
00358     PxVec3* mTireforceAppPoints;
00359 
00363     PxVec3* mSuspforceAppPoints;
00364 
00368     PxU32 mNumActiveWheels;
00369 
00370     PxU32 mPad[3];
00371 
00372 private:
00373 
00374     PxVehicleTelemetryData(){}
00375     ~PxVehicleTelemetryData(){}
00376 };
00377 
00378 PX_COMPILE_TIME_ASSERT(0==(sizeof(PxVehicleTelemetryData) & 15));
00379 
00380 #endif //PX_DEBUG_VEHICLE_ON
00381 
00382 //#endif // PX_DEBUG_VEHICLE_ON
00383 
00384 #ifndef PX_DOXYGEN
00385 } // namespace physx
00386 #endif
00387 
00389 #endif //PX_VEHICLE_UTILSTELEMETRY_H


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