Fast Research Interface Library  Manual and Documentation
include/LWRBaseControllerInterface.h
Go to the documentation of this file.
00001 //  ---------------------- Doxygen info ----------------------
00053 //  ----------------------------------------------------------
00054 //   For a convenient reading of this file's source code,
00055 //   please use a tab width of four characters.
00056 //  ----------------------------------------------------------
00057 
00058 
00059 #ifndef __LWRBaseControllerInterface__
00060 #define __LWRBaseControllerInterface__
00061 
00062 #include <FastResearchInterface.h>
00063 #include <friComm.h>
00064 #include <OSAbstraction.h>
00065 #include <errno.h>
00066 #include <stdarg.h>
00067 
00068 
00069 
00070 //  ---------------------- Doxygen info ----------------------
00093 //  ----------------------------------------------------------
00094 
00095 class LWRBaseControllerInterface
00096 {
00097 
00098 
00099 public:
00100 
00101 
00102 //  ---------------------- Doxygen info ----------------------
00112 //  ----------------------------------------------------------
00113     LWRBaseControllerInterface(const char *InitFileName)
00114     {
00115         this->FRI           =   new FastResearchInterface(InitFileName);
00116     }
00117 
00118 
00119 //  ---------------------- Doxygen info ----------------------
00129 //  ----------------------------------------------------------
00130     ~LWRBaseControllerInterface(void)
00131     {
00132         delete this->FRI;
00133     }
00134 
00135 
00136 //  ---------------------- Doxygen info ----------------------
00144 //  ----------------------------------------------------------
00145     virtual inline int StartRobot(const float &TimeOutValueInSeconds) = 0;
00146 
00147 //  ---------------------- Doxygen info ----------------------
00155 //  ----------------------------------------------------------
00156     inline int StopRobot(void)
00157     {
00158         return(this->FRI->StopRobot());
00159     }
00160 
00161 
00162 //  ---------------------- Doxygen info ----------------------
00176 //  ----------------------------------------------------------
00177     inline int GetMeasuredJointPositions(float *MeasuredJointPositions)
00178     {
00179         this->FRI->GetMeasuredJointPositions(MeasuredJointPositions);
00180 
00181         if (this->FRI->GetFRIMode() == FRI_STATE_OFF)
00182         {
00183             return(ENOTCONN);
00184         }
00185         else
00186         {
00187             return(EOK);
00188         }
00189     }
00190 
00191 
00192 //  ---------------------- Doxygen info ----------------------
00206 //  ----------------------------------------------------------
00207     inline int GetMeasuredJointTorques(float *MeasuredJointTorques)
00208     {
00209         this->FRI->GetMeasuredJointTorques(MeasuredJointTorques);
00210 
00211         if (this->FRI->GetFRIMode() == FRI_STATE_OFF)
00212         {
00213             return(ENOTCONN);
00214         }
00215         else
00216         {
00217             return(EOK);
00218         }
00219     }
00220 
00221 
00222 //  ---------------------- Doxygen info ----------------------
00230 //  ----------------------------------------------------------
00231     inline int WaitForKRCTick(const unsigned int &TimeoutValueInMicroSeconds = 0)
00232     {
00233         return(this->FRI->WaitForKRCTick(TimeoutValueInMicroSeconds));
00234     }
00235 
00236 
00237 //  ---------------------- Doxygen info ----------------------
00245 //  ----------------------------------------------------------
00246     inline int WaitForTimerTick(const unsigned int &TimeoutValueInMicroSeconds = 0)
00247     {
00248         return(this->FRI->WaitForTimerTick(TimeoutValueInMicroSeconds));
00249     }
00250 
00251 
00252 //  ---------------------- Doxygen info ----------------------
00260 //  ----------------------------------------------------------
00261     inline bool IsMachineOK(void)
00262     {
00263         return(this->FRI->IsMachineOK());
00264     }
00265 
00266 
00267 //  ---------------------- Doxygen info ----------------------
00275 //  ----------------------------------------------------------
00276     inline float GetCycleTime(void)
00277     {
00278         return(this->FRI->GetFRICycleTime());
00279     }
00280 
00281 
00282 //  ---------------------- Doxygen info ----------------------
00290 //  ----------------------------------------------------------
00291     inline const char* GetCompleteRobotStateAndInformation(void)
00292     {
00293         return(FRI->GetCompleteRobotStateAndInformation());
00294     }
00295 
00296 //  ---------------------- Doxygen info ----------------------
00304 //  ----------------------------------------------------------
00305     inline int printf(const char* Format, ...)
00306     {
00307         int         Result      =   0;
00308         va_list     ListOfArguments;
00309 
00310         va_start(ListOfArguments, Format);
00311         Result = FRI->printf(Format, ListOfArguments);
00312         va_end(ListOfArguments);
00313 
00314         return(Result);
00315     }
00316 
00317 
00318 //  ---------------------- Doxygen info ----------------------
00326 //  ----------------------------------------------------------
00327     inline int PrepareLogging(const char *FileIdentifier = NULL)
00328     {
00329         return(FRI->PrepareLogging(FileIdentifier));
00330     }
00331 
00332 
00333 //  ---------------------- Doxygen info ----------------------
00341 //  ----------------------------------------------------------
00342     inline int StartLogging(void)
00343     {
00344         return(FRI->StartLogging());
00345     }
00346 
00347 
00348 //  ---------------------- Doxygen info ----------------------
00356 //  ----------------------------------------------------------
00357     inline int StopLogging(void)
00358     {
00359         return(FRI->StopLogging());
00360     }
00361 
00362 
00363 //  ---------------------- Doxygen info ----------------------
00371 //  ----------------------------------------------------------
00372     inline int WriteLoggingDataFile(void)
00373     {
00374         return(FRI->WriteLoggingDataFile());
00375     }
00376 
00377 
00378 protected:
00379 
00380 
00381 //  ---------------------- Doxygen info ----------------------
00386 //  ----------------------------------------------------------
00387     FastResearchInterface       *FRI;
00388 
00389 };  // class LWRBaseControllerInterface
00390 
00391 #endif
This document was generated with Doxygen on Thu Apr 12 2012 11:18:53. User documentation of the Fast Research Interface Library for the KUKA Lightweight Robot IV by the Stanford Robotics Research Group. Copyright 2010–2012.