47#ifndef __TRACKER_WIIMOTEHEAD_H
48#define __TRACKER_WIIMOTEHEAD_H
87 float led_spacing = 0.145);
virtual void mainloop()=0
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
Generic connection class not specific to the transport mechanism.
void _reset_points()
reset cached points, point count, and flip state,
static void VRPN_CALLBACK VRPN_CALLBACK handle_analog_update(void *userdata, const vrpn_ANALOGCB info)
Callback triggered when our data source issues an update.
void _update_gravity_moving_avg()
based on cached gravity data, use a moving average to update the tracker's stored gravity transform.
q_xyz_quat_type d_currentPose
Current pose estimate.
void report()
Pack and send tracker report.
vrpn_Analog_Remote * d_ana
Source of analog data, traditionally vrpn_WiiMote Must present analog channels in this order:
struct timeval d_prevtime
Time of last tracker report issued.
void _update_2_LED_pose(q_xyz_quat_type &newPose)
Create tracker-relative pose estimate based on sensor location of 2 tracked points.
FlipState d_flipState
Whether we need to flip the order of the tracked points before calculating a pose.
const double d_blobDistance
distance between LEDs on glasses, in meters
vrpn_Tracker_WiimoteHead(const char *name, vrpn_Connection *trackercon, const char *wiimote, float update_rate, float led_spacing=0.145)
constructor
q_xyz_quat_type d_gravityXform
Gravity correction transformation.
q_vec_type d_vGravPenultimate
q_vec_type d_vGravAntepenultimate
bool d_lock
Flag: Does the tracking algorithm report a lock?
void _reset_gravity()
reset gravity transform and cached gravity vectors
void _update_flip_state()
If flip state is unknown, set flip state appropriately.
bool _should_report(double elapsedInterval) const
return true if we have new data or max time elapsed
static int VRPN_CALLBACK VRPN_CALLBACK handle_connection(void *, vrpn_HANDLERPARAM)
Callback triggered when a new client connects to the tracker.
bool d_updated
Flag: Have we received updated Wiimote data since last report?
bool d_gravDirty
Flag: Have we received updated gravity data since last gravity update?
virtual void reset()
reset pose, gravity transform, and cached points and gravity
bool d_contact
Flag: Have we received the first message from the Wiimote?
const char * d_name
Tracker device name.
bool _have_gravity() const
return true if our gravity values look like real data
void _reset_pose()
reset current pose, last report time, and tracker pose
const double d_update_interval
maximum time between updates, in seconds
void update_pose()
function to drive the full pose update process
void setup_wiimote()
set up connection to wiimote-like analog device
void _convert_pose_to_tracker()
Set the vrpn_Tracker position and rotation to that indicated by our d_currentPose;.
vrpn_Tracker(const char *name, vrpn_Connection *c=NULL, const char *tracker_cfg_file_name=NULL)
This structure is what is passed to a vrpn_Connection message callback.
class VRPN_API vrpn_Connection