ADD: default grid scenario
This commit is contained in:
@@ -14,7 +14,7 @@ RUN apt-get upgrade
|
|||||||
|
|
||||||
####### DEBUG packete
|
####### DEBUG packete
|
||||||
|
|
||||||
RUN apt-get -y install tcpdump nano netcat-openbsd
|
RUN apt-get -y install tcpdump nano netcat-openbsd htop
|
||||||
|
|
||||||
|
|
||||||
########
|
########
|
||||||
|
|||||||
@@ -60,6 +60,13 @@ class SimControl{
|
|||||||
void updateShip(nlohmann::json request);
|
void updateShip(nlohmann::json request);
|
||||||
void deleteShip(nlohmann::json request);
|
void deleteShip(nlohmann::json request);
|
||||||
|
|
||||||
|
|
||||||
|
void saveScenario();
|
||||||
|
void loadScenario(std::string ID);
|
||||||
|
void deleteScenario(std::string ID);
|
||||||
|
void generateSampleScneario();
|
||||||
|
|
||||||
|
|
||||||
void startWebApp();
|
void startWebApp();
|
||||||
|
|
||||||
void startWebsocketServer();
|
void startWebsocketServer();
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include <Orders/MoveOrder.hpp>
|
#include <Orders/MoveOrder.hpp>
|
||||||
#include <SimCore/Identifier.hpp>
|
#include <SimCore/Identifier.hpp>
|
||||||
#include "DirectCommunicationServer.hpp"
|
#include "DirectCommunicationServer.hpp"
|
||||||
|
#include "GeographicLib/Geodesic.hpp"
|
||||||
#include "SimControl/Tracklist.hpp"
|
#include "SimControl/Tracklist.hpp"
|
||||||
#include "SimCore/Messages/Control.hpp"
|
#include "SimCore/Messages/Control.hpp"
|
||||||
#include "SimCore/Messages/SimTrack.hpp"
|
#include "SimCore/Messages/SimTrack.hpp"
|
||||||
@@ -180,11 +181,11 @@ namespace SimControl {
|
|||||||
// The uri the client did connect to.
|
// The uri the client did connect to.
|
||||||
LOG_S(INFO) << "Uri: " << msg->openInfo.uri ;
|
LOG_S(INFO) << "Uri: " << msg->openInfo.uri ;
|
||||||
|
|
||||||
LOG_S(INFO) << "Headers:" ;
|
// LOG_S(INFO) << "Headers:" ;
|
||||||
for (auto it : msg->openInfo.headers)
|
// for (auto it : msg->openInfo.headers)
|
||||||
{
|
// {
|
||||||
LOG_S(INFO)<< "\t" << it.first << ": " << it.second;
|
// LOG_S(INFO)<< "\t" << it.first << ": " << it.second;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
else if (msg->type == ix::WebSocketMessageType::Message)
|
else if (msg->type == ix::WebSocketMessageType::Message)
|
||||||
{
|
{
|
||||||
@@ -225,6 +226,29 @@ namespace SimControl {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}else if (j["Data"] == "Scenario")
|
||||||
|
{
|
||||||
|
if(j["Type"] == "Save")
|
||||||
|
{
|
||||||
|
|
||||||
|
}else if(j["Type"] == "Load")
|
||||||
|
{
|
||||||
|
|
||||||
|
}else if(j["Type"] == "Delete")
|
||||||
|
{
|
||||||
|
|
||||||
|
}else if(j["Type"] == "AutoRaster")
|
||||||
|
{
|
||||||
|
this->generateSampleScneario();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}else if (j["Data"] == "TEST")
|
||||||
|
{
|
||||||
|
nlohmann::json response;
|
||||||
|
response["Message"] = "Hello world";
|
||||||
|
websocket.send(response.dump());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -267,7 +291,7 @@ namespace SimControl {
|
|||||||
|
|
||||||
void SimControl::startNewShip(std::string Name, std::string lat, std::string lon, std::string height , std::string course, std::string speed)
|
void SimControl::startNewShip(std::string Name, std::string lat, std::string lon, std::string height , std::string course, std::string speed)
|
||||||
{
|
{
|
||||||
|
LOG_S(INFO)<< "start New Ship";
|
||||||
|
|
||||||
std::string uuid = xg::newGuid().str();
|
std::string uuid = xg::newGuid().str();
|
||||||
kubecontrol::KubePod ShipPod1("controller",uuid,"ship","ship:latest",Namespace_);
|
kubecontrol::KubePod ShipPod1("controller",uuid,"ship","ship:latest",Namespace_);
|
||||||
@@ -303,6 +327,8 @@ namespace SimControl {
|
|||||||
|
|
||||||
void SimControl::updateShip(nlohmann::json request)
|
void SimControl::updateShip(nlohmann::json request)
|
||||||
{
|
{
|
||||||
|
LOG_S(INFO)<< "Update Ship: "<< request["ID"];
|
||||||
|
|
||||||
// if (j["Type"] == ) {
|
// if (j["Type"] == ) {
|
||||||
// statements
|
// statements
|
||||||
// }
|
// }
|
||||||
@@ -375,6 +401,57 @@ namespace SimControl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SimControl::saveScenario()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimControl::loadScenario(std::string ID)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimControl::deleteScenario(std::string ID)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimControl::generateSampleScneario()
|
||||||
|
{
|
||||||
|
GeographicLib::Geodesic geod(GeographicLib::Constants::WGS84_a(), GeographicLib::Constants::WGS84_f());
|
||||||
|
double lat = 54, lon = 1;
|
||||||
|
int counter = 0;
|
||||||
|
double distance = 10000;
|
||||||
|
|
||||||
|
int rasterSize = 10;
|
||||||
|
|
||||||
|
for (int i = 0; i < rasterSize; i++ )
|
||||||
|
{
|
||||||
|
double lonTmp = lon;
|
||||||
|
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);
|
||||||
|
|
||||||
|
SimControl::startNewShip(name, std::to_string(lat2), std::to_string(lon2), "0", "0", "0");
|
||||||
|
lonTmp = lon2;
|
||||||
|
counter ++;
|
||||||
|
}
|
||||||
|
double lat2, lon2;
|
||||||
|
|
||||||
|
geod.Direct(lat, lon, 0, distance, lat2, lon2);
|
||||||
|
|
||||||
|
lat = lat2;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SimControl::MainFunction_()
|
void SimControl::MainFunction_()
|
||||||
|
|||||||
Reference in New Issue
Block a user