Apollo 10.0
自动驾驶开放平台
llc_motioncommandfeedback1_22.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 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
19#include "glog/logging.h"
20
23
24namespace apollo {
25namespace canbus {
26namespace transit {
27
28using ::apollo::drivers::canbus::Byte;
29
31const int32_t Llcmotioncommandfeedback122::ID = 0x22;
32
33void Llcmotioncommandfeedback122::Parse(const std::uint8_t* bytes,
34 int32_t length,
35 Transit* chassis) const {
36 chassis->mutable_llc_motioncommandfeedback1_22()
37 ->set_llc_fbk_steeringanglesetpoint(
38 llc_fbk_steeringanglesetpoint(bytes, length));
39 chassis->mutable_llc_motioncommandfeedback1_22()
40 ->set_llc_fbk_throttlesetpoint(llc_fbk_throttlesetpoint(bytes, length));
41 chassis->mutable_llc_motioncommandfeedback1_22()
42 ->set_llc_fbk_brakepercentsetpoint(
43 llc_fbk_brakepercentsetpoint(bytes, length));
44 chassis->mutable_llc_motioncommandfeedback1_22()
45 ->set_llc_motioncommandfeedback1_count(
46 llc_motioncommandfeedback1_count(bytes, length));
47 chassis->mutable_llc_motioncommandfeedback1_22()
48 ->set_llc_motioncommandfeedback1_check(
49 llc_motioncommandfeedback1_check(bytes, length));
50}
51
52// config detail: {'description': 'Steering angle setpoint (after limits)',
53// 'offset': 0.0, 'precision': 0.05, 'len': 16, 'name':
54// 'llc_fbk_steeringanglesetpoint', 'is_signed_var': True, 'physical_range':
55// '[-1638.4|1638.35]', 'bit': 21, 'type': 'double', 'order': 'intel',
56// 'physical_unit': 'deg'}
57double Llcmotioncommandfeedback122::llc_fbk_steeringanglesetpoint(
58 const std::uint8_t* bytes, int32_t length) const {
59 Byte t0(bytes + 4);
60 int32_t x = t0.get_byte(0, 5);
61
62 Byte t1(bytes + 3);
63 int32_t t = t1.get_byte(0, 8);
64 x <<= 8;
65 x |= t;
66
67 Byte t2(bytes + 2);
68 t = t2.get_byte(5, 3);
69 x <<= 3;
70 x |= t;
71
72 x <<= 16;
73 x >>= 16;
74
75 double ret = x * 0.050000;
76 return ret;
77}
78
79// config detail: {'description': 'Current throttle setpoint (after limits)',
80// 'offset': 0.0, 'precision': 0.1, 'len': 10, 'name':
81// 'llc_fbk_throttlesetpoint', 'is_signed_var': False, 'physical_range':
82// '[0|102.3]', 'bit': 11, 'type': 'double', 'order': 'intel', 'physical_unit':
83// '%'}
84double Llcmotioncommandfeedback122::llc_fbk_throttlesetpoint(
85 const std::uint8_t* bytes, int32_t length) const {
86 Byte t0(bytes + 2);
87 int32_t x = t0.get_byte(0, 5);
88
89 Byte t1(bytes + 1);
90 int32_t t = t1.get_byte(3, 5);
91 x <<= 5;
92 x |= t;
93
94 double ret = x * 0.100000;
95 return ret;
96}
97
98// config detail: {'description': 'Front brake pressure setpoint (after
99// limits)', 'offset': 0.0, 'precision': 0.0556, 'len': 11, 'name':
100// 'llc_fbk_brakepercentsetpoint', 'is_signed_var': False, 'physical_range':
101// '[0|113.8132]', 'bit': 0, 'type': 'double', 'order': 'intel',
102// 'physical_unit': '%'}
103double Llcmotioncommandfeedback122::llc_fbk_brakepercentsetpoint(
104 const std::uint8_t* bytes, int32_t length) const {
105 Byte t0(bytes + 1);
106 int32_t x = t0.get_byte(0, 3);
107
108 Byte t1(bytes + 0);
109 int32_t t = t1.get_byte(0, 8);
110 x <<= 8;
111 x |= t;
112
113 double ret = x * 0.055600;
114 return ret;
115}
116
117// config detail: {'description': 'Motion command feedback 2 heartbeat counter',
118// 'offset': 0.0, 'precision': 1.0, 'len': 2, 'name':
119// 'llc_motioncommandfeedback1_count', 'is_signed_var': False, 'physical_range':
120// '[0|3]', 'bit': 54, 'type': 'int', 'order': 'intel', 'physical_unit': ''}
121int Llcmotioncommandfeedback122::llc_motioncommandfeedback1_count(
122 const std::uint8_t* bytes, int32_t length) const {
123 Byte t0(bytes + 6);
124 int32_t x = t0.get_byte(6, 2);
125
126 int ret = x;
127 return ret;
128}
129
130// config detail: {'description': 'Motion command feedback 1 checksum',
131// 'offset': 0.0, 'precision': 1.0, 'len': 8, 'name':
132// 'llc_motioncommandfeedback1_check', 'is_signed_var': False, 'physical_range':
133// '[0|255]', 'bit': 56, 'type': 'int', 'order': 'intel', 'physical_unit': ''}
134int Llcmotioncommandfeedback122::llc_motioncommandfeedback1_check(
135 const std::uint8_t* bytes, int32_t length) const {
136 Byte t0(bytes + 7);
137 int32_t x = t0.get_byte(0, 8);
138
139 int ret = x;
140 return ret;
141}
142} // namespace transit
143} // namespace canbus
144} // namespace apollo
Defines the Byte class.
void Parse(const std::uint8_t *bytes, int32_t length, Transit *chassis) const override
class register implement
Definition arena_queue.h:37