Mechatronics Robotics / Mbed 2 deprecated BrobotV1

Dependencies:   mbed UniServ

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Brobot.h Source File

Brobot.h

00001 /*
00002  * Brobot.h
00003  *
00004  */
00005 
00006 #ifndef BROBOT_H_
00007 #define BROBOT_H_
00008 
00009 #include <cstdlib>
00010 #include <mbed.h>
00011 #include "SpeedControl.h"
00012 #include "PID_Control.h"
00013 #include "IRSensor.h"
00014 #include "Pixy.h"
00015 #include "UniServ.h"
00016 
00017 /**
00018  * This is a device driver class to drive the robot autonomously
00019  */
00020 class Brobot
00021 {
00022 
00023 public:
00024     // constructors have same name as the class
00025     Brobot(SpeedControl& speedctrl, AnalogIn& distance, DigitalOut& enable, DigitalOut& bit0, DigitalOut& bit1, DigitalOut& bit2, DigitalOut* leds, Pixy& pixy, UniServ& servo);
00026 
00027     void        avoidObstacleAndMove(int vtrans);
00028     void        startLeds();
00029     void        ledShow();
00030     void        ledDistance();
00031     void        forward();
00032     void        back();
00033     void        stop();
00034     void        rotate(int ammount); //
00035     int         rotateAndApproach();
00036     bool        approachHome();
00037     void        closeGrip();
00038     void        openGrip();
00039     bool        foundGreenBrick();
00040     bool        foundHome();
00041     
00042 
00043 private:
00044 
00045     SpeedControl& speedctrl;
00046     AnalogIn& distance;
00047     DigitalOut& enable;
00048     DigitalOut& bit0;
00049     DigitalOut& bit1;
00050     DigitalOut& bit2;
00051     IRSensor sensor_front; // uses the default constructor because no arguments given
00052     IRSensor sensor_left;
00053     IRSensor sensor_right;
00054     DigitalOut* leds;  //0 to 5
00055     IRSensor sensors[6];
00056     Ticker t1;
00057     PID_Control pid;
00058     PID_Control pixypid;
00059     PID_Control pixypidS;
00060     Pixy& pixy;
00061     UniServ& servo;
00062     float e ;
00063 
00064 };
00065 
00066 #endif /* BROBOT_H_ */