Class CameraTilt
Why: a camera reports a target's direction in its OWN view. When the camera is tilted up (to see a high goal), "to the side" in the picture is not "to the side" on the floor: a goal 27 degrees to the left reads only about 21 degrees with a camera tilted 35 degrees up, and its distance is the slanted line from the camera up to the goal. The aim and the shot tables want the floor's numbers.
How: the camera's numbers (right, forward along the lens, up in the picture) are turned down by the tilt, so "forward" lies flat on the floor again. Then bearing = the angle sideways, distance = the length sideways and forward (the height left out). With a tilt of 0 nothing changes.
The tilt: pitchDeg in the camera's Tunables section (degrees, + = tilted UP, as in the
simulator's robot file). Measure it on the robot: docs/reference/parts/camera.md.
double b = CameraTilt.bearingDeg(right, forward, up, 35); // + = LEFT, along the floor
-
Method Summary
Modifier and TypeMethodDescriptionstatic doublebearingDeg(double right, double forward, double up, double pitchDeg) The target's direction along the floor.static doublefloorDistance(double right, double forward, double up, double pitchDeg) The target's distance from the camera along the floor (the height difference left out).
-
Method Details
-
bearingDeg
public static double bearingDeg(double right, double forward, double up, double pitchDeg) The target's direction along the floor.- Parameters:
right- the target's place to the right of the lens, in the camera's own view (any length unit)forward- the target's place along the lens's line of sight (same unit)up- the target's place up in the picture, square to the line of sight (same unit)pitchDeg- how far the camera is tilted up, degrees (0 = level; + = up, - = down)- Returns:
- degrees, + = to the LEFT (the library's sign, docs/conventions.md); NaN if a number is NaN
-
floorDistance
public static double floorDistance(double right, double forward, double up, double pitchDeg) The target's distance from the camera along the floor (the height difference left out).- Parameters:
right- as inbearingDeg(double, double, double, double)forward- as inbearingDeg(double, double, double, double)up- as inbearingDeg(double, double, double, double)pitchDeg- as inbearingDeg(double, double, double, double)- Returns:
- in the same length unit as the inputs; NaN if a number is NaN
-