simulatedMotor.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *   http://www.apache.org/licenses/LICENSE-2.0
00009 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
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   // virtual void setDebugOutput(ostream* os) { deb = os; }
00044 
00046   // Zunächst die Steuerungs-Funktionen: //
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   // Funktionen zum setzen und auslesen von Parametern: //
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   // hier die Funktionen zur Statusabfrage: //
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;      // upper limit and lower limit
00160   double m_amax, m_vmax;  // Never mover faster than this!
00161 
00162   double T0;  // Zeitkonstante für Annäherung der Sprungantwort durch Rampe
00163 
00164   // ostream * deb;
00165 };
00166 
00167 #endif


schunk_powercube_chain
Author(s): Florian Weisshardt
autogenerated on Sat Jun 8 2019 20:25:18