- Timestamp:
- Jun 28, 2016, 3:20:04 PM (8 years ago)
- Location:
- trunk/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairMeta/src/UavFactory.cpp
r15 r41 29 29 using namespace flair::meta; 30 30 31 namespace { // anonymous 32 vector<flair::meta::Uav* (*)(FrameworkManager*,string,string,UavMultiplex*)> vectoroffunctions; 33 } 34 31 35 Uav *CreateUav(FrameworkManager *parent, string uav_name, string uav_type, 32 36 UavMultiplex *multiplex) { 33 /*if(uav_type=="ardrone2") { 34 return new ArDrone2(parent,uav_name,multiplex); 35 } else */ if (uav_type == "hds_x4") { 37 38 Uav *uav; 39 for(int i=0;i<vectoroffunctions.size();i++) { 40 uav=vectoroffunctions.at(i)(parent, uav_name, uav_type,multiplex); 41 if(uav!=NULL) return uav; 42 } 43 44 if (uav_type == "hds_x4") { 36 45 parent->Err("UAV type %s not yet implemented\n", uav_type.c_str()); 37 46 return NULL; … … 60 69 } 61 70 } 71 72 void RegisterUavCreator(flair::meta::Uav*(*func)(FrameworkManager *parent, string uav_name, string uav_type, 73 UavMultiplex *multiplex)) { 74 vectoroffunctions.push_back(func); 75 76 } -
trunk/lib/FlairMeta/src/UavFactory.h
r15 r41 25 25 flair::filter::UavMultiplex *multiplex = NULL); 26 26 27 void RegisterUavCreator(flair::meta::Uav*(*func)(flair::core::FrameworkManager *parent, 28 std::string uav_name, std::string uav_type, 29 flair::filter::UavMultiplex *multiplex)); 27 30 #endif // UAVFACTORY -
trunk/lib/FlairSensorActuator/src/Mb800.cpp
r15 r41 43 43 /** Debut init **/ 44 44 char response[200] = {0}; 45 int size ;45 int size,written; 46 46 47 47 /** Fin init **/ … … 49 49 /** Debut config **/ 50 50 char to_send[] = "$PASHS,NME,ALL,A,OFF\r\n"; 51 serialport->Write(to_send, sizeof(to_send)); 52 51 written=serialport->Write(to_send, sizeof(to_send)); 52 if (written< 0) { 53 Thread::Err("erreur Write (%s)\n", strerror(-written)); 54 } 55 /* 53 56 { 54 57 char to_send[] = "$PASHS,CPD,AFP,95.0\r\n"; 55 serialport->Write(to_send, sizeof(to_send)); 58 written=serialport->Write(to_send, sizeof(to_send)); 59 if (written< 0) { 60 Thread::Err("erreur Write (%s)\n", strerror(-written)); 61 } 56 62 } 57 63 { 58 64 char to_send[] = "$PASHS,DIF,PRT,C,RT3\r\n"; 59 serialport->Write(to_send, sizeof(to_send)); 65 written=serialport->Write(to_send, sizeof(to_send)); 66 if (written< 0) { 67 Thread::Err("erreur Write (%s)\n", strerror(-written)); 68 } 60 69 } 61 70 */ 62 71 if ((NMEAFlags & GGA) != 0) { 63 72 char to_send[] = "$PASHS,NME,GGA,A,ON,0.05\r\n"; 64 size = serialport->Write(to_send, sizeof(to_send)); 65 // Printf("ecrit %i\n",size); 73 written = serialport->Write(to_send, sizeof(to_send)); 74 if (written< 0) { 75 Thread::Err("erreur Write (%s)\n", strerror(-written)); 76 } 66 77 } 67 78 if ((NMEAFlags & VTG) != 0) { 68 79 char to_send[] = "$PASHS,NME,VTG,A,ON,0.05\r\n"; 69 size = serialport->Write(to_send, sizeof(to_send)); 70 // Printf("%i\n",size); 80 written = serialport->Write(to_send, sizeof(to_send)); 81 if (written< 0) { 82 Thread::Err("erreur Write (%s)\n", strerror(-written)); 83 } 71 84 } 72 85 if ((NMEAFlags & GST) != 0) { 73 86 char to_send[] = "$PASHS,NME,GST,A,ON,0.05\r\n"; 74 size = serialport->Write(to_send, sizeof(to_send)); 75 // Printf("%i\n",size); 87 written = serialport->Write(to_send, sizeof(to_send)); 88 if (written< 0) { 89 Thread::Err("erreur Write (%s)\n", strerror(-written)); 90 } 76 91 } 77 92 … … 84 99 85 100 while (!ToBeStopped()) { 101 //Printf("loop\n"); 86 102 SleepMS(10); 87 size = 0; 103 size = 0;/* 88 104 while (!ToBeStopped()) { 89 105 ssize_t read = serialport->Read(&response[size], 1); … … 95 111 break; 96 112 size++; 97 } 113 }*/ 98 114 size++; 99 parseFrame(response, size);115 //parseFrame(response, size); 100 116 } 101 117 /** fin running loop **/ … … 106 122 char data = 0; 107 123 ssize_t read = 0; 108 124 Printf("sync\n"); 109 125 // attente fin trame 110 while (data != 0x0a ) {126 while (data != 0x0a && !ToBeStopped()) { 111 127 read = serialport->Read(&data, 1); 128 SleepMS(10); 129 Printf("%i %x\n",read,data); 112 130 if (read < 0) { 113 131 Thread::Err("erreur Read (%s)\n", strerror(-read));
Note:
See TracChangeset
for help on using the changeset viewer.