vrpn  07.33
Virtual Reality Peripheral Network
vrpn_Poser_Tek4662.h
Go to the documentation of this file.
1 #ifndef vrpn_POSER_TEK4662_H
2 #define vrpn_POSER_TEK4662_H
3 #include "vrpn_Configure.h" // for VRPN_CALLBACK, VRPN_API
4 #include "vrpn_Poser.h" // for vrpn_Poser
5 #include "vrpn_Serial.h" // for ::vrpn_SER_PARITY_NONE, etc
6 #include "vrpn_Tracker.h" // for vrpn_Tracker
7 
9 struct vrpn_HANDLERPARAM;
10 
11 // This code is for a Poser server that uses a Tektronix 4662 plotter in the
12 // RS-232 mode. This is a 2D device.
13 // This class also acts as a vrpn_Tracker so that it can report back the new positions
14 // to the client. This lets the system operate in a closed-loop fashion.
15 //
16 // It assumes the following settings on the plotter: GIN terminator (none), no
17 // DEL modification, device A, copy mode off, 1 stop bit, CR translation off,
18 // low-speed plotting off, RS-232 interface enabled. It assumes that the plotter
19 // is not in local mode and that the communications is through the Modem port.
20 
21 // If multiple requests for motion to a new location arrive while an ongoing
22 // move is being made, all but the last are ignored.
23 
25 public:
26  vrpn_Poser_Tek4662(const char* name, vrpn_Connection* c,
27  const char * port, int baud = 1200, int bits = 8,
29 
30  virtual ~vrpn_Poser_Tek4662();
31 
32  virtual void mainloop();
33 
34 protected:
35  int d_serial_fd; //< File descriptor for the serial port we're using
36  unsigned char d_inbuf[1024]; //< Input buffer for characters from the plotter
37  int d_inbufcounter; //< How many characters have been read
38 
39  float d_newx, d_newy; //< New location that we're supposed to go to
40  bool d_new_location_requested; //< Has a new location been requested since our last move?
41  int d_outstanding_requests; //< How many GIN requests are outstanding?
42 
43  void reset(void);
44  void run();
45 
46  static int VRPN_CALLBACK handle_change_message(void *userdata, vrpn_HANDLERPARAM p);
47  static int VRPN_CALLBACK handle_vel_change_message(void *userdata, vrpn_HANDLERPARAM p);
48 };
49 
50 #endif
51 
vrpn_Tracker.h
vrpn_Tracker
Definition: vrpn_Tracker.h:49
vrpn_SER_PARITY_NONE
@ vrpn_SER_PARITY_NONE
Definition: vrpn_Serial.h:16
vrpn_Poser_Tek4662::d_serial_fd
int d_serial_fd
Definition: vrpn_Poser_Tek4662.h:35
vrpn_Poser_Tek4662::d_inbufcounter
int d_inbufcounter
Definition: vrpn_Poser_Tek4662.h:37
vrpn_Serial.h
vrpn_Serial: Pulls all the serial port routines into one file to make porting to new operating system...
vrpn_SER_PARITY
vrpn_SER_PARITY
Definition: vrpn_Serial.h:15
vrpn_HANDLERPARAM
This structure is what is passed to a vrpn_Connection message callback.
Definition: vrpn_Connection.h:44
vrpn_Poser
Definition: vrpn_Poser.h:18
vrpn_BaseClass::mainloop
virtual void mainloop()=0
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
vrpn_Connection
Generic connection class not specific to the transport mechanism.
Definition: vrpn_Connection.h:510
vrpn_Poser_Tek4662
Definition: vrpn_Poser_Tek4662.h:24
VRPN_CALLBACK
#define VRPN_CALLBACK
Definition: vrpn_Configure.h:647
vrpn_Poser_Tek4662::d_newy
float d_newy
Definition: vrpn_Poser_Tek4662.h:39
vrpn_Poser_Tek4662::d_new_location_requested
bool d_new_location_requested
Definition: vrpn_Poser_Tek4662.h:40
vrpn_Poser.h
vrpn_Configure.h
VRPN_API
#define VRPN_API
Definition: vrpn_Configure.h:646
vrpn_Poser_Tek4662::d_outstanding_requests
int d_outstanding_requests
Definition: vrpn_Poser_Tek4662.h:41