Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _SIMULATED_MOTOR_H_
00019 #define _SIMULATED_MOTOR_H_
00020
00021 #include <schunk_powercube_chain/moveCommand.h>
00022 #include <string>
00023
00024 class simulatedMotor
00025 {
00026 public:
00027 simulatedMotor(double lowLimit, double upLimit, double maxAcc, double maxVel);
00028 ~simulatedMotor() {;}
00029
00031 virtual bool init()
00032 {
00033 return true;
00034 }
00035
00037 virtual std::string getErrorMessage()
00038 {
00039 return std::string("No Errors.");
00040 }
00041
00043
00044
00046
00048
00050 virtual void moveRamp(double targetAngle, double vmax, double amax);
00051
00053 virtual void moveVel(double vel);
00054
00056 virtual void movePos(double pos);
00057
00059 virtual void stop();
00060
00062
00064
00067 virtual void setMaxVelocity(double radpersec)
00068 {
00069 m_vmax = radpersec;
00070 }
00071 virtual double getMaxVelocity()
00072 {
00073 return m_vmax;
00074 }
00075
00078 virtual void setMaxAcceleration(double radPerSecSquared)
00079 {
00080 m_amax = radPerSecSquared;
00081 }
00082 virtual double getMaxAcceleration()
00083 {
00084 return m_amax;
00085 }
00086
00088 virtual void setLimits(double lowerLimit, double upperLimit)
00089 {
00090 m_ul = upperLimit;
00091 m_ll = lowerLimit;
00092 }
00093 virtual double getUpperLimit()
00094 {
00095 return m_ul;
00096 }
00097 virtual double getLowerLimit()
00098 {
00099 return m_ll;
00100 }
00101
00103 virtual void setTimeConstant(double T)
00104 {
00105 T0 = T;
00106 }
00107 virtual double getTimeConstant() const
00108 {
00109 return T0;
00110 }
00111
00113
00115
00117 virtual RampCommand getRampMove(double targetAngle, double v, double a);
00118
00120 virtual RampCommand getRampMove(double targetAngle)
00121 {
00122 return getRampMove(targetAngle, m_vmax, m_amax);
00123 }
00124
00126 virtual double getAngle()
00127 {
00128 return m_lastMove.getPos();
00129 }
00130
00132 virtual double getVelocity()
00133 {
00134 return m_lastMove.getVel();
00135 }
00136
00139 virtual bool statusMoving()
00140 {
00141 return m_lastMove.isActive();
00142 }
00143
00145 virtual bool statusDec()
00146 {
00147 return m_lastMove.inPhase3();
00148 }
00149
00151 virtual bool statusAcc()
00152 {
00153 return m_lastMove.inPhase1();
00154 }
00155
00156 private:
00157 RampCommand m_lastMove;
00158
00159 double m_ul, m_ll;
00160 double m_amax, m_vmax;
00161
00162 double T0;
00163
00164
00165 };
00166
00167 #endif