simulatedMotor.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9 
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
18 #ifndef _SIMULATED_MOTOR_H_
19 #define _SIMULATED_MOTOR_H_
20 
22 #include <string>
23 
25 {
26 public:
27  simulatedMotor(double lowLimit, double upLimit, double maxAcc, double maxVel);
29 
31  virtual bool init()
32  {
33  return true;
34  }
35 
37  virtual std::string getErrorMessage()
38  {
39  return std::string("No Errors.");
40  }
41 
43  // virtual void setDebugOutput(ostream* os) { deb = os; }
44 
46  // Zunächst die Steuerungs-Funktionen: //
48 
50  virtual void moveRamp(double targetAngle, double vmax, double amax);
51 
53  virtual void moveVel(double vel);
54 
56  virtual void movePos(double pos);
57 
59  virtual void stop();
60 
62  // Funktionen zum setzen und auslesen von Parametern: //
64 
67  virtual void setMaxVelocity(double radpersec)
68  {
69  m_vmax = radpersec;
70  }
71  virtual double getMaxVelocity()
72  {
73  return m_vmax;
74  }
75 
78  virtual void setMaxAcceleration(double radPerSecSquared)
79  {
80  m_amax = radPerSecSquared;
81  }
82  virtual double getMaxAcceleration()
83  {
84  return m_amax;
85  }
86 
88  virtual void setLimits(double lowerLimit, double upperLimit)
89  {
90  m_ul = upperLimit;
91  m_ll = lowerLimit;
92  }
93  virtual double getUpperLimit()
94  {
95  return m_ul;
96  }
97  virtual double getLowerLimit()
98  {
99  return m_ll;
100  }
101 
103  virtual void setTimeConstant(double T)
104  {
105  T0 = T;
106  }
107  virtual double getTimeConstant() const
108  {
109  return T0;
110  }
111 
113  // hier die Funktionen zur Statusabfrage: //
115 
117  virtual RampCommand getRampMove(double targetAngle, double v, double a);
118 
120  virtual RampCommand getRampMove(double targetAngle)
121  {
122  return getRampMove(targetAngle, m_vmax, m_amax);
123  }
124 
126  virtual double getAngle()
127  {
128  return m_lastMove.getPos();
129  }
130 
132  virtual double getVelocity()
133  {
134  return m_lastMove.getVel();
135  }
136 
139  virtual bool statusMoving()
140  {
141  return m_lastMove.isActive();
142  }
143 
145  virtual bool statusDec()
146  {
147  return m_lastMove.inPhase3();
148  }
149 
151  virtual bool statusAcc()
152  {
153  return m_lastMove.inPhase1();
154  }
155 
156 private:
158 
159  double m_ul, m_ll; // upper limit and lower limit
160  double m_amax, m_vmax; // Never mover faster than this!
161 
162  double T0; // Zeitkonstante für Annäherung der Sprungantwort durch Rampe
163 
164  // ostream * deb;
165 };
166 
167 #endif
virtual std::string getErrorMessage()
if error occured during init, get the error message with this
virtual void setTimeConstant(double T)
sets / gets the time that the motor needs to reach target velocity (moveVel)
virtual double getPos(double TimeElapsed)
returns the planned position for TimeElapsed (seconds)
RampCommand m_lastMove
virtual bool statusAcc()
Returs true if the Joint is in phase one of rampmove.
virtual void stop()
Stops the motor immediately.
virtual RampCommand getRampMove(double targetAngle)
Same but using the maximum velocity and acceleration of this motor.
virtual void setMaxVelocity(double radpersec)
Sets the maximum angular velocity (rad/s) for the Joints, use with care! A Value of 0...
virtual RampCommand getRampMove(double targetAngle, double v, double a)
Get a representation of the rampMove that the motor WOULD execute if told so at the time of function ...
virtual bool isActive()
returns true if the the end of the movement is not reached yet
Definition: moveCommand.h:65
virtual double getVelocity()
Returns the current Angular velocities (Rad/s)
virtual double getTimeConstant() const
virtual bool statusMoving()
Returns true if the Joint is still moving also returns true if Joints are accelerating or deceleratin...
virtual bool init()
initializes the module, if an error occurs function returns false
virtual void moveVel(double vel)
Moves the motor with the given velocity.
virtual double getAngle()
Returns the current Joint Angles.
virtual double getUpperLimit()
simulatedMotor(double lowLimit, double upLimit, double maxAcc, double maxVel)
virtual void movePos(double pos)
Moves the motor with the given velocity.
virtual bool inPhase1()
Definition: moveCommand.h:141
virtual void moveRamp(double targetAngle, double vmax, double amax)
any messages useful for debug are sent to this stream:
virtual double getMaxAcceleration()
virtual double getVel(double TimeElapsed)
returns the planned velocity for TimeElapsed (seconds)
virtual double getLowerLimit()
virtual bool statusDec()
Returns true if the Joint is decelerating at end of movement.
virtual bool inPhase3()
Definition: moveCommand.h:146
virtual void setMaxAcceleration(double radPerSecSquared)
Sets the maximum angular acceleration (rad/s^2) for the Joints, use with care! A Value of 0...
virtual void setLimits(double lowerLimit, double upperLimit)
sets the Joint Limits, the motor has to stay in these limits!
virtual double getMaxVelocity()


schunk_powercube_chain
Author(s): Florian Weisshardt
autogenerated on Mon Nov 25 2019 03:48:21