PST SDK  5.0.3.0-7c6cbb9
pst-sdk.h
Go to the documentation of this file.
1 /* -*- Mode: C; tab-width: 4 -*-
2  *
3  * Copyright (c) 2009-2019 PS-Tech B.V.
4  * Falckstraat 53 hs, NL-1017 VV, Amsterdam, the Netherlands.
5  * All rights reserved.
6  *
7  * This software is the confidential and proprietary information of Personal
8  * Space Technologies, Inc. ("Confidential Information"). You shall not
9  * disclose such Confidential Information and shall use it only in
10  * accordance with the terms of the license agreement you entered into
11  * with Personal Space Technologies.
12  */
13 
14 #ifndef _PST_SDK_H_
15 #define _PST_SDK_H_
16 
17 #include <string>
18 #include <vector>
19 #include <array>
20 
21 #if (defined(_WIN32) || defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__))
22 # ifdef pstsdk_EXPORTS
23 # define PST_EXPORT __declspec(dllexport)
24 # else
25 # define PST_EXPORT __declspec(dllimport)
26 # endif
27 #else
28 # define PST_EXPORT
29 #endif
30 
31 namespace PSTech
32 {
33 namespace pstsdk
34 {
35 
53  enum class StatusMessage
54  {
55  OK,
57  DISCONNECTED,
58  ERR_GENERAL,
59  ERR_TIMEOUT,
65  };
66 
76  struct Image
77  {
78  unsigned int width;
79  unsigned int height;
80  std::vector<unsigned char*> images;
81  };
82 
90  struct Target
91  {
92  std::string name;
93  std::string uuid;
94  int id;
95  };
96 
104  typedef std::vector<Target> Targets;
105 
118  struct TargetStatus : public Target
119  {
120  bool status;
121  };
122 
130  typedef std::vector<TargetStatus> TargetStatuses;
131 
143  struct TargetPose : public Target
144  {
145  std::array<float, 16> pose;
146  };
147 
155  typedef std::vector<TargetPose> TargetPoses;
156 
168  struct Point
169  {
170  int id;
171  std::array<float, 3> position;
172  };
173 
181  typedef std::vector<Point> Points;
182 
190  typedef std::vector<std::array<float, 3>> MarkerList;
191 
203  struct TrackerData
204  {
205  double timestamp;
206  int seqnumber;
207  TargetPoses targetlist;
208  Points datapoints;
209  };
210 
220  class Listener
221  {
222  public:
232  virtual void OnTrackerData(TrackerData& data) { }
233  virtual ~Listener() { }
234  };
235 
243  {
244  public:
261  Tracker(const std::string& path = "", const std::string& config_file = "server.cfg",
262  const std::string& db_file = "models.db", const std::string& grabber_name = "default");
263  ~Tracker();
264 
275  std::vector<std::string> GetUncalibratedCameraUrls(bool silent = false);
276 
284  std::string GetVersionInfo() const;
285 
294  std::string GetConfigPath() const;
295 
296 
308  void AddTrackerListener(Listener* listener);
309 
320  void RemoveTrackerListener(Listener* listener);
321 
329  void Start();
330 
339  void Pause();
340 
351  void Shutdown();
352 
364  StatusMessage Systemcheck() const;
365 
366 
379  void SetFramerate(double fps);
380 
391  double GetFramerate() const;
392 
406  std::vector<float> GetSupportedFramerates() const;
407 
422  void SetExposure(float time);
423 
433  float GetExposure() const;
434 
451  void GetExposureRange(double& min, double& max) const;
452 
469  void EnableFiltering();
470 
479  void DisableFiltering();
480 
492  void SetPositionFilter(double value);
493 
505  void SetOrientationFilter(double value);
506 
521  void EnableTremorFilter();
522 
531  void DisableTremorFilter();
532 
533 
546  void EnableImageTransfer();
547 
556  void DisableImageTransfer();
557 
571  bool GetImage(Image& image) const;
572 
573 
586  TargetStatuses GetTargetList() const;
587 
600  Target GetTargetInfo(const std::string& name) const;
601 
616  void SetTargetStatus(const std::string& name, bool active);
617 
632  bool GetTargetStatus(const std::string& name) const;
633 
648  MarkerList GetTargetMarkers(const std::string& name) const;
649 
662  void SetTargetId(const std::string& name, int id);
663 
680  void SetReference(const std::array<float, 16>& reference, bool relative = false);
681 
692  void SetDefaultReference();
693 
707  std::array<float, 16> GetReference() const;
708 
730  void EnableSharedMemory();
731 
739  void DisableSharedMemory();
740 
759  void EnableRestServer(const std::string& server_address, const std::string& server_port, const int& eventStream_retry_timeout_ms = 3000);
760 
769  void DisableRestServer();
770  };
772 }
773 }
774 
775 #endif // _PST_SDK_H_
776 
std::vector< unsigned char * > images
Definition: pst-sdk.h:80
Tracking target status.
Definition: pst-sdk.h:118
Definition: pst-sdk.h:31
std::vector< TargetPose > TargetPoses
Vector of TargetPose objects.
Definition: pst-sdk.h:155
Points datapoints
Definition: pst-sdk.h:208
std::array< float, 3 > position
Definition: pst-sdk.h:171
int seqnumber
Definition: pst-sdk.h:206
unsigned int width
Definition: pst-sdk.h:78
std::vector< Target > Targets
Vector of Target objects.
Definition: pst-sdk.h:104
Tracking target information.
Definition: pst-sdk.h:90
std::string uuid
Definition: pst-sdk.h:93
std::vector< Point > Points
Vector of Point objects.
Definition: pst-sdk.h:181
std::vector< std::array< float, 3 > > MarkerList
Vector of 3D marker positions of a tracking Target.
Definition: pst-sdk.h:190
std::array< float, 16 > pose
Definition: pst-sdk.h:145
#define PST_EXPORT
Definition: pst-sdk.h:28
bool status
Definition: pst-sdk.h:120
virtual void OnTrackerData(TrackerData &data)
Callback function receiving tracking information from the tracker.
Definition: pst-sdk.h:232
unsigned int height
Definition: pst-sdk.h:79
StatusMessage
Tracker status messages enum class.
Definition: pst-sdk.h:53
Estimated tracking target pose.
Definition: pst-sdk.h:143
Estimated 3D marker location.
Definition: pst-sdk.h:168
double timestamp
Definition: pst-sdk.h:205
Abstract listener class for receiving tracking information.
Definition: pst-sdk.h:220
std::string name
Definition: pst-sdk.h:92
std::vector< TargetStatus > TargetStatuses
Vector of TargetStatus objects.
Definition: pst-sdk.h:130
Images retrieved from the tracker.
Definition: pst-sdk.h:76
int id
Definition: pst-sdk.h:94
Tracking information retrieved from tracker.
Definition: pst-sdk.h:203
virtual ~Listener()
Definition: pst-sdk.h:233
Main PST SDK class implementing tracker communication.
Definition: pst-sdk.h:242
TargetPoses targetlist
Definition: pst-sdk.h:207
int id
Definition: pst-sdk.h:170