Apollo 10.0
自动驾驶开放平台
ads_drive_command_50.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/neolix_edu/proto/neolix_edu.pb.h"
20
22
23namespace apollo {
24namespace canbus {
25namespace neolix_edu {
26
28 ::apollo::canbus::Neolix_edu> {
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 Neolix_edu* chassis) const override;
38
39 void UpdateData(uint8_t* data) override;
40
41 void Reset() override;
42
43 // config detail: {'description': '0x0:disable ;0x1:enable', 'offset': 0.0,
44 // 'precision': 1.0, 'len': 1, 'name': 'Drive_Enable', 'is_signed_var': False,
45 // 'physical_range': '[0|0]', 'bit': 0, 'type': 'bool', 'order': 'motorola',
46 // 'physical_unit': ''}
47 Adsdrivecommand50* set_drive_enable(bool drive_enable);
48
49 // config detail: {'description': '0x0:N ;0x1:D ;0x2:R ;0x3:Reserved ',
50 // 'enum': {0: 'AUTO_SHIFT_COMMAND_N', 1: 'AUTO_SHIFT_COMMAND_D', 2:
51 // 'AUTO_SHIFT_COMMAND_R', 3: 'AUTO_SHIFT_COMMAND_RESERVED'},
52 // 'precision': 1.0, 'len': 2, 'name': 'AUTO_Shift_Command', 'is_signed_var':
53 // False, 'offset': 0.0, 'physical_range': '[0|3]', 'bit': 9, 'type': 'enum',
54 // 'order': 'motorola', 'physical_unit': ''}
57
58 // config detail: {'name': 'AUTO_Drive_Torque', 'offset': -665.0, 'precision':
59 // 0.02, 'len': 16, 'is_signed_var': False, 'physical_range': '[0|0]', 'bit':
60 // 23, 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
61 Adsdrivecommand50* set_auto_drive_torque(double auto_drive_torque);
62
63 // config detail: {'name': 'AUTO_DriverCmd_AliveCounter', 'offset': 0.0,
64 // 'precision': 1.0, 'len': 4, 'is_signed_var': False, 'physical_range':
65 // '[0|0]', 'bit': 51, 'type': 'int', 'order': 'motorola', 'physical_unit':
66 // ''}
68 int auto_drivercmd_alivecounter);
69
70 // config detail: {'name': 'AUTO_DriverCmd_CheckSum', 'offset': 0.0,
71 // 'precision': 1.0, 'len': 8, 'is_signed_var': False, 'physical_range':
72 // '[0|0]', 'bit': 63, 'type': 'int', 'order': 'motorola', 'physical_unit':
73 // ''}
74 Adsdrivecommand50* set_auto_drivercmd_checksum(int auto_drivercmd_checksum);
75
76 private:
77 // config detail: {'description': '0x0:disable ;0x1:enable', 'offset': 0.0,
78 // 'precision': 1.0, 'len': 1, 'name': 'Drive_Enable', 'is_signed_var': False,
79 // 'physical_range': '[0|0]', 'bit': 0, 'type': 'bool', 'order': 'motorola',
80 // 'physical_unit': ''}
81 void set_p_drive_enable(uint8_t* data, bool drive_enable);
82
83 // config detail: {'description': '0x0:N ;0x1:D ;0x2:R ;0x3:Reserved ',
84 // 'enum': {0: 'AUTO_SHIFT_COMMAND_N', 1: 'AUTO_SHIFT_COMMAND_D', 2:
85 // 'AUTO_SHIFT_COMMAND_R', 3: 'AUTO_SHIFT_COMMAND_RESERVED'},
86 // 'precision': 1.0, 'len': 2, 'name': 'AUTO_Shift_Command', 'is_signed_var':
87 // False, 'offset': 0.0, 'physical_range': '[0|3]', 'bit': 9, 'type': 'enum',
88 // 'order': 'motorola', 'physical_unit': ''}
89 void set_p_auto_shift_command(
90 uint8_t* data,
92
93 // config detail: {'name': 'AUTO_Drive_Torque', 'offset': -665.0, 'precision':
94 // 0.02, 'len': 16, 'is_signed_var': False, 'physical_range': '[0|0]', 'bit':
95 // 23, 'type': 'double', 'order': 'motorola', 'physical_unit': ''}
96 void set_p_auto_drive_torque(uint8_t* data, double auto_drive_torque);
97
98 // config detail: {'name': 'AUTO_DriverCmd_AliveCounter', 'offset': 0.0,
99 // 'precision': 1.0, 'len': 4, 'is_signed_var': False, 'physical_range':
100 // '[0|0]', 'bit': 51, 'type': 'int', 'order': 'motorola', 'physical_unit':
101 // ''}
102 void set_p_auto_drivercmd_alivecounter(uint8_t* data,
103 int auto_drivercmd_alivecounter);
104
105 // config detail: {'name': 'AUTO_DriverCmd_CheckSum', 'offset': 0.0,
106 // 'precision': 1.0, 'len': 8, 'is_signed_var': False, 'physical_range':
107 // '[0|0]', 'bit': 63, 'type': 'int', 'order': 'motorola', 'physical_unit':
108 // ''}
109 void set_p_auto_drivercmd_checksum(uint8_t* data,
110 int auto_drivercmd_checksum);
111
112 bool drive_enable(const std::uint8_t* bytes, const int32_t length) const;
113
115 const std::uint8_t* bytes, int32_t length) const;
116
117 double auto_drive_torque(const std::uint8_t* bytes, int32_t length) const;
118
119 private:
120 bool drive_enable_;
122 double auto_drive_torque_;
123 int auto_drivercmd_alivecounter_;
124 int auto_drivercmd_checksum_;
125};
126
127} // namespace neolix_edu
128} // namespace canbus
129} // namespace apollo
Adsdrivecommand50 * set_auto_drive_torque(double auto_drive_torque)
Adsdrivecommand50 * set_auto_drivercmd_alivecounter(int auto_drivercmd_alivecounter)
Adsdrivecommand50 * set_auto_shift_command(Ads_drive_command_50::Auto_shift_commandType auto_shift_command)
void Parse(const std::uint8_t *bytes, int32_t length, Neolix_edu *chassis) const override
Adsdrivecommand50 * set_drive_enable(bool drive_enable)
Adsdrivecommand50 * set_auto_drivercmd_checksum(int auto_drivercmd_checksum)
This is the base class of protocol data.
class register implement
Definition arena_queue.h:37
The class of ProtocolData