Skip to content
Snippets Groups Projects
Commit 7dcf3bc5 authored by 488_MP-4's avatar 488_MP-4
Browse files

any and all changes for sdmay23 bigquad deck

parent 867fdba5
No related branches found
No related tags found
5 merge requests!106Adding Pycrocart 2.1,!104adding cflib to this branch,!98Pycrocart 2.1 will,!94Merge cflib adapter into main,!88Bigquad
......@@ -118,7 +118,7 @@ void controllerStudent(control_t *control, setpoint_t *setpoint, const sensorDat
}
//set desired thrust
thrustDesired = setpoint->thrust;
thrustDesired = setpoint->thrust/4;
// Run the attitude controller with the measured attitude and desired attitude
......@@ -144,6 +144,7 @@ void controllerStudent(control_t *control, setpoint_t *setpoint, const sensorDat
if(tuning_mode == true){
if (setpoint->mode.yaw == modeVelocity) {
rateDesired.yaw = setpoint->attitudeRate.yaw;
attitudeDesired.roll = 3;
studentAttitudeControllerResetYawAttitudePID();
}
}
......@@ -151,9 +152,9 @@ void controllerStudent(control_t *control, setpoint_t *setpoint, const sensorDat
//update the attitude rate PID, given the current angular rate
//read by the gyro and the desired rate
studentAttitudeControllerCorrectRatePID(sensors->gyro.x, -sensors->gyro.y, sensors->gyro.z,
rateDesired.roll, rateDesired.pitch, rateDesired.yaw,
rateDesired.roll, rateDesired.pitch, setpoint->attitudeRate.yaw,
&(control->roll), &(control->pitch), &(control->yaw));
rateDesired.yaw = setpoint->attitudeRate.yaw;
//invert yaw control
control->yaw = -control->yaw;
}
......
......@@ -134,13 +134,14 @@ void studentAttitudeControllerCorrectRatePID(
)
{
studentPidSetDesired(&pidRollRate, rollRateDesired);
*rollCommand = saturateSignedInt16(studentPidUpdate(&pidRollRate, rollRateMeasured, true));
*rollCommand = saturateSignedInt16(studentPidUpdate(&pidRollRate, rollRateMeasured, true)/4);
studentPidSetDesired(&pidPitchRate, pitchRateDesired);
*pitchCommand = saturateSignedInt16(studentPidUpdate(&pidPitchRate, pitchRateMeasured, true));
*pitchCommand = saturateSignedInt16(studentPidUpdate(&pidPitchRate, pitchRateMeasured, true)/4);
studentPidSetDesired(&pidYawRate, yawRateDesired);
*yawCommand = saturateSignedInt16(studentPidUpdate(&pidYawRate, yawRateMeasured, true));
*yawCommand = saturateSignedInt16(studentPidUpdate(&pidYawRate, yawRateMeasured, true)/4);
}
void studentAttitudeControllerResetRollAttitudePID(void)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment