Apollo 10.0
自动驾驶开放平台
parking_brake_cmd_124.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 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 lexus {
24
25using ::apollo::drivers::canbus::Byte;
26
27const int32_t Parkingbrakecmd124::ID = 0x124;
28
29// public
31
33 // TODO(QiL) modify every protocol's period manually
34 static const uint32_t PERIOD = 20 * 1000;
35 return PERIOD;
36}
37
38void Parkingbrakecmd124::UpdateData(uint8_t* data) {
39 set_p_ignore_overrides(data, ignore_overrides_);
40 set_p_enable(data, enable_);
41 set_p_clear_override(data, clear_override_);
42 set_p_parking_brake_cmd(data, parking_brake_cmd_);
43 set_p_clear_faults(data, clear_faults_);
44}
45
47 // TODO(QiL) you should check this manually
48 ignore_overrides_ = false;
49 enable_ = false;
50 clear_override_ = false;
51 parking_brake_cmd_ = false;
52 clear_faults_ = false;
53}
54
56 bool ignore_overrides) {
57 ignore_overrides_ = ignore_overrides;
58 return this;
59}
60
61// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0, 'precision': 1.0,
62// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
63// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
64void Parkingbrakecmd124::set_p_ignore_overrides(uint8_t* data,
65 bool ignore_overrides) {
66 uint8_t x = ignore_overrides;
67
68 Byte to_set(data + 0);
69 to_set.set_value(static_cast<uint8_t>(x), 1, 1);
70}
71
73 enable_ = enable;
74 return this;
75}
76
77// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len': 1,
78// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
79// 'order': 'motorola', 'physical_unit': ''}
80void Parkingbrakecmd124::set_p_enable(uint8_t* data, bool enable) {
81 uint8_t x = enable;
82
83 Byte to_set(data + 0);
84 to_set.set_value(static_cast<uint8_t>(x), 0, 1);
85}
86
88 bool clear_override) {
89 clear_override_ = clear_override;
90 return this;
91}
92
93// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
94// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
95// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
96void Parkingbrakecmd124::set_p_clear_override(uint8_t* data,
97 bool clear_override) {
98 uint8_t x = clear_override;
99
100 Byte to_set(data + 0);
101 to_set.set_value(static_cast<uint8_t>(x), 2, 1);
102}
103
105 bool parking_brake_cmd) {
106 parking_brake_cmd_ = parking_brake_cmd;
107 return this;
108}
109
110// config detail: {'name': 'PARKING_BRAKE_CMD', 'offset': 0.0, 'precision': 1.0,
111// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 8,
112// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
113void Parkingbrakecmd124::set_p_parking_brake_cmd(uint8_t* data,
114 bool parking_brake_cmd) {
115 uint8_t x = parking_brake_cmd;
116
117 Byte to_set(data + 1);
118 to_set.set_value(static_cast<uint8_t>(x), 0, 1);
119}
120
122 clear_faults_ = clear_faults;
123 return this;
124}
125
126// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
127// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
128// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
129void Parkingbrakecmd124::set_p_clear_faults(uint8_t* data, bool clear_faults) {
130 uint8_t x = clear_faults;
131
132 Byte to_set(data + 0);
133 to_set.set_value(static_cast<uint8_t>(x), 3, 1);
134}
135
136} // namespace lexus
137} // namespace canbus
138} // namespace apollo
Defines the Byte class.
Parkingbrakecmd124 * set_ignore_overrides(bool ignore_overrides)
Parkingbrakecmd124 * set_parking_brake_cmd(bool parking_brake_cmd)
Parkingbrakecmd124 * set_clear_override(bool clear_override)
Parkingbrakecmd124 * set_enable(bool enable)
Parkingbrakecmd124 * set_clear_faults(bool clear_faults)
class register implement
Definition arena_queue.h:37