Mechatronics Robotics
/
BrobotV1
These are the core files for the Robot at Team conception.
Diff: Brobot.h
- Revision:
- 11:05d5539141c8
- Parent:
- 8:351b0b7b05b2
- Child:
- 12:9a763d149f61
diff -r 351b0b7b05b2 -r 05d5539141c8 Brobot.h --- a/Brobot.h Mon May 29 13:03:28 2017 +0000 +++ b/Brobot.h Thu Jun 01 08:34:27 2017 +0000 @@ -9,6 +9,9 @@ #include <cstdlib> #include <mbed.h> #include "SpeedControl.h" +#include "PID_Control.h" +#include "IRSensor.h" +#include "Pixy.h" /** * This is a device driver class to drive the robot autonomously @@ -18,24 +21,43 @@ public: // constructors have same name as the class - Brobot(SpeedControl* speedctrl, int number); - //Brobot(); //empty constructor - + Brobot(SpeedControl& speedctrl, AnalogIn& distance, DigitalOut& enable, DigitalOut& bit0, DigitalOut& bit1, DigitalOut& bit2, DigitalOut* leds, Pixy& pixy); - // void init(PwmOut* left, PwmOut* right, int number); + void avoidObstacleAndMove(int vtrans); + void startLeds(); + void ledShow(); + void ledDistance(); void turnleft(); void turnright(); void forward(); void back(); void stop(); - void slow(float ammount); // ammount is subtracted from current speeds - void rotate(float ammount); // values from -0.5 to 0.5 + void rotate(int ammount); // + void approachBrick(); + void closeGrip(); + void openGrip(); + bool foundGreenBrick(); + bool foundHome(); + private: - PwmOut* pwmL; - PwmOut* pwmR; - int number; - SpeedControl* speedctrl; + + + 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; + SpeedControl& speedctrl; + AnalogIn& distance; + DigitalOut& enable; + DigitalOut& bit0; + DigitalOut& bit1; + DigitalOut& bit2; }; #endif /* BROBOT_H_ */