Hi,
I'm working with the direct depacketization of the PythonClient.py from NatNet SDK 3.1.
Using the direct depacketization, I have access to:
* CameraMidExposureTimestamp
* CameraDataReceivedTimestamp
* TransmitTimestamp
However, if I want to calculate latency, I need to subtract between the timestamps and then divide the result with the clock frequency (HighResClockFrequency) - but I don't understand how to make a direct depacketization of the HighResClockFrequency from the incoming frame.
In addition, is there an absolute timestamp we can give to the frame, so I'll be able to know when is the exact time that the frame has been captured by the cameras ? (to synchronize the frame with some other frames (like audio frames for example) from a different tool).
Help will be much appreciated,
Thanks,
Joseph
Timestamping in NatNet SDK 3.1
Re: Timestamping in NatNet SDK 3.1
Hi Joseph,
I was looking into this to and the frequency you need seems to be in the Server Description.
Looking the C++ client example in there is a struct that describes the global description of the server.
So we can see, that after the NatNetVersion is grabbed there is a uint64_t representing the clock frequency.
The forum has a few heroes who point out that SERVER_INFO in c++ is the same as a NAT_PINGRESPONSE so looking into the call for the PING_RESPONSE in the Python Client in there I think we can grab the clock frequency by using something like:
I'm playing around with this myself but I think this provides a rough starting point.
I was looking into this to and the frequency you need seems to be in the Server Description.
Looking the C++ client example in
Code: Select all
NatNetTypes.h
Code: Select all
// Mocap server application description
typedef struct sServerDescription
{
bool HostPresent; // host is present and accounted for
char szHostComputerName[MAX_NAMELENGTH];// host computer name
uint8_t HostComputerAddress[4]; // host IP address
char szHostApp[MAX_NAMELENGTH]; // name of host app
uint8_t HostAppVersion[4]; // version of host app
uint8_t NatNetVersion[4]; // host app's version of NatNet
// Clock and connection info is only provided by NatNet 3.0+ servers.
uint64_t HighResClockFrequency; // host's high resolution clock frequency (ticks per second)
bool bConnectionInfoValid; // If the server predates NatNet 3.0, this will be false, and the other Connection* fields invalid.
uint16_t ConnectionDataPort; // The data port this server is configured to use.
bool ConnectionMulticast; // Whether this server is streaming in multicast. If false, connect in unicast instead.
uint8_t ConnectionMulticastAddress[4]; // The multicast group address to use for a multicast connection.
} sServerDescription;
The forum has a few heroes who point out that SERVER_INFO in c++ is the same as a NAT_PINGRESPONSE so looking into the call for the PING_RESPONSE in the Python Client in there I think we can grab the clock frequency by using something like:
Code: Select all
self.__natNetStreamVersion = struct.unpack( 'BBBB', data[offset:offset+4] )
offset += 4
if self.__natNetStreamVersion[0] >= 3:
self.__natNetClockTicks = struct.unpack('Q', data[offset:offset+8])[0]
offset += 8