27#if defined(VRPN_USE_LIBUSB_1_0)
31#ifndef VRPN_CLIENT_ONLY
35static const char *default_tracker_cfg_file_name =
"vrpn_Tracker.cfg";
39#define vrpn_ser_tkr_MAX_TIME_INTERVAL \
46 const char *tracker_cfg_file_name)
49 , unit2sensor_quat(NULL)
86#ifdef DESKTOP_PHANTOM_DEFAULTS
99#ifdef DESKTOP_PHANTOM_DEFAULTS
110 if (tracker_cfg_file_name == NULL) {
111 tracker_cfg_file_name = default_tracker_cfg_file_name;
113 if ((config_file = fopen(tracker_cfg_file_name,
"r")) == NULL) {
119 if (tracker_cfg_file_name != default_tracker_cfg_file_name) {
120 fprintf(stderr,
"vrpn_Tracker: Can't find config file %s\n",
121 tracker_cfg_file_name);
127 "vrpn_Tracker: Found config file %s, but cannot read info for %s\n",
128 tracker_cfg_file_name, name);
132 fprintf(stderr,
"vrpn_Tracker: Read room and sensor info from %s\n",
133 tracker_cfg_file_name);
153 "vrpn_Tracker Request_Tracker_To_Room");
155 "vrpn_Tracker Request_Unit_To_Sensor");
159 "vrpn_Tracker Request_Tracker_Workspace");
176 fprintf(stderr,
"vrpn_Tracker::~vrpn_Tracker(): delete failed\n");
184 fprintf(stderr,
"vrpn_Tracker::~vrpn_Tracker(): delete failed\n");
207 catch (...) {
return false; }
210 catch (...) {
return false; }
220 newlist[i][0] = newlist[i][1] = newlist[i][2] = 0.0;
221 newqlist[i][0] = 0.0;
222 newqlist[i][1] = 0.0;
223 newqlist[i][2] = 0.0;
224 newqlist[i][3] = 1.0;
232 fprintf(stderr,
"vrpn_Tracker::ensure_enough_unit2sensors(): delete failed\n");
240 fprintf(stderr,
"vrpn_Tracker::ensure_enough_unit2sensors(): delete failed\n");
256 vrpn_int32 which_sensor;
261 while (fgets(line,
sizeof(line), config_file) != NULL) {
263 if (strlen(line) >=
sizeof(line) - 1) {
264 fprintf(stderr,
"Line too long in config file: %s\n", line);
268 if ((!(strncmp(line, tracker_name, strlen(tracker_name)))) &&
269 (isspace(line[strlen(tracker_name)]))) {
271 if (fgets(line,
sizeof(line), config_file) == NULL)
break;
272 if (sscanf(line,
"%f%f%f", &f[0], &f[1], &f[2]) != 3)
break;
273 if (fgets(line,
sizeof(line), config_file) == NULL)
break;
274 if (sscanf(line,
"%f%f%f%f", &f[3], &f[4], &f[5], &f[6]) != 4)
276 if (fgets(line,
sizeof(line), config_file) == NULL)
break;
277 if (sscanf(line,
"%f%f%f%f%f%f", &f[7], &f[8], &f[9], &f[10],
278 &f[11], &f[12]) != 6)
281 for (i = 0; i < 3; i++) {
286 for (i = 0; i < 4; i++)
289 if (fgets(line,
sizeof(line), config_file) == NULL)
break;
290 if (sscanf(line,
"%d", &num_sens) != 1)
break;
292 fprintf(stderr,
"Out of memory\n");
295 for (i = 0; i < num_sens; i++) {
297 if (fgets(line,
sizeof(line), config_file) == NULL)
break;
298 if (sscanf(line,
"%d", &which_sensor) != 1)
break;
300 fprintf(stderr,
"Out of memory\n");
304 if (fgets(line,
sizeof(line), config_file) == NULL)
break;
305 if (sscanf(line,
"%f%f%f", &f[0], &f[1], &f[2]) != 3)
break;
306 if (fgets(line,
sizeof(line), config_file) == NULL)
break;
307 if (sscanf(line,
"%f%f%f%f", &f[3], &f[4], &f[5], &f[6]) != 4)
309 for (j = 0; j < 3; j++) {
312 for (j = 0; j < 4; j++) {
320 fprintf(stderr,
"Error reading or %s not found in config file\n",
327 printf(
"----------------------------------------------------\n");
329 printf(
"Timestamp :%ld:%ld\n",
timestamp.tv_sec,
332 printf(
"Pos :%lf, %lf, %lf\n",
pos[0],
pos[1],
pos[2]);
342 fprintf(stderr,
"vrpn_Tracker:can't register t2r handler\n");
347 fprintf(stderr,
"vrpn_Tracker:can't register u2s handler\n");
353 fprintf(stderr,
"vrpn_Tracker: "
354 "Can't register workspace handler\n");
368 for (i = 0; i < 3; i++)
370 for (i = 0; i < 4; i++)
380 for (i = 0; i < 3; i++)
382 for (i = 0; i < 4; i++)
388 struct timeval current_time;
396 me->
timestamp.tv_sec = current_time.tv_sec;
397 me->
timestamp.tv_usec = current_time.tv_usec;
407 fprintf(stderr,
"vrpn_Tracker: cannot write t2r message\n");
415 struct timeval current_time;
424 me->
timestamp.tv_sec = current_time.tv_sec;
425 me->
timestamp.tv_usec = current_time.tv_usec;
438 fprintf(stderr,
"vrpn_Tracker: cannot write u2s message\n");
447 struct timeval current_time;
455 me->
timestamp.tv_sec = current_time.tv_sec;
456 me->
timestamp.tv_usec = current_time.tv_usec;
465 fprintf(stderr,
"vrpn_Tracker: cannot write workspace message\n");
484 for (i = 0; i < 3; i++) {
489 for (i = 0; i < 4; i++) {
494 return 1000 - buflen;
518 for (i = 0; i < 3; i++) {
523 for (i = 0; i < 4; i++) {
528 return 1000 - buflen;
544 return 1000 - buflen;
574 return 1000 - buflen;
601 return 1000 - buflen;
628 return 1000 - buflen;
632 vrpn_int32 sensors, vrpn_float64 Hz)
644 struct timeval current_time;
658 timestamp.tv_usec = current_time.tv_usec;
671 "NULL tracker: can't write message: tossing\n");
680 "NULL tracker: can't write message: tossing\n");
689 "NULL tracker: can't write message: tossing\n");
703 "NULL tracker: can't write message: tossing\n");
712 "NULL tracker: can't write message: tossing\n");
721 "NULL tracker: can't write message: tossing\n");
734 vrpn_int32 sensors, vrpn_float64 Hz,
735 vrpn_float64 axisX, vrpn_float64 axisY,
736 vrpn_float64 axisZ, vrpn_float64 spinRateHz)
742 , spin_rate_Hz(spinRateHz)
776 struct timeval current_time;
790 timestamp.tv_usec = current_time.tv_usec;
807 "NULL tracker: can't write message: tossing\n");
816 "NULL tracker: can't write message: tossing\n");
825 "NULL tracker: can't write message: tossing\n");
848 const vrpn_float64 position[3],
849 const vrpn_float64 quaternion[4],
850 const vrpn_uint32 class_of_service)
872 memcpy(
pos, position,
sizeof(
pos));
878 "vrpn_Tracker_Server: can't write message: tossing\n");
886 const int sensor,
const struct timeval t,
const vrpn_float64 position[3],
887 const vrpn_float64 quaternion[4],
const vrpn_float64 interval,
888 const vrpn_uint32 class_of_service)
910 memcpy(
vel, position,
sizeof(
pos));
917 "vrpn_Tracker_Server: can't write message: tossing\n");
926 const int sensor,
const struct timeval t,
const vrpn_float64 position[3],
927 const vrpn_float64 quaternion[4],
const vrpn_float64 interval,
928 const vrpn_uint32 class_of_service)
950 memcpy(
acc, position,
sizeof(
pos));
955 msgbuf, class_of_service)) {
957 "vrpn_Tracker_Server: can't write message: tossing\n");
965#ifndef VRPN_CLIENT_ONLY
967 const char *port,
long baud)
974 fprintf(stderr,
"vrpn_Tracker_Serial: NULL port name\n");
984 fprintf(stderr,
"vrpn_Tracker_Serial: Cannot Open serial port\n");
1010 fprintf(stderr,
"Tracker: cannot write message: tossing\n");
1014 fprintf(stderr,
"Tracker: No valid connection\n");
1045 struct timeval current_time;
1062 sprintf(errmsg,
"Tracker failed to read... current_time=%ld:%ld, "
1063 "timestamp=%ld:%ld\n",
1064 current_time.tv_sec,
1065 static_cast<long>(current_time.tv_usec),
timestamp.tv_sec,
1078 "more than 4 attempts made)",
1087 "vrpn_Tracker_Serial::mainloop(): Cannot Open serial port\n");
1095#if defined(VRPN_USE_LIBUSB_1_0)
1098 vrpn_uint16 vendor, vrpn_uint16 product,
1101 , _device_handle(NULL)
1111 fprintf(stderr,
"vrpn_Tracker_USB: can't init LibUSB\n");
1120 fprintf(stderr,
"vrpn_Tracker_USB: can't find any Polhemus High Speed "
1121 "Liberty Latus devices\n");
1123 " (Did you remember to run as root?)\n");
1130 "vrpn_Tracker_USB: can't claim interface for this device\n");
1132 " (Did you remember to run as root?)\n");
1167 fprintf(stderr,
"Tracker: cannot write message: tossing\n");
1171 fprintf(stderr,
"Tracker: No valid connection\n");
1203 struct timeval current_time;
1220 sprintf(errmsg,
"Tracker failed to read... current_time=%ld:%ld, "
1221 "timestamp=%ld:%ld\n",
1222 current_time.tv_sec,
1223 static_cast<long>(current_time.tv_usec),
timestamp.tv_sec,
1237 "more than 4 attempts made)",
1246 fprintf(stderr,
"vrpn_Tracker_USB::mainloop(): can't find any "
1247 "Polhemus High Speed Liberty Latus devices\n");
1253 fprintf(stderr,
"vrpn_Tracker_USB::mainloop(): can't claim "
1254 "interface for this device\n");
1273 , sensor_callbacks(NULL)
1274 , num_sensor_callbacks(0)
1278 fprintf(stderr,
"vrpn_Tracker_Remote: No connection\n");
1286 "vrpn_Tracker_Remote: can't register position handler\n");
1294 "vrpn_Tracker_Remote: can't register velocity handler\n");
1302 "vrpn_Tracker_Remote: can't register acceleration handler\n");
1311 "vrpn_Tracker_Remote: can't register tracker2room handler\n");
1320 "vrpn_Tracker_Remote: can't register unit2sensor handler\n");
1329 "vrpn_Tracker_Remote: can't register workspace handler\n");
1348 fprintf(stderr,
"vrpn_Tracker_Remote::~vrpn_Tracker_Remote(): delete failed\n");
1387 fprintf(stderr,
"vrpn_Tracker_Remote::ensure_enough_sensor_callbacks(): delete failed\n");
1399 char *msgbuf = NULL;
1401 struct timeval current_time;
1405 timestamp.tv_usec = current_time.tv_usec;
1411 fprintf(stderr,
"vrpn_Tracker_Remote: cannot request t2r xform\n");
1420 char *msgbuf = NULL;
1422 struct timeval current_time;
1426 timestamp.tv_usec = current_time.tv_usec;
1432 fprintf(stderr,
"vrpn_Tracker_Remote: cannot request u2s xform\n");
1441 char *msgbuf = NULL;
1443 struct timeval current_time;
1447 timestamp.tv_usec = current_time.tv_usec;
1453 fprintf(stderr,
"vrpn_Tracker_Remote: cannot request workspace\n");
1463 char msgbuf[
sizeof(vrpn_float64)];
1464 char *bufptr = msgbuf;
1465 vrpn_int32 len =
sizeof(vrpn_float64);
1468 vrpn_int32 buflen = len;
1479 fprintf(stderr,
"vrpn_Tracker_Remote::set_update_rate: "
1480 "Cannot send message.\n");
1489 struct timeval current_time;
1492 timestamp.tv_usec = current_time.tv_usec;
1499 "vrpn_Tracker_Remote: cannot write message: tossing\n");
1519 "vrpn_Tracker_Remote::register_change_handler: bad sensor index\n");
1525 "vrpn_Tracker_Remote::register_change_handler: NULL handler\n");
1542 "vrpn_Tracker_Remote::register_change_handler: Out of memory\n");
1549 vrpn_int32 whichSensor)
1554 "vrpn_Tracker_Remote::register_change_handler: bad sensor index\n");
1560 "vrpn_Tracker_Remote::register_change_handler: NULL handler\n");
1577 "vrpn_Tracker_Remote::register_change_handler: Out of memory\n");
1584 vrpn_int32 whichSensor)
1589 "vrpn_Tracker_Remote::register_change_handler: bad sensor index\n");
1596 "vrpn_Tracker_Remote::register_change_handler: NULL handler\n");
1613 "vrpn_Tracker_Remote::register_change_handler: Out of memory\n");
1620 vrpn_int32 whichSensor)
1625 "vrpn_Tracker_Remote::register_change_handler: bad sensor index\n");
1631 fprintf(stderr,
"%s%s",
"vrpn_Tracker_Remote:",
1632 ":register_change_handler: NULL handler\n");
1649 "vrpn_Tracker_Remote::register_change_handler: Out of memory\n");
1658 fprintf(stderr,
"vrpn_Tracker_Remote::unregister_change_handler: bad "
1674 "vrpn_Tracker_Remote::unregister_change_handler: Out of memory\n");
1681 vrpn_int32 whichSensor)
1684 fprintf(stderr,
"vrpn_Tracker_Remote::unregister_change_handler: bad "
1700 "vrpn_Tracker_Remote::unregister_change_handler: Out of memory\n");
1707 vrpn_int32 whichSensor)
1710 fprintf(stderr,
"vrpn_Tracker_Remote::unregister_change_handler: bad "
1726 "vrpn_Tracker_Remote::unregister_change_handler: Out of memory\n");
1733 vrpn_int32 whichSensor)
1736 fprintf(stderr,
"vrpn_Tracker_Remote::unregister_change_handler: bad "
1752 "vrpn_Tracker_Remote::unregister_change_handler: Out of memory\n");
1761 const char *params = (p.
buffer);
1767 if (p.
payload_len != (8 *
sizeof(vrpn_float64))) {
1768 fprintf(stderr,
"vrpn_Tracker: change message payload error\n");
1769 fprintf(stderr,
" (got %d, expected %lud)\n", p.
payload_len,
1770 static_cast<unsigned long>(8 *
sizeof(vrpn_float64)));
1777 for (i = 0; i < 3; i++) {
1780 for (i = 0; i < 4; i++) {
1791 fprintf(stderr,
"vrpn_Tracker_Rem:pos sensor index is negative!\n");
1798 fprintf(stderr,
"vrpn_Tracker_Rem:pos sensor index too large\n");
1808 const char *params = p.
buffer;
1814 if (p.
payload_len != (9 *
sizeof(vrpn_float64))) {
1815 fprintf(stderr,
"vrpn_Tracker: vel message payload error\n");
1816 fprintf(stderr,
" (got %d, expected %lud)\n", p.
payload_len,
1817 static_cast<unsigned long>(9 *
sizeof(vrpn_float64)));
1824 for (i = 0; i < 3; i++) {
1827 for (i = 0; i < 4; i++) {
1843 fprintf(stderr,
"vrpn_Tracker_Rem:vel sensor index too large\n");
1853 const char *params = p.
buffer;
1859 if (p.
payload_len != (9 *
sizeof(vrpn_float64))) {
1860 fprintf(stderr,
"vrpn_Tracker: acc message payload error\n");
1861 fprintf(stderr,
"(got %d, expected %lud)\n", p.
payload_len,
1862 static_cast<unsigned long>(9 *
sizeof(vrpn_float64)));
1869 for (i = 0; i < 3; i++) {
1872 for (i = 0; i < 4; i++) {
1888 fprintf(stderr,
"vrpn_Tracker_Rem:acc sensor index too large\n");
1898 const char *params = p.
buffer;
1904 if (p.
payload_len != (8 *
sizeof(vrpn_float64))) {
1905 fprintf(stderr,
"vrpn_Tracker: unit2sensor message payload");
1906 fprintf(stderr,
" error\n(got %d, expected %lud)\n", p.
payload_len,
1907 static_cast<unsigned long>(8 *
sizeof(vrpn_float64)));
1916 for (i = 0; i < 3; i++) {
1919 for (i = 0; i < 4; i++) {
1933 fprintf(stderr,
"vrpn_Tracker_Rem:u2s sensor index too large\n");
1944 const char *params = p.
buffer;
1949 if (p.
payload_len != (7 *
sizeof(vrpn_float64))) {
1950 fprintf(stderr,
"vrpn_Tracker: tracker2room message payload");
1951 fprintf(stderr,
" error\n(got %d, expected %lud)\n", p.
payload_len,
1952 static_cast<unsigned long>(7 *
sizeof(vrpn_float64)));
1957 for (i = 0; i < 3; i++) {
1960 for (i = 0; i < 4; i++) {
1975 const char *params = p.
buffer;
1980 if (p.
payload_len != (6 *
sizeof(vrpn_float64))) {
1981 fprintf(stderr,
"vrpn_Tracker: tracker2room message payload");
1982 fprintf(stderr,
" error\n(got %d, expected %lud)\n", p.
payload_len,
1983 static_cast<unsigned long>(6 *
sizeof(vrpn_float64)));
1988 for (i = 0; i < 3; i++) {
1991 for (i = 0; i < 3; i++) {
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.
void client_mainloop(void)
Handles functions that all clients should provide in their mainloop() (warning of no server,...
vrpn_MESSAGEHANDLER handler
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...
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.
Class from which all user-level (and other) classes that communicate with vrpn_Connections should der...
virtual int init(void)
Initialize things that the constructor can't. Returns 0 on success, -1 on failure.
int register_handler(void *userdata, HANDLER_TYPE handler)
Call this to add a handler to the list.
int unregister_handler(void *userdata, HANDLER_TYPE handler)
Call this to remove a handler from the list (if it exists)
void call_handlers(const CALLBACK_STRUCT &info)
This will pass the referenced parameter as a const to all the callbacks.
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...
virtual int mainloop(const struct timeval *timeout=NULL)=0
Call each time through program main loop to handle receiving any incoming messages and sending any pa...
Helper class for vrpn_Connection that automates redundant transmission for unreliable (low-latency) m...
virtual int pack_message(vrpn_uint32 len, timeval time, vrpn_uint32 type, vrpn_uint32 sender, const char *buffer, vrpn_uint32 class_of_service, vrpn_int32 numRetransmissions=-1, timeval *transmissionInterval=NULL)
If !isEnabled(), does a normal pack_message(), but if isEnabled() ignores class_of_service and sends ...
virtual void mainloop()
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
vrpn_RedundantTransmission * d_redundancy
vrpn_Tracker_NULL(const char *name, vrpn_Connection *c, vrpn_int32 sensors=1, vrpn_float64 Hz=1.0)
void setRedundantTransmission(vrpn_RedundantTransmission *)
vrpn_Tracker_Sensor_Callbacks * sensor_callbacks
unsigned num_sensor_callbacks
virtual int unregister_change_handler(void *userdata, vrpn_TRACKERCHANGEHANDLER handler, vrpn_int32 sensor=vrpn_ALL_SENSORS)
vrpn_Tracker_Sensor_Callbacks all_sensor_callbacks
virtual void mainloop()
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
int request_workspace(void)
bool ensure_enough_sensor_callbacks(unsigned num)
static int VRPN_CALLBACK handle_workspace_change_message(void *userdata, vrpn_HANDLERPARAM p)
static int VRPN_CALLBACK handle_vel_change_message(void *userdata, vrpn_HANDLERPARAM p)
static int VRPN_CALLBACK handle_change_message(void *userdata, vrpn_HANDLERPARAM p)
vrpn_Callback_List< vrpn_TRACKERWORKSPACECB > d_workspacechange_list
virtual int register_change_handler(void *userdata, vrpn_TRACKERCHANGEHANDLER handler, vrpn_int32 sensor=vrpn_ALL_SENSORS)
static int VRPN_CALLBACK handle_unit2sensor_change_message(void *userdata, vrpn_HANDLERPARAM p)
vrpn_Tracker_Remote(const char *name, vrpn_Connection *c=NULL)
virtual ~vrpn_Tracker_Remote(void)
static int VRPN_CALLBACK handle_tracker2room_change_message(void *userdata, vrpn_HANDLERPARAM p)
int request_u2s_xform(void)
vrpn_Callback_List< vrpn_TRACKERTRACKER2ROOMCB > d_tracker2roomchange_list
int request_t2r_xform(void)
static int VRPN_CALLBACK handle_acc_change_message(void *userdata, vrpn_HANDLERPARAM p)
int set_update_rate(vrpn_float64 samplesPerSecond)
vrpn_Callback_List< vrpn_TRACKERCB > d_change
vrpn_Callback_List< vrpn_TRACKERVELCB > d_velchange
vrpn_Callback_List< vrpn_TRACKERACCCB > d_accchange
vrpn_Callback_List< vrpn_TRACKERUNIT2SENSORCB > d_unit2sensorchange
char portname[VRPN_TRACKER_BUF_SIZE]
virtual void send_report(void)
virtual void reset(void)=0
Reset the tracker.
virtual void mainloop()
Uses the get_report, send_report, and reset routines to implement a server.
virtual ~vrpn_Tracker_Serial()
virtual int get_report(void)=0
Gets a report if one is available, returns 0 if not, 1 if complete report.
vrpn_Tracker_Serial(const char *name, vrpn_Connection *c, const char *port="/dev/ttyS1", long baud=38400)
virtual int report_pose_acceleration(const int sensor, const struct timeval t, const vrpn_float64 position[3], const vrpn_float64 quaternion[4], const vrpn_float64 interval, const vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY)
virtual void mainloop()
This function should be called each time through app mainloop.
vrpn_Tracker_Server(const char *name, vrpn_Connection *c, vrpn_int32 sensors=1)
virtual int report_pose(const int sensor, const struct timeval t, const vrpn_float64 position[3], const vrpn_float64 quaternion[4], const vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY)
These functions should be called to report changes in state, once per sensor.
virtual int report_pose_velocity(const int sensor, const struct timeval t, const vrpn_float64 position[3], const vrpn_float64 quaternion[4], const vrpn_float64 interval, const vrpn_uint32 class_of_service=vrpn_CONNECTION_LOW_LATENCY)
virtual void mainloop()
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
vrpn_Tracker_Spin(const char *name, vrpn_Connection *c, vrpn_int32 sensors=1, vrpn_float64 reportRateHz=1.0, vrpn_float64 axisX=0, vrpn_float64 axisY=0, vrpn_float64 axisZ=1, vrpn_float64 spinRateHz=0.5)
vrpn_float64 spin_rate_Hz
vrpn_Tracker_USB(const char *name, vrpn_Connection *c, vrpn_uint16 vendor, vrpn_uint16 product, long baud=115200)
virtual ~vrpn_Tracker_USB()
virtual void reset(void)=0
Reset the tracker.
virtual void mainloop()
Uses the get_report, send_report, and reset routines to implement a server.
virtual void send_report(void)
struct libusb_device_handle * _device_handle
virtual int get_report(void)=0
Gets reports if some are available, returns 0 if not, 1 if complete report(s).
struct libusb_context * _context
virtual int encode_to(char *buf)
int register_server_handlers(void)
vrpn_float64 workspace_max[3]
vrpn_int32 request_t2r_m_id
vrpn_int32 reset_origin_m_id
static int VRPN_CALLBACK handle_t2r_request(void *userdata, vrpn_HANDLERPARAM p)
virtual int encode_acc_to(char *buf)
bool ensure_enough_unit2sensors(unsigned num)
static int VRPN_CALLBACK handle_u2s_request(void *userdata, vrpn_HANDLERPARAM p)
vrpn_int32 request_workspace_m_id
vrpn_int32 update_rate_id
vrpn_Tracker(const char *name, vrpn_Connection *c=NULL, const char *tracker_cfg_file_name=NULL)
void get_local_u2s(vrpn_int32 sensor, vrpn_float64 *vec, vrpn_float64 *quat)
struct timeval watchdog_timestamp
vrpn_int32 workspace_m_id
void get_local_t2r(vrpn_float64 *vec, vrpn_float64 *quat)
virtual int encode_unit2sensor_to(char *buf)
Encodes the "Unit to Sensor" transformation into the buffer specified.
vrpn_int32 request_u2s_m_id
virtual int encode_workspace_to(char *buf)
virtual int encode_vel_to(char *buf)
virtual ~vrpn_Tracker(void)
virtual int encode_tracker2room_to(char *buf)
Encodes the "Tracker to Room" transformation into the buffer specified.
vrpn_float64 workspace_min[3]
vrpn_Tracker_Quat * unit2sensor_quat
void print_latest_report(void)
unsigned num_unit2sensors
int read_config_file(FILE *config_file, const char *tracker_name)
vrpn_int32 unit2sensor_m_id
vrpn_Tracker_Pos * unit2sensor
vrpn_float64 tracker2room_quat[4]
vrpn_int32 tracker2room_m_id
virtual int register_types(void)
Register the types of messages this device sends/receives. Return 0 on success, -1 on fail.
static int VRPN_CALLBACK handle_workspace_request(void *userdata, vrpn_HANDLERPARAM p)
vrpn_float64 tracker2room[3]
This structure is what is passed to a vrpn_Connection message callback.
vrpn_float64 tracker2room_quat[4]
vrpn_float64 tracker2room[3]
vrpn_float64 unit2sensor_quat[4]
vrpn_float64 unit2sensor[3]
vrpn_float64 workspace_min[3]
vrpn_float64 workspace_max[3]
const vrpn_uint32 vrpn_CONNECTION_RELIABLE
Classes of service for messages, specify multiple by ORing them together Priority of satisfying these...
const vrpn_uint32 vrpn_CONNECTION_LOW_LATENCY
int vrpn_close_commport(int comm)
int vrpn_open_commport(const char *portname, long baud, int charsize, vrpn_SER_PARITY parity, bool rts_flow)
Open a serial port, given its name and baud rate.
vrpn_Serial: Pulls all the serial port routines into one file to make porting to new operating system...
VRPN_API int vrpn_unbuffer(const char **buffer, timeval *t)
Utility routine for taking a struct timeval from a buffer that was sent as a message.
unsigned long vrpn_TimevalDuration(struct timeval endT, struct timeval startT)
Return number of microseconds between startT and endT.
double vrpn_TimevalDurationSeconds(struct timeval endT, struct timeval startT)
Return the number of seconds between startT and endT as a floating-point value.
VRPN_API int vrpn_buffer(char **insertPt, vrpn_int32 *buflen, const timeval t)
Utility routine for placing a timeval struct into a buffer that is to be sent as a message.
void vrpn_strcpy(char(&to)[charCount], const char *pSrc)
Null-terminated-string copy function that both guarantees not to overrun the buffer and guarantees th...
#define vrpn_gettimeofday
#define vrpn_ser_tkr_MAX_TIME_INTERVAL
const int vrpn_TRACKER_FAIL
const int vrpn_ALL_SENSORS
const int vrpn_TRACKER_RESETTING
void(VRPN_CALLBACK * vrpn_TRACKERACCCHANGEHANDLER)(void *userdata, const vrpn_TRACKERACCCB info)
vrpn_float64 vrpn_Tracker_Quat[4]
const int vrpn_TRACKER_SYNCING
const int vrpn_TRACKER_PARTIAL
void(VRPN_CALLBACK * vrpn_TRACKERCHANGEHANDLER)(void *userdata, const vrpn_TRACKERCB info)
vrpn_float64 vrpn_Tracker_Pos[3]
void(VRPN_CALLBACK * vrpn_TRACKERVELCHANGEHANDLER)(void *userdata, const vrpn_TRACKERVELCB info)
const int vrpn_TRACKER_AWAITING_STATION
void(VRPN_CALLBACK * vrpn_TRACKERUNIT2SENSORCHANGEHANDLER)(void *userdata, const vrpn_TRACKERUNIT2SENSORCB info)