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

one of the protocol data of lincoln vehicle 更多...

#include <throttle_63.h>

类 apollo::canbus::lincoln::Throttle63 继承关系图:
apollo::canbus::lincoln::Throttle63 的协作图:

Public 成员函数

virtual void Parse (const std::uint8_t *bytes, int32_t length, Lincoln *chassis_detail) const
 
double pedal_input (const std::uint8_t *bytes, int32_t length) const
 calculate pedal input based on byte array.
 
double pedal_cmd (const std::uint8_t *bytes, int32_t length) const
 calculate pedal command based on byte array.
 
double pedal_output (const std::uint8_t *bytes, int32_t length) const
 calculate pedal output based on byte array.
 
int32_t watchdog_counter_source (const std::uint8_t *bytes, int32_t length) const
 calculate watchdog counter source based on byte array.
 
bool is_enabled (const std::uint8_t *bytes, int32_t length) const
 check enabled bit based on byte array.
 
bool is_driver_override (const std::uint8_t *bytes, int32_t length) const
 check driver override bit based on byte array.
 
bool is_driver_activity (const std::uint8_t *bytes, int32_t length) const
 check driver activity bit based on byte array.
 
bool is_watchdog_counter_fault (const std::uint8_t *bytes, int32_t length) const
 check watchdog counter fault bit based on byte array.
 
bool is_channel_1_fault (const std::uint8_t *bytes, int32_t length) const
 check channel 1 fault bit based on byte array.
 
bool is_channel_2_fault (const std::uint8_t *bytes, int32_t length) const
 check channel 2 fault bit based on byte array.
 
bool is_connector_fault (const std::uint8_t *bytes, int32_t length) const
 check connector fault bit based on byte array.
 
- Public 成员函数 继承自 apollo::drivers::canbus::ProtocolData< ::apollo::canbus::Lincoln >
 ProtocolData ()=default
 construct protocol data.
 
virtual ~ProtocolData ()=default
 destruct protocol data.
 
virtual uint32_t GetPeriod () const
 
virtual int32_t GetLength () const
 
virtual void Parse (const uint8_t *bytes, int32_t length, ::apollo::canbus::Lincoln *sensor_data) const
 
virtual void UpdateData (uint8_t *data)
 
virtual void UpdateData_Heartbeat (uint8_t *data)
 
virtual void Reset ()
 

静态 Public 属性

static const int32_t ID = 0x63
 

额外继承的成员函数

- 静态 Public 成员函数 继承自 apollo::drivers::canbus::ProtocolData< ::apollo::canbus::Lincoln >
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)
 

详细描述

one of the protocol data of lincoln vehicle

在文件 throttle_63.h40 行定义.

成员函数说明

◆ is_channel_1_fault()

bool apollo::canbus::lincoln::Throttle63::is_channel_1_fault ( const std::uint8_t *  bytes,
int32_t  length 
) const

check channel 1 fault bit based on byte array.

config detail: {'name': 'flt1', 'offset': 0.0, 'precision': 1.0, 'len': 1, 'f_type': 'valid', 'is_signed_var': False, 'physical_range': '[0|0]', 'bit': 60, 'type': 'bool', 'order': 'intel', 'physical_unit': '""'}

参数
bytesa pointer to the byte array
lengththe length of the byte array
返回
the boolean value of channel 1 fault bit

在文件 throttle_63.cc126 行定义.

127 {
128 Byte frame(bytes + 7);
129 return frame.is_bit_1(4);
130}

◆ is_channel_2_fault()

bool apollo::canbus::lincoln::Throttle63::is_channel_2_fault ( const std::uint8_t *  bytes,
int32_t  length 
) const

check channel 2 fault bit based on byte array.

config detail: {'name': 'flt2', 'offset': 0.0, 'precision': 1.0, 'len': 1, 'f_type': 'valid', 'is_signed_var': False, 'physical_range': '[0|0]', 'bit': 61, 'type': 'bool', 'order': 'intel', 'physical_unit': '""'}

参数
bytesa pointer to the byte array
lengththe length of the byte array
返回
the boolean value of channel 2 fault bit

在文件 throttle_63.cc132 行定义.

133 {
134 Byte frame(bytes + 7);
135 return frame.is_bit_1(5);
136}

◆ is_connector_fault()

bool apollo::canbus::lincoln::Throttle63::is_connector_fault ( const std::uint8_t *  bytes,
int32_t  length 
) const

check connector fault bit based on byte array.

config detail: {'name': 'fltcon', 'offset': 0.0, 'precision': 1.0, 'len': 1, 'f_type': 'valid', 'is_signed_var': False, 'physical_range': '[0|0]', 'bit': 63, 'type': 'bool', 'order': 'intel', 'physical_unit': '""'}

参数
bytesa pointer to the byte array
lengththe length of the byte array
返回
the boolean value of connector fault bit

在文件 throttle_63.cc138 行定义.

139 {
140 Byte frame(bytes + 7);
141 return frame.is_bit_1(7);
142}

◆ is_driver_activity()

bool apollo::canbus::lincoln::Throttle63::is_driver_activity ( const std::uint8_t *  bytes,
int32_t  length 
) const

check driver activity bit based on byte array.

config detail: {'name': 'driver', 'offset': 0.0, 'precision': 1.0, 'len': 1, 'f_type': 'valid', 'is_signed_var': False, 'physical_range': '[0|0]', 'bit': 58, 'type': 'bool', 'order': 'intel', 'physical_unit': '""'}

参数
bytesa pointer to the byte array
lengththe length of the byte array
返回
the boolean value of driver activity

在文件 throttle_63.cc114 行定义.

115 {
116 Byte frame(bytes + 7);
117 return frame.is_bit_1(2);
118}

◆ is_driver_override()

bool apollo::canbus::lincoln::Throttle63::is_driver_override ( const std::uint8_t *  bytes,
int32_t  length 
) const

check driver override bit based on byte array.

config detail: {'name': 'override', 'offset': 0.0, 'precision': 1.0, 'len': 1, 'f_type': 'valid', 'is_signed_var': False, 'physical_range': '[0|0]', 'bit': 57, 'type': 'bool', 'order': 'intel', 'physical_unit': '""'}

参数
bytesa pointer to the byte array
lengththe length of the byte array
返回
the boolean value of driver override

在文件 throttle_63.cc108 行定义.

109 {
110 Byte frame(bytes + 7);
111 return frame.is_bit_1(1);
112}

◆ is_enabled()

bool apollo::canbus::lincoln::Throttle63::is_enabled ( const std::uint8_t *  bytes,
int32_t  length 
) const

check enabled bit based on byte array.

config detail: {'name': 'en', 'offset': 0.0, 'precision': 1.0, 'len': 1, 'f_type': 'valid', 'is_signed_var': False, 'physical_range': '[0|0]', 'bit': 56, 'type': 'bool', 'order': 'intel', 'physical_unit': '""'}

参数
bytesa pointer to the byte array
lengththe length of the byte array
返回
the boolean value of enabled bit

在文件 throttle_63.cc103 行定义.

103 {
104 Byte frame(bytes + 7);
105 return frame.is_bit_1(0);
106}

◆ is_watchdog_counter_fault()

bool apollo::canbus::lincoln::Throttle63::is_watchdog_counter_fault ( const std::uint8_t *  bytes,
int32_t  length 
) const

check watchdog counter fault bit based on byte array.

config detail: {'name': 'fltwdc', 'offset': 0.0, 'precision': 1.0, 'len': 1, 'f_type': 'valid', 'is_signed_var': False, 'physical_range': '[0|0]', 'bit': 59, 'type': 'bool', 'order': 'intel', 'physical_unit': '""'}

参数
bytesa pointer to the byte array
lengththe length of the byte array
返回
the boolean value of watchdog counter fault bit

在文件 throttle_63.cc120 行定义.

121 {
122 Byte frame(bytes + 7);
123 return frame.is_bit_1(3);
124}

◆ Parse()

void apollo::canbus::lincoln::Throttle63::Parse ( const std::uint8_t *  bytes,
int32_t  length,
Lincoln chassis_detail 
) const
virtual

在文件 throttle_63.cc29 行定义.

30 {
31 chassis_detail->mutable_gas()->set_throttle_input(pedal_input(bytes, length));
32 chassis_detail->mutable_gas()->set_throttle_cmd(pedal_cmd(bytes, length));
33 chassis_detail->mutable_gas()->set_throttle_output(
34 pedal_output(bytes, length));
35 chassis_detail->mutable_gas()->set_watchdog_source(
36 watchdog_counter_source(bytes, length));
37 chassis_detail->mutable_gas()->set_throttle_enabled(
38 is_enabled(bytes, length));
39 chassis_detail->mutable_gas()->set_driver_override(
40 is_driver_override(bytes, length));
41 chassis_detail->mutable_gas()->set_driver_activity(
42 is_driver_activity(bytes, length));
43 chassis_detail->mutable_gas()->set_watchdog_fault(
44 is_watchdog_counter_fault(bytes, length));
45 chassis_detail->mutable_gas()->set_channel_1_fault(
46 is_channel_1_fault(bytes, length));
47 chassis_detail->mutable_gas()->set_channel_2_fault(
48 is_channel_2_fault(bytes, length));
49 chassis_detail->mutable_gas()->set_connector_fault(
50 is_connector_fault(bytes, length));
51 chassis_detail->mutable_check_response()->set_is_vcu_online(
52 !is_driver_override(bytes, length));
53}
bool is_driver_override(const std::uint8_t *bytes, int32_t length) const
check driver override bit based on byte array.
double pedal_cmd(const std::uint8_t *bytes, int32_t length) const
calculate pedal command based on byte array.
double pedal_output(const std::uint8_t *bytes, int32_t length) const
calculate pedal output based on byte array.
bool is_connector_fault(const std::uint8_t *bytes, int32_t length) const
check connector fault bit based on byte array.
double pedal_input(const std::uint8_t *bytes, int32_t length) const
calculate pedal input based on byte array.
bool is_channel_2_fault(const std::uint8_t *bytes, int32_t length) const
check channel 2 fault bit based on byte array.
bool is_watchdog_counter_fault(const std::uint8_t *bytes, int32_t length) const
check watchdog counter fault bit based on byte array.
bool is_enabled(const std::uint8_t *bytes, int32_t length) const
check enabled bit based on byte array.
bool is_channel_1_fault(const std::uint8_t *bytes, int32_t length) const
check channel 1 fault bit based on byte array.
bool is_driver_activity(const std::uint8_t *bytes, int32_t length) const
check driver activity bit based on byte array.
int32_t watchdog_counter_source(const std::uint8_t *bytes, int32_t length) const
calculate watchdog counter source based on byte array.

◆ pedal_cmd()

double apollo::canbus::lincoln::Throttle63::pedal_cmd ( const std::uint8_t *  bytes,
int32_t  length 
) const

calculate pedal command based on byte array.

config detail: {'name': 'pc', 'offset': 0.0, 'precision': 1.52590218966964e-05, 'len': 16, 'f_type': 'value', 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 16, 'type': 'double', 'order': 'intel', 'physical_unit': '"%"'}

参数
bytesa pointer to the byte array
lengththe length of the byte array
返回
the value of pedal command

在文件 throttle_63.cc69 行定义.

69 {
70 // Pedal Command from the command message
71 Byte frame_high(bytes + 3);
72 int32_t high = frame_high.get_byte(0, 8);
73 Byte frame_low(bytes + 2);
74 int32_t low = frame_low.get_byte(0, 8);
75 int32_t value = (high << 8) | low;
76 // control needs a value in range [0, 100] %
77 double output = 100.0 * value * 1.52590218966964e-05;
78 output = ProtocolData::BoundedValue(0.0, 100.0, output);
79 return output;
80}

◆ pedal_input()

double apollo::canbus::lincoln::Throttle63::pedal_input ( const std::uint8_t *  bytes,
int32_t  length 
) const

calculate pedal input based on byte array.

config detail: {'name': 'pi', 'offset': 0.0, 'precision': 1.52590218966964e-05, 'len': 16, 'f_type': 'value', 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 0, 'type': 'double', 'order': 'intel', 'physical_unit': '"%"'}

参数
bytesa pointer to the byte array
lengththe length of the byte array
返回
the value of byte input

在文件 throttle_63.cc55 行定义.

56 {
57 // Pedal Input from the physical pedal
58 Byte frame_high(bytes + 1);
59 int32_t high = frame_high.get_byte(0, 8);
60 Byte frame_low(bytes + 0);
61 int32_t low = frame_low.get_byte(0, 8);
62 int32_t value = (high << 8) | low;
63 // control needs a value in range [0, 100] %
64 double output = 100.0 * value * 1.52590218966964e-05;
65 output = ProtocolData::BoundedValue(0.0, 100.0, output);
66 return output;
67}

◆ pedal_output()

double apollo::canbus::lincoln::Throttle63::pedal_output ( const std::uint8_t *  bytes,
int32_t  length 
) const

calculate pedal output based on byte array.

config detail: {'name': 'po', 'offset': 0.0, 'precision': 1.52590218966964e-05, 'len': 16, 'f_type': 'value', 'is_signed_var': False, 'physical_range': '[0|1]', 'bit': 32, 'type': 'double', 'order': 'intel', 'physical_unit': '"%"'}

参数
bytesa pointer to the byte array
lengththe length of the byte array
返回
the value of pedal output

在文件 throttle_63.cc82 行定义.

83 {
84 // Pedal Output is the maximum of PI and PC
85 Byte frame_high(bytes + 5);
86 int32_t high = frame_high.get_byte(0, 8);
87 Byte frame_low(bytes + 4);
88 int32_t low = frame_low.get_byte(0, 8);
89 int32_t value = (high << 8) | low;
90 // control needs a value in range [0, 100] %
91 double output = 100.0 * value * 1.52590218966964e-05;
92 output = ProtocolData::BoundedValue(0.0, 100.0, output);
93 return output;
94}

◆ watchdog_counter_source()

int32_t apollo::canbus::lincoln::Throttle63::watchdog_counter_source ( const std::uint8_t *  bytes,
int32_t  length 
) const

calculate watchdog counter source based on byte array.

config detail: {'name': 'wdcsrc', 'offset': 0.0, 'precision': 1.0, 'len': 4, 'f_type': 'value', 'is_signed_var': False, 'physical_range': '[0|0]', 'bit': 52, 'type': 'int', 'order': 'intel', 'physical_unit': '""'}

参数
bytesa pointer to the byte array
lengththe length of the byte array
返回
the value of watchdog counter source

在文件 throttle_63.cc96 行定义.

97 {
98 Byte frame(bytes + 6);
99 int32_t x = frame.get_byte(4, 4);
100 return x;
101}

类成员变量说明

◆ ID

const int32_t apollo::canbus::lincoln::Throttle63::ID = 0x63
static

在文件 throttle_63.h43 行定义.


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