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

Dependencies:   mbed

Fork of autonomous Robot Android by Christian Burri

Committer:
chrigelburri
Date:
Thu Feb 07 17:43:19 2013 +0000
Revision:
0:31f7be68e52d
Child:
1:6cd533a712c6
first steps

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chrigelburri 0:31f7be68e52d 1 #ifndef _MOTION_STATE_H_
chrigelburri 0:31f7be68e52d 2 #define _MOTION_STATE_H_
chrigelburri 0:31f7be68e52d 3
chrigelburri 0:31f7be68e52d 4 #include <cmath>
chrigelburri 0:31f7be68e52d 5 #include "defines.h"
chrigelburri 0:31f7be68e52d 6
chrigelburri 0:31f7be68e52d 7 /**
chrigelburri 0:31f7be68e52d 8 * @author Christian Burri
chrigelburri 0:31f7be68e52d 9 *
chrigelburri 0:31f7be68e52d 10 * @section LICENSE
chrigelburri 0:31f7be68e52d 11 *
chrigelburri 0:31f7be68e52d 12 * Copyright (c) 2013 HSLU Pren Team #1 Cruising Crêpe
chrigelburri 0:31f7be68e52d 13 * All rights reserved.
chrigelburri 0:31f7be68e52d 14 *
chrigelburri 0:31f7be68e52d 15 * @section DESCRIPTION
chrigelburri 0:31f7be68e52d 16 *
chrigelburri 0:31f7be68e52d 17 * ?????
chrigelburri 0:31f7be68e52d 18 *
chrigelburri 0:31f7be68e52d 19 */
chrigelburri 0:31f7be68e52d 20 class MotionState
chrigelburri 0:31f7be68e52d 21 {
chrigelburri 0:31f7be68e52d 22
chrigelburri 0:31f7be68e52d 23 private:
chrigelburri 0:31f7be68e52d 24
chrigelburri 0:31f7be68e52d 25 float acceleration;
chrigelburri 0:31f7be68e52d 26 float thetaAcceleration;
chrigelburri 0:31f7be68e52d 27
chrigelburri 0:31f7be68e52d 28 public:
chrigelburri 0:31f7be68e52d 29
chrigelburri 0:31f7be68e52d 30 /** The xposition value of this motion state. */
chrigelburri 0:31f7be68e52d 31 float xposition;
chrigelburri 0:31f7be68e52d 32 /** The yposition value of this motion state. */
chrigelburri 0:31f7be68e52d 33 float yposition;
chrigelburri 0:31f7be68e52d 34 /** The angle of this motion state. */
chrigelburri 0:31f7be68e52d 35 float theta;
chrigelburri 0:31f7be68e52d 36 /** The angle of this motion state from the compass. */
chrigelburri 0:31f7be68e52d 37 float thetaCompass;
chrigelburri 0:31f7be68e52d 38 /** The speed value of this motion state. */
chrigelburri 0:31f7be68e52d 39 float speed;
chrigelburri 0:31f7be68e52d 40 /** The speed rotational value of this motion state. */
chrigelburri 0:31f7be68e52d 41 float omega;
chrigelburri 0:31f7be68e52d 42
chrigelburri 0:31f7be68e52d 43 /**
chrigelburri 0:31f7be68e52d 44 * Creates a <code>MotionState</code> object.
chrigelburri 0:31f7be68e52d 45 * The values for position and speed are set to 0.
chrigelburri 0:31f7be68e52d 46 */
chrigelburri 0:31f7be68e52d 47 MotionState();
chrigelburri 0:31f7be68e52d 48
chrigelburri 0:31f7be68e52d 49 /**
chrigelburri 0:31f7be68e52d 50 * Creates a <code>MotionState</code> object with given values for position and speed.
chrigelburri 0:31f7be68e52d 51 * @param xposition the initial position value of this motion state, given in [m].
chrigelburri 0:31f7be68e52d 52 * @param yposition the initial position value of this motion state, given in [m].
chrigelburri 0:31f7be68e52d 53 * @param theta the initial angle value of this motion state, given in [rad].
chrigelburri 0:31f7be68e52d 54 * @param speed the initial speed value of this motion state, given in [m/s].
chrigelburri 0:31f7be68e52d 55 * @param omega the initial omega speed value of this motion state, given in [rad/s].
chrigelburri 0:31f7be68e52d 56 */
chrigelburri 0:31f7be68e52d 57 MotionState(float xposition, float yposition, float theta, float speed, float omega);
chrigelburri 0:31f7be68e52d 58
chrigelburri 0:31f7be68e52d 59 /**
chrigelburri 0:31f7be68e52d 60 * Destructor of the Object to destroy the Object.
chrigelburri 0:31f7be68e52d 61 **/
chrigelburri 0:31f7be68e52d 62 virtual ~MotionState();
chrigelburri 0:31f7be68e52d 63
chrigelburri 0:31f7be68e52d 64 /**
chrigelburri 0:31f7be68e52d 65 * Sets the values for xPosition, yPostion and angle.
chrigelburri 0:31f7be68e52d 66 * @param xposition the initial position value of this motion state, given in [m].
chrigelburri 0:31f7be68e52d 67 * @param yposition the initial position value of this motion state, given in [m].
chrigelburri 0:31f7be68e52d 68 * @param theta the initial angle value of this motion state, given in [rad].
chrigelburri 0:31f7be68e52d 69 * @param speed the initial speed value of this motion state, given in [m/s].
chrigelburri 0:31f7be68e52d 70 * @param omega the initial omega speed value of this motion state, given in [rad/s].
chrigelburri 0:31f7be68e52d 71 */
chrigelburri 0:31f7be68e52d 72 void setState(float xposition, float yposition, float theta, float speed, float omega);
chrigelburri 0:31f7be68e52d 73
chrigelburri 0:31f7be68e52d 74 /**
chrigelburri 0:31f7be68e52d 75 * Sets the values for xPosition, yPostion and angle.
chrigelburri 0:31f7be68e52d 76 * @param motionState another <code>MotionState</code> object to copy the state values from.
chrigelburri 0:31f7be68e52d 77 */
chrigelburri 0:31f7be68e52d 78 void setState(MotionState* motionState);
chrigelburri 0:31f7be68e52d 79
chrigelburri 0:31f7be68e52d 80 /**
chrigelburri 0:31f7be68e52d 81 * Sets the X-position value.
chrigelburri 0:31f7be68e52d 82 * @param the desired xposition value of this motion state, given in [m].
chrigelburri 0:31f7be68e52d 83 */
chrigelburri 0:31f7be68e52d 84 void setxPosition(float position);
chrigelburri 0:31f7be68e52d 85
chrigelburri 0:31f7be68e52d 86 /**
chrigelburri 0:31f7be68e52d 87 * Gets the X-position value.
chrigelburri 0:31f7be68e52d 88 * @return the xposition value of this motion state, given in [m].
chrigelburri 0:31f7be68e52d 89 */
chrigelburri 0:31f7be68e52d 90 float getxPosition();
chrigelburri 0:31f7be68e52d 91
chrigelburri 0:31f7be68e52d 92 /**
chrigelburri 0:31f7be68e52d 93 * Sets the Y-position value.
chrigelburri 0:31f7be68e52d 94 * @param the desired yposition value of this motion state, given in [m].
chrigelburri 0:31f7be68e52d 95 */
chrigelburri 0:31f7be68e52d 96 void setyPosition(float yposition);
chrigelburri 0:31f7be68e52d 97
chrigelburri 0:31f7be68e52d 98 /**
chrigelburri 0:31f7be68e52d 99 * Gets the Y-position value.
chrigelburri 0:31f7be68e52d 100 * @return the xposition value of this motion state, given in [m].
chrigelburri 0:31f7be68e52d 101 */
chrigelburri 0:31f7be68e52d 102 float getyPosition();
chrigelburri 0:31f7be68e52d 103
chrigelburri 0:31f7be68e52d 104 /**
chrigelburri 0:31f7be68e52d 105 * Sets the theta value.
chrigelburri 0:31f7be68e52d 106 * @param the desired theta value of this motion state, given in [m].
chrigelburri 0:31f7be68e52d 107 */
chrigelburri 0:31f7be68e52d 108 void setTheta(float theta);
chrigelburri 0:31f7be68e52d 109
chrigelburri 0:31f7be68e52d 110 /**
chrigelburri 0:31f7be68e52d 111 * Gets the angle value.
chrigelburri 0:31f7be68e52d 112 * @return the theta value of this motion state, given in [rad].
chrigelburri 0:31f7be68e52d 113 */
chrigelburri 0:31f7be68e52d 114 float getTheta();
chrigelburri 0:31f7be68e52d 115
chrigelburri 0:31f7be68e52d 116 /**
chrigelburri 0:31f7be68e52d 117 * Sets the speed value.
chrigelburri 0:31f7be68e52d 118 * @param speed the desired speed value of this motion state, given in [m/s].
chrigelburri 0:31f7be68e52d 119 */
chrigelburri 0:31f7be68e52d 120 void setSpeed(float speed);
chrigelburri 0:31f7be68e52d 121
chrigelburri 0:31f7be68e52d 122 /**
chrigelburri 0:31f7be68e52d 123 * Gets the speed value.
chrigelburri 0:31f7be68e52d 124 * @return the speed value of this motion state, given in [m/s].
chrigelburri 0:31f7be68e52d 125 */
chrigelburri 0:31f7be68e52d 126 float getSpeed();
chrigelburri 0:31f7be68e52d 127
chrigelburri 0:31f7be68e52d 128 /**
chrigelburri 0:31f7be68e52d 129 * Sets the omega value.
chrigelburri 0:31f7be68e52d 130 * @param omega the desired omega value of this motion state, given in [rad/s].
chrigelburri 0:31f7be68e52d 131 */
chrigelburri 0:31f7be68e52d 132 void setOmega(float omega);
chrigelburri 0:31f7be68e52d 133
chrigelburri 0:31f7be68e52d 134 /**
chrigelburri 0:31f7be68e52d 135 * Gets the omega value.
chrigelburri 0:31f7be68e52d 136 * @return the omega value of this motion state, given in [rad/s].
chrigelburri 0:31f7be68e52d 137 */
chrigelburri 0:31f7be68e52d 138 float getOmega();
chrigelburri 0:31f7be68e52d 139
chrigelburri 0:31f7be68e52d 140 /**
chrigelburri 0:31f7be68e52d 141 * Sets the maximum acceleration value.
chrigelburri 0:31f7be68e52d 142 * @param acceleration the maximum acceleration value to use for the calculation
chrigelburri 0:31f7be68e52d 143 * of the motion trajectory, given in [m/s&sup2;].
chrigelburri 0:31f7be68e52d 144 */
chrigelburri 0:31f7be68e52d 145 void setAcceleration(float acceleration);
chrigelburri 0:31f7be68e52d 146
chrigelburri 0:31f7be68e52d 147 /**
chrigelburri 0:31f7be68e52d 148 * Gets the maximum acceleration value.
chrigelburri 0:31f7be68e52d 149 * @return the maximum acceleration value used for the calculation
chrigelburri 0:31f7be68e52d 150 * of the motion trajectory, given in [m/s&sup2;].
chrigelburri 0:31f7be68e52d 151 */
chrigelburri 0:31f7be68e52d 152 float getAcceleration();
chrigelburri 0:31f7be68e52d 153
chrigelburri 0:31f7be68e52d 154 /**
chrigelburri 0:31f7be68e52d 155 * Sets the maximum acceleration value of rotation.
chrigelburri 0:31f7be68e52d 156 * @param acceleration the maximum acceleration value to use for the calculation
chrigelburri 0:31f7be68e52d 157 * of the motion trajectory, given in [rad/s&sup2;].
chrigelburri 0:31f7be68e52d 158 */
chrigelburri 0:31f7be68e52d 159 void setThetaAcceleration(float thetaAcceleration);
chrigelburri 0:31f7be68e52d 160
chrigelburri 0:31f7be68e52d 161 /**
chrigelburri 0:31f7be68e52d 162 * Gets the maximum acceleration value of rotation.
chrigelburri 0:31f7be68e52d 163 * @return the maximum acceleration value used for the calculation
chrigelburri 0:31f7be68e52d 164 * of the motion trajectory, given in [rad/s&sup2;].
chrigelburri 0:31f7be68e52d 165 */
chrigelburri 0:31f7be68e52d 166 float getThetaAcceleration();
chrigelburri 0:31f7be68e52d 167
chrigelburri 0:31f7be68e52d 168 /**
chrigelburri 0:31f7be68e52d 169 * Increments the current motion state towards a given desired speed.
chrigelburri 0:31f7be68e52d 170 * @param desiredSpeed the desired speed given in [m/s].
chrigelburri 0:31f7be68e52d 171 * @param desiredOmega the desired omega given in [rad/s].
chrigelburri 0:31f7be68e52d 172 * @param period the time period to increment the motion state for, given in [s].
chrigelburri 0:31f7be68e52d 173 */
chrigelburri 0:31f7be68e52d 174 void increment(float desiredSpeed, float desiredOmega, float period);
chrigelburri 0:31f7be68e52d 175 };
chrigelburri 0:31f7be68e52d 176
chrigelburri 0:31f7be68e52d 177 #endif