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
f75f4424
Commit
f75f4424
authored
Jul 20, 2011
by
LM
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-lin' of
https://github.com/godbolt/qgroundcontrol
into dev
parents
63900c28
d163ee02
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
132 additions
and
99 deletions
+132
-99
UAS.cc
src/uas/UAS.cc
+6
-6
QGCRemoteControlView.cc
src/ui/QGCRemoteControlView.cc
+17
-17
QGCRemoteControlView.h
src/ui/QGCRemoteControlView.h
+1
-1
AbstractCalibrator.cc
src/ui/RadioCalibration/AbstractCalibrator.cc
+8
-8
AbstractCalibrator.h
src/ui/RadioCalibration/AbstractCalibrator.h
+7
-6
AirfoilServoCalibrator.cc
src/ui/RadioCalibration/AirfoilServoCalibrator.cc
+4
-4
AirfoilServoCalibrator.h
src/ui/RadioCalibration/AirfoilServoCalibrator.h
+1
-1
CurveCalibrator.cc
src/ui/RadioCalibration/CurveCalibrator.cc
+38
-10
CurveCalibrator.h
src/ui/RadioCalibration/CurveCalibrator.h
+3
-3
RadioCalibrationData.cc
src/ui/RadioCalibration/RadioCalibrationData.cc
+17
-17
RadioCalibrationData.h
src/ui/RadioCalibration/RadioCalibrationData.h
+18
-16
RadioCalibrationWindow.cc
src/ui/RadioCalibration/RadioCalibrationWindow.cc
+6
-6
RadioCalibrationWindow.h
src/ui/RadioCalibration/RadioCalibrationWindow.h
+2
-0
SwitchCalibrator.cc
src/ui/RadioCalibration/SwitchCalibrator.cc
+3
-3
SwitchCalibrator.h
src/ui/RadioCalibration/SwitchCalibrator.h
+1
-1
No files found.
src/uas/UAS.cc
View file @
f75f4424
...
@@ -957,12 +957,12 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
...
@@ -957,12 +957,12 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
case
MAVLINK_MSG_ID_RADIO_CALIBRATION
:
{
case
MAVLINK_MSG_ID_RADIO_CALIBRATION
:
{
mavlink_radio_calibration_t
radioMsg
;
mavlink_radio_calibration_t
radioMsg
;
mavlink_msg_radio_calibration_decode
(
&
message
,
&
radioMsg
);
mavlink_msg_radio_calibration_decode
(
&
message
,
&
radioMsg
);
QVector
<
floa
t
>
aileron
;
QVector
<
uint16_
t
>
aileron
;
QVector
<
floa
t
>
elevator
;
QVector
<
uint16_
t
>
elevator
;
QVector
<
floa
t
>
rudder
;
QVector
<
uint16_
t
>
rudder
;
QVector
<
floa
t
>
gyro
;
QVector
<
uint16_
t
>
gyro
;
QVector
<
floa
t
>
pitch
;
QVector
<
uint16_
t
>
pitch
;
QVector
<
floa
t
>
throttle
;
QVector
<
uint16_
t
>
throttle
;
for
(
int
i
=
0
;
i
<
MAVLINK_MSG_RADIO_CALIBRATION_FIELD_AILERON_LEN
;
++
i
)
for
(
int
i
=
0
;
i
<
MAVLINK_MSG_RADIO_CALIBRATION_FIELD_AILERON_LEN
;
++
i
)
aileron
<<
radioMsg
.
aileron
[
i
];
aileron
<<
radioMsg
.
aileron
[
i
];
...
...
src/ui/QGCRemoteControlView.cc
View file @
f75f4424
...
@@ -120,25 +120,25 @@ void QGCRemoteControlView::setChannelRaw(int channelId, float raw)
...
@@ -120,25 +120,25 @@ void QGCRemoteControlView::setChannelRaw(int channelId, float raw)
redraw
();
redraw
();
}
}
//
void QGCRemoteControlView::setChannelScaled(int channelId, float normalized)
void
QGCRemoteControlView
::
setChannelScaled
(
int
channelId
,
float
normalized
)
//
{
{
//
if (this->raw.size() <= channelId) // using raw vector as size indicator
if
(
this
->
raw
.
size
()
<=
channelId
)
// using raw vector as size indicator
//
{
{
//
// This is a new channel, append it
// This is a new channel, append it
//
this->normalized.append(normalized);
this
->
normalized
.
append
(
normalized
);
//
this->raw.append(0);
this
->
raw
.
append
(
0
);
//
appendChannelWidget(channelId);
appendChannelWidget
(
channelId
);
//
}
}
//
else
else
//
{
{
//
// This is an existing channel, update it
// This is an existing channel, update it
//
this->normalized[channelId] = normalized;
this
->
normalized
[
channelId
]
=
normalized
;
//
}
}
// updated = true;
// updated = true;
// // FIXME Will be timer based in the future
// // FIXME Will be timer based in the future
// redraw();
// redraw();
//
}
}
void
QGCRemoteControlView
::
setRemoteRSSI
(
float
rssiNormalized
)
void
QGCRemoteControlView
::
setRemoteRSSI
(
float
rssiNormalized
)
{
{
...
@@ -179,9 +179,9 @@ void QGCRemoteControlView::redraw()
...
@@ -179,9 +179,9 @@ void QGCRemoteControlView::redraw()
// Update percent bars
// Update percent bars
for
(
int
i
=
0
;
i
<
progressBars
.
count
();
i
++
)
{
for
(
int
i
=
0
;
i
<
progressBars
.
count
();
i
++
)
{
rawLabels
.
at
(
i
)
->
setText
(
QString
(
"%1 us"
).
arg
(
raw
.
at
(
i
),
4
,
10
,
QChar
(
'0'
)));
rawLabels
.
at
(
i
)
->
setText
(
QString
(
"%1 us"
).
arg
(
raw
.
at
(
i
),
4
,
10
,
QChar
(
'0'
)));
//
int vv = normalized.at(i)*100.0f;
int
vv
=
normalized
.
at
(
i
)
*
100.0
f
;
//progressBars.at(i)->setValue(vv);
//progressBars.at(i)->setValue(vv);
int
vv
=
raw
.
at
(
i
)
*
1.0
f
;
//
int vv = raw.at(i)*1.0f;
progressBars
.
at
(
i
)
->
setValue
(
vv
);
progressBars
.
at
(
i
)
->
setValue
(
vv
);
}
}
// Update RSSI
// Update RSSI
...
...
src/ui/QGCRemoteControlView.h
View file @
f75f4424
...
@@ -55,7 +55,7 @@ public:
...
@@ -55,7 +55,7 @@ public:
public
slots
:
public
slots
:
void
setUASId
(
int
id
);
void
setUASId
(
int
id
);
void
setChannelRaw
(
int
channelId
,
float
raw
);
void
setChannelRaw
(
int
channelId
,
float
raw
);
//
void setChannelScaled(int channelId, float normalized);
void
setChannelScaled
(
int
channelId
,
float
normalized
);
void
setRemoteRSSI
(
float
rssiNormalized
);
void
setRemoteRSSI
(
float
rssiNormalized
);
void
redraw
();
void
redraw
();
...
...
src/ui/RadioCalibration/AbstractCalibrator.cc
View file @
f75f4424
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
AbstractCalibrator
::
AbstractCalibrator
(
QWidget
*
parent
)
:
AbstractCalibrator
::
AbstractCalibrator
(
QWidget
*
parent
)
:
QWidget
(
parent
),
QWidget
(
parent
),
pulseWidth
(
new
QLabel
()),
pulseWidth
(
new
QLabel
()),
log
(
new
QVector
<
floa
t
>
())
log
(
new
QVector
<
uint16_
t
>
())
{
{
}
}
...
@@ -12,17 +12,17 @@ AbstractCalibrator::~AbstractCalibrator()
...
@@ -12,17 +12,17 @@ AbstractCalibrator::~AbstractCalibrator()
delete
log
;
delete
log
;
}
}
floa
t
AbstractCalibrator
::
logAverage
()
uint16_
t
AbstractCalibrator
::
logAverage
()
{
{
floa
t
total
=
0
;
uint16_
t
total
=
0
;
for
(
int
i
=
0
;
i
<
log
->
size
();
++
i
)
for
(
int
i
=
0
;
i
<
log
->
size
();
++
i
)
total
+=
log
->
value
(
i
);
total
+=
log
->
value
(
i
);
return
floor
(
total
/
log
->
size
()
);
return
total
/
log
->
size
(
);
}
}
floa
t
AbstractCalibrator
::
logExtrema
()
uint16_
t
AbstractCalibrator
::
logExtrema
()
{
{
floa
t
extrema
=
logAverage
();
uint16_
t
extrema
=
logAverage
();
if
(
logAverage
()
<
1500
)
{
if
(
logAverage
()
<
1500
)
{
for
(
int
i
=
0
;
i
<
log
->
size
();
++
i
)
{
for
(
int
i
=
0
;
i
<
log
->
size
();
++
i
)
{
if
(
log
->
value
(
i
)
<
extrema
)
if
(
log
->
value
(
i
)
<
extrema
)
...
@@ -40,9 +40,9 @@ float AbstractCalibrator::logExtrema()
...
@@ -40,9 +40,9 @@ float AbstractCalibrator::logExtrema()
return
extrema
;
return
extrema
;
}
}
void
AbstractCalibrator
::
channelChanged
(
floa
t
raw
)
void
AbstractCalibrator
::
channelChanged
(
uint16_
t
raw
)
{
{
pulseWidth
->
setText
(
QString
::
number
(
static_cast
<
double
>
(
raw
)
));
pulseWidth
->
setText
(
QString
::
number
(
raw
));
if
(
log
->
size
()
==
5
)
if
(
log
->
size
()
==
5
)
log
->
pop_front
();
log
->
pop_front
();
log
->
push_back
(
raw
);
log
->
push_back
(
raw
);
...
...
src/ui/RadioCalibration/AbstractCalibrator.h
View file @
f75f4424
...
@@ -36,6 +36,7 @@ This file is part of the QGROUNDCONTROL project
...
@@ -36,6 +36,7 @@ This file is part of the QGROUNDCONTROL project
#include <QVector>
#include <QVector>
#include <math.h>
#include <math.h>
#include <stdint.h>
/**
/**
@brief Holds the code which is common to all the radio calibration widgets.
@brief Holds the code which is common to all the radio calibration widgets.
...
@@ -53,30 +54,30 @@ public:
...
@@ -53,30 +54,30 @@ public:
changing the display from an external source (file/uav).
changing the display from an external source (file/uav).
@param data QVector of setpoints
@param data QVector of setpoints
*/
*/
virtual
void
set
(
const
QVector
<
floa
t
>&
data
)
=
0
;
virtual
void
set
(
const
QVector
<
uint16_
t
>&
data
)
=
0
;
signals:
signals:
/** Announce a setpoint change.
/** Announce a setpoint change.
@param index setpoint number - 0 based in the current implementation
@param index setpoint number - 0 based in the current implementation
@param value new value
@param value new value
*/
*/
void
setpointChanged
(
int
index
,
floa
t
value
);
void
setpointChanged
(
int
index
,
uint16_
t
value
);
public
slots
:
public
slots
:
/** Slot to call when the relevant channel is updated
/** Slot to call when the relevant channel is updated
@param raw current channel value
@param raw current channel value
*/
*/
void
channelChanged
(
floa
t
raw
);
void
channelChanged
(
uint16_
t
raw
);
protected:
protected:
/** Display the current pulse width */
/** Display the current pulse width */
QLabel
*
pulseWidth
;
QLabel
*
pulseWidth
;
/** Log of the past few samples for use in averaging and finding extrema */
/** Log of the past few samples for use in averaging and finding extrema */
QVector
<
floa
t
>
*
log
;
QVector
<
uint16_
t
>
*
log
;
/** Find the maximum or minimum of the data log */
/** Find the maximum or minimum of the data log */
floa
t
logExtrema
();
uint16_
t
logExtrema
();
/** Find the average of the log */
/** Find the average of the log */
floa
t
logAverage
();
uint16_
t
logAverage
();
};
};
#endif // ABSTRACTCALIBRATOR_H
#endif // ABSTRACTCALIBRATOR_H
src/ui/RadioCalibration/AirfoilServoCalibrator.cc
View file @
f75f4424
...
@@ -78,23 +78,23 @@ AirfoilServoCalibrator::AirfoilServoCalibrator(AirfoilType type, QWidget *parent
...
@@ -78,23 +78,23 @@ AirfoilServoCalibrator::AirfoilServoCalibrator(AirfoilType type, QWidget *parent
void
AirfoilServoCalibrator
::
setHigh
()
void
AirfoilServoCalibrator
::
setHigh
()
{
{
highPulseWidth
->
setText
(
QString
::
number
(
static_cast
<
double
>
(
logExtrema
()
)));
highPulseWidth
->
setText
(
QString
::
number
(
logExtrema
(
)));
emit
setpointChanged
(
2
,
logExtrema
());
emit
setpointChanged
(
2
,
logExtrema
());
}
}
void
AirfoilServoCalibrator
::
setCenter
()
void
AirfoilServoCalibrator
::
setCenter
()
{
{
centerPulseWidth
->
setText
(
QString
::
number
(
static_cast
<
double
>
(
logAverage
()
)));
centerPulseWidth
->
setText
(
QString
::
number
(
logAverage
(
)));
emit
setpointChanged
(
1
,
logAverage
());
emit
setpointChanged
(
1
,
logAverage
());
}
}
void
AirfoilServoCalibrator
::
setLow
()
void
AirfoilServoCalibrator
::
setLow
()
{
{
lowPulseWidth
->
setText
(
QString
::
number
(
static_cast
<
double
>
(
logExtrema
()
)));
lowPulseWidth
->
setText
(
QString
::
number
(
logExtrema
(
)));
emit
setpointChanged
(
0
,
logExtrema
());
emit
setpointChanged
(
0
,
logExtrema
());
}
}
void
AirfoilServoCalibrator
::
set
(
const
QVector
<
floa
t
>
&
data
)
void
AirfoilServoCalibrator
::
set
(
const
QVector
<
uint16_
t
>
&
data
)
{
{
if
(
data
.
size
()
==
3
)
{
if
(
data
.
size
()
==
3
)
{
lowPulseWidth
->
setText
(
QString
::
number
(
data
[
0
]));
lowPulseWidth
->
setText
(
QString
::
number
(
data
[
0
]));
...
...
src/ui/RadioCalibration/AirfoilServoCalibrator.h
View file @
f75f4424
...
@@ -58,7 +58,7 @@ public:
...
@@ -58,7 +58,7 @@ public:
explicit
AirfoilServoCalibrator
(
AirfoilType
type
=
AILERON
,
QWidget
*
parent
=
0
);
explicit
AirfoilServoCalibrator
(
AirfoilType
type
=
AILERON
,
QWidget
*
parent
=
0
);
/** @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
<
floa
t
>&
data
);
void
set
(
const
QVector
<
uint16_
t
>&
data
);
protected
slots
:
protected
slots
:
void
setHigh
();
void
setHigh
();
...
...
src/ui/RadioCalibration/CurveCalibrator.cc
View file @
f75f4424
...
@@ -2,8 +2,8 @@
...
@@ -2,8 +2,8 @@
CurveCalibrator
::
CurveCalibrator
(
QString
titleString
,
QWidget
*
parent
)
:
CurveCalibrator
::
CurveCalibrator
(
QString
titleString
,
QWidget
*
parent
)
:
AbstractCalibrator
(
parent
),
AbstractCalibrator
(
parent
),
setpoints
(
new
QVector
<
double
>
(
5
)),
setpoints
(
new
QVector
<
uint16_t
>
(
5
)),
positions
(
new
QVector
<
double
>
())
positions
(
new
QVector
<
uint16_t
>
())
{
{
QGridLayout
*
grid
=
new
QGridLayout
(
this
);
QGridLayout
*
grid
=
new
QGridLayout
(
this
);
QLabel
*
title
=
new
QLabel
(
titleString
);
QLabel
*
title
=
new
QLabel
(
titleString
);
...
@@ -32,7 +32,17 @@ CurveCalibrator::CurveCalibrator(QString titleString, QWidget *parent) :
...
@@ -32,7 +32,17 @@ CurveCalibrator::CurveCalibrator(QString titleString, QWidget *parent) :
curve
=
new
QwtPlotCurve
();
curve
=
new
QwtPlotCurve
();
curve
->
setPen
(
QPen
(
QColor
(
QString
(
"lime"
))));
curve
->
setPen
(
QPen
(
QColor
(
QString
(
"lime"
))));
curve
->
setData
(
*
positions
,
*
setpoints
);
QVector
<
double
>
pos
(
positions
->
size
());
QVector
<
double
>
set
(
setpoints
->
size
());
for
(
int
i
=
0
;
i
<
positions
->
size
()
&&
i
<
setpoints
->
size
();
i
++
)
{
pos
[
i
]
=
static_cast
<
double
>
((
*
positions
)[
i
]);
set
[
i
]
=
static_cast
<
double
>
((
*
setpoints
)[
i
]);
}
curve
->
setData
(
pos
,
set
);
curve
->
attach
(
plot
);
curve
->
attach
(
plot
);
plot
->
replot
();
plot
->
replot
();
...
@@ -75,22 +85,40 @@ CurveCalibrator::~CurveCalibrator()
...
@@ -75,22 +85,40 @@ CurveCalibrator::~CurveCalibrator()
void
CurveCalibrator
::
setSetpoint
(
int
setpoint
)
void
CurveCalibrator
::
setSetpoint
(
int
setpoint
)
{
{
if
(
setpoint
==
0
||
setpoint
==
4
)
{
if
(
setpoint
==
0
||
setpoint
==
4
)
{
setpoints
->
replace
(
setpoint
,
static_cast
<
double
>
(
logExtrema
()
));
setpoints
->
replace
(
setpoint
,
logExtrema
(
));
}
else
{
}
else
{
setpoints
->
replace
(
setpoint
,
static_cast
<
double
>
(
logAverage
()
));
setpoints
->
replace
(
setpoint
,
logAverage
(
));
}
}
curve
->
setData
(
*
positions
,
*
setpoints
);
QVector
<
double
>
pos
(
positions
->
size
());
QVector
<
double
>
set
(
setpoints
->
size
());
for
(
int
i
=
0
;
i
<
positions
->
size
()
&&
i
<
setpoints
->
size
();
i
++
)
{
pos
[
i
]
=
static_cast
<
double
>
((
*
positions
)[
i
]);
set
[
i
]
=
static_cast
<
double
>
((
*
setpoints
)[
i
]);
}
curve
->
setData
(
pos
,
set
);
plot
->
replot
();
plot
->
replot
();
emit
setpointChanged
(
setpoint
,
s
tatic_cast
<
float
>
(
setpoints
->
value
(
setpoint
)
));
emit
setpointChanged
(
setpoint
,
s
etpoints
->
value
(
setpoint
));
}
}
void
CurveCalibrator
::
set
(
const
QVector
<
floa
t
>
&
data
)
void
CurveCalibrator
::
set
(
const
QVector
<
uint16_
t
>
&
data
)
{
{
if
(
data
.
size
()
==
5
)
{
if
(
data
.
size
()
==
5
)
{
for
(
int
i
=
0
;
i
<
data
.
size
();
++
i
)
for
(
int
i
=
0
;
i
<
data
.
size
();
++
i
)
setpoints
->
replace
(
i
,
static_cast
<
double
>
(
data
[
i
]));
setpoints
->
replace
(
i
,
data
[
i
]);
curve
->
setData
(
*
positions
,
*
setpoints
);
QVector
<
double
>
pos
(
positions
->
size
());
QVector
<
double
>
set
(
setpoints
->
size
());
for
(
int
i
=
0
;
i
<
positions
->
size
()
&&
i
<
setpoints
->
size
();
i
++
)
{
pos
[
i
]
=
static_cast
<
double
>
((
*
positions
)[
i
]);
set
[
i
]
=
static_cast
<
double
>
((
*
setpoints
)[
i
]);
}
curve
->
setData
(
pos
,
set
);
plot
->
replot
();
plot
->
replot
();
}
else
{
}
else
{
qDebug
()
<<
__FILE__
<<
__LINE__
<<
": wrong data vector size"
;
qDebug
()
<<
__FILE__
<<
__LINE__
<<
": wrong data vector size"
;
...
...
src/ui/RadioCalibration/CurveCalibrator.h
View file @
f75f4424
...
@@ -58,14 +58,14 @@ public:
...
@@ -58,14 +58,14 @@ public:
explicit
CurveCalibrator
(
QString
title
=
QString
(),
QWidget
*
parent
=
0
);
explicit
CurveCalibrator
(
QString
title
=
QString
(),
QWidget
*
parent
=
0
);
~
CurveCalibrator
();
~
CurveCalibrator
();
void
set
(
const
QVector
<
floa
t
>
&
data
);
void
set
(
const
QVector
<
uint16_
t
>
&
data
);
protected
slots
:
protected
slots
:
void
setSetpoint
(
int
setpoint
);
void
setSetpoint
(
int
setpoint
);
protected:
protected:
QVector
<
double
>
*
setpoints
;
QVector
<
uint16_t
>
*
setpoints
;
QVector
<
double
>
*
positions
;
QVector
<
uint16_t
>
*
positions
;
/** Plot to display calibration curve */
/** Plot to display calibration curve */
QwtPlot
*
plot
;
QwtPlot
*
plot
;
/** Curve object of calibration curve */
/** Curve object of calibration curve */
...
...
src/ui/RadioCalibration/RadioCalibrationData.cc
View file @
f75f4424
...
@@ -2,23 +2,23 @@
...
@@ -2,23 +2,23 @@
RadioCalibrationData
::
RadioCalibrationData
()
RadioCalibrationData
::
RadioCalibrationData
()
{
{
data
=
new
QVector
<
QVector
<
floa
t
>
>
(
6
);
data
=
new
QVector
<
QVector
<
uint16_
t
>
>
(
6
);
(
*
data
).
insert
(
AILERON
,
QVector
<
floa
t
>
(
3
));
(
*
data
).
insert
(
AILERON
,
QVector
<
uint16_
t
>
(
3
));
(
*
data
).
insert
(
ELEVATOR
,
QVector
<
floa
t
>
(
3
));
(
*
data
).
insert
(
ELEVATOR
,
QVector
<
uint16_
t
>
(
3
));
(
*
data
).
insert
(
RUDDER
,
QVector
<
floa
t
>
(
3
));
(
*
data
).
insert
(
RUDDER
,
QVector
<
uint16_
t
>
(
3
));
(
*
data
).
insert
(
GYRO
,
QVector
<
floa
t
>
(
2
));
(
*
data
).
insert
(
GYRO
,
QVector
<
uint16_
t
>
(
2
));
(
*
data
).
insert
(
PITCH
,
QVector
<
floa
t
>
(
5
));
(
*
data
).
insert
(
PITCH
,
QVector
<
uint16_
t
>
(
5
));
(
*
data
).
insert
(
THROTTLE
,
QVector
<
floa
t
>
(
5
));
(
*
data
).
insert
(
THROTTLE
,
QVector
<
uint16_
t
>
(
5
));
}
}
RadioCalibrationData
::
RadioCalibrationData
(
const
QVector
<
floa
t
>
&
aileron
,
RadioCalibrationData
::
RadioCalibrationData
(
const
QVector
<
uint16_
t
>
&
aileron
,
const
QVector
<
floa
t
>
&
elevator
,
const
QVector
<
uint16_
t
>
&
elevator
,
const
QVector
<
floa
t
>
&
rudder
,
const
QVector
<
uint16_
t
>
&
rudder
,
const
QVector
<
floa
t
>
&
gyro
,
const
QVector
<
uint16_
t
>
&
gyro
,
const
QVector
<
floa
t
>
&
pitch
,
const
QVector
<
uint16_
t
>
&
pitch
,
const
QVector
<
floa
t
>
&
throttle
)
const
QVector
<
uint16_
t
>
&
throttle
)
{
{
data
=
new
QVector
<
QVector
<
floa
t
>
>
();
data
=
new
QVector
<
QVector
<
uint16_
t
>
>
();
(
*
data
)
<<
aileron
(
*
data
)
<<
aileron
<<
elevator
<<
elevator
<<
rudder
<<
rudder
...
@@ -30,7 +30,7 @@ RadioCalibrationData::RadioCalibrationData(const QVector<float> &aileron,
...
@@ -30,7 +30,7 @@ RadioCalibrationData::RadioCalibrationData(const QVector<float> &aileron,
RadioCalibrationData
::
RadioCalibrationData
(
const
RadioCalibrationData
&
other
)
RadioCalibrationData
::
RadioCalibrationData
(
const
RadioCalibrationData
&
other
)
:
QObject
()
:
QObject
()
{
{
data
=
new
QVector
<
QVector
<
floa
t
>
>
(
*
other
.
data
);
data
=
new
QVector
<
QVector
<
uint16_
t
>
>
(
*
other
.
data
);
}
}
RadioCalibrationData
::~
RadioCalibrationData
()
RadioCalibrationData
::~
RadioCalibrationData
()
...
@@ -38,7 +38,7 @@ RadioCalibrationData::~RadioCalibrationData()
...
@@ -38,7 +38,7 @@ RadioCalibrationData::~RadioCalibrationData()
delete
data
;
delete
data
;
}
}
const
floa
t
*
RadioCalibrationData
::
operator
[](
int
i
)
const
const
uint16_
t
*
RadioCalibrationData
::
operator
[](
int
i
)
const
{
{
if
(
i
<
data
->
size
())
{
if
(
i
<
data
->
size
())
{
return
(
*
data
)[
i
].
constData
();
return
(
*
data
)[
i
].
constData
();
...
@@ -47,7 +47,7 @@ const float* RadioCalibrationData::operator [](int i) const
...
@@ -47,7 +47,7 @@ const float* RadioCalibrationData::operator [](int i) const
return
NULL
;
return
NULL
;
}
}
const
QVector
<
floa
t
>&
RadioCalibrationData
::
operator
()(
const
int
i
)
const
throw
(
std
::
out_of_range
)
const
QVector
<
uint16_
t
>&
RadioCalibrationData
::
operator
()(
const
int
i
)
const
throw
(
std
::
out_of_range
)
{
{
if
((
i
<
data
->
size
())
&&
(
i
>=
0
))
{
if
((
i
<
data
->
size
())
&&
(
i
>=
0
))
{
return
(
*
data
)[
i
];
return
(
*
data
)[
i
];
...
...
src/ui/RadioCalibration/RadioCalibrationData.h
View file @
f75f4424
...
@@ -36,6 +36,8 @@ This file is part of the QGROUNDCONTROL project
...
@@ -36,6 +36,8 @@ This file is part of the QGROUNDCONTROL project
#include <QString>
#include <QString>
#include <stdexcept>
#include <stdexcept>
#include <stdint.h>
/**
/**
@brief Class to hold the calibration data.
@brief Class to hold the calibration data.
...
@@ -48,12 +50,12 @@ class RadioCalibrationData : public QObject
...
@@ -48,12 +50,12 @@ class RadioCalibrationData : public QObject
public:
public:
explicit
RadioCalibrationData
();
explicit
RadioCalibrationData
();
RadioCalibrationData
(
const
RadioCalibrationData
&
);
RadioCalibrationData
(
const
RadioCalibrationData
&
);
RadioCalibrationData
(
const
QVector
<
floa
t
>&
aileron
,
RadioCalibrationData
(
const
QVector
<
uint16_
t
>&
aileron
,
const
QVector
<
floa
t
>&
elevator
,
const
QVector
<
uint16_
t
>&
elevator
,
const
QVector
<
floa
t
>&
rudder
,
const
QVector
<
uint16_
t
>&
rudder
,
const
QVector
<
floa
t
>&
gyro
,
const
QVector
<
uint16_
t
>&
gyro
,
const
QVector
<
floa
t
>&
pitch
,
const
QVector
<
uint16_
t
>&
pitch
,
const
QVector
<
floa
t
>&
throttle
);
const
QVector
<
uint16_
t
>&
throttle
);
~
RadioCalibrationData
();
~
RadioCalibrationData
();
enum
RadioElement
{
enum
RadioElement
{
...
@@ -65,33 +67,33 @@ public:
...
@@ -65,33 +67,33 @@ public:
THROTTLE
THROTTLE
};
};
const
floa
t
*
operator
[](
int
i
)
const
;
const
uint16_
t
*
operator
[](
int
i
)
const
;
#ifdef _MSC_VER
#ifdef _MSC_VER
const
QVector
<
floa
t
>&
operator
()(
int
i
)
const
;
const
QVector
<
uint16_
t
>&
operator
()(
int
i
)
const
;
#else
#else
const
QVector
<
floa
t
>&
operator
()(
int
i
)
const
throw
(
std
::
out_of_range
);
const
QVector
<
uint16_
t
>&
operator
()(
int
i
)
const
throw
(
std
::
out_of_range
);
#endif
#endif
void
set
(
int
element
,
int
index
,
float
value
)
{
void
set
(
int
element
,
int
index
,
float
value
)
{
(
*
data
)[
element
][
index
]
=
value
;
(
*
data
)[
element
][
index
]
=
value
;
}
}
public
slots
:
public
slots
:
void
setAileron
(
int
index
,
floa
t
value
)
{
void
setAileron
(
int
index
,
uint16_
t
value
)
{
set
(
AILERON
,
index
,
value
);
set
(
AILERON
,
index
,
value
);
}
}
void
setElevator
(
int
index
,
floa
t
value
)
{
void
setElevator
(
int
index
,
uint16_
t
value
)
{
set
(
ELEVATOR
,
index
,
value
);
set
(
ELEVATOR
,
index
,
value
);
}
}
void
setRudder
(
int
index
,
floa
t
value
)
{
void
setRudder
(
int
index
,
uint16_
t
value
)
{
set
(
RUDDER
,
index
,
value
);
set
(
RUDDER
,
index
,
value
);
}
}
void
setGyro
(
int
index
,
floa
t
value
)
{
void
setGyro
(
int
index
,
uint16_
t
value
)
{
set
(
GYRO
,
index
,
value
);
set
(
GYRO
,
index
,
value
);
}
}
void
setPitch
(
int
index
,
floa
t
value
)
{
void
setPitch
(
int
index
,
uint16_
t
value
)
{
set
(
PITCH
,
index
,
value
);
set
(
PITCH
,
index
,
value
);
}
}
void
setThrottle
(
int
index
,
floa
t
value
)
{
void
setThrottle
(
int
index
,
uint16_
t
value
)
{
set
(
THROTTLE
,
index
,
value
);
set
(
THROTTLE
,
index
,
value
);
}
}
...
@@ -100,7 +102,7 @@ public:
...
@@ -100,7 +102,7 @@ public:
QString
toString
(
const
RadioElement
element
)
const
;
QString
toString
(
const
RadioElement
element
)
const
;
protected:
protected:
QVector
<
QVector
<
floa
t
>
>
*
data
;
QVector
<
QVector
<
uint16_
t
>
>
*
data
;
void
init
(
const
QVector
<
float
>&
aileron
,
void
init
(
const
QVector
<
float
>&
aileron
,
const
QVector
<
float
>&
elevator
,
const
QVector
<
float
>&
elevator
,
...
...
src/ui/RadioCalibration/RadioCalibrationWindow.cc
View file @
f75f4424
...
@@ -43,12 +43,12 @@ RadioCalibrationWindow::RadioCalibrationWindow(QWidget *parent) :
...
@@ -43,12 +43,12 @@ RadioCalibrationWindow::RadioCalibrationWindow(QWidget *parent) :
connect
(
transmit
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
send
()));
connect
(
transmit
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
send
()));
connect
(
get
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
request
()));
connect
(
get
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
request
()));
connect
(
aileron
,
SIGNAL
(
setpointChanged
(
int
,
float
)),
radio
,
SLOT
(
setAileron
(
int
,
floa
t
)));
connect
(
aileron
,
SIGNAL
(
setpointChanged
(
int
,
uint16_t
)),
radio
,
SLOT
(
setAileron
(
int
,
uint16_
t
)));
connect
(
elevator
,
SIGNAL
(
setpointChanged
(
int
,
float
)),
radio
,
SLOT
(
setElevator
(
int
,
floa
t
)));
connect
(
elevator
,
SIGNAL
(
setpointChanged
(
int
,
uint16_t
)),
radio
,
SLOT
(
setElevator
(
int
,
uint16_
t
)));
connect
(
rudder
,
SIGNAL
(
setpointChanged
(
int
,
float
)),
radio
,
SLOT
(
setRudder
(
int
,
floa
t
)));
connect
(
rudder
,
SIGNAL
(
setpointChanged
(
int
,
uint16_t
)),
radio
,
SLOT
(
setRudder
(
int
,
uint16_
t
)));
connect
(
gyro
,
SIGNAL
(
setpointChanged
(
int
,
float
)),
radio
,
SLOT
(
setGyro
(
int
,
floa
t
)));
connect
(
gyro
,
SIGNAL
(
setpointChanged
(
int
,
uint16_t
)),
radio
,
SLOT
(
setGyro
(
int
,
uint16_
t
)));
connect
(
pitch
,
SIGNAL
(
setpointChanged
(
int
,
float
)),
radio
,
SLOT
(
setPitch
(
int
,
floa
t
)));
connect
(
pitch
,
SIGNAL
(
setpointChanged
(
int
,
uint16_t
)),
radio
,
SLOT
(
setPitch
(
int
,
uint16_
t
)));
connect
(
throttle
,
SIGNAL
(
setpointChanged
(
int
,
float
)),
radio
,
SLOT
(
setThrottle
(
int
,
floa
t
)));
connect
(
throttle
,
SIGNAL
(
setpointChanged
(
int
,
uint16_t
)),
radio
,
SLOT
(
setThrottle
(
int
,
uint16_
t
)));
setUASId
(
0
);
setUASId
(
0
);
}
}
...
...
src/ui/RadioCalibration/RadioCalibrationWindow.h
View file @
f75f4424
...
@@ -44,6 +44,8 @@ This file is part of the QGROUNDCONTROL project
...
@@ -44,6 +44,8 @@ This file is part of the QGROUNDCONTROL project
#include <QtXml>
#include <QtXml>
#include <QTextStream>
#include <QTextStream>
#include <stdint.h>
#include "AirfoilServoCalibrator.h"
#include "AirfoilServoCalibrator.h"
#include "SwitchCalibrator.h"
#include "SwitchCalibrator.h"
#include "CurveCalibrator.h"
#include "CurveCalibrator.h"
...
...
src/ui/RadioCalibration/SwitchCalibrator.cc
View file @
f75f4424
...
@@ -38,17 +38,17 @@ SwitchCalibrator::SwitchCalibrator(QString titleString, QWidget *parent) :
...
@@ -38,17 +38,17 @@ SwitchCalibrator::SwitchCalibrator(QString titleString, QWidget *parent) :
void
SwitchCalibrator
::
setDefault
()
void
SwitchCalibrator
::
setDefault
()
{
{
defaultPulseWidth
->
setText
(
QString
::
number
(
static_cast
<
double
>
(
logExtrema
()
)));
defaultPulseWidth
->
setText
(
QString
::
number
(
logExtrema
(
)));
emit
setpointChanged
(
0
,
logExtrema
());
emit
setpointChanged
(
0
,
logExtrema
());
}
}
void
SwitchCalibrator
::
setToggled
()
void
SwitchCalibrator
::
setToggled
()
{
{
toggledPulseWidth
->
setText
(
QString
::
number
(
static_cast
<
double
>
(
logExtrema
()
)));
toggledPulseWidth
->
setText
(
QString
::
number
(
logExtrema
(
)));
emit
setpointChanged
(
1
,
logExtrema
());
emit
setpointChanged
(
1
,
logExtrema
());
}
}
void
SwitchCalibrator
::
set
(
const
QVector
<
floa
t
>
&
data
)
void
SwitchCalibrator
::
set
(
const
QVector
<
uint16_
t
>
&
data
)
{
{
if
(
data
.
size
()
==
2
)
{
if
(
data
.
size
()
==
2
)
{
defaultPulseWidth
->
setText
(
QString
::
number
(
data
[
0
]));
defaultPulseWidth
->
setText
(
QString
::
number
(
data
[
0
]));
...
...
src/ui/RadioCalibration/SwitchCalibrator.h
View file @
f75f4424
...
@@ -49,7 +49,7 @@ class SwitchCalibrator : public AbstractCalibrator
...
@@ -49,7 +49,7 @@ class SwitchCalibrator : public AbstractCalibrator
public:
public:
explicit
SwitchCalibrator
(
QString
title
=
QString
(),
QWidget
*
parent
=
0
);
explicit
SwitchCalibrator
(
QString
title
=
QString
(),
QWidget
*
parent
=
0
);
void
set
(
const
QVector
<
floa
t
>
&
data
);
void
set
(
const
QVector
<
uint16_
t
>
&
data
);
protected
slots
:
protected
slots
:
void
setDefault
();
void
setDefault
();
...
...
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