Skip to content

Use pose multiplication instead of subtraction #1521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -626,10 +626,11 @@ void MulticopterMotorModelPrivate::UpdateForcesAndMoments(
// is equivalent to use WorldPose().Rot().
Link parentLink(this->parentLinkEntity);
const auto parentWorldPose = parentLink.WorldPose(_ecm);
// The tansformation from the parent_link to the link_.
// The transformation from the parent_link to the link_.
// Pose poseDifference =
// link_->GetWorldCoGPose() - parent_links.at(0)->GetWorldCoGPose();
Pose poseDifference = *worldPose - *parentWorldPose;
// parent_links.at(0)->GetWorldCoGPose().Inverse()
// * link_->GetWorldCoGPose()
Pose poseDifference = (*parentWorldPose).Inverse() * (*worldPose);
Vector3 dragTorque(
0, 0, -this->turningDirection * thrust * this->momentConstant);
// Transforming the drag torque into the parent frame to handle
Expand Down
4 changes: 2 additions & 2 deletions test/integration/logical_camera_system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ TEST_F(LogicalCameraTest, IGN_UTILS_TEST_DISABLED_ON_WIN32(LogicalCameraBox))
EXPECT_EQ(sensor1Pose, gz::msgs::Convert(img1.pose()));
EXPECT_EQ(1, img1.model().size());
EXPECT_EQ(boxName, img1.model(0).name());
gz::math::Pose3d boxPoseCamera1Frame = boxPose - sensor1Pose;
gz::math::Pose3d boxPoseCamera1Frame = sensor1Pose.Inverse() * boxPose;
EXPECT_EQ(boxPoseCamera1Frame, gz::msgs::Convert(img1.model(0).pose()));
mutex.unlock();

Expand All @@ -192,7 +192,7 @@ TEST_F(LogicalCameraTest, IGN_UTILS_TEST_DISABLED_ON_WIN32(LogicalCameraBox))
EXPECT_EQ(sensor2Pose, gz::msgs::Convert(img2.pose()));
EXPECT_EQ(1, img2.model().size());
EXPECT_EQ(boxName, img2.model(0).name());
gz::math::Pose3d boxPoseCamera2Frame = boxPose - sensor2Pose;
gz::math::Pose3d boxPoseCamera2Frame = sensor2Pose.Inverse() * boxPose;
EXPECT_EQ(boxPoseCamera2Frame, gz::msgs::Convert(img2.model(0).pose()));
mutex.unlock();
}