diff --git a/gazebo_state_plugins/src/GazeboObjectInfo.cpp b/gazebo_state_plugins/src/GazeboObjectInfo.cpp index 30f38db71ffb96b2e7f4c8f1763b2b794e06d7f4..0c5ba7f1f98cd061f08de637579f16bf61147b98 100644 --- a/gazebo_state_plugins/src/GazeboObjectInfo.cpp +++ b/gazebo_state_plugins/src/GazeboObjectInfo.cpp @@ -157,7 +157,7 @@ shape_msgs::SolidPrimitive * GazeboObjectInfo::getSolidPrimitive(physics::Collis else { ROS_WARN("shape type %i of collision %s not supported. Using bounding box instead. ", c->GetShapeType(),c->GetName().c_str()); - gz_math::Box box = GetBoundingBox(*c); + GzBox box = GetBoundingBox(*c); GzVector3 bb = GetBoundingBoxDimensions(box); if ((GetX(bb) < 1e-05) || (GetY(bb) < 1e-05) || (GetZ(bb) < 1e-05)){ ROS_WARN_ONCE("Skipping coll %s because its bounding box is flat",c->GetName().c_str()); diff --git a/gazebo_version_helpers/include/gazebo_version_helpers/GazeboVersionHelpers.h b/gazebo_version_helpers/include/gazebo_version_helpers/GazeboVersionHelpers.h index 5a8f359ed67c3cb342f4a9bd167a99560a42d286..6deafce2c79365cb94cc192c56b93021ddfb7e43 100644 --- a/gazebo_version_helpers/include/gazebo_version_helpers/GazeboVersionHelpers.h +++ b/gazebo_version_helpers/include/gazebo_version_helpers/GazeboVersionHelpers.h @@ -7,13 +7,22 @@ namespace gazebo { // typedefs -#if GAZEBO_MAJOR_VERSION >= 8 +#if GAZEBO_MAJOR_VERSION >= 11 +namespace gz_math = ignition::math; +typedef gz_math::Pose3d GzPose3; +typedef gz_math::Vector3d GzVector3; +typedef gz_math::Quaterniond GzQuaternion; +typedef gz_math::Matrix4d GzMatrix4; +typedef gz_math::Matrix3d GzMatrix3; +typedef gz_math::AxisAlignedBox GzBox; +#elif GAZEBO_MAJOR_VERSION >= 8 namespace gz_math = ignition::math; typedef gz_math::Pose3d GzPose3; typedef gz_math::Vector3d GzVector3; typedef gz_math::Quaterniond GzQuaternion; typedef gz_math::Matrix4d GzMatrix4; typedef gz_math::Matrix3d GzMatrix3; +typedef gz_math::Box GzBox; #else namespace gz_math = gazebo::math; typedef gz_math::Pose GzPose3; @@ -21,8 +30,10 @@ typedef gz_math::Vector3 GzVector3; typedef gz_math::Quaternion GzQuaternion; typedef gz_math::Matrix4 GzMatrix4; typedef gz_math::Matrix3 GzMatrix3; +typedef gz_math::Box GzBox; #endif + // Helper functions // ////////////////////////// @@ -116,7 +127,7 @@ std::string GetName(const T& t) /////////////////////////////////////////////////////////////////////////////// template<typename T> -gz_math::Box GetBoundingBox(const T &t) +GzBox GetBoundingBox(const T &t) { #if GAZEBO_MAJOR_VERSION >= 8 return t.BoundingBox(); @@ -126,7 +137,7 @@ gz_math::Box GetBoundingBox(const T &t) } /////////////////////////////////////////////////////////////////////////////// -GzVector3 GetBoundingBoxDimensions(const gz_math::Box &box); +GzVector3 GetBoundingBoxDimensions(const GzBox &box); /////////////////////////////////////////////////////////////////////////////// template<typename T> diff --git a/gazebo_version_helpers/src/GazeboVersionHelpers.cpp b/gazebo_version_helpers/src/GazeboVersionHelpers.cpp index e0ef8984d3a93caae11d6c632df9c346e80e15a5..f724c3493670569f1dc747ef650ad4b24ea916dc 100644 --- a/gazebo_version_helpers/src/GazeboVersionHelpers.cpp +++ b/gazebo_version_helpers/src/GazeboVersionHelpers.cpp @@ -314,9 +314,12 @@ gazebo::physics::Model_V gazebo::GetModels( } /////////////////////////////////////////////////////////////////////////////// -gazebo::GzVector3 gazebo::GetBoundingBoxDimensions(const gz_math::Box &box) +gazebo::GzVector3 gazebo::GetBoundingBoxDimensions(const GzBox &box) { -#if GAZEBO_MAJOR_VERSION >= 8 +#if GAZEBO_MAJOR_VERSION >= 11 + auto const size = box.Size(); + GzVector3 bb(size.X(), size.Y(), size.Z()); +#elif GAZEBO_MAJOR_VERSION >= 8 GzVector3 bb(box.XLength(), box.YLength(), box.ZLength()); #else GzVector3 bb(box.GetXLength(), box.GetYLength(), box.GetZLength());