Skip to content
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

Use pose multiplication instead of subtraction #231

Merged
merged 1 commit into from
Jun 7, 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
2 changes: 1 addition & 1 deletion src/LogicalCameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ bool LogicalCameraSensor::Update(
msgs::LogicalCameraImage::Model *modelMsg =
this->dataPtr->msg.add_model();
modelMsg->set_name(it.first);
msgs::Set(modelMsg->mutable_pose(), it.second - this->Pose());
msgs::Set(modelMsg->mutable_pose(), this->Pose().Inverse() * it.second);
}
}
*this->dataPtr->msg.mutable_header()->mutable_stamp() = msgs::Convert(_now);
Expand Down
4 changes: 2 additions & 2 deletions test/integration/logical_camera.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ TEST_F(LogicalCameraSensorTest, DetectBox)
EXPECT_EQ(sensorPose, gz::msgs::Convert(img.pose()));
EXPECT_EQ(1, img.model().size());
EXPECT_EQ(boxName, img.model(0).name());
gz::math::Pose3d boxPoseCameraFrame = boxPose - sensorPose;
gz::math::Pose3d boxPoseCameraFrame = sensorPose.Inverse() * boxPose;
EXPECT_EQ(boxPoseCameraFrame, gz::msgs::Convert(img.model(0).pose()));

// 2. test box outside of frustum
Expand Down Expand Up @@ -221,7 +221,7 @@ TEST_F(LogicalCameraSensorTest, DetectBox)
EXPECT_EQ(sensorPose3, gz::msgs::Convert(img.pose()));
EXPECT_EQ(1, img.model().size());
EXPECT_EQ(boxName, img.model(0).name());
gz::math::Pose3d boxPose3CameraFrame = boxPose3 - sensorPose3;
gz::math::Pose3d boxPose3CameraFrame = sensorPose3.Inverse() * boxPose3;
EXPECT_EQ(boxPose3CameraFrame, gz::msgs::Convert(img.model(0).pose()));

// 4. rotate camera away and image should be empty
Expand Down