Apollo 10.0
自动驾驶开放平台
apollo::canbus::demo::Gearcommand103类 参考

#include <gear_command_103.h>

类 apollo::canbus::demo::Gearcommand103 继承关系图:
apollo::canbus::demo::Gearcommand103 的协作图:

Public 成员函数

 Gearcommand103 ()
 
uint32_t GetPeriod () const override
 
void Parse (const std::uint8_t *bytes, int32_t length, Demo *chassis) const override
 
void UpdateData_Heartbeat (uint8_t *data) override
 
void UpdateData (uint8_t *data) override
 
void Reset () override
 
Gearcommand103set_heartbeat_103 (int heartbeat_103)
 
Gearcommand103set_gear_target (Gear_command_103::Gear_targetType gear_target)
 
Gearcommand103set_gear_en_ctrl (Gear_command_103::Gear_en_ctrlType gear_en_ctrl)
 
Gearcommand103set_checksum_103 (int checksum_103)
 
- Public 成员函数 继承自 apollo::drivers::canbus::ProtocolData<::apollo::canbus::Demo >
 ProtocolData ()=default
 construct protocol data.
 
virtual ~ProtocolData ()=default
 destruct protocol data.
 
virtual int32_t GetLength () const
 
virtual void Parse (const uint8_t *bytes, int32_t length, ::apollo::canbus::Demo *sensor_data) const
 

静态 Public 属性

static const int32_t ID = 0x103
 

额外继承的成员函数

- 静态 Public 成员函数 继承自 apollo::drivers::canbus::ProtocolData<::apollo::canbus::Demo >
static std::uint8_t CalculateCheckSum (const uint8_t *input, const uint32_t length)
 static function, used to calculate the checksum of input array.
 
static T BoundedValue (T lower, T upper, T val)
 

详细描述

在文件 gear_command_103.h27 行定义.

构造及析构函数说明

◆ Gearcommand103()

apollo::canbus::demo::Gearcommand103::Gearcommand103 ( )

在文件 gear_command_103.cc30 行定义.

成员函数说明

◆ GetPeriod()

uint32_t apollo::canbus::demo::Gearcommand103::GetPeriod ( ) const
overridevirtual

重载 apollo::drivers::canbus::ProtocolData<::apollo::canbus::Demo > .

在文件 gear_command_103.cc32 行定义.

32 {
33 // TODO(All) : modify every protocol's period manually
34 static const uint32_t PERIOD = 20 * 1000;
35 return PERIOD;
36}

◆ Parse()

void apollo::canbus::demo::Gearcommand103::Parse ( const std::uint8_t *  bytes,
int32_t  length,
Demo chassis 
) const
override

在文件 gear_command_103.cc38 行定义.

39 {
40 chassis->mutable_gear_command_103()->set_heartbeat_103(
41 heartbeat_103(bytes, length));
42 chassis->mutable_gear_command_103()->set_gear_target(
43 gear_target(bytes, length));
44 chassis->mutable_gear_command_103()->set_gear_en_ctrl(
45 gear_en_ctrl(bytes, length));
46 chassis->mutable_gear_command_103()->set_checksum_103(
47 checksum_103(bytes, length));
48}

◆ Reset()

void apollo::canbus::demo::Gearcommand103::Reset ( )
overridevirtual

重载 apollo::drivers::canbus::ProtocolData<::apollo::canbus::Demo > .

在文件 gear_command_103.cc65 行定义.

65 {
66 // TODO(All) : you should check this manually
67 heartbeat_103_ = 0;
70 checksum_103_ = 0;
71}

◆ set_checksum_103()

Gearcommand103 * apollo::canbus::demo::Gearcommand103::set_checksum_103 ( int  checksum_103)

在文件 gear_command_103.cc129 行定义.

129 {
130 checksum_103_ = checksum_103;
131 return this;
132}

◆ set_gear_en_ctrl()

Gearcommand103 * apollo::canbus::demo::Gearcommand103::set_gear_en_ctrl ( Gear_command_103::Gear_en_ctrlType  gear_en_ctrl)

在文件 gear_command_103.cc109 行定义.

110 {
111 gear_en_ctrl_ = gear_en_ctrl;
112 return this;
113}

◆ set_gear_target()

Gearcommand103 * apollo::canbus::demo::Gearcommand103::set_gear_target ( Gear_command_103::Gear_targetType  gear_target)

在文件 gear_command_103.cc89 行定义.

90 {
91 gear_target_ = gear_target;
92 return this;
93}

◆ set_heartbeat_103()

Gearcommand103 * apollo::canbus::demo::Gearcommand103::set_heartbeat_103 ( int  heartbeat_103)

在文件 gear_command_103.cc73 行定义.

73 {
74 heartbeat_103_ = heartbeat_103;
75 return this;
76}

◆ UpdateData()

void apollo::canbus::demo::Gearcommand103::UpdateData ( uint8_t *  data)
overridevirtual

重载 apollo::drivers::canbus::ProtocolData<::apollo::canbus::Demo > .

在文件 gear_command_103.cc60 行定义.

60 {
61 set_p_gear_target(data, gear_target_);
62 set_p_gear_en_ctrl(data, gear_en_ctrl_);
63}

◆ UpdateData_Heartbeat()

void apollo::canbus::demo::Gearcommand103::UpdateData_Heartbeat ( uint8_t *  data)
overridevirtual

重载 apollo::drivers::canbus::ProtocolData<::apollo::canbus::Demo > .

在文件 gear_command_103.cc50 行定义.

50 {
51 // TODO(All) : you should add the heartbeat manually
52 ++heartbeat_103_;
53 heartbeat_103_ = (heartbeat_103_) % 16;
54 set_p_heartbeat_103(data, heartbeat_103_);
55 checksum_103_ =
56 data[0] ^ data[1] ^ data[2] ^ data[3] ^ data[4] ^ data[5] ^ data[6];
57 set_p_checksum_103(data, checksum_103_);
58}

类成员变量说明

◆ ID

const int32_t apollo::canbus::demo::Gearcommand103::ID = 0x103
static

在文件 gear_command_103.h30 行定义.


该类的文档由以下文件生成: