ADD: add the usage of the kubecontroller bus not with fully using the start of pods

This commit is contained in:
Henry Winkel
2023-08-08 17:14:26 +02:00
parent 7bc8001936
commit 6ad961fbed
6 changed files with 37 additions and 22 deletions

3
.gitmodules vendored
View File

@@ -10,3 +10,6 @@
[submodule "libs/nlohmannJSON"] [submodule "libs/nlohmannJSON"]
path = libs/nlohmannJSON path = libs/nlohmannJSON
url = https://github.com/nlohmann/json.git url = https://github.com/nlohmann/json.git
[submodule "libs/KubeControl"]
path = libs/KubeControl
url = ssh://git@dev-gitea.ftewa.ti.unibw-hamburg.de:12000/hwinkel/KubeControl.git

View File

@@ -10,6 +10,7 @@
#include "SimCore/Orientation.hpp" #include "SimCore/Orientation.hpp"
#include "SimCore/SafeMap.hpp" #include "SimCore/SafeMap.hpp"
#include "SimCore/SimCore.hpp" #include "SimCore/SimCore.hpp"
#include "kubecontrol/PodController.hpp"
#include <WHISPER/InternalUDPService.hpp> #include <WHISPER/InternalUDPService.hpp>
#include <WHISPER/InternalUDPSender.hpp> #include <WHISPER/InternalUDPSender.hpp>
@@ -111,6 +112,7 @@ namespace Entities {
void startSensor(); void startSensor();
std::unique_ptr<kubecontrol::PodController> PodController_;
std::shared_ptr<std::list<Entities::SensorClientData>> SensorStore_; std::shared_ptr<std::list<Entities::SensorClientData>> SensorStore_;

1
libs/KubeControl Submodule

Submodule libs/KubeControl added at 96495f44ea

View File

@@ -2,11 +2,16 @@
#include "Entities/Movement.hpp" #include "Entities/Movement.hpp"
#include "Orders/MoveOrder.hpp" #include "Orders/MoveOrder.hpp"
#include "SimCore/Messages/SimTrack.hpp" #include "SimCore/Messages/SimTrack.hpp"
#include "SimCore/UtilFunctions.hpp"
#include "WHISPER/InternalUDPListener.hpp" #include "WHISPER/InternalUDPListener.hpp"
#include "WHISPER/InternalUDPSender.hpp" #include "WHISPER/InternalUDPSender.hpp"
#include "WHISPER/Messages/Message.hpp" #include "WHISPER/Messages/Message.hpp"
#include "WHISPER/Messages/stringData.hpp" #include "WHISPER/Messages/stringData.hpp"
#include "WHISPER/threadSafeQueue.hpp" #include "WHISPER/threadSafeQueue.hpp"
#include "crossguid/guid.hpp"
#include "kubecontrol/KubePod.hpp"
#include "kubecontrol/PodController.hpp"
#include "yaml-cpp/node/parse.h"
#include <SimCore/SimCore.hpp> #include <SimCore/SimCore.hpp>
#include <Entities/Entity.hpp> #include <Entities/Entity.hpp>
@@ -34,6 +39,7 @@ namespace Entities
EntityKind_(EntityKind) EntityKind_(EntityKind)
{ {
PodController_ = std::make_unique<kubecontrol::PodController>("libs/KubeControl/docs/config");
OwnShipTrack = std::make_shared<SimCore::SimTrack>(OwnID, OwnType, EntityKind); OwnShipTrack = std::make_shared<SimCore::SimTrack>(OwnID, OwnType, EntityKind);
OwnShipTrack->setPosition(SimCore::Position()); OwnShipTrack->setPosition(SimCore::Position());
@@ -116,8 +122,13 @@ namespace Entities
} }
void Entity::startMovementWorker() void Entity::startMovementWorker()
{ {
auto MovementPod = kubecontrol::KubePod("MovmentPod_"+EntityName_,xg::newGuid().str(),"movementimage:latest");
MovementPod.setEnvironmentVar("SERVER_IP", SimCore::UtilFunctions::getOwnIP());
// LOG_S(INFO)<< MovementPod.createYAML();
LOG_S(INFO)<<PodController_->getServerAddress();
LOG_S(INFO)<< "TODO: starting the movement app from here"; LOG_S(INFO)<< "TODO: starting the movement app from here";
if (MovemtServer_->countClients() > 0 ) if (MovemtServer_->countClients() > 0 )

View File

@@ -22,17 +22,17 @@ class Ship : public Entities::Entity
SimCore::Identifier ParentID, SimCore::Identifier ParentID,
SimCore::EntityKind EntityKind, SimCore::EntityKind EntityKind,
std::uint32_t GroundTruthPort, std::uint32_t GroundTruthPort,
std::uint32_t CommandPort, std::uint32_t CommandPort
std::string CommandIPAddress): ):
Entity( OwnID,EntityName,ownType, ParentID, EntityKind, GroundTruthPort, CommandPort, CommandIPAddress) Entity( OwnID,EntityName,ownType, ParentID, EntityKind, GroundTruthPort, CommandPort)
{ {
SimCore::Position pos1; SimCore::Position pos1;
pos1.setGeodesicPos(55, 6, 0); pos1.setGeodesicPos(55, 6, 0);
Movement_.setPosition(pos1); // Movement_.setPosition(pos1);
Movement_.setCourse(0); // Movement_.setCourse(0);
Movement_.setSpeed(100); // Movement_.setSpeed(100);
LOG_S(INFO)<<std::endl<<Movement_.getPosition().getGeodesicPos(); // LOG_S(INFO)<<std::endl<<Movement_.getPosition().getGeodesicPos();
} }
@@ -44,10 +44,10 @@ class Ship : public Entities::Entity
pos1.setGeodesicPos(55, 6, 0); pos1.setGeodesicPos(55, 6, 0);
LOG_S(INFO)<<std::endl<<Movement_.getPosition().getGeodesicPos(); // LOG_S(INFO)<<std::endl<<Movement_.getPosition().getGeodesicPos();
double distance, bearing1; // double distance, bearing1;
std::tie(distance, bearing1) = Movement_.getPosition().distanceBearingToPosition(pos1); // std::tie(distance, bearing1) = Movement_.getPosition().distanceBearingToPosition(pos1);
LOG_S(INFO)<<"distance from start is:" << distance; // LOG_S(INFO)<<"distance from start is:" << distance;
LOG_S(INFO)<<"calculating every " << duration << " milliseconds"; LOG_S(INFO)<<"calculating every " << duration << " milliseconds";
}; };
@@ -68,7 +68,7 @@ SCENARIO("Testing the SimCore Sensor")
{ {
SimCore::Identifier IDParent(0,1,false); SimCore::Identifier IDParent(0,1,false);
SimCore::Identifier ID1(0,2,false); SimCore::Identifier ID1(0,2,false);
Ship Ship(ID1,"FGS Hamburg",WHISPER::SourceType::SHIP,IDParent,SimCore::EntityKind::SURFACE,8000,8001,"127.0.0.1"); Ship Ship(ID1,"FGSHamburg",WHISPER::SourceType::ENTITY,IDParent,SimCore::EntityKind::SURFACE,8000,8001);
Ship.start(); Ship.start();
std::this_thread::sleep_for(std::chrono::milliseconds(10000)); std::this_thread::sleep_for(std::chrono::milliseconds(10000));
Ship.stop(); Ship.stop();

View File

@@ -22,7 +22,7 @@ SCENARIO("Testing the SimCore Sensor")
auto ID1 = IDMaker.getNewIdentifier(0, SimCore::ObjectSource::INTERNAL); auto ID1 = IDMaker.getNewIdentifier(0, SimCore::ObjectSource::INTERNAL);
auto ID2 = IDMaker.getNewIdentifier(1, SimCore::ObjectSource::INTERNAL); auto ID2 = IDMaker.getNewIdentifier(1, SimCore::ObjectSource::INTERNAL);
std::shared_ptr<Orders::MoveOrder> movOrd = std::make_shared<Orders::MoveOrder>(OrderID,*ID1.get(),*ID2.get(),WHISPER::SourceType::GATEWAY); std::shared_ptr<Orders::MoveOrder> movOrd = std::make_shared<Orders::MoveOrder>(*ID1.get(),WHISPER::SourceType::GATEWAY);
auto list = std::vector<std::shared_ptr<Orders::Order>>(); auto list = std::vector<std::shared_ptr<Orders::Order>>();
list.push_back(movOrd); list.push_back(movOrd);
@@ -42,24 +42,22 @@ SCENARIO("Testing the SimCore Sensor")
res = true; res = true;
} }
movOrd->setSpeed(100); movOrd->Speed.setValue(100);
movOrd->setStartTime(duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count()+3); movOrd->StartTime.setValue(duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count()+3);
THEN("check if Track attributes are correct") THEN("check if Track attributes are correct")
{ {
REQUIRE(movOrd->getOrderID() == OrderID); REQUIRE(movOrd->getOrderID() == OrderID);
REQUIRE(movOrd->getOrderingEntity() == *ID1.get());
REQUIRE(movOrd->getOrderedEntity() == *ID2.get());
REQUIRE(res == true); REQUIRE(res == true);
REQUIRE(movOrd->getSpeed() == 100); REQUIRE(movOrd->Speed.getValue() == 100);
REQUIRE(movOrd->getStartTime() > duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count()); REQUIRE(movOrd->StartTime.getValue() > duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count());
std::this_thread::sleep_for(std::chrono::seconds(5)); std::this_thread::sleep_for(std::chrono::seconds(5));
REQUIRE(movOrd->getStartTime() < duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count()); REQUIRE(movOrd->StartTime.getValue() < duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count());
REQUIRE(mvOrder2->getSpeed() == movOrd->getSpeed()); REQUIRE(mvOrder2->Speed.getValue() == movOrd->Speed.getValue());