Skip to content

Commit 09fd519

Browse files
authored
Use pose multiplication instead of subtraction (#1521)
Part of gz-math#60. Signed-off-by: Steve Peters <[email protected]>
1 parent 88e0c49 commit 09fd519

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/systems/multicopter_motor_model/MulticopterMotorModel.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -626,10 +626,11 @@ void MulticopterMotorModelPrivate::UpdateForcesAndMoments(
626626
// is equivalent to use WorldPose().Rot().
627627
Link parentLink(this->parentLinkEntity);
628628
const auto parentWorldPose = parentLink.WorldPose(_ecm);
629-
// The tansformation from the parent_link to the link_.
629+
// The transformation from the parent_link to the link_.
630630
// Pose poseDifference =
631-
// link_->GetWorldCoGPose() - parent_links.at(0)->GetWorldCoGPose();
632-
Pose poseDifference = *worldPose - *parentWorldPose;
631+
// parent_links.at(0)->GetWorldCoGPose().Inverse()
632+
// * link_->GetWorldCoGPose()
633+
Pose poseDifference = (*parentWorldPose).Inverse() * (*worldPose);
633634
Vector3 dragTorque(
634635
0, 0, -this->turningDirection * thrust * this->momentConstant);
635636
// Transforming the drag torque into the parent frame to handle

test/integration/logical_camera_system.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ TEST_F(LogicalCameraTest, IGN_UTILS_TEST_DISABLED_ON_WIN32(LogicalCameraBox))
181181
EXPECT_EQ(sensor1Pose, gz::msgs::Convert(img1.pose()));
182182
EXPECT_EQ(1, img1.model().size());
183183
EXPECT_EQ(boxName, img1.model(0).name());
184-
gz::math::Pose3d boxPoseCamera1Frame = boxPose - sensor1Pose;
184+
gz::math::Pose3d boxPoseCamera1Frame = sensor1Pose.Inverse() * boxPose;
185185
EXPECT_EQ(boxPoseCamera1Frame, gz::msgs::Convert(img1.model(0).pose()));
186186
mutex.unlock();
187187

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

0 commit comments

Comments
 (0)