Apollo 10.0
自动驾驶开放平台
turn_cmd_63.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 gem {
24
25using ::apollo::drivers::canbus::Byte;
26
27const int32_t Turncmd63::ID = 0x63;
28
29// public
31
32uint32_t Turncmd63::GetPeriod() const {
33 // TODO(QiL) :modify every protocol's period manually
34 static const uint32_t PERIOD = 20 * 1000;
35 return PERIOD;
36}
37
38void Turncmd63::UpdateData(uint8_t* data) {
39 set_p_turn_signal_cmd(data, turn_signal_cmd_);
40}
41
43 // TODO(QiL) :you should check this manually
44 turn_signal_cmd_ = Turn_cmd_63::TURN_SIGNAL_CMD_NONE;
45}
46
48 Turn_cmd_63::Turn_signal_cmdType turn_signal_cmd) {
49 turn_signal_cmd_ = turn_signal_cmd;
50 return this;
51}
52
53// config detail: {'name': 'TURN_SIGNAL_CMD', 'enum': {0:
54// 'TURN_SIGNAL_CMD_RIGHT', 1: 'TURN_SIGNAL_CMD_NONE', 2:
55// 'TURN_SIGNAL_CMD_LEFT', 3: 'TURN_SIGNAL_CMD_HAZARD'}, 'precision': 1.0,
56// 'len': 8, 'is_signed_var': False, 'offset': 0.0, 'physical_range': '[0|3]',
57// 'bit': 7, 'type': 'enum', 'order': 'motorola', 'physical_unit': ''}
58void Turncmd63::set_p_turn_signal_cmd(
59 uint8_t* data, Turn_cmd_63::Turn_signal_cmdType turn_signal_cmd) {
60 uint8_t x = turn_signal_cmd;
61
62 Byte to_set(data + 0);
63 to_set.set_value(static_cast<uint8_t>(x), 0, 8);
64}
65
66} // namespace gem
67} // namespace canbus
68} // namespace apollo
Defines the Byte class.
Turncmd63 * set_turn_signal_cmd(Turn_cmd_63::Turn_signal_cmdType turn_signal_cmd)
uint32_t GetPeriod() const override
void UpdateData(uint8_t *data) override
static const int32_t ID
Definition turn_cmd_63.h:29
class register implement
Definition arena_queue.h:37