RflySimSDK v3.08
RflySimSDK说明文档
载入中...
搜索中...
未找到
vrpn_Tracker_LibertyHS.h
1// vrpn_Tracker_LibertyHS.h
2// This file contains the class header for a High Speed Polhemus Liberty
3// Latus Tracker.
4// This file is based on the vrpn_Tracker_Liberty.h file, with modifications made
5// to allow it to operate a Liberty Latus instead. It has been tested on Linux.
6
7#ifndef VRPN_TRACKER_LIBERTYHS_H
8#define VRPN_TRACKER_LIBERTYHS_H
9
10#include <stdio.h> // for NULL
11
12#include "vrpn_Configure.h" // for VRPN_API, etc
13#include "vrpn_Shared.h" // for timeval
14#include "vrpn_Tracker.h" // for vrpn_Tracker_USB
15#include "vrpn_Types.h" // for vrpn_uint16, vrpn_uint8, etc
16
17class VRPN_API vrpn_Connection;
18
19#if defined(VRPN_USE_LIBUSB_1_0)
20
21// Vendor and product IDs for High Speed Liberty Latus tracker
22static const vrpn_uint16 LIBERTYHS_VENDOR_ID = 0x0f44;
23static const vrpn_uint16 LIBERTYHS_PRODUCT_ID = 0xff20;
24
25// Endpoints to communicate with the USB device
26static const vrpn_uint8 LIBERTYHS_WRITE_EP = 0x04;
27static const vrpn_uint8 LIBERTYHS_READ_EP = 0x88;
28
29const int vrpn_LIBERTYHS_MAX_STATIONS = 8; //< How many stations (i.e. markers) can exist
30const int vrpn_LIBERTYHS_MAX_WHOAMI_LEN = 1024; //< Maximum whoami response length
31const int vrpn_LIBERTYHS_MAX_MARKERMAP_LEN = 12; //< Maximum active marker map response length
32
33
34class VRPN_API vrpn_Tracker_LibertyHS: public vrpn_Tracker_USB {
35
36 public:
37
38 /// The constructor is given the name of the tracker (the name of
39 /// the sender it should use), the connection on which it is to
40 /// send its messages, the baud rate at which it is to communicate
41 /// (default 115200), whether filtering is enabled (default yes),
42 /// the number of stations that are possible on this LibertyHS (default 8)
43 /// and the receptor used to launch the stations (default 1).
44 /// The final parameter is a string that can contain additional
45 /// commands that are set to the tracker as part of its reset routine.
46 /// These might be used to set the hemisphere or other things that are
47 /// not normally included; see the Liberty Latus manual for a list of these.
48 /// There can be multiple lines of them but putting <CR> into the string.
49
50 vrpn_Tracker_LibertyHS(const char *name, vrpn_Connection *c,
51 long baud = 115200, int enable_filtering = 1,
52 int numstations = vrpn_LIBERTYHS_MAX_STATIONS,
53 int receptoridx = 1, const char *additional_reset_commands = NULL,
54 int whoamilen = 288);
55
56 ~vrpn_Tracker_LibertyHS();
57
58 protected:
59
60 virtual int get_report(void);
61 virtual void reset();
62
63
64 int do_filter; //< Should we turn on filtering for pos/orient?
65 int num_stations; //< How many stations (trackers) on this LibertyHS?
66 int receptor_index; //< Index of receptor used to detect and launch the markers
67 int num_resets; //< Number of resets we've tried this time.
68 char add_reset_cmd[2048]; //< Additional reset commands to be sent
69 int whoami_len; //< Number of chars in whoami response
70 int read_len; //< Number of bytes in usb read buffer
71 int sync_index; //< Index of first sync char in usb read buffer
72
73 struct timeval liberty_zerotime; //< When the liberty time counter was zeroed
74 struct timeval liberty_timestamp; //< The time returned from the LibertyHS System
75 vrpn_uint32 REPORT_LEN; //< The length that the current report should be
76
77
78 /// Augments the basic LibertyHS format
79 int set_sensor_output_format(int sensor = -1);
80
81 /// Augments the basic LibertyHS report length
82 int report_length(int sensor);
83
84 /// Writes len bytes from data buffer to USB device
85 int write_usb_data(void* data,int len);
86
87 /// Reads at most maxlen bytes from USB device and copy them into
88 /// data buffer. Returns the number of read bytes.
89 /// The maximum period in milliseconds to wait for reading USB data
90 /// is defined by parameter timeout.
91 int read_usb_data(void* data,int maxlen,unsigned int timeout = 50);
92
93 /// Empties the USB read buffer
94 void flush_usb_data();
95
96 /// Launches num_stations markers using receptor receptor_index to detect them.
97 int test_markers();
98
99 /// Returns the number of detected and lauched trackers
100 int launch_markers();
101};
102
103// End of LIBUSB
104#endif
105
106// End of VRPN_TRACKER_LIBERTYHS_H
107#endif
Generic connection class not specific to the transport mechanism.
定义 vrpn_Connection.h:562