File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4747
4848#include < gz/common/Console.hh>
4949#include < gz/math/eigen3/Conversions.hh>
50+ #include < gz/math/SemanticVersion.hh>
5051#include < gz/physics/Implements.hh>
5152
5253namespace gz {
@@ -360,6 +361,10 @@ class Base : public Implements3d<FeatureList<Feature>>
360361 // Note: Entity ID 0 is reserved for the "engine"
361362 public: std::size_t entityCount = 1 ;
362363
364+ // BT_BULLET_VERSION is an integer like 324 representing version 3.24
365+ public: const gz::math::SemanticVersion engineVersion{
366+ BT_BULLET_VERSION / 100 , BT_BULLET_VERSION % 100 };
367+
363368 public: inline std::size_t GetNextEntity ()
364369 {
365370 return entityCount++;
Original file line number Diff line number Diff line change @@ -308,10 +308,7 @@ const std::string &EntityManagementFeatures::GetEngineName(
308308const gz::math::SemanticVersion &EntityManagementFeatures::GetEngineVersion (
309309 const Identity &) const
310310{
311- // BT_BULLET_VERSION is an integer like 324 representing version 3.24
312- int ver = BT_BULLET_VERSION ;
313- static const gz::math::SemanticVersion version (ver / 100 , ver % 100 );
314- return version;
311+ return this ->engineVersion ;
315312}
316313
317314// ///////////////////////////////////////////////
Original file line number Diff line number Diff line change 2929#include < map>
3030
3131#include < gz/common/Console.hh>
32+ #include < gz/math/SemanticVersion.hh>
3233#include < gz/physics/Implements.hh>
3334#include < gz/math/eigen3/Conversions.hh>
3435
@@ -174,6 +175,10 @@ inline math::Pose3d convertToGz(const btTransform &_pose)
174175
175176class Base : public Implements3d <FeatureList<Feature>>
176177{
178+ // BT_BULLET_VERSION is an integer like 324 representing version 3.24
179+ public: const gz::math::SemanticVersion engineVersion{
180+ BT_BULLET_VERSION / 100 , BT_BULLET_VERSION % 100 };
181+
177182 public: std::size_t entityCount = 0 ;
178183
179184 public: inline std::size_t GetNextEntity ()
Original file line number Diff line number Diff line change @@ -122,10 +122,7 @@ const std::string &EntityManagementFeatures::GetEngineName(
122122const gz::math::SemanticVersion &EntityManagementFeatures::GetEngineVersion (
123123 const Identity &) const
124124{
125- // BT_BULLET_VERSION is an integer like 324 representing version 3.24
126- int ver = BT_BULLET_VERSION ;
127- static const gz::math::SemanticVersion version (ver / 100 , ver % 100 );
128- return version;
125+ return this ->engineVersion ;
129126}
130127
131128std::size_t EntityManagementFeatures::GetEngineIndex (const Identity &) const
Original file line number Diff line number Diff line change 3737#include < gz/common/Console.hh>
3838#include < gz/math/eigen3/Conversions.hh>
3939#include < gz/math/Inertial.hh>
40+ #include < gz/math/SemanticVersion.hh>
4041#include < gz/physics/Implements.hh>
4142
4243#include < sdf/Types.hh>
@@ -261,6 +262,12 @@ struct EntityStorage
261262
262263class Base : public Implements3d <FeatureList<Feature>>
263264{
265+ public: const gz::math::SemanticVersion engineVersion = [](){
266+ gz::math::SemanticVersion v;
267+ v.Parse (DART_VERSION );
268+ return v;
269+ }();
270+
264271 public: using DartWorld = dart::simulation::World;
265272 public: using DartWorldPtr = dart::simulation::WorldPtr;
266273 public: using DartSkeletonPtr = dart::dynamics::SkeletonPtr;
Original file line number Diff line number Diff line change @@ -140,12 +140,7 @@ const std::string &EntityManagementFeatures::GetEngineName(
140140const gz::math::SemanticVersion &EntityManagementFeatures::GetEngineVersion (
141141 const Identity &/* _engineID*/ ) const
142142{
143- static const gz::math::SemanticVersion version = [](){
144- gz::math::SemanticVersion v;
145- v.Parse (DART_VERSION );
146- return v;
147- }();
148- return version;
143+ return this ->engineVersion ;
149144}
150145
151146// ///////////////////////////////////////////////
Original file line number Diff line number Diff line change 1818#ifndef GZ_PHYSICS_TPE_PLUGIN_SRC_BASE_HH_
1919#define GZ_PHYSICS_TPE_PLUGIN_SRC_BASE_HH_
2020
21+ #include < gz/math/SemanticVersion.hh>
2122#include < gz/physics/Implements.hh>
2223
2324#include < map>
@@ -61,6 +62,9 @@ struct CollisionInfo
6162
6263class Base : public Implements3d <FeatureList<Feature>>
6364{
65+ // TPE versioning is internal to gz-physics
66+ public: const gz::math::SemanticVersion engineVersion{1 , 0 };
67+
6468 public: inline Identity InitiateEngine (std::size_t /* _engineID*/ ) override
6569 {
6670 return this ->GenerateIdentity (0 );
Original file line number Diff line number Diff line change @@ -35,9 +35,7 @@ const std::string &EntityManagementFeatures::GetEngineName(
3535const gz::math::SemanticVersion &EntityManagementFeatures::GetEngineVersion (
3636 const Identity &) const
3737{
38- // TPE versioning is internal to gz-physics, set the version here
39- static const gz::math::SemanticVersion version (1 , 0 );
40- return version;
38+ return this ->engineVersion ;
4139}
4240
4341// ///////////////////////////////////////////////
You can’t perform that action at this time.
0 commit comments