a question about yaw control in firmware
Posted: Tue Nov 16, 2021 1:51 pm
hello!
I know the coordinate system is different from normal system.But when I modify controller_pid.c,I find that in line 114,it is:control->yaw = -control->yaw.
If I set mode.position x\y\z = modeAbs,the mode.yaw should be modeDsiabled. If I use PID controller,I find:
1. attitudeControllerCorrectAttitudePID(): state->attitude.yaw and attitudeDesired.yaw become rateDesired.yaw.
2. attitudeControllerCorrectRatePID(): rateDesired.yaw and sensors->gyro.z become yawOutput.
3. attitudeControllerGetActuatorOutput(): yawOutput becomes control->yaw.
I think those data are actual date,and control->yaw can be used derictly.But then,
4.control->yaw = -control->yaw;
I don't know why use minus sign here,because from PID controller_yaw i get actual desired yaw,and then i get real attitudeDesired_yawrate.
Could you tell me why there need a minus sign?Thanks!
I know the coordinate system is different from normal system.But when I modify controller_pid.c,I find that in line 114,it is:control->yaw = -control->yaw.
If I set mode.position x\y\z = modeAbs,the mode.yaw should be modeDsiabled. If I use PID controller,I find:
1. attitudeControllerCorrectAttitudePID(): state->attitude.yaw and attitudeDesired.yaw become rateDesired.yaw.
2. attitudeControllerCorrectRatePID(): rateDesired.yaw and sensors->gyro.z become yawOutput.
3. attitudeControllerGetActuatorOutput(): yawOutput becomes control->yaw.
I think those data are actual date,and control->yaw can be used derictly.But then,
4.control->yaw = -control->yaw;
I don't know why use minus sign here,because from PID controller_yaw i get actual desired yaw,and then i get real attitudeDesired_yawrate.
Could you tell me why there need a minus sign?Thanks!