Yaw FF Setpoint in PX4 flight review

Good day

I have been struggling a bit with controlling the yaw on my drone in sitl. As you can see from the image, the drone is able to track the setpoint quite well, but then the Yaw FF Setpoint gets injected. What is this setpoint, as it cannot be the yawrate ff gain, as this is set to 0 on my drone?

Does anyone know which module publishes this setpoint, as I have not been able to find it yet

Thank you very much for any help

1 Like

So I did more digging and I think I found the answer.

The Yaw feed forward setpoint seen in these graphs are not about yaw, but rather the _yawspeed_setpoint from the trajectory setpoint topic. In the attitude controller, rate setpoints are computed through the P controller as you would expect, however, just before these rates are limited, the _yawspeed_setpoint from the current running task is fed-forward, as you can see in this code:

matrix::Vector3f AttitudeControl::update(const Quatf &q) const
{
.
.
.
  if (std::isfinite(_yawspeed_setpoint)) {
		  rate_setpoint += q.inversed().dcm_z() * _yawspeed_setpoint;
	  }

	  // limit rates
	  for (int i = 0; i < 3; i++) {
		  rate_setpoint(i) = math::constrain(rate_setpoint(i), -_rate_limit(i), _rate_limit(i));
	  }

	  return rate_setpoint;
  }

Due to the setpoint being used before the rates controller, the MC_YAWRATE_FF parameter has no effect on it. If you have to cancel out this effect for some reason, make sure _yawspeed_setpoint = 0` from your current running task.