Previous Codes

This page contains the current and past codes for each part of the project. Keep in mind, some codes may be on other pages for their respective tests.

 

Preliminary R&D Lab 1;

celerate(1,0,15,2.5);       // Accelerate motor 1, from 0% to 15% power, over 2.5 sec

motorSpeed(1,15);         // Set motor 1 speed to 15%

goFor(1);                         // Run last two commands for 1 sec

brake(1);                         // Cut motor 1 power

celerate(2,0,27,4);          // Accelerate motor 2, from 0% to 27% power, over 4 sec

motorSpeed(2,27);         // Set motor 2 speed to 27%

goFor(2.7);                     // Run last two commands for 2.7 sec

celerate(2,27,15,1);        // Decelerate motor 2, from 27% to 15% over 1 sec

brake(2);                         // Cut the power to motor 2

reverse(2);                      // Run motor 2 in the opposite direction

celerate(4,0,31,2);          // Accelerate both motors from 0% to 31% power over 2 sec

motorSpeed(4,35);         // Set both motors speeds to 35%

goFor(1);                         // Run last two commands for 1 sec

brake(2);                         // Cut off motor 2 power

motorSpeed(1,35);         // Set motor 1 speed to 35%

goFor(3);                         // Run last command for 3 sec

brake(4);                         // Cut off both motor power

reverse(1);                      // Run motor 1 in opposite direction

celerate(1,0,19,2);          // Accelerate motor 1, from 0% to 19%, over 2 sec

motorSpeed(1,19);         // Set motor 1 speed to 19%

motorSpeed(2,35);         // Set motor 2 speed to 35%

goFor(2);                         // Run last two commands for 2 sec

motorSpeed(4,19);         // Set both motors speeds to 19%

goFor(2);                         // Run last command for 2 sec

celerate(4, 19,0,3);         // Decelerate both motors from 19% to 0% power over 3 sec

brake(4);                         // Cut off power to both motors

 

Preliminary R&D Lab 2;

motorSpeed(4, 25);                                   // Set both motor’s speeds to 25%

goFor(2);                                                    // Run last command for 2 sec

motorSpeed(2, 20);                                   // Set motor 2 speed to 20%

goToAbsolutePosition(295.384615);       // Run las command until AEV is at mark 295.384615

reverse(4);                                                 // Set both motors to reverse direction

motorSpeed(4, 30);                                   // Set both motors speeds to 30%

goFor(1.5);                                                // Run last command for 1.5 sec

brake(4);                                                    // Cut power to both motors

 

Preliminary R&D Lab 4;

celerate(4,0,25,3);          // Accelerate both motors from 0% to 25% power over 3 sec

goFor(1);                         // Run last command for 1 sec

motorSpeed(4,20);         // Set both motors speed to 20%

goFor(2);                         // Run last command for 1 sec

reverse(4);                      // Set both motors in reverse

motorSpeed(4,25);         // Set both motor speeds to 25%

brake(4);                         // Cut off power to both motors

Power vs. Time Plot

The motors are accelerating from 0 to 3 seconds which explains why the power is steadily increasing for about 3 seconds on the graph.  Then the motor speed decreased for a few seconds, requiring less power from the motor.  Then the motor speed remained constant causing there to be little to no change in power of the motors.  Finally, the motors shut off causing the power required to drop down to 0.

Power vs. Distance Plot

The AEV remained still during this test which is why the plot is just a straight line. The team was not able to test the AEV on the physical track so the wheels did not move.

AR&D 1&2: Propeller Configuration

Both pushing

reverse(4);                             // Reverses both motors so that they are pushing
motorSpeed(4, 40);             // Sets both motors speeds to 40.
goFor(5);                                // Has motors run for 5 seconds at motor speed 40.
brake(4);                                // Stops all motors.

One pushing, one pulling

reverse(1);                              // Reverses motor one so that it pushes rather than pulls
motorSpeed(4, 40);             //  Initializes all motor speeds to 40.
goFor(5);                                // Has motors run for 5 seconds at motor speed 40.
brake(4);                                // Stops all motors.

Both pulling;

motorSpeed(4, 40);             // Initializes all motor speeds to 40
goFor(5);                               // Has motors run for 5 seconds at motor speed 40.
brake(4);                               // Stops all motors.

 

Performance Test 1

reverse(1);                           // sets motor one in reverse
motorSpeed(4, 40);          // sets both motors to speed 40
goFor(1.75);                        // keeps above command for 1.75 seconds
celerate(4,40,10,1.7);       // decelerates both motors from 40 to 10 in 1.7 seconds
reverse(4);                          // sets both motors in reverse
motorSpeed(4, 50);          // sets both motors to 50 percent power
goFor(0.9);                        // keeps current command for 0.9 seconds
brake(4);                            // stop both motors
motorSpeed(4, 0);           // sets both motors to speed 0
goFor(7);                            // keeps above command for 7 seconds
reverse(4);                         // sets both motors in reverse
motorSpeed(4, 30);         // sets both motors to 30 speed
goFor(3);                           // keeps above command for 3 seconds

 

Performance Test 2

Code 1:

reverse(1);                                  // sets motor one in reverse
motorSpeed(4, 40);                 // sets both motors to speed 40
goFor(1.75);                              // keeps above command for 1.75 seconds
celerate(4,40,10,1.815);         // decelerates both motors from 40 to 10 in 1.815 seconds
reverse(4);                               // sets both motors in reverse
motorSpeed(4, 50);               // sets both motors to 50 percent power
goFor(0.9);                             // keeps current command for 0.9 seconds
brake(4);                                 // stop both motors
motorSpeed(4, 0);                // sets both motors to speed 0
goFor(7.1);                              // keeps above command for 7.1 seconds
reverse(4);                              // sets both motors in reverse
motorSpeed(4, 30);              // sets both motors to 30 speed
goFor(2.75);                           // keeps above command for 2.75 seconds
celerate(4,30,10,.5);             // decelerates both motors from 30 to 10 in .5 seconds
reverse(4);                              // sets both motors in reverse

Code 2:

reverse(1); // sets motor one in reverse
motorSpeed(4, 40); // sets both motors to speed 40
goToAbsolutePosition(176); // keeps above command for 30 marks
//celerate(4,40,10,1.85); // decelerates both motors from 40 to 10 in 1.7 seconds
motorSpeed(4, 0);
goToRelativePosition(82);
reverse(4); // sets both motors in reverse
motorSpeed(4, 50); // sets both motors to 50 percent power
goFor(1); // keeps current command for 0.9 seconds
brake(4); // stop both motors
motorSpeed(4, 0); // sets both motors to 0 percent power
goFor(7.2); // keeps above command for 7.2 seconds
reverse(4); // reverses both motors
motorSpeed(4, 30); // sets both motors to 30 percent power
goToRelativePosition(94); // keeps above command for 94 marks
motorSpeed(4, 0); // sets both motors to 0 percent power
goFor(1.2); // keeps above command for 1.2 seconds
brake(4); // brakes both motors
goFor(10.1); // keeps both motors at 0 percent for another 10.1 seconds
reverse(4); // reverses both motors
motorSpeed(4, 50); // sets both motors to 50 percent power
goToRelativePosition(-180); // keeps above command for 180 marks (in reverse)

 

Performance Test 3/Final Performance Test

 

reverse(1); // sets motor one in reverse
motorSpeed(4, 40); // sets both motors to speed 40
goToAbsolutePosition(176); // keeps above command for 30 marks
motorSpeed(4, 0); // sets both motors to speed 0
goToRelativePosition(80); // keeps above command for 80 marks
reverse(4); // sets both motors in reverse
motorSpeed(4, 50); // sets both motors to 50 percent power
goFor(1); // keeps current command for 0.9 seconds
brake(4); // stop both motors
motorSpeed(4, 0); // sets both motors to 0 percent power
goFor(7.2); // keeps above command for 7.2 seconds
reverse(4); // reverses both motors
motorSpeed(4, 30); // sets both motors to 30 percent power
goToRelativePosition(80); // keeps above command for 94 marks
motorSpeed(4, 0); // sets both motors to 0 percent power
goFor(1.2); // keeps above command for 1.2 seconds
brake(4); // brakes both motors
goFor(10.1); // keeps both motors at 0 percent for another 10.1 seconds
reverse(4); // reverses both motors
motorSpeed(4, 50); // sets both motors to 50 percent power
goToRelativePosition(-180); // keeps above command for 180 marks (in reverse)
motorSpeed(4, 0); // sets both motors to 0 percent power
goToRelativePosition(-96); // keeps above command for 76 marks (in reverse)
reverse(4); // reverses both motors
motorSpeed(4, 60); // sets both motors to 60 percent power
goFor(1); // keeps above command for 1 second
brake(4); // brakes both motors
reverse(4); // reverses both motors
motorSpeed(4, 0); // sets both motors to 0 percent power
goFor(7.2); // keeps above command for 7.2 seconds
motorSpeed(4, 60); // sets both motors to 60 percent power
goToRelativePosition(-30); // keeps above command for 30 marks (in reverse)
motorSpeed(4, 50); // sets both motors to 50 percent power
goToRelativePosition(-20); // keeps above command for 20 marks (in reverse)
motorSpeed(4, 0); // sets both motors to 0 percent power
goToRelativePosition(-150); // keeps above command for 120 marks (in reverse)
brake(4); // brakes both motors
reverse(4); // reverses both motors
motorSpeed(4, 30); // sets both motors to 30 percent power
goFor(1.35); // keeps above command for 1.24 seconds
motorSpeed(4, 0); // sets both motors to 0 percent power
goToRelativePosition(-30); // keeps above command for 30 marks (in reverse);
motorSpeed(4, 20); // sets both motors to speed 20
goFor(.5); // keeps above command for .5 seconds