main.cc
00001
00002
00003
00004
00005
00006
00007
00008 #include <opencv/highgui.h>
00009 #include <opencv/cv.h>
00010 #include <iostream>
00011 #include <pthread.h>
00012 #include <cstdio>
00013
00014 #include "TestrigGUI.h"
00015 #include "DataThreads.h"
00016
00017 extern int serialCon;
00018 extern IplImage * frame;
00019 extern CvCapture * camera;
00020 extern TestrigGUI * myGui;
00021
00022 int main (int argc, char *argv[]) {
00023
00024
00025 IplImage * gray, * fakeGray;
00026
00027
00028 CvFont defaultFont;
00029 cvInitFont (&defaultFont, CV_FONT_HERSHEY_DUPLEX, 0.75, 0.75);
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069 QApplication gui(argc, argv);
00070 TestrigGUI trg;
00071 myGui = &trg;
00072 trg.show();
00073 gui.connect(&gui, SIGNAL(lastWindowClosed()), &gui, SLOT(quit()));
00074
00075
00076 pthread_t imuThread, camThread, guiThread;
00077 pthread_attr_t attr;
00078 void * status;
00079 pthread_attr_init(&attr);
00080 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
00081
00082
00083 initializeDataThreads();
00084 pthread_create(&imuThread, &attr, runIMUThread, NULL);
00085 pthread_create(&camThread, &attr, runCamThread, NULL);
00086 pthread_create(&guiThread, &attr, runGuiThread, NULL);
00087
00088 gui.exec();
00089
00090
00091 shutdownDataThreads();
00092 pthread_attr_destroy(&attr);
00093 pthread_join(imuThread, &status);
00094 pthread_join(camThread, &status);
00095 pthread_join(guiThread, &status);
00096
00097
00098
00099
00100
00101 return 0;
00102 }