Vision Processing, getting the camera to robot / robot to camera transformation

We just finished our last competition for this arc season, and I want to start working on vision processing and April tags, but one thing that really confuses me is how to get the robot to camera transform3d. I know that the transform is measured from the center of the robot but I am confused on whether the front of the robot is the x or y axis, and how to measure the pitch of the camera.
Thanks :slight_smile:

1 Like


If you are lucky enough to get your hands on some limelight 3s, you can use their built-in 3d positioning to do it all for you (see botpose Complete NetworkTables API — Limelight 1.0 documentation). If not, I would still recommend checking out the Limelight docs as they have some great tutorials on vision processing.

As far as the axis goes, that depends on the rest of your codebase and is somewhat left up to you. On Team 2875 we like to use “up and to the right” as positive (the front of the robot is positive y and the right is positive x).

The pitch of the camera is generally measured in degrees (or radians) from perfectly vertical. This means that if you have your camera angled 10 degrees down from vertical, it would have a pitch of -10.

If you want to see some examples of 3d position estimation (of a generic target, not AprilTag) done without using Limelight’s built-in 3d positioning, you can check out how 2875 (and I) do it in our Limelight class (warning: it is written in Kotlin). The getPosition method at the bottom uses the Limelight’s reported horizontal and vertical offsets from center (in degrees) to estimate the position of the target in field-relative space. I would also recommend looking into PhotonVision if you are not using a Limelight (I’ve never personally used it but heard it is good).

Hope this helps!

Edit: I also just found this docs page stating how the Limelight’s axis are defined.

Ok, thanks! I think my code uses positive x as front instead of positive y.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.