ADD: added Sensor virtual PArent class
This commit is contained in:
76
include/SimCore/Sensor.hpp
Normal file
76
include/SimCore/Sensor.hpp
Normal file
@@ -0,0 +1,76 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
|
||||
#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 SimCore {
|
||||
|
||||
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<SimCore::Track>> 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;
|
||||
|
||||
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 receivingData();
|
||||
void sendingData();
|
||||
|
||||
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;
|
||||
|
||||
std::shared_ptr<Position> position_ = nullptr;
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
@@ -37,4 +37,12 @@ enum ContactEnvironment : std::uint8_t{
|
||||
};
|
||||
|
||||
|
||||
enum SensorKinds : std::uint32_t {
|
||||
RADAR = 1,
|
||||
ELOKA,
|
||||
SONAR,
|
||||
VISUAL
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <netdb.h>
|
||||
|
||||
|
||||
|
||||
@@ -12,9 +13,13 @@ namespace SimCore {
|
||||
{
|
||||
public:
|
||||
static std::vector<std::string> explode(std::string const & s, char delim);
|
||||
static std::string implode(const std::vector<std::string> &v , char delim);
|
||||
|
||||
static bool isNumber(const std::string& s);
|
||||
|
||||
static void check_host_name(int hostname);
|
||||
static void check_host_entry(struct hostent * hostentry);
|
||||
static void IP_formatter(char *IPbuffer);
|
||||
static std::string getOwnIP();
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user