76 lines
2.5 KiB
C++
Executable File
76 lines
2.5 KiB
C++
Executable File
/**
|
|
* Simulation for Movement
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by gr, SLSE, 2017-12-13
|
|
*/
|
|
#pragma once
|
|
|
|
#include <CentralEffectSimulation/logger.h>
|
|
#include <CentralEffectSimulation/dds_handler.h>
|
|
#include <CentralEffectSimulation/handler_participant.h>
|
|
#include <CentralEffectSimulation/ces_db.h>
|
|
|
|
#include <QLineF>
|
|
#include <QObject>
|
|
#include <QTimer>
|
|
|
|
|
|
namespace CentralEffectSimulationBasic
|
|
{
|
|
|
|
class SimulationMovement : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
SimulationMovement(const std::shared_ptr<CentralEffectSimulation::DdsHandler> &ddsHandler,
|
|
const std::shared_ptr<CentralEffectSimulation::DatabaseInterface> &db,
|
|
const std::shared_ptr<CentralEffectSimulation::HandlerParticipant> &participantHandler,
|
|
const CentralEffectSimulation::SimulatedMovement &sml,
|
|
QObject *parent = nullptr);
|
|
|
|
~SimulationMovement();
|
|
void setSimulatedMovementRequest(const CentralEffectSimulation::SimulatedMovement &sml);
|
|
int id() const { return m_simMovement.id(); }
|
|
void setId(int id) { m_simMovement.id(id); }
|
|
int participantId() const { return m_simMovement.participantId(); }
|
|
|
|
void setJump(bool jump);
|
|
void setnextPoint(int nextPoint) { m_simMovement.nextPoint(nextPoint); }
|
|
int getNextPoint() const { return m_simMovement.nextPoint(); }
|
|
void publishSimulatedMovement();
|
|
const CentralEffectSimulation::SimulatedMovement &simMovementData() const { return m_simMovement; }
|
|
|
|
static CentralEffectSimulation::Database::CesSimulatedMovement toDb(const CentralEffectSimulation::SimulatedMovement &ddsSimMovement);
|
|
protected Q_SLOTS:
|
|
void publishNewPos();
|
|
void startNewSegment();
|
|
void move();
|
|
|
|
protected:
|
|
void updateNextPointInDb();
|
|
|
|
private:
|
|
std::shared_ptr<CentralEffectSimulation::DdsHandler> m_ddsHandler; ///< Pointer to VOM DDS handler
|
|
std::shared_ptr<CentralEffectSimulation::DatabaseInterface> m_db;
|
|
std::shared_ptr<CentralEffectSimulation::HandlerParticipant> m_handlerParticipant;
|
|
|
|
// Input Data
|
|
QVector<QPointF> m_points;
|
|
QVector<double> m_segSpeed;
|
|
QVector<int> m_segDelay;
|
|
// Dynamic Data
|
|
int m_moveTime; /// Time starts for each segment new
|
|
QLineF m_actSegment;
|
|
QPointF m_newPos;
|
|
bool m_simStart; /// Start of simulation
|
|
int m_zone;
|
|
QTimer *m_segTimer;
|
|
QTimer *m_moveTimer;
|
|
|
|
CentralEffectSimulation::SimulatedMovement m_simMovement;
|
|
CentralEffectSimulation::LOGGER_T &m_logger; ///< Interface to the Logging-Facility
|
|
};
|
|
}
|