Apollo 10.0
自动驾驶开放平台
throttle_status__510.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#include "glog/logging.h"
21
22namespace apollo {
23namespace canbus {
24namespace ch {
25
26using ::apollo::drivers::canbus::Byte;
27
29const int32_t Throttlestatus510::ID = 0x510;
30
31void Throttlestatus510::Parse(const std::uint8_t* bytes, int32_t length,
32 Ch* chassis) const {
33 chassis
34 ->mutable_throttle_status__510()
35 ->set_throttle_pedal_en_sts(throttle_pedal_en_sts(bytes, length));
36 chassis->mutable_throttle_status__510()->set_throttle_pedal_sts(
37 throttle_pedal_sts(bytes, length));
38 chassis->mutable_throttle_status__510()->set_drive_motor_err(
39 drive_motor_err(bytes, length));
40 chassis->mutable_throttle_status__510()->set_battery_bms_err(
41 battery_bms_err(bytes, length));
42}
43
44// config detail: {'description': 'throttle pedal enable bit(Status)', 'enum':
45// {0: 'THROTTLE_PEDAL_EN_STS_DISABLE', 1: 'THROTTLE_PEDAL_EN_STS_ENABLE', 2:
46// 'THROTTLE_PEDAL_EN_STS_TAKEOVER'}, 'precision': 1.0, 'len': 8, 'name':
47// 'throttle_pedal_en_sts', 'is_signed_var': False, 'offset': 0.0,
48// 'physical_range': '[0|1]', 'bit': 0, 'type': 'enum', 'order': 'intel',
49// 'physical_unit': ''}
51Throttlestatus510::throttle_pedal_en_sts(const std::uint8_t* bytes,
52 int32_t length) const {
53 Byte t0(bytes + 0);
54 int32_t x = t0.get_byte(0, 8);
55
58 return ret;
59}
60
61// config detail: {'bit': 8, 'description': 'Percentage of throttle
62// pedal(Status)', 'is_signed_var': False, 'len': 8, 'name':
63// 'throttle_pedal_sts', 'offset': 0.0, 'order': 'intel', 'physical_range':
64// '[0|100]', 'physical_unit': '%', 'precision': 1.0, 'type': 'int'}
65int Throttlestatus510::throttle_pedal_sts(const std::uint8_t* bytes,
66 int32_t length) const {
67 Byte t0(bytes + 1);
68 int32_t x = t0.get_byte(0, 8);
69
70 int ret = x;
71 return ret;
72}
73
74// config detail: {'bit': 16, 'enum': {0: 'DRIVE_MOTOR_ERR_NOERR', 1:
75// 'DRIVE_MOTOR_ERR_DRV_MOTOR_ERR'}, 'is_signed_var': False, 'len': 8, 'name':
76// 'drive_motor_err', 'offset': 0.0, 'order': 'intel', 'physical_range':
77// '[0|1]', 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
78Throttle_status__510::Drive_motor_errType Throttlestatus510::drive_motor_err(
79 const std::uint8_t* bytes, int32_t length) const {
80 Byte t0(bytes + 2);
81 int32_t x = t0.get_byte(0, 8);
82
85 return ret;
86}
87
88// config detail: {'bit': 24, 'enum': {0: 'BATTERY_BMS_ERR_NOERR', 1:
89// 'BATTERY_BMS_ERR_BATTERY_ERR'}, 'is_signed_var': False, 'len': 8, 'name':
90// 'battery_bms_err', 'offset': 0.0, 'order': 'intel', 'physical_range':
91// '[0|1]', 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
92Throttle_status__510::Battery_bms_errType Throttlestatus510::battery_bms_err(
93 const std::uint8_t* bytes, int32_t length) const {
94 Byte t0(bytes + 3);
95 int32_t x = t0.get_byte(0, 8);
96
99 return ret;
100}
101} // namespace ch
102} // namespace canbus
103} // namespace apollo
Defines the Byte class.
void Parse(const std::uint8_t *bytes, int32_t length, Ch *chassis) const override
class register implement
Definition arena_queue.h:37