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: RobotControl/RobotControl.h
- Revision:
- 6:48eeb41188dd
- Parent:
- 5:48a258f6335e
- Child:
- 11:775ebb69d5e1
--- a/RobotControl/RobotControl.h Thu Mar 21 08:56:53 2013 +0000 +++ b/RobotControl/RobotControl.h Sat Mar 23 13:52:48 2013 +0000 @@ -45,103 +45,125 @@ float speed; float omega; + /** + * Add ±2π when the range of + * the radian is over +π or under -π. + * @param theta to check the value + * @return the value in the range from -π to +π + */ + float PiRange(float theta); + public: /** - * Creates a <code>Robot Control</code> object and initializes all private - * state variables. - * @param motorControllerLeft a reference to the servo drive for the left motor - * @param motorControllerRight a reference to the servo drive for the right motor + * Creates a <code>Robot Control</code> object and + * initializes all private state variables. + * @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 period the sampling period of the run loop of this controller, given in [s] + * @param period the sampling period of the run loop of + * this controller, given in [s] */ - RobotControl(MaxonESCON* motorControllerLeft, MaxonESCON* motorControllerRight, /*HMC6352* compass,*/ float period); + RobotControl(MaxonESCON* motorControllerLeft, + MaxonESCON* + motorControllerRight, + /*HMC6352* compass,*/ + float period); /** - * Destructor of the Object to destroy the Object. - **/ + * Destructor of the Object to destroy the Object. + **/ virtual ~RobotControl(); /** - * Enables or disables the servo drives of the motors. - * @param enable if <code>true</code> enables the drives, <code>false</code> otherwise - * the servo drives are shut down. - */ + * Enables or disables the servo drives of the motors. + * @param enable if <code>true</code> enables the drives, + * <code>false</code> otherwise + * the servo drives are shut down. + */ void setEnable(bool enable); /** - * Tests if the servo drives of the motors are enabled. - * @return <code>true</code> if the drives are enabled, <code>false</code> otherwise - */ + * Tests if the servo drives of the motors are enabled. + * @return <code>true</code> if the drives are enabled, + * <code>false</code> otherwise + */ bool isEnabled(); /** - * Sets the maximum acceleration value. - * @param acceleration the maximum acceleration value to use for the calculation of the motion trajectory, given in [m/s<SUP>2</SUP>] - */ + * Sets the maximum acceleration value. + * @param acceleration the maximum acceleration value to use + * for the calculation of the motion trajectory, given in [m/s<SUP>2</SUP>] + */ void setAcceleration(float acceleration); /** - * Sets the maximum acceleration value of rotation. - * @param acceleration the maximum acceleration value to use for the calculation of the motion trajectory, given in [rad/s<SUP>2</SUP>] - */ + * Sets the maximum acceleration value of rotation. + * @param acceleration the maximum acceleration value + * to use for the calculation of the motion trajectory, + * given in [rad/s<SUP>2</SUP>] + */ void setThetaAcceleration(float acceleration); /** - * Sets the desired translational speed of the robot. - * @param speed the desired speed, given in [m/s] - */ + * Sets the desired translational speed of the robot. + * @param speed the desired speed, given in [m/s] + */ void setDesiredSpeed(float speed); /** - * Sets the desired rotational speed of the robot. - * @param omega the desired rotational speed, given in [rad/s] - */ + * Sets the desired rotational speed of the robot. + * @param omega the desired rotational speed, given in [rad/s] + */ void setDesiredOmega(float omega); /** - * Sets the desired X-position of the robot. - * @param xposition the desired position, given in [m] - */ + * Sets the desired X-position of the robot. + * @param xposition the desired position, given in [m] + */ void setDesiredxPosition(float xposition); /** - * Sets the desired Y-position of the robot. - * @param yposition the desired position, given in [m] - */ + * Sets the desired Y-position of the robot. + * @param yposition the desired position, given in [m] + */ void setDesiredyPosition(float yposition); /** - * Sets the desired θ of the robot. - * @param theta the desired θ, given in [rad] - */ + * Sets the desired θ of the robot. + * @param theta the desired θ, given in [rad] + */ void setDesiredTheta(float theta); - - /** - * Get the desired X-position of the robot. - * @return xposition the desired position, given in [m] - */ + + /** + * Get the desired X-position of the robot. + * @return xposition the desired position, given in [m] + */ float getDesiredxPosition(); /** - * Get the desired Y-position of the robot. - * @return yposition the desired position, given in [m] - */ + * Get the desired Y-position of the robot. + * @return yposition the desired position, given in [m] + */ float getDesiredyPosition(); /** - * Get the desired θ of the robot. - * @return theta the desired θ, given in [rad] - */ + * Get the desired θ of the robot. + * @return theta the desired θ, given in [rad] + */ float getDesiredTheta(); /** - * Sets the desired Position and θ. - * @param xposition the desired position, given in [m] - * @param yposition the desired position, given in [m] - * @param theta the desired θ, given in [rad] - */ - void setDesiredPositionAndAngle(float xposition, float yposition, float theta); + * Sets the desired Position and θ. + * @param xposition the desired position, given in [m] + * @param yposition the desired position, given in [m] + * @param theta the desired θ, given in [rad] + */ + void setDesiredPositionAndAngle(float xposition, + float yposition, + float theta); /** * Gets the desired θ of the goal point. @@ -162,85 +184,82 @@ float getActualSpeed(); /** - * Gets the desired rotational speed of the robot. - * @return the desired speed, given in [rad/s] - */ + * Gets the desired rotational speed of the robot. + * @return the desired speed, given in [rad/s] + */ float getDesiredOmega(); /** - * Gets the actual rotational speed of the robot. - * @return the desired speed, given in [rad/s] - */ + * Gets the actual rotational speed of the robot. + * @return the desired speed, given in [rad/s] + */ float getActualOmega(); /** - * Gets the actual translational X-position of the robot. - * @return the actual position, given in [m] - */ + * Gets the actual translational X-position of the robot. + * @return the actual position, given in [m] + */ float getxActualPosition(); /** - * Gets the X-position following error of the robot. - * @return the position following error, given in [m] - */ + * Gets the X-position following error of the robot. + * @return the position following error, given in [m] + */ float getxPositionError(); /** - * Gets the actual translational Y-position of the robot. - * @return the actual position, given in [m] - */ + * Gets the actual translational Y-position of the robot. + * @return the actual position, given in [m] + */ float getyActualPosition(); /** - * Gets the Y-position following error of the robot. - * @return the position following error, given in [m] - */ + * Gets the Y-position following error of the robot. + * @return the position following error, given in [m] + */ float getyPositionError(); /** - * Gets the actual orientation of the robot. - * @return the orientation, given in [rad] - */ + * Gets the actual orientation of the robot. + * @return the orientation, given in [rad] + */ float getActualTheta(); /** - * Gets the orientation following error of the robot. - * @return the orientation following error, given in [rad] - */ + * Gets the orientation following error of the robot. + * @return the orientation following error, given in [rad] + */ float getThetaError(); /** - * Gets the distance to disired point. Calculate with pythagoras. - * @return distance to goal, given in [m] - */ + * Gets the distance to disired point. Calculate with pythagoras. + * @return distance to goal, given in [m] + */ float getDistanceError(); /** - * Gets the θ ot the pointing vector to the goal right the unicycle axis from actual point. - * @return theta to goal, given in [rad] - */ + * Gets the θ ot the pointing vector to the goal right + * the unicycle axis from actual point. + * @return theta to goal, given in [rad] + */ float getThetaErrorToGoal(); /** - * Gets the θ ot the pointing vector to the goal right the unicycle main axis. - * @return theta from the goal, given in [rad] - */ + * Gets the θ ot the pointing vector to the goal right the unicycle main axis. + * @return theta from the goal, given in [rad] + */ float getThetaGoal(); /** - * Set all state to zero, except the X-position, y-position and θ. - * @param xZeroPos Sets the start X-position, given in [m] - * @param yZeroPos Sets the start y-position, given in [m] - * @param theta Sets the start θ, given in [rad] - */ - void setAllToZero(float xZeroPos, float yZeroPos, float theta); + * Set all state to zero, except the X-position, y-position and θ. + * @param xZeroPos Sets the start X-position, given in [m] + * @param yZeroPos Sets the start y-position, given in [m] + * @param theta Sets the start θ, given in [rad] + */ + void setAllToZero(float xZeroPos, + float yZeroPos, + float theta); - /** - * Add ±2π when the range of the radian is over +π or under -π. - * @param theta to check the value - * @return the value in the range from -π to +π - */ - float PiRange(float theta); void run(); };