Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
madhephaestus committed Jun 22, 2017
1 parent e16b383 commit 913d7d6
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,6 @@ void runPid(){
// next update all control outputs
for (int i=0;i<numberOfPid;i++)
pid[i]->updateControl();
//Handle any chip errors after the critical timing
<<<<<<< HEAD
//for (int i=0;i<numberOfPid;i++)
if(pid[0]->encoder->error.status)
pid[0]->encoder->handleErrors();
=======
// for (int i=0;i<numberOfPid;i++)
// if(pid[i]->encoder->error.status)
// pid[i]->encoder->handleErrors();
>>>>>>> 1c7e80a67149c5392c883f52c8119d793b79b7e5

}
int main() {

Expand All @@ -39,21 +28,13 @@ void runPid(){
for (int i=0;i<numberOfPid;i++){
pid[i]->state.config.Enabled=false;// disable PID to start with
}
<<<<<<< HEAD
pidTimer.attach(&runPid, 0.004);
=======
pidTimer.attach(&runPid, 0.001);
>>>>>>> 1c7e80a67149c5392c883f52c8119d793b79b7e5
// capture 100 ms of encoders before starting
wait_ms(100);
for (int i=0;i<numberOfPid;i++){
//reset after encoders have been updated a few times
pid[i]->InitilizePidController();
<<<<<<< HEAD
//pid[i]->ZeroPID();// set the current encoder value to 0
=======
pid[i]->ZeroPID();// set the current encoder value to 0
>>>>>>> 1c7e80a67149c5392c883f52c8119d793b79b7e5
// this should be replaced by calibration routine
pid[i]->SetPIDEnabled( true);// Enable PID to start control
}
Expand All @@ -71,11 +52,7 @@ void runPid(){
pid[0]->startHomingLink( CALIBRARTION_home_velocity, 123);
*/
float timeBetweenPrints = 2000;
<<<<<<< HEAD
float bounds = 800;
=======
float bounds = 500;
>>>>>>> 1c7e80a67149c5392c883f52c8119d793b79b7e5
RunEveryObject printer(0,1000);
RunEveryObject setpoint(0,timeBetweenPrints);
float iterator=0;
Expand All @@ -87,7 +64,6 @@ void runPid(){
if(setpoint.RunEvery(current)>0){
// sweep some setpoints
if(direction)
<<<<<<< HEAD
iterator+=bounds/4;
else
iterator-=bounds/4;
Expand All @@ -98,18 +74,6 @@ void runPid(){
pid[0]->state.Output,
pid[0]->state.OutputSet
);
=======
iterator+=bounds/3;
else
iterator-=bounds/3;
if(iterator>bounds){
direction=false;
}
if(iterator<-bounds){
direction=true;
}

>>>>>>> 1c7e80a67149c5392c883f52c8119d793b79b7e5
for (int i=0;i<numberOfPid;i++){
//Interrupts need to be disabled to to avoid conflicts with pid objects
__disable_irq(); // Disable Interrupts
Expand All @@ -120,17 +84,13 @@ void runPid(){
__enable_irq(); // Enable Interrupts

}
<<<<<<< HEAD
if(iterator>bounds){
direction=false;
}
if(iterator<-bounds){
direction=true;
}

=======
printf("\n\nUpdating setpoint %f\n\n",iterator);
>>>>>>> 1c7e80a67149c5392c883f52c8119d793b79b7e5
}

wait_ms(1);
Expand Down

0 comments on commit 913d7d6

Please sign in to comment.