DriveParam.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 DRIVEPARAM_INCLUDEDEF_H
19 #define DRIVEPARAM_INCLUDEDEF_H
20 
21 //-----------------------------------------------
22 
23 
29 {
30 
31 private:
32 
34  int m_iEncIncrPerRevMot; // encoder increments per revolution motor shaft
35  double m_dVelMeasFrqHz; // only used for Neo drive, else = 1
36  double m_dGearRatio; //
37  double m_dBeltRatio; // if drive has belt set ratio, else = 1
38  int m_iSign; // direction of motion
39  double m_dVelMaxEncIncrS; // max. veloctiy
40  double m_dAccIncrS2; // max. acceleration
41  double m_dDecIncrS2; // max. decelration
43  int m_iEncOffsetIncr; // Position in Increments of Steerwheel when Homingposition
44  // is reached (only needed forCoB3)
45  int m_iHomingDigIn; // specifies which digital input is used for homing signal, standart 11 is good for COB3, 19 for Cob3_5
46  bool m_bIsSteer; // needed to distinguish motors for initializing
47  double m_dCurrToTorque; // factor to convert motor active current [A] into torque [Nm]
48  double m_dCurrMax; // max. current allowed
49 
50 public:
51 
56  {
57 
58  m_bIsSteer = true; //has to be set, because it is checked for absolute / relative positioning
59 
60  }
61 
74  void setParam(
75  int iDriveIdent,
76  int iEncIncrPerRevMot,
77  double dVelMeasFrqHz,
78  double dBeltRatio,
79  double dGearRatio,
80  int iSign,
81  double dVelMaxEncIncrS,
82  double dAccIncrS2,
83  double dDecIncrS2)
84  {
85 
86  m_iDriveIdent = iDriveIdent;
87  m_iEncIncrPerRevMot = iEncIncrPerRevMot;
88  m_dVelMeasFrqHz = dVelMeasFrqHz;
89  m_dBeltRatio = dBeltRatio;
90  m_dGearRatio = dGearRatio;
91  m_iSign = iSign;
92  m_dVelMaxEncIncrS = dVelMaxEncIncrS;
93  m_dAccIncrS2 = dAccIncrS2;
94  m_dDecIncrS2 = dDecIncrS2;
95 
96  m_iHomingDigIn = 11; //for Cob3
97 
98  double dPI = 3.14159265358979323846;
99 
100  m_dPosGearRadToPosMotIncr = m_iEncIncrPerRevMot * m_dGearRatio
101  * m_dBeltRatio / (2. * dPI);
102  }
103 
104  //Overloaded Method for CoB3
105  void setParam(
106  int iDriveIdent,
107  int iEncIncrPerRevMot,
108  double dVelMeasFrqHz,
109  double dBeltRatio,
110  double dGearRatio,
111  int iSign,
112  double dVelMaxEncIncrS,
113  double dAccIncrS2,
114  double dDecIncrS2,
115  int iEncOffsetIncr,
116  bool bIsSteer,
117  double dCurrToTorque,
118  double dCurrMax)
119  {
120 
121  m_iDriveIdent = iDriveIdent;
122  m_iEncIncrPerRevMot = iEncIncrPerRevMot;
123  m_dVelMeasFrqHz = dVelMeasFrqHz;
124  m_dBeltRatio = dBeltRatio;
125  m_dGearRatio = dGearRatio;
126  m_iSign = iSign;
127  m_dVelMaxEncIncrS = dVelMaxEncIncrS;
128  m_dAccIncrS2 = dAccIncrS2;
129  m_dDecIncrS2 = dDecIncrS2;
130  m_iEncOffsetIncr = iEncOffsetIncr;
131  m_bIsSteer = bIsSteer;
132 
133  m_iHomingDigIn = 11; //for Cob3
134 
135  double dPI = 3.14159265358979323846;
136 
137  m_dPosGearRadToPosMotIncr = m_iEncIncrPerRevMot * m_dGearRatio
138  * m_dBeltRatio / (2. * dPI);
139 
140  m_dCurrToTorque = dCurrToTorque;
141  m_dCurrMax = dCurrMax;
142  }
143 
144  //Overloaded Method for CoB3 including new feature HomingDigIn, for compatibility reasons overloaded
145  void setParam(
146  int iDriveIdent,
147  int iEncIncrPerRevMot,
148  double dVelMeasFrqHz,
149  double dBeltRatio,
150  double dGearRatio,
151  int iSign,
152  double dVelMaxEncIncrS,
153  double dAccIncrS2,
154  double dDecIncrS2,
155  int iEncOffsetIncr,
156  bool bIsSteer,
157  double dCurrToTorque,
158  double dCurrMax,
159  int iHomingDigIn)
160  {
161 
162  m_iDriveIdent = iDriveIdent;
163  m_iEncIncrPerRevMot = iEncIncrPerRevMot;
164  m_dVelMeasFrqHz = dVelMeasFrqHz;
165  m_dBeltRatio = dBeltRatio;
166  m_dGearRatio = dGearRatio;
167  m_iSign = iSign;
168  m_dVelMaxEncIncrS = dVelMaxEncIncrS;
169  m_dAccIncrS2 = dAccIncrS2;
170  m_dDecIncrS2 = dDecIncrS2;
171  m_iEncOffsetIncr = iEncOffsetIncr;
172  m_bIsSteer = bIsSteer;
173 
174  double dPI = 3.14159265358979323846;
175 
176  m_dPosGearRadToPosMotIncr = m_iEncIncrPerRevMot * m_dGearRatio
177  * m_dBeltRatio / (2. * dPI);
178 
179  m_dCurrToTorque = dCurrToTorque;
180  m_dCurrMax = dCurrMax;
181  m_iHomingDigIn = iHomingDigIn;
182  }
183 
188  {
189  return m_iDriveIdent;
190  }
191 
195  int getSign()
196  {
197  return m_iSign;
198  }
199 
203  double getVelMax()
204  {
205  return m_dVelMaxEncIncrS;
206  }
207 
215  void PosVelRadToIncr(double dPosRad, double dVelRadS, int* piPosIncr, int* piVelIncrPeriod)
216  {
217  *piPosIncr = PosGearRadToPosMotIncr(dPosRad);
218  *piVelIncrPeriod = VelGearRadSToVelMotIncrPeriod(dVelRadS);
219  }
220 
226  int TempMeasIncrToGradCel(int iTempIncr)
227  {
228  double dTempMeasGradCel;
229 
230  dTempMeasGradCel = 0.0002 * (iTempIncr * iTempIncr) - 0.2592 * iTempIncr + 105;
231 
232  return (int)dTempMeasGradCel;
233  }
234 
239  int PosGearRadToPosMotIncr(double dPosGearRad)
240  {
241  return ((int)(dPosGearRad * m_dPosGearRadToPosMotIncr));
242  }
243 
245  double PosMotIncrToPosGearRad(int iPosIncr)
246  {
247  return ((double)iPosIncr / m_dPosGearRadToPosMotIncr);
248  }
249 
251  int VelGearRadSToVelMotIncrPeriod(double dVelGearRadS)
252  {
253  return ((int)(dVelGearRadS * m_dPosGearRadToPosMotIncr / m_dVelMeasFrqHz));
254  }
255 
257  double VelMotIncrPeriodToVelGearRadS(int iVelMotIncrPeriod)
258  {
259  return ((double)iVelMotIncrPeriod / m_dPosGearRadToPosMotIncr * m_dVelMeasFrqHz);
260  }
261 
266  void setMaxAcc(double dMaxAcc)
267  {
268  m_dAccIncrS2 = dMaxAcc;
269  }
270 
275  double getMaxAcc()
276  {
277  return m_dAccIncrS2;
278  }
279 
284  void setMaxDec(double dMaxDec)
285  {
286  m_dDecIncrS2 = dMaxDec;
287  }
288 
293  double getMaxDec()
294  {
295  return m_dDecIncrS2;
296  }
297 
302  void setMaxVel(double dMaxVel)
303  {
304  m_dVelMaxEncIncrS = dMaxVel;
305  }
306 
311  double getMaxVel()
312  {
313  return m_dVelMaxEncIncrS;
314  }
315 
320  double getGearRatio()
321  {
322  return m_dGearRatio;
323  }
328  double getBeltRatio()
329  {
330  return m_dBeltRatio;
331  }
332 
338  {
339  return m_iEncOffsetIncr;
340  }
341 
346  bool getIsSteer()
347  {
348  return m_bIsSteer;
349  }
355  {
356  return m_iEncIncrPerRevMot;
357  }
362  {
363  return m_dCurrToTorque;
364  }
368  double getCurrMax()
369  {
370  return m_dCurrMax;
371  }
376  {
377  return m_iHomingDigIn;
378  }
382  void setHomingDigIn(int HomingDigIn)
383  {
384  m_iHomingDigIn = HomingDigIn;
385  }
386 };
387 //-----------------------------------------------
388 #endif
double getCurrToTorque()
Definition: DriveParam.h:361
double m_dDecIncrS2
Definition: DriveParam.h:41
int m_iDriveIdent
Definition: DriveParam.h:33
double m_dAccIncrS2
Definition: DriveParam.h:40
int getDriveIdent()
Definition: DriveParam.h:187
void setParam(int iDriveIdent, int iEncIncrPerRevMot, double dVelMeasFrqHz, double dBeltRatio, double dGearRatio, int iSign, double dVelMaxEncIncrS, double dAccIncrS2, double dDecIncrS2)
Definition: DriveParam.h:74
bool getIsSteer()
Definition: DriveParam.h:346
int getEncOffset()
Definition: DriveParam.h:337
void setMaxAcc(double dMaxAcc)
Definition: DriveParam.h:266
double getGearRatio()
Definition: DriveParam.h:320
double getVelMax()
Definition: DriveParam.h:203
int getEncIncrPerRevMot()
Definition: DriveParam.h:354
void setMaxDec(double dMaxDec)
Definition: DriveParam.h:284
int m_iEncIncrPerRevMot
Definition: DriveParam.h:34
double m_dVelMaxEncIncrS
Definition: DriveParam.h:39
bool m_bIsSteer
Definition: DriveParam.h:46
int PosGearRadToPosMotIncr(double dPosGearRad)
Definition: DriveParam.h:239
int VelGearRadSToVelMotIncrPeriod(double dVelGearRadS)
Conversions of gear velocity in rad/s to encoder increments per measurment period.
Definition: DriveParam.h:251
int TempMeasIncrToGradCel(int iTempIncr)
Definition: DriveParam.h:226
double m_dCurrToTorque
Definition: DriveParam.h:47
double m_dPosGearRadToPosMotIncr
Definition: DriveParam.h:42
void setHomingDigIn(int HomingDigIn)
Definition: DriveParam.h:382
double m_dGearRatio
Definition: DriveParam.h:36
double m_dVelMeasFrqHz
Definition: DriveParam.h:35
int m_iEncOffsetIncr
Definition: DriveParam.h:43
void setParam(int iDriveIdent, int iEncIncrPerRevMot, double dVelMeasFrqHz, double dBeltRatio, double dGearRatio, int iSign, double dVelMaxEncIncrS, double dAccIncrS2, double dDecIncrS2, int iEncOffsetIncr, bool bIsSteer, double dCurrToTorque, double dCurrMax, int iHomingDigIn)
Definition: DriveParam.h:145
double PosMotIncrToPosGearRad(int iPosIncr)
Conversions of encoder increments to gear position in radians.
Definition: DriveParam.h:245
void setParam(int iDriveIdent, int iEncIncrPerRevMot, double dVelMeasFrqHz, double dBeltRatio, double dGearRatio, int iSign, double dVelMaxEncIncrS, double dAccIncrS2, double dDecIncrS2, int iEncOffsetIncr, bool bIsSteer, double dCurrToTorque, double dCurrMax)
Definition: DriveParam.h:105
void setMaxVel(double dMaxVel)
Definition: DriveParam.h:302
double getCurrMax()
Definition: DriveParam.h:368
double VelMotIncrPeriodToVelGearRadS(int iVelMotIncrPeriod)
Conversions of encoder increments per measurment period to gear velocity in rad/s.
Definition: DriveParam.h:257
double getMaxVel()
Definition: DriveParam.h:311
double m_dBeltRatio
Definition: DriveParam.h:37
double m_dCurrMax
Definition: DriveParam.h:48
double getMaxAcc()
Definition: DriveParam.h:275
int m_iSign
Definition: DriveParam.h:38
double getMaxDec()
Definition: DriveParam.h:293
double getBeltRatio()
Definition: DriveParam.h:328
void PosVelRadToIncr(double dPosRad, double dVelRadS, int *piPosIncr, int *piVelIncrPeriod)
Definition: DriveParam.h:215
int getHomingDigIn()
Definition: DriveParam.h:375
int getSign()
Definition: DriveParam.h:195
int m_iHomingDigIn
Definition: DriveParam.h:45


cob_canopen_motor
Author(s): Christian Connette
autogenerated on Wed Apr 7 2021 02:11:53