RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
vrpn_Tracker_IMU.h
浏览该文件的文档.
1
5
11
12#pragma once
13
14#include <quat.h> // for q_matrix_type
15#include <stdio.h> // for NULL
16#include <string>
17#include "vrpn_Analog.h" // for vrpn_ANALOGCB, etc
18#include "vrpn_Tracker.h" // for vrpn_Tracker
19
23
25public:
26 VRPN_API vrpn_IMU_Axis_Params(void) {
27 for (size_t i = 0; i < 3; i++) {
28 channels[i] = 0;
29 offsets[i] = 0;
30 scales[i] = 1;
31 }
32 }
33
34 std::string name; //< Name of the Analog device driving these axes
35
36 int channels[3]; //< Which channel to use from the Analog device for each axis
37 double offsets[3]; //< Offset to apply to the measurement (applied before scale)
38 double scales[3]; //< Scale, including positive or negative axis
39};
40
42public:
43 VRPN_API vrpn_IMU_Vector (void) { ana = NULL;
44 values[0] = values[1] = values[2] = 0.0;
45 time.tv_sec = 0; time.tv_usec = 0; };
46
47 vrpn_IMU_Axis_Params params; //< Parameters used to construct values
48 vrpn_Analog_Remote *ana; //< Analog Remote device to listen to
49 double values[3]; //< Vector fo values
50 struct timeval time; //< Time of the report used to generate value
51};
52
64
66public:
80 VRPN_API vrpn_IMU_Magnetometer(std::string const &name, vrpn_Connection *output_con,
81 vrpn_IMU_Axis_Params params, float update_rate,
82 bool report_changes = VRPN_FALSE);
83
84 virtual VRPN_API ~vrpn_IMU_Magnetometer();
85
87 virtual VRPN_API void mainloop();
88
89protected:
90 double d_update_interval; //< How long to wait between sends
91 struct timeval d_prevtime; //< Time of the previous report
92 bool d_report_changes; //< Call report_changes() or report()?
93
96
98 double d_mins[3], d_maxes[3];
99
100 int setup_vector(vrpn_IMU_Vector *vector);
101 int teardown_vector(vrpn_IMU_Vector *vector);
102
103 static void VRPN_CALLBACK handle_analog_update (void *userdata,
104 const vrpn_ANALOGCB info);
105};
106
108public:
109 VRPN_API vrpn_Tracker_IMU_Params(void) {}
110
111 vrpn_IMU_Axis_Params d_acceleration; //< Acceleration input to use
112 vrpn_IMU_Axis_Params d_rotational_vel; //< Rotational velocity input to use
113 std::string d_magnetometer_name; //< Magnetometer to use (Empty if none)
114};
115
117// interpreting them as inertial-measurement report vectors. The two required
118// inputs are an acceleration vector and a rotational velocity measurement. There
119// is an optional magnetometer.
120// The accelerometer scale parameter should be set to produce values that
121// are in meters/second/second. The rotational input scale parameters should
122// be set to produce values that are in radians/second. The magnetometer
123// scale should be set to produce a unit normal vector.
124// NOTE: The coordinate system of the HMD has X to the right as the device
125// is worn, Y facing up, and Z pointing out the back of the wearer's head.
126// The time reported by is as of the last report received from any device.
127// If reportChanges is TRUE, updates are ONLY sent if there has been a
128// change since the last update, in which case they are generated no faster
129// than update_rate.
130
132 public:
133 VRPN_API vrpn_IMU_SimpleCombiner(const char *name, vrpn_Connection *trackercon,
135 float update_rate, bool report_changes = VRPN_FALSE);
136
137 virtual VRPN_API ~vrpn_IMU_SimpleCombiner(void);
138
139 virtual VRPN_API void mainloop ();
140
141 protected:
142 double d_update_interval; //< How long to wait between sends
143 struct timeval d_prevtime; //< Time of the previous report
144 bool d_report_changes; //< Report only changes, or always?
145
146 vrpn_IMU_Vector d_acceleration; //< Analog input for accelerometer
147 vrpn_IMU_Vector d_rotational_vel; //< Analog input for rotational velocity
148 vrpn_IMU_Vector d_magnetometer; //< Analog input for magnetometer, if present
149
150 double d_gravity_restore_rate; //< Radians/second to restore gravity vector
151 double d_north_restore_rate; //< Radians/second to restore North vector
152
153 struct timeval d_prev_update_time; //< Time of previous integration update
154 void update_matrix_based_on_values(double time_interval);
155
156 int setup_vector(vrpn_IMU_Vector *vector, vrpn_ANALOGCHANGEHANDLER f);
157 int teardown_vector(vrpn_IMU_Vector *vector, vrpn_ANALOGCHANGEHANDLER f);
158
159 static void VRPN_CALLBACK handle_analog_update(void *userdata,
160 const vrpn_ANALOGCB info);
161};
162
定义 vrpn_Analog.h:181
定义 vrpn_Analog.h:95
virtual void report_changes(vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY, const struct timeval time=vrpn_ANALOG_NOW)
Makes public the protected base class function
Generic connection class not specific to the transport mechanism.
定义 vrpn_Connection.h:562
Describes information describing an IMU axis. It describes the analog channel to use to drive the axi...
定义 vrpn_Tracker_IMU.h:24
Normalizes the three directions for a magnetometer into a unit vector.
定义 vrpn_Tracker_IMU.h:65
double d_mins[3]
Minimum, maximum, and current values for each axis.
定义 vrpn_Tracker_IMU.h:98
vrpn_IMU_Vector d_vector
Axes to handle gathering and scaling the required data.
定义 vrpn_Tracker_IMU.h:95
virtual VRPN_API void mainloop()
Override base class function.
VRPN_API vrpn_IMU_Magnetometer(std::string const &name, vrpn_Connection *output_con, vrpn_IMU_Axis_Params params, float update_rate, bool report_changes=VRPN_FALSE)
Constructor
This class will turn set of two or three analog devices into a tracker by
定义 vrpn_Tracker_IMU.h:131
virtual VRPN_API void mainloop()
定义 vrpn_Tracker_IMU.h:41
定义 vrpn_Tracker_IMU.h:107
定义 vrpn_Tracker.h:49
定义 vrpn_Analog.h:168