PowerCubeSim.h
Go to the documentation of this file.
00001 
00060 #ifndef __POWER_CUBE_SIM_H_
00061 #define __POWER_CUBE_SIM_H_
00062 
00063 #include <schunk_powercube_chain/PowerCubeCtrl.h>
00064 #include <schunk_powercube_chain/Joint.h>
00065 #include <iostream>
00066 #include <stdio.h>
00067 #include <stdlib.h>
00068 #include <vector>
00069 
00070 using namespace std;
00071 #include <pthread.h>
00072 
00073 
00074 //-------------------------------------------------------------------------
00075 //                              Defines
00076 // -------------------------------------------------------------------------
00077 
00078 #define MAX_VEL 0.5
00079 #define MAX_ACC 0.5
00080 #define K13 0.5
00081 #define K14 0.5
00082 #define K15 3
00083 #define DAEMPFUNG 0.5
00084 
00085 //#define __LINUX__
00086 
00087 #ifdef SWIG
00088 %module PowerCubeSim
00089 %include "Source/Manipulation/Interfaces/armInterface.h"
00090 %{
00091         #include "PowerCubeSim.h"
00092 %}
00093 #endif 
00094 
00095 class PowerCubeSim;
00096 
00097 /* Thread arguments for simulation threads*/
00098 typedef struct
00099 {
00100         PowerCubeSim * cubeSimPtr;
00101         int cubeID;
00102         double targetAngle;
00103 } SimThreadArgs;
00104 
00105 class PowerCubeSim
00106 {
00107         public:
00108                 
00109                 PowerCubeSim();
00110                 ~PowerCubeSim();
00111                 
00112 
00113                 bool Init(PowerCubeCtrlParams * params);
00114 
00115                 bool isInitialized() const { return m_Initialized; }
00116 
00117                 std::string getErrorMessage() const { return m_ErrorMessage; }
00118 
00119                 int Close(){return true;}
00120                 // Arm-Ansteuerung:
00121                 
00122 
00125                 bool MoveJointSpaceSync(const std::vector<double>& Angle);
00126                                 
00128                 bool MoveVel(const std::vector<double>& vel);
00129                 
00131                 bool Stop();
00132                 
00134                 // Funktionen zum setzen von Parametern: //
00136                 
00139                 bool setMaxVelocity(double radpersec);
00140                 
00141                 bool setMaxVelocity(const std::vector<double>& radpersec);
00142 
00145                 bool setMaxAcceleration(double radPerSecSquared);
00146                 bool setMaxAcceleration(const std::vector<double>& radPerSecSquared);
00147                 
00149                 // hier die Funktionen zur Statusabfrage: //
00151         
00152 
00154                 bool getConfig(std::vector<double>& result);
00155                 
00157                 bool getJointVelocities(std::vector<double>& result);
00158 
00159                 void setCurrentAngles(std::vector<double> Angles);
00160 
00161                 void setCurrentJointVelocities(std::vector<double> Angles);
00162                 
00165                 bool statusMoving();
00166                 bool statusMoving(int cubeNo);
00167                 
00169                 bool statusDec();
00170                 
00172                 bool statusAcc();
00173 
00175                 //vector<int> getModuleMap(int dev);
00176                 
00178                 //void HomingDone();
00179                 
00180                 typedef enum
00181                 {
00182                         PC_CTRL_OK = 0,
00183                         PC_CTRL_NOT_REFERENCED = -1,
00184                         PC_CTRL_ERR = -2,
00185                         PC_CTRL_POW_VOLT_ERR = -3
00186                 } PC_CTRL_STATE;
00187                 //int getStatus(){return PC_CTRL_OK;}
00188                 double maxVel;
00189 
00190                 void setStatusMoving (int cubeNo, bool moving);
00191                 bool getStatusMoving (int cubeNo) const { return m_MovementInProgress[cubeNo]; }
00192 
00193                 vector<int>  getModuleMap() const {return m_IdModules;}
00194                 std::vector<double>  getCurrentAngularMaxVel() {return m_CurrentAngularMaxVel;}
00195                 std::vector<double>  getCurrentAngularMaxAccel() {return m_CurrentAngularMaxAccel;}
00196             void millisleep(unsigned int milliseconds) const;
00197         protected:
00198                 
00200                 //void waitForSync();
00202                 //void dontWaitForSync();
00204                 double timeRampMove(double dtheta, double vnow, double v, double a);
00205 
00206                 int startSimulatedMovement(std::vector<double> target);
00207 
00208 
00209                 //void* SimThreadRoutine (void*);       
00210         
00211         
00212                 #ifdef COB3
00213                 Manipulator * m_Obj_Manipulator;
00214 #endif
00215                 
00216                 int m_DOF;
00217                 int m_Initialized;
00218                 int m_NumOfModules;
00219                 int m_Dev;
00220                 vector<int> m_IdModules;
00221                 
00222                 std::vector<double> m_maxVel;
00223                 std::vector<double> m_maxAcc;
00224 
00225                 Jointd m_AngleOffsets;
00226 
00227                 std::vector<bool> m_MovementInProgress;
00228 
00229                 std::vector<double> m_CurrentAngles;
00230                 std::vector<double> m_CurrentAngularVel;
00231                 std::vector<double> m_CurrentAngularMaxVel;
00232                 std::vector<double> m_CurrentAngularMaxAccel;
00233 
00234 
00235 
00236                 //vector<unsigned long> startConf;
00237                 
00238                 std::string m_ErrorMessage;
00239 
00240                 float maxAcc;
00241 
00242                 pthread_mutex_t  m_Angles_Mutex;
00243                 pthread_mutex_t  m_AngularVel_Mutex;
00244                 pthread_mutex_t  m_Movement_Mutex;
00245                 pthread_t  * m_SimThreadID;
00246                 SimThreadArgs ** m_SimThreadArgs;
00247                 
00248 };
00249 
00250 
00251 #endif


schunk_powercube_chain
Author(s): Florian Weisshardt
autogenerated on Thu Aug 27 2015 15:06:58