## Decoding Incoming Data Using Python

Topics related to the Lighthouse positioning system, configuration and use
barismetin
Beginner
Posts: 7
Joined: Wed May 27, 2020 7:25 pm

### Decoding Incoming Data Using Python

My goal is calculate 3D confidante of the lighthouse deck using python script. I do not have crazyflie drone and I would like to just use lighthouse deck and lighthouse v2 base stations ( I have 2 of them ). I know crazyflie does this function using IMU and Kalman filter but at this point I am just interested X , Y , and Z Cartesian system coordinates.

There are useful python scripts under the tool section which allows to process incoming data from lighthouse deck.

such as print_frame.py, decodev2_cf and , decodev2.py. I understand print_frame.py output where output of the sensors are

I have a idea about print frame it prints sensors azimuth and evaluation angles,
I am not sure about output decodev2 output and decodev2_cf my question is

What is the output of the decodev2 and deocedev2_cf.py

How can I find the cartesian coordinates of the lighthouse deck using decodev2 and deocedev2_cf.py python script
How important decodev2 and deocedev2_cf.py during the process of finding Cartesian coordinates
Any tips or help is really appreciated
kristoffer
Bitcraze
Posts: 369
Joined: Tue Jun 30, 2015 7:47 am

### Re: Decoding Incoming Data Using Python

I'm not sure the decoding scripts are fully functional, but it should not be too far away. I don't remember what the output is (they were changed around a few times), but you probably have to dig in to them and find a good place to print the actual sweep angles.

Lighthouse 2 uses two light planes that are tilted by 30 degrees, both sweeping horizontally. To convert from lighthouse 2 angles to lighthouse 1 angles (vertical/horizontal angles) you can look at the function https://github.com/bitcraze/crazyflie-f ... #L219-L225

When you have horizontal/vertical angles (lighthouse 1 style) you can calculate the line that is defined by the two angles, in relation to the basestation.
Use the https://github.com/bitcraze/crazyflie-f ... c#L63-L102 function to calculate the intersection point (or closest point) of the lines from two basestations.