1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-06 17:46:07 +01:00
LibrePilot/ground/openpilotgcs/src/plugins/hitl/isimulator.h

73 lines
1.6 KiB
C
Raw Normal View History

2013-04-05 22:46:56 +02:00
#ifndef ISIMULATOR_H
#define ISIMULATOR_H
#include "uavobjectmanager.h"
#include "actuatordesired.h"
#include "altitudestate.h"
#include "attitudestate.h"
#include "velocitystate.h"
#include "positionstate.h"
2013-04-05 22:46:56 +02:00
#include "gcstelemetrystats.h"
#include <QObject>
#include <QUdpSocket>
#include <QTimer>
#include <math.h>
class Simulator : public QObject {
Q_OBJECT
2013-04-05 22:46:56 +02:00
public:
// static ISimulator* Instance();
// protected:
Simulator();
~ISimulator();
2013-04-05 22:46:56 +02:00
bool isAutopilotConnected();
bool isFGConnected();
2013-04-05 22:46:56 +02:00
signals:
void myStart();
void autopilotConnected();
void autopilotDisconnected();
void fgConnected();
void fgDisconnected();
2013-04-05 22:46:56 +02:00
private slots:
void onStart();
void transmitUpdate();
void receiveUpdate();
void onAutopilotConnect();
void onAutopilotDisconnect();
void onFGConnectionTimeout();
void telStatsUpdated(UAVObject *obj);
2013-04-05 22:46:56 +02:00
private:
// static ISimulator* _instance;
2013-04-05 22:46:56 +02:00
QUdpSocket *inSocket;
QUdpSocket *outSocket;
ActuatorDesired *actDesired;
AltitudeState *altState;
VelocityState *velState;
AttitudeState *attState;
PositionState *posState;
GCSTelemetryStats *telStats;
QHostAddress fgHost;
int inPort;
int outPort;
int updatePeriod;
QTimer *txTimer;
QTimer *fgTimer;
bool autopilotConnectionStatus;
bool fgConnectionStatus;
int fgTimeout;
2013-04-05 22:46:56 +02:00
void processUpdate(QString & data);
void setupOutputObject(UAVObject *obj, int updatePeriod);
void setupInputObject(UAVObject *obj, int updatePeriod);
void setupObjects();
2013-04-05 22:46:56 +02:00
};
#endif // ISIMULATOR_H