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

corrected bigquad deck stuff

parent 71858097
No related branches found
No related tags found
4 merge requests!106Adding Pycrocart 2.1,!104adding cflib to this branch,!98Pycrocart 2.1 will,!94Merge cflib adapter into main
Showing
with 19 additions and 7 deletions
Subproject commit a65b7c9a3e6502127fdb80eb288d8cbdf251a6f4
Subproject commit 3604527e3b31991c596cd420f32989ee890aca4a
Subproject commit cb1ad78b974937e1ad717858fab73ec5380ef94b
Subproject commit 448a0efde42a258139cc8ca61fe53ff3bb4a9b94
Subproject commit 287e076962ec711cd2bdf08364a8df9ce51e106b
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -271,10 +271,13 @@ bool motorsTest(void) ...@@ -271,10 +271,13 @@ bool motorsTest(void)
vTaskDelay(M2T(MOTORS_TEST_DELAY_TIME_MS));*/ vTaskDelay(M2T(MOTORS_TEST_DELAY_TIME_MS));*/
motorsConfigureESC(); motorsConfigureESC();
#else #else
/*
motorsSetRatio(MOTORS[i], MOTORS_TEST_RATIO); motorsSetRatio(MOTORS[i], MOTORS_TEST_RATIO);
vTaskDelay(M2T(MOTORS_TEST_ON_TIME_MS)); vTaskDelay(M2T(MOTORS_TEST_ON_TIME_MS));
motorsSetRatio(MOTORS[i], 0); motorsSetRatio(MOTORS[i], 0);
vTaskDelay(M2T(MOTORS_TEST_DELAY_TIME_MS)); vTaskDelay(M2T(MOTORS_TEST_DELAY_TIME_MS));
*/
motorsConfigureESC();
#endif #endif
} }
} }
...@@ -365,18 +368,18 @@ void motorsConfigureESC() { ...@@ -365,18 +368,18 @@ void motorsConfigureESC() {
vTaskDelay(M2T(20)); // wait 2 ms vTaskDelay(M2T(20)); // wait 2 ms
motorMap[0]->setCompare(motorMap[0]->tim, motorsConv16ToBits_uCart23(65535)); motorMap[0]->setCompare(motorMap[0]->tim, motorsConv16ToBits_uCart23(65535));
vTaskDelay(M2T(2)); // wait 2 ms vTaskDelay(M2T(2)); // wait 2 ms
motorMap[0]->setCompare(motorMap[0]->tim, motorsConv16ToBits_uCart23(0)); motorMap[0]->setCompare(motorMap[0]->tim, motorsConv16ToBits_uCart23(0));
vTaskDelay(M2T(20)); // wait 2 msS vTaskDelay(M2T(20)); // wait 2 msS
motorMap[1]->setCompare(motorMap[1]->tim, motorsConv16ToBits_uCart23(65535)); motorMap[1]->setCompare(motorMap[1]->tim, motorsConv16ToBits_uCart23(65535));
vTaskDelay(M2T(2)); // wait 2 ms vTaskDelay(M2T(2)); // wait 2 ms
motorMap[1]->setCompare(motorMap[1]->tim, motorsConv16ToBits_uCart23(0)); motorMap[1]->setCompare(motorMap[1]->tim, motorsConv16ToBits_uCart23(0));
vTaskDelay(M2T(20)); // wait 2 ms vTaskDelay(M2T(20)); // wait 2 ms
motorMap[2]->setCompare(motorMap[2]->tim, motorsConv16ToBits_uCart23(65535)); motorMap[2]->setCompare(motorMap[2]->tim, motorsConv16ToBits_uCart23(65535));
vTaskDelay(M2T(2)); // wait 2 ms vTaskDelay(M2T(2)); // wait 2 ms
motorMap[2]->setCompare(motorMap[2]->tim, motorsConv16ToBits_uCart23(0)); motorMap[2]->setCompare(motorMap[2]->tim, motorsConv16ToBits_uCart23(0));
......
...@@ -118,7 +118,7 @@ void controllerStudent(control_t *control, setpoint_t *setpoint, const sensorDat ...@@ -118,7 +118,7 @@ void controllerStudent(control_t *control, setpoint_t *setpoint, const sensorDat
} }
//set desired thrust //set desired thrust
thrustDesired = setpoint->thrust/4; thrustDesired = setpoint->thrust;
// Run the attitude controller with the measured attitude and desired attitude // Run the attitude controller with the measured attitude and desired attitude
...@@ -152,7 +152,7 @@ void controllerStudent(control_t *control, setpoint_t *setpoint, const sensorDat ...@@ -152,7 +152,7 @@ void controllerStudent(control_t *control, setpoint_t *setpoint, const sensorDat
//update the attitude rate PID, given the current angular rate //update the attitude rate PID, given the current angular rate
//read by the gyro and the desired rate //read by the gyro and the desired rate
studentAttitudeControllerCorrectRatePID(sensors->gyro.x, -sensors->gyro.y, sensors->gyro.z, studentAttitudeControllerCorrectRatePID(sensors->gyro.x, -sensors->gyro.y, sensors->gyro.z,
rateDesired.roll, rateDesired.pitch, setpoint->attitudeRate.yaw, rateDesired.roll, rateDesired.pitch, rateDesired.yaw,
&(control->roll), &(control->pitch), &(control->yaw)); &(control->roll), &(control->pitch), &(control->yaw));
rateDesired.yaw = setpoint->attitudeRate.yaw; rateDesired.yaw = setpoint->attitudeRate.yaw;
//invert yaw control //invert yaw control
......
...@@ -81,6 +81,10 @@ void powerStop() ...@@ -81,6 +81,10 @@ void powerStop()
motorsSetRatio(MOTOR_M4, 0); motorsSetRatio(MOTOR_M4, 0);
} }
int scaleThrustForMicroPi(uint16_t value_in) {
return value_in / 4;
}
void powerDistribution(const control_t *control) void powerDistribution(const control_t *control)
{ {
#ifdef QUAD_FORMATION_X #ifdef QUAD_FORMATION_X
......
...@@ -135,13 +135,13 @@ void studentAttitudeControllerCorrectRatePID( ...@@ -135,13 +135,13 @@ void studentAttitudeControllerCorrectRatePID(
{ {
studentPidSetDesired(&pidRollRate, rollRateDesired); studentPidSetDesired(&pidRollRate, rollRateDesired);
*rollCommand = saturateSignedInt16(studentPidUpdate(&pidRollRate, rollRateMeasured, true)/4); *rollCommand = saturateSignedInt16(studentPidUpdate(&pidRollRate, rollRateMeasured, true));
studentPidSetDesired(&pidPitchRate, pitchRateDesired); studentPidSetDesired(&pidPitchRate, pitchRateDesired);
*pitchCommand = saturateSignedInt16(studentPidUpdate(&pidPitchRate, pitchRateMeasured, true)/4); *pitchCommand = saturateSignedInt16(studentPidUpdate(&pidPitchRate, pitchRateMeasured, true));
studentPidSetDesired(&pidYawRate, yawRateDesired); studentPidSetDesired(&pidYawRate, yawRateDesired);
*yawCommand = saturateSignedInt16(studentPidUpdate(&pidYawRate, yawRateMeasured, true)/4); *yawCommand = saturateSignedInt16(studentPidUpdate(&pidYawRate, yawRateMeasured, true));
} }
void studentAttitudeControllerResetRollAttitudePID(void) void studentAttitudeControllerResetRollAttitudePID(void)
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
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