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
6dff7166
Commit
6dff7166
authored
11 years ago
by
Darryl Taylor
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into gps_fix
parents
ced28712
d878d475
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/drivers/gps/ubx.cpp
+18
-23
18 additions, 23 deletions
src/drivers/gps/ubx.cpp
with
18 additions
and
23 deletions
src/drivers/gps/ubx.cpp
+
18
−
23
View file @
6dff7166
...
...
@@ -196,7 +196,7 @@ UBX::configure(unsigned &baudrate)
// if (wait_for_ack(UBX_CONFIG_TIMEOUT) < 0)
// continue;
configure_message_rate
(
UBX_CLASS_NAV
,
UBX_MESSAGE_NAV_SVINFO
,
0
);
1
);
// /* insist of receiving the ACK for this packet */
// if (wait_for_ack(UBX_CONFIG_TIMEOUT) < 0)
// continue;
...
...
@@ -539,7 +539,7 @@ UBX::handle_message()
}
case
NAV_SVINFO
:
{
//
printf("GOT NAV_SVINFO MESSAGE\n");
//
printf("GOT NAV_SVINFO MESSAGE\n");
if
(
!
_waiting_for_ack
)
{
//this is a more complicated message: the length depends on the number of satellites. This number is extracted from the first part of the message
...
...
@@ -560,7 +560,7 @@ UBX::handle_message()
uint8_t
satellites_used
=
0
;
int
i
;
// printf("Number of Channels: %d\n", packet_part1->numCh);
for
(
i
=
0
;
i
<
packet_part1
->
numCh
;
i
++
)
{
//for each channel
/* Get satellite information from the buffer */
...
...
@@ -572,27 +572,22 @@ UBX::handle_message()
_gps_position
->
satellite_prn
[
i
]
=
packet_part2
->
svid
;
//if satellite information is healthy store the data
uint8_t
unhealthy
=
packet_part2
->
flags
&
1
<<
4
;
//flags is a bitfield
if
(
!
unhealthy
)
{
if
((
packet_part2
->
flags
)
&
1
)
{
//flags is a bitfield
_gps_position
->
satellite_used
[
i
]
=
1
;
satellites_used
++
;
}
else
{
_gps_position
->
satellite_used
[
i
]
=
0
;
}
_gps_position
->
satellite_snr
[
i
]
=
packet_part2
->
cno
;
_gps_position
->
satellite_elevation
[
i
]
=
(
uint8_t
)(
packet_part2
->
elev
);
_gps_position
->
satellite_azimuth
[
i
]
=
(
uint8_t
)((
float
)
packet_part2
->
azim
*
255.0
f
/
360.0
f
);
}
else
{
_gps_position
->
satellite_used
[
i
]
=
0
;
_gps_position
->
satellite_snr
[
i
]
=
0
;
_gps_position
->
satellite_elevation
[
i
]
=
0
;
_gps_position
->
satellite_azimuth
[
i
]
=
0
;
//DT uint8_t unhealthy = packet_part2->flags & 1 << 4; //flags is a bitfield
//DT Above is broken due to operator precedence. should be ... & (1<<4) or ... & 0x10.
//DT If an SV is unhealthy then it won't be used.
uint8_t
sv_used
=
packet_part2
->
flags
&
0x01
;
if
(
sv_used
)
{
// Update count of SVs used for NAV.
satellites_used
++
;
}
// Record info for all used channels, whether or not the SV is used for NAV,
_gps_position
->
satellite_used
[
i
]
=
sv_used
;
_gps_position
->
satellite_snr
[
i
]
=
packet_part2
->
cno
;
_gps_position
->
satellite_elevation
[
i
]
=
(
uint8_t
)(
packet_part2
->
elev
);
_gps_position
->
satellite_azimuth
[
i
]
=
(
uint8_t
)((
float
)
packet_part2
->
azim
*
255.0
f
/
360.0
f
);
}
...
...
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