[46] | 1 | // %flair:license{
|
---|
| 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
| 4 | // %flair:license}
|
---|
| 5 | // created: 2016/07/05
|
---|
| 6 | // filename: Mavlink.h
|
---|
| 7 | //
|
---|
| 8 | // authors: Thomas Fuhrmann
|
---|
| 9 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 10 | //
|
---|
| 11 | // version: $Id: $
|
---|
| 12 | //
|
---|
| 13 | // purpose: Mavlink controller in client side.
|
---|
| 14 | //
|
---|
| 15 | //
|
---|
| 16 | /*********************************************************************/
|
---|
| 17 |
|
---|
| 18 | #ifndef MAVLINK_TEST_H
|
---|
| 19 | #define MAVLINK_TEST_H
|
---|
| 20 |
|
---|
| 21 | #include <stdint.h>
|
---|
| 22 | #include <Thread.h>
|
---|
| 23 |
|
---|
| 24 | namespace flair {
|
---|
| 25 | namespace core {
|
---|
| 26 | class FrameworkManager;
|
---|
| 27 | class Socket;
|
---|
| 28 | }
|
---|
| 29 | namespace gui {
|
---|
| 30 | class SpinBox;
|
---|
| 31 | class Label;
|
---|
| 32 | class CheckBox;
|
---|
| 33 | class Tab;
|
---|
| 34 | class TabWidget;
|
---|
| 35 | class DoubleSpinBox;
|
---|
| 36 | class PushButton;
|
---|
| 37 | class Label;
|
---|
| 38 | class ComboBox;
|
---|
| 39 | class GroupBox;
|
---|
[47] | 40 | class ListWidget;
|
---|
[46] | 41 | }
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | namespace flair {
|
---|
| 45 | namespace sensor {
|
---|
| 46 |
|
---|
| 47 | class Mavlink : public core::Thread {
|
---|
| 48 | public:
|
---|
| 49 |
|
---|
| 50 | Mavlink(const core::FrameworkManager *parent, std::string name,
|
---|
| 51 | std::string receiverAddress, int receiverPort);
|
---|
| 52 | ~Mavlink();
|
---|
| 53 |
|
---|
| 54 | private:
|
---|
| 55 | gui::SpinBox *deadZone;
|
---|
| 56 | gui::CheckBox *enabled;
|
---|
| 57 | gui::Label *batteryChargeLevel;
|
---|
| 58 | core::Time now;
|
---|
| 59 | gui::TabWidget *tabWidget;
|
---|
| 60 | gui::Tab *tab;
|
---|
| 61 | gui::Tab *settingsTab;
|
---|
| 62 |
|
---|
| 63 | // Controls groupbox
|
---|
| 64 | gui::GroupBox* controlsGroupBox;
|
---|
| 65 | gui::PushButton* btn_initialize;
|
---|
| 66 | gui::PushButton* btn_start_mission;
|
---|
| 67 | gui::PushButton* btn_stop_mission;
|
---|
| 68 | gui::PushButton* btn_kill;
|
---|
| 69 |
|
---|
| 70 | // Add wpt groupbox
|
---|
| 71 | gui::GroupBox* add_wptGroupBox;
|
---|
| 72 | gui::DoubleSpinBox* latField;
|
---|
| 73 | gui::DoubleSpinBox* lonField;
|
---|
| 74 | gui::PushButton* btn_add_mission_wpt;
|
---|
| 75 | gui::PushButton* btn_add_entrance_wpt;
|
---|
| 76 | gui::PushButton* btn_add_exit_wpt;
|
---|
| 77 |
|
---|
| 78 | // Show wpt groupbox
|
---|
| 79 | gui::GroupBox* show_wptGroupBox;
|
---|
[47] | 80 | gui::ListWidget* list_mission_wpt;
|
---|
| 81 | gui::ListWidget* list_entrance_wpt;
|
---|
| 82 | gui::ListWidget* list_exit_wpt;
|
---|
| 83 | gui::PushButton* btn_remove_mission_wpt;
|
---|
| 84 | gui::PushButton* btn_remove_entrance_wpt;
|
---|
| 85 | gui::PushButton* btn_remove_exit_wpt;
|
---|
[46] | 86 |
|
---|
| 87 | // Action wpt groupbox
|
---|
| 88 | gui::GroupBox* action_wptGroupBox;
|
---|
| 89 | gui::PushButton* btn_send_wpt;
|
---|
| 90 | gui::PushButton* btn_clear_wpt;
|
---|
| 91 | gui::PushButton* btn_loop;
|
---|
| 92 |
|
---|
| 93 | core::Socket* mavlinkSocket;
|
---|
| 94 | core::Socket* recvSocket;
|
---|
| 95 |
|
---|
| 96 | // reimplement the run of the Thread class
|
---|
| 97 | void Run();
|
---|
[50] | 98 |
|
---|
| 99 | std::string GetWptLatLon();
|
---|
[46] | 100 |
|
---|
| 101 | // First tab callbacks
|
---|
| 102 | void MissionInitialize();
|
---|
| 103 | void MissionStart();
|
---|
| 104 | void MissionStop();
|
---|
| 105 | void MissionKill();
|
---|
| 106 |
|
---|
| 107 | // Second tab callbacks
|
---|
| 108 | void MissionWptAdd();
|
---|
| 109 | void EntranceWptAdd();
|
---|
| 110 | void ExitWptAdd();
|
---|
| 111 | void WptSend();
|
---|
| 112 | void WptClear();
|
---|
| 113 | void WptLoopSend();
|
---|
| 114 |
|
---|
| 115 | void SendWptMessage(gui::DoubleSpinBox* latField, gui::DoubleSpinBox* lonField);
|
---|
| 116 | void SendHeartbeat();
|
---|
| 117 |
|
---|
| 118 | void SendAllWptMessage();
|
---|
| 119 |
|
---|
| 120 | void DecodeWptMessage(std::string wpt_to_decode);
|
---|
| 121 |
|
---|
| 122 | std::string U8toString(const uint8_t* chars, const uint16_t chars_size);
|
---|
| 123 | };
|
---|
| 124 |
|
---|
| 125 | }
|
---|
| 126 | }
|
---|
| 127 |
|
---|
| 128 | #endif // MAVLINK_H
|
---|