Apollo 10.0
自动驾驶开放平台
cruise_control_buttons_cmd_108.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 Cruisecontrolbuttonscmd108::ID = 0x108;
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
39 set_p_cruise_control_button(data, cruise_control_button_);
40 set_p_ignore_overrides(data, ignore_overrides_);
41 set_p_clear_override(data, clear_override_);
42 set_p_enable(data, enable_);
43 set_p_clear_faults(data, clear_faults_);
44}
45
47 // TODO(QiL) you should check this manually
48 cruise_control_button_ =
50 ignore_overrides_ = false;
51 clear_override_ = false;
52 enable_ = false;
53 clear_faults_ = false;
54}
55
59 cruise_control_button) {
60 cruise_control_button_ = cruise_control_button;
61 return this;
62}
63
64// config detail: {'name': 'CRUISE_CONTROL_BUTTON', 'enum': {0:
65// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_NONE', 1:
66// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_CNCL', 2:
67// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_ACC_FURTHER', 3:
68// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_ACC_CLOSER', 4:
69// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_SET_DEC', 5:
70// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_RES_INC', 6:
71// 'CRUISE_CONTROL_BUTTON_CRUISE_CONTROL_ON_OFF'}, 'precision': 1.0, 'len': 8,
72// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|255]', 'bit':
73// 15, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
74void Cruisecontrolbuttonscmd108::set_p_cruise_control_button(
76 cruise_control_button) {
77 uint8_t x = cruise_control_button;
78
79 Byte to_set(data + 1);
80 to_set.set_value(static_cast<uint8_t>(x), 0, 8);
81}
82
84 bool ignore_overrides) {
85 ignore_overrides_ = ignore_overrides;
86 return this;
87}
88
89// config detail: {'name': 'IGNORE_OVERRIDES', 'offset': 0.0, 'precision': 1.0,
90// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 1,
91// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
92void Cruisecontrolbuttonscmd108::set_p_ignore_overrides(uint8_t* data,
93 bool ignore_overrides) {
94 uint8_t x = ignore_overrides;
95
96 Byte to_set(data + 0);
97 to_set.set_value(static_cast<uint8_t>(x), 1, 1);
98}
99
101 bool clear_override) {
102 clear_override_ = clear_override;
103 return this;
104}
105
106// config detail: {'name': 'CLEAR_OVERRIDE', 'offset': 0.0, 'precision': 1.0,
107// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 2,
108// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
109void Cruisecontrolbuttonscmd108::set_p_clear_override(uint8_t* data,
110 bool clear_override) {
111 uint8_t x = clear_override;
112
113 Byte to_set(data + 0);
114 to_set.set_value(static_cast<uint8_t>(x), 2, 1);
115}
116
118 bool enable) {
119 enable_ = enable;
120 return this;
121}
122
123// config detail: {'name': 'ENABLE', 'offset': 0.0, 'precision': 1.0, 'len': 1,
124// 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'bool',
125// 'order': 'motorola', 'physical_unit': ''}
126void Cruisecontrolbuttonscmd108::set_p_enable(uint8_t* data, bool enable) {
127 uint8_t x = enable;
128
129 Byte to_set(data + 0);
130 to_set.set_value(static_cast<uint8_t>(x), 0, 1);
131}
132
134 bool clear_faults) {
135 clear_faults_ = clear_faults;
136 return this;
137}
138
139// config detail: {'name': 'CLEAR_FAULTS', 'offset': 0.0, 'precision': 1.0,
140// 'len': 1, 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 3,
141// 'type': 'bool', 'order': 'motorola', 'physical_unit': ''}
142void Cruisecontrolbuttonscmd108::set_p_clear_faults(uint8_t* data,
143 bool clear_faults) {
144 uint8_t x = clear_faults;
145
146 Byte to_set(data + 0);
147 to_set.set_value(static_cast<uint8_t>(x), 3, 1);
148}
149
150} // namespace lexus
151} // namespace canbus
152} // namespace apollo
Defines the Byte class.
Cruisecontrolbuttonscmd108 * set_ignore_overrides(bool ignore_overrides)
Cruisecontrolbuttonscmd108 * set_clear_override(bool clear_override)
Cruisecontrolbuttonscmd108 * set_cruise_control_button(Cruise_control_buttons_cmd_108::Cruise_control_buttonType cruise_control_button)
Cruisecontrolbuttonscmd108 * set_clear_faults(bool clear_faults)
class register implement
Definition arena_queue.h:37