diff --git a/.gitmodules b/.gitmodules index d37defb..25afe2d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "libs/SimCore"] path = libs/SimCore url = ssh://git@dev-gitea.ftewa.ti.unibw-hamburg.de:12000/hwinkel/SimCore.git +[submodule "libs/json"] + path = libs/json + url = https://github.com/nlohmann/json.git diff --git a/include/Entities/Sensor.hpp b/include/Entities/Sensor.hpp index 05dbb1a..c5c5287 100644 --- a/include/Entities/Sensor.hpp +++ b/include/Entities/Sensor.hpp @@ -15,7 +15,7 @@ #include #include -namespace SimCore { +namespace Entities { class Sensor { public: @@ -25,7 +25,7 @@ namespace SimCore { void stop(); protected: - std::shared_ptr> incommingTrackMessages = nullptr; + std::shared_ptr>> incommingTrackMessages = nullptr; std::shared_ptr> incommingGroundThruthMessages = nullptr; @@ -37,7 +37,7 @@ namespace SimCore { virtual void specificSensorCalculations() = 0; virtual void specificReloadCharacteristicts() = 0; - std::shared_ptr ownShipPosition_ = nullptr; + std::shared_ptr ownShipPosition_ = nullptr; private: diff --git a/libs/json b/libs/json new file mode 160000 index 0000000..b230614 --- /dev/null +++ b/libs/json @@ -0,0 +1 @@ +Subproject commit b2306145e1789368e6f261680e8dc007e91cc986 diff --git a/src/Entities/Sensor.cpp b/src/Entities/Sensor.cpp index ddf06b1..b8495f1 100644 --- a/src/Entities/Sensor.cpp +++ b/src/Entities/Sensor.cpp @@ -4,10 +4,11 @@ #include "SimCore/SimCore.hpp" #include "SimCore/UtilFunctions.hpp" #include "WHISPER/Messages/Message.hpp" -#include +#include #include +#include -namespace SimCore { +namespace Entities { Sensor::Sensor(SimCore::Identifier OwnID, SimCore::Identifier ParentID, SimCore::SensorKinds SensorKind,std::uint32_t GroundTruthPort, std::uint32_t ParentPort,std::string ParentIPAddress): OwnID_(OwnID),ParentID_(ParentID),SensorKind_(SensorKind),GroundTruthPort_(GroundTruthPort),ParentPort_(ParentPort),ParentIPAddress_(ParentIPAddress) @@ -23,7 +24,7 @@ namespace SimCore { incommingParentMessages = std::make_shared>(); outgoingParentMessages = std::make_shared>(); - incommingTrackMessages = std::make_shared>(); + incommingTrackMessages = std::make_shared>>(); GroundTruthUDPService_ = std::make_shared(OwnID.getParentNumber(),OwnID.getNumber(),WHISPER::SENSOR,GroundTruthPort_,SimCore::UtilFunctions::implode(ip,'.'),ownIP); @@ -121,9 +122,8 @@ namespace SimCore { WHISPER::Message msg; incommingGroundThruthMessages->get(msg); if (msg.msgType_ == WHISPER::MsgType::GROUND_TRUTH_TRACK) { - auto elem = GroundTruthTrack::unpack(msg); - // auto Track = SimCore::Track(msg.serialize()); - incommingTrackMessages->addElement(elem); + auto GTrack = std::make_shared(std::move(SimCore::GroundTruthTrack::unpack(msg))); + incommingTrackMessages->addElement(GTrack); } } @@ -152,8 +152,10 @@ namespace SimCore { incommingParentMessages->get(msg); LOG_S(INFO)<< "Message received from Parent is" << msg.msgType_; std::uint32_t type = 0; - - if (msg.msgType_ == WHISPER::MsgType::OWN_TRACK) { + + switch (msg.msgType_) { + case WHISPER::MsgType::OWN_TRACK :{ + auto OwnTrack = SimCore::GroundTruthTrack::unpack(msg); // SimCore::Track OwnTrack(msg.serialize()); auto tmpPos = OwnTrack.getPostion().getGeocentricPos(); @@ -169,8 +171,22 @@ namespace SimCore { tmpPos[SimCore::GeocentricPosition::Y], tmpPos[SimCore::GeocentricPosition::Z]); } + + break; } - + case WHISPER::MsgType::COMMAND: { + + break; + } + default: { + + break; + } + } + + + + }