Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
be1417f6
Commit
be1417f6
authored
8 years ago
by
James Goppert
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
LPE alt init now allows baro only init without GPS w/o changing flag. (#5398)
Flight test went well, merging.
parent
44990067
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/modules/local_position_estimator/sensors/baro.cpp
+1
-2
1 addition, 2 deletions
src/modules/local_position_estimator/sensors/baro.cpp
src/modules/local_position_estimator/sensors/gps.cpp
+31
-15
31 additions, 15 deletions
src/modules/local_position_estimator/sensors/gps.cpp
with
32 additions
and
17 deletions
src/modules/local_position_estimator/sensors/baro.cpp
+
1
−
2
View file @
be1417f6
...
...
@@ -29,8 +29,7 @@ void BlockLocalPositionEstimator::baroInit()
_baroInitialized
=
true
;
_baroFault
=
FAULT_NONE
;
// only initialize alt origin with baro and no gps
if
(
!
_altOriginInitialized
&&
!
_gps_on
.
get
())
{
if
(
!
_altOriginInitialized
)
{
_altOriginInitialized
=
true
;
_altOrigin
=
_baroAltOrigin
;
}
...
...
This diff is collapsed.
Click to expand it.
src/modules/local_position_estimator/sensors/gps.cpp
+
31
−
15
View file @
be1417f6
...
...
@@ -37,27 +37,43 @@ void BlockLocalPositionEstimator::gpsInit()
// if finished
if
(
_gpsStats
.
getCount
()
>
REQ_GPS_INIT_COUNT
)
{
double
gpsLatOrigin
=
_gpsStats
.
getMean
()(
0
);
double
gpsLonOrigin
=
_gpsStats
.
getMean
()(
1
);
// get mean gps values
double
gpsLat
=
_gpsStats
.
getMean
()(
0
);
double
gpsLon
=
_gpsStats
.
getMean
()(
1
);
float
gpsAlt
=
_gpsStats
.
getMean
()(
2
);
if
(
!
_receivedGps
)
{
_receivedGps
=
true
;
map_projection_init
(
&
_map_ref
,
gpsLatOrigin
,
gpsLonOrigin
);
}
_gpsAltOrigin
=
_gpsStats
.
getMean
()(
2
);
PX4_INFO
(
"[lpe] gps init "
"lat %6.2f lon %6.2f alt %5.1f m"
,
gpsLatOrigin
,
gpsLonOrigin
,
double
(
_gpsAltOrigin
));
_gpsInitialized
=
true
;
_gpsFault
=
FAULT_NONE
;
_gpsStats
.
reset
();
if
(
!
_altOriginInitialized
)
{
_altOriginInitialized
=
true
;
if
(
!
_receivedGps
)
{
// this is the first time we have received gps
_receivedGps
=
true
;
// note we subtract X_z which is in down directon so it is
// an addition
_gpsAltOrigin
=
gpsAlt
+
_x
(
X_z
);
// find lat, lon of current origin by subtracting x and y
double
gpsLatOrigin
=
0
;
double
gpsLonOrigin
=
0
;
// reproject at current coordinates
map_projection_init
(
&
_map_ref
,
gpsLat
,
gpsLon
);
// find origin
map_projection_reproject
(
&
_map_ref
,
-
_x
(
X_x
),
-
_x
(
X_y
),
&
gpsLatOrigin
,
&
gpsLonOrigin
);
// reinit origin
map_projection_init
(
&
_map_ref
,
gpsLatOrigin
,
gpsLonOrigin
);
// always override alt origin on first GPS to fix
// possible baro offset in global altitude at init
_altOrigin
=
_gpsAltOrigin
;
_altOriginInitialized
=
true
;
PX4_INFO
(
"[lpe] gps init "
"lat %6.2f lon %6.2f alt %5.1f m"
,
gpsLatOrigin
,
gpsLonOrigin
,
double
(
_gpsAltOrigin
));
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment