From 64160f94aceca6fdd2b5baa3270da63a06dee9f2 Mon Sep 17 00:00:00 2001 From: Udaya Prakash Date: Wed, 13 Nov 2024 14:36:30 +0100 Subject: [PATCH 01/12] add suppresswarning and quaternion Signed-off-by: Udaya Prakash Signed-off-by: udayaprakash --- BUILD.bazel | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/BUILD.bazel b/BUILD.bazel index 280adfd4a..9b400bf98 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -123,13 +123,15 @@ cc_library( "@gz-math//:Graph", "@gz-math//:Inertial", "@gz-math//:Pose3", + "@gz-math//:Quaternion", "@gz-math//:SemanticVersion", "@gz-math//:Sphere", "@gz-math//:SphericalCoordinates", "@gz-math//:Temperature", "@gz-math//:Vector2", "@gz-utils//:Environment", - "@gz-utils//:ImplPtr", + "@gz-utils//:ImplPtr" + "@gz-utils//:SuppressWarning", ], ) From f508488ffe4a0ae4a7791fc736da4519fe4eede5 Mon Sep 17 00:00:00 2001 From: Udaya Prakash Date: Wed, 13 Nov 2024 14:49:36 +0100 Subject: [PATCH 02/12] Fix comma Signed-off-by: Udaya Prakash Signed-off-by: udayaprakash --- BUILD.bazel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD.bazel b/BUILD.bazel index 9b400bf98..f028e9e19 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -130,7 +130,7 @@ cc_library( "@gz-math//:Temperature", "@gz-math//:Vector2", "@gz-utils//:Environment", - "@gz-utils//:ImplPtr" + "@gz-utils//:ImplPtr", "@gz-utils//:SuppressWarning", ], ) From 9f9502dc0da0aafed905194a1c74a32b5b9011f0 Mon Sep 17 00:00:00 2001 From: udayaprakash Date: Thu, 14 Nov 2024 15:17:09 +0000 Subject: [PATCH 03/12] add vector3 to sdformat Signed-off-by: udayaprakash --- BUILD.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/BUILD.bazel b/BUILD.bazel index f028e9e19..4974a2546 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -129,6 +129,7 @@ cc_library( "@gz-math//:SphericalCoordinates", "@gz-math//:Temperature", "@gz-math//:Vector2", + "@gz-math//:Vector3", "@gz-utils//:Environment", "@gz-utils//:ImplPtr", "@gz-utils//:SuppressWarning", From 4a6e8b48cc1de449b93517dad93952ba2ea38443 Mon Sep 17 00:00:00 2001 From: Nate Koenig Date: Tue, 12 Nov 2024 10:07:00 -0800 Subject: [PATCH 04/12] Support removing the actor, light, or model from the root (#1492) * Support removing the actor, light, or model from the root Signed-off-by: Nate Koenig * Update src/Root_TEST.cc Co-authored-by: Steve Peters Signed-off-by: Nate Koenig * Update src/Root_TEST.cc Co-authored-by: Steve Peters Signed-off-by: Nate Koenig * Update src/Root_TEST.cc Co-authored-by: Steve Peters Signed-off-by: Nate Koenig * Update src/Root_TEST.cc Co-authored-by: Steve Peters Signed-off-by: Nate Koenig * Update src/Root_TEST.cc Co-authored-by: Steve Peters Signed-off-by: Nate Koenig * Update src/Root_TEST.cc Co-authored-by: Steve Peters Signed-off-by: Nate Koenig --------- Signed-off-by: Nate Koenig Co-authored-by: Steve Peters --- include/sdf/Root.hh | 5 +++++ python/src/sdf/pyRoot.cc | 4 ++++ python/test/pyRoot_TEST.py | 28 +++++++++++++++++++++++++ src/Root.cc | 6 ++++++ src/Root_TEST.cc | 42 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 85 insertions(+) diff --git a/include/sdf/Root.hh b/include/sdf/Root.hh index 8a93192bf..6ad91ba63 100644 --- a/include/sdf/Root.hh +++ b/include/sdf/Root.hh @@ -246,6 +246,11 @@ namespace sdf public: sdf::ElementPtr ToElement( const OutputConfig &_config = OutputConfig::GlobalConfig()) const; + /// \brief Remove the actor, light, or model if one of them exists. + /// The SDF Root object can only hold one, or none, from the set + /// [Actor, Light, Model]. + public: void ClearActorLightModel(); + /// \brief Private data pointer GZ_UTILS_IMPL_PTR(dataPtr) }; diff --git a/python/src/sdf/pyRoot.cc b/python/src/sdf/pyRoot.cc index 2da83830a..af94e78b5 100644 --- a/python/src/sdf/pyRoot.cc +++ b/python/src/sdf/pyRoot.cc @@ -96,6 +96,10 @@ void defineRoot(pybind11::object module) .def("set_light", &sdf::Root::SetLight, "Set the light object. This will override any existing model, " "actor, and light object.") + .def("clear_actor_light_model", &sdf::Root::ClearActorLightModel, + "Remove the actor, light, or model if one of them exists." + "The SDF Root object can only hold one, or none, from the set" + "[Actor, Light, Model].") .def("add_world", [](Root &self, const World &_world) { ThrowIfErrors(self.AddWorld(_world)); diff --git a/python/test/pyRoot_TEST.py b/python/test/pyRoot_TEST.py index 0a41bf667..785f94de3 100644 --- a/python/test/pyRoot_TEST.py +++ b/python/test/pyRoot_TEST.py @@ -358,5 +358,33 @@ def test_resolve_auto_inertials_with_save_calculation_configuration(self): self.assertEqual(len(inertialErr), 0) self.assertTrue(link.auto_inertia_saved()) + def test_clear_actor_light_model(self): + root = Root() + + # \TODO(anyone) Wrap the Actor class. + # self.assertEqual(None, root.actor()) + # actor1 = Actor() + # actor1.set_name("actor1") + # root.set_actor(actor1) + # self.assertNotEqual(None, root.actor()) + # root.clear_actor_light_model() + # self.assertEqual(None, root.actor()) + + self.assertEqual(None, root.light()) + light1 = Light() + light1.set_name("light1") + root.set_light(light1) + self.assertNotEqual(None, root.light()) + root.clear_actor_light_model() + self.assertEqual(None, root.light()) + + self.assertEqual(None, root.model()) + model1 = Model() + model1.set_name("model1") + root.set_model(model1) + self.assertNotEqual(None, root.model()) + root.clear_actor_light_model() + self.assertEqual(None, root.model()) + if __name__ == '__main__': unittest.main() diff --git a/src/Root.cc b/src/Root.cc index 34e2f2103..b6e412d2f 100644 --- a/src/Root.cc +++ b/src/Root.cc @@ -644,3 +644,9 @@ sdf::ElementPtr Root::ToElement(const OutputConfig &_config) const return elem; } + +///////////////////////////////////////////////// +void Root::ClearActorLightModel() +{ + this->dataPtr->modelLightOrActor = std::monostate{}; +} diff --git a/src/Root_TEST.cc b/src/Root_TEST.cc index 4a06de902..629d6b7e7 100644 --- a/src/Root_TEST.cc +++ b/src/Root_TEST.cc @@ -670,3 +670,45 @@ TEST(DOMRoot, WorldByName) ASSERT_TRUE(root.WorldNameExists("world2")); EXPECT_EQ("world2", root.WorldByName("world2")->Name()); } + +///////////////////////////////////////////////// +TEST(DOMRoot, ClearActorLightModel) +{ + sdf::Root root; + EXPECT_EQ(nullptr, root.Actor()); + EXPECT_EQ(nullptr, root.Light()); + EXPECT_EQ(nullptr, root.Model()); + + sdf::Actor actor1; + actor1.SetName("actor1"); + root.SetActor(actor1); + EXPECT_NE(nullptr, root.Actor()); + EXPECT_EQ(nullptr, root.Light()); + EXPECT_EQ(nullptr, root.Model()); + root.ClearActorLightModel(); + EXPECT_EQ(nullptr, root.Actor()); + EXPECT_EQ(nullptr, root.Light()); + EXPECT_EQ(nullptr, root.Model()); + + sdf::Light light1; + light1.SetName("light1"); + root.SetLight(light1); + EXPECT_EQ(nullptr, root.Actor()); + EXPECT_NE(nullptr, root.Light()); + EXPECT_EQ(nullptr, root.Model()); + root.ClearActorLightModel(); + EXPECT_EQ(nullptr, root.Actor()); + EXPECT_EQ(nullptr, root.Light()); + EXPECT_EQ(nullptr, root.Model()); + + sdf::Model model1; + model1.SetName("model1"); + root.SetModel(model1); + EXPECT_EQ(nullptr, root.Actor()); + EXPECT_EQ(nullptr, root.Light()); + EXPECT_NE(nullptr, root.Model()); + root.ClearActorLightModel(); + EXPECT_EQ(nullptr, root.Actor()); + EXPECT_EQ(nullptr, root.Light()); + EXPECT_EQ(nullptr, root.Model()); +} From 9d7abc21e48ec09bed5a770b83c5dcba4db6c2a5 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Wed, 13 Nov 2024 14:53:48 -0800 Subject: [PATCH 05/12] Prepare for 15.1.0 release (#1502) Signed-off-by: Steve Peters --- CMakeLists.txt | 2 +- Changelog.md | 29 +++++++++++++++++++++++++++++ package.xml | 2 +- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 74d38ad66..29cc1bcdf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ if(COMMAND CMAKE_POLICY) CMAKE_POLICY(SET CMP0004 NEW) endif(COMMAND CMAKE_POLICY) -project (sdformat15 VERSION 15.0.0) +project (sdformat15 VERSION 15.1.0) # The protocol version has nothing to do with the package version. # It represents the current version of SDFormat implemented by the software diff --git a/Changelog.md b/Changelog.md index 211119ff2..16e2491b4 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,34 @@ ## libsdformat 15.X +### libsdformat 15.1.0 (2024-11-13) + +1. Bazel CI + * [Pull request #1500](https://github.com/gazebosim/sdformat/pull/1500) + +1. Add bzlmod support to sdf15 + * [Pull request #1493](https://github.com/gazebosim/sdformat/pull/1493) + +1. Support removing the actor, light, or model from the root + * [Pull request #1492](https://github.com/gazebosim/sdformat/pull/1492) + +1. Only look for psutil if testing is enabled + * [Pull request #1495](https://github.com/gazebosim/sdformat/pull/1495) + +1. Improve installation instructions + * [Pull request #1496](https://github.com/gazebosim/sdformat/pull/1496) + +1. Permit building python bindings separately from libsdformat library + * [Pull request #1491](https://github.com/gazebosim/sdformat/pull/1491) + +1. Change sdf\_config.h to sdf/config.hh everywhere + * [Pull request #1494](https://github.com/gazebosim/sdformat/pull/1494) + +1. Improve installation instructions + * [Pull request #1490](https://github.com/gazebosim/sdformat/pull/1490) + +1. Fix symbol checking test when compiled with debug symbols + * [Pull request #1474](https://github.com/gazebosim/sdformat/pull/1474) + ### libsdformat 15.0.0 (2024-09-25) 1. **Baseline:** this includes all changes from 14.5.0 and earlier. diff --git a/package.xml b/package.xml index 2cfe9abe1..860e2e4b4 100644 --- a/package.xml +++ b/package.xml @@ -1,7 +1,7 @@ sdformat15 - 15.0.0 + 15.1.0 SDFormat is an XML file format that describes environments, objects, and robots in a manner suitable for robotic applications From 234e4c110f7f1b19bf5bf9a82beb41b66554e9ee Mon Sep 17 00:00:00 2001 From: udayaprakash Date: Thu, 14 Nov 2024 15:18:52 +0000 Subject: [PATCH 06/12] add Plane to sdformat Signed-off-by: udayaprakash --- BUILD.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/BUILD.bazel b/BUILD.bazel index 4974a2546..f4ac7daac 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -123,6 +123,7 @@ cc_library( "@gz-math//:Graph", "@gz-math//:Inertial", "@gz-math//:Pose3", + "@gz-math//:Plane", "@gz-math//:Quaternion", "@gz-math//:SemanticVersion", "@gz-math//:Sphere", From ef64ef04af564f083b40d2935ad3fb80337c6461 Mon Sep 17 00:00:00 2001 From: udayaprakash Date: Thu, 14 Nov 2024 15:26:14 +0000 Subject: [PATCH 07/12] add NeverDestroyed Signed-off-by: udayaprakash --- BUILD.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/BUILD.bazel b/BUILD.bazel index f4ac7daac..97ee78cad 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -133,6 +133,7 @@ cc_library( "@gz-math//:Vector3", "@gz-utils//:Environment", "@gz-utils//:ImplPtr", + "@gz-utils//:NeverDestroyed", "@gz-utils//:SuppressWarning", ], ) From ad32f3a69fd43a108c6cb1314b846ff8f009bacf Mon Sep 17 00:00:00 2001 From: udayaprakash Date: Thu, 14 Nov 2024 15:28:48 +0000 Subject: [PATCH 08/12] add tinyxml2 Signed-off-by: udayaprakash --- BUILD.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/BUILD.bazel b/BUILD.bazel index 97ee78cad..f922ed821 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -135,6 +135,7 @@ cc_library( "@gz-utils//:ImplPtr", "@gz-utils//:NeverDestroyed", "@gz-utils//:SuppressWarning", + "@tinyxml2", ], ) From 35a8b69d88496c47499bfcc8f5f24240d15f20cf Mon Sep 17 00:00:00 2001 From: udayaprakash Date: Thu, 14 Nov 2024 15:31:31 +0000 Subject: [PATCH 09/12] add Helpers Signed-off-by: udayaprakash --- BUILD.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/BUILD.bazel b/BUILD.bazel index f922ed821..5113f0516 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -121,6 +121,7 @@ cc_library( "@gz-math//:Cylinder", "@gz-math//:Ellipsoid", "@gz-math//:Graph", + "@gz-math//:Helpers", "@gz-math//:Inertial", "@gz-math//:Pose3", "@gz-math//:Plane", From dbef675117c0c0653ba0464c1e17958f5720fd4a Mon Sep 17 00:00:00 2001 From: udayaprakash Date: Thu, 14 Nov 2024 15:36:18 +0000 Subject: [PATCH 10/12] add Material Signed-off-by: udayaprakash --- BUILD.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/BUILD.bazel b/BUILD.bazel index 5113f0516..d466c1c42 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -123,6 +123,7 @@ cc_library( "@gz-math//:Graph", "@gz-math//:Helpers", "@gz-math//:Inertial", + "@gz-math//:Material", "@gz-math//:Pose3", "@gz-math//:Plane", "@gz-math//:Quaternion", From 2e29d618439bbbe699273e237489e4badcafc718 Mon Sep 17 00:00:00 2001 From: udayaprakash Date: Thu, 14 Nov 2024 15:48:08 +0000 Subject: [PATCH 11/12] add MassMatrix3 Signed-off-by: udayaprakash --- BUILD.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/BUILD.bazel b/BUILD.bazel index d466c1c42..c5c8d4171 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -124,6 +124,7 @@ cc_library( "@gz-math//:Helpers", "@gz-math//:Inertial", "@gz-math//:Material", + "@gz-math//:MassMatrix3", "@gz-math//:Pose3", "@gz-math//:Plane", "@gz-math//:Quaternion", From 42f9310bf6af3eddfcc7db16ab0aa8249a204f1f Mon Sep 17 00:00:00 2001 From: udayaprakash Date: Thu, 14 Nov 2024 17:06:56 +0000 Subject: [PATCH 12/12] fix BUILD file with buildifier Signed-off-by: udayaprakash --- BUILD.bazel | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index c5c8d4171..443f26968 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -123,10 +123,10 @@ cc_library( "@gz-math//:Graph", "@gz-math//:Helpers", "@gz-math//:Inertial", - "@gz-math//:Material", "@gz-math//:MassMatrix3", - "@gz-math//:Pose3", + "@gz-math//:Material", "@gz-math//:Plane", + "@gz-math//:Pose3", "@gz-math//:Quaternion", "@gz-math//:SemanticVersion", "@gz-math//:Sphere",