Optimization of Camera Placement for AprilTags

I wrote some quick-and-dirty Python code to examine how “visibility” (ability to see at least one tag) is affected by tag placement on the field, and camera setup on the robot. I define some tag locations, and some cameras (FoV, location, orientation) and then iterate in X and Y across the standard field size. At each location, I iterate through many possible robot orientations, and take the minimum number of tags visible. That is, the analysis I’m doing is, “at any given position on the field, what’s the minimum number of tags in view, across the possible orientations?” Then, I plot those values on a heatmap.

Caveats:

  1. I solely evaluate whether a tag is in the field of view of a camera, without regard to range.
  2. Neither obstructions on the robot nor the field are considered.
  3. This is a strictly 2D analysis.

(I’ll post code as soon as I can get back into my github account. Damn you, 2FA.)

Some results

Figure_7

Figure_8

8 Likes

If nothing else the math is pretty. It seems like what we would expect. Best chance of catching the most tags is with a 360 degree spread of cameras.

1 Like

So, I understand the theoretical “more cameras is betterer” argument. But why is a single camera that corrects robot pose when it sees an April tag not sufficient?

It’s fine if you can get your odometry to fill in the gaps. Pushing matches, field bumps etc. will throw off odometry till the next tag sighting.

Getting multiple tag measurements at once is more reliable/accurate (“more is betterer”) than just one. You can capture multiple tags with one camera, but obviously more cameras can improve that coverage.

1 Like

Otheres who have posted here are already doing the hard work to actually implement this, but I’ll go ahead and be their cheerleader to toss out a few thoughts:

If you want to localize well off of just one tag, you want it viewed from multiple cameras. Multiple cameras seeing the same target opens the door for you to remove the ambiguity of the multiple estimates that come off of the same target.

That same effect can come from multiple targets seen by one camera.

1 Like

Also if you have more cameras, you have a higher chance of seeing a tag. Especially if they are only using 30 tags.

With “only” 30 tags, they could place one tag every 6 feet around the entire field perimeter. Do people really think the number of tags will be an issue?

1 Like

I think the general assumption is that there will be structures in the field, like the hub this year, and that some moderate fraction of the tags will be need to go on that.

I was not involved, but some teams put tags on the 2022 field for post season matches this summer and they use roughly 30-40 tags. That was without any tags on the field side walls.

I thought that would be easy as I bought two USB OV9281 (Amazon ArduCam 1MP SKU: B0332). Connected to RPi 4b. PhotonVision is not happy with the second camera.

The first camera is the only one that displays on dashboard so it’s hard to tell what the second camera sees. I get no images for any camera on photonvision:118x.

It takes a few page refreshes or changing tabs to get the right target info insert for the second camera. And then it doesn’t update. The target location is stuck until I refresh the image somehow.

NT looks okay for the first camera but the second camera has a bunch of zeros and no updates.

How many tags did you use for this and where are they placed?

1 Like

Yeah…so photon has trouble telling usb cams of the same model apart. That’s a known issue unfortunately.

1 Like

Looks like the red dots in the picture are the tag locations.

Arducam’s website has instructions and a utility for changing the name and serial number for the OV9281 UVC cameras. Would this solve the problem at least for the supported cameras?

The second link in particular seems to describe a very similar issue to ours that it then resolves.

1 Like

Is there a max limit of cameras that photon can handle right now?

That’s my guess based on another saying they measure farther than reality and mine report about 2 feet short of reality. I’m relying on you all to get them accurate enough to be able to turn to a target and compute a correct distance to the target.

Those old-school green blobs were tolerant and accurate but maybe we’ll get through the AprilTag growing pains soon enough and then love them forever.

Their utility failed with error Unknown Device. Microsoft Window’s Camera uses the camera fine so I know it was connected to the PC okay.

I was under the impression that PhotonVision wouldn’t necessarily associate a camera with the right port if the cameras had the same name. I wasn’t even concerned about that (yet, but soon). PhotonVision wouldn’t even get the cameras to display right or at all. PhotonVision did correctly rename the second camera to …(1) and I was happy with that but that’s about the only thing it seemed to do right.

1 Like

Here’s the code, finally: https://github.com/carlosgj/FRC-Visibility-Analysis

Yup.

1 Like

I used this utility to change the name and serial number of our OV9281 USB camera. I don’t have a 2nd camera to see if Photovision will treat them as two separate cameras easily.

I haven’t found a similar utility that works with the ELP cameras.

2 Likes

Then it comes back to how much is good enough. Like 2 cameras will probably have some improvement, but 2 → 3 and 3 → 4?

1 Like