CanCtrlPltfCOb3.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 CANCTRLPLTFCOB3_INCLUDEDEF_H
19 #define CANCTRLPLTFCOB3_INCLUDEDEF_H
20 
21 //-----------------------------------------------
22 
23 // general includes
24 
25 // Headers provided by other cob-packages
28 #include <cob_generic_can/CanItf.h>
29 
30 // Headers provided by cob-packages which should be avoided/removed
31 #include <cob_utilities/IniFile.h>
32 #include <cob_utilities/Mutex.h>
33 
34 // remove (not supported)
35 //#include "stdafx.h"
36 
37 
38 //-----------------------------------------------
39 
43 class CanCtrlPltfCOb3 // : public CanCtrlPltfItf
44 {
45 public:
46 
47  //--------------------------------- Basic procedures
48 
52  CanCtrlPltfCOb3(std::string iniDirectory);
53 
58 
59 
60  //--------------------------------- Hardware Specification
61 
67  {
76  };
77 
78 
79  //--------------------------------- Commands for all nodes on the bus
80 
86  bool initPltf();
87 
92  bool resetPltf();
93 
98  bool isPltfError();
99 
104  bool shutdownPltf();
105 
109  bool startWatchdog(bool bStarted);
110 
114  int evalCanBuffer();
115 
116 
117  //--------------------------------- Commands specific for motor controller nodes
118 
125  int setVelGearRadS(int iCanIdent, double dVelGearRadS);
126 
133  void setMotorTorque(int iCanIdent, double dTorqueNm);
134 
141  void requestDriveStatus();
142 
150  int requestMotPosVel(int iCanIdent);
151 
156  void requestMotorTorque();
157 
164  int getGearPosVelRadS(int iCanIdent, double* pdAngleGearRad, double* pdVelGearRadS);
165 
172  int getGearDeltaPosVelRadS(int iCanIdent, double* pdDeltaAngleGearRad, double* pdVelGearRadS);
173 
179  void getStatus(int iCanIdent, int* piStatus, int* piTempCel);
180 
186  void getMotorTorque(int iCanIdent, double* pdTorqueNm);
187 
188 
189 
190  //--------------------------------- Commands specific for a certain motor controller
191  // have to be implemented here, to keep the CanDriveItf generic
192 
203  int ElmoRecordings(int iFlag, int iParam, std::string sString);
204 
205  //--------------------------------- Commands for other nodes
206 
207 
208 
209 
210 protected:
211 
212  //--------------------------------- internal functions
213 
218  std::string sIniDirectory;
219  std::string sComposed;
220  void readConfiguration();
221 
225  void sendNetStartCanOpen();
226 
227 
228  //--------------------------------- Types
229 
233  struct ParamType
234  {
235  // Platform config
236 
245 
250 
252 
255 
261 
262  double dCanTimeout;
263  };
264 
269  {
272  double dGearRatio;
273  double dBeltRatio;
274  int iSign;
276  double dAccIncrS2;
277  double dDecIncrS2;
278  double dScaleToMM;
280  bool bIsSteer;
282  double dCurrMax;
284  };
285 
290  {
293 
298 
303 
308 
313 
320  };
321 
327  {
328  // Wheel 1
329  // can adresse motor 1
335  // can adresse motor 2
341 
342  // Wheel 2
343  // can adresse motor 7
349  // can adresse motor 8
355 
356  // Wheel 3
357  // can adresse motor 5
363  // can adresse motor 6
369 
370  // Wheel 4
371  // can adresse motor 3
377  // can adresse motor 4
383  };
384 
385  //--------------------------------- Parameter
387 // CanNeoIDType m_CanNeoIDParam;
389 
390  // Prms for all Motor/Gear combos
399 
400  //--------------------------------- Variables
404 
405  //--------------------------------- Components
406  // Can-Interface
409 
412 
413  // Motor-Controllers
414 /* CanDriveItf* m_pW1DriveMotor;
415  CanDriveItf* m_pW1SteerMotor;
416  CanDriveItf* m_pW2DriveMotor;
417  CanDriveItf* m_pW2SteerMotor;
418  CanDriveItf* m_pW3DriveMotor;
419  CanDriveItf* m_pW3SteerMotor;
420  CanDriveItf* m_pW4DriveMotor;
421  CanDriveItf* m_pW4SteerMotor;*/
422  // pointer to each motors Can-Itf
423  std::vector<CanDriveItf*> m_vpMotor;
424  // vector with enums (specifying hardware-structure) -> simplifies cmd-check
425  // this has to be adapted in c++ file to your hardware
426  std::vector<int> m_viMotorID;
427 
428  // other
429 
430 
431 };
432 
433 
434 //-----------------------------------------------
435 #endif
std::string sIniDirectory
GearMotorParamType m_GearMotDrive3
int setVelGearRadS(int iCanIdent, double dVelGearRadS)
std::string sComposed
GearMotorParamType m_GearMotDrive1
CanOpenIDType m_CanOpenIDParam
GearMotorParamType m_GearMotSteer1
int requestMotPosVel(int iCanIdent)
std::vector< CanDriveItf * > m_vpMotor
int getGearDeltaPosVelRadS(int iCanIdent, double *pdDeltaAngleGearRad, double *pdVelGearRadS)
void getMotorTorque(int iCanIdent, double *pdTorqueNm)
bool startWatchdog(bool bStarted)
GearMotorParamType m_GearMotDrive4
int getGearPosVelRadS(int iCanIdent, double *pdAngleGearRad, double *pdVelGearRadS)
void getStatus(int iCanIdent, int *piStatus, int *piTempCel)
GearMotorParamType m_GearMotSteer4
GearMotorParamType m_GearMotSteer3
GearMotorParamType m_GearMotDrive2
CanCtrlPltfCOb3(std::string iniDirectory)
std::vector< int > m_viMotorID
void setMotorTorque(int iCanIdent, double dTorqueNm)
GearMotorParamType m_GearMotSteer2
int ElmoRecordings(int iFlag, int iParam, std::string sString)


cob_base_drive_chain
Author(s): Christian Connette
autogenerated on Wed Apr 7 2021 02:11:54