Input a custom IMU GYRO Value

Hi,

I am trying to input a custom xgyro, ygyro and zgyro live value to the px4 algorithm. I have done research inside the PX4 Firmware github files but I can’t figure it out. I am trying to get to the root of where does the px4 uses the original values coming from the IMU, to tell the px4 to use a live value that I am calculating and willing to feed to the Pixhawk 4 from a RPi, for it to be used instead of the original IMU gyro values. Is there any option to do this as simple as possible? I am trying to build something in where I can switch in between original values and custom calculated gyro values, and be able to change with my RC, like a flight-mode or just a switch.

Thanks in advance!

From a control and estimation point of view that sounds quite tricky because for good performance we try to read gyro data at a high rate and low latency.

However, if you insist, you should be able to publish your gyro data in a module similar to the gyro module which is here: PX4-Autopilot/gyro.cpp at 36877b9efc37bdf13ea7d0a6fc08feb768b4bf8f · PX4/PX4-Autopilot · GitHub

Also, make sure to read about how multiple EKFs are used:

You will have to learn quite a bit about the inner workings of PX4 and find out which uorb topics are published and consumed. And you probably want to have one EKF running on the default/first IMU, and then a second one based on your gyro data.

Out of interest, can you explain more about what you’re trying to achieve, or what sort of gyro data you have?