sot-talos-balance  2.0.5
Collection of dynamic-graph entities aimed at implementing balance control on talos.
RTProtocol.h
Go to the documentation of this file.
1 #ifndef RTPROTOCOL_H
2 #define RTPROTOCOL_H
3 
4 #include <map>
5 #include <string>
6 #include <vector>
7 
8 #include "Network.h"
9 #include "RTPacket.h"
10 
11 #ifdef _WIN32
12 #pragma warning(disable : 4251)
13 #endif
14 
15 #ifdef EXPORT_DLL
16 #define DLL_EXPORT __declspec(dllexport)
17 #else
18 #define DLL_EXPORT
19 #endif
20 
21 #define DEFAULT_AUTO_DESCOVER_PORT 22226
22 #define WAIT_FOR_DATA_TIMEOUT 5000000 // 5 s
23 
24 class CMarkup;
25 
27  public:
28  static const unsigned int cComponent3d = 0x000001;
29  static const unsigned int cComponent3dNoLabels = 0x000002;
30  static const unsigned int cComponentAnalog = 0x000004;
31  static const unsigned int cComponentForce = 0x000008;
32  static const unsigned int cComponent6d = 0x000010;
33  static const unsigned int cComponent6dEuler = 0x000020;
34  static const unsigned int cComponent2d = 0x000040;
35  static const unsigned int cComponent2dLin = 0x000080;
36  static const unsigned int cComponent3dRes = 0x000100;
37  static const unsigned int cComponent3dNoLabelsRes = 0x000200;
38  static const unsigned int cComponent6dRes = 0x000400;
39  static const unsigned int cComponent6dEulerRes = 0x000800;
40  static const unsigned int cComponentAnalogSingle = 0x001000;
41  static const unsigned int cComponentImage = 0x002000;
42  static const unsigned int cComponentForceSingle = 0x004000;
43  static const unsigned int cComponentGazeVector = 0x008000;
44  static const unsigned int cComponentTimecode = 0x010000;
45  static const unsigned int cComponentSkeleton = 0x020000;
46 
49  : mAnalogChannels(nullptr), mSkeletonGlobalData(false) {}
52  };
53 
54  enum EStreamRate {
55  RateNone = 0,
56  RateAllFrames = 1,
57  RateFrequency = 2,
58  RateFrequencyDivisor = 3
59  };
60 
61  enum ECameraModel {
62  ModelMacReflex = 0,
63  ModelProReflex120 = 1,
64  ModelProReflex240 = 2,
65  ModelProReflex500 = 3,
66  ModelProReflex1000 = 4,
67  ModelOqus100 = 5,
68  ModelOqus300 = 6,
69  ModelOqus300Plus = 7,
70  ModelOqus400 = 8,
71  ModelOqus500 = 9,
72  ModelOqus200C = 10,
73  ModelOqus500Plus = 11,
74  ModelOqus700 = 12,
75  ModelOqus700Plus = 13,
76  ModelOqus600Plus = 14,
77  ModelMiqusM1 = 15,
78  ModelMiqusM3 = 16,
79  ModelMiqusM5 = 17,
80  ModelMiqusSyncUnit = 18,
81  ModelMiqusVideo = 19,
82  ModelMiqusVideoColor = 20
83  };
84 
85  enum ECameraSystemType { Unknown = 0, Oqus = 1, Miqus = 2 };
86 
87  enum ECameraMode { ModeMarker = 0, ModeMarkerIntensity = 1, ModeVideo = 2 };
88 
90  VideoResolution1080p = 0,
91  VideoResolution720p = 1,
92  VideoResolution540p = 2,
93  VideoResolution480p = 3,
94  VideoResolutionNone = 4
95  };
96 
98  VideoAspectRatio16x9 = 0,
99  VideoAspectRatio4x3 = 1,
100  VideoAspectRatio1x1 = 2,
101  VideoAspectRatioNone = 3
102  };
103 
105  ModeShutterOut = 1, // A pulse per frame is sent
110  ModeFixed100Hz
111  };
112 
114  SourceControlPort = 0,
115  SourceIRReceiver = 1,
116  SourceSMPTE = 2,
117  SourceVideoSync = 3,
118  SourceIRIG = 4
119  };
120 
121  enum EAxis { XPos = 0, XNeg = 1, YPos = 2, YNeg = 3, ZPos = 4, ZNeg = 5 };
122 
124  ProcessingNone = 0x0000,
125  ProcessingTracking2D = 0x0001,
126  ProcessingTracking3D = 0x0002,
127  ProcessingTwinSystemMerge = 0x0004,
128  ProcessingSplineFill = 0x0008,
129  ProcessingAIM = 0x0010,
130  Processing6DOFTracking = 0x0020,
131  ProcessingForceData = 0x0040,
132  ProcessingGazeVector = 0x0080,
133  ProcessingExportTSV = 0x0100,
134  ProcessingExportC3D = 0x0200,
135  ProcessingExportMatlabFile = 0x0800,
136  ProcessingExportAviFile = 0x1000,
137  ProcessingPreProcess2D = 0x2000
138  };
139 
140  struct SPoint {
141  float fX;
142  float fY;
143  float fZ;
144  };
145 
147  char message[128];
148  unsigned int nAddr;
149  unsigned short nBasePort;
150  };
151 
152  private:
153  struct SSettingsGeneralCamera {
154  unsigned int nID;
155  ECameraModel eModel;
156  bool bUnderwater;
157  bool bSupportsHwSync;
158  unsigned int nSerial;
159  ECameraMode eMode;
160  EVideoResolution eVideoResolution;
161  EVideoAspectRatio eVideoAspectRatio;
162  unsigned int nVideoFrequency;
163  unsigned int nVideoExposure; // Micro seconds
164  unsigned int nVideoExposureMin; // Micro seconds
165  unsigned int nVideoExposureMax; // Micro seconds
166  unsigned int nVideoFlashTime; // Micro seconds
167  unsigned int nVideoFlashTimeMin; // Micro seconds
168  unsigned int nVideoFlashTimeMax; // Micro seconds
169  unsigned int nMarkerExposure; // Micro seconds
170  unsigned int nMarkerExposureMin; // Micro seconds
171  unsigned int nMarkerExposureMax; // Micro seconds
172  unsigned int nMarkerThreshold;
173  unsigned int nMarkerThresholdMin;
174  unsigned int nMarkerThresholdMax;
175  float fPositionX;
176  float fPositionY;
177  float fPositionZ;
178  float fPositionRotMatrix[3][3];
179  unsigned int nOrientation; // Degrees
180  unsigned int nMarkerResolutionWidth; // Sub pixels
181  unsigned int nMarkerResolutionHeight; // Sub pixels
182  unsigned int nVideoResolutionWidth; // Pixels
183  unsigned int nVideoResolutionHeight; // Pixels
184  unsigned int nMarkerFOVLeft; // Pixels
185  unsigned int nMarkerFOVTop; // Pixels
186  unsigned int nMarkerFOVRight; // Pixels
187  unsigned int nMarkerFOVBottom; // Pixels
188  unsigned int nVideoFOVLeft; // Pixels
189  unsigned int nVideoFOVTop; // Pixels
190  unsigned int nVideoFOVRight; // Pixels
191  unsigned int nVideoFOVBottom; // Pixels
192  ESyncOutFreqMode eSyncOutMode[2];
193  unsigned int nSyncOutValue[2];
194  float fSyncOutDutyCycle[2]; // Percent
195  bool bSyncOutNegativePolarity[3];
196  float fFocus;
197  float fAperture;
198  bool autoExposureEnabled;
199  float autoExposureCompensation;
200  int autoWhiteBalance;
201  };
202 
203  struct SSettingsGeneralCameraSystem {
204  ECameraSystemType eType;
205  };
206 
207  struct SSettingsGeneralExternalTimebase {
208  SSettingsGeneralExternalTimebase()
209  : bEnabled(false),
210  eSignalSource(SourceControlPort),
211  bSignalModePeriodic(false),
212  nFreqMultiplier(0),
213  nFreqDivisor(0),
214  nFreqTolerance(0),
215  fNominalFrequency(0.0f),
216  bNegativeEdge(false),
217  nSignalShutterDelay(0),
218  fNonPeriodicTimeout(0.0f) {}
219 
220  bool bEnabled;
221  ESignalSource eSignalSource;
222  bool bSignalModePeriodic;
223  unsigned int nFreqMultiplier;
224  unsigned int nFreqDivisor;
225  unsigned int nFreqTolerance;
226  float fNominalFrequency;
227  bool bNegativeEdge;
228  unsigned int nSignalShutterDelay;
229  float fNonPeriodicTimeout;
230  };
231 
232  struct SSettingsGeneral {
233  SSettingsGeneral()
234  : nCaptureFrequency(0),
235  fCaptureTime(0.0f),
236  bStartOnExternalTrigger(false),
237  bStartOnTrigNO(false),
238  bStartOnTrigNC(false),
239  bStartOnTrigSoftware(false),
240  eProcessingActions(EProcessingActions::ProcessingNone),
241  eRtProcessingActions(EProcessingActions::ProcessingNone),
242  eReprocessingActions(EProcessingActions::ProcessingNone) {
243  sExternalTimebase = {};
244  sCameraSystem = {Unknown};
245  }
246 
247  unsigned int nCaptureFrequency;
248  float fCaptureTime;
249  bool bStartOnExternalTrigger;
250  bool bStartOnTrigNO;
251  bool bStartOnTrigNC;
252  bool bStartOnTrigSoftware;
253  SSettingsGeneralCameraSystem sCameraSystem;
254  SSettingsGeneralExternalTimebase sExternalTimebase;
255  EProcessingActions eProcessingActions; // Binary flags.
256  EProcessingActions eRtProcessingActions; // Binary flags.
257  EProcessingActions eReprocessingActions; // Binary flags.
258  std::vector<SSettingsGeneralCamera> vsCameras;
259  };
260 
261  struct SSettings3DLabel {
262  std::string oName;
263  unsigned int nRGBColor;
264  };
265 
266  struct SSettingsBone {
267  std::string fromName;
268  std::string toName;
269  unsigned int color;
270  };
271 
272  struct SSettings3D {
273  EAxis eAxisUpwards;
274  char pCalibrationTime[32];
275  std::vector<SSettings3DLabel> s3DLabels;
276  std::vector<SSettingsBone> sBones;
277  };
278 
279  struct SSettings6DOFBody {
280  std::string oName;
281  unsigned int nRGBColor;
282  std::vector<SPoint> vsPoints;
283  };
284 
285  struct SSettings6DOF {
286  std::vector<SSettings6DOFBody> bodySettings;
287  std::string eulerFirst;
288  std::string eulerSecond;
289  std::string eulerThird;
290  };
291 
292  struct SGazeVector {
293  std::string name;
294  float frequency;
295  };
296 
297  struct SAnalogDevice {
298  unsigned int nDeviceID;
299  unsigned int nChannels;
300  std::string oName;
301  std::vector<std::string> voLabels;
302  unsigned int nFrequency;
303  std::string oUnit;
304  float fMinRange;
305  float fMaxRange;
306  std::vector<std::string> voUnits;
307  };
308 
309  struct SForceChannel {
310  unsigned int nChannelNumber;
311  float fConversionFactor;
312  };
313 
314  struct SForcePlate {
315  unsigned int nID;
316  unsigned int nAnalogDeviceID;
317  std::string oType;
318  std::string oName;
319  unsigned int nFrequency;
320  float fLength;
321  float fWidth;
322  SPoint asCorner[4];
323  SPoint sOrigin;
324  std::vector<SForceChannel> vChannels;
325  bool bValidCalibrationMatrix;
326  float afCalibrationMatrix[12][12];
327  unsigned int nCalibrationMatrixRows;
328  unsigned int nCalibrationMatrixColumns;
329  };
330 
331  struct SSettingsForce {
332  std::string oUnitLength;
333  std::string oUnitForce;
334  std::vector<SForcePlate> vsForcePlates;
335  };
336 
337  struct SImageCamera {
338  unsigned int nID;
339  bool bEnabled;
340  CRTPacket::EImageFormat eFormat;
341  unsigned int nWidth;
342  unsigned int nHeight;
343  float fCropLeft;
344  float fCropTop;
345  float fCropRight;
346  float fCropBottom;
347  };
348 
349  public:
351  std::string name;
352  int parentId;
354  };
355 
357  std::string name;
358  std::vector<SSettingsSkeletonSegment> segments;
359  };
360 
361  public:
362  CRTProtocol();
363  ~CRTProtocol();
364 
365  bool Connect(const char* pServerAddr, unsigned short nPort,
366  unsigned short* pnUDPServerPort = nullptr,
367  int nMajorVersion = MAJOR_VERSION,
368  int nMinorVersion = MINOR_VERSION, bool bBigEndian = false);
369  unsigned short GetUdpServerPort();
370  void Disconnect();
371  bool Connected() const;
372  bool SetVersion(int nMajorVersion, int nMinorVersion);
373  bool GetVersion(unsigned int& nMajorVersion, unsigned int& nMinorVersion);
374  bool GetQTMVersion(char* pVersion, unsigned int nVersionLen);
375  bool GetByteOrder(bool& bBigEndian);
376  bool CheckLicense(const char* pLicenseCode);
377  bool DiscoverRTServer(
378  unsigned short nServerPort, bool bNoLocalResponses,
379  unsigned short nDiscoverPort = DEFAULT_AUTO_DESCOVER_PORT);
380  int GetNumberOfDiscoverResponses();
381  bool GetDiscoverResponse(unsigned int nIndex, unsigned int& nAddr,
382  unsigned short& nBasePort, std::string& message);
383 
384  bool GetCurrentFrame(unsigned int nComponentType,
385  const SComponentOptions& componentOptions = {});
386  bool StreamFrames(EStreamRate eRate, unsigned int nRateArg,
387  unsigned short nUDPPort, const char* pUDPAddr,
388  unsigned int nComponentType,
389  const SComponentOptions& componentOptions = {});
390  bool StreamFramesStop();
391  bool GetState(CRTPacket::EEvent& eEvent, bool bUpdate = true,
392  int nTimeout = WAIT_FOR_DATA_TIMEOUT);
393  bool GetCapture(const char* pFileName, bool bC3D);
394  bool SendTrig();
395  bool SetQTMEvent(const char* pLabel);
396  bool TakeControl(const char* pPassword = nullptr);
397  bool ReleaseControl();
398  bool IsControlling();
399  bool NewMeasurement();
400  bool CloseMeasurement();
401  bool StartCapture();
402  bool StartRTOnFile();
403  bool StopCapture();
404  bool LoadCapture(const char* pFileName);
405  bool SaveCapture(const char* pFileName, bool bOverwrite,
406  char* pNewFileName = nullptr, int nSizeOfNewFileName = 0);
407  bool LoadProject(const char* pFileName);
408  bool Reprocess();
409 
410  static bool GetEventString(CRTPacket::EEvent eEvent, char* pStr);
411  static bool ConvertRateString(const char* pRate, EStreamRate& eRate,
412  unsigned int& nRateArg);
413  static unsigned int ConvertComponentString(const char* pComponentType);
414  static bool GetComponentString(
415  char* pComponentStr, unsigned int nComponentType,
416  const SComponentOptions& options = SComponentOptions());
417 
418  int ReceiveRTPacket(
419  CRTPacket::EPacketType& eType, bool bSkipEvents = true,
420  int nTimeout = WAIT_FOR_DATA_TIMEOUT); // nTimeout < 0 : Blocking receive
421  CRTPacket* GetRTPacket();
422 
423  bool ReadXmlBool(CMarkup* xml, const std::string& element, bool& value) const;
424  bool ReadCameraSystemSettings();
425  bool Read3DSettings(bool& bDataAvailable);
426  bool Read6DOFSettings(bool& bDataAvailable);
427  bool ReadGazeVectorSettings(bool& bDataAvailable);
428  bool ReadAnalogSettings(bool& bDataAvailable);
429  bool ReadForceSettings(bool& bDataAvailable);
430  bool ReadImageSettings(bool& bDataAvailable);
431  bool ReadSkeletonSettings(bool& bDataAvailable,
432  bool skeletonGlobalData = false);
433 
434  void GetSystemSettings(unsigned int& nCaptureFrequency, float& fCaptureTime,
435  bool& bStartOnExtTrig, bool& trigNO, bool& trigNC,
436  bool& trigSoftware,
437  EProcessingActions& eProcessingActions,
438  EProcessingActions& eRtProcessingActions,
439  EProcessingActions& eReprocessingActions) const;
440 
441  void GetExtTimeBaseSettings(bool& bEnabled, ESignalSource& eSignalSource,
442  bool& bSignalModePeriodic,
443  unsigned int& nFreqMultiplier,
444  unsigned int& nFreqDivisor,
445  unsigned int& nFreqTolerance,
446  float& fNominalFrequency, bool& bNegativeEdge,
447  unsigned int& nSignalShutterDelay,
448  float& fNonPeriodicTimeout) const;
449 
450  unsigned int GetCameraCount() const;
451 
452  bool GetCameraSettings(unsigned int nCameraIndex, unsigned int& nID,
453  ECameraModel& eModel, bool& bUnderwater,
454  bool& bSupportsHwSync, unsigned int& nSerial,
455  ECameraMode& eMode) const;
456 
457  bool GetCameraMarkerSettings(unsigned int nCameraIndex,
458  unsigned int& nCurrentExposure,
459  unsigned int& nMinExposure,
460  unsigned int& nMaxExposure,
461  unsigned int& nCurrentThreshold,
462  unsigned int& nMinThreshold,
463  unsigned int& nMaxThreshold) const;
464 
465  bool GetCameraVideoSettings(
466  unsigned int nCameraIndex, EVideoResolution& eVideoResolution,
467  EVideoAspectRatio& eVideoAspectRatio, unsigned int& nVideoFrequency,
468  unsigned int& nCurrentExposure, unsigned int& nMinExposure,
469  unsigned int& nMaxExposure, unsigned int& nCurrentFlashTime,
470  unsigned int& nMinFlashTime, unsigned int& nMaxFlashTime) const;
471 
472  bool GetCameraSyncOutSettings(unsigned int nCameraIndex,
473  unsigned int portNumber,
474  ESyncOutFreqMode& eSyncOutMode,
475  unsigned int& nSyncOutValue,
476  float& fSyncOutDutyCycle,
477  bool& bSyncOutNegativePolarity) const;
478 
479  bool GetCameraPosition(unsigned int nCameraIndex, SPoint& sPoint,
480  float fvRotationMatrix[3][3]) const;
481 
482  bool GetCameraOrientation(unsigned int nCameraIndex, int& nOrientation) const;
483 
484  bool GetCameraResolution(unsigned int nCameraIndex,
485  unsigned int& nMarkerWidth,
486  unsigned int& nMarkerHeight,
487  unsigned int& nVideoWidth,
488  unsigned int& nVideoHeight) const;
489 
490  bool GetCameraFOV(unsigned int nCameraIndex, unsigned int& nMarkerLeft,
491  unsigned int& nMarkerTop, unsigned int& nMarkerRight,
492  unsigned int& nMarkerBottom, unsigned int& nVideoLeft,
493  unsigned int& nVideoTop, unsigned int& nVideoRight,
494  unsigned int& nVideoBottom) const;
495 
496  bool GetCameraLensControlSettings(const unsigned int nCameraIndex,
497  float* focus, float* aperture) const;
498  bool GetCameraAutoExposureSettings(const unsigned int nCameraIndex,
499  bool* autoExposureEnabled,
500  float* autoExposureCompensation) const;
501  bool GetCameraAutoWhiteBalance(const unsigned int nCameraIndex,
502  bool* autoWhiteBalanceEnabled) const;
503 
504  EAxis Get3DUpwardAxis() const;
505  const char* Get3DCalibrated() const;
506  unsigned int Get3DLabeledMarkerCount() const;
507  const char* Get3DLabelName(unsigned int nMarkerIndex) const;
508  unsigned int Get3DLabelColor(unsigned int nMarkerIndex) const;
509 
510  unsigned int Get3DBoneCount() const;
511  const char* Get3DBoneFromName(unsigned int boneIndex) const;
512  const char* Get3DBoneToName(unsigned int boneIndex) const;
513 
514  void Get6DOFEulerNames(std::string& first, std::string& second,
515  std::string& third) const;
516  unsigned int Get6DOFBodyCount() const;
517  const char* Get6DOFBodyName(unsigned int nBodyIndex) const;
518  unsigned int Get6DOFBodyColor(unsigned int nBodyIndex) const;
519  unsigned int Get6DOFBodyPointCount(unsigned int nBodyIndex) const;
520  bool Get6DOFBodyPoint(unsigned int nBodyIndex, unsigned int nMarkerIndex,
521  SPoint& sPoint) const;
522 
523  unsigned int GetGazeVectorCount() const;
524  const char* GetGazeVectorName(unsigned int nGazeVectorIndex) const;
525  float GetGazeVectorFrequency(unsigned int nGazeVectorIndex) const;
526 
527  unsigned int GetAnalogDeviceCount() const;
528  bool GetAnalogDevice(unsigned int nDeviceIndex, unsigned int& nDeviceID,
529  unsigned int& nChannels, char*& pName,
530  unsigned int& nFrequency, char*& pUnit, float& fMinRange,
531  float& fMaxRange) const;
532  const char* GetAnalogLabel(unsigned int nDeviceIndex,
533  unsigned int nChannelIndex) const;
534  const char* GetAnalogUnit(unsigned int nDeviceIndex,
535  unsigned int nChannelIndex) const;
536 
537  void GetForceUnits(char*& pLength, char*& pForce) const;
538  unsigned int GetForcePlateCount() const;
539  bool GetForcePlate(unsigned int nPlateIndex, unsigned int& nID,
540  unsigned int& nAnalogDeviceID, unsigned int& nFrequency,
541  char*& pType, char*& pName, float& fLength,
542  float& fWidth) const;
543  bool GetForcePlateLocation(unsigned int nPlateIndex, SPoint sCorner[4]) const;
544  bool GetForcePlateOrigin(unsigned int nPlateIndex, SPoint& sOrigin) const;
545  unsigned int GetForcePlateChannelCount(unsigned int nPlateIndex) const;
546  bool GetForcePlateChannel(unsigned int nPlateIndex,
547  unsigned int nChannelIndex,
548  unsigned int& nChannelNumber,
549  float& fConversionFactor) const;
550  bool GetForcePlateCalibrationMatrix(unsigned int nPlateIndex,
551  float fvCalMatrix[12][12],
552  unsigned int* rows,
553  unsigned int* columns) const;
554 
555  unsigned int GetImageCameraCount() const;
556  bool GetImageCamera(unsigned int nCameraIndex, unsigned int& nCameraID,
557  bool& bEnabled, CRTPacket::EImageFormat& eFormat,
558  unsigned int& nWidth, unsigned int& nHeight,
559  float& fCropLeft, float& fCropTop, float& fCropRight,
560  float& fCropBottom) const;
561 
562  unsigned int GetSkeletonCount() const;
563  const char* GetSkeletonName(unsigned int skeletonIndex);
564  unsigned int GetSkeletonSegmentCount(unsigned int skeletonIndex);
565  bool GetSkeleton(unsigned int skeletonIndex, SSettingsSkeleton* skeleton);
566  bool GetSkeletonSegment(
567  unsigned int skeletonIndex, unsigned int segmentIndex,
568  SSettingsSkeletonSegment* segment); // parentIndex = -1 => No parent.
569 
570  ECameraSystemType GetCameraSystemType() const;
571 
572  bool SetSystemSettings(const unsigned int* pnCaptureFrequency,
573  const float* pfCaptureTime,
574  const bool* pbStartOnExtTrig, const bool* trigNO,
575  const bool* trigNC, const bool* trigSoftware,
576  const EProcessingActions* peProcessingActions,
577  const EProcessingActions* peRtProcessingActions,
578  const EProcessingActions* peReprocessingActions);
579 
580  bool SetExtTimeBaseSettings(
581  const bool* pbEnabled, const ESignalSource* peSignalSource,
582  const bool* pbSignalModePeriodic, const unsigned int* pnFreqMultiplier,
583  const unsigned int* pnFreqDivisor, const unsigned int* pnFreqTolerance,
584  const float* pfNominalFrequency, const bool* pbNegativeEdge,
585  const unsigned int* pnSignalShutterDelay,
586  const float* pfNonPeriodicTimeout);
587 
588  bool SetCameraSettings(const unsigned int nCameraID,
589  const ECameraMode* peMode,
590  const float* pfMarkerExposure,
591  const float* pfMarkerThreshold,
592  const int* pnOrientation);
593 
594  bool SetCameraVideoSettings(const unsigned int nCameraID,
595  const EVideoResolution* eVideoResolution,
596  const EVideoAspectRatio* eVideoAspectRatio,
597  const unsigned int* pnVideoFrequency,
598  const float* pfVideoExposure,
599  const float* pfVideoFlashTime);
600 
601  bool SetCameraSyncOutSettings(const unsigned int nCameraID,
602  const unsigned int portNumber,
603  const ESyncOutFreqMode* peSyncOutMode,
604  const unsigned int* pnSyncOutValue,
605  const float* pfSyncOutDutyCycle,
606  const bool* pbSyncOutNegativePolarity);
607 
608  bool SetCameraLensControlSettings(const unsigned int nCameraID,
609  const float focus, const float aperture);
610  bool SetCameraAutoExposureSettings(const unsigned int nCameraID,
611  const bool autoExposure,
612  const float compensation);
613  bool SetCameraAutoWhiteBalance(const unsigned int nCameraID,
614  const bool enable);
615 
616  bool SetImageSettings(const unsigned int nCameraID, const bool* pbEnable,
617  const CRTPacket::EImageFormat* peFormat,
618  const unsigned int* pnWidth,
619  const unsigned int* pnHeight, const float* pfLeftCrop,
620  const float* pfTopCrop, const float* pfRightCrop,
621  const float* pfBottomCrop);
622 
623  bool SetForceSettings(const unsigned int nPlateID, const SPoint* psCorner1,
624  const SPoint* psCorner2, const SPoint* psCorner3,
625  const SPoint* psCorner4);
626 
627  char* GetErrorString();
628 
629  private:
630  bool SendString(const char* pCmdStr, int nType);
631  bool SendCommand(const char* pCmdStr);
632  bool SendCommand(const char* pCmdStr, char* pCommandResponseStr,
633  unsigned int timeout = WAIT_FOR_DATA_TIMEOUT);
634  bool SendXML(const char* pCmdStr);
635  void AddXMLElementBool(CMarkup* oXML, const char* tTag, const bool* pbValue,
636  const char* tTrue = "True",
637  const char* tFalse = "False");
638  void AddXMLElementBool(CMarkup* oXML, const char* tTag, const bool bValue,
639  const char* tTrue = "True",
640  const char* tFalse = "False");
641  void AddXMLElementInt(CMarkup* oXML, const char* tTag, const int* pnValue);
642  void AddXMLElementUnsignedInt(CMarkup* oXML, const char* tTag,
643  const unsigned int* pnValue);
644  void AddXMLElementFloat(CMarkup* oXML, const char* tTag, const float* pfValue,
645  unsigned int pnDecimals = 6);
646  bool CompareNoCase(std::string tStr1, const char* tStr2) const;
647 
648  private:
649  CNetwork* mpoNetwork;
650  CRTPacket* mpoRTPacket;
651  char* maDataBuff;
652  unsigned int mDataBuffSize;
653  CRTPacket::EEvent meLastEvent;
655  meState; // Same as meLastEvent but without EventCameraSettingsChanged
656  int mnMinorVersion;
657  int mnMajorVersion;
658  bool mbBigEndian;
659  bool mbIsMaster;
660  SSettingsGeneral msGeneralSettings;
661  SSettings3D ms3DSettings;
662  SSettings6DOF mvs6DOFSettings;
663  std::vector<SGazeVector> mvsGazeVectorSettings;
664  std::vector<SAnalogDevice> mvsAnalogDeviceSettings;
665  SSettingsForce msForceSettings;
666  std::vector<SImageCamera> mvsImageSettings;
667  std::vector<SSettingsSkeleton> mSkeletonSettings;
668  char maErrorStr[1024];
669  unsigned short mnBroadcastPort;
670  FILE* mpFileBuffer;
671  std::vector<SDiscoverResponse> mvsDiscoverResponseList;
672 };
673 
674 #endif // RTPROTOCOL_H
CMarkup
Definition: Markup.h:25
DLL_EXPORT
#define DLL_EXPORT
Definition: RTProtocol.h:18
CRTProtocol::SPoint
Definition: RTProtocol.h:140
CRTProtocol::SSettingsSkeletonSegment::parentId
int parentId
Definition: RTProtocol.h:352
CRTPacket::EImageFormat
EImageFormat
Definition: RTPacket.h:60
Network.h
CRTProtocol::ESignalSource
ESignalSource
Definition: RTProtocol.h:113
CRTProtocol::EProcessingActions
EProcessingActions
Definition: RTProtocol.h:123
CRTProtocol::SSettingsSkeleton::segments
std::vector< SSettingsSkeletonSegment > segments
Definition: RTProtocol.h:358
MAJOR_VERSION
#define MAJOR_VERSION
Definition: RTPacket.h:13
CRTProtocol::ESyncOutFreqMode
ESyncOutFreqMode
Definition: RTProtocol.h:104
CRTPacket::EPacketType
EPacketType
Definition: RTPacket.h:25
CRTProtocol::SSettingsSkeletonSegment::name
std::string name
Definition: RTProtocol.h:351
CRTProtocol
Definition: RTProtocol.h:26
CRTProtocol::EVideoResolution
EVideoResolution
Definition: RTProtocol.h:89
CRTProtocol::SComponentOptions::mSkeletonGlobalData
bool mSkeletonGlobalData
Definition: RTProtocol.h:51
CRTProtocol::ModeMeasurementTime
@ ModeMeasurementTime
Definition: RTProtocol.h:109
CNetwork
Definition: Network.h:12
MINOR_VERSION
#define MINOR_VERSION
Definition: RTPacket.h:14
CRTProtocol::SDiscoverResponse::nAddr
unsigned int nAddr
Definition: RTProtocol.h:148
RTPacket.h
CRTProtocol::ModeMultiplier
@ ModeMultiplier
Definition: RTProtocol.h:106
CRTProtocol::EStreamRate
EStreamRate
Definition: RTProtocol.h:54
CRTProtocol::SSettingsSkeleton::name
std::string name
Definition: RTProtocol.h:357
CRTPacket::SSkeletonSegment
Definition: RTPacket.h:115
CRTProtocol::EAxis
EAxis
Definition: RTProtocol.h:121
CRTProtocol::SPoint::fZ
float fZ
Definition: RTProtocol.h:143
CRTProtocol::SComponentOptions
Definition: RTProtocol.h:47
CRTPacket::EEvent
EEvent
Definition: RTPacket.h:67
CRTProtocol::SSettingsSkeleton
Definition: RTProtocol.h:356
CRTProtocol::SPoint::fX
float fX
Definition: RTProtocol.h:141
CRTProtocol::ModeDivisor
@ ModeDivisor
Definition: RTProtocol.h:107
WAIT_FOR_DATA_TIMEOUT
#define WAIT_FOR_DATA_TIMEOUT
Definition: RTProtocol.h:22
CRTProtocol::EVideoAspectRatio
EVideoAspectRatio
Definition: RTProtocol.h:97
CRTProtocol::ECameraSystemType
ECameraSystemType
Definition: RTProtocol.h:85
CRTProtocol::SComponentOptions::SComponentOptions
SComponentOptions()
Definition: RTProtocol.h:48
sot_talos_balance.test.appli_admittance_end_effector.value
value
Definition: appli_admittance_end_effector.py:70
CRTProtocol::SSettingsSkeletonSegment
Definition: RTProtocol.h:350
DEFAULT_AUTO_DESCOVER_PORT
#define DEFAULT_AUTO_DESCOVER_PORT
Definition: RTProtocol.h:21
CRTProtocol::SPoint::fY
float fY
Definition: RTProtocol.h:142
CRTProtocol::ECameraMode
ECameraMode
Definition: RTProtocol.h:87
CRTProtocol::SDiscoverResponse::nBasePort
unsigned short nBasePort
Definition: RTProtocol.h:149
CRTProtocol::ECameraModel
ECameraModel
Definition: RTProtocol.h:61
CRTProtocol::SSettingsSkeletonSegment::parentIndex
int parentIndex
Definition: RTProtocol.h:353
CRTProtocol::ModeActualFreq
@ ModeActualFreq
Definition: RTProtocol.h:108
CRTPacket
Definition: RTPacket.h:23
sot_talos_balance.test.appli_dcm_zmp_control.name
name
Definition: appli_dcm_zmp_control.py:298
CRTProtocol::SDiscoverResponse
Definition: RTProtocol.h:146
CRTProtocol::SComponentOptions::mAnalogChannels
char * mAnalogChannels
Definition: RTProtocol.h:50