I have checked that the Firewall is not the problem.
I am using Motive 2.2.0.
I have tried with Mavproxy both an Linux and on Windows and the output is the following: On Linux
I get optitrack [Errno 11] Resource temporarily unavailable
On Windows
I don’t get any output on mavproxy but I am almost sure that its not working properly.
So far I am looking at the GPS status and I dont get GPS Fix. I have also checked XKF1 message but PE,PD, and PN are 0. Is this the correct way of checking or perhaps is there a way to directly check MAVLINK traffic for ATT_POS_MOCAP messages? Also I do not see any “EKF3 IMU0 is using external nav data” sort of message.
Up to this point I ve tried almost every possible combination and I am not sure how to further debug this. Is this something on my side or possibly a bug on Mavproxy/Firmware? Any recommentations are highly appreciated!
It turns out that the optitrack module can not be used as it is with Arduplane. The reason being, the EKF needs GPS to work properly in Arduplane. Arducopter does not require this. This module feeds postion with ATT_POS_MOCAP mavlink message.
Only way to make it work is build your own module using mavlink library (python version for easier use) and feed position as a fake GPS using the GPS_INPUT message. I tried but at the end couldn’t make the EKF use the GPS’s yaw. Long story short, I admitted defeat.
I’m trying to use the optitrack module with Arducopter. When I ran MavProxy on Windows everything worked fine but now I switched to Linux because I want to do everything on board with Nvidia Jetson Nano. I did everything the same on Linux but when I run the command “optitrack start” i get “optitrack [Errno 11] Resource temporarily unavailable”. Did you find a solution to this regardless of the Arduplane compatibility issue?
No. That’s was my first reason on switching to a custom solution. The error message is quite cryptic and unless you are willing to debug the code from the optitrack module I would say that the most straight forward solution would be to write your own module. Use ATT_POS_MOCAP messages and feed position data with pymavlink library. It ll save you time in the end.
How do you get the position data from Motive and feed it to ATT_POS_MOCAP in your module? I haven’t used the mavlink library before so I would appreicate it if you could share your code with me if you still have it.
Also, do you run your custom module from the Mavproxy terminal? If so, how do you do it? Or should I connect to the vehicle in the mavlink script and do everything there?
Support for mavlink (so for Ardupilot) is the latest development so not documented yet.
Build with
mkdir build && cd build
cmake -D'CLIENTS=mavlink' .. && make
Run with (for example; need to check the arguments yourself)
./mocap2mavlink -s 123 -f 20
Tested in arducopter and works fine.
/clients directory has the “frontend” code where data is received from optitrack and mavlink messages are built and sent
The rest directories contain code for pose calculations and the “backend” code where the API provided by optitrack is used to utilize the communication stream.
Hi, I fixed the problem with not compiling correctly. How can I send the optitrack data to the flight controller via USB connection instead of UDP? I want to stream the optitrack data to the companion computer on my drone and then send it to Pixhawk via USB connection. Does your Mavlink client work with serial connections too or just with UDP connection?
I finally managed to get everything working by using my laptop as the host! Now I am facing another issue with running your code on Nvidia Jetson Orin Nano. When I try to build the environment with ‘make’ command, I get the following error:
/usr/bin/ld: _deps/natnet_sdk_content-src/lib/libNatNet.so: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/client.dir/build.make:132: client] Error 1
make[1]: *** [CMakeFiles/Makefile2:87: CMakeFiles/client.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
This probably happens because the architecture of libNatNet.so is x86-64 but my system is Aarch64. Do you have any idea how I can solve this problem?
Perhaps you are right but never tried it on that architecture so cant really help here.
We use PC as a host always. Maybe involve you laptop in the loop and reroute packets if you cant figure out how to overcome this. I am not even sure if optitrack provides library for that architecture. Have a look at their site.