This program is for an autonomous robot for the competition at the Hochschule Luzern. http://cruisingcrepe.wordpress.com/ We are one of the 32 teams. http://cruisingcrepe.wordpress.com/ The postition control is based on this Documentation: Control of Wheeled Mobile Robots: An Experimental Overview from Alessandro De Luca, Giuseppe Oriolo, Marilena Vendittelli. For more information see here: http://www.dis.uniroma1.it/~labrob/pub/papers/Ramsete01.pdf
Fork of autonomous Robot Android by
Diff: State/State.h
- Revision:
- 12:235e318a414f
- Parent:
- 11:775ebb69d5e1
- Child:
- 23:4d8173c5183b
diff -r 775ebb69d5e1 -r 235e318a414f State/State.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/State/State.h Sun Apr 07 08:31:51 2013 +0000 @@ -0,0 +1,100 @@ +#ifndef _STATE_H_ +#define _STATE_H_ + +#include "MaxonESCON.h" +#include "RobotControl.h" +#include "Task.h" +#include "defines.h" + +/** + * @author Christian Burri + * + * @copyright Copyright © 2013 HSLU Pren Team #1 Cruising Crêpe + * All rights reserved. + * + * @brief + * + * State is the main mechanism for communicating current realtime system state to + * the rest of the system for logging etc. + * + */ + +class State : public Task +{ + +private: + + state_t* s; + RobotControl* robotControl; + MaxonESCON* motorControllerLeft; + MaxonESCON* motorControllerRight; + AnalogIn battery; + Timer timer; + float period; + +public: + + /** + * @brief Creates a robot control object and initializes all private state variables. + * @param s struct to read and write the state + * @param robotControl Object to read the state + * @param motorControllerLeft a reference to the servo drive for the left motor + * @param motorControllerRight a reference to the servo drive for the right motor + * @param batteryPin mbed pin for analog Input Battery Voltage + * @param period the sampling period of the run loop of this controller, given in [s] + */ + State(state_t* s, + RobotControl* robotControl, + MaxonESCON* motorControllerLeft, + MaxonESCON* motorControllerRight, + PinName batteryPin, + float period); + + /** + * @brief Destructor of the Object to destroy the Object. + */ + virtual ~State(); + + /** + * @brief Initzialize the File. Open the File plots.txt and set the title at first line. + */ + void initPlotFile(void); + + /** + * @brief Close the File. + */ + void closePlotFile(void); + + /** + * @brief Return the Battery voltage + * state variables. + * @return Batterie Voltage [V] + */ + float readBattery(); + + /** + * @brief Starts the timer from zero. + * The timer is for the logging Time. + */ + void startTimerFromZero(); + + /** + * @brief Save the new state to a new line. + */ + void savePlotFile(state_t s); + + /** + * @brief Run method actualize every period. + */ + void run(); + +private: + + void setBatteryBit(); + + void setEnableLeftBit(); + + void setEnableRightBit(); +}; + +#endif