Apollo 10.0
自动驾驶开放平台
brake_command_101.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2023 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
17#pragma once
18
19#include "modules/canbus_vehicle/demo/proto/demo.pb.h"
20
22
23namespace apollo {
24namespace canbus {
25namespace demo {
26
28 : public ::apollo::drivers::canbus::ProtocolData<::apollo::canbus::Demo> {
29 public:
30 static const int32_t ID;
31
33
34 uint32_t GetPeriod() const override;
35
36 void Parse(const std::uint8_t* bytes, int32_t length,
37 Demo* chassis) const override;
38
39 void UpdateData_Heartbeat(uint8_t* data) override;
40
41 void UpdateData(uint8_t* data) override;
42
43 void Reset() override;
44
45 // config detail: {'bit': 7, 'is_signed_var': False, 'len': 4, 'name':
46 // 'Heartbeat_101', 'offset': 0.0, 'order': 'motorola', 'physical_range':
47 // '[0|15]', 'physical_unit': '', 'precision': 1.0, 'type': 'int'}
48 Brakecommand101* set_heartbeat_101(int heartbeat_101);
49
50 // config detail: {'bit': 1, 'enum': {0: 'AEB_EN_CTRL_DISABLE_AEB', 1:
51 // 'AEB_EN_CTRL_ENABLE_AEB'}, 'is_signed_var': False, 'len': 1, 'name':
52 // 'AEB_EN_CTRL', 'offset': 0.0, 'order': 'motorola', 'physical_range':
53 // '[0|0]', 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
56
57 // config detail: {'bit': 15, 'is_signed_var': False, 'len': 10, 'name':
58 // 'Brake_Dec', 'offset': 0.0, 'order': 'motorola', 'physical_range':
59 // '[0|10]', 'physical_unit': 'm/s^2', 'precision': 0.01, 'type': 'double'}
60 Brakecommand101* set_brake_dec(double brake_dec);
61
62 // config detail: {'bit': 63, 'is_signed_var': False, 'len': 8, 'name':
63 // 'CheckSum_101', 'offset': 0.0, 'order': 'motorola', 'physical_range':
64 // '[0|255]', 'physical_unit': '', 'precision': 1.0, 'type': 'int'}
65 Brakecommand101* set_checksum_101(int checksum_101);
66
67 // config detail: {'bit': 31, 'description': 'command', 'is_signed_var':
68 // False, 'len': 16, 'name': 'Brake_Pedal_Target', 'offset': 0.0, 'order':
69 // 'motorola', 'physical_range': '[0|100]', 'physical_unit': '%', 'precision':
70 // 0.1, 'signal_type': 'command', 'type': 'double'}
71 Brakecommand101* set_brake_pedal_target(double brake_pedal_target);
72
73 // config detail: {'bit': 0, 'description': 'enable', 'enum': {0:
74 // 'BRAKE_EN_CTRL_DISABLE', 1: 'BRAKE_EN_CTRL_ENABLE'}, 'is_signed_var':
75 // False, 'len': 1, 'name': 'Brake_EN_CTRL', 'offset': 0.0, 'order':
76 // 'motorola', 'physical_range': '[0|1]', 'physical_unit': '',
77 // 'precision': 1.0, 'signal_type': 'enable', 'type': 'enum'}
80
81 private:
82 // config detail: {'bit': 7, 'is_signed_var': False, 'len': 4, 'name':
83 // 'Heartbeat_101', 'offset': 0.0, 'order': 'motorola', 'physical_range':
84 // '[0|15]', 'physical_unit': '', 'precision': 1.0, 'type': 'int'}
85 void set_p_heartbeat_101(uint8_t* data, int heartbeat_101);
86
87 // config detail: {'bit': 1, 'enum': {0: 'AEB_EN_CTRL_DISABLE_AEB', 1:
88 // 'AEB_EN_CTRL_ENABLE_AEB'}, 'is_signed_var': False, 'len': 1, 'name':
89 // 'AEB_EN_CTRL', 'offset': 0.0, 'order': 'motorola', 'physical_range':
90 // '[0|0]', 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
91 void set_p_aeb_en_ctrl(uint8_t* data,
93
94 // config detail: {'bit': 15, 'is_signed_var': False, 'len': 10, 'name':
95 // 'Brake_Dec', 'offset': 0.0, 'order': 'motorola', 'physical_range':
96 // '[0|10]', 'physical_unit': 'm/s^2', 'precision': 0.01, 'type': 'double'}
97 void set_p_brake_dec(uint8_t* data, double brake_dec);
98
99 // config detail: {'bit': 63, 'is_signed_var': False, 'len': 8, 'name':
100 // 'CheckSum_101', 'offset': 0.0, 'order': 'motorola', 'physical_range':
101 // '[0|255]', 'physical_unit': '', 'precision': 1.0, 'type': 'int'}
102 void set_p_checksum_101(uint8_t* data, int checksum_101);
103
104 // config detail: {'bit': 31, 'description': 'command', 'is_signed_var':
105 // False, 'len': 16, 'name': 'Brake_Pedal_Target', 'offset': 0.0, 'order':
106 // 'motorola', 'physical_range': '[0|100]', 'physical_unit': '%', 'precision':
107 // 0.1, 'signal_type': 'command', 'type': 'double'}
108 void set_p_brake_pedal_target(uint8_t* data, double brake_pedal_target);
109
110 // config detail: {'bit': 0, 'description': 'enable', 'enum': {0:
111 // 'BRAKE_EN_CTRL_DISABLE', 1: 'BRAKE_EN_CTRL_ENABLE'}, 'is_signed_var':
112 // False, 'len': 1, 'name': 'Brake_EN_CTRL', 'offset': 0.0, 'order':
113 // 'motorola', 'physical_range': '[0|1]', 'physical_unit': '',
114 // 'precision': 1.0, 'signal_type': 'enable', 'type': 'enum'}
115 void set_p_brake_en_ctrl(uint8_t* data,
117
118 int heartbeat_101(const std::uint8_t* bytes, const int32_t length) const;
119
120 Brake_command_101::Aeb_en_ctrlType aeb_en_ctrl(const std::uint8_t* bytes,
121 const int32_t length) const;
122
123 double brake_dec(const std::uint8_t* bytes, const int32_t length) const;
124
125 int checksum_101(const std::uint8_t* bytes, const int32_t length) const;
126
127 double brake_pedal_target(const std::uint8_t* bytes,
128 const int32_t length) const;
129
131 const std::uint8_t* bytes, const int32_t length) const;
132
133 private:
134 int heartbeat_101_;
136 double brake_dec_;
137 int checksum_101_;
138 double brake_pedal_target_;
140};
141
142} // namespace demo
143} // namespace canbus
144} // namespace apollo
Brakecommand101 * set_checksum_101(int checksum_101)
Brakecommand101 * set_brake_en_ctrl(Brake_command_101::Brake_en_ctrlType brake_en_ctrl)
void UpdateData_Heartbeat(uint8_t *data) override
void UpdateData(uint8_t *data) override
Brakecommand101 * set_heartbeat_101(int heartbeat_101)
void Parse(const std::uint8_t *bytes, int32_t length, Demo *chassis) const override
Brakecommand101 * set_brake_dec(double brake_dec)
Brakecommand101 * set_aeb_en_ctrl(Brake_command_101::Aeb_en_ctrlType aeb_en_ctrl)
Brakecommand101 * set_brake_pedal_target(double brake_pedal_target)
This is the base class of protocol data.
class register implement
Definition arena_queue.h:37
The class of ProtocolData