Overview of the day:
Further designing of robot and ordering new wheels. Deciding against using the IR sensor. First draft of final code for robot written.
Lab work:
Our objective for this week was to finalise a design and start drawing it in Solidworks. Adam has experience with this application and so he mainly did that side of things while Cillian and I sketched and brainstormed. Adam drew a number of parts in Solidworks but unfortunately cannot access them due to the college shutdown.
We decided against using the IR sensor as we thought it would be more hassle than its worth, hoping that our robot wouldn’t be pushed into the out of bounds area in the first place and if it was, the chances are it wouldn’t be able to drive itself back out as it would be being pushed out by the other robot anyway.
We have ordered bigger wheels off of Amazon because we think they will give us better traction and more dependability when bashing into other robots. We decided to go with these wheels as they are cheap and fit the shaft of our motors.
Cillian wrote code that would be used in the tournament, this code probably won’t be what we use on the day but it is a good base to work off of. The code can be seen here:
// Code used for RoboSumo Tournament
// Written by Cillian O'Brien
// Last Updated 11.03.2020
#define button 4 // Switch button
#define echoPin 5 // Trigger Pin for Sensor
#define trigPin 6 // Echo Pin for Sensor
long duration, distance; // Defines variables for duration of pulse, and distance from object
void setup() {
Serial.begin(9600); // Sets baud rate for info from sensor [FOR TESTING]
pinMode(trigPin, OUTPUT); // Set up the trigger pin
pinMode(echoPin, INPUT); // Set up the echo pin
pinMode(2, OUTPUT); // Motor 1 Forward
pinMode(3, OUTPUT); // Motor 1 Backward
pinMode(8, OUTPUT); // Motor 2 Forward
pinMode(9, OUTPUT); // Motor 2 Backward
pinMode(button, INPUT); // Switch Voltage Check
}
void loop() {
int push = digitalRead(button); // Setting up var for reading when button is pushed
digitalWrite(trigPin, LOW);
delayMicroseconds(20);
digitalWrite(trigPin, HIGH); // Set trigPin high
delayMicroseconds(20);
digitalWrite(trigPin, LOW); // Send pulse for 20 us
duration = pulseIn(echoPin, HIGH); //pulseIn detects the duration of pulses from trigger
distance = (duration/2)*0.034; // Time to reach object * Speed of Sound in cm/us
Serial.print(distance); // This is to print the distance (in cm) of the rangefinder
Serial.println(" cm"); // is detecting [FOR TESTING]
if (button == 1) {
Forward();
}
else if (distance < 10) {
Forward();
}
else {
Turn();
}
}
void Turn(){
digitalWrite(2, LOW);
digitalWrite(3, HIGH);
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
}
void Forward() {
digitalWrite(2, LOW);
digitalWrite(3, HIGH);
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
}
Adam contacted Ted in relation to Inkscape and laser-cutting our designs.
What I learned:
This week we were only starting our final design of the robot, so we are still in early stages.
The challenges my team faced:
We were discussing whether the IR sensor would be helpful or not, but we ultimately decided against it after much deliberation. We believe that this is the right decision.
Our tasks for next week:
Next week Adam is continuing work on the Solidworks drawings, and hopefully Ted will reply to us and guide us through the process of laser-cutting the parts. Cillian will do some more refinement to the code and I will be working on more detailed designs and drawings of our robot.
