DriveParam.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 DRIVEPARAM_INCLUDEDEF_H
00019 #define DRIVEPARAM_INCLUDEDEF_H
00020 
00021 //-----------------------------------------------
00022 
00023 
00028 class DriveParam
00029 {
00030 
00031 private:
00032 
00033         int m_iDriveIdent;
00034         int m_iEncIncrPerRevMot;        // encoder increments per revolution motor shaft
00035         double m_dVelMeasFrqHz;         // only used for Neo drive, else = 1
00036         double m_dGearRatio;            //
00037         double m_dBeltRatio;            // if drive has belt set ratio, else = 1
00038         int m_iSign;                            // direction of motion
00039         double m_dVelMaxEncIncrS;       // max. veloctiy
00040         double m_dAccIncrS2;            // max. acceleration
00041         double m_dDecIncrS2;            // max. decelration
00042         double m_dPosGearRadToPosMotIncr;
00043         int m_iEncOffsetIncr;           // Position in Increments of Steerwheel when Homingposition
00044                                         //  is reached (only needed forCoB3)
00045         int m_iHomingDigIn; // specifies which digital input is used for homing signal, standart 11 is good for COB3, 19 for Cob3_5
00046         bool m_bIsSteer;                // needed to distinguish motors for initializing
00047     double m_dCurrToTorque;             // factor to convert motor active current [A] into torque [Nm]
00048         double m_dCurrMax;              // max. current allowed
00049 
00050 public:
00051 
00055         DriveParam()
00056         {
00057 
00058                 m_bIsSteer = true; //has to be set, because it is checked for absolute / relative positioning
00059 
00060         }
00061 
00074         void setParam(
00075                 int iDriveIdent,
00076                 int iEncIncrPerRevMot,
00077                 double dVelMeasFrqHz,
00078                 double dBeltRatio,
00079                 double dGearRatio,
00080                 int iSign,
00081                 double dVelMaxEncIncrS,
00082                 double dAccIncrS2,
00083                 double dDecIncrS2)
00084         {
00085 
00086                 m_iDriveIdent = iDriveIdent;
00087                 m_iEncIncrPerRevMot = iEncIncrPerRevMot;
00088                 m_dVelMeasFrqHz = dVelMeasFrqHz;
00089                 m_dBeltRatio = dBeltRatio;
00090                 m_dGearRatio = dGearRatio;
00091                 m_iSign = iSign;
00092                 m_dVelMaxEncIncrS = dVelMaxEncIncrS;
00093                 m_dAccIncrS2 = dAccIncrS2;
00094                 m_dDecIncrS2 = dDecIncrS2;
00095 
00096                 m_iHomingDigIn = 11; //for Cob3
00097 
00098                 double dPI = 3.14159265358979323846;
00099 
00100                 m_dPosGearRadToPosMotIncr = m_iEncIncrPerRevMot * m_dGearRatio
00101                         * m_dBeltRatio / (2. * dPI);
00102         }
00103 
00104         //Overloaded Method for CoB3
00105         void setParam(
00106                 int iDriveIdent,
00107                 int iEncIncrPerRevMot,
00108                 double dVelMeasFrqHz,
00109                 double dBeltRatio,
00110                 double dGearRatio,
00111                 int iSign,
00112                 double dVelMaxEncIncrS,
00113                 double dAccIncrS2,
00114                 double dDecIncrS2,
00115                 int iEncOffsetIncr,
00116                 bool bIsSteer,
00117         double dCurrToTorque,
00118                 double dCurrMax)
00119         {
00120 
00121                 m_iDriveIdent = iDriveIdent;
00122                 m_iEncIncrPerRevMot = iEncIncrPerRevMot;
00123                 m_dVelMeasFrqHz = dVelMeasFrqHz;
00124                 m_dBeltRatio = dBeltRatio;
00125                 m_dGearRatio = dGearRatio;
00126                 m_iSign = iSign;
00127                 m_dVelMaxEncIncrS = dVelMaxEncIncrS;
00128                 m_dAccIncrS2 = dAccIncrS2;
00129                 m_dDecIncrS2 = dDecIncrS2;
00130                 m_iEncOffsetIncr = iEncOffsetIncr;
00131                 m_bIsSteer = bIsSteer;
00132 
00133                 m_iHomingDigIn = 11; //for Cob3
00134 
00135                 double dPI = 3.14159265358979323846;
00136 
00137                 m_dPosGearRadToPosMotIncr = m_iEncIncrPerRevMot * m_dGearRatio
00138                         * m_dBeltRatio / (2. * dPI);
00139 
00140         m_dCurrToTorque = dCurrToTorque;
00141                 m_dCurrMax = dCurrMax;
00142         }
00143 
00144         //Overloaded Method for CoB3 including new feature HomingDigIn, for compatibility reasons overloaded
00145         void setParam(
00146                 int iDriveIdent,
00147                 int iEncIncrPerRevMot,
00148                 double dVelMeasFrqHz,
00149                 double dBeltRatio,
00150                 double dGearRatio,
00151                 int iSign,
00152                 double dVelMaxEncIncrS,
00153                 double dAccIncrS2,
00154                 double dDecIncrS2,
00155                 int iEncOffsetIncr,
00156                 bool bIsSteer,
00157         double dCurrToTorque,
00158                 double dCurrMax,
00159                 int iHomingDigIn)
00160         {
00161 
00162                 m_iDriveIdent = iDriveIdent;
00163                 m_iEncIncrPerRevMot = iEncIncrPerRevMot;
00164                 m_dVelMeasFrqHz = dVelMeasFrqHz;
00165                 m_dBeltRatio = dBeltRatio;
00166                 m_dGearRatio = dGearRatio;
00167                 m_iSign = iSign;
00168                 m_dVelMaxEncIncrS = dVelMaxEncIncrS;
00169                 m_dAccIncrS2 = dAccIncrS2;
00170                 m_dDecIncrS2 = dDecIncrS2;
00171                 m_iEncOffsetIncr = iEncOffsetIncr;
00172                 m_bIsSteer = bIsSteer;
00173 
00174                 double dPI = 3.14159265358979323846;
00175 
00176                 m_dPosGearRadToPosMotIncr = m_iEncIncrPerRevMot * m_dGearRatio
00177                         * m_dBeltRatio / (2. * dPI);
00178 
00179         m_dCurrToTorque = dCurrToTorque;
00180                 m_dCurrMax = dCurrMax;
00181                 m_iHomingDigIn = iHomingDigIn;
00182         }
00183 
00187         int getDriveIdent()
00188         {
00189                 return m_iDriveIdent;
00190         }
00191 
00195         int getSign()
00196         {
00197                 return m_iSign;
00198         }
00199 
00203         double getVelMax()
00204         {
00205                 return m_dVelMaxEncIncrS;
00206         }
00207 
00215         void PosVelRadToIncr(double dPosRad, double dVelRadS, int* piPosIncr, int* piVelIncrPeriod)
00216         {
00217                 *piPosIncr = PosGearRadToPosMotIncr(dPosRad);
00218                 *piVelIncrPeriod = VelGearRadSToVelMotIncrPeriod(dVelRadS);
00219         }
00220 
00226         int TempMeasIncrToGradCel(int iTempIncr)
00227         {
00228                 double dTempMeasGradCel;
00229 
00230                 dTempMeasGradCel = 0.0002 * (iTempIncr * iTempIncr) - 0.2592 * iTempIncr + 105;
00231 
00232                 return (int)dTempMeasGradCel;
00233         }
00234 
00239         int PosGearRadToPosMotIncr(double dPosGearRad)
00240         {
00241                 return ((int)(dPosGearRad * m_dPosGearRadToPosMotIncr));
00242         }
00243 
00245         double PosMotIncrToPosGearRad(int iPosIncr)
00246         {
00247                 return ((double)iPosIncr / m_dPosGearRadToPosMotIncr);
00248         }
00249 
00251         int VelGearRadSToVelMotIncrPeriod(double dVelGearRadS)
00252         {
00253                 return ((int)(dVelGearRadS * m_dPosGearRadToPosMotIncr / m_dVelMeasFrqHz));
00254         }
00255 
00257         double VelMotIncrPeriodToVelGearRadS(int iVelMotIncrPeriod)
00258         {
00259                 return ((double)iVelMotIncrPeriod / m_dPosGearRadToPosMotIncr * m_dVelMeasFrqHz);
00260         }
00261 
00266         void setMaxAcc(double dMaxAcc)
00267         {
00268                 m_dAccIncrS2 = dMaxAcc;
00269         }
00270 
00275         double getMaxAcc()
00276         {
00277                 return m_dAccIncrS2;
00278         }
00279 
00284         void setMaxDec(double dMaxDec)
00285         {
00286                 m_dDecIncrS2 = dMaxDec;
00287         }
00288 
00293         double getMaxDec()
00294         {
00295                 return m_dDecIncrS2;
00296         }
00297 
00302         void setMaxVel(double dMaxVel)
00303         {
00304                 m_dVelMaxEncIncrS = dMaxVel;
00305         }
00306 
00311         double getMaxVel()
00312         {
00313                 return m_dVelMaxEncIncrS;
00314         }
00315 
00320         double getGearRatio()
00321         {
00322                 return m_dGearRatio;
00323         }
00328         double getBeltRatio()
00329         {
00330                 return m_dBeltRatio;
00331         }
00332 
00337         int getEncOffset()
00338         {
00339                 return m_iEncOffsetIncr;
00340         }
00341 
00346         bool getIsSteer()
00347         {
00348                 return m_bIsSteer;
00349         }
00354         int getEncIncrPerRevMot()
00355         {
00356                 return m_iEncIncrPerRevMot;
00357         }
00361         double getCurrToTorque()
00362         {
00363                 return m_dCurrToTorque;
00364         }
00368         double getCurrMax()
00369         {
00370                 return m_dCurrMax;
00371         }
00375         int getHomingDigIn()
00376         {
00377                 return m_iHomingDigIn;
00378         }
00382         void setHomingDigIn(int HomingDigIn)
00383         {
00384                 m_iHomingDigIn = HomingDigIn;
00385         }
00386 };
00387 //-----------------------------------------------
00388 #endif


cob_canopen_motor
Author(s): Christian Connette
autogenerated on Sat Jun 8 2019 21:02:28