-
Notifications
You must be signed in to change notification settings - Fork 0
/
mavlink_receiver.h
55 lines (40 loc) · 1.17 KB
/
mavlink_receiver.h
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
#pragma once
#include "mavlink_include.h"
#include "global_include.h"
#include <cstdint>
namespace mavsdk {
class MAVLinkReceiver {
public:
explicit MAVLinkReceiver(uint8_t channel);
uint8_t get_channel() { return _channel; }
mavlink_message_t& get_last_message() { return _last_message; }
mavlink_status_t& get_status() { return _status; }
void set_new_datagram(char* datagram, unsigned datagram_len);
bool parse_message();
#if DROP_DEBUG == 1
void debug_drop_rate();
void print_line(
const char* index,
unsigned count,
unsigned count_total,
unsigned overall_bytes,
unsigned overall_bytes_total);
#endif
private:
uint8_t _channel;
mavlink_message_t _last_message = {};
mavlink_status_t _status = {};
char* _datagram = nullptr;
unsigned _datagram_len = 0;
#if DROP_DEBUG == 1
unsigned _bytes_received = 0;
unsigned _bytes_sent_overall = 0;
// unsigned _bytes_at_gimbal_overall = 0;
unsigned _bytes_at_camera_overall = 0;
unsigned _bytes_at_sdk_overall = 0;
bool _first = true;
dl_time_t _last_time;
double _time_elapsed = 0.0;
#endif
};
} // namespace mavsdk