Apollo 10.0
自动驾驶开放平台
steer_status__512.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 Steerstatus512::ID = 0x512;
30
31void Steerstatus512::Parse(const std::uint8_t* bytes, int32_t length,
32 Ch* chassis) const {
33 chassis->mutable_steer_status__512()->set_steer_angle_en_sts(
34 steer_angle_en_sts(bytes, length));
35 chassis->mutable_steer_status__512()->set_steer_angle_sts(
36 steer_angle_sts(bytes, length));
37 chassis->mutable_steer_status__512()->set_steer_err(
38 steer_err(bytes, length));
39 chassis->mutable_steer_status__512()->set_sensor_err(
40 sensor_err(bytes, length));
41}
42
43// config detail: {'bit': 0, 'description': 'steering angle enable bit(Status)',
44// 'enum': {0: 'STEER_ANGLE_EN_STS_DISABLE', 1: 'STEER_ANGLE_EN_STS_ENABLE', 2:
45// 'STEER_ANGLE_EN_STS_TAKEOVER'}, 'is_signed_var': False, 'len': 8, 'name':
46// 'steer_angle_en_sts', 'offset': 0.0, 'order': 'intel', 'physical_range':
47// '[0|2]', 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
48Steer_status__512::Steer_angle_en_stsType Steerstatus512::steer_angle_en_sts(
49 const std::uint8_t* bytes, int32_t length) const {
50 Byte t0(bytes + 0);
51 int32_t x = t0.get_byte(0, 8);
52
55 return ret;
56}
57
58// config detail: {'bit': 8, 'description': 'Current steering angle(Status)',
59// 'is_signed_var': True, 'len': 16, 'name': 'steer_angle_sts', 'offset': 0.0,
60// 'order': 'intel', 'physical_range': '[-0.524|0.524]', 'physical_unit':
61// 'radian', 'precision': 0.001, 'type': 'double'}
62double Steerstatus512::steer_angle_sts(const std::uint8_t* bytes,
63 int32_t length) const {
64 Byte t0(bytes + 2);
65 int32_t x = t0.get_byte(0, 8);
66
67 Byte t1(bytes + 1);
68 int32_t t = t1.get_byte(0, 8);
69 x <<= 8;
70 x |= t;
71
72 x <<= 16;
73 x >>= 16;
74
75 double ret = x * 0.001000;
76 return ret;
77}
78
79// config detail: {'bit': 24, 'enum': {0: 'STEER_ERR_NOERR', 1:
80// 'STEER_ERR_STEER_MOTOR_ERR'}, 'is_signed_var': False, 'len': 8, 'name':
81// 'steer_err', 'offset': 0.0, 'order': 'intel', 'physical_range': '[0|1]',
82// 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
83Steer_status__512::Steer_errType Steerstatus512::steer_err(
84 const std::uint8_t* bytes, int32_t length) const {
85 Byte t0(bytes + 3);
86 int32_t x = t0.get_byte(0, 8);
87
90 return ret;
91}
92
93// config detail: {'bit': 32, 'enum': {0: 'SENSOR_ERR_NOERR', 1:
94// 'SENSOR_ERR_STEER_SENSOR_ERR'}, 'is_signed_var': False, 'len': 8, 'name':
95// 'sensor_err', 'offset': 0.0, 'order': 'intel', 'physical_range': '[0|1]',
96// 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
97Steer_status__512::Sensor_errType Steerstatus512::sensor_err(
98 const std::uint8_t* bytes, int32_t length) const {
99 Byte t0(bytes + 4);
100 int32_t x = t0.get_byte(0, 8);
101
103 static_cast<Steer_status__512::Sensor_errType>(x);
104 return ret;
105}
106} // namespace ch
107} // namespace canbus
108} // 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