Lab 01:
// Run motor one at a constant speed (23% power) for 2.5 second.
motorSpeed(1,23);
goFor(2.5);
// // Brake motor one.
// brake(1);
// Accelerate motor one from start to 15% power in 2.5 seconds.
celerate(1,23,15,2.5);
// Run motor one at a constant speed (15% power) for 1 second.
goFor(1);
//Brake motor one
brake(1);
//Accelerate motor two from start to 27% power in 4 seconds
celerate(2,23,27,4);
//Run motor two at a constant speed (27% power) for 2.7 seconds
goFor(2.7);
//Decelerate motor two to 15% power in 1 second
celerate(2,27,15,1);
//Brake motor two
brake(2);
//Reverse the direction of only motor 2
reverse(2);
//Accelerate all motors from start to 31% power in 2 seconds
celerate(4,0,31,2);
//Run all motors at a constant speed of 35% power for 1 second
celerate(4,31,35,1);
goFor(1);
//Brake motor two but keep motor one running at a constant speed (35% power) for 3 seconds
brake(2);
goFor(3);
//Brake all motors for 1 second
brake(4);
goFor(1);
//Reverse the direction of motor one
reverse(1);
//Accelerate motor one from start to 19% power over 2 seconds
celerate(1,0,19,2);
//Run motor two at 35% power while simultaneously running motor one at 19% power for 2 seconds
celerate(2,0,35,2);
goFor(2);
//Run both motors at a constant speed (19% power) for 2 seconds
celerate(2,35,19,1);
goFor(2);
//Decelerate both motors to 0% power in 3 seconds
celerate(4,19,0,3)
//Brake all motors
brake(4);
Lab 02:
reflectanceSensorTest(); //Tests to make sure that the reflectance sensors were working properly
Lab 03:
no code was needed
Lab 04:
motorSpeed(4,30); //set the motor speed for all motors
goToAbsolutePosition(250); //Uses the sensors to get the AEV to go to a certain position.
Matlab code for analysis:
//This code read in the data and assigned it to variables
data = xlsread(‘performance_analysis_1’);
te = data(7:279,1);
ie = data(7:279,2);
ve = data(7:279,3);
marks = data(7:279,4);
pos = data(7:279,5);
//This code converted it to physical parameters
t=te/1000;
I=(ie/1024)*2.46*(1/0.185);
V=(15*ve)/1024;
d=0.0124*marks;
s=0.0124*pos;
P= V.*I;
//This code created a energy usage plot
plot(t,P)
xlabel(‘Time (sec)’)
ylabel(‘Power (watts)’)
title(‘Power vs. Time’)
grid on
box on
//This code calculated the energy that the AEV used
xR = 130;
xL = 0;
iL = knnsearch(t,xL);
iR = knnsearch(t,xR); % Power values of Phase 1
t1 = t(iL:iR);
E= t1(218)
Lab 05:
No code was needed for this lab.
Lab 06:
reverse(1); // Reverse one of the motors
celerate(4,0,30,1); //Accelerate all motors from 0 to 30% power over 1 second
motorSpeed(4,30); //Set the motor speed to 30% for all motors
goFor(3.82); // Go at this speed for 3.82 seconds
//4.28 for 3rd floor
//3.84 for second floor
brake(4); // Brake all motors and coast to the gate
goFor(14.3); //Coast and wait at the gate for 14.3 seconds
Lab 07:
no code used during the oral presentation
Lab 08 (Performance Test 1):
reverse(1); // Reverse one of the motors
celerate(4,0,30,1); //Accelerate all motors from 0 to 30% power over 1 second
motorSpeed(4,30); //Set the motor speed to 30% for all motors
goFor(3.82); // Go at this speed for 3.82 seconds
//4.28 for 3rd floor
//3.84 for second floor
brake(4); // Brake all motors and coast to the gate
goFor(14.3); //Coast and wait at the gate for 14.3 seconds
//16.3 for third floor
//14.27 for second
celerate(4,0,30,1); //Accelerate all motors from 0 to 30% power over 1 second
motorSpeed(4,30); //Set all motors to 30% power
goFor(4.28); //Stay at this motor speed for 4.28 seconds
brake(4); //brake all motors
goFor(10); //Coast into the cargo for 10 seconds
Lab 09 (Performance Test 2):
reverse(1); // Reverse one of the motors
celerate(4,0,30,1); //Accelerate all motors from 0 to 30% power over 1 second
motorSpeed(4,30); //Set the motor speed to 30% for all motors
goFor(3.82); // Go at this speed for 3.82 seconds
//4.28 for 3rd floor
//3.84 for second floor
brake(4); // Brake all motors and coast to the gate
goFor(14.3); //Coast and wait at the gate for 14.3 seconds
//16.3 for third floor
//14.27 for second
celerate(4,0,30,1); //Accelerate all motors from 0 to 30% power over 1 second
motorSpeed(4,30); //Set all motors to 30% power
goFor(4.28); //Stay at this motor speed for 4.28 seconds
brake(4); //brake all motors
goFor(10); //Coast into the cargo for 10 seconds
reverse(4); //Reverse all motors
celerate(4,0,50,1); //Accelerate all motors from 0 to 50% over 1 second
motorSpeed(4,50); //Set motor speed at 50% for all motors
goFor(3.53); //Go at this motor speed for 3.53 seconds
brake(4); //Brake all motors
goFor(14.25); // coast and stop at the gate for 14.25 seconds
Lab 10 (Performance Test 3):
reverse(1); // Reverse one of the motors
celerate(4,0,30,1); //Accelerate all motors from 0 to 30% power over 1 second
motorSpeed(4,30); //Set the motor speed to 30% for all motors
goFor(3.82); // Go at this speed for 3.82 seconds
//4.28 for 3rd floor
//3.84 for second floor
brake(4); // Brake all motors and coast to the gate
goFor(14.3); //Coast and wait at the gate for 14.3 seconds
//16.3 for third floor
//14.27 for second
celerate(4,0,30,1); //Accelerate all motors from 0 to 30% power over 1 second
motorSpeed(4,30); //Set all motors to 30% power
goFor(4.28); //Stay at this motor speed for 4.28 seconds
brake(4); //brake all motors
goFor(10); //Coast into the cargo for 10 seconds
reverse(4); //Reverse all motors
celerate(4,0,50,1); //Accelerate all motors from 0 to 50% over 1 second
motorSpeed(4,50); //Set motor speed at 50% for all motors
goFor(3.53); //Go at this motor speed for 3.53 seconds
brake(4); //Brake all motors
goFor(14.25); // coast and stop at the gate for 14.25 seconds
celerate(4,0,50,1); //Accelerate all motors from 0 to 50% over 1 second
motorSpeed(4,50); //Set motor speed to 50%
goFor(4.05); //Go at this motor speed for 4.05 seconds
Lab 11 (Final Testing):
reverse(1); // Reverse one of the motors
celerate(4,0,30,1); //Accelerate all motors from 0 to 30% power over 1 second
motorSpeed(4,30); //Set the motor speed to 30% for all motors
goFor(3.82); // Go at this speed for 3.82 seconds
//4.28 for 3rd floor
//3.84 for second floor
brake(4); // Brake all motors and coast to the gate
goFor(14.3); //Coast and wait at the gate for 14.3 seconds
//16.3 for third floor
//14.27 for second
celerate(4,0,30,1); //Accelerate all motors from 0 to 30% power over 1 second
motorSpeed(4,30); //Set all motors to 30% power
goFor(4.28); //Stay at this motor speed for 4.28 seconds
brake(4); //brake all motors
goFor(10); //Coast into the cargo for 10 seconds
reverse(4); //Reverse all motors
celerate(4,0,50,1); //Accelerate all motors from 0 to 50% over 1 second
motorSpeed(4,50); //Set motor speed at 50% for all motors
goFor(3.53); //Go at this motor speed for 3.53 seconds
brake(4); //Brake all motors
goFor(14.25); // coast and stop at the gate for 14.25 seconds
celerate(4,0,50,1); //Accelerate all motors from 0 to 50% over 1 second
motorSpeed(4,50); //Set motor speed to 50%
goFor(4.05); //Go at this motor speed for 4.05 seconds and coast to the finish