完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
你好。
我正在尝试构建一个完整的运动传感器软件。我正在使用NUCLEO-F411RE和STM32F411RE, SW4STM IDE, LSM9DS1传感器带陀螺仪,加速度计和磁力计。为此,我使用MotionAC,MotionGC和MotionMC实现了X-CUBE-MEMS1库,用于传感器校准。我成功完成了陀螺仪校准,但我无法校准 加速度计和磁力计。 MotionMC库永远不会给我结果。 MotionAC有时给我结果,但仅在“动态校准”模式下,它们不是很准确。我正在做圆周运动试图用所有轴覆盖所有点的最大值。 定义: & sharpdefine ADJUST_ACC_MG 0.061f //2range:0.061mg / LSB //来自数据表的价值 & sharpdefine ADJUST_ACC_G 0.000061f //2range:0.000061g / LSB & sharpdefine ADJUST_GYR_MDPS 8.75f // 2455range:8.75mdps/LSB & sharpdefine ADJUST_GYR_DPS 0.00875f // 2455range:0.00875dps/LSB & sharpdefine ADJUST_MAG_MGAUSS 0.14f //4range:0.14mgauss / LSB & sharpdefine ADJUST_MAG_UT 0.014f //4range:0.014uT/LSB&sharpdefine REPORT_INTERVAL 10 & sharpdefine SAMPLE_FREQUENCY_F 100.0fVariables: SensorAxes_t ACC_Brute; //来自传感器的数据 SensorAxes_t GYR_Brute; //来自传感器的数据 SensorAxes_t MAG_Brute; //来自传感器的数据 SensorAxesFloat_t ACC_Cal; //校准数据 SensorAxesFloat_t GYR_Cal; //校准数据 SensorAxesFloat_t MAG_Cal; //校准数据 uint32_t CounterStamp; // MotionAC MAC_input_t MAC_Input_Brute; MAC_output_t MAC_Params; // MotionMC MMC_Input_t MMC_Input_Brute; MMC_Output_t MMC_Params;初始化: // MotionMC MotionMC_Initialize(REPORT_INTERVAL,1); 每隔10ms由计时器调用: CounterStamp ++; // MotionAC uint8_t is_calibrated = 0; MAC_Input_Brute.TimeStamp = CounterStamp * REPORT_INTERVAL; MAC_Input_Brute.Acc [0] = ACC_Brute.AXIS_X * ADJUST_ACC_G; MAC_Input_Brute.Acc [1] = ACC_Brute.AXIS_Y * ADJUST_ACC_G; MAC_Input_Brute.Acc [2] = ACC_Brute.AXIS_Z * ADJUST_ACC_G; MotionAC_Update(& MAC_Input_Brute,& is_calibrated); MotionAC_GetCalParams(安培; MAC_Params); ACC_Cal.X =(MAC_Input_Brute.Acc [0] - MAC_Params.AccBias [0])* MAC_Params.SF_Matrix [0] [0]; ACC_Cal.Y =(MAC_Input_Brute.Acc [1] - MAC_Params.AccBias [1])* MAC_Params.SF_Matrix [1] [1]; ACC_Cal.Z =(MAC_Input_Brute.Acc [2] - MAC_Params.AccBias [2])* MAC_Params.SF_Matrix [2] [2]; // MotionMC MMC_Input_Brute.TimeStamp = CounterStamp * REPORT_INTERVAL; MMC_Input_Brute.Mag [0] =(float)MAG_Brute.AXIS_X * ADJUST_MAG_UT; MMC_Input_Brute.Mag [1] =(float)MAG_Brute.AXIS_Y * ADJUST_MAG_UT; MMC_Input_Brute.Mag [2] =(浮动)MAG_Brute.AXIS_Z * ADJUST_MAG_UT; MotionMC_Update(安培; MMC_Input_Brute); MotionMC_GetCalParams(& MMC_Params); MAG_Cal.X =((MMC_Input_Brute.Mag [0] - MMC_Params.HI_Bias [0])* MMC_Params.SF_Matrix [0] [0]) +((MMC_Input_Brute.Mag [1] - MMC_Params.HI_Bias [1])* MMC_Params.SF_Matrix [0] [1]) +((MMC_Input_Brute.Mag [2] - MMC_Params.HI_Bias [2])* MMC_Params.SF_Matrix [0] [2]); MAG_Cal.Y =((MMC_Input_Brute.Mag [0] - MMC_Params.HI_Bias [0])* MMC_Params.SF_Matrix [1] [0]) +((MMC_Input_Brute.Mag [1] - MMC_Params.HI_Bias [1])* MMC_Params.SF_Matrix [1] [1]) +((MMC_Input_Brute.Mag [2] - MMC_Params.HI_Bias [2])* MMC_Params.SF_Matrix [1] [2]); MAG_Cal.Z =((MMC_Input_Brute.Mag [0] - MMC_Params.HI_Bias [0])* MMC_Params.SF_Matrix [2] [0]) +((MMC_Input_Brute.Mag [1] - MMC_Params.HI_Bias [1])* MMC_Params.SF_Matrix [2] [1]) +((MMC_Input_Brute.Mag [2] - MMC_Params.HI_Bias [2])* MMC_Params.SF_Matrix [2] [2]);} 执行此校准需要什么?我也计划实现MotionTL,MotionEC和MotionFX。 亲切的问候, Jonattan #magnetometer #motionmc #accelerometer #calibration #mems #motionac 以上来自于谷歌翻译 以下为原文 Hello. I am trying to build a full motion sensor software. I am using the NUCLEO-F411RE with STM32F411RE, SW4STM IDE, LSM9DS1 sensor with gyroscope, accelerometer and magnetometer. For this, I implemented the X-CUBE-MEMS1 library with MotionAC, MotionGC and MotionMC for sensor calibration.I performed the gyroscope calibration successfully, but I could not calibrate the accelerometer and magnetometer. The MotionMC library never gives me results. The MotionAC gives me results sometimes, but only in 'Dynamic Calibration' mode and they are not very accurate. I am doing circular motions trying to cover to the maximum all the points with all the axes. Defines: &sharpdefine ADJUST_ACC_MG 0.061f //2range:0.061mg/LSB //VALUES FROM DATASHEET &sharpdefine ADJUST_ACC_G 0.000061f //2range:0.000061g/LSB &sharpdefine ADJUST_GYR_MDPS 8.75f //245range:8.75mdps/LSB &sharpdefine ADJUST_GYR_DPS 0.00875f //245range:0.00875dps/LSB &sharpdefine ADJUST_MAG_MGAUSS 0.14f //4range:0.14mgauss/LSB &sharpdefine ADJUST_MAG_UT 0.014f //4range:0.014uT/LSB&sharpdefine REPORT_INTERVAL 10 &sharpdefine SAMPLE_FREQUENCY_F 100.0fVariables: SensorAxes_t ACC_Brute; // Data from sensor SensorAxes_t GYR_Brute; // Data from sensor SensorAxes_t MAG_Brute; // Data from sensor SensorAxesFloat_t ACC_Cal; // Calibrated data SensorAxesFloat_t GYR_Cal; // Calibrated data SensorAxesFloat_t MAG_Cal; // Calibrated data uint32_t CounterStamp; //MotionAC MAC_input_t MAC_Input_Brute; MAC_output_t MAC_Params;//MotionMC MMC_Input_t MMC_Input_Brute; MMC_Output_t MMC_Params;Initialization:
//MotionMC MotionMC_Initialize(REPORT_INTERVAL, 1); }Called by timer every 10ms: CounterStamp++; //MotionAC uint8_t is_calibrated = 0; MAC_Input_Brute.TimeStamp = CounterStamp * REPORT_INTERVAL; MAC_Input_Brute.Acc[0] = ACC_Brute.AXIS_X * ADJUST_ACC_G; MAC_Input_Brute.Acc[1] = ACC_Brute.AXIS_Y * ADJUST_ACC_G; MAC_Input_Brute.Acc[2] = ACC_Brute.AXIS_Z * ADJUST_ACC_G; MotionAC_Update(&MAC_Input_Brute, &is_calibrated); MotionAC_GetCalParams(&MAC_Params); ACC_Cal.X = (MAC_Input_Brute.Acc[0] - MAC_Params.AccBias[0]) * MAC_Params.SF_Matrix[0][0]; ACC_Cal.Y = (MAC_Input_Brute.Acc[1] - MAC_Params.AccBias[1]) * MAC_Params.SF_Matrix[1][1]; ACC_Cal.Z = (MAC_Input_Brute.Acc[2] - MAC_Params.AccBias[2]) * MAC_Params.SF_Matrix[2][2]; //MotionMC MMC_Input_Brute.TimeStamp = CounterStamp * REPORT_INTERVAL; MMC_Input_Brute.Mag[0] = (float)MAG_Brute.AXIS_X * ADJUST_MAG_UT; MMC_Input_Brute.Mag[1] = (float)MAG_Brute.AXIS_Y * ADJUST_MAG_UT; MMC_Input_Brute.Mag[2] = (float)MAG_Brute.AXIS_Z * ADJUST_MAG_UT; MotionMC_Update(&MMC_Input_Brute); MotionMC_GetCalParams(&MMC_Params);MAG_Cal.X = ((MMC_Input_Brute.Mag[0] - MMC_Params.HI_Bias[0]) * MMC_Params.SF_Matrix[0][0]) + ((MMC_Input_Brute.Mag[1] - MMC_Params.HI_Bias[1]) * MMC_Params.SF_Matrix[0][1]) + ((MMC_Input_Brute.Mag[2] - MMC_Params.HI_Bias[2]) * MMC_Params.SF_Matrix[0][2]); MAG_Cal.Y = ((MMC_Input_Brute.Mag[0] - MMC_Params.HI_Bias[0]) * MMC_Params.SF_Matrix[1][0]) + ((MMC_Input_Brute.Mag[1] - MMC_Params.HI_Bias[1]) * MMC_Params.SF_Matrix[1][1]) + ((MMC_Input_Brute.Mag[2] - MMC_Params.HI_Bias[2]) * MMC_Params.SF_Matrix[1][2]); MAG_Cal.Z = ((MMC_Input_Brute.Mag[0] - MMC_Params.HI_Bias[0]) * MMC_Params.SF_Matrix[2][0]) + ((MMC_Input_Brute.Mag[1] - MMC_Params.HI_Bias[1]) * MMC_Params.SF_Matrix[2][1]) + ((MMC_Input_Brute.Mag[2] - MMC_Params.HI_Bias[2]) * MMC_Params.SF_Matrix[2][2]);} What is necessary to perform this calibration? I plan to implement MotionTL, MotionEC and MotionFX too. Kind regards, Jonattan #magnetometer #motionmc #accelerometer #calibration #mems #motionac |
|
相关推荐
3个回答
|
|
|
关于MotionMC库,我没有看到库初始化和启用:MotionMC_Initialize(SAMPLE_TIME,1);
你是什么意思 MotionAC不是很准确吗?由于MotionAC是实时库并且能够在运行中校准传感器,因此结果并不完美。我想说现代传感器不需要它。 如果您想要高精度地创建测斜仪,我建议您在MotionTL库中使用6点校准。 以上来自于谷歌翻译 以下为原文 Concerning the MotionMC library, I don't see the library initialization and enabling: MotionMC_Initialize(SAMPLE_TIME, 1); What do you mean by MotionAC is not very accurate? As the MotionAC is real-time library and is able to calibrate the sensor on the fly the results are not perfect. I would say for modern sensors it is not needed. If you want to create inclinometer with high accuracy, I would recomend you to use 6-point calibration in MotionTL library. |
|
|
|
|
|
感谢你的回答。
关于MotionMC初始化,我编辑了帖子,我复制并粘贴了另一段代码。 MotionAC似乎不准确,因为我无法实时获得更新结果。我需要大约1000次迭代来获得第一个参数结果,并且这些参数在没有软件重置的情况下不会再次更改。 'MAC_cal_quality_t'参数从'MAC_CALQSTATUSOK'开始,并在第一个结果处变为'MAC_CALQSTATUSGOOD'。我做错了校准动作吗?有软件错误吗? 我现在正在研究MotionTL,如果我有任何方便的结果,我会在这里发布。 以上来自于谷歌翻译 以下为原文 Thanks for the answer. About MotionMC initialization, I edited the post, I had copied and pasted another piece of code. MotionAC does not seem accurate because I can not get updated results in real time. I need approximately 1000 iterations to get the first parameter result, and these parameters do not change again without software reset. The 'MAC_cal_quality_t' parameter starts at 'MAC_CALQSTATUSOK' and changes to 'MAC_CALQSTATUSGOOD' at the first result. Am I doing the wrong calibration movement? Is there a software error? I'm working on MotionTL right now, if I have any convenient results I'll post here. |
|
|
|
|
|
如果加速度计校准库返回MAC_CALQSTATUSGOOD,则校准工作正常。
如果您的传感器在此范围内,则库的目标与1g重力矢量+/- 40mg不同,校准参数将保持为0(偏移)和1(比例因子)。 以上来自于谷歌翻译 以下为原文 If the accelerometer calibration library returns MAC_CALQSTATUSGOOD than the calibration is working well. The target of the library is difference from 1g gravity vector +/- 40mg if your sensor is in this range, the calibration parameters will remain 0 (offset) and 1 (scale factor). |
|
|
|
|
只有小组成员才能发言,加入小组>>
stm32mp157的异核通信的rpmsg_sdb的m4固件和a7驱动该如何编写?
1447 浏览 0 评论
stm32f103用freertos对一个采样率为1kHz的传感器,进行采样,数据出差
1494 浏览 0 评论
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
3641 浏览 1 评论
3834 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
2454 浏览 1 评论
STM32H7打开DCache后,出现了串口接收信息为空的现象,是哪里出了问题?
727浏览 5评论
用NANO STM32F103RBT6的开发板烧录不了是哪里出了问题?
658浏览 5评论
710浏览 5评论
外部中断触发类型为双边沿触发,进入中断回调后有什么办法判断该边沿是上升沿还是下降沿?
940浏览 5评论
STM32L071CBT6低温环境下无法正常工作是什么原因引起的?
744浏览 5评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-1 18:58 , Processed in 0.777250 second(s), Total 79, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
2132