[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 |
|
---|
[137] | 41 | UavMultiplex::UavMultiplex(std::string name)
|
---|
| 42 | : IODevice(getFrameworkManager(), name) {
|
---|
| 43 | pimpl_ = new UavMultiplex_impl(this, name);
|
---|
[7] | 44 | }
|
---|
| 45 |
|
---|
[15] | 46 | UavMultiplex::~UavMultiplex(void) { delete pimpl_; }
|
---|
[7] | 47 |
|
---|
[15] | 48 | void UavMultiplex::Update(core::Time time) {
|
---|
| 49 | pimpl_->input->SetDataTime(time);
|
---|
| 50 | UpdateFrom(pimpl_->input);
|
---|
[7] | 51 | }
|
---|
| 52 |
|
---|
[15] | 53 | void UavMultiplex::SetMultiplexComboBox(string name, int index) {
|
---|
| 54 | pimpl_->SetMultiplexComboBox(name, index);
|
---|
[7] | 55 | }
|
---|
| 56 |
|
---|
[15] | 57 | int UavMultiplex::MultiplexValue(int index) const {
|
---|
| 58 | return pimpl_->MultiplexValue(index);
|
---|
[7] | 59 | }
|
---|
| 60 |
|
---|
[15] | 61 | TabWidget *UavMultiplex::GetTabWidget(void) const { return pimpl_->tabwidget; }
|
---|
[7] | 62 |
|
---|
[15] | 63 | Layout *UavMultiplex::GetLayout(void) const { return pimpl_->setup_tab; }
|
---|
[7] | 64 |
|
---|
[15] | 65 | void UavMultiplex::LockUserInterface(void) const {
|
---|
| 66 | pimpl_->setup_tab->setEnabled(false);
|
---|
[7] | 67 | }
|
---|
| 68 |
|
---|
[15] | 69 | void UavMultiplex::UnlockUserInterface(void) const {
|
---|
| 70 | pimpl_->setup_tab->setEnabled(true);
|
---|
[7] | 71 | }
|
---|
| 72 |
|
---|
[15] | 73 | void UavMultiplex::SetRoll(float value) {
|
---|
| 74 | pimpl_->input->SetValue(0, 0, value);
|
---|
[7] | 75 | }
|
---|
| 76 |
|
---|
[15] | 77 | void UavMultiplex::SetPitch(float value) {
|
---|
| 78 | pimpl_->input->SetValue(1, 0, value);
|
---|
[7] | 79 | }
|
---|
| 80 |
|
---|
[15] | 81 | void UavMultiplex::SetYaw(float value) { pimpl_->input->SetValue(2, 0, value); }
|
---|
[7] | 82 |
|
---|
[15] | 83 | void UavMultiplex::SetThrust(float value) {
|
---|
| 84 | pimpl_->input->SetValue(3, 0, value);
|
---|
[7] | 85 | }
|
---|
| 86 |
|
---|
[15] | 87 | void UavMultiplex::SetRollTrim(float value) {
|
---|
| 88 | pimpl_->input->SetValue(4, 0, value);
|
---|
[7] | 89 | }
|
---|
| 90 |
|
---|
[15] | 91 | void UavMultiplex::SetPitchTrim(float value) {
|
---|
| 92 | pimpl_->input->SetValue(5, 0, value);
|
---|
[7] | 93 | }
|
---|
| 94 |
|
---|
[15] | 95 | void UavMultiplex::SetYawTrim(float value) {
|
---|
| 96 | pimpl_->input->SetValue(6, 0, value);
|
---|
[7] | 97 | }
|
---|
| 98 |
|
---|
| 99 | } // end namespace filter
|
---|
| 100 | } // end namespace flair
|
---|