Apollo 10.0
自动驾驶开放平台
scu_1_301.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 ge3 {
25
26using ::apollo::drivers::canbus::Byte;
27
29const int32_t Scu1301::ID = 0x301;
30
31void Scu1301::Parse(const std::uint8_t* bytes, int32_t length,
32 Ge3* chassis) const {
33 chassis->mutable_scu_1_301()->set_vin16(vin16(bytes, length));
34 chassis->mutable_scu_1_301()->set_scu_stopbutst(
35 scu_stopbutst(bytes, length));
36 chassis->mutable_scu_1_301()->set_scu_drvmode(
37 scu_drvmode(bytes, length));
38 chassis->mutable_scu_1_301()->set_scu_faultst(
39 scu_faultst(bytes, length));
40}
41
42// config detail: {'description': 'VIN string character 16', 'offset': 0.0,
43// 'precision': 1.0, 'len': 8, 'name': 'vin16', 'is_signed_var': False,
44// 'physical_range': '[0|255]', 'bit': 15, 'type': 'int', 'order': 'motorola',
45// 'physical_unit': '-'}
46int Scu1301::vin16(const std::uint8_t* bytes, int32_t length) const {
47 Byte t0(bytes + 1);
48 int32_t x = t0.get_byte(0, 8);
49
50 int ret = x;
51 return ret;
52}
53
54// config detail: {'description': 'Brake pedal position', 'enum': {0:
55// 'SCU_STOPBUTST_UNPRESSED', 1: 'SCU_STOPBUTST_PRESSED'}, 'precision': 1.0,
56// 'len': 1, 'name': 'scu_stopbutst', 'is_signed_var': False, 'offset': 0.0,
57// 'physical_range': '[0|1]', 'bit': 0, 'type': 'enum', 'order': 'motorola',
58// 'physical_unit': ''}
59Scu_1_301::Scu_stopbutstType Scu1301::scu_stopbutst(const std::uint8_t* bytes,
60 int32_t length) const {
61 Byte t0(bytes + 0);
62 int32_t x = t0.get_byte(0, 1);
63
65 static_cast<Scu_1_301::Scu_stopbutstType>(x);
66 return ret;
67}
68
69// config detail: {'description': 'SCU drive mode', 'enum': {0:
70// 'SCU_DRVMODE_INVALID', 1: 'SCU_DRVMODE_MANUAL', 2: 'SCU_DRVMODE_INTERRUPT',
71// 3: 'SCU_DRVMODE_AUTO'}, 'precision': 1.0, 'len': 2, 'name': 'scu_drvmode',
72// 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|3]', 'bit': 3,
73// 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
74Scu_1_301::Scu_drvmodeType Scu1301::scu_drvmode(const std::uint8_t* bytes,
75 int32_t length) const {
76 Byte t0(bytes + 0);
77 int32_t x = t0.get_byte(2, 2);
78
80 return ret;
81}
82
83// config detail: {'description': 'SCU fault status', 'enum': {0:
84// 'SCU_FAULTST_NORMAL', 1: 'SCU_FAULTST_FAULT'}, 'precision': 1.0, 'len': 4,
85// 'name': 'scu_faultst', 'is_signed_var': False, 'offset': 0.0,
86// 'physical_range': '[0|15]', 'bit': 7, 'type': 'enum', 'order': 'motorola',
87// 'physical_unit': ''}
88Scu_1_301::Scu_faultstType Scu1301::scu_faultst(const std::uint8_t* bytes,
89 int32_t length) const {
90 Byte t0(bytes + 0);
91 int32_t x = t0.get_byte(4, 4);
92
94 return ret;
95}
96} // namespace ge3
97} // namespace canbus
98} // namespace apollo
Defines the Byte class.
static const int32_t ID
Definition scu_1_301.h:29
void Parse(const std::uint8_t *bytes, int32_t length, Ge3 *chassis) const override
Definition scu_1_301.cc:31
class register implement
Definition arena_queue.h:37