OSVR-Core
IMUMessage.h
Go to the documentation of this file.
1 
11 // Copyright 2016 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_IMUMessage_h_GUID_BF9DF56D_F7CB_4E92_C9E6_B44C56C8138D
26 #define INCLUDED_IMUMessage_h_GUID_BF9DF56D_F7CB_4E92_C9E6_B44C56C8138D
27 
28 // Internal Includes
29 // - none
30 
31 // Library/third-party includes
32 #include <boost/none_t.hpp>
33 #include <boost/variant.hpp>
34 #include <osvr/TypePack/List.h>
36 #include <osvr/Util/TimeValue.h>
37 
38 // Standard includes
39 // - none
40 
41 namespace osvr {
42 namespace vbtracker {
43 
44  // Forward declaration
45  class TrackedBodyIMU;
46 
47  enum class ImuMessageCategory { Empty, Orientation, AngularVelocity };
48 
51  template <typename ReportType> class TimestampedImuReport {
52  public:
54  util::time::TimeValue const &tv,
55  ReportType const &d)
56  : imuPtr(&myImu), timestamp(tv), data(d) {}
57 
58  private:
59  TrackedBodyIMU *imuPtr;
60 
61  public:
62  TrackedBodyIMU &imu() const { return *imuPtr; }
63 
64  util::time::TimeValue timestamp;
65  ReportType data;
66  };
67 
69  template <typename ReportType>
72  ReportType const &d) {
73  return TimestampedImuReport<ReportType>{myImu, tv, d};
74  }
75 
79 
83 
86  using TimestampedReports =
88 
92  using IMUMessage = boost::variant<boost::none_t, TimestampedOrientation,
94 
95 } // namespace vbtracker
96 } // namespace osvr
97 
98 #endif // INCLUDED_IMUMessage_h_GUID_BF9DF56D_F7CB_4E92_C9E6_B44C56C8138D
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
TimestampedImuReport< ReportType > makeImuReport(TrackedBodyIMU &myImu, util::time::TimeValue const &tv, ReportType const &d)
Generic constructor/factory function.
Definition: IMUMessage.h:71
A wrapper for a template parameter pack of types.
Definition: List.h:52
Header.
Definition: TrackedBodyIMU.h:44
Header providing a C++ wrapper around TimeValueC.h.
An IMU report data structure, along with the report time and the internal tracking system&#39;s pointer t...
Definition: IMUMessage.h:51
boost::variant< boost::none_t, TimestampedOrientation, TimestampedAngVel > IMUMessage
A "typesafe tagged-union" variant that can hold an IMU report data along with the timestamp and the p...
Definition: IMUMessage.h:93
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...
Definition: TimeValueC.h:81