Yaw Rate setpoints forming a loop?

Hey there,

This is Nikhil here, a fellow drone enthusiast and hobbyist from India. I want to run and test this controller (A MPC controller from ETH Zurich). unfortunately this controller outputs only roll/pitch angle setpoints along with yaw_rate setpoints and thrust. To the best of my knowledge i don’t think px4 supports this configuration natively out of the box ( i might be wrong, please do correct me in that case )

For the sake of learning and exploring, i had a look at the px4 firmware to understand what’s going on behind the scenes. i came across this block of code inside mc_att_control which made no sense to me

if (_v_control_mode.flag_control_yawrate_override_enabled) {
/* Yaw rate override enabled, overwrite the yaw setpoint */
const auto yawrate_reference = _v_rates_sp.yaw;
_rates_sp(2) = yawrate_reference;


from what i understood the flow is as follows,
1. _rates_sp are the output of the outer attitude conrol loop
2. if override is enabled, it takes the yaw rate from _v_rates_sp ( uorb topic : vehicle_rates_setpoint ref )
3. it then published this new setpoint using _v_rates_sp_pub ( uorb topic : vehicle_rates_setpoint ref )

so essentially in summary, it takes yawrate from vehicle_rates_setpoint and publsihes it to the same topic again ?.

owing to the asynchronous nature of publish subscribe model, wont the data flow be messed up. if we are unlucky, the publishing of att_control could forever hide new data coming in from mavlink etc.

if someone knows whats intended and whats actually going, please elucidate me