86 lines
2.3 KiB
C++
86 lines
2.3 KiB
C++
#pragma once
|
|
|
|
#include "DirectCommunicationClient.hpp"
|
|
#include "SimCore/Messages/SensorData.hpp"
|
|
#include "SimCore/Messages/SensorTrack.hpp"
|
|
#include "SimCore/Messages/SimTrack.hpp"
|
|
#include "WHISPER/InternalUDPListener.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 <atomic>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <thread>
|
|
|
|
|
|
|
|
namespace Entities {
|
|
|
|
/**
|
|
*@brief this class represents a template class example for senor Applications like Radar, Sonar, eg.
|
|
*/
|
|
class Sensor {
|
|
public:
|
|
Sensor(
|
|
SimCore::Identifier OwnID,
|
|
SimCore::Identifier OwnShipID,
|
|
std::string Name,
|
|
SimCore::SensorKinds SensorKind,
|
|
std::string GroundTruthAddress,
|
|
std::uint32_t GroundTruthPort,
|
|
std::uint32_t ParentPort,
|
|
std::string ParentIPAddress);
|
|
|
|
void start();
|
|
void stop();
|
|
|
|
protected:
|
|
|
|
SimCore::SensorData OwnData;
|
|
|
|
|
|
virtual void specificSensorCalculations(std::unique_ptr<SimCore::SimTrack> track) = 0;
|
|
|
|
std::shared_ptr<SimCore::SimTrack> OwnShipTrack_ = nullptr;
|
|
|
|
const SimCore::Identifier OwnShipID;
|
|
|
|
|
|
|
|
std::shared_ptr<WHISPER::threadSafeQueue<std::shared_ptr<SimCore::SensorTrack>>> recognisedTracks_ = nullptr;
|
|
private:
|
|
|
|
std::uint32_t GroundTruthPort_;
|
|
std::string GroundTruthAddr_;
|
|
std::uint32_t ParentPort_;
|
|
std::string ParentIPAddress_;
|
|
|
|
std::unique_ptr<WHISPER::InternalUDPListener> GroundTruthUDPListener_;
|
|
|
|
std::unique_ptr<DirectCommunication::DirectCommunicationClient> client_;
|
|
|
|
|
|
std::thread UpdateOwnShipThread_;
|
|
|
|
std::atomic_bool stopOwnShipUpdater_ = false;
|
|
|
|
void handleGroundThruthMessage(std::string msg);
|
|
|
|
void updateOwnShipFunction();
|
|
|
|
|
|
void handlServerMessages(std::string msg);
|
|
|
|
void HandleOrders(WHISPER::Message WHmsg);
|
|
|
|
void setupOwnShip(std::shared_ptr<SimCore::SimTrack> ownShipTracK);
|
|
|
|
|
|
};
|
|
} |