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: StateDefines/State.h
- Revision:
- 0:31f7be68e52d
- Child:
- 1:6cd533a712c6
diff -r 000000000000 -r 31f7be68e52d StateDefines/State.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/StateDefines/State.h Thu Feb 07 17:43:19 2013 +0000 @@ -0,0 +1,113 @@ +#ifndef _STATE_H_ +#define _STATE_H_ + +#include <cmath> +#include "mbed.h" +#include "MaxonESCON.h" +#include "RobotControl.h" +#include "Task.h" +#include "HMC5883L.h" +#include "HMC6352.h" +#include "defines.h" + +/** + * @author Christian Burri + * + * @section LICENSE + * + * Copyright (c) 2013 HSLU Pren Team #1 Cruising Crêpe + * All rights reserved. + * + * @section DESCRIPTION + * + * 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; + HMC6352* compass; + AnalogIn* battery; + Timer timer; + float period; + + float magout[3]; + + + +public: + + + /** + * Creates a robot control object and initializes all private + * state variables. + * @param RobotControl Objekt 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 compass Modul HMC5883L + * @param Analog Input Battery Voltage input + * @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, HMC6352* compass, AnalogIn* battery, float period); + + /** + * Destructor of the Object to destroy the Object. + **/ + virtual ~State(); + + + /** + * Initzialize the File. Open the File plots.txt and set the title at first line + */ + void initPlotFile(void); + + + + /** + * Save the char to the file. + * For example at the end. + * Don't forget the \n at first. + */ + void savePlotText(char text[]); + + + /** + * Close the File + */ + void closePlotFile(void); + + + /** + * Return the Battery voltage + * state variables. + * @return Batterie Voltage [V] + */ + float readBattery(); + + void startTimerFromZero(); + + /** + * Save the new state to a new line + */ + void savePlotFile(state_t s); + + void run(); + + +private: + + void setBatteryBit(); + + void setEnableLeftBit(); + + void setEnableRightBit(); +}; + +#endif