UndercarriageCtrlGeom.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 UndercarriageCtrlGeom_INCLUDEDEF_H
19 #define UndercarriageCtrlGeom_INCLUDEDEF_H
20 
21 //#include <time.h>
22 
23 #include <cob_utilities/IniFile.h>
24 #include <cob_utilities/MathSup.h>
26 
28 {
29 private:
30 
32 
34 
35  std::string m_sIniDirectory;
36 
37  /*// Logging for debugging
38  // create Filepointers
39  FILE * m_pfileDesVel, * m_pfileMeasVel;
40  FILE * m_pfileSteerAngTarget1, * m_pfileSteerAngTarget2;
41  FILE * m_pfileSteerAngTarget, * m_pfileDriveVelTarget;
42  FILE * m_pfileSteerAngCmd, * m_pfileSteerVelCmd, * m_pfileDriveVelCmd;
43  // create TimeStamp
44  TimeStamp m_RawTime, m_StartTime;
45  double m_dNowTime;*/
46 
47 
48  // Actual Values for PltfMovement (calculated from Actual Wheelspeeds)
49  double m_dVelLongMMS;
50  double m_dVelLatMMS;
51  double m_dRotRobRadS;
52  double m_dRotVelRadS;
53 
54  // Actual Wheelspeed (read from Motor-Ctrls)
55  std::vector<double> m_vdVelGearDriveRadS;
56  std::vector<double> m_vdVelGearSteerRadS;
57  std::vector<double> m_vdDltAngGearDriveRad;
58  std::vector<double> m_vdAngGearSteerRad;
59 
60  // Desired Pltf-Movement (set from PltfHwItf)
65 
66  /*// Interpolated Wheelspeeds (calculated from desired and current Pltf-Config)
67  std::vector<double> m_vdVelGearDriveIntpRadS;
68  std::vector<double> m_vdVelGearSteerIntpRadS;
69  std::vector<double> m_vdAngGearSteerIntpRad;
70 
71  // Delta values for interpolating between two commands
72  std::vector<double> m_vdDeltaAngIntpRad;
73  std::vector<double> m_vdDeltaDriveIntpRadS;*/
74 
75  // Desired Wheelspeeds set to ELMO-Ctrl's (calculated from desired Pltf-Movement)
76  std::vector<double> m_vdVelGearDriveCmdRadS;
77  std::vector<double> m_vdVelGearSteerCmdRadS;
78  std::vector<double> m_vdAngGearSteerCmdRad;
79 
80  // Target Wheelspeed and -angle (calculated from desired Pltf-Movement with Inverse without controle!)
81  // This Values might not be valid (to high step response in steering rate, ...) for commanding the drives
82  std::vector<double> m_vdAngGearSteerTarget1Rad; // alternativ 1 for steering angle
83  std::vector<double> m_vdVelGearDriveTarget1RadS;
84  std::vector<double> m_vdAngGearSteerTarget2Rad; // alternativ 2 for steering angle (+/- PI)
85  std::vector<double> m_vdVelGearDriveTarget2RadS;
86  std::vector<double> m_vdAngGearSteerTargetRad; // choosen alternativ for steering angle
87  std::vector<double> m_vdVelGearDriveTargetRadS;
88 
93  std::vector<double> m_vdWheelXPosMM;
94  std::vector<double> m_vdWheelYPosMM;
95  std::vector<double> m_vdWheelDistMM;
96  std::vector<double> m_vdWheelAngRad;
97 
102  std::vector<double> m_vdExWheelXPosMM;
103  std::vector<double> m_vdExWheelYPosMM;
104  std::vector<double> m_vdExWheelDistMM;
105  std::vector<double> m_vdExWheelAngRad;
106 
107  struct ParamType
108  {
111 
113 
116  double dCmdRateS;
117  std::vector<double> WheelNeutralPos;
118  std::vector<double> vdSteerDriveCoupling;
123  std::vector<double> vdFactorVel;
124  };
125 
127 
147  std::vector< std::vector<double> > m_vdCtrlVal;
148 
149  // Factor for thread cycle time of ThreadMotionPltfCtrl and ThreadUnderCarriageCtrl
150  //double m_dThreadCycleMultiplier;
151 
152  // calculate inverse kinematics
153  void CalcInverse(void);
154 
155  // calculate direct kinematics
156  void CalcDirect(void);
157 
158  // calculate Exact Wheel Position in robot coordinates
159  void CalcExWheelPos(void);
160 
161  // perform one discrete Controle Step
162  void CalcControlStep(void);
163 
164 public:
165 
166  // Constructor
167  UndercarriageCtrlGeom(std::string sIniDirectory);
168 
169  // Destructor
171 
172  // Initialize Parameters for Controller and Kinematics
173  void InitUndercarriageCtrl(void);
174 
175  // Set desired value for Plattform Velocity to UndercarriageCtrl (Sollwertvorgabe)
176  void SetDesiredPltfVelocity(double dCmdVelLongMMS, double dCmdVelLatMMS, double dCmdRotRobRadS, double dCmdRotVelRadS);
177 
178  // Set actual values of wheels (steer/drive velocity/position) (Istwerte)
179  void SetActualWheelValues(std::vector<double> vdVelGearDriveRadS, std::vector<double> vdVelGearSteerRadS, std::vector<double> vdDltAngGearDriveRad, std::vector<double> vdAngGearSteerRad);
180 
181  // Get result of inverse kinematics (without controller)
182  void GetSteerDriveSetValues(std::vector<double> & vdVelGearDriveRadS, std::vector<double> & vdAngGearSteerRad);
183 
184  // Get set point values for the Wheels (including controller) from UndercarriangeCtrl
185  void GetNewCtrlStateSteerDriveSetValues(std::vector<double> & vdVelGearDriveRadS, std::vector<double> & vdVelGearSteerRadS, std::vector<double> & vdAngGearSteerRad,
186  double & dVelLongMMS, double & dVelLatMMS, double & dRotRobRadS, double & dRotVelRadS);
187 
188  // Get result of direct kinematics
189  void GetActualPltfVelocity(double & dDeltaLongMM, double & dDeltaLatMM, double & dDeltaRotRobRad, double & dDeltaRotVelRad,
190  double & dVelLongMMS, double & dVelLatMMS, double & dRotRobRadS, double & dRotVelRadS);
191 
192  // Set EM flag and stop Ctrlr
193  void setEMStopActive(bool bEMStopActive);
194 
195  // operator overloading
196  void operator=(const UndercarriageCtrlGeom & GeomCtrl);
197 };
198 #endif
199 
std::vector< double > m_vdWheelXPosMM
std::vector< std::vector< double > > m_vdCtrlVal
void setEMStopActive(bool bEMStopActive)
std::vector< double > m_vdExWheelDistMM
std::vector< double > m_vdAngGearSteerCmdRad
std::vector< double > m_vdAngGearSteerTargetRad
std::vector< double > m_vdVelGearDriveCmdRadS
void operator=(const UndercarriageCtrlGeom &GeomCtrl)
std::vector< double > m_vdDltAngGearDriveRad
std::vector< double > m_vdAngGearSteerTarget2Rad
std::vector< double > m_vdAngGearSteerTarget1Rad
std::vector< double > vdSteerDriveCoupling
void GetNewCtrlStateSteerDriveSetValues(std::vector< double > &vdVelGearDriveRadS, std::vector< double > &vdVelGearSteerRadS, std::vector< double > &vdAngGearSteerRad, double &dVelLongMMS, double &dVelLatMMS, double &dRotRobRadS, double &dRotVelRadS)
std::vector< double > m_vdVelGearDriveRadS
std::vector< double > m_vdExWheelYPosMM
std::vector< double > m_vdWheelDistMM
void SetDesiredPltfVelocity(double dCmdVelLongMMS, double dCmdVelLatMMS, double dCmdRotRobRadS, double dCmdRotVelRadS)
std::vector< double > m_vdVelGearDriveTarget2RadS
std::vector< double > m_vdVelGearSteerRadS
std::vector< double > m_vdVelGearDriveTargetRadS
std::vector< double > m_vdAngGearSteerRad
std::vector< double > m_vdExWheelAngRad
std::vector< double > m_vdExWheelXPosMM
void SetActualWheelValues(std::vector< double > vdVelGearDriveRadS, std::vector< double > vdVelGearSteerRadS, std::vector< double > vdDltAngGearDriveRad, std::vector< double > vdAngGearSteerRad)
void GetSteerDriveSetValues(std::vector< double > &vdVelGearDriveRadS, std::vector< double > &vdAngGearSteerRad)
std::vector< double > m_vdWheelYPosMM
std::vector< double > m_vdVelGearSteerCmdRadS
void GetActualPltfVelocity(double &dDeltaLongMM, double &dDeltaLatMM, double &dDeltaRotRobRad, double &dDeltaRotVelRad, double &dVelLongMMS, double &dVelLatMMS, double &dRotRobRadS, double &dRotVelRadS)
std::vector< double > m_vdVelGearDriveTarget1RadS
std::vector< double > m_vdWheelAngRad
UndercarriageCtrlGeom(std::string sIniDirectory)


cob_undercarriage_ctrl
Author(s): Christian Connette
autogenerated on Wed Apr 7 2021 02:11:56