Skip to content

Commit

Permalink
Merge pull request #338 from USC-ACTLab/issue335
Browse files Browse the repository at this point in the history
Manual flight: same yaw rate for PID and Mellinger
  • Loading branch information
ataffanel authored Jul 31, 2018
2 parents b943ff8 + f31693b commit 3e881b6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/modules/src/controller_mellinger.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ void controllerMellinger(control_t *control, setpoint_t *setpoint,
}
}

// Rate-controled YAW is moving YAW angle setpoint
// Rate-controlled YAW is moving YAW angle setpoint
if (setpoint->mode.yaw == modeVelocity) {
desiredYaw = state->attitude.yaw - setpoint->attitudeRate.yaw * dt;
desiredYaw = state->attitude.yaw + setpoint->attitudeRate.yaw * dt;
} else if (setpoint->mode.yaw == modeAbs) {
desiredYaw = setpoint->attitude.yaw;
} else if (setpoint->mode.quat == modeAbs) {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/src/controller_pid.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void controllerPid(control_t *control, setpoint_t *setpoint,
if (RATE_DO_EXECUTE(ATTITUDE_RATE, tick)) {
// Rate-controled YAW is moving YAW angle setpoint
if (setpoint->mode.yaw == modeVelocity) {
attitudeDesired.yaw -= setpoint->attitudeRate.yaw/500.0f;
attitudeDesired.yaw += setpoint->attitudeRate.yaw * ATTITUDE_UPDATE_DT;
while (attitudeDesired.yaw > 180.0f)
attitudeDesired.yaw -= 360.0f;
while (attitudeDesired.yaw < -180.0f)
Expand Down
3 changes: 2 additions & 1 deletion src/modules/src/crtp_commander_rpyt.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ void crtpCommanderRpytDecodeSetpoint(setpoint_t *setpoint, CRTPPacket *pk)

// Yaw
if (!posSetMode) {
setpoint->attitudeRate.yaw = values->yaw;
// legacy rate input is inverted
setpoint->attitudeRate.yaw = -values->yaw;
yawModeUpdate(setpoint);

setpoint->mode.yaw = modeVelocity;
Expand Down

0 comments on commit 3e881b6

Please sign in to comment.