-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathVehicle.h
More file actions
68 lines (56 loc) · 2.14 KB
/
Copy pathVehicle.h
File metadata and controls
68 lines (56 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
* @file
* @brief Class Vehicle. This class represents a vehicle with specific id, it handles received messages
* sent from LinkManager instance, decodes and parses messages and then dispatchs parsed valid information.
*
*/
#ifndef VEHICLE_H
#define VEHICLE_H
#include <QObject>
#include <common/mavlink.h>
#include "SerialCommunication.h"
#include <QVariant>
#include <mavlink_types.h>
class Vehicle;
class LinkManager;
class UAS;
class Vehicle : public QObject
{
Q_OBJECT
public:
explicit Vehicle(SerialLink* link, int vehicleId);
~Vehicle();
/// all called by vihicle when used afterwards
LinkManager* linkManager(void) { return _linkMgr;}
int id(void) { return _vehicleId;}
private:
QString _flightMode(uint8_t baseMode); /// string of current flight mode
void _addLink(SerialLink* link);
void _handleHeartbeat(mavlink_message_t& message); /// handle heartbeat message
LinkManager * _linkMgr;
SerialLink* _link;
int _vehicleId; /// system id of current vehicle
uint8_t _base_mode; /// custom flight modes, 2-manual, 3- altitude, 3-position
uint32_t _armed;
int8_t _system_status;
signals:
/// signal to VehicleManager to handle link deletion
void linkDeleted(Vehicle* vehicle);
/// emit to mainWindow to show status of flight
void modeChanged(QString shortModeText);
void telemetryChanged(uint8_t rssi);
void attitudeChanged(mavlink_attitude_t* attitude);
void altitudeChanged(float pressure_alt);
void batteryChanged(int8_t voltage_battery);
void GPSStatusChanged(mavlink_gps_raw_int_t* gps_raw_int);
void globalPositionChanged(mavlink_global_position_int_t* global_position_int);
void localPositionChanged(mavlink_local_position_ned_t* local_position);
void groundSpeedChanged(float);
void statusChanged(uint8_t status);
void armedChanged(uint32_t);
public slots:
void _linkDeleted(SerialLink* link);
/// Handle messages from LinkManager, parse status of vehicle and flight
void _mavlinkMessageReceived(SerialLink*link, mavlink_message_t &message);
};
#endif // VEHICLE_H