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
RobotControl/MotionState.h@3:92ba0254af87, 2013-03-07 (annotated)
- Committer:
- chrigelburri
- Date:
- Thu Mar 07 09:47:07 2013 +0000
- Revision:
- 3:92ba0254af87
- Parent:
- 1:6cd533a712c6
- Child:
- 6:48eeb41188dd
bitte kommentare korriegieren;
Who changed what in which revision?
User | Revision | Line number | New 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 "defines.h" |
chrigelburri | 0:31f7be68e52d | 5 | |
chrigelburri | 0:31f7be68e52d | 6 | /** |
chrigelburri | 0:31f7be68e52d | 7 | * @author Christian Burri |
chrigelburri | 0:31f7be68e52d | 8 | * |
chrigelburri | 0:31f7be68e52d | 9 | * @section LICENSE |
chrigelburri | 0:31f7be68e52d | 10 | * |
chrigelburri | 1:6cd533a712c6 | 11 | * Copyright © 2013 HSLU Pren Team #1 Cruising Crêpe |
chrigelburri | 0:31f7be68e52d | 12 | * All rights reserved. |
chrigelburri | 0:31f7be68e52d | 13 | * |
chrigelburri | 0:31f7be68e52d | 14 | * @section DESCRIPTION |
chrigelburri | 0:31f7be68e52d | 15 | * |
chrigelburri | 3:92ba0254af87 | 16 | * This help class is for calculate and save the actual or desired value. |
chrigelburri | 3:92ba0254af87 | 17 | * There have the setter and the getter methode to change the value |
chrigelburri | 3:92ba0254af87 | 18 | * Is also possible to limit the translational and rotational speed |
chrigelburri | 3:92ba0254af87 | 19 | * by the value acceleration and thetaAcceleration. Therefore |
chrigelburri | 3:92ba0254af87 | 20 | * can adjust the ramp. |
chrigelburri | 0:31f7be68e52d | 21 | * |
chrigelburri | 0:31f7be68e52d | 22 | */ |
chrigelburri | 0:31f7be68e52d | 23 | class MotionState |
chrigelburri | 0:31f7be68e52d | 24 | { |
chrigelburri | 0:31f7be68e52d | 25 | |
chrigelburri | 0:31f7be68e52d | 26 | private: |
chrigelburri | 0:31f7be68e52d | 27 | |
chrigelburri | 0:31f7be68e52d | 28 | float acceleration; |
chrigelburri | 0:31f7be68e52d | 29 | float thetaAcceleration; |
chrigelburri | 0:31f7be68e52d | 30 | |
chrigelburri | 0:31f7be68e52d | 31 | public: |
chrigelburri | 0:31f7be68e52d | 32 | |
chrigelburri | 0:31f7be68e52d | 33 | /** The xposition value of this motion state. */ |
chrigelburri | 0:31f7be68e52d | 34 | float xposition; |
chrigelburri | 0:31f7be68e52d | 35 | /** The yposition value of this motion state. */ |
chrigelburri | 0:31f7be68e52d | 36 | float yposition; |
chrigelburri | 3:92ba0254af87 | 37 | /** The θ of this motion state. */ |
chrigelburri | 0:31f7be68e52d | 38 | float theta; |
chrigelburri | 3:92ba0254af87 | 39 | /** The θ of this motion state from the compass. */ |
chrigelburri | 0:31f7be68e52d | 40 | float thetaCompass; |
chrigelburri | 0:31f7be68e52d | 41 | /** The speed value of this motion state. */ |
chrigelburri | 0:31f7be68e52d | 42 | float speed; |
chrigelburri | 0:31f7be68e52d | 43 | /** The speed rotational value of this motion state. */ |
chrigelburri | 0:31f7be68e52d | 44 | float omega; |
chrigelburri | 0:31f7be68e52d | 45 | |
chrigelburri | 0:31f7be68e52d | 46 | /** |
chrigelburri | 0:31f7be68e52d | 47 | * Creates a <code>MotionState</code> object. |
chrigelburri | 0:31f7be68e52d | 48 | * The values for position and speed are set to 0. |
chrigelburri | 0:31f7be68e52d | 49 | */ |
chrigelburri | 0:31f7be68e52d | 50 | MotionState(); |
chrigelburri | 0:31f7be68e52d | 51 | |
chrigelburri | 0:31f7be68e52d | 52 | /** |
chrigelburri | 0:31f7be68e52d | 53 | * Creates a <code>MotionState</code> object with given values for position and speed. |
chrigelburri | 3:92ba0254af87 | 54 | * @param xposition the initial position value of this motion state, given in [m] |
chrigelburri | 3:92ba0254af87 | 55 | * @param yposition the initial position value of this motion state, given in [m] |
chrigelburri | 3:92ba0254af87 | 56 | * @param theta the initial θ value of this motion state, given in [rad] |
chrigelburri | 3:92ba0254af87 | 57 | * @param speed the initial speed value of this motion state, given in [m/s] |
chrigelburri | 3:92ba0254af87 | 58 | * @param omega the initial ω speed value of this motion state, given in [rad/s] |
chrigelburri | 0:31f7be68e52d | 59 | */ |
chrigelburri | 0:31f7be68e52d | 60 | MotionState(float xposition, float yposition, float theta, float speed, float omega); |
chrigelburri | 0:31f7be68e52d | 61 | |
chrigelburri | 0:31f7be68e52d | 62 | /** |
chrigelburri | 0:31f7be68e52d | 63 | * Destructor of the Object to destroy the Object. |
chrigelburri | 0:31f7be68e52d | 64 | **/ |
chrigelburri | 0:31f7be68e52d | 65 | virtual ~MotionState(); |
chrigelburri | 0:31f7be68e52d | 66 | |
chrigelburri | 0:31f7be68e52d | 67 | /** |
chrigelburri | 3:92ba0254af87 | 68 | * Sets the values for xPosition, yPostion and θ. |
chrigelburri | 3:92ba0254af87 | 69 | * @param xposition the initial position value of this motion state, given in [m] |
chrigelburri | 3:92ba0254af87 | 70 | * @param yposition the initial position value of this motion state, given in [m] |
chrigelburri | 3:92ba0254af87 | 71 | * @param theta the initial θ value of this motion state, given in [rad] |
chrigelburri | 3:92ba0254af87 | 72 | * @param speed the initial speed value of this motion state, given in [m/s] |
chrigelburri | 3:92ba0254af87 | 73 | * @param omega the initial ω speed value of this motion state, given in [rad/s] |
chrigelburri | 0:31f7be68e52d | 74 | */ |
chrigelburri | 0:31f7be68e52d | 75 | void setState(float xposition, float yposition, float theta, float speed, float omega); |
chrigelburri | 0:31f7be68e52d | 76 | |
chrigelburri | 0:31f7be68e52d | 77 | /** |
chrigelburri | 3:92ba0254af87 | 78 | * Sets the values for X-Position, Y-Postion and θ. |
chrigelburri | 3:92ba0254af87 | 79 | * @param motionState another <code>MotionState</code> object to copy the state values from |
chrigelburri | 0:31f7be68e52d | 80 | */ |
chrigelburri | 0:31f7be68e52d | 81 | void setState(MotionState* motionState); |
chrigelburri | 0:31f7be68e52d | 82 | |
chrigelburri | 0:31f7be68e52d | 83 | /** |
chrigelburri | 0:31f7be68e52d | 84 | * Sets the X-position value. |
chrigelburri | 3:92ba0254af87 | 85 | * @param xposition the desired xposition value of this motion state, given in [m] |
chrigelburri | 0:31f7be68e52d | 86 | */ |
chrigelburri | 1:6cd533a712c6 | 87 | void setxPosition(float xposition); |
chrigelburri | 0:31f7be68e52d | 88 | |
chrigelburri | 0:31f7be68e52d | 89 | /** |
chrigelburri | 0:31f7be68e52d | 90 | * Gets the X-position value. |
chrigelburri | 3:92ba0254af87 | 91 | * @return the xposition value of this motion state, given in [m] |
chrigelburri | 0:31f7be68e52d | 92 | */ |
chrigelburri | 0:31f7be68e52d | 93 | float getxPosition(); |
chrigelburri | 0:31f7be68e52d | 94 | |
chrigelburri | 0:31f7be68e52d | 95 | /** |
chrigelburri | 0:31f7be68e52d | 96 | * Sets the Y-position value. |
chrigelburri | 3:92ba0254af87 | 97 | * @param yposition the desired yposition value of this motion state, given in [m] |
chrigelburri | 0:31f7be68e52d | 98 | */ |
chrigelburri | 0:31f7be68e52d | 99 | void setyPosition(float yposition); |
chrigelburri | 0:31f7be68e52d | 100 | |
chrigelburri | 0:31f7be68e52d | 101 | /** |
chrigelburri | 0:31f7be68e52d | 102 | * Gets the Y-position value. |
chrigelburri | 3:92ba0254af87 | 103 | * @return the xposition value of this motion state, given in [m] |
chrigelburri | 0:31f7be68e52d | 104 | */ |
chrigelburri | 0:31f7be68e52d | 105 | float getyPosition(); |
chrigelburri | 0:31f7be68e52d | 106 | |
chrigelburri | 0:31f7be68e52d | 107 | /** |
chrigelburri | 3:92ba0254af87 | 108 | * Sets the θ value. |
chrigelburri | 3:92ba0254af87 | 109 | * @param theta the desired θ value of this motion state, given in [rad] |
chrigelburri | 0:31f7be68e52d | 110 | */ |
chrigelburri | 0:31f7be68e52d | 111 | void setTheta(float theta); |
chrigelburri | 0:31f7be68e52d | 112 | |
chrigelburri | 0:31f7be68e52d | 113 | /** |
chrigelburri | 3:92ba0254af87 | 114 | * Gets the θ value. |
chrigelburri | 3:92ba0254af87 | 115 | * @return the θ value of this motion state, given in [rad] |
chrigelburri | 0:31f7be68e52d | 116 | */ |
chrigelburri | 0:31f7be68e52d | 117 | float getTheta(); |
chrigelburri | 0:31f7be68e52d | 118 | |
chrigelburri | 0:31f7be68e52d | 119 | /** |
chrigelburri | 0:31f7be68e52d | 120 | * Sets the speed value. |
chrigelburri | 3:92ba0254af87 | 121 | * @param speed the desired speed value of this motion state, given in [m/s] |
chrigelburri | 0:31f7be68e52d | 122 | */ |
chrigelburri | 0:31f7be68e52d | 123 | void setSpeed(float speed); |
chrigelburri | 0:31f7be68e52d | 124 | |
chrigelburri | 0:31f7be68e52d | 125 | /** |
chrigelburri | 0:31f7be68e52d | 126 | * Gets the speed value. |
chrigelburri | 3:92ba0254af87 | 127 | * @return the speed value of this motion state, given in [m/s] |
chrigelburri | 0:31f7be68e52d | 128 | */ |
chrigelburri | 0:31f7be68e52d | 129 | float getSpeed(); |
chrigelburri | 0:31f7be68e52d | 130 | |
chrigelburri | 0:31f7be68e52d | 131 | /** |
chrigelburri | 1:6cd533a712c6 | 132 | * Sets the ω value. |
chrigelburri | 3:92ba0254af87 | 133 | * @param omega the desired ω value of this motion state, given in [rad/s] |
chrigelburri | 0:31f7be68e52d | 134 | */ |
chrigelburri | 0:31f7be68e52d | 135 | void setOmega(float omega); |
chrigelburri | 0:31f7be68e52d | 136 | |
chrigelburri | 0:31f7be68e52d | 137 | /** |
chrigelburri | 1:6cd533a712c6 | 138 | * Gets the ω value. |
chrigelburri | 3:92ba0254af87 | 139 | * @return the ω value of this motion state, given in [rad/s] |
chrigelburri | 0:31f7be68e52d | 140 | */ |
chrigelburri | 0:31f7be68e52d | 141 | float getOmega(); |
chrigelburri | 0:31f7be68e52d | 142 | |
chrigelburri | 0:31f7be68e52d | 143 | /** |
chrigelburri | 0:31f7be68e52d | 144 | * Sets the maximum acceleration value. |
chrigelburri | 3:92ba0254af87 | 145 | * @param acceleration the maximum acceleration value to use for the calculation of the motion trajectory, given in [m/s<SUP>2</SUP>] |
chrigelburri | 0:31f7be68e52d | 146 | */ |
chrigelburri | 0:31f7be68e52d | 147 | void setAcceleration(float acceleration); |
chrigelburri | 0:31f7be68e52d | 148 | |
chrigelburri | 0:31f7be68e52d | 149 | /** |
chrigelburri | 0:31f7be68e52d | 150 | * Gets the maximum acceleration value. |
chrigelburri | 3:92ba0254af87 | 151 | * @return the maximum acceleration value used for the calculation of the motion trajectory, given in [m/s<SUP>2</SUP>] |
chrigelburri | 0:31f7be68e52d | 152 | */ |
chrigelburri | 0:31f7be68e52d | 153 | float getAcceleration(); |
chrigelburri | 0:31f7be68e52d | 154 | |
chrigelburri | 0:31f7be68e52d | 155 | /** |
chrigelburri | 0:31f7be68e52d | 156 | * Sets the maximum acceleration value of rotation. |
chrigelburri | 3:92ba0254af87 | 157 | * @param thetaAcceleration the maximum acceleration value to use for the calculation of the motion trajectory, given in [rad/<SUP>2</SUP>] |
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 | 3:92ba0254af87 | 163 | * @return the maximum acceleration value used for the calculation of the motion trajectory, given in [rad/<SUP>2</SUP>] |
chrigelburri | 0:31f7be68e52d | 164 | */ |
chrigelburri | 0:31f7be68e52d | 165 | float getThetaAcceleration(); |
chrigelburri | 0:31f7be68e52d | 166 | |
chrigelburri | 0:31f7be68e52d | 167 | /** |
chrigelburri | 0:31f7be68e52d | 168 | * Increments the current motion state towards a given desired speed. |
chrigelburri | 0:31f7be68e52d | 169 | * @param desiredSpeed the desired speed given in [m/s]. |
chrigelburri | 1:6cd533a712c6 | 170 | * @param desiredOmega the desired ω given in [rad/s]. |
chrigelburri | 3:92ba0254af87 | 171 | * @param period the time period to increment the motion state for, given in [s] |
chrigelburri | 0:31f7be68e52d | 172 | */ |
chrigelburri | 0:31f7be68e52d | 173 | void increment(float desiredSpeed, float desiredOmega, float period); |
chrigelburri | 0:31f7be68e52d | 174 | }; |
chrigelburri | 0:31f7be68e52d | 175 | |
chrigelburri | 0:31f7be68e52d | 176 | #endif |