Math to calculate shooter angle for offset rotation

Team 2972’s robot for Crescendo has a shooting platform that can tip up and down. The platform rotates around a pivot that is away from the shooting surface, both laterally and vertically. The programmers were asking how to calculate the rotation angle of the platform to point it at a target (which, yes, assumes our projectile path is fast enough to be roughly linear).

I created this online calculator to demonstrate the trigonometry, and thought it might be useful to another team. (If for nothing else than to show how amazing Geogebra is for constraints-based Geometry calculations.)

You can just watch a video of it being used, or play with the calculator yourself.

Note that the units of the values are irrelevant, as long as they are consistent. The values for x, y, and r can be in inches, centimeters, or meters, as long as they’re all the same units.

In radians instead of degrees—which is likely what programmers would really be using—the formula is:

theta = PI - atan(y / x) - acos(r / sqrt(x*x + y*y))

If you want flat-shooting to be a rotation of zero, subtract π/2 from the value.

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