Apollo 10.0
自动驾驶开放平台
llc_vehiclelimits_24.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 Llcvehiclelimits24::ID = 0x24;
32
33void Llcvehiclelimits24::Parse(const std::uint8_t* bytes, int32_t length,
34 Transit* chassis) const {
35 chassis->mutable_llc_vehiclelimits_24()->set_llc_fbk_maxsteeringangle(
36 llc_fbk_maxsteeringangle(bytes, length));
37 chassis->mutable_llc_vehiclelimits_24()->set_llc_fbk_maxbrakepercent(
38 llc_fbk_maxbrakepercent(bytes, length));
39}
40
41// config detail: {'description': 'Steering angle feedback', 'offset': 0.0,
42// 'precision': 1.0, 'len': 12, 'name': 'llc_fbk_maxsteeringangle',
43// 'is_signed_var': False, 'physical_range': '[0|4095]', 'bit': 12, 'type':
44// 'int', 'order': 'intel', 'physical_unit': 'deg'}
45int Llcvehiclelimits24::llc_fbk_maxsteeringangle(const std::uint8_t* bytes,
46 int32_t length) const {
47 Byte t0(bytes + 2);
48 int32_t x = t0.get_byte(0, 8);
49
50 Byte t1(bytes + 1);
51 int32_t t = t1.get_byte(4, 4);
52 x <<= 4;
53 x |= t;
54
55 int ret = x;
56 return ret;
57}
58
59// config detail: {'description': 'Front brake pressure feedback', 'offset':
60// 0.0, 'precision': 1.0, 'len': 12, 'name': 'llc_fbk_maxbrakepercent',
61// 'is_signed_var': False, 'physical_range': '[0|113.8132]', 'bit': 0, 'type':
62// 'double', 'order': 'intel', 'physical_unit': '%'}
63double Llcvehiclelimits24::llc_fbk_maxbrakepercent(const std::uint8_t* bytes,
64 int32_t length) const {
65 Byte t0(bytes + 1);
66 int32_t x = t0.get_byte(0, 4);
67
68 Byte t1(bytes + 0);
69 int32_t t = t1.get_byte(0, 8);
70 x <<= 8;
71 x |= t;
72
73 double ret = x;
74 return ret;
75}
76} // namespace transit
77} // namespace canbus
78} // 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