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
a47b16fb
Commit
a47b16fb
authored
Sep 17, 2010
by
Bryan Godbolt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
laid out all widgets needed for radio calibration window
parent
bec9e278
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
303 additions
and
32 deletions
+303
-32
qgroundcontrol.pro
qgroundcontrol.pro
+9
-4
QGCRemoteControlView.cc
src/ui/QGCRemoteControlView.cc
+2
-1
QGCRemoteControlView.h
src/ui/QGCRemoteControlView.h
+3
-1
AirfoilServoCalibrator.cc
src/ui/RadioCalibration/AirfoilServoCalibrator.cc
+41
-0
AirfoilServoCalibrator.h
src/ui/RadioCalibration/AirfoilServoCalibrator.h
+46
-0
CurveCalibrator.cc
src/ui/RadioCalibration/CurveCalibrator.cc
+46
-0
CurveCalibrator.h
src/ui/RadioCalibration/CurveCalibrator.h
+32
-0
RadioCalibrationWindow.cc
src/ui/RadioCalibration/RadioCalibrationWindow.cc
+52
-0
RadioCalibrationWindow.h
src/ui/RadioCalibration/RadioCalibrationWindow.h
+12
-26
SwitchCalibrator.cc
src/ui/RadioCalibration/SwitchCalibrator.cc
+25
-0
SwitchCalibrator.h
src/ui/RadioCalibration/SwitchCalibrator.h
+35
-0
No files found.
qgroundcontrol.pro
View file @
a47b16fb
...
@@ -76,8 +76,7 @@ FORMS += src/ui/MainWindow.ui \
...
@@ -76,8 +76,7 @@ FORMS += src/ui/MainWindow.ui \
src
/
ui
/
QGCPxImuFirmwareUpdate
.
ui
\
src
/
ui
/
QGCPxImuFirmwareUpdate
.
ui
\
src
/
ui
/
QGCDataPlot2D
.
ui
\
src
/
ui
/
QGCDataPlot2D
.
ui
\
src
/
ui
/
QGCRemoteControlView
.
ui
\
src
/
ui
/
QGCRemoteControlView
.
ui
\
src
/
ui
/
WaypointGlobalView
.
ui
\
src
/
ui
/
WaypointGlobalView
.
ui
src
/
ui
/
QGCRadioCalibration
.
ui
INCLUDEPATH
+=
src
\
INCLUDEPATH
+=
src
\
src
/
ui
\
src
/
ui
\
src
/
ui
/
linechart
\
src
/
ui
/
linechart
\
...
@@ -162,7 +161,10 @@ HEADERS += src/MG.h \
...
@@ -162,7 +161,10 @@ HEADERS += src/MG.h \
src
/
ui
/
QGCRemoteControlView
.
h
\
src
/
ui
/
QGCRemoteControlView
.
h
\
src
/
WaypointGlobal
.
h
\
src
/
WaypointGlobal
.
h
\
src
/
ui
/
WaypointGlobalView
.
h
\
src
/
ui
/
WaypointGlobalView
.
h
\
src
/
ui
/
RadioCalibration
/
RadioCalibrationWindow
.
h
src
/
ui
/
RadioCalibration
/
RadioCalibrationWindow
.
h
\
src
/
ui
/
RadioCalibration
/
AirfoilServoCalibrator
.
h
\
src
/
ui
/
RadioCalibration
/
SwitchCalibrator
.
h
\
src
/
ui
/
RadioCalibration
/
CurveCalibrator
.
h
SOURCES
+=
src
/
main
.
cc
\
SOURCES
+=
src
/
main
.
cc
\
src
/
Core
.
cc
\
src
/
Core
.
cc
\
src
/
uas
/
UASManager
.
cc
\
src
/
uas
/
UASManager
.
cc
\
...
@@ -229,7 +231,10 @@ SOURCES += src/main.cc \
...
@@ -229,7 +231,10 @@ SOURCES += src/main.cc \
src
/
ui
/
QGCRemoteControlView
.
cc
\
src
/
ui
/
QGCRemoteControlView
.
cc
\
src
/
WaypointGlobal
.
cpp
\
src
/
WaypointGlobal
.
cpp
\
src
/
ui
/
WaypointGlobalView
.
cpp
\
src
/
ui
/
WaypointGlobalView
.
cpp
\
src
/
ui
/
RadioCalibration
/
RadioCalibrationWindow
.
cc
src
/
ui
/
RadioCalibration
/
RadioCalibrationWindow
.
cc
\
src
/
ui
/
RadioCalibration
/
AirfoilServoCalibrator
.
cc
\
src
/
ui
/
RadioCalibration
/
SwitchCalibrator
.
cc
\
src
/
ui
/
RadioCalibration
/
CurveCalibrator
.
cc
RESOURCES
=
mavground
.
qrc
RESOURCES
=
mavground
.
qrc
#
Include
RT
-
LAB
Library
#
Include
RT
-
LAB
Library
...
...
src/ui/QGCRemoteControlView.cc
View file @
a47b16fb
...
@@ -76,7 +76,7 @@ QGCRemoteControlView::QGCRemoteControlView(QWidget *parent) :
...
@@ -76,7 +76,7 @@ QGCRemoteControlView::QGCRemoteControlView(QWidget *parent) :
calibrateButtonLayout
->
addWidget
(
calibrate
,
0
,
Qt
::
AlignHCenter
);
calibrateButtonLayout
->
addWidget
(
calibrate
,
0
,
Qt
::
AlignHCenter
);
layout
->
addItem
(
calibrateButtonLayout
,
3
,
0
,
1
,
2
);
layout
->
addItem
(
calibrateButtonLayout
,
3
,
0
,
1
,
2
);
calibrationWindow
=
new
QWidget
(
this
,
Qt
::
Window
);
calibrationWindow
=
new
RadioCalibrationWindow
(
this
);
connect
(
calibrate
,
SIGNAL
(
clicked
()),
calibrationWindow
,
SLOT
(
show
()));
connect
(
calibrate
,
SIGNAL
(
clicked
()),
calibrationWindow
,
SLOT
(
show
()));
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
int
)),
this
,
SLOT
(
setUASId
(
int
)));
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
int
)),
this
,
SLOT
(
setUASId
(
int
)));
...
@@ -108,6 +108,7 @@ void QGCRemoteControlView::setUASId(int id)
...
@@ -108,6 +108,7 @@ void QGCRemoteControlView::setUASId(int id)
// New UAS exists, connect
// New UAS exists, connect
nameLabel
->
setText
(
QString
(
"RC Input of %1"
).
arg
(
newUAS
->
getUASName
()));
nameLabel
->
setText
(
QString
(
"RC Input of %1"
).
arg
(
newUAS
->
getUASName
()));
connect
(
newUAS
,
SIGNAL
(
remoteControlChannelChanged
(
int
,
float
,
float
)),
this
,
SLOT
(
setChannel
(
int
,
float
,
float
)));
connect
(
newUAS
,
SIGNAL
(
remoteControlChannelChanged
(
int
,
float
,
float
)),
this
,
SLOT
(
setChannel
(
int
,
float
,
float
)));
connect
(
newUAS
,
SIGNAL
(
remoteControlChannelChanged
(
int
,
float
,
float
)),
calibrationWindow
,
SLOT
(
setChannel
(
int
,
float
,
float
)));
connect
(
newUAS
,
SIGNAL
(
remoteControlRSSIChanged
(
float
)),
this
,
SLOT
(
setRemoteRSSI
(
float
)));
connect
(
newUAS
,
SIGNAL
(
remoteControlRSSIChanged
(
float
)),
this
,
SLOT
(
setRemoteRSSI
(
float
)));
}
}
}
}
...
...
src/ui/QGCRemoteControlView.h
View file @
a47b16fb
...
@@ -34,6 +34,8 @@ This file is part of the QGROUNDCONTROL project
...
@@ -34,6 +34,8 @@ This file is part of the QGROUNDCONTROL project
#include <QVector>
#include <QVector>
#include <QPushButton>
#include <QPushButton>
#include "RadioCalibration/RadioCalibrationWindow.h"
namespace
Ui
{
namespace
Ui
{
class
QGCRemoteControlView
;
class
QGCRemoteControlView
;
}
}
...
@@ -70,7 +72,7 @@ protected:
...
@@ -70,7 +72,7 @@ protected:
QProgressBar
*
rssiBar
;
QProgressBar
*
rssiBar
;
QLabel
*
nameLabel
;
QLabel
*
nameLabel
;
QPushButton
*
calibrate
;
QPushButton
*
calibrate
;
QWidget
*
calibrationWindow
;
RadioCalibrationWindow
*
calibrationWindow
;
private:
private:
Ui
::
QGCRemoteControlView
*
ui
;
Ui
::
QGCRemoteControlView
*
ui
;
...
...
src/ui/RadioCalibration/AirfoilServoCalibrator.cc
0 → 100644
View file @
a47b16fb
#include "AirfoilServoCalibrator.h"
AirfoilServoCalibrator
::
AirfoilServoCalibrator
(
AirfoilType
type
,
QWidget
*
parent
)
:
QWidget
(
parent
)
{
QGridLayout
*
grid
=
new
QGridLayout
(
this
);
/* Add title */
QHBoxLayout
*
titleLayout
=
new
QHBoxLayout
();
QLabel
*
title
;
if
(
type
==
AILERON
)
{
title
=
new
QLabel
(
tr
(
"Aileron"
));
}
else
if
(
type
==
ELEVATOR
)
{
title
=
new
QLabel
(
tr
(
"Elevator"
));
}
else
if
(
type
==
RUDDER
)
{
title
=
new
QLabel
(
tr
(
"Rudder"
));
}
titleLayout
->
addWidget
(
title
);
grid
->
addLayout
(
titleLayout
,
0
,
0
,
1
,
3
,
Qt
::
AlignHCenter
);
/* 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
);
this
->
setLayout
(
grid
);
}
void
AirfoilServoCalibrator
::
channelChanged
(
float
raw
)
{
pulseWidth
->
setText
(
QString
::
number
(
static_cast
<
double
>
(
raw
)));
}
src/ui/RadioCalibration/AirfoilServoCalibrator.h
0 → 100644
View file @
a47b16fb
#ifndef AIRFOILSERVOCALIBRATOR_H
#define AIRFOILSERVOCALIBRATOR_H
#include <QWidget>
#include <QLabel>
#include <QPushButton>
#include <QVector>
#include <QGridLayout>
#include <QHBoxLayout>
class
AirfoilServoCalibrator
:
public
QWidget
{
Q_OBJECT
public:
enum
AirfoilType
{
AILERON
,
ELEVATOR
,
RUDDER
};
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
;
float
high
;
float
center
;
float
low
;
QVector
<
float
>
log
;
};
#endif // AIRFOILSERVOCALIBRATOR_H
src/ui/RadioCalibration/CurveCalibrator.cc
0 → 100644
View file @
a47b16fb
#include "CurveCalibrator.h"
CurveCalibrator
::
CurveCalibrator
(
QString
titleString
,
QWidget
*
parent
)
:
QWidget
(
parent
),
setpoints
(
QVector
<
double
>
(
5
)),
positions
(
QVector
<
double
>
())
{
QGridLayout
*
grid
=
new
QGridLayout
(
this
);
QLabel
*
title
=
new
QLabel
(
titleString
);
grid
->
addWidget
(
title
,
0
,
0
,
1
,
5
,
Qt
::
AlignHCenter
);
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
,
5
,
Qt
::
AlignHCenter
);
for
(
int
i
=
0
;
i
<=
100
;
i
=
i
+
100
/
4
)
positions
.
append
(
static_cast
<
double
>
(
i
));
setpoints
.
fill
(
1500
);
plot
=
new
QwtPlot
();
grid
->
addWidget
(
plot
,
2
,
0
,
1
,
5
,
Qt
::
AlignHCenter
);
plot
->
setAxisScale
(
QwtPlot
::
yLeft
,
1000
,
2000
,
200
);
curve
=
new
QwtPlotCurve
();
curve
->
setData
(
positions
,
setpoints
);
curve
->
attach
(
plot
);
plot
->
replot
();
this
->
setLayout
(
grid
);
}
void
CurveCalibrator
::
channelChanged
(
float
raw
)
{
pulseWidth
->
setText
(
QString
::
number
(
static_cast
<
double
>
(
raw
)));
}
src/ui/RadioCalibration/CurveCalibrator.h
0 → 100644
View file @
a47b16fb
#ifndef CURVECALIBRATOR_H
#define CURVECALIBRATOR_H
#include <QWidget>
#include <QVector>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <QGridLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QPushButton>
class
CurveCalibrator
:
public
QWidget
{
Q_OBJECT
public:
explicit
CurveCalibrator
(
QString
title
=
QString
(),
QWidget
*
parent
=
0
);
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/RadioCalibrationWindow.cc
View file @
a47b16fb
...
@@ -3,4 +3,56 @@
...
@@ -3,4 +3,56 @@
RadioCalibrationWindow
::
RadioCalibrationWindow
(
QWidget
*
parent
)
:
RadioCalibrationWindow
::
RadioCalibrationWindow
(
QWidget
*
parent
)
:
QWidget
(
parent
,
Qt
::
Window
)
QWidget
(
parent
,
Qt
::
Window
)
{
{
QGridLayout
*
grid
=
new
QGridLayout
();
aileron
=
new
AirfoilServoCalibrator
(
AirfoilServoCalibrator
::
AILERON
);
grid
->
addWidget
(
aileron
,
0
,
0
,
1
,
1
,
Qt
::
AlignTop
);
elevator
=
new
AirfoilServoCalibrator
(
AirfoilServoCalibrator
::
ELEVATOR
);
grid
->
addWidget
(
elevator
,
0
,
1
,
1
,
1
,
Qt
::
AlignTop
);
rudder
=
new
AirfoilServoCalibrator
(
AirfoilServoCalibrator
::
RUDDER
);
grid
->
addWidget
(
rudder
,
0
,
2
,
1
,
1
,
Qt
::
AlignTop
);
gyro
=
new
SwitchCalibrator
(
tr
(
"Gyro Mode/Gain"
));
grid
->
addWidget
(
gyro
,
0
,
3
,
1
,
1
,
Qt
::
AlignTop
);
pitch
=
new
CurveCalibrator
(
tr
(
"Collective Pitch"
));
grid
->
addWidget
(
pitch
,
1
,
0
,
1
,
2
);
throttle
=
new
CurveCalibrator
(
tr
(
"Throttle"
));
grid
->
addWidget
(
throttle
,
1
,
2
,
1
,
2
);
this
->
setLayout
(
grid
);
}
void
RadioCalibrationWindow
::
setChannel
(
int
ch
,
float
raw
,
float
normalized
)
{
/** this expects a particular channel to function mapping
\todo allow run-time channel mapping
*/
switch
(
ch
)
{
case
0
:
aileron
->
channelChanged
(
raw
);
break
;
case
1
:
elevator
->
channelChanged
(
raw
);
break
;
case
2
:
throttle
->
channelChanged
(
raw
);
break
;
case
3
:
rudder
->
channelChanged
(
raw
);
break
;
case
4
:
gyro
->
channelChanged
(
raw
);
break
;
case
5
:
pitch
->
channelChanged
(
raw
);
break
;
}
}
}
src/ui/RadioCalibration/RadioCalibrationWindow.h
View file @
a47b16fb
...
@@ -6,6 +6,11 @@
...
@@ -6,6 +6,11 @@
#include <QGroupBox>
#include <QGroupBox>
#include <QPushButton>
#include <QPushButton>
#include <QVector>
#include <QVector>
#include <QGridLayout>
#include "AirfoilServoCalibrator.h"
#include "SwitchCalibrator.h"
#include "CurveCalibrator.h"
class
RadioCalibrationWindow
:
public
QWidget
class
RadioCalibrationWindow
:
public
QWidget
{
{
...
@@ -16,34 +21,15 @@ public:
...
@@ -16,34 +21,15 @@ public:
signals:
signals:
public
slots
:
public
slots
:
void
setChannel
(
int
ch
,
float
raw
,
float
normalized
);
protected:
protected:
class
AirfoilServoCalibrator
:
public
QWidget
AirfoilServoCalibrator
*
aileron
;
{
AirfoilServoCalibrator
*
elevator
;
Q_OBJECT
AirfoilServoCalibrator
*
rudder
;
public:
SwitchCalibrator
*
gyro
;
explicit
AirfoilServoCalibrator
(
QWidget
*
parent
=
0
);
CurveCalibrator
*
pitch
;
CurveCalibrator
*
throttle
;
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
;
float
high
;
float
center
;
float
low
;
QVector
<
float
>
log
;
};
};
};
...
...
src/ui/RadioCalibration/SwitchCalibrator.cc
0 → 100644
View file @
a47b16fb
#include "SwitchCalibrator.h"
SwitchCalibrator
::
SwitchCalibrator
(
QString
titleString
,
QWidget
*
parent
)
:
QWidget
(
parent
)
{
/* Add title label*/
QLabel
*
title
=
new
QLabel
(
titleString
);
QGridLayout
*
grid
=
new
QGridLayout
();
grid
->
addWidget
(
title
,
0
,
0
,
1
,
3
);
/* 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
);
this
->
setLayout
(
grid
);
}
void
SwitchCalibrator
::
channelChanged
(
float
raw
)
{
pulseWidth
->
setText
(
QString
::
number
(
static_cast
<
double
>
(
raw
)));
}
src/ui/RadioCalibration/SwitchCalibrator.h
0 → 100644
View file @
a47b16fb
#ifndef SWITCHCALIBRATOR_H
#define SWITCHCALIBRATOR_H
#include <QWidget>
#include <QLabel>
#include <QPushButton>
#include <QVector>
#include <QGridLayout>
#include <QHBoxLayout>
class
SwitchCalibrator
:
public
QWidget
{
Q_OBJECT
public:
explicit
SwitchCalibrator
(
QString
title
=
QString
(),
QWidget
*
parent
=
0
);
signals:
void
defaultSetpointChanged
(
float
);
void
toggledSetpointChanged
(
float
);
public
slots
:
void
channelChanged
(
float
raw
);
protected:
QLabel
*
pulseWidth
;
QPushButton
*
defaultButton
;
QPushButton
*
toggledButton
;
float
defaultPos
;
float
toggled
;
QVector
<
float
>
log
;
};
#endif // SWITCHCALIBRATOR_H
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