Apollo 10.0
自动驾驶开放平台
parking_control_a5.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2019 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 zhongyun {
24
25using ::apollo::drivers::canbus::Byte;
26
27const int32_t Parkingcontrola5::ID = 0xA5;
28
29// public
31
33 // TODO(ChaoM) : modify every protocol's period manually
34 static const uint32_t PERIOD = 20 * 1000;
35 return PERIOD;
36}
37
38void Parkingcontrola5::UpdateData(uint8_t* data) {
39 set_p_parking_target(data, parking_target_);
40 set_p_parking_enable_control(data, parking_enable_control_);
41}
42
44 // TODO(ChaoM) : you should check this manually
46 parking_enable_control_ =
48}
49
52 parking_target_ = parking_target;
53 return this;
54}
55
56// config detail: {'name': 'Parking_target', 'enum': {0:
57// 'PARKING_TARGET_RELEASE', 1: 'PARKING_TARGET_PARKING_TRIGGER'},
58// 'precision': 1.0, 'len': 8, 'is_signed_var': False, 'offset': 0.0,
59// 'physical_range': '[0|1]', 'bit': 8, 'type': 'enum', 'order': 'intel',
60// 'physical_unit': ''}
61void Parkingcontrola5::set_p_parking_target(
62 uint8_t* data, Parking_control_a5::Parking_targetType parking_target) {
63 int x = parking_target;
64
65 Byte to_set(data + 1);
66 to_set.set_value(static_cast<uint8_t>(x), 0, 8);
67}
68
71 parking_enable_control_ = parking_enable_control;
72 return this;
73}
74
75// config detail: {'name': 'Parking_Enable_control', 'enum': {0:
76// 'PARKING_ENABLE_CONTROL_PARKING_MANUALCONTROL', 1:
77// 'PARKING_ENABLE_CONTROL_PARKING_AUTOCONTROL'}, 'precision': 1.0, 'len': 8,
78// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|1]', 'bit': 0,
79// 'type': 'enum', 'order': 'intel', 'physical_unit': ''}
80void Parkingcontrola5::set_p_parking_enable_control(
81 uint8_t* data,
83 int x = parking_enable_control;
84
85 Byte to_set(data + 0);
86 to_set.set_value(static_cast<uint8_t>(x), 0, 8);
87}
88
89} // namespace zhongyun
90} // namespace canbus
91} // namespace apollo
Defines the Byte class.
Parkingcontrola5 * set_parking_target(Parking_control_a5::Parking_targetType parking_target)
Parkingcontrola5 * set_parking_enable_control(Parking_control_a5::Parking_enable_controlType parking_enable_control)
class register implement
Definition arena_queue.h:37