FIX: fixed bugs from changing simcore

This commit is contained in:
Henry Winkel
2023-09-27 16:21:30 +02:00
parent 4d06ca48b4
commit 0a182bb8df
5 changed files with 27 additions and 10 deletions

View File

@@ -53,7 +53,9 @@ namespace Entities {
Entity(const SimCore::Identifier OwnID, Entity(const SimCore::Identifier OwnID,
std::string EnttityName, std::string EnttityName,
WHISPER::SourceType OwnType, WHISPER::SourceType OwnType,
SimCore::EntityKind EntityKind, SimCore::Kind::EntityKind EntityKind,
SimCore::Side::EntitySide EntitySide,
std::string GroundTruthAddr,
std::uint32_t GroundTruthPort, std::uint32_t GroundTruthPort,
ushort CommandPort, ushort CommandPort,
bool online); bool online);
@@ -78,12 +80,16 @@ namespace Entities {
std::shared_ptr<SimCore::SimTrack> OwnShipTrack = nullptr; std::shared_ptr<SimCore::SimTrack> OwnShipTrack = nullptr;
std::string EntityName_; std::string EntityName_;
SimCore::EntityKind EntityKind_; SimCore::Kind::EntityKind EntityKind_;
SimCore::Side::EntitySide EntitySide_;
ushort MovemntWorkerPort_; ushort MovemntWorkerPort_;
std::unique_ptr<kubecontrol::PodController> PodController_; std::unique_ptr<kubecontrol::PodController> PodController_;
std::shared_ptr<WHISPER::InternalUDPSender> BroadcastServer_;

View File

@@ -83,7 +83,7 @@ namespace TrackList {
///range in meters ///range in meters
double range_; double range_;
//environment (AIR,SURFACE,SUBSURFACE,SPACE) //environment (AIR,SURFACE,SUBSURFACE,SPACE)
SimCore::EntityKind environemnt_; SimCore::Kind::EntityKind kind_;
std::chrono::time_point<std::chrono::steady_clock> lastUpdateTimestamp_; std::chrono::time_point<std::chrono::steady_clock> lastUpdateTimestamp_;

View File

@@ -38,17 +38,20 @@ namespace Entities
Entity::Entity(const SimCore::Identifier OwnID, Entity::Entity(const SimCore::Identifier OwnID,
std::string EnttityName, std::string EnttityName,
WHISPER::SourceType OwnType, WHISPER::SourceType OwnType,
SimCore::EntityKind EntityKind, SimCore::Kind::EntityKind EntityKind,
SimCore::Side::EntitySide EntitySide,
std::string GroundTruthAddr,
std::uint32_t GroundTruthPort, std::uint32_t GroundTruthPort,
ushort CommandPort, ushort CommandPort,
bool online): bool online):
EntityName_(EnttityName), EntityName_(EnttityName),
EntityKind_(EntityKind), EntityKind_(EntityKind),
EntitySide_(EntitySide),
online_(online) online_(online)
{ {
PodController_ = std::make_unique<kubecontrol::PodController>("docs/config"); PodController_ = std::make_unique<kubecontrol::PodController>("docs/config");
OwnShipTrack = std::make_shared<SimCore::SimTrack>(OwnID, EnttityName, EntityKind); OwnShipTrack = std::make_shared<SimCore::SimTrack>(OwnID, EnttityName, EntityKind,EntitySide);
OwnShipTrack->setPosition(SimCore::Position()); OwnShipTrack->setPosition(SimCore::Position());
MovemtServer_ = std::make_shared<DirectCommunication::DirectCommunicationServer>(__MOVEMENT_SERVER_PORT__); MovemtServer_ = std::make_shared<DirectCommunication::DirectCommunicationServer>(__MOVEMENT_SERVER_PORT__);
@@ -56,6 +59,11 @@ namespace Entities
CommandCommsServer_ = std::make_shared<DirectCommunication::DirectCommunicationServer>(CommandPort); CommandCommsServer_ = std::make_shared<DirectCommunication::DirectCommunicationServer>(CommandPort);
CommandCommsServer_->registerMessageCallback(std::bind(&Entity::handleExternalComms,this,std::placeholders::_1)); CommandCommsServer_->registerMessageCallback(std::bind(&Entity::handleExternalComms,this,std::placeholders::_1));
BroadcastServer_ = std::make_shared<WHISPER::InternalUDPSender>(GroundTruthAddr, GroundTruthPort);
// BroadcastServer_ = std::make_shared<WHISPER::InternalUDPSender>("239.0.0.1", 10000);
} }
@@ -131,6 +139,8 @@ namespace Entities
stopMainLoop = true; stopMainLoop = true;
BroadcastServer_.reset();
for (std::vector<std::thread>::iterator it = threads.begin(); it != threads.end();) for (std::vector<std::thread>::iterator it = threads.begin(); it != threads.end();)
@@ -155,7 +165,8 @@ namespace Entities
LOG_S(INFO)<<"__ONLINE__"; LOG_S(INFO)<<"__ONLINE__";
MovementPodUUID_ = xg::newGuid().str(); MovementPodUUID_ = xg::newGuid().str();
LOG_S(INFO)<<this->OwnShipTrack->getIdentifier().getUUID(); LOG_S(INFO)<<this->OwnShipTrack->getIdentifier().getUUID();
auto MovementPod = kubecontrol::KubePod(this->OwnShipTrack->getIdentifier().getUUID(),MovementPodUUID_,"movementimage:latest"); kubecontrol::KubePod MovementPod(this->OwnShipTrack->getIdentifier().getUUID(),MovementPodUUID_,"movementimage:latest");
MovementPod.setEnvironmentVar("SERVER_IP", SimCore::UtilFunctions::getOwnIP()); MovementPod.setEnvironmentVar("SERVER_IP", SimCore::UtilFunctions::getOwnIP());
MovementPod.setComponent("MovementCalculation"); MovementPod.setComponent("MovementCalculation");
LOG_S(INFO)<< MovementPod.createYAML(); LOG_S(INFO)<< MovementPod.createYAML();
@@ -203,7 +214,7 @@ namespace Entities
MovementWorkerStarted = false; MovementWorkerStarted = false;
LOG_S(WARNING)<<"Movementclient lost"; LOG_S(WARNING)<<"Movementclient lost";
} }
std::this_thread::sleep_for(std::chrono::milliseconds(500)); // std::this_thread::sleep_for(std::chrono::milliseconds(500));
} }
@@ -286,7 +297,7 @@ namespace Entities
handleMovement(); handleMovement();
childWorker(); childWorker();
std::this_thread::sleep_for(std::chrono::milliseconds(500)); std::this_thread::sleep_for(std::chrono::milliseconds(33));
} }