diff --git a/Changelog.md b/Changelog.md index cbfc16988..083a0e0ec 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,9 @@ 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) +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) + 1. Set camera intrinsics axis skew (s) default value to 0 * [Pull request 504](https://bitbucket.org/osrf/sdformat/pull-requests/504) @@ -72,6 +75,9 @@ ### 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) + 1. Set camera intrinsics axis skew (s) default value to 0 * [Pull request 504](https://bitbucket.org/osrf/sdformat/pull-requests/504) diff --git a/src/parser_urdf.cc b/src/parser_urdf.cc index 3b4499c3e..713d6b98b 100644 --- a/src/parser_urdf.cc +++ b/src/parser_urdf.cc @@ -2895,7 +2895,7 @@ void CreateInertial(TiXmlElement *_elem, //////////////////////////////////////////////////////////////////////////////// void CreateJoint(TiXmlElement *_root, urdf::LinkConstSharedPtr _link, - ignition::math::Pose3d &_currentTransform) + ignition::math::Pose3d &/*_currentTransform*/) { // compute the joint tag std::string jtype; @@ -2975,15 +2975,12 @@ void CreateJoint(TiXmlElement *_root, } else if (jtype != "fixed") { - ignition::math::Vector3d rotatedJointAxis = - _currentTransform.Rot().RotateVector( - ignition::math::Vector3d(_link->parent_joint->axis.x, - _link->parent_joint->axis.y, - _link->parent_joint->axis.z)); - double rotatedJointAxisArray[3] = - { rotatedJointAxis.X(), rotatedJointAxis.Y(), rotatedJointAxis.Z() }; + double jointAxisXyzArray[3] = + { _link->parent_joint->axis.x, + _link->parent_joint->axis.y, + _link->parent_joint->axis.z}; AddKeyValue(jointAxis, "xyz", - Values2str(3, rotatedJointAxisArray)); + Values2str(3, jointAxisXyzArray)); if (_link->parent_joint->dynamics) { AddKeyValue(jointAxisDynamics, "damping", @@ -3237,9 +3234,9 @@ TiXmlDocument URDF2SDF::InitModelString(const std::string &_urdfStr, try { - // URDF is compatible with version 1.4. The automatic conversion script + // URDF is compatible with version 1.5. The automatic conversion script // will up-convert URDF to SDF. - sdf->SetAttribute("version", "1.4"); + sdf->SetAttribute("version", "1.5"); // add robot to sdf sdf->LinkEndChild(robot); } diff --git a/src/parser_urdf_TEST.cc b/src/parser_urdf_TEST.cc index 07dd88a41..e4a4938c0 100644 --- a/src/parser_urdf_TEST.cc +++ b/src/parser_urdf_TEST.cc @@ -78,11 +78,8 @@ TEST(URDFParser, ParseResults_BasicModel_ParseEqualToModel) // SDF -> SDF std::ostringstream stream; - // Use hard-coded "1.4" for version string - // until parser_urdf.cc exports version "1.5" - // see `sdf->SetAttribute("version", "1.4");` - // in URDF2SDF::InitModelString() - stream << "" + // parser_urdf.cc exports version "1.5" + stream << "" << " " << ""; TiXmlDocument sdf_doc; diff --git a/test/integration/urdf_joint_parameters.cc b/test/integration/urdf_joint_parameters.cc index d0b323027..49d6caaa1 100644 --- a/test/integration/urdf_joint_parameters.cc +++ b/test/integration/urdf_joint_parameters.cc @@ -68,4 +68,22 @@ TEST(SDFParser, JointAxisParameters) EXPECT_DOUBLE_EQ(value, dynamics->Get("friction")); } EXPECT_EQ(bitmask, 0x3u); + + // check joint axis values + for (sdf::ElementPtr joint = model->GetElement("joint"); joint; + joint = joint->GetNextElement("joint")) + { + std::string jointName = joint->Get("name"); + + ignition::math::Vector3d xyz(1, 0, 0); + if (jointName == "joint12" || jointName == "joint23") + { + xyz.Set(0, 1, 0); + } + + ASSERT_TRUE(joint->HasElement("axis")); + sdf::ElementPtr axis = joint->GetElement("axis"); + EXPECT_EQ(xyz, axis->Get("xyz")); + EXPECT_FALSE(axis->Get("use_parent_model_frame")); + } }