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
c4874a48
Commit
c4874a48
authored
Oct 06, 2010
by
Bryan Godbolt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ready to test load save and transmit for rc calibration
parent
da1a7153
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
102 additions
and
11 deletions
+102
-11
RadioCalibration.xml
settings/RadioCalibration.xml
+6
-3
OpalLink.cc
src/comm/OpalLink.cc
+5
-0
CurveCalibrator.cc
src/ui/RadioCalibration/CurveCalibrator.cc
+0
-7
RadioCalibrationData.cc
src/ui/RadioCalibration/RadioCalibrationData.cc
+10
-0
RadioCalibrationData.h
src/ui/RadioCalibration/RadioCalibrationData.h
+5
-0
RadioCalibrationWindow.cc
src/ui/RadioCalibration/RadioCalibrationWindow.cc
+75
-1
RadioCalibrationWindow.h
src/ui/RadioCalibration/RadioCalibrationWindow.h
+1
-0
No files found.
settings/RadioCalibration.xml
View file @
c4874a48
<!-- Values are ordered low center high -->
<channels>
<threeSetpoint
name=
"Aileron"
number=
"1"
>
1.0, 1.5, 2.0
</threeSetpoint>
<twoSetpoint
name=
"Gyro"
number=
"3"
>
2.0, 1.0
</twoSetpoint>
<fiveSetpoint
name=
"Pitch"
number=
"5"
>
1.0, 1.25, 1.5, 1.75, 2.0
</fiveSetpoint>
<threeSetpoint
name=
"Aileron"
number=
"1"
>
1000.0, 1500.0, 2000.0
</threeSetpoint>
<threeSetpoint
name=
"Elevator"
number=
"2"
>
1000.0, 1500.0, 2000.0
</threeSetpoint>
<threeSetpoint
name=
"Rudder"
number=
"4"
>
1000.0, 1500.0, 2000.0
</threeSetpoint>
<twoSetpoint
name=
"Gyro"
number=
"5"
>
2000.0, 1000.0
</twoSetpoint>
<fiveSetpoint
name=
"Pitch"
number=
"6"
>
1000.0, 1250.0, 1500.0, 1750.0, 2000.0
</fiveSetpoint>
<fiveSetpoint
name=
"Throttle"
number=
"3"
>
1000.0, 1250.0, 1500.0, 1750.0, 2000.0
</fiveSetpoint>
</channels>
src/comm/OpalLink.cc
View file @
c4874a48
...
...
@@ -149,6 +149,11 @@ void OpalLink::writeBytes(const char *bytes, qint64 length)
mavlink_msg_radio_calibration_decode
(
&
msg
,
&
radio
);
qDebug
()
<<
"RADIO CALIBRATION RECEIVED"
;
qDebug
()
<<
"AILERON: "
<<
radio
.
aileron
[
0
]
<<
" "
<<
radio
.
aileron
[
1
]
<<
" "
<<
radio
.
aileron
[
2
];
qDebug
()
<<
"ELEVATOR: "
<<
radio
.
elevator
[
0
]
<<
" "
<<
radio
.
elevator
[
1
]
<<
" "
<<
radio
.
elevator
[
2
];
qDebug
()
<<
"RUDDER: "
<<
radio
.
rudder
[
0
]
<<
" "
<<
radio
.
rudder
[
1
]
<<
" "
<<
radio
.
rudder
[
2
];
qDebug
()
<<
"GYRO: "
<<
radio
.
gyro
[
0
]
<<
" "
<<
radio
.
gyro
[
1
];
qDebug
()
<<
"PITCH: "
<<
radio
.
pitch
[
0
]
<<
radio
.
pitch
[
1
]
<<
radio
.
pitch
[
2
]
<<
radio
.
pitch
[
3
]
<<
radio
.
pitch
[
4
];
qDebug
()
<<
"THROTTLE: "
<<
radio
.
throttle
[
0
]
<<
radio
.
throttle
[
1
]
<<
radio
.
throttle
[
2
]
<<
radio
.
throttle
[
3
]
<<
radio
.
throttle
[
4
];
}
break
;
#endif
...
...
src/ui/RadioCalibration/CurveCalibrator.cc
View file @
c4874a48
...
...
@@ -92,16 +92,9 @@ void CurveCalibrator::set(const QVector<float> &data)
{
if
(
data
.
size
()
==
5
)
{
// delete setpoints;
// QVector<double> dataDouble;
for
(
int
i
=
0
;
i
<
data
.
size
();
++
i
)
setpoints
->
replace
(
i
,
static_cast
<
double
>
(
data
[
i
]));
// setpoints = new QVector<double>(dataDouble);
curve
->
setPen
(
QPen
(
QColor
(
QString
(
"lime"
))));
curve
->
setData
(
*
positions
,
*
setpoints
);
curve
->
attach
(
plot
);
plot
->
replot
();
}
else
...
...
src/ui/RadioCalibration/RadioCalibrationData.cc
View file @
c4874a48
...
...
@@ -58,3 +58,13 @@ const QVector<float>& RadioCalibrationData::operator ()(int i) const
// This is not good. If it is ever used after being returned it will cause a crash
// return QVector<float>();
}
QString
RadioCalibrationData
::
toString
(
RadioElement
element
)
const
{
QString
s
;
foreach
(
float
f
,
(
*
data
)[
element
])
{
s
+=
QString
::
number
(
f
)
+
", "
;
}
return
s
.
mid
(
0
,
s
.
length
()
-
2
);
}
src/ui/RadioCalibration/RadioCalibrationData.h
View file @
c4874a48
...
...
@@ -4,6 +4,7 @@
#include <QObject>
#include <QDebug>
#include <QVector>
#include <QString>
class
RadioCalibrationData
:
public
QObject
...
...
@@ -43,6 +44,10 @@ public slots:
void
setPitch
(
int
index
,
float
value
)
{
set
(
PITCH
,
index
,
value
);}
void
setThrottle
(
int
index
,
float
value
)
{
set
(
THROTTLE
,
index
,
value
);}
public:
/// Creates a comman seperated list of the values for a particular element
QString
toString
(
const
RadioElement
element
)
const
;
protected:
QVector
<
QVector
<
float
>
>
*
data
;
...
...
src/ui/RadioCalibration/RadioCalibrationWindow.cc
View file @
c4874a48
...
...
@@ -84,7 +84,80 @@ void RadioCalibrationWindow::setChannel(int ch, float raw, float normalized)
void
RadioCalibrationWindow
::
saveFile
()
{
qDebug
()
<<
__FILE__
<<
__LINE__
<<
"SAVE TO FILE"
;
QString
fileName
(
QFileDialog
::
getSaveFileName
(
this
,
tr
(
"Save RC Calibration"
),
"settings/"
,
tr
(
"XML Files (*.xml)"
)));
if
(
fileName
.
isEmpty
())
return
;
QDomDocument
*
rcConfig
=
new
QDomDocument
();
QFile
rcFile
(
fileName
);
if
(
rcFile
.
exists
())
{
rcFile
.
remove
();
}
if
(
!
rcFile
.
open
(
QFile
::
WriteOnly
|
QFile
::
Text
))
{
qDebug
()
<<
__FILE__
<<
__LINE__
<<
"could not open"
<<
rcFile
.
fileName
()
<<
"for writing"
;
return
;
}
QDomElement
root
;
rcConfig
->
appendChild
(
root
=
rcConfig
->
createElement
(
"channels"
));
QDomElement
e
;
QDomText
t
;
// Aileron
e
=
rcConfig
->
createElement
(
"threeSetpoint"
);
e
.
setAttribute
(
"name"
,
"Aileron"
);
e
.
setAttribute
(
"number"
,
"1"
);
t
=
rcConfig
->
createTextNode
(
radio
->
toString
(
RadioCalibrationData
::
AILERON
));
e
.
appendChild
(
t
);
root
.
appendChild
(
e
);
// Elevator
e
=
rcConfig
->
createElement
(
"threeSetpoint"
);
e
.
setAttribute
(
"name"
,
"Elevator"
);
e
.
setAttribute
(
"number"
,
"2"
);
t
=
rcConfig
->
createTextNode
(
radio
->
toString
(
RadioCalibrationData
::
ELEVATOR
));
e
.
appendChild
(
t
);
root
.
appendChild
(
e
);
// Rudder
e
=
rcConfig
->
createElement
(
"threeSetpoint"
);
e
.
setAttribute
(
"name"
,
"Rudder"
);
e
.
setAttribute
(
"number"
,
"4"
);
t
=
rcConfig
->
createTextNode
(
radio
->
toString
(
RadioCalibrationData
::
RUDDER
));
e
.
appendChild
(
t
);
root
.
appendChild
(
e
);
// Gyro Mode/Gain
e
=
rcConfig
->
createElement
(
"twoSetpoint"
);
e
.
setAttribute
(
"name"
,
"Gyro"
);
e
.
setAttribute
(
"number"
,
"5"
);
t
=
rcConfig
->
createTextNode
(
radio
->
toString
(
RadioCalibrationData
::
GYRO
));
e
.
appendChild
(
t
);
root
.
appendChild
(
e
);
// Throttle
e
=
rcConfig
->
createElement
(
"fiveSetpoint"
);
e
.
setAttribute
(
"name"
,
"Throttle"
);
e
.
setAttribute
(
"number"
,
"3"
);
t
=
rcConfig
->
createTextNode
(
radio
->
toString
(
RadioCalibrationData
::
THROTTLE
));
e
.
appendChild
(
t
);
root
.
appendChild
(
e
);
// Pitch
e
=
rcConfig
->
createElement
(
"fiveSetpoint"
);
e
.
setAttribute
(
"name"
,
"Pitch"
);
e
.
setAttribute
(
"number"
,
"6"
);
t
=
rcConfig
->
createTextNode
(
radio
->
toString
(
RadioCalibrationData
::
PITCH
));
e
.
appendChild
(
t
);
root
.
appendChild
(
e
);
QTextStream
out
(
&
rcFile
);
const
int
IndentSize
=
4
;
rcConfig
->
save
(
out
,
IndentSize
);
rcFile
.
close
();
}
void
RadioCalibrationWindow
::
loadFile
()
...
...
@@ -121,6 +194,7 @@ void RadioCalibrationWindow::loadFile()
return
;
}
rcFile
.
close
();
QDomElement
root
=
rcConfig
->
documentElement
();
if
(
root
.
tagName
()
!=
"channels"
)
{
qDebug
()
<<
__FILE__
<<
__LINE__
<<
"This is not a Radio Calibration xml file"
;
...
...
src/ui/RadioCalibration/RadioCalibrationWindow.h
View file @
c4874a48
...
...
@@ -13,6 +13,7 @@
#include <QFileDialog>
#include <QFile>
#include <QtXml>
#include <QTextStream>
#include "AirfoilServoCalibrator.h"
#include "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