diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7b4d8ae..e549c9c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,19 +3,20 @@ on: pull_request jobs: test_sdformat_urdf: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest strategy: matrix: - ros-distro: ["humble", "rolling"] - gazebo-version: - - "fortress" # libsdformat12 - env: - GAZEBO_VERSION: ${{ matrix.gazebo-version }} + include: + - ros-distro: "rolling" + docker-image: "ubuntu:24.04" + container: + image: ${{ matrix.docker-image }} steps: - - uses: ros-tooling/setup-ros@v0.7 + - uses: ros-tooling/setup-ros@master with: required-ros-distributions: ${{ matrix.ros-distro }} + use-ros2-testing: true - name: Build and test all packages - uses: ros-tooling/action-ros-ci@v0.2 + uses: ros-tooling/action-ros-ci@v0.3 with: target-ros2-distro: ${{ matrix.ros-distro }} diff --git a/sdformat_urdf/CMakeLists.txt b/sdformat_urdf/CMakeLists.txt index 91b0da5..f0703f1 100644 --- a/sdformat_urdf/CMakeLists.txt +++ b/sdformat_urdf/CMakeLists.txt @@ -19,48 +19,15 @@ find_package(urdf_parser_plugin REQUIRED) find_package(tinyxml2_vendor REQUIRED) find_package(TinyXML2 REQUIRED) -# Default to Fortress -set(SDF_VER 12) - -# If the user didn't specify a GZ distribution, pick the one matching the ROS distribution according to REP 2000 -if(NOT DEFINED ENV{GZ_VERSION} AND DEFINED ENV{ROS_DISTRO}) - if("$ENV{ROS_DISTRO}" STREQUAL "humble") - set(ENV{GZ_VERSION} "fortress") - endif() -endif() - -# Find libsdformat matching the picked GZ distribution -if("$ENV{GZ_VERSION}" STREQUAL "fortress") - find_package(sdformat12 REQUIRED) - set(SDF_VER ${sdformat12_VERSION_MAJOR}) - message(STATUS "Compiling against Gazebo Fortress (libSDFormat 12)") -elseif("$ENV{GZ_VERSION}" STREQUAL "garden") - find_package(sdformat13 REQUIRED) - set(SDF_VER ${sdformat13_VERSION_MAJOR}) - message(STATUS "Compiling against Gazebo Garden (libSDFormat 13)") -elseif("$ENV{GZ_VERSION}" STREQUAL "harmonic") - find_package(sdformat14 REQUIRED) - set(SDF_VER ${sdformat14_VERSION_MAJOR}) - message(STATUS "Compiling against Gazebo Harmonic (libSDFormat 14)") -# No GZ distribution specified, find any version of libsdformat we can -else() - foreach(major RANGE 13 9) - find_package(sdformat${major} QUIET) - if(sdformat${major}_FOUND) - # Next `find_package` call will be a noop - set(SDF_VER ${major}) - message(STATUS "Compiling against libSDFormat ${major}") - break() - endif() - endforeach() -endif() +find_package(sdformat_vendor REQUIRED) +find_package(sdformat REQUIRED) # Add sdformat_urdf shared library add_library(sdformat_urdf SHARED src/sdformat_urdf.cpp ) target_link_libraries(sdformat_urdf PUBLIC - sdformat${SDF_VER}::sdformat${SDF_VER} + sdformat::core urdfdom_headers::urdfdom_headers ) target_link_libraries(sdformat_urdf PRIVATE @@ -88,7 +55,7 @@ target_link_libraries(sdformat_urdf_plugin PRIVATE ament_export_dependencies(pluginlib) ament_export_dependencies(rcutils) -ament_export_dependencies(sdformat${SDF_VER}) +ament_export_dependencies(sdformat_vendor) ament_export_dependencies(tinyxml2) ament_export_dependencies(urdf_parser_plugin) ament_export_dependencies(urdfdom_headers) diff --git a/sdformat_urdf/colcon.pkg b/sdformat_urdf/colcon.pkg deleted file mode 100644 index f73af60..0000000 --- a/sdformat_urdf/colcon.pkg +++ /dev/null @@ -1,5 +0,0 @@ -{ - # Add dependency on sdformat's CMake project name so colcon can build this - # and sdformat in the same workspace - "dependencies": ["sdformat9"] -} diff --git a/sdformat_urdf/package.xml b/sdformat_urdf/package.xml index e4a6088..45adaad 100644 --- a/sdformat_urdf/package.xml +++ b/sdformat_urdf/package.xml @@ -17,16 +17,7 @@ ament_cmake_ros ament_cmake_ros - - sdformat12 - sdformat12 - sdformat12 - sdformat12 - - - sdformat13 - - sdformat14 + sdformat_vendor urdf diff --git a/sdformat_urdf/src/sdformat_urdf.cpp b/sdformat_urdf/src/sdformat_urdf.cpp index 63bbd42..31c5c72 100644 --- a/sdformat_urdf/src/sdformat_urdf.cpp +++ b/sdformat_urdf/src/sdformat_urdf.cpp @@ -115,7 +115,7 @@ sdformat_urdf::convert_model(const sdf::Model & sdf_model, sdf::Errors & errors) std::string relative_joint_name{""}; for (uint64_t j = 0; j < sdf_model.JointCount(); ++j) { const sdf::Joint * sdf_joint = sdf_model.JointByIndex(j); - if (sdf_joint && sdf_joint->ChildLinkName() == sdf_link->Name()) { + if (sdf_joint && sdf_joint->ChildName() == sdf_link->Name()) { relative_joint_name = sdf_joint->Name(); break; } @@ -212,7 +212,7 @@ sdformat_urdf::convert_model(const sdf::Model & sdf_model, sdf::Errors & errors) // Fix poses and check for tree structure issues while (joint_iter != joints_to_visit.end()) { const sdf::Joint * sdf_joint = *joint_iter; - if (sdf_joint->ParentLinkName() == sdf_parent_link->Name()) { + if (sdf_joint->ParentName() == sdf_parent_link->Name()) { // Visited parent link of this joint - don't look at it again joint_iter = joints_to_visit.erase(joint_iter); @@ -269,7 +269,7 @@ sdformat_urdf::convert_model(const sdf::Model & sdf_model, sdf::Errors & errors) // Explore this child link later link_stack.push_back(sdf_child_link); - } else if (sdf_joint->ChildLinkName() == sdf_parent_link->Name()) { + } else if (sdf_joint->ChildName() == sdf_parent_link->Name()) { // Something is wrong here if (sdf_parent_link == sdf_canonical_link) { // The canonical link can't be a child of a joint @@ -573,8 +573,8 @@ sdformat_urdf::convert_joint(const sdf::Joint & sdf_joint, sdf::Errors & errors) } } - urdf_joint->child_link_name = sdf_joint.ChildLinkName(); - urdf_joint->parent_link_name = sdf_joint.ParentLinkName(); + urdf_joint->child_link_name = sdf_joint.ChildName(); + urdf_joint->parent_link_name = sdf_joint.ParentName(); return urdf_joint; } diff --git a/sdformat_urdf/test/joint_tests.cpp b/sdformat_urdf/test/joint_tests.cpp index 8b97dc3..89bc30c 100644 --- a/sdformat_urdf/test/joint_tests.cpp +++ b/sdformat_urdf/test/joint_tests.cpp @@ -257,8 +257,8 @@ TEST(Joint, joint_revolute_default_limits) EXPECT_EQ("joint_revolute", joint->name); EXPECT_EQ(urdf::Joint::REVOLUTE, joint->type); ASSERT_NE(nullptr, joint->limits); - EXPECT_DOUBLE_EQ(-1e16, joint->limits->lower); // SDFormat default - EXPECT_DOUBLE_EQ(1e16, joint->limits->upper); // SDFormat default + EXPECT_DOUBLE_EQ(-std::numeric_limits::infinity(), joint->limits->lower); + EXPECT_DOUBLE_EQ(std::numeric_limits::infinity(), joint->limits->upper); EXPECT_DOUBLE_EQ(std::numeric_limits::infinity(), joint->limits->effort); EXPECT_DOUBLE_EQ(std::numeric_limits::infinity(), joint->limits->velocity); }