Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of autonomousRobotAndroid by
RobotControl/MotionState.h
- Committer:
- chrigelburri
- Date:
- 2013-03-02
- Revision:
- 1:6cd533a712c6
- Parent:
- 0:31f7be68e52d
- Child:
- 3:92ba0254af87
File content as of revision 1:6cd533a712c6:
#ifndef _MOTION_STATE_H_ #define _MOTION_STATE_H_ #include <cmath> #include "defines.h" /** * @author Christian Burri * * @section LICENSE * * Copyright © 2013 HSLU Pren Team #1 Cruising Crêpe * All rights reserved. * * @section DESCRIPTION * * ????? * */ class MotionState { private: float acceleration; float thetaAcceleration; public: /** The xposition value of this motion state. */ float xposition; /** The yposition value of this motion state. */ float yposition; /** The angle of this motion state. */ float theta; /** The angle of this motion state from the compass. */ float thetaCompass; /** The speed value of this motion state. */ float speed; /** The speed rotational value of this motion state. */ float omega; /** * Creates a <code>MotionState</code> object. * The values for position and speed are set to 0. */ MotionState(); /** * Creates a <code>MotionState</code> object with given values for position and speed. * @param xposition the initial position value of this motion state, given in [m]. * @param yposition the initial position value of this motion state, given in [m]. * @param theta the initial angle value of this motion state, given in [rad]. * @param speed the initial speed value of this motion state, given in [m/s]. * @param omega the initial ω speed value of this motion state, given in [rad/s]. */ MotionState(float xposition, float yposition, float theta, float speed, float omega); /** * Destructor of the Object to destroy the Object. **/ virtual ~MotionState(); /** * Sets the values for xPosition, yPostion and angle. * @param xposition the initial position value of this motion state, given in [m]. * @param yposition the initial position value of this motion state, given in [m]. * @param theta the initial angle value of this motion state, given in [rad]. * @param speed the initial speed value of this motion state, given in [m/s]. * @param omega the initial ω speed value of this motion state, given in [rad/s]. */ void setState(float xposition, float yposition, float theta, float speed, float omega); /** * Sets the values for xPosition, yPostion and angle. * @param motionState another <code>MotionState</code> object to copy the state values from. */ void setState(MotionState* motionState); /** * Sets the X-position value. * @param xposition the desired xposition value of this motion state, given in [m]. */ void setxPosition(float xposition); /** * Gets the X-position value. * @return the xposition value of this motion state, given in [m]. */ float getxPosition(); /** * Sets the Y-position value. * @param yposition the desired yposition value of this motion state, given in [m]. */ void setyPosition(float yposition); /** * Gets the Y-position value. * @return the xposition value of this motion state, given in [m]. */ float getyPosition(); /** * Sets the theta value. * @param theta the desired theta value of this motion state, given in [m]. */ void setTheta(float theta); /** * Gets the angle value. * @return the theta value of this motion state, given in [rad]. */ float getTheta(); /** * Sets the speed value. * @param speed the desired speed value of this motion state, given in [m/s]. */ void setSpeed(float speed); /** * Gets the speed value. * @return the speed value of this motion state, given in [m/s]. */ float getSpeed(); /** * Sets the ω value. * @param omega the desired ω value of this motion state, given in [rad/s]. */ void setOmega(float omega); /** * Gets the ω value. * @return the ω value of this motion state, given in [rad/s]. */ float getOmega(); /** * 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); /** * Gets the maximum acceleration value. * @return the maximum acceleration value used for the calculation of the motion trajectory, given in [m/s<SUP>2</SUP>]. */ float getAcceleration(); /** * Sets the maximum acceleration value of rotation. * @param thetaAcceleration the maximum acceleration value to use for the calculation of the motion trajectory, given in [rad/<SUP>2</SUP>]. */ void setThetaAcceleration(float thetaAcceleration); /** * Gets the maximum acceleration value of rotation. * @return the maximum acceleration value used for the calculation of the motion trajectory, given in [rad/<SUP>2</SUP>]. */ float getThetaAcceleration(); /** * Increments the current motion state towards a given desired speed. * @param desiredSpeed the desired speed given in [m/s]. * @param desiredOmega the desired ω given in [rad/s]. * @param period the time period to increment the motion state for, given in [s]. */ void increment(float desiredSpeed, float desiredOmega, float period); }; #endif