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)");
const vrpn_uint32 vrpn_CONNECTION_LOW_LATENCY
virtual void mainloop()
Uses the get_report, send_report, and reset routines to implement a server.
void server_mainloop(void)
Handles functions that all servers should provide in their mainloop() (ping/pong, for example) Should...
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")
int vrpn_close_commport(int comm)
const int vrpn_TRACKER_REPORT_READY
int vrpn_flush_input_buffer(int comm)
Throw out any characters within the input buffer.
int register_server_handlers(void)
Header containing macros formerly duplicated in a lot of implementation files.
vrpn_Serial: Pulls all the serial port routines into one file to make porting to new operating system...
virtual void reset()
Reset the tracker.
Generic connection class not specific to the transport mechanism.
#define VRPN_MSG_WARNING(msg)
const int vrpn_TRACKER_FAIL
int vrpn_set_rts(int comm)
All types of client/server/peer objects in VRPN should be derived from the vrpn_BaseClass type descri...
const int vrpn_TRACKER_RESETTING
int vrpn_read_available_characters(int comm, unsigned char *buffer, size_t bytes)
const int vrpn_TRACKER_PARTIAL
vrpn_Connection * d_connection
Connection that this object talks to.
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...
const int vrpn_TRACKER_SYNCING
#define VRPN_MSG_INFO(msg)
virtual int encode_to(char *buf)
unsigned char buffer[VRPN_TRACKER_BUF_SIZE *10]
This function should be called each time through the main loop of the server code. It polls for a report from the tracker and sends it if there is one. It will reset the tracker if there is no data from it for a few seconds.
const int vrpn_TRACKER_AWAITING_STATION
#define vrpn_gettimeofday
virtual int get_report(void)
Gets a report if one is available, returns 0 if not, 1 if complete report.
vrpn_int32 d_sender_id
Sender ID registered with the connection.
#define VRPN_TRACKER_BUF_SIZE
#define VRPN_MSG_ERROR(msg)