Changeset 55 in flair-src for trunk/lib/FlairSensorActuator/src/NmeaGps.cpp
- Timestamp:
- Jul 28, 2016, 5:55:31 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairSensorActuator/src/NmeaGps.cpp
r51 r55 47 47 nmea_zero_INFO(&info); 48 48 nmea_parser_init(&parser); 49 alt _ref = 0;49 altRef = 0; 50 50 51 51 if ((NMEAFlags & GGA) == 0) { … … 63 63 64 64 // station sol 65 main _tab = new Tab(parent->GetTabWidget(), name);66 tab = new TabWidget(main _tab->NewRow(), name);67 sensor _tab = new Tab(tab, "Reglages");68 GroupBox *reglages_groupbox = new GroupBox(sensor_tab->NewRow(), name);69 button _ref = new PushButton(reglages_groupbox->NewRow(), "set ref");70 nb _sat_label = new Label(reglages_groupbox->NewRow(), "nb_sat");71 fix _label = new Label(reglages_groupbox->LastRowLastCol(), "fix");65 mainTab = new Tab(parent->GetTabWidget(), name); 66 tab = new TabWidget(mainTab->NewRow(), name); 67 sensorTab = new Tab(tab, "Setup"); 68 setupGroupbox = new GroupBox(sensorTab->NewRow(), name); 69 buttonRef = new PushButton(setupGroupbox->NewRow(), "set ref"); 70 nbSatLabel = new Label(setupGroupbox->NewRow(), "nb_sat"); 71 fixLabel = new Label(setupGroupbox->LastRowLastCol(), "fix"); 72 72 73 73 position = new GeoCoordinate((IODevice *)this, "position", 0, 0, 0); 74 74 75 take _ref = false;75 takeRef = false; 76 76 77 77 gpsData = new GpsData(this); 78 78 AddDataToLog(gpsData); 79 79 80 nb_sat_label->SetText("nb_sat: %i", gpsData->GetNumberOfSatellites()); 81 fix_label->SetText("fix: %i", gpsData->GetFixQuality()); 80 nbSatLabel->SetText("number of satellies: %i", gpsData->GetNumberOfSatellites()); 81 fixLabel->SetText("fix quality: %i", gpsData->GetFixQuality()); 82 } 83 84 NmeaGps::NmeaGps(const IODevice *parent, std::string name) : IODevice(parent, name) { 85 gpsData = new GpsData(this); 86 mainTab = NULL; 87 tab = NULL; 88 sensorTab = NULL; 82 89 } 83 90 84 91 NmeaGps::~NmeaGps() { 85 nmea_parser_destroy(&parser); 86 delete main_tab; 87 } 92 if (mainTab != NULL) { 93 nmea_parser_destroy(&parser); 94 delete mainTab; 95 } 96 } 97 98 GroupBox *NmeaGps::GetGroupBox(void) const { return setupGroupbox; } 88 99 89 100 const GpsData *NmeaGps::GetDatas(void) const { … … 96 107 97 108 void NmeaGps::UseDefaultPlot(void) { 98 plot _tab = new Tab(tab, "Mesures");99 100 if ((NMEAFlags & GGA) != 0) { 101 e _plot = new DataPlot1D(plot_tab->NewRow(), "e", -10, 10);102 e _plot->AddCurve(gpsData->Element(GpsData::East));103 n _plot = new DataPlot1D(plot_tab->LastRowLastCol(), "n", -10, 10);104 n _plot->AddCurve(gpsData->Element(GpsData::North));105 u _plot = new DataPlot1D(plot_tab->LastRowLastCol(), "u", -10, 10);106 u _plot->AddCurve(gpsData->Element(GpsData::Up));109 plotTab = new Tab(tab, "Mesures"); 110 111 if ((NMEAFlags & GGA) != 0) { 112 ePlot = new DataPlot1D(plotTab->NewRow(), "e", -10, 10); 113 ePlot->AddCurve(gpsData->Element(GpsData::East)); 114 nPlot = new DataPlot1D(plotTab->LastRowLastCol(), "n", -10, 10); 115 nPlot->AddCurve(gpsData->Element(GpsData::North)); 116 uPlot = new DataPlot1D(plotTab->LastRowLastCol(), "u", -10, 10); 117 uPlot->AddCurve(gpsData->Element(GpsData::Up)); 107 118 } 108 119 if ((NMEAFlags & VTG) != 0) { 109 ve _plot = new DataPlot1D(plot_tab->NewRow(), "ve", -10, 10);110 ve _plot->AddCurve(gpsData->Element(GpsData::EastVelocity));111 vn _plot = new DataPlot1D(plot_tab->LastRowLastCol(), "vn", -10, 10);112 vn _plot->AddCurve(gpsData->Element(GpsData::NorthVelocity));120 vePlot = new DataPlot1D(plotTab->NewRow(), "ve", -10, 10); 121 vePlot->AddCurve(gpsData->Element(GpsData::EastVelocity)); 122 vnPlot = new DataPlot1D(plotTab->LastRowLastCol(), "vn", -10, 10); 123 vnPlot->AddCurve(gpsData->Element(GpsData::NorthVelocity)); 113 124 } 114 125 … … 120 131 DataPlot1D *NmeaGps::EPlot(void) const { 121 132 if ((NMEAFlags & GGA) != 0) { 122 return e _plot;133 return ePlot; 123 134 } else { 124 135 Err("GGA sentence not requested\n"); … … 129 140 DataPlot1D *NmeaGps::NPlot(void) const { 130 141 if ((NMEAFlags & GGA) != 0) { 131 return n _plot;142 return nPlot; 132 143 } else { 133 144 Err("GGA sentence not requested\n"); … … 138 149 DataPlot1D *NmeaGps::UPlot(void) const { 139 150 if ((NMEAFlags & GGA) != 0) { 140 return u _plot;151 return uPlot; 141 152 } else { 142 153 Err("GGA sentence not requested\n"); … … 147 158 DataPlot1D *NmeaGps::VEPlot(void) const { 148 159 if ((NMEAFlags & VTG) != 0) { 149 return ve _plot;160 return vePlot; 150 161 } else { 151 162 Err("GGA sentence not requested\n"); … … 156 167 DataPlot1D *NmeaGps::VNPlot(void) const { 157 168 if ((NMEAFlags & VTG) != 0) { 158 return vn _plot;159 } else { 160 Err("GGA sentence not requested\n"); 161 return NULL; 162 } 163 } 164 165 Layout *NmeaGps::GetLayout(void) const { return sensor _tab; }166 167 Tab *NmeaGps::GetPlotTab(void) const { return plot _tab; }169 return vnPlot; 170 } else { 171 Err("GGA sentence not requested\n"); 172 return NULL; 173 } 174 } 175 176 Layout *NmeaGps::GetLayout(void) const { return sensorTab; } 177 178 Tab *NmeaGps::GetPlotTab(void) const { return plotTab; } 168 179 169 180 TabWidget *NmeaGps::GetTab(void) const { return tab; } 170 181 171 void NmeaGps::SetRef(void) { take _ref = true; }182 void NmeaGps::SetRef(void) { takeRef = true; } 172 183 173 184 void NmeaGps::GetEnu(Vector3D *point) { … … 197 208 if (gpsData->GetFixQuality() != (GpsData::FixQuality_t)pack.sig) { 198 209 gpsData->SetFixQuality((GpsData::FixQuality_t)pack.sig); 199 fix _label->SetText("fix: %i", pack.sig);210 fixLabel->SetText("fix: %i", pack.sig); 200 211 } 201 212 if (gpsData->GetNumberOfSatellites() != pack.satinuse) { 202 213 gpsData->SetNumberOfSatellites(pack.satinuse) ; 203 nb _sat_label->SetText("nb_sat: %i", pack.satinuse);214 nbSatLabel->SetText("nb_sat: %i", pack.satinuse); 204 215 } 205 216 gpsData->ReleaseMutex(); … … 209 220 info.elv); 210 221 211 if ((info.sig == 2 && alt _ref == 0) || button_ref->Clicked() == true ||212 take _ref == true) {222 if ((info.sig == 2 && altRef == 0) || buttonRef->Clicked() == true || 223 takeRef == true) { 213 224 Printf("prise pos ref\n"); 214 lat _ref = pos.lat;215 long _ref = pos.lon;216 alt _ref = info.elv;217 take _ref = false;225 latRef = pos.lat; 226 longRef = pos.lon; 227 altRef = info.elv; 228 takeRef = false; 218 229 } 219 230 // if(alt_ref!=0) … … 222 233 double e, n, u; 223 234 Geographique_2_ECEF(pos.lon, pos.lat, info.elv, x, y, z); 224 ECEF_2_ENU(x, y, z, e, n, u, long _ref, lat_ref, alt_ref);235 ECEF_2_ENU(x, y, z, e, n, u, longRef, latRef, altRef); 225 236 // Printf("lon:%f lat:%f elv:%f\n",pos.lon,pos.lat,info.elv); 226 237
Note:
See TracChangeset
for help on using the changeset viewer.