mje-nz / python_natnet Goto Github PK
View Code? Open in Web Editor NEWPython NatNet client library, supporting protocol version 3 (Motive version 2.0).
License: BSD 3-Clause "New" or "Revised" License
Python NatNet client library, supporting protocol version 3 (Motive version 2.0).
License: BSD 3-Clause "New" or "Revised" License
I've poked around the code a bit and there doesn't seem to be an implementation of sending remote requests/commands as listed on the natnet docs (c# example):
https://v20.wiki.optitrack.com/index.php?title=NatNet:_Remote_Requests/Commands#ErrorCode
Is this at all possible?
If not I'm happy to get started implementing it if you could point me in the right direction on where to get started making changes.
How do you disable the printed debug statements? I'm getting a server echo print statement every second or so that would be great to turn off.
And how does one disable the printed server evaluation at the beginning if you don't want to see the printout?
Thanks!
Hello, running the code I get the following error:
File "/usr/local/lib/python3.5/dist-packages/natnet-0.1.0-py3.5.egg/natnet/comms.py", line 399, in _simple_connect
assert server_info.connection_info.multicast
AssertionError
Is that assertion necessary ? Motive allows to broadcast data in either multicast or unicast mode.
For example, multicast messages are not allowed within my company and thus filtered by the router. I would thus need to use unicast communication.
Thank you
Hello, I am very interested in this project, but how to run these examples?According to your instructions, I'm failed.
I am getting an OSError when running the example. It evidently can see the server, but can't open the socket?
python3 natnet-client-demo.py --server 192.168.0.100
Connecting to 192.168.0.100
Getting server info
Server application: Motive
Server version: Version(major=2, minor=2, build=0, revision=0)
Traceback (most recent call last):
File "natnet-client-demo.py", line 97, in <module>
main()
File "natnet-client-demo.py", line 90, in main
app = ClientApp.connect('fake' if args.fake else args.server, args.rate, args.quiet)
File "natnet-client-demo.py", line 35, in connect
client = natnet.Client.connect(server_name)
File "/home/swarmtestbed/lvctestbed/ros2_ws/src/python_natnet/src/natnet/comms.py", line 418, in connect
return cls._simple_connect(server, logger, timeout)
File "/home/swarmtestbed/lvctestbed/ros2_ws/src/python_natnet/src/natnet/comms.py", line 401, in _simple_connect
return cls._setup_client(conn, server_info, logger)
File "/home/swarmtestbed/lvctestbed/ros2_ws/src/python_natnet/src/natnet/comms.py", line 344, in _setup_client
conn.bind_data_socket(server_info.connection_info.multicast_address,
File "/home/swarmtestbed/lvctestbed/ros2_ws/src/python_natnet/src/natnet/comms.py", line 60, in bind_data_socket
self._data_socket.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)
OSError: [Errno 22] Invalid argument
Hi, unfortunately I am having issues using this library with the newer Motive Tracker Software (2.2.0).
The connection can be established without issue but a new model_type
cannot be handled by this library:
Getting data descriptions
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\natnet-0.1.0-py3.10.egg\natnet\protocol\ModelDefinitionsMessage.py", line 60, in deserialize
impl = self._implementation_types[model_type]
KeyError: 5
resulting in a ValueError: Unknown model definition type
.
I do notice that this library appears to be unmaintained, but as this is so much easier to use I really hope this can be easily fixed, maybe even by myself.
Any input on this would be highly appreciated!
The full log is pasted below:
Connecting to 10.100.25.27
Getting server info
Server application: Motive
Server version: Version(major=2, minor=2, build=0, revision=0)
Synchronizing clocks
First echo: RTT 1.43ms, server time 742.2
Echo 6: RTT 1.02ms (min 1.00ms), server time 742.2s, dt 0.012s, correction 0.259ms, drift 21.993ms/s, new skew: 0.000ms/s
Echo 50: RTT 1.07ms (min 1.00ms), server time 742.3s, dt 0.067s, correction 0.078ms, drift 1.166ms/s, new skew: 0.000ms/s
Echo 76: RTT 1.00ms (min 1.00ms), server time 742.3s, dt 0.042s, correction -0.113ms, drift -2.726ms/s, new skew: 0.000ms/s
Getting data descriptions
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\natnet-0.1.0-py3.10.egg\natnet\protocol\ModelDefinitionsMessage.py", line 60, in deserialize
impl = self._implementation_types[model_type]
KeyError: 5
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\user\Documents\Python Scripts\optitrack\main.py", line 27, in <module>
client = natnet.Client.connect(server_name)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\natnet-0.1.0-py3.10.egg\natnet\comms.py", line 418, in connect
return cls._simple_connect(server, logger, timeout)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\natnet-0.1.0-py3.10.egg\natnet\comms.py", line 401, in _simple_connect
return cls._setup_client(conn, server_info, logger)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\natnet-0.1.0-py3.10.egg\natnet\comms.py", line 354, in _setup_client
model_definitions_message, _ = conn.wait_for_message_with_id(protocol.MessageId.ModelDef)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\natnet-0.1.0-py3.10.egg\natnet\comms.py", line 155, in wait_for_message_with_id
return protocol.deserialize_payload(message_id, payload), received_time
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\natnet-0.1.0-py3.10.egg\natnet\protocol\common.py", line 271, in
deserialize_payload
return _registry.deserialize_payload(*args, **kwargs)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\natnet-0.1.0-py3.10.egg\natnet\protocol\common.py", line 221, in
deserialize_payload
message = message_type.deserialize(payload_data, version)
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\natnet-0.1.0-py3.10.egg\natnet\protocol\ModelDefinitionsMessage.py", line 231, in deserialize
models.append(_registry.deserialize(data, version))
File "C:\Users\user\AppData\Local\Programs\Python\Python310\lib\site-packages\natnet-0.1.0-py3.10.egg\natnet\protocol\ModelDefinitionsMessage.py", line 62, in deserialize
raise ValueError('Unknown model definition type {}'.format(model_type))
ValueError: Unknown model definition type ```
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.