Apollo 10.0
自动驾驶开放平台
detected_object_rpt_411.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 lexus {
27
28using ::apollo::drivers::canbus::Byte;
29
31const int32_t Detectedobjectrpt411::ID = 0x411;
32
33void Detectedobjectrpt411::Parse(const std::uint8_t* bytes, int32_t length,
34 Lexus* chassis) const {
35 chassis->mutable_detected_object_rpt_411()
36 ->set_front_object_distance_high_res(
37 front_object_distance_high_res(bytes, length));
38 chassis->mutable_detected_object_rpt_411()->set_front_object_distance_low_res(
39 front_object_distance_low_res(bytes, length));
40}
41
42// config detail: {'name': 'front_object_distance_high_res', 'offset': 0.0,
43// 'precision': 0.001, 'len': 24, 'is_signed_var': False, 'physical_range':
44// '[0|16777.215]', 'bit': 31, 'type': 'double', 'order': 'motorola',
45// 'physical_unit': 'm'}
46double Detectedobjectrpt411::front_object_distance_high_res(
47 const std::uint8_t* bytes, int32_t length) const {
48 Byte t0(bytes + 3);
49 int32_t x = t0.get_byte(0, 8);
50
51 Byte t1(bytes + 4);
52 int32_t t = t1.get_byte(0, 8);
53 x <<= 8;
54 x |= t;
55
56 Byte t2(bytes + 5);
57 t = t2.get_byte(0, 8);
58 x <<= 8;
59 x |= t;
60
61 double ret = x * 0.001000;
62 return ret;
63}
64
65// config detail: {'name': 'front_object_distance_low_res', 'offset': 0.0,
66// 'precision': 0.001, 'len': 24, 'is_signed_var': False, 'physical_range':
67// '[0|16777.215]', 'bit': 7, 'type': 'double', 'order': 'motorola',
68// 'physical_unit': 'm'}
69double Detectedobjectrpt411::front_object_distance_low_res(
70 const std::uint8_t* bytes, int32_t length) const {
71 Byte t0(bytes + 0);
72 int32_t x = t0.get_byte(0, 8);
73
74 Byte t1(bytes + 1);
75 int32_t t = t1.get_byte(0, 8);
76 x <<= 8;
77 x |= t;
78
79 Byte t2(bytes + 2);
80 t = t2.get_byte(0, 8);
81 x <<= 8;
82 x |= t;
83
84 double ret = x * 0.001000;
85 return ret;
86}
87} // namespace lexus
88} // namespace canbus
89} // namespace apollo
Defines the Byte class.
void Parse(const std::uint8_t *bytes, int32_t length, Lexus *chassis) const override
class register implement
Definition arena_queue.h:37