diff --git a/files/styles/style-dark.css b/files/styles/style-dark.css new file mode 100644 index 0000000000000000000000000000000000000000..0e04d607fd9d548a71bfe2bc99d1522236e229ae --- /dev/null +++ b/files/styles/style-dark.css @@ -0,0 +1,581 @@ +* { + background-color: #222; + color: #FFF; + background-clip: border; + font-size: 11px; +} + +*::disabled { + color: #777; +} + +JoystickButton QLabel { + border: 1px solid #AAA; + border-radius: 4px; + height: 16px; + padding: 0 3px; +} + +QCheckBox { + color: #DDD; +} + +QCheckBox::indicator { + border: 1px solid #777; + border-radius: 2px; + width: 10px; + height: 10px; +} + +QCheckBox::indicator:hover { + background-color: #CCC; +} + +QCheckBox::indicator:pressed, QCheckBox::indicator:checked:pressed { + background-color: #777; +} + +QCheckBox::indicator:checked { + background-color: #B8D3E6; +} + +QCheckBox::indicator:disabled { + border-color: #555; +} + +QCheckBox::indicator:disabled:checked { + background-color: #333; +} + +QComboBox { + border: 1px solid #777; + border-radius: 2px; +} + +QDialog { + border: 1px solid #62676B; + border-radius: 2px; +} + +QDockWidget { + border: 1px solid #666; + border-radius: 1px; +} + +QDockWidget::close-button, QDockWidget::float-button { + border: 1px solid transparent; + background: none; + padding: 0; +} + +QDockWidget::close-button:hover, QDockWidget::float-button:hover { + background: #B8D3E6; +} + +QDockWidget::close-button:pressed, QDockWidget::float-button:pressed { + padding: 1px -1px -1px 1px; + background: #899FAD; +} + +QDockWidget::title { + text-align: left; + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #3F556A, stop: 1 #293645); + color: #EDEDED; + padding-left: 3px; + height: 14px; +} + +QGCMAVLinkLogPlayer { + background: none; +} + +QGCMAVLinkLogPlayer QLabel { + color: #FFF; +} + +QGCMAVLinkLogPlayer QLabel:disabled { + color: #AAA; +} + +QGCToolBar { + border-top-color: #969696; + border-bottom-color: #484848; + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #4B4B4B, stop: 0.3 #404040, stop: 0.34 #383838, stop:1 #181818); + padding: 0; + margin: 0; +} + +QGCToolBar QLabel { + font-size: 12pt; + font-weight: bold; + margin: 4px 2px; + padding: 0 2px; + border-radius: 4px; +} + +QGCToolBar QLabel#toolBarBatteryBar { + color: #0F0; +} + +QGCToolBar QLabel#toolBarTimeoutLabel { + color: #FFFFFF; + background-color: #FF0037; + font-size: 15pt; +} + +QGCToolBar QLabel#toolBarSafetyLabel { + /* color is for this label defined within the code */ + font-size: 15pt; +} + +QGCToolBar QLabel#toolBarModeLabel { + color: #ACEBFE; + font-size: 15pt; +} + +QGCToolBar QLabel#toolBarStateLabel { + color: #FEC654; + font-size: 15pt; +} + +QGCToolBar QLabel#toolBarBatteryVoltageLabel { + color: #0F0; + font-size: 15pt; +} + +QGCToolBar QLabel#toolBarWpLabel { + color: #ACEBFE; + font-size: 15pt; +} + +QGCToolBar QLabel#toolBarMessageLabel { + color: #ACEBFE; +} + +QGCToolBar QProgressBar { + margin: 4px 2px; +} + +QGCToolBar QToolButton { + margin: 0; + padding: 0; + border: none; + border-top: 1px solid #333; + border-bottom: 1px solid #333; + border-radius: 0; + height: 24px; + margin-bottom: 4px; + text-align: left; + font-weight: bold; + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #AAA, stop: 1 #BBB); + color: #000; +} + +QGCToolBar QToolButton:checked, QGCToolBar QToolButton:pressed, QGCToolBar QToolButton:checked:hover { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #555, stop: 1 #777); + color: #FFF; +} + +QGCToolBar QToolButton:hover { + color: #FFF; +} + +QGCToolBar QToolButton#advancedButton { + margin-left: 0; + margin-right: 13px; + padding: 0 12px 0 4px; + padding-right: 8px; + border-radius: 0; + border-bottom-right-radius: 6px; + border-top-right-radius: 6px; + border-left: none; +} + +QGCToolBar QToolButton#firstAction { + margin-left: 8px; + border-bottom-left-radius: 6px; + border-top-left-radius: 6px; + border-right: none; +} + +QGCToolBar .QWidget { + margin: 0; + background-color: transparent; +} + +QGCToolWidgetItem { + border: 1px solid #666; + border-radius: 3px; + padding: 10px 0 0 0; + margin-top: 1ex; /* leave space at the top for the title */ +} + +QGCUnconnectedInfoWidget QPushButton { + border-radius: 18px; +} + +QGroupBox { + border: 1px solid #666; + border-radius: 3px; + padding: 10px 0 0 0; + margin-top: 1ex; /* leave space at the top for the title */ +} + +QGroupBox::title { + subcontrol-origin: margin; + subcontrol-position: top center; + margin: 0 3px 0 3px; + padding: 0 3px 0 0; + font: bold 8px; + color: #DDD; +} + +QLabel { + background-color: transparent; +} + +QLabel:disabled { + color: #444; + border-color: #444; +} + +QLabel#noUas { + font-size: 30pt; +} + +QLineEdit { + border: 1px solid #777; + border-radius: 2px; +} + +QMainWindow::separator { + background-color: #323235; + width: 2px; /* when vertical */ + height: 2px; /* when horizontal */ +} + +QMainWindow::separator:hover { + background-color: #FFF; +} + +QMenu { + border: 1px solid #B8D3E6; +} + +QMenu::item:selected, QMenu::item:checked:selected { + background-color: #CCC; + color: #000; +} + +QMenu::item:checked { + background-color: #B8D3E6; + color: #000; +} + +QMenu::separator { + height: 1px; + background: #B8D3E6; + margin: 8px 5px 4px 5px; +} + +QMenuBar::item:selected { + background-color: #CCC; + color: #000; +} + +QMenuBar::item:disabled { + border: none; + background: none; +} + +QPlainTextEdit { + border: 1px solid #777; + border-radius: 2px; + font-family: "Monospace"; + font: large; +} + +QProgressBar { + border: 1px solid #4A4A4A; + border-radius: 4px; + text-align: center; + padding: 2px; + color: #DDD; + background: #111; + height: 10px; +} + +QProgressBar::chunk { + background-color: #3C7B9E; +} + +QProgressBar::chunk#batteryBar { + background-color: green; +} + +QProgressBar::chunk#speedBar { + background-color: yellow; +} + +QProgressBar::chunk#thrustBar { + background-color: orange; +} + +QProgressBar:horizontal { + height: 9px; +} + +QProgressBar:vertical { + width: 9px; +} + +QPushButton, QToolButton { + min-height: 20px; + max-height: 20px; + border: 1px solid #465158; + margin: 1px; + border-radius: 4px; + padding-left: 8px; + padding-right: 8px; + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #777, stop: 1 #333); +} + +QPushButton#connectButton, QPushButton#controlButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #73D95D, stop: 1 #18A154); +} + +QPushButton#controlButton { + min-height: 25px; +} + +QPushButton#deleteButton, QPushButton#killButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D9002F, stop: 1 #AC0025); +} + +QPushButton:checked, QToolButton:checked { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #09A2B2, stop: 1 #414B52); +} + +QPushButton:checked#connectButton, QPushButton:checked#controlButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E38000, stop: 1 #945F00); + color: #000; +} + +QPushButton:checked:hover#connectButton, QPushButton:checked:hover#controlButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FF9000, stop: 1 #B37300); +} + +QPushButton:checked:pressed#connectButton, QPushButton:checked:pressed#controlButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #DB7C00, stop: 1 #825400); +} + +QPushButton:disabled, QToolButton:disabled { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #232228, stop: 1 #020208); +} + +QPushButton:hover, QToolButton:hover { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #59666F, stop: 1 #414B52); +} + +QPushButton:hover#connectButton, QPushButton:hover#controlButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #87FF6D, stop: 1 #1FD16D); +} + +QPushButton:hover#deleteButton, QPushButton#killButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #F20034, stop: 1 #9E0022); +} + +QPushButton:pressed, QToolButton:pressed { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #bbbbbb, stop: 1 #b0b0b0); +} + +QPushButton:pressed#connectButton, QPushButton:pressed#controlButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #62B84E, stop: 1 #148A47); +} + +QPushButton:pressed#deleteButton, QPushButton#killButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #C9002C, stop: 1 #9C0021); +} + +QScrollBar { + border: 1px solid #333; +} + +QSeparator { + color: #EEE; +} + +QSlider { + background-color: transparent; +} + +QSlider::groove:horizontal { + border: 1px solid #999; + height: 4px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */ + background-color: #4A4A4A; + margin: 2px 0; +} + +QSlider::groove:horizontal:disabled { + border: 1px solid #454545; + background-color: #4A4A4A; + height: 4px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */ + margin: 2px 0; +} + +QSlider::groove:vertical { + border: 1px solid #999; + width: 4px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */ + background-color: #4A4A4A; + margin: 2px 0; +} + +QSlider::handle:horizontal { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #232228, stop: 1 #020208); + border: 2px solid #B8D3E6; + width: 18px; + margin: -5px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */ + border-radius: 3px; +} + +QSlider::handle:horizontal:disabled { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #535258, stop: 1 #050508); + border: 2px solid #444; + width: 18px; + margin: -5px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */ + border-radius: 3px; +} + +QSlider::handle:vertical { + background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #232228, stop: 1 #020208); + border: 2px solid #B8D3E6; + height: 18px; + margin: 0 -5px; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */ + border-radius: 3px; +} + +QSizeGrip { + background: none; +} + +QSpinBox, QDoubleSpinBox { + min-height: 14px; + max-height: 18px; + border: 1px solid #777; + border-radius: 5px; +} + +QSpinBox::down-arrow, QDoubleSpinBox::down-arrow { + image: url(:/files/images/actions/go-down.svg); + width: 16px; +} + +QSpinBox::down-button, QDoubleSpinBox::down-button { + border: none; +} + +QSpinBox::up-arrow, QDoubleSpinBox::up-arrow { + image: url(:/files/images/actions/go-up.svg); + width: 16px; +} + +QSpinBox::up-button, QDoubleSpinBox::up-button { + border: none; +} + +QStatusBar { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #4B4B4B, stop: 0.3 #404040, stop:0.34 #383838, stop:1 #181818); +} + +QTabBar::tab { + border: 2px solid #62676B; + border-radius: 4px; + min-width: 8ex; + padding: 2px; +} + +QTabBar::tab:hover { + border: 2px solid #B8D3E6; +} + +QTabBar::tab:selected { + border: 2px solid #B8D3E6; + background: #555; +} + +QTabWidget::tab-bar { + alignment: center; +} + +QTabWidget::pane { + border: 1px solid #62676B; + border-radius: 2px; + position: absolute; + top: -0.5em; +} + +QTextEdit { + border: 1px solid #777; + border-radius: 2px; +} + +QToolButton { + padding-left: 3px; + padding-right: 3px; +} + +QToolTip { + background-color: #3D5368; + border:0 solid #B8D3E6; + margin: 3px; + border-radius: 3px; + color: #DDD; +} + +UASQuickViewItem QLabel { + padding: 0; + margin: 0; + min-height: 1em; + font-weight: bold; +} + +UASQuickViewItem QLabel#value { + font-size: 20pt; +} + +UASView { + background: #444; + border: 1px solid #AAA; + border-radius: 12px; +} + +UASView QLabel#heartBeatLabel, UASView QLabel#typeLabel { + border: 1px solid #333; + border-radius: 5px; + padding: 2px; +} + +QGCUnconnectedInfoWidget QPushButton#connectButton { + min-height: 150px; + max-height: 275px; + margin: 15px; + padding: 20px; +} + +WaypointEditableView, WaypointViewOnlyView { + border: 1px solid #777; + border-radius: 5px; + margin-bottom: 3px; +} + +WaypointEditableView[RowColoring="odd"], WaypointViewOnlyView[RowColoring="odd"] { + background-color: #333; +} + +WaypointEditableView[RowColoring="even"], WaypointViewOnlyView[RowColoring="even"] { + background-color: #555; +} + +WaypointEditableView QCheckBox, WaypointEditableView .QWidget, WaypointViewOnlyView QCheckBox, WaypointViewOnlyView .QWidget { + background: none; +} diff --git a/files/styles/style-indoor.css b/files/styles/style-indoor.css deleted file mode 100644 index 3da0058af6a5c9beb8e550b0e8555a1333cb95a5..0000000000000000000000000000000000000000 --- a/files/styles/style-indoor.css +++ /dev/null @@ -1,461 +0,0 @@ -/** { font-family: "Bitstream Vera Sans"; font: "Roman"; font-size: 12px; }*/ -QWidget#colorIcon {} - -QWidget { - background-color: #222224; - color: #FFFFFF; - background-clip: border; - font-size: 11px; -} - -QGroupBox { - border: 1px solid #66666B; - border-radius: 3px; - padding: 10px 0px 0px 0px; - margin-top: 1ex; /* leave space at the top for the title */ -} - -QCheckBox { - /*background-color: #252528;*/ - color: #DDDDDF; -} - -QCheckBox::indicator { - border: 1px solid #777777; - border-radius: 2px; - color: #FFFFFF; - width: 10px; - height: 10px; -} - -QLineEdit { -border: 1px solid #777777; - border-radius: 2px; -} - -QTextEdit { - border: 1px solid #777777; - border-radius: 2px; -} - -QPlainTextEdit { - border: 1px solid #777777; - border-radius: 2px; - font-family: "Monospace"; - font: large; -} - -QComboBox { -border: 1px solid #777777; - border-radius: 2px; - } - - QCheckBox::indicator:checked { - background-color: #379AC3; - } - - QCheckBox::indicator:checked:hover { - background-color: #379AC3; - } - - QCheckBox::indicator:checked:pressed { - background-color: #379AC3; - } - - QCheckBox::indicator:indeterminate:hover { - image: url(:/files/images/checkbox_indeterminate_hover.png); - } - - QCheckBox::indicator:indeterminate:pressed { - image: url(:/files/images/checkbox_indeterminate_pressed.png); - } - - QGroupBox::title { - subcontrol-origin: margin; - subcontrol-position: top center; /* position at the top center */ - margin: 0 3px 0px 3px; - padding: 0 3px 0px 0px; - font: bold 8px; - color: #DDDDDF; - } - - QMainWindow::separator { - background-color: #323235; - width: 2px; /* when vertical */ - height: 2px; /* when horizontal */ - } - - QMainWindow::separator:hover { - background: white; - } - - QGCToolWidgetItem { - border: 1px solid #66666B; - border-radius: 3px; - padding: 10px 0px 0px 0px; - margin-top: 1ex; /* leave space at the top for the title */ - } - -QDockWidget::close-button, QDockWidget::float-button { - border: 1px solid transparent; - background: none; - padding: 0px; -} - -QDockWidget::close-button:hover, QDockWidget::float-button:hover { - background: none; -} - -QDockWidget::close-button:pressed, QDockWidget::float-button:pressed { - padding: 1px -1px -1px 1px; - background: none; -} - - QDockWidget { - border: 10px solid #66666B; - /*padding: 2px;*/ - border-radius: 1px; - /*background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #59666f, stop: 1 #414B52);*/ - /* titlebar-close-icon: url(close.png); - titlebar-normal-icon: url(undock.png);*/ -} - -QDockWidget::title { - text-align: left; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #3F556A, stop: 1 #293645); - color: #EDEDED; - padding-left: 10px; - height: 14px; - border-bottom: 1px solid #1B1F22; - border-bottom: 2px solid #2C3A4A; -} - -QSeparator { - color: #EEEEEE; - } - - -QSpinBox { - min-height: 14px; - max-height: 18px; - border: 1px solid #4A4A4F; - border-radius: 5px; -} - -QSpinBox::up-button { - subcontrol-origin: border; - subcontrol-position: top right; /* position at the top right corner */ - border-image: url(:/files/images/actions/go-up.svg) 1; - border-width: 1px; -} -QSpinBox::down-button { - subcontrol-origin: border; - subcontrol-position: bottom right; /* position at the top right corner */ - border-image: url(:/files/images/actions/go-down.svg) 1; - border-width: 1px; -} - -QDoubleSpinBox { - min-height: 14px; - max-height: 18px; - border: 1px solid #4A4A4F; - border-radius: 5px; -} - -QDoubleSpinBox::up-button { - subcontrol-origin: border; - subcontrol-position: top right; /* position at the top right corner */ - border-image: url(:/files/images/actions/go-up.svg) 1; - border-width: 1px; - max-width: 5px; -} -QDoubleSpinBox::down-button { - subcontrol-origin: border; - subcontrol-position: bottom right; /* position at the top right corner */ - border-image: url(:/files/images/actions/go-down.svg) 1; - border-width: 1px; - max-width: 5px; -} - -QPushButton { - min-height: 16px; - border: 1px solid #465158; - margin: 1px; - border-radius: 2px; - padding-left: 8px; - padding-right: 8px; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #59666f, stop: 1 #414B52); -} - -QPushButton:disabled { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #232228, stop: 1 #020208); -} - -QPushButton:checked { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #09A2B2, stop: 1 #414B52); -} - -QPushButton:pressed { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #bbbbbb, stop: 1 #b0b0b0); -} - -QToolButton { - font-weight: bold; - min-height: 16px; - border: 1px solid #4A4A4F; - margin: 1px; - border-radius: 2px; - padding-left: 3px; - padding-right: 3px; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #59666f, stop: 1 #414B52); -} - -QToolButton:disabled { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #232228, stop: 1 #020208); -} - -QToolButton:checked { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #09A2B2, stop: 1 #414B52); -} - -QToolButton:pressed { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #bbbbbb, stop: 1 #b0b0b0); -} - -QToolTip { - background-color: #3D5368; - border: 0px solid #379AC3; - margin: 3px; - border-radius: 3px; - color: #DDDDDF; -} - -QMenu { - border: 1px solid #379AC3; -} - -QMenu::separator { - height: 1px; - background: #379AC3; - margin-top: 8px; - margin-bottom: 4px; - margin-left: 5px; - margin-right: 5px; - } - -QMenuBar::item:disabled { - border: none; - background: none; -} -QMenuBar::item:disabled:selected { - border: none; - background: none; -} -QMenuBar::item:disabled:pressed { - background: none; - border: none; -} - -QSlider { - background-color: transparent; -} - -QSlider::groove:horizontal { - border: 1px solid #999999; - height: 4px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */ - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #4A4A4F, stop:1 #4A4A4F); - margin: 2px 0; - } - - QSlider::groove:disabled:horizontal { - border: 1px solid #454545; - height: 4px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */ - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #4A4A4F, stop:1 #4A4A4F); - margin: 2px 0; - } - - QSlider::handle:horizontal { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #232228, stop: 1 #020208); - border: 2px solid #379AC3; - width: 18px; - margin: -5px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */ - border-radius: 3px; - } - - QSlider::handle:disabled:horizontal { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #535258, stop: 1 #050508); - border: 2px solid #444444; - width: 18px; - margin: -5px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */ - border-radius: 3px; - } - - QSlider::groove:vertical { - border: 1px solid #999999; - width: 4px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */ - background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #4A4A4F, stop:1 #4A4A4F); - margin: 2px 0; - } - - QSlider::handle:vertical { - background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #232228, stop: 1 #020208); - border: 2px solid #379AC3; - height: 18px; - margin: 0 -5px; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */ - border-radius: 3px; - } - -QPushButton#forceLandButton { - font-weight: bold; - min-height: 30px; - color: #000000; - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #ffee01, stop:1 #ae8f00) url("ICONDIR/control/emergency-button.png"); - background-clip: border; - border-width: 1px; - border-color: #555555; - border-radius: 5px; -} - -QPushButton:pressed#forceLandButton { - font-weight: bold; - min-height: 30px; - color: #000000; - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #bbaa00, stop:1 #a05b00) url("ICONDIR/control/emergency-button.png"); - background-clip: border; - border-width: 1px; - border-color: #555555; - border-radius: 5px; -} - -QPushButton#killButton { - font-weight: bold; - min-height: 30px; - color: #000000; - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #ffb917, stop:1 #b37300) url("ICONDIR/control/emergency-button.png"); - background-clip: border; - border-width: 1px; - border-color: #555555; - border-radius: 5px; -} - -QPushButton:pressed#killButton { - font-weight: bold; - min-height: 30px; - color: #000000; - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #bb8500, stop:1 #903000) url("ICONDIR/control/emergency-button.png"); - background-clip: border; - border-width: 1px; - border-color: #555555; - border-radius: 5px; -} - -QPushButton#controlButton { - min-height: 25px; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #A0AE00, stop: 1 #909E00); -} - -QPushButton:checked#controlButton { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #b76f11, stop: 1 #e1a718); -} - -QProgressBar { - border: 1px solid #4A4A4F; - border-radius: 4px; - text-align: center; - padding: 2px; - color: #DDDDDF; - background-color: #111118; - height: 10px; -} - -QProgressBar:horizontal { - height: 9px; -} - -QProgressBar:vertical { - width: 9px; -} - -QProgressBar::chunk { - background-color: #3C7B9E; -} - -QProgressBar::chunk#batteryBar { - background-color: green; -} - -QProgressBar::chunk#speedBar { - background-color: yellow; -} - -QProgressBar::chunk#thrustBar { - background-color: orange; -} - -QDialog { - border: 1px solid #62676B; - border-radius: 2px; -} - - QTabWidget::pane { /* The tab widget frame */ - border: 1px solid #62676B; - border-radius: 2px; - position: absolute; - top: -0.5em; - } - - QTabWidget::tab-bar { - alignment: center; - } - - /* Style the tab using the tab sub-control. Note that - it reads QTabBar _not_ QTabWidget */ - QTabBar::tab { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #090909, stop: 1 #353535); - border: 2px solid #62676B; - border-radius: 4px; - min-width: 8ex; - padding: 2px; - } - - QTabBar::tab:selected, QTabBar::tab:hover { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #090909, stop: 1 #353535); - border: 2px solid #379AC3; - } - - QTabBar::tab:selected { - border: 2px solid #379AC3; - } - -QLabel { - background-color: transparent; -} - -QLabel:disabled { - color: #353535; -} - -QLabel#toolBarNameLabel { - font: bold 16px; - color: #3C7B9E; -} - -QLabel#toolBarModeLabel { - font: 12px; -} - -QLabel#toolBarStateLabel { - font: 12px; - color: #3C7B9E; -} - -QLabel#toolBarMessageLabel { - font: 12px; - font-style: italic; - color: #3C7B9E; -} - diff --git a/files/styles/style-light.css b/files/styles/style-light.css new file mode 100644 index 0000000000000000000000000000000000000000..25c38addf4d8854ad865f695abcf67fb55f95174 --- /dev/null +++ b/files/styles/style-light.css @@ -0,0 +1,583 @@ +* { + background-color: #F6F6F6; + color: #000; + background-clip: border; + font-size: 11px; +} + +*::disabled { + color: #AAA; +} + +JoystickButton QLabel { + border: 1px solid #777; + border-radius: 4px; + height: 16px; + padding: 0 3px; +} + +QCheckBox { + color: #222; +} + +QCheckBox::indicator { + border: 1px solid #111; + border-radius: 2px; + width: 10px; + height: 10px; +} + +QCheckBox::indicator:hover { + background-color: #CCC; +} + +QCheckBox::indicator:pressed, QCheckBox::indicator:checked:pressed { + background-color: #777; +} + +QCheckBox::indicator:checked { + background-color: #379AC3; +} + +QCheckBox::indicator:disabled { + border-color: #555; +} + +QCheckBox::indicator:disabled:checked { + background-color: #AAA; +} + +QComboBox { + border: 1px solid #777; + border-radius: 2px; +} + +QDialog { + border: 1px solid #777; + border-radius: 2px; +} + +QDockWidget { + border: 1px solid #666; + border-radius: 1px; +} + +QDockWidget::close-button, QDockWidget::float-button { + border: 1px solid transparent; + background: none; + padding: 0; +} + +QDockWidget::close-button:hover, QDockWidget::float-button:hover { + background: #777; +} + +QDockWidget::close-button:pressed, QDockWidget::float-button:pressed { + padding: 1px -1px -1px 1px; + background: #555; +} + +QDockWidget::title { + text-align: left; + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #CCC, stop: 1 #888); + color: #000; + padding-left: 3px; + height: 14px; +} + +QGCMAVLinkLogPlayer { + background: none; +} + +QGCMAVLinkLogPlayer QLabel { + color: #FFF; +} + +QGCMAVLinkLogPlayer QLabel:disabled { + color: #666; +} + +QGCToolBar { + border-top-color: #969696; + border-bottom-color: #484848; + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #DDD, stop: 1 #999); + padding: 0; + margin: 0; +} + +QGCToolBar QLabel { + font-size: 12pt; + font-weight: bold; + margin: 4px 2px; + padding: 0 2px; + border-radius: 4px; +} + +QGCToolBar QLabel#toolBarBatteryBar { + color: #008000; +} + +QGCToolBar QLabel#toolBarTimeoutLabel { + color: #FFFFFF; + background-color: #FF0037; + font-size: 15pt; +} + +QGCToolBar QLabel#toolBarSafetyLabel { + /* color is for this label defined within the code */ + font-size: 15pt; +} + +QGCToolBar QLabel#toolBarModeLabel { + color: #475E66; + font-size: 15pt; +} + +QGCToolBar QLabel#toolBarStateLabel { + color: #80632A; + font-size: 15pt; +} + +QGCToolBar QLabel#toolBarBatteryVoltageLabel { + color: #008000; + font-size: 15pt; +} + +QGCToolBar QLabel#toolBarWpLabel { + color: #475E66; + font-size: 15pt; +} + +QGCToolBar QLabel#toolBarMessageLabel { + color: #475E66; +} + +QGCToolBar QProgressBar { + margin: 4px 2px; +} + +QGCToolBar QToolButton { + margin: 0; + padding: 0; + border: none; + border-top: 1px solid #DDD; + border-bottom: 1px solid #DDD; + border-radius: 0; + height: 24px; + margin-bottom: 4px; + text-align: left; + font-weight: bold; + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #333, stop: 1 #444); + color: #FFF; +} + +QGCToolBar QToolButton:checked, QGCToolBar QToolButton:pressed, QGCToolBar QToolButton:checked:hover { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #777, stop: 1 #999); + color: #FFF; +} + +QGCToolBar QToolButton:hover { + color: #000; +} + +QGCToolBar QToolButton#advancedButton { + margin-left: 0; + margin-right: 13px; + padding: 0 12px 0 4px; + padding-right: 8px; + border-radius: 0; + border-bottom-right-radius: 6px; + border-top-right-radius: 6px; + border-left: none; +} + +QGCToolBar QToolButton#firstAction { + margin-left: 8px; + border-bottom-left-radius: 6px; + border-top-left-radius: 6px; + border-right: none; +} + +QGCToolBar .QWidget { + margin: 0; + background-color: transparent; +} + +QGCToolWidgetItem { + border: 1px solid #666; + border-radius: 3px; + padding: 10px 0 0 0; + margin-top: 1ex; /* leave space at the top for the title */ +} + +QGCUnconnectedInfoWidget QPushButton { + border-radius: 18px; +} + +QGroupBox { + border: 1px solid #666; + border-radius: 3px; + padding: 10px 0 0 0; + margin-top: 1ex; /* leave space at the top for the title */ +} + +QGroupBox::title { + subcontrol-origin: margin; + subcontrol-position: top center; + margin: 0 3px 0 3px; + padding: 0 3px 0 0; + font: bold 8px; + color: #000; +} + +QLabel { + background-color: transparent; +} + +QLabel:disabled { + color: #999; + border-color: #999; +} + +QLabel#noUas { + font-size: 30pt; +} + +QLineEdit { + border: 1px solid #111; + border-radius: 2px; +} + +QMainWindow::separator { + background-color: #CCC; + width: 2px; /* when vertical */ + height: 2px; /* when horizontal */ +} + +QMainWindow::separator:hover { + background-color: #222; +} + +QMenu { + border: 1px solid #379AC3; +} + +QMenu::item:selected, QMenu::item:checked:selected { + background-color: #555; + color: #FFF; +} + +QMenu::item:checked { + background-color: #379AC3; + color: #FFF; +} + +QMenu::separator { + height: 1px; + background: #379AC3; + margin: 8px 5px 4px 5px; +} + +QMenuBar::item:selected { + background-color: #555; + color: #FFF; +} + +QMenuBar::item:disabled { + border: none; + background: none; +} + +QPlainTextEdit { + border: 1px solid #111; + border-radius: 2px; + font-family: "Monospace"; + font: large; +} + +QProgressBar { + border: 1px solid #666; + border-radius: 4px; + text-align: center; + padding: 2px; + color: #000; + background: none; + height: 10px; +} + +QProgressBar::chunk { + background-color: #666; +} + +QProgressBar::chunk#batteryBar { + background-color: green; +} + +QProgressBar::chunk#speedBar { + background-color: yellow; +} + +QProgressBar::chunk#thrustBar { + background-color: orange; +} + +QProgressBar:horizontal { + height: 9px; +} + +QProgressBar:vertical { + width: 9px; +} + +QPushButton, QToolButton { + min-height: 20px; + max-height: 20px; + border: 1px solid #465158; + margin: 1px; + border-radius: 4px; + padding-left: 8px; + padding-right: 8px; + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #BBB, stop: 1 #777); +} + +QPushButton#connectButton, QPushButton#controlButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #73D95D, stop: 1 #18A154); +} + +QPushButton#controlButton { + min-height: 25px; +} + +QPushButton#deleteButton, QPushButton#killButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D9002F, stop: 1 #AC0025); +} + +QPushButton:checked, QToolButton:checked { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #444, stop: 1 #888); + color: #FFF; +} + +QPushButton:checked#connectButton, QPushButton:checked#controlButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E38000, stop: 1 #945F00); + color: #000; +} + +QPushButton:checked:hover#connectButton, QPushButton:checked:hover#controlButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FF9000, stop: 1 #B37300); +} + +QPushButton:checked:pressed#connectButton, QPushButton:checked:pressed#controlButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #DB7C00, stop: 1 #825400); +} + +QPushButton:disabled, QToolButton:disabled { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #EEE, stop: 1 #CCC); + color: #AAA; +} + +QPushButton:hover, QToolButton:hover { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #B8D3E6, stop: 1 #899FAD); +} + +QPushButton:hover#connectButton, QPushButton:hover#controlButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #87FF6D, stop: 1 #1FD16D); +} + +QPushButton:hover#deleteButton, QPushButton#killButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #F20034, stop: 1 #9E0022); +} + +QPushButton:pressed, QToolButton:pressed { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #AAA, stop: 1 #666); +} + +QPushButton:pressed#connectButton, QPushButton:pressed#controlButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #62B84E, stop: 1 #148A47); +} + +QPushButton:pressed#deleteButton, QPushButton#killButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #C9002C, stop: 1 #9C0021); +} + +QScrollBar { + border: 1px solid #333; +} + +QSeparator { + color: #000; +} + +QSlider { + background-color: transparent; +} + +QSlider::groove:horizontal { + border: 1px solid #999; + height: 4px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */ + background-color: #4A4A4A; + margin: 2px 0; +} + +QSlider::groove:horizontal:disabled { + border: 1px solid #999; + background-color: #CCC; + height: 4px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */ + margin: 2px 0; +} + +QSlider::groove:vertical { + border: 1px solid #999; + width: 4px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */ + background-color: #4A4A4A; + margin: 2px 0; +} + +QSlider::handle:horizontal { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #232228, stop: 1 #020208); + border: 2px solid #379AC3; + width: 18px; + margin: -5px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */ + border-radius: 3px; +} + +QSlider::handle:horizontal:disabled { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #EEE, stop: 1 #CCC); + border: 2px solid #777; + width: 18px; + margin: -5px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */ + border-radius: 3px; +} + +QSlider::handle:vertical { + background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #232228, stop: 1 #020208); + border: 2px solid #379AC3; + height: 18px; + margin: 0 -5px; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */ + border-radius: 3px; +} + +QSizeGrip { + background: none; +} + +QSpinBox, QDoubleSpinBox { + min-height: 14px; + max-height: 18px; + border: 1px solid #4A4A4A; + border-radius: 5px; +} + +QSpinBox::down-arrow, QDoubleSpinBox::down-arrow { + image: url(:/files/images/actions/go-down.svg); + width: 16px; +} + +QSpinBox::down-button, QDoubleSpinBox::down-button { + border: none; +} + +QSpinBox::up-arrow, QDoubleSpinBox::up-arrow { + image: url(:/files/images/actions/go-up.svg); + width: 16px; +} + +QSpinBox::up-button, QDoubleSpinBox::up-button { + border: none; +} + +QStatusBar { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #DDD, stop: 1 #999); +} + +QTabBar::tab { + border: 2px solid #777; + border-radius: 4px; + min-width: 8ex; + padding: 2px; +} + +QTabBar::tab:hover { + border: 2px solid #379AC3; +} + +QTabBar::tab:selected { + border: 2px solid #379AC3; + background: #CCC; +} + +QTabWidget::tab-bar { + alignment: center; +} + +QTabWidget::pane { + border: 1px solid #777; + border-radius: 2px; + position: absolute; + top: -0.5em; +} + +QTextEdit { + border: 1px solid #222; + border-radius: 2px; +} + +QToolButton { + padding-left: 3px; + padding-right: 3px; +} + +QToolTip { + background-color: #F6F6F6; + border:0 solid #379AC3; + margin: 3px; + border-radius: 3px; + color: #000; +} + +UASQuickViewItem QLabel { + padding: 0; + margin: 0; + min-height: 1em; + font-weight: bold; +} + +UASQuickViewItem QLabel#value { + font-size: 20pt; +} + +UASView { + background: #D0D0D0; + border: 1px solid #666; + border-radius: 12px; +} + +UASView QLabel#heartBeatLabel, UASView QLabel#typeLabel { + border: 1px solid #333; + border-radius: 5px; + padding: 2px; +} + +QGCUnconnectedInfoWidget QPushButton#connectButton { + min-height: 150px; + max-height: 275px; + margin: 15px; + padding: 20px; +} + +WaypointEditableView, WaypointViewOnlyView { + border: 1px solid #333; + border-radius: 5px; + margin-bottom: 3px; +} + +WaypointEditableView[RowColoring="odd"], WaypointViewOnlyView[RowColoring="odd"] { + background-color: #999; +} + +WaypointEditableView[RowColoring="even"], WaypointViewOnlyView[RowColoring="even"] { + background-color: #CCC; +} + +WaypointEditableView QCheckBox, WaypointEditableView .QWidget, WaypointViewOnlyView QCheckBox, WaypointViewOnlyView .QWidget { + background: none; +} diff --git a/files/styles/style-outdoor.css b/files/styles/style-outdoor.css deleted file mode 100644 index e6893c6d88f1f0dec1d7fbad48574f76895a7fee..0000000000000000000000000000000000000000 --- a/files/styles/style-outdoor.css +++ /dev/null @@ -1,315 +0,0 @@ -* { font-family: "Bitstream Vera Sans"; font: "Roman"; font-size: 12px; } -QWidget#colorIcon {} - -QWidget { -background-color: #F6F6F6; -color: #000000; -background-clip: border; -font-size: 11px; -} - -QGroupBox { -border: 1px solid #222216; -border-radius: 3px; -padding: 10px 0px 0px 0px; -margin-top: 1ex; /* leave space at the top for the title */ -} - -QCheckBox { -/*background-color: #252528;*/ -color: #222221; -} - -QCheckBox::indicator { - border: 1px solid #111111; - border-radius: 2px; - color: #222221; - width: 10px; - height: 10px; -} - -QLineEdit { -border: 1px solid #111111; - border-radius: 2px; -} - -QTextEdit { -border: 1px solid #111111; - border-radius: 2px; -} - -QPlainTextEdit { -border: 1px solid #111111; - border-radius: 2px; -} - -QComboBox { -border: 1px solid #111111; - border-radius: 2px; - } - - QCheckBox::indicator:checked { - background-color: #333333; - } - - QCheckBox::indicator:checked:hover { - background-color: #222222; - } - - QCheckBox::indicator:checked:pressed { - background-color: #222222; - } - - QCheckBox::indicator:indeterminate:hover { - image: url(:/files/images/checkbox_indeterminate_hover.png); - } - - QCheckBox::indicator:indeterminate:pressed { - image: url(:/files/images/checkbox_indeterminate_pressed.png); - } - - QGroupBox::title { - subcontrol-origin: margin; - subcontrol-position: top center; /* position at the top center */ - margin: 0 3px 0px 3px; - padding: 0 3px 0px 0px; - font: bold 8px; - color: #DDDDDF; - } - - QMainWindow::separator { - background: #090909; - width: 2px; /* when vertical */ - height: 2px; /* when horizontal */ - } - - QMainWindow::separator:hover { - background: white; - } - -QMenuBar::item:disabled { - border: none; - background: none; -} -QMenuBar::item:disabled:selected { - border: none; - background: none; -} -QMenuBar::item:disabled:pressed { - background: none; - border: none; -} - - QDockWidget { - border: 1px solid #32345E; - /* titlebar-close-icon: url(close.png); - titlebar-normal-icon: url(undock.png);*/ - } - QDockWidget::title { - text-align: left; - background: #EEEEEE; - color: #111111; - padding-left: 5px; - height: 10px; - border-bottom: 1px solid #222222; -} - - QDockWidget::close-button, QDockWidget::float-button { - border: 1px solid transparent; - background: darkgray; - padding: 0px; - } - - QDockWidget::close-button:hover, QDockWidget::float-button:hover { - background: gray; - } - - QDockWidget::close-button:pressed, QDockWidget::float-button:pressed { - padding: 1px -1px -1px 1px; - } - - - -QDockWidget::close-button, QDockWidget::float-button { - background-color: #181820; - color: #EEEEEE; -} - -QSeparator { - color: #EEEEEE; - } - - -QSpinBox { - min-height: 14px; - max-height: 18px; - border: 1px solid #4A4A4F; - border-radius: 5px; -} - -QSpinBox::up-button { - subcontrol-origin: border; - subcontrol-position: top right; /* position at the top right corner */ - border-image: url(:/files/images/actions/go-up.svg) 1; - border-width: 1px; -} -QSpinBox::down-button { - subcontrol-origin: border; - subcontrol-position: bottom right; /* position at the top right corner */ - border-image: url(:/files/images/actions/go-down.svg) 1; - border-width: 1px; -} - -QDoubleSpinBox { - min-height: 14px; - max-height: 18px; - border: 1px solid #4A4A4F; - border-radius: 5px; -} - -QDoubleSpinBox::up-button { - subcontrol-origin: border; - subcontrol-position: top right; /* position at the top right corner */ - border-image: url(:/files/images/actions/go-up.svg) 1; - border-width: 1px; - max-width: 5px; -} -QDoubleSpinBox::down-button { - subcontrol-origin: border; - subcontrol-position: bottom right; /* position at the top right corner */ - border-image: url(:/files/images/actions/go-down.svg) 1; - border-width: 1px; - max-width: 5px; -} - -QPushButton { - font-weight: bold; - /*min-height: 18px;*/ - /*max-height: 18px;*/ - border: 2px solid #4A4A4F; - border-radius: 5px; - padding-left: 10px; - padding-right: 10px; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #C3C2C8, stop: 1 #828288); -} - -QPushButton:checked { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #404040, stop: 1 #808080); -} - -QPushButton:pressed { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #bbbbbb, stop: 1 #b0b0b0); -} - -QToolButton { - font-weight: bold; - min-height: 16px; - min-width: 24px; - max-height: 18px; - border: 2px solid #4A4A4F; - border-radius: 5px; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #C3C2C8, stop: 1 #828288); -} - -QToolButton:checked { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #090909, stop: 1 #353535); -} - -QToolButton:pressed { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #bbbbbb, stop: 1 #b0b0b0); -} - -QToolTip { - background-color: #404040; - border-radius: 3px; -} - -QPushButton#forceLandButton { - font-weight: bold; - min-height: 30px; - color: #000000; - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #ffee01, stop:1 #ae8f00) url("ICONDIR/control/emergency-button.png"); - background-clip: border; - border-width: 1px; - border-color: #222222; - border-radius: 5px; -} - -QPushButton:pressed#forceLandButton { - font-weight: bold; - min-height: 30px; - color: #000000; - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #bbaa00, stop:1 #a05b00) url("ICONDIR/control/emergency-button.png"); - background-clip: border; - border-width: 1px; - border-color: #222222; - border-radius: 5px; -} - -QPushButton#killButton { - font-weight: bold; - min-height: 30px; - color: #000000; - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #ffb917, stop:1 #b37300) url("ICONDIR/control/emergency-button.png"); - background-clip: border; - border-width: 1px; - border-color: #222222; - border-radius: 5px; -} - -QPushButton:pressed#killButton { - font-weight: bold; - min-height: 30px; - color: #000000; - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #bb8500, stop:1 #903000) url("ICONDIR/control/emergency-button.png"); - background-clip: border; - border-width: 1px; - border-color: #222222; - border-radius: 5px; -} - -QPushButton#controlButton { - min-height: 25px; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #A0AE00, stop: 1 #909E00); -} - -QPushButton:checked#controlButton { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #b76f11, stop: 1 #e1a718); -} - -QProgressBar { - border: 1px solid #4A4A4F; - border-radius: 4px; - text-align: center; - padding: 2px; - color: #DDDDDF; - background-color: #111118; -} - -QProgressBar:horizontal { - height: 9px; -} - -QProgressBar:vertical { - width: 9px; -} - -QProgressBar::chunk { - background-color: #3C7B9E; -} - -QProgressBar::chunk#batteryBar { - background-color: green; -} - -QProgressBar::chunk#speedBar { - background-color: yellow; -} - -QProgressBar::chunk#thrustBar { - background-color: orange; -} diff --git a/libs/mavlink/include/mavlink/v1.0/ardupilotmega/ardupilotmega.h b/libs/mavlink/include/mavlink/v1.0/ardupilotmega/ardupilotmega.h index 7073045599df1263febd23590aa524da5b6f7547..eec9a89c50e1bd18e9708063175983c9320c14bf 100644 --- a/libs/mavlink/include/mavlink/v1.0/ardupilotmega/ardupilotmega.h +++ b/libs/mavlink/include/mavlink/v1.0/ardupilotmega/ardupilotmega.h @@ -12,15 +12,15 @@ extern "C" { // MESSAGE LENGTHS AND CRCS #ifndef MAVLINK_MESSAGE_LENGTHS -#define MAVLINK_MESSAGE_LENGTHS {9, 31, 12, 0, 14, 28, 3, 32, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 20, 2, 25, 23, 30, 101, 22, 26, 16, 14, 28, 32, 28, 28, 22, 22, 21, 6, 6, 37, 4, 4, 2, 2, 4, 2, 2, 3, 13, 12, 19, 17, 15, 15, 27, 25, 18, 18, 20, 20, 9, 34, 26, 46, 36, 0, 6, 4, 0, 11, 18, 0, 0, 0, 20, 0, 33, 3, 0, 0, 20, 22, 0, 0, 0, 0, 0, 0, 0, 28, 56, 42, 33, 0, 0, 0, 0, 0, 0, 0, 26, 32, 32, 20, 32, 62, 54, 88, 44, 9, 254, 249, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 33, 25, 42, 8, 4, 12, 15, 13, 6, 15, 14, 0, 12, 3, 8, 28, 44, 3, 9, 22, 12, 18, 34, 66, 98, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 30, 18, 18, 51, 9, 0} +#define MAVLINK_MESSAGE_LENGTHS {9, 31, 12, 0, 14, 28, 3, 32, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 20, 2, 25, 23, 30, 101, 22, 26, 16, 14, 28, 32, 28, 28, 22, 22, 21, 6, 6, 37, 4, 4, 2, 2, 4, 2, 2, 3, 13, 12, 19, 17, 15, 15, 27, 25, 18, 18, 20, 20, 9, 34, 26, 46, 36, 0, 6, 4, 0, 11, 18, 0, 0, 0, 20, 0, 33, 3, 0, 0, 20, 22, 0, 0, 0, 0, 0, 0, 0, 28, 56, 42, 33, 0, 0, 0, 0, 0, 0, 0, 26, 32, 32, 20, 32, 62, 54, 64, 84, 9, 254, 249, 9, 36, 26, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 33, 25, 42, 8, 4, 12, 15, 13, 6, 15, 14, 0, 12, 3, 8, 28, 44, 3, 9, 22, 12, 18, 34, 66, 98, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 30, 18, 18, 51, 9, 0} #endif #ifndef MAVLINK_MESSAGE_CRCS -#define MAVLINK_MESSAGE_CRCS {50, 124, 137, 0, 237, 217, 104, 119, 0, 0, 0, 89, 0, 0, 0, 0, 0, 0, 0, 0, 214, 159, 220, 168, 24, 23, 170, 144, 67, 115, 39, 246, 185, 104, 237, 244, 222, 212, 9, 254, 230, 28, 28, 132, 221, 232, 11, 153, 41, 39, 214, 223, 141, 33, 15, 3, 100, 24, 239, 238, 30, 240, 183, 130, 130, 0, 148, 21, 0, 243, 124, 0, 0, 0, 20, 0, 152, 143, 0, 0, 127, 106, 0, 0, 0, 0, 0, 0, 0, 231, 183, 63, 54, 0, 0, 0, 0, 0, 0, 0, 175, 102, 158, 208, 56, 93, 211, 5, 212, 185, 235, 93, 124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 241, 15, 134, 219, 208, 188, 84, 22, 19, 21, 134, 0, 78, 68, 189, 127, 111, 21, 21, 144, 1, 234, 73, 181, 22, 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 204, 49, 170, 44, 83, 46, 0} +#define MAVLINK_MESSAGE_CRCS {50, 124, 137, 0, 237, 217, 104, 119, 0, 0, 0, 89, 0, 0, 0, 0, 0, 0, 0, 0, 214, 159, 220, 168, 24, 23, 170, 144, 67, 115, 39, 246, 185, 104, 237, 244, 222, 212, 9, 254, 230, 28, 28, 132, 221, 232, 11, 153, 41, 39, 214, 223, 141, 33, 15, 3, 100, 24, 239, 238, 30, 240, 183, 130, 130, 0, 148, 21, 0, 243, 124, 0, 0, 0, 20, 0, 152, 143, 0, 0, 127, 106, 0, 0, 0, 0, 0, 0, 0, 231, 183, 63, 54, 0, 0, 0, 0, 0, 0, 0, 175, 102, 158, 208, 56, 93, 211, 108, 32, 185, 235, 93, 124, 124, 119, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 241, 15, 134, 219, 208, 188, 84, 22, 19, 21, 134, 0, 78, 68, 189, 127, 111, 21, 21, 144, 1, 234, 73, 181, 22, 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 204, 49, 170, 44, 83, 46, 0} #endif #ifndef MAVLINK_MESSAGE_INFO -#define MAVLINK_MESSAGE_INFO {MAVLINK_MESSAGE_INFO_HEARTBEAT, MAVLINK_MESSAGE_INFO_SYS_STATUS, MAVLINK_MESSAGE_INFO_SYSTEM_TIME, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_PING, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL_ACK, MAVLINK_MESSAGE_INFO_AUTH_KEY, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_SET_MODE, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_VALUE, MAVLINK_MESSAGE_INFO_PARAM_SET, MAVLINK_MESSAGE_INFO_GPS_RAW_INT, MAVLINK_MESSAGE_INFO_GPS_STATUS, MAVLINK_MESSAGE_INFO_SCALED_IMU, MAVLINK_MESSAGE_INFO_RAW_IMU, MAVLINK_MESSAGE_INFO_RAW_PRESSURE, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE, MAVLINK_MESSAGE_INFO_ATTITUDE, MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT, MAVLINK_MESSAGE_INFO_RC_CHANNELS_SCALED, MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW, MAVLINK_MESSAGE_INFO_SERVO_OUTPUT_RAW, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_WRITE_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_ITEM, MAVLINK_MESSAGE_INFO_MISSION_REQUEST, MAVLINK_MESSAGE_INFO_MISSION_SET_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_LIST, MAVLINK_MESSAGE_INFO_MISSION_COUNT, MAVLINK_MESSAGE_INFO_MISSION_CLEAR_ALL, MAVLINK_MESSAGE_INFO_MISSION_ITEM_REACHED, MAVLINK_MESSAGE_INFO_MISSION_ACK, MAVLINK_MESSAGE_INFO_SET_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_SET_LOCAL_POSITION_SETPOINT, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_SETPOINT, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_SETPOINT_INT, MAVLINK_MESSAGE_INFO_SET_GLOBAL_POSITION_SETPOINT_INT, MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SET_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_SET_ROLL_PITCH_YAW_SPEED_THRUST, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_SET_QUAD_MOTORS_SETPOINT, MAVLINK_MESSAGE_INFO_SET_QUAD_SWARM_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_NAV_CONTROLLER_OUTPUT, MAVLINK_MESSAGE_INFO_SET_QUAD_SWARM_LED_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_STATE_CORRECTION, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_REQUEST_DATA_STREAM, MAVLINK_MESSAGE_INFO_DATA_STREAM, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_RC_CHANNELS_OVERRIDE, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_VFR_HUD, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_COMMAND_LONG, MAVLINK_MESSAGE_INFO_COMMAND_ACK, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_RATES_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_MANUAL_SETPOINT, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET, MAVLINK_MESSAGE_INFO_HIL_STATE, MAVLINK_MESSAGE_INFO_HIL_CONTROLS, MAVLINK_MESSAGE_INFO_HIL_RC_INPUTS_RAW, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_GLOBAL_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_SPEED_ESTIMATE, MAVLINK_MESSAGE_INFO_VICON_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_HIGHRES_IMU, MAVLINK_MESSAGE_INFO_OMNIDIRECTIONAL_FLOW, MAVLINK_MESSAGE_INFO_HIL_SENSOR, MAVLINK_MESSAGE_INFO_SIM_STATE, MAVLINK_MESSAGE_INFO_RADIO_STATUS, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_START, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_DIR_LIST, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_RES, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_BATTERY_STATUS, MAVLINK_MESSAGE_INFO_SETPOINT_8DOF, MAVLINK_MESSAGE_INFO_SETPOINT_6DOF, MAVLINK_MESSAGE_INFO_SENSOR_OFFSETS, MAVLINK_MESSAGE_INFO_SET_MAG_OFFSETS, MAVLINK_MESSAGE_INFO_MEMINFO, MAVLINK_MESSAGE_INFO_AP_ADC, MAVLINK_MESSAGE_INFO_DIGICAM_CONFIGURE, MAVLINK_MESSAGE_INFO_DIGICAM_CONTROL, MAVLINK_MESSAGE_INFO_MOUNT_CONFIGURE, MAVLINK_MESSAGE_INFO_MOUNT_CONTROL, MAVLINK_MESSAGE_INFO_MOUNT_STATUS, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_FENCE_POINT, MAVLINK_MESSAGE_INFO_FENCE_FETCH_POINT, MAVLINK_MESSAGE_INFO_FENCE_STATUS, MAVLINK_MESSAGE_INFO_AHRS, MAVLINK_MESSAGE_INFO_SIMSTATE, MAVLINK_MESSAGE_INFO_HWSTATUS, MAVLINK_MESSAGE_INFO_RADIO, MAVLINK_MESSAGE_INFO_LIMITS_STATUS, MAVLINK_MESSAGE_INFO_WIND, MAVLINK_MESSAGE_INFO_DATA16, MAVLINK_MESSAGE_INFO_DATA32, MAVLINK_MESSAGE_INFO_DATA64, MAVLINK_MESSAGE_INFO_DATA96, MAVLINK_MESSAGE_INFO_RANGEFINDER, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_MEMORY_VECT, MAVLINK_MESSAGE_INFO_DEBUG_VECT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_FLOAT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_INT, MAVLINK_MESSAGE_INFO_STATUSTEXT, MAVLINK_MESSAGE_INFO_DEBUG, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}} +#define MAVLINK_MESSAGE_INFO {MAVLINK_MESSAGE_INFO_HEARTBEAT, MAVLINK_MESSAGE_INFO_SYS_STATUS, MAVLINK_MESSAGE_INFO_SYSTEM_TIME, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_PING, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL_ACK, MAVLINK_MESSAGE_INFO_AUTH_KEY, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_SET_MODE, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_VALUE, MAVLINK_MESSAGE_INFO_PARAM_SET, MAVLINK_MESSAGE_INFO_GPS_RAW_INT, MAVLINK_MESSAGE_INFO_GPS_STATUS, MAVLINK_MESSAGE_INFO_SCALED_IMU, MAVLINK_MESSAGE_INFO_RAW_IMU, MAVLINK_MESSAGE_INFO_RAW_PRESSURE, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE, MAVLINK_MESSAGE_INFO_ATTITUDE, MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT, MAVLINK_MESSAGE_INFO_RC_CHANNELS_SCALED, MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW, MAVLINK_MESSAGE_INFO_SERVO_OUTPUT_RAW, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_WRITE_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_ITEM, MAVLINK_MESSAGE_INFO_MISSION_REQUEST, MAVLINK_MESSAGE_INFO_MISSION_SET_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_LIST, MAVLINK_MESSAGE_INFO_MISSION_COUNT, MAVLINK_MESSAGE_INFO_MISSION_CLEAR_ALL, MAVLINK_MESSAGE_INFO_MISSION_ITEM_REACHED, MAVLINK_MESSAGE_INFO_MISSION_ACK, MAVLINK_MESSAGE_INFO_SET_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_SET_LOCAL_POSITION_SETPOINT, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_SETPOINT, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_SETPOINT_INT, MAVLINK_MESSAGE_INFO_SET_GLOBAL_POSITION_SETPOINT_INT, MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SET_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_SET_ROLL_PITCH_YAW_SPEED_THRUST, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_SET_QUAD_MOTORS_SETPOINT, MAVLINK_MESSAGE_INFO_SET_QUAD_SWARM_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_NAV_CONTROLLER_OUTPUT, MAVLINK_MESSAGE_INFO_SET_QUAD_SWARM_LED_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_STATE_CORRECTION, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_REQUEST_DATA_STREAM, MAVLINK_MESSAGE_INFO_DATA_STREAM, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_RC_CHANNELS_OVERRIDE, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_VFR_HUD, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_COMMAND_LONG, MAVLINK_MESSAGE_INFO_COMMAND_ACK, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_RATES_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_MANUAL_SETPOINT, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET, MAVLINK_MESSAGE_INFO_HIL_STATE, MAVLINK_MESSAGE_INFO_HIL_CONTROLS, MAVLINK_MESSAGE_INFO_HIL_RC_INPUTS_RAW, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_GLOBAL_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_SPEED_ESTIMATE, MAVLINK_MESSAGE_INFO_VICON_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_HIGHRES_IMU, MAVLINK_MESSAGE_INFO_OMNIDIRECTIONAL_FLOW, MAVLINK_MESSAGE_INFO_HIL_SENSOR, MAVLINK_MESSAGE_INFO_SIM_STATE, MAVLINK_MESSAGE_INFO_RADIO_STATUS, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_START, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_DIR_LIST, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_RES, MAVLINK_MESSAGE_INFO_HIL_GPS, MAVLINK_MESSAGE_INFO_HIL_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_HIL_STATE_QUATERNION, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_BATTERY_STATUS, MAVLINK_MESSAGE_INFO_SETPOINT_8DOF, MAVLINK_MESSAGE_INFO_SETPOINT_6DOF, MAVLINK_MESSAGE_INFO_SENSOR_OFFSETS, MAVLINK_MESSAGE_INFO_SET_MAG_OFFSETS, MAVLINK_MESSAGE_INFO_MEMINFO, MAVLINK_MESSAGE_INFO_AP_ADC, MAVLINK_MESSAGE_INFO_DIGICAM_CONFIGURE, MAVLINK_MESSAGE_INFO_DIGICAM_CONTROL, MAVLINK_MESSAGE_INFO_MOUNT_CONFIGURE, MAVLINK_MESSAGE_INFO_MOUNT_CONTROL, MAVLINK_MESSAGE_INFO_MOUNT_STATUS, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_FENCE_POINT, MAVLINK_MESSAGE_INFO_FENCE_FETCH_POINT, MAVLINK_MESSAGE_INFO_FENCE_STATUS, MAVLINK_MESSAGE_INFO_AHRS, MAVLINK_MESSAGE_INFO_SIMSTATE, MAVLINK_MESSAGE_INFO_HWSTATUS, MAVLINK_MESSAGE_INFO_RADIO, MAVLINK_MESSAGE_INFO_LIMITS_STATUS, MAVLINK_MESSAGE_INFO_WIND, MAVLINK_MESSAGE_INFO_DATA16, MAVLINK_MESSAGE_INFO_DATA32, MAVLINK_MESSAGE_INFO_DATA64, MAVLINK_MESSAGE_INFO_DATA96, MAVLINK_MESSAGE_INFO_RANGEFINDER, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_MEMORY_VECT, MAVLINK_MESSAGE_INFO_DEBUG_VECT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_FLOAT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_INT, MAVLINK_MESSAGE_INFO_STATUSTEXT, MAVLINK_MESSAGE_INFO_DEBUG, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}} #endif #include "../protocol.h" diff --git a/libs/mavlink/include/mavlink/v1.0/ardupilotmega/version.h b/libs/mavlink/include/mavlink/v1.0/ardupilotmega/version.h index 7e10f050cac7d2bea5bc6664f954adf307948595..852b94b55f99f38a72749aee06374edf57e68ea5 100644 --- a/libs/mavlink/include/mavlink/v1.0/ardupilotmega/version.h +++ b/libs/mavlink/include/mavlink/v1.0/ardupilotmega/version.h @@ -5,7 +5,7 @@ #ifndef MAVLINK_VERSION_H #define MAVLINK_VERSION_H -#define MAVLINK_BUILD_DATE "Fri Jun 7 22:41:53 2013" +#define MAVLINK_BUILD_DATE "Thu Jul 4 13:11:17 2013" #define MAVLINK_WIRE_PROTOCOL_VERSION "1.0" #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 254 diff --git a/libs/mavlink/include/mavlink/v1.0/autoquad/autoquad.h b/libs/mavlink/include/mavlink/v1.0/autoquad/autoquad.h new file mode 100644 index 0000000000000000000000000000000000000000..cc020b9d288bf656e7d5d045362aacab661d1552 --- /dev/null +++ b/libs/mavlink/include/mavlink/v1.0/autoquad/autoquad.h @@ -0,0 +1,97 @@ +/** @file + * @brief MAVLink comm protocol generated from autoquad.xml + * @see http://qgroundcontrol.org/mavlink/ + */ +#ifndef AUTOQUAD_H +#define AUTOQUAD_H + +#ifdef __cplusplus +extern "C" { +#endif + +// MESSAGE LENGTHS AND CRCS + +#ifndef MAVLINK_MESSAGE_LENGTHS +#define MAVLINK_MESSAGE_LENGTHS {9, 31, 12, 0, 14, 28, 3, 32, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 20, 2, 25, 23, 30, 101, 22, 26, 16, 14, 28, 32, 28, 28, 22, 22, 21, 6, 6, 37, 4, 4, 2, 2, 4, 2, 2, 3, 13, 12, 19, 17, 15, 15, 27, 25, 18, 18, 20, 20, 9, 34, 26, 46, 36, 0, 6, 4, 0, 11, 18, 0, 0, 0, 20, 0, 33, 3, 0, 0, 20, 22, 0, 0, 0, 0, 0, 0, 0, 28, 56, 42, 33, 0, 0, 0, 0, 0, 0, 0, 26, 32, 32, 20, 32, 62, 54, 64, 84, 9, 254, 249, 9, 36, 26, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 33, 25, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 30, 18, 18, 51, 9, 0} +#endif + +#ifndef MAVLINK_MESSAGE_CRCS +#define MAVLINK_MESSAGE_CRCS {50, 124, 137, 0, 237, 217, 104, 119, 0, 0, 0, 89, 0, 0, 0, 0, 0, 0, 0, 0, 214, 159, 220, 168, 24, 23, 170, 144, 67, 115, 39, 246, 185, 104, 237, 244, 222, 212, 9, 254, 230, 28, 28, 132, 221, 232, 11, 153, 41, 39, 214, 223, 141, 33, 15, 3, 100, 24, 239, 238, 30, 240, 183, 130, 130, 0, 148, 21, 0, 243, 124, 0, 0, 0, 20, 0, 152, 143, 0, 0, 127, 106, 0, 0, 0, 0, 0, 0, 0, 231, 183, 63, 54, 0, 0, 0, 0, 0, 0, 0, 175, 102, 158, 208, 56, 93, 211, 108, 32, 185, 235, 93, 124, 124, 119, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 241, 15, 241, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 204, 49, 170, 44, 83, 46, 0} +#endif + +#ifndef MAVLINK_MESSAGE_INFO +#define MAVLINK_MESSAGE_INFO {MAVLINK_MESSAGE_INFO_HEARTBEAT, MAVLINK_MESSAGE_INFO_SYS_STATUS, MAVLINK_MESSAGE_INFO_SYSTEM_TIME, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_PING, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL_ACK, MAVLINK_MESSAGE_INFO_AUTH_KEY, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_SET_MODE, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_VALUE, MAVLINK_MESSAGE_INFO_PARAM_SET, MAVLINK_MESSAGE_INFO_GPS_RAW_INT, MAVLINK_MESSAGE_INFO_GPS_STATUS, MAVLINK_MESSAGE_INFO_SCALED_IMU, MAVLINK_MESSAGE_INFO_RAW_IMU, MAVLINK_MESSAGE_INFO_RAW_PRESSURE, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE, MAVLINK_MESSAGE_INFO_ATTITUDE, MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT, MAVLINK_MESSAGE_INFO_RC_CHANNELS_SCALED, MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW, MAVLINK_MESSAGE_INFO_SERVO_OUTPUT_RAW, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_WRITE_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_ITEM, MAVLINK_MESSAGE_INFO_MISSION_REQUEST, MAVLINK_MESSAGE_INFO_MISSION_SET_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_LIST, MAVLINK_MESSAGE_INFO_MISSION_COUNT, MAVLINK_MESSAGE_INFO_MISSION_CLEAR_ALL, MAVLINK_MESSAGE_INFO_MISSION_ITEM_REACHED, MAVLINK_MESSAGE_INFO_MISSION_ACK, MAVLINK_MESSAGE_INFO_SET_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_SET_LOCAL_POSITION_SETPOINT, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_SETPOINT, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_SETPOINT_INT, MAVLINK_MESSAGE_INFO_SET_GLOBAL_POSITION_SETPOINT_INT, MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SET_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_SET_ROLL_PITCH_YAW_SPEED_THRUST, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_SET_QUAD_MOTORS_SETPOINT, MAVLINK_MESSAGE_INFO_SET_QUAD_SWARM_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_NAV_CONTROLLER_OUTPUT, MAVLINK_MESSAGE_INFO_SET_QUAD_SWARM_LED_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_STATE_CORRECTION, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_REQUEST_DATA_STREAM, MAVLINK_MESSAGE_INFO_DATA_STREAM, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_RC_CHANNELS_OVERRIDE, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_VFR_HUD, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_COMMAND_LONG, MAVLINK_MESSAGE_INFO_COMMAND_ACK, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_RATES_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_MANUAL_SETPOINT, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET, MAVLINK_MESSAGE_INFO_HIL_STATE, MAVLINK_MESSAGE_INFO_HIL_CONTROLS, MAVLINK_MESSAGE_INFO_HIL_RC_INPUTS_RAW, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_GLOBAL_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_SPEED_ESTIMATE, MAVLINK_MESSAGE_INFO_VICON_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_HIGHRES_IMU, MAVLINK_MESSAGE_INFO_OMNIDIRECTIONAL_FLOW, MAVLINK_MESSAGE_INFO_HIL_SENSOR, MAVLINK_MESSAGE_INFO_SIM_STATE, MAVLINK_MESSAGE_INFO_RADIO_STATUS, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_START, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_DIR_LIST, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_RES, MAVLINK_MESSAGE_INFO_HIL_GPS, MAVLINK_MESSAGE_INFO_HIL_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_HIL_STATE_QUATERNION, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_BATTERY_STATUS, MAVLINK_MESSAGE_INFO_SETPOINT_8DOF, MAVLINK_MESSAGE_INFO_SETPOINT_6DOF, MAVLINK_MESSAGE_INFO_AQ_TELEMETRY_F, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_MEMORY_VECT, MAVLINK_MESSAGE_INFO_DEBUG_VECT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_FLOAT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_INT, MAVLINK_MESSAGE_INFO_STATUSTEXT, MAVLINK_MESSAGE_INFO_DEBUG, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}} +#endif + +#include "../protocol.h" + +#define MAVLINK_ENABLED_AUTOQUAD + +// ENUM DEFINITIONS + + +/** @brief */ +#ifndef HAVE_ENUM_MAV_CMD +#define HAVE_ENUM_MAV_CMD +enum MAV_CMD +{ + MAV_CMD_AQ_TELEMETRY=2, /* Start/stop AutoQuad telemetry values stream. |Start or stop (1 or 0)| Stream frequency in us| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_AQ_FOLLOW=3, /* Command AutoQuad to go to a particular place at a set speed. |Latitude| Lontitude| Altitude| Speed| Empty| Empty| Empty| */ + MAV_CMD_AQ_REQUEST_VERSION=4, /* Request AutoQuad firmware version number. |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_NAV_WAYPOINT=16, /* Navigate to MISSION. |Hold time in decimal seconds. (ignored by fixed wing, time to stay at MISSION for rotary wing)| Acceptance radius in meters (if the sphere with this radius is hit, the MISSION counts as reached)| 0 to pass through the WP, if > 0 radius in meters to pass by WP. Positive value for clockwise orbit, negative value for counter-clockwise orbit. Allows trajectory control.| Desired yaw angle at MISSION (rotary wing)| Latitude| Longitude| Altitude| */ + MAV_CMD_NAV_LOITER_UNLIM=17, /* Loiter around this MISSION an unlimited amount of time |Empty| Empty| Radius around MISSION, in meters. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| */ + MAV_CMD_NAV_LOITER_TURNS=18, /* Loiter around this MISSION for X turns |Turns| Empty| Radius around MISSION, in meters. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| */ + MAV_CMD_NAV_LOITER_TIME=19, /* Loiter around this MISSION for X seconds |Seconds (decimal)| Empty| Radius around MISSION, in meters. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| */ + MAV_CMD_NAV_RETURN_TO_LAUNCH=20, /* Return to launch location |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_NAV_LAND=21, /* Land at location |Empty| Empty| Empty| Desired yaw angle.| Latitude| Longitude| Altitude| */ + MAV_CMD_NAV_TAKEOFF=22, /* Takeoff from ground / hand |Minimum pitch (if airspeed sensor present), desired pitch without sensor| Empty| Empty| Yaw angle (if magnetometer present), ignored without magnetometer| Latitude| Longitude| Altitude| */ + MAV_CMD_NAV_ROI=80, /* Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicles control system to control the vehicle attitude and the attitude of various sensors such as cameras. |Region of intereset mode. (see MAV_ROI enum)| MISSION index/ target ID. (see MAV_ROI enum)| ROI index (allows a vehicle to manage multiple ROI's)| Empty| x the location of the fixed ROI (see MAV_FRAME)| y| z| */ + MAV_CMD_NAV_PATHPLANNING=81, /* Control autonomous path planning on the MAV. |0: Disable local obstacle avoidance / local path planning (without resetting map), 1: Enable local path planning, 2: Enable and reset local path planning| 0: Disable full path planning (without resetting map), 1: Enable, 2: Enable and reset map/occupancy grid, 3: Enable and reset planned route, but not occupancy grid| Empty| Yaw angle at goal, in compass degrees, [0..360]| Latitude/X of goal| Longitude/Y of goal| Altitude/Z of goal| */ + MAV_CMD_NAV_LAST=95, /* NOP - This command is only used to mark the upper limit of the NAV/ACTION commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_CONDITION_DELAY=112, /* Delay mission state machine. |Delay in seconds (decimal)| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_CONDITION_CHANGE_ALT=113, /* Ascend/descend at rate. Delay mission state machine until desired altitude reached. |Descent / Ascend rate (m/s)| Empty| Empty| Empty| Empty| Empty| Finish Altitude| */ + MAV_CMD_CONDITION_DISTANCE=114, /* Delay mission state machine until within desired distance of next NAV point. |Distance (meters)| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_CONDITION_YAW=115, /* Reach a certain target angle. |target angle: [0-360], 0 is north| speed during yaw change:[deg per second]| direction: negative: counter clockwise, positive: clockwise [-1,1]| relative offset or absolute angle: [ 1,0]| Empty| Empty| Empty| */ + MAV_CMD_CONDITION_LAST=159, /* NOP - This command is only used to mark the upper limit of the CONDITION commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_SET_MODE=176, /* Set system mode. |Mode, as defined by ENUM MAV_MODE| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_JUMP=177, /* Jump to the desired command in the mission list. Repeat this action only the specified number of times |Sequence number| Repeat count| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_CHANGE_SPEED=178, /* Change speed and/or throttle set points. |Speed type (0=Airspeed, 1=Ground Speed)| Speed (m/s, -1 indicates no change)| Throttle ( Percent, -1 indicates no change)| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_SET_HOME=179, /* Changes the home location either to the current location or a specified location. |Use current (1=use current location, 0=use specified location)| Empty| Empty| Empty| Latitude| Longitude| Altitude| */ + MAV_CMD_DO_SET_PARAMETER=180, /* Set a system parameter. Caution! Use of this command requires knowledge of the numeric enumeration value of the parameter. |Parameter number| Parameter value| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_SET_RELAY=181, /* Set a relay to a condition. |Relay number| Setting (1=on, 0=off, others possible depending on system hardware)| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_REPEAT_RELAY=182, /* Cycle a relay on and off for a desired number of cyles with a desired period. |Relay number| Cycle count| Cycle time (seconds, decimal)| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_SET_SERVO=183, /* Set a servo to a desired PWM value. |Servo number| PWM (microseconds, 1000 to 2000 typical)| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_REPEAT_SERVO=184, /* Cycle a between its nominal setting and a desired PWM for a desired number of cycles with a desired period. |Servo number| PWM (microseconds, 1000 to 2000 typical)| Cycle count| Cycle time (seconds)| Empty| Empty| Empty| */ + MAV_CMD_DO_CONTROL_VIDEO=200, /* Control onboard camera system. |Camera ID (-1 for all)| Transmission: 0: disabled, 1: enabled compressed, 2: enabled raw| Transmission mode: 0: video stream, >0: single images every n seconds (decimal)| Recording: 0: disabled, 1: enabled compressed, 2: enabled raw| Empty| Empty| Empty| */ + MAV_CMD_DO_LAST=240, /* NOP - This command is only used to mark the upper limit of the DO commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_PREFLIGHT_CALIBRATION=241, /* Trigger calibration. This command will be only accepted if in pre-flight mode. |Gyro calibration: 0: no, 1: yes| Magnetometer calibration: 0: no, 1: yes| Ground pressure: 0: no, 1: yes| Radio calibration: 0: no, 1: yes| Accelerometer calibration: 0: no, 1: yes| Empty| Empty| */ + MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS=242, /* Set sensor offsets. This command will be only accepted if in pre-flight mode. |Sensor to adjust the offsets for: 0: gyros, 1: accelerometer, 2: magnetometer, 3: barometer, 4: optical flow| X axis offset (or generic dimension 1), in the sensor's raw units| Y axis offset (or generic dimension 2), in the sensor's raw units| Z axis offset (or generic dimension 3), in the sensor's raw units| Generic dimension 4, in the sensor's raw units| Generic dimension 5, in the sensor's raw units| Generic dimension 6, in the sensor's raw units| */ + MAV_CMD_PREFLIGHT_STORAGE=245, /* Request storage of different parameter values and logs. This command will be only accepted if in pre-flight mode. |Parameter storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM| Mission storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM| Reserved| Reserved| Empty| Empty| Empty| */ + MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN=246, /* Request the reboot or shutdown of system components. |0: Do nothing for autopilot, 1: Reboot autopilot, 2: Shutdown autopilot.| 0: Do nothing for onboard computer, 1: Reboot onboard computer, 2: Shutdown onboard computer.| Reserved| Reserved| Empty| Empty| Empty| */ + MAV_CMD_OVERRIDE_GOTO=252, /* Hold / continue the current action |MAV_GOTO_DO_HOLD: hold MAV_GOTO_DO_CONTINUE: continue with next item in mission plan| MAV_GOTO_HOLD_AT_CURRENT_POSITION: Hold at current position MAV_GOTO_HOLD_AT_SPECIFIED_POSITION: hold at specified position| MAV_FRAME coordinate frame of hold point| Desired yaw angle in degrees| Latitude / X position| Longitude / Y position| Altitude / Z position| */ + MAV_CMD_MISSION_START=300, /* start running a mission |first_item: the first mission item to run| last_item: the last mission item to run (after this item is run, the mission ends)| */ + MAV_CMD_COMPONENT_ARM_DISARM=400, /* Arms / Disarms a component |1 to arm, 0 to disarm| */ + MAV_CMD_ENUM_END=401, /* | */ +}; +#endif + +#include "../common/common.h" + +// MAVLINK VERSION + +#ifndef MAVLINK_VERSION +#define MAVLINK_VERSION 3 +#endif + +#if (MAVLINK_VERSION == 0) +#undef MAVLINK_VERSION +#define MAVLINK_VERSION 3 +#endif + +// MESSAGE DEFINITIONS +#include "./mavlink_msg_aq_telemetry_f.h" + +#ifdef __cplusplus +} +#endif // __cplusplus +#endif // AUTOQUAD_H diff --git a/libs/mavlink/include/mavlink/v1.0/autoquad/mavlink.h b/libs/mavlink/include/mavlink/v1.0/autoquad/mavlink.h new file mode 100644 index 0000000000000000000000000000000000000000..3f80c9a41e2e6438eb12d4b72c52d9d8374644dc --- /dev/null +++ b/libs/mavlink/include/mavlink/v1.0/autoquad/mavlink.h @@ -0,0 +1,27 @@ +/** @file + * @brief MAVLink comm protocol built from autoquad.xml + * @see http://pixhawk.ethz.ch/software/mavlink + */ +#ifndef MAVLINK_H +#define MAVLINK_H + +#ifndef MAVLINK_STX +#define MAVLINK_STX 254 +#endif + +#ifndef MAVLINK_ENDIAN +#define MAVLINK_ENDIAN MAVLINK_LITTLE_ENDIAN +#endif + +#ifndef MAVLINK_ALIGNED_FIELDS +#define MAVLINK_ALIGNED_FIELDS 1 +#endif + +#ifndef MAVLINK_CRC_EXTRA +#define MAVLINK_CRC_EXTRA 1 +#endif + +#include "version.h" +#include "autoquad.h" + +#endif // MAVLINK_H diff --git a/libs/mavlink/include/mavlink/v1.0/autoquad/mavlink_msg_aq_telemetry_f.h b/libs/mavlink/include/mavlink/v1.0/autoquad/mavlink_msg_aq_telemetry_f.h new file mode 100644 index 0000000000000000000000000000000000000000..dabccdf733ac89e383291dba5157d4ed47dcb982 --- /dev/null +++ b/libs/mavlink/include/mavlink/v1.0/autoquad/mavlink_msg_aq_telemetry_f.h @@ -0,0 +1,603 @@ +// MESSAGE AQ_TELEMETRY_F PACKING + +#define MAVLINK_MSG_ID_AQ_TELEMETRY_F 150 + +typedef struct __mavlink_aq_telemetry_f_t +{ + float value1; ///< value1 + float value2; ///< value2 + float value3; ///< value3 + float value4; ///< value4 + float value5; ///< value5 + float value6; ///< value6 + float value7; ///< value7 + float value8; ///< value8 + float value9; ///< value9 + float value10; ///< value10 + float value11; ///< value11 + float value12; ///< value12 + float value13; ///< value13 + float value14; ///< value14 + float value15; ///< value15 + float value16; ///< value16 + float value17; ///< value17 + float value18; ///< value18 + float value19; ///< value19 + float value20; ///< value20 + uint16_t Index; ///< Index of message +} mavlink_aq_telemetry_f_t; + +#define MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN 82 +#define MAVLINK_MSG_ID_150_LEN 82 + +#define MAVLINK_MSG_ID_AQ_TELEMETRY_F_CRC 241 +#define MAVLINK_MSG_ID_150_CRC 241 + + + +#define MAVLINK_MESSAGE_INFO_AQ_TELEMETRY_F { \ + "AQ_TELEMETRY_F", \ + 21, \ + { { "value1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_aq_telemetry_f_t, value1) }, \ + { "value2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_aq_telemetry_f_t, value2) }, \ + { "value3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_aq_telemetry_f_t, value3) }, \ + { "value4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_aq_telemetry_f_t, value4) }, \ + { "value5", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_aq_telemetry_f_t, value5) }, \ + { "value6", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_aq_telemetry_f_t, value6) }, \ + { "value7", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_aq_telemetry_f_t, value7) }, \ + { "value8", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_aq_telemetry_f_t, value8) }, \ + { "value9", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_aq_telemetry_f_t, value9) }, \ + { "value10", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_aq_telemetry_f_t, value10) }, \ + { "value11", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_aq_telemetry_f_t, value11) }, \ + { "value12", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_aq_telemetry_f_t, value12) }, \ + { "value13", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_aq_telemetry_f_t, value13) }, \ + { "value14", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_aq_telemetry_f_t, value14) }, \ + { "value15", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_aq_telemetry_f_t, value15) }, \ + { "value16", NULL, MAVLINK_TYPE_FLOAT, 0, 60, offsetof(mavlink_aq_telemetry_f_t, value16) }, \ + { "value17", NULL, MAVLINK_TYPE_FLOAT, 0, 64, offsetof(mavlink_aq_telemetry_f_t, value17) }, \ + { "value18", NULL, MAVLINK_TYPE_FLOAT, 0, 68, offsetof(mavlink_aq_telemetry_f_t, value18) }, \ + { "value19", NULL, MAVLINK_TYPE_FLOAT, 0, 72, offsetof(mavlink_aq_telemetry_f_t, value19) }, \ + { "value20", NULL, MAVLINK_TYPE_FLOAT, 0, 76, offsetof(mavlink_aq_telemetry_f_t, value20) }, \ + { "Index", NULL, MAVLINK_TYPE_UINT16_T, 0, 80, offsetof(mavlink_aq_telemetry_f_t, Index) }, \ + } \ +} + + +/** + * @brief Pack a aq_telemetry_f message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param Index Index of message + * @param value1 value1 + * @param value2 value2 + * @param value3 value3 + * @param value4 value4 + * @param value5 value5 + * @param value6 value6 + * @param value7 value7 + * @param value8 value8 + * @param value9 value9 + * @param value10 value10 + * @param value11 value11 + * @param value12 value12 + * @param value13 value13 + * @param value14 value14 + * @param value15 value15 + * @param value16 value16 + * @param value17 value17 + * @param value18 value18 + * @param value19 value19 + * @param value20 value20 + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_aq_telemetry_f_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint16_t Index, float value1, float value2, float value3, float value4, float value5, float value6, float value7, float value8, float value9, float value10, float value11, float value12, float value13, float value14, float value15, float value16, float value17, float value18, float value19, float value20) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN]; + _mav_put_float(buf, 0, value1); + _mav_put_float(buf, 4, value2); + _mav_put_float(buf, 8, value3); + _mav_put_float(buf, 12, value4); + _mav_put_float(buf, 16, value5); + _mav_put_float(buf, 20, value6); + _mav_put_float(buf, 24, value7); + _mav_put_float(buf, 28, value8); + _mav_put_float(buf, 32, value9); + _mav_put_float(buf, 36, value10); + _mav_put_float(buf, 40, value11); + _mav_put_float(buf, 44, value12); + _mav_put_float(buf, 48, value13); + _mav_put_float(buf, 52, value14); + _mav_put_float(buf, 56, value15); + _mav_put_float(buf, 60, value16); + _mav_put_float(buf, 64, value17); + _mav_put_float(buf, 68, value18); + _mav_put_float(buf, 72, value19); + _mav_put_float(buf, 76, value20); + _mav_put_uint16_t(buf, 80, Index); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN); +#else + mavlink_aq_telemetry_f_t packet; + packet.value1 = value1; + packet.value2 = value2; + packet.value3 = value3; + packet.value4 = value4; + packet.value5 = value5; + packet.value6 = value6; + packet.value7 = value7; + packet.value8 = value8; + packet.value9 = value9; + packet.value10 = value10; + packet.value11 = value11; + packet.value12 = value12; + packet.value13 = value13; + packet.value14 = value14; + packet.value15 = value15; + packet.value16 = value16; + packet.value17 = value17; + packet.value18 = value18; + packet.value19 = value19; + packet.value20 = value20; + packet.Index = Index; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_AQ_TELEMETRY_F; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN, MAVLINK_MSG_ID_AQ_TELEMETRY_F_CRC); +#else + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN); +#endif +} + +/** + * @brief Pack a aq_telemetry_f message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message was sent over + * @param msg The MAVLink message to compress the data into + * @param Index Index of message + * @param value1 value1 + * @param value2 value2 + * @param value3 value3 + * @param value4 value4 + * @param value5 value5 + * @param value6 value6 + * @param value7 value7 + * @param value8 value8 + * @param value9 value9 + * @param value10 value10 + * @param value11 value11 + * @param value12 value12 + * @param value13 value13 + * @param value14 value14 + * @param value15 value15 + * @param value16 value16 + * @param value17 value17 + * @param value18 value18 + * @param value19 value19 + * @param value20 value20 + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_aq_telemetry_f_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint16_t Index,float value1,float value2,float value3,float value4,float value5,float value6,float value7,float value8,float value9,float value10,float value11,float value12,float value13,float value14,float value15,float value16,float value17,float value18,float value19,float value20) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN]; + _mav_put_float(buf, 0, value1); + _mav_put_float(buf, 4, value2); + _mav_put_float(buf, 8, value3); + _mav_put_float(buf, 12, value4); + _mav_put_float(buf, 16, value5); + _mav_put_float(buf, 20, value6); + _mav_put_float(buf, 24, value7); + _mav_put_float(buf, 28, value8); + _mav_put_float(buf, 32, value9); + _mav_put_float(buf, 36, value10); + _mav_put_float(buf, 40, value11); + _mav_put_float(buf, 44, value12); + _mav_put_float(buf, 48, value13); + _mav_put_float(buf, 52, value14); + _mav_put_float(buf, 56, value15); + _mav_put_float(buf, 60, value16); + _mav_put_float(buf, 64, value17); + _mav_put_float(buf, 68, value18); + _mav_put_float(buf, 72, value19); + _mav_put_float(buf, 76, value20); + _mav_put_uint16_t(buf, 80, Index); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN); +#else + mavlink_aq_telemetry_f_t packet; + packet.value1 = value1; + packet.value2 = value2; + packet.value3 = value3; + packet.value4 = value4; + packet.value5 = value5; + packet.value6 = value6; + packet.value7 = value7; + packet.value8 = value8; + packet.value9 = value9; + packet.value10 = value10; + packet.value11 = value11; + packet.value12 = value12; + packet.value13 = value13; + packet.value14 = value14; + packet.value15 = value15; + packet.value16 = value16; + packet.value17 = value17; + packet.value18 = value18; + packet.value19 = value19; + packet.value20 = value20; + packet.Index = Index; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_AQ_TELEMETRY_F; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN, MAVLINK_MSG_ID_AQ_TELEMETRY_F_CRC); +#else + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN); +#endif +} + +/** + * @brief Encode a aq_telemetry_f struct into a message + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param aq_telemetry_f C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_aq_telemetry_f_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_aq_telemetry_f_t* aq_telemetry_f) +{ + return mavlink_msg_aq_telemetry_f_pack(system_id, component_id, msg, aq_telemetry_f->Index, aq_telemetry_f->value1, aq_telemetry_f->value2, aq_telemetry_f->value3, aq_telemetry_f->value4, aq_telemetry_f->value5, aq_telemetry_f->value6, aq_telemetry_f->value7, aq_telemetry_f->value8, aq_telemetry_f->value9, aq_telemetry_f->value10, aq_telemetry_f->value11, aq_telemetry_f->value12, aq_telemetry_f->value13, aq_telemetry_f->value14, aq_telemetry_f->value15, aq_telemetry_f->value16, aq_telemetry_f->value17, aq_telemetry_f->value18, aq_telemetry_f->value19, aq_telemetry_f->value20); +} + +/** + * @brief Send a aq_telemetry_f message + * @param chan MAVLink channel to send the message + * + * @param Index Index of message + * @param value1 value1 + * @param value2 value2 + * @param value3 value3 + * @param value4 value4 + * @param value5 value5 + * @param value6 value6 + * @param value7 value7 + * @param value8 value8 + * @param value9 value9 + * @param value10 value10 + * @param value11 value11 + * @param value12 value12 + * @param value13 value13 + * @param value14 value14 + * @param value15 value15 + * @param value16 value16 + * @param value17 value17 + * @param value18 value18 + * @param value19 value19 + * @param value20 value20 + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_aq_telemetry_f_send(mavlink_channel_t chan, uint16_t Index, float value1, float value2, float value3, float value4, float value5, float value6, float value7, float value8, float value9, float value10, float value11, float value12, float value13, float value14, float value15, float value16, float value17, float value18, float value19, float value20) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN]; + _mav_put_float(buf, 0, value1); + _mav_put_float(buf, 4, value2); + _mav_put_float(buf, 8, value3); + _mav_put_float(buf, 12, value4); + _mav_put_float(buf, 16, value5); + _mav_put_float(buf, 20, value6); + _mav_put_float(buf, 24, value7); + _mav_put_float(buf, 28, value8); + _mav_put_float(buf, 32, value9); + _mav_put_float(buf, 36, value10); + _mav_put_float(buf, 40, value11); + _mav_put_float(buf, 44, value12); + _mav_put_float(buf, 48, value13); + _mav_put_float(buf, 52, value14); + _mav_put_float(buf, 56, value15); + _mav_put_float(buf, 60, value16); + _mav_put_float(buf, 64, value17); + _mav_put_float(buf, 68, value18); + _mav_put_float(buf, 72, value19); + _mav_put_float(buf, 76, value20); + _mav_put_uint16_t(buf, 80, Index); + +#if MAVLINK_CRC_EXTRA + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AQ_TELEMETRY_F, buf, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN, MAVLINK_MSG_ID_AQ_TELEMETRY_F_CRC); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AQ_TELEMETRY_F, buf, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN); +#endif +#else + mavlink_aq_telemetry_f_t packet; + packet.value1 = value1; + packet.value2 = value2; + packet.value3 = value3; + packet.value4 = value4; + packet.value5 = value5; + packet.value6 = value6; + packet.value7 = value7; + packet.value8 = value8; + packet.value9 = value9; + packet.value10 = value10; + packet.value11 = value11; + packet.value12 = value12; + packet.value13 = value13; + packet.value14 = value14; + packet.value15 = value15; + packet.value16 = value16; + packet.value17 = value17; + packet.value18 = value18; + packet.value19 = value19; + packet.value20 = value20; + packet.Index = Index; + +#if MAVLINK_CRC_EXTRA + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AQ_TELEMETRY_F, (const char *)&packet, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN, MAVLINK_MSG_ID_AQ_TELEMETRY_F_CRC); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AQ_TELEMETRY_F, (const char *)&packet, MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN); +#endif +#endif +} + +#endif + +// MESSAGE AQ_TELEMETRY_F UNPACKING + + +/** + * @brief Get field Index from aq_telemetry_f message + * + * @return Index of message + */ +static inline uint16_t mavlink_msg_aq_telemetry_f_get_Index(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 80); +} + +/** + * @brief Get field value1 from aq_telemetry_f message + * + * @return value1 + */ +static inline float mavlink_msg_aq_telemetry_f_get_value1(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 0); +} + +/** + * @brief Get field value2 from aq_telemetry_f message + * + * @return value2 + */ +static inline float mavlink_msg_aq_telemetry_f_get_value2(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 4); +} + +/** + * @brief Get field value3 from aq_telemetry_f message + * + * @return value3 + */ +static inline float mavlink_msg_aq_telemetry_f_get_value3(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 8); +} + +/** + * @brief Get field value4 from aq_telemetry_f message + * + * @return value4 + */ +static inline float mavlink_msg_aq_telemetry_f_get_value4(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 12); +} + +/** + * @brief Get field value5 from aq_telemetry_f message + * + * @return value5 + */ +static inline float mavlink_msg_aq_telemetry_f_get_value5(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 16); +} + +/** + * @brief Get field value6 from aq_telemetry_f message + * + * @return value6 + */ +static inline float mavlink_msg_aq_telemetry_f_get_value6(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 20); +} + +/** + * @brief Get field value7 from aq_telemetry_f message + * + * @return value7 + */ +static inline float mavlink_msg_aq_telemetry_f_get_value7(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 24); +} + +/** + * @brief Get field value8 from aq_telemetry_f message + * + * @return value8 + */ +static inline float mavlink_msg_aq_telemetry_f_get_value8(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 28); +} + +/** + * @brief Get field value9 from aq_telemetry_f message + * + * @return value9 + */ +static inline float mavlink_msg_aq_telemetry_f_get_value9(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 32); +} + +/** + * @brief Get field value10 from aq_telemetry_f message + * + * @return value10 + */ +static inline float mavlink_msg_aq_telemetry_f_get_value10(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 36); +} + +/** + * @brief Get field value11 from aq_telemetry_f message + * + * @return value11 + */ +static inline float mavlink_msg_aq_telemetry_f_get_value11(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 40); +} + +/** + * @brief Get field value12 from aq_telemetry_f message + * + * @return value12 + */ +static inline float mavlink_msg_aq_telemetry_f_get_value12(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 44); +} + +/** + * @brief Get field value13 from aq_telemetry_f message + * + * @return value13 + */ +static inline float mavlink_msg_aq_telemetry_f_get_value13(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 48); +} + +/** + * @brief Get field value14 from aq_telemetry_f message + * + * @return value14 + */ +static inline float mavlink_msg_aq_telemetry_f_get_value14(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 52); +} + +/** + * @brief Get field value15 from aq_telemetry_f message + * + * @return value15 + */ +static inline float mavlink_msg_aq_telemetry_f_get_value15(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 56); +} + +/** + * @brief Get field value16 from aq_telemetry_f message + * + * @return value16 + */ +static inline float mavlink_msg_aq_telemetry_f_get_value16(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 60); +} + +/** + * @brief Get field value17 from aq_telemetry_f message + * + * @return value17 + */ +static inline float mavlink_msg_aq_telemetry_f_get_value17(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 64); +} + +/** + * @brief Get field value18 from aq_telemetry_f message + * + * @return value18 + */ +static inline float mavlink_msg_aq_telemetry_f_get_value18(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 68); +} + +/** + * @brief Get field value19 from aq_telemetry_f message + * + * @return value19 + */ +static inline float mavlink_msg_aq_telemetry_f_get_value19(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 72); +} + +/** + * @brief Get field value20 from aq_telemetry_f message + * + * @return value20 + */ +static inline float mavlink_msg_aq_telemetry_f_get_value20(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 76); +} + +/** + * @brief Decode a aq_telemetry_f message into a struct + * + * @param msg The message to decode + * @param aq_telemetry_f C-struct to decode the message contents into + */ +static inline void mavlink_msg_aq_telemetry_f_decode(const mavlink_message_t* msg, mavlink_aq_telemetry_f_t* aq_telemetry_f) +{ +#if MAVLINK_NEED_BYTE_SWAP + aq_telemetry_f->value1 = mavlink_msg_aq_telemetry_f_get_value1(msg); + aq_telemetry_f->value2 = mavlink_msg_aq_telemetry_f_get_value2(msg); + aq_telemetry_f->value3 = mavlink_msg_aq_telemetry_f_get_value3(msg); + aq_telemetry_f->value4 = mavlink_msg_aq_telemetry_f_get_value4(msg); + aq_telemetry_f->value5 = mavlink_msg_aq_telemetry_f_get_value5(msg); + aq_telemetry_f->value6 = mavlink_msg_aq_telemetry_f_get_value6(msg); + aq_telemetry_f->value7 = mavlink_msg_aq_telemetry_f_get_value7(msg); + aq_telemetry_f->value8 = mavlink_msg_aq_telemetry_f_get_value8(msg); + aq_telemetry_f->value9 = mavlink_msg_aq_telemetry_f_get_value9(msg); + aq_telemetry_f->value10 = mavlink_msg_aq_telemetry_f_get_value10(msg); + aq_telemetry_f->value11 = mavlink_msg_aq_telemetry_f_get_value11(msg); + aq_telemetry_f->value12 = mavlink_msg_aq_telemetry_f_get_value12(msg); + aq_telemetry_f->value13 = mavlink_msg_aq_telemetry_f_get_value13(msg); + aq_telemetry_f->value14 = mavlink_msg_aq_telemetry_f_get_value14(msg); + aq_telemetry_f->value15 = mavlink_msg_aq_telemetry_f_get_value15(msg); + aq_telemetry_f->value16 = mavlink_msg_aq_telemetry_f_get_value16(msg); + aq_telemetry_f->value17 = mavlink_msg_aq_telemetry_f_get_value17(msg); + aq_telemetry_f->value18 = mavlink_msg_aq_telemetry_f_get_value18(msg); + aq_telemetry_f->value19 = mavlink_msg_aq_telemetry_f_get_value19(msg); + aq_telemetry_f->value20 = mavlink_msg_aq_telemetry_f_get_value20(msg); + aq_telemetry_f->Index = mavlink_msg_aq_telemetry_f_get_Index(msg); +#else + memcpy(aq_telemetry_f, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_AQ_TELEMETRY_F_LEN); +#endif +} diff --git a/libs/mavlink/include/mavlink/v1.0/autoquad/testsuite.h b/libs/mavlink/include/mavlink/v1.0/autoquad/testsuite.h new file mode 100644 index 0000000000000000000000000000000000000000..dbec869cea3aece7852b4c927e4e9d0fc2ba6b19 --- /dev/null +++ b/libs/mavlink/include/mavlink/v1.0/autoquad/testsuite.h @@ -0,0 +1,118 @@ +/** @file + * @brief MAVLink comm protocol testsuite generated from autoquad.xml + * @see http://qgroundcontrol.org/mavlink/ + */ +#ifndef AUTOQUAD_TESTSUITE_H +#define AUTOQUAD_TESTSUITE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef MAVLINK_TEST_ALL +#define MAVLINK_TEST_ALL +static void mavlink_test_common(uint8_t, uint8_t, mavlink_message_t *last_msg); +static void mavlink_test_autoquad(uint8_t, uint8_t, mavlink_message_t *last_msg); + +static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) +{ + mavlink_test_common(system_id, component_id, last_msg); + mavlink_test_autoquad(system_id, component_id, last_msg); +} +#endif + +#include "../common/testsuite.h" + + +static void mavlink_test_aq_telemetry_f(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) +{ + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_aq_telemetry_f_t packet_in = { + 17.0, + 45.0, + 73.0, + 101.0, + 129.0, + 157.0, + 185.0, + 213.0, + 241.0, + 269.0, + 297.0, + 325.0, + 353.0, + 381.0, + 409.0, + 437.0, + 465.0, + 493.0, + 521.0, + 549.0, + 21395, + }; + mavlink_aq_telemetry_f_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.value1 = packet_in.value1; + packet1.value2 = packet_in.value2; + packet1.value3 = packet_in.value3; + packet1.value4 = packet_in.value4; + packet1.value5 = packet_in.value5; + packet1.value6 = packet_in.value6; + packet1.value7 = packet_in.value7; + packet1.value8 = packet_in.value8; + packet1.value9 = packet_in.value9; + packet1.value10 = packet_in.value10; + packet1.value11 = packet_in.value11; + packet1.value12 = packet_in.value12; + packet1.value13 = packet_in.value13; + packet1.value14 = packet_in.value14; + packet1.value15 = packet_in.value15; + packet1.value16 = packet_in.value16; + packet1.value17 = packet_in.value17; + packet1.value18 = packet_in.value18; + packet1.value19 = packet_in.value19; + packet1.value20 = packet_in.value20; + packet1.Index = packet_in.Index; + + + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_aq_telemetry_f_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_aq_telemetry_f_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_aq_telemetry_f_pack(system_id, component_id, &msg , packet1.Index , packet1.value1 , packet1.value2 , packet1.value3 , packet1.value4 , packet1.value5 , packet1.value6 , packet1.value7 , packet1.value8 , packet1.value9 , packet1.value10 , packet1.value11 , packet1.value12 , packet1.value13 , packet1.value14 , packet1.value15 , packet1.value16 , packet1.value17 , packet1.value18 , packet1.value19 , packet1.value20 ); + mavlink_msg_aq_telemetry_f_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_aq_telemetry_f_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.Index , packet1.value1 , packet1.value2 , packet1.value3 , packet1.value4 , packet1.value5 , packet1.value6 , packet1.value7 , packet1.value8 , packet1.value9 , packet1.value10 , packet1.value11 , packet1.value12 , packet1.value13 , packet1.value14 , packet1.value15 , packet1.value16 , packet1.value17 , packet1.value18 , packet1.value19 , packet1.value20 ); + mavlink_msg_aq_telemetry_f_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; i 0 radius in meters to pass by WP. Positive value for clockwise orbit, negative value for counter-clockwise orbit. Allows trajectory control.| Desired yaw angle at MISSION (rotary wing)| Latitude| Longitude| Altitude| */ + MAV_CMD_NAV_LOITER_UNLIM=17, /* Loiter around this MISSION an unlimited amount of time |Empty| Empty| Radius around MISSION, in meters. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| */ + MAV_CMD_NAV_LOITER_TURNS=18, /* Loiter around this MISSION for X turns |Turns| Empty| Radius around MISSION, in meters. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| */ + MAV_CMD_NAV_LOITER_TIME=19, /* Loiter around this MISSION for X seconds |Seconds (decimal)| Empty| Radius around MISSION, in meters. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| */ + MAV_CMD_NAV_RETURN_TO_LAUNCH=20, /* Return to launch location |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_NAV_LAND=21, /* Land at location |Empty| Empty| Empty| Desired yaw angle.| Latitude| Longitude| Altitude| */ + MAV_CMD_NAV_TAKEOFF=22, /* Takeoff from ground / hand |Minimum pitch (if airspeed sensor present), desired pitch without sensor| Empty| Empty| Yaw angle (if magnetometer present), ignored without magnetometer| Latitude| Longitude| Altitude| */ + MAV_CMD_NAV_ROI=80, /* Sets the region of interest (ROI) for a sensor set or the vehicle itself. This can then be used by the vehicles control system to control the vehicle attitude and the attitude of various sensors such as cameras. |Region of intereset mode. (see MAV_ROI enum)| MISSION index/ target ID. (see MAV_ROI enum)| ROI index (allows a vehicle to manage multiple ROI's)| Empty| x the location of the fixed ROI (see MAV_FRAME)| y| z| */ + MAV_CMD_NAV_PATHPLANNING=81, /* Control autonomous path planning on the MAV. |0: Disable local obstacle avoidance / local path planning (without resetting map), 1: Enable local path planning, 2: Enable and reset local path planning| 0: Disable full path planning (without resetting map), 1: Enable, 2: Enable and reset map/occupancy grid, 3: Enable and reset planned route, but not occupancy grid| Empty| Yaw angle at goal, in compass degrees, [0..360]| Latitude/X of goal| Longitude/Y of goal| Altitude/Z of goal| */ + MAV_CMD_NAV_LAST=95, /* NOP - This command is only used to mark the upper limit of the NAV/ACTION commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_CONDITION_DELAY=112, /* Delay mission state machine. |Delay in seconds (decimal)| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_CONDITION_CHANGE_ALT=113, /* Ascend/descend at rate. Delay mission state machine until desired altitude reached. |Descent / Ascend rate (m/s)| Empty| Empty| Empty| Empty| Empty| Finish Altitude| */ + MAV_CMD_CONDITION_DISTANCE=114, /* Delay mission state machine until within desired distance of next NAV point. |Distance (meters)| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_CONDITION_YAW=115, /* Reach a certain target angle. |target angle: [0-360], 0 is north| speed during yaw change:[deg per second]| direction: negative: counter clockwise, positive: clockwise [-1,1]| relative offset or absolute angle: [ 1,0]| Empty| Empty| Empty| */ + MAV_CMD_CONDITION_LAST=159, /* NOP - This command is only used to mark the upper limit of the CONDITION commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_SET_MODE=176, /* Set system mode. |Mode, as defined by ENUM MAV_MODE| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_JUMP=177, /* Jump to the desired command in the mission list. Repeat this action only the specified number of times |Sequence number| Repeat count| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_CHANGE_SPEED=178, /* Change speed and/or throttle set points. |Speed type (0=Airspeed, 1=Ground Speed)| Speed (m/s, -1 indicates no change)| Throttle ( Percent, -1 indicates no change)| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_SET_HOME=179, /* Changes the home location either to the current location or a specified location. |Use current (1=use current location, 0=use specified location)| Empty| Empty| Empty| Latitude| Longitude| Altitude| */ + MAV_CMD_DO_SET_PARAMETER=180, /* Set a system parameter. Caution! Use of this command requires knowledge of the numeric enumeration value of the parameter. |Parameter number| Parameter value| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_SET_RELAY=181, /* Set a relay to a condition. |Relay number| Setting (1=on, 0=off, others possible depending on system hardware)| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_REPEAT_RELAY=182, /* Cycle a relay on and off for a desired number of cyles with a desired period. |Relay number| Cycle count| Cycle time (seconds, decimal)| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_SET_SERVO=183, /* Set a servo to a desired PWM value. |Servo number| PWM (microseconds, 1000 to 2000 typical)| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_DO_REPEAT_SERVO=184, /* Cycle a between its nominal setting and a desired PWM for a desired number of cycles with a desired period. |Servo number| PWM (microseconds, 1000 to 2000 typical)| Cycle count| Cycle time (seconds)| Empty| Empty| Empty| */ + MAV_CMD_DO_CONTROL_VIDEO=200, /* Control onboard camera system. |Camera ID (-1 for all)| Transmission: 0: disabled, 1: enabled compressed, 2: enabled raw| Transmission mode: 0: video stream, >0: single images every n seconds (decimal)| Recording: 0: disabled, 1: enabled compressed, 2: enabled raw| Empty| Empty| Empty| */ + MAV_CMD_DO_LAST=240, /* NOP - This command is only used to mark the upper limit of the DO commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */ + MAV_CMD_PREFLIGHT_CALIBRATION=241, /* Trigger calibration. This command will be only accepted if in pre-flight mode. |Gyro calibration: 0: no, 1: yes| Magnetometer calibration: 0: no, 1: yes| Ground pressure: 0: no, 1: yes| Radio calibration: 0: no, 1: yes| Accelerometer calibration: 0: no, 1: yes| Empty| Empty| */ + MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS=242, /* Set sensor offsets. This command will be only accepted if in pre-flight mode. |Sensor to adjust the offsets for: 0: gyros, 1: accelerometer, 2: magnetometer, 3: barometer, 4: optical flow| X axis offset (or generic dimension 1), in the sensor's raw units| Y axis offset (or generic dimension 2), in the sensor's raw units| Z axis offset (or generic dimension 3), in the sensor's raw units| Generic dimension 4, in the sensor's raw units| Generic dimension 5, in the sensor's raw units| Generic dimension 6, in the sensor's raw units| */ + MAV_CMD_PREFLIGHT_STORAGE=245, /* Request storage of different parameter values and logs. This command will be only accepted if in pre-flight mode. |Parameter storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM| Mission storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM| Reserved| Reserved| Empty| Empty| Empty| */ + MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN=246, /* Request the reboot or shutdown of system components. |0: Do nothing for autopilot, 1: Reboot autopilot, 2: Shutdown autopilot.| 0: Do nothing for onboard computer, 1: Reboot onboard computer, 2: Shutdown onboard computer.| Reserved| Reserved| Empty| Empty| Empty| */ + MAV_CMD_OVERRIDE_GOTO=252, /* Hold / continue the current action |MAV_GOTO_DO_HOLD: hold MAV_GOTO_DO_CONTINUE: continue with next item in mission plan| MAV_GOTO_HOLD_AT_CURRENT_POSITION: Hold at current position MAV_GOTO_HOLD_AT_SPECIFIED_POSITION: hold at specified position| MAV_FRAME coordinate frame of hold point| Desired yaw angle in degrees| Latitude / X position| Longitude / Y position| Altitude / Z position| */ + MAV_CMD_MISSION_START=300, /* start running a mission |first_item: the first mission item to run| last_item: the last mission item to run (after this item is run, the mission ends)| */ + MAV_CMD_COMPONENT_ARM_DISARM=400, /* Arms / Disarms a component |1 to arm, 0 to disarm| */ + MAV_CMD_ENUM_END=401, /* | */ +}; +#endif + /** @brief Data stream IDs. A data stream is not a fixed set of messages, but rather a recommendation to the autopilot software. Individual autopilots may or may not obey the recommended messages. */ @@ -451,6 +493,9 @@ enum MAV_SEVERITY #include "./mavlink_msg_file_transfer_start.h" #include "./mavlink_msg_file_transfer_dir_list.h" #include "./mavlink_msg_file_transfer_res.h" +#include "./mavlink_msg_hil_gps.h" +#include "./mavlink_msg_hil_optical_flow.h" +#include "./mavlink_msg_hil_state_quaternion.h" #include "./mavlink_msg_battery_status.h" #include "./mavlink_msg_setpoint_8dof.h" #include "./mavlink_msg_setpoint_6dof.h" diff --git a/libs/mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_gps.h b/libs/mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_gps.h new file mode 100644 index 0000000000000000000000000000000000000000..75ab6835ddc98ea1c0d3dcc27e8c51495220eca1 --- /dev/null +++ b/libs/mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_gps.h @@ -0,0 +1,427 @@ +// MESSAGE HIL_GPS PACKING + +#define MAVLINK_MSG_ID_HIL_GPS 113 + +typedef struct __mavlink_hil_gps_t +{ + uint64_t time_usec; ///< Timestamp (microseconds since UNIX epoch or microseconds since system boot) + int32_t lat; ///< Latitude (WGS84), in degrees * 1E7 + int32_t lon; ///< Longitude (WGS84), in degrees * 1E7 + int32_t alt; ///< Altitude (WGS84), in meters * 1000 (positive for up) + uint16_t eph; ///< GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535 + uint16_t epv; ///< GPS VDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535 + uint16_t vel; ///< GPS ground speed (m/s * 100). If unknown, set to: 65535 + int16_t vn; ///< GPS velocity in cm/s in NORTH direction in earth-fixed NED frame + int16_t ve; ///< GPS velocity in cm/s in EAST direction in earth-fixed NED frame + int16_t vd; ///< GPS velocity in cm/s in DOWN direction in earth-fixed NED frame + uint16_t cog; ///< Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535 + uint8_t fix_type; ///< 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix. + uint8_t satellites_visible; ///< Number of satellites visible. If unknown, set to 255 +} mavlink_hil_gps_t; + +#define MAVLINK_MSG_ID_HIL_GPS_LEN 36 +#define MAVLINK_MSG_ID_113_LEN 36 + +#define MAVLINK_MSG_ID_HIL_GPS_CRC 124 +#define MAVLINK_MSG_ID_113_CRC 124 + + + +#define MAVLINK_MESSAGE_INFO_HIL_GPS { \ + "HIL_GPS", \ + 13, \ + { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_gps_t, time_usec) }, \ + { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_hil_gps_t, lat) }, \ + { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 12, offsetof(mavlink_hil_gps_t, lon) }, \ + { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 16, offsetof(mavlink_hil_gps_t, alt) }, \ + { "eph", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_hil_gps_t, eph) }, \ + { "epv", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_hil_gps_t, epv) }, \ + { "vel", NULL, MAVLINK_TYPE_UINT16_T, 0, 24, offsetof(mavlink_hil_gps_t, vel) }, \ + { "vn", NULL, MAVLINK_TYPE_INT16_T, 0, 26, offsetof(mavlink_hil_gps_t, vn) }, \ + { "ve", NULL, MAVLINK_TYPE_INT16_T, 0, 28, offsetof(mavlink_hil_gps_t, ve) }, \ + { "vd", NULL, MAVLINK_TYPE_INT16_T, 0, 30, offsetof(mavlink_hil_gps_t, vd) }, \ + { "cog", NULL, MAVLINK_TYPE_UINT16_T, 0, 32, offsetof(mavlink_hil_gps_t, cog) }, \ + { "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_hil_gps_t, fix_type) }, \ + { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_hil_gps_t, satellites_visible) }, \ + } \ +} + + +/** + * @brief Pack a hil_gps message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot) + * @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix. + * @param lat Latitude (WGS84), in degrees * 1E7 + * @param lon Longitude (WGS84), in degrees * 1E7 + * @param alt Altitude (WGS84), in meters * 1000 (positive for up) + * @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535 + * @param epv GPS VDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535 + * @param vel GPS ground speed (m/s * 100). If unknown, set to: 65535 + * @param vn GPS velocity in cm/s in NORTH direction in earth-fixed NED frame + * @param ve GPS velocity in cm/s in EAST direction in earth-fixed NED frame + * @param vd GPS velocity in cm/s in DOWN direction in earth-fixed NED frame + * @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535 + * @param satellites_visible Number of satellites visible. If unknown, set to 255 + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_hil_gps_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, int16_t vn, int16_t ve, int16_t vd, uint16_t cog, uint8_t satellites_visible) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HIL_GPS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_int32_t(buf, 16, alt); + _mav_put_uint16_t(buf, 20, eph); + _mav_put_uint16_t(buf, 22, epv); + _mav_put_uint16_t(buf, 24, vel); + _mav_put_int16_t(buf, 26, vn); + _mav_put_int16_t(buf, 28, ve); + _mav_put_int16_t(buf, 30, vd); + _mav_put_uint16_t(buf, 32, cog); + _mav_put_uint8_t(buf, 34, fix_type); + _mav_put_uint8_t(buf, 35, satellites_visible); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_GPS_LEN); +#else + mavlink_hil_gps_t packet; + packet.time_usec = time_usec; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.eph = eph; + packet.epv = epv; + packet.vel = vel; + packet.vn = vn; + packet.ve = ve; + packet.vd = vd; + packet.cog = cog; + packet.fix_type = fix_type; + packet.satellites_visible = satellites_visible; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_GPS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HIL_GPS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC); +#else + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_GPS_LEN); +#endif +} + +/** + * @brief Pack a hil_gps message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message was sent over + * @param msg The MAVLink message to compress the data into + * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot) + * @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix. + * @param lat Latitude (WGS84), in degrees * 1E7 + * @param lon Longitude (WGS84), in degrees * 1E7 + * @param alt Altitude (WGS84), in meters * 1000 (positive for up) + * @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535 + * @param epv GPS VDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535 + * @param vel GPS ground speed (m/s * 100). If unknown, set to: 65535 + * @param vn GPS velocity in cm/s in NORTH direction in earth-fixed NED frame + * @param ve GPS velocity in cm/s in EAST direction in earth-fixed NED frame + * @param vd GPS velocity in cm/s in DOWN direction in earth-fixed NED frame + * @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535 + * @param satellites_visible Number of satellites visible. If unknown, set to 255 + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_hil_gps_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint64_t time_usec,uint8_t fix_type,int32_t lat,int32_t lon,int32_t alt,uint16_t eph,uint16_t epv,uint16_t vel,int16_t vn,int16_t ve,int16_t vd,uint16_t cog,uint8_t satellites_visible) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HIL_GPS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_int32_t(buf, 16, alt); + _mav_put_uint16_t(buf, 20, eph); + _mav_put_uint16_t(buf, 22, epv); + _mav_put_uint16_t(buf, 24, vel); + _mav_put_int16_t(buf, 26, vn); + _mav_put_int16_t(buf, 28, ve); + _mav_put_int16_t(buf, 30, vd); + _mav_put_uint16_t(buf, 32, cog); + _mav_put_uint8_t(buf, 34, fix_type); + _mav_put_uint8_t(buf, 35, satellites_visible); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_GPS_LEN); +#else + mavlink_hil_gps_t packet; + packet.time_usec = time_usec; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.eph = eph; + packet.epv = epv; + packet.vel = vel; + packet.vn = vn; + packet.ve = ve; + packet.vd = vd; + packet.cog = cog; + packet.fix_type = fix_type; + packet.satellites_visible = satellites_visible; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_GPS_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HIL_GPS; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC); +#else + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_GPS_LEN); +#endif +} + +/** + * @brief Encode a hil_gps struct into a message + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param hil_gps C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_hil_gps_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_hil_gps_t* hil_gps) +{ + return mavlink_msg_hil_gps_pack(system_id, component_id, msg, hil_gps->time_usec, hil_gps->fix_type, hil_gps->lat, hil_gps->lon, hil_gps->alt, hil_gps->eph, hil_gps->epv, hil_gps->vel, hil_gps->vn, hil_gps->ve, hil_gps->vd, hil_gps->cog, hil_gps->satellites_visible); +} + +/** + * @brief Send a hil_gps message + * @param chan MAVLink channel to send the message + * + * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot) + * @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix. + * @param lat Latitude (WGS84), in degrees * 1E7 + * @param lon Longitude (WGS84), in degrees * 1E7 + * @param alt Altitude (WGS84), in meters * 1000 (positive for up) + * @param eph GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535 + * @param epv GPS VDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535 + * @param vel GPS ground speed (m/s * 100). If unknown, set to: 65535 + * @param vn GPS velocity in cm/s in NORTH direction in earth-fixed NED frame + * @param ve GPS velocity in cm/s in EAST direction in earth-fixed NED frame + * @param vd GPS velocity in cm/s in DOWN direction in earth-fixed NED frame + * @param cog Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535 + * @param satellites_visible Number of satellites visible. If unknown, set to 255 + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_hil_gps_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, uint16_t eph, uint16_t epv, uint16_t vel, int16_t vn, int16_t ve, int16_t vd, uint16_t cog, uint8_t satellites_visible) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HIL_GPS_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_int32_t(buf, 8, lat); + _mav_put_int32_t(buf, 12, lon); + _mav_put_int32_t(buf, 16, alt); + _mav_put_uint16_t(buf, 20, eph); + _mav_put_uint16_t(buf, 22, epv); + _mav_put_uint16_t(buf, 24, vel); + _mav_put_int16_t(buf, 26, vn); + _mav_put_int16_t(buf, 28, ve); + _mav_put_int16_t(buf, 30, vd); + _mav_put_uint16_t(buf, 32, cog); + _mav_put_uint8_t(buf, 34, fix_type); + _mav_put_uint8_t(buf, 35, satellites_visible); + +#if MAVLINK_CRC_EXTRA + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, buf, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, buf, MAVLINK_MSG_ID_HIL_GPS_LEN); +#endif +#else + mavlink_hil_gps_t packet; + packet.time_usec = time_usec; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.eph = eph; + packet.epv = epv; + packet.vel = vel; + packet.vn = vn; + packet.ve = ve; + packet.vd = vd; + packet.cog = cog; + packet.fix_type = fix_type; + packet.satellites_visible = satellites_visible; + +#if MAVLINK_CRC_EXTRA + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, (const char *)&packet, MAVLINK_MSG_ID_HIL_GPS_LEN, MAVLINK_MSG_ID_HIL_GPS_CRC); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_GPS, (const char *)&packet, MAVLINK_MSG_ID_HIL_GPS_LEN); +#endif +#endif +} + +#endif + +// MESSAGE HIL_GPS UNPACKING + + +/** + * @brief Get field time_usec from hil_gps message + * + * @return Timestamp (microseconds since UNIX epoch or microseconds since system boot) + */ +static inline uint64_t mavlink_msg_hil_gps_get_time_usec(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field fix_type from hil_gps message + * + * @return 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix. + */ +static inline uint8_t mavlink_msg_hil_gps_get_fix_type(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 34); +} + +/** + * @brief Get field lat from hil_gps message + * + * @return Latitude (WGS84), in degrees * 1E7 + */ +static inline int32_t mavlink_msg_hil_gps_get_lat(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 8); +} + +/** + * @brief Get field lon from hil_gps message + * + * @return Longitude (WGS84), in degrees * 1E7 + */ +static inline int32_t mavlink_msg_hil_gps_get_lon(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 12); +} + +/** + * @brief Get field alt from hil_gps message + * + * @return Altitude (WGS84), in meters * 1000 (positive for up) + */ +static inline int32_t mavlink_msg_hil_gps_get_alt(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 16); +} + +/** + * @brief Get field eph from hil_gps message + * + * @return GPS HDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535 + */ +static inline uint16_t mavlink_msg_hil_gps_get_eph(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 20); +} + +/** + * @brief Get field epv from hil_gps message + * + * @return GPS VDOP horizontal dilution of position in cm (m*100). If unknown, set to: 65535 + */ +static inline uint16_t mavlink_msg_hil_gps_get_epv(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 22); +} + +/** + * @brief Get field vel from hil_gps message + * + * @return GPS ground speed (m/s * 100). If unknown, set to: 65535 + */ +static inline uint16_t mavlink_msg_hil_gps_get_vel(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 24); +} + +/** + * @brief Get field vn from hil_gps message + * + * @return GPS velocity in cm/s in NORTH direction in earth-fixed NED frame + */ +static inline int16_t mavlink_msg_hil_gps_get_vn(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 26); +} + +/** + * @brief Get field ve from hil_gps message + * + * @return GPS velocity in cm/s in EAST direction in earth-fixed NED frame + */ +static inline int16_t mavlink_msg_hil_gps_get_ve(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 28); +} + +/** + * @brief Get field vd from hil_gps message + * + * @return GPS velocity in cm/s in DOWN direction in earth-fixed NED frame + */ +static inline int16_t mavlink_msg_hil_gps_get_vd(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 30); +} + +/** + * @brief Get field cog from hil_gps message + * + * @return Course over ground (NOT heading, but direction of movement) in degrees * 100, 0.0..359.99 degrees. If unknown, set to: 65535 + */ +static inline uint16_t mavlink_msg_hil_gps_get_cog(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 32); +} + +/** + * @brief Get field satellites_visible from hil_gps message + * + * @return Number of satellites visible. If unknown, set to 255 + */ +static inline uint8_t mavlink_msg_hil_gps_get_satellites_visible(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 35); +} + +/** + * @brief Decode a hil_gps message into a struct + * + * @param msg The message to decode + * @param hil_gps C-struct to decode the message contents into + */ +static inline void mavlink_msg_hil_gps_decode(const mavlink_message_t* msg, mavlink_hil_gps_t* hil_gps) +{ +#if MAVLINK_NEED_BYTE_SWAP + hil_gps->time_usec = mavlink_msg_hil_gps_get_time_usec(msg); + hil_gps->lat = mavlink_msg_hil_gps_get_lat(msg); + hil_gps->lon = mavlink_msg_hil_gps_get_lon(msg); + hil_gps->alt = mavlink_msg_hil_gps_get_alt(msg); + hil_gps->eph = mavlink_msg_hil_gps_get_eph(msg); + hil_gps->epv = mavlink_msg_hil_gps_get_epv(msg); + hil_gps->vel = mavlink_msg_hil_gps_get_vel(msg); + hil_gps->vn = mavlink_msg_hil_gps_get_vn(msg); + hil_gps->ve = mavlink_msg_hil_gps_get_ve(msg); + hil_gps->vd = mavlink_msg_hil_gps_get_vd(msg); + hil_gps->cog = mavlink_msg_hil_gps_get_cog(msg); + hil_gps->fix_type = mavlink_msg_hil_gps_get_fix_type(msg); + hil_gps->satellites_visible = mavlink_msg_hil_gps_get_satellites_visible(msg); +#else + memcpy(hil_gps, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_HIL_GPS_LEN); +#endif +} diff --git a/libs/mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_optical_flow.h b/libs/mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_optical_flow.h new file mode 100644 index 0000000000000000000000000000000000000000..13e13d47cb7f0d472624b787a833390a6ebf680b --- /dev/null +++ b/libs/mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_optical_flow.h @@ -0,0 +1,317 @@ +// MESSAGE HIL_OPTICAL_FLOW PACKING + +#define MAVLINK_MSG_ID_HIL_OPTICAL_FLOW 114 + +typedef struct __mavlink_hil_optical_flow_t +{ + uint64_t time_usec; ///< Timestamp (UNIX) + float flow_comp_m_x; ///< Flow in meters in x-sensor direction, angular-speed compensated + float flow_comp_m_y; ///< Flow in meters in y-sensor direction, angular-speed compensated + float ground_distance; ///< Ground distance in meters. Positive value: distance known. Negative value: Unknown distance + int16_t flow_x; ///< Flow in pixels in x-sensor direction + int16_t flow_y; ///< Flow in pixels in y-sensor direction + uint8_t sensor_id; ///< Sensor ID + uint8_t quality; ///< Optical flow quality / confidence. 0: bad, 255: maximum quality +} mavlink_hil_optical_flow_t; + +#define MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN 26 +#define MAVLINK_MSG_ID_114_LEN 26 + +#define MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC 119 +#define MAVLINK_MSG_ID_114_CRC 119 + + + +#define MAVLINK_MESSAGE_INFO_HIL_OPTICAL_FLOW { \ + "HIL_OPTICAL_FLOW", \ + 8, \ + { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_optical_flow_t, time_usec) }, \ + { "flow_comp_m_x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_hil_optical_flow_t, flow_comp_m_x) }, \ + { "flow_comp_m_y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_hil_optical_flow_t, flow_comp_m_y) }, \ + { "ground_distance", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_hil_optical_flow_t, ground_distance) }, \ + { "flow_x", NULL, MAVLINK_TYPE_INT16_T, 0, 20, offsetof(mavlink_hil_optical_flow_t, flow_x) }, \ + { "flow_y", NULL, MAVLINK_TYPE_INT16_T, 0, 22, offsetof(mavlink_hil_optical_flow_t, flow_y) }, \ + { "sensor_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_hil_optical_flow_t, sensor_id) }, \ + { "quality", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_hil_optical_flow_t, quality) }, \ + } \ +} + + +/** + * @brief Pack a hil_optical_flow message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param time_usec Timestamp (UNIX) + * @param sensor_id Sensor ID + * @param flow_x Flow in pixels in x-sensor direction + * @param flow_y Flow in pixels in y-sensor direction + * @param flow_comp_m_x Flow in meters in x-sensor direction, angular-speed compensated + * @param flow_comp_m_y Flow in meters in y-sensor direction, angular-speed compensated + * @param quality Optical flow quality / confidence. 0: bad, 255: maximum quality + * @param ground_distance Ground distance in meters. Positive value: distance known. Negative value: Unknown distance + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_hil_optical_flow_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint64_t time_usec, uint8_t sensor_id, int16_t flow_x, int16_t flow_y, float flow_comp_m_x, float flow_comp_m_y, uint8_t quality, float ground_distance) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, flow_comp_m_x); + _mav_put_float(buf, 12, flow_comp_m_y); + _mav_put_float(buf, 16, ground_distance); + _mav_put_int16_t(buf, 20, flow_x); + _mav_put_int16_t(buf, 22, flow_y); + _mav_put_uint8_t(buf, 24, sensor_id); + _mav_put_uint8_t(buf, 25, quality); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN); +#else + mavlink_hil_optical_flow_t packet; + packet.time_usec = time_usec; + packet.flow_comp_m_x = flow_comp_m_x; + packet.flow_comp_m_y = flow_comp_m_y; + packet.ground_distance = ground_distance; + packet.flow_x = flow_x; + packet.flow_y = flow_y; + packet.sensor_id = sensor_id; + packet.quality = quality; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HIL_OPTICAL_FLOW; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC); +#else + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN); +#endif +} + +/** + * @brief Pack a hil_optical_flow message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message was sent over + * @param msg The MAVLink message to compress the data into + * @param time_usec Timestamp (UNIX) + * @param sensor_id Sensor ID + * @param flow_x Flow in pixels in x-sensor direction + * @param flow_y Flow in pixels in y-sensor direction + * @param flow_comp_m_x Flow in meters in x-sensor direction, angular-speed compensated + * @param flow_comp_m_y Flow in meters in y-sensor direction, angular-speed compensated + * @param quality Optical flow quality / confidence. 0: bad, 255: maximum quality + * @param ground_distance Ground distance in meters. Positive value: distance known. Negative value: Unknown distance + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_hil_optical_flow_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint64_t time_usec,uint8_t sensor_id,int16_t flow_x,int16_t flow_y,float flow_comp_m_x,float flow_comp_m_y,uint8_t quality,float ground_distance) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, flow_comp_m_x); + _mav_put_float(buf, 12, flow_comp_m_y); + _mav_put_float(buf, 16, ground_distance); + _mav_put_int16_t(buf, 20, flow_x); + _mav_put_int16_t(buf, 22, flow_y); + _mav_put_uint8_t(buf, 24, sensor_id); + _mav_put_uint8_t(buf, 25, quality); + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN); +#else + mavlink_hil_optical_flow_t packet; + packet.time_usec = time_usec; + packet.flow_comp_m_x = flow_comp_m_x; + packet.flow_comp_m_y = flow_comp_m_y; + packet.ground_distance = ground_distance; + packet.flow_x = flow_x; + packet.flow_y = flow_y; + packet.sensor_id = sensor_id; + packet.quality = quality; + + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HIL_OPTICAL_FLOW; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC); +#else + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN); +#endif +} + +/** + * @brief Encode a hil_optical_flow struct into a message + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param hil_optical_flow C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_hil_optical_flow_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_hil_optical_flow_t* hil_optical_flow) +{ + return mavlink_msg_hil_optical_flow_pack(system_id, component_id, msg, hil_optical_flow->time_usec, hil_optical_flow->sensor_id, hil_optical_flow->flow_x, hil_optical_flow->flow_y, hil_optical_flow->flow_comp_m_x, hil_optical_flow->flow_comp_m_y, hil_optical_flow->quality, hil_optical_flow->ground_distance); +} + +/** + * @brief Send a hil_optical_flow message + * @param chan MAVLink channel to send the message + * + * @param time_usec Timestamp (UNIX) + * @param sensor_id Sensor ID + * @param flow_x Flow in pixels in x-sensor direction + * @param flow_y Flow in pixels in y-sensor direction + * @param flow_comp_m_x Flow in meters in x-sensor direction, angular-speed compensated + * @param flow_comp_m_y Flow in meters in y-sensor direction, angular-speed compensated + * @param quality Optical flow quality / confidence. 0: bad, 255: maximum quality + * @param ground_distance Ground distance in meters. Positive value: distance known. Negative value: Unknown distance + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_hil_optical_flow_send(mavlink_channel_t chan, uint64_t time_usec, uint8_t sensor_id, int16_t flow_x, int16_t flow_y, float flow_comp_m_x, float flow_comp_m_y, uint8_t quality, float ground_distance) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 8, flow_comp_m_x); + _mav_put_float(buf, 12, flow_comp_m_y); + _mav_put_float(buf, 16, ground_distance); + _mav_put_int16_t(buf, 20, flow_x); + _mav_put_int16_t(buf, 22, flow_y); + _mav_put_uint8_t(buf, 24, sensor_id); + _mav_put_uint8_t(buf, 25, quality); + +#if MAVLINK_CRC_EXTRA + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, buf, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, buf, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN); +#endif +#else + mavlink_hil_optical_flow_t packet; + packet.time_usec = time_usec; + packet.flow_comp_m_x = flow_comp_m_x; + packet.flow_comp_m_y = flow_comp_m_y; + packet.ground_distance = ground_distance; + packet.flow_x = flow_x; + packet.flow_y = flow_y; + packet.sensor_id = sensor_id; + packet.quality = quality; + +#if MAVLINK_CRC_EXTRA + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, (const char *)&packet, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_CRC); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW, (const char *)&packet, MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN); +#endif +#endif +} + +#endif + +// MESSAGE HIL_OPTICAL_FLOW UNPACKING + + +/** + * @brief Get field time_usec from hil_optical_flow message + * + * @return Timestamp (UNIX) + */ +static inline uint64_t mavlink_msg_hil_optical_flow_get_time_usec(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field sensor_id from hil_optical_flow message + * + * @return Sensor ID + */ +static inline uint8_t mavlink_msg_hil_optical_flow_get_sensor_id(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 24); +} + +/** + * @brief Get field flow_x from hil_optical_flow message + * + * @return Flow in pixels in x-sensor direction + */ +static inline int16_t mavlink_msg_hil_optical_flow_get_flow_x(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 20); +} + +/** + * @brief Get field flow_y from hil_optical_flow message + * + * @return Flow in pixels in y-sensor direction + */ +static inline int16_t mavlink_msg_hil_optical_flow_get_flow_y(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 22); +} + +/** + * @brief Get field flow_comp_m_x from hil_optical_flow message + * + * @return Flow in meters in x-sensor direction, angular-speed compensated + */ +static inline float mavlink_msg_hil_optical_flow_get_flow_comp_m_x(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 8); +} + +/** + * @brief Get field flow_comp_m_y from hil_optical_flow message + * + * @return Flow in meters in y-sensor direction, angular-speed compensated + */ +static inline float mavlink_msg_hil_optical_flow_get_flow_comp_m_y(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 12); +} + +/** + * @brief Get field quality from hil_optical_flow message + * + * @return Optical flow quality / confidence. 0: bad, 255: maximum quality + */ +static inline uint8_t mavlink_msg_hil_optical_flow_get_quality(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint8_t(msg, 25); +} + +/** + * @brief Get field ground_distance from hil_optical_flow message + * + * @return Ground distance in meters. Positive value: distance known. Negative value: Unknown distance + */ +static inline float mavlink_msg_hil_optical_flow_get_ground_distance(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 16); +} + +/** + * @brief Decode a hil_optical_flow message into a struct + * + * @param msg The message to decode + * @param hil_optical_flow C-struct to decode the message contents into + */ +static inline void mavlink_msg_hil_optical_flow_decode(const mavlink_message_t* msg, mavlink_hil_optical_flow_t* hil_optical_flow) +{ +#if MAVLINK_NEED_BYTE_SWAP + hil_optical_flow->time_usec = mavlink_msg_hil_optical_flow_get_time_usec(msg); + hil_optical_flow->flow_comp_m_x = mavlink_msg_hil_optical_flow_get_flow_comp_m_x(msg); + hil_optical_flow->flow_comp_m_y = mavlink_msg_hil_optical_flow_get_flow_comp_m_y(msg); + hil_optical_flow->ground_distance = mavlink_msg_hil_optical_flow_get_ground_distance(msg); + hil_optical_flow->flow_x = mavlink_msg_hil_optical_flow_get_flow_x(msg); + hil_optical_flow->flow_y = mavlink_msg_hil_optical_flow_get_flow_y(msg); + hil_optical_flow->sensor_id = mavlink_msg_hil_optical_flow_get_sensor_id(msg); + hil_optical_flow->quality = mavlink_msg_hil_optical_flow_get_quality(msg); +#else + memcpy(hil_optical_flow, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_HIL_OPTICAL_FLOW_LEN); +#endif +} diff --git a/libs/mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_sensor.h b/libs/mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_sensor.h index d5a07bc32b7caf8248049cb0ed329e3b2a11c56e..422e55adc8eddc71e45b766f8eb00c7fadb0cf34 100644 --- a/libs/mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_sensor.h +++ b/libs/mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_sensor.h @@ -5,11 +5,6 @@ typedef struct __mavlink_hil_sensor_t { uint64_t time_usec; ///< Timestamp (microseconds, synced to UNIX time or since system boot) - float roll; ///< Roll angle in inertial frame (rad) - float pitch; ///< Pitch angle in inertial frame (rad) - float yaw; ///< Yaw angle in inertial frame (rad) - int32_t lat; ///< Latitude, expressed as * 1E7 degrees - int32_t lon; ///< Longitude, expressed as * 1E7 degrees float xacc; ///< X acceleration (m/s^2) float yacc; ///< Y acceleration (m/s^2) float zacc; ///< Z acceleration (m/s^2) @@ -22,43 +17,36 @@ typedef struct __mavlink_hil_sensor_t float abs_pressure; ///< Absolute pressure in millibar float diff_pressure; ///< Differential pressure (airspeed) in millibar float pressure_alt; ///< Altitude calculated from pressure - float gps_alt; ///< GPS altitude (MSL) WGS84 float temperature; ///< Temperature in degrees celsius uint32_t fields_updated; ///< Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature } mavlink_hil_sensor_t; -#define MAVLINK_MSG_ID_HIL_SENSOR_LEN 88 -#define MAVLINK_MSG_ID_107_LEN 88 +#define MAVLINK_MSG_ID_HIL_SENSOR_LEN 64 +#define MAVLINK_MSG_ID_107_LEN 64 -#define MAVLINK_MSG_ID_HIL_SENSOR_CRC 5 -#define MAVLINK_MSG_ID_107_CRC 5 +#define MAVLINK_MSG_ID_HIL_SENSOR_CRC 108 +#define MAVLINK_MSG_ID_107_CRC 108 #define MAVLINK_MESSAGE_INFO_HIL_SENSOR { \ "HIL_SENSOR", \ - 21, \ + 15, \ { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_sensor_t, time_usec) }, \ - { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_hil_sensor_t, roll) }, \ - { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_hil_sensor_t, pitch) }, \ - { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_hil_sensor_t, yaw) }, \ - { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 20, offsetof(mavlink_hil_sensor_t, lat) }, \ - { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 24, offsetof(mavlink_hil_sensor_t, lon) }, \ - { "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_hil_sensor_t, xacc) }, \ - { "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_hil_sensor_t, yacc) }, \ - { "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_hil_sensor_t, zacc) }, \ - { "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_hil_sensor_t, xgyro) }, \ - { "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_hil_sensor_t, ygyro) }, \ - { "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_hil_sensor_t, zgyro) }, \ - { "xmag", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_hil_sensor_t, xmag) }, \ - { "ymag", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_hil_sensor_t, ymag) }, \ - { "zmag", NULL, MAVLINK_TYPE_FLOAT, 0, 60, offsetof(mavlink_hil_sensor_t, zmag) }, \ - { "abs_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 64, offsetof(mavlink_hil_sensor_t, abs_pressure) }, \ - { "diff_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 68, offsetof(mavlink_hil_sensor_t, diff_pressure) }, \ - { "pressure_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 72, offsetof(mavlink_hil_sensor_t, pressure_alt) }, \ - { "gps_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 76, offsetof(mavlink_hil_sensor_t, gps_alt) }, \ - { "temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 80, offsetof(mavlink_hil_sensor_t, temperature) }, \ - { "fields_updated", NULL, MAVLINK_TYPE_UINT32_T, 0, 84, offsetof(mavlink_hil_sensor_t, fields_updated) }, \ + { "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_hil_sensor_t, xacc) }, \ + { "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_hil_sensor_t, yacc) }, \ + { "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_hil_sensor_t, zacc) }, \ + { "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_hil_sensor_t, xgyro) }, \ + { "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_hil_sensor_t, ygyro) }, \ + { "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_hil_sensor_t, zgyro) }, \ + { "xmag", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_hil_sensor_t, xmag) }, \ + { "ymag", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_hil_sensor_t, ymag) }, \ + { "zmag", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_hil_sensor_t, zmag) }, \ + { "abs_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_hil_sensor_t, abs_pressure) }, \ + { "diff_pressure", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_hil_sensor_t, diff_pressure) }, \ + { "pressure_alt", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_hil_sensor_t, pressure_alt) }, \ + { "temperature", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_hil_sensor_t, temperature) }, \ + { "fields_updated", NULL, MAVLINK_TYPE_UINT32_T, 0, 60, offsetof(mavlink_hil_sensor_t, fields_updated) }, \ } \ } @@ -70,11 +58,6 @@ typedef struct __mavlink_hil_sensor_t * @param msg The MAVLink message to compress the data into * * @param time_usec Timestamp (microseconds, synced to UNIX time or since system boot) - * @param roll Roll angle in inertial frame (rad) - * @param pitch Pitch angle in inertial frame (rad) - * @param yaw Yaw angle in inertial frame (rad) - * @param lat Latitude, expressed as * 1E7 degrees - * @param lon Longitude, expressed as * 1E7 degrees * @param xacc X acceleration (m/s^2) * @param yacc Y acceleration (m/s^2) * @param zacc Z acceleration (m/s^2) @@ -87,47 +70,35 @@ typedef struct __mavlink_hil_sensor_t * @param abs_pressure Absolute pressure in millibar * @param diff_pressure Differential pressure (airspeed) in millibar * @param pressure_alt Altitude calculated from pressure - * @param gps_alt GPS altitude (MSL) WGS84 * @param temperature Temperature in degrees celsius * @param fields_updated Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_hil_sensor_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - uint64_t time_usec, float roll, float pitch, float yaw, int32_t lat, int32_t lon, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float gps_alt, float temperature, uint32_t fields_updated) + uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint32_t fields_updated) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_HIL_SENSOR_LEN]; _mav_put_uint64_t(buf, 0, time_usec); - _mav_put_float(buf, 8, roll); - _mav_put_float(buf, 12, pitch); - _mav_put_float(buf, 16, yaw); - _mav_put_int32_t(buf, 20, lat); - _mav_put_int32_t(buf, 24, lon); - _mav_put_float(buf, 28, xacc); - _mav_put_float(buf, 32, yacc); - _mav_put_float(buf, 36, zacc); - _mav_put_float(buf, 40, xgyro); - _mav_put_float(buf, 44, ygyro); - _mav_put_float(buf, 48, zgyro); - _mav_put_float(buf, 52, xmag); - _mav_put_float(buf, 56, ymag); - _mav_put_float(buf, 60, zmag); - _mav_put_float(buf, 64, abs_pressure); - _mav_put_float(buf, 68, diff_pressure); - _mav_put_float(buf, 72, pressure_alt); - _mav_put_float(buf, 76, gps_alt); - _mav_put_float(buf, 80, temperature); - _mav_put_uint32_t(buf, 84, fields_updated); + _mav_put_float(buf, 8, xacc); + _mav_put_float(buf, 12, yacc); + _mav_put_float(buf, 16, zacc); + _mav_put_float(buf, 20, xgyro); + _mav_put_float(buf, 24, ygyro); + _mav_put_float(buf, 28, zgyro); + _mav_put_float(buf, 32, xmag); + _mav_put_float(buf, 36, ymag); + _mav_put_float(buf, 40, zmag); + _mav_put_float(buf, 44, abs_pressure); + _mav_put_float(buf, 48, diff_pressure); + _mav_put_float(buf, 52, pressure_alt); + _mav_put_float(buf, 56, temperature); + _mav_put_uint32_t(buf, 60, fields_updated); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_SENSOR_LEN); #else mavlink_hil_sensor_t packet; packet.time_usec = time_usec; - packet.roll = roll; - packet.pitch = pitch; - packet.yaw = yaw; - packet.lat = lat; - packet.lon = lon; packet.xacc = xacc; packet.yacc = yacc; packet.zacc = zacc; @@ -140,7 +111,6 @@ static inline uint16_t mavlink_msg_hil_sensor_pack(uint8_t system_id, uint8_t co packet.abs_pressure = abs_pressure; packet.diff_pressure = diff_pressure; packet.pressure_alt = pressure_alt; - packet.gps_alt = gps_alt; packet.temperature = temperature; packet.fields_updated = fields_updated; @@ -162,11 +132,6 @@ static inline uint16_t mavlink_msg_hil_sensor_pack(uint8_t system_id, uint8_t co * @param chan The MAVLink channel this message was sent over * @param msg The MAVLink message to compress the data into * @param time_usec Timestamp (microseconds, synced to UNIX time or since system boot) - * @param roll Roll angle in inertial frame (rad) - * @param pitch Pitch angle in inertial frame (rad) - * @param yaw Yaw angle in inertial frame (rad) - * @param lat Latitude, expressed as * 1E7 degrees - * @param lon Longitude, expressed as * 1E7 degrees * @param xacc X acceleration (m/s^2) * @param yacc Y acceleration (m/s^2) * @param zacc Z acceleration (m/s^2) @@ -179,48 +144,36 @@ static inline uint16_t mavlink_msg_hil_sensor_pack(uint8_t system_id, uint8_t co * @param abs_pressure Absolute pressure in millibar * @param diff_pressure Differential pressure (airspeed) in millibar * @param pressure_alt Altitude calculated from pressure - * @param gps_alt GPS altitude (MSL) WGS84 * @param temperature Temperature in degrees celsius * @param fields_updated Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_hil_sensor_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - uint64_t time_usec,float roll,float pitch,float yaw,int32_t lat,int32_t lon,float xacc,float yacc,float zacc,float xgyro,float ygyro,float zgyro,float xmag,float ymag,float zmag,float abs_pressure,float diff_pressure,float pressure_alt,float gps_alt,float temperature,uint32_t fields_updated) + uint64_t time_usec,float xacc,float yacc,float zacc,float xgyro,float ygyro,float zgyro,float xmag,float ymag,float zmag,float abs_pressure,float diff_pressure,float pressure_alt,float temperature,uint32_t fields_updated) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_HIL_SENSOR_LEN]; _mav_put_uint64_t(buf, 0, time_usec); - _mav_put_float(buf, 8, roll); - _mav_put_float(buf, 12, pitch); - _mav_put_float(buf, 16, yaw); - _mav_put_int32_t(buf, 20, lat); - _mav_put_int32_t(buf, 24, lon); - _mav_put_float(buf, 28, xacc); - _mav_put_float(buf, 32, yacc); - _mav_put_float(buf, 36, zacc); - _mav_put_float(buf, 40, xgyro); - _mav_put_float(buf, 44, ygyro); - _mav_put_float(buf, 48, zgyro); - _mav_put_float(buf, 52, xmag); - _mav_put_float(buf, 56, ymag); - _mav_put_float(buf, 60, zmag); - _mav_put_float(buf, 64, abs_pressure); - _mav_put_float(buf, 68, diff_pressure); - _mav_put_float(buf, 72, pressure_alt); - _mav_put_float(buf, 76, gps_alt); - _mav_put_float(buf, 80, temperature); - _mav_put_uint32_t(buf, 84, fields_updated); + _mav_put_float(buf, 8, xacc); + _mav_put_float(buf, 12, yacc); + _mav_put_float(buf, 16, zacc); + _mav_put_float(buf, 20, xgyro); + _mav_put_float(buf, 24, ygyro); + _mav_put_float(buf, 28, zgyro); + _mav_put_float(buf, 32, xmag); + _mav_put_float(buf, 36, ymag); + _mav_put_float(buf, 40, zmag); + _mav_put_float(buf, 44, abs_pressure); + _mav_put_float(buf, 48, diff_pressure); + _mav_put_float(buf, 52, pressure_alt); + _mav_put_float(buf, 56, temperature); + _mav_put_uint32_t(buf, 60, fields_updated); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_SENSOR_LEN); #else mavlink_hil_sensor_t packet; packet.time_usec = time_usec; - packet.roll = roll; - packet.pitch = pitch; - packet.yaw = yaw; - packet.lat = lat; - packet.lon = lon; packet.xacc = xacc; packet.yacc = yacc; packet.zacc = zacc; @@ -233,7 +186,6 @@ static inline uint16_t mavlink_msg_hil_sensor_pack_chan(uint8_t system_id, uint8 packet.abs_pressure = abs_pressure; packet.diff_pressure = diff_pressure; packet.pressure_alt = pressure_alt; - packet.gps_alt = gps_alt; packet.temperature = temperature; packet.fields_updated = fields_updated; @@ -258,7 +210,7 @@ static inline uint16_t mavlink_msg_hil_sensor_pack_chan(uint8_t system_id, uint8 */ static inline uint16_t mavlink_msg_hil_sensor_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_hil_sensor_t* hil_sensor) { - return mavlink_msg_hil_sensor_pack(system_id, component_id, msg, hil_sensor->time_usec, hil_sensor->roll, hil_sensor->pitch, hil_sensor->yaw, hil_sensor->lat, hil_sensor->lon, hil_sensor->xacc, hil_sensor->yacc, hil_sensor->zacc, hil_sensor->xgyro, hil_sensor->ygyro, hil_sensor->zgyro, hil_sensor->xmag, hil_sensor->ymag, hil_sensor->zmag, hil_sensor->abs_pressure, hil_sensor->diff_pressure, hil_sensor->pressure_alt, hil_sensor->gps_alt, hil_sensor->temperature, hil_sensor->fields_updated); + return mavlink_msg_hil_sensor_pack(system_id, component_id, msg, hil_sensor->time_usec, hil_sensor->xacc, hil_sensor->yacc, hil_sensor->zacc, hil_sensor->xgyro, hil_sensor->ygyro, hil_sensor->zgyro, hil_sensor->xmag, hil_sensor->ymag, hil_sensor->zmag, hil_sensor->abs_pressure, hil_sensor->diff_pressure, hil_sensor->pressure_alt, hil_sensor->temperature, hil_sensor->fields_updated); } /** @@ -266,11 +218,6 @@ static inline uint16_t mavlink_msg_hil_sensor_encode(uint8_t system_id, uint8_t * @param chan MAVLink channel to send the message * * @param time_usec Timestamp (microseconds, synced to UNIX time or since system boot) - * @param roll Roll angle in inertial frame (rad) - * @param pitch Pitch angle in inertial frame (rad) - * @param yaw Yaw angle in inertial frame (rad) - * @param lat Latitude, expressed as * 1E7 degrees - * @param lon Longitude, expressed as * 1E7 degrees * @param xacc X acceleration (m/s^2) * @param yacc Y acceleration (m/s^2) * @param zacc Z acceleration (m/s^2) @@ -283,37 +230,30 @@ static inline uint16_t mavlink_msg_hil_sensor_encode(uint8_t system_id, uint8_t * @param abs_pressure Absolute pressure in millibar * @param diff_pressure Differential pressure (airspeed) in millibar * @param pressure_alt Altitude calculated from pressure - * @param gps_alt GPS altitude (MSL) WGS84 * @param temperature Temperature in degrees celsius * @param fields_updated Bitmask for fields that have updated since last message, bit 0 = xacc, bit 12: temperature */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_hil_sensor_send(mavlink_channel_t chan, uint64_t time_usec, float roll, float pitch, float yaw, int32_t lat, int32_t lon, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float gps_alt, float temperature, uint32_t fields_updated) +static inline void mavlink_msg_hil_sensor_send(mavlink_channel_t chan, uint64_t time_usec, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, uint32_t fields_updated) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_HIL_SENSOR_LEN]; _mav_put_uint64_t(buf, 0, time_usec); - _mav_put_float(buf, 8, roll); - _mav_put_float(buf, 12, pitch); - _mav_put_float(buf, 16, yaw); - _mav_put_int32_t(buf, 20, lat); - _mav_put_int32_t(buf, 24, lon); - _mav_put_float(buf, 28, xacc); - _mav_put_float(buf, 32, yacc); - _mav_put_float(buf, 36, zacc); - _mav_put_float(buf, 40, xgyro); - _mav_put_float(buf, 44, ygyro); - _mav_put_float(buf, 48, zgyro); - _mav_put_float(buf, 52, xmag); - _mav_put_float(buf, 56, ymag); - _mav_put_float(buf, 60, zmag); - _mav_put_float(buf, 64, abs_pressure); - _mav_put_float(buf, 68, diff_pressure); - _mav_put_float(buf, 72, pressure_alt); - _mav_put_float(buf, 76, gps_alt); - _mav_put_float(buf, 80, temperature); - _mav_put_uint32_t(buf, 84, fields_updated); + _mav_put_float(buf, 8, xacc); + _mav_put_float(buf, 12, yacc); + _mav_put_float(buf, 16, zacc); + _mav_put_float(buf, 20, xgyro); + _mav_put_float(buf, 24, ygyro); + _mav_put_float(buf, 28, zgyro); + _mav_put_float(buf, 32, xmag); + _mav_put_float(buf, 36, ymag); + _mav_put_float(buf, 40, zmag); + _mav_put_float(buf, 44, abs_pressure); + _mav_put_float(buf, 48, diff_pressure); + _mav_put_float(buf, 52, pressure_alt); + _mav_put_float(buf, 56, temperature); + _mav_put_uint32_t(buf, 60, fields_updated); #if MAVLINK_CRC_EXTRA _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_SENSOR, buf, MAVLINK_MSG_ID_HIL_SENSOR_LEN, MAVLINK_MSG_ID_HIL_SENSOR_CRC); @@ -323,11 +263,6 @@ static inline void mavlink_msg_hil_sensor_send(mavlink_channel_t chan, uint64_t #else mavlink_hil_sensor_t packet; packet.time_usec = time_usec; - packet.roll = roll; - packet.pitch = pitch; - packet.yaw = yaw; - packet.lat = lat; - packet.lon = lon; packet.xacc = xacc; packet.yacc = yacc; packet.zacc = zacc; @@ -340,7 +275,6 @@ static inline void mavlink_msg_hil_sensor_send(mavlink_channel_t chan, uint64_t packet.abs_pressure = abs_pressure; packet.diff_pressure = diff_pressure; packet.pressure_alt = pressure_alt; - packet.gps_alt = gps_alt; packet.temperature = temperature; packet.fields_updated = fields_updated; @@ -367,56 +301,6 @@ static inline uint64_t mavlink_msg_hil_sensor_get_time_usec(const mavlink_messag return _MAV_RETURN_uint64_t(msg, 0); } -/** - * @brief Get field roll from hil_sensor message - * - * @return Roll angle in inertial frame (rad) - */ -static inline float mavlink_msg_hil_sensor_get_roll(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 8); -} - -/** - * @brief Get field pitch from hil_sensor message - * - * @return Pitch angle in inertial frame (rad) - */ -static inline float mavlink_msg_hil_sensor_get_pitch(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 12); -} - -/** - * @brief Get field yaw from hil_sensor message - * - * @return Yaw angle in inertial frame (rad) - */ -static inline float mavlink_msg_hil_sensor_get_yaw(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 16); -} - -/** - * @brief Get field lat from hil_sensor message - * - * @return Latitude, expressed as * 1E7 degrees - */ -static inline int32_t mavlink_msg_hil_sensor_get_lat(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 20); -} - -/** - * @brief Get field lon from hil_sensor message - * - * @return Longitude, expressed as * 1E7 degrees - */ -static inline int32_t mavlink_msg_hil_sensor_get_lon(const mavlink_message_t* msg) -{ - return _MAV_RETURN_int32_t(msg, 24); -} - /** * @brief Get field xacc from hil_sensor message * @@ -424,7 +308,7 @@ static inline int32_t mavlink_msg_hil_sensor_get_lon(const mavlink_message_t* ms */ static inline float mavlink_msg_hil_sensor_get_xacc(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 28); + return _MAV_RETURN_float(msg, 8); } /** @@ -434,7 +318,7 @@ static inline float mavlink_msg_hil_sensor_get_xacc(const mavlink_message_t* msg */ static inline float mavlink_msg_hil_sensor_get_yacc(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 32); + return _MAV_RETURN_float(msg, 12); } /** @@ -444,7 +328,7 @@ static inline float mavlink_msg_hil_sensor_get_yacc(const mavlink_message_t* msg */ static inline float mavlink_msg_hil_sensor_get_zacc(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 36); + return _MAV_RETURN_float(msg, 16); } /** @@ -454,7 +338,7 @@ static inline float mavlink_msg_hil_sensor_get_zacc(const mavlink_message_t* msg */ static inline float mavlink_msg_hil_sensor_get_xgyro(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 40); + return _MAV_RETURN_float(msg, 20); } /** @@ -464,7 +348,7 @@ static inline float mavlink_msg_hil_sensor_get_xgyro(const mavlink_message_t* ms */ static inline float mavlink_msg_hil_sensor_get_ygyro(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 44); + return _MAV_RETURN_float(msg, 24); } /** @@ -474,7 +358,7 @@ static inline float mavlink_msg_hil_sensor_get_ygyro(const mavlink_message_t* ms */ static inline float mavlink_msg_hil_sensor_get_zgyro(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 48); + return _MAV_RETURN_float(msg, 28); } /** @@ -484,7 +368,7 @@ static inline float mavlink_msg_hil_sensor_get_zgyro(const mavlink_message_t* ms */ static inline float mavlink_msg_hil_sensor_get_xmag(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 52); + return _MAV_RETURN_float(msg, 32); } /** @@ -494,7 +378,7 @@ static inline float mavlink_msg_hil_sensor_get_xmag(const mavlink_message_t* msg */ static inline float mavlink_msg_hil_sensor_get_ymag(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 56); + return _MAV_RETURN_float(msg, 36); } /** @@ -504,7 +388,7 @@ static inline float mavlink_msg_hil_sensor_get_ymag(const mavlink_message_t* msg */ static inline float mavlink_msg_hil_sensor_get_zmag(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 60); + return _MAV_RETURN_float(msg, 40); } /** @@ -514,7 +398,7 @@ static inline float mavlink_msg_hil_sensor_get_zmag(const mavlink_message_t* msg */ static inline float mavlink_msg_hil_sensor_get_abs_pressure(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 64); + return _MAV_RETURN_float(msg, 44); } /** @@ -524,7 +408,7 @@ static inline float mavlink_msg_hil_sensor_get_abs_pressure(const mavlink_messag */ static inline float mavlink_msg_hil_sensor_get_diff_pressure(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 68); + return _MAV_RETURN_float(msg, 48); } /** @@ -534,17 +418,7 @@ static inline float mavlink_msg_hil_sensor_get_diff_pressure(const mavlink_messa */ static inline float mavlink_msg_hil_sensor_get_pressure_alt(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 72); -} - -/** - * @brief Get field gps_alt from hil_sensor message - * - * @return GPS altitude (MSL) WGS84 - */ -static inline float mavlink_msg_hil_sensor_get_gps_alt(const mavlink_message_t* msg) -{ - return _MAV_RETURN_float(msg, 76); + return _MAV_RETURN_float(msg, 52); } /** @@ -554,7 +428,7 @@ static inline float mavlink_msg_hil_sensor_get_gps_alt(const mavlink_message_t* */ static inline float mavlink_msg_hil_sensor_get_temperature(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 80); + return _MAV_RETURN_float(msg, 56); } /** @@ -564,7 +438,7 @@ static inline float mavlink_msg_hil_sensor_get_temperature(const mavlink_message */ static inline uint32_t mavlink_msg_hil_sensor_get_fields_updated(const mavlink_message_t* msg) { - return _MAV_RETURN_uint32_t(msg, 84); + return _MAV_RETURN_uint32_t(msg, 60); } /** @@ -577,11 +451,6 @@ static inline void mavlink_msg_hil_sensor_decode(const mavlink_message_t* msg, m { #if MAVLINK_NEED_BYTE_SWAP hil_sensor->time_usec = mavlink_msg_hil_sensor_get_time_usec(msg); - hil_sensor->roll = mavlink_msg_hil_sensor_get_roll(msg); - hil_sensor->pitch = mavlink_msg_hil_sensor_get_pitch(msg); - hil_sensor->yaw = mavlink_msg_hil_sensor_get_yaw(msg); - hil_sensor->lat = mavlink_msg_hil_sensor_get_lat(msg); - hil_sensor->lon = mavlink_msg_hil_sensor_get_lon(msg); hil_sensor->xacc = mavlink_msg_hil_sensor_get_xacc(msg); hil_sensor->yacc = mavlink_msg_hil_sensor_get_yacc(msg); hil_sensor->zacc = mavlink_msg_hil_sensor_get_zacc(msg); @@ -594,7 +463,6 @@ static inline void mavlink_msg_hil_sensor_decode(const mavlink_message_t* msg, m hil_sensor->abs_pressure = mavlink_msg_hil_sensor_get_abs_pressure(msg); hil_sensor->diff_pressure = mavlink_msg_hil_sensor_get_diff_pressure(msg); hil_sensor->pressure_alt = mavlink_msg_hil_sensor_get_pressure_alt(msg); - hil_sensor->gps_alt = mavlink_msg_hil_sensor_get_gps_alt(msg); hil_sensor->temperature = mavlink_msg_hil_sensor_get_temperature(msg); hil_sensor->fields_updated = mavlink_msg_hil_sensor_get_fields_updated(msg); #else diff --git a/libs/mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_state.h b/libs/mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_state.h index a27f19cde679e07f7dbab4ffed160e18c95a6bc6..1d3f286649f648515c46cea6b1428b501be8ebfd 100644 --- a/libs/mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_state.h +++ b/libs/mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_state.h @@ -8,9 +8,9 @@ typedef struct __mavlink_hil_state_t float roll; ///< Roll angle (rad) float pitch; ///< Pitch angle (rad) float yaw; ///< Yaw angle (rad) - float rollspeed; ///< Roll angular speed (rad/s) - float pitchspeed; ///< Pitch angular speed (rad/s) - float yawspeed; ///< Yaw angular speed (rad/s) + float rollspeed; ///< Body frame roll / phi angular speed (rad/s) + float pitchspeed; ///< Body frame pitch / theta angular speed (rad/s) + float yawspeed; ///< Body frame yaw / psi angular speed (rad/s) int32_t lat; ///< Latitude, expressed as * 1E7 int32_t lon; ///< Longitude, expressed as * 1E7 int32_t alt; ///< Altitude in meters, expressed as * 1000 (millimeters) @@ -63,9 +63,9 @@ typedef struct __mavlink_hil_state_t * @param roll Roll angle (rad) * @param pitch Pitch angle (rad) * @param yaw Yaw angle (rad) - * @param rollspeed Roll angular speed (rad/s) - * @param pitchspeed Pitch angular speed (rad/s) - * @param yawspeed Yaw angular speed (rad/s) + * @param rollspeed Body frame roll / phi angular speed (rad/s) + * @param pitchspeed Body frame pitch / theta angular speed (rad/s) + * @param yawspeed Body frame yaw / psi angular speed (rad/s) * @param lat Latitude, expressed as * 1E7 * @param lon Longitude, expressed as * 1E7 * @param alt Altitude in meters, expressed as * 1000 (millimeters) @@ -140,9 +140,9 @@ static inline uint16_t mavlink_msg_hil_state_pack(uint8_t system_id, uint8_t com * @param roll Roll angle (rad) * @param pitch Pitch angle (rad) * @param yaw Yaw angle (rad) - * @param rollspeed Roll angular speed (rad/s) - * @param pitchspeed Pitch angular speed (rad/s) - * @param yawspeed Yaw angular speed (rad/s) + * @param rollspeed Body frame roll / phi angular speed (rad/s) + * @param pitchspeed Body frame pitch / theta angular speed (rad/s) + * @param yawspeed Body frame yaw / psi angular speed (rad/s) * @param lat Latitude, expressed as * 1E7 * @param lon Longitude, expressed as * 1E7 * @param alt Altitude in meters, expressed as * 1000 (millimeters) @@ -229,9 +229,9 @@ static inline uint16_t mavlink_msg_hil_state_encode(uint8_t system_id, uint8_t c * @param roll Roll angle (rad) * @param pitch Pitch angle (rad) * @param yaw Yaw angle (rad) - * @param rollspeed Roll angular speed (rad/s) - * @param pitchspeed Pitch angular speed (rad/s) - * @param yawspeed Yaw angular speed (rad/s) + * @param rollspeed Body frame roll / phi angular speed (rad/s) + * @param pitchspeed Body frame pitch / theta angular speed (rad/s) + * @param yawspeed Body frame yaw / psi angular speed (rad/s) * @param lat Latitude, expressed as * 1E7 * @param lon Longitude, expressed as * 1E7 * @param alt Altitude in meters, expressed as * 1000 (millimeters) @@ -345,7 +345,7 @@ static inline float mavlink_msg_hil_state_get_yaw(const mavlink_message_t* msg) /** * @brief Get field rollspeed from hil_state message * - * @return Roll angular speed (rad/s) + * @return Body frame roll / phi angular speed (rad/s) */ static inline float mavlink_msg_hil_state_get_rollspeed(const mavlink_message_t* msg) { @@ -355,7 +355,7 @@ static inline float mavlink_msg_hil_state_get_rollspeed(const mavlink_message_t* /** * @brief Get field pitchspeed from hil_state message * - * @return Pitch angular speed (rad/s) + * @return Body frame pitch / theta angular speed (rad/s) */ static inline float mavlink_msg_hil_state_get_pitchspeed(const mavlink_message_t* msg) { @@ -365,7 +365,7 @@ static inline float mavlink_msg_hil_state_get_pitchspeed(const mavlink_message_t /** * @brief Get field yawspeed from hil_state message * - * @return Yaw angular speed (rad/s) + * @return Body frame yaw / psi angular speed (rad/s) */ static inline float mavlink_msg_hil_state_get_yawspeed(const mavlink_message_t* msg) { diff --git a/libs/mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_state_quaternion.h b/libs/mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_state_quaternion.h new file mode 100644 index 0000000000000000000000000000000000000000..0474e64a2b693bbb4ee6cea24a72f4902d88a85f --- /dev/null +++ b/libs/mavlink/include/mavlink/v1.0/common/mavlink_msg_hil_state_quaternion.h @@ -0,0 +1,487 @@ +// MESSAGE HIL_STATE_QUATERNION PACKING + +#define MAVLINK_MSG_ID_HIL_STATE_QUATERNION 115 + +typedef struct __mavlink_hil_state_quaternion_t +{ + uint64_t time_usec; ///< Timestamp (microseconds since UNIX epoch or microseconds since system boot) + float attitude_quaternion[4]; ///< Vehicle attitude expressed as normalized quaternion + float rollspeed; ///< Body frame roll / phi angular speed (rad/s) + float pitchspeed; ///< Body frame pitch / theta angular speed (rad/s) + float yawspeed; ///< Body frame yaw / psi angular speed (rad/s) + int32_t lat; ///< Latitude, expressed as * 1E7 + int32_t lon; ///< Longitude, expressed as * 1E7 + int32_t alt; ///< Altitude in meters, expressed as * 1000 (millimeters) + int16_t vx; ///< Ground X Speed (Latitude), expressed as m/s * 100 + int16_t vy; ///< Ground Y Speed (Longitude), expressed as m/s * 100 + int16_t vz; ///< Ground Z Speed (Altitude), expressed as m/s * 100 + uint16_t ind_airspeed; ///< Indicated airspeed, expressed as m/s * 100 + uint16_t true_airspeed; ///< True airspeed, expressed as m/s * 100 + int16_t xacc; ///< X acceleration (mg) + int16_t yacc; ///< Y acceleration (mg) + int16_t zacc; ///< Z acceleration (mg) +} mavlink_hil_state_quaternion_t; + +#define MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN 64 +#define MAVLINK_MSG_ID_115_LEN 64 + +#define MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC 4 +#define MAVLINK_MSG_ID_115_CRC 4 + +#define MAVLINK_MSG_HIL_STATE_QUATERNION_FIELD_ATTITUDE_QUATERNION_LEN 4 + +#define MAVLINK_MESSAGE_INFO_HIL_STATE_QUATERNION { \ + "HIL_STATE_QUATERNION", \ + 16, \ + { { "time_usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_state_quaternion_t, time_usec) }, \ + { "attitude_quaternion", NULL, MAVLINK_TYPE_FLOAT, 4, 8, offsetof(mavlink_hil_state_quaternion_t, attitude_quaternion) }, \ + { "rollspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_hil_state_quaternion_t, rollspeed) }, \ + { "pitchspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_hil_state_quaternion_t, pitchspeed) }, \ + { "yawspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_hil_state_quaternion_t, yawspeed) }, \ + { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 36, offsetof(mavlink_hil_state_quaternion_t, lat) }, \ + { "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 40, offsetof(mavlink_hil_state_quaternion_t, lon) }, \ + { "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 44, offsetof(mavlink_hil_state_quaternion_t, alt) }, \ + { "vx", NULL, MAVLINK_TYPE_INT16_T, 0, 48, offsetof(mavlink_hil_state_quaternion_t, vx) }, \ + { "vy", NULL, MAVLINK_TYPE_INT16_T, 0, 50, offsetof(mavlink_hil_state_quaternion_t, vy) }, \ + { "vz", NULL, MAVLINK_TYPE_INT16_T, 0, 52, offsetof(mavlink_hil_state_quaternion_t, vz) }, \ + { "ind_airspeed", NULL, MAVLINK_TYPE_UINT16_T, 0, 54, offsetof(mavlink_hil_state_quaternion_t, ind_airspeed) }, \ + { "true_airspeed", NULL, MAVLINK_TYPE_UINT16_T, 0, 56, offsetof(mavlink_hil_state_quaternion_t, true_airspeed) }, \ + { "xacc", NULL, MAVLINK_TYPE_INT16_T, 0, 58, offsetof(mavlink_hil_state_quaternion_t, xacc) }, \ + { "yacc", NULL, MAVLINK_TYPE_INT16_T, 0, 60, offsetof(mavlink_hil_state_quaternion_t, yacc) }, \ + { "zacc", NULL, MAVLINK_TYPE_INT16_T, 0, 62, offsetof(mavlink_hil_state_quaternion_t, zacc) }, \ + } \ +} + + +/** + * @brief Pack a hil_state_quaternion message + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * + * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot) + * @param attitude_quaternion Vehicle attitude expressed as normalized quaternion + * @param rollspeed Body frame roll / phi angular speed (rad/s) + * @param pitchspeed Body frame pitch / theta angular speed (rad/s) + * @param yawspeed Body frame yaw / psi angular speed (rad/s) + * @param lat Latitude, expressed as * 1E7 + * @param lon Longitude, expressed as * 1E7 + * @param alt Altitude in meters, expressed as * 1000 (millimeters) + * @param vx Ground X Speed (Latitude), expressed as m/s * 100 + * @param vy Ground Y Speed (Longitude), expressed as m/s * 100 + * @param vz Ground Z Speed (Altitude), expressed as m/s * 100 + * @param ind_airspeed Indicated airspeed, expressed as m/s * 100 + * @param true_airspeed True airspeed, expressed as m/s * 100 + * @param xacc X acceleration (mg) + * @param yacc Y acceleration (mg) + * @param zacc Z acceleration (mg) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_hil_state_quaternion_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, + uint64_t time_usec, const float *attitude_quaternion, float rollspeed, float pitchspeed, float yawspeed, int32_t lat, int32_t lon, int32_t alt, int16_t vx, int16_t vy, int16_t vz, uint16_t ind_airspeed, uint16_t true_airspeed, int16_t xacc, int16_t yacc, int16_t zacc) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 24, rollspeed); + _mav_put_float(buf, 28, pitchspeed); + _mav_put_float(buf, 32, yawspeed); + _mav_put_int32_t(buf, 36, lat); + _mav_put_int32_t(buf, 40, lon); + _mav_put_int32_t(buf, 44, alt); + _mav_put_int16_t(buf, 48, vx); + _mav_put_int16_t(buf, 50, vy); + _mav_put_int16_t(buf, 52, vz); + _mav_put_uint16_t(buf, 54, ind_airspeed); + _mav_put_uint16_t(buf, 56, true_airspeed); + _mav_put_int16_t(buf, 58, xacc); + _mav_put_int16_t(buf, 60, yacc); + _mav_put_int16_t(buf, 62, zacc); + _mav_put_float_array(buf, 8, attitude_quaternion, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN); +#else + mavlink_hil_state_quaternion_t packet; + packet.time_usec = time_usec; + packet.rollspeed = rollspeed; + packet.pitchspeed = pitchspeed; + packet.yawspeed = yawspeed; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + packet.ind_airspeed = ind_airspeed; + packet.true_airspeed = true_airspeed; + packet.xacc = xacc; + packet.yacc = yacc; + packet.zacc = zacc; + mav_array_memcpy(packet.attitude_quaternion, attitude_quaternion, sizeof(float)*4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HIL_STATE_QUATERNION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC); +#else + return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN); +#endif +} + +/** + * @brief Pack a hil_state_quaternion message on a channel + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param chan The MAVLink channel this message was sent over + * @param msg The MAVLink message to compress the data into + * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot) + * @param attitude_quaternion Vehicle attitude expressed as normalized quaternion + * @param rollspeed Body frame roll / phi angular speed (rad/s) + * @param pitchspeed Body frame pitch / theta angular speed (rad/s) + * @param yawspeed Body frame yaw / psi angular speed (rad/s) + * @param lat Latitude, expressed as * 1E7 + * @param lon Longitude, expressed as * 1E7 + * @param alt Altitude in meters, expressed as * 1000 (millimeters) + * @param vx Ground X Speed (Latitude), expressed as m/s * 100 + * @param vy Ground Y Speed (Longitude), expressed as m/s * 100 + * @param vz Ground Z Speed (Altitude), expressed as m/s * 100 + * @param ind_airspeed Indicated airspeed, expressed as m/s * 100 + * @param true_airspeed True airspeed, expressed as m/s * 100 + * @param xacc X acceleration (mg) + * @param yacc Y acceleration (mg) + * @param zacc Z acceleration (mg) + * @return length of the message in bytes (excluding serial stream start sign) + */ +static inline uint16_t mavlink_msg_hil_state_quaternion_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, + mavlink_message_t* msg, + uint64_t time_usec,const float *attitude_quaternion,float rollspeed,float pitchspeed,float yawspeed,int32_t lat,int32_t lon,int32_t alt,int16_t vx,int16_t vy,int16_t vz,uint16_t ind_airspeed,uint16_t true_airspeed,int16_t xacc,int16_t yacc,int16_t zacc) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 24, rollspeed); + _mav_put_float(buf, 28, pitchspeed); + _mav_put_float(buf, 32, yawspeed); + _mav_put_int32_t(buf, 36, lat); + _mav_put_int32_t(buf, 40, lon); + _mav_put_int32_t(buf, 44, alt); + _mav_put_int16_t(buf, 48, vx); + _mav_put_int16_t(buf, 50, vy); + _mav_put_int16_t(buf, 52, vz); + _mav_put_uint16_t(buf, 54, ind_airspeed); + _mav_put_uint16_t(buf, 56, true_airspeed); + _mav_put_int16_t(buf, 58, xacc); + _mav_put_int16_t(buf, 60, yacc); + _mav_put_int16_t(buf, 62, zacc); + _mav_put_float_array(buf, 8, attitude_quaternion, 4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN); +#else + mavlink_hil_state_quaternion_t packet; + packet.time_usec = time_usec; + packet.rollspeed = rollspeed; + packet.pitchspeed = pitchspeed; + packet.yawspeed = yawspeed; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + packet.ind_airspeed = ind_airspeed; + packet.true_airspeed = true_airspeed; + packet.xacc = xacc; + packet.yacc = yacc; + packet.zacc = zacc; + mav_array_memcpy(packet.attitude_quaternion, attitude_quaternion, sizeof(float)*4); + memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN); +#endif + + msg->msgid = MAVLINK_MSG_ID_HIL_STATE_QUATERNION; +#if MAVLINK_CRC_EXTRA + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC); +#else + return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN); +#endif +} + +/** + * @brief Encode a hil_state_quaternion struct into a message + * + * @param system_id ID of this system + * @param component_id ID of this component (e.g. 200 for IMU) + * @param msg The MAVLink message to compress the data into + * @param hil_state_quaternion C-struct to read the message contents from + */ +static inline uint16_t mavlink_msg_hil_state_quaternion_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_hil_state_quaternion_t* hil_state_quaternion) +{ + return mavlink_msg_hil_state_quaternion_pack(system_id, component_id, msg, hil_state_quaternion->time_usec, hil_state_quaternion->attitude_quaternion, hil_state_quaternion->rollspeed, hil_state_quaternion->pitchspeed, hil_state_quaternion->yawspeed, hil_state_quaternion->lat, hil_state_quaternion->lon, hil_state_quaternion->alt, hil_state_quaternion->vx, hil_state_quaternion->vy, hil_state_quaternion->vz, hil_state_quaternion->ind_airspeed, hil_state_quaternion->true_airspeed, hil_state_quaternion->xacc, hil_state_quaternion->yacc, hil_state_quaternion->zacc); +} + +/** + * @brief Send a hil_state_quaternion message + * @param chan MAVLink channel to send the message + * + * @param time_usec Timestamp (microseconds since UNIX epoch or microseconds since system boot) + * @param attitude_quaternion Vehicle attitude expressed as normalized quaternion + * @param rollspeed Body frame roll / phi angular speed (rad/s) + * @param pitchspeed Body frame pitch / theta angular speed (rad/s) + * @param yawspeed Body frame yaw / psi angular speed (rad/s) + * @param lat Latitude, expressed as * 1E7 + * @param lon Longitude, expressed as * 1E7 + * @param alt Altitude in meters, expressed as * 1000 (millimeters) + * @param vx Ground X Speed (Latitude), expressed as m/s * 100 + * @param vy Ground Y Speed (Longitude), expressed as m/s * 100 + * @param vz Ground Z Speed (Altitude), expressed as m/s * 100 + * @param ind_airspeed Indicated airspeed, expressed as m/s * 100 + * @param true_airspeed True airspeed, expressed as m/s * 100 + * @param xacc X acceleration (mg) + * @param yacc Y acceleration (mg) + * @param zacc Z acceleration (mg) + */ +#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS + +static inline void mavlink_msg_hil_state_quaternion_send(mavlink_channel_t chan, uint64_t time_usec, const float *attitude_quaternion, float rollspeed, float pitchspeed, float yawspeed, int32_t lat, int32_t lon, int32_t alt, int16_t vx, int16_t vy, int16_t vz, uint16_t ind_airspeed, uint16_t true_airspeed, int16_t xacc, int16_t yacc, int16_t zacc) +{ +#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS + char buf[MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN]; + _mav_put_uint64_t(buf, 0, time_usec); + _mav_put_float(buf, 24, rollspeed); + _mav_put_float(buf, 28, pitchspeed); + _mav_put_float(buf, 32, yawspeed); + _mav_put_int32_t(buf, 36, lat); + _mav_put_int32_t(buf, 40, lon); + _mav_put_int32_t(buf, 44, alt); + _mav_put_int16_t(buf, 48, vx); + _mav_put_int16_t(buf, 50, vy); + _mav_put_int16_t(buf, 52, vz); + _mav_put_uint16_t(buf, 54, ind_airspeed); + _mav_put_uint16_t(buf, 56, true_airspeed); + _mav_put_int16_t(buf, 58, xacc); + _mav_put_int16_t(buf, 60, yacc); + _mav_put_int16_t(buf, 62, zacc); + _mav_put_float_array(buf, 8, attitude_quaternion, 4); +#if MAVLINK_CRC_EXTRA + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_STATE_QUATERNION, buf, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_STATE_QUATERNION, buf, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN); +#endif +#else + mavlink_hil_state_quaternion_t packet; + packet.time_usec = time_usec; + packet.rollspeed = rollspeed; + packet.pitchspeed = pitchspeed; + packet.yawspeed = yawspeed; + packet.lat = lat; + packet.lon = lon; + packet.alt = alt; + packet.vx = vx; + packet.vy = vy; + packet.vz = vz; + packet.ind_airspeed = ind_airspeed; + packet.true_airspeed = true_airspeed; + packet.xacc = xacc; + packet.yacc = yacc; + packet.zacc = zacc; + mav_array_memcpy(packet.attitude_quaternion, attitude_quaternion, sizeof(float)*4); +#if MAVLINK_CRC_EXTRA + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_STATE_QUATERNION, (const char *)&packet, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_CRC); +#else + _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_STATE_QUATERNION, (const char *)&packet, MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN); +#endif +#endif +} + +#endif + +// MESSAGE HIL_STATE_QUATERNION UNPACKING + + +/** + * @brief Get field time_usec from hil_state_quaternion message + * + * @return Timestamp (microseconds since UNIX epoch or microseconds since system boot) + */ +static inline uint64_t mavlink_msg_hil_state_quaternion_get_time_usec(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint64_t(msg, 0); +} + +/** + * @brief Get field attitude_quaternion from hil_state_quaternion message + * + * @return Vehicle attitude expressed as normalized quaternion + */ +static inline uint16_t mavlink_msg_hil_state_quaternion_get_attitude_quaternion(const mavlink_message_t* msg, float *attitude_quaternion) +{ + return _MAV_RETURN_float_array(msg, attitude_quaternion, 4, 8); +} + +/** + * @brief Get field rollspeed from hil_state_quaternion message + * + * @return Body frame roll / phi angular speed (rad/s) + */ +static inline float mavlink_msg_hil_state_quaternion_get_rollspeed(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 24); +} + +/** + * @brief Get field pitchspeed from hil_state_quaternion message + * + * @return Body frame pitch / theta angular speed (rad/s) + */ +static inline float mavlink_msg_hil_state_quaternion_get_pitchspeed(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 28); +} + +/** + * @brief Get field yawspeed from hil_state_quaternion message + * + * @return Body frame yaw / psi angular speed (rad/s) + */ +static inline float mavlink_msg_hil_state_quaternion_get_yawspeed(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 32); +} + +/** + * @brief Get field lat from hil_state_quaternion message + * + * @return Latitude, expressed as * 1E7 + */ +static inline int32_t mavlink_msg_hil_state_quaternion_get_lat(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 36); +} + +/** + * @brief Get field lon from hil_state_quaternion message + * + * @return Longitude, expressed as * 1E7 + */ +static inline int32_t mavlink_msg_hil_state_quaternion_get_lon(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 40); +} + +/** + * @brief Get field alt from hil_state_quaternion message + * + * @return Altitude in meters, expressed as * 1000 (millimeters) + */ +static inline int32_t mavlink_msg_hil_state_quaternion_get_alt(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int32_t(msg, 44); +} + +/** + * @brief Get field vx from hil_state_quaternion message + * + * @return Ground X Speed (Latitude), expressed as m/s * 100 + */ +static inline int16_t mavlink_msg_hil_state_quaternion_get_vx(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 48); +} + +/** + * @brief Get field vy from hil_state_quaternion message + * + * @return Ground Y Speed (Longitude), expressed as m/s * 100 + */ +static inline int16_t mavlink_msg_hil_state_quaternion_get_vy(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 50); +} + +/** + * @brief Get field vz from hil_state_quaternion message + * + * @return Ground Z Speed (Altitude), expressed as m/s * 100 + */ +static inline int16_t mavlink_msg_hil_state_quaternion_get_vz(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 52); +} + +/** + * @brief Get field ind_airspeed from hil_state_quaternion message + * + * @return Indicated airspeed, expressed as m/s * 100 + */ +static inline uint16_t mavlink_msg_hil_state_quaternion_get_ind_airspeed(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 54); +} + +/** + * @brief Get field true_airspeed from hil_state_quaternion message + * + * @return True airspeed, expressed as m/s * 100 + */ +static inline uint16_t mavlink_msg_hil_state_quaternion_get_true_airspeed(const mavlink_message_t* msg) +{ + return _MAV_RETURN_uint16_t(msg, 56); +} + +/** + * @brief Get field xacc from hil_state_quaternion message + * + * @return X acceleration (mg) + */ +static inline int16_t mavlink_msg_hil_state_quaternion_get_xacc(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 58); +} + +/** + * @brief Get field yacc from hil_state_quaternion message + * + * @return Y acceleration (mg) + */ +static inline int16_t mavlink_msg_hil_state_quaternion_get_yacc(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 60); +} + +/** + * @brief Get field zacc from hil_state_quaternion message + * + * @return Z acceleration (mg) + */ +static inline int16_t mavlink_msg_hil_state_quaternion_get_zacc(const mavlink_message_t* msg) +{ + return _MAV_RETURN_int16_t(msg, 62); +} + +/** + * @brief Decode a hil_state_quaternion message into a struct + * + * @param msg The message to decode + * @param hil_state_quaternion C-struct to decode the message contents into + */ +static inline void mavlink_msg_hil_state_quaternion_decode(const mavlink_message_t* msg, mavlink_hil_state_quaternion_t* hil_state_quaternion) +{ +#if MAVLINK_NEED_BYTE_SWAP + hil_state_quaternion->time_usec = mavlink_msg_hil_state_quaternion_get_time_usec(msg); + mavlink_msg_hil_state_quaternion_get_attitude_quaternion(msg, hil_state_quaternion->attitude_quaternion); + hil_state_quaternion->rollspeed = mavlink_msg_hil_state_quaternion_get_rollspeed(msg); + hil_state_quaternion->pitchspeed = mavlink_msg_hil_state_quaternion_get_pitchspeed(msg); + hil_state_quaternion->yawspeed = mavlink_msg_hil_state_quaternion_get_yawspeed(msg); + hil_state_quaternion->lat = mavlink_msg_hil_state_quaternion_get_lat(msg); + hil_state_quaternion->lon = mavlink_msg_hil_state_quaternion_get_lon(msg); + hil_state_quaternion->alt = mavlink_msg_hil_state_quaternion_get_alt(msg); + hil_state_quaternion->vx = mavlink_msg_hil_state_quaternion_get_vx(msg); + hil_state_quaternion->vy = mavlink_msg_hil_state_quaternion_get_vy(msg); + hil_state_quaternion->vz = mavlink_msg_hil_state_quaternion_get_vz(msg); + hil_state_quaternion->ind_airspeed = mavlink_msg_hil_state_quaternion_get_ind_airspeed(msg); + hil_state_quaternion->true_airspeed = mavlink_msg_hil_state_quaternion_get_true_airspeed(msg); + hil_state_quaternion->xacc = mavlink_msg_hil_state_quaternion_get_xacc(msg); + hil_state_quaternion->yacc = mavlink_msg_hil_state_quaternion_get_yacc(msg); + hil_state_quaternion->zacc = mavlink_msg_hil_state_quaternion_get_zacc(msg); +#else + memcpy(hil_state_quaternion, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_HIL_STATE_QUATERNION_LEN); +#endif +} diff --git a/libs/mavlink/include/mavlink/v1.0/common/mavlink_msg_sim_state.h b/libs/mavlink/include/mavlink/v1.0/common/mavlink_msg_sim_state.h index 956f2357779f2efaf8f29197c494ca832da1f64e..6fd32abd256cce49acc72d94a40cae9379b2e54c 100644 --- a/libs/mavlink/include/mavlink/v1.0/common/mavlink_msg_sim_state.h +++ b/libs/mavlink/include/mavlink/v1.0/common/mavlink_msg_sim_state.h @@ -4,9 +4,13 @@ typedef struct __mavlink_sim_state_t { - float roll; ///< Roll angle (rad) - float pitch; ///< Pitch angle (rad) - float yaw; ///< Yaw angle (rad) + float q1; ///< True attitude quaternion component 1 + float q2; ///< True attitude quaternion component 2 + float q3; ///< True attitude quaternion component 3 + float q4; ///< True attitude quaternion component 4 + float roll; ///< Attitude roll expressed as Euler angles, not recommended except for human-readable outputs + float pitch; ///< Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs + float yaw; ///< Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs float xacc; ///< X acceleration m/s/s float yacc; ///< Y acceleration m/s/s float zacc; ///< Z acceleration m/s/s @@ -14,31 +18,47 @@ typedef struct __mavlink_sim_state_t float ygyro; ///< Angular speed around Y axis rad/s float zgyro; ///< Angular speed around Z axis rad/s float lat; ///< Latitude in degrees - float lng; ///< Longitude in degrees + float lon; ///< Longitude in degrees + float alt; ///< Altitude in meters + float std_dev_horz; ///< Horizontal position standard deviation + float std_dev_vert; ///< Vertical position standard deviation + float vn; ///< True velocity in m/s in NORTH direction in earth-fixed NED frame + float ve; ///< True velocity in m/s in EAST direction in earth-fixed NED frame + float vd; ///< True velocity in m/s in DOWN direction in earth-fixed NED frame } mavlink_sim_state_t; -#define MAVLINK_MSG_ID_SIM_STATE_LEN 44 -#define MAVLINK_MSG_ID_108_LEN 44 +#define MAVLINK_MSG_ID_SIM_STATE_LEN 84 +#define MAVLINK_MSG_ID_108_LEN 84 -#define MAVLINK_MSG_ID_SIM_STATE_CRC 212 -#define MAVLINK_MSG_ID_108_CRC 212 +#define MAVLINK_MSG_ID_SIM_STATE_CRC 32 +#define MAVLINK_MSG_ID_108_CRC 32 #define MAVLINK_MESSAGE_INFO_SIM_STATE { \ "SIM_STATE", \ - 11, \ - { { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_sim_state_t, roll) }, \ - { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_sim_state_t, pitch) }, \ - { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_sim_state_t, yaw) }, \ - { "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_sim_state_t, xacc) }, \ - { "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_sim_state_t, yacc) }, \ - { "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_sim_state_t, zacc) }, \ - { "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_sim_state_t, xgyro) }, \ - { "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_sim_state_t, ygyro) }, \ - { "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_sim_state_t, zgyro) }, \ - { "lat", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_sim_state_t, lat) }, \ - { "lng", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_sim_state_t, lng) }, \ + 21, \ + { { "q1", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_sim_state_t, q1) }, \ + { "q2", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_sim_state_t, q2) }, \ + { "q3", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_sim_state_t, q3) }, \ + { "q4", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_sim_state_t, q4) }, \ + { "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_sim_state_t, roll) }, \ + { "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_sim_state_t, pitch) }, \ + { "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_sim_state_t, yaw) }, \ + { "xacc", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_sim_state_t, xacc) }, \ + { "yacc", NULL, MAVLINK_TYPE_FLOAT, 0, 32, offsetof(mavlink_sim_state_t, yacc) }, \ + { "zacc", NULL, MAVLINK_TYPE_FLOAT, 0, 36, offsetof(mavlink_sim_state_t, zacc) }, \ + { "xgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 40, offsetof(mavlink_sim_state_t, xgyro) }, \ + { "ygyro", NULL, MAVLINK_TYPE_FLOAT, 0, 44, offsetof(mavlink_sim_state_t, ygyro) }, \ + { "zgyro", NULL, MAVLINK_TYPE_FLOAT, 0, 48, offsetof(mavlink_sim_state_t, zgyro) }, \ + { "lat", NULL, MAVLINK_TYPE_FLOAT, 0, 52, offsetof(mavlink_sim_state_t, lat) }, \ + { "lon", NULL, MAVLINK_TYPE_FLOAT, 0, 56, offsetof(mavlink_sim_state_t, lon) }, \ + { "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 60, offsetof(mavlink_sim_state_t, alt) }, \ + { "std_dev_horz", NULL, MAVLINK_TYPE_FLOAT, 0, 64, offsetof(mavlink_sim_state_t, std_dev_horz) }, \ + { "std_dev_vert", NULL, MAVLINK_TYPE_FLOAT, 0, 68, offsetof(mavlink_sim_state_t, std_dev_vert) }, \ + { "vn", NULL, MAVLINK_TYPE_FLOAT, 0, 72, offsetof(mavlink_sim_state_t, vn) }, \ + { "ve", NULL, MAVLINK_TYPE_FLOAT, 0, 76, offsetof(mavlink_sim_state_t, ve) }, \ + { "vd", NULL, MAVLINK_TYPE_FLOAT, 0, 80, offsetof(mavlink_sim_state_t, vd) }, \ } \ } @@ -49,9 +69,13 @@ typedef struct __mavlink_sim_state_t * @param component_id ID of this component (e.g. 200 for IMU) * @param msg The MAVLink message to compress the data into * - * @param roll Roll angle (rad) - * @param pitch Pitch angle (rad) - * @param yaw Yaw angle (rad) + * @param q1 True attitude quaternion component 1 + * @param q2 True attitude quaternion component 2 + * @param q3 True attitude quaternion component 3 + * @param q4 True attitude quaternion component 4 + * @param roll Attitude roll expressed as Euler angles, not recommended except for human-readable outputs + * @param pitch Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs + * @param yaw Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs * @param xacc X acceleration m/s/s * @param yacc Y acceleration m/s/s * @param zacc Z acceleration m/s/s @@ -59,29 +83,49 @@ typedef struct __mavlink_sim_state_t * @param ygyro Angular speed around Y axis rad/s * @param zgyro Angular speed around Z axis rad/s * @param lat Latitude in degrees - * @param lng Longitude in degrees + * @param lon Longitude in degrees + * @param alt Altitude in meters + * @param std_dev_horz Horizontal position standard deviation + * @param std_dev_vert Vertical position standard deviation + * @param vn True velocity in m/s in NORTH direction in earth-fixed NED frame + * @param ve True velocity in m/s in EAST direction in earth-fixed NED frame + * @param vd True velocity in m/s in DOWN direction in earth-fixed NED frame * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_sim_state_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, - float roll, float pitch, float yaw, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float lat, float lng) + float q1, float q2, float q3, float q4, float roll, float pitch, float yaw, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float lat, float lon, float alt, float std_dev_horz, float std_dev_vert, float vn, float ve, float vd) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_SIM_STATE_LEN]; - _mav_put_float(buf, 0, roll); - _mav_put_float(buf, 4, pitch); - _mav_put_float(buf, 8, yaw); - _mav_put_float(buf, 12, xacc); - _mav_put_float(buf, 16, yacc); - _mav_put_float(buf, 20, zacc); - _mav_put_float(buf, 24, xgyro); - _mav_put_float(buf, 28, ygyro); - _mav_put_float(buf, 32, zgyro); - _mav_put_float(buf, 36, lat); - _mav_put_float(buf, 40, lng); + _mav_put_float(buf, 0, q1); + _mav_put_float(buf, 4, q2); + _mav_put_float(buf, 8, q3); + _mav_put_float(buf, 12, q4); + _mav_put_float(buf, 16, roll); + _mav_put_float(buf, 20, pitch); + _mav_put_float(buf, 24, yaw); + _mav_put_float(buf, 28, xacc); + _mav_put_float(buf, 32, yacc); + _mav_put_float(buf, 36, zacc); + _mav_put_float(buf, 40, xgyro); + _mav_put_float(buf, 44, ygyro); + _mav_put_float(buf, 48, zgyro); + _mav_put_float(buf, 52, lat); + _mav_put_float(buf, 56, lon); + _mav_put_float(buf, 60, alt); + _mav_put_float(buf, 64, std_dev_horz); + _mav_put_float(buf, 68, std_dev_vert); + _mav_put_float(buf, 72, vn); + _mav_put_float(buf, 76, ve); + _mav_put_float(buf, 80, vd); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SIM_STATE_LEN); #else mavlink_sim_state_t packet; + packet.q1 = q1; + packet.q2 = q2; + packet.q3 = q3; + packet.q4 = q4; packet.roll = roll; packet.pitch = pitch; packet.yaw = yaw; @@ -92,7 +136,13 @@ static inline uint16_t mavlink_msg_sim_state_pack(uint8_t system_id, uint8_t com packet.ygyro = ygyro; packet.zgyro = zgyro; packet.lat = lat; - packet.lng = lng; + packet.lon = lon; + packet.alt = alt; + packet.std_dev_horz = std_dev_horz; + packet.std_dev_vert = std_dev_vert; + packet.vn = vn; + packet.ve = ve; + packet.vd = vd; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SIM_STATE_LEN); #endif @@ -111,9 +161,13 @@ static inline uint16_t mavlink_msg_sim_state_pack(uint8_t system_id, uint8_t com * @param component_id ID of this component (e.g. 200 for IMU) * @param chan The MAVLink channel this message was sent over * @param msg The MAVLink message to compress the data into - * @param roll Roll angle (rad) - * @param pitch Pitch angle (rad) - * @param yaw Yaw angle (rad) + * @param q1 True attitude quaternion component 1 + * @param q2 True attitude quaternion component 2 + * @param q3 True attitude quaternion component 3 + * @param q4 True attitude quaternion component 4 + * @param roll Attitude roll expressed as Euler angles, not recommended except for human-readable outputs + * @param pitch Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs + * @param yaw Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs * @param xacc X acceleration m/s/s * @param yacc Y acceleration m/s/s * @param zacc Z acceleration m/s/s @@ -121,30 +175,50 @@ static inline uint16_t mavlink_msg_sim_state_pack(uint8_t system_id, uint8_t com * @param ygyro Angular speed around Y axis rad/s * @param zgyro Angular speed around Z axis rad/s * @param lat Latitude in degrees - * @param lng Longitude in degrees + * @param lon Longitude in degrees + * @param alt Altitude in meters + * @param std_dev_horz Horizontal position standard deviation + * @param std_dev_vert Vertical position standard deviation + * @param vn True velocity in m/s in NORTH direction in earth-fixed NED frame + * @param ve True velocity in m/s in EAST direction in earth-fixed NED frame + * @param vd True velocity in m/s in DOWN direction in earth-fixed NED frame * @return length of the message in bytes (excluding serial stream start sign) */ static inline uint16_t mavlink_msg_sim_state_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, - float roll,float pitch,float yaw,float xacc,float yacc,float zacc,float xgyro,float ygyro,float zgyro,float lat,float lng) + float q1,float q2,float q3,float q4,float roll,float pitch,float yaw,float xacc,float yacc,float zacc,float xgyro,float ygyro,float zgyro,float lat,float lon,float alt,float std_dev_horz,float std_dev_vert,float vn,float ve,float vd) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_SIM_STATE_LEN]; - _mav_put_float(buf, 0, roll); - _mav_put_float(buf, 4, pitch); - _mav_put_float(buf, 8, yaw); - _mav_put_float(buf, 12, xacc); - _mav_put_float(buf, 16, yacc); - _mav_put_float(buf, 20, zacc); - _mav_put_float(buf, 24, xgyro); - _mav_put_float(buf, 28, ygyro); - _mav_put_float(buf, 32, zgyro); - _mav_put_float(buf, 36, lat); - _mav_put_float(buf, 40, lng); + _mav_put_float(buf, 0, q1); + _mav_put_float(buf, 4, q2); + _mav_put_float(buf, 8, q3); + _mav_put_float(buf, 12, q4); + _mav_put_float(buf, 16, roll); + _mav_put_float(buf, 20, pitch); + _mav_put_float(buf, 24, yaw); + _mav_put_float(buf, 28, xacc); + _mav_put_float(buf, 32, yacc); + _mav_put_float(buf, 36, zacc); + _mav_put_float(buf, 40, xgyro); + _mav_put_float(buf, 44, ygyro); + _mav_put_float(buf, 48, zgyro); + _mav_put_float(buf, 52, lat); + _mav_put_float(buf, 56, lon); + _mav_put_float(buf, 60, alt); + _mav_put_float(buf, 64, std_dev_horz); + _mav_put_float(buf, 68, std_dev_vert); + _mav_put_float(buf, 72, vn); + _mav_put_float(buf, 76, ve); + _mav_put_float(buf, 80, vd); memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_SIM_STATE_LEN); #else mavlink_sim_state_t packet; + packet.q1 = q1; + packet.q2 = q2; + packet.q3 = q3; + packet.q4 = q4; packet.roll = roll; packet.pitch = pitch; packet.yaw = yaw; @@ -155,7 +229,13 @@ static inline uint16_t mavlink_msg_sim_state_pack_chan(uint8_t system_id, uint8_ packet.ygyro = ygyro; packet.zgyro = zgyro; packet.lat = lat; - packet.lng = lng; + packet.lon = lon; + packet.alt = alt; + packet.std_dev_horz = std_dev_horz; + packet.std_dev_vert = std_dev_vert; + packet.vn = vn; + packet.ve = ve; + packet.vd = vd; memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_SIM_STATE_LEN); #endif @@ -178,16 +258,20 @@ static inline uint16_t mavlink_msg_sim_state_pack_chan(uint8_t system_id, uint8_ */ static inline uint16_t mavlink_msg_sim_state_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_sim_state_t* sim_state) { - return mavlink_msg_sim_state_pack(system_id, component_id, msg, sim_state->roll, sim_state->pitch, sim_state->yaw, sim_state->xacc, sim_state->yacc, sim_state->zacc, sim_state->xgyro, sim_state->ygyro, sim_state->zgyro, sim_state->lat, sim_state->lng); + return mavlink_msg_sim_state_pack(system_id, component_id, msg, sim_state->q1, sim_state->q2, sim_state->q3, sim_state->q4, sim_state->roll, sim_state->pitch, sim_state->yaw, sim_state->xacc, sim_state->yacc, sim_state->zacc, sim_state->xgyro, sim_state->ygyro, sim_state->zgyro, sim_state->lat, sim_state->lon, sim_state->alt, sim_state->std_dev_horz, sim_state->std_dev_vert, sim_state->vn, sim_state->ve, sim_state->vd); } /** * @brief Send a sim_state message * @param chan MAVLink channel to send the message * - * @param roll Roll angle (rad) - * @param pitch Pitch angle (rad) - * @param yaw Yaw angle (rad) + * @param q1 True attitude quaternion component 1 + * @param q2 True attitude quaternion component 2 + * @param q3 True attitude quaternion component 3 + * @param q4 True attitude quaternion component 4 + * @param roll Attitude roll expressed as Euler angles, not recommended except for human-readable outputs + * @param pitch Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs + * @param yaw Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs * @param xacc X acceleration m/s/s * @param yacc Y acceleration m/s/s * @param zacc Z acceleration m/s/s @@ -195,25 +279,41 @@ static inline uint16_t mavlink_msg_sim_state_encode(uint8_t system_id, uint8_t c * @param ygyro Angular speed around Y axis rad/s * @param zgyro Angular speed around Z axis rad/s * @param lat Latitude in degrees - * @param lng Longitude in degrees + * @param lon Longitude in degrees + * @param alt Altitude in meters + * @param std_dev_horz Horizontal position standard deviation + * @param std_dev_vert Vertical position standard deviation + * @param vn True velocity in m/s in NORTH direction in earth-fixed NED frame + * @param ve True velocity in m/s in EAST direction in earth-fixed NED frame + * @param vd True velocity in m/s in DOWN direction in earth-fixed NED frame */ #ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS -static inline void mavlink_msg_sim_state_send(mavlink_channel_t chan, float roll, float pitch, float yaw, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float lat, float lng) +static inline void mavlink_msg_sim_state_send(mavlink_channel_t chan, float q1, float q2, float q3, float q4, float roll, float pitch, float yaw, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float lat, float lon, float alt, float std_dev_horz, float std_dev_vert, float vn, float ve, float vd) { #if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS char buf[MAVLINK_MSG_ID_SIM_STATE_LEN]; - _mav_put_float(buf, 0, roll); - _mav_put_float(buf, 4, pitch); - _mav_put_float(buf, 8, yaw); - _mav_put_float(buf, 12, xacc); - _mav_put_float(buf, 16, yacc); - _mav_put_float(buf, 20, zacc); - _mav_put_float(buf, 24, xgyro); - _mav_put_float(buf, 28, ygyro); - _mav_put_float(buf, 32, zgyro); - _mav_put_float(buf, 36, lat); - _mav_put_float(buf, 40, lng); + _mav_put_float(buf, 0, q1); + _mav_put_float(buf, 4, q2); + _mav_put_float(buf, 8, q3); + _mav_put_float(buf, 12, q4); + _mav_put_float(buf, 16, roll); + _mav_put_float(buf, 20, pitch); + _mav_put_float(buf, 24, yaw); + _mav_put_float(buf, 28, xacc); + _mav_put_float(buf, 32, yacc); + _mav_put_float(buf, 36, zacc); + _mav_put_float(buf, 40, xgyro); + _mav_put_float(buf, 44, ygyro); + _mav_put_float(buf, 48, zgyro); + _mav_put_float(buf, 52, lat); + _mav_put_float(buf, 56, lon); + _mav_put_float(buf, 60, alt); + _mav_put_float(buf, 64, std_dev_horz); + _mav_put_float(buf, 68, std_dev_vert); + _mav_put_float(buf, 72, vn); + _mav_put_float(buf, 76, ve); + _mav_put_float(buf, 80, vd); #if MAVLINK_CRC_EXTRA _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIM_STATE, buf, MAVLINK_MSG_ID_SIM_STATE_LEN, MAVLINK_MSG_ID_SIM_STATE_CRC); @@ -222,6 +322,10 @@ static inline void mavlink_msg_sim_state_send(mavlink_channel_t chan, float roll #endif #else mavlink_sim_state_t packet; + packet.q1 = q1; + packet.q2 = q2; + packet.q3 = q3; + packet.q4 = q4; packet.roll = roll; packet.pitch = pitch; packet.yaw = yaw; @@ -232,7 +336,13 @@ static inline void mavlink_msg_sim_state_send(mavlink_channel_t chan, float roll packet.ygyro = ygyro; packet.zgyro = zgyro; packet.lat = lat; - packet.lng = lng; + packet.lon = lon; + packet.alt = alt; + packet.std_dev_horz = std_dev_horz; + packet.std_dev_vert = std_dev_vert; + packet.vn = vn; + packet.ve = ve; + packet.vd = vd; #if MAVLINK_CRC_EXTRA _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SIM_STATE, (const char *)&packet, MAVLINK_MSG_ID_SIM_STATE_LEN, MAVLINK_MSG_ID_SIM_STATE_CRC); @@ -247,34 +357,74 @@ static inline void mavlink_msg_sim_state_send(mavlink_channel_t chan, float roll // MESSAGE SIM_STATE UNPACKING +/** + * @brief Get field q1 from sim_state message + * + * @return True attitude quaternion component 1 + */ +static inline float mavlink_msg_sim_state_get_q1(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 0); +} + +/** + * @brief Get field q2 from sim_state message + * + * @return True attitude quaternion component 2 + */ +static inline float mavlink_msg_sim_state_get_q2(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 4); +} + +/** + * @brief Get field q3 from sim_state message + * + * @return True attitude quaternion component 3 + */ +static inline float mavlink_msg_sim_state_get_q3(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 8); +} + +/** + * @brief Get field q4 from sim_state message + * + * @return True attitude quaternion component 4 + */ +static inline float mavlink_msg_sim_state_get_q4(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 12); +} + /** * @brief Get field roll from sim_state message * - * @return Roll angle (rad) + * @return Attitude roll expressed as Euler angles, not recommended except for human-readable outputs */ static inline float mavlink_msg_sim_state_get_roll(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 0); + return _MAV_RETURN_float(msg, 16); } /** * @brief Get field pitch from sim_state message * - * @return Pitch angle (rad) + * @return Attitude pitch expressed as Euler angles, not recommended except for human-readable outputs */ static inline float mavlink_msg_sim_state_get_pitch(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 4); + return _MAV_RETURN_float(msg, 20); } /** * @brief Get field yaw from sim_state message * - * @return Yaw angle (rad) + * @return Attitude yaw expressed as Euler angles, not recommended except for human-readable outputs */ static inline float mavlink_msg_sim_state_get_yaw(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 8); + return _MAV_RETURN_float(msg, 24); } /** @@ -284,7 +434,7 @@ static inline float mavlink_msg_sim_state_get_yaw(const mavlink_message_t* msg) */ static inline float mavlink_msg_sim_state_get_xacc(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 12); + return _MAV_RETURN_float(msg, 28); } /** @@ -294,7 +444,7 @@ static inline float mavlink_msg_sim_state_get_xacc(const mavlink_message_t* msg) */ static inline float mavlink_msg_sim_state_get_yacc(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 16); + return _MAV_RETURN_float(msg, 32); } /** @@ -304,7 +454,7 @@ static inline float mavlink_msg_sim_state_get_yacc(const mavlink_message_t* msg) */ static inline float mavlink_msg_sim_state_get_zacc(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 20); + return _MAV_RETURN_float(msg, 36); } /** @@ -314,7 +464,7 @@ static inline float mavlink_msg_sim_state_get_zacc(const mavlink_message_t* msg) */ static inline float mavlink_msg_sim_state_get_xgyro(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 24); + return _MAV_RETURN_float(msg, 40); } /** @@ -324,7 +474,7 @@ static inline float mavlink_msg_sim_state_get_xgyro(const mavlink_message_t* msg */ static inline float mavlink_msg_sim_state_get_ygyro(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 28); + return _MAV_RETURN_float(msg, 44); } /** @@ -334,7 +484,7 @@ static inline float mavlink_msg_sim_state_get_ygyro(const mavlink_message_t* msg */ static inline float mavlink_msg_sim_state_get_zgyro(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 32); + return _MAV_RETURN_float(msg, 48); } /** @@ -344,17 +494,77 @@ static inline float mavlink_msg_sim_state_get_zgyro(const mavlink_message_t* msg */ static inline float mavlink_msg_sim_state_get_lat(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 36); + return _MAV_RETURN_float(msg, 52); } /** - * @brief Get field lng from sim_state message + * @brief Get field lon from sim_state message * * @return Longitude in degrees */ -static inline float mavlink_msg_sim_state_get_lng(const mavlink_message_t* msg) +static inline float mavlink_msg_sim_state_get_lon(const mavlink_message_t* msg) { - return _MAV_RETURN_float(msg, 40); + return _MAV_RETURN_float(msg, 56); +} + +/** + * @brief Get field alt from sim_state message + * + * @return Altitude in meters + */ +static inline float mavlink_msg_sim_state_get_alt(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 60); +} + +/** + * @brief Get field std_dev_horz from sim_state message + * + * @return Horizontal position standard deviation + */ +static inline float mavlink_msg_sim_state_get_std_dev_horz(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 64); +} + +/** + * @brief Get field std_dev_vert from sim_state message + * + * @return Vertical position standard deviation + */ +static inline float mavlink_msg_sim_state_get_std_dev_vert(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 68); +} + +/** + * @brief Get field vn from sim_state message + * + * @return True velocity in m/s in NORTH direction in earth-fixed NED frame + */ +static inline float mavlink_msg_sim_state_get_vn(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 72); +} + +/** + * @brief Get field ve from sim_state message + * + * @return True velocity in m/s in EAST direction in earth-fixed NED frame + */ +static inline float mavlink_msg_sim_state_get_ve(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 76); +} + +/** + * @brief Get field vd from sim_state message + * + * @return True velocity in m/s in DOWN direction in earth-fixed NED frame + */ +static inline float mavlink_msg_sim_state_get_vd(const mavlink_message_t* msg) +{ + return _MAV_RETURN_float(msg, 80); } /** @@ -366,6 +576,10 @@ static inline float mavlink_msg_sim_state_get_lng(const mavlink_message_t* msg) static inline void mavlink_msg_sim_state_decode(const mavlink_message_t* msg, mavlink_sim_state_t* sim_state) { #if MAVLINK_NEED_BYTE_SWAP + sim_state->q1 = mavlink_msg_sim_state_get_q1(msg); + sim_state->q2 = mavlink_msg_sim_state_get_q2(msg); + sim_state->q3 = mavlink_msg_sim_state_get_q3(msg); + sim_state->q4 = mavlink_msg_sim_state_get_q4(msg); sim_state->roll = mavlink_msg_sim_state_get_roll(msg); sim_state->pitch = mavlink_msg_sim_state_get_pitch(msg); sim_state->yaw = mavlink_msg_sim_state_get_yaw(msg); @@ -376,7 +590,13 @@ static inline void mavlink_msg_sim_state_decode(const mavlink_message_t* msg, ma sim_state->ygyro = mavlink_msg_sim_state_get_ygyro(msg); sim_state->zgyro = mavlink_msg_sim_state_get_zgyro(msg); sim_state->lat = mavlink_msg_sim_state_get_lat(msg); - sim_state->lng = mavlink_msg_sim_state_get_lng(msg); + sim_state->lon = mavlink_msg_sim_state_get_lon(msg); + sim_state->alt = mavlink_msg_sim_state_get_alt(msg); + sim_state->std_dev_horz = mavlink_msg_sim_state_get_std_dev_horz(msg); + sim_state->std_dev_vert = mavlink_msg_sim_state_get_std_dev_vert(msg); + sim_state->vn = mavlink_msg_sim_state_get_vn(msg); + sim_state->ve = mavlink_msg_sim_state_get_ve(msg); + sim_state->vd = mavlink_msg_sim_state_get_vd(msg); #else memcpy(sim_state, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_SIM_STATE_LEN); #endif diff --git a/libs/mavlink/include/mavlink/v1.0/common/testsuite.h b/libs/mavlink/include/mavlink/v1.0/common/testsuite.h index ead898afd634d6ae705272bc05299a2cdb6ab09f..08dc6640357cf0c58c5b63347dc7e540b7d95cc2 100644 --- a/libs/mavlink/include/mavlink/v1.0/common/testsuite.h +++ b/libs/mavlink/include/mavlink/v1.0/common/testsuite.h @@ -3949,8 +3949,8 @@ static void mavlink_test_hil_sensor(uint8_t system_id, uint8_t component_id, mav 73.0, 101.0, 129.0, - 963498504, - 963498712, + 157.0, + 185.0, 213.0, 241.0, 269.0, @@ -3959,22 +3959,11 @@ static void mavlink_test_hil_sensor(uint8_t system_id, uint8_t component_id, mav 353.0, 381.0, 409.0, - 437.0, - 465.0, - 493.0, - 521.0, - 549.0, - 577.0, - 963501832, + 963500584, }; mavlink_hil_sensor_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); packet1.time_usec = packet_in.time_usec; - packet1.roll = packet_in.roll; - packet1.pitch = packet_in.pitch; - packet1.yaw = packet_in.yaw; - packet1.lat = packet_in.lat; - packet1.lon = packet_in.lon; packet1.xacc = packet_in.xacc; packet1.yacc = packet_in.yacc; packet1.zacc = packet_in.zacc; @@ -3987,7 +3976,6 @@ static void mavlink_test_hil_sensor(uint8_t system_id, uint8_t component_id, mav packet1.abs_pressure = packet_in.abs_pressure; packet1.diff_pressure = packet_in.diff_pressure; packet1.pressure_alt = packet_in.pressure_alt; - packet1.gps_alt = packet_in.gps_alt; packet1.temperature = packet_in.temperature; packet1.fields_updated = packet_in.fields_updated; @@ -3999,12 +3987,12 @@ static void mavlink_test_hil_sensor(uint8_t system_id, uint8_t component_id, mav MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_hil_sensor_pack(system_id, component_id, &msg , packet1.time_usec , packet1.roll , packet1.pitch , packet1.yaw , packet1.lat , packet1.lon , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.abs_pressure , packet1.diff_pressure , packet1.pressure_alt , packet1.gps_alt , packet1.temperature , packet1.fields_updated ); + mavlink_msg_hil_sensor_pack(system_id, component_id, &msg , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.abs_pressure , packet1.diff_pressure , packet1.pressure_alt , packet1.temperature , packet1.fields_updated ); mavlink_msg_hil_sensor_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_hil_sensor_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.roll , packet1.pitch , packet1.yaw , packet1.lat , packet1.lon , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.abs_pressure , packet1.diff_pressure , packet1.pressure_alt , packet1.gps_alt , packet1.temperature , packet1.fields_updated ); + mavlink_msg_hil_sensor_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.abs_pressure , packet1.diff_pressure , packet1.pressure_alt , packet1.temperature , packet1.fields_updated ); mavlink_msg_hil_sensor_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); @@ -4017,7 +4005,7 @@ static void mavlink_test_hil_sensor(uint8_t system_id, uint8_t component_id, mav MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_hil_sensor_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.roll , packet1.pitch , packet1.yaw , packet1.lat , packet1.lon , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.abs_pressure , packet1.diff_pressure , packet1.pressure_alt , packet1.gps_alt , packet1.temperature , packet1.fields_updated ); + mavlink_msg_hil_sensor_send(MAVLINK_COMM_1 , packet1.time_usec , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.xmag , packet1.ymag , packet1.zmag , packet1.abs_pressure , packet1.diff_pressure , packet1.pressure_alt , packet1.temperature , packet1.fields_updated ); mavlink_msg_hil_sensor_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); } @@ -4039,9 +4027,23 @@ static void mavlink_test_sim_state(uint8_t system_id, uint8_t component_id, mavl 241.0, 269.0, 297.0, + 325.0, + 353.0, + 381.0, + 409.0, + 437.0, + 465.0, + 493.0, + 521.0, + 549.0, + 577.0, }; mavlink_sim_state_t packet1, packet2; memset(&packet1, 0, sizeof(packet1)); + packet1.q1 = packet_in.q1; + packet1.q2 = packet_in.q2; + packet1.q3 = packet_in.q3; + packet1.q4 = packet_in.q4; packet1.roll = packet_in.roll; packet1.pitch = packet_in.pitch; packet1.yaw = packet_in.yaw; @@ -4052,7 +4054,13 @@ static void mavlink_test_sim_state(uint8_t system_id, uint8_t component_id, mavl packet1.ygyro = packet_in.ygyro; packet1.zgyro = packet_in.zgyro; packet1.lat = packet_in.lat; - packet1.lng = packet_in.lng; + packet1.lon = packet_in.lon; + packet1.alt = packet_in.alt; + packet1.std_dev_horz = packet_in.std_dev_horz; + packet1.std_dev_vert = packet_in.std_dev_vert; + packet1.vn = packet_in.vn; + packet1.ve = packet_in.ve; + packet1.vd = packet_in.vd; @@ -4062,12 +4070,12 @@ static void mavlink_test_sim_state(uint8_t system_id, uint8_t component_id, mavl MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sim_state_pack(system_id, component_id, &msg , packet1.roll , packet1.pitch , packet1.yaw , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.lat , packet1.lng ); + mavlink_msg_sim_state_pack(system_id, component_id, &msg , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.roll , packet1.pitch , packet1.yaw , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.lat , packet1.lon , packet1.alt , packet1.std_dev_horz , packet1.std_dev_vert , packet1.vn , packet1.ve , packet1.vd ); mavlink_msg_sim_state_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sim_state_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.roll , packet1.pitch , packet1.yaw , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.lat , packet1.lng ); + mavlink_msg_sim_state_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.roll , packet1.pitch , packet1.yaw , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.lat , packet1.lon , packet1.alt , packet1.std_dev_horz , packet1.std_dev_vert , packet1.vn , packet1.ve , packet1.vd ); mavlink_msg_sim_state_decode(&msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); @@ -4080,7 +4088,7 @@ static void mavlink_test_sim_state(uint8_t system_id, uint8_t component_id, mavl MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); memset(&packet2, 0, sizeof(packet2)); - mavlink_msg_sim_state_send(MAVLINK_COMM_1 , packet1.roll , packet1.pitch , packet1.yaw , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.lat , packet1.lng ); + mavlink_msg_sim_state_send(MAVLINK_COMM_1 , packet1.q1 , packet1.q2 , packet1.q3 , packet1.q4 , packet1.roll , packet1.pitch , packet1.yaw , packet1.xacc , packet1.yacc , packet1.zacc , packet1.xgyro , packet1.ygyro , packet1.zgyro , packet1.lat , packet1.lon , packet1.alt , packet1.std_dev_horz , packet1.std_dev_vert , packet1.vn , packet1.ve , packet1.vd ); mavlink_msg_sim_state_decode(last_msg, &packet2); MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); } @@ -4283,6 +4291,203 @@ static void mavlink_test_file_transfer_res(uint8_t system_id, uint8_t component_ MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); } +static void mavlink_test_hil_gps(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg) +{ + mavlink_message_t msg; + uint8_t buffer[MAVLINK_MAX_PACKET_LEN]; + uint16_t i; + mavlink_hil_gps_t packet_in = { + 93372036854775807ULL, + 963497880, + 963498088, + 963498296, + 18275, + 18379, + 18483, + 18587, + 18691, + 18795, + 18899, + 235, + 46, + }; + mavlink_hil_gps_t packet1, packet2; + memset(&packet1, 0, sizeof(packet1)); + packet1.time_usec = packet_in.time_usec; + packet1.lat = packet_in.lat; + packet1.lon = packet_in.lon; + packet1.alt = packet_in.alt; + packet1.eph = packet_in.eph; + packet1.epv = packet_in.epv; + packet1.vel = packet_in.vel; + packet1.vn = packet_in.vn; + packet1.ve = packet_in.ve; + packet1.vd = packet_in.vd; + packet1.cog = packet_in.cog; + packet1.fix_type = packet_in.fix_type; + packet1.satellites_visible = packet_in.satellites_visible; + + + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_hil_gps_encode(system_id, component_id, &msg, &packet1); + mavlink_msg_hil_gps_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_hil_gps_pack(system_id, component_id, &msg , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.vn , packet1.ve , packet1.vd , packet1.cog , packet1.satellites_visible ); + mavlink_msg_hil_gps_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_hil_gps_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.time_usec , packet1.fix_type , packet1.lat , packet1.lon , packet1.alt , packet1.eph , packet1.epv , packet1.vel , packet1.vn , packet1.ve , packet1.vd , packet1.cog , packet1.satellites_visible ); + mavlink_msg_hil_gps_decode(&msg, &packet2); + MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0); + + memset(&packet2, 0, sizeof(packet2)); + mavlink_msg_to_send_buffer(buffer, &msg); + for (i=0; i + +/** + * @file mavlink_conversions.h + * + * These conversion functions follow the NASA rotation standards definition file + * available online. + * + * Their intent is to lower the barrier for MAVLink adopters to use gimbal-lock free + * (both rotation matrices, sometimes called DCM, and quaternions are gimbal-lock free) + * rotation representations. Euler angles (roll, pitch, yaw) will be phased out of the + * protocol as widely as possible. + * + * @author James Goppert + */ + +MAVLINK_HELPER void mavlink_quaternion_to_dcm(const float quaternion[4], float dcm[3][3]) +{ + double a = quaternion[0]; + double b = quaternion[1]; + double c = quaternion[2]; + double d = quaternion[3]; + double aSq = a * a; + double bSq = b * b; + double cSq = c * c; + double dSq = d * d; + dcm[0][0] = aSq + bSq - cSq - dSq; + dcm[0][1] = 2.0 * (b * c - a * d); + dcm[0][2] = 2.0 * (a * c + b * d); + dcm[1][0] = 2.0 * (b * c + a * d); + dcm[1][1] = aSq - bSq + cSq - dSq; + dcm[1][2] = 2.0 * (c * d - a * b); + dcm[2][0] = 2.0 * (b * d - a * c); + dcm[2][1] = 2.0 * (a * b + c * d); + dcm[2][2] = aSq - bSq - cSq + dSq; +} + +MAVLINK_HELPER void mavlink_dcm_to_euler(const float dcm[3][3], float* roll, float* pitch, float* yaw) +{ + float phi, theta, psi; + theta = asin(-dcm[2][0]); + + if (fabs(theta - M_PI_2) < 1.0e-3f) { + phi = 0.0f; + psi = (atan2(dcm[1][2] - dcm[0][1], + dcm[0][2] + dcm[1][1]) + phi); + + } else if (fabs(theta + M_PI_2) < 1.0e-3f) { + phi = 0.0f; + psi = atan2f(dcm[1][2] - dcm[0][1], + dcm[0][2] + dcm[1][1] - phi); + + } else { + phi = atan2f(dcm[2][1], dcm[2][2]); + psi = atan2f(dcm[1][0], dcm[0][0]); + } + + *roll = phi; + *pitch = theta; + *yaw = psi; +} + +MAVLINK_HELPER void mavlink_quaternion_to_euler(const float quaternion[4], float* roll, float* pitch, float* yaw) +{ + float dcm[3][3]; + mavlink_quaternion_to_dcm(quaternion, dcm); + mavlink_dcm_to_euler(dcm, roll, pitch, yaw); +} + +MAVLINK_HELPER void mavlink_euler_to_quaternion(float roll, float pitch, float yaw, float quaternion[4]) +{ + double cosPhi_2 = cos((double)roll / 2.0); + double sinPhi_2 = sin((double)roll / 2.0); + double cosTheta_2 = cos((double)pitch / 2.0); + double sinTheta_2 = sin((double)pitch / 2.0); + double cosPsi_2 = cos((double)yaw / 2.0); + double sinPsi_2 = sin((double)yaw / 2.0); + quaternion[0] = (cosPhi_2 * cosTheta_2 * cosPsi_2 + + sinPhi_2 * sinTheta_2 * sinPsi_2); + quaternion[1] = (sinPhi_2 * cosTheta_2 * cosPsi_2 - + cosPhi_2 * sinTheta_2 * sinPsi_2); + quaternion[2] = (cosPhi_2 * sinTheta_2 * cosPsi_2 + + sinPhi_2 * cosTheta_2 * sinPsi_2); + quaternion[3] = (cosPhi_2 * cosTheta_2 * sinPsi_2 - + sinPhi_2 * sinTheta_2 * cosPsi_2); +} + +MAVLINK_HELPER void mavlink_dcm_to_quaternion(const float dcm[3][3], float quaternion[4]) +{ + quaternion[0] = (0.5 * sqrt(1.0 + + (double)(dcm[0][0] + dcm[1][1] + dcm[2][2]))); + quaternion[1] = (0.5 * sqrt(1.0 + + (double)(dcm[0][0] - dcm[1][1] - dcm[2][2]))); + quaternion[2] = (0.5 * sqrt(1.0 + + (double)(-dcm[0][0] + dcm[1][1] - dcm[2][2]))); + quaternion[3] = (0.5 * sqrt(1.0 + + (double)(-dcm[0][0] - dcm[1][1] + dcm[2][2]))); +} + +MAVLINK_HELPER void mavlink_euler_to_dcm(float roll, float pitch, float yaw, float dcm[3][3]) +{ + double cosPhi = cos(roll); + double sinPhi = sin(roll); + double cosThe = cos(pitch); + double sinThe = sin(pitch); + double cosPsi = cos(yaw); + double sinPsi = sin(yaw); + + dcm[0][0] = cosThe * cosPsi; + dcm[0][1] = -cosPhi * sinPsi + sinPhi * sinThe * cosPsi; + dcm[0][2] = sinPhi * sinPsi + cosPhi * sinThe * cosPsi; + + dcm[1][0] = cosThe * sinPsi; + dcm[1][1] = cosPhi * cosPsi + sinPhi * sinThe * sinPsi; + dcm[1][2] = -sinPhi * cosPsi + cosPhi * sinThe * sinPsi; + + dcm[2][0] = -sinThe; + dcm[2][1] = sinPhi * cosThe; + dcm[2][2] = cosPhi * cosThe; +} + +#endif \ No newline at end of file diff --git a/libs/mavlink/include/mavlink/v1.0/mavlink_helpers.h b/libs/mavlink/include/mavlink/v1.0/mavlink_helpers.h index f3e49e88ab1ac2056954f77148286967ae797aaf..72cf91fb9f39d796e31042cbbfba4272f96f98a1 100644 --- a/libs/mavlink/include/mavlink/v1.0/mavlink_helpers.h +++ b/libs/mavlink/include/mavlink/v1.0/mavlink_helpers.h @@ -4,6 +4,7 @@ #include "string.h" #include "checksum.h" #include "mavlink_types.h" +#include "mavlink_conversions.h" #ifndef MAVLINK_HELPER #define MAVLINK_HELPER diff --git a/libs/mavlink/include/mavlink/v1.0/pixhawk/pixhawk.h b/libs/mavlink/include/mavlink/v1.0/pixhawk/pixhawk.h index 39269f465f99eadbf75cf4f18fd57a2074088c28..a2d0d0e14e77cd4337287f4c3387b073fbfccd78 100644 --- a/libs/mavlink/include/mavlink/v1.0/pixhawk/pixhawk.h +++ b/libs/mavlink/include/mavlink/v1.0/pixhawk/pixhawk.h @@ -12,15 +12,15 @@ extern "C" { // MESSAGE LENGTHS AND CRCS #ifndef MAVLINK_MESSAGE_LENGTHS -#define MAVLINK_MESSAGE_LENGTHS {9, 31, 12, 0, 14, 28, 3, 32, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 20, 2, 25, 23, 30, 101, 22, 26, 16, 14, 28, 32, 28, 28, 22, 22, 21, 6, 6, 37, 4, 4, 2, 2, 4, 2, 2, 3, 13, 12, 19, 17, 15, 15, 27, 25, 18, 18, 20, 20, 9, 34, 26, 46, 36, 0, 6, 4, 0, 11, 18, 0, 0, 0, 20, 0, 33, 3, 0, 0, 20, 22, 0, 0, 0, 0, 0, 0, 0, 28, 56, 42, 33, 0, 0, 0, 0, 0, 0, 0, 26, 32, 32, 20, 32, 62, 54, 88, 44, 9, 254, 249, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 33, 25, 0, 11, 52, 1, 92, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 26, 16, 0, 0, 0, 0, 0, 0, 0, 4, 255, 12, 6, 0, 0, 0, 0, 0, 0, 106, 43, 55, 12, 255, 53, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 30, 18, 18, 51, 9, 0} +#define MAVLINK_MESSAGE_LENGTHS {9, 31, 12, 0, 14, 28, 3, 32, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 20, 2, 25, 23, 30, 101, 22, 26, 16, 14, 28, 32, 28, 28, 22, 22, 21, 6, 6, 37, 4, 4, 2, 2, 4, 2, 2, 3, 13, 12, 19, 17, 15, 15, 27, 25, 18, 18, 20, 20, 9, 34, 26, 46, 36, 0, 6, 4, 0, 11, 18, 0, 0, 0, 20, 0, 33, 3, 0, 0, 20, 22, 0, 0, 0, 0, 0, 0, 0, 28, 56, 42, 33, 0, 0, 0, 0, 0, 0, 0, 26, 32, 32, 20, 32, 62, 54, 64, 84, 9, 254, 249, 9, 36, 26, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 33, 25, 0, 11, 52, 1, 92, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 26, 16, 0, 0, 0, 0, 0, 0, 0, 4, 255, 12, 6, 0, 0, 0, 0, 0, 0, 106, 43, 55, 12, 255, 53, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 30, 18, 18, 51, 9, 0} #endif #ifndef MAVLINK_MESSAGE_CRCS -#define MAVLINK_MESSAGE_CRCS {50, 124, 137, 0, 237, 217, 104, 119, 0, 0, 0, 89, 0, 0, 0, 0, 0, 0, 0, 0, 214, 159, 220, 168, 24, 23, 170, 144, 67, 115, 39, 246, 185, 104, 237, 244, 222, 212, 9, 254, 230, 28, 28, 132, 221, 232, 11, 153, 41, 39, 214, 223, 141, 33, 15, 3, 100, 24, 239, 238, 30, 240, 183, 130, 130, 0, 148, 21, 0, 243, 124, 0, 0, 0, 20, 0, 152, 143, 0, 0, 127, 106, 0, 0, 0, 0, 0, 0, 0, 231, 183, 63, 54, 0, 0, 0, 0, 0, 0, 0, 175, 102, 158, 208, 56, 93, 211, 5, 212, 185, 235, 93, 124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 241, 15, 0, 108, 86, 95, 224, 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 249, 182, 0, 0, 0, 0, 0, 0, 0, 153, 16, 29, 162, 0, 0, 0, 0, 0, 0, 90, 95, 36, 23, 223, 88, 0, 0, 0, 0, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 204, 49, 170, 44, 83, 46, 0} +#define MAVLINK_MESSAGE_CRCS {50, 124, 137, 0, 237, 217, 104, 119, 0, 0, 0, 89, 0, 0, 0, 0, 0, 0, 0, 0, 214, 159, 220, 168, 24, 23, 170, 144, 67, 115, 39, 246, 185, 104, 237, 244, 222, 212, 9, 254, 230, 28, 28, 132, 221, 232, 11, 153, 41, 39, 214, 223, 141, 33, 15, 3, 100, 24, 239, 238, 30, 240, 183, 130, 130, 0, 148, 21, 0, 243, 124, 0, 0, 0, 20, 0, 152, 143, 0, 0, 127, 106, 0, 0, 0, 0, 0, 0, 0, 231, 183, 63, 54, 0, 0, 0, 0, 0, 0, 0, 175, 102, 158, 208, 56, 93, 211, 108, 32, 185, 235, 93, 124, 124, 119, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 241, 15, 0, 108, 86, 95, 224, 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 249, 182, 0, 0, 0, 0, 0, 0, 0, 153, 16, 29, 162, 0, 0, 0, 0, 0, 0, 90, 95, 36, 23, 223, 88, 0, 0, 0, 0, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 204, 49, 170, 44, 83, 46, 0} #endif #ifndef MAVLINK_MESSAGE_INFO -#define MAVLINK_MESSAGE_INFO {MAVLINK_MESSAGE_INFO_HEARTBEAT, MAVLINK_MESSAGE_INFO_SYS_STATUS, MAVLINK_MESSAGE_INFO_SYSTEM_TIME, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_PING, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL_ACK, MAVLINK_MESSAGE_INFO_AUTH_KEY, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_SET_MODE, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_VALUE, MAVLINK_MESSAGE_INFO_PARAM_SET, MAVLINK_MESSAGE_INFO_GPS_RAW_INT, MAVLINK_MESSAGE_INFO_GPS_STATUS, MAVLINK_MESSAGE_INFO_SCALED_IMU, MAVLINK_MESSAGE_INFO_RAW_IMU, MAVLINK_MESSAGE_INFO_RAW_PRESSURE, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE, MAVLINK_MESSAGE_INFO_ATTITUDE, MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT, MAVLINK_MESSAGE_INFO_RC_CHANNELS_SCALED, MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW, MAVLINK_MESSAGE_INFO_SERVO_OUTPUT_RAW, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_WRITE_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_ITEM, MAVLINK_MESSAGE_INFO_MISSION_REQUEST, MAVLINK_MESSAGE_INFO_MISSION_SET_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_LIST, MAVLINK_MESSAGE_INFO_MISSION_COUNT, MAVLINK_MESSAGE_INFO_MISSION_CLEAR_ALL, MAVLINK_MESSAGE_INFO_MISSION_ITEM_REACHED, MAVLINK_MESSAGE_INFO_MISSION_ACK, MAVLINK_MESSAGE_INFO_SET_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_SET_LOCAL_POSITION_SETPOINT, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_SETPOINT, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_SETPOINT_INT, MAVLINK_MESSAGE_INFO_SET_GLOBAL_POSITION_SETPOINT_INT, MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SET_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_SET_ROLL_PITCH_YAW_SPEED_THRUST, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_SET_QUAD_MOTORS_SETPOINT, MAVLINK_MESSAGE_INFO_SET_QUAD_SWARM_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_NAV_CONTROLLER_OUTPUT, MAVLINK_MESSAGE_INFO_SET_QUAD_SWARM_LED_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_STATE_CORRECTION, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_REQUEST_DATA_STREAM, MAVLINK_MESSAGE_INFO_DATA_STREAM, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_RC_CHANNELS_OVERRIDE, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_VFR_HUD, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_COMMAND_LONG, MAVLINK_MESSAGE_INFO_COMMAND_ACK, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_RATES_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_MANUAL_SETPOINT, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET, MAVLINK_MESSAGE_INFO_HIL_STATE, MAVLINK_MESSAGE_INFO_HIL_CONTROLS, MAVLINK_MESSAGE_INFO_HIL_RC_INPUTS_RAW, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_GLOBAL_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_SPEED_ESTIMATE, MAVLINK_MESSAGE_INFO_VICON_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_HIGHRES_IMU, MAVLINK_MESSAGE_INFO_OMNIDIRECTIONAL_FLOW, MAVLINK_MESSAGE_INFO_HIL_SENSOR, MAVLINK_MESSAGE_INFO_SIM_STATE, MAVLINK_MESSAGE_INFO_RADIO_STATUS, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_START, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_DIR_LIST, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_RES, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_BATTERY_STATUS, MAVLINK_MESSAGE_INFO_SETPOINT_8DOF, MAVLINK_MESSAGE_INFO_SETPOINT_6DOF, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_SET_CAM_SHUTTER, MAVLINK_MESSAGE_INFO_IMAGE_TRIGGERED, MAVLINK_MESSAGE_INFO_IMAGE_TRIGGER_CONTROL, MAVLINK_MESSAGE_INFO_IMAGE_AVAILABLE, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_SET_POSITION_CONTROL_OFFSET, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_POSITION_CONTROL_SETPOINT, MAVLINK_MESSAGE_INFO_MARKER, MAVLINK_MESSAGE_INFO_RAW_AUX, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_WATCHDOG_HEARTBEAT, MAVLINK_MESSAGE_INFO_WATCHDOG_PROCESS_INFO, MAVLINK_MESSAGE_INFO_WATCHDOG_PROCESS_STATUS, MAVLINK_MESSAGE_INFO_WATCHDOG_COMMAND, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_PATTERN_DETECTED, MAVLINK_MESSAGE_INFO_POINT_OF_INTEREST, MAVLINK_MESSAGE_INFO_POINT_OF_INTEREST_CONNECTION, MAVLINK_MESSAGE_INFO_DATA_TRANSMISSION_HANDSHAKE, MAVLINK_MESSAGE_INFO_ENCAPSULATED_DATA, MAVLINK_MESSAGE_INFO_BRIEF_FEATURE, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_ATTITUDE_CONTROL, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_MEMORY_VECT, MAVLINK_MESSAGE_INFO_DEBUG_VECT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_FLOAT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_INT, MAVLINK_MESSAGE_INFO_STATUSTEXT, MAVLINK_MESSAGE_INFO_DEBUG, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}} +#define MAVLINK_MESSAGE_INFO {MAVLINK_MESSAGE_INFO_HEARTBEAT, MAVLINK_MESSAGE_INFO_SYS_STATUS, MAVLINK_MESSAGE_INFO_SYSTEM_TIME, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_PING, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL_ACK, MAVLINK_MESSAGE_INFO_AUTH_KEY, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_SET_MODE, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_VALUE, MAVLINK_MESSAGE_INFO_PARAM_SET, MAVLINK_MESSAGE_INFO_GPS_RAW_INT, MAVLINK_MESSAGE_INFO_GPS_STATUS, MAVLINK_MESSAGE_INFO_SCALED_IMU, MAVLINK_MESSAGE_INFO_RAW_IMU, MAVLINK_MESSAGE_INFO_RAW_PRESSURE, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE, MAVLINK_MESSAGE_INFO_ATTITUDE, MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT, MAVLINK_MESSAGE_INFO_RC_CHANNELS_SCALED, MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW, MAVLINK_MESSAGE_INFO_SERVO_OUTPUT_RAW, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_WRITE_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_ITEM, MAVLINK_MESSAGE_INFO_MISSION_REQUEST, MAVLINK_MESSAGE_INFO_MISSION_SET_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_LIST, MAVLINK_MESSAGE_INFO_MISSION_COUNT, MAVLINK_MESSAGE_INFO_MISSION_CLEAR_ALL, MAVLINK_MESSAGE_INFO_MISSION_ITEM_REACHED, MAVLINK_MESSAGE_INFO_MISSION_ACK, MAVLINK_MESSAGE_INFO_SET_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_SET_LOCAL_POSITION_SETPOINT, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_SETPOINT, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_SETPOINT_INT, MAVLINK_MESSAGE_INFO_SET_GLOBAL_POSITION_SETPOINT_INT, MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SET_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_SET_ROLL_PITCH_YAW_SPEED_THRUST, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_SET_QUAD_MOTORS_SETPOINT, MAVLINK_MESSAGE_INFO_SET_QUAD_SWARM_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_NAV_CONTROLLER_OUTPUT, MAVLINK_MESSAGE_INFO_SET_QUAD_SWARM_LED_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_STATE_CORRECTION, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_REQUEST_DATA_STREAM, MAVLINK_MESSAGE_INFO_DATA_STREAM, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_RC_CHANNELS_OVERRIDE, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_VFR_HUD, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_COMMAND_LONG, MAVLINK_MESSAGE_INFO_COMMAND_ACK, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_RATES_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_MANUAL_SETPOINT, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET, MAVLINK_MESSAGE_INFO_HIL_STATE, MAVLINK_MESSAGE_INFO_HIL_CONTROLS, MAVLINK_MESSAGE_INFO_HIL_RC_INPUTS_RAW, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_GLOBAL_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_SPEED_ESTIMATE, MAVLINK_MESSAGE_INFO_VICON_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_HIGHRES_IMU, MAVLINK_MESSAGE_INFO_OMNIDIRECTIONAL_FLOW, MAVLINK_MESSAGE_INFO_HIL_SENSOR, MAVLINK_MESSAGE_INFO_SIM_STATE, MAVLINK_MESSAGE_INFO_RADIO_STATUS, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_START, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_DIR_LIST, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_RES, MAVLINK_MESSAGE_INFO_HIL_GPS, MAVLINK_MESSAGE_INFO_HIL_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_HIL_STATE_QUATERNION, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_BATTERY_STATUS, MAVLINK_MESSAGE_INFO_SETPOINT_8DOF, MAVLINK_MESSAGE_INFO_SETPOINT_6DOF, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_SET_CAM_SHUTTER, MAVLINK_MESSAGE_INFO_IMAGE_TRIGGERED, MAVLINK_MESSAGE_INFO_IMAGE_TRIGGER_CONTROL, MAVLINK_MESSAGE_INFO_IMAGE_AVAILABLE, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_SET_POSITION_CONTROL_OFFSET, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_POSITION_CONTROL_SETPOINT, MAVLINK_MESSAGE_INFO_MARKER, MAVLINK_MESSAGE_INFO_RAW_AUX, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_WATCHDOG_HEARTBEAT, MAVLINK_MESSAGE_INFO_WATCHDOG_PROCESS_INFO, MAVLINK_MESSAGE_INFO_WATCHDOG_PROCESS_STATUS, MAVLINK_MESSAGE_INFO_WATCHDOG_COMMAND, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_PATTERN_DETECTED, MAVLINK_MESSAGE_INFO_POINT_OF_INTEREST, MAVLINK_MESSAGE_INFO_POINT_OF_INTEREST_CONNECTION, MAVLINK_MESSAGE_INFO_DATA_TRANSMISSION_HANDSHAKE, MAVLINK_MESSAGE_INFO_ENCAPSULATED_DATA, MAVLINK_MESSAGE_INFO_BRIEF_FEATURE, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_ATTITUDE_CONTROL, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_MEMORY_VECT, MAVLINK_MESSAGE_INFO_DEBUG_VECT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_FLOAT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_INT, MAVLINK_MESSAGE_INFO_STATUSTEXT, MAVLINK_MESSAGE_INFO_DEBUG, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}} #endif #include "../protocol.h" diff --git a/libs/mavlink/include/mavlink/v1.0/pixhawk/version.h b/libs/mavlink/include/mavlink/v1.0/pixhawk/version.h index 8188957c060667d5c1114afcc93f4c02b82d04ca..61fe6e930d1de6a87734188ee2a22797904d4171 100644 --- a/libs/mavlink/include/mavlink/v1.0/pixhawk/version.h +++ b/libs/mavlink/include/mavlink/v1.0/pixhawk/version.h @@ -5,7 +5,7 @@ #ifndef MAVLINK_VERSION_H #define MAVLINK_VERSION_H -#define MAVLINK_BUILD_DATE "Fri Jun 7 22:42:06 2013" +#define MAVLINK_BUILD_DATE "Thu Jul 4 13:12:05 2013" #define MAVLINK_WIRE_PROTOCOL_VERSION "1.0" #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 255 diff --git a/libs/mavlink/include/mavlink/v1.0/sensesoar/sensesoar.h b/libs/mavlink/include/mavlink/v1.0/sensesoar/sensesoar.h index a8eb32afd18cbdcf06067c9856da2adaa9cb4ba1..3c72078d773e0f3fdcfe86a4440708fdfd7395ec 100644 --- a/libs/mavlink/include/mavlink/v1.0/sensesoar/sensesoar.h +++ b/libs/mavlink/include/mavlink/v1.0/sensesoar/sensesoar.h @@ -12,15 +12,15 @@ extern "C" { // MESSAGE LENGTHS AND CRCS #ifndef MAVLINK_MESSAGE_LENGTHS -#define MAVLINK_MESSAGE_LENGTHS {9, 31, 12, 0, 14, 28, 3, 32, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 20, 2, 25, 23, 30, 101, 22, 26, 16, 14, 28, 32, 28, 28, 22, 22, 21, 6, 6, 37, 4, 4, 2, 2, 4, 2, 2, 3, 13, 12, 19, 17, 15, 15, 27, 25, 18, 18, 20, 20, 9, 34, 26, 46, 36, 0, 6, 4, 0, 11, 18, 0, 0, 0, 20, 0, 33, 3, 0, 0, 20, 22, 0, 0, 0, 0, 0, 0, 0, 28, 56, 42, 33, 0, 0, 0, 0, 0, 0, 0, 26, 32, 32, 20, 32, 62, 54, 88, 44, 9, 254, 249, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 33, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 12, 0, 32, 0, 12, 0, 12, 0, 24, 0, 4, 4, 12, 0, 12, 0, 20, 0, 4, 0, 5, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 30, 18, 18, 51, 9, 0} +#define MAVLINK_MESSAGE_LENGTHS {9, 31, 12, 0, 14, 28, 3, 32, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 20, 2, 25, 23, 30, 101, 22, 26, 16, 14, 28, 32, 28, 28, 22, 22, 21, 6, 6, 37, 4, 4, 2, 2, 4, 2, 2, 3, 13, 12, 19, 17, 15, 15, 27, 25, 18, 18, 20, 20, 9, 34, 26, 46, 36, 0, 6, 4, 0, 11, 18, 0, 0, 0, 20, 0, 33, 3, 0, 0, 20, 22, 0, 0, 0, 0, 0, 0, 0, 28, 56, 42, 33, 0, 0, 0, 0, 0, 0, 0, 26, 32, 32, 20, 32, 62, 54, 64, 84, 9, 254, 249, 9, 36, 26, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 33, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 12, 0, 32, 0, 12, 0, 12, 0, 24, 0, 4, 4, 12, 0, 12, 0, 20, 0, 4, 0, 5, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 30, 18, 18, 51, 9, 0} #endif #ifndef MAVLINK_MESSAGE_CRCS -#define MAVLINK_MESSAGE_CRCS {50, 124, 137, 0, 237, 217, 104, 119, 0, 0, 0, 89, 0, 0, 0, 0, 0, 0, 0, 0, 214, 159, 220, 168, 24, 23, 170, 144, 67, 115, 39, 246, 185, 104, 237, 244, 222, 212, 9, 254, 230, 28, 28, 132, 221, 232, 11, 153, 41, 39, 214, 223, 141, 33, 15, 3, 100, 24, 239, 238, 30, 240, 183, 130, 130, 0, 148, 21, 0, 243, 124, 0, 0, 0, 20, 0, 152, 143, 0, 0, 127, 106, 0, 0, 0, 0, 0, 0, 0, 231, 183, 63, 54, 0, 0, 0, 0, 0, 0, 0, 175, 102, 158, 208, 56, 93, 211, 5, 212, 185, 235, 93, 124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 241, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 108, 0, 146, 0, 16, 0, 32, 0, 159, 0, 24, 248, 79, 0, 5, 0, 170, 0, 157, 0, 209, 0, 243, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 204, 49, 170, 44, 83, 46, 0} +#define MAVLINK_MESSAGE_CRCS {50, 124, 137, 0, 237, 217, 104, 119, 0, 0, 0, 89, 0, 0, 0, 0, 0, 0, 0, 0, 214, 159, 220, 168, 24, 23, 170, 144, 67, 115, 39, 246, 185, 104, 237, 244, 222, 212, 9, 254, 230, 28, 28, 132, 221, 232, 11, 153, 41, 39, 214, 223, 141, 33, 15, 3, 100, 24, 239, 238, 30, 240, 183, 130, 130, 0, 148, 21, 0, 243, 124, 0, 0, 0, 20, 0, 152, 143, 0, 0, 127, 106, 0, 0, 0, 0, 0, 0, 0, 231, 183, 63, 54, 0, 0, 0, 0, 0, 0, 0, 175, 102, 158, 208, 56, 93, 211, 108, 32, 185, 235, 93, 124, 124, 119, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 241, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 0, 108, 0, 146, 0, 16, 0, 32, 0, 159, 0, 24, 248, 79, 0, 5, 0, 170, 0, 157, 0, 209, 0, 243, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 204, 49, 170, 44, 83, 46, 0} #endif #ifndef MAVLINK_MESSAGE_INFO -#define MAVLINK_MESSAGE_INFO {MAVLINK_MESSAGE_INFO_HEARTBEAT, MAVLINK_MESSAGE_INFO_SYS_STATUS, MAVLINK_MESSAGE_INFO_SYSTEM_TIME, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_PING, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL_ACK, MAVLINK_MESSAGE_INFO_AUTH_KEY, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_SET_MODE, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_VALUE, MAVLINK_MESSAGE_INFO_PARAM_SET, MAVLINK_MESSAGE_INFO_GPS_RAW_INT, MAVLINK_MESSAGE_INFO_GPS_STATUS, MAVLINK_MESSAGE_INFO_SCALED_IMU, MAVLINK_MESSAGE_INFO_RAW_IMU, MAVLINK_MESSAGE_INFO_RAW_PRESSURE, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE, MAVLINK_MESSAGE_INFO_ATTITUDE, MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT, MAVLINK_MESSAGE_INFO_RC_CHANNELS_SCALED, MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW, MAVLINK_MESSAGE_INFO_SERVO_OUTPUT_RAW, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_WRITE_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_ITEM, MAVLINK_MESSAGE_INFO_MISSION_REQUEST, MAVLINK_MESSAGE_INFO_MISSION_SET_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_LIST, MAVLINK_MESSAGE_INFO_MISSION_COUNT, MAVLINK_MESSAGE_INFO_MISSION_CLEAR_ALL, MAVLINK_MESSAGE_INFO_MISSION_ITEM_REACHED, MAVLINK_MESSAGE_INFO_MISSION_ACK, MAVLINK_MESSAGE_INFO_SET_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_SET_LOCAL_POSITION_SETPOINT, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_SETPOINT, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_SETPOINT_INT, MAVLINK_MESSAGE_INFO_SET_GLOBAL_POSITION_SETPOINT_INT, MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SET_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_SET_ROLL_PITCH_YAW_SPEED_THRUST, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_SET_QUAD_MOTORS_SETPOINT, MAVLINK_MESSAGE_INFO_SET_QUAD_SWARM_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_NAV_CONTROLLER_OUTPUT, MAVLINK_MESSAGE_INFO_SET_QUAD_SWARM_LED_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_STATE_CORRECTION, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_REQUEST_DATA_STREAM, MAVLINK_MESSAGE_INFO_DATA_STREAM, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_RC_CHANNELS_OVERRIDE, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_VFR_HUD, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_COMMAND_LONG, MAVLINK_MESSAGE_INFO_COMMAND_ACK, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_RATES_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_MANUAL_SETPOINT, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET, MAVLINK_MESSAGE_INFO_HIL_STATE, MAVLINK_MESSAGE_INFO_HIL_CONTROLS, MAVLINK_MESSAGE_INFO_HIL_RC_INPUTS_RAW, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_GLOBAL_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_SPEED_ESTIMATE, MAVLINK_MESSAGE_INFO_VICON_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_HIGHRES_IMU, MAVLINK_MESSAGE_INFO_OMNIDIRECTIONAL_FLOW, MAVLINK_MESSAGE_INFO_HIL_SENSOR, MAVLINK_MESSAGE_INFO_SIM_STATE, MAVLINK_MESSAGE_INFO_RADIO_STATUS, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_START, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_DIR_LIST, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_RES, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_BATTERY_STATUS, MAVLINK_MESSAGE_INFO_SETPOINT_8DOF, MAVLINK_MESSAGE_INFO_SETPOINT_6DOF, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_OBS_POSITION, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_OBS_VELOCITY, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_OBS_ATTITUDE, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_OBS_WIND, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_OBS_AIR_VELOCITY, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_OBS_BIAS, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_OBS_QFF, MAVLINK_MESSAGE_INFO_OBS_AIR_TEMP, MAVLINK_MESSAGE_INFO_FILT_ROT_VEL, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_LLC_OUT, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_PM_ELEC, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_SYS_Stat, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_CMD_AIRSPEED_CHNG, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_CMD_AIRSPEED_ACK, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_MEMORY_VECT, MAVLINK_MESSAGE_INFO_DEBUG_VECT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_FLOAT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_INT, MAVLINK_MESSAGE_INFO_STATUSTEXT, MAVLINK_MESSAGE_INFO_DEBUG, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}} +#define MAVLINK_MESSAGE_INFO {MAVLINK_MESSAGE_INFO_HEARTBEAT, MAVLINK_MESSAGE_INFO_SYS_STATUS, MAVLINK_MESSAGE_INFO_SYSTEM_TIME, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_PING, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL_ACK, MAVLINK_MESSAGE_INFO_AUTH_KEY, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_SET_MODE, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_VALUE, MAVLINK_MESSAGE_INFO_PARAM_SET, MAVLINK_MESSAGE_INFO_GPS_RAW_INT, MAVLINK_MESSAGE_INFO_GPS_STATUS, MAVLINK_MESSAGE_INFO_SCALED_IMU, MAVLINK_MESSAGE_INFO_RAW_IMU, MAVLINK_MESSAGE_INFO_RAW_PRESSURE, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE, MAVLINK_MESSAGE_INFO_ATTITUDE, MAVLINK_MESSAGE_INFO_ATTITUDE_QUATERNION, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT, MAVLINK_MESSAGE_INFO_RC_CHANNELS_SCALED, MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW, MAVLINK_MESSAGE_INFO_SERVO_OUTPUT_RAW, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_WRITE_PARTIAL_LIST, MAVLINK_MESSAGE_INFO_MISSION_ITEM, MAVLINK_MESSAGE_INFO_MISSION_REQUEST, MAVLINK_MESSAGE_INFO_MISSION_SET_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_CURRENT, MAVLINK_MESSAGE_INFO_MISSION_REQUEST_LIST, MAVLINK_MESSAGE_INFO_MISSION_COUNT, MAVLINK_MESSAGE_INFO_MISSION_CLEAR_ALL, MAVLINK_MESSAGE_INFO_MISSION_ITEM_REACHED, MAVLINK_MESSAGE_INFO_MISSION_ACK, MAVLINK_MESSAGE_INFO_SET_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_GPS_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_SET_LOCAL_POSITION_SETPOINT, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_SETPOINT, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_SETPOINT_INT, MAVLINK_MESSAGE_INFO_SET_GLOBAL_POSITION_SETPOINT_INT, MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SET_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_SET_ROLL_PITCH_YAW_SPEED_THRUST, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_SET_QUAD_MOTORS_SETPOINT, MAVLINK_MESSAGE_INFO_SET_QUAD_SWARM_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_NAV_CONTROLLER_OUTPUT, MAVLINK_MESSAGE_INFO_SET_QUAD_SWARM_LED_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_STATE_CORRECTION, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_REQUEST_DATA_STREAM, MAVLINK_MESSAGE_INFO_DATA_STREAM, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_RC_CHANNELS_OVERRIDE, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_VFR_HUD, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_COMMAND_LONG, MAVLINK_MESSAGE_INFO_COMMAND_ACK, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_RATES_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_MANUAL_SETPOINT, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED_SYSTEM_GLOBAL_OFFSET, MAVLINK_MESSAGE_INFO_HIL_STATE, MAVLINK_MESSAGE_INFO_HIL_CONTROLS, MAVLINK_MESSAGE_INFO_HIL_RC_INPUTS_RAW, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_GLOBAL_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_VISION_SPEED_ESTIMATE, MAVLINK_MESSAGE_INFO_VICON_POSITION_ESTIMATE, MAVLINK_MESSAGE_INFO_HIGHRES_IMU, MAVLINK_MESSAGE_INFO_OMNIDIRECTIONAL_FLOW, MAVLINK_MESSAGE_INFO_HIL_SENSOR, MAVLINK_MESSAGE_INFO_SIM_STATE, MAVLINK_MESSAGE_INFO_RADIO_STATUS, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_START, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_DIR_LIST, MAVLINK_MESSAGE_INFO_FILE_TRANSFER_RES, MAVLINK_MESSAGE_INFO_HIL_GPS, MAVLINK_MESSAGE_INFO_HIL_OPTICAL_FLOW, MAVLINK_MESSAGE_INFO_HIL_STATE_QUATERNION, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_BATTERY_STATUS, MAVLINK_MESSAGE_INFO_SETPOINT_8DOF, MAVLINK_MESSAGE_INFO_SETPOINT_6DOF, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_OBS_POSITION, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_OBS_VELOCITY, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_OBS_ATTITUDE, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_OBS_WIND, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_OBS_AIR_VELOCITY, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_OBS_BIAS, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_OBS_QFF, MAVLINK_MESSAGE_INFO_OBS_AIR_TEMP, MAVLINK_MESSAGE_INFO_FILT_ROT_VEL, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_LLC_OUT, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_PM_ELEC, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_SYS_Stat, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_CMD_AIRSPEED_CHNG, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_CMD_AIRSPEED_ACK, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, MAVLINK_MESSAGE_INFO_MEMORY_VECT, MAVLINK_MESSAGE_INFO_DEBUG_VECT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_FLOAT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_INT, MAVLINK_MESSAGE_INFO_STATUSTEXT, MAVLINK_MESSAGE_INFO_DEBUG, {"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}} #endif #include "../protocol.h" diff --git a/libs/mavlink/include/mavlink/v1.0/sensesoar/version.h b/libs/mavlink/include/mavlink/v1.0/sensesoar/version.h index 47a527dd0ee7e4ae7afdf73ad569e8b79337df4a..4633e6eb5c848faf869970b2320f1ac9e953c068 100644 --- a/libs/mavlink/include/mavlink/v1.0/sensesoar/version.h +++ b/libs/mavlink/include/mavlink/v1.0/sensesoar/version.h @@ -5,7 +5,7 @@ #ifndef MAVLINK_VERSION_H #define MAVLINK_VERSION_H -#define MAVLINK_BUILD_DATE "Fri Jun 7 22:42:18 2013" +#define MAVLINK_BUILD_DATE "Thu Jul 4 13:12:22 2013" #define MAVLINK_WIRE_PROTOCOL_VERSION "1.0" #define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 254 diff --git a/qgroundcontrol.pri b/qgroundcontrol.pri index 30f3aa68aba25d82fc6631f9664315d804a68382..e482d65f1abe1ec257351cc37118d19cad03787c 100644 --- a/qgroundcontrol.pri +++ b/qgroundcontrol.pri @@ -52,8 +52,8 @@ macx|macx-g++42|macx-g++|macx-llvm: { # Copy google earth starter file QMAKE_POST_LINK += && cp -f $$BASEDIR/files/images/earth.html $$TARGETDIR/qgroundcontrol.app/Contents/MacOS # Copy CSS stylesheets - QMAKE_POST_LINK += && cp -f $$BASEDIR/files/styles/style-indoor.css $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/style-indoor.css - QMAKE_POST_LINK += && cp -f $$BASEDIR/files/styles/style-outdoor.css $$TARGETDIR/qgroundcontrol.app/Contents/MacOS + QMAKE_POST_LINK += && cp -f $$BASEDIR/files/styles/style-dark.css $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/style-dark.css + QMAKE_POST_LINK += && cp -f $$BASEDIR/files/styles/style-light.css $$TARGETDIR/qgroundcontrol.app/Contents/MacOS/style-light.css # Copy support files QMAKE_POST_LINK += && cp -rf $$BASEDIR/files $$TARGETDIR/qgroundcontrol.app/Contents/MacOS # Copy MAVLink @@ -301,7 +301,8 @@ win32-msvc2008|win32-msvc2010|win32-msvc2012 { INCLUDEPATH += $$BASEDIR/libs/lib/sdl/msvc/include \ $$BASEDIR/libs/lib/opal/include \ - $$BASEDIR/libs/lib/msinttypes + $$BASEDIR/libs/lib/msinttypes \ + $$(QTDIR)/src/activeqt/shared LIBS += -L$$BASEDIR/libs/lib/sdl/msvc/lib \ -lSDLmain -lSDL \ diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index dc4ca6e3e6fa2349a01b654f8a4b29f9e9a43a5d..064aaffbc005f0f8cbdd2f3e417e8b09f3ad52a1 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -68,6 +68,7 @@ win32 { system( cd $$(QTDIR)\\src\\activeqt && $$(QTDIR)\\bin\\qmake.exe ) system( cd $$(QTDIR)\\src\\activeqt\\container && $$(QTDIR)\\bin\\qmake.exe ) system( cd $$(QTDIR)\\src\\activeqt\\control && $$(QTDIR)\\bin\\qmake.exe ) + system( cd $$(QTDIR)\\src\\activeqt && nmake ) } } @@ -100,7 +101,7 @@ INCLUDEPATH += \ # of custom MAVLink messages of this project. It will also # create a QGC_USE_{AUTOPILOT_NAME}_MESSAGES macro for use # within the actual code. -exists(user_config.pri) { +exists(user_config.pri) { include(user_config.pri) message("----- USING CUSTOM USER QGROUNDCONTROL CONFIG FROM user_config.pri -----") message("Adding support for additional MAVLink messages for: " $$MAVLINK_CONF) @@ -109,7 +110,7 @@ exists(user_config.pri) { MAVLINK_CONF += ardupilotmega } INCLUDEPATH += $$MAVLINKPATH -isEmpty(MAVLINK_CONF) { +isEmpty(MAVLINK_CONF) { INCLUDEPATH += $$MAVLINKPATH/common } else { INCLUDEPATH += $$MAVLINKPATH/$$MAVLINK_CONF @@ -168,7 +169,7 @@ FORMS += src/ui/MainWindow.ui \ src/ui/Linechart.ui \ src/ui/UASView.ui \ src/ui/ParameterInterface.ui \ - src/ui/WaypointList.ui \ + src/ui/WaypointList.ui \ src/ui/ObjectDetectionView.ui \ src/ui/JoystickWidget.ui \ src/ui/DebugConsole.ui \ @@ -202,9 +203,8 @@ FORMS += src/ui/MainWindow.ui \ src/ui/map/QGCMapTool.ui \ src/ui/map/QGCMapToolBar.ui \ src/ui/QGCMAVLinkInspector.ui \ - src/ui/WaypointViewOnlyView.ui \ - src/ui/WaypointEditableView.ui \ - src/ui/UnconnectedUASInfoWidget.ui \ + src/ui/WaypointViewOnlyView.ui \ + src/ui/WaypointEditableView.ui \ src/ui/mavlink/QGCMAVLinkMessageSender.ui \ src/ui/firmwareupdate/QGCFirmwareUpdateWidget.ui \ src/ui/QGCPluginHost.ui \ @@ -234,7 +234,9 @@ FORMS += src/ui/MainWindow.ui \ src/ui/uas/UASActionsWidget.ui \ src/ui/QGCTabbedInfoView.ui \ src/ui/UASRawStatusView.ui \ - src/ui/uas/QGCMessageView.ui + src/ui/uas/QGCMessageView.ui \ + src/ui/JoystickButton.ui \ + src/ui/JoystickAxis.ui INCLUDEPATH += src \ src/ui \ src/ui/linechart \ @@ -283,7 +285,7 @@ HEADERS += src/MG.h \ src/comm/UDPLink.h \ src/ui/ParameterInterface.h \ src/ui/WaypointList.h \ - src/Waypoint.h \ + src/Waypoint.h \ src/ui/ObjectDetectionView.h \ src/input/JoystickInput.h \ src/ui/JoystickWidget.h \ @@ -352,8 +354,7 @@ HEADERS += src/MG.h \ src/ui/MAVLinkDecoder.h \ src/ui/WaypointViewOnlyView.h \ src/ui/WaypointViewOnlyView.h \ - src/ui/WaypointEditableView.h \ - src/ui/UnconnectedUASInfoWidget.h \ + src/ui/WaypointEditableView.h \ src/ui/QGCRGBDView.h \ src/ui/mavlink/QGCMAVLinkMessageSender.h \ src/ui/firmwareupdate/QGCFirmwareUpdateWidget.h \ @@ -384,6 +385,7 @@ HEADERS += src/MG.h \ src/ui/dockwidgettitlebareventfilter.h \ src/ui/uas/UASQuickView.h \ src/ui/uas/UASQuickViewItem.h \ + src/ui/linechart/ChartPlot.h \ src/ui/uas/UASQuickViewItemSelect.h \ src/ui/uas/UASQuickViewTextItem.h \ src/ui/uas/UASQuickViewGaugeItem.h \ @@ -392,13 +394,15 @@ HEADERS += src/MG.h \ src/ui/QGCTabbedInfoView.h \ src/ui/UASRawStatusView.h \ src/ui/PrimaryFlightDisplay.h \ - src/ui/uas/QGCMessageView.h + src/ui/uas/QGCMessageView.h \ + src/ui/JoystickButton.h \ + src/ui/JoystickAxis.h # Google Earth is only supported on Mac OS and Windows with Visual Studio Compiler macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010|win32-msvc2012::HEADERS += src/ui/map3D/QGCGoogleEarthView.h -contains(DEPENDENCIES_PRESENT, osg) { +contains(DEPENDENCIES_PRESENT, osg) { message("Including headers for OpenSceneGraph") - + # Enable only if OpenSceneGraph is available HEADERS += src/ui/map3D/gpl.h \ src/ui/map3D/CameraParams.h \ @@ -431,9 +435,9 @@ contains(DEPENDENCIES_PRESENT, protobuf):contains(MAVLINK_CONF, pixhawk) { src/ui/map3D/ObstacleGroupNode.h \ src/ui/map3D/GLOverlayGeode.h } -contains(DEPENDENCIES_PRESENT, libfreenect) { +contains(DEPENDENCIES_PRESENT, libfreenect) { message("Including headers for libfreenect") - + # Enable only if libfreenect is available HEADERS += src/input/Freenect.h } @@ -442,7 +446,6 @@ SOURCES += src/main.cc \ src/uas/UASManager.cc \ src/uas/UAS.cc \ src/comm/LinkManager.cc \ - src/comm/LinkInterface.cpp \ src/comm/SerialLink.cc \ src/comm/MAVLinkProtocol.cc \ src/comm/QGCFlightGearLink.cc \ @@ -531,7 +534,6 @@ SOURCES += src/main.cc \ src/ui/MAVLinkDecoder.cc \ src/ui/WaypointViewOnlyView.cc \ src/ui/WaypointEditableView.cc \ - src/ui/UnconnectedUASInfoWidget.cc \ src/ui/QGCRGBDView.cc \ src/ui/mavlink/QGCMAVLinkMessageSender.cc \ src/ui/firmwareupdate/QGCFirmwareUpdateWidget.cc \ @@ -561,6 +563,7 @@ SOURCES += src/main.cc \ src/ui/dockwidgettitlebareventfilter.cpp \ src/ui/uas/UASQuickViewItem.cc \ src/ui/uas/UASQuickView.cc \ + src/ui/linechart/ChartPlot.cc \ src/ui/uas/UASQuickViewTextItem.cc \ src/ui/uas/UASQuickViewGaugeItem.cc \ src/ui/uas/UASQuickViewItemSelect.cc \ @@ -570,14 +573,16 @@ SOURCES += src/main.cc \ src/ui/UASRawStatusView.cpp \ src/ui/PrimaryFlightDisplay.cc \ src/ui/uas/QGCMessageView.cc + src/ui/JoystickButton.cc \ + src/ui/JoystickAxis.cc # Enable Google Earth only on Mac OS and Windows with Visual Studio compiler macx|macx-g++|macx-g++42|win32-msvc2008|win32-msvc2010|win32-msvc2012::SOURCES += src/ui/map3D/QGCGoogleEarthView.cc # Enable OSG only if it has been found -contains(DEPENDENCIES_PRESENT, osg) { +contains(DEPENDENCIES_PRESENT, osg) { message("Including sources for OpenSceneGraph") - + # Enable only if OpenSceneGraph is available SOURCES += src/ui/map3D/gpl.cc \ src/ui/map3D/CameraParams.cc \ @@ -602,9 +607,9 @@ contains(DEPENDENCIES_PRESENT, osg) { src/ui/map3D/TerrainParamDialog.cc \ src/ui/map3D/ImageryParamDialog.cc - contains(DEPENDENCIES_PRESENT, osgearth) { + contains(DEPENDENCIES_PRESENT, osgearth) { message("Including sources for osgEarth") - + # Enable only if OpenSceneGraph is available SOURCES += } @@ -617,9 +622,9 @@ contains(DEPENDENCIES_PRESENT, protobuf):contains(MAVLINK_CONF, pixhawk) { src/ui/map3D/ObstacleGroupNode.cc \ src/ui/map3D/GLOverlayGeode.cc } -contains(DEPENDENCIES_PRESENT, libfreenect) { +contains(DEPENDENCIES_PRESENT, libfreenect) { message("Including sources for libfreenect") - + # Enable only if libfreenect is available SOURCES += src/input/Freenect.cc } @@ -628,7 +633,7 @@ contains(DEPENDENCIES_PRESENT, libfreenect) { RESOURCES += qgroundcontrol.qrc # Include RT-LAB Library -win32:exists(src/lib/opalrt/OpalApi.h):exists(C:/OPAL-RT/RT-LAB7.2.4/Common/bin) { +win32:exists(src/lib/opalrt/OpalApi.h):exists(C:/OPAL-RT/RT-LAB7.2.4/Common/bin) { message("Building support for Opal-RT") LIBS += -LC:/OPAL-RT/RT-LAB7.2.4/Common/bin \ -lOpalApi diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index 4b47ee099e56c382f7f044b75cdffe117564b1b6..1323ec395e2857d97670657cc0ad138b7b22829a 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -88,7 +88,7 @@ files/images/status/audio-volume-low.svg files/images/status/audio-volume-high.svg files/images/status/colorbars.png - files/styles/style-indoor.css + files/styles/style-dark.css files/images/splash.png files/audio/alert.wav demo-log.txt @@ -98,7 +98,7 @@ files/images/earth.html files/images/mapproviders/googleearth.svg files/images/contrib/slugs.png - files/styles/style-outdoor.css + files/styles/style-light.css files/images/patterns/lenna.jpg files/images/rc_stick.svg files/images/actions/qgroundcontrol-connect.svg diff --git a/src/QGCCore.cc b/src/QGCCore.cc index d6d7e512a742c36aa9354892723a535cb9de6d91..d58f07f5c964e95b06d55c4ec33ee3927be64f9e 100644 --- a/src/QGCCore.cc +++ b/src/QGCCore.cc @@ -129,25 +129,24 @@ QGCCore::QGCCore(int &argc, char* argv[]) : QApplication(argc, argv) // setFont(fontDatabase.font(fontFamilyName, "Roman", 12)); // Start the comm link manager - splashScreen->showMessage(tr("Starting Communication Links"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); + splashScreen->showMessage(tr("Starting communication links"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); startLinkManager(); // Start the UAS Manager - splashScreen->showMessage(tr("Starting UAS Manager"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); + splashScreen->showMessage(tr("Starting UAS manager"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); startUASManager(); // Start the user interface - splashScreen->showMessage(tr("Starting User Interface"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); - // Start UI + splashScreen->showMessage(tr("Starting user interface"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); + + // The first call to instance() creates the MainWindow, so make sure it's passed the splashScreen. + mainWindow = MainWindow::instance(splashScreen); // Connect links // to make sure that all components are initialized when the // first messages arrive UDPLink* udpLink = new UDPLink(QHostAddress::Any, 14550); MainWindow::instance()->addLink(udpLink); - // Listen on Multicast-Address 239.255.77.77, Port 14550 - //QHostAddress * multicast_udp = new QHostAddress("239.255.77.77"); - //UDPLink* udpLink = new UDPLink(*multicast_udp, 14550); #ifdef OPAL_RT // Add OpalRT Link, but do not connect @@ -157,8 +156,6 @@ QGCCore::QGCCore(int &argc, char* argv[]) : QApplication(argc, argv) MAVLinkSimulationLink* simulationLink = new MAVLinkSimulationLink(":/demo-log.txt"); simulationLink->disconnect(); - mainWindow = MainWindow::instance(splashScreen); - // Remove splash screen splashScreen->finish(mainWindow); diff --git a/src/comm/LinkInterface.cpp b/src/comm/LinkInterface.cpp deleted file mode 100644 index 2ddec09e68b8d4680734429efaa85eb627a84a7e..0000000000000000000000000000000000000000 --- a/src/comm/LinkInterface.cpp +++ /dev/null @@ -1,6 +0,0 @@ -//#include "LinkInterface.h" - -//LinkInterface::~LinkInterface() -//{ - -//} diff --git a/src/comm/LinkInterface.h b/src/comm/LinkInterface.h index 0cd15b3124b4b9feac1e6355e61b9fb55e401bcd..9d62a6c77c4e4ef8c52f241f1af8cc6cb3bc827b 100644 --- a/src/comm/LinkInterface.h +++ b/src/comm/LinkInterface.h @@ -54,19 +54,19 @@ public: * The ID is an unsigned integer, starting at 0 * @return ID of this link **/ - virtual int getId() = 0; + virtual int getId() const = 0; /** * @brief Get the human readable name of this link */ - virtual QString getName() = 0; + virtual QString getName() const = 0; /** * @brief Determine the connection status * * @return True if the connection is established, false otherwise **/ - virtual bool isConnected() = 0; + virtual bool isConnected() const = 0; /* Connection characteristics */ @@ -83,7 +83,7 @@ public: * @see getCurrentDataRate() For the data rate of the last transferred chunk * @see getMaxDataRate() For the maximum data rate **/ - virtual qint64 getNominalDataRate() = 0; + virtual qint64 getNominalDataRate() const = 0; /** * @brief Full duplex support of this interface. @@ -93,7 +93,7 @@ public: * * @return True if the interface supports full duplex, false otherwise **/ - virtual bool isFullDuplex() = 0; + virtual bool isFullDuplex() const = 0; /** * @brief Get the link quality. @@ -103,7 +103,7 @@ public: * * @return The link quality in integer percent or -1 if not supported **/ - virtual int getLinkQuality() = 0; + virtual int getLinkQuality() const = 0; /** * @Brief Get the long term (complete) mean of the data rate @@ -150,7 +150,7 @@ public: * * @return The number of sent bits **/ - virtual qint64 getBitsSent() = 0; + virtual qint64 getBitsSent() const = 0; /** * @Brief Get the total number of bits received @@ -158,7 +158,7 @@ public: * @return The number of received bits * @bug Decide if the bits should be counted fromt the instantiation of the interface or if the counter should reset on disconnect. **/ - virtual qint64 getBitsReceived() = 0; + virtual qint64 getBitsReceived() const = 0; /** * @brief Connect this interface logically diff --git a/src/comm/LinkManager.cc b/src/comm/LinkManager.cc index 0f0a8764565f67af4c5cffaeaf12deefd78effaa..59fc3a99eeea97b7ccea5c2dfce717df25d8a039 100644 --- a/src/comm/LinkManager.cc +++ b/src/comm/LinkManager.cc @@ -98,6 +98,8 @@ void LinkManager::addProtocol(LinkInterface* link, ProtocolInterface* protocol) connect(link, SIGNAL(connected(bool)), protocol, SLOT(linkStatusChanged(bool))); // Store the connection information in the protocol links map protocolLinks.insertMulti(protocol, link); + // Make sure the protocol clears its metadata for this link. + protocol->resetMetadataForLink(link); } //qDebug() << __FILE__ << __LINE__ << "ADDED LINK TO PROTOCOL" << link->getName() << protocol->getName() << "NEW SIZE OF LINK LIST:" << protocolLinks.size(); } @@ -107,6 +109,10 @@ QList LinkManager::getLinksForProtocol(ProtocolInterface* protoc return protocolLinks.values(protocol); } +ProtocolInterface* LinkManager::getProtocolForLink(LinkInterface* link) +{ + return protocolLinks.key(link); +} bool LinkManager::connectAll() { diff --git a/src/comm/LinkManager.h b/src/comm/LinkManager.h index b960ebb7d23bf1e9eb76dce1be2d1f4bc14e5228..ae7590ce729ac1565b0f56f666cd804965a769b6 100644 --- a/src/comm/LinkManager.h +++ b/src/comm/LinkManager.h @@ -56,6 +56,8 @@ public: QList getLinksForProtocol(ProtocolInterface* protocol); + ProtocolInterface* getProtocolForLink(LinkInterface* link); + /** @brief Get the link for this id */ LinkInterface* getLinkForId(int id); diff --git a/src/comm/MAVLinkProtocol.cc b/src/comm/MAVLinkProtocol.cc index 0b8e3141045ac43abb72b1eea95ffc3cc43dd436..4941c68a948d902830e3ef56d3658e46339e6c45 100644 --- a/src/comm/MAVLinkProtocol.cc +++ b/src/comm/MAVLinkProtocol.cc @@ -63,10 +63,11 @@ MAVLinkProtocol::MAVLinkProtocol() : // Start heartbeat timer, emitting a heartbeat at the configured rate connect(heartbeatTimer, SIGNAL(timeout()), this, SLOT(sendHeartbeat())); heartbeatTimer->start(1000/heartbeatRate); - totalReceiveCounter = 0; - totalLossCounter = 0; - currReceiveCounter = 0; - currLossCounter = 0; + + // All the *Counter variables are not initialized here, as they should be initialized + // on a per-link basis before those links are used. @see resetMetadataForLink(). + + // Initialize the list for tracking dropped messages to invalid. for (int i = 0; i < 256; i++) { for (int j = 0; j < 256; j++) @@ -174,6 +175,16 @@ QString MAVLinkProtocol::getLogfileName() } } +void MAVLinkProtocol::resetMetadataForLink(const LinkInterface *link) +{ + int linkId = link->getId(); + totalReceiveCounter[linkId] = 0; + totalLossCounter[linkId] = 0; + totalErrorCounter[linkId] = 0; + currReceiveCounter[linkId] = 0; + currLossCounter[linkId] = 0; +} + void MAVLinkProtocol::linkStatusChanged(bool connected) { LinkInterface* link = qobject_cast(QObject::sender()); @@ -201,7 +212,6 @@ void MAVLinkProtocol::linkStatusChanged(bool connected) } /** - * The bytes are copied by calling the LinkInterface::readBytes() method. * This method parses all incoming bytes and constructs a MAVLink packet. * It can handle multiple links in parallel, as each link has it's own buffer/ * parsing state machine. @@ -214,12 +224,16 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) mavlink_message_t message; mavlink_status_t status; + // Cache the link ID for common use. + int linkId = link->getId(); + static int mavlink09Count = 0; static bool decodedFirstPacket = false; static bool warnedUser = false; + // FIXME: Add check for if link->getId() >= MAVLINK_COMM_NUM_BUFFERS for (int position = 0; position < b.size(); position++) { - unsigned int decodeState = mavlink_parse_char(link->getId(), (uint8_t)(b[position]), &message, &status); + unsigned int decodeState = mavlink_parse_char(linkId, (uint8_t)(b[position]), &message, &status); if ((uint8_t)b[position] == 0x55) mavlink09Count++; if ((mavlink09Count > 100) && !decodedFirstPacket && !warnedUser) @@ -230,6 +244,9 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) emit protocolStatusMessage("MAVLink Version or Baud Rate Mismatch", "Your MAVLink device seems to use the deprecated version 0.9, while QGroundControl only supports version 1.0+. Please upgrade the MAVLink version of your autopilot. If your autopilot is using version 1.0, check if the baud rates of QGroundControl and your autopilot are the same."); } + // Count parser errors as well. + totalErrorCounter[linkId] += status.packet_rx_drop_count; + if (decodeState == 1) { decodedFirstPacket = true; @@ -391,8 +408,8 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) { // Increase receive counter - totalReceiveCounter++; - currReceiveCounter++; + totalReceiveCounter[linkId]++; + currReceiveCounter[linkId]++; // Update last message sequence ID uint8_t expectedIndex; @@ -412,7 +429,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) if (message.seq != expectedIndex) { // Determine how many messages were skipped accounting for 0-wraparound - int16_t lostMessages = message.seq - expectedIndex; + int16_t lostMessages = message.seq - expectedIndex; if (lostMessages < 0) { // Usually, this happens in the case of an out-of order packet @@ -423,22 +440,22 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b) // Console generates excessive load at high loss rates, needs better GUI visualization //qDebug() << QString("Lost %1 messages for comp %4: expected sequence ID %2 but received %3.").arg(lostMessages).arg(expectedIndex).arg(message.seq).arg(message.compid); } - totalLossCounter += lostMessages; - currLossCounter += lostMessages; + totalLossCounter[linkId] += lostMessages; + currLossCounter[linkId] += lostMessages; } // Update the last sequence ID lastIndex[message.sysid][message.compid] = message.seq; // Update on every 32th packet - if (totalReceiveCounter % 32 == 0) + if (totalReceiveCounter[linkId] % 32 == 0) { // Calculate new loss ratio // Receive loss - float receiveLoss = (double)currLossCounter/(double)(currReceiveCounter+currLossCounter); + float receiveLoss = (double)currLossCounter[linkId]/(double)(currReceiveCounter[linkId]+currLossCounter[linkId]); receiveLoss *= 100.0f; - currLossCounter = 0; - currReceiveCounter = 0; + currLossCounter[linkId] = 0; + currReceiveCounter[linkId] = 0; emit receiveLossChanged(message.sysid, receiveLoss); } diff --git a/src/comm/MAVLinkProtocol.h b/src/comm/MAVLinkProtocol.h index 829b8e6ac46d556d2e5b379012328f49370365fc..3dc72563f50ebd4c8e34594d4c34b45d3aa7cae4 100644 --- a/src/comm/MAVLinkProtocol.h +++ b/src/comm/MAVLinkProtocol.h @@ -124,6 +124,31 @@ public: int getActionRetransmissionTimeout() { return m_actionRetransmissionTimeout; } + /** + * Retrieve a total of all successfully parsed packets for the specified link. + * @returns -1 if this is not available for this protocol, # of packets otherwise. + */ + qint32 getReceivedPacketCount(const LinkInterface *link) const { + return totalReceiveCounter[link->getId()]; + } + /** + * Retrieve a total of all parsing errors for the specified link. + * @returns -1 if this is not available for this protocol, # of errors otherwise. + */ + qint32 getParsingErrorCount(const LinkInterface *link) const { + return totalErrorCounter[link->getId()]; + } + /** + * Retrieve a total of all dropped packets for the specified link. + * @returns -1 if this is not available for this protocol, # of packets otherwise. + */ + qint32 getDroppedPacketCount(const LinkInterface *link) const { + return totalLossCounter[link->getId()]; + } + /** + * Reset the counters for all metadata for this link. + */ + virtual void resetMetadataForLink(const LinkInterface *link); public slots: /** @brief Receive bytes from a communication interface */ @@ -201,12 +226,13 @@ protected: bool m_paramGuardEnabled; ///< Parameter retransmission/rewrite enabled bool m_actionGuardEnabled; ///< Action request retransmission enabled int m_actionRetransmissionTimeout; ///< Timeout for parameter retransmission - QMutex receiveMutex; ///< Mutex to protect receiveBytes function - int lastIndex[256][256]; ///< Store the last received sequence ID for each system/componenet pair - int totalReceiveCounter; - int totalLossCounter; - int currReceiveCounter; - int currLossCounter; + QMutex receiveMutex; ///< Mutex to protect receiveBytes function + int lastIndex[256][256]; ///< Store the last received sequence ID for each system/componenet pair + int totalReceiveCounter[MAVLINK_COMM_NUM_BUFFERS]; ///< The total number of successfully received messages + int totalLossCounter[MAVLINK_COMM_NUM_BUFFERS]; ///< Total messages lost during transmission. + int totalErrorCounter[MAVLINK_COMM_NUM_BUFFERS]; ///< Total count of all parsing errors. Generally <= totalLossCounter. + int currReceiveCounter[MAVLINK_COMM_NUM_BUFFERS]; ///< Received messages during this sample time window. Used for calculating loss %. + int currLossCounter[MAVLINK_COMM_NUM_BUFFERS]; ///< Lost messages during this sample time window. Used for calculating loss %. bool versionMismatchIgnore; int systemId; #if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES) diff --git a/src/comm/MAVLinkSimulationLink.cc b/src/comm/MAVLinkSimulationLink.cc index f94f4021aa2f77b7e1762a8570f4fb87e68f0fab..a75042bf372b60a214ac80d6f3877fbc5c781e52 100644 --- a/src/comm/MAVLinkSimulationLink.cc +++ b/src/comm/MAVLinkSimulationLink.cc @@ -684,7 +684,7 @@ void MAVLinkSimulationLink::writeBytes(const char* data, qint64 size) if (mavlink_parse_char(this->id, data[i], &msg, &comm)) { // MESSAGE RECEIVED! - qDebug() << "SIMULATION LINK RECEIVED MESSAGE!"; +// qDebug() << "SIMULATION LINK RECEIVED MESSAGE!"; emit messageReceived(msg); switch (msg.msgid) @@ -722,7 +722,7 @@ void MAVLinkSimulationLink::writeBytes(const char* data, qint64 size) mavlink_command_long_t action; mavlink_msg_command_long_decode(&msg, &action); - qDebug() << "SIM" << "received action" << action.command << "for system" << action.target_system; +// qDebug() << "SIM" << "received action" << action.command << "for system" << action.target_system; // FIXME MAVLINKV10PORTINGNEEDED // switch (action.action) { @@ -756,13 +756,13 @@ void MAVLinkSimulationLink::writeBytes(const char* data, qint64 size) case MAVLINK_MSG_ID_MANUAL_CONTROL: { mavlink_manual_control_t control; mavlink_msg_manual_control_decode(&msg, &control); - qDebug() << "\n" << "ROLL:" << control.x << "PITCH:" << control.y; +// qDebug() << "\n" << "ROLL:" << control.x << "PITCH:" << control.y; } break; #endif case MAVLINK_MSG_ID_PARAM_REQUEST_LIST: { - qDebug() << "GCS REQUESTED PARAM LIST FROM SIMULATION"; +// qDebug() << "GCS REQUESTED PARAM LIST FROM SIMULATION"; mavlink_param_request_list_t read; mavlink_msg_param_request_list_decode(&msg, &read); if (read.target_system == systemId) @@ -785,7 +785,7 @@ void MAVLinkSimulationLink::writeBytes(const char* data, qint64 size) j++; } - qDebug() << "SIMULATION SENT PARAMETERS TO GCS"; +// qDebug() << "SIMULATION SENT PARAMETERS TO GCS"; } } break; @@ -794,7 +794,7 @@ void MAVLinkSimulationLink::writeBytes(const char* data, qint64 size) // Drop on even milliseconds if (QGC::groundTimeMilliseconds() % 2 == 0) { - qDebug() << "SIMULATION RECEIVED COMMAND TO SET PARAMETER"; +// qDebug() << "SIMULATION RECEIVED COMMAND TO SET PARAMETER"; mavlink_param_set_t set; mavlink_msg_param_set_decode(&msg, &set); // if (set.target_system == systemId) @@ -819,7 +819,7 @@ void MAVLinkSimulationLink::writeBytes(const char* data, qint64 size) break; case MAVLINK_MSG_ID_PARAM_REQUEST_READ: { - qDebug() << "SIMULATION RECEIVED COMMAND TO SEND PARAMETER"; +// qDebug() << "SIMULATION RECEIVED COMMAND TO SEND PARAMETER"; mavlink_param_request_read_t read; mavlink_msg_param_request_read_decode(&msg, &read); QByteArray bytes((char*)read.param_id, MAVLINK_MSG_PARAM_REQUEST_READ_FIELD_PARAM_ID_LEN); @@ -855,10 +855,7 @@ void MAVLinkSimulationLink::writeBytes(const char* data, qint64 size) break; } } - unsigned char v=data[i]; - fprintf(stderr,"%02x ", v); } - fprintf(stderr,"\n"); readyBufferMutex.lock(); for (int i = 0; i < streampointer; i++) @@ -988,22 +985,22 @@ bool MAVLinkSimulationLink::connectLink(bool connect) * * @return True if link is connected, false otherwise. **/ -bool MAVLinkSimulationLink::isConnected() +bool MAVLinkSimulationLink::isConnected() const { return _isConnected; } -int MAVLinkSimulationLink::getId() +int MAVLinkSimulationLink::getId() const { return id; } -QString MAVLinkSimulationLink::getName() +QString MAVLinkSimulationLink::getName() const { return name; } -qint64 MAVLinkSimulationLink::getNominalDataRate() +qint64 MAVLinkSimulationLink::getNominalDataRate() const { /* 100 Mbit is reasonable fast and sufficient for all embedded applications */ return 100000000; @@ -1031,12 +1028,12 @@ qint64 MAVLinkSimulationLink::getMaxUpstream() return 0; } -qint64 MAVLinkSimulationLink::getBitsSent() +qint64 MAVLinkSimulationLink::getBitsSent() const { return 0; } -qint64 MAVLinkSimulationLink::getBitsReceived() +qint64 MAVLinkSimulationLink::getBitsReceived() const { return 0; } @@ -1061,13 +1058,13 @@ qint64 MAVLinkSimulationLink::getMaxDownstream() return 0; } -bool MAVLinkSimulationLink::isFullDuplex() +bool MAVLinkSimulationLink::isFullDuplex() const { /* Full duplex is no problem when running in pure software, but this is a serial simulation */ return false; } -int MAVLinkSimulationLink::getLinkQuality() +int MAVLinkSimulationLink::getLinkQuality() const { /* The Link quality is always perfect when running in software */ return 100; diff --git a/src/comm/MAVLinkSimulationLink.h b/src/comm/MAVLinkSimulationLink.h index 64520a50a2f0f067cacc5e689907fd453edc71b6..505a9012f77a2f03ecc10d35b79ba01090d889ee 100644 --- a/src/comm/MAVLinkSimulationLink.h +++ b/src/comm/MAVLinkSimulationLink.h @@ -50,7 +50,7 @@ class MAVLinkSimulationLink : public LinkInterface public: MAVLinkSimulationLink(QString readFile="", QString writeFile="", int rate=5, QObject* parent = 0); ~MAVLinkSimulationLink(); - bool isConnected(); + bool isConnected() const; qint64 bytesAvailable(); void run(); @@ -59,7 +59,7 @@ public: bool disconnect(); /* Extensive statistics for scientific purposes */ - qint64 getNominalDataRate(); + qint64 getNominalDataRate() const; qint64 getTotalUpstream(); qint64 getShortTermUpstream(); qint64 getCurrentUpstream(); @@ -68,20 +68,20 @@ public: qint64 getShortTermDownstream(); qint64 getCurrentDownstream(); qint64 getMaxDownstream(); - qint64 getBitsSent(); - qint64 getBitsReceived(); - - QString getName(); - int getId(); - int getBaudRate(); - int getBaudRateType(); - int getFlowType(); - int getParityType(); - int getDataBitsType(); - int getStopBitsType(); - - int getLinkQuality(); - bool isFullDuplex(); + qint64 getBitsSent() const; + qint64 getBitsReceived() const; + + QString getName() const; + int getId() const; + int getBaudRate() const; + int getBaudRateType() const; + int getFlowType() const; + int getParityType() const; + int getDataBitsType() const; + int getStopBitsType() const; + + int getLinkQuality() const; + bool isFullDuplex() const; public slots: void writeBytes(const char* data, qint64 size); diff --git a/src/comm/MAVLinkSimulationMAV.cc b/src/comm/MAVLinkSimulationMAV.cc index d65ea66ddb50e31eaf8fcb1f6f6e2ddc62d813bc..2f575eff73ac3d093c132dce00ecbd424b69e207 100644 --- a/src/comm/MAVLinkSimulationMAV.cc +++ b/src/comm/MAVLinkSimulationMAV.cc @@ -130,7 +130,7 @@ void MAVLinkSimulationMAV::mainloop() y = nextSPY; z = nextSPZ; firstWP = false; - qDebug() << "INIT STEP"; +// qDebug() << "INIT STEP"; } } else @@ -139,7 +139,6 @@ void MAVLinkSimulationMAV::mainloop() } - // GLOBAL POSITION mavlink_message_t msg; mavlink_global_position_int_t pos; @@ -383,11 +382,11 @@ static void print_message(const mavlink_message_t *msg) const mavlink_message_info_t *m = &message_info[msg->msgid]; const mavlink_field_info_t *f = m->fields; unsigned i; - qDebug("%s { ", m->name); - for (i=0; inum_fields; i++) { - print_field(msg, &f[i]); - } - qDebug("}\n"); +// qDebug("%s { ", m->name); +// for (i=0; inum_fields; i++) { +// print_field(msg, &f[i]); +// } +// qDebug("}\n"); } void MAVLinkSimulationMAV::handleMessage(const mavlink_message_t& msg) @@ -395,7 +394,7 @@ void MAVLinkSimulationMAV::handleMessage(const mavlink_message_t& msg) if (msg.sysid != systemid) { print_message(&msg); - qDebug() << "MAV:" << systemid << "RECEIVED MESSAGE FROM" << msg.sysid << "COMP" << msg.compid; +// qDebug() << "MAV:" << systemid << "RECEIVED MESSAGE FROM" << msg.sysid << "COMP" << msg.compid; } switch(msg.msgid) { @@ -407,13 +406,51 @@ void MAVLinkSimulationMAV::handleMessage(const mavlink_message_t& msg) if (systemid == mode.target_system) sys_mode = mode.base_mode; } break; - case MAVLINK_MSG_ID_HIL_STATE: + case MAVLINK_MSG_ID_HIL_STATE_QUATERNION: { - mavlink_hil_state_t state; - mavlink_msg_hil_state_decode(&msg, &state); - roll = state.roll; - pitch = state.pitch; - yaw = state.yaw; + mavlink_hil_state_quaternion_t state; + mavlink_msg_hil_state_quaternion_decode(&msg, &state); + + double a = state.attitude_quaternion[0]; + double b = state.attitude_quaternion[1]; + double c = state.attitude_quaternion[2]; + double d = state.attitude_quaternion[3]; + double aSq = a * a; + double bSq = b * b; + double cSq = c * c; + double dSq = d * d; + float dcm[3][3]; + dcm[0][0] = aSq + bSq - cSq - dSq; + dcm[0][1] = 2.0 * (b * c - a * d); + dcm[0][2] = 2.0 * (a * c + b * d); + dcm[1][0] = 2.0 * (b * c + a * d); + dcm[1][1] = aSq - bSq + cSq - dSq; + dcm[1][2] = 2.0 * (c * d - a * b); + dcm[2][0] = 2.0 * (b * d - a * c); + dcm[2][1] = 2.0 * (a * b + c * d); + dcm[2][2] = aSq - bSq - cSq + dSq; + + float phi, theta, psi; + theta = asin(-dcm[2][0]); + + if (fabs(theta - M_PI_2) < 1.0e-3f) { + phi = 0.0f; + psi = (atan2(dcm[1][2] - dcm[0][1], + dcm[0][2] + dcm[1][1]) + phi); + + } else if (fabs(theta + M_PI_2) < 1.0e-3f) { + phi = 0.0f; + psi = atan2f(dcm[1][2] - dcm[0][1], + dcm[0][2] + dcm[1][1] - phi); + + } else { + phi = atan2f(dcm[2][1], dcm[2][2]); + psi = atan2f(dcm[1][0], dcm[0][0]); + } + + roll = phi; + pitch = theta; + yaw = psi; rollspeed = state.rollspeed; pitchspeed = state.pitchspeed; yawspeed = state.yawspeed; diff --git a/src/comm/OpalLink.cc b/src/comm/OpalLink.cc index 9b01e986442116190a7aa55c9d3bb1f5492e8b7f..62a09dbda44d86a12e9f6bd08fb076a074474704 100644 --- a/src/comm/OpalLink.cc +++ b/src/comm/OpalLink.cc @@ -411,12 +411,12 @@ void OpalLink::run() // qDebug() << "OpalLink::run():: Starting the thread"; } -int OpalLink::getId() +int OpalLink::getId() const { return id; } -QString OpalLink::getName() +QString OpalLink::getName() const { return name; } @@ -427,7 +427,7 @@ void OpalLink::setName(QString name) emit nameChanged(this->name); } -bool OpalLink::isConnected() +bool OpalLink::isConnected() const { return connectState; } @@ -505,12 +505,12 @@ bool OpalLink::disconnect() * */ -qint64 OpalLink::getNominalDataRate() +qint64 OpalLink::getNominalDataRate() const { return 0; //unknown } -int OpalLink::getLinkQuality() +int OpalLink::getLinkQuality() const { return -1; //not supported } @@ -541,18 +541,18 @@ qint64 OpalLink::getMaxUpstream() return 0; //unknown } -qint64 OpalLink::getBitsSent() +qint64 OpalLink::getBitsSent() const { return bitsSentTotal; } -qint64 OpalLink::getBitsReceived() +qint64 OpalLink::getBitsReceived() const { return bitsReceivedTotal; } -bool OpalLink::isFullDuplex() +bool OpalLink::isFullDuplex() const { return false; } diff --git a/src/comm/OpalLink.h b/src/comm/OpalLink.h index 0721bb1d8e5049f545b05f43b5a7d2c285889cb8..bfbdfdb676e79b2a752cbe70241b10ea8040d473 100644 --- a/src/comm/OpalLink.h +++ b/src/comm/OpalLink.h @@ -71,22 +71,22 @@ public: OpalLink(); /* Connection management */ - int getId(); - QString getName(); - bool isConnected(); + int getId() const; + QString getName() const; + bool isConnected() const; /* Connection characteristics */ - qint64 getNominalDataRate(); - bool isFullDuplex(); - int getLinkQuality(); + qint64 getNominalDataRate() const; + bool isFullDuplex() const; + int getLinkQuality() const; qint64 getTotalUpstream(); qint64 getTotalDownstream(); qint64 getCurrentUpstream(); qint64 getMaxUpstream(); - qint64 getBitsSent(); - qint64 getBitsReceived(); + qint64 getBitsSent() const; + qint64 getBitsReceived() const; bool connect(); diff --git a/src/comm/ProtocolInterface.h b/src/comm/ProtocolInterface.h index 758a0a79bcfe0cb7a44ac5bea445395d11735416..150d5eb8f751385fd21e7541161a85846b2ec90a 100644 --- a/src/comm/ProtocolInterface.h +++ b/src/comm/ProtocolInterface.h @@ -50,8 +50,32 @@ class ProtocolInterface : public QObject { Q_OBJECT public: - //virtual ~ProtocolInterface() {}; + virtual ~ProtocolInterface () {} virtual QString getName() = 0; + /** + * Retrieve a total of all successfully parsed packets for the specified link. + * @param link The link to return metadata about. + * @returns -1 if this is not available for this protocol, # of packets otherwise. + */ + virtual qint32 getReceivedPacketCount(const LinkInterface *link) const = 0; + /** + * Retrieve a total of all parsing errors for the specified link. + * @param link The link to return metadata about. + * @returns -1 if this is not available for this protocol, # of errors otherwise. + */ + virtual qint32 getParsingErrorCount(const LinkInterface *link) const = 0; + /** + * Retrieve a total of all dropped packets for the specified link. + * @param link The link to return metadata about. + * @returns -1 if this is not available for this protocol, # of packets otherwise. + */ + virtual qint32 getDroppedPacketCount(const LinkInterface *link) const = 0; + /** + * Reset the received, error, and dropped counts for the given link. Useful for + * when reconnecting a link. + * @param link The link to reset metadata for. + */ + virtual void resetMetadataForLink(const LinkInterface *link) = 0; public slots: virtual void receiveBytes(LinkInterface *link, QByteArray b) = 0; diff --git a/src/comm/QGCFlightGearLink.cc b/src/comm/QGCFlightGearLink.cc index 2c1ec4b49712d49e3d12424317b743ab19975497..61341b048839ba72b215c3a52f32b31a3cf27ddb 100644 --- a/src/comm/QGCFlightGearLink.cc +++ b/src/comm/QGCFlightGearLink.cc @@ -242,6 +242,10 @@ void QGCFlightGearLink::readBytes() // Parse string float roll, pitch, yaw, rollspeed, pitchspeed, yawspeed; double lat, lon, alt; + + // XXX add + float ind_airspeed = 0.0f; + float true_airspeed = 0.0f; double vx, vy, vz, xacc, yacc, zacc; lat = values.at(1).toDouble(); @@ -265,7 +269,7 @@ void QGCFlightGearLink::readBytes() // Send updated state emit hilStateChanged(QGC::groundTimeUsecs(), roll, pitch, yaw, rollspeed, pitchspeed, yawspeed, lat, lon, alt, - vx, vy, vz, xacc, yacc, zacc); + vx, vy, vz, ind_airspeed, true_airspeed, xacc, yacc, zacc); // // Echo data for debugging purposes // std::cerr << __FILE__ << __LINE__ << "Received datagram:" << std::endl; @@ -299,7 +303,7 @@ bool QGCFlightGearLink::disconnectSimulation() disconnect(process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError))); disconnect(mav, SIGNAL(hilControlsChanged(uint64_t, float, float, float, float, uint8_t, uint8_t)), this, SLOT(updateControls(uint64_t,float,float,float,float,uint8_t,uint8_t))); - disconnect(this, SIGNAL(hilStateChanged(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float)), mav, SLOT(sendHilState(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float))); + disconnect(this, SIGNAL(hilStateChanged(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float)), mav, SLOT(sendHilState(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float))); if (process) { @@ -346,7 +350,7 @@ bool QGCFlightGearLink::connectSimulation() terraSync = new QProcess(this); connect(mav, SIGNAL(hilControlsChanged(uint64_t, float, float, float, float, uint8_t, uint8_t)), this, SLOT(updateControls(uint64_t,float,float,float,float,uint8_t,uint8_t))); - connect(this, SIGNAL(hilStateChanged(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float)), mav, SLOT(sendHilState(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float))); + connect(this, SIGNAL(hilStateChanged(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float)), mav, SLOT(sendHilState(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float))); UAS* uas = dynamic_cast(mav); diff --git a/src/comm/QGCHilLink.h b/src/comm/QGCHilLink.h index 155c9f5b049a6bfef90ebf018f64e1ea35b4339c..788165097f6c4992a35445559fc5ee979a462791 100644 --- a/src/comm/QGCHilLink.h +++ b/src/comm/QGCHilLink.h @@ -91,16 +91,20 @@ signals: /** @brief State update from simulation */ void hilStateChanged(quint64 time_us, float roll, float pitch, float yaw, float rollspeed, float pitchspeed, float yawspeed, double lat, double lon, double alt, - float vx, float vy, float vz, float xacc, float yacc, float zacc); + float vx, float vy, float vz, float ind_airspeed, float true_airspeed, float xacc, float yacc, float zacc); - void sensorHilGpsChanged(quint64 time_us, double lat, double lon, double alt, int fix_type, float eph, float epv, float vel, float cog, int satellites); + void hilGroundTruthChanged(quint64 time_us, float roll, float pitch, float yaw, float rollspeed, + float pitchspeed, float yawspeed, double lat, double lon, double alt, + float vx, float vy, float vz, float ind_airspeed, float true_airspeed, float xacc, float yacc, float zacc); + + void sensorHilGpsChanged(quint64 time_us, double lat, double lon, double alt, int fix_type, float eph, float epv, float vel, float vn, float ve, float vd, float cog, int satellites); void sensorHilRawImuChanged(quint64 time_us, float xacc, float yacc, float zacc, float xgyro, float ygyro, float zgyro, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, - quint16 fields_updated); + quint32 fields_updated); /** @brief Remote host and port changed */ void remoteChanged(const QString& hostPort); diff --git a/src/comm/QGCJSBSimLink.cc b/src/comm/QGCJSBSimLink.cc index a0dcf11315722177559f1ab53cafb187039b3f81..8f0f23084287861ab60cb7f7a79019925edba6ca 100644 --- a/src/comm/QGCJSBSimLink.cc +++ b/src/comm/QGCJSBSimLink.cc @@ -271,7 +271,7 @@ bool QGCJSBSimLink::disconnectSimulation() disconnect(process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError))); disconnect(mav, SIGNAL(hilControlsChanged(uint64_t, float, float, float, float, uint8_t, uint8_t)), this, SLOT(updateControls(uint64_t,float,float,float,float,uint8_t,uint8_t))); - disconnect(this, SIGNAL(hilStateChanged(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float)), mav, SLOT(sendHilState(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float))); + disconnect(this, SIGNAL(hilStateChanged(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float)), mav, SLOT(sendHilState(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float))); if (process) { @@ -311,7 +311,7 @@ bool QGCJSBSimLink::connectSimulation() process = new QProcess(this); connect(mav, SIGNAL(hilControlsChanged(uint64_t, float, float, float, float, uint8_t, uint8_t)), this, SLOT(updateControls(uint64_t,float,float,float,float,uint8_t,uint8_t))); - connect(this, SIGNAL(hilStateChanged(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float)), mav, SLOT(sendHilState(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float))); + connect(this, SIGNAL(hilStateChanged(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float)), mav, SLOT(sendHilState(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float))); UAS* uas = dynamic_cast(mav); diff --git a/src/comm/QGCXPlaneLink.cc b/src/comm/QGCXPlaneLink.cc index 7e42a07a379fccae2b524cd2ad7ac8967a4975d7..5841a5b0a54c17ed8f1523761d5f553247d223ce 100644 --- a/src/comm/QGCXPlaneLink.cc +++ b/src/comm/QGCXPlaneLink.cc @@ -54,7 +54,7 @@ QGCXPlaneLink::QGCXPlaneLink(UASInterface* mav, QString remoteHost, QHostAddress simUpdateLast(QGC::groundTimeMilliseconds()), simUpdateLastText(QGC::groundTimeMilliseconds()), simUpdateHz(0), - _sensorHilEnabled(false) + _sensorHilEnabled(true) { this->localHost = localHost; this->localPort = localPort/*+mav->getUASID()*/; @@ -468,7 +468,8 @@ void QGCXPlaneLink::readBytes() if (p.index == 3) { - airspeed = p.f[6] * 0.44704f; + ind_airspeed = p.f[5] * 0.44704f; + true_airspeed = p.f[6] * 0.44704f; groundspeed = p.f[7] * 0.44704; //qDebug() << "SPEEDS:" << "airspeed" << airspeed << "m/s, groundspeed" << groundspeed << "m/s"; @@ -523,8 +524,6 @@ void QGCXPlaneLink::readBytes() roll = p.f[1] / 180.0f * M_PI; yaw = p.f[2] / 180.0f * M_PI; - yaw = yaw; - // X-Plane expresses yaw as 0..2 PI if (yaw > M_PI) { yaw -= 2.0 * M_PI; @@ -551,6 +550,43 @@ void QGCXPlaneLink::readBytes() zmag = 0.45f; fields_changed |= (1 << 6) | (1 << 7) | (1 << 8); + double cosPhi = cos(roll); + double sinPhi = sin(roll); + double cosThe = cos(pitch); + double sinThe = sin(pitch); + double cosPsi = cos(0); + double sinPsi = sin(0); + + float dcm[3][3]; + + dcm[0][0] = cosThe * cosPsi; + dcm[0][1] = -cosPhi * sinPsi + sinPhi * sinThe * cosPsi; + dcm[0][2] = sinPhi * sinPsi + cosPhi * sinThe * cosPsi; + + dcm[1][0] = cosThe * sinPsi; + dcm[1][1] = cosPhi * cosPsi + sinPhi * sinThe * sinPsi; + dcm[1][2] = -sinPhi * cosPsi + cosPhi * sinThe * sinPsi; + + dcm[2][0] = -sinThe; + dcm[2][1] = sinPhi * cosThe; + dcm[2][2] = cosPhi * cosThe; + + Eigen::Matrix3f m = Eigen::Map((float*)dcm).eval(); + + Eigen::Vector3f mag(xmag, ymag, zmag); + + Eigen::Vector3f magbody = m * mag; + + qDebug() << "yaw mag:" << p.f[2] << "x" << xmag << "y" << ymag; + qDebug() << "yaw mag in body:" << magbody(0) << magbody(1) << magbody(2); + + xmag = magbody(0); + ymag = magbody(1); + zmag = magbody(2); + + // Rotate the measurement vector into the body frame using roll and pitch + + emitUpdate = true; } @@ -569,7 +605,9 @@ void QGCXPlaneLink::readBytes() { vy = p.f[3]; vx = -p.f[5]; - vz = p.f[4]; + // moving 'up' in XPlane is positive, but its negative in NED + // for us. + vz = -p.f[4]; } else if (p.index == 12) { @@ -623,7 +661,6 @@ void QGCXPlaneLink::readBytes() // Set state simUpdateLastText = QGC::groundTimeMilliseconds(); } - simUpdateLast = QGC::groundTimeMilliseconds(); if (_sensorHilEnabled) { @@ -634,19 +671,30 @@ void QGCXPlaneLink::readBytes() emit sensorHilRawImuChanged(QGC::groundTimeUsecs(), xacc, yacc, zacc, rollspeed, pitchspeed, yawspeed, xmag, ymag, zmag, abs_pressure, diff_pressure, pressure_alt, temperature, fields_changed); + + // XXX make these GUI-configurable and add randomness + int gps_fix_type = 3; + float eph = 0.3; + float epv = 0.6; + float vel = sqrt(vx*vx + vy*vy + vz*vz); + float cog = atan2(vy, vx); + int satellites = 8; + + emit sensorHilGpsChanged(QGC::groundTimeUsecs(), lat, lon, alt, gps_fix_type, eph, epv, vel, vx, vy, vz, cog, satellites); + } else { + emit hilStateChanged(QGC::groundTimeUsecs(), roll, pitch, yaw, rollspeed, + pitchspeed, yawspeed, lat, lon, alt, + vx, vy, vz, ind_airspeed, true_airspeed, xacc, yacc, zacc); + } + + // Limit ground truth to 25 Hz + if (QGC::groundTimeMilliseconds() - simUpdateLast > 40) { + emit hilGroundTruthChanged(QGC::groundTimeUsecs(), roll, pitch, yaw, rollspeed, + pitchspeed, yawspeed, lat, lon, alt, + vx, vy, vz, ind_airspeed, true_airspeed, xacc, yacc, zacc); } - int gps_fix_type = 3; - float eph = 0.3; - float epv = 0.6; - float vel = sqrt(vx*vx + vy*vy + vz*vz); - float cog = atan2(vy, vx); - int satellites = 8; - - emit sensorHilGpsChanged(QGC::groundTimeUsecs(), lat, lon, alt, gps_fix_type, eph, epv, vel, cog, satellites); - emit hilStateChanged(QGC::groundTimeUsecs(), roll, pitch, yaw, rollspeed, - pitchspeed, yawspeed, lat, lon, alt, - vx, vy, vz, xacc, yacc, zacc); + simUpdateLast = QGC::groundTimeMilliseconds(); } if (!oldConnectionState && xPlaneConnected) @@ -694,9 +742,10 @@ bool QGCXPlaneLink::disconnectSimulation() disconnect(mav, SIGNAL(hilControlsChanged(uint64_t, float, float, float, float, uint8_t, uint8_t)), this, SLOT(updateControls(uint64_t,float,float,float,float,uint8_t,uint8_t))); disconnect(mav, SIGNAL(hilActuatorsChanged(uint64_t, float, float, float, float, float, float, float, float)), this, SLOT(updateActuators(uint64_t,float,float,float,float,float,float,float,float))); - disconnect(this, SIGNAL(hilStateChanged(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float)), mav, SLOT(sendHilState(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float))); - disconnect(this, SIGNAL(sensorHilGpsChanged(quint64,double,double,double,int,float,float,float,float,int)), mav, SLOT(sendHilGps(quint64, double, double, double, int, float, float, float, float, int))); - disconnect(this, SIGNAL(sensorHilRawImuChanged(quint64,float,float,float,float,float,float,float,float,float,float,float,float,float,quint16)), mav, SLOT(sendHilSensors(quint64,float,float,float,float,float,float,float,float,float,float,float,float,float,quint16))); + disconnect(this, SIGNAL(hilGroundTruthChanged(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float)), mav, SLOT(sendHilGroundTruth(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float))); + disconnect(this, SIGNAL(hilStateChanged(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float)), mav, SLOT(sendHilState(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float))); + disconnect(this, SIGNAL(sensorHilGpsChanged(quint64,double,double,double,int,float,float,float,float,float,float,float,int)), mav, SLOT(sendHilGps(quint64,double,double,double,int,float,float,float,float,float,float,float,int))); + disconnect(this, SIGNAL(sensorHilRawImuChanged(quint64,float,float,float,float,float,float,float,float,float,float,float,float,float,quint32)), mav, SLOT(sendHilSensors(quint64,float,float,float,float,float,float,float,float,float,float,float,float,float,quint32))); UAS* uas = dynamic_cast(mav); if (uas) @@ -878,9 +927,10 @@ bool QGCXPlaneLink::connectSimulation() connect(mav, SIGNAL(hilControlsChanged(uint64_t, float, float, float, float, uint8_t, uint8_t)), this, SLOT(updateControls(uint64_t,float,float,float,float,uint8_t,uint8_t))); connect(mav, SIGNAL(hilActuatorsChanged(uint64_t, float, float, float, float, float, float, float, float)), this, SLOT(updateActuators(uint64_t,float,float,float,float,float,float,float,float))); - connect(this, SIGNAL(hilStateChanged(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float)), mav, SLOT(sendHilState(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float))); - connect(this, SIGNAL(sensorHilGpsChanged(quint64,double,double,double,int,float,float,float,float,int)), mav, SLOT(sendHilGps(quint64, double, double, double, int, float, float, float, float, int))); - connect(this, SIGNAL(sensorHilRawImuChanged(quint64,float,float,float,float,float,float,float,float,float,float,float,float,float,quint16)), mav, SLOT(sendHilSensors(quint64,float,float,float,float,float,float,float,float,float,float,float,float,float,quint16))); + connect(this, SIGNAL(hilGroundTruthChanged(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float)), mav, SLOT(sendHilGroundTruth(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float))); + connect(this, SIGNAL(hilStateChanged(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float)), mav, SLOT(sendHilState(quint64,float,float,float,float,float,float,double,double,double,float,float,float,float,float,float,float,float))); + connect(this, SIGNAL(sensorHilGpsChanged(quint64,double,double,double,int,float,float,float,float,float,float,float,int)), mav, SLOT(sendHilGps(quint64,double,double,double,int,float,float,float,float,float,float,float,int))); + connect(this, SIGNAL(sensorHilRawImuChanged(quint64,float,float,float,float,float,float,float,float,float,float,float,float,float,quint32)), mav, SLOT(sendHilSensors(quint64,float,float,float,float,float,float,float,float,float,float,float,float,float,quint32))); UAS* uas = dynamic_cast(mav); if (uas) diff --git a/src/comm/QGCXPlaneLink.h b/src/comm/QGCXPlaneLink.h index ec7f362d29589435b990aad0497bca74f6276d00..696d3c2b188b1700ac7986b7d6ba7c2a6b28b4ac 100644 --- a/src/comm/QGCXPlaneLink.h +++ b/src/comm/QGCXPlaneLink.h @@ -193,7 +193,8 @@ protected: float roll, pitch, yaw, rollspeed, pitchspeed, yawspeed; double lat, lon, alt; float vx, vy, vz, xacc, yacc, zacc; - float airspeed; + float ind_airspeed; + float true_airspeed; float groundspeed; float xmag, ymag, zmag, abs_pressure, diff_pressure, pressure_alt, temperature; diff --git a/src/comm/SerialLink.cc b/src/comm/SerialLink.cc index ae2cde0a79201b2ef0d84308b87ca5881cb61379..60a4ba568ad77eb850d49799f932a8a92376b357 100644 --- a/src/comm/SerialLink.cc +++ b/src/comm/SerialLink.cc @@ -698,7 +698,7 @@ bool SerialLink::hardwareConnect() * * @return True if link is connected, false otherwise. **/ -bool SerialLink::isConnected() +bool SerialLink::isConnected() const { if (port) { return port->isOpen(); @@ -707,12 +707,12 @@ bool SerialLink::isConnected() } } -int SerialLink::getId() +int SerialLink::getId() const { return id; } -QString SerialLink::getName() +QString SerialLink::getName() const { return name; } @@ -728,7 +728,7 @@ void SerialLink::setName(QString name) * This function maps baud rate constants to numerical equivalents. * It relies on the mapping given in qportsettings.h from the QSerialPort library. */ -qint64 SerialLink::getNominalDataRate() +qint64 SerialLink::getNominalDataRate() const { qint64 dataRate = 0; switch (portSettings.baudRate()) { @@ -844,12 +844,12 @@ qint64 SerialLink::getMaxUpstream() return 0; // TODO } -qint64 SerialLink::getBitsSent() +qint64 SerialLink::getBitsSent() const { return bitsSentTotal; } -qint64 SerialLink::getBitsReceived() +qint64 SerialLink::getBitsReceived() const { return bitsReceivedTotal; } @@ -871,54 +871,54 @@ qint64 SerialLink::getMaxDownstream() return 0; // TODO } -bool SerialLink::isFullDuplex() +bool SerialLink::isFullDuplex() const { /* Serial connections are always half duplex */ return false; } -int SerialLink::getLinkQuality() +int SerialLink::getLinkQuality() const { /* This feature is not supported with this interface */ return -1; } -QString SerialLink::getPortName() +QString SerialLink::getPortName() const { return porthandle; } -int SerialLink::getBaudRate() +int SerialLink::getBaudRate() const { return getNominalDataRate(); } -int SerialLink::getBaudRateType() +int SerialLink::getBaudRateType() const { return portSettings.baudRate(); } -int SerialLink::getFlowType() +int SerialLink::getFlowType() const { return portSettings.flowControl(); } -int SerialLink::getParityType() +int SerialLink::getParityType() const { return portSettings.parity(); } -int SerialLink::getDataBitsType() +int SerialLink::getDataBitsType() const { return portSettings.dataBits(); } -int SerialLink::getStopBitsType() +int SerialLink::getStopBitsType() const { return portSettings.stopBits(); } -int SerialLink::getDataBits() +int SerialLink::getDataBits() const { int ret = -1; switch (portSettings.dataBits()) { @@ -941,7 +941,7 @@ int SerialLink::getDataBits() return ret; } -int SerialLink::getStopBits() +int SerialLink::getStopBits() const { int ret = -1; switch (portSettings.stopBits()) { diff --git a/src/comm/SerialLink.h b/src/comm/SerialLink.h index 5ba8dee1a613db423f1938a81f1d0c6363344aa8..6e71b3a7ac76b1e5042ec82d18740e73fefcef7f 100644 --- a/src/comm/SerialLink.h +++ b/src/comm/SerialLink.h @@ -71,47 +71,47 @@ public: /** @brief Get a list of the currently available ports */ QVector* getCurrentPorts(); - bool isConnected(); + bool isConnected() const; qint64 bytesAvailable(); /** * @brief The port handle */ - QString getPortName(); + QString getPortName() const; /** * @brief The human readable port name */ - QString getName(); - int getBaudRate(); - int getDataBits(); - int getStopBits(); + QString getName() const; + int getBaudRate() const; + int getDataBits() const; + int getStopBits() const; // ENUM values - int getBaudRateType(); - int getFlowType(); - int getParityType(); - int getDataBitsType(); - int getStopBitsType(); + int getBaudRateType() const; + int getFlowType() const; + int getParityType() const; + int getDataBitsType() const; + int getStopBitsType() const; /* Extensive statistics for scientific purposes */ - qint64 getNominalDataRate(); + qint64 getNominalDataRate() const; qint64 getTotalUpstream(); qint64 getCurrentUpstream(); qint64 getMaxUpstream(); qint64 getTotalDownstream(); qint64 getCurrentDownstream(); qint64 getMaxDownstream(); - qint64 getBitsSent(); - qint64 getBitsReceived(); + qint64 getBitsSent() const; + qint64 getBitsReceived() const; void loadSettings(); void writeSettings(); void run(); - int getLinkQuality(); - bool isFullDuplex(); - int getId(); + int getLinkQuality() const; + bool isFullDuplex() const; + int getId() const; public slots: bool setPortName(QString portName); diff --git a/src/comm/SerialLinkInterface.h b/src/comm/SerialLinkInterface.h index cc190b38316064db1ced470d122e408e4974e2ad..5421027b1a126d49cc664fe406361d3c2261b5d1 100644 --- a/src/comm/SerialLinkInterface.h +++ b/src/comm/SerialLinkInterface.h @@ -43,16 +43,16 @@ class SerialLinkInterface : public LinkInterface public: virtual QVector* getCurrentPorts() = 0; - virtual QString getPortName() = 0; - virtual int getBaudRate() = 0; - virtual int getDataBits() = 0; - virtual int getStopBits() = 0; - - virtual int getBaudRateType() = 0; - virtual int getFlowType() = 0; - virtual int getParityType() = 0; - virtual int getDataBitsType() = 0; - virtual int getStopBitsType() = 0; + virtual QString getPortName() const = 0; + virtual int getBaudRate() const = 0; + virtual int getDataBits() const = 0; + virtual int getStopBits() const = 0; + + virtual int getBaudRateType() const = 0; + virtual int getFlowType() const = 0; + virtual int getParityType() const = 0; + virtual int getDataBitsType() const = 0; + virtual int getStopBitsType() const = 0; public slots: virtual bool setPortName(QString portName) = 0; diff --git a/src/comm/UDPLink.cc b/src/comm/UDPLink.cc index 708de75b82e305c55e800ad53e59f572169c6e69..121a3755b80fccc80f24c3345fb2486ece6e9aef 100644 --- a/src/comm/UDPLink.cc +++ b/src/comm/UDPLink.cc @@ -354,17 +354,17 @@ bool UDPLink::hardwareConnect(void) * * @return True if link is connected, false otherwise. **/ -bool UDPLink::isConnected() +bool UDPLink::isConnected() const { return connectState; } -int UDPLink::getId() +int UDPLink::getId() const { return id; } -QString UDPLink::getName() +QString UDPLink::getName() const { return name; } @@ -376,7 +376,7 @@ void UDPLink::setName(QString name) } -qint64 UDPLink::getNominalDataRate() +qint64 UDPLink::getNominalDataRate() const { return 54000000; // 54 Mbit } @@ -399,12 +399,12 @@ qint64 UDPLink::getMaxUpstream() return 0; // TODO } -qint64 UDPLink::getBitsSent() +qint64 UDPLink::getBitsSent() const { return bitsSentTotal; } -qint64 UDPLink::getBitsReceived() +qint64 UDPLink::getBitsReceived() const { return bitsReceivedTotal; } @@ -427,12 +427,12 @@ qint64 UDPLink::getMaxDownstream() return 0; // TODO } -bool UDPLink::isFullDuplex() +bool UDPLink::isFullDuplex() const { return true; } -int UDPLink::getLinkQuality() +int UDPLink::getLinkQuality() const { /* This feature is not supported with this interface */ return -1; diff --git a/src/comm/UDPLink.h b/src/comm/UDPLink.h index 41f1158f24f296b499ad96f89057120282662e65..d51f08c6f6f79759a9d198be84e381d7fa684ea8 100644 --- a/src/comm/UDPLink.h +++ b/src/comm/UDPLink.h @@ -49,7 +49,7 @@ public: //UDPLink(QHostAddress host = "239.255.76.67", quint16 port = 7667); ~UDPLink(); - bool isConnected(); + bool isConnected() const; qint64 bytesAvailable(); int getPort() const { return port; @@ -58,33 +58,33 @@ public: /** * @brief The human readable port name */ - QString getName(); - int getBaudRate(); - int getBaudRateType(); - int getFlowType(); - int getParityType(); - int getDataBitsType(); - int getStopBitsType(); - QList getHosts() { + QString getName() const; + int getBaudRate() const; + int getBaudRateType() const; + int getFlowType() const; + int getParityType() const; + int getDataBitsType() const; + int getStopBitsType() const; + QList getHosts() const { return hosts; } /* Extensive statistics for scientific purposes */ - qint64 getNominalDataRate(); + qint64 getNominalDataRate() const; qint64 getTotalUpstream(); qint64 getCurrentUpstream(); qint64 getMaxUpstream(); qint64 getTotalDownstream(); qint64 getCurrentDownstream(); qint64 getMaxDownstream(); - qint64 getBitsSent(); - qint64 getBitsReceived(); + qint64 getBitsSent() const; + qint64 getBitsReceived() const; void run(); - int getLinkQuality(); - bool isFullDuplex(); - int getId(); + int getLinkQuality() const; + bool isFullDuplex() const; + int getId() const; public slots: void setAddress(QHostAddress host); diff --git a/src/comm/XbeeLink.cpp b/src/comm/XbeeLink.cpp index 78c102ef8d4323bcb9056ef2f038923d66395b55..08b62369d67ec490effeb6a41e00b4f384ebae99 100644 --- a/src/comm/XbeeLink.cpp +++ b/src/comm/XbeeLink.cpp @@ -32,7 +32,7 @@ XbeeLink::~XbeeLink() this->disconnect(); } -QString XbeeLink::getPortName() +QString XbeeLink::getPortName() const { QString portName; for(unsigned int i = 0;im_portNameLength;i++) @@ -42,7 +42,7 @@ QString XbeeLink::getPortName() return portName; } -int XbeeLink::getBaudRate() +int XbeeLink::getBaudRate() const { return this->m_baudRate; } @@ -104,32 +104,32 @@ bool XbeeLink::setBaudRate(int rate) return retVal; } -int XbeeLink::getId() +int XbeeLink::getId() const { return this->m_id; } -QString XbeeLink::getName() +QString XbeeLink::getName() const { return this->m_name; } -bool XbeeLink::isConnected() +bool XbeeLink::isConnected() const { return this->m_connected; } -qint64 XbeeLink::getNominalDataRate() +qint64 XbeeLink::getNominalDataRate() const { return this->m_baudRate; } -bool XbeeLink::isFullDuplex() +bool XbeeLink::isFullDuplex() const { return false; } -int XbeeLink::getLinkQuality() +int XbeeLink::getLinkQuality() const { return -1; // TO DO: } @@ -149,12 +149,12 @@ qint64 XbeeLink::getMaxUpstream() return 0; // TO DO: } -qint64 XbeeLink::getBitsSent() +qint64 XbeeLink::getBitsSent() const { return 0; // TO DO: } -qint64 XbeeLink::getBitsReceived() +qint64 XbeeLink::getBitsReceived() const { return 0; // TO DO: } diff --git a/src/comm/XbeeLink.h b/src/comm/XbeeLink.h index e07e95f8c52b9ae886371b931ea451a0276d03d6..00dfa857384aede6268ba662a8e187320569d182 100644 --- a/src/comm/XbeeLink.h +++ b/src/comm/XbeeLink.h @@ -20,8 +20,8 @@ public: ~XbeeLink(); public: // virtual functions from XbeeLinkInterface - QString getPortName(); - int getBaudRate(); + QString getPortName() const; + int getBaudRate() const; public slots: // virtual functions from XbeeLinkInterface bool setPortName(QString portName); @@ -30,20 +30,20 @@ public slots: // virtual functions from XbeeLinkInterface bool setRemoteAddressLow(quint32 low); public: // virtual functions from LinkInterface - int getId(); - QString getName(); - bool isConnected(); - qint64 getNominalDataRate(); - bool isFullDuplex(); - int getLinkQuality(); - qint64 getTotalUpstream(); - qint64 getCurrentUpstream(); - qint64 getMaxUpstream(); - qint64 getBitsSent(); - qint64 getBitsReceived(); - bool connect(); - bool disconnect(); - qint64 bytesAvailable(); + int getId() const; + QString getName() const; + bool isConnected() const; + qint64 getNominalDataRate() const; + bool isFullDuplex() const; + int getLinkQuality() const; + qint64 getTotalUpstream(); + qint64 getCurrentUpstream(); + qint64 getMaxUpstream(); + qint64 getBitsSent() const; + qint64 getBitsReceived() const; + bool connect(); + bool disconnect(); + qint64 bytesAvailable(); public slots: // virtual functions from LinkInterface void writeBytes(const char *bytes, qint64 length); diff --git a/src/comm/XbeeLinkInterface.h b/src/comm/XbeeLinkInterface.h index 37fd9249912d205c1cda44b24418165df1d007fc..d359f579d7a5ab64b58de534f8fd991eb031b448 100644 --- a/src/comm/XbeeLinkInterface.h +++ b/src/comm/XbeeLinkInterface.h @@ -10,8 +10,8 @@ class XbeeLinkInterface : public LinkInterface Q_OBJECT public: - virtual QString getPortName() = 0; - virtual int getBaudRate() = 0; + virtual QString getPortName() const = 0; + virtual int getBaudRate() const = 0; public slots: virtual bool setPortName(QString portName) = 0; diff --git a/src/input/JoystickInput.cc b/src/input/JoystickInput.cc index 074e3c1a753288ec7cadd3828f7a2ea83203dd1d..7f1bc7d7e8bb0deec4b84e9242e087d248389412 100644 --- a/src/input/JoystickInput.cc +++ b/src/input/JoystickInput.cc @@ -19,81 +19,252 @@ #include "QGC.h" #include #include +#include +#include + +using namespace std; /** * The coordinate frame of the joystick axis is the aeronautical frame like shown on this image: * @image html http://pixhawk.ethz.ch/wiki/_media/standards/body-frame.png Aeronautical frame */ JoystickInput::JoystickInput() : - sdlJoystickMin(-32768.0f), - sdlJoystickMax(32767.0f), - defaultIndex(0), - uas(NULL), - uasButtonList(QList()), - done(false), - thrustAxis(2), - xAxis(0), - yAxis(1), - yawAxis(3), - autoButtonMapping(-1), - manualButtonMapping(-1), - stabilizeButtonMapping(-1), - joystickName(tr("Unitinialized")) + sdlJoystickMin(-32768.0f), + sdlJoystickMax(32767.0f), + isEnabled(false), + done(false), + uas(NULL), + autopilotType(0), + systemType(0), + uasCanReverse(false), + rollAxis(-1), + pitchAxis(-1), + yawAxis(-1), + throttleAxis(-1), + joystickName(""), + joystickID(-1), + joystickNumButtons(0) { - loadSettings(); for (int i = 0; i < 10; i++) { calibrationPositive[i] = sdlJoystickMax; calibrationNegative[i] = sdlJoystickMin; } - connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*))); + // Make sure we initialize with the correct UAS. + setActiveUAS(UASManager::instance()->getActiveUAS()); - // Enter main loop - //start(); + // Start this thread. This allows the Joystick Settings window to work correctly even w/o any UASes connected. + start(); } JoystickInput::~JoystickInput() { - storeSettings(); + storeGeneralSettings(); + storeJoystickSettings(); done = true; } -void JoystickInput::loadSettings() +void JoystickInput::loadGeneralSettings() { // Load defaults from settings QSettings settings; settings.sync(); - settings.beginGroup("QGC_JOYSTICK_INPUT"); - xAxis = (settings.value("X_AXIS_MAPPING", xAxis).toInt()); - yAxis = (settings.value("Y_AXIS_MAPPING", yAxis).toInt()); - thrustAxis = (settings.value("THRUST_AXIS_MAPPING", thrustAxis).toInt()); - yawAxis = (settings.value("YAW_AXIS_MAPPING", yawAxis).toInt()); - autoButtonMapping = (settings.value("AUTO_BUTTON_MAPPING", autoButtonMapping).toInt()); - stabilizeButtonMapping = (settings.value("STABILIZE_BUTTON_MAPPING", stabilizeButtonMapping).toInt()); - manualButtonMapping = (settings.value("MANUAL_BUTTON_MAPPING", manualButtonMapping).toInt()); + + // Deal with settings specific to the JoystickInput + settings.beginGroup("JOYSTICK_INPUT"); + isEnabled = settings.value("ENABLED", false).toBool(); + joystickName = settings.value("JOYSTICK_NAME", "").toString(); + settings.endGroup(); +} + +/** + * @brief Restores settings for the current joystick from saved settings file. + * Assumes that both joystickName & joystickNumAxes are correct. + */ +void JoystickInput::loadJoystickSettings() +{ + // Load defaults from settings + QSettings settings; + settings.sync(); + + // Now for the current joystick + settings.beginGroup(joystickName); + rollAxis = (settings.value("ROLL_AXIS_MAPPING", -1).toInt()); + pitchAxis = (settings.value("PITCH_AXIS_MAPPING", -1).toInt()); + yawAxis = (settings.value("YAW_AXIS_MAPPING", -1).toInt()); + throttleAxis = (settings.value("THROTTLE_AXIS_MAPPING", -1).toInt()); + + // Clear out and then restore the (AUTOPILOT, SYSTEM) mapping for joystick settings + joystickSettings.clear(); + int autopilots = settings.beginReadArray("AUTOPILOTS"); + for (int i = 0; i < autopilots; i++) + { + settings.setArrayIndex(i); + int autopilotType = settings.value("AUTOPILOT_TYPE", 0).toInt(); + int systems = settings.beginReadArray("SYSTEMS"); + for (int j = 0; j < systems; j++) + { + settings.setArrayIndex(j); + int systemType = settings.value("SYSTEM_TYPE", 0).toInt(); + + // Now that both the autopilot and system type are available, update some references. + QMap* joystickAxesInverted = &joystickSettings[autopilotType][systemType].axesInverted; + QMap* joystickAxesLimited = &joystickSettings[autopilotType][systemType].axesLimited; + QMap* joystickButtonActions = &joystickSettings[autopilotType][systemType].buttonActions; + + // Read back the joystickAxesInverted QList one element at a time. + int axesStored = settings.beginReadArray("AXES_INVERTED"); + for (int k = 0; k < axesStored; k++) + { + settings.setArrayIndex(k); + int index = settings.value("INDEX", 0).toInt(); + bool inverted = settings.value("INVERTED", false).toBool(); + joystickAxesInverted->insert(index, inverted); + } + settings.endArray(); + + // Read back the joystickAxesLimited QList one element at a time. + axesStored = settings.beginReadArray("AXES_LIMITED"); + for (int k = 0; k < axesStored; k++) + { + settings.setArrayIndex(k); + int index = settings.value("INDEX", 0).toInt(); + bool limited = settings.value("LIMITED", false).toBool(); + joystickAxesLimited->insert(index, limited); + } + settings.endArray(); + + // Read back the button->action mapping. + int buttonsStored = settings.beginReadArray("BUTTONS_ACTIONS"); + for (int k = 0; k < buttonsStored; k++) + { + settings.setArrayIndex(k); + int index = settings.value("INDEX", 0).toInt(); + int action = settings.value("ACTION", 0).toInt(); + joystickButtonActions->insert(index, action); + } + settings.endArray(); + } + settings.endArray(); + } + settings.endArray(); + settings.endGroup(); + + emit joystickSettingsChanged(); } -void JoystickInput::storeSettings() +void JoystickInput::storeGeneralSettings() const +{ + QSettings settings; + settings.beginGroup("JOYSTICK_INPUT"); + settings.setValue("ENABLED", isEnabled); + settings.setValue("JOYSTICK_NAME", joystickName); + settings.endGroup(); + settings.sync(); +} + +void JoystickInput::storeJoystickSettings() const { // Store settings QSettings settings; - settings.beginGroup("QGC_JOYSTICK_INPUT"); - settings.setValue("X_AXIS_MAPPING", xAxis); - settings.setValue("Y_AXIS_MAPPING", yAxis); - settings.setValue("THRUST_AXIS_MAPPING", thrustAxis); + settings.beginGroup(joystickName); + settings.setValue("ROLL_AXIS_MAPPING", rollAxis); + settings.setValue("PITCH_AXIS_MAPPING", pitchAxis); settings.setValue("YAW_AXIS_MAPPING", yawAxis); - settings.setValue("AUTO_BUTTON_MAPPING", autoButtonMapping); - settings.setValue("STABILIZE_BUTTON_MAPPING", stabilizeButtonMapping); - settings.setValue("MANUAL_BUTTON_MAPPING", manualButtonMapping); + settings.setValue("THROTTLE_AXIS_MAPPING", throttleAxis); + settings.beginWriteArray("AUTOPILOTS"); + QMapIterator > i(joystickSettings); + int autopilotIndex = 0; + while (i.hasNext()) + { + i.next(); + settings.setArrayIndex(autopilotIndex++); + + int autopilotType = i.key(); + settings.setValue("AUTOPILOT_TYPE", autopilotType); + + settings.beginWriteArray("SYSTEMS"); + QMapIterator j(i.value()); + int systemIndex = 0; + while (j.hasNext()) + { + j.next(); + settings.setArrayIndex(systemIndex++); + + int systemType = j.key(); + settings.setValue("SYSTEM_TYPE", systemType); + + // Now that both the autopilot and system type are available, update some references. + QMapIterator joystickAxesInverted(joystickSettings[autopilotType][systemType].axesInverted); + QMapIterator joystickAxesLimited(joystickSettings[autopilotType][systemType].axesLimited); + QMapIterator joystickButtonActions(joystickSettings[autopilotType][systemType].buttonActions); + + settings.beginWriteArray("AXES_INVERTED"); + int k = 0; + while (joystickAxesInverted.hasNext()) + { + joystickAxesInverted.next(); + int inverted = joystickAxesInverted.value(); + // Only save this axes' inversion status if it's not the default + if (inverted) + { + settings.setArrayIndex(k++); + int index = joystickAxesInverted.key(); + settings.setValue("INDEX", index); + settings.setValue("INVERTED", inverted); + } + } + settings.endArray(); + + settings.beginWriteArray("AXES_LIMITED"); + k = 0; + while (joystickAxesLimited.hasNext()) + { + joystickAxesLimited.next(); + int limited = joystickAxesLimited.value(); + if (limited) + { + settings.setArrayIndex(k++); + int index = joystickAxesLimited.key(); + settings.setValue("INDEX", index); + settings.setValue("LIMITED", limited); + } + } + settings.endArray(); + + settings.beginWriteArray("BUTTONS_ACTIONS"); + k = 0; + while (joystickButtonActions.hasNext()) + { + joystickButtonActions.next(); + int action = joystickButtonActions.value(); + if (action != -1) + { + settings.setArrayIndex(k++); + int index = joystickButtonActions.key(); + settings.setValue("INDEX", index); + settings.setValue("ACTION", action); + } + } + settings.endArray(); + } + settings.endArray(); // SYSTEMS + } + settings.endArray(); // AUTOPILOTS settings.endGroup(); settings.sync(); } - void JoystickInput::setActiveUAS(UASInterface* uas) { + // Do nothing if the UAS hasn't changed. + if (uas == this->uas) + { + return; + } + // Only connect / disconnect is the UAS is of a controllable UAS class UAS* tmp = 0; if (this->uas) @@ -102,65 +273,101 @@ void JoystickInput::setActiveUAS(UASInterface* uas) if(tmp) { disconnect(this, SIGNAL(joystickChanged(double,double,double,double,int,int,int)), tmp, SLOT(setManualControlCommands(double,double,double,double,int,int,int))); - disconnect(this, SIGNAL(buttonPressed(int)), tmp, SLOT(receiveButton(int))); + disconnect(this, SIGNAL(actionTriggered(int)), tmp, SLOT(triggerAction(int))); } + uasCanReverse = false; + } + + // Save any settings for the last UAS + if (joystickID > -1) + { + storeJoystickSettings(); } this->uas = uas; - tmp = dynamic_cast(this->uas); - if(tmp) { + if (this->uas && (tmp = dynamic_cast(this->uas))) + { connect(this, SIGNAL(joystickChanged(double,double,double,double,int,int,int)), tmp, SLOT(setManualControlCommands(double,double,double,double,int,int,int))); - connect(this, SIGNAL(buttonPressed(int)), tmp, SLOT(receiveButton(int))); + connect(this, SIGNAL(actionTriggered(int)), tmp, SLOT(triggerAction(int))); + uasCanReverse = tmp->systemCanReverse(); + + // Update the joystick settings for a new UAS. + autopilotType = uas->getAutopilotType(); + systemType = uas->getSystemType(); } - if (!isRunning()) + + // Make sure any UI elements know we've updated the UAS. The UASManager signal is re-emitted here so that UI elements know to + // update their UAS-specific UI. + emit activeUASSet(uas); + + // Load any joystick-specific settings now that the UAS has changed. + if (joystickID > -1) { - start(); + loadJoystickSettings(); } } +void JoystickInput::setEnabled(bool enabled) +{ + this->isEnabled = enabled; + storeJoystickSettings(); +} + void JoystickInput::init() { - // INITIALIZE SDL Joystick support + // Initialize SDL Joystick support and detect number of joysticks. if (SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_NOPARACHUTE) < 0) { printf("Couldn't initialize SimpleDirectMediaLayer: %s\n", SDL_GetError()); } // Enumerate joysticks and select one - int numJoysticks = SDL_NumJoysticks(); + numJoysticks = SDL_NumJoysticks(); - // Wait for joysticks if none is connected - while (numJoysticks == 0 && !done) + // If no joysticks are connected, there's nothing we can do, so just keep + // going back to sleep every second unless the program quits. + while (!numJoysticks && !done) { - QGC::SLEEP::msleep(400); - // INITIALIZE SDL Joystick support - if (SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_NOPARACHUTE) < 0) - { - printf("Couldn't initialize SimpleDirectMediaLayer: %s\n", SDL_GetError()); - } - numJoysticks = SDL_NumJoysticks(); + QGC::SLEEP::sleep(1); } if (done) { return; } - printf("%d Input devices found:\n", numJoysticks); - for(int i=0; i < SDL_NumJoysticks(); i++ ) + // Now that we've detected a joystick, load in the joystick-agnostic settings. + loadGeneralSettings(); + + // Enumerate all found devices + qDebug() << QString("%1 Input devices found:").arg(numJoysticks); + int activeJoystick = 0; + for(int i=0; i < numJoysticks; i++ ) { - printf("\t- %s\n", SDL_JoystickName(i)); - joystickName = QString(SDL_JoystickName(i)); - } + QString name = SDL_JoystickName(i); + qDebug() << QString("\t%1").arg(name); - printf("\nOpened %s\n", SDL_JoystickName(defaultIndex)); + // If we've matched this joystick to what was last opened, note it. + // Note: The way this is implemented the LAST joystick of a given name will be opened. + if (name == joystickName) + { + activeJoystick = i; + } - SDL_JoystickEventState(SDL_ENABLE); + SDL_Joystick* x = SDL_JoystickOpen(i); + qDebug() << QString("\tNumber of Axes: %1").arg(QString::number(SDL_JoystickNumAxes(x))); + qDebug() << QString("\tNumber of Buttons: %1").arg(QString::number(SDL_JoystickNumButtons(x))); + SDL_JoystickClose(x); + } - joystick = SDL_JoystickOpen(defaultIndex); + // Set the active joystick based on name, if a joystick was found in the saved settings, otherwise + // default to the first one. + setActiveJoystick(activeJoystick); - // Make sure active UAS is set + // Now make sure we know what the current UAS is and track changes to it. setActiveUAS(UASManager::instance()->getActiveUAS()); + connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*))); } + void JoystickInput::shutdown() { done = true; @@ -168,6 +375,8 @@ void JoystickInput::shutdown() /** * @brief Execute the Joystick process + * Note that the SDL procedure is polled. This is because connecting and disconnecting while the event checker is running + * fails as of SDL 1.2. It is therefore much easier to just poll for the joystick we want to sample. */ void JoystickInput::run() { @@ -181,150 +390,250 @@ void JoystickInput::run() exit(); return; } - while(SDL_PollEvent(&event)) - { - - SDL_JoystickUpdate(); - - // Todo check if it would be more beneficial to use the event structure - switch(event.type) { - case SDL_KEYDOWN: - /* handle keyboard stuff here */ - //qDebug() << "KEY PRESSED!"; - break; - case SDL_QUIT: - /* Set whatever flags are necessary to */ - /* end the main loop here */ - break; + // Poll the joystick for new values. + SDL_JoystickUpdate(); - case SDL_JOYBUTTONDOWN: /* Handle Joystick Button Presses */ - if ( event.jbutton.button == 0 ) { - //qDebug() << "BUTTON PRESSED!"; - } - break; - - case SDL_JOYAXISMOTION: /* Handle Joystick Motion */ - if ( ( event.jaxis.value < -3200 ) || (event.jaxis.value > 3200 ) ) { - if( event.jaxis.axis == 0) { - /* Left-right movement code goes here */ - } + // Emit all necessary signals for all axes. + for (int i = 0; i < joystickNumAxes; i++) + { + // First emit the uncalibrated values for each axis based on their ID. + // This is generally not used for controlling a vehicle, but a UI representation, so it being slightly off is fine. + // Here we map the joystick axis value into the initial range of [0:1]. + float axisValue = SDL_JoystickGetAxis(joystick, i); + if (joystickSettings[autopilotType][systemType].axesInverted[i]) + { + axisValue = (axisValue - calibrationNegative[i]) / (calibrationPositive[i] - calibrationNegative[i]); + } + else + { + axisValue = (axisValue - calibrationPositive[i]) / (calibrationNegative[i] - calibrationPositive[i]); + } + axisValue = 1.0f - axisValue; - if( event.jaxis.axis == 1) { - /* Up-Down movement code goes here */ - } + // For non-throttle axes or if the UAS can reverse, go ahead and convert this into the range [-1:1]. + if (uasCanReverse || throttleAxis != i) + { + axisValue = axisValue * 2.0f - 1.0f; + } + // Otherwise if this vehicle can only go forward, but the axis is limited to only the positive range, + // scale this so the negative values are ignored for this axis and it's clamped to [0:1]. + else if (throttleAxis == i && joystickSettings[autopilotType][systemType].axesLimited.value(i)) + { + axisValue = axisValue * 2.0f - 1.0f; + if (axisValue < 0.0f) + { + axisValue = 0.0f; } - break; + } - default: - //qDebug() << "SDL event occured"; - break; + // Bound rounding errors + if (axisValue > 1.0f) axisValue = 1.0f; + if (axisValue < -1.0f) axisValue = -1.0f; + if (joystickAxes[i] != axisValue) + { + joystickAxes[i] = axisValue; + emit axisValueChanged(i, axisValue); } } -// // Display all axes -// for(int i = 0; i < SDL_JoystickNumAxes(joystick); i++) -// { -// qDebug() << "\rAXIS" << i << "is: " << SDL_JoystickGetAxis(joystick, i); -// } - - // THRUST - double thrust = ((double)SDL_JoystickGetAxis(joystick, thrustAxis) - calibrationNegative[thrustAxis]) / (calibrationPositive[thrustAxis] - calibrationNegative[thrustAxis]); - // Has to be inverted for Logitech Wingman - thrust = 1.0f - thrust; - thrust = thrust * 2.0f - 1.0f; - // Bound rounding errors - if (thrust > 1.0f) thrust = 1.0f; - if (thrust < -1.0f) thrust = -1.0f; - emit thrustChanged((float)thrust); - - // X Axis - double x = ((double)SDL_JoystickGetAxis(joystick, xAxis) - calibrationNegative[xAxis]) / (calibrationPositive[xAxis] - calibrationNegative[xAxis]); - x = 1.0f - x; - x = x * 2.0f - 1.0f; - // Bound rounding errors - if (x > 1.0f) x = 1.0f; - if (x < -1.0f) x = -1.0f; - emit xChanged((float)x); - - // Y Axis - double y = ((double)SDL_JoystickGetAxis(joystick, yAxis) - calibrationNegative[yAxis]) / (calibrationPositive[yAxis] - calibrationNegative[yAxis]); - y = 1.0f - y; - y = y * 2.0f - 1.0f; - // Bound rounding errors - if (y > 1.0f) y = 1.0f; - if (y < -1.0f) y = -1.0f; - emit yChanged((float)y); - - // Yaw Axis - - double yaw = ((double)SDL_JoystickGetAxis(joystick, yawAxis) - calibrationNegative[yawAxis]) / (calibrationPositive[yawAxis] - calibrationNegative[yawAxis]); - yaw = 1.0f - yaw; - yaw = yaw * 2.0f - 1.0f; - // Bound rounding errors - if (yaw > 1.0f) yaw = 1.0f; - if (yaw < -1.0f) yaw = -1.0f; - emit yawChanged((float)yaw); - - // Get joystick hat position, convert it to vector + // Build up vectors describing the hat position int hatPosition = SDL_JoystickGetHat(joystick, 0); + int newYHat = 0; + if ((SDL_HAT_UP & hatPosition) > 0) newYHat = 1; + if ((SDL_HAT_DOWN & hatPosition) > 0) newYHat = -1; + int newXHat = 0; + if ((SDL_HAT_LEFT & hatPosition) > 0) newXHat = -1; + if ((SDL_HAT_RIGHT & hatPosition) > 0) newXHat = 1; + if (newYHat != yHat || newXHat != xHat) + { + xHat = newXHat; + yHat = newYHat; + emit hatDirectionChanged(newXHat, newYHat); + } - int xHat,yHat; - xHat = 0; - yHat = 0; - - // Build up vectors describing the hat position - // - // Coordinate frame for joystick hat: - // - // y - // ^ - // | - // | - // 0 ----> x - // - - if ((SDL_HAT_UP & hatPosition) > 0) yHat = 1; - if ((SDL_HAT_DOWN & hatPosition) > 0) yHat = -1; - - if ((SDL_HAT_LEFT & hatPosition) > 0) xHat = -1; - if ((SDL_HAT_RIGHT & hatPosition) > 0) xHat = 1; - - // Send new values to rest of groundstation - emit hatDirectionChanged(xHat, yHat); - - // Display all buttons - int buttons = 0; - for(int i = 0; i < SDL_JoystickNumButtons(joystick); i++) + // Emit signals for each button individually + for (int i = 0; i < joystickNumButtons; i++) { - //qDebug() << "BUTTON" << i << "is: " << SDL_JoystickGetAxis(joystick, i); - if(SDL_JoystickGetButton(joystick, i)) + // If the button was down, but now it's up, trigger a buttonPressed event + quint16 lastButtonState = joystickButtons & (1 << i); + if (SDL_JoystickGetButton(joystick, i) && !lastButtonState) { emit buttonPressed(i); - buttons |= 1 << i; - // Check if button is a UAS select button - - if (uasButtonList.contains(i)) + joystickButtons |= 1 << i; + } + else if (!SDL_JoystickGetButton(joystick, i) && lastButtonState) + { + emit buttonReleased(i); + if (isEnabled && joystickSettings[autopilotType][systemType].buttonActions.contains(i)) { - UASInterface* uas = UASManager::instance()->getUASForId(i); - if (uas) - { - UASManager::instance()->setActiveUAS(uas); - } + emit actionTriggered(joystickSettings[autopilotType][systemType].buttonActions.value(i)); } + joystickButtons &= ~(1 << i); } + } + // Now signal an update for all UI together. + if (isEnabled) + { + float roll = rollAxis > -1?joystickAxes[rollAxis]:numeric_limits::quiet_NaN(); + float pitch = pitchAxis > -1?joystickAxes[pitchAxis]:numeric_limits::quiet_NaN(); + float yaw = yawAxis > -1?joystickAxes[yawAxis]:numeric_limits::quiet_NaN(); + float throttle = throttleAxis > -1?joystickAxes[throttleAxis]:numeric_limits::quiet_NaN(); + emit joystickChanged(roll, pitch, yaw, throttle, xHat, yHat, joystickButtons); } - emit joystickChanged(y, x, yaw, thrust, xHat, yHat, buttons); // Sleep, update rate of joystick is approx. 50 Hz (1000 ms / 50 = 20 ms) QGC::SLEEP::msleep(20); + } +} +void JoystickInput::setActiveJoystick(int id) +{ + // If we already had a joystick, close that one before opening a new one. + if (joystick && SDL_JoystickOpened(joystickID)) + { + storeJoystickSettings(); + SDL_JoystickClose(joystick); + joystick = NULL; + joystickID = -1; } + joystickID = id; + joystick = SDL_JoystickOpen(joystickID); + if (joystick && SDL_JoystickOpened(joystickID)) + { + // Update joystick configuration. + joystickName = QString(SDL_JoystickName(joystickID)); + joystickNumButtons = SDL_JoystickNumButtons(joystick); + joystickNumAxes = SDL_JoystickNumAxes(joystick); + + // Restore saved settings for this joystick. + loadJoystickSettings(); + + // Update cached joystick axes values. + // Also emit any signals for currently-triggering events + joystickAxes.clear(); + for (int i = 0; i < joystickNumAxes; i++) + { + joystickAxes.append(numeric_limits::quiet_NaN()); + } + + // Update cached joystick button values. + // Emit signals for any button events. + joystickButtons = 0; + } + else + { + joystickNumButtons = 0; + joystickNumAxes = 0; + } + + // Specify that a new joystick has been selected, so that any UI elements can update. + emit newJoystickSelected(); + // And then trigger an update of this new UI. + emit joystickSettingsChanged(); } -const QString& JoystickInput::getName() +void JoystickInput::setAxisMapping(int axis, JOYSTICK_INPUT_MAPPING newMapping) { - return joystickName; + switch (newMapping) + { + case JOYSTICK_INPUT_MAPPING_ROLL: + rollAxis = axis; + break; + case JOYSTICK_INPUT_MAPPING_PITCH: + pitchAxis = axis; + break; + case JOYSTICK_INPUT_MAPPING_YAW: + yawAxis = axis; + break; + case JOYSTICK_INPUT_MAPPING_THROTTLE: + throttleAxis = axis; + break; + case JOYSTICK_INPUT_MAPPING_NONE: + default: + if (rollAxis == axis) + { + rollAxis = -1; + } + if (pitchAxis == axis) + { + pitchAxis = -1; + } + if (yawAxis == axis) + { + yawAxis = -1; + } + if (throttleAxis == axis) + { + throttleAxis = -1; + joystickSettings[autopilotType][systemType].axesLimited.remove(axis); + } + break; + } + storeJoystickSettings(); +} + +void JoystickInput::setAxisInversion(int axis, bool inverted) +{ + if (axis < joystickNumAxes) + { + joystickSettings[autopilotType][systemType].axesInverted[axis] = inverted; + storeJoystickSettings(); + } +} + +void JoystickInput::setAxisRangeLimit(int axis, bool limitRange) +{ + if (axis < joystickNumAxes) + { + joystickSettings[autopilotType][systemType].axesLimited[axis] = limitRange; + storeJoystickSettings(); + } +} + +void JoystickInput::setButtonAction(int button, int action) +{ + if (button < joystickNumButtons) + { + joystickSettings[autopilotType][systemType].buttonActions[button] = action; + storeJoystickSettings(); + } +} + +float JoystickInput::getCurrentValueForAxis(int axis) const +{ + if (axis < joystickNumAxes) + { + return joystickAxes.at(axis); + } + return 0.0f; +} + +bool JoystickInput::getInvertedForAxis(int axis) const +{ + if (axis < joystickNumAxes) + { + return joystickSettings[autopilotType][systemType].axesInverted.value(axis); + } + return false; +} + +bool JoystickInput::getRangeLimitForAxis(int axis) const +{ + if (axis < joystickNumAxes) + { + return joystickSettings[autopilotType][systemType].axesLimited.value(axis); + } + return false; +} + +int JoystickInput::getActionForButton(int button) const +{ + if (button < joystickNumButtons && joystickSettings[autopilotType][systemType].buttonActions.contains(button)) + { + return joystickSettings[autopilotType][systemType].buttonActions.value(button); + } + return -1; } diff --git a/src/input/JoystickInput.h b/src/input/JoystickInput.h index 6315b55e9cc117e7fa02c69e4bc1c3150f920dd2..66070990d2e36e07203b27ef83c7eb2e6bbc9dc3 100644 --- a/src/input/JoystickInput.h +++ b/src/input/JoystickInput.h @@ -23,11 +23,20 @@ This file is part of the PIXHAWK project /** * @file - * @brief Definition of joystick interface + * @brief Definition of joystick interface * - * @author Lorenz Meier - * @author Andreas Romer + * This class defines a new thread to operate the reading of any joystick/controllers + * via the Simple Directmedia Library (libsdl.org). This relies on polling of the SDL, + * which is not their recommended method, instead they suggest use event checking. That + * does not seem to support switching joysticks after their internal event loop has started, + * so it was abandoned. * + * All joystick-related functionality is done in this class, though the JoystickWidget provides + * a UI around modifying its settings. Additionally controller buttons can be mapped to + * actions defined by any UASInterface object through the `UASInterface::getActions()` function. + * + * @author Lorenz Meier + * @author Andreas Romer */ #ifndef _JOYSTICKINPUT_H_ @@ -44,6 +53,13 @@ This file is part of the PIXHAWK project #include "UASInterface.h" +struct JoystickSettings { + QMap axesInverted; ///< Whether each axis should be used inverted from what was reported. + QMap axesLimited; ///< Whether each axis should be limited to only the positive range. Currently this only applies to the throttle axis, but is kept generic here to possibly support other axes. + QMap buttonActions; ///< The index of the action associated with every button. +}; +Q_DECLARE_METATYPE(JoystickSettings) + /** * @brief Joystick input */ @@ -53,81 +69,147 @@ class JoystickInput : public QThread public: JoystickInput(); - ~JoystickInput(); + ~JoystickInput(); void run(); void shutdown(); - const QString& getName(); + /** + * @brief The JOYSTICK_INPUT_MAPPING enum storing the values for each item in the mapping combobox. + * This should match the order of items in the mapping combobox in JoystickAxis.ui. + */ + enum JOYSTICK_INPUT_MAPPING + { + JOYSTICK_INPUT_MAPPING_NONE = 0, + JOYSTICK_INPUT_MAPPING_YAW = 1, + JOYSTICK_INPUT_MAPPING_PITCH = 2, + JOYSTICK_INPUT_MAPPING_ROLL = 3, + JOYSTICK_INPUT_MAPPING_THROTTLE = 4 + }; /** - * @brief Load joystick settings + * @brief Load joystick-specific settings. + */ + void loadJoystickSettings(); + /** + * @brief Load joystick-independent settings. */ - void loadSettings(); + void loadGeneralSettings(); /** - * @brief Store joystick settings + * @brief Store joystick-specific settings. + */ + void storeJoystickSettings() const; + /** + * @brief Store joystick-independent settings. */ - void storeSettings(); + void storeGeneralSettings() const; - int getMappingThrustAxis() + bool enabled() const { - return thrustAxis; + return isEnabled; } - int getMappingXAxis() + int getMappingThrottleAxis() const { - return xAxis; + return throttleAxis; } - int getMappingYAxis() + int getMappingRollAxis() const { - return yAxis; + return rollAxis; } - int getMappingYawAxis() + int getMappingPitchAxis() const + { + return pitchAxis; + } + + int getMappingYawAxis() const { return yawAxis; } - int getMappingAutoButton() + int getJoystickNumButtons() const { - return autoButtonMapping; + return joystickNumButtons; } - int getMappingManualButton() + int getJoystickNumAxes() const { - return manualButtonMapping; + return joystickNumAxes; } - int getMappingStabilizeButton() + int getJoystickID() const { - return stabilizeButtonMapping; + return joystickID; } + const QString& getName() const + { + return joystickName; + } + + int getNumJoysticks() const + { + return numJoysticks; + } + + QString getJoystickNameById(int id) const + { + return QString(SDL_JoystickName(id)); + } + + float getCurrentValueForAxis(int axis) const; + bool getInvertedForAxis(int axis) const; + bool getRangeLimitForAxis(int axis) const; + int getActionForButton(int button) const; + const double sdlJoystickMin; const double sdlJoystickMax; protected: - int defaultIndex; double calibrationPositive[10]; double calibrationNegative[10]; - SDL_Joystick* joystick; - UASInterface* uas; - QList uasButtonList; + + bool isEnabled; ///< Track whether the system should emit the higher-level signals: joystickChanged & actionTriggered. bool done; - QMutex m_doneMutex; - // Axis 3 is thrust (CALIBRATION!) - int thrustAxis; - int xAxis; - int yAxis; + SDL_Joystick* joystick; + UASInterface* uas; ///< Track the current UAS. + int autopilotType; ///< Cache the autopilotType + int systemType; ///< Cache the systemType + bool uasCanReverse; ///< Track whether the connect UAS can drive a reverse speed. + + // Store the mapping between axis numbers and the roll/pitch/yaw/throttle configuration. + // Value is one of JoystickAxis::JOYSTICK_INPUT_MAPPING. + int rollAxis; + int pitchAxis; int yawAxis; - int autoButtonMapping; - int manualButtonMapping; - int stabilizeButtonMapping; - SDL_Event event; + int throttleAxis; + + // Cache information on the joystick instead of polling the SDL everytime. + int numJoysticks; ///< Total number of joysticks detected by the SDL. QString joystickName; + int joystickID; + int joystickNumAxes; + int joystickNumButtons; + + // Track axis/button settings based on a Joystick/AutopilotType/SystemType triplet. + // This is only a double-map, because settings are stored/loaded based on joystick + // name first, so only the settings for the current joystick need to be stored at any given time. + // Pointers are kept to the various settings field to reduce lookup times. + // Note that the mapping (0,0) corresponds to when no UAS is connected. Since this corresponds + // to a generic vehicle type and a generic autopilot, this is a pretty safe default. + QMap > joystickSettings; + + // Track the last state of the axes, buttons, and hats for only emitting change signals. + QList joystickAxes; ///< The values of every axes during the last sample. + quint16 joystickButtons; ///< The state of every button. Bitfield supporting 16 buttons with 1s indicating that the button is down. + int xHat, yHat; ///< The horizontal/vertical hat directions. Values are -1, 0, 1, with (-1,-1) indicating bottom-left. + /** + * @brief Called before main run() event loop starts. Waits for joysticks to be connected. + */ void init(); signals: @@ -135,49 +217,40 @@ signals: /** * @brief Signal containing all joystick raw positions * - * @param roll forward / pitch / x axis, front: 1, center: 0, back: -1 - * @param pitch left / roll / y axis, left: -1, middle: 0, right: 1 - * @param yaw turn axis, left-turn: -1, centered: 0, right-turn: 1 - * @param thrust Thrust, 0%: 0, 100%: 1 + * @param roll forward / pitch / x axis, front: 1, center: 0, back: -1. If the roll axis isn't defined, NaN is transmit instead. + * @param pitch left / roll / y axis, left: -1, middle: 0, right: 1. If the roll axis isn't defined, NaN is transmit instead. + * @param yaw turn axis, left-turn: -1, centered: 0, right-turn: 1. If the roll axis isn't defined, NaN is transmit instead. + * @param throttle Throttle, -100%:-1.0, 0%: 0.0, 100%: 1.0. If the roll axis isn't defined, NaN is transmit instead. * @param xHat hat vector in forward-backward direction, +1 forward, 0 center, -1 backward * @param yHat hat vector in left-right direction, -1 left, 0 center, +1 right */ - void joystickChanged(double roll, double pitch, double yaw, double thrust, int xHat, int yHat, int buttons); - - /** - * @brief Thrust lever of the joystick has changed - * - * @param thrust Thrust, 0%: 0, 100%: 1.0 - */ - void thrustChanged(int thrust); + void joystickChanged(double roll, double pitch, double yaw, double throttle, int xHat, int yHat, int buttons); /** - * @brief X-Axis / forward-backward axis has changed + * @brief Emit a new value for an axis * - * @param x forward / pitch / x axis, front: +1.0, center: 0.0, back: -1.0 + * @param value Value of the axis, between -1.0 and 1.0. */ - void xChanged(int x); + void axisValueChanged(int axis, float value); /** - * @brief Y-Axis / left-right axis has changed - * - * @param y left / roll / y axis, left: -1.0, middle: 0.0, right: +1.0 + * @brief Joystick button has changed state from unpressed to pressed. + * @param key index of the pressed key */ - void yChanged(int y); + void buttonPressed(int key); /** - * @brief Yaw / left-right turn has changed + * @brief Joystick button has changed state from pressed to unpressed. * - * @param yaw turn axis, left-turn: -1.0, middle: 0.0, right-turn: +1.0 + * @param key index of the released key */ - void yawChanged(int yaw); + void buttonReleased(int key); /** - * @brief Joystick button has been pressed - * - * @param key index of the pressed key + * @brief A joystick button was pressed that had a corresponding action. + * @param action The index of the action to trigger. Dependent on UAS. */ - void buttonPressed(int key); + void actionTriggered(int action); /** * @brief Hat (8-way switch on the top) has changed position @@ -196,42 +269,51 @@ signals: */ void hatDirectionChanged(int x, int y); -public slots: - void setActiveUAS(UASInterface* uas); - void setMappingThrustAxis(int mapping) - { - thrustAxis = mapping; - } - - void setMappingXAxis(int mapping) - { - xAxis = mapping; - } - - void setMappingYAxis(int mapping) - { - yAxis = mapping; - } - - void setMappingYawAxis(int mapping) - { - yawAxis = mapping; - } + /** @brief Signal that the UAS has been updated for this JoystickInput + * Note that any UI updates should NOT query this object for joystick details. That should be done in response to the joystickSettingsChanged signal. + */ + void activeUASSet(UASInterface*); - void setMappingAutoButton(int mapping) - { - autoButtonMapping = mapping; - } + /** @brief Signals that new joystick-specific settings were changed. Useful for triggering updates that at dependent on the current joystick. */ + void joystickSettingsChanged(); - void setMappingManualButton(int mapping) - { - manualButtonMapping = mapping; - } + /** @brief The JoystickInput has switched to a different joystick. UI should be adjusted accordingly. */ + void newJoystickSelected(); - void setMappingStabilizeButton(int mapping) - { - stabilizeButtonMapping = mapping; - } +public slots: + /** @brief Enable or disable emitting the high-level control signals from the joystick. */ + void setEnabled(bool enable); + /** @brief Specify the UAS that this input should forward joystickChanged signals and buttonPresses to. */ + void setActiveUAS(UASInterface* uas); + /** @brief Switch to a new joystick by ID number. Both buttons and axes are updated with the proper signals emitted. */ + void setActiveJoystick(int id); + /** + * @brief Change the control mapping for a given joystick axis. + * @param axisID The axis to modify (0-indexed) + * @param newMapping The mapping to use. + * @see JOYSTICK_INPUT_MAPPING + */ + void setAxisMapping(int axis, JoystickInput::JOYSTICK_INPUT_MAPPING newMapping); + /** + * @brief Specify if an axis should be inverted. + * @param axis The ID of the axis. + * @param inverted True indicates inverted from normal. Varies by controller. + */ + void setAxisInversion(int axis, bool inverted); + /** + * @brief Specify that an axis should only transmit the positive values. Useful for controlling throttle from auto-centering axes. + * @param axis Which axis has its range limited. + * @param limitRange If true only the positive half of this axis will be read. + */ + void setAxisRangeLimit(int axis, bool limitRange); + /** + * @brief Specify a button->action mapping for the given uas. + * This mapping is applied based on UAS autopilot type and UAS system type. + * Connects the buttonEmitted signal for the corresponding button to the corresponding action for the current UAS. + * @param button The numeric ID for the button + * @param action The numeric ID of the action for this UAS to map to. + */ + void setButtonAction(int button, int action); }; #endif // _JOYSTICKINPUT_H_ diff --git a/src/uas/ArduPilotMegaMAV.cc b/src/uas/ArduPilotMegaMAV.cc index 2b071f4ba9520994d4c7c7b6e65131244f5f7b81..c3c34c5e859e140618e3567c0e2039a351e99895 100644 --- a/src/uas/ArduPilotMegaMAV.cc +++ b/src/uas/ArduPilotMegaMAV.cc @@ -27,6 +27,15 @@ This file is part of the QGROUNDCONTROL project */ #include "ArduPilotMegaMAV.h" + +#ifndef MAVLINK_MSG_ID_MOUNT_CONFIGURE +#include "ardupilotmega/mavlink_msg_mount_configure.h" +#endif + +#ifndef MAVLINK_MSG_ID_MOUNT_CONTROL +#include "ardupilotmega/mavlink_msg_mount_control.h" +#endif + ArduPilotMegaMAV::ArduPilotMegaMAV(MAVLinkProtocol* mavlink, int id) : UAS(mavlink, id)//, // place other initializers here diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index f44bfb65ee7cfb59eb0a0543d11a93bc957d2924..3076f3292dce9b4a3be6129fe3f3f2344361b1c8 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -26,6 +26,7 @@ #include "QGCMAVLink.h" #include "LinkManager.h" #include "SerialLink.h" +#include #ifdef QGC_PROTOBUF_ENABLED #include @@ -33,9 +34,9 @@ /** * Gets the settings from the previous UAS (name, airframe, autopilot, battery specs) -* by calling readSettings. This means the new UAS will have the same settings +* by calling readSettings. This means the new UAS will have the same settings * as the previous one created unless one calls deleteSettings in the code after -* creating the UAS. +* creating the UAS. */ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(), uasId(id), @@ -138,23 +139,82 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(), hilEnabled(false), sensorHil(false), lastSendTimeGPS(0), - lastSendTimeSensors(0) + lastSendTimeSensors(0), + blockHomePositionChanges(false) { for (unsigned int i = 0; i<255;++i) { componentID[i] = -1; componentMulti[i] = false; } - + + // Store a list of available actions for this UAS. + // Basically everything exposted as a SLOT with no return value or arguments. + + QAction* newAction = new QAction(tr("Arm"), this); + newAction->setToolTip(tr("Enable the UAS so that all actuators are online")); + connect(newAction, SIGNAL(triggered()), this, SLOT(armSystem())); + actions.append(newAction); + + newAction = new QAction(tr("Disarm"), this); + newAction->setToolTip(tr("Disable the UAS so that all actuators are offline")); + connect(newAction, SIGNAL(triggered()), this, SLOT(disarmSystem())); + actions.append(newAction); + + newAction = new QAction(tr("Toggle armed"), this); + newAction->setToolTip(tr("Toggle between armed and disarmed")); + connect(newAction, SIGNAL(triggered()), this, SLOT(toggleAutonomy())); + actions.append(newAction); + + newAction = new QAction(tr("Go home"), this); + newAction->setToolTip(tr("Command the UAS to return to its home position")); + connect(newAction, SIGNAL(triggered()), this, SLOT(home())); + actions.append(newAction); + + newAction = new QAction(tr("Land"), this); + newAction->setToolTip(tr("Command the UAS to land")); + connect(newAction, SIGNAL(triggered()), this, SLOT(land())); + actions.append(newAction); + + newAction = new QAction(tr("Launch"), this); + newAction->setToolTip(tr("Command the UAS to launch itself and begin its mission")); + connect(newAction, SIGNAL(triggered()), this, SLOT(launch())); + actions.append(newAction); + + newAction = new QAction(tr("Resume"), this); + newAction->setToolTip(tr("Command the UAS to continue its mission")); + connect(newAction, SIGNAL(triggered()), this, SLOT(go())); + actions.append(newAction); + + newAction = new QAction(tr("Stop"), this); + newAction->setToolTip(tr("Command the UAS to halt and hold position")); + connect(newAction, SIGNAL(triggered()), this, SLOT(halt())); + actions.append(newAction); + + newAction = new QAction(tr("Go autonomous"), this); + newAction->setToolTip(tr("Set the UAS into an autonomous control mode")); + connect(newAction, SIGNAL(triggered()), this, SLOT(goAutonomous())); + actions.append(newAction); + + newAction = new QAction(tr("Go manual"), this); + newAction->setToolTip(tr("Set the UAS into a manual control mode")); + connect(newAction, SIGNAL(triggered()), this, SLOT(goManual())); + actions.append(newAction); + + newAction = new QAction(tr("Toggle autonomy"), this); + newAction->setToolTip(tr("Toggle between manual and full-autonomy")); + connect(newAction, SIGNAL(triggered()), this, SLOT(toggleAutonomy())); + actions.append(newAction); + color = UASInterface::getNextColor(); setBatterySpecs(QString("9V,9.5V,12.6V")); connect(statusTimeout, SIGNAL(timeout()), this, SLOT(updateState())); connect(this, SIGNAL(systemSpecsChanged(int)), this, SLOT(writeSettings())); statusTimeout->start(500); - readSettings(); + readSettings(); // Initial signals emit disarmed(); - emit armingChanged(false); + emit armingChanged(false); } /** @@ -205,7 +265,7 @@ void UAS::readSettings() /** * Deletes the settings origianally read into the UAS by readSettings. -* This is in case one does not want the old values but would rather +* This is in case one does not want the old values but would rather * start with the values assigned by the constructor. */ void UAS::deleteSettings() @@ -224,6 +284,15 @@ int UAS::getUASID() const return uasId; } +void UAS::triggerAction(int action) +{ + if (action >= 0 && action < actions.size()) + { + qDebug() << "Triggering action: '" << actions[action]->text() << "'"; + actions[action]->trigger(); + } +} + /** * Update the heartbeat. */ @@ -415,15 +484,15 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) emit heartbeat(this); mavlink_heartbeat_t state; mavlink_msg_heartbeat_decode(&message, &state); - - // Send the base_mode and system_status values to the plotter. This uses the ground time - // so the Ground Time checkbox must be ticked for these values to display + + // Send the base_mode and system_status values to the plotter. This uses the ground time + // so the Ground Time checkbox must be ticked for these values to display quint64 time = getUnixTime(); - QString name = QString("M%1:HEARTBEAT.%2").arg(message.sysid); - emit valueChanged(uasId, name.arg("base_mode"), "bits", state.base_mode, time); - emit valueChanged(uasId, name.arg("custom_mode"), "bits", state.custom_mode, time); - emit valueChanged(uasId, name.arg("system_status"), "-", state.system_status, time); - + QString name = QString("M%1:HEARTBEAT.%2").arg(message.sysid); + emit valueChanged(uasId, name.arg("base_mode"), "bits", state.base_mode, time); + emit valueChanged(uasId, name.arg("custom_mode"), "bits", state.custom_mode, time); + emit valueChanged(uasId, name.arg("system_status"), "-", state.system_status, time); + // Set new type if it has changed if (this->type != state.type) { @@ -546,22 +615,22 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) mavlink_sys_status_t state; mavlink_msg_sys_status_decode(&message, &state); - // Prepare for sending data to the realtime plotter, which is every field excluding onboard_control_sensors_present. + // Prepare for sending data to the realtime plotter, which is every field excluding onboard_control_sensors_present. quint64 time = getUnixTime(); - QString name = QString("M%1:SYS_STATUS.%2").arg(message.sysid); - emit valueChanged(uasId, name.arg("sensors_enabled"), "bits", state.onboard_control_sensors_enabled, time); - emit valueChanged(uasId, name.arg("sensors_health"), "bits", state.onboard_control_sensors_health, time); - emit valueChanged(uasId, name.arg("errors_comm"), "-", state.errors_comm, time); - emit valueChanged(uasId, name.arg("errors_count1"), "-", state.errors_count1, time); - emit valueChanged(uasId, name.arg("errors_count2"), "-", state.errors_count2, time); - emit valueChanged(uasId, name.arg("errors_count3"), "-", state.errors_count3, time); + QString name = QString("M%1:SYS_STATUS.%2").arg(message.sysid); + emit valueChanged(uasId, name.arg("sensors_enabled"), "bits", state.onboard_control_sensors_enabled, time); + emit valueChanged(uasId, name.arg("sensors_health"), "bits", state.onboard_control_sensors_health, time); + emit valueChanged(uasId, name.arg("errors_comm"), "-", state.errors_comm, time); + emit valueChanged(uasId, name.arg("errors_count1"), "-", state.errors_count1, time); + emit valueChanged(uasId, name.arg("errors_count2"), "-", state.errors_count2, time); + emit valueChanged(uasId, name.arg("errors_count3"), "-", state.errors_count3, time); emit valueChanged(uasId, name.arg("errors_count4"), "-", state.errors_count4, time); - // Process CPU load. + // Process CPU load. emit loadChanged(this,state.load/10.0f); - emit valueChanged(uasId, name.arg("load"), "%", state.load/10.0f, time); + emit valueChanged(uasId, name.arg("load"), "%", state.load/10.0f, time); - // Battery charge/time remaining/voltage calculations + // Battery charge/time remaining/voltage calculations currentVoltage = state.voltage_battery/1000.0f; lpVoltage = filterVoltage(currentVoltage); tickLowpassVoltage = tickLowpassVoltage*0.8f + 0.2f*currentVoltage; @@ -595,16 +664,16 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) } emit batteryChanged(this, lpVoltage, currentCurrent, getChargeLevel(), timeRemaining); - emit valueChanged(uasId, name.arg("battery_remaining"), "%", getChargeLevel(), time); + emit valueChanged(uasId, name.arg("battery_remaining"), "%", getChargeLevel(), time); // emit voltageChanged(message.sysid, currentVoltage); - emit valueChanged(uasId, name.arg("battery_voltage"), "V", currentVoltage, time); + emit valueChanged(uasId, name.arg("battery_voltage"), "V", currentVoltage, time); - // And if the battery current draw is measured, log that also. - if (state.current_battery != -1) - { + // And if the battery current draw is measured, log that also. + if (state.current_battery != -1) + { currentCurrent = ((double)state.current_battery)/100.0f; emit valueChanged(uasId, name.arg("battery_current"), "A", currentCurrent, time); - } + } // LOW BATTERY ALARM if (lpVoltage < warnVoltage && (currentVoltage - 0.2f) < warnVoltage && (currentVoltage > 3.3)) @@ -624,17 +693,17 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) emit positionZControlEnabled(state.onboard_control_sensors_enabled & (1 << 13)); emit positionXYControlEnabled(state.onboard_control_sensors_enabled & (1 << 14)); - // Trigger drop rate updates as needed. Here we convert the incoming - // drop_rate_comm value from 1/100 of a percent in a uint16 to a true - // percentage as a float. We also cap the incoming value at 100% as defined - // by the MAVLink specifications. - if (state.drop_rate_comm > 10000) - { - state.drop_rate_comm = 10000; - } - emit dropRateChanged(this->getUASID(), state.drop_rate_comm/100.0f); - emit valueChanged(uasId, name.arg("drop_rate_comm"), "%", state.drop_rate_comm/100.0f, time); - } + // Trigger drop rate updates as needed. Here we convert the incoming + // drop_rate_comm value from 1/100 of a percent in a uint16 to a true + // percentage as a float. We also cap the incoming value at 100% as defined + // by the MAVLink specifications. + if (state.drop_rate_comm > 10000) + { + state.drop_rate_comm = 10000; + } + emit dropRateChanged(this->getUASID(), state.drop_rate_comm/100.0f); + emit valueChanged(uasId, name.arg("drop_rate_comm"), "%", state.drop_rate_comm/100.0f, time); + } break; case MAVLINK_MSG_ID_ATTITUDE: { @@ -647,29 +716,70 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) if (!wrongComponent) { lastAttitude = time; - //roll = QGC::limitAngleToPMPIf(attitude.roll); setRoll(QGC::limitAngleToPMPIf(attitude.roll)); - //pitch = QGC::limitAngleToPMPIf(attitude.pitch); setPitch(QGC::limitAngleToPMPIf(attitude.pitch)); - //yaw = QGC::limitAngleToPMPIf(attitude.yaw); setYaw(QGC::limitAngleToPMPIf(attitude.yaw)); - // // Emit in angles - - // // Convert yaw angle to compass value - // // in 0 - 360 deg range - // float compass = (yaw/M_PI)*180.0+360.0f; - // if (compass > -10000 && compass < 10000) - // { - // while (compass > 360.0f) { - // compass -= 360.0f; - // } - // } - // else - // { - // // Set to 0, since it is an invalid value - // compass = 0.0f; - // } + attitudeKnown = true; + emit attitudeChanged(this, getRoll(), getPitch(), getYaw(), time); + emit attitudeRotationRatesChanged(uasId, attitude.rollspeed, attitude.pitchspeed, attitude.yawspeed, time); + } + } + break; + case MAVLINK_MSG_ID_ATTITUDE_QUATERNION: + { + mavlink_attitude_quaternion_t attitude; + mavlink_msg_attitude_quaternion_decode(&message, &attitude); + quint64 time = getUnixReferenceTime(attitude.time_boot_ms); + + double a = attitude.q1; + double b = attitude.q2; + double c = attitude.q3; + double d = attitude.q4; + + double aSq = a * a; + double bSq = b * b; + double cSq = c * c; + double dSq = d * d; + float dcm[3][3]; + dcm[0][0] = aSq + bSq - cSq - dSq; + dcm[0][1] = 2.0 * (b * c - a * d); + dcm[0][2] = 2.0 * (a * c + b * d); + dcm[1][0] = 2.0 * (b * c + a * d); + dcm[1][1] = aSq - bSq + cSq - dSq; + dcm[1][2] = 2.0 * (c * d - a * b); + dcm[2][0] = 2.0 * (b * d - a * c); + dcm[2][1] = 2.0 * (a * b + c * d); + dcm[2][2] = aSq - bSq - cSq + dSq; + + float phi, theta, psi; + theta = asin(-dcm[2][0]); + + if (fabs(theta - M_PI_2) < 1.0e-3f) { + phi = 0.0f; + psi = (atan2(dcm[1][2] - dcm[0][1], + dcm[0][2] + dcm[1][1]) + phi); + + } else if (fabs(theta + M_PI_2) < 1.0e-3f) { + phi = 0.0f; + psi = atan2f(dcm[1][2] - dcm[0][1], + dcm[0][2] + dcm[1][1] - phi); + + } else { + phi = atan2f(dcm[2][1], dcm[2][2]); + psi = atan2f(dcm[1][0], dcm[0][0]); + } + + emit attitudeChanged(this, message.compid, QGC::limitAngleToPMPIf(phi), + QGC::limitAngleToPMPIf(theta), + QGC::limitAngleToPMPIf(psi), time); + + if (!wrongComponent) + { + lastAttitude = time; + setRoll(QGC::limitAngleToPMPIf(phi)); + setPitch(QGC::limitAngleToPMPIf(theta)); + setYaw(QGC::limitAngleToPMPIf(psi)); attitudeKnown = true; emit attitudeChanged(this, getRoll(), getPitch(), getYaw(), time); @@ -812,13 +922,13 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message) // only accept values in a realistic range // quint64 time = getUnixTime(pos.time_usec); quint64 time = getUnixTime(pos.time_usec); - + emit gpsLocalizationChanged(this, pos.fix_type); // TODO: track localization state not only for gps but also for other loc. sources int loc_type = pos.fix_type; if (loc_type == 1) { - loc_type = 0; + loc_type = 0; } emit localizationChanged(this, loc_type); setSatelliteCount(pos.satellites_visible); @@ -1537,9 +1647,12 @@ void UAS::receiveExtendedMessage(LinkInterface* link, std::tr1::shared_ptrgetSystemId(), mavlink->getComponentId(), &msg, &home); sendMessage(msg); + } else { + blockHomePositionChanges = true; } } @@ -1575,7 +1690,7 @@ void UAS::setLocalOriginAtCurrentGPSPosition() { QMessageBox msgBox; msgBox.setIcon(QMessageBox::Warning); - msgBox.setText("Setting new World Coordinate Frame Origin"); + msgBox.setText("Set the home position at the current GPS position?"); msgBox.setInformativeText("Do you want to set a new origin? Waypoints defined in the local frame will be shifted in their physical location"); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel); msgBox.setDefaultButton(QMessageBox::Cancel); @@ -1599,7 +1714,7 @@ void UAS::setLocalOriginAtCurrentGPSPosition() * @param x postion * @param y position * @param z position -*/ +*/ void UAS::setLocalPositionSetpoint(float x, float y, float z, float yaw) { #ifdef MAVLINK_ENABLED_PIXHAWK @@ -1619,7 +1734,7 @@ void UAS::setLocalPositionSetpoint(float x, float y, float z, float yaw) * @param x position * @param y position * @param z position -* @param yaw +* @param yaw */ void UAS::setLocalPositionOffset(float x, float y, float z, float yaw) { @@ -1681,8 +1796,8 @@ void UAS::startPressureCalibration() sendMessage(msg); } -/** -* Check if time is smaller than 40 years, assuming no system without Unix +/** +* Check if time is smaller than 40 years, assuming no system without Unix * timestamp runs longer than 40 years continuously without reboot. In worst case * this will add/subtract the communication delay between GCS and MAV, it will * never alter the timestamp in a safety critical way. @@ -1734,11 +1849,11 @@ quint64 UAS::getUnixReferenceTime(quint64 time) /** * @warning If attitudeStamped is enabled, this function will not actually return -* the precise time stamp of this measurement augmented to UNIX time, but will +* the precise time stamp of this measurement augmented to UNIX time, but will * MOVE the timestamp IN TIME to match the last measured attitude. There is no -* reason why one would want this, except for system setups where the onboard +* reason why one would want this, except for system setups where the onboard * clock is not present or broken and datasets should be collected that are still -* roughly synchronized. PLEASE NOTE THAT ENABLING ATTITUDE STAMPED RUINS THE +* roughly synchronized. PLEASE NOTE THAT ENABLING ATTITUDE STAMPED RUINS THE * SCIENTIFIC NATURE OF THE CORRECT LOGGING FUNCTIONS OF QGROUNDCONTROL! */ quint64 UAS::getUnixTimeFromMs(quint64 time) @@ -1748,10 +1863,10 @@ quint64 UAS::getUnixTimeFromMs(quint64 time) /** * @warning If attitudeStamped is enabled, this function will not actually return -* the precise time stam of this measurement augmented to UNIX time, but will -* MOVE the timestamp IN TIME to match the last measured attitude. There is no -* reason why one would want this, except for system setups where the onboard -* clock is not present or broken and datasets should be collected that are +* the precise time stam of this measurement augmented to UNIX time, but will +* MOVE the timestamp IN TIME to match the last measured attitude. There is no +* reason why one would want this, except for system setups where the onboard +* clock is not present or broken and datasets should be collected that are * still roughly synchronized. PLEASE NOTE THAT ENABLING ATTITUDE STAMPED * RUINS THE SCIENTIFIC NATURE OF THE CORRECT LOGGING FUNCTIONS OF QGROUNDCONTROL! */ @@ -1963,7 +2078,7 @@ QString UAS::getNavModeText(int mode) return QString("UNKNOWN"); } -/** +/** * Get the status of the code and a description of the status. * Status can be unitialized, booting up, calibrating sensors, active * standby, cirtical, emergency, shutdown or unknown. @@ -2026,15 +2141,13 @@ QImage UAS::getImage() // RAW greyscale if (imageType == MAVLINK_DATA_STREAM_IMG_RAW8U) { - // TODO FIXME - int imgColors = 255;//imageSize/(imageWidth*imageHeight); - //const int headerSize = 15; + int imgColors = 255; // Construct PGM header QString header("P5\n%1 %2\n%3\n"); header = header.arg(imageWidth).arg(imageHeight).arg(imgColors); - QByteArray tmpImage(header.toStdString().c_str(), header.toStdString().size()); + QByteArray tmpImage(header.toStdString().c_str(), header.toStdString().size() - 1); tmpImage.append(imageRecBuffer); //qDebug() << "IMAGE SIZE:" << tmpImage.size() << "HEADER SIZE: (15):" << header.size() << "HEADER: " << header; @@ -2047,7 +2160,7 @@ QImage UAS::getImage() if (!image.loadFromData(tmpImage, "PGM")) { - qDebug()<< "could not create extracted image"; + qDebug()<< __FILE__ << __LINE__ << "could not create extracted image"; return QImage(); } @@ -2060,7 +2173,7 @@ QImage UAS::getImage() { if (!image.loadFromData(imageRecBuffer)) { - qDebug() << "Loading data from image buffer failed!"; + qDebug() << __FILE__ << __LINE__ << "Loading data from image buffer failed!"; } } // Restart statemachine @@ -2136,7 +2249,7 @@ void UAS::readParametersFromStorage() sendMessage(msg); } -/** +/** * @param rate The update rate in Hz the message should be sent */ void UAS::enableAllDataTransmission(int rate) @@ -2164,7 +2277,7 @@ void UAS::enableAllDataTransmission(int rate) sendMessage(msg); } -/** +/** * @param rate The update rate in Hz the message should be sent */ void UAS::enableRawSensorDataTransmission(int rate) @@ -2188,7 +2301,7 @@ void UAS::enableRawSensorDataTransmission(int rate) sendMessage(msg); } -/** +/** * @param rate The update rate in Hz the message should be sent */ void UAS::enableExtendedSystemStatusTransmission(int rate) @@ -2212,7 +2325,7 @@ void UAS::enableExtendedSystemStatusTransmission(int rate) sendMessage(msg); } -/** +/** * @param rate The update rate in Hz the message should be sent */ void UAS::enableRCChannelDataTransmission(int rate) @@ -2241,7 +2354,7 @@ void UAS::enableRCChannelDataTransmission(int rate) #endif } -/** +/** * @param rate The update rate in Hz the message should be sent */ void UAS::enableRawControllerDataTransmission(int rate) @@ -2287,7 +2400,7 @@ void UAS::enableRawControllerDataTransmission(int rate) // sendMessage(msg); //} -/** +/** * @param rate The update rate in Hz the message should be sent */ void UAS::enablePositionTransmission(int rate) @@ -2311,7 +2424,7 @@ void UAS::enablePositionTransmission(int rate) sendMessage(msg); } -/** +/** * @param rate The update rate in Hz the message should be sent */ void UAS::enableExtra1Transmission(int rate) @@ -2336,7 +2449,7 @@ void UAS::enableExtra1Transmission(int rate) sendMessage(msg); } -/** +/** * @param rate The update rate in Hz the message should be sent */ void UAS::enableExtra2Transmission(int rate) @@ -2361,7 +2474,7 @@ void UAS::enableExtra2Transmission(int rate) sendMessage(msg); } -/** +/** * @param rate The update rate in Hz the message should be sent */ void UAS::enableExtra3Transmission(int rate) @@ -2390,7 +2503,7 @@ void UAS::enableExtra3Transmission(int rate) * Set a parameter value onboard * * @param component The component to set the parameter - * @param id Name of the parameter + * @param id Name of the parameter */ void UAS::setParameter(const int component, const QString& id, const QVariant& value) { @@ -2478,7 +2591,7 @@ void UAS::setParameter(const int component, const QString& id, const QVariant& v } } -/** +/** * Request parameter, use parameter name to request it. */ void UAS::requestParameter(int component, int id) @@ -2526,7 +2639,7 @@ void UAS::setSystemType(int systemType) if((systemType >= MAV_TYPE_GENERIC) && (systemType < MAV_TYPE_ENUM_END)) { type = systemType; - + // If the airframe is still generic, change it to a close default type if (airframe == 0) { @@ -2635,8 +2748,36 @@ void UAS::disarmSystem() sendMessage(msg); } -/** -* Set the manual control commands. +void UAS::toggleArmedState() +{ + mavlink_message_t msg; + mavlink_msg_set_mode_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, this->getUASID(), mode ^ MAV_MODE_FLAG_SAFETY_ARMED, navMode); + sendMessage(msg); +} + +void UAS::goAutonomous() +{ + mavlink_message_t msg; + mavlink_msg_set_mode_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, this->getUASID(), mode & MAV_MODE_FLAG_AUTO_ENABLED & ~MAV_MODE_FLAG_MANUAL_INPUT_ENABLED, navMode); + sendMessage(msg); +} + +void UAS::goManual() +{ + mavlink_message_t msg; + mavlink_msg_set_mode_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, this->getUASID(), mode & ~MAV_MODE_FLAG_AUTO_ENABLED & MAV_MODE_FLAG_MANUAL_INPUT_ENABLED, navMode); + sendMessage(msg); +} + +void UAS::toggleAutonomy() +{ + mavlink_message_t msg; + mavlink_msg_set_mode_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, this->getUASID(), mode ^ MAV_MODE_FLAG_AUTO_ENABLED ^ MAV_MODE_FLAG_MANUAL_INPUT_ENABLED, navMode); + sendMessage(msg); +} + +/** +* Set the manual control commands. * This can only be done if the system has manual inputs enabled and is armed. */ void UAS::setManualControlCommands(double roll, double pitch, double yaw, double thrust, int xHat, int yHat, int buttons) @@ -2696,27 +2837,6 @@ int UAS::getSystemType() return this->type; } -/** -* @param buttonIndex -*/ -void UAS::receiveButton(int buttonIndex) -{ - switch (buttonIndex) - { - case 0: - - break; - case 1: - - break; - default: - - break; - } - // qDebug() << __FILE__ << __LINE__ << ": Received button clicked signal (button # is: " << buttonIndex << "), UNIMPLEMENTED IN MAVLINK!"; - -} - /** * Halt the uas. */ @@ -2737,8 +2857,8 @@ void UAS::go() sendMessage(msg); } -/** -* Order the robot to return home +/** +* Order the robot to return home */ void UAS::home() { @@ -2754,7 +2874,7 @@ void UAS::home() } /** -* Order the robot to land on the runway +* Order the robot to land on the runway */ void UAS::land() { @@ -2891,6 +3011,66 @@ void UAS::enableHilXPlane(bool enable) } } +/** +* @param time_us Timestamp (microseconds since UNIX epoch or microseconds since system boot) +* @param roll Roll angle (rad) +* @param pitch Pitch angle (rad) +* @param yaw Yaw angle (rad) +* @param rollspeed Roll angular speed (rad/s) +* @param pitchspeed Pitch angular speed (rad/s) +* @param yawspeed Yaw angular speed (rad/s) +* @param lat Latitude, expressed as * 1E7 +* @param lon Longitude, expressed as * 1E7 +* @param alt Altitude in meters, expressed as * 1000 (millimeters) +* @param vx Ground X Speed (Latitude), expressed as m/s * 100 +* @param vy Ground Y Speed (Longitude), expressed as m/s * 100 +* @param vz Ground Z Speed (Altitude), expressed as m/s * 100 +* @param xacc X acceleration (mg) +* @param yacc Y acceleration (mg) +* @param zacc Z acceleration (mg) +*/ +void UAS::sendHilGroundTruth(quint64 time_us, float roll, float pitch, float yaw, float rollspeed, + float pitchspeed, float yawspeed, double lat, double lon, double alt, + float vx, float vy, float vz, float ind_airspeed, float true_airspeed, float xacc, float yacc, float zacc) +{ + float q[4]; + + double cosPhi_2 = cos(double(roll) / 2.0); + double sinPhi_2 = sin(double(roll) / 2.0); + double cosTheta_2 = cos(double(pitch) / 2.0); + double sinTheta_2 = sin(double(pitch) / 2.0); + double cosPsi_2 = cos(double(yaw) / 2.0); + double sinPsi_2 = sin(double(yaw) / 2.0); + q[0] = (cosPhi_2 * cosTheta_2 * cosPsi_2 + + sinPhi_2 * sinTheta_2 * sinPsi_2); + q[1] = (sinPhi_2 * cosTheta_2 * cosPsi_2 - + cosPhi_2 * sinTheta_2 * sinPsi_2); + q[2] = (cosPhi_2 * sinTheta_2 * cosPsi_2 + + sinPhi_2 * cosTheta_2 * sinPsi_2); + q[3] = (cosPhi_2 * cosTheta_2 * sinPsi_2 - + sinPhi_2 * sinTheta_2 * cosPsi_2); + + // Emit attitude for cross-check + emit valueChanged(uasId, "roll sim", "rad", roll, getUnixTime()); + emit valueChanged(uasId, "pitch sim", "rad", pitch, getUnixTime()); + emit valueChanged(uasId, "yaw sim", "rad", yaw, getUnixTime()); + + emit valueChanged(uasId, "roll rate sim", "rad/s", rollspeed, getUnixTime()); + emit valueChanged(uasId, "pitch rate sim", "rad/s", pitchspeed, getUnixTime()); + emit valueChanged(uasId, "yaw rate sim", "rad/s", yawspeed, getUnixTime()); + + emit valueChanged(uasId, "lat sim", "deg", lat*1e7, getUnixTime()); + emit valueChanged(uasId, "lon sim", "deg", lon*1e7, getUnixTime()); + emit valueChanged(uasId, "alt sim", "deg", alt*1e3, getUnixTime()); + + emit valueChanged(uasId, "vx sim", "m/s", vx*1e2, getUnixTime()); + emit valueChanged(uasId, "vy sim", "m/s", vy*1e2, getUnixTime()); + emit valueChanged(uasId, "vz sim", "m/s", vz*1e2, getUnixTime()); + + emit valueChanged(uasId, "IAS sim", "m/s", ind_airspeed, getUnixTime()); + emit valueChanged(uasId, "TAS sim", "m/s", true_airspeed, getUnixTime()); +} + /** * @param time_us Timestamp (microseconds since UNIX epoch or microseconds since system boot) * @param roll Roll angle (rad) @@ -2911,31 +3091,32 @@ void UAS::enableHilXPlane(bool enable) */ void UAS::sendHilState(quint64 time_us, float roll, float pitch, float yaw, float rollspeed, float pitchspeed, float yawspeed, double lat, double lon, double alt, - float vx, float vy, float vz, float xacc, float yacc, float zacc) + float vx, float vy, float vz, float ind_airspeed, float true_airspeed, float xacc, float yacc, float zacc) { if (this->mode & MAV_MODE_FLAG_HIL_ENABLED) { - if (QGC::groundTimeMilliseconds() - lastSendTimeSensors < 100) { - // Emit attitude for cross-check - emit attitudeChanged(this, 201, roll, pitch, yaw, getUnixTime()); - emit valueChanged(uasId, "roll sim", "rad", roll, getUnixTime()); - emit valueChanged(uasId, "pitch sim", "rad", pitch, getUnixTime()); - emit valueChanged(uasId, "yaw sim", "rad", yaw, getUnixTime()); - - emit valueChanged(uasId, "roll rate sim", "rad/s", rollspeed, getUnixTime()); - emit valueChanged(uasId, "pitch rate sim", "rad/s", pitchspeed, getUnixTime()); - emit valueChanged(uasId, "yaw rate sim", "rad/s", yawspeed, getUnixTime()); + float q[4]; + + double cosPhi_2 = cos(double(roll) / 2.0); + double sinPhi_2 = sin(double(roll) / 2.0); + double cosTheta_2 = cos(double(pitch) / 2.0); + double sinTheta_2 = sin(double(pitch) / 2.0); + double cosPsi_2 = cos(double(yaw) / 2.0); + double sinPsi_2 = sin(double(yaw) / 2.0); + q[0] = (cosPhi_2 * cosTheta_2 * cosPsi_2 + + sinPhi_2 * sinTheta_2 * sinPsi_2); + q[1] = (sinPhi_2 * cosTheta_2 * cosPsi_2 - + cosPhi_2 * sinTheta_2 * sinPsi_2); + q[2] = (cosPhi_2 * sinTheta_2 * cosPsi_2 + + sinPhi_2 * cosTheta_2 * sinPsi_2); + q[3] = (cosPhi_2 * cosTheta_2 * sinPsi_2 - + sinPhi_2 * sinTheta_2 * cosPsi_2); - emit valueChanged(uasId, "vx sim", "rad", vx*100, getUnixTime()); - emit valueChanged(uasId, "vy sim", "rad", vy*100, getUnixTime()); - emit valueChanged(uasId, "vz sim", "rad", vz*100, getUnixTime()); - } else { - mavlink_message_t msg; - mavlink_msg_hil_state_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, - time_us, roll, pitch, yaw, rollspeed, pitchspeed, yawspeed, - lat*1e7f, lon*1e7f, alt*1000, vx*100, vy*100, vz*100, xacc*1000/9.81, yacc*1000/9.81, zacc*1000/9.81); - sendMessage(msg); - } + mavlink_message_t msg; + mavlink_msg_hil_state_quaternion_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, + time_us, q, rollspeed, pitchspeed, yawspeed, + lat*1e7f, lon*1e7f, alt*1000, vx*100, vy*100, vz*100, ind_airspeed*100, true_airspeed*100, xacc*1000/9.81, yacc*1000/9.81, zacc*1000/9.81); + sendMessage(msg); } else { @@ -2948,17 +3129,16 @@ void UAS::sendHilState(quint64 time_us, float roll, float pitch, float yaw, floa } void UAS::sendHilSensors(quint64 time_us, float xacc, float yacc, float zacc, float rollspeed, float pitchspeed, float yawspeed, - float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, quint16 fields_changed) + float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, quint32 fields_changed) { if (this->mode & MAV_MODE_FLAG_HIL_ENABLED) { mavlink_message_t msg; - mavlink_msg_highres_imu_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, + mavlink_msg_hil_sensor_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, time_us, xacc, yacc, zacc, rollspeed, pitchspeed, yawspeed, xmag, ymag, zmag, abs_pressure, diff_pressure, pressure_alt, temperature, fields_changed); sendMessage(msg); - sensorHil = true; lastSendTimeSensors = QGC::groundTimeMilliseconds(); } else @@ -2971,7 +3151,7 @@ void UAS::sendHilSensors(quint64 time_us, float xacc, float yacc, float zacc, fl } } -void UAS::sendHilGps(quint64 time_us, double lat, double lon, double alt, int fix_type, float eph, float epv, float vel, float cog, int satellites) +void UAS::sendHilGps(quint64 time_us, double lat, double lon, double alt, int fix_type, float eph, float epv, float vel, float vn, float ve, float vd, float cog, int satellites) { // Only send at 10 Hz max rate if (QGC::groundTimeMilliseconds() - lastSendTimeGPS < 100) @@ -2987,8 +3167,8 @@ void UAS::sendHilGps(quint64 time_us, double lat, double lon, double alt, int fi course = (course / M_PI) * 180.0f; mavlink_message_t msg; - mavlink_msg_gps_raw_int_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, - time_us, fix_type, lat*1e7, lon*1e7, alt*1e3, eph*1e2, epv*1e2, vel*1e2, course*1e2, satellites); + mavlink_msg_hil_gps_pack(mavlink->getSystemId(), mavlink->getComponentId(), &msg, + time_us, fix_type, lat*1e7, lon*1e7, alt*1e3, eph*1e2, epv*1e2, vel*1e2, vn*1e2, ve*1e2, vd*1e2, course*1e2, satellites); lastSendTimeGPS = QGC::groundTimeMilliseconds(); sendMessage(msg); } @@ -3092,8 +3272,8 @@ const QString& UAS::getShortState() const return shortStateText; } -/** -* The mode can be autonomous, guided, manual or armed. It will also return if +/** +* The mode can be autonomous, guided, manual or armed. It will also return if * hardware in the loop is being used. * @return the audio mode text for the id given. */ @@ -3146,7 +3326,7 @@ QString UAS::getAudioModeTextFor(int id) } /** -* The mode returned can be auto, stabilized, test, manual, preflight or unknown. +* The mode returned can be auto, stabilized, test, manual, preflight or unknown. * @return the short text of the mode for the id given. */ QString UAS::getShortModeTextFor(int id) diff --git a/src/uas/UAS.h b/src/uas/UAS.h index 64a133b77329d757351bbdd5335274d94e98066c..95570049a10f8ce94339c6106521d58834c2d161 100644 --- a/src/uas/UAS.h +++ b/src/uas/UAS.h @@ -464,6 +464,7 @@ protected: //COMMENTS FOR TEST UNIT QByteArray imageRecBuffer; ///< Buffer for the incoming bytestream QImage image; ///< Image data of last completely transmitted image quint64 imageStart; + bool blockHomePositionChanges; ///< Block changes to the home position #if defined(QGC_PROTOBUF_ENABLED) && defined(QGC_USE_PIXHAWK_MESSAGES) px::GLOverlay overlay; @@ -528,6 +529,40 @@ public: paramManager = manager; } int getSystemType(); + + /** + * @brief Returns true for systems that can reverse. If the system has no control over position, it returns false as + * @return If the specified vehicle type can + */ + bool systemCanReverse() const + { + switch(type) + { + case MAV_TYPE_GENERIC: + case MAV_TYPE_FIXED_WING: + case MAV_TYPE_ROCKET: + case MAV_TYPE_FLAPPING_WING: + + // System types that don't have movement + case MAV_TYPE_ANTENNA_TRACKER: + case MAV_TYPE_GCS: + case MAV_TYPE_FREE_BALLOON: + default: + return false; + case MAV_TYPE_QUADROTOR: + case MAV_TYPE_COAXIAL: + case MAV_TYPE_HELICOPTER: + case MAV_TYPE_AIRSHIP: + case MAV_TYPE_GROUND_ROVER: + case MAV_TYPE_SURFACE_BOAT: + case MAV_TYPE_SUBMARINE: + case MAV_TYPE_HEXAROTOR: + case MAV_TYPE_OCTOROTOR: + case MAV_TYPE_TRICOPTER: + return true; + } + } + QString getSystemTypeName() { switch(type) @@ -642,6 +677,11 @@ public: break; } } + /** From UASInterface */ + QList getActions() const + { + return actions; + } public slots: /** @brief Set the autopilot type */ @@ -660,7 +700,7 @@ public slots: this->airframe = airframe; emit systemSpecsChanged(uasId); } - + } /** @brief Set a new name **/ void setUASName(const QString& name); @@ -696,11 +736,15 @@ public slots: /** @brief Send the full HIL state to the MAV */ void sendHilState(quint64 time_us, float roll, float pitch, float yaw, float rollRotationRate, float pitchRotationRate, float yawRotationRate, double lat, double lon, double alt, - float vx, float vy, float vz, float xacc, float yacc, float zacc); + float vx, float vy, float vz, float ind_airspeed, float true_airspeed, float xacc, float yacc, float zacc); + + void sendHilGroundTruth(quint64 time_us, float roll, float pitch, float yaw, float rollRotationRate, + float pitchRotationRate, float yawRotationRate, double lat, double lon, double alt, + float vx, float vy, float vz, float ind_airspeed, float true_airspeed, float xacc, float yacc, float zacc); /** @brief RAW sensors for sensor HIL */ - void sendHilSensors(quint64 time_us, float xacc, float yacc, float zacc, float rollRotationRate, float pitchRotationRate, float yawRotationRate, - float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, quint16 fields_changed); + void sendHilSensors(quint64 time_us, float xacc, float yacc, float zacc, float rollspeed, float pitchspeed, float yawspeed, + float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, quint32 fields_changed); /** * @param time_us @@ -714,7 +758,7 @@ public slots: * @param cog course over ground, in radians, -pi..pi * @param satellites */ - void sendHilGps(quint64 time_us, double lat, double lon, double alt, int fix_type, float eph, float epv, float vel, float cog, int satellites); + void sendHilGps(quint64 time_us, double lat, double lon, double alt, int fix_type, float eph, float epv, float vel, float vn, float ve, float vd, float cog, int satellites); /** @brief Places the UAV in Hardware-in-the-Loop simulation status **/ @@ -743,11 +787,23 @@ public slots: void armSystem(); /** @brief Disable the motors */ void disarmSystem(); + /** @brief Toggle the armed state of the system. */ + void toggleArmedState(); + /** + * @brief Tell the UAS to switch into a completely-autonomous mode, so disable manual input. + */ + void goAutonomous(); + /** + * @brief Tell the UAS to switch to manual control. Stabilized attitude may simultaneously be engaged. + */ + void goManual(); + /** + * @brief Tell the UAS to switch between manual and autonomous control. + */ + void toggleAutonomy(); /** @brief Set the values for the manual control of the vehicle */ void setManualControlCommands(double roll, double pitch, double yaw, double thrust, int xHat, int yHat, int buttons); - /** @brief Receive a button pressed event from an input device, e.g. joystick */ - void receiveButton(int buttonIndex); /** @brief Set the values for the 6dof manual control of the vehicle */ void setManual6DOFControlCommands(double x, double y, double z, double roll, double pitch, double yaw); @@ -832,6 +888,9 @@ public slots: void startDataRecording(); void stopDataRecording(); void deleteSettings(); + + /** @brief Triggers the action associated with the given ID. */ + void triggerAction(int action); signals: /** @brief The main/battery voltage has changed/was updated */ //void voltageChanged(int uasId, double voltage); // Defined in UASInterface already @@ -888,6 +947,7 @@ protected: bool sensorHil; ///< True if sensor HIL is enabled quint64 lastSendTimeGPS; ///< Last HIL GPS message sent quint64 lastSendTimeSensors; + QList actions; ///< A list of actions that this UAS can perform. protected slots: /** @brief Write settings to disk */ diff --git a/src/uas/UASInterface.h b/src/uas/UASInterface.h index 83f07f7497dd97faf8e9256048eece0b6ab73fcb..127a51fb135f78b00334f8efb3ceccb7456b4629 100644 --- a/src/uas/UASInterface.h +++ b/src/uas/UASInterface.h @@ -242,6 +242,11 @@ public: /** @brief Get the type of the system (airplane, quadrotor, helicopter,..)*/ virtual int getSystemType() = 0; + /** @brief Indicates whether this system is capable of controlling a reverse velocity. + * Used for, among other things, altering joystick input to either -1:1 or 0:1 range. + */ + virtual bool systemCanReverse() const = 0; + virtual QString getSystemTypeName() = 0; /** @brief Get the type of the autopilot (PIXHAWK, APM, UDB, PPZ,..) */ virtual int getAutopilotType() = 0; @@ -255,6 +260,13 @@ public: return color; } + /** @brief Returns a list of actions/commands that this vehicle can perform. + * Used for creating UI elements for built-in functionality for this vehicle. + * Actions should be mappings to `void f(void);` functions that simply issue + * a command to the vehicle. + */ + virtual QList getActions() const = 0; + public slots: /** @brief Set a new name for the system */ @@ -369,14 +381,14 @@ public slots: /** @brief Send the full HIL state to the MAV */ virtual void sendHilState(quint64 time_us, float roll, float pitch, float yaw, float rollspeed, float pitchspeed, float yawspeed, double lat, double lon, double alt, - float vx, float vy, float vz, float xacc, float yacc, float zacc) = 0; + float vx, float vy, float vz, float ind_airspeed, float true_airspeed, float xacc, float yacc, float zacc) = 0; /** @brief RAW sensors for sensor HIL */ virtual void sendHilSensors(quint64 time_us, float xacc, float yacc, float zacc, float rollspeed, float pitchspeed, float yawspeed, - float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, quint16 fields_changed) = 0; + float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, quint32 fields_changed) = 0; /** @brief Send raw GPS for sensor HIL */ - virtual void sendHilGps(quint64 time_us, double lat, double lon, double alt, int fix_type, float eph, float epv, float vel, float cog, int satellites) = 0; + virtual void sendHilGps(quint64 time_us, double lat, double lon, double alt, int fix_type, float eph, float epv, float vel, float vn, float ve, float vd, float cog, int satellites) = 0; protected: @@ -394,9 +406,6 @@ signals: * @param description longer textual description. Should be however limited to a short text, e.g. 200 chars. */ void statusChanged(UASInterface* uas, QString status, QString description); - /** @brief System has been removed / disconnected / shutdown cleanly, remove */ - void systemRemoved(UASInterface* uas); - void systemRemoved(); /** * @brief Received a plain text message from the robot * This signal should NOT be used for standard communication, but rather for VERY IMPORTANT diff --git a/src/uas/UASManager.cc b/src/uas/UASManager.cc index 00bb81ba261c39ba2c9c27ee302d1cbf3e3d595d..a854b310da5074838bc05ebe63495eeb11c59e67 100644 --- a/src/uas/UASManager.cc +++ b/src/uas/UASManager.cc @@ -75,9 +75,9 @@ bool UASManager::setHomePosition(double lat, double lon, double alt) && lat <= 90.0 && lat >= -90.0 && lon <= 180.0 && lon >= -180.0) { - if (homeLat != lat) changed = true; - if (homeLon != lon) changed = true; - if (homeAlt != alt) changed = true; + if (fabs(homeLat - lat) > 1e-7) changed = true; + if (fabs(homeLon - lon) > 1e-7) changed = true; + if (fabs(homeAlt - alt) > 0.5f) changed = true; // Initialize conversion reference in any case initReference(lat, lon, alt); @@ -89,17 +89,27 @@ bool UASManager::setHomePosition(double lat, double lon, double alt) homeAlt = alt; emit homePositionChanged(homeLat, homeLon, homeAlt); - - // Update all UAVs - foreach (UASInterface* mav, systems) - { - mav->setHomePosition(homeLat, homeLon, homeAlt); - } } } return changed; } +bool UASManager::setHomePositionAndNotify(double lat, double lon, double alt) +{ + // Checking for NaN and infitiny + // and checking for borders + bool changed = setHomePosition(lat, lon, alt); + + if (changed) + { + // Update all UAVs + foreach (UASInterface* mav, systems) + { + mav->setHomePosition(homeLat, homeLon, homeAlt); + } + } +} + /** * @param x1 Point 1 coordinate in x dimension * @param y1 Point 1 coordinate in y dimension @@ -269,7 +279,6 @@ void UASManager::addUAS(UASInterface* uas) if (!systems.contains(uas)) { systems.append(uas); - connect(uas, SIGNAL(destroyed(QObject*)), this, SLOT(removeUAS(QObject*))); // Set home position on UAV if set in UI // - this is done on a per-UAV basis // Set home position in UI if UAV chooses a new one (caution! if multiple UAVs are connected, take care!) @@ -300,42 +309,38 @@ void UASManager::addUAS(UASInterface* uas) } } -void UASManager::removeUAS(QObject* uas) +/** + * @brief The function that should be used when removing UASes from QGC. emits UASDeletect(UASInterface*) when triggered + * so that UI elements can update accordingly. + * @param uas The UAS to remove + */ +void UASManager::removeUAS(UASInterface* uas) { - UASInterface* mav = qobject_cast(uas); + if (uas) + { + int listindex = systems.indexOf(uas); - if (mav) { - int listindex = systems.indexOf(mav); + // Remove this system from local data store. + systems.removeAt(listindex); - if (mav == activeUAS) + // If this is the active UAS, select a new one if one exists otherwise + // indicate that there are no active UASes. + if (uas == activeUAS) { - if (systems.count() > 1) + if (systems.count()) { - // We only set a new UAS if more than one is present - if (listindex != 0) - { - // The system to be removed is not at position 1 - // set position one as new active system - setActiveUAS(systems.first()); - } - else - { - // The system to be removed is at position 1, - // select the next system - setActiveUAS(systems.at(1)); - } + setActiveUAS(systems.first()); } else { - // TODO send a null pointer if no UAS is present any more - // This has to be properly tested however, since it might - // crash code parts not handling null pointers correctly. - activeUAS = NULL; - // XXX Not emitting the null pointer yet + setActiveUAS(NULL); } } - systems.removeAt(listindex); - emit UASDeleted(mav); + + // Notify other UI elements that a UAS is being deleted before finally deleting it. + qDebug() << "Deleting UAS object: " << uas->getUASName(); + emit UASDeleted(uas); + uas->deleteLater(); } } @@ -439,21 +444,24 @@ UASInterface* UASManager::getUASForId(int id) void UASManager::setActiveUAS(UASInterface* uas) { - if (uas != NULL) { - activeUASMutex.lock(); - if (activeUAS != NULL) { - emit activeUASStatusChanged(activeUAS, false); - emit activeUASStatusChanged(activeUAS->getUASID(), false); - } - activeUAS = uas; - activeUASMutex.unlock(); + // Signal components that the last UAS is no longer active. + activeUASMutex.lock(); + if (activeUAS != NULL) { + emit activeUASStatusChanged(activeUAS, false); + emit activeUASStatusChanged(activeUAS->getUASID(), false); + } + activeUAS = uas; + activeUASMutex.unlock(); + // And signal that a new UAS is. + emit activeUASSet(activeUAS); + if (activeUAS) + { activeUAS->setSelected(); - emit activeUASSet(uas); - emit activeUASSet(uas->getUASID()); - emit activeUASSetListIndex(systems.indexOf(uas)); - emit activeUASStatusChanged(uas, true); - emit activeUASStatusChanged(uas->getUASID(), true); + emit activeUASSet(activeUAS->getUASID()); + emit activeUASSetListIndex(systems.indexOf(activeUAS)); + emit activeUASStatusChanged(activeUAS, true); + emit activeUASStatusChanged(activeUAS->getUASID(), true); } } diff --git a/src/uas/UASManager.h b/src/uas/UASManager.h index ff4c89731f1f5c55fd5f2f0a71d1ec37ec399223..1736b64f2090313d3f081389607bff4e15a23788 100644 --- a/src/uas/UASManager.h +++ b/src/uas/UASManager.h @@ -151,12 +151,12 @@ public slots: **/ void addUAS(UASInterface* UAS); - /** @brief Remove a system from the list */ - void removeUAS(QObject* uas); + /** @brief Remove a system from the list. If this is the active UAS, it switches to another one calling setActiveUAS. Also triggers the UAS to kill itself. */ + void removeUAS(UASInterface* uas); /** - * @brief Set a UAS as currently selected + * @brief Set a UAS as currently selected. NULL is a valid value for when no other valid UAS's are available. * * @param UAS Unmanned Air System to set **/ @@ -231,9 +231,12 @@ public slots: /** @brief Shut down the onboard operating system down */ bool shutdownActiveUAS(); - /** @brief Set the current home position on all UAVs*/ + /** @brief Set the current home position, but do not change it on the UAVs */ bool setHomePosition(double lat, double lon, double alt); + /** @brief Set the current home position on all UAVs*/ + bool setHomePositionAndNotify(double lat, double lon, double alt); + /** @brief Set the safety limits in local position frame */ void setLocalNEDSafetyBorders(double x1, double y1, double z1, double x2, double y2, double z2); diff --git a/src/ui/AudioOutputWidget.ui b/src/ui/AudioOutputWidget.ui index 0a87bcab55bd62eb2f05b0eaba6109e515e40055..a6b221191e41c503ceaf606a7c99b0b12f05620d 100644 --- a/src/ui/AudioOutputWidget.ui +++ b/src/ui/AudioOutputWidget.ui @@ -49,7 +49,7 @@ Mute - + :/files/images/status/audio-volume-muted.svg:/files/images/status/audio-volume-muted.svg @@ -63,7 +63,7 @@ - + diff --git a/src/ui/CommConfigurationWindow.cc b/src/ui/CommConfigurationWindow.cc index 43a3698a1e0edbb25dba5723a0c45044f79fa75a..b1fbac86e5ebe36232ded67f319358698c4573c9 100644 --- a/src/ui/CommConfigurationWindow.cc +++ b/src/ui/CommConfigurationWindow.cc @@ -62,6 +62,11 @@ CommConfigurationWindow::CommConfigurationWindow(LinkInterface* link, ProtocolIn // Setup the user interface according to link type ui.setupUi(this); + // Center the window on the screen. + QRect position = frameGeometry(); + position.moveCenter(QDesktopWidget().availableGeometry().center()); + move(position.topLeft()); + // Initialize basic ui state // Do not allow changes here unless advanced is checked diff --git a/src/ui/CommSettings.ui b/src/ui/CommSettings.ui index 91f0ad49dd20d4db98d53a369d0b2896459ae089..ec9c2436d99bfdb0a861deba0832be704a3fba66 100644 --- a/src/ui/CommSettings.ui +++ b/src/ui/CommSettings.ui @@ -14,7 +14,16 @@ Form - + + 6 + + + 6 + + + 6 + + 6 @@ -84,7 +93,16 @@ 0 - + + 0 + + + 0 + + + 0 + + 0 @@ -97,8 +115,8 @@ 0 0 - 393 - 76 + 391 + 85 @@ -116,7 +134,16 @@ 0 - + + 0 + + + 0 + + + 0 + + 0 @@ -129,8 +156,8 @@ 0 0 - 393 - 76 + 391 + 84 @@ -166,7 +193,7 @@ Connect - false + true diff --git a/src/ui/HDDisplay.cc b/src/ui/HDDisplay.cc index f83027efaddd6b5b50757d1ba86d6e4ea4f0363f..fe6f2809339b0c46ad8731fdb58e40121dd03939 100644 --- a/src/ui/HDDisplay.cc +++ b/src/ui/HDDisplay.cc @@ -24,6 +24,7 @@ #include "ui_HDDisplay.h" #include "MG.h" #include "QGC.h" +#include "MainWindow.h" #include HDDisplay::HDDisplay(QStringList* plotList, QString title, QWidget *parent) : @@ -443,7 +444,15 @@ void HDDisplay::renderOverlay() //painter.fillRect(QRect(0, 0, width(), height()), backgroundColor); const float spacing = 0.4f; // 40% of width const float gaugeWidth = vwidth / (((float)columns) + (((float)columns+1) * spacing + spacing * 0.5f)); - const QColor gaugeColor = QColor(200, 200, 200); + QColor gaugeColor; + if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) + { + gaugeColor = QColor(0, 0, 0); + } + else + { + gaugeColor = QColor(255, 255, 255); + } //drawSystemIndicator(10.0f-gaugeWidth/2.0f, 20.0f, 10.0f, 40.0f, 15.0f, &painter); //drawGauge(15.0f, 15.0f, gaugeWidth/2.0f, 0, 1.0f, "thrust", values.value("thrust", 0.0f), gaugeColor, &painter, qMakePair(0.45f, 0.8f), qMakePair(0.8f, 1.0f), true); //drawGauge(15.0f+gaugeWidth*1.7f, 15.0f, gaugeWidth/2.0f, 0, 10.0f, "altitude", values.value("altitude", 0.0f), gaugeColor, &painter, qMakePair(1.0f, 2.5f), qMakePair(0.0f, 0.5f), true); @@ -575,6 +584,20 @@ void HDDisplay::drawChangeRateStrip(float xRef, float yRef, float height, float void HDDisplay::drawGauge(float xRef, float yRef, float radius, float min, float max, QString name, float value, const QColor& color, QPainter* painter, bool symmetric, QPair goodRange, QPair criticalRange, bool solid) { + // Select color scheme based on light or dark theme. + QColor valueColor; + QColor backgroundColor; + if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) + { + valueColor = QColor(26, 75, 95); + backgroundColor = QColor(246, 246, 246); + } + else + { + valueColor = QGC::colorCyan; + backgroundColor = QColor(34, 34, 34); + } + // Draw the circle QPen circlePen(Qt::SolidLine); @@ -634,7 +657,7 @@ void HDDisplay::drawGauge(float xRef, float yRef, float radius, float min, float const float textY = yRef+radius/2.0f; // Draw background rectangle - QBrush brush(QGC::colorBackground, Qt::SolidPattern); + QBrush brush(backgroundColor, Qt::SolidPattern); painter->setBrush(brush); painter->setPen(Qt::NoPen); @@ -663,7 +686,7 @@ void HDDisplay::drawGauge(float xRef, float yRef, float radius, float min, float // Draw the value //painter->setPen(textColor); - paintText(label, QGC::colorCyan, textHeight, textX, textY+nameHeight, painter); + paintText(label, valueColor, textHeight, textX, textY+nameHeight, painter); //paintText(label, color, ((radius - radius/3.0f)*1.1f), xRef-radius/2.5f, yRef+radius/3.0f, painter); // Draw the needle diff --git a/src/ui/HSIDisplay.cc b/src/ui/HSIDisplay.cc index d18ebc038f79757c4f4a449e93b4cce69fe9e51e..d3a2a9d2a3ec2a0c749ec06a99a47d36eec66f42 100644 --- a/src/ui/HSIDisplay.cc +++ b/src/ui/HSIDisplay.cc @@ -43,6 +43,7 @@ This file is part of the QGROUNDCONTROL project #include //#include "Waypoint2DIcon.h" #include "MAV2DIcon.h" +#include "MainWindow.h" #include @@ -176,13 +177,18 @@ HSIDisplay::HSIDisplay(QWidget *parent) : setStatusTip(tr("View from top in body frame. Scroll with mouse wheel to change the horizontal field of view of the widget.")); connect(&statusClearTimer, SIGNAL(timeout()), this, SLOT(clearStatusMessage())); - statusClearTimer.start(3000); if (UASManager::instance()->getActiveUAS()) { setActiveUAS(UASManager::instance()->getActiveUAS()); } + connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), + this, SLOT(setActiveUAS(UASInterface*))); + + connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), + this, SLOT(setActiveUAS(UASInterface*))); + setFocusPolicy(Qt::StrongFocus); } @@ -235,7 +241,7 @@ void HSIDisplay::paintEvent(QPaintEvent * event) void HSIDisplay::renderOverlay() { - if (!isVisible()) return; + if (!isVisible() || !uas) return; #if (QGC_EVENTLOOP_DEBUG) qDebug() << "EVENTLOOP:" << __FILE__ << __LINE__; #endif @@ -262,7 +268,39 @@ void HSIDisplay::renderOverlay() // Draw base instrument // ---------------------- painter.setBrush(Qt::NoBrush); - const QColor ringColor = QColor(200, 200, 200); + + // Set the color scheme depending on the light/dark theme employed. + QColor ringColor; + QColor positionColor; + QColor setpointColor; + QColor labelColor; + QColor valueColor; + QColor statusColor; + QColor waypointLineColor; + QColor attitudeColor; + if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) + { + ringColor = QGC::colorBlack; + positionColor = QColor(20, 20, 200); + setpointColor = QColor(150, 250, 150); + labelColor = QColor(26, 75, 95); + valueColor = QColor(40, 40, 40); + statusColor = QGC::colorOrange; + waypointLineColor = QGC::colorDarkYellow; + attitudeColor = QColor(200, 20, 20); + } + else + { + ringColor = QColor(255, 255, 255); + positionColor = QColor(20, 20, 200); + setpointColor = QColor(150, 250, 150); + labelColor = QGC::colorCyan; + valueColor = QColor(255, 255, 255); + statusColor = QGC::colorOrange; + waypointLineColor = QGC::colorYellow; + attitudeColor = QColor(200, 20, 20); + } + QPen pen; pen.setColor(ringColor); pen.setWidth(refLineWidthToPen(1.0f)); @@ -272,7 +310,7 @@ void HSIDisplay::renderOverlay() { float radius = (vwidth - (topMargin + bottomMargin)*0.3f) / (1.35f * i+1) / 2.0f - bottomMargin / 2.0f; drawCircle(xCenterPos, yCenterPos, radius, 1.0f, ringColor, &painter); - paintText(tr("%1 m").arg(refToMetric(radius), 5, 'f', 1, ' '), QGC::colorCyan, 1.6f, vwidth/2-4, vheight/2+radius+2.2, &painter); + paintText(tr("%1 m").arg(refToMetric(radius), 5, 'f', 1, ' '), valueColor, 1.6f, vwidth/2-4, vheight/2+radius+7, &painter); } // Draw orientation labels @@ -323,11 +361,9 @@ void HSIDisplay::renderOverlay() // Draw state indicator // Draw position - QColor positionColor(20, 20, 200); drawPositionDirection(xCenterPos, yCenterPos, baseRadius, positionColor, &painter); // Draw attitude - QColor attitudeColor(200, 20, 20); drawAttitudeDirection(xCenterPos, yCenterPos, baseRadius, attitudeColor, &painter); @@ -343,9 +379,6 @@ void HSIDisplay::renderOverlay() float normAngleDiff = fabs(atan2(sin(angleDiff), cos(angleDiff))); - //if (((userSetPointSet) || (normAngleDiff > 0.05f) || dragStarted) && !(setPointDist < 0.08f && mavInitialized)) - - // Labels on outer part and bottom // Draw waypoints @@ -376,13 +409,13 @@ void HSIDisplay::renderOverlay() drawStatusFlag(33, 16, tr("VCN"), viconON, viconKnown, viconOK, painter); // Draw speed to top left - paintText(tr("SPEED"), QGC::colorCyan, 2.2f, 2, topMargin+2, &painter); - paintText(tr("%1 m/s").arg(speed, 5, 'f', 2, '0'), Qt::white, 2.2f, 12, topMargin+2, &painter); + paintText(tr("SPEED"), labelColor, 2.2f, 2, topMargin+2, &painter); + paintText(tr("%1 m/s").arg(speed, 5, 'f', 2, '0'), valueColor, 2.2f, 12, topMargin+2, &painter); // Draw crosstrack error to top right float crossTrackError = 0; - paintText(tr("XTRACK"), QGC::colorCyan, 2.2f, 54, topMargin+2, &painter); - paintText(tr("%1 m").arg(crossTrackError, 5, 'f', 2, '0'), Qt::white, 2.2f, 67, topMargin+2, &painter); + paintText(tr("XTRACK"), labelColor, 2.2f, 54, topMargin+2, &painter); + paintText(tr("%1 m").arg(crossTrackError, 5, 'f', 2, '0'), valueColor, 2.2f, 67, topMargin+2, &painter); // Draw position to bottom left if (localAvailable > 0) @@ -391,8 +424,8 @@ void HSIDisplay::renderOverlay() QString str; float offset = (globalAvailable > 0) ? -3.0f : 0.0f; str.sprintf("%05.2f %05.2f %05.2f m", x, y, z); - paintText(tr("POS"), QGC::colorCyan, 2.6f, 2, vheight - offset - 2.0f, &painter); - paintText(str, Qt::white, 2.6f, 10, vheight - offset - 2.0f, &painter); + paintText(tr("POS"), labelColor, 2.6f, 2, vheight - offset - 4.0f, &painter); + paintText(str, valueColor, 2.6f, 10, vheight - offset - 4.0f, &painter); } if (globalAvailable > 0) @@ -400,8 +433,8 @@ void HSIDisplay::renderOverlay() // Position QString str; str.sprintf("lat: %05.2f lon: %06.2f alt: %06.2f", lat, lon, alt); - paintText(tr("GPS"), QGC::colorCyan, 2.6f, 2, vheight- 2.0f, &painter); - paintText(str, Qt::white, 2.6f, 10, vheight - 2.0f, &painter); + paintText(tr("GPS"), labelColor, 2.6f, 2, vheight- 4.0f, &painter); + paintText(str, valueColor, 2.6f, 10, vheight - 4.0f, &painter); } // Draw Safety @@ -410,26 +443,25 @@ void HSIDisplay::renderOverlay() // drawSafetyArea(QPointF(x1, y1), QPointF(x2, y2), QGC::colorYellow, painter); // Draw status message - paintText(statusMessage, QGC::colorOrange, 2.8f, 8, 15, &painter); + paintText(statusMessage, statusColor, 2.8f, 8, 15, &painter); // Draw setpoint over waypoints if (positionSetPointKnown || setPointKnown) { // Draw setpoint - drawSetpointXYZYaw(bodyXSetCoordinate, bodyYSetCoordinate, bodyZSetCoordinate, bodyYawSet, QGC::colorYellow, painter); + drawSetpointXYZYaw(bodyXSetCoordinate, bodyYSetCoordinate, bodyZSetCoordinate, bodyYawSet, setpointColor, painter); // Draw travel direction line QPointF m(bodyXSetCoordinate, bodyYSetCoordinate); // Transform from body to world coordinates m = metricWorldToBody(m); // Scale from metric body to screen reference units QPointF s = metricBodyToRef(m); - drawLine(s.x(), s.y(), xCenterPos, yCenterPos, 1.5f, QGC::colorYellow, &painter); + drawLine(s.x(), s.y(), xCenterPos, yCenterPos, 1.5f, setpointColor, &painter); } if ((userSetPointSet || dragStarted) && ((normAngleDiff > 0.05f) || !(setPointDist < 0.08f && mavInitialized))) { - QColor spColor(150, 250, 150); - drawSetpointXYZYaw(uiXSetCoordinate, uiYSetCoordinate, uiZSetCoordinate, uiYawSet, spColor, painter); + drawSetpointXYZYaw(uiXSetCoordinate, uiYSetCoordinate, uiZSetCoordinate, uiYawSet, setpointColor, painter); } } @@ -440,9 +472,23 @@ void HSIDisplay::drawStatusFlag(float x, float y, QString label, bool status, bo void HSIDisplay::drawStatusFlag(float x, float y, QString label, bool status, bool known, bool ok, QPainter& painter) { - paintText(label, QGC::colorCyan, 2.6f, x, y+0.8f, &painter); - QColor statusColor(250, 250, 250); + QColor statusColor; + QColor labelColor; + if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) + { + statusColor = QColor(40, 40, 40); + labelColor = QColor(26, 75, 95); + } + else + { + statusColor = QColor(250, 250, 250); + labelColor = QGC::colorCyan; + } + // Draw the label. + paintText(label, labelColor, 2.6f, x, y+0.8f, &painter); + + // Determine color of status rectangle. if (!ok) { painter.setBrush(QGC::colorDarkYellow); } else { @@ -454,11 +500,12 @@ void HSIDisplay::drawStatusFlag(float x, float y, QString label, bool status, bo } painter.setPen(Qt::NoPen); + // Draw the status rectangle. float indicatorWidth = refToScreenX(7.0f); float indicatorHeight = refToScreenY(4.0f); - painter.drawRect(QRect(refToScreenX(x+7.3f), refToScreenY(y+0.05), indicatorWidth, indicatorHeight)); paintText((status) ? tr("ON") : tr("OFF"), statusColor, 2.6f, x+7.9f, y+0.8f, &painter); + // Cross out instrument if state unknown if (!known) { @@ -483,32 +530,43 @@ void HSIDisplay::drawStatusFlag(float x, float y, QString label, bool status, bo void HSIDisplay::drawPositionLock(float x, float y, QString label, int status, bool known, QPainter& painter) { - paintText(label, QGC::colorCyan, 2.6f, x, y+0.8f, &painter); + // Select color scheme based on light or dark window theme. + QColor labelColor; QColor negStatusColor(200, 20, 20); QColor intermediateStatusColor (Qt::yellow); QColor posStatusColor(20, 200, 20); - QColor statusColor(250, 250, 250); - if (status == 3) { - painter.setBrush(posStatusColor); - } else if (status == 2) { - painter.setBrush(intermediateStatusColor.dark(150)); - } else { - painter.setBrush(negStatusColor); + QColor statusColor; + if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) + { + statusColor = QColor(40, 40, 40); + labelColor = QColor(26, 75, 95); + } + else + { + statusColor = QColor(250, 250, 250); + labelColor = QGC::colorCyan; } - // Lock text + // Draw the label. + paintText(label, labelColor, 2.6f, x, y+0.8f, &painter); + + // based on the status, choose both the coloring and lock text. QString lockText; switch (status) { case 1: + painter.setBrush(intermediateStatusColor.dark(150)); lockText = tr("LOC"); break; case 2: + painter.setBrush(intermediateStatusColor.dark(150)); lockText = tr("2D"); break; case 3: + painter.setBrush(posStatusColor); lockText = tr("3D"); break; default: + painter.setBrush(negStatusColor); lockText = tr("NO"); break; } @@ -519,6 +577,7 @@ void HSIDisplay::drawPositionLock(float x, float y, QString label, int status, b painter.setPen(Qt::NoPen); painter.drawRect(QRect(refToScreenX(x+7.3f), refToScreenY(y+0.05), refToScreenX(7.0f), refToScreenY(4.0f))); paintText(lockText, statusColor, 2.6f, x+7.9f, y+0.8f, &painter); + // Cross out instrument if state unknown if (!known) { QPen pen(Qt::yellow); @@ -857,9 +916,6 @@ void HSIDisplay::setMetricWidth(double width) */ void HSIDisplay::setActiveUAS(UASInterface* uas) { - if (!uas) - return; - if (this->uas != NULL) { disconnect(this->uas, SIGNAL(gpsSatelliteStatusChanged(int,int,float,float,float,bool)), this, SLOT(updateSatellite(int,int,float,float,float,bool))); disconnect(this->uas, SIGNAL(localPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateLocalPosition(UASInterface*,double,double,double,quint64))); @@ -892,35 +948,43 @@ void HSIDisplay::setActiveUAS(UASInterface* uas) disconnect(this->uas, SIGNAL(actuatorStatusChanged(bool,bool,bool)), this, SLOT(updateActuatorStatus(bool,bool,bool))); } - connect(uas, SIGNAL(gpsSatelliteStatusChanged(int,int,float,float,float,bool)), this, SLOT(updateSatellite(int,int,float,float,float,bool))); - connect(uas, SIGNAL(localPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateLocalPosition(UASInterface*,double,double,double,quint64))); - connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,quint64))); - connect(uas, SIGNAL(attitudeThrustSetPointChanged(UASInterface*,double,double,double,double,quint64)), this, SLOT(updateAttitudeSetpoints(UASInterface*,double,double,double,double,quint64))); - connect(uas, SIGNAL(positionSetPointsChanged(int,float,float,float,float,quint64)), this, SLOT(updatePositionSetpoints(int,float,float,float,float,quint64))); - connect(uas, SIGNAL(userPositionSetPointsChanged(int,float,float,float,float)), this, SLOT(updateUserPositionSetpoints(int,float,float,float,float))); - connect(uas, SIGNAL(velocityChanged_NED(UASInterface*,double,double,double,quint64)), this, SLOT(updateSpeed(UASInterface*,double,double,double,quint64))); - connect(uas, SIGNAL(attitudeChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateAttitude(UASInterface*,double,double,double,quint64))); - - connect(uas, SIGNAL(attitudeControlEnabled(bool)), this, SLOT(updateAttitudeControllerEnabled(bool))); - connect(uas, SIGNAL(positionXYControlEnabled(bool)), this, SLOT(updatePositionXYControllerEnabled(bool))); - connect(uas, SIGNAL(positionZControlEnabled(bool)), this, SLOT(updatePositionZControllerEnabled(bool))); - connect(uas, SIGNAL(positionYawControlEnabled(bool)), this, SLOT(updatePositionYawControllerEnabled(bool))); - - connect(uas, SIGNAL(localizationChanged(UASInterface*,int)), this, SLOT(updateLocalization(UASInterface*,int))); - connect(uas, SIGNAL(visionLocalizationChanged(UASInterface*,int)), this, SLOT(updateVisionLocalization(UASInterface*,int))); - connect(uas, SIGNAL(gpsLocalizationChanged(UASInterface*,int)), this, SLOT(updateGpsLocalization(UASInterface*,int))); - connect(uas, SIGNAL(irUltraSoundLocalizationChanged(UASInterface*,int)), this, SLOT(updateInfraredUltrasoundLocalization(UASInterface*,int))); - connect(uas, SIGNAL(objectDetected(uint,int,int,QString,int,float,float)), this, SLOT(updateObjectPosition(uint,int,int,QString,int,float,float))); - - connect(uas, SIGNAL(gyroStatusChanged(bool,bool,bool)), this, SLOT(updateGyroStatus(bool,bool,bool))); - connect(uas, SIGNAL(accelStatusChanged(bool,bool,bool)), this, SLOT(updateAccelStatus(bool,bool,bool))); - connect(uas, SIGNAL(magSensorStatusChanged(bool,bool,bool)), this, SLOT(updateMagSensorStatus(bool,bool,bool))); - connect(uas, SIGNAL(baroStatusChanged(bool,bool,bool)), this, SLOT(updateBaroStatus(bool,bool,bool))); - connect(uas, SIGNAL(airspeedStatusChanged(bool,bool,bool)), this, SLOT(updateAirspeedStatus(bool,bool,bool))); - connect(uas, SIGNAL(opticalFlowStatusChanged(bool,bool,bool)), this, SLOT(updateOpticalFlowStatus(bool,bool,bool))); - connect(uas, SIGNAL(laserStatusChanged(bool,bool,bool)), this, SLOT(updateLaserStatus(bool,bool,bool))); - connect(uas, SIGNAL(groundTruthSensorStatusChanged(bool,bool,bool)), this, SLOT(updateGroundTruthSensorStatus(bool,bool,bool))); - connect(uas, SIGNAL(actuatorStatusChanged(bool,bool,bool)), this, SLOT(updateActuatorStatus(bool,bool,bool))); + if (uas) + { + connect(uas, SIGNAL(gpsSatelliteStatusChanged(int,int,float,float,float,bool)), this, SLOT(updateSatellite(int,int,float,float,float,bool))); + connect(uas, SIGNAL(localPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateLocalPosition(UASInterface*,double,double,double,quint64))); + connect(uas, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateGlobalPosition(UASInterface*,double,double,double,quint64))); + connect(uas, SIGNAL(attitudeThrustSetPointChanged(UASInterface*,double,double,double,double,quint64)), this, SLOT(updateAttitudeSetpoints(UASInterface*,double,double,double,double,quint64))); + connect(uas, SIGNAL(positionSetPointsChanged(int,float,float,float,float,quint64)), this, SLOT(updatePositionSetpoints(int,float,float,float,float,quint64))); + connect(uas, SIGNAL(userPositionSetPointsChanged(int,float,float,float,float)), this, SLOT(updateUserPositionSetpoints(int,float,float,float,float))); + connect(uas, SIGNAL(speedChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateSpeed(UASInterface*,double,double,double,quint64))); + connect(uas, SIGNAL(attitudeChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateAttitude(UASInterface*,double,double,double,quint64))); + + connect(uas, SIGNAL(attitudeControlEnabled(bool)), this, SLOT(updateAttitudeControllerEnabled(bool))); + connect(uas, SIGNAL(positionXYControlEnabled(bool)), this, SLOT(updatePositionXYControllerEnabled(bool))); + connect(uas, SIGNAL(positionZControlEnabled(bool)), this, SLOT(updatePositionZControllerEnabled(bool))); + connect(uas, SIGNAL(positionYawControlEnabled(bool)), this, SLOT(updatePositionYawControllerEnabled(bool))); + + connect(uas, SIGNAL(localizationChanged(UASInterface*,int)), this, SLOT(updateLocalization(UASInterface*,int))); + connect(uas, SIGNAL(visionLocalizationChanged(UASInterface*,int)), this, SLOT(updateVisionLocalization(UASInterface*,int))); + connect(uas, SIGNAL(gpsLocalizationChanged(UASInterface*,int)), this, SLOT(updateGpsLocalization(UASInterface*,int))); + connect(uas, SIGNAL(irUltraSoundLocalizationChanged(UASInterface*,int)), this, SLOT(updateInfraredUltrasoundLocalization(UASInterface*,int))); + connect(uas, SIGNAL(objectDetected(uint,int,int,QString,int,float,float)), this, SLOT(updateObjectPosition(uint,int,int,QString,int,float,float))); + + connect(uas, SIGNAL(gyroStatusChanged(bool,bool,bool)), this, SLOT(updateGyroStatus(bool,bool,bool))); + connect(uas, SIGNAL(accelStatusChanged(bool,bool,bool)), this, SLOT(updateAccelStatus(bool,bool,bool))); + connect(uas, SIGNAL(magSensorStatusChanged(bool,bool,bool)), this, SLOT(updateMagSensorStatus(bool,bool,bool))); + connect(uas, SIGNAL(baroStatusChanged(bool,bool,bool)), this, SLOT(updateBaroStatus(bool,bool,bool))); + connect(uas, SIGNAL(airspeedStatusChanged(bool,bool,bool)), this, SLOT(updateAirspeedStatus(bool,bool,bool))); + connect(uas, SIGNAL(opticalFlowStatusChanged(bool,bool,bool)), this, SLOT(updateOpticalFlowStatus(bool,bool,bool))); + connect(uas, SIGNAL(laserStatusChanged(bool,bool,bool)), this, SLOT(updateLaserStatus(bool,bool,bool))); + connect(uas, SIGNAL(groundTruthSensorStatusChanged(bool,bool,bool)), this, SLOT(updateGroundTruthSensorStatus(bool,bool,bool))); + connect(uas, SIGNAL(actuatorStatusChanged(bool,bool,bool)), this, SLOT(updateActuatorStatus(bool,bool,bool))); + statusClearTimer.start(3000); + } + else + { + statusClearTimer.stop(); + } this->uas = uas; @@ -1031,7 +1095,7 @@ void HSIDisplay::updateAttitude(UASInterface* uas, double roll, double pitch, do void HSIDisplay::updateUserPositionSetpoints(int uasid, float xDesired, float yDesired, float zDesired, float yawDesired) { - Q_UNUSED(uasid); + Q_UNUSED(uasid); uiXSetCoordinate = xDesired; uiYSetCoordinate = yDesired; uiZSetCoordinate = zDesired; diff --git a/src/ui/HUD.cc b/src/ui/HUD.cc index 815224445ec963eab489681448aa848e02fffde0..2c424b1b83cc9b16ef71352c7f4c514d1b619b14 100644 --- a/src/ui/HUD.cc +++ b/src/ui/HUD.cc @@ -34,8 +34,9 @@ This file is part of the QGROUNDCONTROL project #include #include #include - +#include #include + #include #include #include @@ -43,13 +44,8 @@ This file is part of the QGROUNDCONTROL project #include "UASManager.h" #include "UAS.h" #include "HUD.h" -#include "MG.h" #include "QGC.h" - -// Fix for some platforms, e.g. windows -#ifndef GL_MULTISAMPLE -#define GL_MULTISAMPLE 0x809D -#endif +#include "MainWindow.h" /** * @warning The HUD widget will not start painting its content automatically @@ -60,7 +56,7 @@ This file is part of the QGROUNDCONTROL project * @param parent */ HUD::HUD(int width, int height, QWidget* parent) - : QWidget(parent), + : QLabel(parent), uas(NULL), yawInt(0.0f), mode(tr("UNKNOWN MODE")), @@ -83,12 +79,6 @@ HUD::HUD(int width, int height, QWidget* parent) receivedChannels(1), receivedWidth(640), receivedHeight(480), - defaultColor(QColor(70, 200, 70)), - setPointColor(QColor(200, 20, 200)), - warningColor(Qt::yellow), - criticalColor(Qt::red), - infoColor(QColor(20, 200, 20)), - fuelColor(criticalColor), warningBlinkRate(5), refreshTimer(new QTimer(this)), noCamera(true), @@ -119,12 +109,13 @@ HUD::HUD(int width, int height, QWidget* parent) load(0.0f), offlineDirectory(""), nextOfflineImage(""), - HUDInstrumentsEnabled(true), + HUDInstrumentsEnabled(false), videoEnabled(true), xImageFactor(1.0), yImageFactor(1.0), + imageLoggingEnabled(false), imageRequested(false), - imageLoggingEnabled(false) + image(NULL) { // Set auto fill to false setAutoFillBackground(false); @@ -135,34 +126,16 @@ HUD::HUD(int width, int height, QWidget* parent) setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); scalingFactor = this->width()/vwidth; - // Fill with black background - QImage fill = QImage(width, height, QImage::Format_Indexed8); - fill.setNumColors(3); - fill.setColor(0, qRgb(0, 0, 0)); - fill.setColor(1, qRgb(0, 0, 0)); - fill.setColor(2, qRgb(0, 0, 0)); - fill.fill(0); - - //QString imagePath = "/Users/user/Desktop/frame0000.png"; - //qDebug() << __FILE__ << __LINE__ << "template image:" << imagePath; - //fill = QImage(imagePath); - - glImage = fill; + // Set up the initial color theme. This can be updated by a styleChanged + // signal from MainWindow. + styleChanged(((MainWindow*)parent)->getStyle()); // Refresh timer refreshTimer->setInterval(updateInterval); - connect(refreshTimer, SIGNAL(timeout()), this, SLOT(paintHUD())); + connect(refreshTimer, SIGNAL(timeout()), this, SLOT(repaint())); // Resize to correct size and fill with image QWidget::resize(this->width(), this->height()); - //glDrawPixels(glImage.width(), glImage.height(), GL_RGBA, GL_UNSIGNED_BYTE, glImage.bits()); - - // Set size once - //setFixedSize(fill.size()); - //setMinimumSize(fill.size()); - //setMaximumSize(fill.size()); - // Lock down the size - //setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); fontDatabase = QFontDatabase(); const QString fontFileName = ":/general/vera.ttf"; ///< Font file is part of the QRC file and compiled into the app @@ -178,6 +151,11 @@ HUD::HUD(int width, int height, QWidget* parent) if (font.family() != fontFamilyName) qDebug() << "ERROR! WRONG FONT LOADED: " << fontFamilyName; } + // Connect the themeChanged signal from the MainWindow to this widget, so it + // can change it's styling accordingly. + connect((MainWindow*)parent, SIGNAL(styleChanged(MainWindow::QGC_MAINWINDOW_STYLE)), + this, SLOT(styleChanged(MainWindow::QGC_MAINWINDOW_STYLE))); + // Connect with UAS connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*))); @@ -196,6 +174,41 @@ QSize HUD::sizeHint() const return QSize(width(), (width()*3.0f)/4); } +void HUD::styleChanged(MainWindow::QGC_MAINWINDOW_STYLE newTheme) +{ + // Generate a background image that's dependent on the current color scheme. + QImage fill = QImage(width(), height(), QImage::Format_Indexed8); + if (newTheme == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) + { + fill.fill(255); + } + else + { + fill.fill(0); + } + glImage = QGLWidget::convertToGLFormat(fill); + + // Now set the other default colors based on the current color scheme. + if (newTheme == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) + { + defaultColor = QColor(0x01, 0x47, 0x01); + setPointColor = QColor(0x82, 0x17, 0x82); + warningColor = Qt::darkYellow; + criticalColor = Qt::darkRed; + infoColor = QColor(0x07, 0x82, 0x07); + fuelColor = criticalColor; + } + else + { + defaultColor = QColor(70, 200, 70); + setPointColor = QColor(200, 20, 200); + warningColor = Qt::yellow; + criticalColor = Qt::red; + infoColor = QColor(20, 200, 20); + fuelColor = criticalColor; + } +} + void HUD::showEvent(QShowEvent* event) { // React only to internal (pre-display) @@ -302,10 +315,10 @@ void HUD::setActiveUAS(UASInterface* uas) connect(u, SIGNAL(imageStarted(quint64)), this, SLOT(startImage(quint64))); connect(u, SIGNAL(imageReady(UASInterface*)), this, SLOT(copyImage())); } - - // Set new UAS - this->uas = uas; } + + // Set new UAS + this->uas = uas; } //void HUD::updateAttitudeThrustSetPoint(UASInterface* uas, double rollDesired, double pitchDesired, double yawDesired, double thrustDesired, quint64 msec) @@ -502,10 +515,8 @@ void HUD::paintRollPitchStrips() void HUD::paintEvent(QPaintEvent *event) { - // Event is not needed - // the event is ignored as this widget - // is refreshed automatically - Q_UNUSED(event); + + paintHUD(); } void HUD::paintHUD() @@ -560,7 +571,6 @@ void HUD::paintHUD() scalingFactor = this->width()/vwidth; double scalingFactorH = this->height()/vheight; if (scalingFactorH < scalingFactor) scalingFactor = scalingFactorH; - // Fill with black background if (videoEnabled) { if (nextOfflineImage != "" && QFileInfo(nextOfflineImage).exists()) { @@ -575,6 +585,7 @@ void HUD::paintHUD() } + // And if either video or the data stream is enabled, draw the next frame. if (dataStreamEnabled || videoEnabled) { @@ -586,23 +597,27 @@ void HUD::paintHUD() } + QPainter painter; + painter.begin(this); + painter.setRenderHint(QPainter::Antialiasing, true); + painter.setRenderHint(QPainter::HighQualityAntialiasing, true); + QPixmap pmap = QPixmap::fromImage(glImage).scaledToWidth(width()); + painter.drawPixmap(0, (height() - pmap.height()) / 2, pmap); + // END OF OPENGL PAINTING - if (HUDInstrumentsEnabled) { + if (HUDInstrumentsEnabled) + { //glEnable(GL_MULTISAMPLE); // QT PAINTING //makeCurrent(); - QPainter painter; - painter.begin(this); - painter.setRenderHint(QPainter::Antialiasing, true); - painter.setRenderHint(QPainter::HighQualityAntialiasing, true); + painter.translate((this->vwidth/2.0+xCenterOffset)*scalingFactor, (this->vheight/2.0+yCenterOffset)*scalingFactor); // COORDINATE FRAME IS NOW (0,0) at CENTER OF WIDGET - // Draw all fixed indicators // BATTERY paintText(fuelStatus, fuelColor, 6.0f, (-vwidth/2.0) + 10, -vheight/2.0 + 6, &painter); @@ -759,13 +774,12 @@ void HUD::paintHUD() painter.rotate(-(att.x()/M_PI)* -180.0f); } - painter.end(); - } else { - QPainter painter; - painter.begin(this); - painter.end(); + } + + painter.end(); } + } @@ -1200,7 +1214,8 @@ void HUD::setImageSize(int width, int height, int depth, int channels) rawBuffer1 = (unsigned char*)malloc(rawExpectedBytes); rawBuffer2 = (unsigned char*)malloc(rawExpectedBytes); rawImage = rawBuffer1; - // TODO check if old image should be deleted + if (image) + delete image; // Set image format // 8 BIT GREYSCALE IMAGE @@ -1220,7 +1235,14 @@ void HUD::setImageSize(int width, int height, int depth, int channels) } // Fill first channel of image with black pixels - image->fill(0); + if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) + { + image->fill(255); + } + else + { + image->fill(0); + } glImage = *image; qDebug() << __FILE__ << __LINE__ << "Setting up image"; @@ -1367,20 +1389,16 @@ void HUD::setPixels(int imgid, const unsigned char* imageData, int length, int s void HUD::copyImage() { - if (isVisible() && HUDInstrumentsEnabled) + UAS* u = dynamic_cast(this->uas); + if (u) { - //qDebug() << "HUD::copyImage()"; - UAS* u = dynamic_cast(this->uas); - if (u) - { - this->glImage = u->getImage(); + this->glImage = u->getImage(); - // Save to directory if logging is enabled - if (imageLoggingEnabled) - { - u->getImage().save(QString("%1/%2.png").arg(imageLogDirectory).arg(imageLogCounter)); - imageLogCounter++; - } + // Save to directory if logging is enabled + if (imageLoggingEnabled) + { + u->getImage().save(QString("%1/%2.png").arg(imageLogDirectory).arg(imageLogCounter)); + imageLogCounter++; } } } diff --git a/src/ui/HUD.h b/src/ui/HUD.h index 8352e6c1ba7945fcf5746d99bb08c9228049df4b..0e69d0e74eaeafdf41f9f53162c5b8def91718c7 100644 --- a/src/ui/HUD.h +++ b/src/ui/HUD.h @@ -34,11 +34,13 @@ This file is part of the QGROUNDCONTROL project #include #include +#include #include #include #include #include #include "UASInterface.h" +#include "MainWindow.h" /** * @brief Displays a Head Up Display (HUD) @@ -47,7 +49,7 @@ This file is part of the QGROUNDCONTROL project * It can superimpose the HUD over the current live image stream (any arriving image stream will be auto- * matically used as background), or it draws the classic blue-brown background known from instruments. */ -class HUD : public QWidget +class HUD : public QLabel { Q_OBJECT public: @@ -58,8 +60,7 @@ public: void resize(int w, int h); public slots: -// void initializeGL(); - //void paintGL(); + void styleChanged(MainWindow::QGC_MAINWINDOW_STYLE newTheme); /** @brief Set the currently monitored UAS */ virtual void setActiveUAS(UASInterface* uas); @@ -139,7 +140,7 @@ protected: void contextMenuEvent (QContextMenuEvent* event); void createActions(); - static const int updateInterval = 40; + static const int updateInterval = 100; QImage* image; ///< Double buffer image QImage glImage; ///< The background / camera image diff --git a/src/ui/JoystickAxis.cc b/src/ui/JoystickAxis.cc new file mode 100644 index 0000000000000000000000000000000000000000..5effd6971b6c8cb4481bbebf8d97fb93752a15ed --- /dev/null +++ b/src/ui/JoystickAxis.cc @@ -0,0 +1,92 @@ +#include "JoystickAxis.h" +#include "JoystickInput.h" +#include "ui_JoystickAxis.h" +#include "UASManager.h" +#include + +JoystickAxis::JoystickAxis(int id, QWidget *parent) : + QWidget(parent), + id(id), + ui(new Ui::JoystickAxis) +{ + ui->setupUi(this); + mappingComboBoxChanged(JoystickInput::JOYSTICK_INPUT_MAPPING_NONE); + ui->label->setText(QString::number(id)); + connect(ui->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(mappingComboBoxChanged(int))); + connect(ui->invertedCheckBox, SIGNAL(clicked(bool)), this, SLOT(inversionCheckBoxChanged(bool))); + connect(ui->rangeCheckBox, SIGNAL(clicked(bool)), this, SLOT(rangeCheckBoxChanged(bool))); +} + +JoystickAxis::~JoystickAxis() +{ + delete ui; +} + +void JoystickAxis::setValue(float value) +{ + ui->progressBar->setValue(100.0f * value); +} + +void JoystickAxis::setMapping(JoystickInput::JOYSTICK_INPUT_MAPPING newMapping) +{ + ui->comboBox->setCurrentIndex(newMapping); + if (newMapping == JoystickInput::JOYSTICK_INPUT_MAPPING_THROTTLE) + { + ui->rangeCheckBox->show(); + } + else + { + ui->rangeCheckBox->hide(); + } + this->setActiveUAS(UASManager::instance()->getActiveUAS()); +} + +void JoystickAxis::setInverted(bool newValue) +{ + ui->invertedCheckBox->setChecked(newValue); +} + +void JoystickAxis::setRangeLimit(bool newValue) +{ + ui->rangeCheckBox->setChecked(newValue); +} + +void JoystickAxis::mappingComboBoxChanged(int newMapping) +{ + JoystickInput::JOYSTICK_INPUT_MAPPING mapping = (JoystickInput::JOYSTICK_INPUT_MAPPING)newMapping; + emit mappingChanged(id, mapping); + updateUIBasedOnUAS(UASManager::instance()->getActiveUAS(), mapping); +} + +void JoystickAxis::inversionCheckBoxChanged(bool inverted) +{ + emit inversionChanged(id, inverted); +} + +void JoystickAxis::rangeCheckBoxChanged(bool limited) +{ + emit rangeChanged(id, limited); +} + +void JoystickAxis::setActiveUAS(UASInterface* uas) +{ + updateUIBasedOnUAS(uas, (JoystickInput::JOYSTICK_INPUT_MAPPING)ui->comboBox->currentIndex()); +} + +void JoystickAxis::updateUIBasedOnUAS(UASInterface* uas, JoystickInput::JOYSTICK_INPUT_MAPPING axisMapping) +{ + // Set the throttle display to only positive if: + // * This is the throttle axis AND + // * The current UAS can't reverse OR there is no current UAS + // This causes us to default to systems with no negative throttle. + if (((uas && !uas->systemCanReverse()) || !uas) && axisMapping == JoystickInput::JOYSTICK_INPUT_MAPPING_THROTTLE) + { + ui->progressBar->setRange(0, 100); + ui->rangeCheckBox->show(); + } + else + { + ui->progressBar->setRange(-100, 100); + ui->rangeCheckBox->hide(); + } +} diff --git a/src/ui/JoystickAxis.h b/src/ui/JoystickAxis.h new file mode 100644 index 0000000000000000000000000000000000000000..6bb94b349a76b96a2b20c6eac0b35433d46d4155 --- /dev/null +++ b/src/ui/JoystickAxis.h @@ -0,0 +1,84 @@ +/*===================================================================== + +QGroundControl Open Source Ground Control Station + +This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + +======================================================================*/ + +/** + * @file + * This class defines a UI element to represent a single controller axis. + * It is used by the JoystickWidget to simplify some of the logic in that class. + */ + +#ifndef JOYSTICKAXIS_H +#define JOYSTICKAXIS_H + +#include +#include "JoystickInput.h" + +namespace Ui { +class JoystickAxis; +} + +class JoystickAxis : public QWidget +{ + Q_OBJECT + +public: + explicit JoystickAxis(int id, QWidget *parent = 0); + ~JoystickAxis(); + void setMapping(JoystickInput::JOYSTICK_INPUT_MAPPING newMapping); + void setInverted(bool newValue); + void setRangeLimit(bool newValue); + +signals: + /** @brief Signal a change in this axis' yaw/pitch/roll mapping */ + void mappingChanged(int id, JoystickInput::JOYSTICK_INPUT_MAPPING newMapping); + /** @brief Signal a change in this axis' inversion status */ + void inversionChanged(int id, bool inversion); + /** @brief Signal a change in this axis' range setting. If limited is true then only the positive values should be read from this axis. */ + void rangeChanged(int id, bool limited); + +public slots: + /** @brief Update the displayed value of the included progressbar. + * @param value A value between -1.0 and 1.0. + */ + void setValue(float value); + /** @brief Specify the UAS that this axis should track for displaying throttle properly. */ + void setActiveUAS(UASInterface* uas); + +private: + int id; ///< The ID for this axis. Corresponds to the IDs used by JoystickInput. + Ui::JoystickAxis *ui; + /** + * @brief Update the UI based on both the current UAS and the current axis mapping. + * @param uas The currently-active UAS. + * @param axisMapping The new mapping for this axis. + */ + void updateUIBasedOnUAS(UASInterface* uas, JoystickInput::JOYSTICK_INPUT_MAPPING axisMapping); + +private slots: + /** @brief Handle changes to the mapping dropdown bar. */ + void mappingComboBoxChanged(int newMapping); + /** @brief Emit signal when the inversion checkbox is changed. */ + void inversionCheckBoxChanged(bool inverted); + /** @brief Emit signal when the range checkbox is changed. */ + void rangeCheckBoxChanged(bool inverted); +}; + +#endif // JOYSTICKAXIS_H diff --git a/src/ui/JoystickAxis.ui b/src/ui/JoystickAxis.ui new file mode 100644 index 0000000000000000000000000000000000000000..212133c5033baf8c50e045f6c407bf56c42f432d --- /dev/null +++ b/src/ui/JoystickAxis.ui @@ -0,0 +1,168 @@ + + + JoystickAxis + + + + 0 + 0 + 80 + 200 + + + + + 0 + 0 + + + + + 40 + 200 + + + + Form + + + + QLayout::SetMinimumSize + + + 1 + + + 2 + + + 1 + + + 2 + + + + + + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + Specify what property of the UAS this axis should command + + + + -- + + + + + Yaw + + + + + Pitch + + + + + Roll + + + + + Throttle + + + + + + + + Half range + + + + + + + true + + + + 0 + 0 + + + + + 0 + 100 + + + + Only use the positive values from this axis for control + + + -100 + + + 0 + + + Qt::AlignCenter + + + true + + + Qt::Vertical + + + QProgressBar::TopToBottom + + + %v + + + + + + + + 0 + 0 + + + + + 0 + 25 + + + + Reverse the values for this axis + + + Inverted + + + + + + + + diff --git a/src/ui/JoystickButton.cc b/src/ui/JoystickButton.cc new file mode 100644 index 0000000000000000000000000000000000000000..97941557ba0678bd8bea4c5aee891c491ee3a1c1 --- /dev/null +++ b/src/ui/JoystickButton.cc @@ -0,0 +1,58 @@ +#include "JoystickButton.h" +#include "ui_JoystickButton.h" +#include "UASManager.h" + +JoystickButton::JoystickButton(int id, QWidget *parent) : + QWidget(parent), + id(id), + m_ui(new Ui::JoystickButton) +{ + m_ui->setupUi(this); + m_ui->joystickButtonLabel->setText(QString::number(id)); + this->setActiveUAS(UASManager::instance()->getActiveUAS()); + connect(m_ui->joystickAction, SIGNAL(currentIndexChanged(int)), this, SLOT(actionComboBoxChanged(int))); +} + +JoystickButton::~JoystickButton() +{ + delete m_ui; +} + +void JoystickButton::setActiveUAS(UASInterface* uas) +{ + // Disable signals so that changes to joystickAction don't trigger JoystickInput updates. + disconnect(m_ui->joystickAction, SIGNAL(currentIndexChanged(int)), this, SLOT(actionComboBoxChanged(int))); + if (uas) + { + m_ui->joystickAction->setEnabled(true); + m_ui->joystickAction->clear(); + m_ui->joystickAction->addItem("--"); + QList actions = uas->getActions(); + foreach (QAction* a, actions) + { + m_ui->joystickAction->addItem(a->text()); + } + m_ui->joystickAction->setCurrentIndex(0); + } else { + m_ui->joystickAction->setEnabled(false); + m_ui->joystickAction->clear(); + m_ui->joystickAction->addItem("--"); + m_ui->joystickAction->setCurrentIndex(0); + } + connect(m_ui->joystickAction, SIGNAL(currentIndexChanged(int)), this, SLOT(actionComboBoxChanged(int))); +} + +void JoystickButton::setAction(int index) +{ + // Disable signals so that changes to joystickAction don't trigger JoystickInput updates. + disconnect(m_ui->joystickAction, SIGNAL(currentIndexChanged(int)), this, SLOT(actionComboBoxChanged(int))); + // Add one because the default no-action takes the 0-spot. + m_ui->joystickAction->setCurrentIndex(index + 1); + connect(m_ui->joystickAction, SIGNAL(currentIndexChanged(int)), this, SLOT(actionComboBoxChanged(int))); +} + +void JoystickButton::actionComboBoxChanged(int index) +{ + // Subtract one because the default no-action takes the 0-spot. + emit actionChanged(id, index - 1); +} diff --git a/src/ui/JoystickButton.h b/src/ui/JoystickButton.h new file mode 100644 index 0000000000000000000000000000000000000000..559f49201891615b996bdad4af0fa8939735b680 --- /dev/null +++ b/src/ui/JoystickButton.h @@ -0,0 +1,66 @@ +/*===================================================================== + +QGroundControl Open Source Ground Control Station + +This file is part of the QGROUNDCONTROL project + + QGROUNDCONTROL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + QGROUNDCONTROL is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with QGROUNDCONTROL. If not, see . + +======================================================================*/ + +/** + * @file + * This class defines a UI element to represent a single controller axis. + * It is used by the JoystickWidget to simplify some of the logic in that class. + */ + +#ifndef JOYSTICKBUTTON_H +#define JOYSTICKBUTTON_H + +#include + +#include "UASInterface.h" + +namespace Ui +{ +class JoystickButton; +} + +class JoystickButton : public QWidget +{ + Q_OBJECT + +public: + explicit JoystickButton(int id, QWidget *parent = 0); + virtual ~JoystickButton(); + +public slots: + /** @brief Specify the UAS that this axis should track for displaying throttle properly. */ + void setActiveUAS(UASInterface* uas); + /** @brieft Specify which action this button should correspond to. + * Values 0 and higher indicate a specific action, while -1 indicates no action. */ + void setAction(int index); + +signals: + /** @brief Signal a change in this buttons' action mapping */ + void actionChanged(int id, int index); + +private: + int id; + Ui::JoystickButton *m_ui; + +private slots: + void actionComboBoxChanged(int index); +}; +#endif // JOYSTICKBUTTON_H diff --git a/src/ui/JoystickButton.ui b/src/ui/JoystickButton.ui new file mode 100644 index 0000000000000000000000000000000000000000..1598d22273c2a4929d4d60c896fd37624158ca4c --- /dev/null +++ b/src/ui/JoystickButton.ui @@ -0,0 +1,92 @@ + + + JoystickButton + + + + 0 + 0 + 125 + 29 + + + + + 0 + 0 + + + + + 50 + 0 + + + + Form + + + + QLayout::SetMinimumSize + + + 2 + + + 1 + + + 2 + + + 1 + + + + + + 0 + 0 + + + + + 20 + 0 + + + + + + + Qt::AlignCenter + + + + + + + false + + + + 0 + 0 + + + + + 60 + 0 + + + + QComboBox::AdjustToContents + + + + + + + + diff --git a/src/ui/JoystickWidget.cc b/src/ui/JoystickWidget.cc index 21b077b554ae5610d16b28bf999ddf65935ca022..5b5150791f8d437107d26177ffeafcb0cce8804c 100644 --- a/src/ui/JoystickWidget.cc +++ b/src/ui/JoystickWidget.cc @@ -1,48 +1,101 @@ #include "JoystickWidget.h" +#include "MainWindow.h" #include "ui_JoystickWidget.h" -#include +#include "JoystickButton.h" +#include "JoystickAxis.h" + +#include JoystickWidget::JoystickWidget(JoystickInput* joystick, QWidget *parent) : QDialog(parent), + joystick(joystick), m_ui(new Ui::JoystickWidget) { m_ui->setupUi(this); - clearKeys(); - this->joystick = joystick; - - m_ui->rollMapSpinBox->setValue(joystick->getMappingXAxis()); - m_ui->pitchMapSpinBox->setValue(joystick->getMappingYAxis()); - m_ui->yawMapSpinBox->setValue(joystick->getMappingYawAxis()); - m_ui->throttleMapSpinBox->setValue(joystick->getMappingThrustAxis()); - m_ui->autoMapSpinBox->setValue(joystick->getMappingAutoButton()); - - connect(this->joystick, SIGNAL(joystickChanged(double,double,double,double,int,int,int)), this, SLOT(updateJoystick(double,double,double,double,int,int))); - connect(this->joystick, SIGNAL(buttonPressed(int)), this, SLOT(pressKey(int))); - connect(m_ui->rollMapSpinBox, SIGNAL(valueChanged(int)), this->joystick, SLOT(setMappingXAxis(int))); - connect(m_ui->pitchMapSpinBox, SIGNAL(valueChanged(int)), this->joystick, SLOT(setMappingYAxis(int))); - connect(m_ui->yawMapSpinBox, SIGNAL(valueChanged(int)), this->joystick, SLOT(setMappingYawAxis(int))); - connect(m_ui->throttleMapSpinBox, SIGNAL(valueChanged(int)), this->joystick, SLOT(setMappingThrustAxis(int))); - connect(m_ui->autoMapSpinBox, SIGNAL(valueChanged(int)), this->joystick, SLOT(setMappingAutoButton(int))); - - // Display the widget - this->window()->setWindowTitle(tr("Joystick Settings")); - if (joystick) updateStatus(tr("Found joystick: %1").arg(joystick->getName())); + // Center the window on the screen. + QRect position = frameGeometry(); + position.moveCenter(QDesktopWidget().availableGeometry().center()); + move(position.topLeft()); + + // Initialize the UI based on the current joystick + initUI(); + + // Watch for button, axis, and hat input events from the joystick. + connect(this->joystick, SIGNAL(buttonPressed(int)), this, SLOT(joystickButtonPressed(int))); + connect(this->joystick, SIGNAL(buttonReleased(int)), this, SLOT(joystickButtonReleased(int))); + connect(this->joystick, SIGNAL(axisValueChanged(int,float)), this, SLOT(updateAxisValue(int,float))); + connect(this->joystick, SIGNAL(hatDirectionChanged(int,int)), this, SLOT(setHat(int,int))); + + // Also watch for when new settings were loaded for the current joystick to do a mass UI refresh. + connect(this->joystick, SIGNAL(joystickSettingsChanged()), this, SLOT(updateUI())); + + // If the selected joystick is changed, update the JoystickInput. + connect(m_ui->joystickNameComboBox, SIGNAL(currentIndexChanged(int)), this->joystick, SLOT(setActiveJoystick(int))); + // Also wait for the JoystickInput to switch, then update our UI. + connect(this->joystick, SIGNAL(newJoystickSelected()), this, SLOT(createUIForJoystick())); + + // Initialize the UI to the current JoystickInput state. Also make sure to listen for future changes + // so that the UI can be updated. + connect(m_ui->enableCheckBox, SIGNAL(toggled(bool)), m_ui->joystickFrame, SLOT(setEnabled(bool))); + m_ui->enableCheckBox->setChecked(this->joystick->enabled()); // Needs to be after connecting to the joystick frame and before watching for enabled events from JoystickInput. + connect(m_ui->enableCheckBox, SIGNAL(toggled(bool)), this->joystick, SLOT(setEnabled(bool))); + + // Update the button label colors based on the current theme and watch for future theme changes. + styleChanged(MainWindow::instance()->getStyle()); + connect(MainWindow::instance(), SIGNAL(styleChanged(MainWindow::QGC_MAINWINDOW_STYLE)), this, SLOT(styleChanged(MainWindow::QGC_MAINWINDOW_STYLE))); + + // Display the widget above all other windows. + this->raise(); this->show(); } -JoystickWidget::~JoystickWidget() +void JoystickWidget::initUI() { - delete m_ui; + // Add the joysticks to the top combobox. They're indexed by their item number. + // And set the currently-selected combobox item to the current joystick. + int joysticks = joystick->getNumJoysticks(); + if (joysticks) + { + for (int i = 0; i < joysticks; i++) + { + m_ui->joystickNameComboBox->addItem(joystick->getJoystickNameById(i)); + } + m_ui->joystickNameComboBox->setCurrentIndex(joystick->getJoystickID()); + // And if joystick support is enabled, show the UI. + if (m_ui->enableCheckBox->isChecked()) + { + m_ui->joystickFrame->setEnabled(true); + } + + // Create the initial UI. + createUIForJoystick(); + } + // But if there're no joysticks, disable everything and hide empty UI. + else + { + m_ui->enableCheckBox->setEnabled(false); + m_ui->joystickNameComboBox->addItem(tr("No joysticks found. Connect and restart QGC to add one.")); + m_ui->joystickNameComboBox->setEnabled(false); + m_ui->joystickFrame->hide(); + } } -void JoystickWidget::updateJoystick(double roll, double pitch, double yaw, double thrust, int xHat, int yHat) +void JoystickWidget::styleChanged(MainWindow::QGC_MAINWINDOW_STYLE newStyle) { - setX(roll); - setY(pitch); - setZ(yaw); - setThrottle(thrust); - setHat(xHat, yHat); + if (newStyle == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) + { + buttonLabelColor = QColor(0x73, 0xD9, 0x5D); + } + else + { + buttonLabelColor = QColor(0x14, 0xC6, 0x14); + } +} + +JoystickWidget::~JoystickWidget() +{ + delete m_ui; } void JoystickWidget::changeEvent(QEvent *e) @@ -56,98 +109,147 @@ void JoystickWidget::changeEvent(QEvent *e) } } - -void JoystickWidget::setThrottle(float thrust) +void JoystickWidget::updateUI() { - m_ui->thrust->setValue(thrust*100); -} + // Update the actions for all of the buttons + for (int i = 0; i < buttons.size(); i++) + { + JoystickButton* button = buttons[i]; + int action = joystick->getActionForButton(i); + button->setAction(action); + } -void JoystickWidget::setX(float x) -{ - m_ui->xSlider->setValue(x*100); - m_ui->xValue->display(x*100); + // Update the axis mappings + int rollAxis = joystick->getMappingRollAxis(); + int pitchAxis = joystick->getMappingPitchAxis(); + int yawAxis = joystick->getMappingYawAxis(); + int throttleAxis = joystick->getMappingThrottleAxis(); + for (int i = 0; i < axes.size(); i++) + { + JoystickAxis* axis = axes[i]; + JoystickInput::JOYSTICK_INPUT_MAPPING mapping = JoystickInput::JOYSTICK_INPUT_MAPPING_NONE; + if (i == rollAxis) + { + mapping = JoystickInput::JOYSTICK_INPUT_MAPPING_ROLL; + } + else if (i == pitchAxis) + { + mapping = JoystickInput::JOYSTICK_INPUT_MAPPING_PITCH; + } + else if (i == yawAxis) + { + mapping = JoystickInput::JOYSTICK_INPUT_MAPPING_YAW; + } + else if (i == throttleAxis) + { + mapping = JoystickInput::JOYSTICK_INPUT_MAPPING_THROTTLE; + } + axis->setMapping(mapping); + bool inverted = joystick->getInvertedForAxis(i); + axis->setInverted(inverted); + bool limited = joystick->getRangeLimitForAxis(i); + axis->setRangeLimit(limited); + } } -void JoystickWidget::setY(float y) +void JoystickWidget::createUIForJoystick() { - m_ui->ySlider->setValue(y*100); - m_ui->yValue->display(y*100); -} + // Delete all the old UI elements + foreach (JoystickButton* b, buttons) + { + delete b; + } + buttons.clear(); + foreach (JoystickAxis* a, axes) + { + delete a; + } + axes.clear(); + + // And add the necessary button displays for this joystick. + int newButtons = joystick->getJoystickNumButtons(); + if (newButtons) + { + m_ui->buttonBox->show(); + for (int i = 0; i < newButtons; i++) + { + JoystickButton* button = new JoystickButton(i, m_ui->buttonBox); + button->setAction(joystick->getActionForButton(i)); + connect(button, SIGNAL(actionChanged(int,int)), this->joystick, SLOT(setButtonAction(int,int))); + connect(this->joystick, SIGNAL(activeUASSet(UASInterface*)), button, SLOT(setActiveUAS(UASInterface*))); + m_ui->buttonLayout->addWidget(button); + buttons.append(button); + } + } + else + { + m_ui->buttonBox->hide(); + } -void JoystickWidget::setZ(float z) -{ - m_ui->dial->setValue(z*100); + // Do the same for the axes supported by this joystick. + int rollAxis = joystick->getMappingRollAxis(); + int pitchAxis = joystick->getMappingPitchAxis(); + int yawAxis = joystick->getMappingYawAxis(); + int throttleAxis = joystick->getMappingThrottleAxis(); + int newAxes = joystick->getJoystickNumAxes(); + if (newAxes) + { + for (int i = 0; i < newAxes; i++) + { + JoystickAxis* axis = new JoystickAxis(i, m_ui->axesBox); + axis->setValue(joystick->getCurrentValueForAxis(i)); + if (i == rollAxis) + { + axis->setMapping(JoystickInput::JOYSTICK_INPUT_MAPPING_ROLL); + } + else if (i == pitchAxis) + { + axis->setMapping(JoystickInput::JOYSTICK_INPUT_MAPPING_PITCH); + } + else if (i == yawAxis) + { + axis->setMapping(JoystickInput::JOYSTICK_INPUT_MAPPING_YAW); + } + else if (i == throttleAxis) + { + axis->setMapping(JoystickInput::JOYSTICK_INPUT_MAPPING_THROTTLE); + } + axis->setInverted(joystick->getInvertedForAxis(i)); + axis->setRangeLimit(joystick->getRangeLimitForAxis(i)); + connect(axis, SIGNAL(mappingChanged(int,JoystickInput::JOYSTICK_INPUT_MAPPING)), this->joystick, SLOT(setAxisMapping(int,JoystickInput::JOYSTICK_INPUT_MAPPING))); + connect(axis, SIGNAL(inversionChanged(int,bool)), this->joystick, SLOT(setAxisInversion(int,bool))); + connect(axis, SIGNAL(rangeChanged(int,bool)), this->joystick, SLOT(setAxisRangeLimit(int,bool))); + connect(this->joystick, SIGNAL(activeUASSet(UASInterface*)), axis, SLOT(setActiveUAS(UASInterface*))); + m_ui->axesLayout->addWidget(axis); + axes.append(axis); + } + } + else + { + m_ui->axesBox->hide(); + } } -void JoystickWidget::setHat(float x, float y) +void JoystickWidget::updateAxisValue(int axis, float value) { - updateStatus(tr("Hat position: x: %1, y: %2").arg(x).arg(y)); + if (axis < axes.size()) + { + axes.at(axis)->setValue(value); + } } -void JoystickWidget::clearKeys() +void JoystickWidget::setHat(int x, int y) { - QString colorstyle; - QColor buttonStyleColor = QColor(200, 20, 20); - colorstyle = QString("QLabel { border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: %1;}").arg(buttonStyleColor.name()); - - m_ui->button0->setStyleSheet(colorstyle); - m_ui->button1->setStyleSheet(colorstyle); - m_ui->button2->setStyleSheet(colorstyle); - m_ui->button3->setStyleSheet(colorstyle); - m_ui->button4->setStyleSheet(colorstyle); - m_ui->button5->setStyleSheet(colorstyle); - m_ui->button6->setStyleSheet(colorstyle); - m_ui->button7->setStyleSheet(colorstyle); - m_ui->button8->setStyleSheet(colorstyle); - m_ui->button9->setStyleSheet(colorstyle); - m_ui->button10->setStyleSheet(colorstyle); + m_ui->statusLabel->setText(tr("Hat position: x: %1, y: %2").arg(x).arg(y)); } -void JoystickWidget::pressKey(int key) +void JoystickWidget::joystickButtonPressed(int key) { - QString colorstyle; - QColor buttonStyleColor = QColor(20, 200, 20); - colorstyle = QString("QLabel { border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: %1;}").arg(buttonStyleColor.name()); - switch(key) { - case 0: - m_ui->button0->setStyleSheet(colorstyle); - break; - case 1: - m_ui->button1->setStyleSheet(colorstyle); - break; - case 2: - m_ui->button2->setStyleSheet(colorstyle); - break; - case 3: - m_ui->button3->setStyleSheet(colorstyle); - break; - case 4: - m_ui->button4->setStyleSheet(colorstyle); - break; - case 5: - m_ui->button5->setStyleSheet(colorstyle); - break; - case 6: - m_ui->button6->setStyleSheet(colorstyle); - break; - case 7: - m_ui->button7->setStyleSheet(colorstyle); - break; - case 8: - m_ui->button8->setStyleSheet(colorstyle); - break; - case 9: - m_ui->button9->setStyleSheet(colorstyle); - break; - case 10: - m_ui->button10->setStyleSheet(colorstyle); - break; - } - QTimer::singleShot(20, this, SLOT(clearKeys())); - updateStatus(tr("Key %1 pressed").arg(key)); + QString colorStyle = QString("QLabel { background-color: %1;}").arg(buttonLabelColor.name()); + buttons.at(key)->setStyleSheet(colorStyle); } -void JoystickWidget::updateStatus(const QString& status) +void JoystickWidget::joystickButtonReleased(int key) { - m_ui->statusLabel->setText(status); + buttons.at(key)->setStyleSheet(""); } diff --git a/src/ui/JoystickWidget.h b/src/ui/JoystickWidget.h index b6c47c628efaf509212a46669706642ed9a8fc85..c1eb1d51a88f9b5ac4937e0bc571c06fabc27bc5 100644 --- a/src/ui/JoystickWidget.h +++ b/src/ui/JoystickWidget.h @@ -23,7 +23,7 @@ This file is part of the PIXHAWK project /** * @file - * @brief Definition of joystick widget + * @brief Definition of joystick widget. Provides a UI for configuring the joystick settings. * @author Lorenz Meier * */ @@ -32,7 +32,12 @@ This file is part of the PIXHAWK project #define JOYSTICKWIDGET_H #include +#include +#include #include "JoystickInput.h" +#include "MainWindow.h" +#include "JoystickAxis.h" +#include "JoystickButton.h" namespace Ui { @@ -48,41 +53,45 @@ public: virtual ~JoystickWidget(); public slots: + /** @brief Update the UI for a new joystick based on SDL ID. */ + void createUIForJoystick(); /** - * @brief Receive raw joystick values - * - * @param roll forward / pitch / x axis, front: 32'767, center: 0, back: -32'768 - * @param pitch left / roll / y axis, left: -32'768, middle: 0, right: 32'767 - * @param yaw turn axis, left-turn: -32'768, centered: 0, right-turn: 32'767 - * @param thrust Thrust, 0%: 0, 100%: 65535 - * @param xHat hat vector in forward-backward direction, +1 forward, 0 center, -1 backward - * @param yHat hat vector in left-right direction, -1 left, 0 center, +1 right + * @brief Update a given axis with a new value + * @param axis The index of the axis to update. + * @param value The new value for the axis, [-1.0:1.0]. + * @see JoystickInput:axisValueChanged */ - void updateJoystick(double roll, double pitch, double yaw, double thrust, int xHat, int yHat); - /** @brief Throttle lever */ - void setThrottle(float thrust); - /** @brief Back/forth movement */ - void setX(float x); - /** @brief Left/right movement */ - void setY(float y); - /** @brief Wrist rotation */ - void setZ(float z); - /** @brief Hat switch position */ - void setHat(float x, float y); - /** @brief Clear keys */ - void clearKeys(); - /** @brief Joystick keys, as labeled on the joystick */ - void pressKey(int key); - /** @brief Update status string */ - void updateStatus(const QString& status); + void updateAxisValue(int axis, float value); + /** @brief Update the UI with new values for the hat. + * @see JoystickInput::hatDirectionChanged + */ + void setHat(int x, int y); + /** @brief Trigger a UI change based on a button being pressed */ + void joystickButtonPressed(int key); + /** @brief Trigger a UI change based on a button being released */ + void joystickButtonReleased(int key); + /** @brief Update the UI color scheme when the MainWindow theme changes. */ + void styleChanged(MainWindow::QGC_MAINWINDOW_STYLE); + /** Update the UI assuming the joystick has stayed the same. */ + void updateUI(); protected: /** @brief UI change event */ virtual void changeEvent(QEvent *e); JoystickInput* joystick; ///< Reference to the joystick + /** @brief a list of all button labels generated for this joystick. */ + QList buttons; + /** @brief a lit of all joystick axes generated for this joystick. */ + QList axes; + /** @brief The color to use for button labels when their corresponding button is pressed */ + QColor buttonLabelColor; private: Ui::JoystickWidget *m_ui; + /** @brief Initialize all dynamic UI elements (button list, joystick names, etc.). + * Only done once at startup. + */ + void initUI(); }; #endif // JOYSTICKWIDGET_H diff --git a/src/ui/JoystickWidget.ui b/src/ui/JoystickWidget.ui index 5c426fc3bc86ee9a0ce3e4844274c5a53137eb6a..f33134eb650d3b93031162cec4b22b819a9a1981 100644 --- a/src/ui/JoystickWidget.ui +++ b/src/ui/JoystickWidget.ui @@ -6,10 +6,16 @@ 0 0 - 497 - 448 + 368 + 274 + + + 0 + 0 + + 368 @@ -17,559 +23,198 @@ - Dialog + Joystick Settings - - + + 8 - + + QLayout::SetFixedSize + + 8 - - - - - 0 - 0 - - - - - 40 - 400 - - - - Buttons - - - Qt::AlignCenter + + 8 + + + 8 + + + 8 + + + + + true - - false + + Enable joysticks - - - 1 - - - 3 - - - - - true - - - - 0 - 0 - - - - 0 - - - Qt::AlignCenter - - - - - - - true - - - - 0 - 0 - - - - 1 - - - Qt::AlignCenter - - - - - - - true - - - - 0 - 0 - - - - 2 - - - Qt::AlignCenter - - - - - - - true - - - - 0 - 0 - - - - 3 - - - Qt::AlignCenter - - - - - - - true - - - - 0 - 0 - - - - 4 - - - Qt::AlignCenter - - - - - - - true - - - - 0 - 0 - - - - 5 - - - Qt::AlignCenter - - - - - - - true - - - - 0 - 0 - - - - 6 - - - Qt::AlignCenter - - - - - - - true - - - - 0 - 0 - - - - 7 - - - Qt::AlignCenter - - - - - - - true - - - - 0 - 0 - - - - 8 - - - Qt::AlignCenter - - - - - - - true - - - - 0 - 0 - - - - 9 - - - Qt::AlignCenter - - - - - - - true - - - - 0 - 0 - - - - 10 - - - Qt::AlignCenter - - - - - - - - Mappings + + + + true - - Qt::AlignCenter + + + 0 + 0 + - - - - - Throttle - - - - - - - Stabilized Button - - - - - - - Auto Button - - - - - - - Manual Button - - - - - - - Pitch Axis - - - - - - - Yaw Axis - - - - - - - Roll Axis - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Stick + + + + false + + + QFrame::StyledPanel - - Qt::AlignCenter + + QFrame::Sunken - - - 6 + + + QLayout::SetMinimumSize - - - - - 0 - 0 - - - - - 40 - 24 - - - - QFrame::Plain - - - true - - - 3 - - - QLCDNumber::Flat - - - - - - - false - - - -100 - - - 100 - - - Qt::Vertical - - - - - - - true - - - - 40 - 24 - - - - QFrame::Plain - - - true - - - 3 - - - QLCDNumber::Flat - - - - - - - false - - - -100 - - - 100 - - - - - - - Y - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - false - - - -100 - - - 100 - - - Qt::Horizontal - - + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 16777215 + 16777215 + + + + Buttons + + + Qt::AlignCenter + + + false + + + + 1 + + + QLayout::SetMinimumSize + + + 3 + + + 3 + + + 3 + + + 3 + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + Axes + + + Qt::AlignCenter + + + + QLayout::SetMinimumSize + + + + + - - + + - X + - - + + + + + 0 + 0 + + + + + 50 + 0 + + - 60 + 16777215 16777215 - - Throttle + + Qt::Horizontal + + + QDialogButtonBox::Ok - - - 0 - - - 2 - - - - - true - - - - 40 - 20 - - - - 0 - - - Qt::Vertical - - - - - - - - - - 1 - - - No joystick detected yet.. waiting - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - buttonBox + dialogButtonsBox accepted() JoystickWidget accept() - 248 - 254 + 263 + 438 157 @@ -577,21 +222,5 @@ - - buttonBox - rejected() - JoystickWidget - reject() - - - 316 - 260 - - - 286 - 274 - - - diff --git a/src/ui/MAVLinkDecoder.cc b/src/ui/MAVLinkDecoder.cc index b93fa9af5a8848e9195d8793a7c3dc1a51d720d0..549da8fba19b6c8fca8ffacfc130cf6bb8097527 100644 --- a/src/ui/MAVLinkDecoder.cc +++ b/src/ui/MAVLinkDecoder.cc @@ -17,8 +17,9 @@ MAVLinkDecoder::MAVLinkDecoder(MAVLinkProtocol* protocol, QObject *parent) : } // Fill filter - messageFilter.insert(MAVLINK_MSG_ID_HEARTBEAT, false); - messageFilter.insert(MAVLINK_MSG_ID_SYS_STATUS, false); + // Allow system status +// messageFilter.insert(MAVLINK_MSG_ID_HEARTBEAT, false); +// messageFilter.insert(MAVLINK_MSG_ID_SYS_STATUS, false); messageFilter.insert(MAVLINK_MSG_ID_STATUSTEXT, false); messageFilter.insert(MAVLINK_MSG_ID_COMMAND_LONG, false); messageFilter.insert(MAVLINK_MSG_ID_COMMAND_ACK, false); @@ -200,7 +201,7 @@ void MAVLinkDecoder::emitFieldValue(mavlink_message_t* msg, int fieldid, quint64 // Add field tree widget item uint8_t msgid = msg->msgid; - //if (messageFilter.contains(msgid)) return; + if (messageFilter.contains(msgid)) return; QString fieldName(messageInfo[msgid].fields[fieldid].name); QString fieldType; uint8_t* m = ((uint8_t*)(receivedMessages+msgid))+8; diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index 7184ebfc4df7c23b47bf7a1ebbad7c1724934aaf..e695f0bbb9590ad42e0b2a3a4d74f7d3a55ea523 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -59,6 +59,8 @@ This file is part of the QGROUNDCONTROL project #include "QGCFirmwareUpdate.h" #include "QGCStatusBar.h" #include "UASQuickView.h" +#include "QGCDataPlot2D.h" +#include "Linecharts.h" #include "UASActionsWidget.h" #include "QGCTabbedInfoView.h" #include "UASRawStatusView.h" @@ -72,20 +74,24 @@ This file is part of the QGROUNDCONTROL project #include "PxQuadMAV.h" #include "SlugsMAV.h" - #include "LogCompressor.h" +// Set up some constants +const QString MainWindow::defaultDarkStyle = ":files/styles/style-dark.css"; +const QString MainWindow::defaultLightStyle = ":files/styles/style-light.css"; + MainWindow* MainWindow::instance(QSplashScreen* screen) { static MainWindow* _instance = 0; - if(_instance == 0) + if (_instance == 0) { _instance = new MainWindow(); - if (screen) connect(_instance, SIGNAL(initStatusChanged(QString)), screen, SLOT(showMessage(QString))); - - /* Set the application as parent to ensure that this object - * will be destroyed when the main application exits */ - //_instance->setParent(qApp); + if (screen) + { + connect(_instance, SIGNAL(initStatusChanged(QString,int,QColor)), + screen, SLOT(showMessage(QString,int,QColor))); + } + _instance->init(); } return _instance; } @@ -100,23 +106,36 @@ MainWindow* MainWindow::instance(QSplashScreen* screen) MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), currentView(VIEW_FLIGHT), - currentStyle(QGC_MAINWINDOW_STYLE_INDOOR), + currentStyle(QGC_MAINWINDOW_STYLE_DARK), aboutToCloseFlag(false), changingViewsFlag(false), centerStackActionGroup(new QActionGroup(this)), - styleFileName(QCoreApplication::applicationDirPath() + "/style-indoor.css"), + darkStyleFileName(defaultDarkStyle), + lightStyleFileName(defaultLightStyle), autoReconnect(false), - lowPowerMode(false) + lowPowerMode(false), + isAdvancedMode(false), + dockWidgetTitleBarEnabled(true) { this->setAttribute(Qt::WA_DeleteOnClose); hide(); - dockWidgetTitleBarEnabled = true; - isAdvancedMode = false; - emit initStatusChanged("Loading UI Settings.."); +} + +void MainWindow::init() +{ + emit initStatusChanged(tr("Loading settings"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); loadSettings(); - emit initStatusChanged("Loading Style."); - loadStyle(currentStyle); + emit initStatusChanged(tr("Loading style"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); + qApp->setStyle("plastique"); + if (currentStyle == QGC_MAINWINDOW_STYLE_LIGHT) + { + loadStyle(currentStyle, lightStyleFileName); + } + else + { + loadStyle(currentStyle, darkStyleFileName); + } if (settings.contains("ADVANCED_MODE")) { @@ -142,8 +161,7 @@ MainWindow::MainWindow(QWidget *parent): } settings.sync(); - - emit initStatusChanged("Setting up user interface."); + emit initStatusChanged(tr("Setting up user interface"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); // Setup user interface ui.setupUi(this); @@ -187,20 +205,18 @@ MainWindow::MainWindow(QWidget *parent): setStatusBar(customStatusBar); statusBar()->setSizeGripEnabled(true); - - - emit initStatusChanged("Building common widgets."); + emit initStatusChanged(tr("Building common widgets"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); buildCommonWidgets(); connectCommonWidgets(); - emit initStatusChanged("Building common actions."); + emit initStatusChanged(tr("Building common actions"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); // Create actions connectCommonActions(); // Populate link menu - emit initStatusChanged("Populating link menu"); + emit initStatusChanged(tr("Populating link menu"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); QList links = LinkManager::instance()->getLinks(); foreach(LinkInterface* link, links) { @@ -210,19 +226,19 @@ MainWindow::MainWindow(QWidget *parent): connect(LinkManager::instance(), SIGNAL(newLink(LinkInterface*)), this, SLOT(addLink(LinkInterface*))); // Connect user interface devices - emit initStatusChanged("Initializing joystick interface."); + emit initStatusChanged(tr("Initializing joystick interface"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); joystickWidget = 0; joystick = new JoystickInput(); #ifdef MOUSE_ENABLED_WIN - emit initStatusChanged("Initializing 3D mouse interface."); + emit initStatusChanged(tr("Initializing 3D mouse interface"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); mouseInput = new Mouse3DInput(this); mouse = new Mouse6dofInput(mouseInput); #endif //MOUSE_ENABLED_WIN #if MOUSE_ENABLED_LINUX - emit initStatusChanged("Initializing 3D mouse interface."); + emit initStatusChanged(tr("Initializing 3D mouse interface"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); mouse = new Mouse6dofInput(this); connect(this, SIGNAL(x11EventOccured(XEvent*)), mouse, SLOT(handleX11Event(XEvent*))); @@ -244,12 +260,12 @@ MainWindow::MainWindow(QWidget *parent): // Initialize window state windowStateVal = windowState(); - emit initStatusChanged("Restoring last view state."); + emit initStatusChanged(tr("Restoring last view state"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); // Restore the window setup loadViewState(); - emit initStatusChanged("Restoring last window size."); + emit initStatusChanged(tr("Restoring last window size"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); // Restore the window position and size if (settings.contains(getWindowGeometryKey())) { @@ -278,7 +294,7 @@ MainWindow::MainWindow(QWidget *parent): connect(&windowNameUpdateTimer, SIGNAL(timeout()), this, SLOT(configureWindowName())); windowNameUpdateTimer.start(15000); - emit initStatusChanged("Done."); + emit initStatusChanged(tr("Done"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); show(); } @@ -466,11 +482,7 @@ void MainWindow::buildCommonWidgets() { pilotView = new SubMainWindow(this); pilotView->setObjectName("VIEW_FLIGHT"); - //pilotView->setCentralWidget(new HUD(320,240,this)); pilotView->setCentralWidget(new QGCMapTool(this)); - //hudWidget = new HUD(320, 240, this); - //addCentralWidget(hudWidget, tr("Head Up Display")); - //mapWidget = new QGCMapTool(this); addCentralWidget(pilotView, "Pilot"); } if (!configView) @@ -550,27 +562,6 @@ void MainWindow::buildCommonWidgets() } createDockWidget(simView,new HSIDisplay(this),tr("Horizontal Situation"),"HORIZONTAL_SITUATION_INDICATOR_DOCKWIDGET",VIEW_SIMULATION,Qt::BottomDockWidgetArea); - - - //FIXME: memory of acceptList will never be freed again - QStringList* acceptList = new QStringList(); - acceptList->append("-3.3,ATTITUDE.roll,rad,+3.3,s"); - acceptList->append("-3.3,ATTITUDE.pitch,deg,+3.3,s"); - acceptList->append("-3.3,ATTITUDE.yaw,deg,+3.3,s"); - - //FIXME: memory of acceptList2 will never be freed again - QStringList* acceptList2 = new QStringList(); - acceptList2->append("0,RAW_PRESSURE.pres_abs,hPa,65500"); - - - //HDDisplay* hdDisplay = new HDDisplay(acceptList, "Flight Display", this); - //hdDisplay->addSource(mavlinkDecoder); - //createDockWidget(pilotView,hdDisplay,tr("Flight Display"),"HEAD_DOWN_DISPLAY_1_DOCKWIDGET",VIEW_FLIGHT,Qt::RightDockWidgetArea); - - //HDDisplay* hdDisplay2 = new HDDisplay(acceptList2, "Actuator Status", this); - //hdDisplay2->addSource(mavlinkDecoder); - //createDockWidget(pilotView,hdDisplay2,tr("Actuator Status"),"HEAD_DOWN_DISPLAY_2_DOCKWIDGET",VIEW_FLIGHT,Qt::RightDockWidgetArea); - { QAction* tempAction = ui.menuTools->addAction(tr("Flight Display")); tempAction->setCheckable(true); @@ -591,18 +582,9 @@ void MainWindow::buildCommonWidgets() connect(tempAction,SIGNAL(triggered(bool)),this, SLOT(showTool(bool))); } - // createDockWidget(simView,new HUD(320,240,this),tr("Head Up Display"),"HEAD_UP_DISPLAY_DOCKWIDGET",VIEW_SIMULATION,Qt::RightDockWidgetArea,this->width()/1.5); + createDockWidget(engineeringView,new HUD(320,240,this),tr("Video Downlink"),"HEAD_UP_DISPLAY_DOCKWIDGET",VIEW_ENGINEER,Qt::RightDockWidgetArea,this->width()/1.5); createDockWidget(simView,new PrimaryFlightDisplay(320,240,this),tr("Primary Flight Display"),"PRIMARY_FLIGHT_DISPLAY_DOCKWIDGET",VIEW_SIMULATION,Qt::RightDockWidgetArea,this->width()/1.5); - //createDockWidget(pilotView,new UASListWidget(this),tr("Unmanned Systems"),"UNMANNED_SYSTEM_LIST_DOCKWIDGET",VIEW_FLIGHT,Qt::RightDockWidgetArea); -// createDockWidget(pilotView,new HUD(320,240,this),tr("Head Up Display"),"HEAD_UP_DISPLAY_DOCKWIDGET",VIEW_FLIGHT,Qt::LeftDockWidgetArea,this->width()/1.8); - //createDockWidget(pilotView,new UASQuickView(this),tr("Quick View"),"UAS_INFO_QUICKVIEW_DOCKWIDGET",VIEW_FLIGHT,Qt::LeftDockWidgetArea); - - //UASQuickView *quickview = new UASQuickView(this); - //quickview->addSource(mavlinkDecoder); - - - //createDockWidget(pilotView,quickview,tr("Quick View"),"UAS_INFO_QUICKVIEW_DOCKWIDGET",VIEW_FLIGHT,Qt::LeftDockWidgetArea); createDockWidget(pilotView,new PrimaryFlightDisplay(320,240,this),tr("Primary Flight Display"),"PRIMARY_FLIGHT_DISPLAY_DOCKWIDGET",VIEW_FLIGHT,Qt::LeftDockWidgetArea,this->width()/1.8); QGCTabbedInfoView *infoview = new QGCTabbedInfoView(this); @@ -673,7 +655,7 @@ void MainWindow::buildCommonWidgets() } #endif -#if (defined _MSC_VER) | (defined Q_OS_MAC) +#if (defined _MSC_VER) /*| (defined Q_OS_MAC) mac os doesn't support gearth right now */ if (!gEarthWidget) { gEarthWidget = new QGCGoogleEarthView(this); @@ -728,35 +710,10 @@ void MainWindow::addTool(SubMainWindow *parent,VIEW_SECTIONS view,QDockWidget* w QDockWidget* MainWindow::createDockWidget(QWidget *parent,QWidget *child,QString title,QString objectname,VIEW_SECTIONS view,Qt::DockWidgetArea area,int minwidth,int minheight) { - //if (child->objectName() == "") - //{ child->setObjectName(objectname); - //} QDockWidget *widget = new QDockWidget(title,this); - if (!isAdvancedMode) - { - if (dockWidgetTitleBarEnabled) - { - dockToTitleBarMap[widget] = widget->titleBarWidget(); - QLabel *label = new QLabel(this); - label->setText(title); - widget->setTitleBarWidget(label); - label->installEventFilter(new DockWidgetTitleBarEventFilter()); - } - else - { - dockToTitleBarMap[widget] = widget->titleBarWidget(); - widget->setTitleBarWidget(new QWidget(this)); - } - } - else - { - QLabel *label = new QLabel(this); - label->setText(title); - dockToTitleBarMap[widget] = label; - label->installEventFilter(new DockWidgetTitleBarEventFilter()); - label->hide(); - } + dockWidgets.append(widget); + setDockWidgetTitleBar(widget); widget->setObjectName(child->objectName()); widget->setWidget(child); if (minheight != 0 || minwidth != 0) @@ -861,6 +818,38 @@ void MainWindow::loadDockWidget(QString name) } } +void MainWindow::setDockWidgetTitleBar(QDockWidget* widget) +{ + QWidget* oldTitleBar = widget->titleBarWidget(); + + // In advanced mode, we use the default titlebar provided by Qt. + if (isAdvancedMode) + { + widget->setTitleBarWidget(0); + } + // Otherwise, if just a textlabel should be shown, make that the titlebar. + else if (dockWidgetTitleBarEnabled) + { + QLabel* label = new QLabel(this); + label->setText(widget->windowTitle()); + label->installEventFilter(new DockWidgetTitleBarEventFilter()); + widget->setTitleBarWidget(label); + } + // And if nothing should be shown, use an empty widget. + else + { + QWidget* newTitleBar = new QWidget(this); + widget->setTitleBarWidget(newTitleBar); + } + + // Be sure to clean up the old titlebar. When using QDockWidget::setTitleBarWidget(), + // it doesn't delete the old titlebar object. + if (oldTitleBar) + { + delete oldTitleBar; + } +} + void MainWindow::showTool(bool show) { //Called when a menu item is clicked on, regardless of view. @@ -904,6 +893,7 @@ void MainWindow::showTool(bool show) }*/ void MainWindow::addCentralWidget(QWidget* widget, const QString& title) { + Q_UNUSED(title); // Check if this widget already has been added if (centerStack->indexOf(widget) == -1) { @@ -1152,6 +1142,8 @@ void MainWindow::loadSettings() settings.beginGroup("QGC_MAINWINDOW"); autoReconnect = settings.value("AUTO_RECONNECT", autoReconnect).toBool(); currentStyle = (QGC_MAINWINDOW_STYLE)settings.value("CURRENT_STYLE", currentStyle).toInt(); + darkStyleFileName = settings.value("DARK_STYLE_FILENAME", darkStyleFileName).toString(); + lightStyleFileName = settings.value("LIGHT_STYLE_FILENAME", lightStyleFileName).toString(); lowPowerMode = settings.value("LOW_POWER_MODE", lowPowerMode).toBool(); dockWidgetTitleBarEnabled = settings.value("DOCK_WIDGET_TITLEBARS",dockWidgetTitleBarEnabled).toBool(); settings.endGroup(); @@ -1164,6 +1156,8 @@ void MainWindow::storeSettings() settings.beginGroup("QGC_MAINWINDOW"); settings.setValue("AUTO_RECONNECT", autoReconnect); settings.setValue("CURRENT_STYLE", currentStyle); + settings.setValue("DARK_STYLE_FILENAME", darkStyleFileName); + settings.setValue("LIGHT_STYLE_FILENAME", lightStyleFileName); settings.endGroup(); if (!aboutToCloseFlag && isVisible()) { @@ -1250,26 +1244,10 @@ void MainWindow::enableDockWidgetTitleBars(bool enabled) settings.setValue("DOCK_WIDGET_TITLEBARS",dockWidgetTitleBarEnabled); settings.endGroup(); settings.sync(); - if (!isAdvancedMode) + + for (int i = 0; i < dockWidgets.size(); i++) { - if (enabled) - { - for (QMap::const_iterator i=dockToTitleBarMap.constBegin();i!=dockToTitleBarMap.constEnd();i++) - { - QLabel *label = new QLabel(this); - label->setText(i.key()->windowTitle()); - i.key()->setTitleBarWidget(label); - //label->setEnabled(false); - label->installEventFilter(new DockWidgetTitleBarEventFilter()); - } - } - else - { - for (QMap::const_iterator i=dockToTitleBarMap.constBegin();i!=dockToTitleBarMap.constEnd();i++) - { - i.key()->setTitleBarWidget(new QWidget(this)); - } - } + setDockWidgetTitleBar(dockWidgets[i]); } } @@ -1278,95 +1256,43 @@ void MainWindow::enableAutoReconnect(bool enabled) autoReconnect = enabled; } -void MainWindow::loadNativeStyle() +bool MainWindow::loadStyle(QGC_MAINWINDOW_STYLE style, QString cssFile) { - loadStyle(QGC_MAINWINDOW_STYLE_NATIVE); -} + // Store the new style classification. + currentStyle = style; -void MainWindow::loadIndoorStyle() -{ - loadStyle(QGC_MAINWINDOW_STYLE_INDOOR); -} + // Load the new stylesheet. + QFile styleSheet(cssFile); -void MainWindow::loadOutdoorStyle() -{ - loadStyle(QGC_MAINWINDOW_STYLE_OUTDOOR); -} + // Attempt to open the stylesheet. + if (styleSheet.open(QIODevice::ReadOnly | QIODevice::Text)) + { + // Signal to the user that the app will pause to apply a new stylesheet + qApp->setOverrideCursor(Qt::WaitCursor); + + qApp->setStyleSheet(styleSheet.readAll()); -void MainWindow::loadStyle(QGC_MAINWINDOW_STYLE style) -{ - switch (style) { - case QGC_MAINWINDOW_STYLE_NATIVE: { - // Native mode means setting no style - // so if we were already in native mode - // take no action - // Only if a style was set, remove it. - if (style != currentStyle) { - qApp->setStyleSheet(""); - showInfoMessage(tr("Please restart QGroundControl"), tr("Please restart QGroundControl to switch to fully native look and feel. Currently you have loaded Qt's plastique style.")); + // And save the new stylesheet path. + if (currentStyle == QGC_MAINWINDOW_STYLE_LIGHT) + { + lightStyleFileName = cssFile; + } + else + { + darkStyleFileName = cssFile; } - } - break; - case QGC_MAINWINDOW_STYLE_INDOOR: - qApp->setStyle("plastique"); - styleFileName = ":files/styles/style-indoor.css"; - reloadStylesheet(); - break; - case QGC_MAINWINDOW_STYLE_OUTDOOR: - qApp->setStyle("plastique"); - styleFileName = ":files/styles/style-outdoor.css"; - reloadStylesheet(); - break; - } - currentStyle = style; -} -void MainWindow::selectStylesheet() -{ - // Let user select style sheet - styleFileName = QFileDialog::getOpenFileName(this, tr("Specify stylesheet"), styleFileName, tr("CSS Stylesheet (*.css);;")); + // And trigger any changes to other UI elements that are watching for + // theme changes. + emit styleChanged(style); - if (!styleFileName.endsWith(".css")) - { - QMessageBox msgBox; - msgBox.setIcon(QMessageBox::Information); - msgBox.setText(tr("QGroundControl did lot load a new style")); - msgBox.setInformativeText(tr("No suitable .css file selected. Please select a valid .css file.")); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - msgBox.exec(); - return; + // Finally restore the cursor before returning. + qApp->restoreOverrideCursor(); + return true; } - // Load style sheet - reloadStylesheet(); -} - -void MainWindow::reloadStylesheet() -{ - // Load style sheet - QFile* styleSheet = new QFile(styleFileName); - if (!styleSheet->exists()) - { - styleSheet = new QFile(":files/styles/style-indoor.css"); - } - if (styleSheet->open(QIODevice::ReadOnly | QIODevice::Text)) - { - QString style = QString(styleSheet->readAll()); - style.replace("ICONDIR", QCoreApplication::applicationDirPath()+ "files/styles/"); - qApp->setStyleSheet(style); - } - else - { - QMessageBox msgBox; - msgBox.setIcon(QMessageBox::Information); - msgBox.setText(tr("QGroundControl did lot load a new style")); - msgBox.setInformativeText(tr("Stylesheet file %1 was not readable").arg(styleFileName)); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - msgBox.exec(); - } - delete styleSheet; + // Otherwise alert return a failure code. + return false; } /** @@ -1482,6 +1408,7 @@ void MainWindow::connectCommonActions() // Connect actions from ui connect(ui.actionAdd_Link, SIGNAL(triggered()), this, SLOT(addLink())); + ui.actionAdvanced_Mode->setChecked(isAdvancedMode); connect(ui.actionAdvanced_Mode,SIGNAL(triggered()),this,SLOT(setAdvancedMode())); // Connect internal actions @@ -1507,9 +1434,6 @@ void MainWindow::connectCommonActions() connect(ui.actionFirmwareUpdateView, SIGNAL(triggered()), this, SLOT(loadFirmwareUpdateView())); connect(ui.actionMavlinkView, SIGNAL(triggered()), this, SLOT(loadMAVLinkView())); - connect(ui.actionReloadStylesheet, SIGNAL(triggered()), this, SLOT(reloadStylesheet())); - connect(ui.actionSelectStylesheet, SIGNAL(triggered()), this, SLOT(selectStylesheet())); - // Help Actions connect(ui.actionOnline_Documentation, SIGNAL(triggered()), this, SLOT(showHelp())); connect(ui.actionDeveloper_Credits, SIGNAL(triggered()), this, SLOT(showCredits())); @@ -1588,7 +1512,7 @@ void MainWindow::configure() { joystick->start(); } - joystickWidget = new JoystickWidget(joystick); + joystickWidget = new JoystickWidget(joystick, this); } joystickWidget->show(); } @@ -1678,6 +1602,7 @@ void MainWindow::commsWidgetDestroyed(QObject *obj) void MainWindow::setActiveUAS(UASInterface* uas) { + Q_UNUSED(uas); // Enable and rename menu // ui.menuUnmanned_System->setTitle(uas->getUASName()); // if (!ui.menuUnmanned_System->isEnabled()) ui.menuUnmanned_System->setEnabled(true); @@ -1721,84 +1646,83 @@ void MainWindow::UASCreated(UASInterface* uas) //{ // The pilot, operator and engineer views were not available on startup, enable them now ui.actionFlightView->setEnabled(true); - ui.actionMissionView->setEnabled(true); - ui.actionEngineersView->setEnabled(true); - // The UAS actions are not enabled without connection to system - ui.actionLiftoff->setEnabled(true); - ui.actionLand->setEnabled(true); - ui.actionEmergency_Kill->setEnabled(true); - ui.actionEmergency_Land->setEnabled(true); - ui.actionShutdownMAV->setEnabled(true); - - QIcon icon; - // Set matching icon - switch (uas->getSystemType()) - { - case MAV_TYPE_GENERIC: - icon = QIcon(":files/images/mavs/generic.svg"); - break; - case MAV_TYPE_FIXED_WING: - icon = QIcon(":files/images/mavs/fixed-wing.svg"); - break; - case MAV_TYPE_QUADROTOR: - icon = QIcon(":files/images/mavs/quadrotor.svg"); - break; - case MAV_TYPE_COAXIAL: - icon = QIcon(":files/images/mavs/coaxial.svg"); - break; - case MAV_TYPE_HELICOPTER: - icon = QIcon(":files/images/mavs/helicopter.svg"); - break; - case MAV_TYPE_ANTENNA_TRACKER: - icon = QIcon(":files/images/mavs/antenna-tracker.svg"); - break; - case MAV_TYPE_GCS: - icon = QIcon(":files/images/mavs/groundstation.svg"); - break; - case MAV_TYPE_AIRSHIP: - icon = QIcon(":files/images/mavs/airship.svg"); - break; - case MAV_TYPE_FREE_BALLOON: - icon = QIcon(":files/images/mavs/free-balloon.svg"); - break; - case MAV_TYPE_ROCKET: - icon = QIcon(":files/images/mavs/rocket.svg"); - break; - case MAV_TYPE_GROUND_ROVER: - icon = QIcon(":files/images/mavs/ground-rover.svg"); - break; - case MAV_TYPE_SURFACE_BOAT: - icon = QIcon(":files/images/mavs/surface-boat.svg"); - break; - case MAV_TYPE_SUBMARINE: - icon = QIcon(":files/images/mavs/submarine.svg"); - break; - case MAV_TYPE_HEXAROTOR: - icon = QIcon(":files/images/mavs/hexarotor.svg"); - break; - case MAV_TYPE_OCTOROTOR: - icon = QIcon(":files/images/mavs/octorotor.svg"); - break; - case MAV_TYPE_TRICOPTER: - icon = QIcon(":files/images/mavs/tricopter.svg"); - break; - case MAV_TYPE_FLAPPING_WING: - icon = QIcon(":files/images/mavs/flapping-wing.svg"); - break; - case MAV_TYPE_KITE: - icon = QIcon(":files/images/mavs/kite.svg"); - break; - default: - icon = QIcon(":files/images/mavs/unknown.svg"); - break; - } + ui.actionMissionView->setEnabled(true); + ui.actionEngineersView->setEnabled(true); + // The UAS actions are not enabled without connection to system + ui.actionLiftoff->setEnabled(true); + ui.actionLand->setEnabled(true); + ui.actionEmergency_Kill->setEnabled(true); + ui.actionEmergency_Land->setEnabled(true); + ui.actionShutdownMAV->setEnabled(true); + + QIcon icon; + // Set matching icon + switch (uas->getSystemType()) + { + case MAV_TYPE_GENERIC: + icon = QIcon(":files/images/mavs/generic.svg"); + break; + case MAV_TYPE_FIXED_WING: + icon = QIcon(":files/images/mavs/fixed-wing.svg"); + break; + case MAV_TYPE_QUADROTOR: + icon = QIcon(":files/images/mavs/quadrotor.svg"); + break; + case MAV_TYPE_COAXIAL: + icon = QIcon(":files/images/mavs/coaxial.svg"); + break; + case MAV_TYPE_HELICOPTER: + icon = QIcon(":files/images/mavs/helicopter.svg"); + break; + case MAV_TYPE_ANTENNA_TRACKER: + icon = QIcon(":files/images/mavs/antenna-tracker.svg"); + break; + case MAV_TYPE_GCS: + icon = QIcon(":files/images/mavs/groundstation.svg"); + break; + case MAV_TYPE_AIRSHIP: + icon = QIcon(":files/images/mavs/airship.svg"); + break; + case MAV_TYPE_FREE_BALLOON: + icon = QIcon(":files/images/mavs/free-balloon.svg"); + break; + case MAV_TYPE_ROCKET: + icon = QIcon(":files/images/mavs/rocket.svg"); + break; + case MAV_TYPE_GROUND_ROVER: + icon = QIcon(":files/images/mavs/ground-rover.svg"); + break; + case MAV_TYPE_SURFACE_BOAT: + icon = QIcon(":files/images/mavs/surface-boat.svg"); + break; + case MAV_TYPE_SUBMARINE: + icon = QIcon(":files/images/mavs/submarine.svg"); + break; + case MAV_TYPE_HEXAROTOR: + icon = QIcon(":files/images/mavs/hexarotor.svg"); + break; + case MAV_TYPE_OCTOROTOR: + icon = QIcon(":files/images/mavs/octorotor.svg"); + break; + case MAV_TYPE_TRICOPTER: + icon = QIcon(":files/images/mavs/tricopter.svg"); + break; + case MAV_TYPE_FLAPPING_WING: + icon = QIcon(":files/images/mavs/flapping-wing.svg"); + break; + case MAV_TYPE_KITE: + icon = QIcon(":files/images/mavs/kite.svg"); + break; + default: + icon = QIcon(":files/images/mavs/unknown.svg"); + break; + } // XXX The multi-UAS selection menu has been disabled for now, // its redundant with right-clicking the UAS in the list. // this code piece might be removed later if this is the final // conclusion (May 2013) // QAction* uasAction = new QAction(icon, tr("Select %1 for control").arg(uas->getUASName()), ui.menuConnected_Systems); - // connect(uas, SIGNAL(systemRemoved()), uasAction, SLOT(deleteLater())); // connect(uasAction, SIGNAL(triggered()), uas, SLOT(setSelected())); // ui.menuConnected_Systems->addAction(uasAction); @@ -1899,6 +1823,7 @@ void MainWindow::UASCreated(UASInterface* uas) void MainWindow::UASDeleted(UASInterface* uas) { + Q_UNUSED(uas); if (UASManager::instance()->getUASList().count() == 0) { // Last system deleted @@ -2030,32 +1955,13 @@ void MainWindow::loadViewState() } void MainWindow::setAdvancedMode() { - if (!isAdvancedMode) - { - ui.actionAdvanced_Mode->setChecked(true); - isAdvancedMode = true; - settings.setValue("ADVANCED_MODE",true); - for (QMap::const_iterator i=dockToTitleBarMap.constBegin();i!=dockToTitleBarMap.constEnd();i++) - { - //QWidget *widget = i.value(); - QWidget *widget = i.key()->titleBarWidget(); - i.key()->setTitleBarWidget(i.value()); - dockToTitleBarMap[i.key()] = widget; + isAdvancedMode = !isAdvancedMode; + ui.actionAdvanced_Mode->setChecked(isAdvancedMode); + settings.setValue("ADVANCED_MODE",isAdvancedMode); - } - } - else + for (int i = 0; i < dockWidgets.size(); i++) { - ui.actionAdvanced_Mode->setChecked(false); - isAdvancedMode = false; - settings.setValue("ADVANCED_MODE",false); - for (QMap::const_iterator i=dockToTitleBarMap.constBegin();i!=dockToTitleBarMap.constEnd();i++) - { - //QWidget *widget = i.value(); - QWidget *widget = i.key()->titleBarWidget(); - i.key()->setTitleBarWidget(i.value()); - dockToTitleBarMap[i.key()] = widget; - } + setDockWidgetTitleBar(dockWidgets[i]); } } diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h index f9b322961e7689f0b21c5789215805591eee4ff7..b757d67539a78b1e718fe18b63f045e596a5eb9e 100644 --- a/src/ui/MainWindow.h +++ b/src/ui/MainWindow.h @@ -43,7 +43,6 @@ This file is part of the QGROUNDCONTROL project #include "UASInterface.h" #include "UASManager.h" #include "UASControlWidget.h" -#include "Linecharts.h" #include "UASInfoWidget.h" #include "WaypointList.h" #include "CameraView.h" @@ -51,9 +50,7 @@ This file is part of the QGROUNDCONTROL project #include "MAVLinkProtocol.h" #include "MAVLinkSimulationLink.h" #include "ObjectDetectionView.h" -#include "HUD.h" #include "submainwindow.h" -#include "JoystickWidget.h" #include "input/JoystickInput.h" #if (defined MOUSE_ENABLED_WIN) | (defined MOUSE_ENABLED_LINUX) #include "Mouse6dofInput.h" @@ -64,7 +61,6 @@ This file is part of the QGROUNDCONTROL project #include "HDDisplay.h" #include "WatchdogControl.h" #include "HSIDisplay.h" -#include "QGCDataPlot2D.h" #include "QGCRemoteControlView.h" #include "opmapcontrol.h" #if (defined Q_OS_MAC) | (defined _MSC_VER) @@ -88,6 +84,9 @@ class QGCMAVLinkMessageSender; class QGCFirmwareUpdate; class QSplashScreen; class QGCStatusBar; +class Linecharts; +class QGCDataPlot2D; +class JoystickWidget; /** * @brief Main Application Window @@ -98,21 +97,58 @@ class MainWindow : public QMainWindow Q_OBJECT public: + /** + * A static function for obtaining the sole instance of the MainWindow. The screen + * argument is only important on the FIRST call to this function. The provided splash + * screen is updated with some status messages that are emitted during init(). This + * function cannot be used within the MainWindow constructor! + */ static MainWindow* instance(QSplashScreen* screen = 0); + + /** + * Initializes the MainWindow. Some variables are initialized and the widget is hidden. + * Initialization of the MainWindow class really occurs in init(), which loads the UI + * and does everything important. The constructor is split in two like this so that + * the instance() is available for all classes. + */ + MainWindow(QWidget *parent = NULL); ~MainWindow(); + /** + * This function actually performs the non-trivial initialization of the MainWindow + * class. This is separate from the constructor because instance() won't work within + * code executed in the MainWindow constructor. + */ + void init(); + enum QGC_MAINWINDOW_STYLE { - QGC_MAINWINDOW_STYLE_NATIVE, - QGC_MAINWINDOW_STYLE_INDOOR, - QGC_MAINWINDOW_STYLE_OUTDOOR + QGC_MAINWINDOW_STYLE_DARK, + QGC_MAINWINDOW_STYLE_LIGHT }; + // Declare default dark and light stylesheets. These should be file-resource + // paths. + static const QString defaultDarkStyle; + static const QString defaultLightStyle; + /** @brief Get current visual style */ - int getStyle() + QGC_MAINWINDOW_STYLE getStyle() { return currentStyle; } + + /** @brief Get current light visual stylesheet */ + QString getLightStyleSheet() + { + return lightStyleFileName; + } + + /** @brief Get current dark visual stylesheet */ + QString getDarkStyleSheet() + { + return darkStyleFileName; + } /** @brief Get auto link reconnect setting */ bool autoReconnectEnabled() { @@ -188,24 +224,16 @@ public slots: /** @brief Show the project roadmap */ void showRoadMap(); - /** @brief Reload the CSS style sheet */ - void reloadStylesheet(); - /** @brief Let the user select the CSS style sheet */ - void selectStylesheet(); /** @breif Enable title bars on dock widgets when no in advanced mode */ void enableDockWidgetTitleBars(bool enabled); /** @brief Automatically reconnect last link */ void enableAutoReconnect(bool enabled); /** @brief Save power by reducing update rates */ void enableLowPowerMode(bool enabled) { lowPowerMode = enabled; } - /** @brief Switch to native application style */ - void loadNativeStyle(); - /** @brief Switch to indoor mission style */ - void loadIndoorStyle(); - /** @brief Switch to outdoor mission style */ - void loadOutdoorStyle(); - /** @brief Load a specific style */ - void loadStyle(QGC_MAINWINDOW_STYLE style); + /** @brief Load a specific style. + * If it's a custom style, load the file indicated by the cssFile path. + */ + bool loadStyle(QGC_MAINWINDOW_STYLE style, QString cssFile); /** @brief Add a custom tool widget */ void createCustomWidget(); @@ -253,7 +281,8 @@ public slots: void commsWidgetDestroyed(QObject *obj); signals: - void initStatusChanged(const QString& message); + void styleChanged(MainWindow::QGC_MAINWINDOW_STYLE newTheme); + void initStatusChanged(const QString& message, int alignment, const QColor &color); #ifdef MOUSE_ENABLED_LINUX /** @brief Forward X11Event to catch 3DMouse inputs */ void x11EventOccured(XEvent *event); @@ -272,8 +301,6 @@ public: protected: - MainWindow(QWidget *parent = 0); - typedef enum _VIEW_SECTIONS { VIEW_ENGINEER, @@ -330,7 +357,7 @@ protected: void buildCommonWidgets(); void connectCommonWidgets(); void connectCommonActions(); - void connectSenseSoarActions(); + void connectSenseSoarActions(); void loadSettings(); void storeSettings(); @@ -437,7 +464,8 @@ protected: LogCompressor* comp; QString screenFileName; QTimer* videoTimer; - QString styleFileName; + QString darkStyleFileName; + QString lightStyleFileName; bool autoReconnect; Qt::WindowStates windowStateVal; bool lowPowerMode; ///< If enabled, QGC reduces the update rates of all widgets @@ -448,12 +476,17 @@ private: QList commsWidgetList; QMap customWidgetNameToFilenameMap; QMap menuToDockNameMap; - QMap dockToTitleBarMap; + QList dockWidgets; QMap > centralWidgetToDockWidgetsMap; - bool isAdvancedMode; - bool dockWidgetTitleBarEnabled; + bool isAdvancedMode; ///< If enabled dock widgets can be moved and floated. + bool dockWidgetTitleBarEnabled; ///< If enabled, dock widget titlebars are displayed when NOT in advanced mode. Ui::MainWindow ui; + /** @brief Set the appropriate titlebar for a given dock widget. + * Relies on the isAdvancedMode and dockWidgetTitleBarEnabled member variables. + */ + void setDockWidgetTitleBar(QDockWidget* widget); + QString getWindowStateKey(); QString getWindowGeometryKey(); diff --git a/src/ui/MainWindow.ui b/src/ui/MainWindow.ui index 24eef80933622f03cc90bae024acd7c9ab036f1d..41fb9846a90aa862c4c32983e9beb1619ac81ab3 100644 --- a/src/ui/MainWindow.ui +++ b/src/ui/MainWindow.ui @@ -51,27 +51,19 @@ 0 0 800 - 22 + 25 File - - - Display - - - - - @@ -208,7 +200,7 @@ :/files/images/devices/input-gaming.svg:/files/images/devices/input-gaming.svg - Joystick Test + Joystick Configuration true @@ -322,15 +314,6 @@ Meta+M - - - - :/files/images/categories/applications-internet.svg:/files/images/categories/applications-internet.svg - - - Select Stylesheet - - true @@ -401,14 +384,6 @@ Shutdown the onboard computer - works not during flight - - - Reload Stylesheet - - - Meta+R - - Settings diff --git a/src/ui/OpalLinkSettings.ui b/src/ui/OpalLinkSettings.ui index 3d29f7d449a265c2bb6d7afc33c4da6260cf6012..419dd0227de0cc3bf398145a1e144d28534a1235 100644 --- a/src/ui/OpalLinkSettings.ui +++ b/src/ui/OpalLinkSettings.ui @@ -74,7 +74,7 @@ Change - + :/files/images/status/folder-open.svg:/files/images/status/folder-open.svg @@ -88,7 +88,7 @@ Change - + :/files/images/status/folder-open.svg:/files/images/status/folder-open.svg @@ -150,7 +150,7 @@ - + diff --git a/src/ui/PrimaryFlightDisplay.cc b/src/ui/PrimaryFlightDisplay.cc index bc6f82aa916262910b0f7fdb82ddfaec8eb2d6fc..5a741098b930411eee6c1b0dd0e8b3fc97ebff25 100644 --- a/src/ui/PrimaryFlightDisplay.cc +++ b/src/ui/PrimaryFlightDisplay.cc @@ -99,7 +99,7 @@ static const int UNKNOWN_SPEED = -1; */ double PrimaryFlightDisplay_round(double value, int digits=0) { - return floor(value * pow(10, digits) + 0.5) / pow(10, digits); + return floor(value * pow(10.0, digits) + 0.5) / pow(10.0, digits); } qreal PrimaryFlightDisplay_constrain(qreal value, qreal min, qreal max) { @@ -524,17 +524,17 @@ void PrimaryFlightDisplay::drawAIAirframeFixedFeatures(QPainter& painter, QRectF qreal h = area.height(); QPen pen; - pen.setWidthF(lineWidth * 1.5); + pen.setWidthF(lineWidth * 1.5f); pen.setColor(redColor); painter.setPen(pen); - float length = 0.15; - float side = 0.5; + float length = 0.15f; + float side = 0.5f; // The 2 lines at sides. painter.drawLine(QPointF(-side*w, 0), QPointF(-(side-length)*w, 0)); painter.drawLine(QPointF(side*w, 0), QPointF((side-length)*w, 0)); - float rel = length/qSqrt(2); + float rel = length/qSqrt(2.0f); // The gull painter.drawLine(QPointF(rel*w, rel*w/2), QPoint(0, 0)); painter.drawLine(QPointF(-rel*w, rel*w/2), QPoint(0, 0)); diff --git a/src/ui/QGCDataPlot2D.cc b/src/ui/QGCDataPlot2D.cc index f3dbeb40386e50dd9a256b92e445e8b3557cc1a4..02dc9d1721d4c5888a3d29464eae02a9efbd646d 100644 --- a/src/ui/QGCDataPlot2D.cc +++ b/src/ui/QGCDataPlot2D.cc @@ -47,7 +47,7 @@ This file is part of the QGROUNDCONTROL project QGCDataPlot2D::QGCDataPlot2D(QWidget *parent) : QWidget(parent), - plot(new IncrementalPlot()), + plot(new IncrementalPlot(parent)), logFile(NULL), ui(new Ui::QGCDataPlot2D) { @@ -70,6 +70,10 @@ QGCDataPlot2D::QGCDataPlot2D(QWidget *parent) : connect(ui->gridCheckBox, SIGNAL(clicked(bool)), plot, SLOT(showGrid(bool))); connect(ui->regressionButton, SIGNAL(clicked()), this, SLOT(calculateRegression())); connect(ui->style, SIGNAL(currentIndexChanged(QString)), plot, SLOT(setStyleText(QString))); + + // Allow style changes to propagate through this widget + connect(MainWindow::instance(), SIGNAL(styleChanged(MainWindow::QGC_MAINWINDOW_STYLE)), + plot, SLOT(styleChanged(MainWindow::QGC_MAINWINDOW_STYLE))); } void QGCDataPlot2D::reloadFile() @@ -246,27 +250,27 @@ void QGCDataPlot2D::exportSVG(QString fileName) */ void QGCDataPlot2D::selectFile() { - // Open a file dialog prompting the user for the file to load. - // Note the special case for the Pixhawk. + // Open a file dialog prompting the user for the file to load. + // Note the special case for the Pixhawk. if (ui->inputFileType->currentText().contains("pxIMU") || ui->inputFileType->currentText().contains("RAW")) { fileName = QFileDialog::getOpenFileName(this, tr("Specify log file name"), QString(), "Logfile (*.imu *.raw)"); - } - else - { + } + else + { fileName = QFileDialog::getOpenFileName(this, tr("Specify log file name"), QString(), "Logfile (*.csv *.txt *.log)"); } - // Check if the user hit cancel, which results in a Null string. - // If this is the case, we just stop. - if (fileName.isNull()) - { - return; - } + // Check if the user hit cancel, which results in a Null string. + // If this is the case, we just stop. + if (fileName.isNull()) + { + return; + } - // Now attempt to open the file + // Now attempt to open the file QFileInfo fileInfo(fileName); if (!fileInfo.isReadable()) - { + { QMessageBox msgBox; msgBox.setIcon(QMessageBox::Critical); msgBox.setText("Could not open file"); @@ -276,8 +280,8 @@ void QGCDataPlot2D::selectFile() msgBox.exec(); ui->filenameLabel->setText(tr("Could not open %1").arg(fileInfo.baseName()+"."+fileInfo.completeSuffix())); } - else - { + else + { ui->filenameLabel->setText(tr("Opened %1").arg(fileInfo.completeBaseName()+"."+fileInfo.completeSuffix())); // Open and import the file loadFile(); @@ -561,7 +565,7 @@ void QGCDataPlot2D::loadCsvLog(QString file, QString xAxisName, QString yAxisFil bool QGCDataPlot2D::calculateRegression() { // TODO: Add support for quadratic / cubic curve fitting - return calculateRegression(ui->xRegressionComboBox->currentText(), ui->yRegressionComboBox->currentText(), "linear"); + return calculateRegression(ui->xRegressionComboBox->currentText(), ui->yRegressionComboBox->currentText(), "linear"); } /** @@ -580,14 +584,14 @@ bool QGCDataPlot2D::calculateRegression(QString xName, QString yName, QString me ui->yRegressionComboBox->setCurrentIndex(curveNames.indexOf(yName)); } - // Create a couple of arrays for us to use to temporarily store some of the data from the plot. - // These arrays are allocated on the heap as they are far too big to go in the stack and will - // cause an overflow. - // TODO: Look into if this would be better done by having a getter return const double pointers instead - // of using memcpy(). + // Create a couple of arrays for us to use to temporarily store some of the data from the plot. + // These arrays are allocated on the heap as they are far too big to go in the stack and will + // cause an overflow. + // TODO: Look into if this would be better done by having a getter return const double pointers instead + // of using memcpy(). const int size = 100000; - double *x = new double[size]; - double *y = new double[size]; + double *x = new double[size]; + double *y = new double[size]; int copied = plot->data(yName, x, y, size); if (method == "linear") { @@ -604,8 +608,8 @@ bool QGCDataPlot2D::calculateRegression(QString xName, QString yName, QString me plot->setStyleText("lines"); // x-value of the current rightmost x position in the plot plot->appendData(tr("regression %1-%2").arg(xName, yName), plot->invTransform(QwtPlot::xBottom, plot->width() - plot->width()*0.08f), (a + b*plot->invTransform(QwtPlot::xBottom, plot->width() - plot->width() * 0.08f))); - - result = true; + + result = true; } else { function = tr("Linear regression failed. (Limit: %1 data points. Try with less)").arg(size); } diff --git a/src/ui/QGCHilXPlaneConfiguration.cc b/src/ui/QGCHilXPlaneConfiguration.cc index 6941af04076531d042dd31a3e769a18cecf34d18..4166d7e662c04d5cd449580303676953691b4165 100644 --- a/src/ui/QGCHilXPlaneConfiguration.cc +++ b/src/ui/QGCHilXPlaneConfiguration.cc @@ -29,9 +29,9 @@ QGCHilXPlaneConfiguration::QGCHilXPlaneConfiguration(QGCHilLink* link, QWidget * ui->airframeComboBox->setCurrentIndex(link->getAirFrameIndex()); // XXX not implemented yet ui->airframeComboBox->hide(); - ui->sensorHilCheckBox->setChecked(link->sensorHilEnabled()); - connect(link, SIGNAL(sensorHilChanged(bool)), ui->sensorHilCheckBox, SLOT(setChecked(bool))); - connect(ui->sensorHilCheckBox, SIGNAL(clicked(bool)), link, SLOT(enableSensorHIL(bool))); + ui->sensorHilCheckBox->setChecked(xplane->sensorHilEnabled()); + connect(xplane, SIGNAL(sensorHilChanged(bool)), ui->sensorHilCheckBox, SLOT(setChecked(bool))); + connect(ui->sensorHilCheckBox, SIGNAL(clicked(bool)), xplane, SLOT(enableSensorHIL(bool))); connect(link, SIGNAL(versionChanged(int)), this, SLOT(setVersion(int))); } @@ -44,7 +44,7 @@ QGCHilXPlaneConfiguration::QGCHilXPlaneConfiguration(QGCHilLink* link, QWidget * void QGCHilXPlaneConfiguration::setVersion(int version) { - + Q_UNUSED(version); } void QGCHilXPlaneConfiguration::toggleSimulation(bool connect) diff --git a/src/ui/QGCMAVLinkLogPlayer.cc b/src/ui/QGCMAVLinkLogPlayer.cc index 0b5a33cd0514f7632775bdaf181b5df85f83cc9c..20f7649e71a0b61d1a1effbce2342b24a10a302f 100644 --- a/src/ui/QGCMAVLinkLogPlayer.cc +++ b/src/ui/QGCMAVLinkLogPlayer.cc @@ -561,3 +561,14 @@ void QGCMAVLinkLogPlayer::changeEvent(QEvent *e) break; } } + +/** + * Implement paintEvent() so that stylesheets work for our custom widget. + */ +void QGCMAVLinkLogPlayer::paintEvent(QPaintEvent *) +{ + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); +} \ No newline at end of file diff --git a/src/ui/QGCMAVLinkLogPlayer.h b/src/ui/QGCMAVLinkLogPlayer.h index df20d7361c38fc0d4c53c98019f28f4de7794eb1..647461ecf096f8e4b80a329be101ea5c345e277a 100644 --- a/src/ui/QGCMAVLinkLogPlayer.h +++ b/src/ui/QGCMAVLinkLogPlayer.h @@ -99,6 +99,7 @@ protected: private: Ui::QGCMAVLinkLogPlayer *ui; + virtual void paintEvent(QPaintEvent *); }; #endif // QGCMAVLINKLOGPLAYER_H diff --git a/src/ui/QGCParamWidget.cc b/src/ui/QGCParamWidget.cc index 068dbebb9d1cdd7c0bf0971e47f23c8ca3722667..4e9700a20cc7650d811cabf8ce8fe4f89bcbf36c 100644 --- a/src/ui/QGCParamWidget.cc +++ b/src/ui/QGCParamWidget.cc @@ -55,7 +55,9 @@ QGCParamWidget::QGCParamWidget(UASInterface* uas, QWidget *parent) : loadSettings(); // Load default values and tooltips - loadParameterInfoCSV(uas->getAutopilotTypeName(), uas->getSystemTypeName()); + QString hey(uas->getAutopilotTypeName()); + QString hey2(uas->getSystemTypeName()); + loadParameterInfoCSV(hey, hey2); // Create tree widget tree = new QTreeWidget(this); diff --git a/src/ui/QGCSettingsWidget.cc b/src/ui/QGCSettingsWidget.cc index f5fb0a6d0aadc5dd245c3a67b3073550fa0bdaab..5f16ce1170e0cea32dca5a85e275164254d6a421 100644 --- a/src/ui/QGCSettingsWidget.cc +++ b/src/ui/QGCSettingsWidget.cc @@ -13,10 +13,16 @@ QGCSettingsWidget::QGCSettingsWidget(QWidget *parent, Qt::WindowFlags flags) : QDialog(parent, flags), - ui(new Ui::QGCSettingsWidget) + ui(new Ui::QGCSettingsWidget), + mainWindow((MainWindow*)parent) { ui->setupUi(this); + // Center the window on the screen. + QRect position = frameGeometry(); + position.moveCenter(QDesktopWidget().availableGeometry().center()); + move(position.topLeft()); + // Add all protocols QList protocols = LinkManager::instance()->getProtocols(); foreach (ProtocolInterface* protocol, protocols) { @@ -35,42 +41,139 @@ QGCSettingsWidget::QGCSettingsWidget(QWidget *parent, Qt::WindowFlags flags) : connect(GAudioOutput::instance(), SIGNAL(mutedChanged(bool)), ui->audioMuteCheckBox, SLOT(setChecked(bool))); // Reconnect - ui->reconnectCheckBox->setChecked(MainWindow::instance()->autoReconnectEnabled()); - connect(ui->reconnectCheckBox, SIGNAL(clicked(bool)), MainWindow::instance(), SLOT(enableAutoReconnect(bool))); + ui->reconnectCheckBox->setChecked(mainWindow->autoReconnectEnabled()); + connect(ui->reconnectCheckBox, SIGNAL(clicked(bool)), mainWindow, SLOT(enableAutoReconnect(bool))); // Low power mode - ui->lowPowerCheckBox->setChecked(MainWindow::instance()->lowPowerModeEnabled()); - connect(ui->lowPowerCheckBox, SIGNAL(clicked(bool)), MainWindow::instance(), SLOT(enableLowPowerMode(bool))); + ui->lowPowerCheckBox->setChecked(mainWindow->lowPowerModeEnabled()); + connect(ui->lowPowerCheckBox, SIGNAL(clicked(bool)), mainWindow, SLOT(enableLowPowerMode(bool))); //Dock widget title bars - ui->titleBarCheckBox->setChecked(MainWindow::instance()->dockWidgetTitleBarsEnabled()); - connect(ui->titleBarCheckBox,SIGNAL(clicked(bool)),MainWindow::instance(),SLOT(enableDockWidgetTitleBars(bool))); - - // Style - MainWindow::QGC_MAINWINDOW_STYLE style = (MainWindow::QGC_MAINWINDOW_STYLE)MainWindow::instance()->getStyle(); - switch (style) { - case MainWindow::QGC_MAINWINDOW_STYLE_NATIVE: - ui->nativeStyle->setChecked(true); - break; - case MainWindow::QGC_MAINWINDOW_STYLE_INDOOR: - ui->indoorStyle->setChecked(true); - break; - case MainWindow::QGC_MAINWINDOW_STYLE_OUTDOOR: - ui->outdoorStyle->setChecked(true); - break; + ui->titleBarCheckBox->setChecked(mainWindow->dockWidgetTitleBarsEnabled()); + connect(ui->titleBarCheckBox,SIGNAL(clicked(bool)),mainWindow,SLOT(enableDockWidgetTitleBars(bool))); + + // Intialize the style UI to the proper values obtained from the MainWindow. + MainWindow::QGC_MAINWINDOW_STYLE style = mainWindow->getStyle(); + ui->styleChooser->setCurrentIndex(style); + if (style == MainWindow::QGC_MAINWINDOW_STYLE_DARK) + { + ui->styleSheetFile->setText(mainWindow->getDarkStyleSheet()); + } + else + { + ui->styleSheetFile->setText(mainWindow->getLightStyleSheet()); } - connect(ui->nativeStyle, SIGNAL(clicked()), MainWindow::instance(), SLOT(loadNativeStyle())); - connect(ui->indoorStyle, SIGNAL(clicked()), MainWindow::instance(), SLOT(loadIndoorStyle())); - connect(ui->outdoorStyle, SIGNAL(clicked()), MainWindow::instance(), SLOT(loadOutdoorStyle())); + + // And then connect all the signals for the UI for changing styles. + connect(ui->styleChooser, SIGNAL(currentIndexChanged(int)), this, SLOT(styleChanged(int))); + connect(ui->styleCustomButton, SIGNAL(clicked()), this, SLOT(selectStylesheet())); + connect(ui->styleDefaultButton, SIGNAL(clicked()), this, SLOT(setDefaultStyle())); + connect(ui->styleSheetFile, SIGNAL(editingFinished()), this, SLOT(lineEditFinished())); // Close / destroy connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(deleteLater())); - - // Set layout options - ui->generalPaneGridLayout->setAlignment(Qt::AlignTop); } QGCSettingsWidget::~QGCSettingsWidget() { delete ui; } + +void QGCSettingsWidget::selectStylesheet() +{ + // Let user select style sheet. The root directory for the file picker is the user's home directory if they haven't loaded a custom style. + // Otherwise it defaults to the directory of that custom file. + QString findDir; + QString oldStylesheet(ui->styleSheetFile->text()); + QFile styleSheet(oldStylesheet); + if (styleSheet.exists() && oldStylesheet[0] != ':') + { + findDir = styleSheet.fileName(); + } + else + { + findDir = QDir::homePath(); + } + + // Prompt the user to select a new style sheet. Do nothing if they cancel. + QString newStyleFileName = QFileDialog::getOpenFileName(this, tr("Specify stylesheet"), findDir, tr("CSS Stylesheet (*.css);;")); + if (newStyleFileName.isNull()) { + return; + } + + // Load the new style sheet if a valid one was selected, notifying the user + // of an error if necessary. + QFile newStyleFile(newStyleFileName); + if (!newStyleFile.exists() || !updateStyle(newStyleFileName)) + { + QMessageBox msgBox; + msgBox.setIcon(QMessageBox::Information); + msgBox.setText(tr("QGroundControl did not load a new style")); + msgBox.setInformativeText(tr("Stylesheet file %1 was not readable").arg(newStyleFileName)); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setDefaultButton(QMessageBox::Ok); + msgBox.exec(); + } + // And update the UI as needed. + else + { + ui->styleSheetFile->setText(newStyleFileName); + } +} + +bool QGCSettingsWidget::updateStyle(QString style) +{ + switch (ui->styleChooser->currentIndex()) + { + case 0: + return mainWindow->loadStyle(MainWindow::QGC_MAINWINDOW_STYLE_DARK, style); + case 1: + return mainWindow->loadStyle(MainWindow::QGC_MAINWINDOW_STYLE_LIGHT, style); + default: + return false; + } +} + +void QGCSettingsWidget::lineEditFinished() +{ + QString newStyleFileName(ui->styleSheetFile->text()); + QFile newStyleFile(newStyleFileName); + if (!newStyleFile.exists() || !updateStyle(newStyleFileName)) + { + QMessageBox msgBox; + msgBox.setIcon(QMessageBox::Information); + msgBox.setText(tr("QGroundControl did not load a new style")); + msgBox.setInformativeText(tr("Stylesheet file %1 was not readable").arg(newStyleFileName)); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setDefaultButton(QMessageBox::Ok); + msgBox.exec(); + } +} + +void QGCSettingsWidget::styleChanged(int index) +{ + if (index == 1) + { + ui->styleSheetFile->setText(mainWindow->getLightStyleSheet()); + mainWindow->loadStyle(MainWindow::QGC_MAINWINDOW_STYLE_LIGHT, mainWindow->getLightStyleSheet()); + } + else + { + ui->styleSheetFile->setText(mainWindow->getDarkStyleSheet()); + mainWindow->loadStyle(MainWindow::QGC_MAINWINDOW_STYLE_DARK, mainWindow->getDarkStyleSheet()); + } +} + +void QGCSettingsWidget::setDefaultStyle() +{ + if (ui->styleChooser->currentIndex() == 1) + { + ui->styleSheetFile->setText(MainWindow::defaultLightStyle); + mainWindow->loadStyle(MainWindow::QGC_MAINWINDOW_STYLE_LIGHT, MainWindow::defaultLightStyle); + } + else + { + ui->styleSheetFile->setText(MainWindow::defaultDarkStyle); + mainWindow->loadStyle(MainWindow::QGC_MAINWINDOW_STYLE_DARK, MainWindow::defaultDarkStyle); + } +} diff --git a/src/ui/QGCSettingsWidget.h b/src/ui/QGCSettingsWidget.h index 5537c5808a8900243d761f31db42b384155c0ddf..87b81f0b958c5c5174b4f141abf920748603f2b0 100644 --- a/src/ui/QGCSettingsWidget.h +++ b/src/ui/QGCSettingsWidget.h @@ -2,6 +2,7 @@ #define QGCSETTINGSWIDGET_H #include +#include "MainWindow.h" namespace Ui { @@ -17,9 +18,15 @@ public: ~QGCSettingsWidget(); public slots: + void styleChanged(int index); + void lineEditFinished(); + void setDefaultStyle(); + void selectStylesheet(); private: - Ui::QGCSettingsWidget *ui; + MainWindow* mainWindow; + Ui::QGCSettingsWidget* ui; + bool updateStyle(QString style); }; #endif // QGCSETTINGSWIDGET_H diff --git a/src/ui/QGCSettingsWidget.ui b/src/ui/QGCSettingsWidget.ui index a26ae5f7badb048180b4892c539b12368e22d52e..746b37fb3ef44f86ae9935143c466b8c68fef4b5 100644 --- a/src/ui/QGCSettingsWidget.ui +++ b/src/ui/QGCSettingsWidget.ui @@ -6,10 +6,16 @@ 0 0 - 535 - 427 + 528 + 321 + + + 0 + 0 + + Dialog @@ -23,8 +29,8 @@ General Settings - - + + Mute all audio output @@ -35,7 +41,7 @@ - + Automatically reconnect last link on application startup @@ -46,31 +52,7 @@ - - - - Use native platform look and feel (Windows/Linux/Mac OS) - - - true - - - - - - - Use indoor mission style (black background) - - - - - - - Use outdoor mission style (light background) - - - - + Lowers all update rates to save battery power @@ -80,7 +62,7 @@ - + Show Docked Widget title bars when NOT in advanced Mode. @@ -90,6 +72,95 @@ + + + + Style + + + false + + + false + + + + + + QLayout::SetMinimumSize + + + + + + Dark (for indoor use) + + + + + Light (for outdoor use) + + + + + + + + + + + + + 0 + 0 + + + + Stylesheet: + + + + + + + + + + Custom + + + false + + + + + + + Default + + + false + + + + + + + + + + + + Qt::Vertical + + + + 20 + 0 + + + + @@ -102,6 +173,9 @@ QDialogButtonBox::Close + + false + diff --git a/src/ui/QGCStatusBar.cc b/src/ui/QGCStatusBar.cc index 04f77de2f43ff130ae328fb5a880a86a2eddd04c..9d542615e7ae419dca58bf7029cd4f14ec574669 100644 --- a/src/ui/QGCStatusBar.cc +++ b/src/ui/QGCStatusBar.cc @@ -43,8 +43,6 @@ QGCStatusBar::QGCStatusBar(QWidget *parent) : addPermanentWidget(toggleLoggingButton); loadSettings(); - - setStyleSheet("QStatusBar { border: 0px; border-bottom: 1px solid #101010; border-top: 1px solid #4F4F4F; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #4B4B4B, stop:0.3 #404040, stop:0.34 #383838, stop:1 #181818); } "); } void QGCStatusBar::paintEvent(QPaintEvent * event) diff --git a/src/ui/QGCToolBar.cc b/src/ui/QGCToolBar.cc index e887658f535a20e777b7a1694c5a54685df7a0c5..294fb60f9ec1e7c5a3ae8c2d98c787709849d871 100644 --- a/src/ui/QGCToolBar.cc +++ b/src/ui/QGCToolBar.cc @@ -31,17 +31,19 @@ This file is part of the QGROUNDCONTROL project QGCToolBar::QGCToolBar(QWidget *parent) : QToolBar(parent), mav(NULL), - player(NULL), changed(true), batteryPercent(0), batteryVoltage(0), wpId(0), wpDistance(0), + altitudeMSL(0), + altitudeRel(0), systemArmed(false), currentLink(NULL), firstAction(NULL) { - setObjectName("QGC_TOOLBAR"); + setObjectName("QGCToolBar"); + setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); // Do not load UI, wait for actions } @@ -64,111 +66,113 @@ void QGCToolBar::heartbeatTimeout(bool timeout, unsigned int ms) // Alternate colors to increase visibility if ((ms / 1000) % 2 == 0) { - toolBarTimeoutLabel->setStyleSheet(QString("QLabel { margin: 3px 2px; padding: 2px; padding-left: 4px; padding-right: 4px; font: 14px; color: %1; background-color: %2; border-radius: 4px;}").arg(QGC::colorDarkWhite.name()).arg(QGC::colorMagenta.name())); + toolBarTimeoutLabel->setStyleSheet(QString("QLabel {color: #000; background-color: #FF0037;}")); } else { - toolBarTimeoutLabel->setStyleSheet(QString("QLabel { margin: 3px 2px; padding: 2px; padding-left: 4px; padding-right: 4px; font: 14px; color: %1; background-color: %2; border-radius: 4px;}").arg(QGC::colorDarkWhite.name()).arg(QGC::colorMagenta.dark(250).name())); + toolBarTimeoutLabel->setStyleSheet(QString("QLabel {color: #FFF; background-color: #6B0017;}")); } toolBarTimeoutLabel->setText(tr("CONNECTION LOST: %1 s").arg((ms / 1000.0f), 2, 'f', 1, ' ')); + toolBarTimeoutAction->setVisible(true); } else { // Check if loss text is present, reset once - if (toolBarTimeoutLabel->text() != "") + if (toolBarTimeoutAction->isVisible()) { - toolBarTimeoutLabel->setText(""); - toolBarTimeoutLabel->setStyleSheet(QString("")); + toolBarTimeoutAction->setVisible(false); } } } void QGCToolBar::createUI() { - setStyleSheet("QToolBar {margin: 0px; border-bottom: 1px solid #484848; border-top: 1px solid #969696; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #8B8B8B, stop:0.3 #808080, stop:0.34 #747474, stop:1 #484848);}"); - // CREATE TOOLBAR ITEMS // Add internal actions // Add MAV widget - symbolButton = new QToolButton(this); - symbolButton->setStyleSheet("QWidget { margin-left: 10px; background-color: #050508; color: #DDDDDF; background-clip: border; }"); - addWidget(symbolButton); + symbolLabel = new QLabel(this); + addWidget(symbolLabel); - toolBarNameLabel = new QLabel("------", this); + toolBarNameLabel = new QLabel(this); toolBarNameLabel->setToolTip(tr("Currently controlled vehicle")); toolBarNameLabel->setAlignment(Qt::AlignCenter); + toolBarNameLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); addWidget(toolBarNameLabel); - toolBarTimeoutLabel = new QLabel("UNCONNECTED", this); + toolBarTimeoutLabel = new QLabel(this); toolBarTimeoutLabel->setToolTip(tr("System timed out, interval since last message")); - toolBarTimeoutLabel->setStyleSheet(QString("QLabel { margin: 3px 2px; padding: 2px; padding-left: 4px; padding-right: 4px; font: 14px; color: %1; background-color: %2; border-radius: 4px;}").arg(QGC::colorDarkWhite.name()).arg(QGC::colorMagenta.name())); toolBarTimeoutLabel->setAlignment(Qt::AlignCenter); - addWidget(toolBarTimeoutLabel); + toolBarTimeoutLabel->setObjectName("toolBarTimeoutLabel"); + toolBarTimeoutLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); + toolBarTimeoutAction = addWidget(toolBarTimeoutLabel); - toolBarSafetyLabel = new QLabel("SAFE", this); - toolBarSafetyLabel->setStyleSheet("QLabel { margin: 3px 2px; padding: 2px; padding-left: 4px; padding-right: 4px; font: 14px; color: #14C814; }"); + toolBarSafetyLabel = new QLabel(this); toolBarSafetyLabel->setToolTip(tr("Vehicle safety state")); toolBarSafetyLabel->setAlignment(Qt::AlignCenter); addWidget(toolBarSafetyLabel); - toolBarModeLabel = new QLabel("------", this); - toolBarModeLabel->setStyleSheet("QLabel { margin: 3px 2px; font: 14px; color: #ACEBFE; }"); + toolBarModeLabel = new QLabel(this); toolBarModeLabel->setToolTip(tr("Vehicle mode")); + toolBarModeLabel->setObjectName("toolBarModeLabel"); toolBarModeLabel->setAlignment(Qt::AlignCenter); addWidget(toolBarModeLabel); - toolBarStateLabel = new QLabel("------", this); - toolBarStateLabel->setStyleSheet("QLabel { margin: 3px 2px; font: 14px; color: #FEC654; }"); + toolBarStateLabel = new QLabel(this); toolBarStateLabel->setToolTip(tr("Vehicle state")); + toolBarStateLabel->setObjectName("toolBarStateLabel"); toolBarStateLabel->setAlignment(Qt::AlignCenter); addWidget(toolBarStateLabel); toolBarBatteryBar = new QProgressBar(this); - toolBarBatteryBar->setStyleSheet("QProgressBar:horizontal { margin: 0px 4px 0px 0px; border: 1px solid #4A4A4F; border-radius: 4px; text-align: center; padding: 2px; color: #111111; background-color: #111118; height: 14px; } QProgressBar:horizontal QLabel { font-size: 9px; color: #111111; } QProgressBar::chunk { background-color: green; }"); toolBarBatteryBar->setMinimum(0); toolBarBatteryBar->setMaximum(100); toolBarBatteryBar->setMinimumWidth(20); toolBarBatteryBar->setMaximumWidth(100); - toolBarBatteryBar->setValue(0); toolBarBatteryBar->setToolTip(tr("Battery charge level")); + toolBarBatteryBar->setObjectName("toolBarBatteryBar"); + toolBarBatteryBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding); addWidget(toolBarBatteryBar); - toolBarBatteryVoltageLabel = new QLabel("xx.x V"); - toolBarBatteryVoltageLabel->setStyleSheet(QString("QLabel { margin: 0px 0px 0px 4px; font: 14px; color: %1; }").arg(QColor(Qt::green).name())); + toolBarBatteryVoltageLabel = new QLabel(this); toolBarBatteryVoltageLabel->setToolTip(tr("Battery voltage")); + toolBarBatteryVoltageLabel->setObjectName("toolBarBatteryVoltageLabel"); toolBarBatteryVoltageLabel->setAlignment(Qt::AlignCenter); addWidget(toolBarBatteryVoltageLabel); - toolBarWpLabel = new QLabel("WP--", this); - toolBarWpLabel->setStyleSheet("QLabel { margin: 3px 2px; font: 18px; color: #ACEBFE; }"); + toolBarWpLabel = new QLabel(this); toolBarWpLabel->setToolTip(tr("Current waypoint")); + toolBarWpLabel->setObjectName("toolBarWpLabel"); toolBarWpLabel->setAlignment(Qt::AlignCenter); addWidget(toolBarWpLabel); - toolBarDistLabel = new QLabel("--- ---- m", this); + toolBarDistLabel = new QLabel(this); toolBarDistLabel->setToolTip(tr("Distance to current waypoint")); toolBarDistLabel->setAlignment(Qt::AlignCenter); addWidget(toolBarDistLabel); - toolBarMessageLabel = new QLabel("", this); - toolBarMessageLabel->setStyleSheet("QLabel { margin: 3px 2px; font: 14px; color: #ACEBFE; }"); + toolBarMessageLabel = new QLabel(this); toolBarMessageLabel->setToolTip(tr("Most recent system message")); + toolBarMessageLabel->setObjectName("toolBarMessageLabel"); addWidget(toolBarMessageLabel); QWidget* spacer = new QWidget(); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - spacer->setStyleSheet("* { margin: 0px; background-color: transparent; min-height: 24px}"); addWidget(spacer); connectButton = new QPushButton(tr("Connect"), this); + connectButton->setObjectName("connectButton"); connectButton->setToolTip(tr("Connect wireless link to MAV")); connectButton->setCheckable(true); - connectButton->setStyleSheet("QPushButton { min-height: 24px; max-height: 24px; color: #222222; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #5AAA49, stop: 1 #106B38); margin-left: 4px; margin-right: 4px; border-radius: 4px; border: 1px solid #085B35; } QPushButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FF9000, stop: 1 #FFD450); color: #222222; border-color: #D1892A}"); addWidget(connectButton); connect(connectButton, SIGNAL(clicked(bool)), this, SLOT(connectLink(bool))); + resetToolbarUI(); + // DONE INITIALIZING BUTTONS + // Set the toolbar to be updated every 2s + connect(&updateViewTimer, SIGNAL(timeout()), this, SLOT(updateView())); + // Configure the toolbar for the current default UAS setActiveUAS(UASManager::instance()->getActiveUAS()); connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*))); @@ -184,15 +188,36 @@ void QGCToolBar::createUI() connectButton->setText(tr("New Link")); } - // Set the toolbar to be updated every 2s - connect(&updateViewTimer, SIGNAL(timeout()), this, SLOT(updateView())); - updateViewTimer.start(2000); - loadSettings(); changed = false; } +/** + * Reset all the labels and stuff for the toolbar to a pristine state. Done at startup after + * all UI has been created and also when the last UAS has been deleted. + **/ +void QGCToolBar::resetToolbarUI() +{ + toolBarNameLabel->setText("------"); + toolBarNameLabel->setStyleSheet(""); + toolBarTimeoutLabel->setText(tr("UNCONNECTED")); + //toolBarTimeoutLabel->show(); + toolBarSafetyLabel->setText("----"); + toolBarModeLabel->setText("------"); + toolBarStateLabel->setText("------"); + toolBarBatteryBar->setValue(0); + toolBarBatteryBar->setDisabled(true); + toolBarBatteryVoltageLabel->setText("xx.x V"); + toolBarWpLabel->setText("WP--"); + toolBarDistLabel->setText("--- ---- m"); + toolBarMessageLabel->clear(); + lastSystemMessage = ""; + lastSystemMessageTimeMs = 0; + symbolLabel->setStyleSheet(""); + symbolLabel->clear(); +} + void QGCToolBar::setPerspectiveChangeActions(const QList &actions) { if (actions.count() > 1) @@ -200,8 +225,8 @@ void QGCToolBar::setPerspectiveChangeActions(const QList &actions) group = new QButtonGroup(this); group->setExclusive(true); + // Add the first button. QToolButton *first = new QToolButton(this); - // Add first button first->setIcon(actions.first()->icon()); first->setText(actions.first()->text()); first->setToolTip(actions.first()->toolTip()); @@ -209,15 +234,14 @@ void QGCToolBar::setPerspectiveChangeActions(const QList &actions) first->setCheckable(true); connect(first, SIGNAL(clicked(bool)), actions.first(), SIGNAL(triggered(bool))); connect(actions.first(),SIGNAL(triggered(bool)),first,SLOT(setChecked(bool))); - first->setStyleSheet("QToolButton { min-height: 24px; max-height: 24px; min-width: 60px; color: #222222; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #A2A3A4, stop: 1 #B6B7B8); margin-left: 8px; margin-right: 0px; padding-left: 4px; padding-right: 8px; border-radius: 0px; border : 0px solid blue; border-bottom-left-radius: 6px; border-top-left-radius: 6px; border-left: 1px solid #484848; border-top: 1px solid #484848; border-bottom: 1px solid #484848; } QToolButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #555555, stop: 1 #787878); color: #DDDDDD; }"); + first->setObjectName("firstAction"); addWidget(first); group->addButton(first); + // Add all the middle buttons. for (int i = 1; i < actions.count(); i++) { - // Add last button QToolButton *btn = new QToolButton(this); - // Add first button btn->setIcon(actions.at(i)->icon()); btn->setText(actions.at(i)->text()); btn->setToolTip(actions.at(i)->toolTip()); @@ -225,19 +249,19 @@ void QGCToolBar::setPerspectiveChangeActions(const QList &actions) btn->setCheckable(true); connect(btn, SIGNAL(clicked(bool)), actions.at(i), SIGNAL(triggered(bool))); connect(actions.at(i),SIGNAL(triggered(bool)),btn,SLOT(setChecked(bool))); - btn->setStyleSheet("QToolButton { min-height: 24px; max-height: 24px; min-width: 60px; color: #222222; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #A2A3A4, stop: 1 #B6B7B8); margin-left: -2px; margin-right: -2px; padding-left: 0px; padding-right: 0px; border-radius: 0px; border-top: 1px solid #484848; border-bottom: 1px solid #484848; } QToolButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #555555, stop: 1 #787878); color: #DDDDDD; }"); addWidget(btn); group->addButton(btn); } // Add last button - advancedButton = new QPushButton(this); - // Add first button + advancedButton = new QToolButton(this); advancedButton->setIcon(QIcon(":/files/images/apps/utilities-system-monitor.svg")); advancedButton->setText(tr("Pro")); advancedButton->setToolTip(tr("Options for advanced users")); advancedButton->setCheckable(true); - advancedButton->setStyleSheet("QPushButton { min-height: 24px; max-height: 24px; min-width: 60px; font-weight: bold; text-align: left; color: #222222; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #A2A3A4, stop: 1 #B6B7B8); margin-left: 0px; margin-right: 13px; padding-left: 4px; padding-right: 8px; border-radius: 0px; border : 0px solid blue; border-bottom-right-radius: 6px; border-top-right-radius: 6px; border-right: 1px solid #484848; border-top: 1px solid #484848; border-bottom: 1px solid #484848; } QPushButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #555555, stop: 1 #787878); color: #DDDDDD; }"); + advancedButton->setObjectName("advancedButton"); + advancedButton->setPopupMode(QToolButton::InstantPopup); + advancedButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); addWidget(advancedButton); group->addButton(advancedButton); } else { @@ -260,8 +284,6 @@ void QGCToolBar::setPerspectiveChangeAdvancedActions(const QList &acti menu->addAction(actions.at(i)); } - menu->setStyleSheet("QMenu { font-weight: bold; min-width: 70px; color: #222222; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #A2A3A4, stop: 1 #B6B7B8); border: 1px solid #484848; } QMenu::item:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #555555, stop: 1 #787878); color: #DDDDDD; }"); - advancedButton->setMenu(menu); connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(advancedActivityTriggered(QAction*))); @@ -278,12 +300,12 @@ void QGCToolBar::advancedActivityTriggered(QAction* action) void QGCToolBar::setActiveUAS(UASInterface* active) { - // Do nothing if system is the same or NULL - if ((active == NULL) || mav == active) return; + // Do nothing if system is the same + if (mav == active) return; + // If switching UASes, disconnect the only one. if (mav) { - // Disconnect old system disconnect(mav, SIGNAL(statusChanged(UASInterface*,QString,QString)), this, SLOT(updateState(UASInterface*,QString,QString))); disconnect(mav, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString))); disconnect(mav, SIGNAL(nameChanged(QString)), this, SLOT(updateName(QString))); @@ -299,41 +321,51 @@ void QGCToolBar::setActiveUAS(UASInterface* active) disconnect(mav->getWaypointManager(), SIGNAL(waypointDistanceChanged(double)), this, SLOT(updateWaypointDistance(double))); } } + else + { + // Only update the UI once a UAS has been selected. + updateViewTimer.start(2000); + } // Connect new system mav = active; - connect(active, SIGNAL(statusChanged(UASInterface*,QString,QString)), this, SLOT(updateState(UASInterface*, QString,QString))); - connect(active, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString))); - connect(active, SIGNAL(nameChanged(QString)), this, SLOT(updateName(QString))); - connect(active, SIGNAL(systemTypeSet(UASInterface*,uint)), this, SLOT(setSystemType(UASInterface*,uint))); - connect(active, SIGNAL(textMessageReceived(int,int,int,QString)), this, SLOT(receiveTextMessage(int,int,int,QString))); - connect(active, SIGNAL(batteryChanged(UASInterface*, double, double, double, int)), this, SLOT(updateBatteryRemaining(UASInterface*, double, double, double, int))); - connect(active, SIGNAL(armingChanged(bool)), this, SLOT(updateArmingState(bool))); - connect(active, SIGNAL(heartbeatTimeout(bool, unsigned int)), this, SLOT(heartbeatTimeout(bool,unsigned int))); - connect(active, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(globalPositionChanged(UASInterface*,double,double,double,quint64))); - if (active->getWaypointManager()) + if (mav) { - connect(active->getWaypointManager(), SIGNAL(currentWaypointChanged(quint16)), this, SLOT(updateCurrentWaypoint(quint16))); - connect(active->getWaypointManager(), SIGNAL(waypointDistanceChanged(double)), this, SLOT(updateWaypointDistance(double))); - } - - // Update all values once - systemName = mav->getUASName(); - systemArmed = mav->isArmed(); - toolBarNameLabel->setText(mav->getUASName()); - toolBarNameLabel->setStyleSheet(QString("QLabel { font: bold 16px; color: %1; }").arg(mav->getColor().name())); - symbolButton->setStyleSheet(QString("QWidget { background-color: %1; color: #DDDDDF; background-clip: border; } QToolButton { font-weight: bold; font-size: 14px; border: 0px solid #484848; border-radius: 5px; min-width:22px; max-width: 22px; min-height: 22px; max-height: 22px; padding: 0px; margin: 0px 4px 0px 20px; background-color: none; }").arg(mav->getColor().name())); - toolBarModeLabel->setText(mav->getShortMode()); - toolBarStateLabel->setText(mav->getShortState()); - toolBarTimeoutLabel->setStyleSheet(QString("")); - toolBarTimeoutLabel->setText(""); - toolBarDistLabel->setText(""); - setSystemType(mav, mav->getSystemType()); -} - -void QGCToolBar::createCustomWidgets() -{ + connect(mav, SIGNAL(statusChanged(UASInterface*,QString,QString)), this, SLOT(updateState(UASInterface*, QString,QString))); + connect(mav, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString))); + connect(mav, SIGNAL(nameChanged(QString)), this, SLOT(updateName(QString))); + connect(mav, SIGNAL(systemTypeSet(UASInterface*,uint)), this, SLOT(setSystemType(UASInterface*,uint))); + connect(mav, SIGNAL(textMessageReceived(int,int,int,QString)), this, SLOT(receiveTextMessage(int,int,int,QString))); + connect(mav, SIGNAL(batteryChanged(UASInterface*,double,double,double,int)), this, SLOT(updateBatteryRemaining(UASInterface*,double,double,double,int))); + connect(mav, SIGNAL(armingChanged(bool)), this, SLOT(updateArmingState(bool))); + connect(mav, SIGNAL(heartbeatTimeout(bool, unsigned int)), this, SLOT(heartbeatTimeout(bool,unsigned int))); + connect(mav, SIGNAL(globalPositionChanged(UASInterface*,double,double,double,quint64)), this, SLOT(globalPositionChanged(UASInterface*,double,double,double,quint64))); + if (mav->getWaypointManager()) + { + connect(mav->getWaypointManager(), SIGNAL(currentWaypointChanged(quint16)), this, SLOT(updateCurrentWaypoint(quint16))); + connect(mav->getWaypointManager(), SIGNAL(waypointDistanceChanged(double)), this, SLOT(updateWaypointDistance(double))); + } + // Update all values once + systemName = mav->getUASName(); + systemArmed = mav->isArmed(); + toolBarNameLabel->setText(mav->getUASName()); + toolBarNameLabel->setStyleSheet(QString("QLabel {color: %1;}").arg(mav->getColor().name())); + symbolLabel->setStyleSheet(QString("QWidget {background-color: %1;}").arg(mav->getColor().name())); + toolBarModeLabel->setText(mav->getShortMode()); + toolBarStateLabel->setText(mav->getShortState()); + toolBarTimeoutAction->setVisible(false); + toolBarMessageLabel->clear(); + lastSystemMessageTimeMs = 0; + toolBarDistLabel->clear(); + toolBarBatteryBar->setEnabled(true); + setSystemType(mav, mav->getSystemType()); + } + else + { + updateViewTimer.stop(); + resetToolbarUI(); + } } void QGCToolBar::updateArmingState(bool armed) @@ -353,30 +385,52 @@ void QGCToolBar::updateView() toolBarWpLabel->setText(tr("WP%1").arg(wpId)); toolBarBatteryBar->setValue(batteryPercent); if (batteryPercent < 30 && toolBarBatteryBar->value() >= 30) { - toolBarBatteryBar->setStyleSheet("QProgressBar:horizontal { margin: 0px 4px 0px 0px; border: 1px solid #4A4A4F; border-radius: 4px; text-align: center; padding: 2px; color: #111111; background-color: #111118; height: 14px; } QProgressBar:horizontal QLabel { font-size: 9px; color: #111111; } QProgressBar::chunk { background-color: yellow; }"); + if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) + { + toolBarBatteryBar->setStyleSheet("QProgressBar {color: #FFF} QProgressBar::chunk { background-color: #008000}"); + } + else + { + toolBarBatteryBar->setStyleSheet("QProgressBar {color: #000} QProgressBar QProgressBar::chunk { background-color: #0F0}"); + } } else if (batteryPercent >= 30 && toolBarBatteryBar->value() < 30){ - toolBarBatteryBar->setStyleSheet("QProgressBar:horizontal { margin: 0px 4px 0px 0px; border: 1px solid #4A4A4F; border-radius: 4px; text-align: center; padding: 2px; color: #111111; background-color: #111118; height: 14px; } QProgressBar:horizontal QLabel { font-size: 9px; color: #111111; } QProgressBar::chunk { background-color: green; }"); + if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) + { + toolBarBatteryBar->setStyleSheet("QProgressBar {color: #FFF} QProgressBar::chunk { background-color: #808000}"); + } + else + { + toolBarBatteryBar->setStyleSheet("QProgressBar {color: #000} QProgressBar QProgressBar::chunk { background-color: #FF0}"); + } } toolBarBatteryVoltageLabel->setText(tr("%1 V").arg(batteryVoltage, 4, 'f', 1, ' ')); - toolBarStateLabel->setText(tr("%1").arg(state)); - toolBarModeLabel->setText(tr("%1").arg(mode)); + toolBarStateLabel->setText(QString("%1").arg(state)); + toolBarModeLabel->setText(QString("%1").arg(mode)); toolBarNameLabel->setText(systemName); // expire after 15 seconds if (QGC::groundTimeMilliseconds() - lastSystemMessageTimeMs < 15000) { - toolBarMessageLabel->setText(tr("%1").arg(lastSystemMessage)); + toolBarMessageLabel->setText(QString("%1").arg(lastSystemMessage)); } else { - toolBarMessageLabel->setText(tr("%1").arg("")); + toolBarMessageLabel->clear(); } + // Display the system armed state with a red-on-yellow background if armed or green text if safe. if (systemArmed) { - toolBarSafetyLabel->setStyleSheet(QString("QLabel { margin: 3px 2px; padding: 2px; padding-left: 4px; padding-right: 4px; font: 14px; color: %1; background-color: %2; border-radius: 4px;}").arg(QGC::colorRed.name()).arg(QGC::colorYellow.name())); + toolBarSafetyLabel->setStyleSheet(QString("QLabel {color: %1; background-color: %2; font-size: 15pt;}").arg(QGC::colorRed.name()).arg(QGC::colorYellow.name())); toolBarSafetyLabel->setText(tr("ARMED")); } else { - toolBarSafetyLabel->setStyleSheet("QLabel { margin: 3px 2px; padding: 2px; padding-left: 4px; padding-right: 4px; font: 14px; color: #14C814; }"); + if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) + { + toolBarSafetyLabel->setStyleSheet("QLabel {color: #0D820D; font-size: 15pt;}"); + } + else + { + toolBarSafetyLabel->setStyleSheet("QLabel {color: #14C814; font-size: 15pt;}"); + } toolBarSafetyLabel->setText(tr("SAFE")); } @@ -399,6 +453,7 @@ void QGCToolBar::updateBatteryRemaining(UASInterface* uas, double voltage, doubl { Q_UNUSED(uas); Q_UNUSED(seconds); + Q_UNUSED(current); if (batteryPercent != percent || batteryVoltage != voltage) changed = true; batteryPercent = percent; batteryVoltage = voltage; @@ -443,66 +498,67 @@ void QGCToolBar::updateName(const QString& name) void QGCToolBar::setSystemType(UASInterface* uas, unsigned int systemType) { Q_UNUSED(uas); - // Set matching icon - switch (systemType) { - case MAV_TYPE_GENERIC: - symbolButton->setIcon(QIcon(":/files/images/mavs/generic.svg")); - break; - case MAV_TYPE_FIXED_WING: - symbolButton->setIcon(QIcon(":/files/images/mavs/fixed-wing.svg")); - break; - case MAV_TYPE_QUADROTOR: - symbolButton->setIcon(QIcon(":/files/images/mavs/quadrotor.svg")); - break; - case MAV_TYPE_COAXIAL: - symbolButton->setIcon(QIcon(":/files/images/mavs/coaxial.svg")); - break; - case MAV_TYPE_HELICOPTER: - symbolButton->setIcon(QIcon(":/files/images/mavs/helicopter.svg")); - break; - case MAV_TYPE_ANTENNA_TRACKER: - symbolButton->setIcon(QIcon(":/files/images/mavs/antenna-tracker.svg")); - break; - case MAV_TYPE_GCS: - symbolButton->setIcon(QIcon(":files/images/mavs/groundstation.svg")); - break; - case MAV_TYPE_AIRSHIP: - symbolButton->setIcon(QIcon(":files/images/mavs/airship.svg")); - break; - case MAV_TYPE_FREE_BALLOON: - symbolButton->setIcon(QIcon(":files/images/mavs/free-balloon.svg")); - break; - case MAV_TYPE_ROCKET: - symbolButton->setIcon(QIcon(":files/images/mavs/rocket.svg")); - break; - case MAV_TYPE_GROUND_ROVER: - symbolButton->setIcon(QIcon(":files/images/mavs/ground-rover.svg")); - break; - case MAV_TYPE_SURFACE_BOAT: - symbolButton->setIcon(QIcon(":files/images/mavs/surface-boat.svg")); - break; - case MAV_TYPE_SUBMARINE: - symbolButton->setIcon(QIcon(":files/images/mavs/submarine.svg")); - break; - case MAV_TYPE_HEXAROTOR: - symbolButton->setIcon(QIcon(":files/images/mavs/hexarotor.svg")); - break; - case MAV_TYPE_OCTOROTOR: - symbolButton->setIcon(QIcon(":files/images/mavs/octorotor.svg")); - break; - case MAV_TYPE_TRICOPTER: - symbolButton->setIcon(QIcon(":files/images/mavs/tricopter.svg")); - break; - case MAV_TYPE_FLAPPING_WING: - symbolButton->setIcon(QIcon(":files/images/mavs/flapping-wing.svg")); - break; - case MAV_TYPE_KITE: - symbolButton->setIcon(QIcon(":files/images/mavs/kite.svg")); - break; - default: - symbolButton->setIcon(QIcon(":/files/images/mavs/unknown.svg")); - break; - } + QPixmap newPixmap; + switch (systemType) { + case MAV_TYPE_GENERIC: + newPixmap = QPixmap(":/files/images/mavs/generic.svg"); + break; + case MAV_TYPE_FIXED_WING: + newPixmap = QPixmap(":/files/images/mavs/fixed-wing.svg"); + break; + case MAV_TYPE_QUADROTOR: + newPixmap = QPixmap(":/files/images/mavs/quadrotor.svg"); + break; + case MAV_TYPE_COAXIAL: + newPixmap = QPixmap(":/files/images/mavs/coaxial.svg"); + break; + case MAV_TYPE_HELICOPTER: + newPixmap = QPixmap(":/files/images/mavs/helicopter.svg"); + break; + case MAV_TYPE_ANTENNA_TRACKER: + newPixmap = QPixmap(":/files/images/mavs/antenna-tracker.svg"); + break; + case MAV_TYPE_GCS: + newPixmap = QPixmap(":files/images/mavs/groundstation.svg"); + break; + case MAV_TYPE_AIRSHIP: + newPixmap = QPixmap(":files/images/mavs/airship.svg"); + break; + case MAV_TYPE_FREE_BALLOON: + newPixmap = QPixmap(":files/images/mavs/free-balloon.svg"); + break; + case MAV_TYPE_ROCKET: + newPixmap = QPixmap(":files/images/mavs/rocket.svg"); + break; + case MAV_TYPE_GROUND_ROVER: + newPixmap = QPixmap(":files/images/mavs/ground-rover.svg"); + break; + case MAV_TYPE_SURFACE_BOAT: + newPixmap = QPixmap(":files/images/mavs/surface-boat.svg"); + break; + case MAV_TYPE_SUBMARINE: + newPixmap = QPixmap(":files/images/mavs/submarine.svg"); + break; + case MAV_TYPE_HEXAROTOR: + newPixmap = QPixmap(":files/images/mavs/hexarotor.svg"); + break; + case MAV_TYPE_OCTOROTOR: + newPixmap = QPixmap(":files/images/mavs/octorotor.svg"); + break; + case MAV_TYPE_TRICOPTER: + newPixmap = QPixmap(":files/images/mavs/tricopter.svg"); + break; + case MAV_TYPE_FLAPPING_WING: + newPixmap = QPixmap(":files/images/mavs/flapping-wing.svg"); + break; + case MAV_TYPE_KITE: + newPixmap = QPixmap(":files/images/mavs/kite.svg"); + break; + default: + newPixmap = QPixmap(":/files/images/mavs/unknown.svg"); + break; + } + symbolLabel->setPixmap(newPixmap.scaledToHeight(24)); } void QGCToolBar::receiveTextMessage(int uasid, int componentid, int severity, QString text) diff --git a/src/ui/QGCToolBar.h b/src/ui/QGCToolBar.h index f83e4461911286929bdbb017804a9440a97ba0e7..ac7141ff02f3141871db6c0eeecb0a470aee848d 100644 --- a/src/ui/QGCToolBar.h +++ b/src/ui/QGCToolBar.h @@ -84,15 +84,16 @@ public slots: void advancedActivityTriggered(QAction* action); protected: - void createCustomWidgets(); void storeSettings(); void loadSettings(); void createUI(); + void resetToolbarUI(); UASInterface* mav; - QToolButton* symbolButton; + QLabel* symbolLabel; QLabel* toolBarNameLabel; QLabel* toolBarTimeoutLabel; + QAction* toolBarTimeoutAction; ///< Needed to set label (in)visible. QLabel* toolBarSafetyLabel; QLabel* toolBarModeLabel; QLabel* toolBarStateLabel; @@ -102,7 +103,6 @@ protected: QPushButton* connectButton; QProgressBar* toolBarBatteryBar; QLabel* toolBarBatteryVoltageLabel; - QGCMAVLinkLogPlayer* player; bool changed; float batteryPercent; float batteryVoltage; @@ -119,7 +119,7 @@ protected: bool systemArmed; LinkInterface* currentLink; QAction* firstAction; - QPushButton *advancedButton; + QToolButton *advancedButton; QButtonGroup *group; }; diff --git a/src/ui/QGCVehicleConfig.cc b/src/ui/QGCVehicleConfig.cc index 282f18e9f79aa07111dd8aa834b5562fdc48acda..b99535bccbaf2a24a9f17f2eef59dbe199c4b036 100644 --- a/src/ui/QGCVehicleConfig.cc +++ b/src/ui/QGCVehicleConfig.cc @@ -36,11 +36,6 @@ QGCVehicleConfig::QGCVehicleConfig(QWidget *parent) : ui(new Ui::QGCVehicleConfig) { doneLoadingConfig = false; - systemTypeToParamMap["FIXED_WING"] = new QMap(); - systemTypeToParamMap["QUADROTOR"] = new QMap(); - systemTypeToParamMap["GROUND_ROVER"] = new QMap(); - systemTypeToParamMap["BOAT"] = new QMap(); - libParamToWidgetMap = new QMap(); setObjectName("QGC_VEHICLECONFIG"); ui->setupUi(this); @@ -65,16 +60,11 @@ QGCVehicleConfig::QGCVehicleConfig(QWidget *parent) : connect(ui->generalMenuButton,SIGNAL(clicked()),this,SLOT(generalMenuButtonClicked())); connect(ui->advancedMenuButton,SIGNAL(clicked()),this,SLOT(advancedMenuButtonClicked())); - - requestCalibrationRC(); - if (mav) mav->requestParameter(0, "RC_TYPE"); - ui->rcModeComboBox->setCurrentIndex((int)rc_mode - 1); ui->rcCalibrationButton->setCheckable(true); connect(ui->rcCalibrationButton, SIGNAL(clicked(bool)), this, SLOT(toggleCalibrationRC(bool))); connect(ui->setButton, SIGNAL(clicked()), this, SLOT(writeParameters())); - connect(ui->refreshButton,SIGNAL(clicked()),mav,SLOT(requestParameters())); connect(ui->rcModeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setRCModeIndex(int))); //connect(ui->setTrimButton, SIGNAL(clicked()), this, SLOT(setTrimPositions())); @@ -261,57 +251,61 @@ void QGCVehicleConfig::loadQgcConfig(bool primary) //TODO: Throw an error here too, no autopilot specific configuration qWarning() << "Invalid vehicle dir, no vehicle specific configuration will be loaded."; } + + // Generate widgets for the General tab. QGCToolWidget *tool; bool left = true; foreach (QString file,generaldir.entryList(QDir::Files | QDir::NoDotAndDotDot)) { if (file.toLower().endsWith(".qgw")) { - tool = new QGCToolWidget("", this); + QWidget* parent = left?ui->generalLeftContents:ui->generalRightContents; + tool = new QGCToolWidget("", parent); if (tool->loadSettings(generaldir.absoluteFilePath(file), false)) { toolWidgets.append(tool); - //ui->sensorLayout->addWidget(tool); - QGroupBox *box = new QGroupBox(this); + QGroupBox *box = new QGroupBox(parent); box->setTitle(tool->objectName()); - box->setLayout(new QVBoxLayout()); + box->setLayout(new QVBoxLayout(box)); box->layout()->addWidget(tool); if (left) { left = false; - ui->leftGeneralLayout->addWidget(box); + ui->generalLeftLayout->addWidget(box); } else { left = true; - ui->rightGeneralLayout->addWidget(box); + ui->generalRightLayout->addWidget(box); } } else { delete tool; } } } + + // Generate widgets for the Advanced tab. left = true; foreach (QString file,vehicledir.entryList(QDir::Files | QDir::NoDotAndDotDot)) { if (file.toLower().endsWith(".qgw")) { - tool = new QGCToolWidget("", this); + QWidget* parent = left?ui->advancedLeftContents:ui->advancedRightContents; + tool = new QGCToolWidget("", parent); if (tool->loadSettings(vehicledir.absoluteFilePath(file), false)) { toolWidgets.append(tool); - //ui->sensorLayout->addWidget(tool); - QGroupBox *box = new QGroupBox(this); + QGroupBox *box = new QGroupBox(parent); box->setTitle(tool->objectName()); - box->setLayout(new QVBoxLayout()); + box->setLayout(new QVBoxLayout(box)); box->layout()->addWidget(tool); if (left) { left = false; - ui->leftAdvancedLayout->addWidget(box); + ui->advancedLeftLayout->addWidget(box); } else { left = true; - ui->rightAdvancedLayout->addWidget(box); + ui->advancedRightLayout->addWidget(box); } } else { delete tool; @@ -319,7 +313,7 @@ void QGCVehicleConfig::loadQgcConfig(bool primary) } } - //Load tabs for general configuration + // Load tabs for general configuration foreach (QString dir,generaldir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) { QPushButton *button = new QPushButton(ui->scrollAreaWidgetContents_3); @@ -329,17 +323,15 @@ void QGCVehicleConfig::loadQgcConfig(bool primary) button->setMinimumWidth(100); button->show(); button->setText(dir); - //QWidget *tab = new QWidget(ui->tabWidget); - //ui->tabWidget->insertTab(2,tab,dir); QWidget *tab = new QWidget(ui->stackedWidget); ui->stackedWidget->insertWidget(2,tab); buttonToWidgetMap[button] = tab; tab->setLayout(new QVBoxLayout()); tab->show(); - QScrollArea *area = new QScrollArea(); + QScrollArea *area = new QScrollArea(tab); tab->layout()->addWidget(area); - QWidget *scrollArea = new QWidget(); - scrollArea->setLayout(new QVBoxLayout()); + QWidget *scrollArea = new QWidget(tab); + scrollArea->setLayout(new QVBoxLayout(tab)); area->setWidget(scrollArea); area->setWidgetResizable(true); area->show(); @@ -348,14 +340,14 @@ void QGCVehicleConfig::loadQgcConfig(bool primary) foreach (QString file,newdir.entryList(QDir::Files| QDir::NoDotAndDotDot)) { if (file.toLower().endsWith(".qgw")) { - tool = new QGCToolWidget("", this); + tool = new QGCToolWidget("", tab); if (tool->loadSettings(newdir.absoluteFilePath(file), false)) { toolWidgets.append(tool); //ui->sensorLayout->addWidget(tool); - QGroupBox *box = new QGroupBox(this); + QGroupBox *box = new QGroupBox(tab); box->setTitle(tool->objectName()); - box->setLayout(new QVBoxLayout()); + box->setLayout(new QVBoxLayout(tab)); box->layout()->addWidget(tool); scrollArea->layout()->addWidget(box); } else { @@ -365,11 +357,9 @@ void QGCVehicleConfig::loadQgcConfig(bool primary) } } - //Load tabs for vehicle specific configuration + // Load additional tabs for vehicle specific configuration foreach (QString dir,vehicledir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) { - //QWidget *tab = new QWidget(ui->tabWidget); - //ui->tabWidget->insertTab(2,tab,dir); QPushButton *button = new QPushButton(ui->scrollAreaWidgetContents_3); connect(button,SIGNAL(clicked()),this,SLOT(menuButtonClicked())); ui->navBarLayout->insertWidget(2,button); @@ -384,10 +374,10 @@ void QGCVehicleConfig::loadQgcConfig(bool primary) button->setText(dir); tab->setLayout(new QVBoxLayout()); tab->show(); - QScrollArea *area = new QScrollArea(); + QScrollArea *area = new QScrollArea(tab); tab->layout()->addWidget(area); - QWidget *scrollArea = new QWidget(); - scrollArea->setLayout(new QVBoxLayout()); + QWidget *scrollArea = new QWidget(tab); + scrollArea->setLayout(new QVBoxLayout(tab)); area->setWidget(scrollArea); area->setWidgetResizable(true); area->show(); @@ -397,15 +387,15 @@ void QGCVehicleConfig::loadQgcConfig(bool primary) foreach (QString file,newdir.entryList(QDir::Files| QDir::NoDotAndDotDot)) { if (file.toLower().endsWith(".qgw")) { - tool = new QGCToolWidget("", this); + tool = new QGCToolWidget("", tab); tool->addUAS(mav); if (tool->loadSettings(newdir.absoluteFilePath(file), false)) { toolWidgets.append(tool); //ui->sensorLayout->addWidget(tool); - QGroupBox *box = new QGroupBox(); + QGroupBox *box = new QGroupBox(tab); box->setTitle(tool->objectName()); - box->setLayout(new QVBoxLayout()); + box->setLayout(new QVBoxLayout(box)); box->layout()->addWidget(tool); scrollArea->layout()->addWidget(box); box->show(); @@ -417,30 +407,31 @@ void QGCVehicleConfig::loadQgcConfig(bool primary) } } - // Load calibration + // Load general calibration for autopilot //TODO: Handle this more gracefully, maybe have it scan the directory for multiple calibration entries? - tool = new QGCToolWidget("", this); + tool = new QGCToolWidget("", ui->sensorContents); tool->addUAS(mav); if (tool->loadSettings(autopilotdir.absolutePath() + "/general/calibration/calibration.qgw", false)) { toolWidgets.append(tool); - QGroupBox *box = new QGroupBox(this); + QGroupBox *box = new QGroupBox(ui->sensorContents); box->setTitle(tool->objectName()); - box->setLayout(new QVBoxLayout()); + box->setLayout(new QVBoxLayout(box)); box->layout()->addWidget(tool); ui->sensorLayout->addWidget(box); } else { delete tool; } - tool = new QGCToolWidget("", this); + // Load vehicle-specific autopilot configuration + tool = new QGCToolWidget("", ui->sensorContents); tool->addUAS(mav); if (tool->loadSettings(autopilotdir.absolutePath() + "/" + mav->getSystemTypeName().toLower() + "/calibration/calibration.qgw", false)) { toolWidgets.append(tool); - QGroupBox *box = new QGroupBox(this); + QGroupBox *box = new QGroupBox(ui->sensorContents); box->setTitle(tool->objectName()); - box->setLayout(new QVBoxLayout()); + box->setLayout(new QVBoxLayout(box)); box->layout()->addWidget(tool); ui->sensorLayout->addWidget(box); } else { @@ -499,7 +490,7 @@ void QGCVehicleConfig::loadConfig() QXmlStreamReader xml(xmlfile.readAll()); xmlfile.close(); - //TODO: Testing to ensure that incorrectly formated XML won't break this. + //TODO: Testing to ensure that incorrectly formatted XML won't break this. while (!xml.atEnd()) { if (xml.isStartElement() && xml.name() == "paramfile") @@ -679,7 +670,16 @@ void QGCVehicleConfig::loadConfig() } if (genarraycount > 0) { - tool = new QGCToolWidget("", this); + QWidget* parent = this; + if (valuetype == "vehicles") + { + parent = ui->generalLeftContents; + } + else if (valuetype == "libraries") + { + parent = ui->generalRightContents; + } + tool = new QGCToolWidget("", parent); tool->addUAS(mav); tool->setTitle(parametersname); tool->setObjectName(parametersname); @@ -690,41 +690,50 @@ void QGCVehicleConfig::loadConfig() //Based on the airframe, we add the parameter to different categories. if (parametersname == "ArduPlane") //MAV_TYPE_FIXED_WING FIXED_WING { - systemTypeToParamMap["FIXED_WING"]->insert(paramlist[i],tool); + systemTypeToParamMap["FIXED_WING"].insert(paramlist[i],tool); } else if (parametersname == "ArduCopter") //MAV_TYPE_QUADROTOR "QUADROTOR { - systemTypeToParamMap["QUADROTOR"]->insert(paramlist[i],tool); + systemTypeToParamMap["QUADROTOR"].insert(paramlist[i],tool); } else if (parametersname == "APMrover2") //MAV_TYPE_GROUND_ROVER GROUND_ROVER { - systemTypeToParamMap["GROUND_ROVER"]->insert(paramlist[i],tool); + systemTypeToParamMap["GROUND_ROVER"].insert(paramlist[i],tool); } else { - libParamToWidgetMap->insert(paramlist[i],tool); + libParamToWidgetMap.insert(paramlist[i],tool); } } toolWidgets.append(tool); - QGroupBox *box = new QGroupBox(this); + QGroupBox *box = new QGroupBox(parent); box->setTitle(tool->objectName()); - box->setLayout(new QVBoxLayout()); + box->setLayout(new QVBoxLayout(box)); box->layout()->addWidget(tool); if (valuetype == "vehicles") { - ui->leftGeneralLayout->addWidget(box); + ui->generalLeftLayout->addWidget(box); } else if (valuetype == "libraries") { - ui->rightGeneralLayout->addWidget(box); + ui->generalRightLayout->addWidget(box); } box->hide(); toolToBoxMap[tool] = box; } if (advarraycount > 0) { - tool = new QGCToolWidget("", this); + QWidget* parent = this; + if (valuetype == "vehicles") + { + parent = ui->generalLeftContents; + } + else if (valuetype == "libraries") + { + parent = ui->generalRightContents; + } + tool = new QGCToolWidget("", parent); tool->addUAS(mav); tool->setTitle(parametersname); tool->setObjectName(parametersname); @@ -735,48 +744,42 @@ void QGCVehicleConfig::loadConfig() //Based on the airframe, we add the parameter to different categories. if (parametersname == "ArduPlane") //MAV_TYPE_FIXED_WING FIXED_WING { - systemTypeToParamMap["FIXED_WING"]->insert(paramlist[i],tool); + systemTypeToParamMap["FIXED_WING"].insert(paramlist[i],tool); } else if (parametersname == "ArduCopter") //MAV_TYPE_QUADROTOR "QUADROTOR { - systemTypeToParamMap["QUADROTOR"]->insert(paramlist[i],tool); + systemTypeToParamMap["QUADROTOR"].insert(paramlist[i],tool); } else if (parametersname == "APMrover2") //MAV_TYPE_GROUND_ROVER GROUND_ROVER { - systemTypeToParamMap["GROUND_ROVER"]->insert(paramlist[i],tool); + systemTypeToParamMap["GROUND_ROVER"].insert(paramlist[i],tool); } else { - libParamToWidgetMap->insert(paramlist[i],tool); + libParamToWidgetMap.insert(paramlist[i],tool); } } toolWidgets.append(tool); - QGroupBox *box = new QGroupBox(this); + QGroupBox *box = new QGroupBox(parent); box->setTitle(tool->objectName()); - box->setLayout(new QVBoxLayout()); + box->setLayout(new QVBoxLayout(box)); box->layout()->addWidget(tool); if (valuetype == "vehicles") { - ui->leftAdvancedLayout->addWidget(box); + ui->generalLeftLayout->addWidget(box); } else if (valuetype == "libraries") { - ui->rightAdvancedLayout->addWidget(box); + ui->generalRightLayout->addWidget(box); } box->hide(); toolToBoxMap[tool] = box; } - - - - } xml.readNext(); } - } - xml.readNext(); } } @@ -790,8 +793,23 @@ void QGCVehicleConfig::loadConfig() void QGCVehicleConfig::setActiveUAS(UASInterface* active) { - // Do nothing if system is the same or NULL - if ((active == NULL) || mav == active) return; + // Hide items if NULL and abort + if (!active) { + ui->setButton->setEnabled(false); + ui->refreshButton->setEnabled(false); + ui->readButton->show(); + ui->readButton->setEnabled(false); + ui->writeButton->show(); + ui->writeButton->setEnabled(false); + ui->loadFileButton->setEnabled(false); + ui->saveFileButton->setEnabled(false); + + return; + } + + + // Do nothing if system is the same + if (mav == active) return; if (mav) { @@ -800,25 +818,62 @@ void QGCVehicleConfig::setActiveUAS(UASInterface* active) SLOT(remoteControlChannelRawChanged(int,float))); disconnect(mav, SIGNAL(parameterChanged(int,int,QString,QVariant)), this, SLOT(parameterChanged(int,int,QString,QVariant))); + disconnect(ui->refreshButton,SIGNAL(clicked()),mav,SLOT(requestParameters())); - foreach (QGCToolWidget* tool, toolWidgets) + // Delete all children from all fixed tabs. + foreach(QWidget* child, ui->generalLeftContents->findChildren()) + { + child->deleteLater(); + } + foreach(QWidget* child, ui->generalRightContents->findChildren()) + { + child->deleteLater(); + } + foreach(QWidget* child, ui->advancedLeftContents->findChildren()) + { + child->deleteLater(); + } + foreach(QWidget* child, ui->advancedRightContents->findChildren()) { - delete tool; + child->deleteLater(); } + foreach(QWidget* child, ui->sensorContents->findChildren()) + { + child->deleteLater(); + } + + // And then delete any custom tabs + foreach(QWidget* child, additionalTabs) + { + child->deleteLater(); + } + additionalTabs.clear(); + toolWidgets.clear(); + paramToWidgetMap.clear(); + libParamToWidgetMap.clear(); + systemTypeToParamMap.clear(); + toolToBoxMap.clear(); + paramTooltips.clear(); } + // Connect new system + mav = active; + // Reset current state resetCalibrationRC(); + requestCalibrationRC(); + mav->requestParameter(0, "RC_TYPE"); + chanCount = 0; // Connect new system - mav = active; connect(active, SIGNAL(remoteControlChannelRawChanged(int,float)), this, SLOT(remoteControlChannelRawChanged(int,float))); connect(active, SIGNAL(parameterChanged(int,int,QString,QVariant)), this, SLOT(parameterChanged(int,int,QString,QVariant))); + connect(ui->refreshButton, SIGNAL(clicked()), active, SLOT(requestParameters())); if (systemTypeToParamMap.contains(mav->getSystemTypeName())) { @@ -828,7 +883,6 @@ void QGCVehicleConfig::setActiveUAS(UASInterface* active) { //Indication that we have no meta data for this system type. qDebug() << "No parameters defined for system type:" << mav->getSystemTypeName(); - systemTypeToParamMap[mav->getSystemTypeName()] = new QMap(); paramToWidgetMap = systemTypeToParamMap[mav->getSystemTypeName()]; } @@ -846,7 +900,6 @@ void QGCVehicleConfig::setActiveUAS(UASInterface* active) updateStatus(QString("Reading from system %1").arg(mav->getUASName())); // Since a system is now connected, enable the VehicleConfig UI. - //ui->tabWidget->setEnabled(true); ui->setButton->setEnabled(true); ui->refreshButton->setEnabled(true); ui->readButton->setEnabled(true); @@ -1086,26 +1139,26 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete return; } - if (paramToWidgetMap->contains(parameterName)) + if (paramToWidgetMap.contains(parameterName)) { //Main group of parameters of the selected airframe - paramToWidgetMap->value(parameterName)->setParameterValue(uas,component,parameterName,value); - if (toolToBoxMap.contains(paramToWidgetMap->value(parameterName))) + paramToWidgetMap.value(parameterName)->setParameterValue(uas,component,parameterName,value); + if (toolToBoxMap.contains(paramToWidgetMap.value(parameterName))) { - toolToBoxMap[paramToWidgetMap->value(parameterName)]->show(); + toolToBoxMap[paramToWidgetMap.value(parameterName)]->show(); } else { qCritical() << "Widget with no box, possible memory corruption for param:" << parameterName; } } - else if (libParamToWidgetMap->contains(parameterName)) + else if (libParamToWidgetMap.contains(parameterName)) { //All the library parameters - libParamToWidgetMap->value(parameterName)->setParameterValue(uas,component,parameterName,value); - if (toolToBoxMap.contains(libParamToWidgetMap->value(parameterName))) + libParamToWidgetMap.value(parameterName)->setParameterValue(uas,component,parameterName,value); + if (toolToBoxMap.contains(libParamToWidgetMap.value(parameterName))) { - toolToBoxMap[libParamToWidgetMap->value(parameterName)]->show(); + toolToBoxMap[libParamToWidgetMap.value(parameterName)]->show(); } else { @@ -1123,7 +1176,7 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete { //It should be grouped with this one, add it. toolWidgets[i]->addParam(uas,component,parameterName,value); - libParamToWidgetMap->insert(parameterName,toolWidgets[i]); + libParamToWidgetMap.insert(parameterName,toolWidgets[i]); found = true; break; } @@ -1131,7 +1184,18 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete if (!found) { //New param type, create a QGroupBox for it. - QGCToolWidget *tool = new QGCToolWidget("", this); + QWidget* parent; + if (ui->advancedLeftLayout->count() > ui->advancedRightLayout->count()) + { + parent = ui->advancedRightContents; + } + else + { + parent = ui->advancedLeftContents; + } + + // Create the tool, attaching it to the QGroupBox + QGCToolWidget *tool = new QGCToolWidget("", parent); QString tooltitle = parameterName; if (parameterName.split("_").size() > 1) { @@ -1140,23 +1204,25 @@ void QGCVehicleConfig::parameterChanged(int uas, int component, QString paramete tool->setTitle(tooltitle); tool->setObjectName(tooltitle); //tool->setSettings(set); - tool->addParam(uas,component,parameterName,value); - libParamToWidgetMap->insert(parameterName,tool); + libParamToWidgetMap.insert(parameterName,tool); toolWidgets.append(tool); - QGroupBox *box = new QGroupBox(this); + tool->addParam(uas, component, parameterName, value); + QGroupBox *box = new QGroupBox(parent); box->setTitle(tool->objectName()); - box->setLayout(new QVBoxLayout()); + box->setLayout(new QVBoxLayout(box)); box->layout()->addWidget(tool); + libParamToWidgetMap.insert(parameterName,tool); + toolWidgets.append(tool); - //Make sure we have similar number of widgets on each side. - if (ui->leftAdvancedLayout->count() > ui->rightAdvancedLayout->count()) + // Make sure we have similar number of widgets on each side. + if (ui->advancedLeftLayout->count() > ui->advancedRightLayout->count()) { - ui->rightAdvancedLayout->addWidget(box); + ui->advancedRightLayout->addWidget(box); } else { - ui->leftAdvancedLayout->addWidget(box); + ui->advancedLeftLayout->addWidget(box); } toolToBoxMap[tool] = box; } diff --git a/src/ui/QGCVehicleConfig.h b/src/ui/QGCVehicleConfig.h index a38e450ec5e3e35d8c3c55140157a0b0b586da35..4db21ed1c850eecbfe6f615baa84758f427937ce 100644 --- a/src/ui/QGCVehicleConfig.h +++ b/src/ui/QGCVehicleConfig.h @@ -17,7 +17,7 @@ class QGCVehicleConfig; class QGCVehicleConfig : public QWidget { Q_OBJECT - + public: explicit QGCVehicleConfig(QWidget *parent = 0); ~QGCVehicleConfig(); @@ -185,12 +185,13 @@ protected: QList toolWidgets; ///< Configurable widgets bool calibrationEnabled; ///< calibration mode on / off - QMap *paramToWidgetMap; ///< Holds the current active MAV's parameter widgets. - QMap *libParamToWidgetMap; ///< Holds the library parameter widgets - QMap*> systemTypeToParamMap; ///< Holds all loaded MAV specific parameter widgets, for every MAV. + QMap paramToWidgetMap; ///< Holds the current active MAV's parameter widgets. + QList additionalTabs; ///< Stores additional tabs loaded for this vehicle/autopilot configuration. Used for cleaning up. + QMap libParamToWidgetMap; ///< Holds the library parameter widgets + QMap > systemTypeToParamMap; ///< Holds all loaded MAV specific parameter widgets, for every MAV. QMap toolToBoxMap; ///< Easy method of figuring out which QGroupBox is tied to which ToolWidget. QMap paramTooltips; ///< Tooltips for the ? button next to a parameter. - + private: Ui::QGCVehicleConfig *ui; QMap buttonToWidgetMap; diff --git a/src/ui/QGCVehicleConfig.ui b/src/ui/QGCVehicleConfig.ui index 8365d3d170ad1d5492e7789d008e39e9353b54b6..21f0b19b86e4f52a7aee95a7b32ab4109edc2446 100644 --- a/src/ui/QGCVehicleConfig.ui +++ b/src/ui/QGCVehicleConfig.ui @@ -7,7 +7,7 @@ 0 0 1256 - 670 + 711 @@ -43,7 +43,7 @@ 0 0 133 - 650 + 691 @@ -114,6 +114,19 @@ Config + + + + Qt::Vertical + + + + 20 + 40 + + + + @@ -125,9 +138,9 @@ Config - 0 + 3 - + @@ -859,7 +872,7 @@ Config - + @@ -876,8 +889,8 @@ Config <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p></body></html> +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:8pt;"><br /></p></body></html> @@ -888,13 +901,13 @@ p, li { white-space: pre-wrap; } true - + 0 0 - 20 - 20 + 530 + 574 @@ -911,7 +924,7 @@ p, li { white-space: pre-wrap; } - + @@ -963,13 +976,13 @@ p, li { white-space: pre-wrap; } true - + 0 0 - 16 - 16 + 525 + 523 @@ -977,7 +990,7 @@ p, li { white-space: pre-wrap; } 0 - + @@ -1000,13 +1013,13 @@ p, li { white-space: pre-wrap; } true - + 0 0 - 16 - 16 + 524 + 523 @@ -1014,7 +1027,7 @@ p, li { white-space: pre-wrap; } 0 - + @@ -1027,7 +1040,7 @@ p, li { white-space: pre-wrap; } - + @@ -1079,13 +1092,13 @@ p, li { white-space: pre-wrap; } true - + 0 0 - 16 - 16 + 525 + 523 @@ -1093,7 +1106,7 @@ p, li { white-space: pre-wrap; } 0 - + @@ -1116,13 +1129,13 @@ p, li { white-space: pre-wrap; } true - + 0 0 - 16 - 16 + 524 + 523 @@ -1130,7 +1143,7 @@ p, li { white-space: pre-wrap; } 0 - + @@ -1154,6 +1167,19 @@ p, li { white-space: pre-wrap; } + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -1257,19 +1283,6 @@ p, li { white-space: pre-wrap; } - - - - Qt::Horizontal - - - - 40 - 20 - - - - diff --git a/src/ui/UASControl.ui b/src/ui/UASControl.ui index d9c5d898ec5b09efc0f80121de06c05040999977..70ad156a373273d0cf740c7df1e877e24c283821 100644 --- a/src/ui/UASControl.ui +++ b/src/ui/UASControl.ui @@ -112,7 +112,7 @@ Start - + :/files/images/control/launch.svg:/files/images/control/launch.svg @@ -135,7 +135,7 @@ Land - + :/files/images/control/land.svg:/files/images/control/land.svg @@ -158,7 +158,7 @@ Halt - + :/files/images/actions/system-log-out.svg:/files/images/actions/system-log-out.svg @@ -199,7 +199,7 @@ Set - + :/files/images/devices/network-wireless.svg:/files/images/devices/network-wireless.svg @@ -274,7 +274,7 @@ - + diff --git a/src/ui/UASList.ui b/src/ui/UASList.ui index d7976341b81957d9ab8f458b365f4f5087516058..6e85444fcbbf8cabe0796feea9fafa8a384b23c4 100644 --- a/src/ui/UASList.ui +++ b/src/ui/UASList.ui @@ -19,6 +19,14 @@ Form + + + 6 + + + 3 + + diff --git a/src/ui/UASView.ui b/src/ui/UASView.ui index 66f1b67f3d7d6075de8faf648d5d718511be0ba4..d7f60ca109daf2c7cf0abb94adbfcacd200df90d 100644 --- a/src/ui/UASView.ui +++ b/src/ui/UASView.ui @@ -7,7 +7,7 @@ 0 0 360 - 121 + 155 @@ -32,865 +32,595 @@ Form - QWidget#colorIcon {} - -QWidget { -background-color: #050508; -color: #DDDDDF; -background-clip: border; -font-size: 11px; -} - -QLabel { -background-color: transparent; -} - -QLabel#nameLabel { - font: bold 16px; - color: #3C7B9E; -} - -QLabel#modeLabel { - font: 12px; -} - -QLabel#stateLabel { - font: 12px; - color: #3C7B9E; -} - -QLabel#navLabel { - font: 12px; -} - -QLabel#positionLabel { - font: 8px; -} - -QLabel#timeElapsedLabel { - font: 8px; -} - -QLabel#groundDistanceLabel { - font: 8px; -} - -QLabel#speedLabel { - font: 8px; -} - -QLabel#timeRemainingLabel { - font: 8px; -} - -QLabel#waypointLabel { - font: 22px; -} - -QGroupBox { - border: 1px solid #4A4A4F; - border-radius: 10px; - padding: 0px 0px 0px 0px; - margin: 0px; -} - - QGroupBox::title { - subcontrol-origin: margin; - subcontrol-position: top center; /* position at the top center */ - margin: 0 3px 0px 3px; - padding: 0 3px 0px 0px; - font: bold 8px; - } - -QGroupBox#heartbeatIcon { - background-color: red; -} - -QToolButton#typeButton { - font-weight: bold; - font-size: 12px; - border: 0px solid #999999; - border-radius: 5px; - min-width:42px; - max-width: 42px; - min-height: 42px; - max-height: 42px; - padding: 0px; - margin: 0px; - background-color: none; -} - -QPushButton { - font-weight: bold; - font-size: 12px; - border: 1px solid #999999; - border-radius: 8px; - min-width: 20px; - max-width: 32px; - min-height: 16px; - max-height: 16px; - padding: 2px; - spacing: 10px; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #777777, stop: 1 #555555); -} - -QPushButton:pressed { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #444444, stop: 1 #555555); -} - -QPushButton#abortButton { - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #ffee01, stop:1 #ae8f00); -} - -QPushButton:pressed#abortButton { - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #bbaa00, stop:1 #a05b00); -} - -QPushButton#killButton { - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #ffb917, stop:1 #b37300); -} - -QPushButton:pressed#killButton { - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #bb8500, stop:1 #903000); -} - - -QProgressBar:horizontal { - border: 1px solid #4A4A4F; - border-radius: 4px; - text-align: center; - padding: 2px; - color: #111111; - background-color: #111118; -} - -QProgressBar:vertical { - border: 1px solid #4A4A4F; - border-radius: 4px; - text-align: center; - font-size: 7px; - padding: 2px; - color: #DDDDDF; - min-width: 16px; - background-color: #111118; -} - -QProgressBar:horizontal { - height: 10px; -} - -QProgressBar:horizontal QLabel { - font-size: 9px; - color: #111111; -} - -QProgressBar:vertical QLabel { - font-size: 7px; -} - -QProgressBar:vertical { - width: 14px; -} - -QProgressBar::chunk { - background-color: #656565; -} - -QProgressBar::chunk#batteryBar { - background-color: green; -} - -QProgressBar::chunk#speedBar { - background-color: yellow; -} - -QProgressBar::chunk#thrustBar { - background-color: orange; -} - -QToolTip { - background-color: #090909; - border: 1px solid #379AC3; - border-radius: 3px; - color: #DDDDDF; -} - -QMenu { - border: 1px solid #379AC3; -background-color: #050508; -color: #DDDDDF; -background-clip: border; -font-size: 11px; -} - -QMenu::separator { - height: 1px; - background: #379AC3; - margin-top: 8px; - margin-bottom: 4px; - margin-left: 5px; - margin-right: 5px; - } + - - - 2 - - - 2 - - - 2 - - - 2 - - - 0 + + + 5 - - - - 0 - 0 - + + + 0 - - - 0 - 0 - - - - - 16777215 - 130 - - - - + + + + 0 + + + + + System type + + + System type + + + System type + + + + + + :/files/images/mavs/unknown.svg + + + + + + + 0 + + + + + Heartbeat + + + + + + + + + + + 18 + 0 + + + + + 18 + 40 + + + + + + + Battery Fuel + + + Battery Fuel + + + 0 + + + false + + + Qt::Vertical + + + + + + + + + + + 2 + + + 0 + + + + + + 50 + false + false + + + + Current Waypoint + + + Current Waypoint + + + --- + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + 26 + 22 + + + + + 38 + 22 + + + + Liftoff / Launch + + + Liftoff / Launch + + + + + + + :/files/images/control/launch.svg:/files/images/control/launch.svg + + + + + + + + 0 + 0 + + + + + 26 + 22 + + + + + 38 + 22 + + + + Emergency land system at closest possible site + + + Emergency land system at closest possible site + + + + + + + :/files/images/actions/media-playback-stop.svg:/files/images/actions/media-playback-stop.svg + + + + + + + + 26 + 22 + + + + + 38 + 22 + + + + Loiter / Wait at current position + + + Loiter / Wait at current position + + + + + + + :/files/images/actions/media-playback-pause.svg:/files/images/actions/media-playback-pause.svg + + + + + + + + 26 + 22 + + + + + 38 + 22 + + + + Continue flightplan + + + Continue flightplan + + + + + + + :/files/images/actions/media-playback-start.svg:/files/images/actions/media-playback-start.svg + + + + + + + + 26 + 22 + + + + + 38 + 22 + + + + Fly straight to landing location + + + Fly straight to landing location + + + + + + + :/files/images/control/land.svg:/files/images/control/land.svg + + + + + + + + 26 + 22 + + + + + 38 + 22 + + + + Kill immediately all onboard power + + + Kill immediately all onboard power + + + + + + + :/files/images/actions/process-stop.svg:/files/images/actions/process-stop.svg + + + + + + + + 38 + 22 + + + + Only in standby mode: Power off system + + + Only in standby mode: Power off system + + + + + + + :/files/images/actions/system-log-out.svg:/files/images/actions/system-log-out.svg + + + + + + + 4 + + + QLayout::SetMinimumSize + + + + + + + + + + + + 16777215 + 16 + + + + + 75 + false + true + + + + System Name + + + System Name + + + UAS001 + + + + + + + + + + 50 + false + false + + + + Remaining flight time + + + Remaining flight time + + + 00:00:00 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 50 + false + false + + + + Uptime + + + Uptime + + + 00:00:00 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + 50 + false + false + + + + Altitude + + + Altitude + + + 00.00 m + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 50 + false + false + + + + Ground Speed + + + Ground Speed + + + 00.0 m/s + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + 16777215 + 12 + + + + + 50 + false + false + + + + STATE + + + + + + + + + + + + 16777215 + 16 + + + + + 50 + false + false + + + + MODE + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 0 + 12 + + + + + 16777215 + 12 + + + + + 50 + false + false + + + + Current Position + + + Current Position + + + 00.0 00.0 00.0 m + + + + + + + + + + Current throttle + + + Current throttle + + + 0 + + + throttle %p% + + + + + + + + 50 + false + false + + + + NAV + + + + + + + + + + + Waiting for first status update.. - - - 5 - - - 2 - - - 4 - - - - - - 42 - 42 - - - - - 42 - 42 - - - - - 30 - 30 - - - - System Type - - - System Type - - - ... - - - - :/files/images/mavs/unknown.svg:/files/images/mavs/unknown.svg - - - - 42 - 42 - - - - - - - - - 16777215 - 16 - - - - - -1 - 75 - false - true - - - - System Name - - - System Name - - - UAS001 - - - - - - - - 16777215 - 16 - - - - - -1 - 50 - false - false - - - - MODE - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - -1 - 50 - false - false - - - - Remaining flight time - - - Remaining flight time - - - 00:00:00 - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - -1 - 50 - false - false - - - - Uptime - - - Uptime - - - 00:00:00 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - -1 - - - - Current throttle - - - Current throttle - - - 0 - - - throttle %p% - - - - - - - - -1 - 50 - false - false - - - - Altitude - - - Altitude - - - 00.00 m - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - -1 - 50 - false - false - - - - Ground Speed - - - Ground Speed - - - 00.0 m/s - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 18 - 0 - - - - - 18 - 40 - - - - Heartbeat - - - Heartbeat - - - - - - - - - - - 18 - 0 - - - - - 18 - 40 - - - - - -1 - - - - Battery Fuel - - - Battery Fuel - - - 0 - - - Qt::Vertical - - - - - - - - -1 - 50 - false - false - - - - Current Waypoint - - - Current Waypoint - - - --- - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - - 0 - 12 - - - - - 16777215 - 12 - - - - - -1 - 50 - false - false - - - - Current Position - - - Current Position - - - 00.0 00.0 00.0 m - - - - - - - 4 - - - QLayout::SetMinimumSize - - - - - - 26 - 22 - - - - - 38 - 22 - - - - Liftoff / Launch - - - Liftoff / Launch - - - - - - - :/files/images/control/launch.svg:/files/images/control/launch.svg - - - - - - - - 26 - 22 - - - - - 38 - 22 - - - - Loiter / Wait at current position - - - Loiter / Wait at current position - - - - - - - :/files/images/actions/media-playback-pause.svg:/files/images/actions/media-playback-pause.svg - - - - - - - - 26 - 22 - - - - - 38 - 22 - - - - Continue flightplan - - - Continue flightplan - - - - - - - :/files/images/actions/media-playback-start.svg:/files/images/actions/media-playback-start.svg - - - - - - - - 26 - 22 - - - - - 38 - 22 - - - - Fly straight to landing location - - - Fly straight to landing location - - - - - - - :/files/images/control/land.svg:/files/images/control/land.svg - - - - - - - - 38 - 22 - - - - Only in standby mode: Power off system - - - Only in standby mode: Power off system - - - - - - - :/files/images/actions/system-log-out.svg:/files/images/actions/system-log-out.svg - - - - - - - - 0 - 0 - - - - - 26 - 22 - - - - - 38 - 22 - - - - Emergency land system at closest possible site - - - Emergency land system at closest possible site - - - - - - - :/files/images/actions/media-playback-stop.svg:/files/images/actions/media-playback-stop.svg - - - - - - - - 26 - 22 - - - - - 38 - 22 - - - - Kill immediately all onboard power - - - Kill immediately all onboard power - - - - - - - :/files/images/actions/process-stop.svg:/files/images/actions/process-stop.svg - - - - - - - - - Waiting for first status update.. - - - - - - - - 16777215 - 12 - - - - - -1 - 50 - false - false - - - - STATE - - - - - - - - -1 - 50 - false - false - - - - NAV - - - - - - - Qt::Horizontal - - - - 8 - 20 - - - - - - + diff --git a/src/ui/UnconnectedUASInfoWidget.cc b/src/ui/UnconnectedUASInfoWidget.cc deleted file mode 100644 index 84b8e5ae1afc844e95320d4f24ce0e717827be49..0000000000000000000000000000000000000000 --- a/src/ui/UnconnectedUASInfoWidget.cc +++ /dev/null @@ -1,14 +0,0 @@ -#include "UnconnectedUASInfoWidget.h" -#include "ui_UnconnectedUASInfoWidget.h" - -UnconnectedUASInfoWidget::UnconnectedUASInfoWidget(QWidget *parent) : - QGroupBox(parent), - ui(new Ui::UnconnectedUASInfoWidget) -{ - ui->setupUi(this); -} - -UnconnectedUASInfoWidget::~UnconnectedUASInfoWidget() -{ - delete ui; -} diff --git a/src/ui/UnconnectedUASInfoWidget.h b/src/ui/UnconnectedUASInfoWidget.h deleted file mode 100644 index ea349f85790f126ad526313e9c490fc63af3dbe6..0000000000000000000000000000000000000000 --- a/src/ui/UnconnectedUASInfoWidget.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef UNCONNECTEDUASINFOWIDGET_H -#define UNCONNECTEDUASINFOWIDGET_H - -#include - -namespace Ui { - class UnconnectedUASInfoWidget; -} - -class UnconnectedUASInfoWidget : public QGroupBox -{ - Q_OBJECT - -public: - explicit UnconnectedUASInfoWidget(QWidget *parent = 0); - ~UnconnectedUASInfoWidget(); - -private: - Ui::UnconnectedUASInfoWidget *ui; -}; - -#endif // UNCONNECTEDUASINFOWIDGET_H diff --git a/src/ui/UnconnectedUASInfoWidget.ui b/src/ui/UnconnectedUASInfoWidget.ui deleted file mode 100644 index b87164620b55abc7709a3c236a25121bd5e13e4d..0000000000000000000000000000000000000000 --- a/src/ui/UnconnectedUASInfoWidget.ui +++ /dev/null @@ -1,59 +0,0 @@ - - - UnconnectedUASInfoWidget - - - - 0 - 0 - 279 - 114 - - - - - - - border:0; - - - - - - - - - 0 - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - QTextEdit::AutoAll - - - false - - - true - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> -<table border="0" style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;"> -<tr> -<td style="border: none;"> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:20pt; font-weight:600; color:#b5b5b5;">NO UAV</span></p></td></tr></table></body></html> - - - - - - - - diff --git a/src/ui/WaypointEditableView.cc b/src/ui/WaypointEditableView.cc index b0b0934cad3bdcd56324892fb298a0b48862570d..602f4e04a37b1beaf2b3313ce82a30a5aeee66ca 100644 --- a/src/ui/WaypointEditableView.cc +++ b/src/ui/WaypointEditableView.cc @@ -20,7 +20,7 @@ #include "WaypointEditableView.h" #include "ui_WaypointEditableView.h" - +#include "MainWindow.h" #include "mission/QGCMissionNavWaypoint.h" #include "mission/QGCMissionNavLoiterUnlim.h" #include "mission/QGCMissionNavLoiterTurns.h" @@ -61,7 +61,7 @@ WaypointEditableView::WaypointEditableView(Waypoint* wp, QWidget* parent) : MissionNavTakeoffWidget = NULL; MissionNavSweepWidget = NULL; MissionConditionDelayWidget = NULL; - MissionDoJumpWidget = NULL; + MissionDoJumpWidget = NULL; MissionDoStartSearchWidget = NULL; MissionDoFinishSearchWidget = NULL; MissionOtherWidget = NULL; @@ -78,7 +78,7 @@ WaypointEditableView::WaypointEditableView(Waypoint* wp, QWidget* parent) : //m_ui->comboBox_action->addItem(tr("NAV: Target"),MAV_CMD_NAV_TARGET); m_ui->comboBox_action->addItem(tr("IF: Delay over"),MAV_CMD_CONDITION_DELAY); //m_ui->comboBox_action->addItem(tr("IF: Yaw angle is"),MAV_CMD_CONDITION_YAW); - m_ui->comboBox_action->addItem(tr("DO: Jump to Index"),MAV_CMD_DO_JUMP); + m_ui->comboBox_action->addItem(tr("DO: Jump to Index"),MAV_CMD_DO_JUMP); #ifdef MAVLINK_ENABLED_PIXHAWK m_ui->comboBox_action->addItem(tr("NAV: Sweep"),MAV_CMD_NAV_SWEEP); m_ui->comboBox_action->addItem(tr("Do: Start Search"),MAV_CMD_DO_START_SEARCH); @@ -141,7 +141,7 @@ void WaypointEditableView::changedAutoContinue(int state) } void WaypointEditableView::updateActionView(int action) -{ +{ //Hide all if(MissionNavWaypointWidget) MissionNavWaypointWidget->hide(); if(MissionNavLoiterUnlimWidget) MissionNavLoiterUnlimWidget->hide(); @@ -349,25 +349,25 @@ void WaypointEditableView::changedFrame(int index) } void WaypointEditableView::changedCurrent(int state) -{ +{ if (state == 0) { if (wp->getCurrent() == true) //User clicked on the waypoint, that is already current - { + { m_ui->selectedBox->setChecked(true); m_ui->selectedBox->setCheckState(Qt::Checked); } else - { + { m_ui->selectedBox->setChecked(false); - m_ui->selectedBox->setCheckState(Qt::Unchecked); + m_ui->selectedBox->setCheckState(Qt::Unchecked); } } else - { + { wp->setCurrent(true); emit changeCurrentWaypoint(wp->getId()); //the slot changeCurrentWaypoint() in WaypointList sets all other current flags to false - } + } } void WaypointEditableView::updateValues() @@ -449,7 +449,7 @@ void WaypointEditableView::updateValues() MAV_FRAME frame = wp->getFrame(); int frame_index = m_ui->comboBox_frame->findData(frame); if (m_ui->comboBox_frame->currentIndex() != frame_index) { - m_ui->comboBox_frame->setCurrentIndex(frame_index); + m_ui->comboBox_frame->setCurrentIndex(frame_index); } // Update action @@ -488,41 +488,22 @@ void WaypointEditableView::updateValues() { m_ui->autoContinue->setChecked(wp->getAutoContinue()); } - m_ui->idLabel->setText(QString("%1").arg(wp->getId())); + m_ui->idLabel->setText(QString::number(wp->getId())); - - QColor backGroundColor = QGC::colorBackground; - + // Style alternating rows of Missions as lighter/darker. static int lastId = -1; int currId = wp->getId() % 2; - if (currId != lastId) { - - // qDebug() << "COLOR ID: " << currId; if (currId == 1) { - //backGroundColor = backGroundColor.lighter(150); - backGroundColor = QColor("#252528").lighter(150); + this->setProperty("RowColoring", "odd"); } else { - backGroundColor = QColor("#252528").lighter(250); + this->setProperty("RowColoring", "even"); } - // qDebug() << "COLOR:" << backGroundColor.name(); - - // Update color based on id - QString groupBoxStyle = QString("QGroupBox {padding: 0px; margin: 0px; border: 0px; background-color: %1; }").arg(backGroundColor.name()); - QString labelStyle = QString("QWidget {background-color: %1; color: #DDDDDF; border-color: #EEEEEE; }").arg(backGroundColor.name()); - QString checkBoxStyle = QString("QCheckBox {background-color: %1; color: #454545; border-color: #EEEEEE; }").arg(backGroundColor.name()); - QString widgetSlotStyle = QString("QWidget {background-color: %1; color: #DDDDDF; border-color: #EEEEEE; } QSpinBox {background-color: #252528 } QDoubleSpinBox {background-color: #252528 } QComboBox {background-color: #252528 }").arg(backGroundColor.name()); //FIXME There should be a way to declare background color for widgetSlot without letting the children inherit this color. Here, background color for every widget-type (QSpinBox, etc.) has to be declared separately to overrule the coloring of QWidget. - - m_ui->autoContinue->setStyleSheet(checkBoxStyle); - m_ui->selectedBox->setStyleSheet(checkBoxStyle); - m_ui->idLabel->setStyleSheet(labelStyle); - m_ui->groupBox->setStyleSheet(groupBoxStyle); - m_ui->customActionWidget->setStyleSheet(widgetSlotStyle); lastId = currId; } @@ -651,3 +632,14 @@ void WaypointEditableView::changeEvent(QEvent *e) break; } } + +/** + * Implement paintEvent() so that stylesheets work for our custom widget. + */ +void WaypointEditableView::paintEvent(QPaintEvent *) + { + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + } diff --git a/src/ui/WaypointEditableView.h b/src/ui/WaypointEditableView.h index 4977a4cd55bd115bc5e615426987a09c4279d193..fb1916ec418aaf18c0469d8361ab69c5ed16bbe0 100644 --- a/src/ui/WaypointEditableView.h +++ b/src/ui/WaypointEditableView.h @@ -77,7 +77,7 @@ public slots: void remove(); /** @brief Waypoint matching this widget has been deleted */ void deleted(QObject* waypoint); - void changedAutoContinue(int); + void changedAutoContinue(int); void changedFrame(int state); void updateActionView(int action); void initializeActionView(int action); @@ -98,6 +98,7 @@ protected slots: protected: virtual void changeEvent(QEvent *e); + virtual void paintEvent(QPaintEvent *); Waypoint* wp; QGC_WAYPOINTEDITABLEVIEW_MODE viewMode; // Widgets for every mission element @@ -122,7 +123,7 @@ private: signals: void moveUpWaypoint(Waypoint*); void moveDownWaypoint(Waypoint*); - void removeWaypoint(Waypoint*); + void removeWaypoint(Waypoint*); void changeCurrentWaypoint(quint16); void setYaw(double); diff --git a/src/ui/WaypointEditableView.ui b/src/ui/WaypointEditableView.ui index 9ea57c58eada889338f64b91638bf679cb05c136..07a8784df7ba2b5634ec734fc1c48e65a372bbfa 100644 --- a/src/ui/WaypointEditableView.ui +++ b/src/ui/WaypointEditableView.ui @@ -6,8 +6,8 @@ 0 0 - 2208 - 37 + 585 + 45 @@ -26,329 +26,250 @@ Form - QWidget#colorIcon {} - -QWidget { -background-color: #252528; -color: #DDDDDF; -border-color: #CCCCCF; -} - -QCheckBox { -background-color: #252528; -color: #454545; -} - -QGroupBox { - border: 1px solid #EEEEEE; - border-radius: 5px; - padding: 0px 0px 0px 0px; - margin: 0px; -} - - QGroupBox::title { - subcontrol-origin: margin; - subcontrol-position: top center; /* position at the top center */ - margin: 0 3px 0px 3px; - padding: 0 3px 0px 0px; - font: bold 8px; - } - -QPushButton { - font-weight: bold; - font-size: 12px; - border: 1px solid #465158; - margin: 1px; - border-radius: 2px; - min-width:16px; - max-width: 16px; - min-height: 16px; - max-height: 16px; - padding: 2px; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #59666f, stop: 1 #414B52); -} - -QPushButton:pressed { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #09A2B2, stop: 1 #414B52); -} - + - - - 0 - + - 0 + 6 + + + 6 - - + + + + + 0 + 0 + + + + + 25 + 0 + + + + Waypoint Sequence Number + + + ID + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 20 + 0 + + + + Qt::TabFocus + + + Mission Start + + + Mission Start + + + + + + + 16 + 16 + + + + + + + + + 0 + 0 + + + + + 100 + 16777215 + + + + Coordinate frame + + + Coordinate frame + + + QComboBox::AdjustToContentsOnFirstShow + + + + + + + + 0 + 0 + + + + + 120 + 16777215 + + + + Action at Waypoint + + + Action at Waypoint + + + QComboBox::AdjustToContentsOnFirstShow + + + + + 0 0 - + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + Automatically continue after this waypoint + + + Automatically continue after this waypoint + + + + + + + + + + + 0 + 0 + + + + + 24 + 24 + + + + Qt::NoFocus + + + Move Up in List + + + Move Up in List + + - - - 2 - - - 4 - - - - - - 0 - 0 - - - - - 20 - 0 - - - - Qt::TabFocus - - - Mission Start - - - Mission Start - - - - - - - 16 - 16 - - - - - - - - - 0 - 0 - - - - - 25 - 0 - - - - Waypoint Sequence Number - - - ID - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 120 - 16777215 - - - - Action at Waypoint - - - Action at Waypoint - - - QComboBox::AdjustToContentsOnFirstShow - - - - - - - - 0 - 0 - - - - - 100 - 16777215 - - - - Coordinate frame - - - Coordinate frame - - - QComboBox::AdjustToContentsOnFirstShow - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - - - - Qt::Horizontal - - - - 5 - 10 - - - - - - - - - 0 - 0 - - - - Automatically continue after this waypoint - - - Automatically continue after this waypoint - - - - - - - - - - - 0 - 0 - - - - - 24 - 24 - - - - Qt::NoFocus - - - Move Up in List - - - Move Up in List - - - - - - - :/files/images/actions/go-up.svg:/files/images/actions/go-up.svg - - - - - - - - 0 - 0 - - - - - 24 - 24 - - - - Qt::NoFocus - - - Move Down in List - - - Move Down in List - - - - - - - :/files/images/actions/go-down.svg:/files/images/actions/go-down.svg - - - - - - - - 0 - 0 - - - - - 24 - 24 - - - - Qt::NoFocus - - - Delete - - - - - - - :/files/images/actions/list-remove.svg:/files/images/actions/list-remove.svg - - - - + + + :/files/images/actions/go-up.svg:/files/images/actions/go-up.svg + + + + + + + + 0 + 0 + + + + + 24 + 24 + + + + Qt::NoFocus + + + Move Down in List + + + Move Down in List + + + + + + + :/files/images/actions/go-down.svg:/files/images/actions/go-down.svg + + + + + + + + 0 + 0 + + + + + 24 + 24 + + + + Qt::NoFocus + + + Delete + + + + + + + :/files/images/actions/list-remove.svg:/files/images/actions/list-remove.svg + diff --git a/src/ui/WaypointList.cc b/src/ui/WaypointList.cc index d1283ff3931cc651ea317b809cf78d306409377a..54416fc794bea948fe6d7e0393a88fb9791e76a8 100644 --- a/src/ui/WaypointList.cc +++ b/src/ui/WaypointList.cc @@ -40,6 +40,7 @@ This file is part of the PIXHAWK project #include #include #include +#include WaypointList::WaypointList(QWidget *parent, UASWaypointManager* wpm) : QWidget(parent), @@ -102,14 +103,21 @@ WaypointList::WaypointList(QWidget *parent, UASWaypointManager* wpm) : // SET UAS AFTER ALL SIGNALS/SLOTS ARE CONNECTED if (!WPM->getUAS()) { - // Hide buttons, which don't make sense without valid UAS - m_ui->positionAddButton->hide(); - m_ui->transmitButton->hide(); - m_ui->readButton->hide(); - m_ui->refreshButton->hide(); + // Disable buttons which don't make sense without valid UAS. + m_ui->positionAddButton->setEnabled(false); + m_ui->transmitButton->setEnabled(false); + m_ui->readButton->setEnabled(false); + m_ui->refreshButton->setEnabled(false); + //FIXME: The whole "Onboard Waypoints"-tab should be hidden, instead of "refresh" button - UnconnectedUASInfoWidget* inf = new UnconnectedUASInfoWidget(this); - viewOnlyListLayout->insertWidget(0, inf); //insert a "NO UAV" info into the Onboard Tab + // Insert a "NO UAV" info into the Onboard Tab + QLabel* noUas = new QLabel(this); + noUas->setObjectName("noUas"); + noUas->setText("NO UAS"); + noUas->setEnabled(false); + noUas->setAlignment(Qt::AlignCenter); + viewOnlyListLayout->insertWidget(0, noUas); + showOfflineWarning = true; } else { setUAS(static_cast(WPM->getUAS())); @@ -183,6 +191,12 @@ void WaypointList::setUAS(UASInterface* uas) disconnect(this->uas, SIGNAL(attitudeChanged(UASInterface*,double,double,double,quint64)), this, SLOT(updateAttitude(UASInterface*,double,double,double,quint64))); } + // Now that there's a valid UAS, enable the UI. + m_ui->positionAddButton->setEnabled(true); + m_ui->transmitButton->setEnabled(true); + m_ui->readButton->setEnabled(true); + m_ui->refreshButton->setEnabled(true); + WPM = uas->getWaypointManager(); this->uas = uas; diff --git a/src/ui/WaypointList.h b/src/ui/WaypointList.h index 2871105c02cc4b8d73e6c6bbe1087802dcb2a746..f5d39cb67665634e4c410c68c4f3d5952f19ce16 100644 --- a/src/ui/WaypointList.h +++ b/src/ui/WaypointList.h @@ -42,9 +42,6 @@ This file is part of the QGROUNDCONTROL project #include "UASInterface.h" #include "WaypointEditableView.h" #include "WaypointViewOnlyView.h" -#include "UnconnectedUASInfoWidget.h" -//#include "PopupMessage.h" - namespace Ui { diff --git a/src/ui/WaypointList.ui b/src/ui/WaypointList.ui index b4a5fb11b3b83e0a6c1ba5de3ec5fd92743dbc2d..e89079886e17a98a3b7b0a0576fb8dbf719e093d 100644 --- a/src/ui/WaypointList.ui +++ b/src/ui/WaypointList.ui @@ -37,6 +37,9 @@ + + true + 0 @@ -60,51 +63,23 @@ 6 - - - - true - - - - - 0 - 0 - 836 - 316 - - - - - - - Waypoint list. The list is empty until you issue a read command or add waypoints. - - - Waypoint list. The list is empty until you issue a read command or add waypoints. - - - Waypoint list. The list is empty until you issue a read command or add waypoints. - - - - - - - - - + + - Save waypoints to a file on the local harddisk. Does not save them on the MAV. + Add a new waypoint to this list. Transmit via write to the MAV. - Save waypoints to a file on the local harddisk. Does not save them on the MAV. + Add a new waypoint to this list. Transmit via write to the MAV. - Save waypoints to a file on the local harddisk. Does not save them on the MAV. + Add a new waypoint to this list. Transmit via write to the MAV. - Save WPs + ... + + + + :/files/images/actions/list-add.svg:/files/images/actions/list-add.svg @@ -137,68 +112,75 @@ - - + + - Set the current vehicle position as new waypoint + Save waypoints to a file on the local harddisk. Does not save them on the MAV. - Set the current vehicle position as new waypoint + Save waypoints to a file on the local harddisk. Does not save them on the MAV. - Set the current vehicle position as new waypoint + Save waypoints to a file on the local harddisk. Does not save them on the MAV. - ... - - - - :/files/images/actions/go-bottom.svg:/files/images/actions/go-bottom.svg + Save WPs - - + + - Add a new waypoint to this list. Transmit via write to the MAV. + The current waypoint transmission status - Add a new waypoint to this list. Transmit via write to the MAV. + The current waypoint transmission status - Add a new waypoint to this list. Transmit via write to the MAV. + The current waypoint transmission status - ... - - - - :/files/images/actions/list-add.svg:/files/images/actions/list-add.svg + Please add first waypoint. - - - - Delete all waypoints from this list. You have to click write to clear the list on the MAV as well. - - - Delete all waypoints from this list. You have to click write to clear the list on the MAV as well. - - - Delete all waypoints from this list. You have to click write to clear the list on the MAV as well. - - - ... - - - - :/files/images/actions/process-stop.svg:/files/images/actions/process-stop.svg + + + + true + + + + 0 + 0 + 836 + 316 + + + + + + + Waypoint list. The list is empty until you issue a read command or add waypoints. + + + Waypoint list. The list is empty until you issue a read command or add waypoints. + + + Waypoint list. The list is empty until you issue a read command or add waypoints. + + + + + - + + + false + Read all waypoints from the MAV. Clears the list on this computer. @@ -217,8 +199,11 @@ - + + + false + Transmit all waypoints on this list to the MAV. @@ -237,19 +222,46 @@ - - + + - The current waypoint transmission status + Delete all waypoints from this list. You have to click write to clear the list on the MAV as well. - The current waypoint transmission status + Delete all waypoints from this list. You have to click write to clear the list on the MAV as well. - The current waypoint transmission status + Delete all waypoints from this list. You have to click write to clear the list on the MAV as well. - Please add first waypoint. + ... + + + + :/files/images/actions/process-stop.svg:/files/images/actions/process-stop.svg + + + + + + + false + + + Set the current vehicle position as new waypoint + + + Set the current vehicle position as new waypoint + + + Set the current vehicle position as new waypoint + + + ... + + + + :/files/images/actions/go-bottom.svg:/files/images/actions/go-bottom.svg @@ -329,6 +341,9 @@ + + false + Read all waypoints from the MAV and display in View tab.. diff --git a/src/ui/WaypointViewOnlyView.cc b/src/ui/WaypointViewOnlyView.cc index 3ae64851bcdf5a1535475521546867e0896f531c..8688b3fa2e0402ffcf0506fbb75c8174d8ace0aa 100644 --- a/src/ui/WaypointViewOnlyView.cc +++ b/src/ui/WaypointViewOnlyView.cc @@ -1,4 +1,6 @@ #include + +#include "MainWindow.h" #include "WaypointViewOnlyView.h" #include "ui_WaypointViewOnlyView.h" @@ -15,13 +17,13 @@ WaypointViewOnlyView::WaypointViewOnlyView(Waypoint* wp, QWidget *parent) : } void WaypointViewOnlyView::changedAutoContinue(int state) -{ +{ bool new_value = false; if (state != 0) { new_value = true; } - wp->setAutocontinue(new_value); + wp->setAutocontinue(new_value); emit changeAutoContinue(wp->getId(),new_value); } @@ -30,7 +32,7 @@ void WaypointViewOnlyView::changedCurrent(int state) { Q_UNUSED(state); //qDebug() << "Trof: WaypointViewOnlyView::changedCurrent(" << state << ") ID:" << wp->getId(); - m_ui->current->blockSignals(true); + m_ui->current->blockSignals(true); if (m_ui->current->isChecked() == false) { @@ -47,7 +49,6 @@ void WaypointViewOnlyView::changedCurrent(int state) } else { - hightlightDesiredCurrent(true); m_ui->current->setCheckState(Qt::Unchecked); //qDebug() << "Trof: WaypointViewOnlyView::changedCurrent. Checked new. Sending set_current request to Manager " << m_ui->current->isChecked(); emit changeCurrentWaypoint(wp->getId()); //the slot changeCurrentWaypoint() in WaypointList sets all other current flags to false @@ -59,17 +60,15 @@ void WaypointViewOnlyView::changedCurrent(int state) void WaypointViewOnlyView::setCurrent(bool state) //This is a slot receiving signals from UASWaypointManager. The state given here is the true representation of what the "current" waypoint on UAV is. { - m_ui->current->blockSignals(true); + m_ui->current->blockSignals(true); if (state == true) { wp->setCurrent(true); - hightlightDesiredCurrent(true); m_ui->current->setCheckState(Qt::Checked); } else { wp->setCurrent(false); - hightlightDesiredCurrent(false); m_ui->current->setCheckState(Qt::Unchecked); } m_ui->current->blockSignals(false); @@ -77,7 +76,6 @@ void WaypointViewOnlyView::setCurrent(bool state) void WaypointViewOnlyView::updateValues() { - qDebug() << "Trof: WaypointViewOnlyView::updateValues() ID:" << wp->getId(); // Check if we just lost the wp, delete the widget // accordingly if (!wp) @@ -86,37 +84,20 @@ void WaypointViewOnlyView::updateValues() return; } - // Update style - - QColor backGroundColor = QGC::colorBackground; - + // Style alternating rows of Missions as lighter/darker. static int lastId = -1; int currId = wp->getId() % 2; - if (currId != lastId) { - - // qDebug() << "COLOR ID: " << currId; if (currId == 1) { - backGroundColor = QColor("#252528").lighter(150); + this->setProperty("RowColoring", "odd"); } else { - backGroundColor = QColor("#252528").lighter(250); + this->setProperty("RowColoring", "even"); } - // Update color based on id - QString groupBoxStyle = QString("QGroupBox {padding: 0px; margin: 0px; border: 0px; background-color: %1; min-height: 12px; }").arg(backGroundColor.name()); - QString labelStyle = QString("QWidget {background-color: %1; color: #DDDDDF; border-color: #EEEEEE; }").arg(backGroundColor.name()); - QString displayBarStyle = QString("QWidget {background-color: %1; color: #DDDDDF; border: none; }").arg(backGroundColor.name()); - QString checkBoxStyle = QString("QCheckBox {background-color: %1; color: #454545; border-color: #EEEEEE; }").arg(backGroundColor.name()); - - m_ui->autoContinue->setStyleSheet(checkBoxStyle); - m_ui->current->setStyleSheet(checkBoxStyle); - m_ui->idLabel->setStyleSheet(labelStyle); - m_ui->displayBar->setStyleSheet(displayBarStyle); - m_ui->groupBox->setStyleSheet(groupBoxStyle); lastId = currId; } @@ -157,11 +138,10 @@ void WaypointViewOnlyView::updateValues() } } - hightlightDesiredCurrent(wp->getCurrent()); if (m_ui->current->isChecked() != wp->getCurrent()) { m_ui->current->blockSignals(true); - m_ui->current->setChecked(wp->getCurrent()); + m_ui->current->setChecked(wp->getCurrent()); m_ui->current->blockSignals(false); } if (m_ui->autoContinue->isChecked() != wp->getAutoContinue()) @@ -311,7 +291,7 @@ void WaypointViewOnlyView::updateValues() break; } case MAV_CMD_NAV_LAND: - { + { switch (wp->getFrame()) { case MAV_FRAME_GLOBAL_RELATIVE_ALT: @@ -330,7 +310,7 @@ void WaypointViewOnlyView::updateValues() break; } case MAV_CMD_NAV_TAKEOFF: - { + { switch (wp->getFrame()) { case MAV_FRAME_GLOBAL_RELATIVE_ALT: @@ -405,31 +385,29 @@ void WaypointViewOnlyView::updateValues() } } -void WaypointViewOnlyView::hightlightDesiredCurrent(bool hightlight_on) +WaypointViewOnlyView::~WaypointViewOnlyView() { - QColor backGroundColor = QGC::colorBackground; - QString checkBoxStyle; - if (wp->getId() % 2 == 1) - { - backGroundColor = QColor("#252528").lighter(150); - } - else - { - backGroundColor = QColor("#252528").lighter(250); - } - - if (hightlight_on) - { - checkBoxStyle = QString("QCheckBox {background-color: %1; color: #454545; border-color: #EEEEEE; } QCheckBox::indicator { border-color: #FFFFFF}").arg(backGroundColor.name()); - } - else - { - checkBoxStyle = QString("QCheckBox {background-color: %1; color: #454545; border-color: #EEEEEE; } QCheckBox::indicator { border-color: QGC::colorBackground}").arg(backGroundColor.name()); - } - m_ui->current->setStyleSheet(checkBoxStyle); + delete m_ui; } -WaypointViewOnlyView::~WaypointViewOnlyView() +void WaypointViewOnlyView::changeEvent(QEvent *e) { - delete m_ui; + switch (e->type()) { + case QEvent::LanguageChange: + m_ui->retranslateUi(this); + break; + default: + break; + } } + +/** + * Implement paintEvent() so that stylesheets work for our custom widget. + */ +void WaypointViewOnlyView::paintEvent(QPaintEvent *) + { + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + } diff --git a/src/ui/WaypointViewOnlyView.h b/src/ui/WaypointViewOnlyView.h index 81f3e9a0294409f00c5d840b451b614cce7d40b3..c50056541cb21a7584e822d985058f00da145d3b 100644 --- a/src/ui/WaypointViewOnlyView.h +++ b/src/ui/WaypointViewOnlyView.h @@ -18,20 +18,21 @@ public: ~WaypointViewOnlyView(); public slots: -void changedCurrent(int state); -void changedAutoContinue(int state); -void updateValues(void); -void setCurrent(bool state); + void changedCurrent(int state); + void changedAutoContinue(int state); + void updateValues(void); + void setCurrent(bool state); signals: void changeCurrentWaypoint(quint16); void changeAutoContinue(quint16, bool); protected: -Waypoint* wp; + Waypoint* wp; + virtual void changeEvent(QEvent *e); + virtual void paintEvent(QPaintEvent *); private: - void hightlightDesiredCurrent(bool hightlight_on); Ui::WaypointViewOnlyView *m_ui; }; diff --git a/src/ui/WaypointViewOnlyView.ui b/src/ui/WaypointViewOnlyView.ui index df46423fc6e9b4503eb28daf8b92345811264c37..99b5c70e1d719df7049c98eb20e9631a4fe73b26 100644 --- a/src/ui/WaypointViewOnlyView.ui +++ b/src/ui/WaypointViewOnlyView.ui @@ -26,610 +26,541 @@ Form - QGroupBox { - border: 1px solid #EEEEEE; - border-radius: 5px; - padding: 0px 0px 0px 0px; -margin-top: 1ex; /* leave space at the top for the title */ - margin: 0px; -} - - QGroupBox::title { - subcontrol-origin: margin; - subcontrol-position: top center; /* position at the top center */ - margin: 0 3px 0px 3px; - padding: 0 3px 0px 0px; - font: bold 8px; - } + - + - 0 + 6 - - 0 - - - - - true + + + + + 0 + 0 + + + + + 25 + 0 + + + + 1 + + + ID + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 25 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 255 + 0 + + + + + + + 0 + 212 + 0 + + + + + + + 0 + 85 + 0 + + + + + + + 0 + 113 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 127 + 212 + 127 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 255 + 0 + + + + + + + 0 + 212 + 0 + + + + + + + 0 + 85 + 0 + + + + + + + 0 + 113 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 127 + 212 + 127 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 85 + 0 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 255 + 0 + + + + + + + 0 + 212 + 0 + + + + + + + 0 + 85 + 0 + + + + + + + 0 + 113 + 0 + + + + + + + 0 + 85 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 85 + 0 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 170 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + 0 + 170 + 0 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + Currently executed waypoint + + + Currently executed waypoint + + + + + + + 0 0 - - + + Mission element description - + + Mission element description + + + + Mission element description + + + + + + + Coordinate Frame + + + Coordinate Frame + + + + + + Frame + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - + + + + + false + + + 0 + 0 + + + + Automatically continue after this waypoint + + + Automatically continue after this waypoint + + + + - false + true - - - 2 - - - 4 - - - - - - 0 - 0 - - - - - 25 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 255 - 0 - - - - - - - 0 - 212 - 0 - - - - - - - 0 - 85 - 0 - - - - - - - 0 - 113 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 127 - 212 - 127 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 255 - 0 - - - - - - - 0 - 212 - 0 - - - - - - - 0 - 85 - 0 - - - - - - - 0 - 113 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 127 - 212 - 127 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 85 - 0 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 255 - 0 - - - - - - - 0 - 212 - 0 - - - - - - - 0 - 85 - 0 - - - - - - - 0 - 113 - 0 - - - - - - - 0 - 85 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 85 - 0 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 170 - 0 - - - - - - - 0 - 0 - 0 - - - - - - - 0 - 170 - 0 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - Currently executed waypoint - - - Currently executed waypoint - - - - - - - - - - - 0 - 0 - - - - - 25 - 0 - - - - 1 - - - ID - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - Mission element description - - - Mission element description - - - - - - Mission element description - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 79 - 17 - - - - - - - - Coordinate Frame - - - Coordinate Frame - - - - - - Frame - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - false - - - - 0 - 0 - - - - Automatically continue after this waypoint - - - Automatically continue after this waypoint - - - - - - true - - - - diff --git a/src/ui/designer/QGCComboBox.cc b/src/ui/designer/QGCComboBox.cc index bcd0d65f944354c11a5b4bc23e6135fc555d8335..21d86f67954059323952d6038c11c023e9f5130b 100644 --- a/src/ui/designer/QGCComboBox.cc +++ b/src/ui/designer/QGCComboBox.cc @@ -42,8 +42,6 @@ QGCComboBox::QGCComboBox(QWidget *parent) : ui->infoLabel->hide(); ui->editOptionComboBox->setEnabled(false); isDisabled = true; - //ui->editLine1->setStyleSheet("QWidget { border: 1px solid #66666B; border-radius: 3px; padding: 10px 0px 0px 0px; background: #111122; }"); - // ui->editLine2->setStyleSheet("QWidget { border: 1px solid #66666B; border-radius: 3px; padding: 10px 0px 0px 0px; background: #111122; }"); connect(ui->editDoneButton, SIGNAL(clicked()), this, SLOT(endEditMode())); connect(ui->editOptionComboBox,SIGNAL(currentIndexChanged(QString)),this,SLOT(comboBoxIndexChanged(QString))); connect(ui->editAddItemButton,SIGNAL(clicked()),this,SLOT(addButtonClicked())); diff --git a/src/ui/designer/QGCCommandButton.cc b/src/ui/designer/QGCCommandButton.cc index c42e46ebdad8d6b59f98a28cc905fad3b159750d..24bdc7d37e3fa9b1ba73e6e80a5b32b2ea29aae2 100644 --- a/src/ui/designer/QGCCommandButton.cc +++ b/src/ui/designer/QGCCommandButton.cc @@ -36,9 +36,6 @@ QGCCommandButton::QGCCommandButton(QWidget *parent) : ui->editLine1->hide(); ui->editLine2->hide(); - ui->editLine1->setStyleSheet("QWidget { border: 1px solid #66666B; border-radius: 3px; padding: 10px 0px 0px 0px; background: #111122; }"); - ui->editLine2->setStyleSheet("QWidget { border: 1px solid #66666B; border-radius: 3px; padding: 10px 0px 0px 0px; background: #111122; }"); - // Add commands to combo box ui->editCommandComboBox->addItem("CUSTOM 0", 0); ui->editCommandComboBox->addItem("CUSTOM 1", 1); @@ -185,7 +182,6 @@ void QGCCommandButton::startEditMode() ui->editParam7SpinBox->show(); ui->editLine1->show(); ui->editLine2->show(); - //setStyleSheet("QGroupBox { border: 1px solid #66666B; border-radius: 3px; padding: 10px 0px 0px 0px; background: #111122; }"); // Attempt to undock the dock widget QWidget* p = this; @@ -233,7 +229,6 @@ void QGCCommandButton::endEditMode() // Write to settings emit editingFinished(); - //setStyleSheet(""); // Attempt to dock the dock widget QWidget* p = this; diff --git a/src/ui/designer/QGCParamSlider.cc b/src/ui/designer/QGCParamSlider.cc index 9cd9d070cedb8c6e61ce2559d55b2b5ff1289037..edba2c78cd7bc08e99571a541e711cfeafcf8e5a 100644 --- a/src/ui/designer/QGCParamSlider.cc +++ b/src/ui/designer/QGCParamSlider.cc @@ -44,9 +44,6 @@ QGCParamSlider::QGCParamSlider(QWidget *parent) : ui->editLine2->hide(); ui->infoLabel->hide(); - //ui->editLine1->setStyleSheet("QWidget { border: 1px solid #66666B; border-radius: 3px; padding: 10px 0px 0px 0px; background: #111122; }"); - //ui->editLine2->setStyleSheet("QWidget { border: 1px solid #66666B; border-radius: 3px; padding: 10px 0px 0px 0px; background: #111122; }"); - connect(ui->editDoneButton, SIGNAL(clicked()), this, SLOT(endEditMode())); // Sending actions diff --git a/src/ui/designer/QGCTextLabel.cc b/src/ui/designer/QGCTextLabel.cc index e824e018f218edd0edbc434e757e40db0b18abf5..dd2bbf940ce97afeaeee45e1859ab56e1d7bfee8 100644 --- a/src/ui/designer/QGCTextLabel.cc +++ b/src/ui/designer/QGCTextLabel.cc @@ -24,9 +24,6 @@ QGCTextLabel::QGCTextLabel(QWidget *parent) : ui->editLine1->hide(); ui->editLine2->hide(); - ui->editLine1->setStyleSheet("QWidget { border: 1px solid #66666B; border-radius: 3px; padding: 10px 0px 0px 0px; background: #111122; }"); - ui->editLine2->setStyleSheet("QWidget { border: 1px solid #66666B; border-radius: 3px; padding: 10px 0px 0px 0px; background: #111122; }"); - // Add commands to combo box } @@ -36,8 +33,6 @@ QGCTextLabel::~QGCTextLabel() delete ui; } - - void QGCTextLabel::startEditMode() { // Hide elements @@ -49,7 +44,6 @@ void QGCTextLabel::startEditMode() ui->editComponentSpinBox->show(); ui->editLine1->show(); ui->editLine2->show(); - //setStyleSheet("QGroupBox { border: 1px solid #66666B; border-radius: 3px; padding: 10px 0px 0px 0px; background: #111122; }"); // Attempt to undock the dock widget QWidget* p = this; @@ -82,7 +76,6 @@ void QGCTextLabel::endEditMode() // Write to settings emit editingFinished(); - //setStyleSheet(""); // Attempt to dock the dock widget QWidget* p = this; @@ -127,14 +120,14 @@ void QGCTextLabel::readSettings(const QString& pre,const QVariantMap& settings) //int commandId = settings.value(pre + "QGC_COMMAND_BUTTON_COMMANDID", 0).toInt(); - - - //ui->editNameLabel->setText(settings.value(pre + "QGC_COMMAND_BUTTON_DESCRIPTION", "ERROR LOADING BUTTON").toString()); //ui->nameLabel->setText(settings.value(pre + "QGC_COMMAND_BUTTON_DESCRIPTION", "ERROR LOADING BUTTON").toString()); } void QGCTextLabel::textMessageReceived(int uasid, int component, int severity, QString message) { + Q_UNUSED(uasid); + Q_UNUSED(component); + Q_UNUSED(severity); if (enabledNum != -1) { //SUCCESS: Executed CMD: 241 @@ -172,10 +165,6 @@ void QGCTextLabel::readSettings(const QSettings& settings) ui->textLabel->setText(""); connect(uas,SIGNAL(textMessageReceived(int,int,int,QString)),this,SLOT(textMessageReceived(int,int,int,QString))); } - else - { - - } } void QGCTextLabel::enableText(int num) { diff --git a/src/ui/linechart/ChartPlot.cc b/src/ui/linechart/ChartPlot.cc new file mode 100644 index 0000000000000000000000000000000000000000..665ff5233674f633c6cf324359ae4681020c9620 --- /dev/null +++ b/src/ui/linechart/ChartPlot.cc @@ -0,0 +1,135 @@ +#include "ChartPlot.h" +#include "MainWindow.h" + +const QColor ChartPlot::baseColors[numColors] = { + QColor(242,255,128), + QColor(70,80,242), + QColor(232,33,47), + QColor(116,251,110), + QColor(81,183,244), + QColor(234,38,107), + QColor(92,247,217), + QColor(151,59,239), + QColor(231,72,28), + QColor(236,48,221), + QColor(75,133,243), + QColor(203,254,121), + QColor(104,64,240), + QColor(200,54,238), + QColor(104,250,138), + QColor(235,43,165), + QColor(98,248,176), + QColor(161,252,116), + QColor(87,231,246), + QColor(230,126,23) +}; + +ChartPlot::ChartPlot(QWidget *parent): + QwtPlot(parent), + nextColorIndex(0), + symbolWidth(2.0f), + curveWidth(2.0f), + gridWidth(0.8f), + zoomerWidth(2.0f) +{ + // Initialize the list of curves. + curves = QMap(); + + // Set the grid. The colorscheme was already set in generateColorScheme(). + grid = new QwtPlotGrid; + grid->enableXMin(true); + grid->attach(this); + + // Enable zooming + zoomer = new ScrollZoomer(canvas()); + + colors = QList(); + + ///> Color map for plots, includes 20 colors + ///> Map will start from beginning when the first 20 colors are exceeded + for (int i = 0; i < numColors; ++i) + { + colors.append(baseColors[i]); + } + + // Now that all objects have been initialized, color everything. + styleChanged(MainWindow::instance()->getStyle()); +} + +ChartPlot::~ChartPlot() +{ + +} + +QColor ChartPlot::getNextColor() +{ + if(nextColorIndex >= colors.count()) + { + nextColorIndex = 0; + } + return colors[nextColorIndex++]; +} + +QColor ChartPlot::getColorForCurve(QString id) +{ + return curves.value(id)->pen().color(); +} + +void ChartPlot::shuffleColors() +{ + foreach (QwtPlotCurve* curve, curves) + { + if (curve->isVisible()) { + QPen pen(curve->pen()); + pen.setColor(getNextColor()); + curve->setPen(pen); + } + } +} + +void ChartPlot::styleChanged(MainWindow::QGC_MAINWINDOW_STYLE style) +{ + // Generate a new color list for curves and recolor them. + for (int i = 0; i < numColors; ++i) + { + if (style == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) { + colors[i] = baseColors[i].darker(150); + } + else + { + colors[i] = baseColors[i].lighter(150); + } + } + shuffleColors(); + + // Configure the rest of the UI colors based on the current theme. + if (style == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) + { + // Set the coloring of the area selector for zooming. + zoomer->setRubberBandPen(QPen(QColor(0x37, 0x9A, 0xC3), zoomerWidth, Qt::DotLine)); + zoomer->setTrackerPen(QPen(QColor(0x37, 0x9A, 0xC3))); + + // Set canvas background + setCanvasBackground(QColor(0xFF, 0xFF, 0xFF)); + + // Configure the plot grid. + grid->setMinPen(QPen(QColor(0x55, 0x55, 0x55), gridWidth, Qt::DotLine)); + grid->setMajPen(QPen(QColor(0x22, 0x22, 0x22), gridWidth, Qt::DotLine)); + } + else + { + // Set the coloring of the area selector for zooming. + zoomer->setRubberBandPen(QPen(QColor(0xB8, 0xD3, 0xE6), zoomerWidth, Qt::DotLine)); + zoomer->setTrackerPen(QPen(QColor(0xB8, 0xD3, 0xE6))); + + // Set canvas background + setCanvasBackground(QColor(0, 0, 0)); + + // Configure the plot grid. + grid->setMinPen(QPen(QColor(0xAA, 0xAA, 0xAA), gridWidth, Qt::DotLine)); + grid->setMajPen(QPen(QColor(0xDD, 0xDD, 0xDD), gridWidth, Qt::DotLine)); + } + + // And finally refresh the widget to make sure all color changes are redrawn. + replot(); +} diff --git a/src/ui/linechart/ChartPlot.h b/src/ui/linechart/ChartPlot.h new file mode 100644 index 0000000000000000000000000000000000000000..74a232039ed2ca9bf9be9c2e09a51cd7d0d13c6c --- /dev/null +++ b/src/ui/linechart/ChartPlot.h @@ -0,0 +1,45 @@ +#ifndef CHARTPLOT_H +#define CHARTPLOT_H + +#include +#include +#include "MainWindow.h" +#include "ScrollZoomer.h" + +class ChartPlot : public QwtPlot +{ + Q_OBJECT +public: + ChartPlot(QWidget *parent = NULL); + virtual ~ChartPlot(); + + /** @brief Get next color of color map */ + QColor getNextColor(); + + /** @brief Get color for curve id */ + QColor getColorForCurve(QString id); + + /** @brief Reset color map */ + void shuffleColors(); + +public slots: + + /** @brief Generate coloring for this plot canvas based on current window theme */ + void styleChanged(MainWindow::QGC_MAINWINDOW_STYLE style); + +protected: + const static int numColors = 20; + const static QColor baseColors[numColors]; + QList colors; ///< Colormap for curves + int nextColorIndex; ///< Next index in color map + QMap curves; ///< Plot curves + ScrollZoomer* zoomer; ///< Zoomer class for widget + QwtPlotGrid* grid; ///< Plot grid + + float symbolWidth; ///< Width of curve symbols in pixels + float curveWidth; ///< Width of curve lines in pixels + float gridWidth; ///< Width of gridlines in pixels + float zoomerWidth; ///< Width of zoomer selection box +}; + +#endif // CHARTPLOT_H diff --git a/src/ui/linechart/IncrementalPlot.cc b/src/ui/linechart/IncrementalPlot.cc index 841a108caa47348511402342a5f2419b22e1766a..4b90fcf9febfde09d639cf72aa7a292e0e01c0f3 100644 --- a/src/ui/linechart/IncrementalPlot.cc +++ b/src/ui/linechart/IncrementalPlot.cc @@ -84,26 +84,13 @@ const double* CurveData::y() const } IncrementalPlot::IncrementalPlot(QWidget *parent): - QwtPlot(parent), - symbolWidth(1.2f), - curveWidth(1.0f), - gridWidth(0.8f), - scaleWidth(1.0f), + ChartPlot(parent), symmetric(false) { - setAutoReplot(false); - - setFrameStyle(QFrame::NoFrame); - setLineWidth(0); setStyleText("solid crosses"); - setCanvasLineWidth(2); plotLayout()->setAlignCanvasToScales(true); - grid = new QwtPlotGrid; - grid->setMajPen(QPen(Qt::gray, 0.8f, Qt::DotLine)); - grid->attach(this); - QwtLinearScaleEngine* yScaleEngine = new QwtLinearScaleEngine(); setAxisScaleEngine(QwtPlot::yLeft, yScaleEngine); @@ -112,40 +99,8 @@ IncrementalPlot::IncrementalPlot(QWidget *parent): resetScaling(); - // enable zooming - - zoomer = new ScrollZoomer(canvas()); - zoomer->setRubberBandPen(QPen(Qt::red, 1.5f, Qt::DotLine)); - zoomer->setTrackerPen(QPen(Qt::red)); - //zoomer->setZoomBase(QwtDoubleRect()); legend = NULL; - colors = QList(); - nextColor = 0; - - ///> Color map for plots, includes 20 colors - ///> Map will start from beginning when the first 20 colors are exceeded - colors.append(QColor(242,255,128)); - colors.append(QColor(70,80,242)); - colors.append(QColor(232,33,47)); - colors.append(QColor(116,251,110)); - colors.append(QColor(81,183,244)); - colors.append(QColor(234,38,107)); - colors.append(QColor(92,247,217)); - colors.append(QColor(151,59,239)); - colors.append(QColor(231,72,28)); - colors.append(QColor(236,48,221)); - colors.append(QColor(75,133,243)); - colors.append(QColor(203,254,121)); - colors.append(QColor(104,64,240)); - colors.append(QColor(200,54,238)); - colors.append(QColor(104,250,138)); - colors.append(QColor(235,43,165)); - colors.append(QColor(98,248,176)); - colors.append(QColor(161,252,116)); - colors.append(QColor(87,231,246)); - colors.append(QColor(230,126,23)); - connect(this, SIGNAL(legendChecked(QwtPlotItem*,bool)), this, SLOT(handleLegendClick(QwtPlotItem*,bool))); } @@ -202,7 +157,7 @@ void IncrementalPlot::showLegend(bool show) */ void IncrementalPlot::setStyleText(QString style) { - foreach (QwtPlotCurve* curve, d_curve) { + foreach (QwtPlotCurve* curve, curves) { // Style of datapoints if (style.toLower().contains("circles")) { curve->setSymbol(QwtSymbol(QwtSymbol::Ellipse, @@ -218,17 +173,17 @@ void IncrementalPlot::setStyleText(QString style) Qt::NoBrush, QPen(QBrush(curve->symbol().pen().color()), symbolWidth), QSize(6, 6)) ); } - curve->setPen(QPen(QBrush(curve->symbol().pen().color().darker()), curveWidth)); // Style of lines if (style.toLower().contains("dotted")) { - curve->setStyle(QwtPlotCurve::Dots); + curve->setPen(QPen(QBrush(curve->symbol().pen().color()), curveWidth, Qt::DotLine)); + } else if (style.toLower().contains("dashed")) { + curve->setPen(QPen(QBrush(curve->symbol().pen().color()), curveWidth, Qt::DashLine)); } else if (style.toLower().contains("line") || style.toLower().contains("solid")) { - curve->setStyle(QwtPlotCurve::Lines); - } else if (style.toLower().contains("dashed") || style.toLower().contains("solid")) { - curve->setStyle(QwtPlotCurve::Steps); + curve->setPen(QPen(QBrush(curve->symbol().pen().color()), curveWidth, Qt::SolidLine)); } else { - curve->setStyle(QwtPlotCurve::NoCurve); + curve->setPen(QPen(QBrush(curve->symbol().pen().color()), curveWidth, Qt::NoPen)); } + curve->setStyle(QwtPlotCurve::Lines); } replot(); @@ -308,19 +263,19 @@ void IncrementalPlot::appendData(QString key, double *x, double *y, int size) data = d_data.value(key); } - if (!d_curve.contains(key)) { + if (!curves.contains(key)) { curve = new QwtPlotCurve(key); - d_curve.insert(key, curve); + curves.insert(key, curve); curve->setStyle(QwtPlotCurve::NoCurve); curve->setPaintAttribute(QwtPlotCurve::PaintFiltered); const QColor &c = getNextColor(); curve->setSymbol(QwtSymbol(QwtSymbol::XCross, - QBrush(c), QPen(c, 1.2f), QSize(5, 5)) ); + QBrush(c), QPen(c, symbolWidth), QSize(5, 5)) ); curve->attach(this); } else { - curve = d_curve.value(key); + curve = curves.value(key); } data->append(x, y, size); @@ -374,7 +329,7 @@ void IncrementalPlot::appendData(QString key, double *x, double *y, int size) canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false); // FIXME Check if here all curves should be drawn // QwtPlotCurve* plotCurve; - // foreach(plotCurve, d_curve) + // foreach(plotCurve, curves) // { // plotCurve->draw(0, curve->dataSize()-1); // } @@ -421,30 +376,12 @@ bool IncrementalPlot::gridEnabled() return grid->isVisible(); } -QList IncrementalPlot::getColorMap() -{ - return colors; -} - -QColor IncrementalPlot::getNextColor() -{ - /* Return current color and increment counter for next round */ - nextColor++; - if(nextColor >= colors.count()) nextColor = 0; - return colors[nextColor++]; -} - -QColor IncrementalPlot::getColorForCurve(QString id) -{ - return d_curve.value(id)->pen().color(); -} - void IncrementalPlot::removeData() { - foreach (QwtPlotCurve* curve, d_curve) { + foreach (QwtPlotCurve* curve, curves) { delete curve; } - d_curve.clear(); + curves.clear(); foreach (CurveData* data, d_data) { delete data; diff --git a/src/ui/linechart/IncrementalPlot.h b/src/ui/linechart/IncrementalPlot.h index ea656a9fa1e22a06446c2eef9af5d19c7e658e25..06dee02ff04e90449343b0392e326d39ecc81c84 100644 --- a/src/ui/linechart/IncrementalPlot.h +++ b/src/ui/linechart/IncrementalPlot.h @@ -35,9 +35,8 @@ This file is part of the QGROUNDCONTROL project #include #include #include -#include #include -#include "ScrollZoomer.h" +#include "ChartPlot.h" class QwtPlotCurve; @@ -73,7 +72,7 @@ private: * It will only repaint the minimum screen content necessary to avoid * a too high CPU consumption. It auto-scales the plot to new data. */ -class IncrementalPlot : public QwtPlot +class IncrementalPlot : public ChartPlot { Q_OBJECT public: @@ -81,26 +80,12 @@ public: IncrementalPlot(QWidget *parent = NULL); virtual ~IncrementalPlot(); - /** @brief Get color map of this plot */ - QList getColorMap(); - - /** @brief Get next color of color map */ - QColor getNextColor(); - - /** @brief Get color for curve id */ - QColor getColorForCurve(QString id); - /** @brief Get the state of the grid */ bool gridEnabled(); /** @brief Read out data from a curve */ int data(QString key, double* r_x, double* r_y, int maxSize); - float symbolWidth; - float curveWidth; - float gridWidth; - float scaleWidth; - public slots: /** @brief Append one data point */ void appendData(QString key, double x, double y); @@ -135,11 +120,7 @@ protected slots: protected: bool symmetric; ///< Enable symmetric plotting - QList colors; ///< Colormap for curves - int nextColor; ///< Next index in color map - ScrollZoomer* zoomer; ///< Zoomer class for widget QwtLegend* legend; ///< Plot legend - QwtPlotGrid* grid; ///< Plot grid double xmin; ///< Minimum x value seen double xmax; ///< Maximum x value seen double ymin; ///< Minimum y value seen @@ -148,7 +129,6 @@ protected: private: QMap d_data; ///< Data points - QMap d_curve; ///< Plot curves }; #endif /* INCREMENTALPLOT_H */ diff --git a/src/ui/linechart/LinechartPlot.cc b/src/ui/linechart/LinechartPlot.cc index d4b33d279ee8a5659bcbf26d8bbe8fd6516248c6..9a6c995fef8eb6dbe966e4a8349d2061e5be6bd5 100644 --- a/src/ui/linechart/LinechartPlot.cc +++ b/src/ui/linechart/LinechartPlot.cc @@ -22,6 +22,7 @@ #include #include #include +#include "ChartPlot.h" #include "QGC.h" @@ -31,7 +32,8 @@ * @param parent The parent widget * @param interval The maximum interval for which data is stored (default: 30 minutes) in milliseconds **/ -LinechartPlot::LinechartPlot(QWidget *parent, int plotid, quint64 interval): QwtPlot(parent), +LinechartPlot::LinechartPlot(QWidget *parent, int plotid, quint64 interval): + ChartPlot(parent), minTime(0), lastTime(0), maxTime(100), @@ -52,50 +54,12 @@ LinechartPlot::LinechartPlot(QWidget *parent, int plotid, quint64 interval): Qwt //lastMaxTimeAdded = QTime(); - curves = QMap(); data = QMap(); scaleMaps = QMap(); yScaleEngine = new QwtLinearScaleEngine(); setAxisScaleEngine(QwtPlot::yLeft, yScaleEngine); - /* Create color map */ - colors = QList(); - nextColor = 0; - - ///> Color map for plots, includes 20 colors - ///> Map will start from beginning when the first 20 colors are exceeded - colors.append(QColor(242,255,128)); - colors.append(QColor(70,80,242)); - colors.append(QColor(232,33,47)); - colors.append(QColor(116,251,110)); - colors.append(QColor(81,183,244)); - colors.append(QColor(234,38,107)); - colors.append(QColor(92,247,217)); - colors.append(QColor(151,59,239)); - colors.append(QColor(231,72,28)); - colors.append(QColor(236,48,221)); - colors.append(QColor(75,133,243)); - colors.append(QColor(203,254,121)); - colors.append(QColor(104,64,240)); - colors.append(QColor(200,54,238)); - colors.append(QColor(104,250,138)); - colors.append(QColor(235,43,165)); - colors.append(QColor(98,248,176)); - colors.append(QColor(161,252,116)); - colors.append(QColor(87,231,246)); - colors.append(QColor(230,126,23)); - - setAutoReplot(false); - - // Set grid - QwtPlotGrid *grid = new QwtPlotGrid; - grid->setMinPen(QPen(Qt::darkGray, 0, Qt::DotLine)); - grid->setMajPen(QPen(Qt::gray, 0, Qt::DotLine)); - grid->enableXMin(true); - // TODO xmin? - grid->attach(this); - // Set left scale //setAxisOptions(QwtPlot::yLeft, QwtAutoScale::Logarithmic); @@ -112,15 +76,6 @@ LinechartPlot::LinechartPlot(QWidget *parent, int plotid, quint64 interval): Qwt plotLayout()->setAlignCanvasToScales(true); - // Set canvas background - setCanvasBackground(QColor(40, 40, 40)); - - // Enable zooming - //zoomer = new Zoomer(canvas()); - zoomer = new ScrollZoomer(canvas()); - zoomer->setRubberBandPen(QPen(Qt::blue, 1.2, Qt::DotLine)); - zoomer->setTrackerPen(QPen(Qt::blue)); - // Start QTimer for plot update updateTimer = new QTimer(this); connect(updateTimer, SIGNAL(timeout()), this, SLOT(paintRealtime())); @@ -397,19 +352,6 @@ void LinechartPlot::addCurve(QString id) emit curveAdded(id); } -QColor LinechartPlot::getNextColor() -{ - /* Return current color and increment counter for next round */ - nextColor++; - if(nextColor >= colors.count()) nextColor = 0; - return colors[nextColor++]; -} - -QColor LinechartPlot::getColorForCurve(QString id) -{ - return curves.value(id)->pen().color(); -} - /** * @brief Set the time window for the plot * The time window defines which data is shown in the plot. @@ -438,22 +380,6 @@ quint64 LinechartPlot::getWindowPosition() return plotPosition; } -/** - * @brief Set the color of a curve - * - * This method emits the colorSet(id, color) signal. - * - * @param id The id-string of the curve - * @param color The newly assigned color - **/ -void LinechartPlot::setCurveColor(QString id, QColor color) -{ - QwtPlotCurve* curve = curves.value(id); - curve->setPen(color); - - emit colorSet(id, color); -} - /** * @brief Set the scaling of the (vertical) y axis * The mapping of the variable values on the drawing pane can be @@ -533,6 +459,21 @@ void LinechartPlot::showCurve(QString id) // curves.value(id)->show(); //} +/** + * @brief Set the color of a curve and its symbols. + * + * @param id The id-string of the curve + * @param color The newly assigned color + **/ +void LinechartPlot::setCurveColor(QString id, QColor color) +{ + QwtPlotCurve* curve = curves.value(id); + curve->setPen(QPen(QBrush(color), curveWidth)); + QwtSymbol x = curve->symbol(); + x.setPen(QPen(QBrush(color), symbolWidth)); + curve->setSymbol(x); +} + /** * @brief Check the visibility of a curve * @@ -647,11 +588,6 @@ quint64 LinechartPlot::getDataInterval() return storageInterval; } -QList LinechartPlot::getColorMap() -{ - return colors; -} - /** * @brief Set logarithmic scaling for the curve **/ diff --git a/src/ui/linechart/LinechartPlot.h b/src/ui/linechart/LinechartPlot.h index 77c0a7c20b8bfd976957a42de2a0d7f9ff8e662c..470d64b05b9e8201fa6227f5cb98c623b0e6f6bb 100644 --- a/src/ui/linechart/LinechartPlot.h +++ b/src/ui/linechart/LinechartPlot.h @@ -47,7 +47,7 @@ This file is part of the PIXHAWK project #include #include #include -#include +#include "ChartPlot.h" #include "MG.h" class TimeScaleDraw: public QwtScaleDraw @@ -63,36 +63,6 @@ public: }; -/** - * @brief Zoomer for plot - */ -class Zoomer: public ScrollZoomer -{ -public: - Zoomer(QwtPlotCanvas *canvas) : ScrollZoomer(canvas) {} - virtual void rescale() { - - QwtScaleWidget *scaleWidget = plot()->axisWidget(yAxis()); - QwtScaleDraw *sd = scaleWidget->scaleDraw(); - int minExtent = 0; - if ( zoomRectIndex() > 0 ) { - - // When scrolling in vertical direction - // the plot is jumping in horizontal direction - // because of the different widths of the labels - // So we better use a fixed extent. - - minExtent = sd->spacing() + sd->majTickLength() + 1; - minExtent += sd->labelSize(scaleWidget->font(), 1000).width(); - } - - sd->setMinimumExtent(minExtent); - ScrollZoomer::rescale(); - - } - -}; - /** * @brief Data container @@ -181,7 +151,7 @@ private: /** * @brief Time series plot **/ -class LinechartPlot : public QwtPlot +class LinechartPlot : public ChartPlot { Q_OBJECT public: @@ -205,7 +175,6 @@ public: quint64 getPlotInterval(); quint64 getDataInterval(); quint64 getWindowPosition(); - QList getColorMap(); /** @brief Get the short-term mean of a curve */ double getMean(QString id); @@ -245,7 +214,13 @@ public slots: // Functions referring to the currently active plot void setVisible(QString id, bool visible); - //void showCurve(QString id, int position); + + /** + * @brief Set the color of a curve and its symbols. + * + * @param id The id-string of the curve + * @param color The newly assigned color + **/ void setCurveColor(QString id, QColor color); /** @brief Enforce the use of the receive timestamp */ @@ -269,29 +244,10 @@ public slots: void setAverageWindow(int windowSize); void removeTimedOutCurves(); - /** @brief Reset color map */ - void shuffleColors() - { - foreach (QwtPlotCurve* curve, curves) - { - QPen pen(curve->pen()); - pen.setColor(getNextColor()); - curve->setPen(pen); - } - } - - public: - QColor getColorForCurve(QString id); - protected: - QMap curves; QMap data; QMap scaleMaps; QMap lastUpdate; - ScrollZoomer* zoomer; - - QList colors; - int nextColor; //static const quint64 MAX_STORAGE_INTERVAL = Q_UINT64_C(300000); static const quint64 MAX_STORAGE_INTERVAL = Q_UINT64_C(0); ///< The maximum interval which is stored @@ -325,7 +281,6 @@ protected: // Methods void addCurve(QString id); - QColor getNextColor(); void showEvent(QShowEvent* event); void hideEvent(QHideEvent* event); @@ -341,13 +296,6 @@ signals: * @param color The curve color in the diagram **/ void curveAdded(QString idstring); - /** - * @brief This signal is emitted when a curve gets assigned a color - * - * @param idstring The id-string of the curve - * @param color The curve color in the diagram - **/ - void colorSet(QString idstring, QColor color); /** * @brief This signal is emitted when a curve is removed * diff --git a/src/ui/linechart/LinechartWidget.cc b/src/ui/linechart/LinechartWidget.cc index eb6600eaff49f2d303725b495bc1eec51f004e9c..e29b655321f24f339aed0d6dfc60ba2a854df252 100644 --- a/src/ui/linechart/LinechartWidget.cc +++ b/src/ui/linechart/LinechartWidget.cc @@ -61,7 +61,6 @@ LinechartWidget::LinechartWidget(int systemid, QWidget *parent) : QWidget(parent plotWindowLock(), curveListIndex(0), curveListCounter(0), - listedCurves(new QList()), curveLabels(new QMap()), curveMeans(new QMap()), curveMedians(new QMap()), @@ -142,6 +141,12 @@ LinechartWidget::LinechartWidget(int systemid, QWidget *parent) : QWidget(parent //connect(this, SIGNAL(plotWindowPositionUpdated(int)), scrollbar, SLOT(setValue(int))); //connect(scrollbar, SIGNAL(sliderMoved(int)), this, SLOT(setPlotWindowPosition(int))); + + // And make sure we're listening for future style changes + connect(MainWindow::instance(), SIGNAL(styleChanged(MainWindow::QGC_MAINWINDOW_STYLE)), + this, SLOT(styleChanged(MainWindow::QGC_MAINWINDOW_STYLE))); + connect(MainWindow::instance(), SIGNAL(styleChanged()), this, SLOT(recolor())); + updateTimer->setInterval(updateInterval); connect(updateTimer, SIGNAL(timeout()), this, SLOT(refresh())); connect(ui.uasSelectionBox, SIGNAL(currentIndexChanged(int)), this, SLOT(selectActiveSystem(int))); @@ -154,8 +159,6 @@ LinechartWidget::~LinechartWidget() stopLogging(); if (activePlot) delete activePlot; activePlot = NULL; - delete listedCurves; - listedCurves = NULL; } void LinechartWidget::selectActiveSystem(int mav) @@ -655,34 +658,26 @@ void LinechartWidget::addCurve(const QString& curve, const QString& unit) int labelRow = curvesWidgetLayout->rowCount(); + // Checkbox checkBox = new QCheckBox(this); checkBox->setCheckable(true); checkBox->setObjectName(curve+unit); checkBox->setToolTip(tr("Enable the curve in the graph window")); checkBox->setWhatsThis(tr("Enable the curve in the graph window")); - curvesWidgetLayout->addWidget(checkBox, labelRow, 0); + // Icon QWidget* colorIcon = new QWidget(this); colorIcons.insert(curve+unit, colorIcon); colorIcon->setMinimumSize(QSize(5, 14)); colorIcon->setMaximumSize(4, 14); - curvesWidgetLayout->addWidget(colorIcon, labelRow, 1); + // Label label = new QLabel(this); - curvesWidgetLayout->addWidget(label, labelRow, 2); - - //checkBox->setText(QString()); label->setText(getCurveName(curve+unit, ui.shortNameCheckBox->isChecked())); - QColor color(Qt::gray);// = plot->getColorForCurve(curve+unit); - QString colorstyle; - colorstyle = colorstyle.sprintf("QWidget { background-color: #%X%X%X; }", color.red(), color.green(), color.blue()); - colorIcon->setStyleSheet(colorstyle); - colorIcon->setAutoFillBackground(true); - - // Label curveNameLabels.insert(curve+unit, label); + curvesWidgetLayout->addWidget(label, labelRow, 2); // Value value = new QLabel(this); @@ -696,8 +691,6 @@ void LinechartWidget::addCurve(const QString& curve, const QString& unit) // Unit unitLabel = new QLabel(this); unitLabel->setText(unit); - unitLabel->setStyleSheet(QString("QLabel {color: %1;}").arg("#AAAAAA")); - //qDebug() << "UNIT" << unit; unitLabel->setToolTip(tr("Unit of ") + curve); unitLabel->setWhatsThis(tr("Unit of ") + curve); curvesWidgetLayout->addWidget(unitLabel, labelRow, 4); @@ -784,21 +777,16 @@ void LinechartWidget::removeCurve(QString curve) void LinechartWidget::recolor() { - activePlot->shuffleColors(); - + activePlot->styleChanged(MainWindow::instance()->getStyle()); foreach (QString key, colorIcons.keys()) { - - // FIXME -// if (activePlot) - QString colorstyle; - QColor color = activePlot->getColorForCurve(key); - colorstyle = colorstyle.sprintf("QWidget { background-color: #%X%X%X; }", color.red(), color.green(), color.blue()); QWidget* colorIcon = colorIcons.value(key, 0); - if (colorIcon) + if (colorIcon && !colorIcon->styleSheet().isEmpty()) { + QString colorstyle; + QColor color = activePlot->getColorForCurve(key); + colorstyle = colorstyle.sprintf("QWidget { background-color: #%02X%02X%02X; }", color.red(), color.green(), color.blue()); colorIcon->setStyleSheet(colorstyle); - colorIcon->setAutoFillBackground(true); } } } @@ -988,8 +976,9 @@ void LinechartWidget::setPlotInterval(quint64 interval) /** * @brief Take the click of a curve activation / deactivation button. - * This method allows to map a button to a plot curve.The text of the - * button must equal the curve name to activate / deactivate. + * This method allows to map a button to a plot curve. The text of the + * button must equal the curve name to activate / deactivate. If the checkbox + * was clicked, show the curve color, otherwise clear the coloring. * * @param checked The visibility of the curve: true to display the curve, false otherwise **/ @@ -1001,17 +990,22 @@ void LinechartWidget::takeButtonClick(bool checked) if(button != NULL) { activePlot->setVisible(button->objectName(), checked); - - QColor color = activePlot->getColorForCurve(button->objectName()); - if(color.isValid()) + QWidget* colorIcon = colorIcons.value(button->objectName(), 0); + if (colorIcon) { - QString colorstyle; - colorstyle = colorstyle.sprintf("QWidget { background-color: #%X%X%X; }", color.red(), color.green(), color.blue()); - QWidget* colorIcon = colorIcons.value(button->objectName(), 0); - if (colorIcon) + if (checked) + { + QColor color = activePlot->getColorForCurve(button->objectName()); + if (color.isValid()) + { + QString colorstyle; + colorstyle = colorstyle.sprintf("QWidget { background-color: #%02X%02X%02X; }", color.red(), color.green(), color.blue()); + colorIcon->setStyleSheet(colorstyle); + } + } + else { - colorIcon->setStyleSheet(colorstyle); - colorIcon->setAutoFillBackground(true); + colorIcon->setStyleSheet(""); } } } diff --git a/src/ui/linechart/LinechartWidget.h b/src/ui/linechart/LinechartWidget.h index 3e57975c73529fc5f284a60c74d7100fd3777030..a775c303f182764f4e5b25432de8ae37769ad63f 100644 --- a/src/ui/linechart/LinechartWidget.h +++ b/src/ui/linechart/LinechartWidget.h @@ -95,7 +95,7 @@ public slots: void appendData(int uasId, const QString& curve, const QString& unit, quint64 value, quint64 usec); /** @brief Append double data to the given curve. */ void appendData(int uasId, const QString& curve, const QString& unit, double value, quint64 usec); - + void takeButtonClick(bool checked); void setPlotWindowPosition(int scrollBarValue); void setPlotWindowPosition(quint64 position); @@ -138,7 +138,6 @@ protected: int curveListIndex; int curveListCounter; ///< Counter of curves in curve list - QList* listedCurves; ///< Curves listed QMap* curveLabels; ///< References to the curve labels QMap curveNameLabels; ///< References to the curve labels QMap curveNames; ///< Full curve names diff --git a/src/ui/map/QGCMapWidget.cc b/src/ui/map/QGCMapWidget.cc index d52994aae944f9219e4b70701e5ff9efa0dbc17c..67b3c711d2859d3ae5caad0a185eb56521297bf2 100644 --- a/src/ui/map/QGCMapWidget.cc +++ b/src/ui/map/QGCMapWidget.cc @@ -302,7 +302,6 @@ void QGCMapWidget::addUAS(UASInterface* uas) void QGCMapWidget::activeUASSet(UASInterface* uas) { // Only execute if proper UAS is set - if (!uas) return; this->uas = uas; // Disconnect old MAV manager @@ -315,17 +314,26 @@ void QGCMapWidget::activeUASSet(UASInterface* uas) disconnect(this, SIGNAL(waypointChanged(Waypoint*)), currWPManager, SLOT(notifyOfChangeEditable(Waypoint*))); } - currWPManager = uas->getWaypointManager(); + // Attach the new waypoint manager if a new UAS was selected. Otherwise, indicate + // that no such manager exists. + if (uas) + { + currWPManager = uas->getWaypointManager(); - updateSelectedSystem(uas->getUASID()); - followUAVID = uas->getUASID(); - updateWaypointList(uas->getUASID()); + updateSelectedSystem(uas->getUASID()); + followUAVID = uas->getUASID(); + updateWaypointList(uas->getUASID()); - // Connect the waypoint manager / data storage to the UI - connect(currWPManager, SIGNAL(waypointEditableListChanged(int)), this, SLOT(updateWaypointList(int))); - connect(currWPManager, SIGNAL(waypointEditableChanged(int, Waypoint*)), this, SLOT(updateWaypoint(int,Waypoint*))); - connect(this, SIGNAL(waypointCreated(Waypoint*)), currWPManager, SLOT(addWaypointEditable(Waypoint*))); - connect(this, SIGNAL(waypointChanged(Waypoint*)), currWPManager, SLOT(notifyOfChangeEditable(Waypoint*))); + // Connect the waypoint manager / data storage to the UI + connect(currWPManager, SIGNAL(waypointEditableListChanged(int)), this, SLOT(updateWaypointList(int))); + connect(currWPManager, SIGNAL(waypointEditableChanged(int, Waypoint*)), this, SLOT(updateWaypoint(int,Waypoint*))); + connect(this, SIGNAL(waypointCreated(Waypoint*)), currWPManager, SLOT(addWaypointEditable(Waypoint*))); + connect(this, SIGNAL(waypointChanged(Waypoint*)), currWPManager, SLOT(notifyOfChangeEditable(Waypoint*))); + } + else + { + currWPManager = NULL; + } } /** @@ -595,7 +603,7 @@ void QGCMapWidget::handleMapWaypointEdit(mapcontrol::WayPointItem* waypoint) */ void QGCMapWidget::updateWaypoint(int uas, Waypoint* wp) { - qDebug() << __FILE__ << __LINE__ << "UPDATING WP FUNCTION CALLED"; + //qDebug() << __FILE__ << __LINE__ << "UPDATING WP FUNCTION CALLED"; // Source of the event was in this widget, do nothing if (firingWaypointChange == wp) { return; diff --git a/src/ui/map3D/Pixhawk3DWidget.cc b/src/ui/map3D/Pixhawk3DWidget.cc index ee535434fb52c794d9c00521a370cc67bb79d8ba..43931008e0ce3e76d8dd7e0b69d89037efd0193c 100644 --- a/src/ui/map3D/Pixhawk3DWidget.cc +++ b/src/ui/map3D/Pixhawk3DWidget.cc @@ -113,7 +113,10 @@ Pixhawk3DWidget::~Pixhawk3DWidget() void Pixhawk3DWidget::activeSystemChanged(UASInterface* uas) { - mActiveSystemId = uas->getUASID(); + if (uas) + { + mActiveSystemId = uas->getUASID(); + } mActiveUAS = uas; diff --git a/src/ui/uas/QGCUnconnectedInfoWidget.cc b/src/ui/uas/QGCUnconnectedInfoWidget.cc index ab81a04a1f39710acc26849cb16267679779b069..3a77c1afd8224156b369f59c21c5e808caafa9ca 100644 --- a/src/ui/uas/QGCUnconnectedInfoWidget.cc +++ b/src/ui/uas/QGCUnconnectedInfoWidget.cc @@ -13,10 +13,6 @@ QGCUnconnectedInfoWidget::QGCUnconnectedInfoWidget(QWidget *parent) : //connect(ui->simulationButton, SIGNAL(clicked()), this, SLOT(simulate())); connect(ui->connectButton, SIGNAL(clicked()), this, SLOT(addLink())); - - // Overwrite global style sheet - //ui->connectButton->setStyleSheet("* { max-height: 1000; background-color: transparent; border-color: transparent; }"); - //ui->connectButton->setStyleSheet("QToolButton {background-color: green; border-radius: 20px; } QButton {} QPushButton {}"); } QGCUnconnectedInfoWidget::~QGCUnconnectedInfoWidget() diff --git a/src/ui/uas/QGCUnconnectedInfoWidget.ui b/src/ui/uas/QGCUnconnectedInfoWidget.ui index 6a1ac83bdd8d74822d4fdd4c10cf182f1ac76900..9ac07542b08e42e7de1f2df467c9dbc1d9eeaa43 100644 --- a/src/ui/uas/QGCUnconnectedInfoWidget.ui +++ b/src/ui/uas/QGCUnconnectedInfoWidget.ui @@ -6,20 +6,38 @@ 0 0 - 372 - 309 + 174 + 174 + + + 0 + 0 + + Form - + + + 0 + + + 0 + - + + + + 0 + 0 + + - 150 - 150 + 174 + 174 @@ -35,28 +53,7 @@ - -QToolButton { -color: #222222; -background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #80B81D, stop: 1 #306807); -margin: 15px; -padding: 20px; -border-radius: 18px; -min-height: 100px; -border: 2px solid #085B35; -} - -QToolButton:pressed { -background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #306807, stop: 1 #80B81D); -color: #222222; -border-color: #D1892A; -} - -QToolButton:checked { -background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #306807, stop: 1 #80B81D); -color: #222222; -border-color: #D1892A; -} + @@ -71,24 +68,8 @@ border-color: #D1892A; 140 - - Qt::ToolButtonIconOnly - - - - - Qt::Vertical - - - - 20 - 40 - - - - diff --git a/src/ui/uas/UASActionsWidget.cpp b/src/ui/uas/UASActionsWidget.cpp index 2abb5bb3a2c45aea0720827b6ba030f53fb00bcd..96d08c7b0a997038bac275b24608c5d6222efc39 100644 --- a/src/ui/uas/UASActionsWidget.cpp +++ b/src/ui/uas/UASActionsWidget.cpp @@ -19,10 +19,13 @@ UASActionsWidget::UASActionsWidget(QWidget *parent) : QWidget(parent) void UASActionsWidget::activeUASSet(UASInterface *uas) { m_uas = uas; - connect(m_uas->getWaypointManager(),SIGNAL(waypointEditableListChanged()),this,SLOT(updateWaypointList())); - connect(m_uas->getWaypointManager(),SIGNAL(currentWaypointChanged(quint16)),this,SLOT(currentWaypointChanged(quint16))); - connect(m_uas,SIGNAL(armingChanged(bool)),this,SLOT(armingChanged(bool))); - armingChanged(m_uas->isArmed()); + if (uas) + { + connect(m_uas->getWaypointManager(),SIGNAL(waypointEditableListChanged()),this,SLOT(updateWaypointList())); + connect(m_uas->getWaypointManager(),SIGNAL(currentWaypointChanged(quint16)),this,SLOT(currentWaypointChanged(quint16))); + connect(m_uas,SIGNAL(armingChanged(bool)),this,SLOT(armingChanged(bool))); + armingChanged(m_uas->isArmed()); + } updateWaypointList(); } void UASActionsWidget::armButtonClicked() @@ -63,9 +66,12 @@ void UASActionsWidget::currentWaypointChanged(quint16 wpid) void UASActionsWidget::updateWaypointList() { ui.waypointComboBox->clear(); - for (int i=0;igetWaypointManager()->getWaypointEditableList().size();i++) + if (m_uas) { - ui.waypointComboBox->addItem(QString::number(i)); + for (int i=0;igetWaypointManager()->getWaypointEditableList().size();i++) + { + ui.waypointComboBox->addItem(QString::number(i)); + } } } diff --git a/src/ui/uas/UASControlWidget.cc b/src/ui/uas/UASControlWidget.cc index 6632aa3276b936518a54e0344e6e6bd8865d9d60..5c43eddce76117967531fcb66b702e81c1b15cbf 100644 --- a/src/ui/uas/UASControlWidget.cc +++ b/src/ui/uas/UASControlWidget.cc @@ -70,7 +70,7 @@ UASControlWidget::UASControlWidget(QWidget *parent) : QWidget(parent), void UASControlWidget::setUAS(UASInterface* uas) { - if (this->uas != 0) + if (this->uas) { UASInterface* oldUAS = UASManager::instance()->getUASForId(this->uas); disconnect(ui.controlButton, SIGNAL(clicked()), oldUAS, SLOT(armSystem())); @@ -83,18 +83,25 @@ void UASControlWidget::setUAS(UASInterface* uas) } // Connect user interface controls - connect(ui.controlButton, SIGNAL(clicked()), this, SLOT(cycleContextButton())); - connect(ui.liftoffButton, SIGNAL(clicked()), uas, SLOT(launch())); - connect(ui.landButton, SIGNAL(clicked()), uas, SLOT(home())); - connect(ui.shutdownButton, SIGNAL(clicked()), uas, SLOT(shutdown())); - //connect(ui.setHomeButton, SIGNAL(clicked()), uas, SLOT(setLocalOriginAtCurrentGPSPosition())); - connect(uas, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString))); - connect(uas, SIGNAL(statusChanged(int)), this, SLOT(updateState(int))); - - ui.controlStatusLabel->setText(tr("Connected to ") + uas->getUASName()); - - this->uas = uas->getUASID(); - setBackgroundColor(uas->getColor()); + if (uas) + { + connect(ui.controlButton, SIGNAL(clicked()), this, SLOT(cycleContextButton())); + connect(ui.liftoffButton, SIGNAL(clicked()), uas, SLOT(launch())); + connect(ui.landButton, SIGNAL(clicked()), uas, SLOT(home())); + connect(ui.shutdownButton, SIGNAL(clicked()), uas, SLOT(shutdown())); + //connect(ui.setHomeButton, SIGNAL(clicked()), uas, SLOT(setLocalOriginAtCurrentGPSPosition())); + connect(uas, SIGNAL(modeChanged(int,QString,QString)), this, SLOT(updateMode(int,QString,QString))); + connect(uas, SIGNAL(statusChanged(int)), this, SLOT(updateState(int))); + + ui.controlStatusLabel->setText(tr("Connected to ") + uas->getUASName()); + + this->uas = uas->getUASID(); + setBackgroundColor(uas->getColor()); + } + else + { + this->uas = -1; + } } UASControlWidget::~UASControlWidget() diff --git a/src/ui/uas/UASListWidget.cc b/src/ui/uas/UASListWidget.cc index 1a1e97562fbe1d6e436660065fe1500238603eb2..d1cdde02eb62aa7582dc7ad5b1e1c7a74f02d375 100644 --- a/src/ui/uas/UASListWidget.cc +++ b/src/ui/uas/UASListWidget.cc @@ -49,29 +49,31 @@ UASListWidget::UASListWidget(QWidget *parent) : QWidget(parent), uWidget(NULL), m_ui(new Ui::UASList) { - m_ui->setupUi(this); - - listLayout = new QVBoxLayout(this); - listLayout->setMargin(0); - listLayout->setSpacing(3); - listLayout->setAlignment(Qt::AlignTop); - this->setLayout(listLayout); - setObjectName("UNMANNED_SYSTEMS_LIST"); + // Use a timer to update the link health display. + updateTimer = new QTimer(this); + connect(updateTimer,SIGNAL(timeout()),this,SLOT(updateStatus())); - // Construct initial widget - //uWidget = new QGCUnconnectedInfoWidget(this); - //listLayout->addWidget(uWidget); + m_ui->setupUi(this); + m_ui->verticalLayout->setAlignment(Qt::AlignTop); this->setMinimumWidth(262); + linkToBoxMapping = QMap(); + uasToBoxMapping = QMap(); uasViews = QMap(); this->setVisible(false); - connect(UASManager::instance(),SIGNAL(UASCreated(UASInterface*)),this,SLOT(addUAS(UASInterface*))); + // Listen for when UASes are added or removed. This does not manage the UASView + // widgets that are displayed within this widget. + connect(UASManager::instance(), SIGNAL(UASCreated(UASInterface*)), + this, SLOT(addUAS(UASInterface*))); + connect(UASManager::instance(), SIGNAL(UASDeleted(UASInterface*)), + this, SLOT(removeUAS(UASInterface*))); // Get a list of all existing UAS - foreach (UASInterface* uas, UASManager::instance()->getUASList()) { + foreach (UASInterface* uas, UASManager::instance()->getUASList()) + { addUAS(uas); } } @@ -94,15 +96,48 @@ void UASListWidget::changeEvent(QEvent *e) } } - +void UASListWidget::updateStatus() +{ + QMapIterator i(linkToBoxMapping); + while (i.hasNext()) { + i.next(); + LinkInterface* link = i.key(); + ProtocolInterface* p = LinkManager::instance()->getProtocolForLink(link); + + // Build the tooltip out of the protocol parsing data: received, dropped, and parsing errors. + QString displayString(""); + int c; + if ((c = p->getReceivedPacketCount(link)) != -1) + { + displayString += QString(tr("
Received: %2")).arg(QString::number(c)); + } + if ((c = p->getDroppedPacketCount(link)) != -1) + { + displayString += QString(tr("
Dropped: %2")).arg(QString::number(c)); + } + if ((c = p->getParsingErrorCount(link)) != -1) + { + displayString += QString(tr("
Errors: %2")).arg(QString::number(c)); + } + if (!displayString.isEmpty()) + { + displayString = QString("%1").arg(i.key()->getName()) + displayString; + } +// qDebug() << p << ": " + displayString; + i.value()->setToolTip(displayString); + } +} void UASListWidget::addUAS(UASInterface* uas) { + // If the list was empty, remove the unconnected widget and start the update timer. if (uasViews.isEmpty()) { + updateTimer->start(5000); + if (uWidget) { - listLayout->removeWidget(uWidget); + m_ui->verticalLayout->removeWidget(uWidget); delete uWidget; uWidget = NULL; } @@ -110,9 +145,40 @@ void UASListWidget::addUAS(UASInterface* uas) if (!uasViews.contains(uas)) { - uasViews.insert(uas, new UASView(uas, this)); - listLayout->addWidget(uasViews.value(uas)); - //connect(uas, SIGNAL(destroyed(QObject*)), this, SLOT(removeUAS(QObject*))); + // Only display the UAS in a single link. + QList* x = uas->getLinks(); + if (x->size()) + { + LinkInterface* li = x->at(0); + + // Find an existing QGroupBox for this LinkInterface or create a + // new one. + QGroupBox* newBox; + if (linkToBoxMapping.contains(li)) + { + newBox = linkToBoxMapping[li]; + } + else + { + newBox = new QGroupBox(li->getName(), this); + QVBoxLayout* boxLayout = new QVBoxLayout(newBox); + newBox->setLayout(boxLayout); + m_ui->verticalLayout->addWidget(newBox); + linkToBoxMapping[li] = newBox; + updateStatus(); // Update the link status for this GroupBox. + } + + // And add the new UAS to the UASList + UASView* newView = new UASView(uas, newBox); + uasViews.insert(uas, newView); + uasToBoxMapping[uas] = newBox; + newBox->layout()->addWidget(newView); + + // Watch for when this widget is destroyed so that we can clean up the + // groupbox if necessary. + connect(newView, SIGNAL(destroyed(QObject*)), + this, SLOT(removeUASView(QObject*))); + } } } @@ -124,11 +190,57 @@ void UASListWidget::activeUAS(UASInterface* uas) } } +/** + * If the UAS was removed, check to see if it was the last one in the QGroupBox and delete + * the QGroupBox if so. + */ void UASListWidget::removeUAS(UASInterface* uas) { - Q_UNUSED(uas); -// uasViews.remove(uas); -// listLayout->removeWidget(uasViews.value(uas)); -// uasViews.value(uas)->deleteLater(); -} + // Remove the UASView and check if its parent GroupBox has any other children, + // delete it if it doesn't. + QGroupBox* box = uasToBoxMapping[uas]; + uasToBoxMapping.remove(uas); + uasViews.remove(uas); + int otherViews = 0; + foreach (UASView* view, box->findChildren()) + { + if (view->uas == uas) + { + view->deleteLater(); + } + else + { + ++otherViews; + } + } + if (otherViews == 0) + { + // Delete the groupbox. + QMap::const_iterator i = linkToBoxMapping.constBegin(); + while (i != linkToBoxMapping.constEnd()) { + if (i.value() == box) + { + linkToBoxMapping.remove(i.key()); + } + ++i; + } + box->deleteLater(); + // And if no other QGroupBoxes are left, put the initial widget back. + // We also stop the update timer as there's nothing to update at this point. + int otherBoxes = 0; + foreach (const QGroupBox* otherBox, findChildren()) + { + if (otherBox != box) + { + ++otherBoxes; + } + } + if (otherBoxes == 0) + { + uWidget = new QGCUnconnectedInfoWidget(this); + m_ui->verticalLayout->addWidget(uWidget); + updateTimer->stop(); + } + } +} diff --git a/src/ui/uas/UASListWidget.h b/src/ui/uas/UASListWidget.h index 45f0c735edf9a7bd00076f2b667c45a2a9c28d15..b14e1e97de6fdb58dbe1585726b3b0644b182c27 100644 --- a/src/ui/uas/UASListWidget.h +++ b/src/ui/uas/UASListWidget.h @@ -33,7 +33,9 @@ This file is part of the QGROUNDCONTROL project #include #include +#include #include +#include #include "UASInterface.h" #include "UASView.h" #include "QGCUnconnectedInfoWidget.h" @@ -53,14 +55,21 @@ public slots: void removeUAS(UASInterface* uas); protected: + // Keep a mapping from UASes to their GroupBox. Useful for determining when groupboxes are empty. + QMap uasToBoxMapping; + // Keep a mapping from Links to GroupBoxes for adding new links. + QMap linkToBoxMapping; + // Tie each view to their UAS object so they can be removed easily. QMap uasViews; - QVBoxLayout* listLayout; QGCUnconnectedInfoWidget* uWidget; + QTimer* updateTimer; void changeEvent(QEvent *e); private: Ui::UASList* m_ui; +private slots: + void updateStatus(); }; #endif // _UASLISTWIDGET_H_ diff --git a/src/ui/uas/UASQuickView.cc b/src/ui/uas/UASQuickView.cc index afc633b03e69ff5f2d25373ca85ce58f46577e42..13a198f96a0452f577d40d74db31556549ba821b 100644 --- a/src/ui/uas/UASQuickView.cc +++ b/src/ui/uas/UASQuickView.cc @@ -4,10 +4,14 @@ #include "UASQuickViewItemSelect.h" #include "UASQuickViewTextItem.h" #include -UASQuickView::UASQuickView(QWidget *parent) : QWidget(parent) + +UASQuickView::UASQuickView(QWidget *parent) : + QWidget(parent), + m_ui(new Ui::UASQuickView) { + m_ui->setupUi(this); quickViewSelectDialog=0; - ui.setupUi(this); + connect(UASManager::instance(),SIGNAL(activeUASSet(UASInterface*)),this,SLOT(setActiveUAS(UASInterface*))); connect(UASManager::instance(),SIGNAL(UASCreated(UASInterface*)),this,SLOT(addUAS(UASInterface*))); if (UASManager::instance()->getActiveUAS()) @@ -16,67 +20,6 @@ UASQuickView::UASQuickView(QWidget *parent) : QWidget(parent) } this->setContextMenuPolicy(Qt::ActionsContextMenu); - - /*{ - QAction *action = new QAction("latitude",this); - action->setCheckable(true); - action->setChecked(true); - connect(action,SIGNAL(toggled(bool)),this,SLOT(actionTriggered(bool))); - this->addAction(action); - UASQuickViewItem *item = new UASQuickViewItem(this); - item->setTitle("latitude"); - ui.verticalLayout->addWidget(item); - uasPropertyToLabelMap["latitude"] = item; - } - - { - QAction *action = new QAction("longitude",this); - action->setCheckable(true); - action->setChecked(true); - connect(action,SIGNAL(toggled(bool)),this,SLOT(actionTriggered(bool))); - this->addAction(action); - UASQuickViewItem *item = new UASQuickViewItem(this); - item->setTitle("longitude"); - ui.verticalLayout->addWidget(item); - uasPropertyToLabelMap["longitude"] = item; - } - - { - QAction *action = new QAction("altitude",this); - action->setCheckable(true); - action->setChecked(true); - connect(action,SIGNAL(toggled(bool)),this,SLOT(actionTriggered(bool))); - this->addAction(action); - UASQuickViewItem *item = new UASQuickViewItem(this); - item->setTitle("altitude"); - ui.verticalLayout->addWidget(item); - uasPropertyToLabelMap["altitude"] = item; - } - - { - QAction *action = new QAction("satelliteCount",this); - action->setCheckable(true); - action->setChecked(true); - connect(action,SIGNAL(toggled(bool)),this,SLOT(actionTriggered(bool))); - this->addAction(action); - UASQuickViewItem *item = new UASQuickViewItem(this); - item->setTitle("satelliteCount"); - ui.verticalLayout->addWidget(item); - uasPropertyToLabelMap["satelliteCount"] = item; - } - - { - QAction *action = new QAction("distToWaypoint",this); - action->setCheckable(true); - action->setChecked(true); - connect(action,SIGNAL(toggled(bool)),this,SLOT(actionTriggered(bool))); - this->addAction(action); - UASQuickViewItem *item = new UASQuickViewItem(this); - item->setTitle("distToWaypoint"); - ui.verticalLayout->addWidget(item); - uasPropertyToLabelMap["distToWaypoint"] = item; - }*/ - loadSettings(); //If we don't have any predefined settings, set some defaults. if (uasPropertyValueMap.size() == 0) @@ -95,8 +38,8 @@ UASQuickView::UASQuickView(QWidget *parent) : QWidget(parent) updateTimer = new QTimer(this); connect(updateTimer,SIGNAL(timeout()),this,SLOT(updateTimerTick())); - updateTimer->start(1000); } + void UASQuickView::actionTriggered() { if (quickViewSelectDialog) @@ -115,6 +58,7 @@ void UASQuickView::actionTriggered() } quickViewSelectDialog->show(); } + void UASQuickView::saveSettings() { QSettings settings; @@ -129,6 +73,7 @@ void UASQuickView::saveSettings() settings.endArray(); settings.sync(); } + void UASQuickView::loadSettings() { QSettings settings; @@ -149,7 +94,7 @@ void UASQuickView::valueEnabled(QString value) { UASQuickViewItem *item = new UASQuickViewTextItem(this); item->setTitle(value); - ui.verticalLayout->addWidget(item); + m_ui->verticalLayout->addWidget(item); uasPropertyToLabelMap[value] = item; uasEnabledPropertyList.append(value); if (!uasPropertyValueMap.contains(value)) @@ -167,7 +112,7 @@ void UASQuickView::valueDisabled(QString value) UASQuickViewItem *item = uasPropertyToLabelMap[value]; uasPropertyToLabelMap.remove(value); item->hide(); - ui.verticalLayout->removeWidget(item); + m_ui->verticalLayout->removeWidget(item); item->deleteLater(); uasEnabledPropertyList.removeOne(value); saveSettings(); @@ -204,14 +149,33 @@ void UASQuickView::addUAS(UASInterface* uas) void UASQuickView::setActiveUAS(UASInterface* uas) { - if (!uas) + // Clean up from the old UAS + if (this->uas) { - return; + uasPropertyValueMap.clear(); + foreach (UASQuickViewItem* i, uasPropertyToLabelMap.values()) + { + i->deleteLater(); + } + uasPropertyToLabelMap.clear(); + + updateTimer->stop(); + foreach (QAction* i, this->actions()) + { + i->deleteLater(); + } } + + // Update the UAS to point to the new one. this->uas = uas; - connect(uas,SIGNAL(valueChanged(int,QString,QString,QVariant,quint64)),this,SLOT(valueChanged(int,QString,QString,QVariant,quint64))); - //connect(uas,SIGNAL()) + + if (this->uas) + { + connect(uas,SIGNAL(valueChanged(int,QString,QString,QVariant,quint64)),this,SLOT(valueChanged(int,QString,QString,QVariant,quint64))); + updateTimer->start(1000); + } } + void UASQuickView::addSource(MAVLinkDecoder *decoder) { connect(decoder,SIGNAL(valueChanged(int,QString,QString,double,quint64)),this,SLOT(valueChanged(int,QString,QString,double,quint64))); @@ -224,8 +188,12 @@ void UASQuickView::addSource(MAVLinkDecoder *decoder) connect(decoder,SIGNAL(valueChanged(int,QString,QString,quint32,quint64)),this,SLOT(valueChanged(int,QString,QString,quint32,quint64))); connect(decoder,SIGNAL(valueChanged(int,QString,QString,quint64,quint64)),this,SLOT(valueChanged(int,QString,QString,quint64,quint64))); } + void UASQuickView::valueChanged(const int uasId, const QString& name, const QString& unit, const quint8 value, const quint64 msec) { + Q_UNUSED(uasId); + Q_UNUSED(unit); + Q_UNUSED(msec); if (!uasPropertyValueMap.contains(name)) { if (quickViewSelectDialog) @@ -238,6 +206,9 @@ void UASQuickView::valueChanged(const int uasId, const QString& name, const QStr void UASQuickView::valueChanged(const int uasId, const QString& name, const QString& unit, const qint8 value, const quint64 msec) { + Q_UNUSED(uasId); + Q_UNUSED(unit); + Q_UNUSED(msec); if (!uasPropertyValueMap.contains(name)) { if (quickViewSelectDialog) @@ -247,8 +218,12 @@ void UASQuickView::valueChanged(const int uasId, const QString& name, const QStr } uasPropertyValueMap[name] = value; } + void UASQuickView::valueChanged(const int uasId, const QString& name, const QString& unit, const quint16 value, const quint64 msec) { + Q_UNUSED(uasId); + Q_UNUSED(unit); + Q_UNUSED(msec); if (!uasPropertyValueMap.contains(name)) { if (quickViewSelectDialog) @@ -258,8 +233,12 @@ void UASQuickView::valueChanged(const int uasId, const QString& name, const QStr } uasPropertyValueMap[name] = value; } + void UASQuickView::valueChanged(const int uasId, const QString& name, const QString& unit, const qint16 value, const quint64 msec) { + Q_UNUSED(uasId); + Q_UNUSED(unit); + Q_UNUSED(msec); if (!uasPropertyValueMap.contains(name)) { if (quickViewSelectDialog) @@ -269,19 +248,30 @@ void UASQuickView::valueChanged(const int uasId, const QString& name, const QStr } uasPropertyValueMap[name] = value; } + void UASQuickView::valueChanged(const int uasId, const QString& name, const QString& unit, const quint32 value, const quint64 msec) { + Q_UNUSED(uasId); + Q_UNUSED(unit); + Q_UNUSED(msec); if (!uasPropertyValueMap.contains(name)) { if (quickViewSelectDialog) { quickViewSelectDialog->addItem(name); } + + // And periodically update the view. + updateTimer->start(1000); } uasPropertyValueMap[name] = value; } + void UASQuickView::valueChanged(const int uasId, const QString& name, const QString& unit, const qint32 value, const quint64 msec) { + Q_UNUSED(uasId); + Q_UNUSED(unit); + Q_UNUSED(msec); if (!uasPropertyValueMap.contains(name)) { if (quickViewSelectDialog) @@ -291,8 +281,12 @@ void UASQuickView::valueChanged(const int uasId, const QString& name, const QStr } uasPropertyValueMap[name] = value; } + void UASQuickView::valueChanged(const int uasId, const QString& name, const QString& unit, const quint64 value, const quint64 msec) { + Q_UNUSED(uasId); + Q_UNUSED(unit); + Q_UNUSED(msec); if (!uasPropertyValueMap.contains(name)) { if (quickViewSelectDialog) @@ -302,19 +296,30 @@ void UASQuickView::valueChanged(const int uasId, const QString& name, const QStr } uasPropertyValueMap[name] = value; } + void UASQuickView::valueChanged(const int uasId, const QString& name, const QString& unit, const qint64 value, const quint64 msec) { + Q_UNUSED(uasId); + Q_UNUSED(unit); + Q_UNUSED(msec); if (!uasPropertyValueMap.contains(name)) { if (quickViewSelectDialog) { quickViewSelectDialog->addItem(name); } + + // And periodically update the view. + updateTimer->start(1000); } uasPropertyValueMap[name] = value; } + void UASQuickView::valueChanged(const int uasId, const QString& name, const QString& unit, const double value, const quint64 msec) { + Q_UNUSED(uasId); + Q_UNUSED(unit); + Q_UNUSED(msec); if (!uasPropertyValueMap.contains(name)) { if (quickViewSelectDialog) @@ -325,6 +330,21 @@ void UASQuickView::valueChanged(const int uasId, const QString& name, const QStr uasPropertyValueMap[name] = value; } +void UASQuickView::valueChanged(const int uasId, const QString& name, const QString& unit, const QVariant value,const quint64 msec) +{ + Q_UNUSED(uasId); + Q_UNUSED(unit); + Q_UNUSED(msec); + if (!uasPropertyValueMap.contains(name)) + { + if (quickViewSelectDialog) + { + quickViewSelectDialog->addItem(name); + } + } + uasPropertyValueMap[name] = value.toDouble(); +} + void UASQuickView::actionTriggered(bool checked) { QAction *senderlabel = qobject_cast(sender()); @@ -336,24 +356,20 @@ void UASQuickView::actionTriggered(bool checked) { UASQuickViewItem *item = new UASQuickViewTextItem(this); item->setTitle(senderlabel->text()); - ui.verticalLayout->addWidget(item); + this->layout()->addWidget(item); uasPropertyToLabelMap[senderlabel->text()] = item; } else { - ui.verticalLayout->removeWidget(uasPropertyToLabelMap[senderlabel->text()]); + this->layout()->removeWidget(uasPropertyToLabelMap[senderlabel->text()]); uasPropertyToLabelMap[senderlabel->text()]->deleteLater(); uasPropertyToLabelMap.remove(senderlabel->text()); } } -void UASQuickView::valueChanged(const int uasid, const QString& name, const QString& unit, const QVariant value,const quint64 msecs) -{ - uasPropertyValueMap[name] = value.toDouble(); -} void UASQuickView::valChanged(double val,QString type) { - //qDebug() << "Value changed:" << type << val; - // uasPropertyValueMap[type] = val; + Q_UNUSED(val); + Q_UNUSED(type); } diff --git a/src/ui/uas/UASQuickView.h b/src/ui/uas/UASQuickView.h index 7a709f20d00b4531f2a6154c53957e10b4b7d98e..943fa8c66542f000b2d84d45a0782ce45e7622ae 100644 --- a/src/ui/uas/UASQuickView.h +++ b/src/ui/uas/UASQuickView.h @@ -17,6 +17,10 @@ public: UASQuickView(QWidget *parent = 0); void addSource(MAVLinkDecoder *decoder); private: + /** + * Adds a default set of actions to the widget's menu. + */ + void addDefaultActions(); UASInterface *uas; /** List of enabled properties */ @@ -30,6 +34,7 @@ private: /** Timer for updating the UI */ QTimer *updateTimer; + Ui::UASQuickView* m_ui; /** Selection dialog for selectin/deselecting gauge items */ UASQuickViewItemSelect *quickViewSelectDialog; @@ -40,9 +45,8 @@ private: /** Loads gauge layout from settings file */ void loadSettings(); protected: - Ui::Form ui; signals: - + public slots: void valueChanged(const int uasId, const QString& name, const QString& unit, const quint8 value, const quint64 msec); void valueChanged(const int uasId, const QString& name, const QString& unit, const qint8 value, const quint64 msec); @@ -53,8 +57,8 @@ public slots: void valueChanged(const int uasId, const QString& name, const QString& unit, const quint64 value, const quint64 msec); void valueChanged(const int uasId, const QString& name, const QString& unit, const qint64 value, const quint64 msec); void valueChanged(const int uasId, const QString& name, const QString& unit, const double value, const quint64 msec); + void valueChanged(const int uasId, const QString& name, const QString& unit, const QVariant value, const quint64 msec); - void valueChanged(const int uasid, const QString& name, const QString& unit, const QVariant value,const quint64 msecs); void actionTriggered(bool checked); void actionTriggered(); void updateTimerTick(); diff --git a/src/ui/uas/UASQuickView.ui b/src/ui/uas/UASQuickView.ui index 067c3afc6f489a4914bcb40aebc2e1307a1fa1af..50f17082a0fe822ebd6ee6f3bf453aab7ed4e273 100644 --- a/src/ui/uas/UASQuickView.ui +++ b/src/ui/uas/UASQuickView.ui @@ -1,7 +1,7 @@ - Form - + UASQuickView + 0 @@ -10,6 +10,12 @@ 300 + + + 0 + 0 + + 100 @@ -19,14 +25,13 @@ Form - - - - - 0 - - - + + + QLayout::SetMinimumSize + + + 0 + diff --git a/src/ui/uas/UASQuickViewItem.cc b/src/ui/uas/UASQuickViewItem.cc index 421a14ef6bbfcd2946523ebe85d4cf06383d8eae..aecc923488440343fd6b51ba3d786e1d66e314cf 100644 --- a/src/ui/uas/UASQuickViewItem.cc +++ b/src/ui/uas/UASQuickViewItem.cc @@ -1,7 +1,6 @@ #include "UASQuickViewItem.h" -#include -UASQuickViewItem::UASQuickViewItem(QWidget *parent) : QWidget(parent) +UASQuickViewItem::UASQuickViewItem(QWidget *parent) : + QWidget(parent) { - } diff --git a/src/ui/uas/UASQuickViewItem.h b/src/ui/uas/UASQuickViewItem.h index a406c4a2aba344b548c678b7d82af19377384e11..8bba60ba3c8633264be811679d82e89849b6cdf2 100644 --- a/src/ui/uas/UASQuickViewItem.h +++ b/src/ui/uas/UASQuickViewItem.h @@ -2,7 +2,6 @@ #define UASQUICKVIEWITEM_H #include -#include class UASQuickViewItem : public QWidget { Q_OBJECT diff --git a/src/ui/uas/UASQuickViewTextItem.cc b/src/ui/uas/UASQuickViewTextItem.cc index d03d1f9dc9abcd6bf5a6e4449206da9920bcfb26..520ad948e9e1719eac57dc34187c5b3f6288251f 100644 --- a/src/ui/uas/UASQuickViewTextItem.cc +++ b/src/ui/uas/UASQuickViewTextItem.cc @@ -2,24 +2,35 @@ #include UASQuickViewTextItem::UASQuickViewTextItem(QWidget *parent) : UASQuickViewItem(parent) { - QVBoxLayout *layout = new QVBoxLayout(); - this->setLayout(layout); - layout->setSpacing(0); + // Set a standard vertical layout. + QVBoxLayout* layout = new QVBoxLayout(); layout->setMargin(0); + layout->setSizeConstraint(QLayout::SetMinimumSize); + + // Create the title label. Scale the font based on available size. titleLabel = new QLabel(this); titleLabel->setAlignment(Qt::AlignHCenter); - this->layout()->addWidget(titleLabel); + titleLabel->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Minimum); + titleLabel->setObjectName(QString::fromUtf8("title")); + QFont titlefont = titleLabel->font(); + titlefont.setPixelSize(this->height() / 4.0); + titleLabel->setFont(titlefont); + layout->addWidget(titleLabel); + + // Create the value label. Scale the font based on available size. valueLabel = new QLabel(this); valueLabel->setAlignment(Qt::AlignHCenter); + valueLabel->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Minimum); + valueLabel->setObjectName(QString::fromUtf8("value")); valueLabel->setText("0.00"); - this->layout()->addWidget(valueLabel); - layout->addSpacerItem(new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding)); QFont valuefont = valueLabel->font(); - QFont titlefont = titleLabel->font(); valuefont.setPixelSize(this->height() / 2.0); - titlefont.setPixelSize(this->height() / 4.0); valueLabel->setFont(valuefont); - titleLabel->setFont(titlefont); + layout->addWidget(valueLabel); + + // And make sure the items are evenly spaced in the UASQuickView. + layout->addSpacerItem(new QSpacerItem(20, 0, QSizePolicy::Minimum, QSizePolicy::Expanding)); + this->setLayout(layout); } void UASQuickViewTextItem::setValue(double value) { diff --git a/src/ui/uas/UASView.cc b/src/ui/uas/UASView.cc index 7a6b7e6b045810df4366c6f976fe1351bc103c10..9b051369dbc48283dafe839d50705e0da8f7cb3c 100644 --- a/src/ui/uas/UASView.cc +++ b/src/ui/uas/UASView.cc @@ -43,47 +43,49 @@ This file is part of the PIXHAWK project #include UASView::UASView(UASInterface* uas, QWidget *parent) : - QWidget(parent), - startTime(0), - timeout(false), - iconIsRed(true), - timeRemaining(0), - chargeLevel(0), - uas(uas), - load(0), - state("UNKNOWN"), - stateDesc(tr("Unknown state")), - mode("MAV_MODE_UNKNOWN"), - thrust(0), - isActive(false), - x(0), - y(0), - z(0), - totalSpeed(0), - lat(0), - lon(0), - alt(0), - groundDistance(0), - localFrame(false), - globalFrameKnown(false), - removeAction(new QAction("Delete this system", this)), - renameAction(new QAction("Rename..", this)), - selectAction(new QAction("Control this system", this )), - hilAction(new QAction("HIL - Hardware in the Loop", this )), - selectAirframeAction(new QAction("Choose Airframe", this)), - setBatterySpecsAction(new QAction("Set Battery Options", this)), - lowPowerModeEnabled(true), - generalUpdateCount(0), - filterTime(0), - m_ui(new Ui::UASView) + QWidget(parent), + uas(uas), + startTime(0), + timeout(false), + iconIsRed(true), + disconnected(false), + timeRemaining(0), + chargeLevel(0), + load(0), + state("UNKNOWN"), + stateDesc(tr("Unknown state")), + mode("MAV_MODE_UNKNOWN"), + thrust(0), + isActive(false), + x(0), + y(0), + z(0), + totalSpeed(0), + lat(0), + lon(0), + alt(0), + groundDistance(0), + localFrame(false), + globalFrameKnown(false), + removeAction(new QAction(tr("Delete this system"), this)), + renameAction(new QAction(tr("Rename.."), this)), + selectAction(new QAction(tr("Control this system"), this)), + hilAction(new QAction(tr("HIL - Hardware in the Loop"), this)), + selectAirframeAction(new QAction(tr("Choose Airframe"), this)), + setBatterySpecsAction(new QAction(tr("Set Battery Options"), this)), + lowPowerModeEnabled(true), + generalUpdateCount(0), + filterTime(0), + m_ui(new Ui::UASView) { + m_ui->setupUi(this); + setToolTip(""); // Make sure the QGroupBox's tooltip doesn't seep through. + // FIXME XXX lowPowerModeEnabled = MainWindow::instance()->lowPowerModeEnabled(); hilAction->setCheckable(true); - m_ui->setupUi(this); - // Setup communication //connect(uas, SIGNAL(valueChanged(int,QString,double,quint64)), this, SLOT(receiveValue(int,QString,double,quint64))); connect(uas, SIGNAL(batteryChanged(UASInterface*, double, double, double, int)), this, SLOT(updateBattery(UASInterface*, double, double, double, int))); @@ -104,7 +106,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : connect(uas, SIGNAL(navModeChanged(int, int, QString)), this, SLOT(updateNavMode(int, int, QString))); // Setup UAS selection - connect(m_ui->uasViewFrame, SIGNAL(clicked(bool)), this, SLOT(setUASasActive(bool))); + connect(this, SIGNAL(clicked(bool)), this, SLOT(setUASasActive(bool))); // Setup user interaction connect(m_ui->liftoffButton, SIGNAL(clicked()), uas, SLOT(launch())); @@ -115,14 +117,13 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : connect(m_ui->killButton, SIGNAL(clicked()), uas, SLOT(emergencyKILL())); connect(m_ui->shutdownButton, SIGNAL(clicked()), uas, SLOT(shutdown())); - // Allow to delete this widget - connect(removeAction, SIGNAL(triggered()), this, SLOT(deleteLater())); + // Allow deleting this widget + connect(removeAction, SIGNAL(triggered()), this, SLOT(triggerUASDeletion())); connect(renameAction, SIGNAL(triggered()), this, SLOT(rename())); connect(selectAction, SIGNAL(triggered()), uas, SLOT(setSelected())); connect(hilAction, SIGNAL(triggered(bool)), this, SLOT(showHILUi())); connect(selectAirframeAction, SIGNAL(triggered()), this, SLOT(selectAirframe())); connect(setBatterySpecsAction, SIGNAL(triggered()), this, SLOT(setBatterySpecs())); - connect(uas, SIGNAL(systemRemoved()), this, SLOT(deleteLater())); // Name changes connect(uas, SIGNAL(nameChanged(QString)), this, SLOT(updateName(QString))); @@ -139,8 +140,6 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : m_ui->nameLabel->setText(uas->getUASName()); } - setBackgroundColor(); - // Heartbeat fade refreshTimer = new QTimer(this); connect(refreshTimer, SIGNAL(timeout()), this, SLOT(refresh())); @@ -153,7 +152,13 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : refreshTimer->start(updateInterval); } - // Hide kill and shutdown buttons per default + // Style some elements by default to the UAS' color. + heartbeatColor = uas->getColor(); + QString colorstyle("QLabel { background-color: %1; }"); + m_ui->typeLabel->setStyleSheet(colorstyle.arg(heartbeatColor.name())); + updateActiveUAS(uas, false); + + // Hide kill and shutdown buttons by default m_ui->killButton->hide(); m_ui->shutdownButton->hide(); @@ -166,9 +171,6 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : UASView::~UASView() { delete m_ui; - delete removeAction; - delete renameAction; - delete selectAction; } void UASView::heartbeatTimeout(bool timeout, unsigned int ms) @@ -193,30 +195,6 @@ void UASView::showStatusText(int uasid, int componentid, int severity, QString t stateDesc = text; } -/** - * Set the background color based on the MAV color. If the MAV is selected as the - * currently actively controlled system, the frame color is highlighted - */ -void UASView::setBackgroundColor() -{ - // UAS color - QColor uasColor = uas->getColor(); - QString colorstyle; - QString borderColor = "#4A4A4F"; - if (isActive) - { - borderColor = "#FA4A4F"; - uasColor = uasColor.darker(475); - } - else - { - uasColor = uasColor.darker(675); - } - colorstyle = colorstyle.sprintf("QGroupBox { border-radius: 12px; padding: 0px; margin: 0px; background-color: #%02X%02X%02X; border: 2px solid %s; }", - uasColor.red(), uasColor.green(), uasColor.blue(), borderColor.toStdString().c_str()); - m_ui->uasViewFrame->setStyleSheet(colorstyle); -} - void UASView::setUASasActive(bool active) { if (active) @@ -230,7 +208,14 @@ void UASView::updateActiveUAS(UASInterface* uas, bool active) if (uas == this->uas) { this->isActive = active; - setBackgroundColor(); + if (active) + { + setStyleSheet("UASView { border-width: 3px}"); + } + else + { + setStyleSheet(QString("UASView { border-color: %1}").arg(heartbeatColor.name())); + } } } @@ -295,11 +280,16 @@ void UASView::hideEvent(QHideEvent* event) void UASView::receiveHeartbeat(UASInterface* uas) { - Q_UNUSED(uas); - heartbeatColor = QColor(20, 200, 20); - QString colorstyle("QGroupBox { border-radius: 5px; padding: 2px; margin: 0px; border: 0px; background-color: %1; }"); - m_ui->heartbeatIcon->setStyleSheet(colorstyle.arg(heartbeatColor.name())); - if (timeout) setBackgroundColor(); + heartbeatColor = uas->getColor(); + QString colorstyle("QLabel { background-color: %1; }"); + m_ui->heartBeatLabel->setStyleSheet(colorstyle.arg(heartbeatColor.name())); + + // If we're returning from a disconnection, recolor things properly. + if (disconnected) + { + updateActiveUAS(this->uas, this->isActive); + disconnected = false; + } timeout = false; } @@ -323,22 +313,22 @@ void UASView::setSystemType(UASInterface* uas, unsigned int systemType) switch (systemType) { case MAV_TYPE_GENERIC: - m_ui->typeButton->setIcon(QIcon(":/files/images/mavs/generic.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":/files/images/mavs/generic.svg")); break; case MAV_TYPE_FIXED_WING: - m_ui->typeButton->setIcon(QIcon(":/files/images/mavs/fixed-wing.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":/files/images/mavs/fixed-wing.svg")); break; case MAV_TYPE_QUADROTOR: - m_ui->typeButton->setIcon(QIcon(":/files/images/mavs/quadrotor.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":/files/images/mavs/quadrotor.svg")); break; case MAV_TYPE_COAXIAL: - m_ui->typeButton->setIcon(QIcon(":/files/images/mavs/coaxial.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":/files/images/mavs/coaxial.svg")); break; case MAV_TYPE_HELICOPTER: - m_ui->typeButton->setIcon(QIcon(":/files/images/mavs/helicopter.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":/files/images/mavs/helicopter.svg")); break; case MAV_TYPE_ANTENNA_TRACKER: - m_ui->typeButton->setIcon(QIcon(":/files/images/mavs/unknown.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":/files/images/mavs/unknown.svg")); break; case MAV_TYPE_GCS: { // A groundstation is a special system type, update widget @@ -356,44 +346,44 @@ void UASView::setSystemType(UASInterface* uas, unsigned int systemType) m_ui->landButton->hide(); m_ui->shutdownButton->hide(); m_ui->abortButton->hide(); - m_ui->typeButton->setIcon(QIcon(":/files/images/mavs/groundstation.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":/files/images/mavs/groundstation.svg")); } break; case MAV_TYPE_AIRSHIP: - m_ui->typeButton->setIcon(QIcon(":files/images/mavs/airship.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":files/images/mavs/airship.svg")); break; case MAV_TYPE_FREE_BALLOON: - m_ui->typeButton->setIcon(QIcon(":files/images/mavs/free-balloon.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":files/images/mavs/free-balloon.svg")); break; case MAV_TYPE_ROCKET: - m_ui->typeButton->setIcon(QIcon(":files/images/mavs/rocket.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":files/images/mavs/rocket.svg")); break; case MAV_TYPE_GROUND_ROVER: - m_ui->typeButton->setIcon(QIcon(":files/images/mavs/ground-rover.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":files/images/mavs/ground-rover.svg")); break; case MAV_TYPE_SURFACE_BOAT: - m_ui->typeButton->setIcon(QIcon(":files/images/mavs/surface-boat.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":files/images/mavs/surface-boat.svg")); break; case MAV_TYPE_SUBMARINE: - m_ui->typeButton->setIcon(QIcon(":files/images/mavs/submarine.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":files/images/mavs/submarine.svg")); break; case MAV_TYPE_HEXAROTOR: - m_ui->typeButton->setIcon(QIcon(":files/images/mavs/hexarotor.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":files/images/mavs/hexarotor.svg")); break; case MAV_TYPE_OCTOROTOR: - m_ui->typeButton->setIcon(QIcon(":files/images/mavs/octorotor.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":files/images/mavs/octorotor.svg")); break; case MAV_TYPE_TRICOPTER: - m_ui->typeButton->setIcon(QIcon(":files/images/mavs/tricopter.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":files/images/mavs/tricopter.svg")); break; case MAV_TYPE_FLAPPING_WING: - m_ui->typeButton->setIcon(QIcon(":files/images/mavs/flapping-wing.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":files/images/mavs/flapping-wing.svg")); break; case MAV_TYPE_KITE: - m_ui->typeButton->setIcon(QIcon(":files/images/mavs/kite.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":files/images/mavs/kite.svg")); break; default: - m_ui->typeButton->setIcon(QIcon(":/files/images/mavs/unknown.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":/files/images/mavs/unknown.svg")); break; } } @@ -570,14 +560,14 @@ void UASView::showHILUi() MainWindow::instance()->showHILConfigurationWidget(uas); } -void UASView::refresh() +void UASView::triggerUASDeletion() { - //setUpdatesEnabled(false); - //setUpdatesEnabled(true); - //repaint(); - //qDebug() << "UPDATING UAS WIDGET!" << uas->getUASName(); - + refreshTimer->stop(); + UASManager::instance()->removeUAS(uas); +} +void UASView::refresh() +{ if (generalUpdateCount == 4) { #if (QGC_EVENTLOOP_DEBUG) @@ -678,54 +668,39 @@ void UASView::refresh() } generalUpdateCount++; - QString colorstyle("QGroupBox { border-radius: 5px; padding: 2px; margin: 0px; border: 0px; background-color: %1; }"); - if (timeout) { // CRITICAL CONDITION, NO HEARTBEAT + disconnected = true; - QString borderColor = "#FFFF00"; - if (isActive) - { - borderColor = "#FA4A4F"; - } - + QColor warnColor; if (iconIsRed) { - QColor warnColor(Qt::red); - m_ui->heartbeatIcon->setStyleSheet(colorstyle.arg(warnColor.name())); - QString style = QString("QGroupBox { border-radius: 12px; padding: 0px; margin: 0px; border: 2px solid %1; background-color: %2; }").arg(borderColor, warnColor.name()); - m_ui->uasViewFrame->setStyleSheet(style); + warnColor = Qt::red; } else { - QColor warnColor(Qt::black); - m_ui->heartbeatIcon->setStyleSheet(colorstyle.arg(warnColor.name())); - QString style = QString("QGroupBox { border-radius: 12px; padding: 0px; margin: 0px; border: 2px solid %1; background-color: %2; }").arg(borderColor, warnColor.name()); - m_ui->uasViewFrame->setStyleSheet(style); - + warnColor = Qt::darkRed; refreshTimer->setInterval(errorUpdateInterval); refreshTimer->start(); } + QString style = QString("UASView {background-color: %1;}").arg(warnColor.name()); + this->setStyleSheet(style); iconIsRed = !iconIsRed; } else { + // If we're not in low power mode, add the additional visual effect of + // fading out the color of the heartbeat for this UAS. if (!lowPowerModeEnabled) { - // Fade heartbeat icon - // Make color darker - heartbeatColor = heartbeatColor.darker(210); - - //m_ui->heartbeatIcon->setAutoFillBackground(true); - m_ui->heartbeatIcon->setStyleSheet(colorstyle.arg(heartbeatColor.name())); + heartbeatColor = heartbeatColor.darker(110); + QString colorstyle("QLabel {background-color: %1;}"); + m_ui->heartBeatLabel->setStyleSheet(colorstyle.arg(heartbeatColor.name())); refreshTimer->setInterval(updateInterval); refreshTimer->start(); } } - //setUpdatesEnabled(true); - - //setUpdatesEnabled(false); } void UASView::changeEvent(QEvent *e) @@ -740,3 +715,14 @@ void UASView::changeEvent(QEvent *e) break; } } + +/** + * Implement paintEvent() so that stylesheets work for our custom widget. + */ +void UASView::paintEvent(QPaintEvent *) +{ + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); +} diff --git a/src/ui/uas/UASView.h b/src/ui/uas/UASView.h index 6ad214ede0e65432d3d451538a3831770ab9efbf..70eb11202d6ea7310c0c09cf844a5c1164d74218 100644 --- a/src/ui/uas/UASView.h +++ b/src/ui/uas/UASView.h @@ -49,6 +49,7 @@ class UASView : public QWidget public: UASView(UASInterface* uas, QWidget *parent = 0); ~UASView(); + UASInterface* uas; public slots: /** @brief Update the name of the system */ @@ -65,6 +66,11 @@ public slots: void updateLoad(UASInterface* uas, double load); //void receiveValue(int uasid, QString id, double value, quint64 time); void showHILUi(); + /** + * Request that the UASManager deletes this UAS. This doesn't delete this widget + * yet, it waits for the approprait uasDeleted signal. + */ + void triggerUASDeletion(); void refresh(); /** @brief Receive new waypoint information */ void setWaypoint(int uasId, int id, double x, double y, double z, double yaw, bool autocontinue, bool current); @@ -80,8 +86,6 @@ public slots: void updateActiveUAS(UASInterface* uas, bool active); /** @brief Set the widget into critical mode */ void heartbeatTimeout(bool timeout, unsigned int ms); - /** @brief Set the background color for the widget */ - void setBackgroundColor(); /** @brief Bring up the dialog to rename the system */ void rename(); /** @brief Select airframe for this vehicle */ @@ -100,9 +104,9 @@ protected: quint64 startTime; bool timeout; bool iconIsRed; + bool disconnected; int timeRemaining; float chargeLevel; - UASInterface* uas; float load; QString state; QString stateDesc; @@ -146,6 +150,7 @@ protected: private: Ui::UASView *m_ui; + virtual void paintEvent(QPaintEvent *); signals: void uasInFocus(UASInterface* uas);