对上交代码进行修改,主要将能量机关去掉,添加了同济的PnP位姿解算,但是同济有个四元数,获取IMU部分没有启用,可能导致精度不够。当前还存在反陀螺功能,修改为逻辑和弹道预测相结合,主要在时间关系上进行调整。

This commit is contained in:
2026-03-21 11:57:34 +08:00
commit 56985997ae
80 changed files with 60253 additions and 0 deletions

61
others/include/serial.h Normal file
View File

@@ -0,0 +1,61 @@
#ifndef _SERIAL_H_
#define _SERIAL_H_
#ifdef Windows
#include <Windows.h>
class Serial
{
public:
Serial(UINT baud = CBR_115200, char parity = 'N', UINT databits = 8, UINT stopsbits = 1, DWORD dwCommEvents = EV_RXCHAR);
~Serial();
bool InitPort(UINT portNo = 1, UINT baud = CBR_9600, char parity = 'N', UINT databits = 8, UINT stopsbits = 1, DWORD dwCommEvents = EV_RXCHAR);
UINT GetBytesInCOM() const ;
bool WriteData(const unsigned char* pData, unsigned int length);
bool ReadData(unsigned char* buffer, unsigned int length);
private:
bool openPort(UINT portNo);
void ClosePort();
void ErrorHandler();
private:
HANDLE hComm;
UINT portNo;
UINT baud;
char parity;
UINT databits;
UINT stopsbits;
DWORD dwCommEvents;
};
#elif defined(Linux) || defined(Darwin)
#include <errno.h>
#include <fcntl.h>
#include <termios.h>
#include <unistd.h>
class Serial {
private:
int fd;
int nSpeed;
char nEvent;
int nBits;
int nStop;
int set_opt(int fd, int nSpeed, char nEvent, int nBits, int nStop);
public:
Serial(int nSpeed = 115200, char nEvent = 'N', int nBits = 8, int nStop = 1);
~Serial();
bool InitPort(int nSpeed = 115200, char nEvent = 'N', int nBits = 8, int nStop = 1);
// int GetBytesInCOM() const ;
bool WriteData(const unsigned char* pData, unsigned int length);
bool ReadData(unsigned char* buffer, unsigned int length);
};
#endif
#endif /* _SERIAL_H_ */