Optitrack on Raspberry Pi

From Rsewiki
Revision as of 17:03, 12 May 2021 by Jca (talk | contribs) (→‎setup)

Using optitrack and thin NatNet client

Install

Get client from https://github.com/b4be1/packet-client-linux e.g. from the raspberry:

git clone https://github.com/b4be1/packet-client-linux.git
cd packet-client-linux
mkdir build
cd build
cmake ..
make

Raspberry setup

On the raspberry pi set the wireless network to access the dedicated optitrack network

Modify the /etc/wpa_supplicant/wpa_supplicant.conf by adding the network groups, maybe the 5Ghz SSID should have highest priority.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
ctrl_interface_group=0
update_config=1
country=DK

network={
       ssid="asta_optitrack"
       psk="asta2020"
       priority=1
}

network={
       ssid="asta_optitrack_5G"
       psk="asta2020"
       priority=2
}

Restart the network by reboot or just restart the network

sudo /etc/init.d/networking restart

Optitrack setup

In EDIT mode

In 'View' and 'Data streaming pane' select local interface to the IP address of the server and deselect other streaming services (VRPN and Trackd)

Then go live, and assuming there is rigid bodys, streaming should commence

modify source

The NatNet version should be changed - it is hard-coded in source file.

 cd ~/packet-client-linux
 nano PacketClient.cpp

A bit down change the NatNetVersion to 3.1 (to fit Motive version 2.2)

// Versioning
int NatNetVersion[4] = {3, 1, 0, 0};
int ServerVersion[4] = {0, 0, 0, 0};

Compile the client

Compile

cd ~/packet-client-linux/build
make

Run the client

cd ~/packet-client-linux/build
./PacketClient DESKTOP-OVLVRUD.local 192.168.1.136

where DESKTOP-OVLVRUD is the hostname of the optitrack server (in ASTA) and 192.168.1.136 is the IP of the raspberry pi in this case.