Skip to content

Commit

Permalink
Merge branch 'main' into namespace_migration
Browse files Browse the repository at this point in the history
  • Loading branch information
chapulina authored May 28, 2022
2 parents 422058f + 8a9c631 commit 0e10296
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/sdf/Sensor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,10 @@ namespace sdf
/// and SetPoseRelativeToGraph, but Link::SetPoseRelativeToGraph is
/// a private function, so we need to befriend the entire class.
friend class Link;
/// \brief Allow Joint::SetPoseRelativeToGraph to call SetXmlParentName
/// and SetPoseRelativeToGraph, but Joint::SetPoseRelativeToGraph is
/// a private function, so we need to befriend the entire class.
friend class Joint;

/// \brief Private data pointer.
IGN_UTILS_IMPL_PTR(dataPtr)
Expand Down
5 changes: 5 additions & 0 deletions src/Joint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,11 @@ void Joint::SetPoseRelativeToGraph(
axis->SetPoseRelativeToGraph(this->dataPtr->poseRelativeToGraph);
}
}
for (auto &sensor : this->dataPtr->sensors)
{
sensor.SetXmlParentName(this->dataPtr->name);
sensor.SetPoseRelativeToGraph(_graph);
}
}

/////////////////////////////////////////////////
Expand Down
7 changes: 7 additions & 0 deletions test/integration/joint_dom.cc
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,7 @@ TEST(DOMJoint, Sensors)
EXPECT_EQ("joint", joint->Name());
EXPECT_EQ(1u, joint->SensorCount());

ignition::math::Pose3d pose;
// Get the force_torque sensor
const sdf::Sensor *forceTorqueSensor =
joint->SensorByName("force_torque_sensor");
Expand All @@ -986,6 +987,12 @@ TEST(DOMJoint, Sensors)
EXPECT_EQ(sdf::SensorType::FORCE_TORQUE, forceTorqueSensor->Type());
EXPECT_EQ(gz::math::Pose3d(10, 11, 12, 0, 0, 0),
forceTorqueSensor->RawPose());
EXPECT_TRUE(
forceTorqueSensor->SemanticPose().Resolve(pose, "__model__").empty());
EXPECT_EQ(ignition::math::Pose3d(10, 11, 12, 0, 0, 0), pose);
EXPECT_TRUE(forceTorqueSensor->SemanticPose().Resolve(pose).empty());
EXPECT_EQ(ignition::math::Pose3d(10, 11, 12, 0, 0, 0), pose);

auto forceTorqueSensorObj = forceTorqueSensor->ForceTorqueSensor();
ASSERT_NE(nullptr, forceTorqueSensorObj);
EXPECT_EQ(sdf::ForceTorqueFrame::PARENT, forceTorqueSensorObj->Frame());
Expand Down

0 comments on commit 0e10296

Please sign in to comment.