Fast Research Interface Library  Manual and Documentation
src/FastResearchInterfaceLibrary/GetRobotControlData.cpp
Go to the documentation of this file.
00001 //  ---------------------- Doxygen info ----------------------
00051 //  ----------------------------------------------------------
00052 //   For a convenient reading of this file's source code,
00053 //   please use a tab width of four characters.
00054 //  ----------------------------------------------------------
00055 
00056 
00057 #include <FastResearchInterface.h>
00058 #include <pthread.h>
00059 #include <friComm.h>
00060 
00061 
00062 // ****************************************************************
00063 // GetMeasuredJointPositions()
00064 //
00065 void FastResearchInterface::GetMeasuredJointPositions(float *MeasuredJointPositions)
00066 {
00067     unsigned int        i   =   0;
00068 
00069     pthread_mutex_lock(&(this->MutexForControlData));
00070     for (i = 0; i < LBR_MNJ; i++)
00071     {
00072         MeasuredJointPositions[i]   =   this->ReadData.data.msrJntPos[i];
00073     }
00074     pthread_mutex_unlock(&(this->MutexForControlData));
00075 
00076     return;
00077 }
00078 
00079 
00080 // ****************************************************************
00081 // GetCommandedJointPositions()
00082 //
00083 void FastResearchInterface::GetCommandedJointPositions(float *CommandedJointPositions)
00084 {
00085     unsigned int        i   =   0;
00086 
00087     pthread_mutex_lock(&(this->MutexForControlData));
00088     for (i = 0; i < LBR_MNJ; i++)
00089     {
00090         CommandedJointPositions[i]  =   this->ReadData.data.cmdJntPos[i];
00091     }
00092     pthread_mutex_unlock(&(this->MutexForControlData));
00093 
00094     return;
00095 }
00096 
00097 
00098 // ****************************************************************
00099 // GetCommandedJointPositionOffsets()
00100 //
00101 void FastResearchInterface::GetCommandedJointPositionOffsets(float *CommandedJointPositionOffsets)
00102 {
00103     unsigned int        i   =   0;
00104 
00105     pthread_mutex_lock(&(this->MutexForControlData));
00106     for (i = 0; i < LBR_MNJ; i++)
00107     {
00108         CommandedJointPositionOffsets[i]    =   this->ReadData.data.cmdCartPosFriOffset[i];
00109     }
00110     pthread_mutex_unlock(&(this->MutexForControlData));
00111 
00112     return;
00113 }
00114 
00115 
00116 // ****************************************************************
00117 // GetMeasuredJointTorques()
00118 //
00119 void FastResearchInterface::GetMeasuredJointTorques(float *MeasuredJointTorques)
00120 {
00121     unsigned int        i   =   0;
00122 
00123     pthread_mutex_lock(&(this->MutexForControlData));
00124     for (i = 0; i < LBR_MNJ; i++)
00125     {
00126         MeasuredJointTorques[i] =   this->ReadData.data.msrJntTrq[i];
00127     }
00128     pthread_mutex_unlock(&(this->MutexForControlData));
00129 
00130     return;
00131 }
00132 
00133 
00134 // ****************************************************************
00135 // GetEstimatedExternalJointTorques()
00136 //
00137 void FastResearchInterface::GetEstimatedExternalJointTorques(float *EstimatedExternalJointTorques)
00138 {
00139     unsigned int        i   =   0;
00140 
00141     pthread_mutex_lock(&(this->MutexForControlData));
00142     for (i = 0; i < LBR_MNJ; i++)
00143     {
00144         EstimatedExternalJointTorques[i]    =   this->ReadData.data.estExtJntTrq[i];
00145     }
00146     pthread_mutex_unlock(&(this->MutexForControlData));
00147 
00148     return;
00149 }
00150 
00151 
00152 // ****************************************************************
00153 // GetMeasuredCartPose()
00154 //
00155 void FastResearchInterface::GetMeasuredCartPose(float *MeasuredCartPose)
00156 {
00157     unsigned int        i   =   0;
00158 
00159     pthread_mutex_lock(&(this->MutexForControlData));
00160     for (i = 0; i < FRI_CART_FRM_DIM; i++)
00161     {
00162         MeasuredCartPose[i] =   this->ReadData.data.msrCartPos[i];
00163     }
00164     pthread_mutex_unlock(&(this->MutexForControlData));
00165 
00166     return;
00167 }
00168 
00169 
00170 // ****************************************************************
00171 // GetCommandedCartPose()
00172 //
00173 void FastResearchInterface::GetCommandedCartPose(float *CommandedCartPose)
00174 {
00175     unsigned int        i   =   0;
00176 
00177     pthread_mutex_lock(&(this->MutexForControlData));
00178     for (i = 0; i < FRI_CART_FRM_DIM; i++)
00179     {
00180         CommandedCartPose[i]    =   this->ReadData.data.cmdCartPos[i];
00181     }
00182     pthread_mutex_unlock(&(this->MutexForControlData));
00183 
00184     return;
00185 }
00186 
00187 
00188 // ****************************************************************
00189 // GetCommandedCartPoseOffsets()
00190 //
00191 void FastResearchInterface::GetCommandedCartPoseOffsets(float *CommandedCartPoseOffsets)
00192 {
00193     unsigned int        i   =   0;
00194 
00195     pthread_mutex_lock(&(this->MutexForControlData));
00196     for (i = 0; i < FRI_CART_FRM_DIM; i++)
00197     {
00198         CommandedCartPoseOffsets[i] =   this->ReadData.data.cmdCartPosFriOffset[i];
00199     }
00200     pthread_mutex_unlock(&(this->MutexForControlData));
00201 
00202     return;
00203 }
00204 
00205 
00206 // ****************************************************************
00207 // GetEstimatedExternalCartForcesAndTorques()
00208 //
00209 void FastResearchInterface::GetEstimatedExternalCartForcesAndTorques(float *EstimatedExternalCartForcesAndTorques)
00210 {
00211     unsigned int        i   =   0;
00212 
00213     pthread_mutex_lock(&(this->MutexForControlData));
00214     for (i = 0; i < FRI_CART_VEC; i++)
00215     {
00216         EstimatedExternalCartForcesAndTorques[i]    =   this->ReadData.data.estExtTcpFT[i];
00217     }
00218     pthread_mutex_unlock(&(this->MutexForControlData));
00219 
00220     return;
00221 }
00222 
This document was generated with Doxygen on Thu Apr 12 2012 11:18:54. User documentation of the Fast Research Interface Library for the KUKA Lightweight Robot IV by the Stanford Robotics Research Group. Copyright 2010–2012.