This program is for an autonomous robot for the competition at the Hochschule Luzern. We are one of the 32 teams. <a href="http://cruisingcrepe.wordpress.com/">http://cruisingcrepe.wordpress.com/</a> 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: <a href="http://www.dis.uniroma1.it/~labrob/pub/papers/Ramsete01.pdf">http://www.dis.uniroma1.it/~labrob/pub/papers/Ramsete01.pdf</a>
Fork of autonomousRobotAndroid by
State/State.h
- Committer:
- chrigelburri
- Date:
- 2013-05-20
- Revision:
- 27:a13ede88e75f
- Parent:
- 24:08241be546ba
File content as of revision 27:a13ede88e75f:
#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; PwmOut led1; PwmOut led2; PwmOut led3; PwmOut led4; 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. * @param s struct for logging. */ void savePlotFile(state_t s); /** * Returns the transform a sinusvalue from -1.0 .. 1.0 to 0.0 .. 1.0 * @param idx number of LEDS * @param f value till 2π * @return sinus value from 0.0f 1.0f */ float dim( int idx, float f ); /** * @brief Blink the four LED like KITT * @param wait value for the speed [ms]; */ void ledArray(float wait); /** * @brief Run method actualize every period. */ void run(); private: void setBatteryBit(); void setEnableLeftBit(); void setEnableRightBit(); }; #endif