Increases Sr2_position to greater than 50 Hz

Hi,

I have a project that uses a companion computer to solve a high-level control problem (formulated as a model predictive control). To allow for feedback control, I use serial2 to send the ardupilot’s EKFed vehicle state (attitude and position) to the companion computer. For better performance, the companion computer needs to run the high-level controller as fast as possible, up to the hardware limit. Right now, it’s been capped by the maximum rate that ardupilot sends the vehicle state through mavlink, which is 50 hz ( Sr2_position). I checked the code, and I don’t know where this cap is enforced.

On the hardware side, my serial communications run at a baudrate of 921600, which allows for 112.5 kB/s data rate. At 50 Hz update rate, the bandwidth is sufficient. I checked on my companion computer of the bandwidth taken by existing mavlink messages: /mavros/local_position/pose takes about 3.8 kB/s, /mavros/imu/data takes about 16.2 kB/s. So in principle, even if the rate is improved to 100 Hz or even 200 Hz, such information can be passed to the companion computer. The question is, which file in the ardupilot code can I modify to enable the fast update rate?

Many thanks! Any suggestions will be appreciated!

Sheng