Lab 10 – Performance Test 3

Description of Code: This is another form of the code where the mission is completed. The AEV stops at the gate for 5 seconds while going to R2D2 and with coming back with the cargo. It waits with R2D2 when it first connects for another 5 seconds. When it arrives back to the beginning, it slows in without bouncing off of the foam block.


 //reverse all motors                                                                       

 reverse(4);                                            

                                   

  //motors run at 21% for until 307 marks and then coast until the gate                                                                                                                                 

 motorSpeed(4,21);                                                                          

 goToAbsolutePosition(307);                                                                                                                                             

   

  //reverse to act as a braking force                                                                                      

 reverse(4);                                                                                                                                                                      

 motorSpeed(4,25);                                                                          

 goFor(1.5);                                                                                

                                                                                            

 //brake all motors                                                                         

 brake(4);                                                                                  

                

 //brake and wait for the gate to open                                                                            

 goFor(9);                                                                                  

 reverse(4);  //back into pusher                                                                              

                                                                                            

 //everything above is to get to the gate                                                   

                              

 //run at an initial boost                                                              

 motorSpeed(4,25);                                                                          

 goFor(2);                                                                                  

   

 //run until 640 position and coast until R2D2                                                                                         

 motorSpeed(4,20);                                                                          

 goToAbsolutePosition(640);                                                                 

                                                                                            

 //R2D2 capture                                                                             

//wait at R2D2 for about 5secs                                                                                            

 brake(4);                                                                                  

 goFor(10);                                                                                 

                                                                                            

 reverse(4); //into puller mode                                                                               

 

 //run until 590 as an initial boost of speed                                                                                           

 motorSpeed(4,36);                                                                          

 goToAbsolutePosition(590);                                                                 

                              

 //run the rest and then coast until the gate                                                              

 motorSpeed(4,21);                                                                          

 goToAbsolutePosition(500);                                                                 

    

 //wait at the gate                                                                                       

 brake(4);                                                                                  

 goToAbsolutePosition(480);                                                                 

 

 

 //goes into pusher and then use that as a braking force                                                                                          

 reverse(4);                                                                                

 motorSpeed(4,18);                                                                          

 goFor(2);                                                                                                                                                                             

 reverse(4);  //back into puller                                                                              

     

 //wait at the gate until it opens                                                                                        

 brake(4);                                                                                  

 goFor(9);                                                                                  

                                                                                            

 //at the gate                                                                              

                                                                                            

 //return to start                                                                                                                                                        

 motorSpeed(4, 35);                                                                         

 goToAbsolutePosition(145);   //coast until the end                                                              

                                                                                            

 brake(4);