Apollo
10.0
自动驾驶开放平台
wiper_cmd_90.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
17
#include "
modules/canbus_vehicle/gem/protocol/wiper_cmd_90.h
"
18
19
#include "
modules/drivers/canbus/common/byte.h
"
20
21
namespace
apollo
{
22
namespace
canbus {
23
namespace
gem {
24
25
using ::apollo::drivers::canbus::Byte;
26
27
const
int32_t
Wipercmd90::ID
= 0x90;
28
29
// public
30
Wipercmd90::Wipercmd90
() {
Reset
(); }
31
32
uint32_t
Wipercmd90::GetPeriod
()
const
{
33
// TODO(QiL) :modify every protocol's period manually
34
static
const
uint32_t PERIOD = 20 * 1000;
35
return
PERIOD;
36
}
37
38
void
Wipercmd90::UpdateData
(uint8_t* data) {
39
set_p_wiper_cmd(data, wiper_cmd_);
40
}
41
42
void
Wipercmd90::Reset
() {
43
// TODO(QiL) :you should check this manually
44
wiper_cmd_ =
Wiper_cmd_90::WIPER_CMD_WIPERS_OFF
;
45
}
46
47
Wipercmd90
*
Wipercmd90::set_wiper_cmd
(
Wiper_cmd_90::Wiper_cmdType
wiper_cmd) {
48
wiper_cmd_ = wiper_cmd;
49
return
this
;
50
}
51
52
// config detail: {'name': 'WIPER_CMD', 'enum': {0: 'WIPER_CMD_WIPERS_OFF', 1:
53
// 'WIPER_CMD_INTERMITTENT_1', 2: 'WIPER_CMD_INTERMITTENT_2', 3:
54
// 'WIPER_CMD_INTERMITTENT_3', 4: 'WIPER_CMD_INTERMITTENT_4', 5:
55
// 'WIPER_CMD_INTERMITTENT_5', 6: 'WIPER_CMD_LOW', 7: 'WIPER_CMD_HIGH'},
56
// 'precision': 1.0, 'len': 8, 'is_signed_var': False, 'offset': 0.0,
57
// 'physical_range': '[0|7]', 'bit': 7, 'type': 'enum', 'order': 'motorola',
58
// 'physical_unit': ''}
59
void
Wipercmd90::set_p_wiper_cmd(uint8_t* data,
60
Wiper_cmd_90::Wiper_cmdType
wiper_cmd) {
61
uint8_t x = wiper_cmd;
62
63
Byte to_set(data + 0);
64
to_set.set_value(
static_cast<
uint8_t
>
(x), 0, 8);
65
}
66
67
}
// namespace gem
68
}
// namespace canbus
69
}
// namespace apollo
byte.h
Defines the Byte class.
apollo::canbus::gem::Wipercmd90
Definition
wiper_cmd_90.h:27
apollo::canbus::gem::Wipercmd90::UpdateData
void UpdateData(uint8_t *data) override
Definition
wiper_cmd_90.cc:38
apollo::canbus::gem::Wipercmd90::set_wiper_cmd
Wipercmd90 * set_wiper_cmd(Wiper_cmd_90::Wiper_cmdType wiper_cmd)
Definition
wiper_cmd_90.cc:47
apollo::canbus::gem::Wipercmd90::Wipercmd90
Wipercmd90()
Definition
wiper_cmd_90.cc:30
apollo::canbus::gem::Wipercmd90::ID
static const int32_t ID
Definition
wiper_cmd_90.h:29
apollo::canbus::gem::Wipercmd90::GetPeriod
uint32_t GetPeriod() const override
Definition
wiper_cmd_90.cc:32
apollo::canbus::gem::Wipercmd90::Reset
void Reset() override
Definition
wiper_cmd_90.cc:42
apollo
class register implement
Definition
arena_queue.h:37
apollo::canbus::Wiper_cmd_90::Wiper_cmdType
Wiper_cmdType
Definition
gem.proto:429
apollo::canbus::Wiper_cmd_90::WIPER_CMD_WIPERS_OFF
@ WIPER_CMD_WIPERS_OFF
Definition
gem.proto:430
wiper_cmd_90.h
modules
canbus_vehicle
gem
protocol
wiper_cmd_90.cc