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
simulatedMotor::setLimits
virtual void setLimits(double lowerLimit, double upperLimit)
sets the Joint Limits, the motor has to stay in these limits!
Definition: simulatedMotor.h:88
simulatedMotor::statusAcc
virtual bool statusAcc()
Returs true if the Joint is in phase one of rampmove.
Definition: simulatedMotor.h:151
simulatedMotor::statusMoving
virtual bool statusMoving()
Returns true if the Joint is still moving also returns true if Joints are accelerating or deceleratin...
Definition: simulatedMotor.h:139
simulatedMotor::m_amax
double m_amax
Definition: simulatedMotor.h:160
simulatedMotor::setMaxVelocity
virtual void setMaxVelocity(double radpersec)
Sets the maximum angular velocity (rad/s) for the Joints, use with care! A Value of 0....
Definition: simulatedMotor.h:67
simulatedMotor
Definition: simulatedMotor.h:24
simulatedMotor::T0
double T0
Definition: simulatedMotor.h:162
simulatedMotor::getErrorMessage
virtual std::string getErrorMessage()
if error occured during init, get the error message with this
Definition: simulatedMotor.h:37
simulatedMotor::stop
virtual void stop()
Stops the motor immediately.
Definition: simulatedMotor.cpp:112
RampCommand
Definition: moveCommand.h:104
simulatedMotor::setTimeConstant
virtual void setTimeConstant(double T)
sets / gets the time that the motor needs to reach target velocity (moveVel)
Definition: simulatedMotor.h:103
simulatedMotor::init
virtual bool init()
initializes the module, if an error occurs function returns false
Definition: simulatedMotor.h:31
simulatedMotor::getAngle
virtual double getAngle()
Returns the current Joint Angles.
Definition: simulatedMotor.h:126
simulatedMotor::getMaxVelocity
virtual double getMaxVelocity()
Definition: simulatedMotor.h:71
simulatedMotor::m_vmax
double m_vmax
Definition: simulatedMotor.h:160
simulatedMotor::moveRamp
virtual void moveRamp(double targetAngle, double vmax, double amax)
any messages useful for debug are sent to this stream:
Definition: simulatedMotor.cpp:38
simulatedMotor::getUpperLimit
virtual double getUpperLimit()
Definition: simulatedMotor.h:93
simulatedMotor::movePos
virtual void movePos(double pos)
Moves the motor with the given velocity.
Definition: simulatedMotor.cpp:86
simulatedMotor::moveVel
virtual void moveVel(double vel)
Moves the motor with the given velocity.
Definition: simulatedMotor.cpp:62
RampCommand::inPhase1
virtual bool inPhase1()
Definition: moveCommand.h:141
simulatedMotor::getRampMove
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 ...
Definition: simulatedMotor.cpp:123
simulatedMotor::getMaxAcceleration
virtual double getMaxAcceleration()
Definition: simulatedMotor.h:82
simulatedMotor::m_ul
double m_ul
Definition: simulatedMotor.h:159
moveCommand::isActive
virtual bool isActive()
returns true if the the end of the movement is not reached yet
Definition: moveCommand.h:65
simulatedMotor::~simulatedMotor
~simulatedMotor()
Definition: simulatedMotor.h:28
RampCommand::getVel
virtual double getVel(double TimeElapsed)
returns the planned velocity for TimeElapsed (seconds)
Definition: moveCommand.cpp:246
moveCommand.h
simulatedMotor::getVelocity
virtual double getVelocity()
Returns the current Angular velocities (Rad/s)
Definition: simulatedMotor.h:132
simulatedMotor::getLowerLimit
virtual double getLowerLimit()
Definition: simulatedMotor.h:97
simulatedMotor::m_lastMove
RampCommand m_lastMove
Definition: simulatedMotor.h:157
RampCommand::inPhase3
virtual bool inPhase3()
Definition: moveCommand.h:146
simulatedMotor::m_ll
double m_ll
Definition: simulatedMotor.h:159
simulatedMotor::getRampMove
virtual RampCommand getRampMove(double targetAngle)
Same but using the maximum velocity and acceleration of this motor.
Definition: simulatedMotor.h:120
simulatedMotor::setMaxAcceleration
virtual void setMaxAcceleration(double radPerSecSquared)
Sets the maximum angular acceleration (rad/s^2) for the Joints, use with care! A Value of 0....
Definition: simulatedMotor.h:78
RampCommand::getPos
virtual double getPos(double TimeElapsed)
returns the planned position for TimeElapsed (seconds)
Definition: moveCommand.cpp:207
simulatedMotor::statusDec
virtual bool statusDec()
Returns true if the Joint is decelerating at end of movement.
Definition: simulatedMotor.h:145
simulatedMotor::simulatedMotor
simulatedMotor(double lowLimit, double upLimit, double maxAcc, double maxVel)
Definition: simulatedMotor.cpp:21
simulatedMotor::getTimeConstant
virtual double getTimeConstant() const
Definition: simulatedMotor.h:107


schunk_powercube_chain
Author(s): Florian Weisshardt
autogenerated on Sat May 7 2022 02:17:15