Lighthouse Base Station Position Script Won't Run

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
jamesphopper
Beginner
Posts: 6
Joined: Sun Feb 02, 2020 11:37 pm

Lighthouse Base Station Position Script Won't Run

Post by jamesphopper » Tue Feb 04, 2020 2:02 am

Hello again!

I have my HTC controller and (2) stations tracking, and I installed Openvr with 'python3 -m pip install openvr'. Per wiki instructions, I edited the script to center the space on the controller, but when I try to run it this is the message I get:

python3: can't open file 'get_bs_position.py': [Errno 2] No such file or directory

And then when I open a terminal at the script file itself and try to run the script:

bitcraze@ubuntu:~/projects/crazyflie-firmware/tools/lighthouse$ python3 get_bs_position.py
Opening OpenVR
Unable to read VR Path Registry from /home/bitcraze/.config/openvr/openvrpaths.vrpath
Traceback (most recent call last):
File "get_bs_position.py", line 16, in <module>
vr = openvr.init(openvr.VRApplication_Other)
File "/home/bitcraze/.local/lib/python3.6/site-packages/openvr/__init__.py", line 6906, in init
initInternal2(applicationType, pStartupInfo)
File "/home/bitcraze/.local/lib/python3.6/site-packages/openvr/__init__.py", line 7038, in initInternal2
openvr.error_code.InitError.check_error_value(error.value)
File "/home/bitcraze/.local/lib/python3.6/site-packages/openvr/error_code/__init__.py", line 23, in check_error_value
raise error_class(error_value, message)
openvr.error_code.InitError_Init_PathRegistryNotFound
bitcraze@ubuntu:~/projects/crazyflie-firmware/tools/lighthouse$

I'm very new to coding, so all apologies if the answer is already staring me in face. Please help!

p.s. report from installing openvr looks like this:

bitcraze@ubuntu:~$ python3 -m pip install openvr
Collecting openvr
Installing collected packages: openvr
Successfully installed openvr-1.9.1601



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

Re: Lighthouse Base Station Position Script Won't Run

Post by kristoffer » Tue Feb 04, 2020 7:57 am

Hi!

The first problem is easy to solve (if I understand it correctly)
python3: can't open file 'get_bs_position.py': [Errno 2] No such file or directory
If you are running the script from the root of the crazyflie firmware file tree (in a terminal), you need to add the path to the script file

Code: Select all

python3 tools/lighthouse/get_bs_position.py
It should work to run it from the tools/lighthouse directory as well, like you did, so there seems to be some other issue as well.

First question is if you have set up Steam VR according to the steps in http://help.triadsemi.com/en/articles/8 ... out-an-hmd?

Secondly, the Steam VR application must be up and running when you call the get_bs_position.py script.

jamesphopper
Beginner
Posts: 6
Joined: Sun Feb 02, 2020 11:37 pm

Re: Lighthouse Base Station Position Script Won't Run

Post by jamesphopper » Tue Feb 04, 2020 7:44 pm

Hello, thanks for responding-

I got the stations and htc controller to track with the triadsemi instructions; its py test script gives me telemetry for the htc.

And I have Steam VR open/showing green stations and a controller when I try to run the get_position script. It seems I can’t pair the controller in Steam VR without an HMD, but I don’t remember seeing pairing as requisite. Did I miss a step here?

Also for context, I’m running Steam VR on the windows desktop instead of the vm, and I don’t have the regular Steam program open.

Annnnnd, I reinstalled the vm and updated all projects before submitting my original post, so I’m all up to date there.

Thanks for you help!

jamesphopper
Beginner
Posts: 6
Joined: Sun Feb 02, 2020 11:37 pm

Re: Lighthouse Base Station Position Script Won't Run

Post by jamesphopper » Wed Feb 05, 2020 3:21 am

Ok-

After reviewing the lighthouse wiki, I realized the get_bs_position script should to run on the VR machine and not the VM. Which in my case, the VR would be the Windows environment.

But when I run it from the windows cmd, this is what I get:

Code: Select all

C:\Users\james> py Desktop/crazyflie-firmware-master/tools/lighthouse/get_bs_position.py
Traceback (most recent call last):
  File "Desktop/crazyflie-firmware-master/tools/lighthouse/get_bs_position.py", line 11, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy' 
Soooo...I guess the question now is: where's numpy? :?

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

Re: Lighthouse Base Station Position Script Won't Run

Post by kimberly » Wed Feb 05, 2020 8:32 am

Hi!

So if you run a python script, and you get a ModuleNotFoundError, it means that you are missing a python module/package called numpy (which is a common package that you would often use anyway with python :) ). You will need to look online on how to install this package (we usually use PIP for this)

This is going to be interesting, because actually we never tried working with the lighthouse system on a windows machine before. Please keep us up to date so that we can see which extra steps are necessary to get it to run on windows. We might need to recreate what you are trying to do on a windows machine...

jamesphopper
Beginner
Posts: 6
Joined: Sun Feb 02, 2020 11:37 pm

Re: Lighthouse Base Station Position Script Won't Run

Post by jamesphopper » Mon Feb 10, 2020 8:51 pm

Hello!

Yeah- after posting, I felt a little daft for not taking the code at face value and finding that NumPy module. I appreciate you all taking the time to help me with these basic questions.

As for extra steps for Windows, I think that's the only thing: the exe Windows installer from Python.org doesn't include the NumPy module. But that's easy enough to get with our good friend pip installer.

The syntax differences between a Windows Cmd/Python Shell and your VM's Linux Cmd/Python shell could cause a little confusion for those new to coding, as it did to me for a hot minute. Or maybe they're not that different, and I'm still a little confused. Case in point :)

One quirk to the Windows setup w/o HMD is that SteamVR will revert back to requiring a HMD after a couple of openings. But the OpenVR config script you edit with the triadsemi instructions warns you that it will try to update itself, so fair game I guess. The edited config script disappears at this point, but I've just deinstalled the OpenVR tool and repeated the process in the instructions to get it back.

Which brings me to a last question to close up this thread. I decided, perhaps naively, to use the Windows desktop to set up the vive base stations (while flying cf's from the bitcraze VM) because the wiki says the VR computer isn't required after set up. I also read this to mean that once you've edited/uploaded the base stations' locations into the cf firmware, there's no need for the OpenVR app to run at all. Assuming the stations don't move, give green lights and keep their same 'b' and 'c' designations, we're good to fly. Am I correct in this reading?

thanks again!

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

Re: Lighthouse Base Station Position Script Won't Run

Post by kristoffer » Tue Feb 11, 2020 8:31 am

Which brings me to a last question to close up this thread. I decided, perhaps naively, to use the Windows desktop to set up the vive base stations (while flying cf's from the bitcraze VM) because the wiki says the VR computer isn't required after set up. I also read this to mean that once you've edited/uploaded the base stations' locations into the cf firmware, there's no need for the OpenVR app to run at all. Assuming the stations don't move, give green lights and keep their same 'b' and 'c' designations, we're good to fly. Am I correct in this reading?
Yes, correct. No need for the VR computer after the base station positions have been found.

In the future we hope it will be possible to use the Crazyflie for estimating the base station positions and get rid of the need for any external hardware at all, but we are unfortunately not there yet.

Post Reply