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
64672e34
Commit
64672e34
authored
Feb 10, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Request all sensor parameters before/after cal
Include support for both param sets
parent
96e5674d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
53 deletions
+36
-53
QGCPX4SensorCalibration.cc
src/ui/px4_configuration/QGCPX4SensorCalibration.cc
+34
-53
QGCPX4SensorCalibration.h
src/ui/px4_configuration/QGCPX4SensorCalibration.h
+2
-0
No files found.
src/ui/px4_configuration/QGCPX4SensorCalibration.cc
View file @
64672e34
...
...
@@ -351,28 +351,9 @@ void QGCPX4SensorCalibration::setActiveUAS(UASInterface* uas)
updateSystemSpecs
(
uas
->
getUASID
());
// If the parameters are ready, we aren't going to get paramterChanged signals. So
fake
them in order to make the UI work.
// If the parameters are ready, we aren't going to get paramterChanged signals. So
re-request
them in order to make the UI work.
if
(
uas
->
getParamManager
()
->
parametersReady
())
{
QVariant
value
;
static
const
char
*
rgParamsV1
[]
=
{
"SENS_BOARD_ROT"
,
"SENS_EXT_MAG_ROT"
,
"SENS_MAG_XOFF"
,
"SENS_GYRO_XOFF"
,
"SENS_ACC_XOFF"
,
"SENS_DPRES_OFF"
};
static
const
char
*
rgParamsV2
[]
=
{
"SENS_BOARD_ROT"
,
"SENS_EXT_MAG_ROT"
,
"CAL_MAG0_XOFF"
,
"CAL_GYRO0_XOFF"
,
"CAL_ACC0_XOFF"
,
"SENS_DPRES_OFF"
};
QGCUASParamManagerInterface
*
paramMgr
=
uas
->
getParamManager
();
// Temp hack for parameter mapping
bool
paramsV1
=
paramMgr
->
getComponentForParam
(
"SENS_MAG_XOFF"
).
count
();
static
const
char
**
prgParamList
=
paramsV1
?
rgParamsV1
:
rgParamsV2
;
for
(
size_t
i
=
0
;
i
<
sizeof
(
rgParamsV1
)
/
sizeof
(
rgParamsV1
[
0
]);
i
++
)
{
QVariant
value
;
QList
<
int
>
compIds
=
paramMgr
->
getComponentForParam
(
prgParamList
[
i
]);
Q_ASSERT
(
compIds
.
count
()
==
1
);
bool
found
=
paramMgr
->
getParameterValue
(
compIds
[
0
],
prgParamList
[
i
],
value
);
Q_ASSERT
(
found
);
Q_UNUSED
(
found
);
parameterChanged
(
uas
->
getUASID
(),
compIds
[
0
],
prgParamList
[
i
],
value
);
}
_requestAllSensorParameters
();
}
}
...
...
@@ -436,38 +417,7 @@ void QGCPX4SensorCalibration::handleTextMessage(int uasid, int compId, int sever
}
if
(
activeUAS
)
{
if
(
text
.
startsWith
(
"accel "
))
{
activeUAS
->
requestParameter
(
0
,
"SENS_ACC_XOFF"
);
activeUAS
->
requestParameter
(
0
,
"SENS_ACC_YOFF"
);
activeUAS
->
requestParameter
(
0
,
"SENS_ACC_ZOFF"
);
activeUAS
->
requestParameter
(
0
,
"SENS_ACC_XSCALE"
);
activeUAS
->
requestParameter
(
0
,
"SENS_ACC_YSCALE"
);
activeUAS
->
requestParameter
(
0
,
"SENS_ACC_ZSCALE"
);
activeUAS
->
requestParameter
(
0
,
"SENS_BOARD_ROT"
);
}
if
(
text
.
startsWith
(
"gyro "
))
{
activeUAS
->
requestParameter
(
0
,
"SENS_GYRO_XOFF"
);
activeUAS
->
requestParameter
(
0
,
"SENS_GYRO_YOFF"
);
activeUAS
->
requestParameter
(
0
,
"SENS_GYRO_ZOFF"
);
activeUAS
->
requestParameter
(
0
,
"SENS_GYRO_XSCALE"
);
activeUAS
->
requestParameter
(
0
,
"SENS_GYRO_YSCALE"
);
activeUAS
->
requestParameter
(
0
,
"SENS_GYRO_ZSCALE"
);
activeUAS
->
requestParameter
(
0
,
"SENS_BOARD_ROT"
);
}
if
(
text
.
startsWith
(
"mag "
))
{
activeUAS
->
requestParameter
(
0
,
"SENS_MAG_XOFF"
);
activeUAS
->
requestParameter
(
0
,
"SENS_MAG_YOFF"
);
activeUAS
->
requestParameter
(
0
,
"SENS_MAG_ZOFF"
);
activeUAS
->
requestParameter
(
0
,
"SENS_MAG_XSCALE"
);
activeUAS
->
requestParameter
(
0
,
"SENS_MAG_YSCALE"
);
activeUAS
->
requestParameter
(
0
,
"SENS_MAG_ZSCALE"
);
activeUAS
->
requestParameter
(
0
,
"SENS_EXT_MAG_ROT"
);
}
if
(
text
.
startsWith
(
"dpress "
))
{
activeUAS
->
requestParameter
(
0
,
"SENS_DPRES_OFF"
);
activeUAS
->
requestParameter
(
0
,
"SENS_DPRES_ANA"
);
}
_requestAllSensorParameters
();
}
}
...
...
@@ -524,3 +474,34 @@ void QGCPX4SensorCalibration::contextMenuEvent(QContextMenuEvent* event)
menu
.
addAction
(
clearAction
);
menu
.
exec
(
event
->
globalPos
());
}
void
QGCPX4SensorCalibration
::
_requestAllSensorParameters
(
void
)
{
static
const
char
*
rgSensorsCalParamsV1
[]
=
{
"SENS_ACC_XOFF"
,
"SENS_ACC_YOFF"
,
"SENS_ACC_ZOFF"
,
"SENS_ACC_XSCALE"
,
"SENS_ACC_YSCALE"
,
"SENS_ACC_ZSCALE"
,
"SENS_GYRO_XOFF"
,
"SENS_GYRO_YOFF"
,
"SENS_GYRO_ZOFF"
,
"SENS_GYRO_XSCALE"
,
"SENS_GYRO_YSCALE"
,
"SENS_GYRO_ZSCALE"
,
"SENS_MAG_XOFF"
,
"SENS_MAG_YOFF"
,
"SENS_MAG_ZOFF"
,
"SENS_MAG_XSCALE"
,
"SENS_MAG_YSCALE"
,
"SENS_MAG_ZSCALE"
,
"SENS_EXT_MAG_ROT"
,
"SENS_DPRES_OFF"
,
"SENS_DPRES_ANA"
,
"SENS_BOARD_ROT"
,
NULL
};
static
const
char
*
rgSensorsCalParamsV2
[]
=
{
"CAL_ACC0_ID"
,
"CAL_ACC0_XOFF"
,
"CAL_ACC0_YOFF"
,
"CAL_ACC0_ZOFF"
,
"CAL_ACC0_XSCALE"
,
"CAL_ACC0_YSCALE"
,
"CAL_ACC0_ZSCALE"
,
"CAL_GYRO0_ID"
,
"CAL_GYRO0_XOFF"
,
"CAL_GYRO0_YOFF"
,
"CAL_GYRO0_ZOFF"
,
"CAL_GYRO0_XSCALE"
,
"CAL_GYRO0_YSCALE"
,
"CAL_GYRO0_ZSCALE"
,
"CAL_MAG0_ID"
,
"CAL_MAG0_XOFF"
,
"CAL_MAG0_YOFF"
,
"CAL_MAG0_ZOFF"
,
"CAL_MAG0_XSCALE"
,
"CAL_MAG0_YSCALE"
,
"CAL_MAG0_ZSCALE"
,
"SENS_EXT_MAG_ROT"
,
"SENS_DPRES_OFF"
,
"SENS_DPRES_ANA"
,
"SENS_BOARD_ROT"
,
NULL
};
Q_ASSERT
(
activeUAS
);
QGCUASParamManagerInterface
*
paramMgr
=
activeUAS
->
getParamManager
();
// Temp hack for parameter mapping
bool
paramsV1
=
paramMgr
->
getComponentForParam
(
"SENS_MAG_XOFF"
).
count
();
static
const
char
**
prgParamList
=
paramsV1
?
rgSensorsCalParamsV1
:
rgSensorsCalParamsV2
;
for
(
size_t
i
=
0
;
prgParamList
[
i
]
!=
NULL
;
i
++
)
{
qDebug
()
<<
"Requesting"
<<
prgParamList
[
i
];
activeUAS
->
requestParameter
(
0
,
prgParamList
[
i
]);
}
}
\ No newline at end of file
src/ui/px4_configuration/QGCPX4SensorCalibration.h
View file @
64672e34
...
...
@@ -83,6 +83,8 @@ protected:
void
updateIcons
();
private:
void
_requestAllSensorParameters
(
void
);
Ui
::
QGCPX4SensorCalibration
*
ui
;
};
...
...
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