16 d_update_interval (update_rate ? (1/update_rate) : 1.0),
17 d_reportChanges (reportChanges),
19 d_vel_scale_value(1.0),
21 d_rot_scale_value(1.0)
30 for (i = 0; i < params->
num_axes; i++) {
67 fprintf(stderr,
"vrpn_Tracker_ButtonFly: "
99 fprintf(stderr,
"vrpn_Tracker_ButtonFly: "
118 for ( i =0; i< 4; i++)
119 for (
int j=0; j< 4; j++)
143 fprintf(stderr,
"vrpn_Tracker_ButtonFly::~vrpn_Tracker_ButtonFly(): delete failed\n");
152 fprintf(stderr,
"vrpn_Tracker_ButtonFly::~vrpn_Tracker_ButtonFly(): delete failed\n");
171 }
catch (...) { full->
btn = NULL; }
173 printf(
"vrpn_Tracker_ButtonFly: Adding local button %s\n",
179 }
catch (...) { full->
btn = NULL; }
181 printf(
"vrpn_Tracker_ButtonFly: Adding remote button %s\n",
185 if (full->
btn == NULL) {
186 fprintf(stderr,
"vrpn_Tracker_ButtonFly: "
187 "Can't open Button %s\n",full->
axis.
name);
203 if (full->
btn == NULL) {
return 0; }
212 fprintf(stderr,
"vrpn_Tracker_ButtonFly::teardown_channel(): delete failed\n");
231 double value_abs = fabs(value_scaled);
232 double value_powered;
235 if (value_offset >=0) {
257 double value_abs = fabs(value_scaled);
258 double value_powered;
261 if (value_offset >=0) {
290 if (info.
state == 1) {
291 double tx,ty,tz, rx,ry,rz;
292 q_matrix_type newMatrix;
304 q_euler_to_col_matrix(newMatrix, rz, ry, rx);
305 newMatrix[3][0] = tx; newMatrix[3][1] = ty; newMatrix[3][2] = tz;
334 printf(
"Get a new connection, reset virtual_Tracker\n");
397 fprintf(stderr,
"Tracker ButtonFly: cannot write message: tossing\n");
400 fprintf(stderr,
"Tracker ButtonFly: No valid connection\n");
428 (
double time_interval)
430 double tx,ty,tz, rx,ry,rz;
437 tx = ty = tz = rx = ry = rz = 0.0;
452 q_euler_to_col_matrix(diffM, rz, ry, rx);
453 diffM[3][0] = tx; diffM[3][1] = ty; diffM[3][2] = tz;
471 for (i=0; i< 3; i++) {
474 for (i=0; i< 4; i++) {
480 (
double elapsedInterval) {
virtual int unregister_change_handler(void *userdata, vrpn_ANALOGCHANGEHANDLER handler)
virtual void mainloop()
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
virtual int register_change_handler(void *userdata, vrpn_ANALOGCHANGEHANDLER handler)
int register_autodeleted_handler(vrpn_int32 type, vrpn_MESSAGEHANDLER handler, void *userdata, vrpn_int32 sender=vrpn_ANY_SENDER)
Registers a handler with the connection, and remembers to delete at destruction.
vrpn_Connection * d_connection
Connection that this object talks to.
vrpn_int32 d_sender_id
Sender ID registered with the connection.
void server_mainloop(void)
Handles functions that all servers should provide in their mainloop() (ping/pong, for example) Should...
Generic connection class not specific to the transport mechanism.
virtual vrpn_int32 register_message_type(const char *name)
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...
vrpn_Tracker_ButtonFly * bf
virtual int encode_to(char *buf)
vrpn_float64 channel[vrpn_CHANNEL_MAX]
This structure is what is passed to a vrpn_Connection message callback.
const char * vrpn_got_first_connection
These are the strings that define the system-generated message types that tell when connections are r...
const vrpn_uint32 vrpn_CONNECTION_LOW_LATENCY
double vrpn_TimevalDurationSeconds(struct timeval endT, struct timeval startT)
Return the number of seconds between startT and endT as a floating-point value.
#define vrpn_gettimeofday