Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
95011df1
Commit
95011df1
authored
Sep 20, 2010
by
Bryan Godbolt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Filled in functions for airfoils and switch
parent
a47b16fb
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
206 additions
and
44 deletions
+206
-44
qgroundcontrol.pro
qgroundcontrol.pro
+4
-2
AbstractCalibrator.cc
src/ui/RadioCalibration/AbstractCalibrator.cc
+52
-0
AbstractCalibrator.h
src/ui/RadioCalibration/AbstractCalibrator.h
+26
-0
AirfoilServoCalibrator.cc
src/ui/RadioCalibration/AirfoilServoCalibrator.cc
+70
-4
AirfoilServoCalibrator.h
src/ui/RadioCalibration/AirfoilServoCalibrator.h
+12
-12
CurveCalibrator.cc
src/ui/RadioCalibration/CurveCalibrator.cc
+1
-6
CurveCalibrator.h
src/ui/RadioCalibration/CurveCalibrator.h
+3
-4
SwitchCalibrator.cc
src/ui/RadioCalibration/SwitchCalibrator.cc
+29
-5
SwitchCalibrator.h
src/ui/RadioCalibration/SwitchCalibrator.h
+9
-11
No files found.
qgroundcontrol.pro
View file @
95011df1
...
...
@@ -164,7 +164,8 @@ HEADERS += src/MG.h \
src
/
ui
/
RadioCalibration
/
RadioCalibrationWindow
.
h
\
src
/
ui
/
RadioCalibration
/
AirfoilServoCalibrator
.
h
\
src
/
ui
/
RadioCalibration
/
SwitchCalibrator
.
h
\
src
/
ui
/
RadioCalibration
/
CurveCalibrator
.
h
src
/
ui
/
RadioCalibration
/
CurveCalibrator
.
h
\
src
/
ui
/
RadioCalibration
/
AbstractCalibrator
.
h
SOURCES
+=
src
/
main
.
cc
\
src
/
Core
.
cc
\
src
/
uas
/
UASManager
.
cc
\
...
...
@@ -234,7 +235,8 @@ SOURCES += src/main.cc \
src
/
ui
/
RadioCalibration
/
RadioCalibrationWindow
.
cc
\
src
/
ui
/
RadioCalibration
/
AirfoilServoCalibrator
.
cc
\
src
/
ui
/
RadioCalibration
/
SwitchCalibrator
.
cc
\
src
/
ui
/
RadioCalibration
/
CurveCalibrator
.
cc
src
/
ui
/
RadioCalibration
/
CurveCalibrator
.
cc
\
src
/
ui
/
RadioCalibration
/
AbstractCalibrator
.
cc
RESOURCES
=
mavground
.
qrc
#
Include
RT
-
LAB
Library
...
...
src/ui/RadioCalibration/AbstractCalibrator.cc
0 → 100644
View file @
95011df1
#include "AbstractCalibrator.h"
AbstractCalibrator
::
AbstractCalibrator
(
QWidget
*
parent
)
:
QWidget
(
parent
),
pulseWidth
(
new
QLabel
()),
log
(
new
QVector
<
float
>
())
{
}
AbstractCalibrator
::~
AbstractCalibrator
()
{
delete
log
;
}
float
AbstractCalibrator
::
logAverage
()
{
float
total
=
0
;
for
(
int
i
=
0
;
i
<
log
->
size
();
++
i
)
total
+=
log
->
value
(
i
);
return
(
total
/
log
->
size
());
}
float
AbstractCalibrator
::
logExtrema
()
{
float
extrema
=
logAverage
();
if
(
logAverage
()
<
1500
)
{
for
(
int
i
=
0
;
i
<
log
->
size
();
++
i
)
{
if
(
log
->
value
(
i
)
<
extrema
)
extrema
=
log
->
value
(
i
);
}
}
else
{
for
(
int
i
=
0
;
i
<
log
->
size
();
++
i
)
{
if
(
log
->
value
(
i
)
>
extrema
)
extrema
=
log
->
value
(
i
);
}
}
return
extrema
;
}
void
AbstractCalibrator
::
channelChanged
(
float
raw
)
{
pulseWidth
->
setText
(
QString
::
number
(
static_cast
<
double
>
(
raw
)));
if
(
log
->
size
()
==
5
)
log
->
pop_front
();
log
->
push_back
(
raw
);
}
src/ui/RadioCalibration/AbstractCalibrator.h
0 → 100644
View file @
95011df1
#ifndef ABSTRACTCALIBRATOR_H
#define ABSTRACTCALIBRATOR_H
#include <QWidget>
#include <QString>
#include <QLabel>
class
AbstractCalibrator
:
public
QWidget
{
Q_OBJECT
public:
explicit
AbstractCalibrator
(
QWidget
*
parent
=
0
);
~
AbstractCalibrator
();
public
slots
:
void
channelChanged
(
float
raw
);
protected:
QLabel
*
pulseWidth
;
QVector
<
float
>
*
log
;
float
logExtrema
();
float
logAverage
();
};
#endif // ABSTRACTCALIBRATOR_H
src/ui/RadioCalibration/AirfoilServoCalibrator.cc
View file @
95011df1
#include "AirfoilServoCalibrator.h"
AirfoilServoCalibrator
::
AirfoilServoCalibrator
(
AirfoilType
type
,
QWidget
*
parent
)
:
QWidget
(
parent
)
AbstractCalibrator
(
parent
),
highPulseWidth
(
new
QLabel
()),
centerPulseWidth
(
new
QLabel
()),
lowPulseWidth
(
new
QLabel
())
{
QGridLayout
*
grid
=
new
QGridLayout
(
this
);
...
...
@@ -26,16 +29,79 @@ AirfoilServoCalibrator::AirfoilServoCalibrator(AirfoilType type, QWidget *parent
/* Add current Pulse Width Display */
QLabel
*
pulseWidthTitle
=
new
QLabel
(
tr
(
"Pulse Width (us)"
));
pulseWidth
=
new
QLabel
();
QHBoxLayout
*
pulseLayout
=
new
QHBoxLayout
();
pulseLayout
->
addWidget
(
pulseWidthTitle
);
pulseLayout
->
addWidget
(
pulseWidth
);
grid
->
addLayout
(
pulseLayout
,
1
,
0
,
1
,
3
);
QLabel
*
highPulseString
;
QLabel
*
centerPulseString
;
QLabel
*
lowPulseString
;
if
(
type
==
AILERON
)
{
highPulseString
=
new
QLabel
(
tr
(
"Bank Left"
));
centerPulseString
=
new
QLabel
(
tr
(
"Center"
));
lowPulseString
=
new
QLabel
(
tr
(
"Bank Right"
));
}
else
if
(
type
==
ELEVATOR
)
{
highPulseString
=
new
QLabel
(
tr
(
"Nose Down"
));
centerPulseString
=
new
QLabel
(
tr
(
"Center"
));
lowPulseString
=
new
QLabel
(
tr
(
"Nose Up"
));
}
else
if
(
type
==
RUDDER
)
{
highPulseString
=
new
QLabel
(
tr
(
"Nose Left"
));
centerPulseString
=
new
QLabel
(
tr
(
"Center"
));
lowPulseString
=
new
QLabel
(
tr
(
"Nose Right"
));
}
else
{
highPulseString
=
new
QLabel
(
tr
(
"High"
));
centerPulseString
=
new
QLabel
(
tr
(
"Center"
));
lowPulseString
=
new
QLabel
(
tr
(
"Low"
));
}
QPushButton
*
highButton
=
new
QPushButton
(
tr
(
"Set"
));
QPushButton
*
centerButton
=
new
QPushButton
(
tr
(
"Set"
));
QPushButton
*
lowButton
=
new
QPushButton
(
tr
(
"Set"
));
grid
->
addWidget
(
highPulseString
,
2
,
0
);
grid
->
addWidget
(
highPulseWidth
,
2
,
1
);
grid
->
addWidget
(
highButton
,
2
,
2
);
grid
->
addWidget
(
centerPulseString
,
3
,
0
);
grid
->
addWidget
(
centerPulseWidth
,
3
,
1
);
grid
->
addWidget
(
centerButton
,
3
,
2
);
grid
->
addWidget
(
lowPulseString
,
4
,
0
);
grid
->
addWidget
(
lowPulseWidth
,
4
,
1
);
grid
->
addWidget
(
lowButton
,
4
,
2
);
this
->
setLayout
(
grid
);
connect
(
highButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
setHigh
()));
connect
(
centerButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
setCenter
()));
connect
(
lowButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
setLow
()));
}
void
AirfoilServoCalibrator
::
setHigh
()
{
highPulseWidth
->
setText
(
QString
::
number
(
static_cast
<
double
>
(
logExtrema
())));
emit
highSetpointChanged
(
logExtrema
());
}
void
AirfoilServoCalibrator
::
setCenter
()
{
centerPulseWidth
->
setText
(
QString
::
number
(
static_cast
<
double
>
(
logAverage
())));
emit
centerSetpointChanged
(
logAverage
());
}
void
AirfoilServoCalibrator
::
channelChanged
(
float
raw
)
void
AirfoilServoCalibrator
::
setLow
(
)
{
pulseWidth
->
setText
(
QString
::
number
(
static_cast
<
double
>
(
raw
)));
lowPulseWidth
->
setText
(
QString
::
number
(
static_cast
<
double
>
(
logExtrema
())));
emit
lowSetpointChanged
(
logExtrema
());
}
src/ui/RadioCalibration/AirfoilServoCalibrator.h
View file @
95011df1
...
...
@@ -8,7 +8,9 @@
#include <QGridLayout>
#include <QHBoxLayout>
class
AirfoilServoCalibrator
:
public
QWidget
#include "AbstractCalibrator.h"
class
AirfoilServoCalibrator
:
public
AbstractCalibrator
{
Q_OBJECT
public:
...
...
@@ -21,26 +23,24 @@ public:
explicit
AirfoilServoCalibrator
(
AirfoilType
type
=
AILERON
,
QWidget
*
parent
=
0
);
signals:
void
highSetpointChanged
(
float
);
void
centerSetpointChanged
(
float
);
void
lowSetpointChanged
(
float
);
public
slots
:
void
channelChanged
(
float
raw
);
protected:
QLabel
*
pulseWidth
;
QPushButton
*
highButton
;
QPushButton
*
centerButton
;
QPushButton
*
lowButton
;
protected
slots
:
void
setHigh
();
void
setCenter
();
void
setLow
();
protected:
QLabel
*
highPulseWidth
;
QLabel
*
centerPulseWidth
;
QLabel
*
lowPulseWidth
;
float
high
;
float
center
;
float
low
;
QVector
<
float
>
log
;
};
#endif // AIRFOILSERVOCALIBRATOR_H
src/ui/RadioCalibration/CurveCalibrator.cc
View file @
95011df1
#include "CurveCalibrator.h"
CurveCalibrator
::
CurveCalibrator
(
QString
titleString
,
QWidget
*
parent
)
:
QWidget
(
parent
),
AbstractCalibrator
(
parent
),
setpoints
(
QVector
<
double
>
(
5
)),
positions
(
QVector
<
double
>
())
...
...
@@ -39,8 +39,3 @@ CurveCalibrator::CurveCalibrator(QString titleString, QWidget *parent) :
this
->
setLayout
(
grid
);
}
void
CurveCalibrator
::
channelChanged
(
float
raw
)
{
pulseWidth
->
setText
(
QString
::
number
(
static_cast
<
double
>
(
raw
)));
}
src/ui/RadioCalibration/CurveCalibrator.h
View file @
95011df1
...
...
@@ -10,7 +10,9 @@
#include <QLabel>
#include <QPushButton>
class
CurveCalibrator
:
public
QWidget
#include "AbstractCalibrator.h"
class
CurveCalibrator
:
public
AbstractCalibrator
{
Q_OBJECT
public:
...
...
@@ -18,15 +20,12 @@ public:
signals:
void
setpointChanged
(
float
[
5
]);
public
slots
:
void
channelChanged
(
float
raw
);
protected:
QVector
<
double
>
setpoints
;
QVector
<
double
>
positions
;
QwtPlot
*
plot
;
QwtPlotCurve
*
curve
;
QLabel
*
pulseWidth
;
};
#endif // CURVECALIBRATOR_H
src/ui/RadioCalibration/SwitchCalibrator.cc
View file @
95011df1
#include "SwitchCalibrator.h"
SwitchCalibrator
::
SwitchCalibrator
(
QString
titleString
,
QWidget
*
parent
)
:
QWidget
(
parent
)
AbstractCalibrator
(
parent
),
defaultPulseWidth
(
new
QLabel
()),
toggledPulseWidth
(
new
QLabel
())
{
/* Add title label*/
QLabel
*
title
=
new
QLabel
(
titleString
);
...
...
@@ -9,17 +11,39 @@ SwitchCalibrator::SwitchCalibrator(QString titleString, QWidget *parent) :
grid
->
addWidget
(
title
,
0
,
0
,
1
,
3
);
/* Add current Pulse Width Display */
QLabel
*
pulseWidthTitle
=
new
QLabel
(
tr
(
"Pulse Width (us)"
));
pulseWidth
=
new
QLabel
();
QLabel
*
pulseWidthTitle
=
new
QLabel
(
tr
(
"Pulse Width (us)"
));
QHBoxLayout
*
pulseLayout
=
new
QHBoxLayout
();
pulseLayout
->
addWidget
(
pulseWidthTitle
);
pulseLayout
->
addWidget
(
pulseWidth
);
grid
->
addLayout
(
pulseLayout
,
1
,
0
,
1
,
3
);
QLabel
*
defaultPulseString
=
new
QLabel
(
tr
(
"Default Position"
));
QPushButton
*
defaultButton
=
new
QPushButton
(
tr
(
"Set"
));
grid
->
addWidget
(
defaultPulseString
,
2
,
0
);
grid
->
addWidget
(
defaultPulseWidth
,
2
,
1
);
grid
->
addWidget
(
defaultButton
,
2
,
2
);
QLabel
*
toggledPulseString
=
new
QLabel
(
tr
(
"Toggled Position"
));
QPushButton
*
toggledButton
=
new
QPushButton
(
tr
(
"Set"
));
grid
->
addWidget
(
toggledPulseString
,
3
,
0
);
grid
->
addWidget
(
toggledPulseWidth
,
3
,
1
);
grid
->
addWidget
(
toggledButton
,
3
,
2
);
this
->
setLayout
(
grid
);
connect
(
defaultButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
setDefault
()));
connect
(
toggledButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
setToggled
()));
}
void
SwitchCalibrator
::
setDefault
()
{
defaultPulseWidth
->
setText
(
QString
::
number
(
static_cast
<
double
>
(
logExtrema
())));
emit
defaultSetpointChanged
(
logExtrema
());
}
void
SwitchCalibrator
::
channelChanged
(
float
raw
)
void
SwitchCalibrator
::
setToggled
(
)
{
pulseWidth
->
setText
(
QString
::
number
(
static_cast
<
double
>
(
raw
)));
toggledPulseWidth
->
setText
(
QString
::
number
(
static_cast
<
double
>
(
logExtrema
())));
emit
toggledSetpointChanged
(
logExtrema
());
}
src/ui/RadioCalibration/SwitchCalibrator.h
View file @
95011df1
...
...
@@ -8,7 +8,9 @@
#include <QGridLayout>
#include <QHBoxLayout>
class
SwitchCalibrator
:
public
QWidget
#include "AbstractCalibrator.h"
class
SwitchCalibrator
:
public
AbstractCalibrator
{
Q_OBJECT
public:
...
...
@@ -18,17 +20,13 @@ signals:
void
defaultSetpointChanged
(
float
);
void
toggledSetpointChanged
(
float
);
public
slots
:
void
channelChanged
(
float
raw
);
protected:
QLabel
*
pulseWidth
;
QPushButton
*
defaultButton
;
QPushButton
*
toggledButton
;
float
defaultPos
;
float
toggled
;
protected
slots
:
void
setDefault
();
void
setToggled
();
QVector
<
float
>
log
;
protected:
QLabel
*
defaultPulseWidth
;
QLabel
*
toggledPulseWidth
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment