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