Main Page
Namespaces
Namespace List
Namespace Members
All
Functions
Variables
Typedefs
Classes
Class List
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
~
Functions
a
b
c
d
e
f
g
i
n
o
p
r
s
v
w
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
w
Enumerations
Enumerator
Files
File List
File Members
All
Functions
src
parsers
gphdt.cpp
Go to the documentation of this file.
1
#include <
novatel_gps_driver/parsers/gphdt.h
>
2
#include <boost/make_shared.hpp>
3
#include <
swri_string_util/string_util.h
>
4
5
const
std::string
novatel_gps_driver::GphdtParser::MESSAGE_NAME
=
"GPHDT"
;
6
7
uint32_t
novatel_gps_driver::GphdtParser::GetMessageId
()
const
8
{
9
return
0;
10
}
11
12
const
std::string
novatel_gps_driver::GphdtParser::GetMessageName
()
const
13
{
14
return
MESSAGE_NAME;
15
}
16
17
novatel_gps_msgs::GphdtPtr
novatel_gps_driver::GphdtParser::ParseAscii
(
const
novatel_gps_driver::NmeaSentence
& sentence) noexcept(
false
)
18
{
19
const
size_t
EXPECTED_LEN = 3;
20
21
if
(sentence.body.size() != EXPECTED_LEN)
22
{
23
std::stringstream error;
24
error <<
"Expected GPHDT length = "
25
<< EXPECTED_LEN <<
", "
26
<<
"actual length = "
<< sentence.body.size();
27
throw
ParseException
(error.str());
28
}
29
30
novatel_gps_msgs::GphdtPtr
msg
= boost::make_shared<novatel_gps_msgs::Gphdt>();
31
msg
->message_id = sentence.body[0];
32
33
double
heading;
34
if
(
swri_string_util::ToDouble
(sentence.body[1], heading))
35
{
36
msg
->heading = heading;
37
}
38
else
39
{
40
throw
ParseException
(
"Error parsing heading as double in GPHDT"
);
41
}
42
43
msg
->t = sentence.body[2];
44
return
msg
;
45
}
46
msg
msg
novatel_gps_driver::ParseException
Definition:
parse_exception.h:40
string_util.h
novatel_gps_driver::GphdtParser::MESSAGE_NAME
static const std::string MESSAGE_NAME
Definition:
gphdt.h:18
swri_string_util::ToDouble
bool ToDouble(const std::string &string, double &value)
novatel_gps_driver::GphdtParser::GetMessageId
uint32_t GetMessageId() const override
Definition:
gphdt.cpp:7
novatel_gps_driver::GphdtParser::GetMessageName
const std::string GetMessageName() const override
Definition:
gphdt.cpp:12
novatel_gps_driver::NmeaSentence
Definition:
nmea_sentence.h:41
novatel_gps_driver::GphdtParser::ParseAscii
novatel_gps_msgs::GphdtPtr ParseAscii(const NmeaSentence &sentence) noexcept(false) override
Converts sentence into a ROS message pointer and returns it.
Definition:
gphdt.cpp:17
gphdt.h
novatel_gps_driver
Author(s):
autogenerated on Sun Oct 1 2023 02:58:57