FIRST-Tech-Challenge / SkyStone

FTC SDK
https://www.firstinspires.org/robotics/ftc/what-is-first-tech-challenge
275 stars 1.04k forks source link

Bug in VuforiaTrackableDefaultListener.java--getPose() results wrong for back camera #86

Open jkenney2 opened 4 years ago

jkenney2 commented 4 years ago

The getPose() method (used with the BACK camera) returns x and y values that are the negative of what would be expected. That is, with the phone in portrait orientation, the x and y values are negative when the target is in the upper right of the screen. I believe this is the result of an error in the getPoseCorrectionMatrix() method: shouldn't the line

case BACK: return phoneFromFtcCameraBack;

instead read

case BACK: return phoneFromVuforiaCameraBack; //??

An unrelated aside: upon inspecting this class, I'm also wondering if the phoneFromVuforiaCameraFront matrix is incorrect. I think the correct matrix would be:

0 1 0 0 -1 0 0 0 0 0 1 0 0 0 0 1

But because OpenGLMatrix is Column-Major, I think it is the transposition of that matrix that has been used.

NoahAndrews commented 4 years ago

What phone are you using?

jkenney2 commented 4 years ago

Moto G4 Play (XT1609). BTW, the getRobotLocation() / getFtcFieldFromRobot() methods (which don't rely on getPoseCorrectionMatrix) work fine.

realquantumcookie commented 4 years ago

Our team (4100) also gets this result.
And the annotation says that the getPose() / getFtcCameraFromTarget() returns the pose of the object in the FTC Camera Coordinate System. Here the FTC Camera Coordinate System isn't clearly explained.
The best solution here might just be return the pose of the object in the FTC Robot Coordinate System instead.