EKF2 module gyro sensor units


I am trying to understand how the ekf module works in PX4, and I ran into a confusing part.
In src/modules/ekf2/EKF2.cpp I tried to follow how the angular rate is published, and the unit of the variables seem to be controversial.

First here we define imu_sample_new.delta_ang as [rad/s], but if the if statement goes here it is integrating the gyro output over time and it will be set as [rad].

Furthermore, here we should get [rad/s] for rollspeed, therefore the imu.delta_ang variable’s unit should be [rad/s/s].

(I have taken all unit definitions from corresponding .msg files.)

I’m sure I am missing something trivial but can someone point out where I made the mistake?

Thanks in advance for any help.


I think your confusion stems from

I agree it is a bit confusing in the comment but the unit is [rad] not [rad/s]

Thanks for clarifying that, yes it is quite confusing as the comment explicitly says [rad/s].

On the other hand, this does not explain this part, as it seems to produce [rad*s] for rates that should be [rad/s]. Here imu is an imuSample type variable, and the used fields are in [rad] and [s] respectively, according to the description.

hm that looks like a bug to me

Nice to see it is fixed already, thanks for reporting it.