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
1aa7b9b9
Commit
1aa7b9b9
authored
Aug 25, 2013
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Many more fixes on calibration, starts to actually do something
parent
bd2ecaaf
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
196 additions
and
48 deletions
+196
-48
style-dark.css
files/styles/style-dark.css
+13
-0
QGCPX4VehicleConfig.cc
src/ui/QGCPX4VehicleConfig.cc
+3
-3
QGCPX4SensorCalibration.cc
src/ui/px4_configuration/QGCPX4SensorCalibration.cc
+130
-11
QGCPX4SensorCalibration.h
src/ui/px4_configuration/QGCPX4SensorCalibration.h
+9
-0
QGCPX4SensorCalibration.ui
src/ui/px4_configuration/QGCPX4SensorCalibration.ui
+41
-34
No files found.
files/styles/style-dark.css
View file @
1aa7b9b9
...
...
@@ -248,6 +248,19 @@ QLabel#noUas {
font-size
:
30pt
;
}
QMessageBox
QLabel
{
font-size
:
12pt
;
}
QLabel
#calibrationExplanationLabel
{
font-size
:
20pt
;
}
QLabel
#instructionLabel
{
color
:
#FEC654
;
font-size
:
26pt
;
}
QLineEdit
{
border
:
1px
solid
#777
;
border-radius
:
2px
;
...
...
src/ui/QGCPX4VehicleConfig.cc
View file @
1aa7b9b9
...
...
@@ -1027,9 +1027,9 @@ void QGCPX4VehicleConfig::setActiveUAS(UASInterface* active)
foreach
(
QWidget
*
child
,
ui
->
advanceColumnContents
->
findChildren
<
QWidget
*>
())
{
child
->
deleteLater
();
}
foreach
(
QWidget
*
child
,
ui
->
sensorLayout
->
findChildren
<
QWidget
*>
())
{
child
->
deleteLater
();
}
//
foreach(QWidget* child, ui->sensorLayout->findChildren<QWidget*>()) {
//
child->deleteLater();
//
}
foreach
(
QWidget
*
child
,
ui
->
airframeLayout
->
findChildren
<
QWidget
*>
())
{
...
...
src/ui/px4_configuration/QGCPX4SensorCalibration.cc
View file @
1aa7b9b9
...
...
@@ -3,16 +3,35 @@
#include <UASManager.h>
#include <QMenu>
#include <QScrollBar>
#include <QDebug>
QGCPX4SensorCalibration
::
QGCPX4SensorCalibration
(
QWidget
*
parent
)
:
QWidget
(
parent
),
activeUAS
(
NULL
),
clearAction
(
new
QAction
(
tr
(
"Clear Text"
),
this
)),
accelStarted
(
false
),
gyroStarted
(
false
),
magStarted
(
false
),
ui
(
new
Ui
::
QGCPX4SensorCalibration
)
{
accelAxes
<<
"x+"
;
accelAxes
<<
"x-"
;
accelAxes
<<
"y+"
;
accelAxes
<<
"y-"
;
accelAxes
<<
"z+"
;
accelAxes
<<
"z-"
;
ui
->
setupUi
(
this
);
connect
(
clearAction
,
SIGNAL
(
triggered
()),
ui
->
textView
,
SLOT
(
clear
()));
connect
(
ui
->
gyroButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
gyroButtonClicked
()));
connect
(
ui
->
magButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
magButtonClicked
()));
connect
(
ui
->
accelButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
accelButtonClicked
()));
ui
->
gyroButton
->
setEnabled
(
false
);
ui
->
magButton
->
setEnabled
(
false
);
ui
->
accelButton
->
setEnabled
(
false
);
setInstructionImage
(
"./files/images/px4/calibration/accel_z-.png"
);
setObjectName
(
"PX4_SENSOR_CALIBRATION"
);
...
...
@@ -21,6 +40,7 @@ QGCPX4SensorCalibration::QGCPX4SensorCalibration(QWidget *parent) :
setActiveUAS
(
UASManager
::
instance
()
->
getActiveUAS
());
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
this
,
SLOT
(
setActiveUAS
(
UASInterface
*
)));
ui
->
progressBar
->
setValue
(
0
);
}
QGCPX4SensorCalibration
::~
QGCPX4SensorCalibration
()
...
...
@@ -59,12 +79,90 @@ void QGCPX4SensorCalibration::setActiveUAS(UASInterface* uas)
ui
->
textView
->
clear
();
}
ui
->
gyroButton
->
setEnabled
(
true
);
ui
->
magButton
->
setEnabled
(
true
);
ui
->
accelButton
->
setEnabled
(
true
);
connect
(
uas
,
SIGNAL
(
textMessageReceived
(
int
,
int
,
int
,
QString
)),
this
,
SLOT
(
handleTextMessage
(
int
,
int
,
int
,
QString
)));
activeUAS
=
uas
;
}
void
QGCPX4SensorCalibration
::
handleTextMessage
(
int
uasid
,
int
compId
,
int
severity
,
QString
text
)
{
if
(
text
.
startsWith
(
"[cmd]"
)
||
text
.
startsWith
(
"[mavlink pm]"
))
return
;
if
(
text
.
contains
(
"progress"
))
{
qDebug
()
<<
"PROGRESS:"
<<
text
;
QString
percent
=
text
.
split
(
"<"
).
last
().
split
(
">"
).
first
();
qDebug
()
<<
"PERCENT CANDIDATE"
<<
percent
;
bool
ok
;
int
p
=
percent
.
toInt
(
&
ok
);
if
(
ok
)
ui
->
progressBar
->
setValue
(
p
);
return
;
}
if
(
text
.
contains
(
"accel"
))
{
qDebug
()
<<
"ACCEL"
<<
text
;
if
(
text
.
startsWith
(
"accel meas started: "
))
{
QString
axis
=
text
.
split
(
"meas started: "
).
last
().
right
(
2
);
qDebug
()
<<
"AXIS"
<<
axis
<<
"STR"
<<
text
;
setInstructionImage
(
QString
(
"./files/images/px4/calibration/accel_%1.png"
).
arg
(
axis
));
}
}
if
(
text
.
startsWith
(
"meas result for"
))
{
QString
axis
=
text
.
split
(
"meas result for "
).
last
().
left
(
2
);
qDebug
()
<<
"ACCELDONE AXIS"
<<
axis
<<
"STR"
<<
text
;
for
(
int
i
=
0
;
i
<
6
;
i
++
)
{
if
(
accelAxes
[
i
]
==
axis
)
accelDone
[
i
]
=
true
;
if
(
!
accelDone
[
i
])
{
setInstructionImage
(
QString
(
"./files/images/px4/calibration/accel_%1.png"
).
arg
(
accelAxes
[
i
]));
ui
->
calibrationExplanationLabel
->
setText
(
tr
(
"Axis %1 completed. Please rotate to a different axis, e.g. the one shown here."
).
arg
(
axis
));
}
}
}
if
(
text
.
contains
(
"please rotate in a figure 8"
))
{
ui
->
calibrationExplanationLabel
->
setText
(
tr
(
"Rotate the system around all its axes, e.g. in a figure eight."
));
setInstructionImage
(
"./files/images/px4/calibration/mag_calibration_figure8.png"
);
}
if
(
text
.
contains
(
"accel calibration done"
))
{
accelStarted
=
false
;
// XXX use a confirmation image or something
setInstructionImage
(
"./files/images/px4/calibration/accel_z-.png"
);
ui
->
calibrationExplanationLabel
->
setText
(
tr
(
"Accelerometer calibration completed. Parameters permanently stored."
));
}
if
(
text
.
contains
(
"gyro calibration done"
))
{
gyroStarted
=
false
;
// XXX use a confirmation image or something
setInstructionImage
(
"./files/images/px4/calibration/accel_z-.png"
);
ui
->
calibrationExplanationLabel
->
setText
(
tr
(
"Gyroscope calibration completed. Parameters permanently stored."
));
}
if
(
text
.
contains
(
"mag calibration done"
))
{
magStarted
=
false
;
// XXX use a confirmation image or something
setInstructionImage
(
"./files/images/px4/calibration/accel_z-.png"
);
ui
->
calibrationExplanationLabel
->
setText
(
tr
(
"Magnetometer calibration completed. Parameters permanently stored."
));
}
ui
->
instructionLabel
->
setText
(
QString
(
"%1"
).
arg
(
text
));
// XXX color messages according to severity
QPlainTextEdit
*
msgWidget
=
ui
->
textView
;
...
...
@@ -73,22 +171,43 @@ void QGCPX4SensorCalibration::handleTextMessage(int uasid, int compId, int sever
msgWidget
->
setUpdatesEnabled
(
false
);
QScrollBar
*
scroller
=
msgWidget
->
verticalScrollBar
();
UASInterface
*
uas
=
UASManager
::
instance
()
->
getUASForId
(
uasid
);
QString
uasName
(
uas
->
getUASName
());
QString
colorName
(
uas
->
getColor
().
name
());
//change styling based on severity
if
(
160
==
severity
)
{
//TODO where is the constant for "critical" severity?
//GAudioOutput::instance()->say(text.toLower());
msgWidget
->
appendHtml
(
QString
(
"<p style=
\"
color:#DC143C;background-color:#FFFACD;font-size:large;font-weight:bold
\"
>[%1:%2] %3</p>"
).
arg
(
uasName
).
arg
(
compId
).
arg
(
text
));
}
else
{
msgWidget
->
appendHtml
(
QString
(
"<p style=
\"
color:%1;font-size:smaller
\"
>[%2:%3] %4</p>"
).
arg
(
colorName
).
arg
(
uasName
).
arg
(
compId
).
arg
(
text
));
}
msgWidget
->
appendHtml
(
QString
(
"%4"
).
arg
(
text
));
// Ensure text area scrolls correctly
scroller
->
setValue
(
scroller
->
maximum
());
msgWidget
->
setUpdatesEnabled
(
true
);
}
void
QGCPX4SensorCalibration
::
gyroButtonClicked
()
{
setInstructionImage
(
"./files/images/px4/calibration/accel_z-.png"
);
activeUAS
->
executeCommand
(
MAV_CMD_PREFLIGHT_CALIBRATION
,
1
,
1.0
f
,
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
,
0
);
ui
->
progressBar
->
setValue
(
0
);
ui
->
calibrationExplanationLabel
->
setText
(
tr
(
"Please do not move the system at all and wait for calibration to complete."
));
}
void
QGCPX4SensorCalibration
::
magButtonClicked
()
{
setInstructionImage
(
"./files/images/px4/calibration/accel_z-.png"
);
activeUAS
->
executeCommand
(
MAV_CMD_PREFLIGHT_CALIBRATION
,
1
,
0.0
f
,
1.0
f
,
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
,
0
);
ui
->
progressBar
->
setValue
(
0
);
ui
->
calibrationExplanationLabel
->
setText
(
tr
(
"Please put the system in a rest position and wait for instructions."
));
}
void
QGCPX4SensorCalibration
::
accelButtonClicked
()
{
setInstructionImage
(
"./files/images/px4/calibration/accel_z-.png"
);
activeUAS
->
executeCommand
(
MAV_CMD_PREFLIGHT_CALIBRATION
,
1
,
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
,
1.0
f
,
0.0
f
,
0.0
f
,
0
);
ui
->
progressBar
->
setValue
(
0
);
accelStarted
=
true
;
accelDone
[
0
]
=
false
;
accelDone
[
1
]
=
false
;
accelDone
[
2
]
=
false
;
accelDone
[
3
]
=
false
;
accelDone
[
4
]
=
false
;
accelDone
[
5
]
=
false
;
ui
->
calibrationExplanationLabel
->
setText
(
tr
(
"Please hold the system very still in the shown orientations. Start with the one shown."
));
}
void
QGCPX4SensorCalibration
::
contextMenuEvent
(
QContextMenuEvent
*
event
)
...
...
src/ui/px4_configuration/QGCPX4SensorCalibration.h
View file @
1aa7b9b9
...
...
@@ -32,6 +32,10 @@ public slots:
*/
void
handleTextMessage
(
int
uasid
,
int
componentid
,
int
severity
,
QString
text
);
void
gyroButtonClicked
();
void
magButtonClicked
();
void
accelButtonClicked
();
/**
* @brief Hand context menu event
* @param event
...
...
@@ -44,6 +48,11 @@ protected:
UASInterface
*
activeUAS
;
QAction
*
clearAction
;
QPixmap
instructionIcon
;
bool
accelStarted
;
bool
accelDone
[
6
];
bool
gyroStarted
;
bool
magStarted
;
QStringList
accelAxes
;
virtual
void
resizeEvent
(
QResizeEvent
*
event
);
...
...
src/ui/px4_configuration/QGCPX4SensorCalibration.ui
View file @
1aa7b9b9
...
...
@@ -36,35 +36,28 @@ QPushButton#gyroButton, QPushButton#accelButton {
border: 2px solid #465158;
}
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
rowstretch=
"1,20,3,2,1,1"
columnstretch=
"30,15,5"
>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"titleLabel"
>
<property
name=
"text"
>
<string>
Magnetometer Calibration
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
rowspan=
"2"
colspan=
"2"
>
<widget
class=
"QPlainTextEdit"
name=
"textView"
/>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"iconLabel"
>
<property
name=
"text"
>
<string/>
<layout
class=
"QGridLayout"
name=
"gridLayout"
rowstretch=
"1,20,3,2,1,1,0"
columnstretch=
"30,15,5"
>
<item
row=
"6"
column=
"2"
>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"scaledContents"
>
<bool>
true
</bool>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</
widget
>
</
spacer
>
</item>
<item
row=
"
2"
column=
"0"
colspan=
"2
"
>
<widget
class=
"QLabel"
name=
"
instruction
Label"
>
<item
row=
"
0"
column=
"0
"
>
<widget
class=
"QLabel"
name=
"
title
Label"
>
<property
name=
"text"
>
<string>
To calibrate the system, execute the three calibration steps below.
</string>
<string>
Magnetometer Calibration
</string>
</property>
</widget>
</item>
<item
row=
"
3
"
column=
"0"
colspan=
"3"
>
<item
row=
"
4
"
column=
"0"
colspan=
"3"
>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
...
...
@@ -77,14 +70,24 @@ QPushButton#gyroButton, QPushButton#accelButton {
</property>
</spacer>
</item>
<item
row=
"4"
column=
"0"
colspan=
"3"
>
<item
row=
"3"
column=
"0"
colspan=
"2"
>
<widget
class=
"QLabel"
name=
"instructionLabel"
>
<property
name=
"text"
>
<string/>
</property>
</widget>
</item>
<item
row=
"5"
column=
"0"
colspan=
"3"
>
<widget
class=
"QProgressBar"
name=
"progressBar"
>
<property
name=
"value"
>
<number>
24
</number>
</property>
</widget>
</item>
<item
row=
"5"
column=
"0"
colspan=
"2"
>
<item
row=
"0"
column=
"1"
rowspan=
"2"
colspan=
"2"
>
<widget
class=
"QPlainTextEdit"
name=
"textView"
/>
</item>
<item
row=
"6"
column=
"0"
colspan=
"2"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<item>
<widget
class=
"QPushButton"
name=
"magButton"
>
...
...
@@ -121,18 +124,22 @@ QPushButton#gyroButton, QPushButton#accelButton {
</item>
</layout>
</item>
<item
row=
"
5"
column=
"2
"
>
<
spacer
name=
"horizontalSpacer
"
>
<property
name=
"
orientation
"
>
<
enum>
Qt::Horizontal
</enum
>
<item
row=
"
1"
column=
"0
"
>
<
widget
class=
"QLabel"
name=
"iconLabel
"
>
<property
name=
"
text
"
>
<
string/
>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
<property
name=
"scaledContents"
>
<bool>
true
</bool>
</property>
</spacer>
</widget>
</item>
<item
row=
"2"
column=
"0"
colspan=
"3"
>
<widget
class=
"QLabel"
name=
"calibrationExplanationLabel"
>
<property
name=
"text"
>
<string>
To calibrate the system, execute the three calibration steps below.
</string>
</property>
</widget>
</item>
</layout>
</widget>
...
...
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