ADD: added updated drone.yml and changed some function calls

This commit is contained in:
Henry Winkel
2024-03-13 16:41:56 +01:00
parent 48101a673a
commit 0e05106d1e
13 changed files with 264 additions and 231 deletions

View File

@@ -3,6 +3,8 @@
#include "kubecontrol/KubePod.hpp"
#include "nlohmann/json_fwd.hpp"
#include <math.h>
#include <string>
#include <thread>
#include <vector>
@@ -19,7 +21,10 @@ const int podGrid = 2;
void startShip(kubecontrol::PodController* podc,std::string uuid,std::string Name, std::string lat, std::string lon)
{
kubecontrol::KubePod ShipPod1("controller",uuid,"ship","ship:latest","simulator");
std::string owner = "controller";
std::string type = "ship";
std::string image = "ship:latest";
kubecontrol::KubePod ShipPod1(owner,uuid,type,image,"simulator");
nlohmann::json vars;
vars["ENTITY_ID"] = uuid;
@@ -37,29 +42,30 @@ void startShip(kubecontrol::PodController* podc,std::string uuid,std::string Nam
vars["ENTITY_SENSORS"].push_back("radar:latest");
ShipPod1.setEnvironmentVar("CONFIG", vars.dump());
podc->startPod(ShipPod1);
}
void createScenario(kubecontrol::PodController* podc,std::vector<std::string> *uuidList)
{
// GeographicLib::Geodesic geod(GeographicLib::Constants::WGS84_a(), GeographicLib::Constants::WGS84_f());
// GeographicLib::Geodesic geod(GeographicLib::Constants::WGS84_a(), GeographicLib::Constants::WGS84_f());
double lat = 54, lon = 1;
int counter = 0;
double distance = 10000;
int rasterSize = podGrid;
for (int i = 0; i < rasterSize; i++ )
for (int i = 0; i < rasterSize; i++ )
{
double lonTmp = lon;
for (int a = 0; a < rasterSize; a++)
for (int a = 0; a < rasterSize; a++)
{
std::string name = "test";
name += std::to_string(counter);
double lat2, lon2;
// geod.Direct(lat, lonTmp, 90, distance, lat2, lon2);
double lat2 = 0;
double lon2 = 0;
// geod.Direct(lat, lonTmp, 90, distance, lat2, lon2);
lat2= lat+10;
// SimCore::Identifier id;
// ids->push_back(id.getUUID());
@@ -79,7 +85,7 @@ void createScenario(kubecontrol::PodController* podc,std::vector<std::string> *u
}
double lat2, lon2;
// geod.Direct(lat, lon, 0, distance, lat2, lon2);
// geod.Direct(lat, lon, 0, distance, lat2, lon2);
lat = lat + 10;
@@ -92,7 +98,7 @@ void createScenario(kubecontrol::PodController* podc,std::vector<std::string> *u
SCENARIO("Testing the SimCore Sensor")
{
// kubecontrol::PodController podc("docs/config");
auto podc = new kubecontrol::PodController("docs/config");
std::vector<std::string> uuidList;
@@ -121,7 +127,7 @@ std::this_thread::sleep_for(std::chrono::milliseconds(4000));
{
WHEN("constructing Track Object with data")
{
THEN("check if Track attributes are correct")
{
auto info = podc->getInfoForPod(uuidList[random_index]);
@@ -133,7 +139,7 @@ std::this_thread::sleep_for(std::chrono::milliseconds(4000));
// REQUIRE(info1 != "");
podc->stopAllPods();
@@ -141,4 +147,4 @@ std::this_thread::sleep_for(std::chrono::milliseconds(4000));
} //THEN
} // WHEN
} // GIVEN
} //SCENARIO
} //SCENARIO