Skip to content

Commit 710546a

Browse files
j-riveroscpeters
andauthored
Add GetEngineVersion to GetEngineInfo (#821)
API Changes: * Added GetVersion() method to GetEngineInfo::Engine class for retrieving engine version * Added GetEngineVersion() pure virtual method to GetEngineInfo::Implementation interface * Updated all physics engine plugins to implement version reporting: - bullet and bullet-featherstone: Parse BT_BULLET_VERSION macro to return version string (e.g., "3.24") - dartsim: Use DART_VERSION macro to return version string (e.g., "6.13.0") - tpe: Return "1.0" as version * Updated dartsim's GetEngineName() to return "dartsim" only (previously returned "dartsim-" + DART_VERSION) Generated-by: Claude Opus 4.5 --------- Signed-off-by: Jose Luis Rivero <jrivero@osrfoundation.org> Co-authored-by: Steve Peters <scpeters@openrobotics.org>
1 parent ffa41c0 commit 710546a

17 files changed

Lines changed: 105 additions & 2 deletions

Changelog.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
## Gazebo Physics 9.x
1+
## Gazebo Physics 10.x
2+
3+
### Gazebo Physics 10.0.0 ()
4+
5+
1. Add `GetEngineVersion` to `GetEngineInfo` feature to separate engine name and version
6+
* Adds `GetVersion()` method to `GetEngineInfo::Engine` API returning `gz::math::SemanticVersion`
7+
* Adds `GetEngineVersion()` pure virtual method to `GetEngineInfo::Implementation`
8+
* Implements `GetEngineVersion()` in all physics engine plugins:
9+
- bullet and bullet-featherstone: parse `BT_BULLET_VERSION` macro to return SemanticVersion(3, 24)
10+
- dartsim: parse `DART_VERSION` macro string to SemanticVersion
11+
- tpe: return SemanticVersion(1, 0)
12+
* Updates dartsim `GetEngineName()` to return "dartsim" only (was "dartsim-" DART_VERSION)
213

314
### Gazebo Physics 9.0.0 (2025-09-24)
415

bullet-featherstone/src/Base.hh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
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

5253
namespace 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++;

bullet-featherstone/src/EntityManagementFeatures.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
*/
1717

1818
#include <btBulletDynamicsCommon.h>
19+
#include <LinearMath/btScalar.h>
1920

2021
#include <memory>
22+
#include <sstream>
2123
#include <string>
2224
#include <unordered_map>
2325

@@ -303,6 +305,12 @@ const std::string &EntityManagementFeatures::GetEngineName(
303305
return engineName;
304306
}
305307

308+
const gz::math::SemanticVersion &EntityManagementFeatures::GetEngineVersion(
309+
const Identity &) const
310+
{
311+
return this->engineVersion;
312+
}
313+
306314
/////////////////////////////////////////////////
307315
std::size_t EntityManagementFeatures::GetEngineIndex(const Identity &) const
308316
{

bullet-featherstone/src/EntityManagementFeatures.hh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ class EntityManagementFeatures :
5252
public: const std::string &GetEngineName(
5353
const Identity &_engineID) const override;
5454

55+
public: const gz::math::SemanticVersion &GetEngineVersion(
56+
const Identity &_engineID) const override;
57+
5558
public: std::size_t GetEngineIndex(
5659
const Identity &_engineID) const override;
5760

bullet/src/Base.hh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
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

175176
class 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()

bullet/src/EntityManagementFeatures.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
*/
1717

1818
#include <btBulletDynamicsCommon.h>
19+
#include <LinearMath/btScalar.h>
1920

2021
#include <memory>
22+
#include <sstream>
2123
#include <string>
2224
#include <unordered_map>
2325

@@ -117,6 +119,12 @@ const std::string &EntityManagementFeatures::GetEngineName(
117119
return engineName;
118120
}
119121

122+
const gz::math::SemanticVersion &EntityManagementFeatures::GetEngineVersion(
123+
const Identity &) const
124+
{
125+
return this->engineVersion;
126+
}
127+
120128
std::size_t EntityManagementFeatures::GetEngineIndex(const Identity &) const
121129
{
122130
return 0;

bullet/src/EntityManagementFeatures.hh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ class EntityManagementFeatures :
6565

6666
// ----- Get entities -----
6767
public: const std::string &GetEngineName(const Identity &) const override;
68+
public: const gz::math::SemanticVersion &GetEngineVersion(
69+
const Identity &) const override;
6870
public: std::size_t GetEngineIndex(const Identity &) const override;
6971

7072
public: std::size_t GetWorldCount(const Identity &) const override;

dartsim/src/Base.hh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
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

262263
class 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;

dartsim/src/EntityManagementFeatures.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,17 @@ static std::size_t GetWorldOfShapeNode(const EntityManagementFeatures *_emf,
132132
const std::string &EntityManagementFeatures::GetEngineName(
133133
const Identity &/*_engineID*/) const
134134
{
135-
static const std::string engineName = "dartsim-" DART_VERSION;
135+
static const std::string engineName = "dartsim";
136136
return engineName;
137137
}
138138

139+
/////////////////////////////////////////////////
140+
const gz::math::SemanticVersion &EntityManagementFeatures::GetEngineVersion(
141+
const Identity &/*_engineID*/) const
142+
{
143+
return this->engineVersion;
144+
}
145+
139146
/////////////////////////////////////////////////
140147
std::size_t EntityManagementFeatures::GetEngineIndex(
141148
const Identity &/*_engineID*/) const

dartsim/src/EntityManagementFeatures.hh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ class GZ_PHYSICS_DARTSIM_PLUGIN_VISIBLE EntityManagementFeatures :
5252
// ----- Get entities -----
5353
public: const std::string &GetEngineName(const Identity &) const override;
5454

55+
public: const gz::math::SemanticVersion &GetEngineVersion(
56+
const Identity &) const override;
57+
5558
public: std::size_t GetEngineIndex(const Identity &) const override;
5659

5760
public: std::size_t GetWorldCount(const Identity &) const override;

0 commit comments

Comments
 (0)