Behind the Scenes

What happens behind the scenes when calling .update()!

When you call the .update() method on a ThreeSensorLocalization object, many processes run in the background. The process follows this flow:

  1. Check each sensor to see if they are within the sensorDistanceSafety value

    • This identifies which sensor to use, and which ones not to use

  2. Find the closest 'Cardinal Angle' (0°, 90°, 180°, 270°) of the sensor's theta + robot theta

  3. Based on the cardinal angle, assign whether the sensor calculates the X position or the Y position.

  4. Check the number of sensors that are active:

    • 1-2 active sensors: If the sensor calculates for X, add the sensor's horizontal component to a x position list. If the sensor calculates for Y, add the sensor's vertical component to a y position list.

  5. Assign the average of each list to their corresponding position in Pose Estimate.

Here is a simple flow chart showing this entire process!

Last updated