Apollo 10.0
自动驾驶开放平台
brake_command_101.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2020 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/devkit/proto/devkit.pb.h"
20
22
23namespace apollo {
24namespace canbus {
25namespace devkit {
26
28 ::apollo::canbus::Devkit> {
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 Devkit* chassis) const override;
38
39 void UpdateData(uint8_t* data) override;
40
41 void Reset() override;
42
43 // config detail: {'bit': 0, 'enum': {0: 'BRAKE_EN_CTRL_DISABLE', 1:
44 // 'BRAKE_EN_CTRL_ENABLE'}, 'is_signed_var': False, 'len': 1, 'name':
45 // 'Brake_EN_CTRL', 'offset': 0.0, 'order': 'motorola', 'physical_range':
46 // '[0|1]', 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
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': 31, 'is_signed_var': False, 'len': 16, 'name':
63 // 'Brake_Pedal_Target', 'offset': 0.0, 'order': 'motorola', 'physical_range':
64 // '[0|100]', 'physical_unit': '%', 'precision': 0.1, 'type': 'double'}
65 Brakecommand101* set_brake_pedal_target(double brake_pedal_target);
66
67 // config detail: {'bit': 63, 'is_signed_var': False, 'len': 8, 'name':
68 // 'CheckSum_101', 'offset': 0.0, 'order': 'motorola', 'physical_range':
69 // '[0|255]', 'physical_unit': '', 'precision': 1.0, 'type': 'int'}
70 Brakecommand101* set_checksum_101(int checksum_101);
71
72 private:
73 // config detail: {'bit': 0, 'enum': {0: 'BRAKE_EN_CTRL_DISABLE', 1:
74 // 'BRAKE_EN_CTRL_ENABLE'}, 'is_signed_var': False, 'len': 1, 'name':
75 // 'Brake_EN_CTRL', 'offset': 0.0, 'order': 'motorola', 'physical_range':
76 // '[0|1]', 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
77 void set_p_brake_en_ctrl(uint8_t* data,
79
80 // config detail: {'bit': 1, 'enum': {0: 'AEB_EN_CTRL_DISABLE_AEB', 1:
81 // 'AEB_EN_CTRL_ENABLE_AEB'}, 'is_signed_var': False, 'len': 1, 'name':
82 // 'AEB_EN_CTRL', 'offset': 0.0, 'order': 'motorola', 'physical_range':
83 // '[0|0]', 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
84 void set_p_aeb_en_ctrl(uint8_t* data,
86
87 // config detail: {'bit': 15, 'is_signed_var': False, 'len': 10, 'name':
88 // 'Brake_Dec', 'offset': 0.0, 'order': 'motorola', 'physical_range':
89 // '[0|10]', 'physical_unit': 'm/s^2', 'precision': 0.01, 'type': 'double'}
90 void set_p_brake_dec(uint8_t* data, double brake_dec);
91
92 // config detail: {'bit': 31, 'is_signed_var': False, 'len': 16, 'name':
93 // 'Brake_Pedal_Target', 'offset': 0.0, 'order': 'motorola', 'physical_range':
94 // '[0|100]', 'physical_unit': '%', 'precision': 0.1, 'type': 'double'}
95 void set_p_brake_pedal_target(uint8_t* data, double brake_pedal_target);
96
97 // config detail: {'bit': 63, 'is_signed_var': False, 'len': 8, 'name':
98 // 'CheckSum_101', 'offset': 0.0, 'order': 'motorola', 'physical_range':
99 // '[0|255]', 'physical_unit': '', 'precision': 1.0, 'type': 'int'}
100 void set_p_checksum_101(uint8_t* data, int checksum_101);
101
102 // report the command
104 const std::uint8_t* bytes, const int32_t length) const;
105
106 Brake_command_101::Aeb_en_ctrlType aeb_en_ctrl(const std::uint8_t* bytes,
107 const int32_t length) const;
108
109 double brake_dec(const std::uint8_t* bytes, const int32_t length) const;
110
111 double brake_pedal_target(const std::uint8_t* bytes,
112 const int32_t length) const;
113
114 int checksum_101(const std::uint8_t* bytes, const int32_t length) const;
115
116 private:
118 double brake_dec_;
119 int checksum_101_;
120 double brake_pedal_target_;
122};
123
124} // namespace devkit
125} // namespace canbus
126} // namespace apollo
Brakecommand101 * set_brake_pedal_target(double brake_pedal_target)
void UpdateData(uint8_t *data) override
Brakecommand101 * set_aeb_en_ctrl(Brake_command_101::Aeb_en_ctrlType aeb_en_ctrl)
void Parse(const std::uint8_t *bytes, int32_t length, Devkit *chassis) const override
Brakecommand101 * set_brake_dec(double brake_dec)
Brakecommand101 * set_brake_en_ctrl(Brake_command_101::Brake_en_ctrlType brake_en_ctrl)
Brakecommand101 * set_checksum_101(int checksum_101)
This is the base class of protocol data.
class register implement
Definition arena_queue.h:37
The class of ProtocolData