Skip to content
This repository has been archived by the owner on Feb 3, 2025. It is now read-only.

wrong Pose returned by Camera::GetWorldRotation() #1087

Closed
osrf-migration opened this issue Mar 6, 2014 · 10 comments
Closed

wrong Pose returned by Camera::GetWorldRotation() #1087

osrf-migration opened this issue Mar 6, 2014 · 10 comments
Labels
2.0 bug Something isn't working major

Comments

@osrf-migration
Copy link

Original report (archived issue) by Eric Chuang (Bitbucket: eric4337).


the math::Quaternion returned by Camera::GetWorldRotation() are always '0 0 0'.

no matter what my Camera pose is, it always return '0 0 0'

@osrf-migration
Copy link
Author

Original comment by John Hsu (Bitbucket: hsu, GitHub: hsu).


I just tried by adding code below to gazebo_2.2 branch:

//////////////////////////////////////////////////
void Camera::Update()
{
  gzerr << this->GetName() << " : " << this->GetWorldRotation() << "\n";

and running

gazebo test/worlds/camera_rotation_test.world

got some non-zero values

Error [Camera.cc:318] default::multicamera_sensor_translated(2) : 0 0 0
Error [Camera.cc:318] default::left(3) : 0 0 0
Error [Camera.cc:318] default::right(4) : 0 0 0
Error [Camera.cc:318] default::left(5) : 1.2 1.3 1.4
Error [Camera.cc:318] default::right(6) : 1.2 1.3 1.4

@osrf-migration
Copy link
Author

Original comment by Eric Chuang (Bitbucket: eric4337).


Sorry for my unspecific question.

Was your Camera attached to Model?

My Camera is created from SDF, under .
The Pose returned by Model, the parent of Camera, is correct.
But if i access the Pose of Camera directly, it seems to be wrong.

What i want is that i can get the "World Pose" of Camera directly, since the frame of Model & Camera are possibly not aligned.

@osrf-migration
Copy link
Author

Original comment by John Hsu (Bitbucket: hsu, GitHub: hsu).


I added a unit test here:

https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/branches/compare/issue_1087_gazebo_2.2..gazebo_2.2#diff

you can compile from branch issue_1087_gazebo_2.2 and run the test by:

[build dir]/test/integration/INTEGRATION_multicamera_sensor --gtest_filter="*WorldPose*"

The test fails, indicating there is an issue with Camera::GetWorldRotation() call.

Thanks for the bug report.

@osrf-migration
Copy link
Author

Original comment by John Hsu (Bitbucket: hsu, GitHub: hsu).


Will issue #1098 make it easier for users to submit a patch similar to this test patch in the future?

@osrf-migration
Copy link
Author

Original comment by Ian Chen (Bitbucket: Ian Chen, GitHub: iche033).


regarding the test:

line 376

#!c++

  EXPECT_EQ(model1->GetWorldPose() + multicamera1->GetPose(),
    multicamera1->GetCamera(0)->GetWorldPose());
  • model1->GetWorldPose() = 0 10 1 0 0 0

  • multicamera1->GetPose() = 0 0 0 0 0 0

since camera(0) has an offset pose of 0 1 0 0 0 0, so shouldn't the correct camera world pose be

  • multicamera1->GetCamera(0)->GetWorldPose() = 0 11 1 0 0 0

then the EXPECT statement won't evaluate to true right?

@osrf-migration
Copy link
Author

Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


Shouldn't the pose addition arguments be reversed as: multicamera1->GetPose() + model1->GetWorldPose()?

@osrf-migration
Copy link
Author

Original comment by Ian Chen (Bitbucket: Ian Chen, GitHub: iche033).


I made some changes and the test now pass

Here is a diff showing my changes on top of yours
https://osrf-migration.github.io/gazebo-gh-pages/#!/osrf/gazebo/branches/compare/issue_1087_gazebo_2.2_ian..issue_1087_gazebo_2.2#dif

@osrf-migration
Copy link
Author

Original comment by Ian Chen (Bitbucket: Ian Chen, GitHub: iche033).


@hsu I think the fix + test is ready, let's make a pull request for this?

@osrf-migration
Copy link
Author

Original comment by Steve Peters (Bitbucket: Steven Peters, GitHub: scpeters).


  • changed state from "new" to "resolved"

pull request #1071

@osrf-migration
Copy link
Author

Original comment by Nate Koenig (Bitbucket: Nathan Koenig).


  • changed state from "resolved" to "closed"

@osrf-migration osrf-migration added major bug Something isn't working 2.0 labels Apr 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
2.0 bug Something isn't working major
Projects
None yet
Development

No branches or pull requests

1 participant