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
3ec536a8
Commit
3ec536a8
authored
11 years ago
by
Lorenz Meier
Browse files
Options
Downloads
Patches
Plain Diff
Improved GPS update rate calculation
parent
5886e93a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/drivers/gps/gps.cpp
+2
-2
2 additions, 2 deletions
src/drivers/gps/gps.cpp
src/drivers/gps/gps_helper.cpp
+9
-2
9 additions, 2 deletions
src/drivers/gps/gps_helper.cpp
src/drivers/gps/gps_helper.h
+4
-0
4 additions, 0 deletions
src/drivers/gps/gps_helper.h
with
15 additions
and
4 deletions
src/drivers/gps/gps.cpp
+
2
−
2
View file @
3ec536a8
...
...
@@ -288,7 +288,6 @@ GPS::task_main()
// GPS is obviously detected successfully, reset statistics
_Helper
->
reset_update_rates
();
warnx
(
"module configuration successful"
);
while
(
_Helper
->
receive
(
TIMEOUT_5HZ
)
>
0
&&
!
_task_should_exit
)
{
// lock();
...
...
@@ -306,6 +305,8 @@ GPS::task_main()
_rate
=
last_rate_count
/
((
float
)((
hrt_absolute_time
()
-
last_rate_measurement
))
/
1000000.0
f
);
last_rate_measurement
=
hrt_absolute_time
();
last_rate_count
=
0
;
_Helper
->
store_update_rates
();
_Helper
->
reset_update_rates
();
}
if
(
!
_healthy
)
{
...
...
@@ -381,7 +382,6 @@ GPS::print_info()
warnx
(
"rate velocity:
\t
%6.2f Hz"
,
(
double
)
_Helper
->
get_velocity_update_rate
());
warnx
(
"rate publication:
\t
%6.2f Hz"
,
(
double
)
_rate
);
_Helper
->
reset_update_rates
();
}
usleep
(
100000
);
...
...
This diff is collapsed.
Click to expand it.
src/drivers/gps/gps_helper.cpp
+
9
−
2
View file @
3ec536a8
...
...
@@ -46,13 +46,13 @@
float
GPS_Helper
::
get_position_update_rate
()
{
return
_rate_
count_
lat_lon
/
(((
float
)(
hrt_absolute_time
()
-
_interval_rate_start
))
/
1000000.0
f
)
;
return
_rate_lat_lon
;
}
float
GPS_Helper
::
get_velocity_update_rate
()
{
return
_rate_
count_vel
/
(((
float
)(
hrt_absolute_time
()
-
_interval_rate_start
))
/
1000000.0
f
)
;
return
_rate_
vel
;
}
float
...
...
@@ -63,6 +63,13 @@ GPS_Helper::reset_update_rates()
_interval_rate_start
=
hrt_absolute_time
();
}
float
GPS_Helper
::
store_update_rates
()
{
_rate_vel
=
_rate_count_vel
/
(((
float
)(
hrt_absolute_time
()
-
_interval_rate_start
))
/
1000000.0
f
);
_rate_lat_lon
=
_rate_count_lat_lon
/
(((
float
)(
hrt_absolute_time
()
-
_interval_rate_start
))
/
1000000.0
f
);
}
int
GPS_Helper
::
set_baudrate
(
const
int
&
fd
,
unsigned
baud
)
{
...
...
This diff is collapsed.
Click to expand it.
src/drivers/gps/gps_helper.h
+
4
−
0
View file @
3ec536a8
...
...
@@ -52,11 +52,15 @@ public:
float
get_position_update_rate
();
float
get_velocity_update_rate
();
float
reset_update_rates
();
float
store_update_rates
();
protected:
uint8_t
_rate_count_lat_lon
;
uint8_t
_rate_count_vel
;
float
_rate_lat_lon
;
float
_rate_vel
;
uint64_t
_interval_rate_start
;
};
...
...
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