MAVLinkSimulationMAV.h 2.05 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
#ifndef MAVLINKSIMULATIONMAV_H
#define MAVLINKSIMULATIONMAV_H

#include <QObject>
#include <QTimer>

#include "MAVLinkSimulationLink.h"
#include "MAVLinkSimulationWaypointPlanner.h"

class MAVLinkSimulationMAV : public QObject
{
    Q_OBJECT
public:
14
    explicit MAVLinkSimulationMAV(MAVLinkSimulationLink *parent, int systemid, double lat=47.376389, double lon=8.548056, int version=MAVLINK_VERSION);
15 16 17 18 19 20 21 22 23 24 25 26

signals:

public slots:
    void mainloop();
    void handleMessage(const mavlink_message_t& msg);

protected:
    MAVLinkSimulationLink* link;
    MAVLinkSimulationWaypointPlanner planner;
    int systemid;
    QTimer mainloopTimer;
27 28 29 30 31 32 33 34 35 36 37 38
    int timer25Hz;
    int timer10Hz;
    int timer1Hz;
    double latitude;
    double longitude;
    double altitude;
    double x;
    double y;
    double z;
    double roll;
    double pitch;
    double yaw;
lm's avatar
lm committed
39 40 41
    double rollspeed;
    double pitchspeed;
    double yawspeed;
42 43 44 45 46 47 48 49 50 51 52 53 54

    bool globalNavigation;
    bool firstWP;

    double previousSPX;
    double previousSPY;
    double previousSPZ;
    double previousSPYaw;

    double nextSPX;
    double nextSPY;
    double nextSPZ;
    double nextSPYaw;
55 56 57 58
    uint8_t sys_mode;
    uint8_t sys_state;
    uint8_t nav_mode;
    bool flying;
59 60
    int mavlink_version;

lm's avatar
lm committed
61 62 63 64
    // FIXME MAVLINKV10PORTINGNEEDED
//    static inline uint16_t mavlink_msg_heartbeat_pack_version_free(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, uint8_t type, uint8_t autopilot, uint8_t version) {
//        uint16_t i = 0;
//        msg->msgid = MAVLINK_MSG_ID_HEARTBEAT;
65

lm's avatar
lm committed
66 67 68
//        i += put_uint8_t_by_index(type, i, msg->payload); // Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM)
//        i += put_uint8_t_by_index(autopilot, i, msg->payload); // Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM
//        i += put_uint8_t_by_index(version, i, msg->payload); // MAVLink version
69

lm's avatar
lm committed
70 71
//        return mavlink_finalize_message(msg, system_id, component_id, i);
//    }
72 73 74 75

};

#endif // MAVLINKSIMULATIONMAV_H