Apollo  6.0
Open source self driving car software
brakeinfo_74.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2017 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 
22 #pragma once
23 
24 #include "modules/canbus/proto/chassis_detail.pb.h"
26 
31 namespace apollo {
32 namespace canbus {
33 namespace lincoln {
34 
41  ::apollo::canbus::ChassisDetail> {
42  public:
43  static const int32_t ID;
44 
45  /*
46  * @brief parse received data
47  * @param bytes a pointer to the input bytes
48  * @param length the length of the input bytes
49  * @param timestamp the timestamp of input data
50  * @param chassis_detail the parsed chassis_detail
51  */
52  void Parse(const std::uint8_t *bytes, int32_t length,
53  ChassisDetail *chassis_detail) const override;
54 
55  private:
56  /*
57  * @brief get braking torque request
58  * config detail: {'name': 'brktrqr', 'offset': 0.0, 'precision': 4.0, 'len':
59  * 12, 'f_type': 'value', 'is_signed_var': False, 'physical_range':
60  * '[0|16380]', 'bit': 0, 'type': 'double', 'order': 'intel', 'physical_unit':
61  * '"Nm"'}
62  * @param bytes a pointer to the byte array
63  * @param length the length of the byte array
64  * @return the value of braking torque request
65  */
66  double braking_torque_request(const std::uint8_t *bytes,
67  int32_t length) const;
68  /*
69  * @brief get hill start assist status
70  * config detail: {'name': 'hsastat', 'offset': 0.0, 'precision': 1.0, 'len':
71  * 3, 'f_type': 'value', 'is_signed_var': False, 'physical_range': '[0|0]',
72  * 'bit': 12, 'type': 'int', 'order': 'intel', 'physical_unit': '""'}
73  * @param bytes a pointer to the byte array
74  * @param length the length of the byte array
75  * @return the value of the hill start assist status
76  */
77  int32_t hill_start_assist_status(const std::uint8_t *bytes,
78  int32_t length) const;
79  /*
80  * @brief check vehicle stationary
81  * config detail: {'name': 'statnry', 'offset': 0.0, 'precision': 1.0, 'len':
82  * 1, 'f_type': 'valid', 'is_signed_var': False, 'physical_range': '[0|0]',
83  * 'bit': 15, 'type': 'bool', 'order': 'intel', 'physical_unit': '""'}
84  * @param bytes a pointer to the byte array
85  * @param length the length of the byte array
86  * @return boolean value of the vehicle stationary bit
87  */
88  bool is_vehicle_stationary(const std::uint8_t *bytes, int32_t length) const;
89 
90  /*
91  * @brief get the actual braking torque
92  * config detail: {'name': 'brktrqa', 'offset': 0.0, 'precision': 4.0, 'len':
93  * 12, 'f_type': 'value', 'is_signed_var': False, 'physical_range':
94  * '[0|16380]', 'bit': 16, 'type': 'double', 'order': 'intel',
95  * 'physical_unit': '"Nm"'}
96  * @param bytes a pointer to the byte array
97  * @param length the length of the byte array
98  * @return the value of the actual braking torque
99  */
100  double braking_torque_actual(const std::uint8_t *bytes, int32_t length) const;
101 
102  /*
103  * @brief get the hill start assist mode
104  * config detail: {'name': 'hsamode', 'offset': 0.0, 'precision': 1.0, 'len':
105  * 2, 'f_type': 'value', 'is_signed_var': False, 'physical_range': '[0|0]',
106  * 'bit': 28, 'type': 'int', 'order': 'intel', 'physical_unit': '""'}
107  * @param bytes a pointer to the byte array
108  * @param length the length of the byte array
109  * @return the mode of hill start assist
110  */
111  int32_t hill_start_assist_mode(const std::uint8_t *bytes,
112  int32_t length) const;
113  /*
114  * @brief get the parking brake status
115  * config detail: {'name': 'pbrake', 'offset': 0.0, 'precision': 1.0, 'len':
116  * 2, 'f_type': 'value', 'is_signed_var': False, 'physical_range': '[0|0]',
117  * 'bit': 30, 'type': 'int', 'order': 'intel', 'physical_unit': '""'}
118  * @param bytes a pointer to the byte array
119  * @param length the length of the byte array
120  * @return the value of the parking brake status
121  */
122  int32_t parking_brake_status(const std::uint8_t *bytes, int32_t length) const;
123 
124  /*
125  * @brief get the actual wheel torque
126  * config detail: {'name': 'whltrq', 'offset': 0.0, 'precision': 4.0, 'len':
127  * 14, 'f_type': 'value', 'is_signed_var': True, 'physical_range':
128  * '[-32768|32764]', 'bit': 32, 'type': 'double', 'order': 'intel',
129  * 'physical_unit': '"Nm"'}
130  * @param bytes a pointer to the byte array
131  * @param length the length of the byte array
132  * @return the value of the actual wheel torque
133  */
134  double wheel_torque_actual(const std::uint8_t *bytes, int32_t length) const;
135 
136  /*
137  * @brief get the acceleration over ground
138  * config detail: {'name': 'aog', 'offset': 0.0, 'precision': 0.035, 'len':
139  * 10, 'f_type': 'value', 'is_signed_var': True, 'physical_range':
140  * '[-17.92|17.885]', 'bit': 48, 'type': 'double', 'order': 'intel',
141  * 'physical_unit': '"m/s^2"'}
142  * @param bytes a pointer to the byte array
143  * @param length the length of the byte array
144  * @return the value of the acceleration over ground
145  */
146  double acceleration_over_ground(const std::uint8_t *bytes,
147  int32_t length) const;
148 
149  /*
150  * @brief check abs active
151  * config detail: {'name': 'absa', 'offset': 0.0, 'precision': 1.0, 'len': 1,
152  * 'f_type': 'valid', 'is_signed_var': False, 'physical_range': '[0|0]',
153  * 'bit': 58, 'type': 'bool', 'order': 'intel', 'physical_unit': '""'}
154  * @param bytes a pointer to the byte array
155  * @param length the length of the byte array
156  * @return boolean value of the abs active bit
157  */
158  bool is_abs_active(const std::uint8_t *bytes, int32_t length) const;
159 
160  /*
161  * @brief abs enabled
162  * config detail: {'name': 'abse', 'offset': 0.0, 'precision': 1.0, 'len': 1,
163  * 'f_type': 'valid', 'is_signed_var': False, 'physical_range': '[0|0]',
164  * 'bit': 59, 'type': 'bool', 'order': 'intel', 'physical_unit': '""'}
165  * @param bytes a pointer to the byte array
166  * @param length the length of the byte array
167  * @return boolean value of the abs enabled bit
168  */
169  bool is_abs_enabled(const std::uint8_t *bytes, int32_t length) const;
170 
171  /*
172  * @brief check stability control active
173  * config detail: {'name': 'staba', 'offset': 0.0, 'precision': 1.0, 'len': 1,
174  * 'f_type': 'valid', 'is_signed_var': False, 'physical_range': '[0|0]',
175  * 'bit': 60, 'type': 'bool', 'order': 'intel', 'physical_unit': '""'}
176  * @param bytes a pointer to the byte array
177  * @param length the length of the byte array
178  * @return boolean value of the stability control active bit
179  */
180  bool is_stability_control_active(const std::uint8_t *bytes,
181  int32_t length) const;
182  /*
183  * @brief check stability control enabled bit
184  * config detail: {'name': 'stabe', 'offset': 0.0, 'precision': 1.0, 'len': 1,
185  * 'f_type': 'valid', 'is_signed_var': False, 'physical_range': '[0|0]',
186  * 'bit': 61, 'type': 'bool', 'order': 'intel', 'physical_unit': '""'}
187  * @param bytes a pointer to the byte array
188  * @param length the length of the byte array
189  * @return boolean value of the stability control enabled bit
190  */
191  bool is_stability_control_enabled(const std::uint8_t *bytes,
192  int32_t length) const;
193 
194  /*
195  * @brief traction control active bit
196  * config detail: {'name': 'traca', 'offset': 0.0, 'precision': 1.0, 'len': 1,
197  * 'f_type': 'valid', 'is_signed_var': False, 'physical_range': '[0|0]',
198  * 'bit': 62, 'type': 'bool', 'order': 'intel', 'physical_unit': '""'}
199  * @param bytes a pointer to the byte array
200  * @param length the length of the byte array
201  * @return boolean value of the traction control active bit
202  */
203  bool is_traction_control_active(const std::uint8_t *bytes,
204  int32_t length) const;
205  /*
206  * @brief traction control enabled bit
207  * config detail: {'name': 'trace', 'offset': 0.0, 'precision': 1.0, 'len': 1,
208  * 'f_type': 'valid', 'is_signed_var': False, 'physical_range': '[0|0]',
209  * 'bit': 63, 'type': 'bool', 'order': 'intel', 'physical_unit': '""'}
210  * @param bytes a pointer to the byte array
211  * @param length the length of the byte array
212  * @return boolean value of the traction control enabled bit
213  */
214  bool is_traction_control_enabled(const std::uint8_t *bytes,
215  int32_t length) const;
216 };
217 
218 } // namespace lincoln
219 } // namespace canbus
220 } // namespace apollo
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
This is the base class of protocol data.
Definition: protocol_data.h:44
void Parse(const std::uint8_t *bytes, int32_t length, ChassisDetail *chassis_detail) const override
The class of ProtocolData.
static const int32_t ID
Definition: brakeinfo_74.h:43
one of the protocol data of lincoln vehicle
Definition: brakeinfo_74.h:40