ADD: made position Threadsafe, and made it possible to update the sensor position
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <loguru.hpp>
|
||||
#include <type_traits>
|
||||
|
||||
namespace SimCore {
|
||||
|
||||
@@ -54,7 +55,6 @@ namespace SimCore {
|
||||
|
||||
/**
|
||||
* @brief constructor for building a track which is also the trackmessage to send
|
||||
* @param uint32_t deviceID the id of the sending device
|
||||
* @param WHISPER::SourceType sourcetype of the sending device
|
||||
* @param SimCore::Identifier object identifier
|
||||
*
|
||||
@@ -62,6 +62,15 @@ namespace SimCore {
|
||||
*/
|
||||
Track( WHISPER::SourceType src,SimCore::Identifier id);
|
||||
|
||||
/**
|
||||
* @brief constructor for building a track which is also the trackmessage to send
|
||||
* @param WHISPER::SourceType sourcetype of the sending device
|
||||
* @param SimCore::Identifier object identifier
|
||||
* @param WHISPER::MsgType other message type than RawTrack
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Track( WHISPER::SourceType src,SimCore::Identifier id, WHISPER::MsgType type);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "SimCore/SimCore.hpp"
|
||||
#include <Eigen/Core>
|
||||
#include <GeographicLib/Ellipsoid.hpp>
|
||||
#include <GeographicLib/Geocentric.hpp>
|
||||
@@ -7,6 +8,7 @@
|
||||
#include <GeographicLib/GeodesicLine.hpp>
|
||||
#include <GeographicLib/Constants.hpp>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
namespace SimCore {
|
||||
class Position {
|
||||
@@ -14,6 +16,8 @@ namespace SimCore {
|
||||
Position();
|
||||
Position(double X, double Y, double Z);
|
||||
|
||||
Position(const Position& other);
|
||||
|
||||
/**
|
||||
* @brief returns a eigen vector3d with the X, Y, Z coordinates
|
||||
* @return Eigen::Vector3d
|
||||
@@ -31,6 +35,9 @@ namespace SimCore {
|
||||
|
||||
bool operator== ( Position &lhs);
|
||||
|
||||
Position& operator=(const Position other);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
std::shared_ptr<GeographicLib::Geocentric> earth_ = nullptr;
|
||||
@@ -40,6 +47,8 @@ namespace SimCore {
|
||||
Eigen::Vector3d GeodesicPos_; // lat long height
|
||||
Eigen::Vector3d GeocentricPos_; ///x y z
|
||||
|
||||
mutable std::mutex mx;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -36,6 +36,8 @@ namespace SimCore {
|
||||
virtual void specificSensorCalculations() = 0;
|
||||
virtual void specificReloadCharacteristicts() = 0;
|
||||
|
||||
std::shared_ptr<Position> ownShipPosition_ = nullptr;
|
||||
|
||||
private:
|
||||
|
||||
SimCore::Identifier OwnID_;
|
||||
@@ -48,8 +50,8 @@ namespace SimCore {
|
||||
std::shared_ptr<WHISPER::InternalUDPService> GroundTruthUDPService_ = nullptr;
|
||||
std::shared_ptr<WHISPER::InternalUDPService> ParentUDPService_ = nullptr;
|
||||
|
||||
void receivingData();
|
||||
void sendingData();
|
||||
void groundThruthData();
|
||||
void parentData();
|
||||
|
||||
void SensorCalculations();
|
||||
void ReloadCharacteristicts();
|
||||
@@ -69,7 +71,6 @@ namespace SimCore {
|
||||
|
||||
std::thread sensorCalculationThread;
|
||||
|
||||
std::shared_ptr<Position> position_ = nullptr;
|
||||
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user