Apollo 10.0
自动驾驶开放平台
turnsignal_68.cc
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2017 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 lincoln {
24
25using ::apollo::drivers::canbus::Byte;
26
27const int32_t Turnsignal68::ID = 0x68;
28
29uint32_t Turnsignal68::GetPeriod() const {
30 static const uint32_t PERIOD = 50 * 1000;
31 return PERIOD;
32}
33
34int32_t Turnsignal68::turn_cmd() const { return turn_cmd_; }
35
36void Turnsignal68::UpdateData(uint8_t *data) {
37 set_turn_cmd_p(data, turn_cmd_);
38}
39
40void Turnsignal68::Reset() { turn_cmd_ = 0; }
41
43 turn_cmd_ = 0x00;
44 return this;
45}
46
48 turn_cmd_ = 0x01;
49 return this;
50}
51
53 turn_cmd_ = 0x02;
54 return this;
55}
56// 0x03 not used
57
58// private
59void Turnsignal68::set_turn_cmd_p(uint8_t *data, int32_t turn_cmd) {
60 turn_cmd = ProtocolData::BoundedValue(0, 3, turn_cmd);
61 Byte frame(data + 0);
62 frame.set_value(static_cast<uint8_t>(turn_cmd), 0, 2);
63}
64
65} // namespace lincoln
66} // namespace canbus
67} // namespace apollo
Defines the Byte class.
one of the protocol data of lincoln vehicle
Turnsignal68 * set_turn_right()
set turn right based on pedal command
virtual void Reset()
reset the private variables
virtual uint32_t GetPeriod() const
get the data period
Turnsignal68 * set_turn_none()
set no-turn based on pedal command
virtual int32_t turn_cmd() const
get the turn command
Turnsignal68 * set_turn_left()
set turn left based on pedal command
virtual void UpdateData(uint8_t *data)
update the data
class register implement
Definition arena_queue.h:37
the class of Turnsignal68 (for lincoln vehicle)