vrpn
07.35
Virtual Reality Peripheral Network
Toggle main menu visibility
Loading...
Searching...
No Matches
vrpn_Tracker_Filter.h
Go to the documentation of this file.
1
12
13
#pragma once
14
15
// Internal Includes
16
#include "quat.h"
// for q_vec_type
17
#include "
vrpn_Tracker.h
"
// for vrpn_Tracker
18
#include "
vrpn_OneEuroFilter.h
"
19
#include <string>
20
#include <vector>
21
30
31
class
VRPN_API
vrpn_Tracker_FilterOneEuro
:
public
vrpn_Tracker
{
32
public
:
33
// name is the name that the filtered reports go out under
34
// trackercon is the server connection to use to send filtered reports on
35
// listen_tracker_name is the name of the tracker we listen to to filter
36
// If the tracker should use the server connection, then put * in
37
// front of the name.
38
// channels tells how many channels from the listening tracker to
39
// filter (reports on other channels are ignored by this tracker)
40
// The other parameters are passed to each One-Euro filter.
41
vrpn_Tracker_FilterOneEuro
(
const
char
* name,
vrpn_Connection
* trackercon,
42
const
char
*listen_tracker_name,
43
unsigned
channels, vrpn_float64 vecMinCutoff = 1.15,
44
vrpn_float64 vecBeta = 0.5, vrpn_float64 vecDerivativeCutoff = 1.2,
45
vrpn_float64 quatMinCutoff = 1.5, vrpn_float64 quatBeta = 0.5,
46
vrpn_float64 quatDerivativeCutoff = 1.2);
47
~vrpn_Tracker_FilterOneEuro
();
48
49
virtual
void
mainloop
();
50
51
private
:
52
int
d_channels;
// How many channels on our tracker?
53
vrpn_OneEuroFilterVec
*d_filters;
// Set of position filters, one/channel
54
vrpn_OneEuroFilterQuat
*d_qfilters;
// Set of orientation filters, one/channel
55
struct
timeval *d_last_report_times;
// Last time of report for each tracker.
56
vrpn_Tracker_Remote
*d_listen_tracker;
// Tracker we get our reports from
57
58
// Callback handler to deal with getting messages from the tracker we're
59
// listening to. It filters them and then sends them on.
60
static
void
VRPN_CALLBACK
handle_tracker_update(
void
*
userdata
,
const
vrpn_TRACKERCB
info);
61
};
62
63
65
// of the specified sensors from the specified tracker. If there are no orientation
66
// velocity reports, use the two most-recent poses to estimate angular velocity and
67
// use that to predict.
68
// Note: This class does not try to listen for angular acceleration.
69
// Note: This class does not try to forward-predict position, it leaves that
70
// part of the tracker message alone.
71
72
class
VRPN_API
vrpn_Tracker_DeadReckoning_Rotation
:
public
vrpn_Tracker_Server
73
{
74
public
:
75
76
vrpn_Tracker_DeadReckoning_Rotation
(
77
std::string myName
//< Name of the tracking device we're exposing
78
,
vrpn_Connection
*c
//< Connection to use to send reports on
79
, std::string origTrackerName
//< Name of tracker to predict (*Name for one using our connection, Name@URL for one we should connect to)
80
, vrpn_int32 numSensors = 1
//< How many sensors to predict for?
81
, vrpn_float64 predictionTime = 1.0 / 60.0
//< How far to predict into the future?
82
,
bool
estimateVelocity =
true
//< Should we estimate angular velocity if we don't get it?
83
//< If false, this is basically just a pass-through filter, but estimating velocity can be choppy.
84
);
85
86
~vrpn_Tracker_DeadReckoning_Rotation
();
87
88
// Handle ping/pong requests.
89
void
mainloop
();
90
92
// prints an error message and returns an integer indicating what happened on failure.
93
static
int
test
(
void
);
94
95
protected
:
96
97
vrpn_float64
d_predictionTime
;
//< How far ahead to predict rotation
98
vrpn_int32
d_numSensors
;
//< How many sensors to predict for?
99
vrpn_Tracker_Remote
*
d_origTracker
;
//< Original tracker we're predicting for
100
101
typedef
struct
{
102
bool
d_receivedAngularVelocityReport
;
//< If we get these, we don't estimate them
103
vrpn_float64
d_rotationAmount
[4];
//< How far did we rotate in the specified interval
104
double
d_rotationInterval
;
//< Interval over which we rotated
105
vrpn_float64
d_lastPosition
[3];
//< What was our last reported position?
106
vrpn_float64
d_lastOrientation
[4];
//< What was our last orientation?
107
struct
timeval
d_lastReportTime
;
//< When did we receive it?
108
}
RotationState
;
109
std::vector<RotationState>
d_rotationStates
;
//< State of rotation of each sensor.
110
112
static
void
VRPN_CALLBACK
handle_tracker_report
(
void
*
userdata
,
113
const
vrpn_TRACKERCB
info);
114
static
void
VRPN_CALLBACK
handle_tracker_velocity_report
(
void
*
userdata
,
115
const
vrpn_TRACKERVELCB
info);
116
118
// prediction in the future from the original message by the prediction
119
// interval.
120
void
sendNewPrediction
(vrpn_int32 sensor);
121
122
bool
d_estimateVelocity
;
123
};
124
vrpn_BaseClassUnique::userdata
void * userdata
Definition
vrpn_BaseClass.h:290
vrpn_BaseClass::mainloop
virtual void mainloop()=0
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
vrpn_Connection
Generic connection class not specific to the transport mechanism.
Definition
vrpn_Connection.h:561
vrpn_Tracker_DeadReckoning_Rotation::d_estimateVelocity
bool d_estimateVelocity
Definition
vrpn_Tracker_Filter.h:122
vrpn_Tracker_DeadReckoning_Rotation::d_rotationStates
std::vector< RotationState > d_rotationStates
Definition
vrpn_Tracker_Filter.h:109
vrpn_Tracker_DeadReckoning_Rotation::sendNewPrediction
void sendNewPrediction(vrpn_int32 sensor)
Send a prediction based on the time of the new information; date the.
Definition
vrpn_Tracker_Filter.C:189
vrpn_Tracker_DeadReckoning_Rotation::vrpn_Tracker_DeadReckoning_Rotation
vrpn_Tracker_DeadReckoning_Rotation(std::string myName, vrpn_Connection *c, std::string origTrackerName, vrpn_int32 numSensors=1, vrpn_float64 predictionTime=1.0/60.0, bool estimateVelocity=true)
Definition
vrpn_Tracker_Filter.C:122
vrpn_Tracker_DeadReckoning_Rotation::d_numSensors
vrpn_int32 d_numSensors
Definition
vrpn_Tracker_Filter.h:98
vrpn_Tracker_DeadReckoning_Rotation::handle_tracker_report
static void VRPN_CALLBACK handle_tracker_report(void *userdata, const vrpn_TRACKERCB info)
Static callback handler for tracker reports and tracker velocity reports.
Definition
vrpn_Tracker_Filter.C:260
vrpn_Tracker_DeadReckoning_Rotation::handle_tracker_velocity_report
static void VRPN_CALLBACK handle_tracker_velocity_report(void *userdata, const vrpn_TRACKERVELCB info)
Definition
vrpn_Tracker_Filter.C:310
vrpn_Tracker_DeadReckoning_Rotation::d_origTracker
vrpn_Tracker_Remote * d_origTracker
Definition
vrpn_Tracker_Filter.h:99
vrpn_Tracker_DeadReckoning_Rotation::test
static int test(void)
Test the class to make sure it functions as it should. Returns 0 on success,.
Definition
vrpn_Tracker_Filter.C:392
vrpn_Tracker_DeadReckoning_Rotation::d_predictionTime
vrpn_float64 d_predictionTime
Definition
vrpn_Tracker_Filter.h:97
vrpn_Tracker_FilterOneEuro::vrpn_Tracker_FilterOneEuro
vrpn_Tracker_FilterOneEuro(const char *name, vrpn_Connection *trackercon, const char *listen_tracker_name, unsigned channels, vrpn_float64 vecMinCutoff=1.15, vrpn_float64 vecBeta=0.5, vrpn_float64 vecDerivativeCutoff=1.2, vrpn_float64 quatMinCutoff=1.5, vrpn_float64 quatBeta=0.5, vrpn_float64 quatDerivativeCutoff=1.2)
Definition
vrpn_Tracker_Filter.C:53
vrpn_Tracker_Remote
Definition
vrpn_Tracker.h:396
vrpn_Tracker_Server::vrpn_Tracker_Server
vrpn_Tracker_Server(const char *name, vrpn_Connection *c, vrpn_int32 sensors=1)
Definition
vrpn_Tracker.C:832
vrpn_Tracker::vrpn_Tracker
vrpn_Tracker(const char *name, vrpn_Connection *c=NULL, const char *tracker_cfg_file_name=NULL)
Definition
vrpn_Tracker.C:45
vrpn_TRACKERCB
Definition
vrpn_Tracker.h:306
vrpn_TRACKERVELCB
Definition
vrpn_Tracker.h:319
vrpn_Tracker_DeadReckoning_Rotation::RotationState
Definition
vrpn_Tracker_Filter.h:101
vrpn_Tracker_DeadReckoning_Rotation::RotationState::d_receivedAngularVelocityReport
bool d_receivedAngularVelocityReport
Definition
vrpn_Tracker_Filter.h:102
vrpn_Tracker_DeadReckoning_Rotation::RotationState::d_lastOrientation
vrpn_float64 d_lastOrientation[4]
Definition
vrpn_Tracker_Filter.h:106
vrpn_Tracker_DeadReckoning_Rotation::RotationState::d_rotationAmount
vrpn_float64 d_rotationAmount[4]
Definition
vrpn_Tracker_Filter.h:103
vrpn_Tracker_DeadReckoning_Rotation::RotationState::d_lastPosition
vrpn_float64 d_lastPosition[3]
Definition
vrpn_Tracker_Filter.h:105
vrpn_Tracker_DeadReckoning_Rotation::RotationState::d_rotationInterval
double d_rotationInterval
Definition
vrpn_Tracker_Filter.h:104
vrpn_Tracker_DeadReckoning_Rotation::RotationState::d_lastReportTime
struct timeval d_lastReportTime
Definition
vrpn_Tracker_Filter.h:107
VRPN_API
#define VRPN_API
Definition
vrpn_Configure.h:648
VRPN_CALLBACK
#define VRPN_CALLBACK
Definition
vrpn_Configure.h:649
vrpn_OneEuroFilter.h
Header file that completely implements a direction and orientation filter on tracking reports; it doe...
vrpn_OneEuroFilterQuat
vrpn_OneEuroFilter< vrpn_QuatFilterable > vrpn_OneEuroFilterQuat
Definition
vrpn_OneEuroFilter.h:241
vrpn_OneEuroFilterVec
vrpn_OneEuroFilter vrpn_OneEuroFilterVec
Definition
vrpn_OneEuroFilter.h:173
vrpn_Tracker.h
vrpn_Tracker_Filter.h
Generated by
1.17.0