Apollo 10.0
自动驾驶开放平台
ultr_sensor_1_507.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2020 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"
22
23namespace apollo {
24namespace canbus {
25namespace devkit {
26
27using ::apollo::drivers::canbus::Byte;
28
30const int32_t Ultrsensor1507::ID = 0x507;
31
32void Ultrsensor1507::Parse(const std::uint8_t* bytes, int32_t length,
33 Devkit* chassis) const {
34 chassis->mutable_ultr_sensor_1_507()->set_uiuss9_tof_direct(
35 uiuss9_tof_direct(bytes, length));
36 chassis->mutable_ultr_sensor_1_507()->set_uiuss8_tof_direct(
37 uiuss8_tof_direct(bytes, length));
38 chassis->mutable_ultr_sensor_1_507()->set_uiuss11_tof_direct(
39 uiuss11_tof_direct(bytes, length));
40 chassis->mutable_ultr_sensor_1_507()->set_uiuss10_tof_direct(
41 uiuss10_tof_direct(bytes, length));
42}
43
44// config detail: {'name': 'uiuss9_tof_direct', 'offset': 0.0, 'precision':
45// 0.01724, 'len': 16, 'is_signed_var': False, 'physical_range': '[0|65535]',
46// 'bit': 23, 'type': 'double', 'order': 'motorola', 'physical_unit': 'cm'}
47double Ultrsensor1507::uiuss9_tof_direct(const std::uint8_t* bytes,
48 int32_t length) const {
49 Byte t0(bytes + 2);
50 int32_t x = t0.get_byte(0, 8);
51
52 Byte t1(bytes + 3);
53 int32_t t = t1.get_byte(0, 8);
54 x <<= 8;
55 x |= t;
56
57 double ret = x / 58;
58 return ret;
59}
60
61// config detail: {'name': 'uiuss8_tof_direct', 'offset': 0.0, 'precision':
62// 0.01724, 'len': 16, 'is_signed_var': False, 'physical_range': '[0|65535]',
63// 'bit': 7, 'type': 'double', 'order': 'motorola', 'physical_unit': 'cm'}
64double Ultrsensor1507::uiuss8_tof_direct(const std::uint8_t* bytes,
65 int32_t length) const {
66 Byte t0(bytes + 0);
67 int32_t x = t0.get_byte(0, 8);
68
69 Byte t1(bytes + 1);
70 int32_t t = t1.get_byte(0, 8);
71 x <<= 8;
72 x |= t;
73
74 double ret = x / 58;
75 return ret;
76}
77
78// config detail: {'name': 'uiuss11_tof_direct', 'offset': 0.0, 'precision':
79// 0.01724, 'len': 16, 'is_signed_var': False, 'physical_range': '[0|65535]',
80// 'bit': 55, 'type': 'double', 'order': 'motorola', 'physical_unit': 'cm'}
81double Ultrsensor1507::uiuss11_tof_direct(const std::uint8_t* bytes,
82 int32_t length) const {
83 Byte t0(bytes + 6);
84 int32_t x = t0.get_byte(0, 8);
85
86 Byte t1(bytes + 7);
87 int32_t t = t1.get_byte(0, 8);
88 x <<= 8;
89 x |= t;
90
91 double ret = x / 58;
92 return ret;
93}
94
95// config detail: {'name': 'uiuss10_tof_direct', 'offset': 0.0, 'precision':
96// 0.01724, 'len': 16, 'is_signed_var': False, 'physical_range': '[0|65535]',
97// 'bit': 39, 'type': 'double', 'order': 'motorola', 'physical_unit': 'cm'}
98double Ultrsensor1507::uiuss10_tof_direct(const std::uint8_t* bytes,
99 int32_t length) const {
100 Byte t0(bytes + 4);
101 int32_t x = t0.get_byte(0, 8);
102
103 Byte t1(bytes + 5);
104 int32_t t = t1.get_byte(0, 8);
105 x <<= 8;
106 x |= t;
107
108 double ret = x / 58;
109 return ret;
110}
111} // namespace devkit
112} // namespace canbus
113} // namespace apollo
Defines the Byte class.
void Parse(const std::uint8_t *bytes, int32_t length, Devkit *chassis) const override
class register implement
Definition arena_queue.h:37