source: flair-src/trunk/lib/FlairMeta/src/MetaUsRangeFinder.cpp@ 422

Last change on this file since 422 was 422, checked in by Sanahuja Guillaume, 9 months ago

test pour recaler l'us en fonction de l'orientation

File size: 2.4 KB
Line 
1// %flair:license{
2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
4// %flair:license}
5// created: 2013/04/08
6// filename: MetaUsRangeFinder.cpp
7//
8// author: Guillaume Sanahuja
9// Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11// version: $Id: $
12//
13// purpose: objet integrant une dérivée
14// d'euler, un passe bas et un generateur de consigne
15// -> adapté pour un capteur d'altitude
16//
17//
18/*********************************************************************/
19
20#include "MetaUsRangeFinder.h"
21#include "UsRangeFinder.h"
22#include <LowPassFilter.h>
23#include <ButterworthLowPass.h>
24#include <Layout.h>
25#include <DataPlot1D.h>
26#include <Tab.h>
27#include <EulerDerivative.h>
28#include <GroupBox.h>
29#include <Matrix.h>
30
31using std::string;
32using namespace flair::core;
33using namespace flair::gui;
34using namespace flair::filter;
35using namespace flair::sensor;
36
37namespace flair {
38namespace meta {
39
40MetaUsRangeFinder::MetaUsRangeFinder(UsRangeFinder *us)
41 : Object(us, us->ObjectName()) {
42 //TODO: mettre une rotation entre la sortie US et le low pass
43 //pour eviter les fausses mesures quand le drone est orienté
44 /* ex
45 Vector3Df test(0,0,altitude+0.04);
46 Printf("altitude av %f %f %f %f\n",altitude,test.x,test.y,test.z);
47 test.Rotate(currentQuaternion);
48 Printf("altitude ap %f %f %f %f\n",altitude,test.x,test.y,test.z-0.04);
49 */
50 this->us = us;
51 pbas_z =
52 new ButterworthLowPass(us, us->GetLayout()->NewRow(), "Passe bas", 3);
53 vz_euler = new EulerDerivative(pbas_z, us->GetLayout()->NewRow(), "Vz");
54 pbas_vz = new ButterworthLowPass(vz_euler, us->GetLayout()->NewRow(),
55 "Passe bas v", 3);
56}
57
58MetaUsRangeFinder::~MetaUsRangeFinder() {}
59
60void MetaUsRangeFinder::UseDefaultPlot(void) {
61 us->UseDefaultPlot();
62
63 us->GetPlot()->AddCurve(pbas_z->GetMatrix()->Element(0), DataPlot::Blue);
64
65 vz_plot = new DataPlot1D(us->GetPlotTab()->LastRowLastCol(), "vz", -2, 2);
66 vz_plot->AddCurve(vz_euler->GetMatrix()->Element(0));
67 vz_plot->AddCurve(pbas_vz->GetMatrix()->Element(0), DataPlot::Blue);
68}
69
70gui::DataPlot1D *MetaUsRangeFinder::GetZPlot() { return us->GetPlot(); }
71
72gui::DataPlot1D *MetaUsRangeFinder::GetVzPlot() { return vz_plot; }
73
74float MetaUsRangeFinder::z(void) const { return pbas_z->Output(); }
75
76float MetaUsRangeFinder::Vz(void) const { return pbas_vz->Output(); }
77
78} // end namespace sensor
79} // end namespace flair
Note: See TracBrowser for help on using the repository browser.