ADD: added Json Library,
FIX: fixed issue with dealing with GroundThruthTracks to using sharedpointer
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -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
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
|
||||
namespace SimCore {
|
||||
namespace Entities {
|
||||
|
||||
class Sensor {
|
||||
public:
|
||||
@@ -25,7 +25,7 @@ namespace SimCore {
|
||||
void stop();
|
||||
|
||||
protected:
|
||||
std::shared_ptr<WHISPER::threadSafeQueue<SimCore::GroundTruthTrack>> incommingTrackMessages = nullptr;
|
||||
std::shared_ptr<WHISPER::threadSafeQueue<std::shared_ptr<SimCore::GroundTruthTrack>>> incommingTrackMessages = nullptr;
|
||||
|
||||
|
||||
std::shared_ptr<WHISPER::threadSafeQueue<WHISPER::Message>> incommingGroundThruthMessages = nullptr;
|
||||
@@ -37,7 +37,7 @@ namespace SimCore {
|
||||
virtual void specificSensorCalculations() = 0;
|
||||
virtual void specificReloadCharacteristicts() = 0;
|
||||
|
||||
std::shared_ptr<Position> ownShipPosition_ = nullptr;
|
||||
std::shared_ptr<SimCore::Position> ownShipPosition_ = nullptr;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
1
libs/json
Submodule
1
libs/json
Submodule
Submodule libs/json added at b2306145e1
@@ -4,10 +4,11 @@
|
||||
#include "SimCore/SimCore.hpp"
|
||||
#include "SimCore/UtilFunctions.hpp"
|
||||
#include "WHISPER/Messages/Message.hpp"
|
||||
#include <SimCore/Templates/Sensor.hpp>
|
||||
#include <Entities/Sensor.hpp>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
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<WHISPER::threadSafeQueue<WHISPER::Message>>();
|
||||
outgoingParentMessages = std::make_shared<WHISPER::threadSafeQueue<WHISPER::Message>>();
|
||||
|
||||
incommingTrackMessages = std::make_shared<WHISPER::threadSafeQueue<SimCore::GroundTruthTrack>>();
|
||||
incommingTrackMessages = std::make_shared<WHISPER::threadSafeQueue<std::shared_ptr<SimCore::GroundTruthTrack>>>();
|
||||
|
||||
|
||||
GroundTruthUDPService_ = std::make_shared<WHISPER::InternalUDPService>(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<SimCore::GroundTruthTrack>(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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user