ADD: added use of raw tracklist update
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "SimCore/Identifier.hpp"
|
#include "SimCore/Identifier.hpp"
|
||||||
|
#include "SimCore/Messages/SensorTracklistItem.hpp"
|
||||||
#include "SimCore/SimCore.hpp"
|
#include "SimCore/SimCore.hpp"
|
||||||
#include <SimCore/Messages/SimTrack.hpp>
|
#include <SimCore/Messages/SimTrack.hpp>
|
||||||
#include <kubecontrol/KubePod.hpp>
|
#include <kubecontrol/KubePod.hpp>
|
||||||
@@ -20,6 +21,7 @@ namespace Sensor
|
|||||||
SensorControl(SimCore::Identifier ID, std::string Name, std::string IP, SimCore::SensorKinds sensorKind);
|
SensorControl(SimCore::Identifier ID, std::string Name, std::string IP, SimCore::SensorKinds sensorKind);
|
||||||
|
|
||||||
|
|
||||||
|
SimCore::SensorTracklistItem getSensorTracklistItem();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "Entities/SensorControl.hpp"
|
#include "Entities/SensorControl.hpp"
|
||||||
#include "Entities/Tracklist/Trackfusion.hpp"
|
#include "Entities/Tracklist/Trackfusion.hpp"
|
||||||
#include "SimCore/Identifier.hpp"
|
#include "SimCore/Identifier.hpp"
|
||||||
|
#include "SimCore/Messages/SensorTracklistUpdate.hpp"
|
||||||
#include "SimCore/Messages/SimTrack.hpp"
|
#include "SimCore/Messages/SimTrack.hpp"
|
||||||
#include "SimCore/Messages/TracklistUpdate.hpp"
|
#include "SimCore/Messages/TracklistUpdate.hpp"
|
||||||
#include "SimCore/SimCore.hpp"
|
#include "SimCore/SimCore.hpp"
|
||||||
@@ -117,7 +118,17 @@ namespace Entities
|
|||||||
*
|
*
|
||||||
* @return std::unique_ptr<SimCore::TracklistUpdate>
|
* @return std::unique_ptr<SimCore::TracklistUpdate>
|
||||||
*/
|
*/
|
||||||
std::unique_ptr<SimCore::TracklistUpdate> getTrackListUpdate();
|
std::unique_ptr<SimCore::TracklistUpdate> getTrackListUpdateFusioned();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the Track List Update Raw
|
||||||
|
*
|
||||||
|
* in this list every sensor has its own tracks without a sensorfusion over all sensors
|
||||||
|
*
|
||||||
|
* @return std::unique_ptr<SimCore::SensorTracklistUpdate>
|
||||||
|
*/
|
||||||
|
std::unique_ptr<SimCore::SensorTracklistUpdate> getTrackListUpdateRaw();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief send the ownShipTrack to all connected Sensors
|
* @brief send the ownShipTrack to all connected Sensors
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "SimCore/Identifier.hpp"
|
#include "SimCore/Identifier.hpp"
|
||||||
#include "SimCore/IdentifierMaker.hpp"
|
#include "SimCore/IdentifierMaker.hpp"
|
||||||
|
#include "SimCore/Messages/SensorTrack.hpp"
|
||||||
#include "SimCore/Messages/SimTrack.hpp"
|
#include "SimCore/Messages/SimTrack.hpp"
|
||||||
#include "nlohmann/json.hpp"
|
#include "nlohmann/json.hpp"
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
@@ -24,21 +25,22 @@ namespace TrackList
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TrackList();
|
TrackList();
|
||||||
void addTrack(std::shared_ptr<SimCore::SimTrack> Track);
|
void addTrack(std::shared_ptr<SimCore::SensorTrack> Track);
|
||||||
std::shared_ptr<SimCore::SimTrack> getTrack(SimCore::Identifier);
|
std::shared_ptr<SimCore::SensorTrack> getTrack(SimCore::Identifier);
|
||||||
|
|
||||||
void deleteTrack(std::string ID);
|
void deleteTrack(std::string ID);
|
||||||
void deleteTrack(SimCore::Identifier);
|
void deleteTrack(SimCore::Identifier);
|
||||||
std::shared_ptr<SimCore::SimTrack> getTrackBySringID(std::string ID);
|
std::shared_ptr<SimCore::SensorTrack> getTrackBySringID(std::string ID);
|
||||||
|
|
||||||
size_t getSize();
|
size_t getSize();
|
||||||
|
|
||||||
void getJsonTRackList(nlohmann::json &message);
|
void getJsonTRackList(nlohmann::json &message);
|
||||||
|
std::map<std::string, std::shared_ptr<SimCore::SensorTrack>> getTrackStore();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable std::mutex mx_;
|
mutable std::mutex mx_;
|
||||||
std::map<std::string, std::shared_ptr<SimCore::SimTrack>> TrackStore_;
|
std::map<std::string, std::shared_ptr<SimCore::SensorTrack>> TrackStore_;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Submodule libs/OrderLibrary updated: c3335db37b...20c1465b53
@@ -303,8 +303,15 @@ namespace Entities
|
|||||||
}
|
}
|
||||||
if (TrackListRequest->EntityID == OwnShipTrack->getIdentifier())
|
if (TrackListRequest->EntityID == OwnShipTrack->getIdentifier())
|
||||||
{
|
{
|
||||||
|
if (TrackListRequest->requestedFusioned() == true)
|
||||||
|
{
|
||||||
std::string senderUUID = whisperMsg.senderUUID_;
|
std::string senderUUID = whisperMsg.senderUUID_;
|
||||||
CommandCommsServer_->sendMessage(SensorManager_->getTrackListUpdate()->buildMessage(),senderUUID);
|
CommandCommsServer_->sendMessage(SensorManager_->getTrackListUpdateFusioned()->buildMessage(),senderUUID);
|
||||||
|
}else {
|
||||||
|
std::string senderUUID = whisperMsg.senderUUID_;
|
||||||
|
CommandCommsServer_->sendMessage(SensorManager_->getTrackListUpdateRaw()->buildMessage(),senderUUID);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include <SimCore/Messages/SensorData.hpp>
|
#include <SimCore/Messages/SensorData.hpp>
|
||||||
#include "Entities/Tracklist/Tracklist.hpp"
|
#include "Entities/Tracklist/Tracklist.hpp"
|
||||||
#include "SimCore/Identifier.hpp"
|
#include "SimCore/Identifier.hpp"
|
||||||
|
#include "SimCore/Messages/SensorTracklistItem.hpp"
|
||||||
#include "nlohmann/json_fwd.hpp"
|
#include "nlohmann/json_fwd.hpp"
|
||||||
#include <Entities/SensorControl.hpp>
|
#include <Entities/SensorControl.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@@ -19,6 +20,22 @@ namespace Sensor
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SimCore::SensorTracklistItem SensorControl::getSensorTracklistItem()
|
||||||
|
{
|
||||||
|
auto data = std::make_shared<SimCore::SensorData>(this->getID(),this->getName(),this->getIP(),this->getSensorKind());
|
||||||
|
SimCore::SensorTracklistItem item(data);
|
||||||
|
|
||||||
|
for(auto [key, track]: TrackStore.getTrackStore())
|
||||||
|
{
|
||||||
|
item.updateTrack(track);
|
||||||
|
}
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -246,12 +246,28 @@ namespace Entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::unique_ptr<SimCore::TracklistUpdate> SensorManager::getTrackListUpdate()
|
std::unique_ptr<SimCore::TracklistUpdate> SensorManager::getTrackListUpdateFusioned()
|
||||||
{
|
{
|
||||||
|
|
||||||
return std::move(Trackfusion_.getTrackListUpdate(OwnId_));
|
return std::move(Trackfusion_.getTrackListUpdate(OwnId_));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<SimCore::SensorTracklistUpdate> SensorManager::getTrackListUpdateRaw()
|
||||||
|
{
|
||||||
|
|
||||||
|
auto Update = std::make_unique<SimCore::SensorTracklistUpdate>(OwnId_);
|
||||||
|
|
||||||
|
for(auto [key,item]: SensorStore)
|
||||||
|
{
|
||||||
|
Update->addTrack(item->getSensorTracklistItem());
|
||||||
|
}
|
||||||
|
|
||||||
|
return Update;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SensorManager::sendOwnShipTrackToSensors()
|
void SensorManager::sendOwnShipTrackToSensors()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include <Entities/Tracklist/Tracklist.hpp>
|
#include <Entities/Tracklist/Tracklist.hpp>
|
||||||
|
#include "SimCore/Messages/SensorTrack.hpp"
|
||||||
#include "SimCore/Messages/SimTrack.hpp"
|
#include "SimCore/Messages/SimTrack.hpp"
|
||||||
|
|
||||||
|
|
||||||
@@ -9,10 +10,10 @@ namespace TrackList
|
|||||||
TrackList::TrackList()
|
TrackList::TrackList()
|
||||||
{
|
{
|
||||||
|
|
||||||
TrackStore_ = std::map<std::string, std::shared_ptr<SimCore::SimTrack>>();
|
TrackStore_ = std::map<std::string, std::shared_ptr<SimCore::SensorTrack>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackList::addTrack(std::shared_ptr<SimCore::SimTrack> Track)
|
void TrackList::addTrack(std::shared_ptr<SimCore::SensorTrack> Track)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mx_);
|
std::lock_guard<std::mutex> lock(mx_);
|
||||||
|
|
||||||
@@ -22,7 +23,7 @@ namespace TrackList
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
std::shared_ptr<SimCore::SimTrack> TrackList::getTrack(const SimCore::Identifier ID)
|
std::shared_ptr<SimCore::SensorTrack> TrackList::getTrack(const SimCore::Identifier ID)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mx_);
|
std::lock_guard<std::mutex> lock(mx_);
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ namespace TrackList
|
|||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SimCore::SimTrack> TrackList::getTrackBySringID(std::string ID)
|
std::shared_ptr<SimCore::SensorTrack> TrackList::getTrackBySringID(std::string ID)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mx_);
|
std::lock_guard<std::mutex> lock(mx_);
|
||||||
|
|
||||||
@@ -52,12 +53,17 @@ namespace TrackList
|
|||||||
TrackStore_.erase(it);
|
TrackStore_.erase(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::map<std::string, std::shared_ptr<SimCore::SensorTrack>> TrackList::getTrackStore()
|
||||||
|
{
|
||||||
|
return TrackStore_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void TrackList::getJsonTRackList(nlohmann::json &message)
|
void TrackList::getJsonTRackList(nlohmann::json &message)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mx_);
|
std::lock_guard<std::mutex> lock(mx_);
|
||||||
try {
|
try {
|
||||||
for (std::map<std::string, std::shared_ptr<SimCore::SimTrack>>::iterator it=TrackStore_.begin(); it!=TrackStore_.end(); ++it)
|
for (std::map<std::string, std::shared_ptr<SimCore::SensorTrack>>::iterator it=TrackStore_.begin(); it!=TrackStore_.end(); ++it)
|
||||||
{
|
{
|
||||||
nlohmann::json j;
|
nlohmann::json j;
|
||||||
j["id"] = it->first;
|
j["id"] = it->first;
|
||||||
|
|||||||
Reference in New Issue
Block a user