RavEngine
Loading...
Searching...
No Matches
BaseSerialization.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
27// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
28
29#pragma once
30
31#include "vehicle2/PxVehicleAPI.h"
32
33#include "../base/Base.h"
34
35#if PX_SWITCH
36#pragma clang diagnostic push
37#pragma clang diagnostic ignored "-Wexpansion-to-defined"
38#elif PX_OSX
39#pragma clang diagnostic push
40#pragma clang diagnostic ignored "-Wexpansion-to-defined"
41#pragma clang diagnostic ignored "-Wdocumentation"
42#pragma clang diagnostic ignored "-Wimplicit-fallthrough"
43#elif PX_LINUX && PX_CLANG
44#pragma clang diagnostic push
45#pragma clang diagnostic ignored "-Wdocumentation"
46#endif
47#include "rapidjson/document.h"
48#include "rapidjson/prettywriter.h"
49#if (PX_LINUX && PX_CLANG) || PX_SWITCH
50#pragma clang diagnostic pop
51#endif
52
53
54namespace snippetvehicle2
55{
56
57using namespace physx;
58using namespace physx::vehicle2;
59
60bool readAxleDescription(const rapidjson::Document& config, PxVehicleAxleDescription& axleDesc);
61bool writeAxleDescription(const PxVehicleAxleDescription& axleDesc, rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
62
63
64bool readFrame(const rapidjson::Document& config, PxVehicleFrame& frame);
65bool writeFrame(const PxVehicleFrame& frame, rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
66
67
68bool readScale(const rapidjson::Document& config, PxVehicleScale& scale);
69bool writeScale(const PxVehicleScale& scale, rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
70
71
72bool readBrakeResponseParams
73 (const rapidjson::Document& config, const PxVehicleAxleDescription& axleDesc,
74 PxVehicleBrakeCommandResponseParams& brakeResponseParams);
75bool writeBrakeResponseParams
76 (const PxVehicleBrakeCommandResponseParams& brakeResponseParams, const PxVehicleAxleDescription& axleDesc,
77 rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
78
79
80bool readHandbrakeResponseParams
81 (const rapidjson::Document& config, const PxVehicleAxleDescription& axleDesc,
82 PxVehicleBrakeCommandResponseParams& handbrakeResponseParams);
83bool writeHandbrakeResponseParams
84 (const PxVehicleBrakeCommandResponseParams& handrakeResponseParams, const PxVehicleAxleDescription& axleDesc,
85 rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
86
87
88bool readSteerResponseParams
89 (const rapidjson::Document& config, const PxVehicleAxleDescription& axleDesc,
90 PxVehicleSteerCommandResponseParams& steerResponseParams);
91bool writeSteerResponseParams
92 (const PxVehicleSteerCommandResponseParams& steerResponseParams, const PxVehicleAxleDescription& axleDesc,
93 rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
94
95bool readAckermannParams
96 (const rapidjson::Document& config, PxVehicleAckermannParams& ackermannParams);
97bool writeAckermannParams
98 (const PxVehicleAckermannParams& ackermannParams, rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
99
100bool readRigidBodyParams
101 (const rapidjson::Document& config, PxVehicleRigidBodyParams& rigidBodyParams);
102bool writeRigidBodyParams
103 (const PxVehicleRigidBodyParams& rigidBodyParams, rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
104
105bool readSuspensionParams
106 (const rapidjson::Document& config, const PxVehicleAxleDescription& axleDesc,
107 PxVehicleSuspensionParams* suspParams);
108bool writeSuspensionParams
109 (const PxVehicleSuspensionParams* suspParams, const PxVehicleAxleDescription& axleDesc,
110 rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
111
112bool readSuspensionStateCalculationParams
113 (const rapidjson::Document& config,
115bool writeSuspensionStateCalculationParams
117 rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
118
119
120bool readSuspensionComplianceParams
121 (const rapidjson::Document& config, const PxVehicleAxleDescription& axleDesc,
123bool writeSuspensionComplianceParams
124 (const PxVehicleSuspensionComplianceParams* suspParams, const PxVehicleAxleDescription& axleDesc,
125 rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
126
127
128bool readSuspensionForceParams
129 (const rapidjson::Document& config, const PxVehicleAxleDescription& axleDesc,
131bool writeSuspensionForceParams
132 (const PxVehicleSuspensionForceParams* suspParams, const PxVehicleAxleDescription& axleDesc,
133 rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
134
135
136bool readSuspensionForceLegacyParams
137 (const rapidjson::Document& config, const PxVehicleAxleDescription& axleDesc,
139bool writeSuspensionForceLegacyParams
140 (const PxVehicleSuspensionForceLegacyParams* suspParams, const PxVehicleAxleDescription& axleDesc,
141 rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
142
143
144bool readTireSlipParams
145 (const rapidjson::Document& config, const PxVehicleAxleDescription& axleDesc,
146 PxVehicleTireSlipParams* tireParams);
147bool writeTireSlipParams
148 (const PxVehicleTireSlipParams* tireParams, const PxVehicleAxleDescription& axleDesc,
149 rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
150
151
152bool readTireStickyParams
153 (const rapidjson::Document& config, const PxVehicleAxleDescription& axleDesc,
154 PxVehicleTireStickyParams* tireParams);
155bool writeTireStickyParams
156 (const PxVehicleTireStickyParams* tireParams, const PxVehicleAxleDescription& axleDesc,
157 rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
158
159
160bool readTireForceParams
161 (const rapidjson::Document& config, const PxVehicleAxleDescription& axleDesc,
162 PxVehicleTireForceParams* tireParams);
163bool writeTireForceParams
164 (const PxVehicleTireForceParams* tireParams, const PxVehicleAxleDescription& axleDesc,
165 rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
166
167
168bool readWheelParams
169 (const rapidjson::Document& config, const PxVehicleAxleDescription& axleDesc,
170 PxVehicleWheelParams* wheelParams);
171bool writeWheelParams
172 (const PxVehicleWheelParams* wheelParams, const PxVehicleAxleDescription& axleDesc,
173 rapidjson::PrettyWriter<rapidjson::StringBuffer>& writer);
174
175
176bool readBaseParamsFromJsonFile(const char* directory, const char* filename, BaseVehicleParams&);
177bool writeBaseParamsToJsonFile(const char* directory, const char* filename, const BaseVehicleParams&);
178
179}//namespace snippetvehicle2
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
A description of a single axle that is to be affected by Ackermann steer correction.
Definition PxVehicleSteeringParams.h:86
Definition PxVehicleParams.h:53
Distribute a brake response to the wheels of a vehicle.
Definition PxVehicleBrakingParams.h:56
Definition PxVehicleParams.h:174
The properties of the rigid body.
Definition PxVehicleRigidBodyParams.h:50
Definition PxVehicleParams.h:224
Distribute a steer response to the wheels of a vehicle.
Definition PxVehicleSteeringParams.h:58
Compliance describes how toe and camber angle and force application points are affected by suspension...
Definition PxVehicleSuspensionParams.h:155
Suspension force is computed by converting suspenson state to suspension force under the assumption o...
Definition PxVehicleSuspensionParams.h:286
Suspension force is computed by converting suspenson state to suspension force under the assumption o...
Definition PxVehicleSuspensionParams.h:236
Definition PxVehicleSuspensionParams.h:51
Definition PxVehicleSuspensionParams.h:113
Definition PxVehicleTireParams.h:49
Tire slip values are computed using ratios with potential for divide-by-zero errors....
Definition PxVehicleParams.h:438
For each tire, the forces of the tire model may be replaced by velocity constraints when the tire ent...
Definition PxVehicleParams.h:590
Definition PxVehicleWheelParams.h:47