时间间隔 -- 软件模拟iic的情况下
目前测试代码如下:
create_process(&test_id, "test",NULL, test, (int)(DELTA_TIME*1000));
对于test函数的调用时间设置的是10ms调用一次,test代码如下:
void test(){
signed short acc_data_buf[3] = {0};
signed short gyr_data_buf[3] = {0};
signed short acc_gyro_input[6] = {0};
float Angle_output[3] = {0};
SL_SC7U22_RawData_Read(acc_data_buf,gyr_data_buf);
BLE_send_data = sensor_processing_task(acc_data_buf, gyr_data_buf);
//----省略-----
//一些ble数据发送
memset(&BLE_send_data, 0, sizeof(BLE_send_data_t));
memset(&data, 0, 50);
// xlog("end============\n");
}
sensor_processing_task当中就进行了计算,包括卡尔曼等,在timer设置成10ms的情况下,实际上test函数(或者是sensor_processing_task函数),距离上次调用到本次调用,实际间隔为40ms
计算距离不能直接采用timers设置的时间间隔作为dt来求距离,实际每次计算求速度的时间应该是40ms
11.13
代码主要文件夹:apps\earphone\xtell_Sensor
-
apps\earphone\xtell_Sensor\send_data.c,‘ xtell_task_create ’ 函数,传感器计算程序逻辑开始位置,包括传感器读取数据的任务、蓝牙发送任务、速度距离计算任务
-
apps\earphone\xtell_Sensor\calculate:目前只有计算传感器去除重力分量的代码
- 问题:存在漂移
-
水平的情况下三轴去掉重力分量,计算出来的结果, 误差有0.0x m/s^s
- original(g): x -0.02, y 0.00, z 1.00 device(m/s^2) no g: x -0.08, y -0.01, z -0.04, all 0.08
-
在板子任意倾斜角度下,去掉各轴重力分量的情况下,误差有0.3x m/s^s
-
===original(g): x -0.20, y -0.85, z 0.41===
-
===device(m/s^2) no g: x 0.06, y 0.31, z -0.10, all 0.33===
-
-
- 问题:存在漂移
-
apps\earphone\xtell_Sensor\sensor:传感器驱动,参与编译的为SC7U22.c和SC7U22.h
-
apps\earphone\xtell_Sensor\A_hide:速度和距离计算代码
- 最新一版为apps\earphone\xtell_Sensor\A_hide\10\,水平距离测速2、3m误差
- 要使用只需要把代码复制粘贴到calculate文件夹下
11.18
去除重力分量后仍有误差:
- 数据对齐?
- 有没有丢数据?
- 重复定位的数据?
- 静态时的角度误差?