Apollo 10.0
自动驾驶开放平台
fbs4_235.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
19#include "glog/logging.h"
20
23
24namespace apollo {
25namespace canbus {
26namespace wey {
27
28using ::apollo::drivers::canbus::Byte;
29
31const int32_t Fbs4235::ID = 0x235;
32
33void Fbs4235::Parse(const std::uint8_t* bytes, int32_t length,
34 Wey* chassis) const {
35 chassis->mutable_fbs4_235()->set_steerwheelangle(
36 steerwheelangle(bytes, length));
37 chassis->mutable_fbs4_235()->set_steerwheelspd(
38 steerwheelspd(bytes, length));
39}
40
41// config detail: {'description': 'angle of steering wheel ',
42// 'offset': 0.0, 'precision': 0.1, 'len': 15, 'name': 'steerwheelangle',
43// 'is_signed_var': False, 'physical_range': '[0|780]', 'bit': 15,
44// 'type': 'double', 'order': 'motorola', 'physical_unit': '\xa1\xe3'}
45double Fbs4235::steerwheelangle(const std::uint8_t* bytes,
46 int32_t length) const {
47 Byte t0(bytes + 1);
48 int32_t x = t0.get_byte(0, 8);
49
50 Byte t1(bytes + 2);
51 int32_t t = t1.get_byte(1, 7);
52 x <<= 7;
53 x |= t;
54
55 double ret = x * 0.100000;
56 return ret;
57}
58
59// config detail: {'description': 'steering wheel rotation speed',
60// 'offset': 0.0, 'precision': 0.1, 'len': 15, 'name': 'steerwheelspd',
61// 'is_signed_var': False, 'physical_range': '[0|1016]', 'bit': 39,
62// 'type': 'double', 'order': 'motorola', 'physical_unit': '\xa1\xe3/s'}
63double Fbs4235::steerwheelspd(const std::uint8_t* bytes, int32_t length) const {
64 Byte t0(bytes + 4);
65 int32_t x = t0.get_byte(0, 8);
66
67 Byte t1(bytes + 5);
68 int32_t t = t1.get_byte(1, 7);
69 x <<= 7;
70 x |= t;
71
72 double ret = x * 0.100000;
73 return ret;
74}
75} // namespace wey
76} // namespace canbus
77} // namespace apollo
Defines the Byte class.
static const int32_t ID
Definition fbs4_235.h:29
void Parse(const std::uint8_t *bytes, int32_t length, Wey *chassis) const override
Definition fbs4_235.cc:33
class register implement
Definition arena_queue.h:37