$search
00001 00060 #ifndef _SIMULATED_MOTOR_H_ 00061 #define _SIMULATED_MOTOR_H_ 00062 00063 #include <schunk_powercube_chain/moveCommand.h> 00064 #include <string> 00065 00066 class simulatedMotor 00067 { 00068 public: 00069 00070 simulatedMotor(double lowLimit, double upLimit, double maxAcc, double maxVel); 00071 ~simulatedMotor() {;} 00072 00074 virtual bool init() { return true; } 00075 00077 virtual std::string getErrorMessage() { return std::string("No Errors."); } 00078 00080 // virtual void setDebugOutput(ostream* os) { deb = os; } 00081 00083 // Zunächst die Steuerungs-Funktionen: // 00085 00087 virtual void moveRamp(double targetAngle, double vmax, double amax); 00088 00090 virtual void moveVel(double vel); 00091 00093 virtual void movePos(double pos); 00094 00096 virtual void stop(); 00097 00099 // Funktionen zum setzen und auslesen von Parametern: // 00101 00104 virtual void setMaxVelocity(double radpersec) { m_vmax = radpersec; } 00105 virtual double getMaxVelocity() { return m_vmax; } 00106 00109 virtual void setMaxAcceleration(double radPerSecSquared) { m_amax = radPerSecSquared; } 00110 virtual double getMaxAcceleration() { return m_amax; } 00111 00113 virtual void setLimits(double lowerLimit, double upperLimit) 00114 { m_ul = upperLimit; m_ll = lowerLimit; } 00115 virtual double getUpperLimit() { return m_ul; } 00116 virtual double getLowerLimit() { return m_ll; } 00117 00119 virtual void setTimeConstant(double T) { T0 = T; } 00120 virtual double getTimeConstant() const { return T0; } 00121 00123 // hier die Funktionen zur Statusabfrage: // 00125 00127 virtual RampCommand getRampMove(double targetAngle, double v, double a); 00128 00130 virtual RampCommand getRampMove(double targetAngle) { return getRampMove(targetAngle, m_vmax, m_amax); } 00131 00133 virtual double getAngle() { return m_lastMove.getPos(); } 00134 00136 virtual double getVelocity() { return m_lastMove.getVel(); } 00137 00140 virtual bool statusMoving() { return m_lastMove.isActive(); } 00141 00143 virtual bool statusDec() { return m_lastMove.inPhase3(); } 00144 00146 virtual bool statusAcc() { return m_lastMove.inPhase1(); } 00147 00148 private: 00149 00150 RampCommand m_lastMove; 00151 00152 double m_ul, m_ll; // upper limit and lower limit 00153 double m_amax, m_vmax; // Never mover faster than this! 00154 00155 double T0; // Zeitkonstante für Annäherung der Sprungantwort durch Rampe 00156 00157 //ostream * deb; 00158 }; 00159 00160 00161 #endif