Apollo 10.0
自动驾驶开放平台
turnsignal_command_113.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2019 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
19
20namespace apollo {
21namespace canbus {
22namespace ch {
23
24using ::apollo::drivers::canbus::Byte;
25
26const int32_t Turnsignalcommand113::ID = 0x113;
27
28// public
30
32 // TODO(All) : modify every protocol's period manually
33 static const uint32_t PERIOD = 20 * 1000;
34 return PERIOD;
35}
36
38 set_p_turn_signal_cmd(data, turn_signal_cmd_);
39 set_p_low_beam_cmd(data, low_beam_cmd_);
40}
41
43 // TODO(All) : you should check this manually
46}
47
50 turn_signal_cmd_ = turn_signal_cmd;
51 return this;
52}
53
54// config detail: {'bit': 0, 'description': 'Lighting control(Command)', 'enum':
55// {0: 'TURN_SIGNAL_CMD_NONE', 1: 'TURN_SIGNAL_CMD_LEFT', 2:
56// 'TURN_SIGNAL_CMD_RIGHT', 3: 'TURN_SIGNAL_CMD_HAZARD_WARNING_LAMPSTS'},
57// 'is_signed_var': False, 'len': 8, 'name': 'TURN_SIGNAL_CMD', 'offset': 0.0,
58// 'order': 'intel', 'physical_range': '[0|2]', 'physical_unit': '',
59// 'precision': 1.0, 'type': 'enum'}
60void Turnsignalcommand113::set_p_turn_signal_cmd(
61 uint8_t* data,
63 int x = turn_signal_cmd;
64
65 Byte to_set(data + 0);
66 to_set.set_value(static_cast<uint8_t>(x), 0, 8);
67}
68
71 low_beam_cmd_ = low_beam_cmd;
72 return this;
73}
74
75// config detail: {'bit': 8, 'description': 'Lighting control(Command)', 'enum':
76// {0: 'LOW_BEAM_CMD_OFF', 1: 'LOW_BEAM_CMD_ON'}, 'is_signed_var': False, 'len':
77// 2, 'name': 'LOW_BEAM_CMD', 'offset': 0.0, 'order': 'intel', 'physical_range':
78// '[0|2]', 'physical_unit': '', 'precision': 1.0, 'type': 'enum'}
79void Turnsignalcommand113::set_p_low_beam_cmd(
80 uint8_t* data, Turnsignal_command_113::Low_beam_cmdType low_beam_cmd) {
81 int x = low_beam_cmd;
82
83 Byte to_set(data + 1);
84 to_set.set_value(static_cast<uint8_t>(x), 0, 2);
85}
86} // namespace ch
87} // namespace canbus
88} // namespace apollo
Defines the Byte class.
Turnsignalcommand113 * set_turn_signal_cmd(Turnsignal_command_113::Turn_signal_cmdType turn_signal_cmd)
Turnsignalcommand113 * set_low_beam_cmd(Turnsignal_command_113::Low_beam_cmdType low_beam_cmd)
class register implement
Definition arena_queue.h:37