These are the core files for the Robot at Team conception.

Dependencies:   mbed UniServ

Brobot.h

Committer:
obrie829
Date:
2017-06-05
Revision:
15:4efc66de795a
Parent:
8:351b0b7b05b2
Child:
17:ec52258b9472

File content as of revision 15:4efc66de795a:

/*
 * Brobot.h
 *
 */

#ifndef BROBOT_H_
#define BROBOT_H_

#include <cstdlib>
#include <mbed.h>
#include "SpeedControl.h"
#include "PID_Control.h"
#include "IRSensor.h"
#include "Pixy.h"
#include "UniServ.h"

/**
 * This is a device driver class to drive the robot autonomously
 */
class Brobot
{

public:
    // constructors have same name as the class
    Brobot(SpeedControl& speedctrl, AnalogIn& distance, DigitalOut& enable, DigitalOut& bit0, DigitalOut& bit1, DigitalOut& bit2, DigitalOut* leds, Pixy& pixy, UniServ& servo);

    void        avoidObstacleAndMove(int vtrans);
    void        startLeds();
    void        ledShow();
    void        ledDistance();
    void        forward();
    void        back();
    void        stop();
    void        rotate(int ammount); //
    void        approachBrick();
    bool        approachHome();
    void        closeGrip();
    void        openGrip();
    bool        foundGreenBrick();
    bool        foundHome();
    

private:

    SpeedControl& speedctrl;
    AnalogIn& distance;
    DigitalOut& enable;
    DigitalOut& bit0;
    DigitalOut& bit1;
    DigitalOut& bit2;
    IRSensor sensor_front; // uses the default constructor because no arguments given
    IRSensor sensor_left;
    IRSensor sensor_right;
    DigitalOut* leds;  //0 to 5
    IRSensor sensors[6];
    Ticker t1;
    PID_Control pid;
    PID_Control pixypid;
    Pixy& pixy;
    UniServ& servo;

};

#endif /* BROBOT_H_ */