OSVR-Core
VideoIMUFusionDevice.h
Go to the documentation of this file.
1 
11 // Copyright 2015 Sensics, Inc.
12 //
13 // Licensed under the Apache License, Version 2.0 (the "License");
14 // you may not use this file except in compliance with the License.
15 // You may obtain a copy of the License at
16 //
17 // http://www.apache.org/licenses/LICENSE-2.0
18 //
19 // Unless required by applicable law or agreed to in writing, software
20 // distributed under the License is distributed on an "AS IS" BASIS,
21 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 // See the License for the specific language governing permissions and
23 // limitations under the License.
24 
25 #ifndef INCLUDED_VideoIMUFusionDevice_h_GUID_477141AB_39F3_489A_8C15_BF558BECB7E0
26 #define INCLUDED_VideoIMUFusionDevice_h_GUID_477141AB_39F3_489A_8C15_BF558BECB7E0
27 
28 // Internal Includes
29 #include "VideoIMUFusion.h"
30 #include "FusionParams.h"
34 
35 // Library/third-party includes
36 // - none
37 
38 // Standard includes
39 #include <chrono>
40 
45  public:
47  OSVR_PluginRegContext ctx, std::string const &name,
48  std::string const &imuPath, std::string const &videoPath,
49  VideoIMUFusionParams const &params = VideoIMUFusionParams());
51  OSVR_ReturnCode update();
52  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
53  private:
54  static void s_handleIMUData(void *userdata, const OSVR_TimeValue *timestamp,
55  const OSVR_OrientationReport *report);
56  static void s_handleIMUVelocity(void *userdata,
57  const OSVR_TimeValue *timestamp,
58  const OSVR_AngularVelocityReport *report);
59  static void s_handleVideoTrackerData(void *userdata,
60  const OSVR_TimeValue *timestamp,
61  const OSVR_PoseReport *report);
62  void handleIMUData(const OSVR_TimeValue &timestamp,
63  const OSVR_OrientationReport &report);
64 
65  void handleIMUVelocity(const OSVR_TimeValue &timestamp,
66  const OSVR_AngularVelocityReport &report);
67  void handleVideoTrackerData(const OSVR_TimeValue &timestamp,
68  const OSVR_PoseReport &report);
69 
70  void sendMainPoseReport();
71  void sendVelocityReport();
72 
73  OSVR_TrackerDeviceInterface m_trackerOut;
75  OSVR_ClientContext m_clientCtx;
76 
77  OSVR_ClientInterface m_imu = nullptr;
78 
79  OSVR_ClientInterface m_videoTracker = nullptr;
80 
81  bool m_shouldReportCamera() const;
82 
83  VideoIMUFusion m_fusion;
84  using our_clock = std::chrono::system_clock;
85  bool m_reportedCamera = false;
86  our_clock::time_point m_nextCameraReport;
87 };
88 
89 #endif // INCLUDED_VideoIMUFusionDevice_h_GUID_477141AB_39F3_489A_8C15_BF558BECB7E0
Wrapper class for OSVR_DeviceToken.
Definition: DeviceInterface.h:93
Definition: FusionParams.h:37
VideoIMUFusionDevice(OSVR_PluginRegContext ctx, std::string const &name, std::string const &imuPath, std::string const &videoPath, VideoIMUFusionParams const &params=VideoIMUFusionParams())
Definition: VideoIMUFusionDevice.cpp:48
The core of the fusion code - doesn&#39;t deal with getting data in or reporting it out, for easier use in testing.
Definition: VideoIMUFusion.h:43
Definition: TrackerInterfaceC.cpp:42
~VideoIMUFusionDevice()
Definition: VideoIMUFusionDevice.cpp:86
Report type for an orientation callback on a tracker interface.
Definition: ClientReportTypesC.h:145
Header including the full PluginKit C++ interface.
Definition: ClientContext.h:50
Header.
OSVR_EXTERN_C_BEGIN typedef void * OSVR_PluginRegContext
A context pointer passed in to your plugin&#39;s entry point and other locations of control flow transfer...
Definition: PluginRegContextC.h:47
Report type for an angular velocity callback on a tracker interface.
Definition: ClientReportTypesC.h:187
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...
Definition: TimeValueC.h:81
Definition: ClientInterface.h:49
Wrapper for VideoIMUFusion that handles the specifics of being an analysis plugin.
Definition: VideoIMUFusionDevice.h:44
Report type for a pose (position and orientation) callback on a tracker interface.
Definition: ClientReportTypesC.h:155