Spring 2014, ECE 4180 project, Georgia Institute of Technolgoy. This is the human driver (RF controller) program for the Robotics Cat and Mouse program.

Dependencies:   ADXL345_I2C_NEST HMC6352 IMUfilter ITG3200_NEST USBHost mbed-rtos mbed

Fork of Project by Ganesh Subramaniam

Files at this revision

API Documentation at this revision

Comitter:
Strikewolf
Date:
Fri Apr 11 17:40:07 2014 +0000
Child:
1:41cee26b35cc
Commit message:
Intial Commit

Changed in this revision

RobotControl.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RobotControl.h	Fri Apr 11 17:40:07 2014 +0000
@@ -0,0 +1,46 @@
+//*******************************************
+//* Robot motor control and drive functions *
+//*******************************************
+
+#include "HMC6352.h"
+
+//Gyro
+HMC6532 compass(p28, p27);
+
+//H-bridge
+PwmOut rightMotorPWM(p21);  //Channel A
+PwmOut leftMotorPWM(p22);   //Channel B
+DigitalOut leftMotor1(p23);
+DigitalOut leftMotor2(p24);
+DigitalOut rightMotor1(p25);
+DigitalOut rightMotor2(p26);
+
+//Non-feedback corrected 'dumb' driving
+void setDriveStraight(float speed, bool reverse) {
+    //Set speed
+    rightMotorPWM = speed;
+    leftMotorPWM = speed;
+    
+    //Set motor function
+    leftMotor1 = (!reverse) ? 0 : 1;
+    leftMotor2 = (!reverse) ? 1 : 0;
+    rightMotor1 = (!reverse) ? 0 : 1;
+    rightMotor2 = (!reverse) ? 1 : 0;
+}
+
+//Stop with braking
+void stop() {
+    rightMotorPWM = 0;
+    leftMotorPWM = 0;
+    leftMotor1 = 0;
+    leftMotor2 = 0;
+    rightMotor1 = 0;
+    rightMotor2 = 0;
+}
+
+//Need compass module
+void gyroDriveStraight(float speed, bool reverse);
+void centerTurnLeft(int delta_degrees);
+void centerTurnRight(int delta_degrees);
+void driveTurnLeft(int delta_degrees);
+void driveTurnRight(int delta_degrees);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Apr 11 17:40:07 2014 +0000
@@ -0,0 +1,13 @@
+#include "mbed.h"
+#include "RobotControl.h"
+
+int main() {
+    setDriveStraight(1, false);
+    wait(1);
+    setDriveStraight(1, true);
+    wait(1);
+    stop();
+    
+    while(1) {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Apr 11 17:40:07 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/7d30d6019079
\ No newline at end of file