diff --git a/CMakeLists.txt b/CMakeLists.txt index 47c86c337..d23845a1d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,8 +64,8 @@ if (BUILD_SDF) endif() ################################################# - # Find ign command line utility: - find_program(GZ_PROGRAM ign) + # Find gz command line utility: + find_program(GZ_PROGRAM gz) ################################################# # Copied from catkin/cmake/empy.cmake diff --git a/Changelog.md b/Changelog.md index 3b6f9284e..3240e0ccb 100644 --- a/Changelog.md +++ b/Changelog.md @@ -38,7 +38,7 @@ 1. Add `L16` pixel format to Camera pixel format conversion function * [Pull request #487](https://github.com/gazebosim/sdformat/pull/487) -1. Added ``--inertial-stats`` option to ``ign sdf`` +1. Added ``--inertial-stats`` option to ``gz sdf`` * [Pull request #936](https://github.com/gazebosim/sdformat/pull/936) 1. Added `anti_aliasing` element to camera's SDF @@ -925,7 +925,7 @@ ### libsdformat 10.2.0 (2021-01-12) -1. Disable ign test on Windows +1. Disable gz test on Windows + [Pull request 456](https://github.com/osrf/sdformat/pull/456) 1. Add Heightmap class @@ -1026,7 +1026,7 @@ 1. Added `` to `` * [Pull request #985](https://github.com/gazebosim/sdformat/pull/985) -1. Backport ``ign sdf --inertial-stats`` +1. Backport ``gz sdf --inertial-stats`` * [Pull request #958](https://github.com/gazebosim/sdformat/pull/958) 1. Add L16 pixel format to Camera pixel format conversion function @@ -1361,10 +1361,10 @@ ### libsdformat 9.0.0 (2019-12-10) -1. Move recursiveSameTypeUniqueNames from ign.cc to parser.cc and make public. +1. Move recursiveSameTypeUniqueNames from gz.cc to parser.cc and make public. * [BitBucket pull request 606](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/606) -1. Check that joints have valid parent and child names in `ign sdf --check`. +1. Check that joints have valid parent and child names in `gz sdf --check`. * [BitBucket pull request 609](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/609) 1. Model DOM: error when trying to load nested models, which aren't yet supported. @@ -1382,7 +1382,7 @@ 1. Relax name checking, so name collisions generate warnings and names are automatically changed. * [BitBucket pull request 621](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/621) -1. Unversioned library name for ign tool commands. +1. Unversioned library name for gz tool commands. * [BitBucket pull request 612](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/612) 1. Initial version of SDFormat 1.7 specification. @@ -1544,7 +1544,7 @@ 1. Use inline namespaces in Utils.cc * [BitBucket pull request 574](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/574) -1. Convert `ign sdf` file inputs to absolute paths before processing them +1. Convert `gz sdf` file inputs to absolute paths before processing them * [BitBucket pull request 583](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/583) 1. Add `emissive_map` to material sdf @@ -1581,11 +1581,11 @@ 1. Move private headers from include/sdf to src folder. * [BitBucket pull request 553](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/553) -1. Fix ign library path on macOS. +1. Fix gz library path on macOS. * [BitBucket pull request 542](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/542) * [BitBucket pull request 564](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/564) -1. Use `ign sdf --check` to check sibling elements of the same type for non-unique names. +1. Use `gz sdf --check` to check sibling elements of the same type for non-unique names. * [BitBucket pull request 554](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/554) 1. Converter: remove all matching elements specified by `` tag. @@ -1769,7 +1769,7 @@ * [BitBucket pull request 476](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/476) * [BitBucket pull request 463](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/463) -1. Fix ign library path on macOS. +1. Fix gz library path on macOS. * [BitBucket pull request 542](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/542) 1. Preserve XML elements that are not part of the SDF specification. @@ -1826,7 +1826,7 @@ ### libsdformat 6.3.0 (2021-06-21) -1. Move recursiveSameTypeUniqueNames from ign.cc to parser.cc and make public. +1. Move recursiveSameTypeUniqueNames from gz.cc to parser.cc and make public. * [Pull request 580](https://github.com/osrf/sdformat/pull/580) 1. Parse rpyOffset as radians @@ -1841,10 +1841,10 @@ 1. Avoid hardcoding /machine:x64 flag on 64-bit on MSVC with CMake >= 3.5. * [BitBucket pull request 565](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/565) -1. Fix ign library path on macOS. +1. Fix gz library path on macOS. * [BitBucket pull request 552](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/552) -1. Use `ign sdf --check` to check sibling elements of the same type for non-unique names. +1. Use `gz sdf --check` to check sibling elements of the same type for non-unique names. * [BitBucket pull request 554](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/554) 1. Converter: remove all matching elements specified by `` tag. diff --git a/Migration.md b/Migration.md index 4614d68d1..97e2e95e9 100644 --- a/Migration.md +++ b/Migration.md @@ -25,6 +25,20 @@ but with improved human-readability.. - **sdf/Types.hh**: The `Inertia` class has been deprecated. Please use the  `Inertial` class in the `gz-math` library. +- **sdf/Joint.hh**: + + ***Deprecation:*** const std::string &ChildLinkName() const + + ***Replacement:*** const std::string &ChildName() const + + ***Deprecation:*** const std::string &ParentLinkName() const + + ***Replacement:*** const std::string &ParentName() const + + ***Deprecation:*** void SetChildLinkName(const std::string &) + + ***Replacement:*** void SetChildName(const std::string &) + + ***Deprecation:*** void SetParentLinkName(const std::string &) + + ***Replacement:*** void SetParentName(const std::string &) + +- **sdf/parser.hh**: + + ***Deprecation:*** bool checkJointParentChildLinkNames(const sdf::Root \*) + + ***Replacement:*** bool checkJointParentChildNames(const sdf::Root \*) + ## libsdformat 11.x to 12.0 An error is now emitted instead of a warning for a file containing more than @@ -619,7 +633,7 @@ ABI was broken for `sdf::Element`, and restored on version 11.2.1. Uniqueness is forced so that referencing implicit frames is not ambiguous, e.g. you cannot have a link and joint share an implicit frame name. Some existing SDFormat models may not comply with this requirement. - The `ign sdf --check` command can be used to identify models that violate + The `gz sdf --check` command can be used to identify models that violate this requirement. + [BitBucket pull request 600](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/600) diff --git a/README.md b/README.md index 8a04d4b9a..1a23d1aed 100644 --- a/README.md +++ b/README.md @@ -79,8 +79,8 @@ Miniconda suffices. Create if necessary, and activate a Conda environment: ``` -conda create -n ign-ws -conda activate ign-ws +conda create -n gz-ws +conda activate gz-ws ``` Install `sdformat`: @@ -184,8 +184,8 @@ Miniconda suffices. Create if necessary, and activate a Conda environment: ``` -conda create -n ign-ws -conda activate ign-ws +conda create -n gz-ws +conda activate gz-ws ``` Install prerequisites: diff --git a/conf/CMakeLists.txt b/conf/CMakeLists.txt index ce562797d..186ac0a82 100644 --- a/conf/CMakeLists.txt +++ b/conf/CMakeLists.txt @@ -1,5 +1,5 @@ # Used only for internal testing. -set(gz_library_path "${CMAKE_BINARY_DIR}/test/lib/ruby/ignition/cmd${PROJECT_NAME}") +set(gz_library_path "${CMAKE_BINARY_DIR}/test/lib/ruby/gz/cmd${PROJECT_NAME}") # Generate a configuration file for internal testing. # Note that the major version of the library is included in the name. @@ -9,7 +9,7 @@ configure_file( "${CMAKE_BINARY_DIR}/test/conf/${PROJECT_NAME}.yaml" @ONLY) # Used for the installed version. -set(gz_library_path "${CMAKE_INSTALL_PREFIX}/lib/ruby/ignition/cmd${PROJECT_NAME}") +set(gz_library_path "${CMAKE_INSTALL_PREFIX}/lib/ruby/gz/cmd${PROJECT_NAME}") # Generate the configuration file that is installed. # Note that the major version of the library is included in the name. diff --git a/include/sdf/Joint.hh b/include/sdf/Joint.hh index cb3972f6e..73764b7e7 100644 --- a/include/sdf/Joint.hh +++ b/include/sdf/Joint.hh @@ -113,21 +113,41 @@ namespace sdf /// \param[in] _jointType The type of joint. public: void SetType(const JointType _jointType); + /// \brief Get the name of this joint's parent frame. + /// \return The name of the parent frame. + public: const std::string &ParentName() const; + + /// \brief Set the name of the parent frame. + /// \param[in] _name Name of the parent frame. + public: void SetParentName(const std::string &_name); + + /// \brief Get the name of this joint's child frame. + /// \return The name of the child frame. + public: const std::string &ChildName() const; + + /// \brief Set the name of the child frame. + /// \param[in] _name Name of the child frame. + public: void SetChildName(const std::string &_name); + /// \brief Get the name of this joint's parent link. /// \return The name of the parent link. - public: const std::string &ParentLinkName() const; + /// \deprecated Use ParentName. + public: GZ_DEPRECATED(13) const std::string &ParentLinkName() const; /// \brief Set the name of the parent link. /// \param[in] _name Name of the parent link. - public: void SetParentLinkName(const std::string &_name); + /// \deprecated Use SetParentName. + public: GZ_DEPRECATED(13) void SetParentLinkName(const std::string &_name); /// \brief Get the name of this joint's child link. /// \return The name of the child link. - public: const std::string &ChildLinkName() const; + /// \deprecated Use ChildName. + public: GZ_DEPRECATED(13) const std::string &ChildLinkName() const; /// \brief Set the name of the child link. /// \param[in] _name Name of the child link. - public: void SetChildLinkName(const std::string &_name); + /// \deprecated Use SetChildName. + public: GZ_DEPRECATED(13) void SetChildLinkName(const std::string &_name); /// \brief Resolve the name of the child link from the /// FrameAttachedToGraph. diff --git a/include/sdf/Plugin.hh b/include/sdf/Plugin.hh index c2cbaec25..05fbc8a52 100644 --- a/include/sdf/Plugin.hh +++ b/include/sdf/Plugin.hh @@ -80,7 +80,7 @@ namespace sdf /// The name of the plugin should be unique within the scope of its /// parent. /// \return Name of the plugin. - public: std::string Name() const; + public: const std::string &Name() const; /// \brief Set the name of the plugin. /// The name of the plugin should be unique within the scope of its @@ -90,7 +90,7 @@ namespace sdf /// \brief Get the filename of the shared library. /// \return Filename of the shared library associated with the plugin. - public: std::string Filename() const; + public: const std::string &Filename() const; /// \brief Remove the contents of the plugin, this is everything that /// is a child element of the ``. diff --git a/include/sdf/parser.hh b/include/sdf/parser.hh index 557c8e149..03df56462 100644 --- a/include/sdf/parser.hh +++ b/include/sdf/parser.hh @@ -393,6 +393,17 @@ namespace sdf /// \return True if all models have joints with valid parent and child /// link names. SDFORMAT_VISIBLE + bool checkJointParentChildNames(const sdf::Root *_root); + + /// \brief Check that all joints in contained models specify parent + /// and child link names that match the names of sibling links. + /// This checks recursively and should check the files exhaustively + /// rather than terminating early when the first error is found. + /// \param[in] _root SDF Root object to check recursively. + /// \return True if all models have joints with valid parent and child + /// link names. + /// \deprecated Use checkJointParentChildNames. + SDFORMAT_VISIBLE GZ_DEPRECATED(13) bool checkJointParentChildLinkNames(const sdf::Root *_root); /// \brief Check that all joints in contained models specify parent diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 63e188d5a..44d1593de 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -69,6 +69,7 @@ pybind11_add_module(sdformat SHARED src/sdf/pyPlane.cc src/sdf/pyPlugin.cc src/sdf/pyRoot.cc + src/sdf/pyScene.cc src/sdf/pySemanticPose.cc src/sdf/pySensor.cc src/sdf/pySky.cc @@ -126,6 +127,7 @@ if (BUILD_TESTING) pyPlane_TEST pyPlugin_TEST pyRoot_TEST + pyScene_TEST pySemanticPose_TEST pySensor_TEST pySky_TEST diff --git a/python/src/sdf/_ignition_sdformat_pybind11.cc b/python/src/sdf/_ignition_sdformat_pybind11.cc index 5d3f186be..e24abc082 100644 --- a/python/src/sdf/_ignition_sdformat_pybind11.cc +++ b/python/src/sdf/_ignition_sdformat_pybind11.cc @@ -47,6 +47,7 @@ #include "pyPlane.hh" #include "pyPlugin.hh" #include "pyRoot.hh" +#include "pyScene.hh" #include "pySemanticPose.hh" #include "pySensor.hh" #include "pySky.hh" @@ -95,6 +96,7 @@ PYBIND11_MODULE(sdformat, m) { sdf::python::definePlane(m); sdf::python::definePlugin(m); sdf::python::defineRoot(m); + sdf::python::defineScene(m); sdf::python::defineSemanticPose(m); sdf::python::defineSensor(m); sdf::python::defineSky(m); diff --git a/python/src/sdf/pyJoint.cc b/python/src/sdf/pyJoint.cc index f154207dd..a8b3c5e50 100644 --- a/python/src/sdf/pyJoint.cc +++ b/python/src/sdf/pyJoint.cc @@ -45,14 +45,14 @@ void defineJoint(pybind11::object module) "Get the joint type") .def("set_type", &sdf::Joint::SetType, "Set the joint type.") - .def("parent_link_name", &sdf::Joint::ParentLinkName, - "Get the name of this joint's parent link.") - .def("set_parent_link_name", &sdf::Joint::SetParentLinkName, - "Set the name of the parent link.") - .def("child_link_name", &sdf::Joint::ChildLinkName, - "Get the name of this joint's child link.") - .def("set_child_link_name", &sdf::Joint::SetChildLinkName, - "Set the name of the child link") + .def("parent_name", &sdf::Joint::ParentName, + "Get the name of this joint's parent frame.") + .def("set_parent_name", &sdf::Joint::SetParentName, + "Set the name of the parent frame.") + .def("child_name", &sdf::Joint::ChildName, + "Get the name of this joint's child frame.") + .def("set_child_name", &sdf::Joint::SetChildName, + "Set the name of the child frame.") .def("resolve_child_link", [](const sdf::Joint &self) { diff --git a/python/src/sdf/pyScene.cc b/python/src/sdf/pyScene.cc new file mode 100644 index 000000000..2fe80e12e --- /dev/null +++ b/python/src/sdf/pyScene.cc @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2022 Open Source Robotics Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "pyScene.hh" + +#include + +#include "sdf/Scene.hh" + +using namespace pybind11::literals; + +namespace sdf +{ +// Inline bracket to help doxygen filtering. +inline namespace SDF_VERSION_NAMESPACE { +namespace python +{ +///////////////////////////////////////////////// +void defineScene(pybind11::object module) +{ + pybind11::class_(module, "Scene") + .def(pybind11::init<>()) + .def(pybind11::init()) + .def("ambient", &sdf::Scene::Ambient, + "Get the ambient color of the scene") + .def("set_ambient", &sdf::Scene::SetAmbient, + "Set the ambient color of the scene") + .def("background", &sdf::Scene::Background, + "Get the background color of the scene") + .def("set_background", &sdf::Scene::SetBackground, + "Set the background color of the scene") + .def("grid", &sdf::Scene::Grid, + "Get whether grid is enabled") + .def("set_grid", &sdf::Scene::SetGrid, + "Set whether the grid should be enabled") + .def("origin_visual", &sdf::Scene::OriginVisual, + "Get whether origin visual is enabled") + .def("set_origin_visual", &sdf::Scene::SetOriginVisual, + "Set whether the origin visual should be enabled") + .def("shadows", &sdf::Scene::Shadows, + "Get whether shadows are enabled") + .def("set_shadows", &sdf::Scene::SetShadows, + "Set whether shadows should be enabled") + .def("set_sky", &sdf::Scene::SetSky, + "Set sky") + .def("sky", &sdf::Scene::Sky, + pybind11::return_value_policy::reference_internal, + "Get sky") + .def("__copy__", [](const sdf::Scene &self) { + return sdf::Scene(self); + }) + .def("__deepcopy__", [](const sdf::Scene &self, pybind11::dict) { + return sdf::Scene(self); + }, "memo"_a); +} +} // namespace python +} // namespace SDF_VERSION_NAMESPACE +} // namespace sdf diff --git a/python/src/sdf/pyScene.hh b/python/src/sdf/pyScene.hh new file mode 100644 index 000000000..3134a8499 --- /dev/null +++ b/python/src/sdf/pyScene.hh @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2022 Open Source Robotics Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SDFORMAT_PYTHON_SCENE_HH_ +#define SDFORMAT_PYTHON_SCENE_HH_ + +#include + +#include "sdf/Scene.hh" + +#include "sdf/config.hh" + +namespace sdf +{ +// Inline bracket to help doxygen filtering. +inline namespace SDF_VERSION_NAMESPACE { +namespace python +{ +/// Define a pybind11 wrapper for an sdf::Scene +/** + * \param[in] module a pybind11 module to add the definition to + */ +void defineScene(pybind11::object module); +} // namespace python +} // namespace SDF_VERSION_NAMESPACE +} // namespace sdf + +#endif // SDFORMAT_PYTHON_SCENE_HH_ diff --git a/python/test/pyJoint_TEST.py b/python/test/pyJoint_TEST.py index f04c0dee3..0a0fa39c3 100644 --- a/python/test/pyJoint_TEST.py +++ b/python/test/pyJoint_TEST.py @@ -26,8 +26,8 @@ def test_default_construction(self): joint = Joint() self.assertFalse(joint.name()) self.assertEqual(sdf.JointType.INVALID, joint.type()) - self.assertFalse(joint.parent_link_name()) - self.assertFalse(joint.child_link_name()) + self.assertFalse(joint.parent_name()) + self.assertFalse(joint.child_name()) self.assertEqual(Pose3d.ZERO, joint.raw_pose()) self.assertFalse(joint.pose_relative_to()) @@ -55,11 +55,11 @@ def test_default_construction(self): joint.set_name("test_joint") self.assertEqual("test_joint", joint.name()) - joint.set_parent_link_name("parent") - self.assertEqual("parent", joint.parent_link_name()) + joint.set_parent_name("parent") + self.assertEqual("parent", joint.parent_name()) - joint.set_child_link_name("child") - self.assertEqual("child", joint.child_link_name()) + joint.set_child_name("child") + self.assertEqual("child", joint.child_name()) errors, resolveChildLink = joint.resolve_child_link() self.assertEqual(1, len(errors)) diff --git a/python/test/pyScene_TEST.py b/python/test/pyScene_TEST.py new file mode 100644 index 000000000..e70d96c7a --- /dev/null +++ b/python/test/pyScene_TEST.py @@ -0,0 +1,115 @@ +# Copyright (C) 2022 Open Source Robotics Foundation + +# Licensed under the Apache License, version 2.0 (the "License") +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import copy +from ignition.math import Color +from sdformat import Scene, Sky +import unittest + + +class SceneTEST(unittest.TestCase): + + def test_default_construction(self): + scene = Scene() + self.assertEqual(Color(0.4, 0.4, 0.4), scene.ambient()) + self.assertEqual(Color(0.7, 0.7, 0.7), scene.background()) + self.assertTrue(scene.grid()) + self.assertTrue(scene.shadows()) + self.assertTrue(scene.origin_visual()) + self.assertEqual(None, scene.sky()) + + + def test_copy_construction(self): + scene = Scene() + scene.set_ambient(Color.BLUE) + scene.set_background(Color.RED) + scene.set_grid(False) + scene.set_shadows(False) + scene.set_origin_visual(False) + sky = Sky() + scene.set_sky(sky) + + scene2 = Scene(scene) + self.assertEqual(Color.BLUE, scene2.ambient()) + self.assertEqual(Color.RED, scene2.background()) + self.assertFalse(scene2.grid()) + self.assertFalse(scene2.shadows()) + self.assertFalse(scene2.origin_visual()) + self.assertNotEqual(None, scene2.sky()) + + def test_assignment(self): + scene = Scene() + scene.set_ambient(Color.RED) + scene.set_background(Color(0.2, 0.3, 0.4)) + scene.set_grid(False) + scene.set_shadows(False) + scene.set_origin_visual(False) + sky = Sky() + scene.set_sky(sky) + + scene2 = scene + self.assertEqual(Color.RED, scene2.ambient()) + self.assertEqual(Color(0.2, 0.3, 0.4), scene2.background()) + self.assertFalse(scene2.grid()) + self.assertFalse(scene2.shadows()) + self.assertFalse(scene2.origin_visual()) + self.assertNotEqual(None, scene2.sky()) + + def test_deepcopy(self): + scene = Scene() + scene.set_ambient(Color.RED) + scene.set_background(Color(0.2, 0.3, 0.4)) + scene.set_grid(False) + scene.set_shadows(False) + scene.set_origin_visual(False) + sky = Sky() + scene.set_sky(sky) + + scene2 = copy.deepcopy(scene) + self.assertEqual(Color.RED, scene2.ambient()) + self.assertEqual(Color(0.2, 0.3, 0.4), scene2.background()) + self.assertFalse(scene2.grid()) + self.assertFalse(scene2.shadows()) + self.assertFalse(scene2.origin_visual()) + self.assertNotEqual(None, scene2.sky()) + + def test_set(self): + scene = Scene() + scene.set_ambient(Color(0.1, 0.2, 0.3)) + self.assertEqual(Color(0.1, 0.2, 0.3), scene.ambient()) + + scene.set_background(Color(0.2, 0.3, 0.4)) + self.assertEqual(Color(0.2, 0.3, 0.4), scene.background()) + + scene.set_grid(True) + self.assertTrue(scene.grid()) + scene.set_grid(False) + self.assertFalse(scene.grid()) + + scene.set_shadows(True) + self.assertTrue(scene.shadows()) + scene.set_shadows(False) + self.assertFalse(scene.shadows()) + + scene.set_origin_visual(True) + self.assertTrue(scene.origin_visual()) + scene.set_origin_visual(False) + self.assertFalse(scene.origin_visual()) + + sky = Sky() + scene.set_sky(sky) + self.assertNotEqual(None, scene.sky()) + +if __name__ == '__main__': + unittest.main() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f10dd510f..efa0464bf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -30,7 +30,7 @@ endif() if (BUILD_TESTING) # Build this test file only if Ignition Tools is installed. if (NOT GZ_PROGRAM) - list(REMOVE_ITEM gtest_sources ign_TEST.cc) + list(REMOVE_ITEM gtest_sources gz_TEST.cc) endif() # Skip tests that don't work on Windows diff --git a/src/Collision_TEST.cc b/src/Collision_TEST.cc index f7b8a8019..cba078fbf 100644 --- a/src/Collision_TEST.cc +++ b/src/Collision_TEST.cc @@ -184,6 +184,11 @@ TEST(DOMCollision, ToElement) sdf::Contact contact; contact.SetCollideBitmask(123u); surface.SetContact(contact); + sdf::Friction friction; + sdf::ODE ode; + ode.SetMu(1.23); + friction.SetODE(ode); + surface.SetFriction(friction); collision.SetSurface(surface); sdf::ElementPtr elem = collision.ToElement(); @@ -199,4 +204,7 @@ TEST(DOMCollision, ToElement) ASSERT_NE(nullptr, surface2); ASSERT_NE(nullptr, surface2->Contact()); EXPECT_EQ(123u, surface2->Contact()->CollideBitmask()); + ASSERT_NE(nullptr, surface2->Friction()); + ASSERT_NE(nullptr, surface2->Friction()->ODE()); + EXPECT_DOUBLE_EQ(1.23, surface2->Friction()->ODE()->Mu()); } diff --git a/src/FrameSemantics.cc b/src/FrameSemantics.cc index 787e3ea84..0b15cd9ba 100644 --- a/src/FrameSemantics.cc +++ b/src/FrameSemantics.cc @@ -383,7 +383,7 @@ struct JointWrapper : public WrapperBase : WrapperBase{_joint.Name(), "Joint", FrameType::JOINT}, rawPose(_joint.RawPose()), rawRelativeTo(_joint.PoseRelativeTo()), - childName(_joint.ChildLinkName()), + childName(_joint.ChildName()), relativeTo(rawRelativeTo.empty() ? childName : rawRelativeTo) { } diff --git a/src/Joint.cc b/src/Joint.cc index 051967eb9..d4574a308 100644 --- a/src/Joint.cc +++ b/src/Joint.cc @@ -37,11 +37,11 @@ class sdf::Joint::Implementation /// \brief Name of the joint. public: std::string name = ""; - /// \brief Name of the parent link. - public: std::string parentLinkName = ""; + /// \brief Name of the parent frame. + public: std::string parentName = ""; - /// \brief Name of the child link. - public: std::string childLinkName = ""; + /// \brief Name of the child frame. + public: std::string childName = ""; /// \brief the joint type. public: JointType type = JointType::INVALID; @@ -117,11 +117,11 @@ Errors Joint::Load(ElementPtr _sdf) _sdf->Get("parent", ""); if (parentPair.second) { - this->dataPtr->parentLinkName = parentPair.first; - if (!isValidFrameReference(this->dataPtr->parentLinkName)) + this->dataPtr->parentName = parentPair.first; + if (!isValidFrameReference(this->dataPtr->parentName)) { errors.push_back({ErrorCode::RESERVED_NAME, - "The supplied joint parent name [" + this->dataPtr->parentLinkName + + "The supplied joint parent name [" + this->dataPtr->parentName + "] is not valid."}); } } @@ -135,11 +135,11 @@ Errors Joint::Load(ElementPtr _sdf) std::pair childPair = _sdf->Get("child", ""); if (childPair.second) { - this->dataPtr->childLinkName = childPair.first; - if (!isValidFrameReference(this->dataPtr->childLinkName)) + this->dataPtr->childName = childPair.first; + if (!isValidFrameReference(this->dataPtr->childName)) { errors.push_back({ErrorCode::RESERVED_NAME, - "The supplied joint child name [" + this->dataPtr->childLinkName + + "The supplied joint child name [" + this->dataPtr->childName + "] is not valid."}); } } @@ -149,19 +149,19 @@ Errors Joint::Load(ElementPtr _sdf) "The child element is missing."}); } - if (this->dataPtr->childLinkName == "world") + if (this->dataPtr->childName == "world") { errors.push_back({ErrorCode::JOINT_CHILD_LINK_INVALID, "Joint with name[" + this->dataPtr->name + "] specified invalid child link [world]."}); } - if (this->dataPtr->childLinkName == this->dataPtr->parentLinkName) + if (this->dataPtr->childName == this->dataPtr->parentName) { errors.push_back({ErrorCode::JOINT_PARENT_SAME_AS_CHILD, "Joint with name[" + this->dataPtr->name + "] must specify different frame names for " - "parent and child, while [" + this->dataPtr->childLinkName + + "parent and child, while [" + this->dataPtr->childName + "] was specified for both."}); } @@ -250,28 +250,52 @@ void Joint::SetType(const JointType _jointType) this->dataPtr->type = _jointType; } +///////////////////////////////////////////////// +const std::string &Joint::ParentName() const +{ + return this->dataPtr->parentName; +} + +///////////////////////////////////////////////// +void Joint::SetParentName(const std::string &_name) +{ + this->dataPtr->parentName = _name; +} + +///////////////////////////////////////////////// +const std::string &Joint::ChildName() const +{ + return this->dataPtr->childName; +} + +///////////////////////////////////////////////// +void Joint::SetChildName(const std::string &_name) +{ + this->dataPtr->childName = _name; +} + ///////////////////////////////////////////////// const std::string &Joint::ParentLinkName() const { - return this->dataPtr->parentLinkName; + return this->ParentName(); } ///////////////////////////////////////////////// void Joint::SetParentLinkName(const std::string &_name) { - this->dataPtr->parentLinkName = _name; + this->SetParentName(_name); } ///////////////////////////////////////////////// const std::string &Joint::ChildLinkName() const { - return this->dataPtr->childLinkName; + return this->ChildName(); } ///////////////////////////////////////////////// void Joint::SetChildLinkName(const std::string &_name) { - this->dataPtr->childLinkName = _name; + this->SetChildName(_name); } ///////////////////////////////////////////////// @@ -352,7 +376,7 @@ Errors Joint::ResolveChildLink(std::string &_link) const } std::string link; - errors = resolveFrameAttachedToBody(link, graph, this->ChildLinkName()); + errors = resolveFrameAttachedToBody(link, graph, this->ChildName()); if (errors.empty()) { _link = link; @@ -367,7 +391,7 @@ Errors Joint::ResolveParentLink(std::string &_link) const // special case for world, return without resolving since it's not in a // model's FrameAttachedToGraph - if ("world" == this->ParentLinkName()) + if ("world" == this->ParentName()) { _link = "world"; return errors; @@ -382,7 +406,7 @@ Errors Joint::ResolveParentLink(std::string &_link) const } std::string link; - errors = resolveFrameAttachedToBody(link, graph, this->ParentLinkName()); + errors = resolveFrameAttachedToBody(link, graph, this->ParentName()); if (errors.empty()) { _link = link; @@ -397,7 +421,7 @@ sdf::SemanticPose Joint::SemanticPose() const this->dataPtr->name, this->dataPtr->pose, this->dataPtr->poseRelativeTo, - this->ChildLinkName(), + this->ChildName(), this->dataPtr->poseRelativeToGraph); } @@ -516,8 +540,8 @@ sdf::ElementPtr Joint::ToElement() const } elem->GetAttribute("type")->Set(jointType); - elem->GetElement("parent")->Set(this->ParentLinkName()); - elem->GetElement("child")->Set(this->ChildLinkName()); + elem->GetElement("parent")->Set(this->ParentName()); + elem->GetElement("child")->Set(this->ChildName()); for (unsigned int i = 0u; i < 2u; ++i) { const JointAxis *axis = this->Axis(i); diff --git a/src/Joint_TEST.cc b/src/Joint_TEST.cc index 49ed28a3b..50d4682e6 100644 --- a/src/Joint_TEST.cc +++ b/src/Joint_TEST.cc @@ -27,8 +27,14 @@ TEST(DOMJoint, Construction) sdf::Joint joint; EXPECT_TRUE(joint.Name().empty()); EXPECT_EQ(sdf::JointType::INVALID, joint.Type()); + + EXPECT_TRUE(joint.ParentName().empty()); + EXPECT_TRUE(joint.ChildName().empty()); + GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION EXPECT_TRUE(joint.ParentLinkName().empty()); EXPECT_TRUE(joint.ChildLinkName().empty()); + GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION + EXPECT_EQ(gz::math::Pose3d::Zero, joint.RawPose()); EXPECT_TRUE(joint.PoseRelativeTo().empty()); EXPECT_EQ(nullptr, joint.Element()); @@ -59,11 +65,23 @@ TEST(DOMJoint, Construction) joint.SetName("test_joint"); EXPECT_EQ("test_joint", joint.Name()); + GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION joint.SetParentLinkName("parent"); EXPECT_EQ("parent", joint.ParentLinkName()); + GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION + EXPECT_EQ("parent", joint.ParentName()); + GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION joint.SetChildLinkName("child"); EXPECT_EQ("child", joint.ChildLinkName()); + GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION + EXPECT_EQ("child", joint.ChildName()); + + joint.SetParentName("parent2"); + EXPECT_EQ("parent2", joint.ParentName()); + + joint.SetChildName("child2"); + EXPECT_EQ("child2", joint.ChildName()); std::string body; EXPECT_FALSE(joint.ResolveChildLink(body).empty()); @@ -260,8 +278,8 @@ TEST(DOMJoint, ToElement) joint.SetRawPose({-1, -2, -3, 0, GZ_PI, 0}); joint.SetPoseRelativeTo("link"); joint.SetName("test_joint"); - joint.SetParentLinkName("parent"); - joint.SetChildLinkName("child"); + joint.SetParentName("parent"); + joint.SetChildName("child"); joint.SetType(sdf::JointType::BALL); sdf::JointAxis axis; EXPECT_TRUE(axis.SetXyz(gz::math::Vector3d(1, 0, 0)).empty()); @@ -295,8 +313,8 @@ TEST(DOMJoint, ToElement) joint2.RawPose()); EXPECT_EQ("link", joint2.PoseRelativeTo()); EXPECT_EQ("test_joint", joint2.Name()); - EXPECT_EQ("parent", joint2.ParentLinkName()); - EXPECT_EQ("child", joint2.ChildLinkName()); + EXPECT_EQ("parent", joint2.ParentName()); + EXPECT_EQ("child", joint2.ChildName()); EXPECT_EQ(sdf::JointType::BALL, joint2.Type()); ASSERT_TRUE(nullptr != joint2.Axis(0)); ASSERT_TRUE(nullptr != joint2.Axis(1)); @@ -308,12 +326,12 @@ TEST(DOMJoint, ToElement) EXPECT_NE(nullptr, joint.SensorByIndex(i)); // make changes to DOM and verify ToElement produces updated values - joint2.SetParentLinkName("new_parent"); + joint2.SetParentName("new_parent"); sdf::ElementPtr joint2Elem = joint2.ToElement(); EXPECT_NE(nullptr, joint2Elem); sdf::Joint joint3; joint3.Load(joint2Elem); - EXPECT_EQ("new_parent", joint3.ParentLinkName()); + EXPECT_EQ("new_parent", joint3.ParentName()); } ///////////////////////////////////////////////// diff --git a/src/Param.cc b/src/Param.cc index d1f1b5643..cee4f1a2f 100644 --- a/src/Param.cc +++ b/src/Param.cc @@ -1353,7 +1353,7 @@ bool Param::Reparse(sdf::Errors &_errors) strToReparse = this->dataPtr->strValue.value(); } // A default PrintConfig can be used here, as Reparse() is not called in the - // code path from the 'ign sdf -p' command. + // code path from the 'gz sdf -p' command. else if (!this->dataPtr->StringFromValueImpl(PrintConfig(), this->dataPtr->typeName, this->dataPtr->defaultValue, diff --git a/src/Plugin.cc b/src/Plugin.cc index 36ac812fe..9bbafc4f0 100644 --- a/src/Plugin.cc +++ b/src/Plugin.cc @@ -125,7 +125,7 @@ Errors Plugin::Load(ElementPtr _sdf) } ///////////////////////////////////////////////// -std::string Plugin::Name() const +const std::string &Plugin::Name() const { return this->dataPtr->name; } @@ -137,7 +137,7 @@ void Plugin::SetName(const std::string &_name) } ///////////////////////////////////////////////// -std::string Plugin::Filename() const +const std::string &Plugin::Filename() const { return this->dataPtr->filename; } diff --git a/src/Scene_TEST.cc b/src/Scene_TEST.cc index 9002b6e03..de74359d7 100644 --- a/src/Scene_TEST.cc +++ b/src/Scene_TEST.cc @@ -148,8 +148,8 @@ TEST(DOMScene, Set) scene.SetAmbient(gz::math::Color(0.1f, 0.2f, 0.3f)); EXPECT_EQ(gz::math::Color(0.1f, 0.2f, 0.3f), scene.Ambient()); - scene.SetBackground(gz::math::Color(0.1f, 0.2f, 0.3f)); - EXPECT_EQ(gz::math::Color(0.1f, 0.2f, 0.3f), scene.Ambient()); + scene.SetBackground(gz::math::Color(0.2f, 0.3f, 0.4f)); + EXPECT_EQ(gz::math::Color(0.2f, 0.3f, 0.4f), scene.Background()); scene.SetGrid(true); EXPECT_TRUE(scene.Grid()); diff --git a/src/Surface.cc b/src/Surface.cc index 331b8ccab..078b96f11 100644 --- a/src/Surface.cc +++ b/src/Surface.cc @@ -399,5 +399,9 @@ sdf::ElementPtr Surface::ToElement() const contactElem->GetElement("collide_bitmask")->Set( this->dataPtr->contact.CollideBitmask()); + sdf::ElementPtr frictionElem = elem->GetElement("friction"); + frictionElem->GetElement("ode")->GetElement("mu")->Set( + this->dataPtr->friction.ODE()->Mu()); + return elem; } diff --git a/src/cmd/CMakeLists.txt b/src/cmd/CMakeLists.txt index e831d413a..d45aadb1e 100644 --- a/src/cmd/CMakeLists.txt +++ b/src/cmd/CMakeLists.txt @@ -2,7 +2,7 @@ # Generate the ruby script for internal testing. # Note that the major version of the library is included in the name. # Ex: cmdsdformat0.rb -set(cmd_script_generated_test "${CMAKE_BINARY_DIR}/test/lib/ruby/ignition/cmd${PROJECT_NAME}.rb") +set(cmd_script_generated_test "${CMAKE_BINARY_DIR}/test/lib/ruby/gz/cmd${PROJECT_NAME}.rb") set(cmd_script_configured_test "${cmd_script_generated_test}.configured") # Set the library_location variable to the full path of the library file within @@ -41,4 +41,4 @@ file(GENERATE INPUT "${cmd_script_configured}") # Install the ruby command line library in an unversioned location. -install(FILES ${cmd_script_generated} DESTINATION lib/ruby/ignition) +install(FILES ${cmd_script_generated} DESTINATION lib/ruby/gz) diff --git a/src/cmd/cmdsdformat.rb.in b/src/cmd/cmdsdformat.rb.in index a97a735dc..7c93d7680 100644 --- a/src/cmd/cmdsdformat.rb.in +++ b/src/cmd/cmdsdformat.rb.in @@ -36,7 +36,7 @@ COMMON_OPTIONS = ' --versions Show the available versions.' COMMANDS = { 'sdf' => "Utilities for SDF files.\n\n"\ - " ign sdf [options]\n\n"\ + " gz sdf [options]\n\n"\ "Options:\n\n"\ " -k [ --check ] arg Check if an SDFormat file is valid.\n" + " -d [ --describe ] [SPEC VERSION] Print the aggregated SDFormat spec description. Default version (@SDF_PROTOCOL_VERSION@).\n" + @@ -251,7 +251,7 @@ class Cmd end else puts 'Command error: I do not have an implementation for '\ - "command [ign #{options['command']}]." + "command [gz #{options['command']}]." end rescue puts "Library error: Problem running [#{options['command']}]() "\ diff --git a/src/ign.cc b/src/gz.cc similarity index 99% rename from src/ign.cc rename to src/gz.cc index df036dcc1..c00bba916 100644 --- a/src/ign.cc +++ b/src/gz.cc @@ -35,7 +35,7 @@ #include "FrameSemantics.hh" #include "ScopedGraph.hh" -#include "ign.hh" +#include "gz.hh" ////////////////////////////////////////////////// extern "C" SDFORMAT_VISIBLE int cmdCheck(const char *_path) @@ -58,7 +58,7 @@ extern "C" SDFORMAT_VISIBLE int cmdCheck(const char *_path) result = -1; } - if (!sdf::checkJointParentChildLinkNames(&root)) + if (!sdf::checkJointParentChildNames(&root)) { result = -1; } diff --git a/src/ign.hh b/src/gz.hh similarity index 94% rename from src/ign.hh rename to src/gz.hh index d0c8aded8..cc6077858 100644 --- a/src/ign.hh +++ b/src/gz.hh @@ -27,7 +27,7 @@ inline namespace SDF_VERSION_NAMESPACE { // -/// \brief External hook to execute 'ign sdf -k' from the command line. +/// \brief External hook to execute 'gz sdf -k' from the command line. /// \param[in] _path Path to the file to validate. /// \return Zero on success, negative one otherwise. extern "C" SDFORMAT_VISIBLE int cmdCheck(const char *_path); diff --git a/src/ign_TEST.cc b/src/gz_TEST.cc similarity index 100% rename from src/ign_TEST.cc rename to src/gz_TEST.cc diff --git a/src/parser.cc b/src/parser.cc index 33ce82198..a05139fd0 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -2482,6 +2482,12 @@ bool checkPoseRelativeToGraph(const sdf::Root *_root) ////////////////////////////////////////////////// bool checkJointParentChildLinkNames(const sdf::Root *_root) +{ + return checkJointParentChildNames(_root); +} + +////////////////////////////////////////////////// +bool checkJointParentChildNames(const sdf::Root *_root) { Errors errors; checkJointParentChildNames(_root, errors); @@ -2505,7 +2511,7 @@ void checkJointParentChildNames(const sdf::Root *_root, Errors &_errors) { auto joint = _model->JointByIndex(j); - const std::string &parentName = joint->ParentLinkName(); + const std::string &parentName = joint->ParentName(); const std::string parentLocalName = sdf::SplitName(parentName).second; if (parentName != "world" && parentLocalName != "__model__" && @@ -2517,7 +2523,7 @@ void checkJointParentChildNames(const sdf::Root *_root, Errors &_errors) "] not found in model with name[" + _model->Name() + "]."}); } - const std::string &childName = joint->ChildLinkName(); + const std::string &childName = joint->ChildName(); const std::string childLocalName = sdf::SplitName(childName).second; if (childName == "world") { diff --git a/src/parser_TEST.cc b/src/parser_TEST.cc index a543b038e..214ee14ba 100644 --- a/src/parser_TEST.cc +++ b/src/parser_TEST.cc @@ -149,8 +149,8 @@ TEST(Parser, readFileConversions) ///////////////////////////////////////////////// TEST(Parser, NameUniqueness) { - // These tests are copies of the ones in ign_TEST.cc but use direct calls to - // name uniqueness validator functions instead of going through ign. + // These tests are copies of the ones in gz_TEST.cc but use direct calls to + // name uniqueness validator functions instead of going through gz. // Check an SDF file with sibling elements of the same type (world) // that have duplicate names. diff --git a/test/integration/includes.cc b/test/integration/includes.cc index 8f8880c5c..9a3a75b0f 100644 --- a/test/integration/includes.cc +++ b/test/integration/includes.cc @@ -526,14 +526,14 @@ TEST(IncludesTest, MergeInclude) // left_wheel_joint's axis is expressed in __model__. auto joint = model->JointByName("test_model_parent"); ASSERT_NE(nullptr, joint); - EXPECT_EQ(prefixedFrameName, joint->ParentLinkName()); + EXPECT_EQ(prefixedFrameName, joint->ParentName()); } // Check joint child set as __model__ { // left_wheel_joint's axis is expressed in __model__. auto joint = model->JointByName("test_model_child"); ASSERT_NE(nullptr, joint); - EXPECT_EQ(prefixedFrameName, joint->ChildLinkName()); + EXPECT_EQ(prefixedFrameName, joint->ChildName()); } // Verify that plugins get merged diff --git a/test/integration/joint_dom.cc b/test/integration/joint_dom.cc index 3b242abc5..d32ab65d1 100644 --- a/test/integration/joint_dom.cc +++ b/test/integration/joint_dom.cc @@ -89,10 +89,10 @@ TEST(DOMJoint, DoublePendulum) ASSERT_NE(nullptr, lowerJoint); // Check the parent and child link values - EXPECT_EQ("base", upperJoint->ParentLinkName()); - EXPECT_EQ("upper_link", upperJoint->ChildLinkName()); - EXPECT_EQ("upper_link", lowerJoint->ParentLinkName()); - EXPECT_EQ("lower_link", lowerJoint->ChildLinkName()); + EXPECT_EQ("base", upperJoint->ParentName()); + EXPECT_EQ("upper_link", upperJoint->ChildName()); + EXPECT_EQ("upper_link", lowerJoint->ParentName()); + EXPECT_EQ("lower_link", lowerJoint->ChildName()); // Check that the pose relative_to values are empty EXPECT_TRUE(upperJoint->PoseRelativeTo().empty()); @@ -190,8 +190,8 @@ TEST(DOMJoint, LoadJointParentWorld) EXPECT_NE(nullptr, model->JointByIndex(0)); EXPECT_EQ(nullptr, model->JointByIndex(1)); ASSERT_TRUE(model->JointNameExists("joint")); - EXPECT_EQ("link", model->JointByName("joint")->ChildLinkName()); - EXPECT_EQ("world", model->JointByName("joint")->ParentLinkName()); + EXPECT_EQ("link", model->JointByName("joint")->ChildName()); + EXPECT_EQ("world", model->JointByName("joint")->ParentName()); std::string resolvedLinkName; EXPECT_TRUE( model->JointByName("joint")->ResolveChildLink(resolvedLinkName).empty()); @@ -250,8 +250,8 @@ TEST(DOMJoint, LoadJointParentModelFrame) EXPECT_EQ(1u, model->JointCount()); auto *joint = model->JointByName("joint"); ASSERT_NE(nullptr, joint); - EXPECT_EQ("child_link", model->JointByName("joint")->ChildLinkName()); - EXPECT_EQ("__model__", model->JointByName("joint")->ParentLinkName()); + EXPECT_EQ("child_link", model->JointByName("joint")->ChildName()); + EXPECT_EQ("__model__", model->JointByName("joint")->ParentName()); std::string resolvedLinkName; EXPECT_TRUE(joint->ResolveParentLink(resolvedLinkName).empty()); EXPECT_EQ("base_link", resolvedLinkName); @@ -282,8 +282,8 @@ TEST(DOMJoint, LoadJointChildModelFrame) EXPECT_EQ(1u, model->JointCount()); auto *joint = model->JointByName("joint"); ASSERT_NE(nullptr, joint); - EXPECT_EQ("__model__", model->JointByName("joint")->ChildLinkName()); - EXPECT_EQ("parent_link", model->JointByName("joint")->ParentLinkName()); + EXPECT_EQ("__model__", model->JointByName("joint")->ChildName()); + EXPECT_EQ("parent_link", model->JointByName("joint")->ParentName()); std::string resolvedLinkName; EXPECT_TRUE(joint->ResolveChildLink(resolvedLinkName).empty()); EXPECT_EQ("base_link", resolvedLinkName); @@ -333,8 +333,8 @@ TEST(DOMJoint, LoadJointParentFrame) EXPECT_NE(nullptr, model->JointByIndex(0)); EXPECT_EQ(nullptr, model->JointByIndex(1)); ASSERT_TRUE(model->JointNameExists("joint")); - EXPECT_EQ("child_link", model->JointByName("joint")->ChildLinkName()); - EXPECT_EQ("parent_frame", model->JointByName("joint")->ParentLinkName()); + EXPECT_EQ("child_link", model->JointByName("joint")->ChildName()); + EXPECT_EQ("parent_frame", model->JointByName("joint")->ParentName()); std::string resolvedLinkName; EXPECT_TRUE( @@ -425,8 +425,8 @@ TEST(DOMJoint, LoadJointChildFrame) EXPECT_NE(nullptr, model->JointByIndex(0)); EXPECT_EQ(nullptr, model->JointByIndex(1)); ASSERT_TRUE(model->JointNameExists("joint")); - EXPECT_EQ("child_frame", model->JointByName("joint")->ChildLinkName()); - EXPECT_EQ("parent_link", model->JointByName("joint")->ParentLinkName()); + EXPECT_EQ("child_frame", model->JointByName("joint")->ChildName()); + EXPECT_EQ("parent_link", model->JointByName("joint")->ParentName()); std::string resolvedLinkName; EXPECT_TRUE( @@ -844,8 +844,8 @@ TEST(DOMJoint, LoadJointNestedParentChild) { const sdf::Joint *j1 = model->JointByName("J1"); ASSERT_NE(nullptr, j1); - EXPECT_EQ("M1::L1", j1->ParentLinkName()); - EXPECT_EQ("L1", j1->ChildLinkName()); + EXPECT_EQ("M1::L1", j1->ParentName()); + EXPECT_EQ("L1", j1->ChildName()); std::string resolvedLinkName; EXPECT_TRUE(j1->ResolveParentLink(resolvedLinkName).empty()); @@ -860,8 +860,8 @@ TEST(DOMJoint, LoadJointNestedParentChild) { const sdf::Joint *j2 = model->JointByName("J2"); ASSERT_NE(nullptr, j2); - EXPECT_EQ("F1", j2->ParentLinkName()); - EXPECT_EQ("L1", j2->ChildLinkName()); + EXPECT_EQ("F1", j2->ParentName()); + EXPECT_EQ("L1", j2->ChildName()); std::string resolvedLinkName; EXPECT_TRUE(j2->ResolveParentLink(resolvedLinkName).empty()); @@ -876,8 +876,8 @@ TEST(DOMJoint, LoadJointNestedParentChild) { const sdf::Joint *j3 = model->JointByName("J3"); ASSERT_NE(nullptr, j3); - EXPECT_EQ("L1", j3->ParentLinkName()); - EXPECT_EQ("M1::L2", j3->ChildLinkName()); + EXPECT_EQ("L1", j3->ParentName()); + EXPECT_EQ("M1::L2", j3->ChildName()); std::string resolvedLinkName; EXPECT_TRUE(j3->ResolveParentLink(resolvedLinkName).empty()); @@ -892,8 +892,8 @@ TEST(DOMJoint, LoadJointNestedParentChild) { const sdf::Joint *j4 = model->JointByName("J4"); ASSERT_NE(nullptr, j4); - EXPECT_EQ("L1", j4->ParentLinkName()); - EXPECT_EQ("M1::F1", j4->ChildLinkName()); + EXPECT_EQ("L1", j4->ParentName()); + EXPECT_EQ("M1::F1", j4->ChildName()); std::string resolvedLinkName; EXPECT_TRUE(j4->ResolveParentLink(resolvedLinkName).empty()); @@ -908,8 +908,8 @@ TEST(DOMJoint, LoadJointNestedParentChild) { const sdf::Joint *j5 = model->JointByName("J5"); ASSERT_NE(nullptr, j5); - EXPECT_EQ("L1", j5->ParentLinkName()); - EXPECT_EQ("M1::M2", j5->ChildLinkName()); + EXPECT_EQ("L1", j5->ParentName()); + EXPECT_EQ("M1::M2", j5->ChildName()); std::string resolvedLinkName; EXPECT_TRUE(j5->ResolveParentLink(resolvedLinkName).empty()); @@ -924,8 +924,8 @@ TEST(DOMJoint, LoadJointNestedParentChild) { const sdf::Joint *j6 = model->JointByName("J6"); ASSERT_NE(nullptr, j6); - EXPECT_EQ("M1::__model__", j6->ParentLinkName()); - EXPECT_EQ("L1", j6->ChildLinkName()); + EXPECT_EQ("M1::__model__", j6->ParentName()); + EXPECT_EQ("L1", j6->ChildName()); std::string resolvedLinkName; EXPECT_TRUE(j6->ResolveParentLink(resolvedLinkName).empty()); @@ -940,8 +940,8 @@ TEST(DOMJoint, LoadJointNestedParentChild) { const sdf::Joint *j7 = model->JointByName("J7"); ASSERT_NE(nullptr, j7); - EXPECT_EQ("L1", j7->ParentLinkName()); - EXPECT_EQ("M1::__model__", j7->ChildLinkName()); + EXPECT_EQ("L1", j7->ParentName()); + EXPECT_EQ("M1::__model__", j7->ChildName()); std::string resolvedLinkName; EXPECT_TRUE(j7->ResolveParentLink(resolvedLinkName).empty()); diff --git a/test/integration/sdf_dom_conversion.cc b/test/integration/sdf_dom_conversion.cc index 5481ce6f6..ea79ea3fa 100644 --- a/test/integration/sdf_dom_conversion.cc +++ b/test/integration/sdf_dom_conversion.cc @@ -568,8 +568,8 @@ TEST(SDFDomConversion, Joints) EXPECT_EQ("joint", joint->Name()); EXPECT_EQ(1u, joint->SensorCount()); - EXPECT_EQ("link1", joint->ParentLinkName()); - EXPECT_EQ("link2", joint->ChildLinkName()); + EXPECT_EQ("link1", joint->ParentName()); + EXPECT_EQ("link2", joint->ChildName()); EXPECT_EQ(sdf::JointType::FIXED, joint->Type()); // Get the force_torque sensor diff --git a/test/sdf/inertial_stats.sdf b/test/sdf/inertial_stats.sdf index d8d6df8a7..e2504807f 100644 --- a/test/sdf/inertial_stats.sdf +++ b/test/sdf/inertial_stats.sdf @@ -2,7 +2,7 @@