AutopilotPi / V3s_Quadrotor

A Quadrotor Using AutoPilotPi
GNU General Public License v3.0
10 stars 5 forks source link

IMU timeout Accel #0 fail: TIMEOUT! #1

Closed Jddl closed 2 years ago

Jddl commented 2 years ago

Accel #0 fail: TIMEOUT! 最近也在研究v3s的px4移植 mpu6500 启动后会报 Accel #0 fail: TIMEOUT! 大侠有没有遇到过

Ncerzzk commented 2 years ago

你检查一下启动后CPU的占用是不是达到100%了

Jddl commented 2 years ago

image image

看上去没到100%

Ncerzzk commented 2 years ago

看起来好像正常,你可以用sensors status看看呢?

---Original--- From: @.> Date: Sat, Apr 23, 2022 21:49 PM To: @.>; Cc: @.**@.>; Subject: Re: [Ncerzzk/V3s_Quadrotor] IMU timeout Accel #0 fail: TIMEOUT! (Issue #1)

看上去没到100%

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

Ncerzzk commented 2 years ago

如果sensor status里加速度计是正常的,那可能只是因为启动时,某些模块启动太慢,导致某一次调度间隔太久,只要之后恢复了就没事

---Original--- From: @.> Date: Sat, Apr 23, 2022 21:49 PM To: @.>; Cc: @.**@.>; Subject: Re: [Ncerzzk/V3s_Quadrotor] IMU timeout Accel #0 fail: TIMEOUT! (Issue #1)

看上去没到100%

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

Jddl commented 2 years ago

image

Jddl commented 2 years ago

我看树莓派里面跑px4进程都是第二个内核,是不是感觉还是选双核的处理器才行

Ncerzzk commented 2 years ago

应该不是的,我用v3s跑,cpu占用率没超过50,看起来还是绰绰有余的。

---Original--- From: @.> Date: Sat, Apr 23, 2022 22:06 PM To: @.>; Cc: @.**@.>; Subject: Re: [Ncerzzk/V3s_Quadrotor] IMU timeout Accel #0 fail: TIMEOUT! (Issue #1)

我看树莓派里面跑px4进程都是第二个内核,是不是感觉还是选双核的处理器才行

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

Jddl commented 2 years ago

有没有飞起来过?哈哈😃

Ncerzzk commented 2 years ago

看起来这个无法恢复,不知道你kernel是否开了软实时(rt_preempt)。

另外,把config文件贴出来看看?把ekf2先注释掉看看,因为我看你只有imu,ekf2多半是没法正常启动的

---Original--- From: @.> Date: Sat, Apr 23, 2022 22:04 PM To: @.>; Cc: @.**@.>; Subject: Re: [Ncerzzk/V3s_Quadrotor] IMU timeout Accel #0 fail: TIMEOUT! (Issue #1)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

Ncerzzk commented 2 years ago

还没有呀,最近在整遥控,不知道为啥px4一直识别不了我的elrs接收机

---Original--- From: @.> Date: Sun, Apr 24, 2022 08:15 AM To: @.>; Cc: @.**@.>; Subject: Re: [Ncerzzk/V3s_Quadrotor] IMU timeout Accel #0 fail: TIMEOUT! (Issue #1)

有没有飞起来过?哈哈😃

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

Jddl commented 2 years ago

目前看上去是SPI这块的问题,加了CONFIG_PREEMPT=y好像没什么效果 uorb top 看到的加速度和陀螺仪频率一直是波动的,280-370,如果正常应该是保持400 a3c86fd7e235cdf9c39cd81bfaffc8b

Ncerzzk commented 2 years ago

你如果有时间不如试试这个改动? https://github.com/Ncerzzk/PX4-Autopilot/commit/c006bbd285d3cd063b4af932156776e7c7795ef3

之前在v3s测试发现的一个调度上的bug:https://github.com/PX4/PX4-Autopilot/issues/19358 症状跟你类似,但又不太一样(我的CPU占用会达到几乎100%)

Jddl commented 2 years ago

换成icm20602之后,立刻就正常了。要么是模块本身的问题,要么是驱动 image

Jddl commented 2 years ago

这个issue我先关了,多谢

Jddl commented 2 years ago

今天飞起来试了一下,抖的不行,而且一解锁,就会报TIMEOUT,感觉和linux的实时性还是有关系。

Ncerzzk commented 2 years ago

感觉你换了icm20602 后,timeout的问题其实没有解决。 试试 用ekf2 status 看看数据抖动呢?

# ./px4-ekf2 status
INFO  [ekf2] available instances: 1
INFO  [ekf2] 0: ACC: 3670274, GYRO: 3670274, MAG: 527617, healthy, test ratio: 1.0000000 (0.00000) *

ekf2:0 EKF dt: 0.0100s, IMU dt: 0.0050s, attitude: 1, local position: 0, global position: 0
ekf2: ECL update: 34716 events, 329080us elapsed, 9.48us avg, min 1us max 280us 4.831us rms
ekf2: ECL full update: 34385 events, 7486663us elapsed, 217.73us avg, min 187us max 666us 34.803us rms
ekf2: IMU message missed: 0 events
ekf2: vehicle_air_data messages missed: 0 events
ekf2: vehicle_magnetometer messages missed: 0 events
Jddl commented 2 years ago
ekf2:0 attitude: 1, local position: 0, global position: 0
ekf2: ECL update: 18677 events, 210441us elapsed, 11.27us avg, min 2us max 474us 9.363us rms
ekf2: ECL full update: 18558 events, 5059716us elapsed, 272.64us avg, min 199us max 850us 61.712us rms
ekf2: IMU message missed: 0 events
ekf2: vehicle_air_data messages missed: 0 events
ekf2: vehicle_magnetometer messages missed: 0 events
Jddl commented 2 years ago

解锁后

ekf2:0 attitude: 1, local position: 0, global position: 0
ekf2: ECL update: 29911 events, 316828us elapsed, 10.59us avg, min 7us max 421us 19.187us rms
ekf2: ECL full update: 30180 events, 8246028us elapsed, 273.23us avg, min 187us max 1155us 188.182us rms
ekf2: IMU message missed: 0 events
ekf2: vehicle_air_data messages missed: 0 events
ekf2: vehicle_magnetometer messages missed: 3 events
Jddl commented 2 years ago

估计还是SPI的原因

Ncerzzk commented 2 years ago

试试这个呢?https://github.com/Ncerzzk/PX4-Autopilot/releases/tag/v1.9.0-devtest

Jddl commented 2 years ago

PWM 我用的PCA9685 主线上我试过,驱动有问题,不知道这个版本行不行

Ncerzzk commented 2 years ago

这个的PCA9685驱动就是主线的,我没有改过。主要是试试解锁后会不会timeout。里面有source code,也可以把你改动的patch打进来再编译一下。 make pipx4_v3s upload

Jddl commented 2 years ago

image 试了一下,和主线代码差不多,估计的值感觉有丢失,还会报baro timeout

Ncerzzk commented 2 years ago

挺奇怪的。你的kernel是什么版本的?有defconfig看看吗

Jddl commented 2 years ago

刚开始用的5.2,换成4.10也是一样

Jddl commented 2 years ago

等你飞起来,我再来看看,哈哈哈😁

Ncerzzk commented 2 years ago

好的,我打算组个空心杯,PCA9685的频率不够,整了个FPGA来输出PWM,估计还得调段时间

Ncerzzk commented 2 years ago

我总算组好了,fpga也正常输出pwm了 微信图片_20220527225905 测试解锁后是正常的,没有出现timeout的情况,在架子上测试了一下roll 和 pitch的控制还行 不过电机不够力,这个716电机当时好像是随便买的,没挑强磁的,导致现在油门推到顶也起飞不了,稍微有点尴尬了

Jddl commented 2 years ago

厉害,可能是我硬件上的问题

Ncerzzk commented 1 year ago

哦,看起来这个超时恢复不了。 不知道你的os开启软实时(rt_preempt)了吗? 另外,你贴一下你的config文件看看,尝试将 ekf2注释掉,看看是否会出现。 因为我看你只有陀螺仪和加速度计,ekf2应该也无法正常启动

---Original--- From: @.> Date: Sat, Apr 23, 2022 22:04 PM To: @.>; Cc: @.**@.>; Subject: Re: [Ncerzzk/V3s_Quadrotor] IMU timeout Accel #0 fail: TIMEOUT! (Issue #1)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>