## Light House Position question

Discussions related to positioning systems where the position is calculated outside the Crazyflie and sent to the device using radio, including MoCap systems
stupid_moron
Beginner
Posts: 22
Joined: Tue Jan 21, 2020 7:05 am

### Light House Position question

I have followed the steps to run the light house accordingly to https://wiki.bitcraze.io/doc:lighthouse:setup

Upon running the program get_bs_position.py, I get 2 Line of coordinates(2x base station) and 1 line of cordinates for (1x Base Station setup)
the data are:
orgin = {3.8256,0.2836,-0.3367}, .mat = {{0.99997,0.00019,-0.002257,}, {0.0000,0.0999963,0.008581,} ,{0.002257, -0.008581, 0.999961},},}}
.orgin = {0.00,0.00,0.00}, .mat = {{0.99997,0.00019,-0.002257,}, {0.0000,0.0999963,0.008581,} ,{0.002257, -0.008581, 0.999961},},}}

The problem is (for 1x base station and 2x base station setup), no mater where i move the tracker or rotate the orientation of the tracker, the data values does not change.
Am i doing it correctly?

Also, what are the values suppose to mean? The coordinates of the Tracker? Or the coordinates of the base Station, Suppose Mode b Station is cordinate 0,0,0, thus the first line of orgin = {...} is for Mode C Base station? What does the .mat stands for and the following cordinates?

My Setup (for 2x base Station)
2x V1 Base Station (one in mode B, another in Mode C) Placed 2m of exactly opposite of each other
1x HTC Vive Tracker Placed in the mod point of both base staiton, 1m vertically down
Steam VR is running in the back ground

My Setup (for 1x base station)
1x V1 Base Station (in Mode A)
1x HTC Tracker Placed 1m horizontally and 1m verrtically down from base station
Steam VR is running in the background as well.

Side Question, From looking at the code, line 36, there is a "Controller not found, place controller at the orgin of the space"
when i remove the tracker from sight of the base station, It doesnt print Line 36. It just prints:
Opening OpenVR
OpenVR opened
Orgin: { } [0, 0, 0]
----------------------------

"END"
Is this corect?

kristoffer
Bitcraze
Posts: 257
Joined: Tue Jun 30, 2015 7:47 am

### Re: Light House Position question

it looks like you have not set CENTER_AROUND_CONTROLLER = True (see the wiki page)
It centers the coordinate system around the tracker, as opposed to one of the base stations.

The data you get from the script is a vector from the origin of the coordinate system to each base station (.origin) + a rotation matrix describing the orientation of each base station (.mat). Since one of your origins is (0, 0, 0), your coordinate system is centered in one of the base stations. It probably works, but is not very practical.

stupid_moron
Beginner
Posts: 22
Joined: Tue Jan 21, 2020 7:05 am

### Re: Light House Position question

I have set the Centre_position to true.

But no matter which direction i placed it it, it doesnt points to the orginal direction like this video.

I am just doing simple hovering at 1m with the folloing command

for y in range(10)
cf.commander.send_hover_setpoint(0,0,0,1)

kristoffer
Bitcraze
Posts: 257
Joined: Tue Jun 30, 2015 7:47 am

### Re: Light House Position question

You may want to try out our lates addition to the Lighthouse system, see https://github.com/bitcraze/crazyflie-f ... issues/562
It is a script to estimate the base station geometry without Steam VR.
Take a look at tools/lighthouse/get_bs_geometry.py
Note: this script is very new and has not been fully tested.
But no matter which direction i placed it it, it doesnt points to the orginal direction like this video.
It sounds like the Crazyflie does not use the lighthouse deck for positioning. Have you compiled the firmware with

Code: Select all

``CFLAGS += -DDISABLE_LIGHTHOUSE_DRIVER=0``

stupid_moron
Beginner
Posts: 22
Joined: Tue Jan 21, 2020 7:05 am

### Re: Light House Position question

kristoffer wrote:
Thu Mar 05, 2020 9:39 am
But no matter which direction i placed it it, it doesnt points to the orginal direction like this video.
It sounds like the Crazyflie does not use the lighthouse deck for positioning. Have you compiled the firmware with

Code: Select all

``CFLAGS += -DDISABLE_LIGHTHOUSE_DRIVER=0``
Update:

My Setup:
Crazyflie 2.1
Flowdeck v2
lighthouse deck
2x Vive Base Station v1

I duplicated "config.mk.example" and renamed it as "config.mk" (tools/make)
Added "CLAGS += -DDISABLE_LIGHTHOUSE_DRIVER=0" at the bottom of the line.

Went into src/deck/drivers/src/lighthouse.c
Commented the line (//define DISABLED_LIGHTHOUSE DRIVER 1)

Changed the coordinates:
The coordinates value are from placing the lighthouse deck,SteamVR not running in the background, Run the script get_bs_position.py.
Complied the software and upload to CF

Placed Cf at the same exact position. But I still could not replicate the howering pattern like in the video. ):

Any idea where I went wrong?
I followed this: https://www.bitcraze.io/docs/crazyflie- ... _overview/

kristoffer
Bitcraze
Posts: 257
Joined: Tue Jun 30, 2015 7:47 am

### Re: Light House Position question

There might be problems using the Flow deck and Lighthouse decks at the same time, I don't think we have tested that. A first step would be to remove the Flow deck and only use the Lighthouse deck to make sure that works.
I duplicated "config.mk.example" and renamed it as "config.mk" (tools/make)
Added "CLAGS += -DDISABLE_LIGHTHOUSE_DRIVER=0" at the bottom of the line.

Went into src/deck/drivers/src/lighthouse.c
Commented the line (//define DISABLED_LIGHTHOUSE DRIVER 1)
The documentation was been a bit outdated (now updated in https://www.bitcraze.io/docs/crazyflie- ... _overview/). If you set the compile flag in config.mk there is no need to modify the lighthouse.c (should not do any harm though).
The coordinates value are from placing the lighthouse deck,SteamVR not running in the background, Run the script get_bs_position.py.
Complied the software and upload to CF
The script to run in the new procedure is tools/lighthouse/get_bs_geometry.py (not get_bs_position.py)
It uses the Lighthouse deck to estimate the positions of the base stations. I did some further testing yesterday and it seems to work.
Do the coordinates you get, look reasonable compared to your setup? The positions of the base stations is the ".origin" part of the data.

stupid_moron
Beginner
Posts: 22
Joined: Tue Jan 21, 2020 7:05 am

### Re: Light House Position question

I've cloned a fresh Firmware from github and done the following:
Duplicated config.mk.example, renamed it as config.mk (In folder tools/make)
Compile the firmware and uploaded into CF

Ran the script get_BS_geometry.ps
Copied the 2 last 2 lines, Paste into src/deck/drivers/src/lighthouse.c
Complied and uploaded into CF Again

Left the rest of the code as it is.
(CF is placed facing the +X Direction)
Orgin point is about 0.2m off in the x-y Direction and about 0.1m off in the Z-direction

ran flowsequencesync.py script(edited it to just hover at height 0.5m) with CF starting, deliberately pointing in 90degree left (CF is facing in the -Y Direction)

Observed:
CF does not corect it's yaw toward the +ve X Direction

I folowed the steps to the detail, but still unable to obtain any results

Setup:
Crazyflie 2.1
LightHouse deck

stupid_moron
Beginner
Posts: 22
Joined: Tue Jan 21, 2020 7:05 am

### Re: Light House Position question

Any one managed to compile the firmware with just Lighthouse Running and Code that works? So that i am able to try them out?

Or any help in determining why the firmware doens't work?

I have also tried using Logging config of "lighthouse.x", "lighthouse.y" ,"lighthouse.z" and they all returned back 0.0
I have a feeling that the firmware does not process the lighthouse data.

Though running the script get_bs_geometry.ps returns the correct estimation values of accuracy 0.4m in the XY direction and 0.1m accuracy in the Z Direction.

I am not sure how to ineterpret the rotation axis values...

kristoffer
Bitcraze
Posts: 257
Joined: Tue Jun 30, 2015 7:47 am

### Re: Light House Position question

Any one managed to compile the firmware with just Lighthouse Running and Code that works? So that i am able to try them out?
The code should be fine and working for Lighthouse V1.

The best log data to start to look at is the angles detected by the deck. lighthouse.angle0x, lighthouse.angle0y, lighthouse.angle1x, lighthouse.angle1y, lighthouse.angle0x_1 an so on. If the deck is working (and the firmware is compiled correctly) you should see changing angles when moving the deck around.
I have also tried using Logging config of "lighthouse.x", "lighthouse.y" ,"lighthouse.z" and they all returned back 0.0
I have a feeling that the firmware does not process the lighthouse data.
The "lighthouse.x", "lighthouse.y" ,"lighthouse.z" are only valid if you use the "crossing beams" method, lighthouse.estimationMethod=0
I am not sure how to ineterpret the rotation axis values...
The rotation matrixes are probably hard to understand just by looking at them. You can use python to generate a unit vector in the direction of the base station though:

Code: Select all

``````import numpy as np
R=np.array([[0.79721498, -0.004274, 0.60368103], [0.0, 0.99997503, 0.00708], [-0.60369599, -0.005645, 0.79719502]])
np.dot(R, (1, 0, 0))
``````
Where R is

stupid_moron
Beginner
Posts: 22
Joined: Tue Jan 21, 2020 7:05 am

### Re: Light House Position question

Update:

Light house works with the "HL Commander" python coding style. It Does not work the the "Flow" python coding style. I have been using the "Flow" python coding style.

There wasnt much mention in the examples/setup guide. Hope this piece of information helps everyone here!