Unable to get any geometry data from lighthouse v2 (valve)

Topics related to the Lighthouse positioning system, configuration and use
whizzle
Beginner
Posts: 18
Joined: Sat Feb 08, 2020 4:05 pm

Unable to get any geometry data from lighthouse v2 (valve)

Post by whizzle »

Hey there,

we have troubles getting V2 Lighthouse (Valve) basestation calibration data with our Crazyflie 2.1 + Lighthouse deck.

================
edit: Jump to post 3
for latest updates.
================

We plugged in the 2 basestations to the power outlet.
We get a green led light in the basestations.

We flashed our crazyflies with the latest master as well as with the state of the commit sha 463110b1aae6166fdecdcfca4d3bc64532e949bc.
When we start the crazyflie we get two blue leds at the back, one red led blinking right front and one blue led on the lighthouse deck itself.

With the latest master we got stuck by executing the command "get_geometry".
On the console we get the following text:
python3 get_bs_geometry.py --uri radio://0/80/2M/E7E7E7E7E2
Connecting to radio://0/80/2M/E7E7E7E7E2
Connected to radio://0/80/2M/E7E7E7E7E2
Reading sensor data...


With the state of 463110b1aae6166fdecdcfca4d3bc64532e949bc we do not get stuck by executing the command "get_geometry" but we do not get any reasonable calibration data (only 1s and 0s)

python3 get_bs_geometry.py --uri radio://0/80/2M/E7E7E7E7E2
Connecting to radio://0/80/2M/E7E7E7E7E2
Connected to radio://0/80/2M/E7E7E7E7E2
Reading sensor data...
Estimating position of base stations...
Could not find valid solution for base station 0
{.origin = {0.000000, 0.000000, 0.000000, }, .mat = {{1.000000, 0.000000, 0.000000, }, {0.000000, 1.000000, 0.000000, }, {0.000000, 0.000000, 1.000000, }, }},
Could not find valid solution for base station 1
{.origin = {0.000000, 0.000000, 0.000000, }, .mat = {{1.000000, 0.000000, 0.000000, }, {0.000000, 1.000000, 0.000000, }, {0.000000, 0.000000, 1.000000, }, }},



We tried to plot the raw angles (lighthouse.rawAngle0xlh2 ...) but they only show a straight line at 0 and do not change when the crazyflie is moved.

When flashing the crazyflie we used the tools/make/config.mk.example, renamed it to config.mk and added the following two lines:
CFLAGS += -DISABLE-LIGHTHOUSE-DRIVER=0
CFLAGS += -DLIGHTHOUSE_FORCE_TYPE=2



After flashing and starting, we get the following in the cfclient console:

ESTKALMAN: State out of bounds, resetting
SYS: ----------------------------
SYS: Crazyflie 2.1 is up and running!
SYS: Build 123:0bda4718c448 (2020.09 +123) CLEAN
SYS: I am 0x203336473152500700240027 and I have 1024KB of flash!
CFGBLK: v1, verification [OK]
DECK_CORE: 2 deck(s) found
DECK_CORE: Calling INIT on driver bcLedRing for deck 0
DECK_CORE: Calling INIT on driver bcLighthouse4 for deck 1
IMU: BMI088 Gyro I2C connection [OK].
IMU: BMI088 Accel I2C connection [OK]
IMU: BMP388 I2C connection [OK]
ESTIMATOR: Using Kalman (2) estimator
CONTROLLER: Using PID (1) controller
MTR-DRV: Using brushed motor driver
EEPROM: I2C connection [OK].
STORAGE: Storage check [OK].
IMU: BMI088 gyro self-test [OK]
STAB: Wait for sensor calibration...
SYS: Free heap: 20304 bytes
LHFL: Lighthouse bootloader version: 2
STAB: Ready to fly.
LHFL: Firmware version 5 verified, booting deck!


Looking forward for help.
Last edited by whizzle on Tue Dec 08, 2020 8:49 am, edited 1 time in total.
whizzle
Beginner
Posts: 18
Joined: Sat Feb 08, 2020 4:05 pm

Re: Unable to get any geometry data from lighthouse v2 (valve)

Post by whizzle »

I set basestation 1 to mode 1 and basestation 2 to mode 2. (sudo apt install picocom; sudo picocom /dev/ttyACM0; mode (shows e.g. mode 4); mode 2; param save; )
Is this correct?
Since then I am getting some raw angles.
But executing ~/projects/crazyflie-firmware/tools/lighthouse$ python get_lh2_calib_data.py --dev /dev/ttyACM0
results in:
File "get_lh2_calib_data.py", line 82
print(' {', end='')
^
SyntaxError: invalid syntax

Executing ~/projects/crazyflie-firmware/tools/make$ python3 ../lighthouse/get_bs_geometry.py --uri radio://0/80/2M/E7E7E7E7E2
results in:
Traceback (most recent call last):
File "/home/bitcraze/.local/lib/python3.6/site-packages/cflib/crazyflie/__init__.py", line 403, in run
cb.callback(pk)
File "/home/bitcraze/.local/lib/python3.6/site-packages/cflib/crazyflie/localization.py", line 105, in _incoming
self.receivedLocationPacket.call(pk)
File "/home/bitcraze/.local/lib/python3.6/site-packages/cflib/utils/callbacks.py", line 55, in call
cb(*args)
File "../lighthouse/get_bs_geometry.py", line 71, in _loc_callback
if pk.type != scf.cf.loc.LH_ANGLE_STREAM:
AttributeError: 'Localization' object has no attribute 'LH_ANGLE_STREAM'

ERROR:cflib.crazyflie:Exception while doing callback on port [6]

Traceback (most recent call last):
File "/home/bitcraze/.local/lib/python3.6/site-packages/cflib/crazyflie/__init__.py", line 403, in run
cb.callback(pk)
File "/home/bitcraze/.local/lib/python3.6/site-packages/cflib/crazyflie/localization.py", line 105, in _incoming
self.receivedLocationPacket.call(pk)
File "/home/bitcraze/.local/lib/python3.6/site-packages/cflib/utils/callbacks.py", line 55, in call
cb(*args)
File "../lighthouse/get_bs_geometry.py", line 71, in _loc_callback
if pk.type != scf.cf.loc.LH_ANGLE_STREAM:
AttributeError: 'Localization' object has no attribute 'LH_ANGLE_STREAM'

ERROR:cflib.crazyflie:Exception while doing callback on port [6]
whizzle
Beginner
Posts: 18
Joined: Sat Feb 08, 2020 4:05 pm

Re: Unable to get any geometry data from lighthouse v2 (valve)

Post by whizzle »

Ok, so setting the 2 basestations to mode 1 and 2 and using crazyflie-firmware state from commit 463110b1aae6166fdecdcfca4d3bc64532e949bc we can get some raw angles as well as get_geometry.

To set the geometry (I really don't know how to use --write flag since I never saw a valid command - could sb. send one with sample geometry data?) we need a repository state which contains lighthouseCoreState.bsGeometry in ‘src/modules/src/lighthouse/lighthouse_core.c’. so we switch to master and make clean, all and cload

The client shows still the raw angles but the position remains at around 0

Where do we get the calibration data from?
Executing the command get_lh2_calib_data.py results in
Traceback (most recent call last):
File "tools/lighthouse/get_lh2_calib_data.py", line 42, in <module>
import serial
ModuleNotFoundError: No module named 'serial'
kimberly
Bitcraze
Posts: 749
Joined: Fri Jul 06, 2018 11:13 am

Re: Unable to get any geometry data from lighthouse v2 (valve)

Post by kimberly »

Alright, it is a bit unclear where your current status is, so assume only on the last post.

So right now angles will not be send to the position estimate filter if there is no calibration data (assuming you are on master). So you will need to to add the calibration data first.


You need to install the python package 'serial'

Code: Select all

pip3 install serial
Or look up how you do it for you version of ubuntu.

Then find out on which ACM port your basestation is at (on ubuntu) which you can find with 'dmesg'.

Then you need to run (replace your AMC number in the last argument)

Code: Select all

get_lh2_clib_data.py --dev /dev/ACM0
whizzle
Beginner
Posts: 18
Joined: Sat Feb 08, 2020 4:05 pm

Re: Unable to get any geometry data from lighthouse v2 (valve)

Post by whizzle »

Hi Kimberly,

thanks for your reply.
I installed serial via pip3.
I changed directory to /crazyflie-firmware$ and executed:

python3 tools/lighthouse/get_lh2_calib_data.py --dev /dev/ttyACM0

I get the following result in the console:

Connecting to /dev/ttyACM0
Traceback (most recent call last):
File "tools/lighthouse/get_lh2_calib_data.py", line 56, in <module>
ser = serial.Serial(dev, timeout=0.4)
AttributeError: module 'serial' has no attribute 'Serial'
kimberly
Bitcraze
Posts: 749
Joined: Fri Jul 06, 2018 11:13 am

Re: Unable to get any geometry data from lighthouse v2 (valve)

Post by kimberly »

woops sorry. You need to pip3 install pyserial. I have version 3.4 of that package
whizzle
Beginner
Posts: 18
Joined: Sat Feb 08, 2020 4:05 pm

Re: Unable to get any geometry data from lighthouse v2 (valve)

Post by whizzle »

Hi Kimberly,

we did not have to do the calibration, getting the geometry with the old firmware was enough ;-)
kristoffer
Bitcraze
Posts: 479
Joined: Tue Jun 30, 2015 7:47 am

Re: Unable to get any geometry data from lighthouse v2 (valve)

Post by kristoffer »

Hi!

You will need the calibration data to get reasonably good results. The documentation has been updated and will hopefully help you out. Please see https://www.bitcraze.io/documentation/r ... etting_up/
Johannes214
Beginner
Posts: 13
Joined: Tue Nov 03, 2020 12:52 pm

Re: Unable to get any geometry data from lighthouse v2 (valve)

Post by Johannes214 »

Hi Kristoffer,

I am trying to do the calibration with that documentation as well.
When I try to run the persist, I get this error:
ImportError: cannot import name 'LighthouseBsCalibration'
According the persist file, that file is imported from cflib.crazyflie.mem.
But such file doesn´t seem to exist in the mem folder.
I this due to recent changes in the lighthouse system and will be fixed in time or I am doing something wrong here?
kristoffer
Bitcraze
Posts: 479
Joined: Tue Jun 30, 2015 7:47 am

Re: Unable to get any geometry data from lighthouse v2 (valve)

Post by kristoffer »

Hi,
it has been added recently, you probably have to pull in the latest version of the python lib from github.

It is here https://github.com/bitcraze/crazyflie-l ... y#L99-L150
Post Reply