[10] | 1 | // %flair:license{
|
---|
[15] | 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[10] | 4 | // %flair:license}
|
---|
[7] | 5 | // created: 2014/04/11
|
---|
| 6 | // filename: UavMultiplex.cpp
|
---|
| 7 | //
|
---|
| 8 | // author: Guillaume Sanahuja
|
---|
| 9 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 10 | //
|
---|
| 11 | // version: $Id: $
|
---|
| 12 | //
|
---|
| 13 | // purpose: Class defining uav multiplexing
|
---|
| 14 | //
|
---|
| 15 | //
|
---|
| 16 | /*********************************************************************/
|
---|
| 17 |
|
---|
| 18 | #include "UavMultiplex.h"
|
---|
| 19 | #include "UavMultiplex_impl.h"
|
---|
| 20 | #include <cvmatrix.h>
|
---|
| 21 | #include <FrameworkManager.h>
|
---|
| 22 | #include <Tab.h>
|
---|
| 23 | #include <GridLayout.h>
|
---|
[45] | 24 | #include "compile_info.h"
|
---|
[7] | 25 |
|
---|
| 26 | using std::string;
|
---|
| 27 | using namespace flair::core;
|
---|
| 28 | using namespace flair::gui;
|
---|
| 29 |
|
---|
[45] | 30 | //todo: put it on seprate file, but not possible with static lib?
|
---|
| 31 | static void constructor() __attribute__((constructor));
|
---|
| 32 |
|
---|
| 33 | void constructor() {
|
---|
| 34 | compile_info("FlairFilter");
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 |
|
---|
[15] | 38 | namespace flair {
|
---|
| 39 | namespace filter {
|
---|
[7] | 40 |
|
---|
[15] | 41 | UavMultiplex::UavMultiplex(const core::FrameworkManager *parent,
|
---|
| 42 | std::string name)
|
---|
| 43 | : IODevice(parent, name) {
|
---|
| 44 | pimpl_ = new UavMultiplex_impl(parent, this, name);
|
---|
[7] | 45 | }
|
---|
| 46 |
|
---|
[15] | 47 | UavMultiplex::~UavMultiplex(void) { delete pimpl_; }
|
---|
[7] | 48 |
|
---|
[15] | 49 | void UavMultiplex::Update(core::Time time) {
|
---|
| 50 | pimpl_->input->SetDataTime(time);
|
---|
| 51 | UpdateFrom(pimpl_->input);
|
---|
[7] | 52 | }
|
---|
| 53 |
|
---|
[15] | 54 | void UavMultiplex::SetMultiplexComboBox(string name, int index) {
|
---|
| 55 | pimpl_->SetMultiplexComboBox(name, index);
|
---|
[7] | 56 | }
|
---|
| 57 |
|
---|
[15] | 58 | int UavMultiplex::MultiplexValue(int index) const {
|
---|
| 59 | return pimpl_->MultiplexValue(index);
|
---|
[7] | 60 | }
|
---|
| 61 |
|
---|
[15] | 62 | TabWidget *UavMultiplex::GetTabWidget(void) const { return pimpl_->tabwidget; }
|
---|
[7] | 63 |
|
---|
[15] | 64 | Layout *UavMultiplex::GetLayout(void) const { return pimpl_->setup_tab; }
|
---|
[7] | 65 |
|
---|
[15] | 66 | void UavMultiplex::LockUserInterface(void) const {
|
---|
| 67 | pimpl_->setup_tab->setEnabled(false);
|
---|
[7] | 68 | }
|
---|
| 69 |
|
---|
[15] | 70 | void UavMultiplex::UnlockUserInterface(void) const {
|
---|
| 71 | pimpl_->setup_tab->setEnabled(true);
|
---|
[7] | 72 | }
|
---|
| 73 |
|
---|
[15] | 74 | void UavMultiplex::SetRoll(float value) {
|
---|
| 75 | pimpl_->input->SetValue(0, 0, value);
|
---|
[7] | 76 | }
|
---|
| 77 |
|
---|
[15] | 78 | void UavMultiplex::SetPitch(float value) {
|
---|
| 79 | pimpl_->input->SetValue(1, 0, value);
|
---|
[7] | 80 | }
|
---|
| 81 |
|
---|
[15] | 82 | void UavMultiplex::SetYaw(float value) { pimpl_->input->SetValue(2, 0, value); }
|
---|
[7] | 83 |
|
---|
[15] | 84 | void UavMultiplex::SetThrust(float value) {
|
---|
| 85 | pimpl_->input->SetValue(3, 0, value);
|
---|
[7] | 86 | }
|
---|
| 87 |
|
---|
[15] | 88 | void UavMultiplex::SetRollTrim(float value) {
|
---|
| 89 | pimpl_->input->SetValue(4, 0, value);
|
---|
[7] | 90 | }
|
---|
| 91 |
|
---|
[15] | 92 | void UavMultiplex::SetPitchTrim(float value) {
|
---|
| 93 | pimpl_->input->SetValue(5, 0, value);
|
---|
[7] | 94 | }
|
---|
| 95 |
|
---|
[15] | 96 | void UavMultiplex::SetYawTrim(float value) {
|
---|
| 97 | pimpl_->input->SetValue(6, 0, value);
|
---|
[7] | 98 | }
|
---|
| 99 |
|
---|
| 100 | } // end namespace filter
|
---|
| 101 | } // end namespace flair
|
---|