ADD: added prototype of sensormanager

This commit is contained in:
Henry Winkel
2024-02-12 18:43:53 +01:00
parent fc7fe2193b
commit cfe2aff5ce
11 changed files with 396 additions and 14 deletions

View File

@@ -4,6 +4,7 @@
#include "DirectCommunicationServer.hpp"
#include "Entities/Movement.hpp"
#include "Entities/SensorManager.hpp"
#include "SimCore/Messages/SimTrack.hpp"
#include "SimCore/Orientation.hpp"
#include "SimCore/SafeMap.hpp"
@@ -59,6 +60,7 @@ namespace Entities {
std::string GroundTruthAddr,
std::uint32_t GroundTruthPort,
ushort CommandPort,
ushort SensorPort,
bool online);
~Entity();
@@ -89,11 +91,12 @@ namespace Entities {
SimCore::Side::EntitySide EntitySide_;
double RCS_;
ushort MovemntWorkerPort_;
ushort SensorPort_;
std::unique_ptr<kubecontrol::PodController> PodController_;
std::shared_ptr<kubecontrol::PodController> PodController_;
std::unique_ptr<SensorManager> SensorManager_;
std::shared_ptr<WHISPER::InternalUDPSender> BroadcastServer_;
@@ -105,6 +108,7 @@ namespace Entities {
private:
bool online_;
std::vector<std::thread> threads;
std::atomic<bool> stopMainLoop = false;

View File

@@ -20,6 +20,9 @@
namespace Entities {
/**
*@brief this class represents a template class example for senor Applications like Radar, Sonar, eg.
*/
class Sensor {
public:
Sensor(

View File

@@ -0,0 +1,72 @@
#pragma once
#include "SimCore/SimCore.hpp"
#include <SimCore/Messages/SimTrack.hpp>
#include <kubecontrol/KubePod.hpp>
#include <Entities/Tracklist/Tracklist.hpp>
#include <loguru.hpp>
#include <memory>
#include <string>
#include <vector>
namespace Entities
{
class SensorControl
{
public:
SensorControl(std::string ID, std::string Name, std::string IP, SimCore::SensorKinds sensorKind);
/**
* @brief Get the Name of the Sensor
*
* @return std::string
*/
std::string getName();
/**
* @brief Get the UUID of the Sensor
*
* @return std::string
*/
std::string getID();
/**
* @brief Get the Sensor Kind
*
* @return SimCore::SensorKinds
*/
SimCore::SensorKinds getSensorKind();
/**
* @brief Get the Sensor Status
*
* @return SimCore::Status
*/
SimCore::Status getSensorStatus();
/**
* @brief updates the sensor status
*
* @param SimCore::Status
*/
void updateStatus(SimCore::Status status);
std::unique_ptr<TrackList::TrackList> TrackStore;
private:
const std::string ID_;
std::string Name_;
std::string IP_;
SimCore::SensorKinds SensorKind_;
SimCore::Status SensorSatus_;
};
}

View File

@@ -0,0 +1,79 @@
#pragma once
#include "DirectCommunicationServer.hpp"
#include "Entities/SensorControl.hpp"
#include "SimCore/Identifier.hpp"
#include "SimCore/Messages/SimTrack.hpp"
#include "SimCore/SimCore.hpp"
#include "kubecontrol/PodController.hpp"
#include <loguru.hpp>
#include <map>
#include <memory>
#include <string>
#include <sys/types.h>
namespace Entities
{
class SensorManager
{
public:
SensorManager(SimCore::Identifier OwnID,std::shared_ptr<kubecontrol::PodController> PodController, ushort sensorPort = 5557);
/**
*@brief starts a Sensor based on a KubePod Object
*@param KubePod - a KubePod Item ready to start
*@param SensorKind - numeric value of the SensorKind from SimCore
*/
void startSensor(std::shared_ptr<kubecontrol::KubePod> pod, SimCore::SensorKinds SensorKind);
/**
*@brief stops a Sensor based on a uuid ( the sensors just stops to operate)
*@param string uuid sensor
*/
void stopSenser(std::string uuid);
/**
*@brief deletes a sensor pod based on the uuid
*@param string uuid sensor
*/
void deleteSensor(std::string uuid);
/**
*@brief get the Tracklist as JSON formatted string where you can see the tracks every sensor detects
*@return string - JSON formatted string
*/
std::string getTracklistStringBySensor();
/**
*@brief get the Tracklist as JSON formatted string where the tracks are fusiond with a list for each track which sensor has detected that track
*@return string - JSON formatted string
*/
std::string getTracklistStringFusioned();
/**
*@brief Updates the Tracklist for the Specific Sensor
*@param string uuid for the Sensor
*@param SimTrack updated Track
*/
void updateTracklistForSensor(std::string uuidSensor, std::shared_ptr<SimCore::SimTrack> track);
private:
const SimCore::Identifier OwnId_;
ushort SensorPort_ = 5557;
std::map<std::string, std::unique_ptr<Entities::SensorControl>> SensorStore;
std::shared_ptr<kubecontrol::PodController> PodController_;
std::shared_ptr<DirectCommunication::DirectCommunicationServer> SensorServer_ = nullptr;
void handlSensorMessages(std::string Message);
};
}