Apollo 10.0
自动驾驶开放平台
Decode_0A类 参考final

#include <protocol_asensing.h>

类 Decode_0A 继承关系图:
Decode_0A 的协作图:

Public 成员函数

 Decode_0A ()
 
virtual ~Decode_0A ()
 
void subData (const uint8_t *sub_address, int &index)
 
- Public 成员函数 继承自 ProtocolAsensing
 ProtocolAsensing ()
 
virtual ~ProtocolAsensing ()
 
void addData (const std::string &data)
 
void clearCache ()
 
bool registProtocol (const std::string &protocolFlag, int length, ProtocolAsensing *sub)
 
void toQuaternion (double *rpy, double *quaterArray)
 
int getLength (const std::string &flag)
 
uint32_t getDataSize ()
 
void changeLength (const std::string &flag, int len)
 
std::string getProtocol ()
 

详细描述

在文件 protocol_asensing.h120 行定义.

构造及析构函数说明

◆ Decode_0A()

Decode_0A::Decode_0A ( )
explicit

在文件 decode_0A.cc21 行定义.

21 {
22 filename1 = "BDDB0A.csv";
23 content1 =
24 "GyroX_degps,GyroY_degps,GyroZ_degps,AccX_g,AccY_g,AccZ_g,T_deg[0],"
25 "SysTime_ms";
26
27 // createFileAndWrite(filename1, content1);
28
29 registProtocol(m_type, m_length, this);
30}
bool registProtocol(const std::string &protocolFlag, int length, ProtocolAsensing *sub)

◆ ~Decode_0A()

Decode_0A::~Decode_0A ( )
virtual

在文件 decode_0A.cc32 行定义.

32{}

成员函数说明

◆ subData()

void Decode_0A::subData ( const uint8_t *  sub_address,
int &  index 
)
virtual

重载 ProtocolAsensing .

在文件 decode_0A.cc34 行定义.

34 {
35 int sub_index = 3;
36 uint8_t check_sum = 0;
37 int dataLength = getLength(m_type);
38 /* check xor */
39 for (int i = 0; i < dataLength - 1; ++i) {
40 check_sum ^= sub_address[i];
41 }
42
43 if (check_sum == sub_address[dataLength - 1]) {
44 int16_t middle;
45 sub_index = 3;
46 // gyro
47 float pubMsg_gx = toValue<float>(sub_address, sub_index);
48 float m_msg_gx = pubMsg_gx;
49 float pubMsg_gy = toValue<float>(sub_address, sub_index);
50 float m_msg_gy = pubMsg_gy;
51 float pubMsg_gz = toValue<float>(sub_address, sub_index);
52 float m_msg_gz = pubMsg_gz;
53
54 // acc
55 float pubMsg_ax = toValue<float>(sub_address, sub_index);
56 float m_msg_ax = pubMsg_ax;
57 float pubMsg_ay = toValue<float>(sub_address, sub_index);
58 float m_msg_ay = pubMsg_ay;
59 float pubMsg_az = toValue<float>(sub_address, sub_index);
60 float m_msg_az = pubMsg_az;
61
62 // temp
63 middle = toValue<int16_t>(sub_address, sub_index);
64 float pubMsg_temperature = middle * 200.0 / 32768;
65
66 // time
67 uint32_t timiddle = toValue<uint32_t>(sub_address, sub_index);
68 double time = timiddle * 2.5 * 0.0001;
69
70 index += dataLength;
71
72 // Do not write csv.
73 // std::vector<std::string> data_w;
74 // data_w.clear();
75 // data_w.push_back(std::to_string(pubMsg_gx));
76 // data_w.push_back(std::to_string(pubMsg_gy));
77 // data_w.push_back(std::to_string(pubMsg_gz));
78 // data_w.push_back(std::to_string(pubMsg_ax));
79 // data_w.push_back(std::to_string(pubMsg_ay));
80 // data_w.push_back(std::to_string(pubMsg_az));
81 // data_w.push_back(std::to_string(pubMsg_temperature));
82 // data_w.push_back(std::to_string(time));
83 // if (AppendCsv(filename1, data_w)) {
84 // // std::cout << "数据成功写入到文件 " << filename << "\n";
85 // } else {
86 // std::cerr << "写入文件时出现错误\n";
87 // }
88
89 } else {
90 index += 3;
91 }
92}
int getLength(const std::string &flag)

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