Consti10 / FPV_VR_OS

Latest version of FPV_VR, open source under LGPL
GNU Lesser General Public License v2.1
66 stars 26 forks source link

How can I use the feature air head tracking? #1

Closed ericma15 closed 3 years ago

ericma15 commented 6 years ago

I want to send my pitch row data to drone. I saw settings air head tracking, I use it but it didn't work. Then I try to view the code . I can't find any code about send data. What should I do? Hope reply soon.

Consti10 commented 6 years ago

Hello ericma15, Sorry for the late reply I am currently having exams at university.

The head tracking feature still has a lot of work left before it is usable - both on the android and EZWB side. Currently, the "enable" option is just a dummy that creates a thread which sends x,y,z 0,0,0 via UDP to the set IP address for testing. Implementing this on android is harder than expected -> e.g. in its current state the UDP sender thread is bound to an android service - but I can't use the GVR head tracking api with that. I can't give a date on when and how this feature will be available, but it has a high priority.

RespawnDespair commented 6 years ago

Any progress to report? I'm keeping an eye on both EZWB and this, but i haven't heard about this feature in a while. I'd be willing to help if needed, i have EZWB running and i have a 2 axis gimbal with the Pi cam. Let me know!

Consti10 commented 6 years ago

Hello RespawnDespair,

I had to change how the head tracking feature works. Implementing it as a service running in the background is not possible using the gvr_api. However, while I haven't tested my code yet it could still be used in a similar pattern: 1) as soon as fpv-vr receives some video data from your ez-wb pi (and head tracking enabled) it stores its IP adress . TEST: You should see a toast telling you that & can also look up / manually change the IP in the network settings

2) When you now start any of the video activities, FPV-VR sends (currently) dummy x,y and z values via UDP to the set IP adress. TEST: You should have a notification (like whatsapp new message) that shows IP, port and send data

What needs to be done: Since I did not feel like that many users actually need head tracking functionality I did not really test it . What needs to be done with FPV-VR a) check if the UDP packets actually make it to the pi (I think there is still something wrong with the UDPSender.cpp ) b) change the values from dummy to actual data

What needs to be done in EZ-WB: a) write a small script that receives the udp head tracking data and pipes it into the rc uplink. Rodizio is probably the only person who knows how to do that :)

If you want to help me with anything of the described above, I can send you the current developement source code of fpv-vr via drive. I don't know if I will upload it to github (open-source) due to copyright concerns. Or the beta version of fpv-vr in the play store (everyone can opt in) also has the newest changes made to the head tracking included

Consti10 commented 6 years ago

I think i will be able to do 1a) and 1b) this weekend

Consti10 commented 6 years ago

Hello, I did a quick test. TEST of the Head tracking feature: 1) connect fpv-vr via tethering to windows pc

2) automatic ip does not work here (since we did not connect to ezwb). get it via ipconfig in windows, then enter it on connect->network->UplinkEZWBIpAdress (e.g.192.168.42.152, ip of your windows pc)

3) Open ncat Command to listen on port 5200 and print received data : ncat -lvu 5200

4) You should see the received data, e.g. screenshot 1

TEST PASSED !

So the only thing left to do is the script for EZ-WB. I also left the dummy data - this makes it easier to test the ezwb script. You can see what's send in AirHeadTrackingServer.java ( I changed it to .java code, not .cpp, since I needed to do the notification in .java anyways)

RespawnDespair commented 6 years ago

Wow, in the time i needed to read the messages, you finished testing. I would be very interested in the source code, i will also try my hand at injecting the data on the EZWB side. This is a really awesome piece of software!

Consti10 commented 6 years ago

Okay, that would be perfect. Please write me an email so I can end you the code. Adress: consti10.100XX@XXXgmail.com (Without the XXX, I added it to confuse these crawlers searching the web for spam adresses :)