Apollo 10.0
自动驾驶开放平台
throttle_command_100.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2023 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
17#pragma once
18
19#include "modules/canbus_vehicle/demo/proto/demo.pb.h"
20
22
23namespace apollo {
24namespace canbus {
25namespace demo {
26
28 : public ::apollo::drivers::canbus::ProtocolData<::apollo::canbus::Demo> {
29 public:
30 static const int32_t ID;
31
33
34 uint32_t GetPeriod() const override;
35
36 void Parse(const std::uint8_t* bytes, int32_t length,
37 Demo* chassis) const override;
38
39 void UpdateData_Heartbeat(uint8_t* data) override;
40
41 void UpdateData(uint8_t* data) override;
42
43 void Reset() override;
44
45 // config detail: {'bit': 7, 'is_signed_var': False, 'len': 4, 'name':
46 // 'Heartbeat_100', 'offset': 0.0, 'order': 'motorola', 'physical_range':
47 // '[0|15]', 'physical_unit': '', 'precision': 1.0, 'type': 'int'}
48 Throttlecommand100* set_heartbeat_100(int heartbeat_100);
49
50 // config detail: {'bit': 47, 'is_signed_var': False, 'len': 12, 'name':
51 // 'Speed_Target', 'offset': 0.0, 'order': 'motorola', 'physical_range':
52 // '[0|40.95]', 'physical_unit': 'm/s', 'precision': 0.01, 'type': 'double'}
53 Throttlecommand100* set_speed_target(double speed_target);
54
55 // config detail: {'bit': 15, 'is_signed_var': False, 'len': 10, 'name':
56 // 'Throttle_Acc', 'offset': 0.0, 'order': 'motorola', 'physical_range':
57 // '[0|10]', 'physical_unit': 'm/s^2', 'precision': 0.01, 'type': 'double'}
58 Throttlecommand100* set_throttle_acc(double throttle_acc);
59
60 // config detail: {'bit': 63, 'is_signed_var': False, 'len': 8, 'name':
61 // 'CheckSum_100', 'offset': 0.0, 'order': 'motorola', 'physical_range':
62 // '[0|255]', 'physical_unit': '', 'precision': 1.0, 'type': 'int'}
63 Throttlecommand100* set_checksum_100(int checksum_100);
64
65 // config detail: {'bit': 31, 'description': 'command', 'is_signed_var':
66 // False, 'len': 16, 'name': 'Throttle_Pedal_Target', 'offset': 0.0, 'order':
67 // 'motorola', 'physical_range': '[0|100]', 'physical_unit': '%', 'precision':
68 // 0.1, 'signal_type': 'command', 'type': 'double'}
69 Throttlecommand100* set_throttle_pedal_target(double throttle_pedal_target);
70
71 // config detail: {'bit': 0, 'description': 'enable', 'enum': {0:
72 // 'THROTTLE_EN_CTRL_DISABLE', 1: 'THROTTLE_EN_CTRL_ENABLE'}, 'is_signed_var':
73 // False, 'len': 1, 'name': 'Throttle_EN_CTRL', 'offset': 0.0, 'order':
74 // 'motorola', 'physical_range': '[0|1]', 'physical_unit': '',
75 // 'precision': 1.0, 'signal_type': 'enable', 'type': 'enum'}
78
79 private:
80 // config detail: {'bit': 7, 'is_signed_var': False, 'len': 4, 'name':
81 // 'Heartbeat_100', 'offset': 0.0, 'order': 'motorola', 'physical_range':
82 // '[0|15]', 'physical_unit': '', 'precision': 1.0, 'type': 'int'}
83 void set_p_heartbeat_100(uint8_t* data, int heartbeat_100);
84
85 // config detail: {'bit': 47, 'is_signed_var': False, 'len': 12, 'name':
86 // 'Speed_Target', 'offset': 0.0, 'order': 'motorola', 'physical_range':
87 // '[0|40.95]', 'physical_unit': 'm/s', 'precision': 0.01, 'type': 'double'}
88 void set_p_speed_target(uint8_t* data, double speed_target);
89
90 // config detail: {'bit': 15, 'is_signed_var': False, 'len': 10, 'name':
91 // 'Throttle_Acc', 'offset': 0.0, 'order': 'motorola', 'physical_range':
92 // '[0|10]', 'physical_unit': 'm/s^2', 'precision': 0.01, 'type': 'double'}
93 void set_p_throttle_acc(uint8_t* data, double throttle_acc);
94
95 // config detail: {'bit': 63, 'is_signed_var': False, 'len': 8, 'name':
96 // 'CheckSum_100', 'offset': 0.0, 'order': 'motorola', 'physical_range':
97 // '[0|255]', 'physical_unit': '', 'precision': 1.0, 'type': 'int'}
98 void set_p_checksum_100(uint8_t* data, int checksum_100);
99
100 // config detail: {'bit': 31, 'description': 'command', 'is_signed_var':
101 // False, 'len': 16, 'name': 'Throttle_Pedal_Target', 'offset': 0.0, 'order':
102 // 'motorola', 'physical_range': '[0|100]', 'physical_unit': '%', 'precision':
103 // 0.1, 'signal_type': 'command', 'type': 'double'}
104 void set_p_throttle_pedal_target(uint8_t* data, double throttle_pedal_target);
105
106 // config detail: {'bit': 0, 'description': 'enable', 'enum': {0:
107 // 'THROTTLE_EN_CTRL_DISABLE', 1: 'THROTTLE_EN_CTRL_ENABLE'}, 'is_signed_var':
108 // False, 'len': 1, 'name': 'Throttle_EN_CTRL', 'offset': 0.0, 'order':
109 // 'motorola', 'physical_range': '[0|1]', 'physical_unit': '',
110 // 'precision': 1.0, 'signal_type': 'enable', 'type': 'enum'}
111 void set_p_throttle_en_ctrl(
112 uint8_t* data,
114
115 int heartbeat_100(const std::uint8_t* bytes, const int32_t length) const;
116
117 double speed_target(const std::uint8_t* bytes, const int32_t length) const;
118
119 double throttle_acc(const std::uint8_t* bytes, const int32_t length) const;
120
121 int checksum_100(const std::uint8_t* bytes, const int32_t length) const;
122
123 double throttle_pedal_target(const std::uint8_t* bytes,
124 const int32_t length) const;
125
127 const std::uint8_t* bytes, const int32_t length) const;
128
129 private:
130 int heartbeat_100_;
131 double speed_target_;
132 double throttle_acc_;
133 int checksum_100_;
134 double throttle_pedal_target_;
136};
137
138} // namespace demo
139} // namespace canbus
140} // namespace apollo
void UpdateData_Heartbeat(uint8_t *data) override
Throttlecommand100 * set_heartbeat_100(int heartbeat_100)
Throttlecommand100 * set_throttle_en_ctrl(Throttle_command_100::Throttle_en_ctrlType throttle_en_ctrl)
void Parse(const std::uint8_t *bytes, int32_t length, Demo *chassis) const override
Throttlecommand100 * set_throttle_pedal_target(double throttle_pedal_target)
Throttlecommand100 * set_checksum_100(int checksum_100)
Throttlecommand100 * set_speed_target(double speed_target)
Throttlecommand100 * set_throttle_acc(double throttle_acc)
This is the base class of protocol data.
class register implement
Definition arena_queue.h:37
The class of ProtocolData