|
Fast Research Interface Library
Manual and Documentation
|
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 // SetCommandedJointPositions() 00064 // 00065 void FastResearchInterface::SetCommandedJointPositions(const float *CommandedJointPositions) 00066 { 00067 unsigned int i = 0; 00068 00069 pthread_mutex_lock(&(this->MutexForControlData)); 00070 for (i = 0; i < LBR_MNJ; i++) 00071 { 00072 this->CommandData.cmd.jntPos[i] = CommandedJointPositions[i]; 00073 } 00074 pthread_mutex_unlock(&(this->MutexForControlData)); 00075 00076 return; 00077 } 00078 00079 00080 // **************************************************************** 00081 // SetCommandedJointTorques() 00082 // 00083 void FastResearchInterface::SetCommandedJointTorques(const float *CommandedJointTorques) 00084 { 00085 unsigned int i = 0; 00086 00087 pthread_mutex_lock(&(this->MutexForControlData)); 00088 for (i = 0; i < LBR_MNJ; i++) 00089 { 00090 this->CommandData.cmd.addJntTrq[i] = CommandedJointTorques[i]; 00091 } 00092 pthread_mutex_unlock(&(this->MutexForControlData)); 00093 00094 return; 00095 } 00096 00097 00098 // **************************************************************** 00099 // SetCommandedJointStiffness() 00100 // 00101 void FastResearchInterface::SetCommandedJointStiffness(const float *CommandedJointStiffness) 00102 { 00103 unsigned int i = 0; 00104 00105 pthread_mutex_lock(&(this->MutexForControlData)); 00106 for (i = 0; i < LBR_MNJ; i++) 00107 { 00108 this->CommandData.cmd.jntStiffness[i] = CommandedJointStiffness[i]; 00109 } 00110 pthread_mutex_unlock(&(this->MutexForControlData)); 00111 00112 return; 00113 } 00114 00115 00116 // **************************************************************** 00117 // SetCommandedJointDamping() 00118 // 00119 void FastResearchInterface::SetCommandedJointDamping(const float *CommandedJointDamping) 00120 { 00121 unsigned int i = 0; 00122 00123 pthread_mutex_lock(&(this->MutexForControlData)); 00124 for (i = 0; i < LBR_MNJ; i++) 00125 { 00126 this->CommandData.cmd.jntDamping[i] = CommandedJointDamping[i]; 00127 } 00128 pthread_mutex_unlock(&(this->MutexForControlData)); 00129 00130 return; 00131 } 00132 00133 00134 // **************************************************************** 00135 // SetCommandedCartPose() 00136 // 00137 void FastResearchInterface::SetCommandedCartPose(const float *CommandedCartPose) 00138 { 00139 unsigned int i = 0; 00140 00141 pthread_mutex_lock(&(this->MutexForControlData)); 00142 for (i = 0; i < FRI_CART_FRM_DIM; i++) 00143 { 00144 this->CommandData.cmd.cartPos[i] = CommandedCartPose[i]; 00145 } 00146 pthread_mutex_unlock(&(this->MutexForControlData)); 00147 00148 return; 00149 } 00150 00151 00152 // **************************************************************** 00153 // SetCommandedCartForcesAndTorques() 00154 // 00155 void FastResearchInterface::SetCommandedCartForcesAndTorques(const float *CartForcesAndTorques) 00156 { 00157 unsigned int i = 0; 00158 00159 pthread_mutex_lock(&(this->MutexForControlData)); 00160 for (i = 0; i < FRI_CART_VEC; i++) 00161 { 00162 this->CommandData.cmd.addTcpFT[i] = CartForcesAndTorques[i]; 00163 } 00164 pthread_mutex_unlock(&(this->MutexForControlData)); 00165 00166 return; 00167 } 00168 00169 00170 // **************************************************************** 00171 // SetCommandedCartStiffness() 00172 // 00173 void FastResearchInterface::SetCommandedCartStiffness(const float *CommandedCartStiffness) 00174 { 00175 unsigned int i = 0; 00176 00177 pthread_mutex_lock(&(this->MutexForControlData)); 00178 for (i = 0; i < FRI_CART_VEC; i++) 00179 { 00180 this->CommandData.cmd.cartStiffness[i] = CommandedCartStiffness[i]; 00181 } 00182 pthread_mutex_unlock(&(this->MutexForControlData)); 00183 00184 return; 00185 } 00186 00187 00188 // **************************************************************** 00189 // SetCommandedCartDamping() 00190 // 00191 void FastResearchInterface::SetCommandedCartDamping(const float *CommandedCartDamping) 00192 { 00193 unsigned int i = 0; 00194 00195 pthread_mutex_lock(&(this->MutexForControlData)); 00196 for (i = 0; i < FRI_CART_VEC; i++) 00197 { 00198 this->CommandData.cmd.cartDamping[i] = CommandedCartDamping[i]; 00199 } 00200 pthread_mutex_unlock(&(this->MutexForControlData)); 00201 00202 return; 00203 }