最近在用Stm32F4写在姿态解算,上位机显示用的是第七实验室的miniAHRS上位机,但是刷新频率略低,因此自己用QT重新写了一个
姿态解算部分见另一篇帖子:
http://www.amobbs.com/forum.php? ... p;page=1#pid7713903
这里重点说说新写的上位机,主要用于acel gyro mag roll pitch yaw这些调试信息的显示
1、波特率最高达4000 000
2、显示范围可以滚轮缩放
通讯协议:
- 关于serialScope协议:
- package head(2Byte): 0xA5 0x5A
- package length(1 Byte):
- package ID:
- package data:
- chucksum
- package tail: 0xAA
- ==========================
- ID:
- #define ACCEL_ID 0x00
- #define GYRO_ID 0x01
- #define MAG_ID 0x02
- #define RPY_ID 0x03
- 有需要可以自己添加
- //demo
- void print_sensor(float data[3], uint8_t id)
- {
- int16_t sendData[3];
- uint8_t buf[32] = {0};
- uint8_t checksum = 0;
- uint8_t i = 0;
- sendData[0] = data[0]*100;
- sendData[1] = data[1]*100;
- sendData[2] = data[2]*100;
- //file head
- buf[0] = 0xa5;
- buf[1] = 0x5a;
- //length
- buf[2] = 10;
- //id
- buf[3] = id;
- buf[4] = (sendData[0] >> 8) & 0xff;
- buf[5] = sendData[0] & 0xff;
- buf[6] = (sendData[1] >> 8) & 0xff;
- buf[7] = sendData[1] & 0xff;
- buf[8] = (sendData[2] >> 8) & 0xff;
- buf[9] = sendData[2] & 0xff;
- for( i = 2; i <= 9; i++)
- {
- checksum += buf;
- }
- buf[10] = checksum;
- buf[11] = 0xAA;
- USART_send_hex(USART3, (char*)buf, 24);
- }
|