Skip to content

Commit

Permalink
Update MotorControlTask.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
cshank19 committed Dec 8, 2024
1 parent f7f164e commit 9ffc962
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/Control Tasks/MotorControlTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,12 @@ void MotorControlTask::control() {
time_curr = millis();

sfr::imu::failed_init = true;
if (sfr::imu::failed_init != true){
if (sfr::imu::failed_init == false){

// calculate PID terms
proportional = Kp * error_curr;
derivative = Kd * (error_curr - error_prev) / (time_curr - time_prev);

<<<<<<< HEAD
// send electic pulse based on PID (range from 0 to 1000)
vlogln(esc_prev);
T = proportional + derivative;
Expand All @@ -89,12 +88,6 @@ void MotorControlTask::control() {

}else{ // open loop
duty_cycle = 1800;
=======
if (duty_cycle < 1180.00) {
duty_cycle = 1180.00;
} else if (duty_cycle > 2000.00) {
duty_cycle = 2000.00;
>>>>>>> ff922fe11ee0ba458cf63a01923f26b85b6bd2c3
}

angle = map(duty_cycle, 1000, 2000, 0, 180);
Expand Down

0 comments on commit 9ffc962

Please sign in to comment.