Optitrack on Raspberry Pi: Difference between revisions
(→setup) |
|||
Line 76: | Line 76: | ||
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. | 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. | ||
==== Data in client ==== | |||
The client should then print package data on the console, like | |||
Begin Packet | |||
------- | |||
Message ID : 7 | |||
Byte count : 220 | |||
Frame # : 285290 | |||
Marker Set Count : 0 | |||
Rigid Body Count : 1 | |||
ID : 20 | |||
pos: [0.73,0.57,-0.15] | |||
ori: [-0.01,-0.00,1.00,0.02] | |||
Mean marker error: 0.00 | |||
Tracking Valid: True | |||
Skeleton Count : 0 | |||
Labeled Marker Count : 4 | |||
ID : [MarkerID: 1] [ModelID: 20] | |||
pos : [0.72,0.50,-0.15] | |||
size: [0.01] | |||
err: [0.00] | |||
ID : [MarkerID: 2] [ModelID: 20] | |||
pos : [0.78,0.53,-0.14] | |||
size: [0.01] | |||
err: [0.00] | |||
ID : [MarkerID: 3] [ModelID: 20] | |||
pos : [0.74,0.62,-0.15] | |||
size: [0.01] | |||
err: [0.00] | |||
ID : [MarkerID: 4] [ModelID: 20] | |||
pos : [0.66,0.64,-0.15] | |||
size: [0.01] | |||
err: [0.00] | |||
Timestamp : 2377.417 | |||
Mid-exposure timestamp : 12335057189261 | |||
Camera data received timestamp : 12335057223494 | |||
Transmit timestamp : 12335057235053 | |||
End Packet | |||
The data is thus available in the client and should be integrated in the intended application (by further source code editing). |
Revision as of 17:05, 12 May 2021
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.
Data in client
The client should then print package data on the console, like
Begin Packet ------- Message ID : 7 Byte count : 220 Frame # : 285290 Marker Set Count : 0 Rigid Body Count : 1 ID : 20 pos: [0.73,0.57,-0.15] ori: [-0.01,-0.00,1.00,0.02] Mean marker error: 0.00 Tracking Valid: True Skeleton Count : 0 Labeled Marker Count : 4 ID : [MarkerID: 1] [ModelID: 20] pos : [0.72,0.50,-0.15] size: [0.01] err: [0.00] ID : [MarkerID: 2] [ModelID: 20] pos : [0.78,0.53,-0.14] size: [0.01] err: [0.00] ID : [MarkerID: 3] [ModelID: 20] pos : [0.74,0.62,-0.15] size: [0.01] err: [0.00] ID : [MarkerID: 4] [ModelID: 20] pos : [0.66,0.64,-0.15] size: [0.01] err: [0.00] Timestamp : 2377.417 Mid-exposure timestamp : 12335057189261 Camera data received timestamp : 12335057223494 Transmit timestamp : 12335057235053 End Packet
The data is thus available in the client and should be integrated in the intended application (by further source code editing).