24 if (info.
sensor >= me->d_channels) {
32 if (dt <= 0) { dt = 1; }
36 memcpy(quat, info.
quat,
sizeof(quat));
37 const vrpn_float64 *filtered = me->d_filters[info.
sensor].
filter(dt,
pos);
38 q_vec_copy(me->
pos, filtered);
39 const double *q_filtered = me->d_qfilters[info.
sensor].
filter(dt, quat);
40 q_normalize(me->
d_quat, q_filtered);
50 fprintf(stderr,
"vrpn_Tracker_FilterOneEuro: cannot write message: tossing\n");
55 const char *listen_tracker_name,
56 unsigned channels, vrpn_float64 vecMinCutoff,
57 vrpn_float64 vecBeta, vrpn_float64 vecDerivativeCutoff,
58 vrpn_float64 quatMinCutoff, vrpn_float64 quatBeta,
59 vrpn_float64 quatDerivativeCutoff)
61 , d_channels(channels)
64 d_last_report_times =
new struct timeval[channels];
65 if (d_last_report_times == NULL) {
66 fprintf(stderr,
"vrpn_Tracker_FilterOneEuro::vrpn_Tracker_FilterOneEuro(): Out of memory\n");
76 if ( (d_filters == NULL) || (d_qfilters == NULL) ) {
77 fprintf(stderr,
"vrpn_Tracker_FilterOneEuro::vrpn_Tracker_FilterOneEuro(): Out of memory\n");
83 for (
int i = 0; i < static_cast<int>(channels); ++i) {
89 d_qfilters[i].
setBeta(quatBeta);
96 if (listen_tracker_name[0] ==
'*') {
108 delete d_listen_tracker;
109 if (d_qfilters) {
delete [] d_qfilters; d_qfilters = NULL; }
110 if (d_filters) {
delete [] d_filters; d_filters = NULL; }
111 if (d_last_report_times) {
delete [] d_last_report_times; d_last_report_times = NULL; }
const vrpn_uint32 vrpn_CONNECTION_LOW_LATENCY
const value_filter_return_type filter(scalar_type dt, const value_type x)
void server_mainloop(void)
Handles functions that all servers should provide in their mainloop() (ping/pong, for example) Should...
virtual int register_change_handler(void *userdata, vrpn_TRACKERCHANGEHANDLER handler, vrpn_int32 sensor=vrpn_ALL_SENSORS)
Header for a class of trackers that read from one tracker and apply a filter to the inputs,...
void setMinCutoff(scalar_type mincutoff)
Generic connection class not specific to the transport mechanism.
double vrpn_TimevalDurationSeconds(struct timeval endT, struct timeval startT)
Return the number of seconds between startT and endT as a floating-point value.
virtual void mainloop()
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
vrpn_Connection * d_connection
Connection that this object talks to.
virtual void mainloop()
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
virtual int pack_message(vrpn_uint32 len, struct timeval time, vrpn_int32 type, vrpn_int32 sender, const char *buffer, vrpn_uint32 class_of_service)
Pack a message that will be sent the next time mainloop() is called. Turn off the RELIABLE flag if yo...
void setDerivativeCutoff(scalar_type dcutoff)
virtual int encode_to(char *buf)
Tracker filter based on the one-Euro filter by Jan Ciger jan.ciger@reviatech.com
virtual int unregister_change_handler(void *userdata, vrpn_TRACKERCHANGEHANDLER handler, vrpn_int32 sensor=vrpn_ALL_SENSORS)
Header allowing use of a output stream-style method of sending text messages from devices.
#define vrpn_gettimeofday
Header file that completely implements a direction and orientation filter on tracking reports; it doe...
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)
vrpn_int32 d_sender_id
Sender ID registered with the connection.
void setBeta(scalar_type beta)
~vrpn_Tracker_FilterOneEuro()