Debian Codegraph @

test_suite/unit_tests/Instrumentation/test_hold_controller.cxx

raw symbols SCIP
1 /*
2 * Copyright (C) 2019 James Turner
3 *
4 * This file is part of the program FlightGear.
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "test_hold_controller.hxx"
21
22 #include <memory>
23 #include <cstring>
24
25 #include "test_suite/FGTestApi/testGlobals.hxx"
26 #include "test_suite/FGTestApi/NavDataCache.hxx"
27 #include "test_suite/FGTestApi/TestPilot.hxx"
28
29 #include <Navaids/NavDataCache.hxx>
30 #include <Navaids/navrecord.hxx>
31 #include <Navaids/navlist.hxx>
32 #include <Navaids/FlightPlan.hxx>
33
34 #include <Instrumentation/gps.hxx>
35 #include <Instrumentation/navradio.hxx>
36
37 #include <Autopilot/route_mgr.hxx>
38
39 using namespace flightgear;
40
41 /////////////////////////////////////////////////////////////////////////////
42
43 class TestFPDelegate : public FlightPlan::Delegate
44 {
45 public:
46 FlightPlanRef thePlan;
47 int sequenceCount = 0;
48
49 void sequence() override
50 {
51
52 ++sequenceCount;
53 int newIndex = thePlan->currentIndex() + 1;
54 if (newIndex >= thePlan->numLegs()) {
55 thePlan->finish();
56 return;
57 }
58
59 thePlan->setCurrentIndex(newIndex);
60 }
61
62 void currentWaypointChanged() override
63 {
64 }
65
66 };
67
68 /////////////////////////////////////////////////////////////////////////////
69
70 // Set up function for each test.
71 void HoldControllerTests::setUp()
72 {
73 FGTestApi::setUp::initTestGlobals("hold-ctl");
74 FGTestApi::setUp::initNavDataCache();
75
76 globals->get_subsystem_mgr()->bind();
77 globals->get_subsystem_mgr()->init();
78
79 setupRouteManager();
80 }
81
82 // Clean up after each test.
83 void HoldControllerTests::tearDown()
84 {
85 FGTestApi::tearDown::shutdownTestGlobals();
86 }
87
88 void HoldControllerTests::setPositionAndStabilise(const SGGeod& g)
89 {
90 FGTestApi::setPosition(g);
91 for (int i=0; i<60; ++i) {
92 m_gps->update(0.015);
93 }
94 }
95
96 GPS* HoldControllerTests::setupStandardGPS(SGPropertyNode_ptr config,
97 const std::string name, const int index)
98 {
99 SGPropertyNode_ptr configNode(config.valid() ? config
100 : SGPropertyNode_ptr{new SGPropertyNode});
101 configNode->setStringValue("name", name);
102 configNode->setIntValue("number", index);
103
104 GPS* gps(new GPS(configNode));
105 m_gps = gps;
106
107 m_gpsNode = globals->get_props()->getNode("instrumentation", true)->getChild(name, index, true);
108 m_gpsNode->setBoolValue("serviceable", true);
109 globals->get_props()->setDoubleValue("systems/electrical/outputs/gps", 6.0);
110
111 gps->bind();
112 gps->init();
113
114 globals->get_subsystem_mgr()->add("gps", gps);
115 return gps;
116 }
117
118 void HoldControllerTests::setupRouteManager()
119 {
120 auto rm = globals->get_subsystem_mgr()->add<FGRouteMgr>();
121 rm->bind();
122 rm->init();
123 rm->postinit();
124 }
125
126 /////////////////////////////////////////////////////////////////////////////
127
128 void HoldControllerTests::testHoldEntryDirect()
129 {
130 // FGTestApi::setUp::logPositionToKML("hold_direct_entry");
131
132 auto rm = globals->get_subsystem<FGRouteMgr>();
133 auto fp = FlightPlan::create();
134 rm->setFlightPlan(fp);
135 FGTestApi::setUp::populateFPWithoutNasal(fp, "EBBR", "07L", "EGGD", "27",
136 "NIK COA DVR TAWNY WOD");
137 // FGTestApi::writeFlightPlanToKML(fp);
138
139 auto testDelegate = new TestFPDelegate;
140 testDelegate->thePlan = fp;
141 CPPUNIT_ASSERT(rm->activate());
142 fp->addDelegate(testDelegate);
143
144 setupStandardGPS();
145 m_gpsNode->setStringValue("command", "leg");
146 setPositionAndStabilise(fp->departureRunway()->pointOnCenterline(0.0));
147
148 CPPUNIT_ASSERT_EQUAL(std::string{"leg"}, std::string{m_gpsNode->getStringValue("mode")});
149 CPPUNIT_ASSERT_EQUAL(std::string{"EBBR-07L"}, std::string{m_gpsNode->getStringValue("wp/wp[1]/ID")});
150
151 auto leg = fp->legAtIndex(3); // DVR vor
152 leg->setHoldCount(3);
153 CPPUNIT_ASSERT_EQUAL(std::string{"hold"}, leg->waypoint()->type());
154
155 // sequence to that waypoint
156 SGGeod nearDover = fp->pointAlongRoute(3, -6.0);
157 setPositionAndStabilise(nearDover);
158
159 // check course deviation / cross-track error - we should still be at zero
160 auto doverVORPos = fp->legAtIndex(3)->waypoint()->position();
161 const double crsToDover = SGGeodesy::courseDeg(globals->get_aircraft_position(), doverVORPos);
162 const double legCrs = SGGeodesy::courseDeg(nearDover, doverVORPos);
163
164 // verify hold entry course
165 auto pilot = SGSharedPtr<FGTestApi::TestPilot>(new FGTestApi::TestPilot);
166 pilot->resetAtPosition(nearDover);
167 pilot->setCourseTrue(crsToDover); // initial course is correct
168 pilot->setSpeedKts(250);
169 pilot->flyGPSCourse(m_gps);
170
171 // ensure GPS speed is plausible
172 FGTestApi::runForTime(1.0);
173 fp->setCurrentIndex(3);
174
175 CPPUNIT_ASSERT_EQUAL(std::string{"COA"}, std::string{m_gpsNode->getStringValue("wp/wp[0]/ID")});
176 CPPUNIT_ASSERT_EQUAL(std::string{"DVR"}, std::string{m_gpsNode->getStringValue("wp/wp[1]/ID")});
177
178 CPPUNIT_ASSERT_DOUBLES_EQUAL(crsToDover, m_gpsNode->getDoubleValue("wp/wp[1]/bearing-true-deg"), 0.5);
179 CPPUNIT_ASSERT_DOUBLES_EQUAL(legCrs, m_gpsNode->getDoubleValue("wp/leg-true-course-deg"), 0.5);
180 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-error-nm"), 0.05);
181 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-deviation-deg"), 0.5);
182
183 auto statusNode = m_gpsNode->getNode("rnav-controller-status");
184 CPPUNIT_ASSERT_EQUAL(std::string{"leg-to-hold"}, std::string{statusNode->getStringValue()});
185
186 bool ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
187 std::string s = statusNode->getStringValue();
188 if (s == "hold-outbound") return true;
189 return false;
190 });
191
192 CPPUNIT_ASSERT(ok);
193
194 // first outbound leg
195 ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
196 std::string s = statusNode->getStringValue();
197 if (s == "hold-inbound") return true;
198 return false;
199 });
200
201 CPPUNIT_ASSERT(ok);
202 // check where we are!
203
204
205 ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
206 std::string s = statusNode->getStringValue();
207 if (s == "hold-outbound") return true;
208 return false;
209 });
210
211 CPPUNIT_ASSERT(ok);
212 FGTestApi::runForTime(45.0);
213
214 // reqeust hold exit
215 m_gpsNode->setStringValue("command", "exit-hold");
216
217 ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
218 std::string s = statusNode->getStringValue();
219 if (s == "hold-inbound") return true;
220 return false;
221 });
222
223 CPPUNIT_ASSERT(ok);
224
225 // and now we should exit the hold and sequence to TAWNY
226
227 ok = FGTestApi::runForTimeWithCheck(600.0, [fp]() {
228 if (fp->currentIndex() == 4) return true;
229 return false;
230 });
231
232 CPPUNIT_ASSERT(ok);
233 CPPUNIT_ASSERT_EQUAL(std::string{"leg"}, std::string{m_gpsNode->getStringValue("mode")});
234
235 // check we get back enroute okay
236 FGTestApi::runForTime(45.0);
237 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-error-nm"), 0.05);
238 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-deviation-deg"), 0.5);
239 }
240
241
242 void HoldControllerTests::testHoldEntryTeardrop()
243 {
244 // FGTestApi::setUp::logPositionToKML("hold_teardrop_entry");
245
246 auto rm = globals->get_subsystem<FGRouteMgr>();
247 auto fp = FlightPlan::create();
248 rm->setFlightPlan(fp);
249 FGTestApi::setUp::populateFPWithoutNasal(fp, "EBBR", "07L", "EGGD", "27",
250 "NIK COA DVR TAWNY WOD");
251 FGTestApi::writeFlightPlanToKML(fp);
252
253 auto testDelegate = new TestFPDelegate;
254 testDelegate->thePlan = fp;
255 CPPUNIT_ASSERT(rm->activate());
256 fp->addDelegate(testDelegate);
257
258 setupStandardGPS();
259 m_gpsNode->setStringValue("command", "leg");
260 setPositionAndStabilise(fp->departureRunway()->pointOnCenterline(0.0));
261
262 CPPUNIT_ASSERT_EQUAL(std::string{"leg"}, std::string{m_gpsNode->getStringValue("mode")});
263 CPPUNIT_ASSERT_EQUAL(std::string{"EBBR-07L"}, std::string{m_gpsNode->getStringValue("wp/wp[1]/ID")});
264
265 auto leg = fp->legAtIndex(3); // DVR vor
266 leg->setHoldCount(3);
267 CPPUNIT_ASSERT_EQUAL(std::string{"hold"}, leg->waypoint()->type());
268
269 flightgear::Hold* holdWpt = static_cast<flightgear::Hold*>(leg->waypoint());
270 holdWpt->setHoldRadial(120.0);
271
272 // sequence to that waypoint
273 SGGeod nearDover = fp->pointAlongRoute(3, -8.0);
274 setPositionAndStabilise(nearDover);
275
276 // check course deviation / cross-track error - we should still be at zero
277 auto doverVORPos = fp->legAtIndex(3)->waypoint()->position();
278 const double crsToDover = SGGeodesy::courseDeg(globals->get_aircraft_position(), doverVORPos);
279 const double legCrs = SGGeodesy::courseDeg(nearDover, doverVORPos);
280
281 // verify hold entry course
282 auto pilot = SGSharedPtr<FGTestApi::TestPilot>(new FGTestApi::TestPilot);
283 pilot->resetAtPosition(nearDover);
284 pilot->setCourseTrue(crsToDover); // initial course is correct
285 pilot->setSpeedKts(200);
286 pilot->flyGPSCourse(m_gps);
287
288 // ensure GPS speed is plausible
289 FGTestApi::runForTime(5.0);
290
291 // trigger entry to the hold
292 fp->setCurrentIndex(3);
293
294 CPPUNIT_ASSERT_EQUAL(std::string{"DVR"}, std::string{m_gpsNode->getStringValue("wp/wp[1]/ID")});
295 CPPUNIT_ASSERT_DOUBLES_EQUAL(crsToDover, m_gpsNode->getDoubleValue("wp/wp[1]/bearing-true-deg"), 0.5);
296 CPPUNIT_ASSERT_DOUBLES_EQUAL(legCrs, m_gpsNode->getDoubleValue("wp/leg-true-course-deg"), 0.5);
297 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-error-nm"), 0.1);
298 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-deviation-deg"), 0.5);
299
300
301 auto statusNode = m_gpsNode->getNode("rnav-controller-status");
302 CPPUNIT_ASSERT_EQUAL(std::string{"leg-to-hold"}, std::string{statusNode->getStringValue()});
303
304 bool ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
305 std::string s = statusNode->getStringValue();
306 if (s == "entry-teardrop") return true;
307 return false;
308 });
309 CPPUNIT_ASSERT(ok);
310
311 ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
312 std::string s = statusNode->getStringValue();
313 if (s == "hold-inbound") return true;
314 return false;
315 });
316
317 CPPUNIT_ASSERT(ok);
318 // check where we are
319
320 ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
321 std::string s = statusNode->getStringValue();
322 if (s == "hold-outbound") return true;
323 return false;
324 });
325
326 CPPUNIT_ASSERT(ok);
327
328 // outbound leg
329 ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
330 std::string s = statusNode->getStringValue();
331 if (s == "hold-inbound") return true;
332 return false;
333 });
334
335 CPPUNIT_ASSERT(ok);
336 FGTestApi::runForTime(80.0); // run inbound a bit
337 m_gpsNode->setStringValue("command", "exit-hold");
338
339 // check we exit ok
340 ok = FGTestApi::runForTimeWithCheck(600.0, [fp]() {
341 if (fp->currentIndex() == 4) return true;
342 return false;
343 });
344
345 CPPUNIT_ASSERT(ok);
346 CPPUNIT_ASSERT_EQUAL(std::string{"leg"}, std::string{m_gpsNode->getStringValue("mode")});
347
348 // check we get back enroute okay - will take a long time since we're pointing totally
349 // the wrong way
350 FGTestApi::runForTime(240.0);
351 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-error-nm"), 0.05);
352 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-deviation-deg"), 0.5);
353 }
354
355
356 void HoldControllerTests::testHoldEntryParallel()
357 {
358 //FGTestApi::setUp::logPositionToKML("hold_parallel_entry");
359
360 auto rm = globals->get_subsystem<FGRouteMgr>();
361 auto fp = FlightPlan::create();
362 rm->setFlightPlan(fp);
363 FGTestApi::setUp::populateFPWithoutNasal(fp, "EBBR", "07L", "EGGD", "27",
364 "NIK COA DVR TAWNY WOD");
365 // FGTestApi::writeFlightPlanToKML(fp);
366
367 auto testDelegate = new TestFPDelegate;
368 testDelegate->thePlan = fp;
369 CPPUNIT_ASSERT(rm->activate());
370 fp->addDelegate(testDelegate);
371
372 setupStandardGPS();
373 m_gpsNode->setStringValue("command", "leg");
374 setPositionAndStabilise(fp->departureRunway()->pointOnCenterline(0.0));
375
376 CPPUNIT_ASSERT_EQUAL(std::string{"leg"}, std::string{m_gpsNode->getStringValue("mode")});
377 CPPUNIT_ASSERT_EQUAL(std::string{"EBBR-07L"}, std::string{m_gpsNode->getStringValue("wp/wp[1]/ID")});
378
379 auto leg = fp->legAtIndex(3); // DVR vor
380 leg->setHoldCount(3);
381 CPPUNIT_ASSERT_EQUAL(std::string{"hold"}, leg->waypoint()->type());
382
383 flightgear::Hold* holdWpt = static_cast<flightgear::Hold*>(leg->waypoint());
384 holdWpt->setHoldRadial(45.0);
385
386 // sequence to that waypoint
387 SGGeod nearDover = fp->pointAlongRoute(3, -5.0);
388 setPositionAndStabilise(nearDover);
389
390 // trigger entry to the hold
391 fp->setCurrentIndex(3);
392
393 CPPUNIT_ASSERT_EQUAL(std::string{"DVR"}, std::string{m_gpsNode->getStringValue("wp/wp[1]/ID")});
394
395 // check course deviation / cross-track error - we should still be at zero
396 auto doverVORPos = fp->legAtIndex(3)->waypoint()->position();
397 const double crsToDover = SGGeodesy::courseDeg(globals->get_aircraft_position(), doverVORPos);
398 const double legCrs = SGGeodesy::courseDeg(nearDover, doverVORPos);
399
400 CPPUNIT_ASSERT_DOUBLES_EQUAL(crsToDover, m_gpsNode->getDoubleValue("wp/wp[1]/bearing-true-deg"), 0.5);
401 CPPUNIT_ASSERT_DOUBLES_EQUAL(legCrs, m_gpsNode->getDoubleValue("wp/leg-true-course-deg"), 0.5);
402 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-error-nm"), 0.05);
403 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-deviation-deg"), 0.5);
404
405 // verify hold entry course
406 auto pilot = SGSharedPtr<FGTestApi::TestPilot>(new FGTestApi::TestPilot);
407 pilot->resetAtPosition(nearDover);
408 pilot->setCourseTrue(crsToDover); // initial course is correct
409 pilot->setSpeedKts(250);
410 pilot->flyGPSCourse(m_gps);
411
412 auto statusNode = m_gpsNode->getNode("rnav-controller-status");
413 CPPUNIT_ASSERT_EQUAL(std::string{"leg-to-hold"}, std::string{statusNode->getStringValue()});
414
415 bool ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
416 std::string s = statusNode->getStringValue();
417 if (s == "entry-parallel") return true;
418 return false;
419 });
420 CPPUNIT_ASSERT(ok);
421
422 ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
423 std::string s = statusNode->getStringValue();
424 if (s == "hold-outbound") return true;
425 return false;
426 });
427
428 CPPUNIT_ASSERT(ok);
429 // check where we are
430
431 // outbound leg
432 ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
433 std::string s = statusNode->getStringValue();
434 if (s == "hold-inbound") return true;
435 return false;
436 });
437
438 CPPUNIT_ASSERT(ok);
439 FGTestApi::runForTime(80.0); // run inbound a bit
440 m_gpsNode->setStringValue("command", "exit-hold");
441
442 // check we exit ok
443 ok = FGTestApi::runForTimeWithCheck(600.0, [fp]() {
444 if (fp->currentIndex() == 4) return true;
445 return false;
446 });
447
448 CPPUNIT_ASSERT(ok);
449 CPPUNIT_ASSERT_EQUAL(std::string{"leg"}, std::string{m_gpsNode->getStringValue("mode")});
450
451 // check we get back enroute okay - will take a long time since we're pointing totally
452 // the wrong way
453 FGTestApi::runForTime(240.0);
454 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-error-nm"), 0.05);
455 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-deviation-deg"), 0.5);
456 }
457
458 /////////////////////////////////////////////////////////////////////////////
459
460 void HoldControllerTests::testLeftHoldEntryDirect()
461 {
462 // FGTestApi::setUp::logPositionToKML("hold_left_direct_entry");
463
464 auto rm = globals->get_subsystem<FGRouteMgr>();
465 auto fp = FlightPlan::create();
466 rm->setFlightPlan(fp);
467 FGTestApi::setUp::populateFPWithoutNasal(fp, "EBBR", "07L", "EGGD", "27",
468 "NIK COA DVR TAWNY WOD");
469 // FGTestApi::writeFlightPlanToKML(fp);
470
471 auto testDelegate = new TestFPDelegate;
472 testDelegate->thePlan = fp;
473 CPPUNIT_ASSERT(rm->activate());
474 fp->addDelegate(testDelegate);
475
476 setupStandardGPS();
477 m_gpsNode->setStringValue("command", "leg");
478 setPositionAndStabilise(fp->departureRunway()->pointOnCenterline(0.0));
479
480 CPPUNIT_ASSERT_EQUAL(std::string{"leg"}, std::string{m_gpsNode->getStringValue("mode")});
481 CPPUNIT_ASSERT_EQUAL(std::string{"EBBR-07L"}, std::string{m_gpsNode->getStringValue("wp/wp[1]/ID")});
482
483 auto leg = fp->legAtIndex(3); // DVR vor
484 leg->setHoldCount(3);
485 CPPUNIT_ASSERT_EQUAL(std::string{"hold"}, leg->waypoint()->type());
486 flightgear::Hold* holdWpt = static_cast<flightgear::Hold*>(leg->waypoint());
487
488 // puts us near the 110-degree limit for a direct entry on a left-handed-hold
489 holdWpt->setHoldRadial(15.0);
490 holdWpt->setLeftHanded();
491
492 // sequence to that waypoint
493 SGGeod nearDover = fp->pointAlongRoute(3, -4.0);
494 setPositionAndStabilise(nearDover);
495 fp->setCurrentIndex(3);
496
497 CPPUNIT_ASSERT_EQUAL(std::string{"COA"}, std::string{m_gpsNode->getStringValue("wp/wp[0]/ID")});
498 CPPUNIT_ASSERT_EQUAL(std::string{"DVR"}, std::string{m_gpsNode->getStringValue("wp/wp[1]/ID")});
499
500 // check course deviation / cross-track error - we should still be at zero
501 auto doverVORPos = fp->legAtIndex(3)->waypoint()->position();
502 const double crsToDover = SGGeodesy::courseDeg(globals->get_aircraft_position(), doverVORPos);
503 const double legCrs = SGGeodesy::courseDeg(nearDover, doverVORPos);
504
505 CPPUNIT_ASSERT_DOUBLES_EQUAL(crsToDover, m_gpsNode->getDoubleValue("wp/wp[1]/bearing-true-deg"), 0.5);
506 CPPUNIT_ASSERT_DOUBLES_EQUAL(legCrs, m_gpsNode->getDoubleValue("wp/leg-true-course-deg"), 0.5);
507 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-error-nm"), 0.05);
508 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-deviation-deg"), 0.5);
509
510 // verify hold entry course
511 auto pilot = SGSharedPtr<FGTestApi::TestPilot>(new FGTestApi::TestPilot);
512 pilot->resetAtPosition(nearDover);
513 pilot->setCourseTrue(crsToDover); // initial course is correct
514 pilot->setSpeedKts(300);
515 pilot->flyGPSCourse(m_gps);
516
517 auto statusNode = m_gpsNode->getNode("rnav-controller-status");
518 CPPUNIT_ASSERT_EQUAL(std::string{"leg-to-hold"}, std::string{statusNode->getStringValue()});
519
520 bool ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
521 std::string s = statusNode->getStringValue();
522 if (s == "hold-outbound") return true;
523 return false;
524 });
525
526 CPPUNIT_ASSERT(ok);
527
528 // first outbound leg
529 ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
530 std::string s = statusNode->getStringValue();
531 if (s == "hold-inbound") return true;
532 return false;
533 });
534
535 CPPUNIT_ASSERT(ok);
536 // check where we are!
537
538
539 ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
540 std::string s = statusNode->getStringValue();
541 if (s == "hold-outbound") return true;
542 return false;
543 });
544
545 CPPUNIT_ASSERT(ok);
546 FGTestApi::runForTime(45.0);
547
548 // reqeust hold exit
549 m_gpsNode->setStringValue("command", "exit-hold");
550
551 ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
552 std::string s = statusNode->getStringValue();
553 if (s == "hold-inbound") return true;
554 return false;
555 });
556
557 CPPUNIT_ASSERT(ok);
558
559 // and now we should exit the hold and sequence to TAWNY
560
561 ok = FGTestApi::runForTimeWithCheck(600.0, [fp]() {
562 if (fp->currentIndex() == 4) return true;
563 return false;
564 });
565
566 CPPUNIT_ASSERT(ok);
567 CPPUNIT_ASSERT_EQUAL(std::string{"leg"}, std::string{m_gpsNode->getStringValue("mode")});
568
569 // check we get back enroute okay
570 FGTestApi::runForTime(120.0);
571 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-error-nm"), 0.05);
572 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-deviation-deg"), 0.5);
573 }
574
575 void HoldControllerTests::testLeftHoldEntryTeardrop()
576 {
577 //FGTestApi::setUp::logPositionToKML("hold_left_teardrop_entry");
578
579 auto rm = globals->get_subsystem<FGRouteMgr>();
580 auto fp = FlightPlan::create();
581 rm->setFlightPlan(fp);
582 FGTestApi::setUp::populateFPWithoutNasal(fp, "EBBR", "07L", "EGGD", "27",
583 "NIK COA DVR TAWNY WOD");
584 // FGTestApi::writeFlightPlanToKML(fp);
585
586 auto testDelegate = new TestFPDelegate;
587 testDelegate->thePlan = fp;
588 CPPUNIT_ASSERT(rm->activate());
589 fp->addDelegate(testDelegate);
590
591 setupStandardGPS();
592 m_gpsNode->setStringValue("command", "leg");
593 setPositionAndStabilise(fp->departureRunway()->pointOnCenterline(0.0));
594
595 CPPUNIT_ASSERT_EQUAL(std::string{"leg"}, std::string{m_gpsNode->getStringValue("mode")});
596 CPPUNIT_ASSERT_EQUAL(std::string{"EBBR-07L"}, std::string{m_gpsNode->getStringValue("wp/wp[1]/ID")});
597
598 auto leg = fp->legAtIndex(3); // DVR vor
599 leg->setHoldCount(3);
600 CPPUNIT_ASSERT_EQUAL(std::string{"hold"}, leg->waypoint()->type());
601
602 flightgear::Hold* holdWpt = static_cast<flightgear::Hold*>(leg->waypoint());
603 holdWpt->setHoldRadial(25.0);
604 holdWpt->setLeftHanded();
605
606 // sequence to that waypoint
607 SGGeod nearDover = fp->pointAlongRoute(3, -5.0);
608 setPositionAndStabilise(nearDover);
609
610 // trigger entry to the hold
611 fp->setCurrentIndex(3);
612
613 CPPUNIT_ASSERT_EQUAL(std::string{"DVR"}, std::string{m_gpsNode->getStringValue("wp/wp[1]/ID")});
614
615 // check course deviation / cross-track error - we should still be at zero
616 auto doverVORPos = fp->legAtIndex(3)->waypoint()->position();
617 const double crsToDover = SGGeodesy::courseDeg(globals->get_aircraft_position(), doverVORPos);
618 const double legCrs = SGGeodesy::courseDeg(nearDover, doverVORPos);
619
620 CPPUNIT_ASSERT_DOUBLES_EQUAL(crsToDover, m_gpsNode->getDoubleValue("wp/wp[1]/bearing-true-deg"), 0.5);
621 CPPUNIT_ASSERT_DOUBLES_EQUAL(legCrs, m_gpsNode->getDoubleValue("wp/leg-true-course-deg"), 0.5);
622 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-error-nm"), 0.05);
623 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-deviation-deg"), 0.5);
624
625 // verify hold entry course
626 auto pilot = SGSharedPtr<FGTestApi::TestPilot>(new FGTestApi::TestPilot);
627 pilot->resetAtPosition(nearDover);
628 pilot->setCourseTrue(crsToDover); // initial course is correct
629 pilot->setSpeedKts(250);
630 pilot->flyGPSCourse(m_gps);
631
632 auto statusNode = m_gpsNode->getNode("rnav-controller-status");
633 CPPUNIT_ASSERT_EQUAL(std::string{"leg-to-hold"}, std::string{statusNode->getStringValue()});
634
635 bool ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
636 std::string s = statusNode->getStringValue();
637 if (s == "entry-teardrop") return true;
638 return false;
639 });
640
641 CPPUNIT_ASSERT(ok);
642
643 ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
644 std::string s = statusNode->getStringValue();
645 if (s == "hold-inbound") return true;
646 return false;
647 });
648
649 CPPUNIT_ASSERT(ok);
650 // check where we are
651
652 ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
653 std::string s = statusNode->getStringValue();
654 if (s == "hold-outbound") return true;
655 return false;
656 });
657
658 CPPUNIT_ASSERT(ok);
659
660 // outbound leg
661 ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
662 std::string s = statusNode->getStringValue();
663 if (s == "hold-inbound") return true;
664 return false;
665 });
666
667 CPPUNIT_ASSERT(ok);
668 FGTestApi::runForTime(80.0); // run inbound a bit
669 m_gpsNode->setStringValue("command", "exit-hold");
670
671 // check we exit ok
672 ok = FGTestApi::runForTimeWithCheck(600.0, [fp]() {
673 if (fp->currentIndex() == 4) return true;
674 return false;
675 });
676
677 CPPUNIT_ASSERT(ok);
678 CPPUNIT_ASSERT_EQUAL(std::string{"leg"}, std::string{m_gpsNode->getStringValue("mode")});
679
680 // check we get back enroute okay - will take a long time since we're pointing totally
681 // the wrong way
682 FGTestApi::runForTime(240.0);
683 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-error-nm"), 0.05);
684 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-deviation-deg"), 0.5);
685 }
686
687 void HoldControllerTests::testLeftHoldEntryParallel()
688 {
689 // FGTestApi::setUp::logPositionToKML("hold_left_parallel_entry");
690
691 auto rm = globals->get_subsystem<FGRouteMgr>();
692 auto fp = FlightPlan::create();
693 rm->setFlightPlan(fp);
694 FGTestApi::setUp::populateFPWithoutNasal(fp, "EBBR", "07L", "EGGD", "27",
695 "NIK COA DVR TAWNY WOD");
696 // FGTestApi::writeFlightPlanToKML(fp);
697
698 auto testDelegate = new TestFPDelegate;
699 testDelegate->thePlan = fp;
700 CPPUNIT_ASSERT(rm->activate());
701 fp->addDelegate(testDelegate);
702
703 setupStandardGPS();
704 m_gpsNode->setStringValue("command", "leg");
705 setPositionAndStabilise(fp->departureRunway()->pointOnCenterline(0.0));
706
707 CPPUNIT_ASSERT_EQUAL(std::string{"leg"}, std::string{m_gpsNode->getStringValue("mode")});
708 CPPUNIT_ASSERT_EQUAL(std::string{"EBBR-07L"}, std::string{m_gpsNode->getStringValue("wp/wp[1]/ID")});
709
710 auto leg = fp->legAtIndex(3); // DVR vor
711 leg->setHoldCount(3);
712 CPPUNIT_ASSERT_EQUAL(std::string{"hold"}, leg->waypoint()->type());
713
714 flightgear::Hold* holdWpt = static_cast<flightgear::Hold*>(leg->waypoint());
715 holdWpt->setHoldRadial(160);
716 holdWpt->setLeftHanded();
717
718 // sequence to that waypoint
719 SGGeod nearDover = fp->pointAlongRoute(3, -5.0);
720 setPositionAndStabilise(nearDover);
721
722 // trigger entry to the hold
723 fp->setCurrentIndex(3);
724
725 CPPUNIT_ASSERT_EQUAL(std::string{"DVR"}, std::string{m_gpsNode->getStringValue("wp/wp[1]/ID")});
726
727 // check course deviation / cross-track error - we should still be at zero
728 auto doverVORPos = fp->legAtIndex(3)->waypoint()->position();
729 const double crsToDover = SGGeodesy::courseDeg(globals->get_aircraft_position(), doverVORPos);
730 const double legCrs = SGGeodesy::courseDeg(nearDover, doverVORPos);
731
732 CPPUNIT_ASSERT_DOUBLES_EQUAL(crsToDover, m_gpsNode->getDoubleValue("wp/wp[1]/bearing-true-deg"), 0.5);
733 CPPUNIT_ASSERT_DOUBLES_EQUAL(legCrs, m_gpsNode->getDoubleValue("wp/leg-true-course-deg"), 0.5);
734 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-error-nm"), 0.05);
735 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-deviation-deg"), 0.5);
736
737 // verify hold entry course
738 auto pilot = SGSharedPtr<FGTestApi::TestPilot>(new FGTestApi::TestPilot);
739 pilot->resetAtPosition(nearDover);
740 pilot->setCourseTrue(crsToDover); // initial course is correct
741 pilot->setSpeedKts(190);
742 pilot->flyGPSCourse(m_gps);
743
744 auto statusNode = m_gpsNode->getNode("rnav-controller-status");
745 CPPUNIT_ASSERT_EQUAL(std::string{"leg-to-hold"}, std::string{statusNode->getStringValue()});
746
747 bool ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
748 std::string s = statusNode->getStringValue();
749 if (s == "entry-parallel") return true;
750 return false;
751 });
752
753 CPPUNIT_ASSERT(ok);
754
755 ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
756 std::string s = statusNode->getStringValue();
757 if (s == "hold-outbound") return true;
758 return false;
759 });
760
761 CPPUNIT_ASSERT(ok);
762 // check where we are
763
764 // outbound leg
765 ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
766 std::string s = statusNode->getStringValue();
767 if (s == "hold-inbound") return true;
768 return false;
769 });
770
771 CPPUNIT_ASSERT(ok);
772 FGTestApi::runForTime(80.0); // run inbound a bit
773 m_gpsNode->setStringValue("command", "exit-hold");
774
775 // check we exit ok
776 ok = FGTestApi::runForTimeWithCheck(600.0, [fp]() {
777 if (fp->currentIndex() == 4) return true;
778 return false;
779 });
780
781 CPPUNIT_ASSERT(ok);
782 CPPUNIT_ASSERT_EQUAL(std::string{"leg"}, std::string{m_gpsNode->getStringValue("mode")});
783
784 // check we get back enroute okay - will take a long time since we're pointing totally
785 // the wrong way
786 FGTestApi::runForTime(240.0);
787 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-error-nm"), 0.05);
788 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-deviation-deg"), 0.5);
789 }
790
791 /////////////////////////////////////////////////////////////////////////////
792
793 void HoldControllerTests::testHoldNotEntered()
794 {
795 // FGTestApi::setUp::logPositionToKML("hold_no_entry");
796
797 auto rm = globals->get_subsystem<FGRouteMgr>();
798 auto fp = FlightPlan::create();
799 rm->setFlightPlan(fp);
800 FGTestApi::setUp::populateFPWithoutNasal(fp, "EBBR", "07L", "EGGD", "27",
801 "NIK COA DVR TAWNY WOD");
802 // FGTestApi::writeFlightPlanToKML(fp);
803
804 auto testDelegate = new TestFPDelegate;
805 testDelegate->thePlan = fp;
806 CPPUNIT_ASSERT(rm->activate());
807 fp->addDelegate(testDelegate);
808
809 setupStandardGPS();
810 m_gpsNode->setStringValue("command", "leg");
811 setPositionAndStabilise(fp->departureRunway()->pointOnCenterline(0.0));
812
813 CPPUNIT_ASSERT_EQUAL(std::string{"leg"}, std::string{m_gpsNode->getStringValue("mode")});
814 CPPUNIT_ASSERT_EQUAL(std::string{"EBBR-07L"}, std::string{m_gpsNode->getStringValue("wp/wp[1]/ID")});
815
816 auto leg = fp->legAtIndex(3); // DVR vor
817 leg->setHoldCount(3);
818 CPPUNIT_ASSERT_EQUAL(std::string{"hold"}, leg->waypoint()->type());
819 flightgear::Hold* holdWpt = static_cast<flightgear::Hold*>(leg->waypoint());
820
821 holdWpt->setHoldRadial(15.0);
822
823 // sequence to that waypoint
824 SGGeod nearDover = fp->pointAlongRoute(3, -4.0);
825 setPositionAndStabilise(nearDover);
826 fp->setCurrentIndex(3);
827
828 CPPUNIT_ASSERT_EQUAL(std::string{"COA"}, std::string{m_gpsNode->getStringValue("wp/wp[0]/ID")});
829 CPPUNIT_ASSERT_EQUAL(std::string{"DVR"}, std::string{m_gpsNode->getStringValue("wp/wp[1]/ID")});
830
831 // check course deviation / cross-track error - we should still be at zero
832 auto doverVORPos = fp->legAtIndex(3)->waypoint()->position();
833 const double crsToDover = SGGeodesy::courseDeg(globals->get_aircraft_position(), doverVORPos);
834 const double legCrs = SGGeodesy::courseDeg(nearDover, doverVORPos);
835
836 CPPUNIT_ASSERT_DOUBLES_EQUAL(crsToDover, m_gpsNode->getDoubleValue("wp/wp[1]/bearing-true-deg"), 0.5);
837 CPPUNIT_ASSERT_DOUBLES_EQUAL(legCrs, m_gpsNode->getDoubleValue("wp/leg-true-course-deg"), 0.5);
838 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-error-nm"), 0.05);
839 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-deviation-deg"), 0.5);
840
841 // verify hold entry course
842 auto pilot = SGSharedPtr<FGTestApi::TestPilot>(new FGTestApi::TestPilot);
843 pilot->resetAtPosition(nearDover);
844 pilot->setCourseTrue(crsToDover); // initial course is correct
845 pilot->setSpeedKts(300);
846 pilot->flyGPSCourse(m_gps);
847
848 auto statusNode = m_gpsNode->getNode("rnav-controller-status");
849 CPPUNIT_ASSERT_EQUAL(std::string{"leg-to-hold"}, std::string{statusNode->getStringValue()});
850
851 // now we reset the hold count, so we don't enter
852 m_gpsNode->setStringValue("command", "exit-hold");
853
854 // this should not do anything for now
855 CPPUNIT_ASSERT_EQUAL(std::string{"leg-to-hold"}, std::string{statusNode->getStringValue()});
856
857 bool ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
858 std::string s = statusNode->getStringValue();
859 if (s == "hold-exiting") return true;
860 return false;
861 });
862
863 // and now we should exit the hold and sequence to TAWNY
864 ok = FGTestApi::runForTimeWithCheck(600.0, [fp]() {
865 if (fp->currentIndex() == 4) return true;
866 return false;
867 });
868
869 CPPUNIT_ASSERT(ok);
870 CPPUNIT_ASSERT_EQUAL(std::string{"leg"}, std::string{m_gpsNode->getStringValue("mode")});
871
872 // check we get back enroute okay
873 FGTestApi::runForTime(120.0);
874 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-error-nm"), 0.05);
875 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-deviation-deg"), 0.5);
876 }
877
878 /////////////////////////////////////////////////////////////////////////////
879 // test entering the hold from wildly off the leg's track
880
881 void HoldControllerTests::testHoldEntryOffCourse()
882 {
883 // FGTestApi::setUp::logPositionToKML("hold_entry_off-course");
884
885 auto rm = globals->get_subsystem<FGRouteMgr>();
886 auto fp = FlightPlan::create();
887 rm->setFlightPlan(fp);
888 FGTestApi::setUp::populateFPWithoutNasal(fp, "EBBR", "07L", "EGGD", "27",
889 "NIK COA DVR TAWNY WOD");
890 // FGTestApi::writeFlightPlanToKML(fp);
891
892 auto testDelegate = new TestFPDelegate;
893 testDelegate->thePlan = fp;
894 CPPUNIT_ASSERT(rm->activate());
895 fp->addDelegate(testDelegate);
896
897 setupStandardGPS();
898 m_gpsNode->setStringValue("command", "leg");
899 setPositionAndStabilise(fp->departureRunway()->pointOnCenterline(0.0));
900
901 CPPUNIT_ASSERT_EQUAL(std::string{"leg"}, std::string{m_gpsNode->getStringValue("mode")});
902 CPPUNIT_ASSERT_EQUAL(std::string{"EBBR-07L"}, std::string{m_gpsNode->getStringValue("wp/wp[1]/ID")});
903
904 auto leg = fp->legAtIndex(3); // DVR vor
905 leg->setHoldCount(3);
906 CPPUNIT_ASSERT_EQUAL(std::string{"hold"}, leg->waypoint()->type());
907
908 flightgear::Hold* holdWpt = static_cast<flightgear::Hold*>(leg->waypoint());
909 // this should be a direct entry, but now we're going to go off course!
910 holdWpt->setHoldRadial(330);
911
912 // sequence to that waypoint
913 auto doverVORPos = fp->legAtIndex(3)->waypoint()->position();
914 SGGeod nearDover = fp->pointAlongRoute(3, -6.0);
915 SGGeod offCoursePos = SGGeodesy::direct(doverVORPos, 20, 3.0 * SG_NM_TO_METER);
916 setPositionAndStabilise(nearDover);
917
918 // check course deviation / cross-track error - we should still be at zero
919 const double legCrs = SGGeodesy::courseDeg(nearDover, doverVORPos);
920
921 // sequence to the COA -> DVR leg
922 fp->setCurrentIndex(3);
923
924 // assume we got wildly off course somehow
925 setPositionAndStabilise(offCoursePos);
926
927 // verify hold entry course
928 auto pilot = SGSharedPtr<FGTestApi::TestPilot>(new FGTestApi::TestPilot);
929 pilot->setCourseTrue(legCrs); // initial course is correct
930 pilot->setSpeedKts(250);
931 pilot->flyGPSCourse(m_gps);
932 pilot->resetAtPosition(offCoursePos);
933 const double crsToDover = SGGeodesy::courseDeg(globals->get_aircraft_position(), doverVORPos);
934 pilot->setCourseTrue(crsToDover); // initial course is correct
935
936 CPPUNIT_ASSERT_EQUAL(std::string{"COA"}, std::string{m_gpsNode->getStringValue("wp/wp[0]/ID")});
937 CPPUNIT_ASSERT_EQUAL(std::string{"DVR"}, std::string{m_gpsNode->getStringValue("wp/wp[1]/ID")});
938
939 CPPUNIT_ASSERT_DOUBLES_EQUAL(crsToDover, m_gpsNode->getDoubleValue("wp/wp[1]/bearing-true-deg"), 0.5);
940 CPPUNIT_ASSERT_DOUBLES_EQUAL(legCrs, m_gpsNode->getDoubleValue("wp/leg-true-course-deg"), 0.5);
941 // CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-error-nm"), 0.05);
942 CPPUNIT_ASSERT_DOUBLES_EQUAL(crsToDover - legCrs, m_gpsNode->getDoubleValue("wp/wp[1]/course-deviation-deg"), 0.5);
943
944 auto statusNode = m_gpsNode->getNode("rnav-controller-status");
945 CPPUNIT_ASSERT_EQUAL(std::string{"leg-to-hold"}, std::string{statusNode->getStringValue()});
946
947 // we should select parallel entry due to being off course
948 bool ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
949 std::string s = statusNode->getStringValue();
950 if (s == "entry-parallel") return true;
951 return false;
952 });
953 CPPUNIT_ASSERT(ok);
954
955 ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
956 std::string s = statusNode->getStringValue();
957 if (s == "hold-outbound") return true;
958 return false;
959 });
960
961
962 CPPUNIT_ASSERT(ok);
963 // first outbound leg
964 ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
965 std::string s = statusNode->getStringValue();
966 if (s == "hold-inbound") return true;
967 return false;
968 });
969
970 CPPUNIT_ASSERT(ok);
971
972 ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
973 std::string s = statusNode->getStringValue();
974 if (s == "hold-outbound") return true;
975 return false;
976 });
977
978 CPPUNIT_ASSERT(ok);
979 FGTestApi::runForTime(45.0);
980
981 // reqeust hold exit
982 m_gpsNode->setStringValue("command", "exit-hold");
983
984 ok = FGTestApi::runForTimeWithCheck(600.0, [statusNode]() {
985 std::string s = statusNode->getStringValue();
986 if (s == "hold-inbound") return true;
987 return false;
988 });
989
990 CPPUNIT_ASSERT(ok);
991
992 // and now we should exit the hold and sequence to TAWNY
993
994 ok = FGTestApi::runForTimeWithCheck(600.0, [fp]() {
995 if (fp->currentIndex() == 4) return true;
996 return false;
997 });
998
999 CPPUNIT_ASSERT(ok);
1000 CPPUNIT_ASSERT_EQUAL(std::string{"leg"}, std::string{m_gpsNode->getStringValue("mode")});
1001
1002 // check we get back enroute okay
1003 FGTestApi::runForTime(45.0);
1004 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-error-nm"), 0.05);
1005 CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_gpsNode->getDoubleValue("wp/wp[1]/course-deviation-deg"), 0.5);
1006 }