Classes
LighthouseCrossingBeam
LighthouseCrossingBeam()
A class to calculate the crossing point of two “beams” from two base stations. The beams are defined by the line where the two light planes intersect. In a perfect world the crossing point of the two beams is the position of a sensor on the Crazyflie Lighthouse deck, but in reality the beams will most likely not cross and instead we use the closest point between the two beams as the position estimate. The (minimum) distance between the beams is also calculated and can be used as an error estimate for the position.
Static methods
def distance_sensor(bs1: Pose, angles_bs1: LighthouseBsVector, bs2: Pose, angles_bs2: LighthouseBsVector) ‑> float
Calculate the minimum distance between the beams from two base stations.
Args: bs1 (Pose): The pose of the first base station. angles_bs1 (LighthouseBsVector): The sweep angles of the first base station. bs2 (Pose): The pose of the second base station. angles_bs2 (LighthouseBsVector): The sweep angles of the second base station.
Returns: float: The shortest distance between the beams.
def max_distance_all_permutations(bs_angles: list[tuple[Pose, LighthouseBsVectors]]) ‑> float
Calculate the maximum distance between the beams from base stations for all sensors. All permutations of base stations are considered. This result can be used as an estimation of the maximum error.
Args: bs_angles (list[tuple[Pose, LighthouseBsVectors]]): A list of tuples containing the pose of the base stations and their sweep angles.
Returns: float: The maximum distance between the beams from all permutations of base stations.
def position_distance_sensor(bs1: Pose, angles_bs1: LighthouseBsVector, bs2: Pose, angles_bs2: LighthouseBsVector) ‑> tuple[numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[~_ScalarT]], float]
Calculate the estimated position of the crossing point of the beams from two base stations as well as the distance.
Args: bs1 (Pose): The pose of the first base station. angles_bs1 (LighthouseBsVector): The sweep angles of the first base station. bs2 (Pose): The pose of the second base station. angles_bs2 (LighthouseBsVector): The sweep angles of the second base station.
Returns: tuple[npt.NDArray, float]: The estimated position of the crossing point and the distance between the beams.
def position_max_distance(bs1: Pose, angles_bs1: LighthouseBsVectors, bs2: Pose, angles_bs2: LighthouseBsVectors) ‑> tuple[numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[~_ScalarT]], float]
Calculate the position and maximum distance between the beams from two base stations. The position is the average position for all sensors which is the center of the lighthouse deck.
Args: bs1 (Pose): The pose of the first base station. angles_bs1 (LighthouseBsVectors): The sweep angles of the first base station. bs2 (Pose): The pose of the second base station. angles_bs2 (LighthouseBsVectors): The sweep angles of the second base station.
Returns: float: The position and maximum distance between the beams.
def position_max_distance_all_permutations(bs_angles: list[tuple[Pose, LighthouseBsVectors]]) ‑> tuple[numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[~_ScalarT]], float]
Calculate the average position and the maximum distance between the beams from base stations for all sensors. All permutations of base stations are considered.
The position will be an estimate of the position of the center of the lighthouse deck and the maximum distance can be used as an estimation of the maximum error.
Args: bs_angles (list[tuple[Pose, LighthouseBsVectors]]): A list of tuples containing the pose of the base stations and their sweep angles.
Returns: tuple[npt.NDArray, float]: The position and the maximum distance between the beams from all permutations of base stations.
def position_sensor(bs1: Pose, angles_bs1: LighthouseBsVector, bs2: Pose, angles_bs2: LighthouseBsVector) ‑> numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[~_ScalarT]]
Calculate the estimated position of the crossing point of the beams from two base stations.
Args: bs1 (Pose): The pose of the first base station. angles_bs1 (LighthouseBsVector): The sweep angles of the first base station. bs2 (Pose): The pose of the second base station. angles_bs2 (LighthouseBsVector): The sweep angles of the second base station.
Returns: npt.NDArray: The estimated position of the crossing point of the two beams.
def positions_distances(bs1: Pose, angles_bs1: LighthouseBsVectors, bs2: Pose, angles_bs2: LighthouseBsVectors) ‑> list[tuple[numpy.ndarray[tuple[typing.Any, ...], numpy.dtype[~_ScalarT]], float]]
Calculate the positions and minimum distance between the beams from two base stations for all sensors.
Args: bs1 (Pose): The pose of the first base station. angles_bs1 (LighthouseBsVectors): The sweep angles of the first base station. bs2 (Pose): The pose of the second base station. angles_bs2 (LighthouseBsVectors): The sweep angles of the second base station.
Returns: list[tuple[npt.NDArray, float]]: A list of the positions and distances for each sensor.