[CLOSED] Lighthouse Position always at zero for CF

Discussions related to positioning systems where the position is calculated outside the Crazyflie and sent to the device using radio, including MoCap systems
Post Reply
mouhyemen
Beginner
Posts: 9
Joined: Sun Feb 02, 2020 5:24 pm

[CLOSED] Lighthouse Position always at zero for CF

Post by mouhyemen » Thu Feb 13, 2020 4:14 pm

I am not getting any position/pose info on CF from Lighthouse. I am working w/ CF starter kit, 2 HTC cameras, 1 controller. I did the following:

Camera setup and controller pose: I set up the vive HTC cameras along with the controller based on these 2 links:
  • I then ran the script from triad_openvr to receive the controller's pose. It worked.

    Code: Select all

    python3 controller_test.py
Now to get CF pose: I opened CFclient and flashed the latest firmware. I also flew it around a bit using a gaming controller.
  • I ran the following to get the coordinates, then update baseStationsGeometry[] and comment out DISABLE_LIGHTHOUSE_DRIVER

    Code: Select all

    python3 -m pip install openvr
    cd tools\lighthouse
    python3 get_bs_position.py
    I then flashed the changes onto CF using the radio dongle in bootloader mode using:

    Code: Select all

    make
    make cload
    After flashing, CF's propellers all spun in the customary way it does whenever you power it on.
  • The LED light on Lighthouse deck does the following sequence with Blue/RedYellow: On/On/On -> On/On/Off -> On/Off/Off. So, I guess that's the signal it worked. I read this thread to inquire more.
  • I keep CF stationary and open the CFclient's logging window and plot the following:
    • lighthouse.x/y/z: always at 0
    • lighthouse.angle0x/0y/1x/1y: I receive values
    • lighthouse.setRt: I receive around ~1200 pulses per second.
Note: I always keep my vive controller connected using USB cable to my computer. If I remove it I am not able to access Lighthouse cameras.

Is this necessary even if the CF w/ lighthouse deck is in the FoV of HTC cameras? If I don't connect HTC controller, then SteamVR does not show the 2 cameras detected.

Is there any missing step in the sequence? I do not know what else to do to track CF.
Last edited by mouhyemen on Tue Feb 18, 2020 4:14 pm, edited 1 time in total.



kimberly
Bitcraze
Posts: 369
Joined: Fri Jul 06, 2018 11:13 am

Re: Lighthouse Position always at zero for CF

Post by kimberly » Fri Feb 14, 2020 9:25 am

Hi!

That might be because now in the firmware, the lighthouse deck driver does not estimate the position directly as default, but sends the sweep angles to the Kalman filter, which actually outputs the position. Have you tried looking at the kalman logging variables, if you can see any change in the position there?

But if you want to see the direct estimated position from the lighthouse deck driver, you can set the parameter 'lighthouse.estimatedMethod' to 0 and it will use the old cross beam method again.

mouhyemen
Beginner
Posts: 9
Joined: Sun Feb 02, 2020 5:24 pm

Re: Lighthouse Position always at zero for CF

Post by mouhyemen » Sun Feb 16, 2020 11:15 pm

My console window shows the following:
console_cf.png
This is what I get when I log kalman.stateX/Y/Z.
kalman_stateXYZ.png
I moved the cf around with my hands (not w/ a joystick or motors turned on).
The altitude position is showing negative values. I don't get why is that. Where's the origin located? Is it one of the base stations?

tobias
Bitcraze
Posts: 2013
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Lighthouse Position always at zero for CF

Post by tobias » Mon Feb 17, 2020 1:19 pm

The origin of the lighthouse coordinate system depends on how you calibrated it. If you used a tracker to calibrate the system I think the origin ends up at one of the two base stations and then your graph makes sense.

kimberly
Bitcraze
Posts: 369
Joined: Fri Jul 06, 2018 11:13 am

Re: Lighthouse Position always at zero for CF

Post by kimberly » Mon Feb 17, 2020 3:47 pm

Tobias is indeed right. If you are using a tracker instead of a HDM, have you read the note section in https://wiki.bitcraze.io/doc:lighthouse ... _crazyflie ? This is to place the origin of the coordinate system at the location of your tracker.

mouhyemen
Beginner
Posts: 9
Joined: Sun Feb 02, 2020 5:24 pm

Re: Lighthouse Position always at zero for CF

Post by mouhyemen » Mon Feb 17, 2020 5:38 pm

Yes, I read that.
... you can open the get_bs_position.py script and modify the top of it to set “CENTER_AROUND_CONTROLLER = True”. Be aware that this will put the SteamVR and your space out of sync, so none of the example using the SteamVR coordinate will work correctly.
Reading that, I assumed certain examples will not work correctly. So I did not risk modifying anything.

Correct me if my understanding is wrong then.

Since I am using a tracker (and not HMD), I need to modify line #13 https://github.com/bitcraze/crazyflie-f ... ion.py#L13 to True. Now, if I place my tracker on the floor, that will be marked as the new origin for my system [0, 0, 0]. So placing the cf over here should ideally report values close to [0, 0, 0]. Right? And hopefully this would also address the ESTKALMAN out of bounds as reported on my console log?

kimberly
Bitcraze
Posts: 369
Joined: Fri Jul 06, 2018 11:13 am

Re: Lighthouse Position always at zero for CF

Post by kimberly » Tue Feb 18, 2020 8:55 am

Hi,

Actually, we believe that this warning is about any scripts from steamVR or using the steamVR, but not for our crazyflie examples. I don't see a reason why it should not work with center_around_controller = true.

Give it a go and let us know if it works out.

mouhyemen
Beginner
Posts: 9
Joined: Sun Feb 02, 2020 5:24 pm

Re: [CLOSED] Lighthouse Position always at zero for CF

Post by mouhyemen » Tue Feb 18, 2020 4:14 pm

Thanks guys. It worked.

Simply had to set "CENTER_AROUND_CONTROLLER = True".

Here's the new kalman state positions.
cf_origin_controller.png
I think the topic can be closed.

kimberly
Bitcraze
Posts: 369
Joined: Fri Jul 06, 2018 11:13 am

Re: [CLOSED] Lighthouse Position always at zero for CF

Post by kimberly » Wed Feb 19, 2020 9:01 am

Great! Thanks for sharing

Post Reply