PST SDK  5.0.1.0-acae3ae
pst-sdk.h
Go to the documentation of this file.
1 /* -*- Mode: C; tab-width: 4 -*-
2  *
3  * Copyright (c) 2009-2018 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 {
42  enum class StatusMessage
43  {
44  OK,
46  DISCONNECTED,
47  ERR_GENERAL,
48  ERR_TIMEOUT,
54  };
55 
65  struct Image
66  {
67  unsigned int width;
68  unsigned int height;
69  std::vector<unsigned char*> images;
70  };
71 
79  struct Target
80  {
81  std::string name;
82  std::string uuid;
83  int id;
84  };
85 
93  typedef std::vector<Target> Targets;
94 
107  struct TargetStatus : public Target
108  {
109  bool status;
110  };
111 
119  typedef std::vector<TargetStatus> TargetStatuses;
120 
132  struct TargetPose : public Target
133  {
134  std::array<float, 16> pose;
135  };
136 
144  typedef std::vector<TargetPose> TargetPoses;
145 
157  struct Point
158  {
159  int id;
160  std::array<float, 3> position;
161  };
162 
170  typedef std::vector<Point> Points;
171 
179  typedef std::vector<std::array<float, 3>> MarkerList;
180 
192  struct TrackerData
193  {
194  double timestamp;
195  int seqnumber;
196  TargetPoses targetlist;
197  Points datapoints;
198  };
199 
209  class Listener
210  {
211  public:
221  virtual void OnTrackerData(TrackerData& data) { }
222  virtual ~Listener() { }
223  };
224 
232  {
233  public:
250  Tracker(const std::string& path = "", const std::string& config_file = "server.cfg",
251  const std::string& db_file = "models.db", const std::string& grabber_name = "default");
252  ~Tracker();
253 
264  std::vector<std::string> GetUncalibratedCameraUrls(bool silent = false);
265 
273  std::string GetVersionInfo() const;
274 
283  std::string GetConfigPath() const;
284 
285 
297  void AddTrackerListener(Listener* listener);
298 
309  void RemoveTrackerListener(Listener* listener);
310 
318  void Start();
319 
328  void Pause();
329 
340  void Shutdown();
341 
353  StatusMessage Systemcheck() const;
354 
355 
368  void SetFramerate(double fps);
369 
380  double GetFramerate() const;
381 
395  std::vector<float> GetSupportedFramerates() const;
396 
411  void SetExposure(float time);
412 
422  float GetExposure() const;
423 
440  void GetExposureRange(double& min, double& max) const;
441 
458  void EnableFiltering();
459 
468  void DisableFiltering();
469 
481  void SetPositionFilter(double value);
482 
494  void SetOrientationFilter(double value);
495 
510  void EnableTremorFilter();
511 
520  void DisableTremorFilter();
521 
522 
535  void EnableImageTransfer();
536 
545  void DisableImageTransfer();
546 
560  bool GetImage(Image& image) const;
561 
562 
575  TargetStatuses GetTargetList() const;
576 
589  Target GetTargetInfo(const std::string& name) const;
590 
605  void SetTargetStatus(const std::string& name, bool active);
606 
621  bool GetTargetStatus(const std::string& name) const;
622 
637  MarkerList GetTargetMarkers(const std::string& name) const;
638 
651  void SetTargetId(const std::string& name, int id);
652 
669  void SetReference(const std::array<float, 16>& reference, bool relative = false);
670 
681  void SetDefaultReference();
682 
696  std::array<float, 16> GetReference() const;
697 
719  void EnableSharedMemory();
720 
728  void DisableSharedMemory();
729 
749  void EnableRestServer(const std::string& server_address, const std::string& server_port, const int& eventStream_retry_timeout_ms = 3000, const size_t& socket_size = 65536);
750 
759  void DisableRestServer();
760  };
761 }
762 }
763 
764 #endif // _PST_SDK_H_
765 
std::vector< unsigned char * > images
Definition: pst-sdk.h:69
Tracking target status.
Definition: pst-sdk.h:107
Definition: pst-sdk.h:31
std::vector< Point > Points
Vector of Point objects.
Definition: pst-sdk.h:170
Points datapoints
Definition: pst-sdk.h:197
std::vector< TargetStatus > TargetStatuses
Vector of TargetStatus objects.
Definition: pst-sdk.h:119
std::array< float, 3 > position
Definition: pst-sdk.h:160
int seqnumber
Definition: pst-sdk.h:195
unsigned int width
Definition: pst-sdk.h:67
Tracking target information.
Definition: pst-sdk.h:79
std::string uuid
Definition: pst-sdk.h:82
std::array< float, 16 > pose
Definition: pst-sdk.h:134
#define PST_EXPORT
Definition: pst-sdk.h:28
std::vector< Target > Targets
Vector of Target objects.
Definition: pst-sdk.h:93
bool status
Definition: pst-sdk.h:109
std::vector< TargetPose > TargetPoses
Vector of TargetPose objects.
Definition: pst-sdk.h:144
std::vector< std::array< float, 3 > > MarkerList
Vector of 3D marker positions of a tracking Target.
Definition: pst-sdk.h:179
virtual void OnTrackerData(TrackerData &data)
Callback function receiving tracking information from the tracker.
Definition: pst-sdk.h:221
unsigned int height
Definition: pst-sdk.h:68
Estimated tracking target pose.
Definition: pst-sdk.h:132
Estimated 3D marker location.
Definition: pst-sdk.h:157
double timestamp
Definition: pst-sdk.h:194
Abstract listener class for receiving tracking information.
Definition: pst-sdk.h:209
std::string name
Definition: pst-sdk.h:81
Images retrieved from the tracker.
Definition: pst-sdk.h:65
int id
Definition: pst-sdk.h:83
StatusMessage
Tracker status messages enum class.
Definition: pst-sdk.h:42
Tracking information retrieved from tracker.
Definition: pst-sdk.h:192
virtual ~Listener()
Definition: pst-sdk.h:222
Main PST SDK class implementing tracker communication.
Definition: pst-sdk.h:231
TargetPoses targetlist
Definition: pst-sdk.h:196
int id
Definition: pst-sdk.h:159