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
50e87f74
Commit
50e87f74
authored
Feb 23, 2016
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2864 from DonLakeFlyer/Sensors
Usability plus bug fixes
parents
50a26196
9931529c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
77 additions
and
59 deletions
+77
-59
APMSensorsComponent.cc
src/AutoPilotPlugins/APM/APMSensorsComponent.cc
+10
-35
APMSensorsComponent.qml
src/AutoPilotPlugins/APM/APMSensorsComponent.qml
+13
-12
APMSensorsComponentController.cc
src/AutoPilotPlugins/APM/APMSensorsComponentController.cc
+0
-5
APMSensorsComponentController.h
src/AutoPilotPlugins/APM/APMSensorsComponentController.h
+0
-1
APMSensorsComponentSummary.qml
src/AutoPilotPlugins/APM/APMSensorsComponentSummary.qml
+38
-4
SensorsComponent.qml
src/AutoPilotPlugins/PX4/SensorsComponent.qml
+1
-1
SensorsComponentSummary.qml
src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml
+15
-1
No files found.
src/AutoPilotPlugins/APM/APMSensorsComponent.cc
View file @
50e87f74
...
...
@@ -72,16 +72,7 @@ QStringList APMSensorsComponent::setupCompleteChangedTriggerList(void) const
<<
"COMPASS_OFS3_X"
<<
"COMPASS_OFS3_X"
<<
"COMPASS_OFS3_X"
;
// Accelerometer triggers
if
(
_autopilot
->
parameterExists
(
FactSystem
::
defaultComponentId
,
"INS_USE"
))
{
triggers
<<
"INS_USE"
<<
"INS_USE2"
<<
"INS_USE3"
<<
"INS_ACCOFFS_X"
<<
"INS_ACCOFFS_Y"
<<
"INS_ACCOFFS_Z"
<<
"INS_ACC2OFFS_X"
<<
"INS_ACC2OFFS_Y"
<<
"INS_ACC2OFFS_Z"
<<
"INS_ACC3OFFS_X"
<<
"INS_ACC3OFFS_Y"
<<
"INS_ACC3OFFS_Z"
;
}
else
{
// For older firmwares which don't support the INS_USE parameter we can't determine which secondary accels are in use.
// So we just base things off the the first accel.
triggers
<<
"INS_ACCOFFS_X"
<<
"INS_ACCOFFS_Y"
<<
"INS_ACCOFFS_Z"
;
}
triggers
<<
"INS_ACCOFFS_X"
<<
"INS_ACCOFFS_Y"
<<
"INS_ACCOFFS_Z"
;
return
triggers
;
}
...
...
@@ -116,9 +107,9 @@ bool APMSensorsComponent::compassSetupNeeded(void) const
QStringList
rgOffsets
[
cCompass
];
devicesIds
<<
QStringLiteral
(
"COMPASS_DEV_ID"
)
<<
QStringLiteral
(
"COMPASS_DEV_ID2"
)
<<
QStringLiteral
(
"COMPASS_DEV_ID3"
);
rgOffsets
[
0
]
<<
QStringLiteral
(
"COMPASS_OFS_X"
)
<<
QStringLiteral
(
"COMPASS_OFS_
X"
)
<<
QStringLiteral
(
"COMPASS_OFS_X
"
);
rgOffsets
[
1
]
<<
QStringLiteral
(
"COMPASS_OFS2_X"
)
<<
QStringLiteral
(
"COMPASS_OFS2_
X"
)
<<
QStringLiteral
(
"COMPASS_OFS2_X
"
);
rgOffsets
[
2
]
<<
QStringLiteral
(
"COMPASS_OFS3_X"
)
<<
QStringLiteral
(
"COMPASS_OFS3_
X"
)
<<
QStringLiteral
(
"COMPASS_OFS3_X
"
);
rgOffsets
[
0
]
<<
QStringLiteral
(
"COMPASS_OFS_X"
)
<<
QStringLiteral
(
"COMPASS_OFS_
Y"
)
<<
QStringLiteral
(
"COMPASS_OFS_Z
"
);
rgOffsets
[
1
]
<<
QStringLiteral
(
"COMPASS_OFS2_X"
)
<<
QStringLiteral
(
"COMPASS_OFS2_
Y"
)
<<
QStringLiteral
(
"COMPASS_OFS2_Z
"
);
rgOffsets
[
2
]
<<
QStringLiteral
(
"COMPASS_OFS3_X"
)
<<
QStringLiteral
(
"COMPASS_OFS3_
Y"
)
<<
QStringLiteral
(
"COMPASS_OFS3_Z
"
);
for
(
size_t
i
=
0
;
i
<
cCompass
;
i
++
)
{
if
(
_autopilot
->
getParameterFact
(
FactSystem
::
defaultComponentId
,
devicesIds
[
i
])
->
rawValue
().
toInt
()
!=
0
)
{
...
...
@@ -135,29 +126,13 @@ bool APMSensorsComponent::compassSetupNeeded(void) const
bool
APMSensorsComponent
::
accelSetupNeeded
(
void
)
const
{
const
size_t
cAccel
=
3
;
const
size_t
cOffset
=
3
;
QStringList
insUse
;
QStringList
rgOffsets
[
cAccel
];
if
(
_autopilot
->
parameterExists
(
FactSystem
::
defaultComponentId
,
"INS_USE"
))
{
insUse
<<
QStringLiteral
(
"INS_USE"
)
<<
QStringLiteral
(
"INS_USE2"
)
<<
QStringLiteral
(
"INS_USE3"
);
rgOffsets
[
0
]
<<
QStringLiteral
(
"INS_ACCOFFS_X"
)
<<
QStringLiteral
(
"INS_ACCOFFS_Y"
)
<<
QStringLiteral
(
"INS_ACCOFFS_Z"
);
rgOffsets
[
1
]
<<
QStringLiteral
(
"INS_ACC2OFFS_X"
)
<<
QStringLiteral
(
"INS_ACC2OFFS_Y"
)
<<
QStringLiteral
(
"INS_ACC2OFFS_Z"
);
rgOffsets
[
2
]
<<
QStringLiteral
(
"INS_ACC3OFFS_X"
)
<<
QStringLiteral
(
"INS_ACC3OFFS_Y"
)
<<
QStringLiteral
(
"INS_ACC3OFFS_Z"
);
}
else
{
// For older firmwares which don't support the INS_USE parameter we can't determine which secondary accels are in use.
// So we just base things off the the first accel.
rgOffsets
[
0
]
<<
QStringLiteral
(
"INS_ACCOFFS_X"
)
<<
QStringLiteral
(
"INS_ACCOFFS_Y"
)
<<
QStringLiteral
(
"INS_ACCOFFS_Z"
);
}
QStringList
offsets
;
for
(
size_t
i
=
0
;
i
<
cAccel
;
i
++
)
{
if
(
insUse
.
count
()
==
0
||
_autopilot
->
getParameterFact
(
FactSystem
::
defaultComponentId
,
insUse
[
i
])
->
rawValue
().
toInt
()
!=
0
)
{
for
(
size_t
j
=
0
;
j
<
cOffset
;
j
++
)
{
if
(
rgOffsets
[
i
].
count
()
&&
_autopilot
->
getParameterFact
(
FactSystem
::
defaultComponentId
,
rgOffsets
[
i
][
j
])
->
rawValue
().
toFloat
()
==
0.0
f
)
{
return
true
;
}
}
offsets
<<
QStringLiteral
(
"INS_ACCOFFS_X"
)
<<
QStringLiteral
(
"INS_ACCOFFS_Y"
)
<<
QStringLiteral
(
"INS_ACCOFFS_Z"
);
foreach
(
const
QString
&
offset
,
offsets
)
{
if
(
_autopilot
->
getParameterFact
(
FactSystem
::
defaultComponentId
,
offset
)
->
rawValue
().
toFloat
()
==
0.0
f
)
{
return
true
;
}
}
...
...
src/AutoPilotPlugins/APM/APMSensorsComponent.qml
View file @
50e87f74
...
...
@@ -369,6 +369,19 @@ QGCView {
QGCLabel
{
text
:
"
Calibrate:
"
;
anchors.baseline
:
compassButton
.
baseline
}
IndicatorButton
{
id
:
accelButton
width
:
parent
.
buttonWidth
text
:
"
Accelerometer
"
indicatorGreen
:
!
accelCalNeeded
onClicked
:
{
preCalibrationDialogType
=
"
accel
"
preCalibrationDialogHelp
=
accelHelp
showDialog
(
preCalibrationDialogComponent
,
"
Calibrate Accelerometer
"
,
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Cancel
|
StandardButton
.
Ok
)
}
}
IndicatorButton
{
id
:
compassButton
width
:
parent
.
buttonWidth
...
...
@@ -388,18 +401,6 @@ QGCView {
}
}
IndicatorButton
{
id
:
accelButton
width
:
parent
.
buttonWidth
text
:
"
Accelerometer
"
indicatorGreen
:
!
accelCalNeeded
onClicked
:
{
preCalibrationDialogType
=
"
accel
"
preCalibrationDialogHelp
=
accelHelp
showDialog
(
preCalibrationDialogComponent
,
"
Calibrate Accelerometer
"
,
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Cancel
|
StandardButton
.
Ok
)
}
}
QGCButton
{
id
:
nextButton
showBorder
:
true
...
...
src/AutoPilotPlugins/APM/APMSensorsComponentController.cc
View file @
50e87f74
...
...
@@ -77,11 +77,6 @@ APMSensorsComponentController::APMSensorsComponentController(void) :
connect
(
_sensorsComponent
,
&
VehicleComponent
::
setupCompleteChanged
,
this
,
&
APMSensorsComponentController
::
setupNeededChanged
);
}
APMSensorsComponentController
::~
APMSensorsComponentController
()
{
_vehicle
->
setConnectionLostEnabled
(
true
);
}
/// Appends the specified text to the status log area in the ui
void
APMSensorsComponentController
::
_appendStatusLog
(
const
QString
&
text
)
{
...
...
src/AutoPilotPlugins/APM/APMSensorsComponentController.h
View file @
50e87f74
...
...
@@ -41,7 +41,6 @@ class APMSensorsComponentController : public FactPanelController
public:
APMSensorsComponentController
(
void
);
~
APMSensorsComponentController
();
Q_PROPERTY
(
bool
fixedWing
READ
fixedWing
CONSTANT
)
...
...
src/AutoPilotPlugins/APM/APMSensorsComponentSummary.qml
View file @
50e87f74
...
...
@@ -20,7 +20,28 @@ FactPanel {
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
enabled
}
APMSensorsComponentController
{
id
:
controller
;
factPanel
:
panel
}
property
bool
accelCalNeeded
:
controller
.
accelSetupNeeded
property
Fact
compass1IdFact
:
controller
.
getParameterFact
(
-
1
,
"
COMPASS_DEV_ID
"
)
property
Fact
compass2IdFact
:
controller
.
getParameterFact
(
-
1
,
"
COMPASS_DEV_ID2
"
)
property
Fact
compass3IdFact
:
controller
.
getParameterFact
(
-
1
,
"
COMPASS_DEV_ID3
"
)
property
Fact
compass1OfsXFact
:
controller
.
getParameterFact
(
-
1
,
"
COMPASS_OFS_X
"
)
property
Fact
compass1OfsYFact
:
controller
.
getParameterFact
(
-
1
,
"
COMPASS_OFS_Y
"
)
property
Fact
compass1OfsZFact
:
controller
.
getParameterFact
(
-
1
,
"
COMPASS_OFS_Z
"
)
property
Fact
compass2OfsXFact
:
controller
.
getParameterFact
(
-
1
,
"
COMPASS_OFS2_X
"
)
property
Fact
compass2OfsYFact
:
controller
.
getParameterFact
(
-
1
,
"
COMPASS_OFS2_Y
"
)
property
Fact
compass2OfsZFact
:
controller
.
getParameterFact
(
-
1
,
"
COMPASS_OFS2_Z
"
)
property
Fact
compass3OfsXFact
:
controller
.
getParameterFact
(
-
1
,
"
COMPASS_OFS3_X
"
)
property
Fact
compass3OfsYFact
:
controller
.
getParameterFact
(
-
1
,
"
COMPASS_OFS3_Y
"
)
property
Fact
compass3OfsZFact
:
controller
.
getParameterFact
(
-
1
,
"
COMPASS_OFS3_Z
"
)
property
bool
compass1Available
:
compass1IdFact
.
value
!==
0
property
bool
compass2Available
:
compass2IdFact
.
value
!==
0
property
bool
compass3Available
:
compass3IdFact
.
value
!==
0
property
bool
compass1Calibrated
:
compass1Available
?
compass1OfsXFact
.
value
!=
0.0
&&
compass1OfsYFact
.
value
!=
0.0
&&
compass1OfsZFact
.
value
!=
0.0
:
false
property
bool
compass2Calibrated
:
compass2Available
?
compass2OfsXFact
.
value
!=
0.0
&&
compass2OfsYFact
.
value
!=
0.0
&&
compass2OfsZFact
.
value
!=
0.0
:
false
property
bool
compass3Calibrated
:
compass3Available
?
compass3OfsXFact
.
value
!=
0.0
&&
compass3OfsYFact
.
value
!=
0.0
&&
compass3OfsZFact
.
value
!=
0.0
:
false
property
bool
compassCalNeeded
:
controller
.
compassSetupNeeded
Column
{
...
...
@@ -28,13 +49,26 @@ FactPanel {
anchors.margins
:
8
VehicleSummaryRow
{
labelText
:
"
Compass:
"
valueText
:
compassCalNeeded
?
"
Setup required
"
:
"
Ready
"
labelText
:
"
Compass 1:
"
visible
:
compass1Available
valueText
:
compass1Calibrated
?
"
Ready
"
:
"
Setup required
"
}
VehicleSummaryRow
{
labelText
:
"
Compass 2:
"
visible
:
compass2Available
valueText
:
compass2Calibrated
?
"
Ready
"
:
"
Setup required
"
}
VehicleSummaryRow
{
labelText
:
"
Compass 3:
"
visible
:
compass3Available
valueText
:
compass3Calibrated
?
"
Ready
"
:
"
Setup required
"
}
VehicleSummaryRow
{
labelText
:
"
Accelerometer:
"
valueText
:
accelCal
Needed
?
"
Setup required
"
:
"
Ready
"
valueText
:
controller
.
accelSetup
Needed
?
"
Setup required
"
:
"
Ready
"
}
}
}
src/AutoPilotPlugins/PX4/SensorsComponent.qml
View file @
50e87f74
...
...
@@ -130,7 +130,7 @@ QGCView {
onSetCompassRotations
:
{
if
(
showCompass0Rot
||
showCompass1Rot
||
showCompass2Rot
)
{
showDialog
(
compassRotationDialogComponent
,
"
Set Compass Rotation(s)
"
,
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Ok
)
showDialog
(
compassRotationDialogComponent
,
"
Set Compass Rotation(s)
"
,
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Ok
)
}
}
...
...
src/AutoPilotPlugins/PX4/SensorsComponentSummary.qml
View file @
50e87f74
...
...
@@ -20,6 +20,8 @@ FactPanel {
FactPanelController
{
id
:
controller
;
factPanel
:
panel
}
property
Fact
mag0IdFact
:
controller
.
getParameterFact
(
-
1
,
"
CAL_MAG0_ID
"
)
property
Fact
mag1IdFact
:
controller
.
getParameterFact
(
-
1
,
"
CAL_MAG1_ID
"
)
property
Fact
mag2IdFact
:
controller
.
getParameterFact
(
-
1
,
"
CAL_MAG2_ID
"
)
property
Fact
gyro0IdFact
:
controller
.
getParameterFact
(
-
1
,
"
CAL_GYRO0_ID
"
)
property
Fact
accel0IdFact
:
controller
.
getParameterFact
(
-
1
,
"
CAL_ACC0_ID
"
)
...
...
@@ -28,10 +30,22 @@ FactPanel {
anchors.margins
:
8
VehicleSummaryRow
{
labelText
:
"
Compass:
"
labelText
:
"
Compass
0
:
"
valueText
:
mag0IdFact
?
(
mag0IdFact
.
value
===
0
?
"
Setup required
"
:
"
Ready
"
)
:
""
}
VehicleSummaryRow
{
labelText
:
"
Compass 1:
"
visible
:
mag1IdFact
.
value
!==
0
valueText
:
"
Ready
"
}
VehicleSummaryRow
{
labelText
:
"
Compass 2:
"
visible
:
mag2IdFact
.
value
!==
0
valueText
:
"
Ready
"
}
VehicleSummaryRow
{
labelText
:
"
Gyro:
"
valueText
:
gyro0IdFact
?
(
gyro0IdFact
.
value
===
0
?
"
Setup required
"
:
"
Ready
"
)
:
""
...
...
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