Query regarding lighthouse get_bs_geometry.py

Discussions about all things Bitcraze
Post Reply
imranmomtaz
Member
Posts: 36
Joined: Tue Mar 17, 2020 7:01 pm

Query regarding lighthouse get_bs_geometry.py

Post by imranmomtaz »

Hello,

I have trying to setup the lighthouse with my crazyflie 2.1 and so far, I have been able to setup the cfclient, and the radioPA link. I was following the steps given in https://github.com/bitcraze/crazyflie-f ... verview.md and after running

Code: Select all

tools/lighthouse/get_bs_geometry.py --uri radio://0/80/2M
I get the following:

Code: Select all

$ tools/lighthouse/get_bs_geometry.py --uri radio://0/80/2M
Connecting to radio://0/80/2M
Connected to radio://0/80/2M
Reading sensor data...
Traceback (most recent call last):
  File "tools/lighthouse/get_bs_geometry.py", line 335, in <module>
    sensor_sweeps_all = read_sensors(scf)
  File "tools/lighthouse/get_bs_geometry.py", line 94, in read_sensors
    with SyncLogger(scf, confs) as logger:
  File "/home/momtaz/.local/lib/python3.6/site-packages/cflib/crazyflie/syncLogger.py", line 113, in __enter__
    self.connect()
  File "/home/momtaz/.local/lib/python3.6/site-packages/cflib/crazyflie/syncLogger.py", line 72, in connect
    self._cf.log.add_config(config)
  File "/home/momtaz/.local/lib/python3.6/site-packages/cflib/crazyflie/log.py", line 453, in add_config
    raise KeyError('Variable {} not in TOC'.format(var.name))
KeyError: 'Variable lighthouse.angle0x not in TOC'
Can you please let me know what I am missing and how I can correct this? Thanks a lot!
kristoffer
Bitcraze
Posts: 630
Joined: Tue Jun 30, 2015 7:47 am

Re: Query regarding lighthouse get_bs_geometry.py

Post by kristoffer »

Hi!

It looks like your Crazyflie firmware was not compiled for the Lighthouse deck compile flag. You need to compile the firmware with CFLAGS += -DDISABLE_LIGHTHOUSE_DRIVER=0 set in your config.mk file.

You can read more about how to make and the config.mk file in https://www.bitcraze.io/docs/crazyflie- ... tructions/
tvlqr
Beginner
Posts: 4
Joined: Thu Mar 19, 2020 5:13 am

Re: Query regarding lighthouse get_bs_geometry.py

Post by tvlqr »

I am having the same issue here. I have added a config.mk and managed to compile and upload the firmware. I also printed CFLAGS in Makefile to make sure my config.mk was really taking effects. Here is my output after running make:

Code: Select all

$CFLAGS is [-DDISABLE_LIGHTHOUSE_DRIVER=0 ]
$CFLAGS is [-DDISABLE_LIGHTHOUSE_DRIVER=0 ]
  CLEAN_VERSION
$CFLAGS is [-DDISABLE_LIGHTHOUSE_DRIVER=0 ]
  VTMPL version.c
  CC    version.o
  LD    cf2.elf
  COPY  cf2.hex
  COPY  cf2.bin
  DFUse cf2.dfu
$CFLAGS is [-DDISABLE_LIGHTHOUSE_DRIVER=0 ]
Build for the CF2 platform!
Build 45:9e47ecfe6967 (2020.02 +45) MODIFIED
Version extracted from git
Crazyloader build!
$CFLAGS is [-DDISABLE_LIGHTHOUSE_DRIVER=0 ]
   text	   data	    bss	    dec	    hex	filename
 200104	   4784	 109032	 313920	  4ca40	cf2.elf
and here is my output after running "tools/lighthouse/get_bs_geometry.py --uri radio://0/80/2M"

Code: Select all

Connecting to radio://0/80/2M
Connected to radio://0/80/2M
Reading sensor data...
Traceback (most recent call last):
  File "tools/lighthouse/get_bs_geometry.py", line 335, in <module>
    sensor_sweeps_all = read_sensors(scf)
  File "tools/lighthouse/get_bs_geometry.py", line 94, in read_sensors
    with SyncLogger(scf, confs) as logger:
  File "/home/taodu/projects/aerial_robots/crazyflie-lib-python/cflib/crazyflie/syncLogger.py", line 113, in __enter__
    self.connect()
  File "/home/taodu/projects/aerial_robots/crazyflie-lib-python/cflib/crazyflie/syncLogger.py", line 72, in connect
    self._cf.log.add_config(config)
  File "/home/taodu/projects/aerial_robots/crazyflie-lib-python/cflib/crazyflie/log.py", line 453, in add_config
    raise KeyError('Variable {} not in TOC'.format(var.name))
KeyError: 'Variable lighthouse.angle0x not in TOC'
Is there any other reason that could cause this error?

In case this is helpful for debugging: I was using 1 HTC VIVE base stations (this one: https://www.vive.com/us/accessory/base-station/) and an Ubuntu 18.04 PC. My crazyflie version is 2.1. For the base station, I just plugged in the power adaptor and saw the green light and a 3 x 3 red array on it. I didn't do any setup for the base station on my PC. Did I miss any steps on the hardware side?

---- EDIT ----
I managed to resolve this error by replacing

Code: Select all

#ifndef DISABLE_LIGHTHOUSE_DRIVER
  #define DISABLE_LIGHTHOUSE_DRIVER 1
#endif
with

Code: Select all

#ifndef DISABLE_LIGHTHOUSE_DRIVER
  #define DISABLE_LIGHTHOUSE_DRIVER 0
#endif
in crazyflie-firmware/src/deck/drivers/src/lighthouse.c. It seems that the macro definition "-DDISABLE_LIGHTHOUSE_DRIVER=0" in my config.mk did not come through, which was a surprise to me because I did print out the value of CFLAGS in Makefile and noticed -DDISABLE_LIGHTHOUSE_DRIVER=0.

----- EDIT2 -----
I think I figured the problem: I first compiled the default firmware then created config.mk for my lighthouse, but I didn't use 'make clean' before I make the new firmware. Once I ran 'make clean' and re-make, everything now works as expected.
kimberly
Bitcraze
Posts: 1050
Joined: Fri Jul 06, 2018 11:13 am

Re: Query regarding lighthouse get_bs_geometry.py

Post by kimberly »

Thanks for notifying the forum on your fix of your problem! Let us know if you experience any other problems
Post Reply