Mission 1

Mission 1

Home Mission 1 Mission 2 Mission 3 Mission 4

Rolling Chasis Mission

Criteria:

  1. Must drive in a ~10ft square pattern, stop at original location and place marker. The marker should be within 3ft of the rover’s original location and the mission should be completed within 60 seconds.
  2. Must drive straight for 15-30ft and place physical marker. The rover will read the specific intended distance from an RF transmitter beacon at the starting location. The marker should be within +/- 10% of the specified drive distance and the task should be completed in less than 30 seconds.

Mission 1A Arduino Code

#include AFMotor.h
#include Arduino.h
#include Servo.h
Servo servo;
int position = 90;
int newPosition;
AF_DCMotor dcMotor1(1); // This defines the name of the motor (dcMotor1) and port number (1).
AF_DCMotor dcMotor2(2);
void setup() {
servo.attach(10);
dcMotor1.setSpeed(200); // Set the speed for the selected DC motor. Values can range between 0 and 255.
dcMotor2.setSpeed(200);
}
void loop() {
delay(2000); //forward
dcMotor1.run(FORWARD);
dcMotor2.run(FORWARD);
delay(8400);
dcMotor1.run(RELEASE);
dcMotor2.run(RELEASE);
delay(500);
dcMotor1.run(FORWARD); //turn
dcMotor2.run(BACKWARD);
delay(700);
dcMotor1.run(RELEASE);
dcMotor2.run(RELEASE);
delay(500);
dcMotor1.run(FORWARD); //forward
dcMotor2.run(FORWARD);
delay(8400);
dcMotor1.run(RELEASE);
dcMotor2.run(RELEASE);
delay(5000000000);
dcMotor1.run(FORWARD); //turn
dcMotor2.run(BACKWARD);
delay(690);
dcMotor1.run(RELEASE);
dcMotor2.run(RELEASE);
delay(500);
dcMotor1.run(FORWARD); //forward
dcMotor2.run(FORWARD);
delay(8400);
dcMotor1.run(RELEASE);
dcMotor2.run(RELEASE);
delay(500);
dcMotor1.run(FORWARD); //turn
dcMotor2.run(BACKWARD);
delay(690);
dcMotor1.run(RELEASE);
dcMotor2.run(RELEASE);
delay(500);
dcMotor1.run(FORWARD); //forward
dcMotor2.run(FORWARD);
delay(8650);
dcMotor1.run(RELEASE);
dcMotor2.run(RELEASE);
delay(500);
servo.write(180); //dump load
delay(5000);
servo.write(position);
delay(10000000);
}


Mission 1B Arduino Code

#include RH_ASK.h
#include AFMotor.h
#include Arduino.h
RH_ASK driver;
AF_DCMotor dcMotor2(2);
void setup()
{
Serial.begin(9600);
if (!driver.init())
{
Serial.println("init failed");
}
dcMotor2.setSpeed(200);
}
void loop()
{
delay(5000);
uint8_t buf[12];
uint8_t buflen = sizeof(buf);
if (driver.recv(buf, &buflen)) // read distance received
{
String message = "";
for (int i = 0; i < buflen; i++)
{
message += (char)buf[i];
}
message.trim();
int number = message.substring(1).toInt();
float duration = number * 870 ;
Serial.print(number); //print distance received
dcMotor2.run(FORWARD); // drive forward for duration calculated
delay(duration);
dcMotor2.run(RELEASE);
delay(10000000000); // end
} }


Mission 1A Results:


Mission 1B Results: