ADD: added orientation

This commit is contained in:
Henry Winkel
2023-03-18 19:36:53 +01:00
parent 9fe27e254d
commit 324f4adb6a
6 changed files with 31 additions and 14 deletions

3
.gitmodules vendored
View File

@@ -4,3 +4,6 @@
[submodule "libs/json"]
path = libs/json
url = https://github.com/nlohmann/json.git
[submodule "libs/whisper-com"]
path = libs/SimCore/libs/whisper-com
url = ssh://git@dev-gitea.ftewa.ti.unibw-hamburg.de:12000/hwinkel/whisper-com.git

View File

@@ -4,6 +4,7 @@
#include "SimCore/Messages/GroundThruthTrack.hpp"
#include "SimCore/Messages/Track.hpp"
#include "SimCore/Orientation.hpp"
#include "SimCore/SafeMap.hpp"
#include "SimCore/SimCore.hpp"
@@ -53,7 +54,8 @@ namespace Entities {
std::uint32_t GroundTruthPort,
std::uint32_t CommandPort,
std::string CommandIPAddress);
// ~Entity();
~Entity();
void start();
void stop();
@@ -67,6 +69,8 @@ namespace Entities {
virtual void specificReloadCharacteristicts() = 0;
std::shared_ptr<SimCore::Position> ownShipPosition_ = nullptr;
std::shared_ptr<SimCore::Orientation> ownShipOrientation_ = nullptr;
private:

View File

@@ -25,7 +25,8 @@ namespace Entities
SimCore::EntityKind EntityKind,
std::uint32_t GroundTruthPort,
std::uint32_t CommandPort,
std::string CommandIPAddress):EntityName_(EnttityName),
std::string CommandIPAddress):
EntityName_(EnttityName),
ownTrack_(OwnType, OwnID, SimCore::TrackKind::GROUND_TRUTH_TRACK),
ParentID_(ParentID),
EntityKind_(EntityKind),
@@ -37,6 +38,12 @@ namespace Entities
}
Entity::~Entity()
{
stop();
}
void Entity::start()
{
@@ -68,21 +75,19 @@ namespace Entities
// }
for (std::vector<std::thread>::iterator it = threads.begin(); it != threads.end();)
{
if (it->joinable())
for (std::vector<std::thread>::iterator it = threads.begin(); it != threads.end();)
{
it->join();
it = threads.erase(it);
if (it->joinable())
{
it->join();
it = threads.erase(it);
}
}
}
LOG_S(ERROR)<< threads.size();
}
void Entity::physicsWorker()

View File

@@ -1,5 +1,7 @@
#include "SimCore/Identifier.hpp"
#include "SimCore/Orientation.hpp"
#include "SimCore/Position.hpp"
#include "WHISPER/Messages/Message.hpp"
#include <SimCore/SimCore.hpp>
#include <memory>
@@ -23,13 +25,16 @@ class Ship : public Entities::Entity
std::string CommandIPAddress):
Entity( OwnID,EntityName,ownType, ParentID, EntityKind, GroundTruthPort, CommandPort, CommandIPAddress)
{
this->ownShipPosition_ = std::make_shared<SimCore::Position>();
this->ownShipOrientation_ = std::make_shared<SimCore::Orientation>();
}
private:
void specificPhysicsCalculations(std::chrono::milliseconds::rep duration) override
{
LOG_S(INFO)<<"calculating every " << duration << "milliseconds";
};