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
f909055d
Commit
f909055d
authored
Jun 24, 2013
by
Michael Carpenter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working accelerometer calibation for APM3.0 and greater
parent
223a7484
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
97 additions
and
9 deletions
+97
-9
AccelCalibrationConfig.cc
src/ui/configuration/AccelCalibrationConfig.cc
+82
-0
AccelCalibrationConfig.h
src/ui/configuration/AccelCalibrationConfig.h
+8
-2
AccelCalibrationConfig.ui
src/ui/configuration/AccelCalibrationConfig.ui
+7
-7
No files found.
src/ui/configuration/AccelCalibrationConfig.cc
View file @
f909055d
...
@@ -3,9 +3,91 @@
...
@@ -3,9 +3,91 @@
AccelCalibrationConfig
::
AccelCalibrationConfig
(
QWidget
*
parent
)
:
QWidget
(
parent
)
AccelCalibrationConfig
::
AccelCalibrationConfig
(
QWidget
*
parent
)
:
QWidget
(
parent
)
{
{
m_uas
=
0
;
ui
.
setupUi
(
this
);
ui
.
setupUi
(
this
);
connect
(
ui
.
calibrateAccelButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
calibrateButtonClicked
()));
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
this
,
SLOT
(
activeUASSet
(
UASInterface
*
)));
activeUASSet
(
UASManager
::
instance
()
->
getActiveUAS
());
accelAckCount
=
0
;
}
}
AccelCalibrationConfig
::~
AccelCalibrationConfig
()
AccelCalibrationConfig
::~
AccelCalibrationConfig
()
{
{
}
}
void
AccelCalibrationConfig
::
activeUASSet
(
UASInterface
*
uas
)
{
if
(
!
uas
)
{
return
;
}
if
(
m_uas
)
{
}
m_uas
=
uas
;
connect
(
m_uas
,
SIGNAL
(
textMessageReceived
(
int
,
int
,
int
,
QString
)),
this
,
SLOT
(
uasTextMessageReceived
(
int
,
int
,
int
,
QString
)));
}
void
AccelCalibrationConfig
::
calibrateButtonClicked
()
{
if
(
accelAckCount
==
0
)
{
MAV_CMD
command
=
MAV_CMD_PREFLIGHT_CALIBRATION
;
int
confirm
=
0
;
float
param1
=
0
;
float
param2
=
0
;
float
param3
=
0
;
float
param4
=
0
;
float
param5
=
1
;
float
param6
=
0
;
float
param7
=
0
;
int
component
=
1
;
m_uas
->
executeCommand
(
command
,
confirm
,
param1
,
param2
,
param3
,
param4
,
param5
,
param6
,
param7
,
component
);
}
else
if
(
accelAckCount
<=
5
)
{
m_uas
->
executeCommandAck
(
accelAckCount
++
,
true
);
}
else
{
m_uas
->
executeCommandAck
(
accelAckCount
++
,
true
);
ui
.
calibrateAccelButton
->
setText
(
"Calibrate
\n
Accelerometer"
);
//accelAckCount = 0;
}
}
void
AccelCalibrationConfig
::
uasTextMessageReceived
(
int
uasid
,
int
componentid
,
int
severity
,
QString
text
)
{
//command received: " Severity 1
//Place APM Level and press any key" severity 5
if
(
severity
==
5
)
{
//This is a calibration instruction
if
(
accelAckCount
==
0
)
{
//Calibration Sucessful\r"
ui
.
calibrateAccelButton
->
setText
(
"Any
\n
Key"
);
accelAckCount
++
;
}
if
(
accelAckCount
==
7
)
{
//All finished
//ui.outputLabel->setText(ui.outputLabel->text() + "\n" + text);
ui
.
outputLabel
->
setText
(
text
);
accelAckCount
++
;
}
if
(
accelAckCount
==
8
)
{
if
(
text
.
contains
(
"Calibration"
)
&&
text
.
contains
(
"successful"
))
{
accelAckCount
=
0
;
}
ui
.
outputLabel
->
setText
(
ui
.
outputLabel
->
text
()
+
"
\n
"
+
text
);
}
else
{
ui
.
outputLabel
->
setText
(
text
);
}
}
}
src/ui/configuration/AccelCalibrationConfig.h
View file @
f909055d
...
@@ -3,7 +3,8 @@
...
@@ -3,7 +3,8 @@
#include <QWidget>
#include <QWidget>
#include "ui_AccelCalibrationConfig.h"
#include "ui_AccelCalibrationConfig.h"
#include "UASManager.h"
#include "UASInterface.h"
class
AccelCalibrationConfig
:
public
QWidget
class
AccelCalibrationConfig
:
public
QWidget
{
{
Q_OBJECT
Q_OBJECT
...
@@ -11,9 +12,14 @@ class AccelCalibrationConfig : public QWidget
...
@@ -11,9 +12,14 @@ class AccelCalibrationConfig : public QWidget
public:
public:
explicit
AccelCalibrationConfig
(
QWidget
*
parent
=
0
);
explicit
AccelCalibrationConfig
(
QWidget
*
parent
=
0
);
~
AccelCalibrationConfig
();
~
AccelCalibrationConfig
();
private
slots
:
void
activeUASSet
(
UASInterface
*
uas
);
void
calibrateButtonClicked
();
void
uasTextMessageReceived
(
int
uasid
,
int
componentid
,
int
severity
,
QString
text
);
private:
private:
int
accelAckCount
;
Ui
::
AccelCalibrationConfig
ui
;
Ui
::
AccelCalibrationConfig
ui
;
UASInterface
*
m_uas
;
};
};
#endif // ACCELCALIBRATIONCONFIG_H
#endif // ACCELCALIBRATIONCONFIG_H
src/ui/configuration/AccelCalibrationConfig.ui
View file @
f909055d
...
@@ -32,8 +32,8 @@
...
@@ -32,8 +32,8 @@
<widget
class=
"QPushButton"
name=
"calibrateAccelButton"
>
<widget
class=
"QPushButton"
name=
"calibrateAccelButton"
>
<property
name=
"geometry"
>
<property
name=
"geometry"
>
<rect>
<rect>
<x>
6
0
</x>
<x>
7
0
</x>
<y>
60
</y>
<y>
1
60
</y>
<width>
81
</width>
<width>
81
</width>
<height>
31
</height>
<height>
31
</height>
</rect>
</rect>
...
@@ -43,13 +43,13 @@
...
@@ -43,13 +43,13 @@
Accelerometer
</string>
Accelerometer
</string>
</property>
</property>
</widget>
</widget>
<widget
class=
"QLabel"
name=
"
label_2
"
>
<widget
class=
"QLabel"
name=
"
outputLabel
"
>
<property
name=
"geometry"
>
<property
name=
"geometry"
>
<rect>
<rect>
<x>
4
0
</x>
<x>
2
0
</x>
<y>
12
0
</y>
<y>
5
0
</y>
<width>
16
1
</width>
<width>
21
1
</width>
<height>
5
1
</height>
<height>
9
1
</height>
</rect>
</rect>
</property>
</property>
<property
name=
"text"
>
<property
name=
"text"
>
...
...
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