DTrackSDK  v2.9.0
example_universal.cpp
1 /* DTrackSDK in C++: example_universal.cpp
2  *
3  * C++ example using universal DTrackSDK constructor for all modes.
4  *
5  * Copyright (c) 2019-2024 Advanced Realtime Tracking GmbH & Co. KG
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  * 3. Neither the name of copyright holder nor the names of its contributors
16  * may be used to endorse or promote products derived from this software
17  * without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  *
30  * Purpose:
31  * - example with or without DTrack2/DTRACK3 remote commands
32  * - in communicating mode: starts measurement, collects some frames and stops measurement again
33  * - in listening mode: please start measurement manually e.g. in DTrack frontend application
34  * - for DTrackSDK v2.9.0 (or newer)
35  */
36 
37 #include "DTrackSDK.hpp"
38 
39 #include <iostream>
40 #include <iomanip>
41 
42 // global DTrackSDK
43 static DTrackSDK* dt = NULL;
44 
45 // prototypes
46 static void output_to_console();
47 static bool data_error_to_console();
48 static void messages_to_console();
49 
50 
54 int main( int argc, char** argv )
55 {
56  if ( argc != 2 )
57  {
58  std::cout << "Usage: example_universal [<server host/ip>:]<data port>[:fw]" << std::endl;
59  return -1;
60  }
61 
62  // initialization:
63 
64  dt = new DTrackSDK( (const char *)argv[ 1 ] );
65 
66  if ( ! dt->isValid() )
67  {
68  if ( ! dt->isDataInterfaceValid() )
69  {
70  std::cout << "DTrackSDK fatal error: initializing data interface" << std::endl;
71  }
72  else if ( ! dt->isCommandInterfaceValid() )
73  {
74  std::cout << "DTrackSDK error: cannot connect to ATC" << std::endl;
75  }
76  else if ( ! dt->isCommandInterfaceFullAccess() ) // ensure full access for DTrack2/3 commands, if in communicating mode
77  {
78  std::cout << "DTrackSDK error: full access to ATC required" << std::endl;
79  } // maybe DTrack2/DTRACK3 frontend is still connected to ATC
80 
81  delete dt;
82  return -3;
83  }
84 
85  std::cout << "Connected to ATC '" << argv[ 1 ] << "', listening at local data port " << dt->getDataPort() << std::endl;
86 
87 // dt->setCommandTimeoutUS( 30000000 ); // NOTE: change here timeout for exchanging commands, if necessary
88 // dt->setDataTimeoutUS( 3000000 ); // NOTE: change here timeout for receiving tracking data, if necessary
89 // dt->setDataBufferSize( 100000 ); // NOTE: change here buffer size for receiving tracking data, if necessary
90 
91  // measurement:
92 
93  if ( dt->isCommandInterfaceValid() )
94  {
95  if ( ! dt->startMeasurement() ) // start measurement
96  {
97  std::cout << "Measurement start failed!" << std::endl;
98  data_error_to_console();
99  messages_to_console();
100  delete dt;
101  return -4;
102  }
103  }
104 
105  int count = 0;
106  while ( count++ < 1000 ) // collect 1000 frames
107  {
108  if ( dt->receive() )
109  {
110  output_to_console();
111  }
112  else
113  {
114  data_error_to_console();
115  if ( dt->isCommandInterfaceValid() ) messages_to_console();
116  }
117 
118  if ( ( count % 100 == 1 ) && dt->isCommandInterfaceValid() )
119  messages_to_console();
120  }
121 
122  if ( dt->isCommandInterfaceValid() )
123  {
124  dt->stopMeasurement(); // stop measurement
125  messages_to_console();
126  }
127 
128  delete dt; // clean up
129  return 0;
130 }
131 
132 
136 static void output_to_console()
137 {
138  std::cout.precision( 3 );
139  std::cout.setf( std::ios::fixed, std::ios::floatfield );
140 
141  std::cout << std::endl << "frame " << dt->getFrameCounter() << " ts " << dt->getTimeStamp()
142  << " ets " << dt->getTimeStampSec() << "." << std::setfill( '0' ) << std::setw( 6 ) << dt->getTimeStampUsec()
143  << " lat " << dt->getLatencyUsec()
144  << std::endl;
145 
146  std::cout << " nbod " << dt->getNumBody() << " nfly " << dt->getNumFlyStick()
147  << " nmea " << dt->getNumMeaTool() << " nmearef " << dt->getNumMeaRef()
148  << " nhand " << dt->getNumHand() << " nmar " << dt->getNumMarker()
149  << " nhuman " << dt->getNumHuman() << " ninertial " << dt->getNumInertial()
150  << " status " << ( dt->isStatusAvailable() ? "yes" : "no" )
151  << std::endl;
152 
153  // Standard bodies:
154  for ( int i = 0; i < dt->getNumBody(); i++ )
155  {
156  const DTrackBody* body = dt->getBody( i );
157  if ( body == NULL )
158  {
159  std::cout << "DTrackSDK fatal error: invalid body id " << i << std::endl;
160  break;
161  }
162 
163  if ( ! body->isTracked() )
164  {
165  std::cout << "bod " << body->id << " not tracked" << std::endl;
166  }
167  else
168  {
169  std::cout << "bod " << body->id << " qu " << body->quality
170  << " loc " << body->loc[ 0 ] << " " << body->loc[ 1 ] << " " << body->loc[ 2 ]
171  << " rot " << body->rot[ 0 ] << " " << body->rot[ 1 ] << " " << body->rot[ 2 ]
172  << " " << body->rot[ 3 ] << " " << body->rot[ 4 ] << " " << body->rot[ 5 ]
173  << " " << body->rot[ 6 ] << " " << body->rot[ 7 ] << " " << body->rot[ 8 ]
174  << std::endl;
175 
176  DTrackQuaternion quat = body->getQuaternion();
177  std::cout << "bod " << body->id << " quatw " << quat.w
178  << " quatxyz " << quat.x << " " << quat.y << " " << quat.z << std::endl;
179  }
180  }
181 
182  // A.R.T. Flysticks:
183  for ( int i = 0; i < dt->getNumFlyStick(); i++ )
184  {
185  const DTrackFlyStick* flystick = dt->getFlyStick( i );
186  if ( flystick == NULL )
187  {
188  std::cout << "DTrackSDK fatal error: invalid Flystick id " << i << std::endl;
189  break;
190  }
191 
192  if ( ! flystick->isTracked() )
193  {
194  std::cout << "fly " << flystick->id << " not tracked" << std::endl;
195  }
196  else
197  {
198  std::cout << "flystick " << flystick->id << " qu " << flystick->quality
199  << " loc " << flystick->loc[ 0 ] << " " << flystick->loc[ 1 ] << " " << flystick->loc[ 2 ]
200  << " rot " << flystick->rot[ 0 ] << " " << flystick->rot[ 1 ] << " " << flystick->rot[ 2 ]
201  << " " << flystick->rot[ 3 ] << " " << flystick->rot[ 4 ] << " " << flystick->rot[ 5 ]
202  << " " << flystick->rot[ 6 ] << " " << flystick->rot[ 7 ] << " " << flystick->rot[ 8 ]
203  << std::endl;
204  }
205 
206  std::cout << " btn";
207  for ( int j = 0; j < flystick->num_button; j++ )
208  {
209  std::cout << " " << flystick->button[ j ];
210  }
211  std::cout << " joy";
212  for ( int j = 0; j < flystick->num_joystick; j++ )
213  {
214  std::cout << " " << flystick->joystick[ j ];
215  }
216  std::cout << std::endl;
217  }
218 
219  // Measurement tools:
220  for ( int i = 0; i < dt->getNumMeaTool(); i++ )
221  {
222  const DTrackMeaTool* meatool = dt->getMeaTool( i );
223  if ( meatool == NULL )
224  {
225  std::cout << "DTrackSDK fatal error: invalid Measurement tool id " << i << std::endl;
226  break;
227  }
228 
229  if ( ! meatool->isTracked() )
230  {
231  std::cout << "mea " << meatool->id << " not tracked" << std::endl;
232  }
233  else
234  {
235  std::cout << "mea " << meatool->id << " qu " << meatool->quality
236  << " loc " << meatool->loc[ 0 ] << " " << meatool->loc[ 1 ] << " " << meatool->loc[ 2 ]
237  << " rot " << meatool->rot[ 0 ] << " " << meatool->rot[ 1 ] << " " << meatool->rot[ 2 ]
238  << " " << meatool->rot[ 3 ] << " " << meatool->rot[ 4 ] << " " << meatool->rot[ 5 ]
239  << " " << meatool->rot[ 6 ] << " " << meatool->rot[ 7 ] << " " << meatool->rot[ 8 ]
240  << std::endl;
241  }
242 
243  if ( meatool->tipradius > 0.0 )
244  {
245  std::cout << " radius " << meatool->tipradius << std::endl;
246  }
247 
248  if ( meatool->num_button > 0 )
249  {
250  std::cout << " btn";
251  for ( int j = 0; j < meatool->num_button; j++ )
252  {
253  std::cout << " " << meatool->button[ j ];
254  }
255  std::cout << std::endl;
256  }
257  }
258 
259  // Measurement references:
260  for ( int i = 0; i < dt->getNumMeaRef(); i++ )
261  {
262  const DTrackMeaRef* mearef = dt->getMeaRef( i );
263  if ( mearef == NULL )
264  {
265  std::cout << "DTrackSDK fatal error: invalid Measurement reference id " << i << std::endl;
266  break;
267  }
268 
269  if ( ! mearef->isTracked() )
270  {
271  std::cout << "mearef " << mearef->id << " not tracked" << std::endl;
272  }
273  else
274  {
275  std::cout << "mearef " << mearef->id << " qu " << mearef->quality
276  << " loc " << mearef->loc[ 0 ] << " " << mearef->loc[ 1 ] << " " << mearef->loc[ 2 ]
277  << " rot " << mearef->rot[ 0 ] << " " << mearef->rot[ 1 ] << " " << mearef->rot[ 2 ]
278  << " " << mearef->rot[ 3 ] << " " << mearef->rot[ 4 ] << " " << mearef->rot[ 5 ]
279  << " " << mearef->rot[ 6 ] << " " << mearef->rot[ 7 ] << " " << mearef->rot[ 8 ]
280  << std::endl;
281  }
282  }
283 
284  // Single markers:
285  for ( int i = 0; i < dt->getNumMarker(); i++ )
286  {
287  const DTrackMarker* marker = dt->getMarker( i );
288  if ( marker == NULL )
289  {
290  std::cout << "DTrackSDK fatal error: invalid marker index " << i << std::endl;
291  break;
292  }
293 
294  std::cout << "mar " << marker->id << " qu " << marker->quality
295  << " loc " << marker->loc[ 0 ] << " " << marker->loc[ 1 ] << " " << marker->loc[ 2 ]
296  << std::endl;
297  }
298 
299  // A.R.T. FINGERTRACKING hands:
300  for ( int i = 0; i < dt->getNumHand(); i++ )
301  {
302  const DTrackHand* hand = dt->getHand( i );
303  if ( hand == NULL )
304  {
305  std::cout << "DTrackSDK fatal error: invalid FINGERTRACKING id " << i << std::endl;
306  break;
307  }
308 
309  if ( ! hand->isTracked() )
310  {
311  std::cout << "hand " << hand->id << " not tracked" << std::endl;
312  }
313  else
314  {
315  std::cout << "hand " << hand->id << " qu " << hand->quality
316  << " lr " << ( ( hand->lr == 0 ) ? "left" : "right") << " nf " << hand->nfinger
317  << " loc " << hand->loc[ 0 ] << " " << hand->loc[ 1 ] << " " << hand->loc[ 2 ]
318  << " rot " << hand->rot[ 0 ] << " " << hand->rot[ 1 ] << " " << hand->rot[ 2 ]
319  << " " << hand->rot[ 3 ] << " " << hand->rot[ 4 ] << " " << hand->rot[ 5 ]
320  << " " << hand->rot[ 6 ] << " " << hand->rot[ 7 ] << " " << hand->rot[ 8 ]
321  << std::endl;
322 
323  for ( int j = 0; j < hand->nfinger; j++ )
324  {
325  std::cout << " fi " << j
326  << " loc " << hand->finger[ j ].loc[ 0 ] << " " << hand->finger[ j ].loc[ 1 ] << " " << hand->finger[ j ].loc[ 2 ]
327  << " rot " << hand->finger[ j ].rot[ 0 ] << " " << hand->finger[ j ].rot[ 1 ] << " " << hand->finger[ j ].rot[ 2 ]
328  << " " << hand->finger[ j ].rot[ 3 ] << " " << hand->finger[ j ].rot[ 4 ] << " " << hand->finger[ j ].rot[ 5 ]
329  << " " << hand->finger[ j ].rot[ 6 ] << " " << hand->finger[ j ].rot[ 7 ] << " " << hand->finger[ j ].rot[ 8 ]
330  << std::endl;
331  std::cout << " fi " << j
332  << " tip " << hand->finger[ j ].radiustip
333  << " pha " << hand->finger[ j ].lengthphalanx[ 0 ] << " " << hand->finger[ j ].lengthphalanx[ 1 ]
334  << " " << hand->finger[ j ].lengthphalanx[ 2 ]
335  << " ang " << hand->finger[ j ].anglephalanx[ 0 ] << " " << hand->finger[ j ].anglephalanx[ 1 ]
336  << std::endl;
337  }
338  }
339  }
340 
341  // A.R.T human models:
342  if ( dt->getNumHuman() < 1 )
343  {
344  std::cout << "no human model data" << std::endl;
345  }
346 
347  for ( int i = 0; i < dt->getNumHuman(); i++ )
348  {
349  const DTrackHuman* human = dt->getHuman( i );
350  if ( human == NULL )
351  {
352  std::cout << "DTrackSDK fatal error: invalid human model id " << i << std::endl;
353  break;
354  }
355 
356  if ( ! human->isTracked() )
357  {
358  std::cout << "human " << human->id << " not tracked" << std::endl;
359  }
360  else
361  {
362  std::cout << "human " << human->id << " num joints " << human->num_joints << std::endl;
363  for ( int j = 0; j < human->num_joints; j++ )
364  {
365  if ( ! human->joint[ j ].isTracked() )
366  {
367  std::cout << "joint " << human->joint[ j ].id << " not tracked" << std::endl;
368  }
369  else
370  {
371  std::cout << "joint " << human->joint[ j ].id << " qu " << human->joint[j].quality
372  << " loc " << human->joint[ j ].loc[ 0 ] << " " << human->joint[j].loc[ 1 ] << " " << human->joint[ j ].loc[ 2 ]
373  << " rot " << human->joint[ j ].rot[ 0 ] << " " << human->joint[j].rot[ 1 ] << " " << human->joint[ j ].rot[ 2 ]
374  << " " << human->joint[ j ].rot[ 3 ] << " " << human->joint[j].rot[ 4 ] << " " << human->joint[ j ].rot[ 5 ]
375  << " " << human->joint[ j ].rot[ 6 ] << " " << human->joint[j].rot[ 7 ] << " " << human->joint[ j ].rot[ 8 ]
376  << std::endl;
377  }
378  }
379  }
380  std::cout << std::endl;
381  }
382 
383  // Hybrid bodies:
384  if ( dt->getNumInertial() < 1 )
385  {
386  std::cout << "no inertial body data" << std::endl;
387  }
388 
389  for ( int i = 0; i < dt->getNumInertial(); i++ )
390  {
391  const DTrackInertial* inertial = dt->getInertial( i );
392  if ( inertial == NULL )
393  {
394  std::cout << "DTrackSDK fatal error: invalid hybrid body id " << i << std::endl;
395  break;
396  }
397 
398  std::cout << " inertial body " << inertial->id << " st " << inertial->st << " error " << inertial->error << std::endl;
399  if ( inertial->isTracked() )
400  {
401  std::cout << " loc " << inertial->loc[ 0 ] << " " << inertial->loc[ 1 ] << " " << inertial->loc[ 2 ]
402  << " rot " << inertial->rot[ 0 ] << " " << inertial->rot[ 1 ] << " " << inertial->rot[ 2 ]
403  << " " << inertial->rot[ 3 ] << " " << inertial->rot[ 4 ] << " " << inertial->rot[ 5 ]
404  << " " << inertial->rot[ 6 ] << " " << inertial->rot[ 7 ] << " " << inertial->rot[ 8 ]
405  << std::endl;
406  }
407  }
408 
409  // System status:
410  if ( ! dt->isStatusAvailable() )
411  {
412  std::cout << "no system status data" << std::endl;
413  }
414  else
415  {
416  const DTrackStatus* status = dt->getStatus();
417  if ( status == NULL )
418  {
419  std::cout << "DTrackSDK fatal error: invalid system status" << std::endl;
420  }
421  else
422  {
423  // general status values
424  std::cout << "status gen nc " << status->numCameras
425  << " nb " << status->numTrackedBodies << " nm " << status->numTrackedMarkers << std::endl;
426 
427  // message statistics
428  std::cout << "status msg nce " << status->numCameraErrorMessages << " ncw " << status->numCameraWarningMessages
429  << " noe " << status->numOtherErrorMessages << " now " << status->numOtherWarningMessages
430  << " ni " << status->numInfoMessages << std::endl;
431 
432  // camera status values
433  for ( int i = 0; i < status->numCameras; i++ )
434  {
435  std::cout << "status cam " << status->cameraStatus[ i ].idCamera
436  << " ns " << status->cameraStatus[ i ].numReflections
437  << " nu " << status->cameraStatus[ i ].numReflectionsUsed
438  << " mi " << status->cameraStatus[ i ].maxIntensity << std::endl;
439  }
440  }
441  }
442 }
443 
444 
450 static bool data_error_to_console()
451 {
452  bool ret = true;
453 
454  if ( dt->getLastDataError() != DTrackSDK::ERR_NONE )
455  {
457  {
458  std::cout << "--- timeout while waiting for tracking data" << std::endl;
459  }
460  else if ( dt->getLastDataError() == DTrackSDK::ERR_NET )
461  {
462  std::cout << "--- error while receiving tracking data" << std::endl;
463  }
464  else if ( dt->getLastDataError() == DTrackSDK::ERR_PARSE )
465  {
466  std::cout << "--- error while parsing tracking data" << std::endl;
467  }
468 
469  ret = false;
470  }
471 
473  {
475  {
476  std::cout << "--- timeout while waiting for Controller command" << std::endl;
477  }
478  else if ( dt->getLastServerError() == DTrackSDK::ERR_NET )
479  {
480  std::cout << "--- error while receiving Controller command" << std::endl;
481  }
482  else if ( dt->getLastServerError() == DTrackSDK::ERR_PARSE )
483  {
484  std::cout << "--- error while parsing Controller command" << std::endl;
485  }
486 
487  ret = false;
488  }
489 
490  return ret;
491 }
492 
493 
497 static void messages_to_console()
498 {
499  while ( dt->getMessage() )
500  {
501  std::cout << "ATC message: \"" << dt->getMessageStatus() << "\" \"" << dt->getMessageMsg() << "\"" << std::endl;
502  }
503 }
504 
double getTimeStamp() const
Get timestamp since midnight.
int getNumFlyStick() const
Get number of calibrated Flysticks.
double loc[3]
Location (in [mm])
const DTrackFlyStick * getFlyStick(int id) const
Get Flystick data.
const DTrackMeaTool * getMeaTool(int id) const
Get Measurement Tool data.
int getNumBody() const
Get number of calibrated standard bodies (as far as known).
bool receive()
Receive and process one tracking data packet.
Definition: DTrackSDK.cpp:441
bool isStatusAvailable() const
Returns if system status data is available.
double rot[9]
Rotation matrix (column-wise)
double loc[3]
Location (in [mm])
unsigned short getDataPort() const
Get UDP data port where tracking data is received.
Definition: DTrackSDK.cpp:321
int numOtherWarningMessages
Number of other warning messages (since booting)
int lr
Left (0) or right (1) hand.
bool isCommandInterfaceFullAccess()
Returns if TCP connection has full access for DTrack2/DTRACK3 commands.
Definition: DTrackSDK.cpp:341
double loc[3]
Location (in [mm])
double loc[3]
Location (in [mm])
Single marker data (3DOF).
double x
Quaternion component x.
double quality
Quality (0.0 <= qu <= 1.0, no tracking if -1.0)
int getNumHand() const
Get number of calibrated A.R.T. FINGERTRACKING hands (as far as known).
A.R.T. Flystick data (6DOF + buttons).
Hybrid (optical-inertial) body data (6DOF).
double error
Drift error estimate (only during inertial tracking, in [deg])
bool isTracked() const
Returns if joint is currently tracked.
std::vector< DTrackCameraStatus > cameraStatus
Camera status.
double quality
Quality of joint (0.0 <= qu <= 1.0, no tracking if -1.0)
Measurement Tool data (6DOF + buttons).
A.R.T. FINGERTRACKING hand data (6DOF + fingers).
int numInfoMessages
Number of info messages (since booting)
int numTrackedBodies
Number of currently tracked 6DOF bodies.
const DTrackBody * getBody(int id) const
Get standard body data.
bool isTracked() const
Returns if Measurement Tool reference is currently tracked.
struct DTrackSDK_Datatypes::DTrackHuman::DTrackJoint joint[DTRACKSDK_HUMAN_MAX_JOINTS]
Joint data.
double y
Quaternion component y.
int nfinger
Number of fingers (maximum 5)
double quality
Quality (0.0 <= qu <= 1.0, no tracking if -1.0)
double rot[9]
Rotation matrix of outermost phalanx (column-wise)
double loc[3]
Location of tip (in [mm])
int id
ID number (starting with 0)
double quality
Quality (0.0 <= qu <= 1.0, no tracking if -1.0)
const DTrackMeaRef * getMeaRef(int id) const
Get Measurement Tool reference data.
DTrack SDK main class derived from DTrackParser.
Definition: DTrackSDK.hpp:77
int id
ID number (starting with 1)
const DTrackMarker * getMarker(int index) const
Get single marker data.
unsigned int getLatencyUsec() const
Get latency (delay between exposure and sending UDP data in Controller).
int getNumMeaRef() const
Get number of calibrated Measurement Tool references.
double anglephalanx[2]
Angle between phalanxes (order: outermost, innermost; in [deg])
int st
State of hybrid body (0: not tracked, 1: inertial tracking, 2: optical tracking, 3: inertial and opti...
bool isTracked() const
Returns if body is currently tracked.
std::string getMessageStatus() const
Get status of last DTrack2/DTRACK3 event message.
Definition: DTrackSDK.cpp:949
double tipradius
Radius of tip (in [mm]) if applicable.
double rot[9]
Rotation matrix (column-wise)
int numCameraWarningMessages
Number of camera-related warning messages (since booting)
int id
ID number of joint (starting with 0)
int numOtherErrorMessages
Number of other error messages (since booting)
double lengthphalanx[3]
Length of phalanxes (order: outermost, middle, innermost; in [mm])
int getNumMarker() const
Get number of tracked single markers.
double loc[3]
Location of joint (in [mm])
unsigned int getFrameCounter() const
Get frame counter.
double rot[9]
Rotation matrix (column-wise)
unsigned int getTimeStampUsec() const
Get timestamp since Unix epoch (1970-01-01 00:00:00), microseconds.
int id
ID number (starting with 0)
const DTrackHuman * getHuman(int id) const
Get ART-Human model data.
int id
ID number (starting with 0)
Errors getLastServerError() const
Get last error at exchanging commands with Controller (command transmission).
Definition: DTrackSDK.cpp:558
bool isCommandInterfaceValid() const
Returns if TCP connection for DTrack2/DTRACK3 commands is active.
Definition: DTrackSDK.cpp:330
double quality
Quality (0.0 <= qu <= 1.0, no tracking if -1.0)
double quality
Quality (0.0 <= qu <= 1.0, no tracking if -1.0)
unsigned int getTimeStampSec() const
Get timestamp since Unix epoch (1970-01-01 00:00:00), seconds.
double loc[3]
Location of back of the hand (in [mm])
std::string getMessageMsg() const
Get message text of last DTrack2/DTRACK3 event message.
Definition: DTrackSDK.cpp:958
const DTrackHand * getHand(int id) const
Get A.R.T. FINGERTRACKING hand data.
double quality
Quality (0.0 <= qu <= 1.0)
int num_joystick
Number of joystick values.
Timeout occured.
Definition: DTrackSDK.hpp:93
int id
ID number (starting with 0)
int id
ID number (starting with 0)
Error while parsing command.
Definition: DTrackSDK.hpp:95
bool isDataInterfaceValid() const
Returns if UDP socket is open to receive tracking data on local machine.
Definition: DTrackSDK.cpp:310
double rot[9]
Rotation matrix of joint (column-wise) in relation to room coordinate system.
bool getMessage()
Get DTrack2/DTRACK3 event message from the Controller.
Definition: DTrackSDK.cpp:864
const DTrackInertial * getInertial(int id) const
Get hybrid (optical-inertial) data.
Errors getLastDataError() const
Get last error at receiving tracking data (data transmission).
Definition: DTrackSDK.cpp:549
int numCameraErrorMessages
Number of camera-related error messages (since booting)
int getNumInertial() const
Get number of calibrated hybrid (optical-inertial) bodies.
int button[DTRACKSDK_FLYSTICK_MAX_BUTTON]
Button state (1 pressed, 0 not pressed): 0 front, 1..n-1 right to left.
bool stopMeasurement()
Stop measurement.
Definition: DTrackSDK.cpp:615
bool startMeasurement()
Start measurement.
Definition: DTrackSDK.cpp:595
const DTrackStatus * getStatus() const
Get system status data.
bool isTracked() const
Returns if human model is currently tracked.
double rot[9]
Rotation matrix of back of the hand (column-wise)
Measurement Tool reference data (6DOF).
double w
Quaternion component w.
double z
Quaternion component z.
bool isTracked() const
Returns if Measurement Tool is currently tracked.
double rot[9]
Rotation matrix (column-wise)
struct DTrackSDK_Datatypes::DTrackHand::DTrackFinger finger[DTRACKSDK_HAND_MAX_FINGER]
Finger data (order: thumb, index finger, middle finger, ...)
DTrackQuaternion getQuaternion() const
Returns rotation as quaternion.
bool isTracked() const
Returns if Flystick is currently tracked.
int button[DTRACKSDK_MEATOOL_MAX_BUTTON]
Button state (1 pressed, 0 not pressed): 0 point measurement state.
double rot[9]
Rotation matrix (column-wise)
int getNumHuman() const
Get number of calibrated ART-Human models.
bool isTracked() const
Returns if hand is currently tracked.
Network error.
Definition: DTrackSDK.hpp:94
int numTrackedMarkers
Number of currently found additional 3DOF markers.
double loc[3]
Location (in [mm])
Standard body data (6DOF).
double loc[3]
Location (in [mm])
double joystick[DTRACKSDK_FLYSTICK_MAX_JOYSTICK]
Joystick value (-1.0 <= joystick <= 1.0); 0 horizontal, 1 vertical.
bool isTracked() const
Returns if body is currently tracked.
int id
ID number (starting with 0)
int id
ID number of human model (starting with 0)
ART-Human model (joints (6DOF) including optional Fingertracking).
int getNumMeaTool() const
Get number of calibrated Measurement Tools.
bool isValid()
Returns if constructor was successful due to the wanted mode.
Definition: DTrackSDK.cpp:294