Browse Source

added some comments to radio calibration widgets

QGC4.4
Bryan Godbolt 15 years ago
parent
commit
84624f9064
  1. 2
      qgroundcontrol.pro
  2. 49
      src/ui/RadioCalibration/AbstractCalibrator.h
  3. 44
      src/ui/RadioCalibration/AirfoilServoCalibrator.h
  4. 40
      src/ui/RadioCalibration/CurveCalibrator.h
  5. 36
      src/ui/RadioCalibration/RadioCalibrationData.h
  6. 34
      src/ui/RadioCalibration/RadioCalibrationWindow.h
  7. 36
      src/ui/RadioCalibration/SwitchCalibrator.h

2
qgroundcontrol.pro

@ -272,8 +272,6 @@ SOURCES += src/main.cc \
src/ui/map/Waypoint2DIcon.cc \ src/ui/map/Waypoint2DIcon.cc \
src/ui/map/MAV2DIcon.cc \ src/ui/map/MAV2DIcon.cc \
src/ui/QGCRemoteControlView.cc \ src/ui/QGCRemoteControlView.cc \
src/WaypointGlobal.cpp \
src/ui/WaypointGlobalView.cpp \
src/ui/RadioCalibration/RadioCalibrationWindow.cc \ src/ui/RadioCalibration/RadioCalibrationWindow.cc \
src/ui/RadioCalibration/AirfoilServoCalibrator.cc \ src/ui/RadioCalibration/AirfoilServoCalibrator.cc \
src/ui/RadioCalibration/SwitchCalibrator.cc \ src/ui/RadioCalibration/SwitchCalibrator.cc \

49
src/ui/RadioCalibration/AbstractCalibrator.h

@ -1,3 +1,32 @@
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
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 <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Common aspects of radio calibration widgets
* @author Bryan Godbolt <godbolt@ualberta.ca>
*/
#ifndef ABSTRACTCALIBRATOR_H #ifndef ABSTRACTCALIBRATOR_H
#define ABSTRACTCALIBRATOR_H #define ABSTRACTCALIBRATOR_H
@ -8,6 +37,11 @@
#include <math.h> #include <math.h>
/**
@brief Holds the code which is common to all the radio calibration widgets.
@author Bryan Godbolt <godbolt@ece.ualberta.ca>
*/
class AbstractCalibrator : public QWidget class AbstractCalibrator : public QWidget
{ {
Q_OBJECT Q_OBJECT
@ -15,18 +49,33 @@ public:
explicit AbstractCalibrator(QWidget *parent = 0); explicit AbstractCalibrator(QWidget *parent = 0);
~AbstractCalibrator(); ~AbstractCalibrator();
/** Change the setpoints of the widget. Used when
changing the display from an external source (file/uav).
@param data QVector of setpoints
*/
virtual void set(const QVector<float>& data)=0; virtual void set(const QVector<float>& data)=0;
signals: signals:
/** Announce a setpoint change.
@param index setpoint number - 0 based in the current implementation
@param value new value
*/
void setpointChanged(int index, float value); void setpointChanged(int index, float value);
public slots: public slots:
/** Slot to call when the relevant channel is updated
@param raw current channel value
*/
void channelChanged(float raw); void channelChanged(float raw);
protected: protected:
/** Display the current pulse width */
QLabel *pulseWidth; QLabel *pulseWidth;
/** Log of the past few samples for use in averaging and finding extrema */
QVector<float> *log; QVector<float> *log;
/** Find the maximum or minimum of the data log */
float logExtrema(); float logExtrema();
/** Find the average of the log */
float logAverage(); float logAverage();
}; };

44
src/ui/RadioCalibration/AirfoilServoCalibrator.h

@ -1,3 +1,32 @@
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
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 <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Calibration widget for 3 point airfoil servo
* @author Bryan Godbolt <godbolt@ualberta.ca>
*/
#ifndef AIRFOILSERVOCALIBRATOR_H #ifndef AIRFOILSERVOCALIBRATOR_H
#define AIRFOILSERVOCALIBRATOR_H #define AIRFOILSERVOCALIBRATOR_H
@ -10,6 +39,12 @@
#include "AbstractCalibrator.h" #include "AbstractCalibrator.h"
/**
@brief Calibration widget three setpoint control input.
For the helicopter autopilot at UAlberta this is used for Aileron, Elevator, and Rudder channels.
@author Bryan Godbolt <godbolt@ece.ualberta.ca>
*/
class AirfoilServoCalibrator : public AbstractCalibrator class AirfoilServoCalibrator : public AbstractCalibrator
{ {
Q_OBJECT Q_OBJECT
@ -26,11 +61,6 @@ public:
/** @param data must have exaclty 3 elemets. they are assumed to be low center high */ /** @param data must have exaclty 3 elemets. they are assumed to be low center high */
void set(const QVector<float>& data); void set(const QVector<float>& data);
//signals:
// void highSetpointChanged(float);
// void centerSetpointChanged(float);
// void lowSetpointChanged(float);
protected slots: protected slots:
void setHigh(); void setHigh();
void setCenter(); void setCenter();
@ -40,10 +70,6 @@ protected:
QLabel *highPulseWidth; QLabel *highPulseWidth;
QLabel *centerPulseWidth; QLabel *centerPulseWidth;
QLabel *lowPulseWidth; QLabel *lowPulseWidth;
// float high;
// float center;
// float low;
}; };
#endif // AIRFOILSERVOCALIBRATOR_H #endif // AIRFOILSERVOCALIBRATOR_H

40
src/ui/RadioCalibration/CurveCalibrator.h

@ -1,3 +1,32 @@
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
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 <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Calibration widget for 5 point inerpolated curve
* @author Bryan Godbolt <godbolt@ualberta.ca>
*/
#ifndef CURVECALIBRATOR_H #ifndef CURVECALIBRATOR_H
#define CURVECALIBRATOR_H #define CURVECALIBRATOR_H
@ -18,6 +47,10 @@
#include "AbstractCalibrator.h" #include "AbstractCalibrator.h"
/**
@brief Calibration widget for 5 point inerpolated curve.
For the helicopter autopilot at UAlberta this is used for the throttle and pitch curves.
*/
class CurveCalibrator : public AbstractCalibrator class CurveCalibrator : public AbstractCalibrator
{ {
Q_OBJECT Q_OBJECT
@ -26,17 +59,16 @@ public:
~CurveCalibrator(); ~CurveCalibrator();
void set(const QVector<float> &data); void set(const QVector<float> &data);
//signals:
// void setpointChanged(int setpoint, float raw);
protected slots: protected slots:
void setSetpoint(int setpoint); void setSetpoint(int setpoint);
protected: protected:
QVector<double> *setpoints; QVector<double> *setpoints;
QVector<double> *positions; QVector<double> *positions;
// QwtArrayData /** Plot to display calibration curve */
QwtPlot *plot; QwtPlot *plot;
/** Curve object of calibration curve */
QwtPlotCurve *curve; QwtPlotCurve *curve;
QSignalMapper *signalMapper; QSignalMapper *signalMapper;

36
src/ui/RadioCalibration/RadioCalibrationData.h

@ -1,3 +1,32 @@
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
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 <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Class to hold the calibration data
* @author Bryan Godbolt <godbolt@ualberta.ca>
*/
#ifndef RADIOCALIBRATIONDATA_H #ifndef RADIOCALIBRATIONDATA_H
#define RADIOCALIBRATIONDATA_H #define RADIOCALIBRATIONDATA_H
@ -7,6 +36,10 @@
#include <QString> #include <QString>
/**
@brief Class to hold the calibration data.
@author Bryan Godbolt <godbolt@ece.ualberta.ca>
*/
class RadioCalibrationData : public QObject class RadioCalibrationData : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -45,13 +78,12 @@ public slots:
void setThrottle(int index, float value) {set(THROTTLE, index, value);} void setThrottle(int index, float value) {set(THROTTLE, index, value);}
public: public:
/// Creates a comman seperated list of the values for a particular element /// Creates a comma seperated list of the values for a particular element
QString toString(const RadioElement element) const; QString toString(const RadioElement element) const;
protected: protected:
QVector<QVector<float> > *data; QVector<QVector<float> > *data;
void init(const QVector<float>& aileron, void init(const QVector<float>& aileron,
const QVector<float>& elevator, const QVector<float>& elevator,
const QVector<float>& rudder, const QVector<float>& rudder,

34
src/ui/RadioCalibration/RadioCalibrationWindow.h

@ -1,3 +1,32 @@
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
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 <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Main window for radio calibration
* @author Bryan Godbolt <godbolt@ualberta.ca>
*/
#ifndef RADIOCALIBRATIONWINDOW_H #ifndef RADIOCALIBRATIONWINDOW_H
#define RADIOCALIBRATIONWINDOW_H #define RADIOCALIBRATIONWINDOW_H
@ -25,7 +54,10 @@
#include "UASManager.h" #include "UASManager.h"
#include "RadioCalibrationData.h" #include "RadioCalibrationData.h"
/**
@brief Main window for radio calibration
@author Bryan Godbolt <godbolt@ece.ualberta.ca>
*/
class RadioCalibrationWindow : public QWidget class RadioCalibrationWindow : public QWidget
{ {
Q_OBJECT Q_OBJECT

36
src/ui/RadioCalibration/SwitchCalibrator.h

@ -1,3 +1,32 @@
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2010 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
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 <http://www.gnu.org/licenses/>.
======================================================================*/
/**
* @file
* @brief Calibration widget for 2 setpoint switch
* @author Bryan Godbolt <godbolt@ualberta.ca>
*/
#ifndef SWITCHCALIBRATOR_H #ifndef SWITCHCALIBRATOR_H
#define SWITCHCALIBRATOR_H #define SWITCHCALIBRATOR_H
@ -10,6 +39,10 @@
#include "AbstractCalibrator.h" #include "AbstractCalibrator.h"
/**
@brief Calibration widget for 2 setpoint switch
@author Bryan Godbolt <godbolt@ece.ualberta.ca>
*/
class SwitchCalibrator : public AbstractCalibrator class SwitchCalibrator : public AbstractCalibrator
{ {
Q_OBJECT Q_OBJECT
@ -17,9 +50,6 @@ public:
explicit SwitchCalibrator(QString title=QString(), QWidget *parent = 0); explicit SwitchCalibrator(QString title=QString(), QWidget *parent = 0);
void set(const QVector<float> &data); void set(const QVector<float> &data);
//signals:
// void defaultSetpointChanged(float);
// void toggledSetpointChanged(float);
protected slots: protected slots:
void setDefault(); void setDefault();

Loading…
Cancel
Save