1
0
Fork 0

Test AI shuttle flight

This commit is contained in:
portree_kid 2021-03-20 13:19:16 +01:00 committed by James Turner
parent 47ca5c251f
commit cb3f8056ff
2 changed files with 275 additions and 14 deletions

View file

@ -10,7 +10,7 @@
<actype>BN2</actype>
<offset>0</offset>
<radius>8</radius>
<flighttype>gate</flighttype>
<flighttype>ga</flighttype>
<performance-class>turboprop_transport</performance-class>
<registration>G-HEBO</registration>
<heavy>false</heavy>
@ -24,13 +24,13 @@
<actype>BN2</actype>
<offset>0</offset>
<radius>8</radius>
<flighttype>gate</flighttype>
<flighttype>ga</flighttype>
<performance-class>turboprop_transport</performance-class>
<registration>G-HEBS</registration>
<heavy>false</heavy>
</aircraft>
<flight>
<callsign>Hebridean_1000</callsign>
<callsign>Test_0001</callsign>
<required-aircraft>TST_BN_2</required-aircraft>
<fltrules>VFR</fltrules>
<departure>
@ -40,12 +40,12 @@
<cruise-alt>50</cruise-alt>
<arrival>
<port>YSSY</port>
<time>01:00:00</time>
<time>00:10:00</time>
</arrival>
<repeat>Hr</repeat>
<repeat>02Hr</repeat>
</flight>
<flight>
<callsign>Hebridean_1000</callsign>
<callsign>Test_1001</callsign>
<required-aircraft>TST_BN_2</required-aircraft>
<fltrules>VFR</fltrules>
<departure>
@ -53,10 +53,265 @@
<time>00:00:00</time>
</departure>
<cruise-alt>50</cruise-alt>
<arrival>
<port>YBBN</port>
<time>00:20:00</time>
</arrival>
<repeat>02Hr</repeat>
</flight>
<flight>
<callsign>Test_1001</callsign>
<required-aircraft>TST_BN_2</required-aircraft>
<fltrules>VFR</fltrules>
<departure>
<port>YSSY</port>
<time>00:05:00</time>
</departure>
<cruise-alt>50</cruise-alt>
<arrival>
<port>YBBN</port>
<time>00:25:00</time>
</arrival>
<repeat>02Hr</repeat>
</flight>
<flight>
<callsign>Test_1002</callsign>
<required-aircraft>TST_BN_2</required-aircraft>
<fltrules>VFR</fltrules>
<departure>
<port>YSSY</port>
<time>00:10:00</time>
</departure>
<cruise-alt>50</cruise-alt>
<arrival>
<port>YBBN</port>
<time>00:30:00</time>
</arrival>
<repeat>02Hr</repeat>
</flight>
<flight>
<callsign>Test_1002</callsign>
<required-aircraft>TST_BN_2</required-aircraft>
<fltrules>VFR</fltrules>
<departure>
<port>YSSY</port>
<time>00:15:00</time>
</departure>
<cruise-alt>50</cruise-alt>
<arrival>
<port>YBBN</port>
<time>00:35:00</time>
</arrival>
<repeat>02Hr</repeat>
</flight>
<flight>
<callsign>Test_1003</callsign>
<required-aircraft>TST_BN_2</required-aircraft>
<fltrules>VFR</fltrules>
<departure>
<port>YSSY</port>
<time>00:20:00</time>
</departure>
<cruise-alt>50</cruise-alt>
<arrival>
<port>YBBN</port>
<time>00:40:00</time>
</arrival>
<repeat>02Hr</repeat>
</flight>
<flight>
<callsign>Test_1003</callsign>
<required-aircraft>TST_BN_2</required-aircraft>
<fltrules>VFR</fltrules>
<departure>
<port>YSSY</port>
<time>00:25:00</time>
</departure>
<cruise-alt>50</cruise-alt>
<arrival>
<port>YBBN</port>
<time>00:45:00</time>
</arrival>
<repeat>02Hr</repeat>
</flight>
<flight>
<callsign>Test_1004</callsign>
<required-aircraft>TST_BN_2</required-aircraft>
<fltrules>VFR</fltrules>
<departure>
<port>YSSY</port>
<time>00:30:00</time>
</departure>
<cruise-alt>50</cruise-alt>
<arrival>
<port>YBBN</port>
<time>00:50:00</time>
</arrival>
<repeat>02Hr</repeat>
</flight>
<flight>
<callsign>Test_1004</callsign>
<required-aircraft>TST_BN_2</required-aircraft>
<fltrules>VFR</fltrules>
<departure>
<port>YSSY</port>
<time>00:35:00</time>
</departure>
<cruise-alt>50</cruise-alt>
<arrival>
<port>YBBN</port>
<time>00:55:00</time>
</arrival>
<repeat>02Hr</repeat>
</flight>
<flight>
<callsign>Test_1005</callsign>
<required-aircraft>TST_BN_2</required-aircraft>
<fltrules>VFR</fltrules>
<departure>
<port>YSSY</port>
<time>00:40:00</time>
</departure>
<cruise-alt>50</cruise-alt>
<arrival>
<port>YBBN</port>
<time>01:00:00</time>
</arrival>
<repeat>Hr</repeat>
<repeat>02Hr</repeat>
</flight>
<flight>
<callsign>Test_1005</callsign>
<required-aircraft>TST_BN_2</required-aircraft>
<fltrules>VFR</fltrules>
<departure>
<port>YSSY</port>
<time>00:45:00</time>
</departure>
<cruise-alt>50</cruise-alt>
<arrival>
<port>YBBN</port>
<time>01:05:00</time>
</arrival>
<repeat>02Hr</repeat>
</flight>
<flight>
<callsign>Test_1006</callsign>
<required-aircraft>TST_BN_2</required-aircraft>
<fltrules>VFR</fltrules>
<departure>
<port>YSSY</port>
<time>00:50:00</time>
</departure>
<cruise-alt>50</cruise-alt>
<arrival>
<port>YBBN</port>
<time>01:10:00</time>
</arrival>
<repeat>02Hr</repeat>
</flight>
<flight>
<callsign>Test_1006</callsign>
<required-aircraft>TST_BN_2</required-aircraft>
<fltrules>VFR</fltrules>
<departure>
<port>YSSY</port>
<time>00:55:00</time>
</departure>
<cruise-alt>50</cruise-alt>
<arrival>
<port>YBBN</port>
<time>01:15:00</time>
</arrival>
<repeat>02Hr</repeat>
</flight>
<flight>
<callsign>Test_1007</callsign>
<required-aircraft>TST_BN_2</required-aircraft>
<fltrules>VFR</fltrules>
<departure>
<port>YSSY</port>
<time>01:00:00</time>
</departure>
<cruise-alt>50</cruise-alt>
<arrival>
<port>YBBN</port>
<time>01:20:00</time>
</arrival>
<repeat>02Hr</repeat>
</flight>
<flight>
<callsign>Test_1008</callsign>
<required-aircraft>TST_BN_2</required-aircraft>
<fltrules>VFR</fltrules>
<departure>
<port>YSSY</port>
<time>01:10:00</time>
</departure>
<cruise-alt>50</cruise-alt>
<arrival>
<port>YBBN</port>
<time>01:30:00</time>
</arrival>
<repeat>02Hr</repeat>
</flight>
<flight>
<callsign>Test_1009</callsign>
<required-aircraft>TST_BN_2</required-aircraft>
<fltrules>VFR</fltrules>
<departure>
<port>YSSY</port>
<time>01:20:00</time>
</departure>
<cruise-alt>50</cruise-alt>
<arrival>
<port>YBBN</port>
<time>01:40:00</time>
</arrival>
<repeat>02Hr</repeat>
</flight>
<flight>
<callsign>Test_1010</callsign>
<required-aircraft>TST_BN_2</required-aircraft>
<fltrules>VFR</fltrules>
<departure>
<port>YSSY</port>
<time>01:30:00</time>
</departure>
<cruise-alt>50</cruise-alt>
<arrival>
<port>YBBN</port>
<time>01:50:00</time>
</arrival>
<repeat>02Hr</repeat>
</flight>
<flight>
<callsign>Test_1011</callsign>
<required-aircraft>TST_BN_2</required-aircraft>
<fltrules>VFR</fltrules>
<departure>
<port>YSSY</port>
<time>01:40:00</time>
</departure>
<cruise-alt>50</cruise-alt>
<arrival>
<port>YBBN</port>
<time>02:00:00</time>
</arrival>
<repeat>02Hr</repeat>
</flight>
<flight>
<callsign>Test_1012</callsign>
<required-aircraft>TST_BN_2</required-aircraft>
<fltrules>VFR</fltrules>
<departure>
<port>YSSY</port>
<time>01:50:00</time>
</departure>
<cruise-alt>50</cruise-alt>
<arrival>
<port>YBBN</port>
<time>02:10:00</time>
</arrival>
<repeat>02Hr</repeat>
</flight>
</trafficlist>

View file

@ -56,12 +56,13 @@ void TrafficTests::setUp()
fgSetBool("sim/ai/enabled", true);
fgSetBool("sim/traffic-manager/enabled", true);
fgSetBool("sim/signals/fdm-initialized", false);
fgSetBool("sim/signals/fdm-initialized", true);
fgSetInt("/environment/visibility-m", 1000);
fgSetBool("/environment/realwx/enabled", false);
fgSetBool("/environment/metar/valid", false);
fgSetBool("/sim/terrasync/ai-data-update-now", false);
globals->append_data_path(SGPath::fromUtf8(FG_TEST_SUITE_DATA), false);
// ensure EDDF has a valid ground net for parking testing
FGAirport::clearAirportsCache();
@ -488,11 +489,11 @@ void TrafficTests::testPushforwardParkYBBNRepeat()
const char* flighttype = "ga";
FGAISchedule* schedule = new FGAISchedule(
"B737", "KLM", departureAirport->getId(), "G-BLA", "ID", false, "B737", "KLM", "N", flighttype, radius, 8);
FGScheduledFlight* flight = new FGScheduledFlight("gaParkYSSY", "", departureAirport->getId(), arrivalAirport->getId(), 24, dep, arr, "WEEK", "HBR_BN_2");
"B737", "KLM", departureAirport->getId(), "G-BLA", "TST_BN_2", false, "B737", "KLM", "N", flighttype, radius, 8);
FGScheduledFlight* flight = new FGScheduledFlight("gaParkYSSY", "VFR", departureAirport->getId(), arrivalAirport->getId(), 24, dep, arr, "WEEK", "TST_BN_2");
schedule->assign(flight);
FGScheduledFlight* returnFlight = new FGScheduledFlight("gaParkYSSY", "", arrivalAirport->getId(), departureAirport->getId(), 24, arr, ret, "WEEK", "HBR_BN_2");
FGScheduledFlight* returnFlight = new FGScheduledFlight("gaParkYSSY", "", arrivalAirport->getId(), departureAirport->getId(), 24, arr, ret, "WEEK", "TST_BN_2");
schedule->assign(returnFlight);
FGAIAircraft* aiAircraft = new FGAIAircraft{schedule};
@ -551,6 +552,7 @@ FGAIAircraft * TrafficTests::flyAI(FGAIAircraft * aiAircraft, std::string fName)
FGTestApi::setUp::logLinestringsToKML(fName);
flightgear::SGGeodVec geods = flightgear::SGGeodVec();
char buffer[50];
int iteration = 1;
int lastLeg = -1;
double lastHeading = 0;
for (size_t i = 0; i < 12000000 && !(aiAircraft->getDie()) && aiAircraft->GetFlightPlan()->getLeg() < 10; i++) {
@ -574,19 +576,23 @@ FGAIAircraft * TrafficTests::flyAI(FGAIAircraft * aiAircraft, std::string fName)
if (aiAircraft->GetFlightPlan()->getLeg() == 9) {
this->dump(aiAircraft);
}
if (aiAircraft->GetFlightPlan()->getLeg() > lastLeg) {
sprintf(buffer, "AI Leg %d", lastLeg);
if (aiAircraft->GetFlightPlan()->getLeg() != lastLeg) {
sprintf(buffer, "AI Leg %d Callsign %s Iteration %d", lastLeg, aiAircraft->getCallSign().c_str(), iteration);
FGTestApi::writeGeodsToKML(buffer, geods);
if (aiAircraft->GetFlightPlan()->getLeg() < lastLeg) {
iteration++;
}
lastLeg = aiAircraft->GetFlightPlan()->getLeg();
SGGeod last = geods.back();
geods.clear();
geods.insert(geods.end(), last);
}
CPPUNIT_ASSERT_LESSEQUAL(10, aiAircraft->GetFlightPlan()->getLeg());
CPPUNIT_ASSERT_MESSAGE( "Aircraft has not completed test in time.", i < 30000);
FGTestApi::runForTime(3);
}
lastLeg = aiAircraft->GetFlightPlan()->getLeg();
sprintf(buffer, "AI Leg %d", lastLeg);
sprintf(buffer, "AI Leg %d Callsign %s Iteration %d", lastLeg, aiAircraft->getCallSign().c_str(), iteration);
FGTestApi::writeGeodsToKML(buffer, geods);
geods.clear();
return aiAircraft;