2010-08-31 12:17:14 +02:00
|
|
|
#ifndef ISIMULATOR_H
|
|
|
|
#define ISIMULATOR_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QUdpSocket>
|
|
|
|
#include <QTimer>
|
|
|
|
#include <math.h>
|
|
|
|
#include "uavtalk/telemetrymanager.h"
|
2011-01-22 18:38:22 +01:00
|
|
|
#include "uavobjectmanager.h"
|
|
|
|
#include "actuatordesired.h"
|
|
|
|
#include "altitudeactual.h"
|
|
|
|
#include "attitudeactual.h"
|
|
|
|
#include "velocityactual.h"
|
|
|
|
#include "positionactual.h"
|
|
|
|
#include "gcstelemetrystats.h"
|
2010-08-31 12:17:14 +02:00
|
|
|
|
|
|
|
class Simulator: public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
//static ISimulator* Instance();
|
|
|
|
//protected:
|
|
|
|
Simulator();
|
|
|
|
~ISimulator();
|
|
|
|
|
|
|
|
bool isAutopilotConnected();
|
|
|
|
bool isFGConnected();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void myStart();
|
|
|
|
void autopilotConnected();
|
|
|
|
void autopilotDisconnected();
|
|
|
|
void fgConnected();
|
|
|
|
void fgDisconnected();
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onStart();
|
|
|
|
void transmitUpdate();
|
|
|
|
void receiveUpdate();
|
|
|
|
void onAutopilotConnect();
|
|
|
|
void onAutopilotDisconnect();
|
|
|
|
void onFGConnectionTimeout();
|
|
|
|
void telStatsUpdated(UAVObject* obj);
|
|
|
|
|
|
|
|
private:
|
|
|
|
//static ISimulator* _instance;
|
|
|
|
|
|
|
|
QUdpSocket* inSocket;
|
|
|
|
QUdpSocket* outSocket;
|
|
|
|
ActuatorDesired* actDesired;
|
|
|
|
AltitudeActual* altActual;
|
2010-10-09 02:59:14 +02:00
|
|
|
VelocityActual* velActual;
|
2010-08-31 12:17:14 +02:00
|
|
|
AttitudeActual* attActual;
|
|
|
|
PositionActual* posActual;
|
|
|
|
GCSTelemetryStats* telStats;
|
|
|
|
QHostAddress fgHost;
|
|
|
|
int inPort;
|
|
|
|
int outPort;
|
|
|
|
int updatePeriod;
|
|
|
|
QTimer* txTimer;
|
|
|
|
QTimer* fgTimer;
|
|
|
|
bool autopilotConnectionStatus;
|
|
|
|
bool fgConnectionStatus;
|
|
|
|
int fgTimeout;
|
|
|
|
|
|
|
|
void processUpdate(QString& data);
|
|
|
|
void setupOutputObject(UAVObject* obj, int updatePeriod);
|
|
|
|
void setupInputObject(UAVObject* obj, int updatePeriod);
|
|
|
|
void setupObjects();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // ISIMULATOR_H
|