ADD: added new version of entity base class

This commit is contained in:
Henry Winkel
2023-07-05 17:58:59 +02:00
parent bbbd5b96df
commit 64f37e59f5
3 changed files with 103 additions and 153 deletions

View File

@@ -2,8 +2,10 @@
#include "DirectCommunicationServer.hpp"
#include "Entities/Movement.hpp"
#include "SimCore/Messages/GroundThruthTrack.hpp"
#include "SimCore/Messages/SimTrack.hpp"
#include "SimCore/Messages/Track.hpp"
#include "SimCore/Orientation.hpp"
#include "SimCore/SafeMap.hpp"
@@ -53,62 +55,61 @@ namespace Entities {
SimCore::Identifier ParentID,
SimCore::EntityKind EntityKind,
std::uint32_t GroundTruthPort,
std::uint32_t CommandPort,
std::string CommandIPAddress);
ushort CommandPort);
~Entity();
void start();
void stop();
void setPosition(SimCore::Position);
void setSpeed(double speed);
void setCourse(double course);
void setPitch( double pitch);
protected:
std::shared_ptr<WHISPER::threadSafeQueue<WHISPER::Message>> incommingCommandMessages = nullptr;
std::shared_ptr<WHISPER::threadSafeQueue<WHISPER::Message>> outgoingCommandMessages = nullptr;
virtual void specificPhysicsCalculations(std::chrono::milliseconds::rep duration) = 0;
virtual void specificReloadCharacteristicts() = 0;
std::unique_ptr<Entities::Movement> Movement_ = nullptr;
protected:
std::shared_ptr<SimCore::SimTrack> OwnShipTrack = nullptr;
std::string EntityName_;
SimCore::GroundTruthTrack ownTrack_;
SimCore::Identifier ParentID_;
SimCore::EntityKind EntityKind_;
std::uint32_t GroundTruthPort_;
std::uint32_t CommandPort_;
std::string CommandIPAddress_;
ushort MovemntWorkerPort_;
private:
std::vector<std::thread> threads;
std::atomic<bool> stopMainLoop = false;
void MainLoop();
void startMovementWorker();
std::atomic<bool> MovementWorkerStarted = false;
std::shared_ptr<DirectCommunication::DirectCommunicationServer> MovemtServer_ = nullptr;
std::atomic<bool> stopCommandWorker = false;
std::atomic<bool> stopSensorWorker = false;
std::atomic<bool> stopTrackWorker = false;
std::atomic<bool> stopPhysicsWorker = false;
std::atomic<bool> physicsIsRunning = false;
void CommandWorker();
void SensorWorker();
void TrackWorker();
void physicsWorker();
void startSensor();
std::shared_ptr<WHISPER::InternalUDPSender> GroundTruthUDPSender_ = nullptr;
std::shared_ptr<std::list<Entities::SensorClientData>> SensorStore_;