Distortion When Tracking Targets With RoboRealm and Tilted Axis Cam

I’ve been working on this issue for a long time, but just can’t seem to get it fixed. When our Axis camera (model m1013) is mounted on our robot at a 45 degree angle (from the ground, pointing upwards) and our robot turns to the side, the target height (calculated with RING_CORNER data) increases by some small amount of pixels, depending on how far the robot is positioned from the target - usually between 3 and 6 pixels. Although 3 to 6 pixels doesn’t sound like much, this heavily affects the way distance from the target is calculated, as our distance function uses the target’s height in pixels for the calculation. I’ve tried many things - the ‘radial distortion’ module, the ‘perspective’ module, the ‘rotate’ module, and the ‘spherical unwarp’ module (which helped a bit, but still didn’t fix the issue completely), but none of them fixed the issue completely. The problem, I’ve determined, is that the camera is rotated at a 45 degree angle, rather than being perpendicular to the ground. This causes a kind of ‘keystone effect’ that is very difficult to eliminate completely, and varies in strength based on how far away the robot is from the target. Unfortunately, as the shooting targets are fairly high up in this year’s FRC game, positioning the camera perpendicular to the ground would cause the target to be out of the shot unless the robot is very far away. Is there any other way I could try to fix this issue??

Please find attached a zipped folder of filtered field images both at 10 ft and 15 ft from the base of the target, with the robot facing towards the target as well as 25 degrees to either side - these images reveal this distortion effect. Also please find attached several RoboRealm projects in which I have tried to approach this issue.

TargetImages.zip (77.2 KB)
TargetTrackingProjects.zip (4.61 KB)


TargetImages.zip (77.2 KB)
TargetTrackingProjects.zip (4.61 KB)

It seems like ‘radial distortion’ or the other modules you used should have fixed it. They are what usually causes this. Is it possible their values aren’t quite right or that your camera’s distance from the high goal is actually changing when you turn (due to its off-center mounting or the robot’s non-perfect turning)?

Thank you for the suggestion blueboss. I’ve tested our vision algorithm with this distortion pretty extensively, and when testing with the robot have made sure that it was at approximately the same distance (give or take several inches) when turned to the side. The spherical unwarp module (along with the standard radial distortion module most people use) has given the most promising correction to the issue, as it made the difference almost unnoticeable when turning the camera, BUT this also made the algorithm a lot less responsive to actual changes in distance, so in a sense it was too strong of a fix - I tried messing around with the amounts of spherical unwarp, as well as multipliers and offsets for the distance function, but this only made the algorithm for random and jumpy. Some of the rotational corrections I applied worked in terms of getting the target to be parallel to the top and bottom of the frame, but still left the additional 3 to 6 pixels on the target height, which is equivalent to about half a foot to a foot in our distance function.

I can confirm the same woes with the M1013 and RoboRealm, jnazaren. We’ve tried the RR modules and tweaking the radial distorion. In the end, we programmed our turret to track a goal to the center of the screen, then calculate distance before determining shooter speed. We can then compare/confirm distance with a rangefinder.

I’ve been looking for a solution to this issue as well. I also tried the 2012 modules and the older Axis cam to no avail. I also saw your post on the RR forum, heh. It seems as long as we can track that goal so our shooter is centered to it, we can figure everything else out.

Yes Mister_E! That’s exactly what I’ve concluded.

At this point, because our angle calculation function is unaffected by this distortion issue, it’s probably better for us to turn to the right angle (so that the target is centered in the middle of the screen) before we calculate distance for shooter wheel speed. :frowning: