31 #define DOUBLE_VECTOR_LENGTH 6 33 #define NOTE_KEY_1 "X" 34 #define NOTE_KEY_2 "Y" 35 #define NOTE_KEY_3 "Z" 36 #define NOTE_KEY_4 "RX" 37 #define NOTE_KEY_5 "RY" 38 #define NOTE_KEY_6 "RZ" 46 printf(
"connecting to rtdb...\n");
48 err = kogmo_rtdb_connect_initinfo (&
dbinfo,
"", trackerName.c_str(), 0.02);
DIEonERR(err);
52 err = kogmo_rtdb_obj_initinfo (
dbc, &
dataobj_info_data,trackerName.c_str(), KOGMO_RTDB_OBJTYPE_E1_FOBTRACKER,
53 sizeof (kogmo_rtdb_obj_e1_fobtracker_t));
DIEonERR(err);
54 std::string trackerName_raw = trackerName;
55 trackerName_raw+=
"_raw";
56 err = kogmo_rtdb_obj_initinfo (
dbc, &
dataobj_info_raw,trackerName_raw.c_str(), KOGMO_RTDB_OBJTYPE_E1_FOBTRACKER_RAW,
57 sizeof (kogmo_rtdb_obj_e1_fobtracker_t));
DIEonERR(err);
85 kogmo_rtdb_disconnect (
dbc, NULL);
96 printf(
"static WorkerThread method called!\n");
99 printf(
"Worker thread exit.\n");
106 #define PAUSE_SET 30000 107 #define PAUSE_WRITE 30000 111 return vAcc[0][index];
113 std::vector<double>
data;
114 for (
unsigned int i=0; i<
MAX_SETS; i++)
115 data.push_back(vAcc[i][index]);
116 std::sort(data.begin(), data.end());
118 if (MAX_SETS % 2 == 0)
119 return ((data[MAX_SETS / 2 - 1] + data[MAX_SETS / 2]) / 2);
121 return data[(MAX_SETS - 1) / 2];
135 for (
unsigned int i=0; i<
MAX_SETS; i++){
151 for (
unsigned int i=0; i<6; i++){
161 printf(
"%s %3.3lf %3.3lf %3.3lf %3.3lf %3.3lf %3.3lf ",
163 v[0], v[1], v[2], v[3], v[4], v[5]);
180 printf(
"Couldn't write Notification to NotificationManager. Error!\n");
191 printf(
"Starting myBird\n");
200 printf(
"Thread started, but was already running.\n");
201 printf(
"Thread running.\n");
206 printf(
"Stopping myBird\n");
224 int fcountLeft, fcountRight;
225 fulcrum fulcrumarrayLeft[255], fulcrumarrayRight[255];
227 res = ((f=fopen(srcFileName,
"r"))!=NULL);
230 fread(&fcountLeft,
sizeof(fcountLeft),1,f);
231 fread(&fcountRight,
sizeof(fcountRight),1,f);
234 printf(
"loadCalibFile %s\n",srcFileName);
235 printf(
"fcountLeft:%i, fcountRight:%i\n",fcountLeft,fcountRight);
237 fread(&fulcrumarrayLeft,
sizeof(fulcrumarrayLeft[0]),fcountLeft,f);
238 fread(&fulcrumarrayRight,
sizeof(fulcrumarrayRight[0]),fcountRight,f);
241 printf(
"fulcrumyArrayLeft(%i):\n",fcountLeft);
242 for(
int i=0;i < fcountLeft;i++) {
243 printf(
"\nentry %i:\n",i);
246 printf(
"fulcrumyArrayRight(%i):\n",fcountRight);
247 for(
int i=0;i < fcountRight;i++) {
248 printf(
"\nentry %i:\n",i);
253 s <<
"Loaded " << (fcountLeft+fcountRight) <<
" fulcrums\n";
257 printf(
"error loading calibration data: 2%s:%u\n",__FILE__,__LINE__);
263 printf(
"loading Calibration into rightTracker\n");
267 printf(
"loading Calibration into leftTracker\n");
271 printf(
"Success! Calibration data loaded\n");
273 printf(
"error loading calibration data: %s:%u\n",__FILE__,__LINE__);
289 double world[6],sensor[6];
291 for (
unsigned int i=0; i < length; i++)
293 for (
int j=0;j<3;j++)
313 for (i=0; i<6; i++) {
319 printf(
"LEFT %3.3lf %3.3lf %3.3lf %3.3lf %3.3lf %3.3lf\n",
320 data[0], data[1], data[2], data[3], data[4], data[5]);
323 printf(
"RIGHT %3.3lf %3.3lf %3.3lf %3.3lf %3.3lf %3.3lf\n",
324 data[0], data[1], data[2], data[3], data[4], data[5]);
330 kogmo_rtdb_cycle_done(
dbc,0);
339 #if tracker_impl_test 340 int main(
int argc,
char **argv)
342 bgcorba::init(argc, argv);
kogmo_rtdb_obj_info_t dataobj_info_data
int main(int argc, char **argv)
bool threadRunning
flag switching on/off thread
kogmo_rtdb_obj_info_t dataobj_info_raw
void workerThread()
this method is called by static method s_workerthread
static void * s_workerThread(void *arg)
Thread is bound to this method.
bool loadCalibration(const fulcrum cal[255], unsigned int length)
kogmo_rtdb_handle_t * dbc
bool loadCalibFile(const char *srcFileName)
kogmo_rtdb_obj_e1_fobtracker_t * dataobj_data
tracker_impl(trackerID t, BirdTrack_impl *b, std::string trackerName)
void printFulcrum(fulcrum fulc)
kogmo_rtdb_connect_info_t dbinfo
pthread_t workerThreadHandle
Thread for delivering tracker data to nCenter.
bool writeNotification(trackerID id, double *raw, double *calibrated)
kogmo_rtdb_obj_e1_fobtracker_t * dataobj_raw
int get_posangles(int whichtracker, double *v)
double getMedian(double(&vAcc)[MAX_SETS][6], unsigned int index)
transformCoords * myTransformer