Apollo 10.0
自动驾驶开放平台
steering_command_102.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_102', 'offset': 0.0, 'order': 'motorola', 'physical_range':
47 // '[0|15]', 'physical_unit': '', 'precision': 1.0, 'type': 'int'}
48 Steeringcommand102* set_heartbeat_102(int heartbeat_102);
49
50 // config detail: {'bit': 0, 'description': 'enable', 'enum': {0:
51 // 'STEER_EN_CTRL_DISABLE', 1: 'STEER_EN_CTRL_ENABLE'}, 'is_signed_var':
52 // False, 'len': 1, 'name': 'Steer_EN_CTRL', 'offset': 0.0, 'order':
53 // 'motorola', 'physical_range': '[0|1]', 'physical_unit': '',
54 // 'precision': 1.0, 'signal_type': 'enable', 'type': 'enum'}
57
58 // config detail: {'bit': 31, 'description': 'command', 'is_signed_var':
59 // False, 'len': 16, 'name': 'Steer_ANGLE_Target', 'offset': -500.0, 'order':
60 // 'motorola', 'physical_range': '[-500|500]', 'physical_unit': 'deg',
61 // 'precision': 1.0, 'signal_type': 'command', 'type': 'int'}
62 Steeringcommand102* set_steer_angle_target(int steer_angle_target);
63
64 // config detail: {'bit': 15, 'is_signed_var': False, 'len': 8, 'name':
65 // 'Steer_ANGLE_SPD_Target', 'offset': 0.0, 'order': 'motorola',
66 // 'physical_range': '[0|250]', 'physical_unit': 'deg/s', 'precision': 1.0,
67 // 'type': 'int'}
68 Steeringcommand102* set_steer_angle_spd_target(int steer_angle_spd_target);
69
70 // config detail: {'bit': 63, 'is_signed_var': False, 'len': 8, 'name':
71 // 'CheckSum_102', 'offset': 0.0, 'order': 'motorola', 'physical_range':
72 // '[0|255]', 'physical_unit': '', 'precision': 1.0, 'type': 'int'}
73 Steeringcommand102* set_checksum_102(int checksum_102);
74
75 private:
76 // config detail: {'bit': 7, 'is_signed_var': False, 'len': 4, 'name':
77 // 'Heartbeat_102', 'offset': 0.0, 'order': 'motorola', 'physical_range':
78 // '[0|15]', 'physical_unit': '', 'precision': 1.0, 'type': 'int'}
79 void set_p_heartbeat_102(uint8_t* data, int heartbeat_102);
80
81 // config detail: {'bit': 0, 'description': 'enable', 'enum': {0:
82 // 'STEER_EN_CTRL_DISABLE', 1: 'STEER_EN_CTRL_ENABLE'}, 'is_signed_var':
83 // False, 'len': 1, 'name': 'Steer_EN_CTRL', 'offset': 0.0, 'order':
84 // 'motorola', 'physical_range': '[0|1]', 'physical_unit': '',
85 // 'precision': 1.0, 'signal_type': 'enable', 'type': 'enum'}
86 void set_p_steer_en_ctrl(
87 uint8_t* data, Steering_command_102::Steer_en_ctrlType steer_en_ctrl);
88
89 // config detail: {'bit': 31, 'description': 'command', 'is_signed_var':
90 // False, 'len': 16, 'name': 'Steer_ANGLE_Target', 'offset': -500.0, 'order':
91 // 'motorola', 'physical_range': '[-500|500]', 'physical_unit': 'deg',
92 // 'precision': 1.0, 'signal_type': 'command', 'type': 'int'}
93 void set_p_steer_angle_target(uint8_t* data, int steer_angle_target);
94
95 // config detail: {'bit': 15, 'is_signed_var': False, 'len': 8, 'name':
96 // 'Steer_ANGLE_SPD_Target', 'offset': 0.0, 'order': 'motorola',
97 // 'physical_range': '[0|250]', 'physical_unit': 'deg/s', 'precision': 1.0,
98 // 'type': 'int'}
99 void set_p_steer_angle_spd_target(uint8_t* data, int steer_angle_spd_target);
100
101 // config detail: {'bit': 63, 'is_signed_var': False, 'len': 8, 'name':
102 // 'CheckSum_102', 'offset': 0.0, 'order': 'motorola', 'physical_range':
103 // '[0|255]', 'physical_unit': '', 'precision': 1.0, 'type': 'int'}
104 void set_p_checksum_102(uint8_t* data, int checksum_102);
105
106 int heartbeat_102(const std::uint8_t* bytes, const int32_t length) const;
107
109 const std::uint8_t* bytes, const int32_t length) const;
110
111 int steer_angle_target(const std::uint8_t* bytes, const int32_t length) const;
112
113 int steer_angle_spd_target(const std::uint8_t* bytes,
114 const int32_t length) const;
115
116 int checksum_102(const std::uint8_t* bytes, const int32_t length) const;
117
118 private:
119 int heartbeat_102_;
121 int steer_angle_target_;
122 int steer_angle_spd_target_;
123 int checksum_102_;
124};
125
126} // namespace demo
127} // namespace canbus
128} // namespace apollo
Steeringcommand102 * set_steer_angle_target(int steer_angle_target)
void UpdateData_Heartbeat(uint8_t *data) override
Steeringcommand102 * set_checksum_102(int checksum_102)
Steeringcommand102 * set_steer_angle_spd_target(int steer_angle_spd_target)
Steeringcommand102 * set_heartbeat_102(int heartbeat_102)
void Parse(const std::uint8_t *bytes, int32_t length, Demo *chassis) const override
Steeringcommand102 * set_steer_en_ctrl(Steering_command_102::Steer_en_ctrlType steer_en_ctrl)
This is the base class of protocol data.
class register implement
Definition arena_queue.h:37
The class of ProtocolData