78 lines
2.6 KiB
C++
78 lines
2.6 KiB
C++
#pragma once
|
|
|
|
|
|
|
|
#include "SimCore/Messages/GroundThruthTrack.hpp"
|
|
#include "SimCore/Messages/Track.hpp"
|
|
#include <WHISPER/InternalUDPService.hpp>
|
|
#include <SimCore/Identifier.hpp>
|
|
|
|
#include <WHISPER/threadSafeQueue.hpp>
|
|
#include <WHISPER/Messages/Message.hpp>
|
|
#include <SimCore/SimCore.hpp>
|
|
#include <SimCore/Identifier.hpp>
|
|
#include <SimCore/Position.hpp>
|
|
#include <memory>
|
|
#include <thread>
|
|
|
|
namespace Entities {
|
|
|
|
class Sensor {
|
|
public:
|
|
Sensor(SimCore::Identifier OwnID, SimCore::Identifier ParentID, SimCore::SensorKinds SensorKind,std::uint32_t GroundTruthPort, std::uint32_t ParentPort,std::string ParentIPAddress);
|
|
~Sensor();
|
|
void start();
|
|
void stop();
|
|
|
|
protected:
|
|
std::shared_ptr<WHISPER::threadSafeQueue<std::shared_ptr<SimCore::GroundTruthTrack>>> incommingTrackMessages = nullptr;
|
|
|
|
|
|
std::shared_ptr<WHISPER::threadSafeQueue<WHISPER::Message>> incommingGroundThruthMessages = nullptr;
|
|
std::shared_ptr<WHISPER::threadSafeQueue<WHISPER::Message>> outgoingGroundThruthMessages = nullptr;
|
|
|
|
std::shared_ptr<WHISPER::threadSafeQueue<WHISPER::Message>> incommingParentMessages = nullptr;
|
|
std::shared_ptr<WHISPER::threadSafeQueue<WHISPER::Message>> outgoingParentMessages = nullptr;
|
|
|
|
virtual void specificSensorCalculations() = 0;
|
|
virtual void specificReloadCharacteristicts() = 0;
|
|
|
|
std::shared_ptr<SimCore::Position> ownShipPosition_ = nullptr;
|
|
|
|
private:
|
|
|
|
SimCore::Identifier OwnID_;
|
|
SimCore::Identifier ParentID_;
|
|
SimCore::SensorKinds SensorKind_;
|
|
std::uint32_t GroundTruthPort_;
|
|
std::uint32_t ParentPort_;
|
|
std::string ParentIPAddress_;
|
|
|
|
std::shared_ptr<WHISPER::InternalUDPService> GroundTruthUDPService_ = nullptr;
|
|
std::shared_ptr<WHISPER::InternalUDPService> ParentUDPService_ = nullptr;
|
|
|
|
void groundThruthData();
|
|
void parentData();
|
|
|
|
void SensorCalculations();
|
|
void ReloadCharacteristicts();
|
|
|
|
std::atomic<bool> stopReceivingGroundThruth = false;
|
|
std::atomic<bool> ReceivingGroundThruthIsRunnung = false;
|
|
|
|
std::atomic<bool> stopsendCalculatedData = false;
|
|
std::atomic<bool> sendCalculatedDataIsRunnung = false;
|
|
|
|
std::atomic<bool> stopCalculationData = false;
|
|
std::atomic<bool> CalculationIsRunnung = false;
|
|
|
|
|
|
std::thread receiveGroundTruthThread;
|
|
std::thread sendCalculatedDataThread;
|
|
|
|
std::thread sensorCalculationThread;
|
|
|
|
|
|
|
|
};
|
|
} |