Skip to content

Commit

Permalink
fix format and add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
matejkarasek committed Sep 9, 2024
1 parent 42f1a94 commit 64d8bc5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/modules/src/controller/controller_pid.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void controllerPid(control_t *control, const setpoint_t *setpoint,
cmd_yaw = control->yaw;

attitudeControllerResetAllPID(state->attitude.roll, state->attitude.pitch, state->attitude.yaw);
positionControllerResetAllPID(state->position.x, state->position.y, state->position.z);
positionControllerResetAllPID(state->position.x, state->position.y, state->position.z);

// Reset the calculated YAW angle for rate control
attitudeDesired.yaw = state->attitude.yaw;
Expand Down
1 change: 1 addition & 0 deletions src/utils/src/pid.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ float pidUpdate(PidObject* pid, const float measured, const bool isYawAngle)
*/
float delta = -(measured - pid->prevMeasured);

// For yaw measurements, take care of spikes when crossing 180deg <-> -180deg
if (isYawAngle){
if (delta > 180.0f){
delta -= 360.0f;
Expand Down

0 comments on commit 64d8bc5

Please sign in to comment.