vrpn
07.33
Virtual Reality Peripheral Network
|
Go to the documentation of this file.
23 #define MAX_TIME_INTERVAL (5000000) // max time between reports (usec)
24 #define INCHES_TO_METERS (2.54/100.0)
25 #define PI (3.14159265358979323846)
39 const char* startSentence) :
47 if (testFileFlag == 1) {
55 if (strlen(startSentence) > 0) {
56 nmeaParser.setStartSentence((
char*)startSentence);
104 printf(
"Serial not detected on reset. Try power cycle.\n");
109 #endif //prevent the console from spamming us
134 unsigned int numparameter=0;
135 unsigned int index=0;
165 printf(
"fail to read first bit\n");
167 }
else if (charRead == 0) {
183 sprintf(errmsg,
"While syncing (looking for '$', got '%c')",
buffer[0]);
212 }
else if (ret == 0) {
263 printf(
"GPS pos: %f, %f, %f\n",
pos[0],
pos[1],
pos[2]);
315 printf(
"GPS cannot determine position (empty fields). Wait for satellites or reposition GPS.\n");
324 printf(
"Sentence Invalid. Resetting tracker and resyncing.\n");
345 fprintf(stderr,
"calling server main\n");
352 fprintf(stderr,
"status in mainloop is %d\n\n",
status);
357 printf(
"tracker report ready\n",
status);
375 fprintf(stderr,
"Fastrak: cannot write message: tossing\n");
389 fprintf(stderr,
"Tracker Fastrak: No valid connection\n");
423 VRPN_MSG_WARNING(
"Tracking failed, trying to reset (try power cycle if more than 4 attempts made)");
#define VRPN_TRACKER_BUF_SIZE
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 encode_to(char *buf)
int vrpn_set_rts(int comm)
unsigned char buffer[VRPN_TRACKER_BUF_SIZE *10]
This function should be called each time through the main loop of the server code....
const int vrpn_TRACKER_REPORT_READY
virtual int get_report(void)
Gets a report if one is available, returns 0 if not, 1 if complete report.
vrpn_Serial: Pulls all the serial port routines into one file to make porting to new operating system...
const vrpn_uint32 vrpn_CONNECTION_LOW_LATENCY
vrpn_Connection * d_connection
Connection that this object talks to.
int vrpn_flush_input_buffer(int comm)
Throw out any characters within the input buffer.
#define VRPN_MSG_WARNING(msg)
const int vrpn_TRACKER_PARTIAL
vrpn_int32 d_sender_id
Sender ID registered with the connection.
virtual void mainloop()
Uses the get_report, send_report, and reset routines to implement a server.
Generic connection class not specific to the transport mechanism.
const int vrpn_TRACKER_FAIL
const int vrpn_TRACKER_RESETTING
#define vrpn_gettimeofday
int register_server_handlers(void)
int vrpn_read_available_characters(int comm, unsigned char *buffer, size_t bytes)
int vrpn_close_commport(int comm)
const int vrpn_TRACKER_SYNCING
#define VRPN_MSG_INFO(msg)
const int vrpn_TRACKER_AWAITING_STATION
Header containing macros formerly duplicated in a lot of implementation files.
virtual void reset()
Reset the tracker.
vrpn_Tracker_GPS(const char *name, vrpn_Connection *c, const char *port="/dev/ttyS1", long baud=4800, int utmFlag=1, int testFileFlag=0, const char *startStr="RMC")
#define VRPN_MSG_ERROR(msg)
void server_mainloop(void)
Handles functions that all servers should provide in their mainloop() (ping/pong, for example) Should...