Apollo 10.0
自动驾驶开放平台
gps_6e.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2017 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
18
20
21namespace apollo {
22namespace canbus {
23namespace lincoln {
24
25using ::apollo::drivers::canbus::Byte;
26
27const int32_t Gps6e::ID = 0x6E;
28
29void Gps6e::Parse(const std::uint8_t *bytes, int32_t length,
30 Lincoln *chassis_detail) const {
31 chassis_detail->mutable_basic()->set_year(year(bytes, length));
32 chassis_detail->mutable_basic()->set_month(month(bytes, length));
33 chassis_detail->mutable_basic()->set_day(day(bytes, length));
34 chassis_detail->mutable_basic()->set_hours(hours(bytes, length));
35 chassis_detail->mutable_basic()->set_minutes(minutes(bytes, length));
36 chassis_detail->mutable_basic()->set_seconds(seconds(bytes, length));
37 chassis_detail->mutable_basic()->set_compass_direction(
38 compass_direction(bytes, length));
39 chassis_detail->mutable_basic()->set_pdop(pdop(bytes, length));
40 chassis_detail->mutable_basic()->set_is_gps_fault(
41 is_gps_fault(bytes, length));
42 chassis_detail->mutable_basic()->set_is_inferred(
43 is_inferred_position(bytes, length));
44}
45
46int32_t Gps6e::year(const std::uint8_t *bytes, int32_t length) const {
47 Byte frame(bytes + 0);
48 int32_t x = frame.get_byte(0, 7);
49 return x;
50}
51
52int32_t Gps6e::month(const std::uint8_t *bytes, int32_t length) const {
53 Byte frame(bytes + 1);
54 int32_t x = frame.get_byte(0, 4);
55 return x;
56}
57
58int32_t Gps6e::day(const std::uint8_t *bytes, int32_t length) const {
59 Byte frame(bytes + 2);
60 int32_t x = frame.get_byte(0, 5);
61 return x;
62}
63
64int32_t Gps6e::hours(const std::uint8_t *bytes, int32_t length) const {
65 Byte frame(bytes + 3);
66 int32_t x = frame.get_byte(0, 5);
67 return x;
68}
69
70int32_t Gps6e::minutes(const std::uint8_t *bytes, int32_t length) const {
71 Byte frame(bytes + 4);
72 int32_t x = frame.get_byte(0, 6);
73 return x;
74}
75
76int32_t Gps6e::seconds(const std::uint8_t *bytes, int32_t length) const {
77 Byte frame(bytes + 5);
78 int32_t x = frame.get_byte(0, 6);
79 return x;
80}
81
82double Gps6e::compass_direction(const std::uint8_t *bytes,
83 int32_t length) const {
84 Byte frame(bytes + 6);
85 int32_t x = frame.get_byte(0, 4);
86 return x * 45.000000;
87}
88
89double Gps6e::pdop(const std::uint8_t *bytes, int32_t length) const {
90 Byte frame(bytes + 7);
91 int32_t x = frame.get_byte(0, 5);
92 return x * 0.200000;
93}
94
95bool Gps6e::is_gps_fault(const std::uint8_t *bytes, int32_t length) const {
96 Byte frame(bytes + 7);
97 return frame.is_bit_1(5);
98}
99
100bool Gps6e::is_inferred_position(const std::uint8_t *bytes,
101 int32_t length) const {
102 Byte frame(bytes + 7);
103 return frame.is_bit_1(6);
104}
105
106} // namespace lincoln
107} // namespace canbus
108} // namespace apollo
Defines the Byte class.
virtual void Parse(const std::uint8_t *bytes, int32_t length, Lincoln *chassis_detail) const
Definition gps_6e.cc:29
bool is_inferred_position(const std::uint8_t *bytes, int32_t length) const
get inferred position from byte array config detail: {'name': 'inf', 'offset': 0.0,...
Definition gps_6e.cc:100
int32_t minutes(const std::uint8_t *bytes, int32_t length) const
get minutes from byte array config detail: {'name': 'minutes', 'offset': 0.0, 'precision': 1....
Definition gps_6e.cc:70
int32_t day(const std::uint8_t *bytes, int32_t length) const
get day from byte array config detail: {'name': 'day', 'offset': 0.0, 'precision': 1....
Definition gps_6e.cc:58
static const int32_t ID
Definition gps_6e.h:43
int32_t month(const std::uint8_t *bytes, int32_t length) const
get month from byte array config detail: {'name': 'month', 'offset': 0.0, 'precision': 1....
Definition gps_6e.cc:52
int32_t seconds(const std::uint8_t *bytes, int32_t length) const
get year from byte array config detail: {'name': 'seconds', 'offset': 0.0, 'precision': 1....
Definition gps_6e.cc:76
bool is_gps_fault(const std::uint8_t *bytes, int32_t length) const
check gps fault from byte array config detail: {'name': 'fltgps', 'offset': 0.0, 'precision': 1....
Definition gps_6e.cc:95
double compass_direction(const std::uint8_t *bytes, int32_t length) const
get compass direction from byte array config detail: {'name': 'compass', 'offset': 0....
Definition gps_6e.cc:82
int32_t hours(const std::uint8_t *bytes, int32_t length) const
get hours from byte array config detail: {'name': 'hours', 'offset': 0.0, 'precision': 1....
Definition gps_6e.cc:64
int32_t year(const std::uint8_t *bytes, int32_t length) const
get year from byte array config detail: {'name': 'year', 'offset': 0.0, 'precision': 1....
Definition gps_6e.cc:46
double pdop(const std::uint8_t *bytes, int32_t length) const
get pdop from byte array config detail: {'name': 'pdop', 'offset': 0.0, 'precision': 0....
Definition gps_6e.cc:89
the class of Gps6e (for lincoln vehicle)
class register implement
Definition arena_queue.h:37