Apollo 10.0
自动驾驶开放平台
llc_diag_steeringcontrol_722.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
20
21namespace apollo {
22namespace canbus {
23namespace transit {
24
25using ::apollo::drivers::canbus::Byte;
26
27const int32_t Llcdiagsteeringcontrol722::ID = 0x722;
28
29// public
31
33 // TODO(All) : modify every protocol's period manually
34 static const uint32_t PERIOD = 10 * 1000;
35 return PERIOD;
36}
37
39 set_p_llc_dbg_steeringsensorposition(data, llc_dbg_steeringsensorposition_);
40 set_p_llc_dbg_steeringrackinputtorque(data, llc_dbg_steeringrackinputtorque_);
41 set_p_llc_dbg_steeringmotorposition(data, llc_dbg_steeringmotorposition_);
42}
43
45 // TODO(All) : you should check this manually
46 llc_dbg_steeringsensorposition_ = 0.0;
47 llc_dbg_steeringrackinputtorque_ = 0;
48 llc_dbg_steeringmotorposition_ = 0.0;
49}
50
53 double llc_dbg_steeringsensorposition) {
54 llc_dbg_steeringsensorposition_ = llc_dbg_steeringsensorposition;
55 return this;
56}
57
58// config detail: {'description': 'Brake control feedforward contribution',
59// 'offset': 0.0, 'precision': 0.0002, 'len': 16, 'name':
60// 'LLC_DBG_SteeringSensorPosition', 'is_signed_var': True, 'physical_range':
61// '[-6.5536|6.5534]', 'bit': 40, 'type': 'double', 'order': 'intel',
62// 'physical_unit': 'rev'}
63void Llcdiagsteeringcontrol722::set_p_llc_dbg_steeringsensorposition(
64 uint8_t* data, double llc_dbg_steeringsensorposition) {
65 llc_dbg_steeringsensorposition = ProtocolData::BoundedValue(
66 -6.5536, 6.5534, llc_dbg_steeringsensorposition);
67 int x = static_cast<int>(llc_dbg_steeringsensorposition / 0.000200);
68 uint8_t t = 0;
69
70 t = static_cast<uint8_t>(x & 0xFF);
71 Byte to_set0(data + 5);
72 to_set0.set_value(t, 0, 8);
73 x >>= 8;
74
75 t = static_cast<uint8_t>(x & 0xFF);
76 Byte to_set1(data + 6);
77 to_set1.set_value(t, 0, 8);
78}
79
80Llcdiagsteeringcontrol722*
82 int llc_dbg_steeringrackinputtorque) {
83 llc_dbg_steeringrackinputtorque_ = llc_dbg_steeringrackinputtorque;
84 return this;
85}
86
87// config detail: {'description': 'Brake control feedforward contribution',
88// 'offset': 0.0, 'precision': 1.0, 'len': 16, 'name':
89// 'LLC_DBG_SteeringRackInputTorque', 'is_signed_var': True, 'physical_range':
90// '[-32768|32767]', 'bit': 24, 'type': 'int', 'order': 'intel',
91// 'physical_unit': 'counts'}
92void Llcdiagsteeringcontrol722::set_p_llc_dbg_steeringrackinputtorque(
93 uint8_t* data, int llc_dbg_steeringrackinputtorque) {
94 llc_dbg_steeringrackinputtorque = ProtocolData::BoundedValue(
95 -32768, 32767, llc_dbg_steeringrackinputtorque);
96 int x = llc_dbg_steeringrackinputtorque;
97 uint8_t t = 0;
98
99 t = static_cast<uint8_t>(x & 0xFF);
100 Byte to_set0(data + 3);
101 to_set0.set_value(t, 0, 8);
102 x >>= 8;
103
104 t = static_cast<uint8_t>(x & 0xFF);
105 Byte to_set1(data + 4);
106 to_set1.set_value(t, 0, 8);
107}
108
109Llcdiagsteeringcontrol722*
111 double llc_dbg_steeringmotorposition) {
112 llc_dbg_steeringmotorposition_ = llc_dbg_steeringmotorposition;
113 return this;
114}
115
116// config detail: {'description': 'Brake control feedforward contribution',
117// 'offset': 0.0, 'precision': 1e-05, 'len': 24, 'name':
118// 'LLC_DBG_SteeringMotorPosition', 'is_signed_var': True, 'physical_range':
119// '[-83.88608|83.88607]', 'bit': 0, 'type': 'double', 'order': 'intel',
120// 'physical_unit': 'rev'}
121void Llcdiagsteeringcontrol722::set_p_llc_dbg_steeringmotorposition(
122 uint8_t* data, double llc_dbg_steeringmotorposition) {
123 llc_dbg_steeringmotorposition = ProtocolData::BoundedValue(
124 -83.88608, 83.88607, llc_dbg_steeringmotorposition);
125 int x = static_cast<int>(llc_dbg_steeringmotorposition / 0.000010);
126 uint8_t t = 0;
127
128 t = static_cast<uint8_t>(x & 0xFF);
129 Byte to_set0(data + 0);
130 to_set0.set_value(t, 0, 8);
131 x >>= 8;
132
133 t = static_cast<uint8_t>(x & 0xFF);
134 Byte to_set1(data + 1);
135 to_set1.set_value(t, 0, 8);
136 x >>= 8;
137
138 t = static_cast<uint8_t>(x & 0xFF);
139 Byte to_set2(data + 2);
140 to_set2.set_value(t, 0, 8);
141}
142
143} // namespace transit
144} // namespace canbus
145} // namespace apollo
Defines the Byte class.
Llcdiagsteeringcontrol722 * set_llc_dbg_steeringsensorposition(double llc_dbg_steeringsensorposition)
Llcdiagsteeringcontrol722 * set_llc_dbg_steeringrackinputtorque(int llc_dbg_steeringrackinputtorque)
Llcdiagsteeringcontrol722 * set_llc_dbg_steeringmotorposition(double llc_dbg_steeringmotorposition)
class register implement
Definition arena_queue.h:37