Sub-modules
- cflib.localization.ippe_cf
- cflib.localization.lighthouse_bs_geo
- cflib.localization.lighthouse_bs_vector
- cflib.localization.lighthouse_config_manager
- cflib.localization.lighthouse_geometry_solver
- cflib.localization.lighthouse_initial_estimator
- cflib.localization.lighthouse_sample_matcher
- cflib.localization.lighthouse_sweep_angle_reader
- cflib.localization.lighthouse_system_aligner
- cflib.localization.lighthouse_system_scaler
- cflib.localization.lighthouse_types
Classes
LighthouseBsGeoEstimator
LighthouseBsGeoEstimator()
This class is used to estimate the geometry (position and attitude) of a lighthouse base station, given angles measured using a lighthouse deck.
Methods
def estimate_geometry(self, bs_vectors)
Estimate the full pose of a base station based on angles from the 4 sensors on a lighthouse deck. The result is a rotation matrix and position of the base station, in the Crazyflie reference frame.
:param bs_vectors A list of 4 LighthouseBsVector objects specifying vectors to the 4 sensors :return rot_bs_in_cf_coord: Rotation matrix of the BS in the CFs coordinate system :return pos_bs_in_cf_coord: Position vector of the BS in the CFs coordinate system
def is_available(self)
def sanity_check_result(self, pos_bs_in_cf_coord)
Checks if the estimated geometry is within reasonable bounds. It returns true if it seems reasonable or false if it doesn’t
LighthouseBsVector
LighthouseBsVector(lh_v1_horiz_angle: float, lh_v1_vert_angle: float)
This class is representing a vector from a base station into space, in the base station reference frame. Typically the intersection of two light planes defined by angles measured by a base station. It also provides functionality to convert between lighthouse V1 angles, V2 angles and cartesian coordinates.
Initialize from lighthouse V1 angles
Parameters
Name | Description |
---|---|
lh_v1_horiz_angle | Horizontal sweep angle, 0 straight forward. Right (seen from the bs) is negative, left is positive |
lh_v1_vert_angle | Vertical sweep angle, 0 straight forward. Down is negative, up is positive. |
Class variables
T
Static methods
def from_cart(cart_vector: list[float]) ‑> cflib.localization.lighthouse_bs_vector.LighthouseBsVector
Create a LighthouseBsVector object from cartesian coordinates.
Parameters
Name | Description |
---|---|
cart_vector | (x, y, z) to a point |
def from_lh2(lh_v2_angle_1: float, lh_v2_angle_2: float) ‑> cflib.localization.lighthouse_bs_vector.LighthouseBsVector
Create a LighthouseBsVector object from lighthouse V2 angles
Parameters
Name | Description |
---|---|
lh_v2_angle_1 | First sweep angles, 0 straight ahead |
lh_v2_angle_2 | Second sweep angles, 0 straight ahead |
def from_projection(proj_point: list[float]) ‑> cflib.localization.lighthouse_bs_vector.LighthouseBsVector
Create a LighthouseBsVector object from the projection point on the plane x=1.0
Parameters
Name | Description |
---|---|
projection point | (y, z) |
Instance variables
cart: numpy.ndarray[typing.Any, numpy.dtype[numpy.float32]]
A normalized vector in cartesian coordinates
lh_v1_angle_pair: tuple[float, float]
Lightouse V1 angle pair (horiz, vert)
lh_v1_horiz_angle: float
Lightouse V1 horizontal sweep angle
lh_v1_vert_angle: float
Lightouse V1 vertical sweep angle
lh_v2_angle_1: float
Lightouse V2 first sweep angle
lh_v2_angle_2: float
Lightouse V2 second sweep angle
projection: numpy.ndarray[typing.Any, numpy.dtype[numpy.float32]]
The 2D point (y, z) when projected on the plane x=1.0 (one meter in front of the base station)
LighthouseConfigFileManager
LighthouseConfigFileManager()
Class variables
CALIBS_ID
GEOS_ID
SYSTEM_TYPE_ID
SYSTEM_TYPE_V1
SYSTEM_TYPE_V2
TYPE
TYPE_ID
VERSION
VERSION_ID
Static methods
def read(file_name)
def write(file_name, geos={}, calibs={}, system_type=2)
LighthouseConfigWriter
LighthouseConfigWriter(cf, nr_of_base_stations=16)
This class is used to write system config data to the Crazyflie RAM and persis to permanent storage
Methods
def write_and_store_config(self, data_stored_cb, geos=None, calibs=None, system_type=None)
Transfer geometry and calibration data to the Crazyflie and persist to permanent storage. The callback is called when done. If geos or calibs is None, no data will be written for that data type. If geos or calibs is a dictionary, the values for the base stations in the dictionary will transfered to the Crazyflie, data for all other base stations will be invalidated.
def write_and_store_config_from_file(self, data_stored_cb, file_name)
Read system configuration data from file and write/persist to the Crazyflie. Geometry and calibration data for base stations that are not in the config file will be invalidated.
LighthouseSweepAngleAverageReader
LighthouseSweepAngleAverageReader(cf, ready_cb)
Helper class to make it easy read sweep angles for multiple base stations and average the result
Methods
def is_collecting(self)
True if data collection is in progress
def start_angle_collection(self)
Start collecting angles. The process will terminate when nr_of_samples_required have been received
def stop_angle_collection(self)
Premature stop of data collection
LighthouseSweepAngleReader
LighthouseSweepAngleReader(cf, data_recevied_cb)
Wrapper to simplify reading of lighthouse sweep angles from the locSrv stream
Class variables
ANGLE_STREAM_PARAM
NR_OF_SENSORS
Methods
def start(self)
Start reading sweep angles
def stop(self)
Stop reading sweep angles