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
d9f0baf4
Commit
d9f0baf4
authored
9 years ago
by
Lorenz Meier
Browse files
Options
Downloads
Patches
Plain Diff
GPS driver: Only let the driver publish reports if it really found a GPS receiver
parent
d8a54f50
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/drivers/gps/gps.cpp
+33
-15
33 additions, 15 deletions
src/drivers/gps/gps.cpp
with
33 additions
and
15 deletions
src/drivers/gps/gps.cpp
+
33
−
15
View file @
d9f0baf4
...
...
@@ -310,7 +310,7 @@ GPS::task_main()
_report_gps_pos
.
cog_rad
=
0.0
f
;
_report_gps_pos
.
vel_ned_valid
=
true
;
/
/
no time and satellite information simulated
/
*
no time and satellite information simulated
*/
if
(
!
(
_pub_blocked
))
{
...
...
@@ -351,28 +351,46 @@ GPS::task_main()
unlock
();
/* the Ashtech driver lies about successful configuration and the
* MTK driver is not well tested, so we really only trust the UBX
* driver for an advance publication
*/
if
(
_Helper
->
configure
(
_baudrate
)
==
0
)
{
unlock
();
//Publish initial report that we have access to a GPS
//Make sure to clear any stale data in case driver is reset
/* reset report */
memset
(
&
_report_gps_pos
,
0
,
sizeof
(
_report_gps_pos
));
_report_gps_pos
.
timestamp_position
=
hrt_absolute_time
();
_report_gps_pos
.
timestamp_variance
=
hrt_absolute_time
();
_report_gps_pos
.
timestamp_velocity
=
hrt_absolute_time
();
_report_gps_pos
.
timestamp_time
=
hrt_absolute_time
();
if
(
!
(
_pub_blocked
))
{
if
(
_report_gps_pos_pub
>
0
)
{
orb_publish
(
ORB_ID
(
vehicle_gps_position
),
_report_gps_pos_pub
,
&
_report_gps_pos
);
if
(
_mode
==
GPS_DRIVER_MODE_UBX
)
{
/* Publish initial report that we have access to a GPS,
* but set all critical state fields to indicate we have
* no valid position lock
*/
}
else
{
_report_gps_pos_pub
=
orb_advertise
(
ORB_ID
(
vehicle_gps_position
),
&
_report_gps_pos
);
_report_gps_pos
.
timestamp_time
=
hrt_absolute_time
();
/* reset the timestamps for data, because we have no data yet */
_report_gps_pos
.
timestamp_position
=
0
;
_report_gps_pos
.
timestamp_variance
=
0
;
_report_gps_pos
.
timestamp_velocity
=
0
;
/* set a massive variance */
_report_gps_pos
.
eph
=
10000.0
f
;
_report_gps_pos
.
epv
=
10000.0
f
;
_report_gps_pos
.
fix_type
=
0
;
if
(
!
(
_pub_blocked
))
{
if
(
_report_gps_pos_pub
>
0
)
{
orb_publish
(
ORB_ID
(
vehicle_gps_position
),
_report_gps_pos_pub
,
&
_report_gps_pos
);
}
else
{
_report_gps_pos_pub
=
orb_advertise
(
ORB_ID
(
vehicle_gps_position
),
&
_report_gps_pos
);
}
}
}
// GPS is obviously detected successfully, reset statistics
_Helper
->
reset_update_rates
();
/* GPS is obviously detected successfully, reset statistics */
_Helper
->
reset_update_rates
();
}
int
helper_ret
;
while
((
helper_ret
=
_Helper
->
receive
(
TIMEOUT_5HZ
))
>
0
&&
!
_task_should_exit
)
{
...
...
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