RflySimSDK v3.05
RflySimSDK说明文档
载入中...
搜索中...
未找到
vrpn_Tracker_WiimoteHead类 参考

Provides a tracker device given data from a Wii Remote and LED glasses. 更多...

#include <vrpn_Tracker_WiimoteHead.h>

+ 类 vrpn_Tracker_WiimoteHead 继承关系图:
+ vrpn_Tracker_WiimoteHead 的协作图:

Public 成员函数

 vrpn_Tracker_WiimoteHead (const char *name, vrpn_Connection *trackercon, const char *wiimote, float update_rate, float led_spacing=0.145)
 constructor
 
virtual ~vrpn_Tracker_WiimoteHead ()
 destructor
 
virtual void reset ()
 reset pose, gravity transform, and cached points and gravity
 
void setup_wiimote ()
 set up connection to wiimote-like analog device
 
virtual void mainloop ()
 VRPN mainloop function
 
void update_pose ()
 function to drive the full pose update process
 
void report ()
 Pack and send tracker report
 
- Public 成员函数 继承自 vrpn_Tracker
 vrpn_Tracker (const char *name, vrpn_Connection *c=NULL, const char *tracker_cfg_file_name=NULL)
 
int read_config_file (FILE *config_file, const char *tracker_name)
 
void print_latest_report (void)
 
int register_server_handlers (void)
 
void get_local_t2r (vrpn_float64 *vec, vrpn_float64 *quat)
 
void get_local_u2s (vrpn_int32 sensor, vrpn_float64 *vec, vrpn_float64 *quat)
 
- Public 成员函数 继承自 vrpn_BaseClass
 vrpn_BaseClass (const char *name, vrpn_Connection *c=NULL)
 
- Public 成员函数 继承自 vrpn_BaseClassUnique
vrpn_ConnectionconnectionPtr ()
 Returns a pointer to the connection this object is using
 

静态 Public 成员函数

static int VRPN_CALLBACK VRPN_CALLBACK handle_connection (void *, vrpn_HANDLERPARAM)
 Callback triggered when a new client connects to the tracker
 
static void VRPN_CALLBACK VRPN_CALLBACK handle_analog_update (void *userdata, const vrpn_ANALOGCB info)
 Callback triggered when our data source issues an update
 
- 静态 Public 成员函数 继承自 vrpn_Tracker
static int VRPN_CALLBACK handle_t2r_request (void *userdata, vrpn_HANDLERPARAM p)
 
static int VRPN_CALLBACK handle_u2s_request (void *userdata, vrpn_HANDLERPARAM p)
 
static int VRPN_CALLBACK handle_workspace_request (void *userdata, vrpn_HANDLERPARAM p)
 

Protected 类型

enum  FlipState { FLIP_NORMAL , FLIP_180 , FLIP_UNKNOWN }
 

Protected 成员函数

void _update_gravity_moving_avg ()
 based on cached gravity data, use a moving average to update the tracker's stored gravity transform.
 
void _update_2_LED_pose (q_xyz_quat_type &newPose)
 Create tracker-relative pose estimate based on sensor location of 2 tracked points.
 
void _update_flip_state ()
 If flip state is unknown, set flip state appropriately.
 
void _convert_pose_to_tracker ()
 Set the vrpn_Tracker position and rotation to that indicated by our d_currentPose;
 
void _reset_gravity ()
 reset gravity transform and cached gravity vectors
 
void _reset_points ()
 reset cached points, point count, and flip state,
 
void _reset_pose ()
 reset current pose, last report time, and tracker pose
 
bool _should_report (double elapsedInterval) const
 return true if we have new data or max time elapsed
 
bool _have_gravity () const
 return true if our gravity values look like real data
 
- Protected 成员函数 继承自 vrpn_Tracker
bool ensure_enough_unit2sensors (unsigned num)
 
virtual int register_types (void)
 
virtual int encode_to (char *buf)
 
virtual int encode_vel_to (char *buf)
 
virtual int encode_acc_to (char *buf)
 
virtual int encode_tracker2room_to (char *buf)
 
virtual int encode_unit2sensor_to (char *buf)
 
virtual int encode_workspace_to (char *buf)
 
- Protected 成员函数 继承自 vrpn_BaseClass
virtual int init (void)
 
virtual int register_senders (void)
 
- Protected 成员函数 继承自 vrpn_BaseClassUnique
int register_autodeleted_handler (vrpn_int32 type, vrpn_MESSAGEHANDLER handler, void *userdata, vrpn_int32 sender=vrpn_ANY_SENDER)
 
int send_text_message (const char *msg, struct timeval timestamp, vrpn_TEXT_SEVERITY type=vrpn_TEXT_NORMAL, vrpn_uint32 level=0)
 Sends a NULL-terminated text message from the device d_sender_id
 
SendTextMessageBoundCall send_text_message (vrpn_TEXT_SEVERITY type=vrpn_TEXT_NORMAL)
 
void server_mainloop (void)
 
void client_mainloop (void)
 

Protected 属性

const char * d_name
 Tracker device name
 
const double d_update_interval
 maximum time between updates, in seconds
 
const double d_blobDistance
 distance between LEDs on glasses, in meters
 
FlipState d_flipState
 Whether we need to flip the order of the tracked points before calculating a pose.
 
struct timeval d_prevtime
 Time of last tracker report issued
 
double d_vX [4]
 
double d_vY [4]
 
double d_vSize [4]
 
double d_points
 
vrpn_Analog_Remoted_ana
 Source of analog data, traditionally vrpn_WiiMote Must present analog channels in this order:
 
q_xyz_quat_type d_gravityXform
 Gravity correction transformation
 
q_xyz_quat_type d_currentPose
 Current pose estimate
 
bool d_contact
 Flag: Have we received the first message from the Wiimote?
 
bool d_lock
 Flag: Does the tracking algorithm report a lock?
 
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?
 
q_vec_type d_vGravAntepenultimate
 
q_vec_type d_vGravPenultimate
 
q_vec_type d_vGrav
 
- Protected 属性 继承自 vrpn_Tracker
vrpn_int32 position_m_id
 
vrpn_int32 velocity_m_id
 
vrpn_int32 accel_m_id
 
vrpn_int32 tracker2room_m_id
 
vrpn_int32 unit2sensor_m_id
 
vrpn_int32 request_t2r_m_id
 
vrpn_int32 request_u2s_m_id
 
vrpn_int32 request_workspace_m_id
 
vrpn_int32 workspace_m_id
 
vrpn_int32 update_rate_id
 
vrpn_int32 connection_dropped_m_id
 
vrpn_int32 reset_origin_m_id
 
vrpn_int32 d_sensor
 
vrpn_float64 pos [3]
 
vrpn_float64 d_quat [4]
 
vrpn_float64 vel [3]
 
vrpn_float64 vel_quat [4]
 
vrpn_float64 vel_quat_dt
 
vrpn_float64 acc [3]
 
vrpn_float64 acc_quat [4]
 
vrpn_float64 acc_quat_dt
 
struct timeval timestamp
 
vrpn_int32 frame_count
 
struct timeval watchdog_timestamp
 
vrpn_float64 tracker2room [3]
 
vrpn_float64 tracker2room_quat [4]
 
vrpn_int32 num_sensors
 
vrpn_Tracker_Pos * unit2sensor
 
vrpn_Tracker_Quat * unit2sensor_quat
 
unsigned num_unit2sensors
 
vrpn_float64 workspace_min [3]
 
vrpn_float64 workspace_max [3]
 
int status
 
- Protected 属性 继承自 vrpn_BaseClassUnique
vrpn_Connectiond_connection
 Connection that this object talks to
 
char * d_servicename
 
vrpn_int32 d_sender_id
 part
 
vrpn_int32 d_text_message_id
 ID for text messages
 
vrpn_int32 d_ping_message_id
 Ask the server if they are there
 
vrpn_int32 d_pong_message_id
 Server telling that it is there
 

额外继承的成员函数

- Public 属性 继承自 vrpn_BaseClassUnique
bool shutup
 
- 静态 Protected 成员函数 继承自 vrpn_BaseClassUnique
static int encode_text_message_to_buffer (char *buf, vrpn_TEXT_SEVERITY severity, vrpn_uint32 level, const char *msg)
 
static int decode_text_message_from_buffer (char *msg, vrpn_TEXT_SEVERITY *severity, vrpn_uint32 *level, const char *buf)
 Decodes the body of the text message from a buffer from the connection
 

详细描述

Provides a tracker device given data from a Wii Remote and LED glasses.

Assumes a reasonably-stationary Wii Remote (on a tripod, for example) and two LEDs on a pair of glasses, some fixed distance (default 0.145m) apart. You can use the "Johnny Lee" glasses with this.

Reports poses in a right-hand coordinate system, y-up, that is always level with respect to gravity no matter how your Wii Remote is tilted.

构造及析构函数说明

◆ vrpn_Tracker_WiimoteHead()

vrpn_Tracker_WiimoteHead ( const char * name,
vrpn_Connection * trackercon,
const char * wiimote,
float update_rate,
float led_spacing = 0.145 )

constructor

参数
nameName for the tracker device to expose
trackerconConnection to provide tracker device over
wiimoteVRPN device name for existing vrpn_WiiMote device or device with a compatible interface - see vrpn_Tracker_WiimoteHead::d_ana for more info. If it starts with *, the server connection will be used instead of creating a new connection.
update_rateMinimum number of updates per second to issue
led_spacingDistance between LEDs in meters (0.145 is default)

◆ ~vrpn_Tracker_WiimoteHead()

virtual ~vrpn_Tracker_WiimoteHead ( )
virtual

destructor

成员函数说明

◆ _convert_pose_to_tracker()

void _convert_pose_to_tracker ( )
protected

Set the vrpn_Tracker position and rotation to that indicated by our d_currentPose;

◆ _have_gravity()

bool _have_gravity ( ) const
protected

return true if our gravity values look like real data

◆ _reset_gravity()

void _reset_gravity ( )
protected

reset gravity transform and cached gravity vectors

◆ _reset_points()

void _reset_points ( )
protected

reset cached points, point count, and flip state,

◆ _reset_pose()

void _reset_pose ( )
protected

reset current pose, last report time, and tracker pose

◆ _should_report()

bool _should_report ( double elapsedInterval) const
protected

return true if we have new data or max time elapsed

◆ _update_2_LED_pose()

void _update_2_LED_pose ( q_xyz_quat_type & newPose)
protected

Create tracker-relative pose estimate based on sensor location of 2 tracked points.

If d_points == 2:

  • 后置条件
    d_currentPose contains a tracker-relative pose estimate
  • 后置条件
    d_lock == true Else:
  • 后置条件
    d_lock == false
  • 后置条件
    d_flipState = FLIP_UNKNOWN

◆ _update_flip_state()

void _update_flip_state ( )
protected

If flip state is unknown, set flip state appropriately.

后置条件
d_flipState=FLIP_NORMAL if the up vector created by d_currentPose has a positive y component (tracked object is right side up)
d_flipState=FLIP_180 if the up vector created by d_currentPose does not have a positive y component (tracked object appears upside-down), which means that you should re-try the pose computation with the points in the opposite order.

◆ _update_gravity_moving_avg()

void _update_gravity_moving_avg ( )
protected

based on cached gravity data, use a moving average to update the tracker's stored gravity transform.

The moving average is computed over the last 3 unique gravity reports. The transform is the rotation required to rotate the averaged gravity vector to (0, 1, 0).

◆ handle_analog_update()

static void VRPN_CALLBACK VRPN_CALLBACK handle_analog_update ( void * userdata,
const vrpn_ANALOGCB info )
static

Callback triggered when our data source issues an update

◆ handle_connection()

static int VRPN_CALLBACK VRPN_CALLBACK handle_connection ( void * ,
vrpn_HANDLERPARAM  )
static

Callback triggered when a new client connects to the tracker

◆ mainloop()

virtual void mainloop ( )
virtual

VRPN mainloop function

实现了 vrpn_BaseClass.

◆ report()

void report ( )

Pack and send tracker report

◆ reset()

virtual void reset ( )
virtual

reset pose, gravity transform, and cached points and gravity

◆ setup_wiimote()

void setup_wiimote ( )

set up connection to wiimote-like analog device

◆ update_pose()

void update_pose ( )

function to drive the full pose update process

If we claim to have a tracker lock after updating, we will transform the current pose by the gravity transform before continuing.

类成员变量说明

◆ d_ana

vrpn_Analog_Remote* d_ana
protected

Source of analog data, traditionally vrpn_WiiMote Must present analog channels in this order:

  • x, y, z components of vector opposed to gravity
    • (0,0,1) is nominal Earth gravity
  • four 3-tuples containing either:
    • (x, y, size) for a tracked point (ranges [0, 1023], [0, 1023], [1,16])
    • (-1, -1, -1) as a place holder - point not seen

◆ d_blobDistance

const double d_blobDistance
protected

distance between LEDs on glasses, in meters

◆ d_contact

bool d_contact
protected

Flag: Have we received the first message from the Wiimote?

◆ d_currentPose

q_xyz_quat_type d_currentPose
protected

Current pose estimate

◆ d_flipState

FlipState d_flipState
protected

Whether we need to flip the order of the tracked points before calculating a pose.

◆ d_gravDirty

bool d_gravDirty
protected

Flag: Have we received updated gravity data since last gravity update?

◆ d_gravityXform

q_xyz_quat_type d_gravityXform
protected

Gravity correction transformation

◆ d_lock

bool d_lock
protected

Flag: Does the tracking algorithm report a lock?

◆ d_name

const char* d_name
protected

Tracker device name

◆ d_prevtime

struct timeval d_prevtime
protected

Time of last tracker report issued

◆ d_update_interval

const double d_update_interval
protected

maximum time between updates, in seconds

◆ d_updated

bool d_updated
protected

Flag: Have we received updated Wiimote data since last report?


该类的文档由以下文件生成: