From 5a0ed034a822058ad8fc9b07ce84ad9306d5f4dd Mon Sep 17 00:00:00 2001 From: hjelstromboli Date: Fri, 18 Feb 2022 15:49:26 -0800 Subject: [PATCH] Distance updates --- docs/cs_estimating_distance.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/cs_estimating_distance.rst b/docs/cs_estimating_distance.rst index a057c79..698c74f 100644 --- a/docs/cs_estimating_distance.rst +++ b/docs/cs_estimating_distance.rst @@ -23,9 +23,10 @@ d = (h2-h1) / tan(a1+a2) The tan function usually assumes that its input is measured in radians. To convert an angle measurement from degrees to radians, multiply the angle measurement by (3.14159/180.0). Essentially, 3.14 radians = 180 degrees. See the full code example below. + .. tabs:: - ..tab:: Java + .. tab:: Java .. code-block:: java @@ -48,7 +49,8 @@ The tan function usually assumes that its input is measured in radians. To conve //calculate distance double distanceFromLimelightToGoalInches = (goalHeightInches - limelightHeightInches)/tan(angleToGoalRadians); - ..tab:: c++ + + .. tab:: C++ .. code-block:: c++ @@ -70,6 +72,8 @@ The tan function usually assumes that its input is measured in radians. To conve //calculate distance double distanceFromLimelightToGoalInches = (goalHeightInches - limelightHeightInches)/tan(angleToGoalRadians); + + When using this technique it is important to choose the mounting angle of your camera carefully. You want to be able to see the target both when you're too close and too far away. You also do not want this angle to change, so mount it securely and avoid using slots in your mounting geometry. If you are having trouble figuring out what the angle a1 is, you can also use the above equation to solve for a1. Just put your robot at a known distance (measuring from the lens of your camera) and solve the same equation for a1.