commit | author | age
|
0a10d5
|
1 |
/************************************************************************
|
JS |
2 |
|
|
3 |
POLHEMUS PROPRIETARY
|
|
4 |
|
|
5 |
Polhemus
|
|
6 |
P.O. Box 560
|
|
7 |
Colchester, Vermont 05446
|
|
8 |
(802) 655-3159
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
Copyright © 2009 by Polhemus
|
|
14 |
All Rights Reserved.
|
|
15 |
|
|
16 |
|
|
17 |
*************************************************************************/
|
|
18 |
|
|
19 |
// G4TrackIncl.h
|
|
20 |
|
|
21 |
|
|
22 |
#ifndef _G4TRACKINCL_H_
|
|
23 |
#define _G4TRACKINCL_H_
|
|
24 |
|
|
25 |
#include "stdint.h" // for uint32_t -- unfortunately compiler specific
|
|
26 |
|
|
27 |
// defines
|
|
28 |
|
|
29 |
|
|
30 |
#define G4_SENSORS_PER_HUB 3
|
|
31 |
#define G4_CREATE_ID(sys,hub,sensor) (((sys<<24)&0xff000000)|((hub<<8)&0x0fff00)|(sensor&0x7f))
|
|
32 |
#define G4_CREATE_ID_SENS_MAP(sys,hub,sensorMap) G4_CREATE_ID(sys,hub,sensorMap)|0x80
|
|
33 |
|
|
34 |
|
|
35 |
// enum definitions
|
|
36 |
|
|
37 |
// commands
|
|
38 |
enum {
|
|
39 |
G4_CMD_WHOAMI,
|
|
40 |
G4_CMD_GETMAXSRC,
|
|
41 |
G4_CMD_BORESIGHT,
|
|
42 |
G4_CMD_FILTER,
|
|
43 |
G4_CMD_INCREMENT,
|
|
44 |
G4_CMD_FOR_ROTATE,
|
|
45 |
G4_CMD_FOR_TRANSLATE,
|
|
46 |
G4_CMD_TIP_OFFSET,
|
|
47 |
G4_CMD_UNITS,
|
|
48 |
G4_CMD_GET_ACTIVE_HUBS,
|
|
49 |
G4_CMD_GET_STATION_MAP,
|
|
50 |
G4_CMD_GET_SOURCE_MAP,
|
|
51 |
G4_CMD_FRAMERATE,
|
|
52 |
G4_CMD_RESTORE_DEF_CFG,
|
|
53 |
G4_CMD_BLOCK_CFG,
|
|
54 |
G4_TOTAL_COMMANDS
|
|
55 |
};
|
|
56 |
|
|
57 |
// different actions
|
|
58 |
enum {G4_ACTION_SET,G4_ACTION_GET,G4_ACTION_RESET};
|
|
59 |
|
|
60 |
// unit types
|
|
61 |
enum dataType {G4_DATA_POS,G4_DATA_ORI};
|
|
62 |
|
|
63 |
|
|
64 |
// types
|
|
65 |
enum {
|
|
66 |
G4_TYPE_EULER_DEGREE,
|
|
67 |
G4_TYPE_EULER_RADIAN,
|
|
68 |
G4_TYPE_QUATERNION,
|
|
69 |
G4_TYPE_INCH,
|
|
70 |
G4_TYPE_FOOT,
|
|
71 |
G4_TYPE_CM,
|
|
72 |
G4_TYPE_METER,
|
|
73 |
};
|
|
74 |
|
|
75 |
|
|
76 |
// errors -- just the beginning
|
|
77 |
enum {
|
|
78 |
G4_ERROR_NONE,
|
|
79 |
G4_ERROR_NO_FRAME_DATA_AVAIL=-100,
|
|
80 |
G4_ERROR_UNSUPPORTED_ACTION,
|
|
81 |
G4_ERROR_UNSUPPORTED_TYPE,
|
|
82 |
G4_ERROR_UNSUPPORTED_COMMAND,
|
|
83 |
G4_ERROR_INVALID_STATION,
|
|
84 |
G4_ERROR_NO_CONNECTION, //-95
|
|
85 |
G4_ERROR_NO_HUBS,
|
|
86 |
G4_ERROR_FRAMERATE_SET,
|
|
87 |
G4_ERROR_MEMORY_ALLOCATION,
|
|
88 |
G4_ERROR_INVALID_SYSTEM_ID,
|
|
89 |
G4_ERROR_SRC_CFG_FILE_OPEN, //-90
|
|
90 |
G4_ERROR_INVALID_SRC_CFG_FILE,
|
|
91 |
G4_ERROR_UNABLE_TO_START_TIMER,
|
|
92 |
G4_ERROR_HUB_NOT_ACTIVE,
|
|
93 |
G4_ERROR_SYS_RESET_FAIL,
|
|
94 |
G4_ERROR_DONGLE_CONNECTION, //-85
|
|
95 |
G4_ERROR_DONGLE_USB_CONFIGURATION,
|
|
96 |
G4_ERROR_DONGLE_USB_INTERFACE_0,
|
|
97 |
G4_ERROR_DUPLICATE_SYS_IDS,
|
|
98 |
G4_ERROR_INVALID_WILDCARD_USE,
|
|
99 |
G4_ERROR_TOTAL
|
|
100 |
};
|
|
101 |
|
|
102 |
|
|
103 |
// structure definitions
|
|
104 |
|
|
105 |
// for giving pno data to host app
|
|
106 |
typedef struct _G4_SEN_FRAMEDATA { // per sensor data
|
|
107 |
uint32_t id;
|
|
108 |
float pos[3];
|
|
109 |
float ori[4];
|
|
110 |
}*LPG4_SENFRAMEDATA,G4_SENFRAMEDATA; //32 bytes
|
|
111 |
|
|
112 |
typedef struct _G4_FRAMEDATA { // all sensors in hub
|
|
113 |
uint32_t hub;
|
|
114 |
uint32_t frame;
|
|
115 |
uint32_t stationMap; // indicates active sensors on hub
|
|
116 |
uint32_t dig_io;
|
|
117 |
G4_SENFRAMEDATA sfd[G4_SENSORS_PER_HUB];
|
|
118 |
}*LPG4_FRAMEDATA,G4_FRAMEDATA;
|
|
119 |
|
|
120 |
|
|
121 |
|
|
122 |
|
|
123 |
// for receiving config commands from host app or SDK
|
|
124 |
typedef struct _G4_CMD_DATA_STRUCT{
|
|
125 |
uint32_t id; // -1 for all sensors
|
|
126 |
uint32_t action; // set,get,reset
|
|
127 |
uint32_t iParam; // command specific
|
|
128 |
void* pParam; // ditto
|
|
129 |
}*LPG4_CMD_DATA_STRUCT,G4_CMD_DATA_STRUCT;
|
|
130 |
|
|
131 |
|
|
132 |
typedef struct _G4_CMD_STRUCT {
|
|
133 |
int cmd;
|
|
134 |
G4_CMD_DATA_STRUCT cds;
|
|
135 |
}*LPG4_CMD_STRUCT,G4_CMD_STRUCT;
|
|
136 |
|
|
137 |
typedef struct _G4_SRC_MAP {
|
|
138 |
int id;
|
|
139 |
int freq;
|
|
140 |
float pos[3];
|
|
141 |
float att[4];
|
|
142 |
}*LPG4_SRC_MAP,G4_SRC_MAP;
|
|
143 |
|
|
144 |
typedef struct _G4_CMD_BLOCK_STRUCT {
|
|
145 |
int units[2]; // pos, att
|
|
146 |
uint8_t version_info[50];
|
|
147 |
float filter_params[2][4]; // pos,att
|
|
148 |
float increment[G4_SENSORS_PER_HUB][2]; // pos, att
|
|
149 |
float rot_angles[3]; // az, el, rl
|
|
150 |
float translate_xyz[3];
|
|
151 |
float tip_offset[G4_SENSORS_PER_HUB][3];
|
|
152 |
}*LPG4_CMD_BLOCK_STRUCT,G4_CMD_BLOCK_STRUCT;
|
|
153 |
|
|
154 |
|
|
155 |
#ifdef __cplusplus
|
|
156 |
extern "C" {
|
|
157 |
#endif
|
|
158 |
|
|
159 |
// function prototypes /////////////////////////////////////////////////////
|
|
160 |
|
|
161 |
|
|
162 |
// Function name : g4_init_sys
|
|
163 |
// Description : Initializes the G4 Tracker
|
|
164 |
// Return type : int - ERROR_NONE if successful, otherwise an error enum
|
|
165 |
// Argument : int* pDongleId - System id of the dongle will be returned here
|
|
166 |
// Argument : const char* src_cfg_file - the source configuration file.
|
|
167 |
// Argument : void* reserved - Should always be NULL
|
|
168 |
uint32_t g4_init_sys(int* pDongleId,const char* src_cfg_file,void* reserved);
|
|
169 |
|
|
170 |
|
|
171 |
|
|
172 |
// Function name : g4_get_frame_data
|
|
173 |
// Description : Gets the G4 frame data from a list of desired hubs
|
|
174 |
// Return type : int -- Upper 16-bit word is total hubs on system
|
|
175 |
// Lower 16-bit word is hubs successfully read
|
|
176 |
// Argument : FRAMEDATA* fd_array -- an array of FRAMEDATA structures to hold the data
|
|
177 |
// Argument : int sysId -- The system id
|
|
178 |
// Argument : const int* hub_id_list -- An array of hub id's that the frame data is requested.
|
|
179 |
// Argument : int num_hubs -- the number of ids in the hub_id_list
|
|
180 |
uint32_t g4_get_frame_data(G4_FRAMEDATA* fd_array,int sysId,const int* hub_id_list,int num_hubs);
|
|
181 |
|
|
182 |
|
|
183 |
|
|
184 |
|
|
185 |
// Function name : g4_set_query
|
|
186 |
// Description : The function to get or set the G4 Tracker parameters
|
|
187 |
// Return type : int - ERROR_NONE if successful, otherwise an error enum
|
|
188 |
// Argument : LPCMD_STRUCT pcs - The command structure. The values of this structure
|
|
189 |
// are dependent upon the actual command.
|
|
190 |
uint32_t g4_set_query(LPG4_CMD_STRUCT pcs);
|
|
191 |
|
|
192 |
|
|
193 |
|
|
194 |
|
|
195 |
// Function name : close_tracker
|
|
196 |
// Description : This function will close the tracker connection.
|
|
197 |
// Return type : void
|
|
198 |
// Argument : void
|
|
199 |
void g4_close_tracker(void);
|
|
200 |
|
|
201 |
#ifdef __cplusplus
|
|
202 |
}
|
|
203 |
#endif
|
|
204 |
#endif
|