From 0a182bb8dff4f3a9c7fc385d3eddb23b17992ce6 Mon Sep 17 00:00:00 2001 From: Henry Winkel Date: Wed, 27 Sep 2023 16:21:30 +0200 Subject: [PATCH] FIX: fixed bugs from changing simcore --- include/Entities/Entity.hpp | 10 ++++++++-- include/Entities/Tracklist/TracklistItem.hpp | 2 +- libs/KubeControl | 2 +- libs/SimCore | 2 +- src/Entities/Entity.cpp | 21 +++++++++++++++----- 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/include/Entities/Entity.hpp b/include/Entities/Entity.hpp index 1598c13..b163f46 100644 --- a/include/Entities/Entity.hpp +++ b/include/Entities/Entity.hpp @@ -53,7 +53,9 @@ namespace Entities { Entity(const SimCore::Identifier OwnID, std::string EnttityName, WHISPER::SourceType OwnType, - SimCore::EntityKind EntityKind, + SimCore::Kind::EntityKind EntityKind, + SimCore::Side::EntitySide EntitySide, + std::string GroundTruthAddr, std::uint32_t GroundTruthPort, ushort CommandPort, bool online); @@ -78,12 +80,16 @@ namespace Entities { std::shared_ptr OwnShipTrack = nullptr; std::string EntityName_; - SimCore::EntityKind EntityKind_; + SimCore::Kind::EntityKind EntityKind_; + SimCore::Side::EntitySide EntitySide_; + ushort MovemntWorkerPort_; std::unique_ptr PodController_; + std::shared_ptr BroadcastServer_; + diff --git a/include/Entities/Tracklist/TracklistItem.hpp b/include/Entities/Tracklist/TracklistItem.hpp index 7ed277f..415763d 100644 --- a/include/Entities/Tracklist/TracklistItem.hpp +++ b/include/Entities/Tracklist/TracklistItem.hpp @@ -83,7 +83,7 @@ namespace TrackList { ///range in meters double range_; //environment (AIR,SURFACE,SUBSURFACE,SPACE) - SimCore::EntityKind environemnt_; + SimCore::Kind::EntityKind kind_; std::chrono::time_point lastUpdateTimestamp_; diff --git a/libs/KubeControl b/libs/KubeControl index 89465f0..49b3605 160000 --- a/libs/KubeControl +++ b/libs/KubeControl @@ -1 +1 @@ -Subproject commit 89465f06a5fa421fc4c424426704fc65680c4afa +Subproject commit 49b36053d7dc6f08c05d10d80928597367788046 diff --git a/libs/SimCore b/libs/SimCore index a390f73..c8061ca 160000 --- a/libs/SimCore +++ b/libs/SimCore @@ -1 +1 @@ -Subproject commit a390f733342885ec18b913f84db9fa7ffba853c4 +Subproject commit c8061ca068b597b09d1b1886afe4cb56393e697d diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 69e08d2..8de683b 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -38,17 +38,20 @@ namespace Entities Entity::Entity(const SimCore::Identifier OwnID, std::string EnttityName, WHISPER::SourceType OwnType, - SimCore::EntityKind EntityKind, + SimCore::Kind::EntityKind EntityKind, + SimCore::Side::EntitySide EntitySide, + std::string GroundTruthAddr, std::uint32_t GroundTruthPort, ushort CommandPort, bool online): EntityName_(EnttityName), EntityKind_(EntityKind), + EntitySide_(EntitySide), online_(online) { PodController_ = std::make_unique("docs/config"); - OwnShipTrack = std::make_shared(OwnID, EnttityName, EntityKind); + OwnShipTrack = std::make_shared(OwnID, EnttityName, EntityKind,EntitySide); OwnShipTrack->setPosition(SimCore::Position()); MovemtServer_ = std::make_shared(__MOVEMENT_SERVER_PORT__); @@ -56,6 +59,11 @@ namespace Entities CommandCommsServer_ = std::make_shared(CommandPort); CommandCommsServer_->registerMessageCallback(std::bind(&Entity::handleExternalComms,this,std::placeholders::_1)); + + BroadcastServer_ = std::make_shared(GroundTruthAddr, GroundTruthPort); + // BroadcastServer_ = std::make_shared("239.0.0.1", 10000); + + } @@ -130,6 +138,8 @@ namespace Entities MovemtServer_.reset(); stopMainLoop = true; + + BroadcastServer_.reset(); @@ -155,7 +165,8 @@ namespace Entities LOG_S(INFO)<<"__ONLINE__"; MovementPodUUID_ = xg::newGuid().str(); LOG_S(INFO)<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.setComponent("MovementCalculation"); LOG_S(INFO)<< MovementPod.createYAML(); @@ -203,7 +214,7 @@ namespace Entities MovementWorkerStarted = false; 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(); childWorker(); - std::this_thread::sleep_for(std::chrono::milliseconds(500)); + std::this_thread::sleep_for(std::chrono::milliseconds(33)); }