dsr_hw_interface.cpp
Go to the documentation of this file.
1 /*
2  * Inferfaces for doosan robot controllor
3  * Author: Kab Kyoum Kim (kabkyoum.kim@doosan.com)
4  *
5  * Copyright (c) 2019 Doosan Robotics
6  * Use of this source code is governed by the BSD, see LICENSE
7 */
8 
10 #include <boost/thread/thread.hpp>
11 #include <boost/assign/list_of.hpp>
12 #include <boost/bind.hpp>
13 #include <sstream>
14 
15 CDRFL Drfl;
16 Serial_comm ser_comm;
17 
20 bool g_bHommingCompleted = FALSE;
21 
24 
25 #define STABLE_BAND_JNT 0.05
26 #define DSR_CTL_PUB_RATE 100 //[hz] 10ms <----- 퍼블리싱 주기, but OnMonitoringDataCB() 은 100ms 마다 불려짐을 유의!
27 
28 namespace dsr_control{
29 
30  const char* GetRobotStateString(int nState)
31  {
32  switch(nState)
33  {
34  case STATE_INITIALIZING: return "(0) INITIALIZING";
35  case STATE_STANDBY: return "(1) STANDBY";
36  case STATE_MOVING: return "(2) MOVING";
37  case STATE_SAFE_OFF: return "(3) SAFE_OFF";
38  case STATE_TEACHING: return "(4) TEACHING";
39  case STATE_SAFE_STOP: return "(5) SAFE_STOP";
40  case STATE_EMERGENCY_STOP: return "(6) EMERGENCY_STOP";
41  case STATE_HOMMING: return "(7) HOMMING";
42  case STATE_RECOVERY: return "(8) RECOVERY";
43  case STATE_SAFE_STOP2: return "(9) SAFE_STOP2";
44  case STATE_SAFE_OFF2: return "(10) SAFE_OFF2";
45  case STATE_RESERVED1: return "(11) RESERVED1";
46  case STATE_RESERVED2: return "(12) RESERVED2";
47  case STATE_RESERVED3: return "(13) RESERVED3";
48  case STATE_RESERVED4: return "(14) RESERVED4";
49  case STATE_NOT_READY: return "(15) NOT_READY";
50 
51  default: return "UNKNOWN";
52  }
53  return "UNKNOWN";
54  }
55 
56  int IsInposition(double dCurPosDeg[], double dCmdPosDeg[])
57  {
58  int cnt=0;
59  double dError[NUM_JOINT] ={0.0, };
60 
61  for(int i=0;i<NUM_JOINT;i++)
62  {
63  dError[i] = dCurPosDeg[i] - dCmdPosDeg[i];
64  ROS_INFO("<inpos> %f = %f -%f",dError[i], dCurPosDeg[i], dCmdPosDeg[i]);
65  if(fabs(dError[i]) < STABLE_BAND_JNT)
66  cnt++;
67  }
68  if(NUM_JOINT == cnt)
69  return true;
70  else
71  return false;
72  }
73 
74  //----- register the call-back functions ----------------------------------------
76  {
77  // request control authority after TP initialized
78  cout << "[callback OnTpInitializingCompletedCB] tp initializing completed" << endl;
80  //Drfl.ManageAccessControl(MANAGE_ACCESS_CONTROL_REQUEST);
81  Drfl.ManageAccessControl(MANAGE_ACCESS_CONTROL_FORCE_REQUEST);
82 
83  g_stDrState.bTpInitialized = TRUE;
84  }
85 
87  {
88  g_bHommingCompleted = TRUE;
89  // Only work within 50msec
90  cout << "[callback OnHommingCompletedCB] homming completed" << endl;
91 
92  g_stDrState.bHommingCompleted = TRUE;
93  }
94 
95  void DRHWInterface::OnProgramStoppedCB(const PROGRAM_STOP_CAUSE iStopCause)
96  {
97  cout << "[callback OnProgramStoppedCB] Program Stop: " << (int)iStopCause << endl;
98  g_stDrState.bDrlStopped = TRUE;
99  }
100 
101  void DRHWInterface::OnMonitoringCtrlIOCB (const LPMONITORING_CTRLIO pCtrlIO)
102  {
103  for (int i = 0; i < NUM_DIGITAL; i++){
104  if(pCtrlIO){
105  g_stDrState.bCtrlBoxDigitalOutput[i] = pCtrlIO->_tOutput._iTargetDO[i];
106  g_stDrState.bCtrlBoxDigitalInput[i] = pCtrlIO->_tInput._iActualDI[i];
107  }
108  }
109  }
110 
111  void DRHWInterface::OnMonitoringModbusCB (const LPMONITORING_MODBUS pModbus)
112  {
113  g_stDrState.nRegCount = pModbus->_iRegCount;
114  for (int i = 0; i < pModbus->_iRegCount; i++){
115  cout << "[callback OnMonitoringModbusCB] " << pModbus->_tRegister[i]._szSymbol <<": " << pModbus->_tRegister[i]._iValue<< endl;
116  g_stDrState.strModbusSymbol[i] = pModbus->_tRegister[i]._szSymbol;
117  g_stDrState.nModbusValue[i] = pModbus->_tRegister[i]._iValue;
118  }
119  }
120 
121  void DRHWInterface::OnMonitoringDataCB(const LPMONITORING_DATA pData)
122  {
123  // This function is called every 100 msec
124  // Only work within 50msec
125  //ROS_INFO("DRHWInterface::OnMonitoringDataCB");
126 
127 
128  /* 추후 연결 필요
129  pData->_tCtrl._tState._iActualMode; // position control: 0, torque control: 1
130  pData->_tCtrl._tState._iActualSpace; //joint space: 0, task space: 1
131 
132  pData->_tCtrl._tJoint._fActualPos[NUM_JOINT]; // Position Actual Value in INC
133  pData->_tCtrl._tJoint._fActualAbs[NUM_JOINT]; // Position Actual Value in ABS
134  pData->_tCtrl._tJoint._fActualVel[NUM_JOINT]; // Velocity Actual Value
135  pData->_tCtrl._tJoint._fActualErr[NUM_JOINT]; // Joint Error
136  pData->_tCtrl._tJoint._fTargetPos[NUM_JOINT]; // Target Position
137  pData->_tCtrl._tJoint._fTargetVel[NUM_JOINT]; // Target Velocity
138 
139  pData->_tCtrl._tTool._fActualPos[2][NUM_TASK]; // Position Actual Value(0: tool, 1: flange)
140  pData->_tCtrl._tTool._fActualVel[NUM_TASK]; // Velocity Actual Value
141  pData->_tCtrl._tTool._fActualErr[NUM_TASK]; // Task Error
142  pData->_tCtrl._tTool._fTargetPos[NUM_TASK]; // Target Position
143  pData->_tCtrl._tTool._fTargetVel[NUM_TASK]; // Target Velocity
144  pData->_tCtrl._tTool._iSolutionSpace; // Solution Space
145  pData->_tCtrl._tTool._fRotationMatrix[3][3]; // Rotation Matrix
146 
147  pData->_tCtrl._tTorque._fDynamicTor[NUM_JOINT]; // Dynamics Torque
148  pData->_tCtrl._tTorque._fActualJTS[NUM_JOINT]; // Joint Torque Sensor Value
149  pData->_tCtrl._tTorque._fActualEJT[NUM_JOINT]; // External Joint Torque
150  pData->_tCtrl._tTorque._fActualETT[NUM_JOINT]; // External Task Force/Torque
151 
152  pData->_tMisc._dSyncTime; // inner clock counter
153  pData->_tMisc._iActualDI[NUM_FLANGE_IO]; // Digtal Input data
154  pData->_tMisc._iActualDO[NUM_FLANGE_IO]; // Digtal output data
155  pData->_tMisc._iActualBK[NUM_JOINT]; // brake state
156  pData->_tMisc._iActualBT[NUM_BUTTON]; // robot button state
157  pData->_tMisc._fActualMC[NUM_JOINT]; // motor input current
158  pData->_tMisc._fActualMT[NUM_JOINT]; // motro current temperature
159  */
160  g_stDrState.nActualMode = pData->_tCtrl._tState._iActualMode;
161  g_stDrState.nActualSpace = pData->_tCtrl._tState._iActualSpace;
162 
163  for (int i = 0; i < NUM_JOINT; i++){
164  if(pData){
165  g_stDrState.fCurrentPosj[i] = pData->_tCtrl._tJoint._fActualPos[i];
166  g_stDrState.fCurrentPosx[i] = pData->_tCtrl._tTool._fActualPos[0][i];
167  g_stDrState.fCurrentVelj[i] = pData->_tCtrl._tJoint._fActualVel[i];
168  g_stDrState.fCurrentVelx[i] = pData->_tCtrl._tTool._fActualVel[i];
169  g_stDrState.fJointAbs[i] = pData->_tCtrl._tJoint._fActualAbs[i];
170  g_stDrState.fJointErr[i] = pData->_tCtrl._tJoint._fActualErr[i];
171  g_stDrState.fTargetPosj[i] = pData->_tCtrl._tJoint._fTargetPos[i];
172  g_stDrState.fTargetVelj[i] = pData->_tCtrl._tJoint._fTargetVel[i];
173 
174  g_stDrState.fTaskErr[i] = pData->_tCtrl._tTool._fActualErr[i];
175  g_stDrState.fTargetPosx[i] = pData->_tCtrl._tTool._fTargetPos[i];
176  g_stDrState.fTargetVelx[i] = pData->_tCtrl._tTool._fTargetVel[i];
177 
178  g_stDrState.fDynamicTor[i] = pData->_tCtrl._tTorque._fDynamicTor[i];
179  g_stDrState.fActualJTS[i] = pData->_tCtrl._tTorque._fActualJTS[i];
180  g_stDrState.fActualEJT[i] = pData->_tCtrl._tTorque._fActualEJT[i];
181  g_stDrState.fActualETT[i] = pData->_tCtrl._tTorque._fActualETT[i];
182 
183  g_stDrState.nActualBK[i] = pData->_tMisc._iActualBK[i];
184  g_stDrState.fActualMC[i] = pData->_tMisc._fActualMC[i];
185  g_stDrState.fActualMT[i] = pData->_tMisc._fActualMT[i];
186  }
187  }
188  for (int i = 5; i < NUM_BUTTON; i++){
189  if(pData){
190  g_stDrState.nActualBT[i] = pData->_tMisc._iActualBT[i];
191  }
192  }
193 
194  g_stDrState.nSolutionSpace = pData->_tCtrl._tTool._iSolutionSpace;
195  g_stDrState.dSyncTime = pData->_tMisc._dSyncTime;
196 
197  for(int i = 0; i < 3; i++){
198  for(int j = 0; j < 3; j++){
199  if(pData){
200  g_stDrState.fRotationMatrix[j][i] = pData->_tCtrl._tTool._fRotationMatrix[j][i];
201  }
202  }
203  }
204 
205  for (int i = 0; i < NUM_FLANGE_IO; i++){
206  if(pData){
207  g_stDrState.bFlangeDigitalInput[i] = pData->_tMisc._iActualDI[i];
208  g_stDrState.bFlangeDigitalOutput[i] = pData->_tMisc._iActualDO[i];
209  }
210  }
211  }
212 
213  void DRHWInterface::OnMonitoringStateCB(const ROBOT_STATE eState)
214  {
215  //This function is called when the state changes.
216  //ROS_INFO("DRHWInterface::OnMonitoringStateCB");
217  // Only work within 50msec
218  ROS_INFO("On Monitor State");
219  switch((unsigned char)eState)
220  {
221 #if 0 // TP initializing logic, Don't use in API level. (If you want to operate without TP, use this logic)
222  case eSTATE_NOT_READY:
223  if (g_bHasControlAuthority) Drfl.SetRobotControl(CONTROL_INIT_CONFIG);
224  break;
225  case eSTATE_INITIALIZING:
226  // add initalizing logic
227  if (g_bHasControlAuthority) Drfl.SetRobotControl(CONTROL_ENABLE_OPERATION);
228  break;
229 #endif
230  case STATE_EMERGENCY_STOP:
231  // popup
232  break;
233  case STATE_STANDBY:
234  case STATE_MOVING:
235  case STATE_TEACHING:
236  break;
237  case STATE_SAFE_STOP:
239  Drfl.SetSafeStopResetType(SAFE_STOP_RESET_TYPE_DEFAULT);
240  Drfl.SetRobotControl(CONTROL_RESET_SAFET_STOP);
241  }
242  break;
243  case STATE_SAFE_OFF:
245  Drfl.SetRobotControl(CONTROL_SERVO_ON);
246  }
247  break;
248  case STATE_SAFE_STOP2:
249  if (g_bHasControlAuthority) Drfl.SetRobotControl(CONTROL_RECOVERY_SAFE_STOP);
250  break;
251  case STATE_SAFE_OFF2:
253  Drfl.SetRobotControl(CONTROL_RECOVERY_SAFE_OFF);
254  }
255  break;
256  case STATE_RECOVERY:
257  Drfl.SetRobotControl(CONTROL_RESET_RECOVERY);
258  break;
259  default:
260  break;
261  }
262 
263  cout << "[callback OnMonitoringStateCB] current state: " << GetRobotStateString((int)eState) << endl;
264  g_stDrState.nRobotState = (int)eState;
265  strncpy(g_stDrState.strRobotState, GetRobotStateString((int)eState), MAX_SYMBOL_SIZE);
266  }
267 
268  void DRHWInterface::OnMonitoringAccessControlCB(const MONITORING_ACCESS_CONTROL eAccCtrl)
269  {
270  // Only work within 50msec
271 
272  cout << "[callback OnMonitoringAccessControlCB] eAccCtrl: " << eAccCtrl << endl;
273  switch(eAccCtrl)
274  {
275  case MONITORING_ACCESS_CONTROL_REQUEST:
276  Drfl.ManageAccessControl(MANAGE_ACCESS_CONTROL_RESPONSE_NO);
277  //Drfl.TransitControlAuth(MANaGE_ACCESS_CONTROL_RESPONSE_YES);
278  break;
279  case MONITORING_ACCESS_CONTROL_GRANT:
280  cout << "access control granted" << endl;
281  g_bHasControlAuthority = TRUE;
282  OnMonitoringStateCB(Drfl.GetRobotState());
283  break;
284  case MONITORING_ACCESS_CONTROL_DENY:
285  ROS_INFO("Access control deny !!!!!!!!!!!!!!!");
286  break;
287  case MONITORING_ACCESS_CONTROL_LOSS:
288  g_bHasControlAuthority = FALSE;
290  Drfl.ManageAccessControl(MANAGE_ACCESS_CONTROL_REQUEST);
291  //Drfl.TransitControlAuth(MANAGE_ACCESS_CONTROL_FORCE_REQUEST);
292  }
293  break;
294  default:
295  break;
296  }
297  g_stDrState.nAccessControl = (int)eAccCtrl;
298  }
299 
300  void DRHWInterface::OnLogAlarm(LPLOG_ALARM pLogAlarm)
301  {
302  //This function is called when an error occurs.
303  ros::NodeHandlePtr node = boost::make_shared<ros::NodeHandle>();
304  ros::Publisher PubRobotError = node->advertise<dsr_msgs::RobotError>("error",100);
305  dsr_msgs::RobotError msg;
306 
307  ROS_ERROR("[callback OnLogAlarm]");
308  ROS_ERROR(" level : %d",(unsigned int)pLogAlarm->_iLevel );
309  ROS_ERROR(" group : %d",(unsigned int)pLogAlarm->_iGroup );
310  ROS_ERROR(" index : %d", pLogAlarm->_iIndex );
311  ROS_ERROR(" param : %s", pLogAlarm->_szParam[0] );
312  ROS_ERROR(" param : %s", pLogAlarm->_szParam[1] );
313  ROS_ERROR(" param : %s", pLogAlarm->_szParam[2] );
314 
315  g_stDrError.nLevel = (unsigned int)pLogAlarm->_iLevel;
316  g_stDrError.nGroup = (unsigned int)pLogAlarm->_iGroup;
317  g_stDrError.nCode = pLogAlarm->_iIndex;
318  strncpy(g_stDrError.strMsg1, pLogAlarm->_szParam[0], MAX_STRING_SIZE);
319  strncpy(g_stDrError.strMsg2, pLogAlarm->_szParam[1], MAX_STRING_SIZE);
320  strncpy(g_stDrError.strMsg3, pLogAlarm->_szParam[2], MAX_STRING_SIZE);
321 
322  msg.level = g_stDrError.nLevel;
323  msg.group = g_stDrError.nGroup;
324  msg.code = g_stDrError.nCode;
325  msg.msg1 = g_stDrError.strMsg1;
326  msg.msg2 = g_stDrError.strMsg2;
327  msg.msg3 = g_stDrError.strMsg3;
328 
329  PubRobotError.publish(msg);
330  }
331  //----- register the call-back functions end -------------------------------------
332 
336  void MsgScriber(const dsr_msgs::RobotStop::ConstPtr& msg)
337  {
338  //ROS_INFO("receive msg.stop_mode = %d", msg->stop_mode);
339  //ROS_INFO("receive msg.stop_mode = %d", msg->stop_mode);
340  ROS_INFO("receive msg.stop_mode = %d", msg->stop_mode);
341 
342  Drfl.MoveStop((STOP_TYPE)msg->stop_mode);
343  }
344 
346  {
347  dsr_msgs::RobotState msg;
348  dsr_msgs::ModbusState modbus_state;
349  memcpy(&m_stDrState, &g_stDrState, sizeof(DR_STATE));
350 
351  msg.robot_state = m_stDrState.nRobotState;
352  msg.robot_state_str = m_stDrState.strRobotState;
354  msg.actual_mode = m_stDrState.nActualMode;
355  msg.actual_space = m_stDrState.nActualSpace;
356 
357  for (int i = 0; i < NUM_JOINT; i++)
358  {
359  msg.current_posj[i] = m_stDrState.fCurrentPosj[i];
360  msg.current_velj[i] = m_stDrState.fCurrentVelj[i];
361  msg.joint_abs[i] = m_stDrState.fJointAbs[i];
362  msg.joint_err[i] = m_stDrState.fJointErr[i];
363  msg.target_posj[i] = m_stDrState.fTargetPosj[i];
364  msg.target_velj[i] = m_stDrState.fTargetVelj[i];
365 
366  msg.current_posx[i] = m_stDrState.fCurrentPosx[i];
367  msg.current_velx[i] = m_stDrState.fCurrentVelx[i];
368  msg.task_err[i] = m_stDrState.fTaskErr[i];
369  msg.target_velx[i] = m_stDrState.fTargetVelx[i];
370  msg.target_posx[i] = m_stDrState.fTargetPosx[i];
371 
372  msg.dynamic_tor[i] = m_stDrState.fDynamicTor[i];
373  msg.actual_jts[i] = m_stDrState.fActualJTS[i];
374  msg.actual_ejt[i] = m_stDrState.fActualEJT[i];
375  msg.actual_ett[i] = m_stDrState.fActualETT[i];
376 
377 
378  msg.actual_bk[i] = m_stDrState.nActualBK[i];
379  msg.actual_mc[i] = m_stDrState.fActualMC[i];
380  msg.actual_mt[i] = m_stDrState.fActualMT[i];
381  }
382  msg.solution_space = m_stDrState.nSolutionSpace;
383  msg.sync_time = m_stDrState.dSyncTime;
384  std_msgs::Float64MultiArray arr;
385 
386  for (int i = 0; i < 3; i++){
387  arr.data.clear();
388  for (int j = 0; j < 3; j++){
389  arr.data.push_back(m_stDrState.fRotationMatrix[i][j]);
390  }
391  msg.rotation_matrix.push_back(arr);
392  }
393 
394  for (int i = 0; i < NUM_BUTTON; i++){
395  msg.actual_bt[i] = m_stDrState.nActualBT[i];
396  }
397  for (int i = 0; i < NUM_DIGITAL; i++){
398  msg.ctrlbox_digital_input[i] = m_stDrState.bCtrlBoxDigitalInput[i];
399  msg.ctrlbox_digital_output[i] = m_stDrState.bCtrlBoxDigitalOutput[i];
400  }
401  for (int i = 0; i < NUM_FLANGE_IO; i++){
402  msg.flange_digital_input[i] = m_stDrState.bFlangeDigitalInput[i];
403  msg.flange_digital_output[i] = m_stDrState.bFlangeDigitalOutput[i];
404  }
405  //msg.io_modbus; GJH
406  for (int i = 0; i < m_stDrState.nRegCount; i++){
407  modbus_state.modbus_symbol = m_stDrState.strModbusSymbol[i];
408  modbus_state.modbus_value = m_stDrState.nModbusValue[i];
409  msg.modbus_state.push_back(modbus_state);
410  }
411  //msg.error; GJH
412  msg.access_control = m_stDrState.nAccessControl;
413  msg.homming_completed = m_stDrState.bHommingCompleted;
414  msg.tp_initialized = m_stDrState.bTpInitialized;
415  msg.mastering_need = m_stDrState.bMasteringNeed;
416  msg.drl_stopped = m_stDrState.bDrlStopped;
417  msg.disconnected = m_stDrState.bDisconnected;
418 
420  return 0;
421  }
422 
423  /* 현재 미사용 : DRHWInterface::OnLogAlarm 에서 바로 퍼블리싱 함.
424  int DRHWInterface::MsgPublisher_RobotError()
425  {
426  dsr_msgs::RobotError msg;
427  memcpy(&m_stDrError, &g_stDrError, sizeof(DR_ERROR));
428 
429  msg.level = m_stDrError.nLevel;
430  msg.group = m_stDrError.nGroup;
431  msg.code = m_stDrError.nCode;
432  msg.msg1 = m_stDrError.strMsg1;
433  msg.msg2 = m_stDrError.strMsg2;
434  msg.msg3 = m_stDrError.strMsg3;
435 
436  m_PubRobotError.publish(msg);
437  return 0;
438  }
439  */
440 
442  {
443  //ros::NodeHandlePtr node = boost::make_shared<ros::NodeHandle>();
444  ros::Subscriber sub_robot_stop = nh.subscribe("stop", 100, MsgScriber);
445  //ros::spin();
446  ros::MultiThreadedSpinner spinner(2);
447  spinner.spin();
448  }
449 
450  void DRHWInterface::thread_publisher(DRHWInterface* pDRHWInterface, ros::NodeHandle nh, int nPubRate)
451  {
452  //ros::NodeHandlePtr node = boost::make_shared<ros::NodeHandle>();
453  ros::Publisher PubRobotState = nh.advertise<dsr_msgs::RobotState>("state",100);
454  dsr_msgs::RobotState msg;
455 
456  ros::Rate r(nPubRate);
457  while (ros::ok())
458  {
459  //ROS_INFO("thread_publisher running!");
460  if(pDRHWInterface) pDRHWInterface->MsgPublisher_RobotState();
461  r.sleep();
462  }
463  }
464 
466  {
467  /*
468  <arg name="ns" value="$(arg ns)"/>
469  <arg name="model" value="$(arg model)"/>
470  <arg name="host" value="$(arg host)"/>
471  <arg name="mode" value="$(arg mode)"/>
472  */
473 
477 
478  ROS_INFO("name_space is %s, %s\n",m_strRobotName.c_str(), m_strRobotModel.c_str());
479 
480  ROS_INFO("[dsr_hw_interface] constructed");
481  ros::V_string arm_joint_names;
482  if(m_strRobotGripper == "robotiq_2f"){
483  arm_joint_names =
484  boost::assign::list_of("joint1")("joint2")("joint3")("joint4")("joint5")("joint6")("robotiq_85_left_knuckle_joint").convert_to_container<ros::V_string>();
485  }
486  else if(m_strRobotGripper == "none")
487  {
488  arm_joint_names =
489  boost::assign::list_of("joint1")("joint2")("joint3")("joint4")("joint5")("joint6").convert_to_container<ros::V_string>();
490  }
491  for(unsigned int i = 0; i < arm_joint_names.size(); i++){
492  hardware_interface::JointStateHandle jnt_state_handle(
493  arm_joint_names[i],
494  &joints[i].pos,
495  &joints[i].vel,
496  &joints[i].eff);
497  jnt_state_interface.registerHandle(jnt_state_handle);
498 
499  hardware_interface::JointHandle jnt_pos_handle(
500  jnt_state_handle,
501  &joints[i].cmd);
502  jnt_pos_interface.registerHandle(jnt_pos_handle);
503  }
506 
507  /*ros::V_string joint_names = boost::assign::list_of("front_left_wheel")("front_right_wheel")("rear_left_wheel")("rear_right_wheel");
508  for (unsigned int i = 0; i < joint_names.size(); i++){
509  hardware_interface::JointStateHandle joint_state_handle(joint_names[i], &joints[i].pos, &joints[i].vel, &joints[i].eff);
510  jnt_state_interface.registerHandle(joint_state_handle);
511 
512  hardware_interface::JointHandle joint_handle(joint_state_handle, &joints[i].cmd);
513  velocity_joint_interface_.registerHandle(joint_handle);
514  }
515  registerInterface(&velocity_joint_interface_);
516  */
517 
518  // Publisher msg
519  m_PubRobotState = private_nh_.advertise<dsr_msgs::RobotState>("state",100);
520  m_PubRobotError = private_nh_.advertise<dsr_msgs::RobotError>("error",100);
521  // gazebo에 joint position 전달
522  m_PubtoGazebo = private_nh_.advertise<std_msgs::Float64MultiArray>("/dsr_joint_position_controller/command",10);
523  // moveit의 trajectory/goal를 받아 제어기로 전달
524  m_sub_joint_trajectory = private_nh_.subscribe("dsr_joint_trajectory_controller/follow_joint_trajectory/goal", 10, &DRHWInterface::trajectoryCallback, this);
525  // topic echo 명령으로 제어기에 전달
526  m_sub_joint_position = private_nh_.subscribe("dsr_joint_position_controller/command", 10, &DRHWInterface::positionCallback, this);
527 
528  ros::NodeHandle nh_temp;
529  m_SubSerialRead = nh_temp.subscribe("serial_read", 100, &Serial_comm::read_callback, &ser_comm);
530  m_PubSerialWrite = nh_temp.advertise<std_msgs::String>("serial_write", 100);
531 
532  // system Operations
533  m_nh_system[0] = private_nh_.advertiseService("system/set_robot_mode", &DRHWInterface::set_robot_mode_cb, this);
534  m_nh_system[1] = private_nh_.advertiseService("system/get_robot_mode", &DRHWInterface::get_robot_mode_cb, this);
535  // motion Operations
536  m_nh_move_service[0] = private_nh_.advertiseService("motion/move_joint", &DRHWInterface::movej_cb, this);
538  m_nh_move_service[2] = private_nh_.advertiseService("motion/move_jointx", &DRHWInterface::movejx_cb, this);
539  m_nh_move_service[3] = private_nh_.advertiseService("motion/move_circle", &DRHWInterface::movec_cb, this);
540  m_nh_move_service[4] = private_nh_.advertiseService("motion/move_spline_joint", &DRHWInterface::movesj_cb, this);
541  m_nh_move_service[5] = private_nh_.advertiseService("motion/move_spline_task", &DRHWInterface::movesx_cb, this);
542  m_nh_move_service[6] = private_nh_.advertiseService("motion/move_blending", &DRHWInterface::moveb_cb, this);
546 
547  // GPIO Operations
556 
557  // Modbus Operations
562 
563  // TCP Operations
568 
569  // Tool Operations
574 
575  // DRL Operations
581 
582  // Gripper Operations
586 
587  // Serial Operations
589 
590  memset(&g_stDrState, 0x00, sizeof(DR_STATE));
591  memset(&g_stDrError, 0x00, sizeof(DR_ERROR));
592  memset(&m_stDrState, 0x00, sizeof(DR_STATE));
593  memset(&m_stDrError, 0x00, sizeof(DR_ERROR));
594 
595  // create threads
596  m_th_subscribe = boost::thread( boost::bind(&thread_subscribe, private_nh_) );
597  m_th_publisher = boost::thread( boost::bind(&thread_publisher, this, private_nh_, DSR_CTL_PUB_RATE/*hz*/) ); //100hz(10ms)
598 
599  }
601  {
602  //ROS_INFO("DRHWInterface::~DRHWInterface() 0");
603  Drfl.CloseConnection();
604 
605  //ROS_INFO("DRHWInterface::~DRHWInterface() 1");
606  m_th_publisher.join(); //kill publisher thread
607  //ROS_INFO("DRHWInterface::~DRHWInterface() 2");
608 
609  m_th_subscribe.join(); //kill subscribe thread
610  ROS_INFO("DRHWInterface::~DRHWInterface()");
611  }
612 
614  {
615  ROS_INFO("[dsr_hw_interface] init() ==> setup callback fucntion");
616  int nServerPort = 12345;
617  ROS_INFO("INIT@@@@@@@@@@@@@@@@@@@@@@@@@2");
618  //--- doosan API's call-back fuctions : Only work within 50msec in call-back functions
619  Drfl.SetOnTpInitializingCompleted(OnTpInitializingCompletedCB);
620  Drfl.SetOnHommingCompleted(OnHommingCompletedCB);
621  Drfl.SetOnProgramStopped(OnProgramStoppedCB);
622  Drfl.SetOnMonitoringCtrlIO(OnMonitoringCtrlIOCB);
623  Drfl.SetOnMonitoringModbus(OnMonitoringModbusCB);
624  Drfl.SetOnMonitoringData(OnMonitoringDataCB);
625  Drfl.SetOnMonitoringState(OnMonitoringStateCB);
626  Drfl.SetOnMonitoringAccessControl(OnMonitoringAccessControlCB);
627  Drfl.SetOnLogAlarm(OnLogAlarm);
628  ROS_INFO("[dsr_hw_interface] init() ==> arm is standby");
629  std::string host;
630  std::string mode;
631  private_nh_.getParam("host", host);
632  private_nh_.getParam("port", nServerPort);
633 
634  private_nh_.param<bool>("command", bCommand_, false);
635  private_nh_.getParam("mode", mode);
636 
637  //for test host = "127.0.0.1";
638 
639  ROS_INFO("host %s, port=%d bCommand: %d, mode: %s\n", host.c_str(), nServerPort, bCommand_, mode.c_str());
640 
641  if(Drfl.OpenConnection(host, nServerPort))
642  {
643  //--- Get version ---
644  SYSTEM_VERSION tSysVerion = {'\0', };
645  assert(Drfl.GetSystemVersion(&tSysVerion));
646  ROS_INFO("DRCF version = %s",tSysVerion._szController);
647  ROS_INFO("DRFL version = %s",Drfl.GetLibraryVersion());
648 
649  //--- Check Robot State : STATE_STANDBY ---
650  int delay;
651  ros::param::param<int>("~standby", delay, 5000);
652  while ((Drfl.GetRobotState() != STATE_STANDBY)){
653  usleep(delay);
654  }
655 
656  //--- Set Robot mode : MANUAL
657  assert(Drfl.SetRobotMode(ROBOT_MODE_MANUAL));
658 
659  //--- Set Robot mode : virual or real
660  ROBOT_SYSTEM eTargetSystem = ROBOT_SYSTEM_VIRTUAL;
661  if(mode == "real") eTargetSystem = ROBOT_SYSTEM_REAL;
662  assert(Drfl.SetRobotSystem(eTargetSystem));
663 
664  // to compare with joints[].cmd
665  for(int i = 0; i < NUM_JOINT; i++){
666  ROS_INFO("[init]::read %d-pos: %7.3f", i, joints[i].cmd);
667  cmd_[i] = joints[i].cmd;
668  }
669  return true;
670  }
671  return false;
672  }
673 
674  void DRHWInterface::read(ros::Duration& elapsed_time)
675  {
676  std_msgs::Float64MultiArray msg;
677  // joints.pos, vel, eff should be update
678  //ROS_DEBUG("DRHWInterface::read()");
679  LPROBOT_POSE pose = Drfl.GetCurrentPose();
680  for(int i = 0; i < NUM_JOINT; i++){
681  ROS_DEBUG("[DRHWInterface::read] %d-pos: %7.3f", i, pose->_fPosition[i]);
682  joints[i].pos = deg2rad(pose->_fPosition[i]); //update pos to Rviz
683  msg.data.push_back(joints[i].pos);
684  }
685  if(m_strRobotGripper != "none"){
686  msg.data.push_back(joints[6].pos);
687  }
688  m_PubtoGazebo.publish(msg);
689  }
691  {
692  //ROS_INFO("DRHWInterface::write()");
693  static int count = 0;
694  // joints.cmd is updated
695  std::array<float, NUM_JOINT> tmp;
696  for(int i = 0; i < NUM_JOINT; i++){
697  ROS_DEBUG("[write]::write %d-pos: %7.3f %d-vel: %7.3f %d-cmd: %7.3f",
698  i,
699  joints[i].pos,
700  i,
701  joints[i].vel,
702  i,
703  joints[i].cmd);
704  tmp[i] = joints[i].cmd;
705  }
706  if( !bCommand_ ) return;
707  /*int state = Drfl.GetRobotState();
708  if( state == STATE_STANDBY ){
709  for(int i = 0; i < NUM_JOINT; i++){
710  if( fabs(cmd_[i] - joints[i].cmd) > 0.0174532925 ){
711  Drfl.MoveJAsync(tmp.data(), 50, 50);
712  ROS_INFO_STREAM("[write] current state: " << GetRobotStateString(state));
713  std::copy(tmp.cbegin(), tmp.cend(), cmd_.begin());
714  break;
715  }
716  }
717  }*/
718  }
719 
720  //----- SIG Handler --------------------------------------------------------------
722  {
723  ROS_INFO("[sigint_hangler] CloseConnection");
724  ROS_INFO("[sigint_hangler] CloseConnection");
725  ROS_INFO("[sigint_hangler] CloseConnection");
726  }
727  void DRHWInterface::positionCallback(const std_msgs::Float64MultiArray::ConstPtr& msg){
728  ROS_INFO("callback: Position received");
729  std::array<float, NUM_JOINT> target_pos;
730  std::copy(msg->data.cbegin(), msg->data.cend(), target_pos.begin());
731  Drfl.MoveJAsync(target_pos.data(), 50, 50);
732  }
733 
734  void DRHWInterface::trajectoryCallback(const control_msgs::FollowJointTrajectoryActionGoal::ConstPtr& msg)
735  {
736  ROS_INFO("callback: Trajectory received");
737  ROS_INFO(" msg->goal.trajectory.points.size() =%d",(int)msg->goal.trajectory.points.size()); //=10 가변젹
738  ROS_INFO(" msg->goal.trajectory.joint_names.size() =%d",(int)msg->goal.trajectory.joint_names.size()); //=6
739 
740  float preTargetTime = 0.0;
741  float targetTime = 0.0;
742 
743  float fTargetPos[MAX_SPLINE_POINT][NUM_JOINT] = {0.0, };
744  int nCntTargetPos =0;
745 
746  nCntTargetPos = msg->goal.trajectory.points.size();
747  if(nCntTargetPos > MAX_SPLINE_POINT)
748  {
749  ROS_INFO("DRHWInterface::trajectoryCallback over max Trajectory (%d > %d)",nCntTargetPos ,MAX_SPLINE_POINT);
750  return;
751  }
752 
753  for(int i = 0; i < msg->goal.trajectory.points.size(); i++) //=10
754  {
755  std::array<float, NUM_JOINT> degrees;
756  ros::Duration d(msg->goal.trajectory.points[i].time_from_start);
757 
758  //ROS_INFO(" msg->goal.trajectory.points[%d].time_from_start = %7.3%f",i,(float)msg->goal.trajectory.points[i].time_from_start );
759 
760  targetTime = d.toSec();
765 
766  ROS_INFO("[trajectory] [%02d : %.3f] %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f",i ,targetTime
767  ,rad2deg(msg->goal.trajectory.points[i].positions[0]) ,rad2deg(msg->goal.trajectory.points[i].positions[1]), rad2deg(msg->goal.trajectory.points[i].positions[2])
768  ,rad2deg(msg->goal.trajectory.points[i].positions[3]) ,rad2deg(msg->goal.trajectory.points[i].positions[4]), rad2deg(msg->goal.trajectory.points[i].positions[5]) );
769 
770  for(int j = 0; j < msg->goal.trajectory.joint_names.size(); j++) //=6
771  {
772  //ROS_INFO("[trajectory] %d-pos: %7.3f", j, msg->goal.trajectory.points[i].positions[j]);
773  /* todo
774  get a position & time_from_start
775  convert radian to degree the position
776  run MoveJ(position, time_From_start)
777  */
778  degrees[j] = rad2deg( msg->goal.trajectory.points[i].positions[j] );
779 
780  fTargetPos[i][j] = degrees[j];
781 
782  }
783  }
784  Drfl.MoveSJ(fTargetPos, nCntTargetPos, 0.0, 0.0, targetTime, (MOVE_MODE)MOVE_MODE_ABSOLUTE);
785 
786  //Drfl.MoveJAsync(degrees.data(), 30, 30, 0, MOVE_MODE_ABSOLUTE, BLENDING_SPEED_TYPE_OVERRIDE);
787  /*
788  for(int i = 0; i < NUM_JOINT; i++){
789  ROS_INFO("[]::cmd %d-pos: %7.3f", i, joints[i].cmd);
790  cmd_[i] = joints[i].cmd;
791  }
792  */
793  }
794 
795  //----- Service Call-back functions ------------------------------------------------------------
796 
797  bool DRHWInterface::set_robot_mode_cb(dsr_msgs::SetRobotMode::Request& req, dsr_msgs::SetRobotMode::Response& res){
798  res.success = Drfl.SetRobotMode((ROBOT_MODE)req.robot_mode);
799  }
800 
801  bool DRHWInterface::get_robot_mode_cb(dsr_msgs::GetRobotMode::Request& req, dsr_msgs::GetRobotMode::Response& res){
802  res.robot_mode = Drfl.GetRobotMode();
803  }
804 
805  bool DRHWInterface::movej_cb(dsr_msgs::MoveJoint::Request& req, dsr_msgs::MoveJoint::Response& res)
806  {
807  std::array<float, NUM_JOINT> target_pos;
808  std::copy(req.pos.cbegin(), req.pos.cend(), target_pos.begin());
809  if(req.syncType == 0){
810  //ROS_INFO("DRHWInterface::movej_cb() called and calling Drfl.MoveJ");
811  res.success = Drfl.MoveJ(target_pos.data(), req.vel, req.acc, req.time, (MOVE_MODE)req.mode, req.radius, (BLENDING_SPEED_TYPE)req.blendType);
812  }
813  else{
814  //ROS_INFO("DRHWInterface::movej_cb() called and calling Drfl.MoveJAsync");
815  res.success = Drfl.MoveJAsync(target_pos.data(), req.vel, req.acc, req.time, (MOVE_MODE)req.mode, (BLENDING_SPEED_TYPE)req.blendType);
816  }
817  }
818  bool DRHWInterface::movel_cb(dsr_msgs::MoveLine::Request& req, dsr_msgs::MoveLine::Response& res)
819  {
820  std::array<float, NUM_TASK> target_pos;
821  std::array<float, 2> target_vel;
822  std::array<float, 2> target_acc;
823  std::copy(req.pos.cbegin(), req.pos.cend(), target_pos.begin());
824  std::copy(req.vel.cbegin(), req.vel.cend(), target_vel.begin());
825  std::copy(req.acc.cbegin(), req.acc.cend(), target_acc.begin());
826 
827  if(req.syncType == 0){
828  //ROS_INFO("DRHWInterface::movel_cb() called and calling Drfl.MoveL");
829  res.success = Drfl.MoveL(target_pos.data(), target_vel.data(), target_acc.data(), req.time, (MOVE_MODE)req.mode, (MOVE_REFERENCE)req.ref, req.radius, (BLENDING_SPEED_TYPE)req.blendType);
830  }
831  else{
832  //ROS_INFO("DRHWInterface::movel_cb() called and calling Drfl.MoveLAsync");
833  res.success = Drfl.MoveLAsync(target_pos.data(), target_vel.data(), target_acc.data(), req.time, (MOVE_MODE)req.mode, (MOVE_REFERENCE)req.ref, (BLENDING_SPEED_TYPE)req.blendType);
834  }
835  }
836  bool DRHWInterface::movejx_cb(dsr_msgs::MoveJointx::Request& req, dsr_msgs::MoveJointx::Response& res)
837  {
838  std::array<float, NUM_TASK> target_pos;
839  std::copy(req.pos.cbegin(), req.pos.cend(), target_pos.begin());
840  if(req.syncType == 0){
841  //ROS_INFO("DRHWInterface::movejx_cb() called and calling Drfl.MoveJX");
842  res.success = Drfl.MoveJX(target_pos.data(), req.sol, req.vel, req.acc, req.time, (MOVE_MODE)req.mode, (MOVE_REFERENCE)req.ref, req.radius, (BLENDING_SPEED_TYPE)req.blendType);
843  }
844  else{
845  //ROS_INFO("DRHWInterface::movejx_cb() called and calling Drfl.MoveJXAsync");
846  res.success = Drfl.MoveJXAsync(target_pos.data(), req.sol, req.vel, req.acc, req.time, (MOVE_MODE)req.mode, (MOVE_REFERENCE)req.ref, (BLENDING_SPEED_TYPE)req.blendType);
847  }
848  }
849  bool DRHWInterface::movec_cb(dsr_msgs::MoveCircle::Request& req, dsr_msgs::MoveCircle::Response& res)
850  {
851  float fTargetPos[2][NUM_TASK];
852  float fTargetVel[2];
853  float fTargetAcc[2];
854  for(int i = 0; i < 2; i++){
855  for(int j = 0; j < NUM_TASK; j++){
856  std_msgs::Float64MultiArray pos = req.pos.at(i);
857  fTargetPos[i][j] = pos.data[j];
858  }
859  fTargetVel[i] = req.vel[i];
860  fTargetAcc[i] = req.acc[i];
861  }
864  if(req.syncType == 0){
865  //ROS_INFO("DRHWInterface::movec_cb() called and calling Drfl.MoveC");
866  res.success = Drfl.MoveC(fTargetPos, fTargetVel, fTargetAcc, req.time, (MOVE_MODE)req.mode, (MOVE_REFERENCE)req.ref, req.radius, (BLENDING_SPEED_TYPE)req.blendType);
867  }
868  else{
869  //ROS_INFO("DRHWInterface::movec_cb() called and calling Drfl.MoveCAsync");
870  res.success = Drfl.MoveCAsync(fTargetPos, fTargetVel, fTargetAcc, req.time, (MOVE_MODE)req.mode, (MOVE_REFERENCE)req.ref, (BLENDING_SPEED_TYPE)req.blendType);
871  }
872  }
873  bool DRHWInterface::movesj_cb(dsr_msgs::MoveSplineJoint::Request& req, dsr_msgs::MoveSplineJoint::Response& res)
874  {
875  float fTargetPos[MAX_SPLINE_POINT][NUM_JOINT];
876 
877  for(int i=0; i<req.posCnt; i++){
878  for(int j=0; j<NUM_JOINT; j++){
879  std_msgs::Float64MultiArray pos = req.pos.at(i);
880  fTargetPos[i][j] = pos.data[j];
881  }
882  }
883  if(req.syncType == 0){
884  //ROS_INFO("DRHWInterface::movesj_cb() called and calling Drfl.MoveSJ");
885  res.success = Drfl.MoveSJ(fTargetPos, req.posCnt, req.vel, req.acc, req.time, (MOVE_MODE)req.mode);
886  }
887  else{
888  //ROS_INFO("DRHWInterface::movesj_cb() called and calling Drfl.MoveSJAsync");
889  res.success = Drfl.MoveSJAsync(fTargetPos, req.posCnt, req.vel, req.acc, req.time, (MOVE_MODE)req.mode);
890  }
891  }
892  bool DRHWInterface::movesx_cb(dsr_msgs::MoveSplineTask::Request& req, dsr_msgs::MoveSplineTask::Response& res)
893  {
894  float fTargetPos[MAX_SPLINE_POINT][NUM_TASK];
895  float fTargetVel[2];
896  float fTargetAcc[2];
897 
898  for(int i=0; i<req.posCnt; i++){
899  for(int j=0; j<NUM_TASK; j++){
900  std_msgs::Float64MultiArray pos = req.pos.at(i);
901  fTargetPos[i][j] = pos.data[j];
902  }
903  // fTargetVel[i] = req.vel[i];
904  // fTargetAcc[i] = req.acc[i];
905  }
906  for(int i=0; i<2; i++){
907  fTargetVel[i] = req.vel[i];
908  fTargetAcc[i] = req.acc[i];
909  }
910  if(req.syncType == 0){
911  //ROS_INFO("DRHWInterface::movesx_cb() called and calling Drfl.MoveSX");
912  res.success = Drfl.MoveSX(fTargetPos, req.posCnt, fTargetVel, fTargetAcc, req.time, (MOVE_MODE)req.mode, (MOVE_REFERENCE)req.ref, (SPLINE_VELOCITY_OPTION)req.opt);
913  }
914  else{
915  //ROS_INFO("DRHWInterface::movesx_cb() called and calling Drfl.MoveSXAsync");
916  res.success = Drfl.MoveSXAsync(fTargetPos, req.posCnt, fTargetVel, fTargetAcc, req.time, (MOVE_MODE)req.mode, (MOVE_REFERENCE)req.ref, (SPLINE_VELOCITY_OPTION)req.opt);
917  }
918  }
919  bool DRHWInterface::moveb_cb(dsr_msgs::MoveBlending::Request& req, dsr_msgs::MoveBlending::Response& res)
920  {
921 
922  MOVE_POSB posb[req.posCnt];
923  for(int i=0; i<req.posCnt; i++){
924  std_msgs::Float64MultiArray segment = req.segment.at(i);
925  for(int j=0; j<NUM_TASK; j++){
926  posb[i]._fTargetPos[0][j] = segment.data[j]; //0~5
927  posb[i]._fTargetPos[1][j] = segment.data[j + NUM_TASK]; //6~11
928  }
929  posb[i]._iBlendType = segment.data[NUM_TASK + NUM_TASK]; //12
930  posb[i]._fBlendRad = segment.data[NUM_TASK + NUM_TASK +1]; //13
931  }
932 
933  /*
934  for(int i=0; i<req.posCnt; i++){
935  printf("----- segment %d -----\n",i);
936  printf(" pos1: %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f\n"
937  ,posb[i]._fTargetPos[0][0], posb[i]._fTargetPos[0][1], posb[i]._fTargetPos[0][2], posb[i]._fTargetPos[0][3], posb[i]._fTargetPos[0][4], posb[i]._fTargetPos[0][5]);
938 
939  printf(" pos2: %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f\n"
940  ,posb[i]._fTargetPos[1][0], posb[i]._fTargetPos[1][1], posb[i]._fTargetPos[1][2], posb[i]._fTargetPos[1][3], posb[i]._fTargetPos[1][4], posb[i]._fTargetPos[1][5]);
941 
942  printf(" posb[%d]._iBlendType = %d\n",i,posb[i]._iBlendType);
943  printf(" posb[%d]._fBlendRad = %f\n",i,posb[i]._fBlendRad);
944  }
945  */
946 
947  std::array<float, 2> target_vel;
948  std::array<float, 2> target_acc;
949  std::copy(req.vel.cbegin(), req.vel.cend(), target_vel.begin());
950  std::copy(req.acc.cbegin(), req.acc.cend(), target_acc.begin());
951 
952  if(req.syncType == 0){
953  //ROS_INFO("DRHWInterface::moveb_cb() called and calling Drfl.MoveB");
954  res.success = Drfl.MoveB(posb, req.posCnt, target_vel.data(), target_acc.data(), req.time, (MOVE_MODE)req.mode, (MOVE_REFERENCE)req.ref);
955  }
956  else{
957  //ROS_INFO("DRHWInterface::moveb_cb() called and calling Drfl.MoveBAsync");
958  res.success = Drfl.MoveBAsync(posb, req.posCnt, target_vel.data(), target_acc.data(), req.time, (MOVE_MODE)req.mode, (MOVE_REFERENCE)req.ref);
959  }
960  }
961  bool DRHWInterface::movespiral_cb(dsr_msgs::MoveSpiral::Request& req, dsr_msgs::MoveSpiral::Response& res)
962  {
963  std::array<float, 2> target_vel;
964  std::array<float, 2> target_acc;
965  std::copy(req.vel.cbegin(), req.vel.cend(), target_vel.begin());
966  std::copy(req.acc.cbegin(), req.acc.cend(), target_acc.begin());
967 
968  if(req.syncType == 0){
969  //ROS_INFO("DRHWInterface::movespiral_cb() called and calling Drfl.MoveSpiral");
970  res.success = Drfl.MoveSpiral((TASK_AXIS)req.taskAxis, req.revolution, req.maxRadius, req.maxLength, target_vel.data(), target_acc.data(), req.time, (MOVE_REFERENCE)req.ref);
971  }
972  else{
973  //ROS_INFO("DRHWInterface::movespiral_cb() called and calling Drfl.MoveSpiralAsync");
974  res.success = Drfl.MoveSpiralAsync((TASK_AXIS)req.taskAxis, req.revolution, req.maxRadius, req.maxLength, target_vel.data(), target_acc.data(), req.time, (MOVE_REFERENCE)req.ref);
975  }
976  }
977  bool DRHWInterface::moveperiodic_cb(dsr_msgs::MovePeriodic::Request& req, dsr_msgs::MovePeriodic::Response& res)
978  {
979  std::array<float, NUM_TASK> target_amp;
980  std::array<float, NUM_TASK> target_periodic;
981  std::copy(req.amp.cbegin(), req.amp.cend(), target_amp.begin());
982  std::copy(req.periodic.cbegin(), req.periodic.cend(), target_periodic.begin());
983  if(req.syncType == 0){
984  //ROS_INFO("DRHWInterface::moveperiodic_cb() called and calling Drfl.MovePeriodic");
985  res.success = Drfl.MovePeriodic(target_amp.data(), target_periodic.data(), req.acc, req.repeat, (MOVE_REFERENCE)req.ref);
986  }
987  else{
988  //ROS_INFO("DRHWInterface::moveperiodic_cb() called and calling Drfl.MovePeriodicAsync");
989  res.success = Drfl.MovePeriodicAsync(target_amp.data(), target_periodic.data(), req.acc, req.repeat, (MOVE_REFERENCE)req.ref);
990  }
991  }
992 
993  bool DRHWInterface::movewait_cb(dsr_msgs::MoveWait::Request& req, dsr_msgs::MoveWait::Response& res)
994  {
995  //ROS_INFO("DRHWInterface::movewait_cb() called and calling Drfl.MoveWait");
996  res.success = Drfl.MoveWait();
997  }
998 
999  bool DRHWInterface::set_digital_output_cb(dsr_msgs::SetCtrlBoxDigitalOutput::Request& req, dsr_msgs::SetCtrlBoxDigitalOutput::Response& res)
1000  {
1001  //ROS_INFO("DRHWInterface::set_digital_output_cb() called and calling Drfl.SetCtrlBoxDigitalOutput");
1002  res.success = Drfl.SetCtrlBoxDigitalOutput((GPIO_CTRLBOX_DIGITAL_INDEX)req.index, req.value);
1003  }
1004  bool DRHWInterface::get_digital_input_cb(dsr_msgs::GetCtrlBoxDigitalInput::Request& req, dsr_msgs::GetCtrlBoxDigitalInput::Response& res)
1005  {
1006  //ROS_INFO("DRHWInterface::get_digital_input_cb() called and calling Drfl.GetCtrlBoxDigitalInput");
1007  res.value = Drfl.GetCtrlBoxDigitalInput((GPIO_CTRLBOX_DIGITAL_INDEX)req.index);
1008  }
1009  bool DRHWInterface::set_tool_digital_output_cb(dsr_msgs::SetToolDigitalOutput::Request& req, dsr_msgs::SetToolDigitalOutput::Response& res)
1010  {
1011  //ROS_INFO("DRHWInterface::set_tool_digital_output_cb() called and calling Drfl.SetToolDigitalOutput");
1012  res.success = Drfl.SetToolDigitalOutput((GPIO_TOOL_DIGITAL_INDEX)req.index, req.value);
1013  }
1014  bool DRHWInterface::get_tool_digital_input_cb(dsr_msgs::GetToolDigitalInput::Request& req, dsr_msgs::GetToolDigitalInput::Response& res)
1015  {
1016  //ROS_INFO("DRHWInterface::get_tool_digital_input_cb() called and calling Drfl.GetToolDigitalInput");
1017  res.value = Drfl.GetToolDigitalInput((GPIO_TOOL_DIGITAL_INDEX)req.index);
1018  }
1019  bool DRHWInterface::set_analog_output_cb(dsr_msgs::SetCtrlBoxAnalogOutput::Request& req, dsr_msgs::SetCtrlBoxAnalogOutput::Response& res)
1020  {
1021  //ROS_INFO("DRHWInterface::set_analog_output_cb() called and calling Drfl.SetCtrlBoxAnalogOutput");
1022  res.success = Drfl.SetCtrlBoxAnalogOutput((GPIO_CTRLBOX_ANALOG_INDEX)req.channel, req.value);
1023  }
1024  bool DRHWInterface::get_analog_input_cb(dsr_msgs::GetCtrlBoxAnalogInput::Request& req, dsr_msgs::GetCtrlBoxAnalogInput::Response& res)
1025  {
1026  //ROS_INFO("DRHWInterface::get_analog_input_cb() called and calling Drfl.GetCtrlBoxAnalogInput");
1027  res.value = Drfl.GetCtrlBoxAnalogInput((GPIO_CTRLBOX_ANALOG_INDEX)req.channel);
1028  }
1029  bool DRHWInterface::set_analog_output_type_cb(dsr_msgs::SetCtrlBoxAnalogOutputType::Request& req, dsr_msgs::SetCtrlBoxAnalogOutputType::Response& res)
1030  {
1031  //ROS_INFO("DRHWInterface::set_analog_output_type_cb() called and calling Drfl.SetCtrlBoxAnalogOutputType");
1032  res.success = Drfl.SetCtrlBoxAnalogOutputType((GPIO_CTRLBOX_ANALOG_INDEX)req.channel, (GPIO_ANALOG_TYPE)req.mode);
1033  }
1034  bool DRHWInterface::set_analog_input_type_cb(dsr_msgs::SetCtrlBoxAnalogInputType::Request& req, dsr_msgs::SetCtrlBoxAnalogInputType::Response& res)
1035  {
1036  //ROS_INFO("DRHWInterface::set_analog_input_type_cb() called and calling Drfl.SetCtrlBoxAnalogInputType");
1037  res.success = Drfl.SetCtrlBoxAnalogInputType((GPIO_CTRLBOX_ANALOG_INDEX)req.channel, (GPIO_ANALOG_TYPE)req.mode);
1038  }
1039  bool DRHWInterface::set_modbus_output_cb(dsr_msgs::SetModbusOutput::Request& req, dsr_msgs::SetModbusOutput::Response& res)
1040  {
1041  //ROS_INFO("DRHWInterface::set_modbus_output_cb() called and calling Drfl.SetModbusOutput");
1042  res.success = Drfl.SetModbusValue(req.name, (unsigned short)req.value);
1043  }
1044  bool DRHWInterface::get_modbus_input_cb(dsr_msgs::GetModbusInput::Request& req, dsr_msgs::GetModbusInput::Response& res)
1045  {
1046  //ROS_INFO("DRHWInterface::get_modbus_input_cb() called and calling Drfl.GetModbusInput");
1047  res.value = Drfl.GetModbusValue(req.name);
1048  }
1049  bool DRHWInterface::config_create_modbus_cb(dsr_msgs::ConfigCreateModbus::Request& req, dsr_msgs::ConfigCreateModbus::Response& res)
1050  {
1051  //ROS_INFO("DRHWInterface::config_create_modbus_cb() called and calling Drfl.ConfigCreateModbus");
1052  res.success = Drfl.ConfigCreateModbus(req.name, req.ip, (unsigned short)req.port, (MODBUS_REGISTER_TYPE)req.reg_type, (unsigned short)req.index, (unsigned short)req.value);
1053  }
1054  bool DRHWInterface::config_delete_modbus_cb(dsr_msgs::ConfigDeleteModbus::Request& req, dsr_msgs::ConfigDeleteModbus::Response& res)
1055  {
1056  //ROS_INFO("DRHWInterface::config_delete_modbus_cb() called and calling Drfl.ConfigDeleteModbus");
1057  res.success = Drfl.ConfigDeleteModbus(req.name);
1058  }
1059  bool DRHWInterface::drl_pause_cb(dsr_msgs::DrlPause::Request& req, dsr_msgs::DrlPause::Response& res)
1060  {
1061  //ROS_INFO("DRHWInterface::drl_pause_cb() called and calling Drfl.DrlPause");
1062  res.success = Drfl.PlayDrlPause();
1063  }
1064  bool DRHWInterface::drl_start_cb(dsr_msgs::DrlStart::Request& req, dsr_msgs::DrlStart::Response& res)
1065  {
1066  //ROS_INFO("DRHWInterface::drl_start_cb() called and calling Drfl.DrlStart");
1067  res.success = Drfl.PlayDrlStart((ROBOT_SYSTEM)req.robotSystem, req.code);
1068  }
1069  bool DRHWInterface::drl_stop_cb(dsr_msgs::DrlStop::Request& req, dsr_msgs::DrlStop::Response& res)
1070  {
1071  //ROS_INFO("DRHWInterface::drl_stop_cb() called and calling Drfl.DrlStop");
1072  res.success = Drfl.PlayDrlStop((STOP_TYPE)req.stop_mode);
1073  }
1074  bool DRHWInterface::drl_resume_cb(dsr_msgs::DrlResume::Request& req, dsr_msgs::DrlResume::Response& res)
1075  {
1076  //ROS_INFO("DRHWInterface::drl_resume_cb() called and calling Drfl.DrlResume");
1077  res.success = Drfl.PlayDrlResume();
1078  }
1079  bool DRHWInterface::get_drl_state_cb(dsr_msgs::GetDrlState::Request& req, dsr_msgs::GetDrlState::Response& res)
1080  {
1081  res.drl_state = Drfl.GetProgramState();
1082  }
1083  bool DRHWInterface::set_current_tcp_cb(dsr_msgs::SetCurrentTcp::Request& req, dsr_msgs::SetCurrentTcp::Response& res)
1084  {
1085  //ROS_INFO("DRHWInterface::set_current_tcp_cb() called and calling Drfl.SetCurrentTCP");
1086  res.success = Drfl.SetCurrentTCP(req.name);
1087  }
1088  bool DRHWInterface::get_current_tcp_cb(dsr_msgs::GetCurrentTcp::Request& req, dsr_msgs::GetCurrentTcp::Response& res)
1089  {
1090  //ROS_INFO("DRHWInterface::get_current_tcp_cb() called and calling Drfl.GetCurrentTCP");
1091  res.info = Drfl.GetCurrentTCP();
1092  }
1093  bool DRHWInterface::config_create_tcp_cb(dsr_msgs::ConfigCreateTcp::Request& req, dsr_msgs::ConfigCreateTcp::Response& res)
1094  {
1095  //ROS_INFO("DRHWInterface::config_create_tcp_cb() called and calling Drfl.ConfigCreateTCP");
1096  std::array<float, 6> target_pos;
1097  std::copy(req.pos.cbegin(), req.pos.cend(), target_pos.begin());
1098  res.success = Drfl.ConfigCreateTCP(req.name, target_pos.data());
1099  }
1100  bool DRHWInterface::config_delete_tcp_cb(dsr_msgs::ConfigDeleteTcp::Request& req, dsr_msgs::ConfigDeleteTcp::Response& res)
1101  {
1102  //ROS_INFO("DRHWInterface::config_delete_tcp_cb() called and calling Drfl.ConfigDeleteTCP");
1103  res.success = Drfl.ConfigDeleteTCP(req.name);
1104  }
1105  bool DRHWInterface::set_current_tool_cb(dsr_msgs::SetCurrentTool::Request& req, dsr_msgs::SetCurrentTool::Response& res)
1106  {
1107  //ROS_INFO("DRHWInterface::set_current_tool_cb() called and calling Drfl.SetCurrentTool");
1108  res.success = Drfl.SetCurrentTool(req.name);
1109  }
1110  bool DRHWInterface::get_current_tool_cb(dsr_msgs::GetCurrentTool::Request& req, dsr_msgs::GetCurrentTool::Response& res)
1111  {
1112  //ROS_INFO("DRHWInterface::get_current_tool_cb() called and calling Drfl.GetCurrentTool %s", Drfl.GetCurrentTool().c_str());
1113  res.info = Drfl.GetCurrentTool();
1114  }
1115  bool DRHWInterface::config_create_tool_cb(dsr_msgs::ConfigCreateTool::Request& req, dsr_msgs::ConfigCreateTool::Response& res)
1116  {
1117  //ROS_INFO("DRHWInterface::config_create_tool_cb() called and calling Drfl.ConfigCreateTool");
1118  std::array<float, 3> target_cog;
1119  std::array<float, 6> target_inertia;
1120  std::copy(req.cog.cbegin(), req.cog.cend(), target_cog.begin());
1121  std::copy(req.inertia.cbegin(), req.inertia.cend(), target_inertia.begin());
1122  res.success = Drfl.ConfigCreateTool(req.name, req.weight, target_cog.data(), target_inertia.data());
1123  }
1124  bool DRHWInterface::config_delete_tool_cb(dsr_msgs::ConfigDeleteTool::Request& req, dsr_msgs::ConfigDeleteTool::Response& res)
1125  {
1126  //ROS_INFO("DRHWInterface::config_delete_tool_cb() called and calling Drfl.ConfigDeleteTool");
1127  res.success = Drfl.ConfigDeleteTool(req.name);
1128  }
1129 
1130  //Gripper Service
1131 
1132  bool DRHWInterface::robotiq_2f_move_cb(dsr_msgs::Robotiq2FMove::Request& req, dsr_msgs::Robotiq2FMove::Response& res)
1133  {
1134  //ROS_INFO("DRHWInterface::gripper_move_cb() called and calling Nothing");
1135  /*
1136  if(mode == "robotiq_2f"){
1137  //Serial Communication
1138  ser.Activation();
1139  ros::Duration(0.1).sleep();
1140  ser.Close();
1141  ros::Duration(0.1).sleep();
1142  ser.Open();
1143  }
1144  */
1145  float goal_pos = req.width;
1146 
1147  while(abs(goal_pos - joints[6].pos) > 0.01){
1148  if(goal_pos > joints[6].pos){
1149  joints[6].pos = joints[6].pos + 0.01;
1150  }
1151  else if(joints[6].pos > goal_pos){
1152  joints[6].pos = joints[6].pos - 0.01;
1153  }
1154  ros::Duration(0.01).sleep();
1155  }
1156  res.success = true;
1157  }
1158  bool DRHWInterface::robotiq_2f_open_cb(dsr_msgs::Robotiq2FOpen::Request& req, dsr_msgs::Robotiq2FOpen::Response& res){
1159  float goal_pos = 0.8;
1160  while(abs(goal_pos - joints[6].pos) > 0.01){
1161  if(goal_pos > joints[6].pos){
1162  joints[6].pos = joints[6].pos + 0.01;
1163  }
1164  else if(joints[6].pos > goal_pos){
1165  joints[6].pos = joints[6].pos - 0.01;
1166  }
1167  ros::Duration(0.01).sleep();
1168  }
1169  res.success = true;
1170 
1171  }
1172  bool DRHWInterface::robotiq_2f_close_cb(dsr_msgs::Robotiq2FClose::Request& req, dsr_msgs::Robotiq2FClose::Response& res){
1173  float goal_pos = 0.0;
1174 
1175  while(abs(goal_pos - joints[6].pos) > 0.01){
1176  if(goal_pos > joints[6].pos){
1177  joints[6].pos = joints[6].pos + 0.01;
1178  }
1179  else if(joints[6].pos > goal_pos){
1180  joints[6].pos = joints[6].pos - 0.01;
1181  }
1182  ros::Duration(0.01).sleep();
1183  }
1184  res.success = true;
1185  }
1186 
1187  bool DRHWInterface::serial_send_data_cb(dsr_msgs::SerialSendData::Request& req, dsr_msgs::SerialSendData::Response &res){
1188  std_msgs::String send_data;
1189  send_data.data = req.data;
1190  m_PubSerialWrite.publish(send_data);
1191  res.success = true;
1192  }
1193 
1194 }
char strMsg2[MAX_STRING_SIZE]
bool set_analog_input_type_cb(dsr_msgs::SetCtrlBoxAnalogInputType::Request &req, dsr_msgs::SetCtrlBoxAnalogInputType::Response &res)
ros::ServiceServer m_nh_io_service[8]
hardware_interface::JointStateInterface jnt_state_interface
d
float fCurrentVelj[NUM_JOINT]
ros::ServiceServer m_nh_gripper_service[10]
bool movespiral_cb(dsr_msgs::MoveSpiral::Request &req, dsr_msgs::MoveSpiral::Response &res)
ros::ServiceServer m_nh_tcp_service[4]
bool drl_start_cb(dsr_msgs::DrlStart::Request &req, dsr_msgs::DrlStart::Response &res)
float fCurrentPosj[NUM_JOINT]
CDRFL Drfl
bool bHommingCompleted
bool g_bHasControlAuthority
ros::ServiceServer m_nh_move_service[10]
bool robotiq_2f_close_cb(dsr_msgs::Robotiq2FClose::Request &req, dsr_msgs::Robotiq2FClose::Response &res)
void publish(const boost::shared_ptr< M > &message) const
void trajectoryCallback(const control_msgs::FollowJointTrajectoryActionGoal::ConstPtr &msg)
bool bFlangeDigitalOutput[6]
bool robotiq_2f_move_cb(dsr_msgs::Robotiq2FMove::Request &req, dsr_msgs::Robotiq2FMove::Response &res)
bool movesx_cb(dsr_msgs::MoveSplineTask::Request &req, dsr_msgs::MoveSplineTask::Response &res)
float fCurrentVelx[NUM_TASK]
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
virtual void read(ros::Duration &elapsed_time)
string cmd
bool set_current_tcp_cb(dsr_msgs::SetCurrentTcp::Request &req, dsr_msgs::SetCurrentTcp::Response &res)
bool drl_pause_cb(dsr_msgs::DrlPause::Request &req, dsr_msgs::DrlPause::Response &res)
static void OnMonitoringStateCB(const ROBOT_STATE eState)
bool set_robot_mode_cb(dsr_msgs::SetRobotMode::Request &req, dsr_msgs::SetRobotMode::Response &res)
bool sleep() const
bool g_bTpInitailizingComplted
int nActualBT[NUM_BUTTON]
ros::ServiceServer m_nh_system[4]
ros::ServiceServer m_nh_serial_service[4]
bool get_current_tcp_cb(dsr_msgs::GetCurrentTcp::Request &req, dsr_msgs::GetCurrentTcp::Response &res)
int nActualBK[NUM_JOINT]
bool config_delete_modbus_cb(dsr_msgs::ConfigDeleteModbus::Request &req, dsr_msgs::ConfigDeleteModbus::Response &res)
bool set_analog_output_cb(dsr_msgs::SetCtrlBoxAnalogOutput::Request &req, dsr_msgs::SetCtrlBoxAnalogOutput::Response &res)
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
bool config_delete_tcp_cb(dsr_msgs::ConfigDeleteTcp::Request &req, dsr_msgs::ConfigDeleteTcp::Response &res)
float fJointErr[NUM_JOINT]
DR_ERROR g_stDrError
bool g_bHommingCompleted
static void thread_publisher(DRHWInterface *pDRHWInterface, ros::NodeHandle nh, int nPubRate)
static void OnTpInitializingCompletedCB()
float fActualETT[NUM_JOINT]
bool config_delete_tool_cb(dsr_msgs::ConfigDeleteTool::Request &req, dsr_msgs::ConfigDeleteTool::Response &res)
char strMsg1[MAX_STRING_SIZE]
float fRotationMatrix[3][3]
bool movesj_cb(dsr_msgs::MoveSplineJoint::Request &req, dsr_msgs::MoveSplineJoint::Response &res)
bool bMasteringNeed
#define STABLE_BAND_JNT
bool bFlangeDigitalInput[6]
std::vector< std::string > V_string
bool drl_resume_cb(dsr_msgs::DrlResume::Request &req, dsr_msgs::DrlResume::Response &res)
#define DSR_CTL_PUB_RATE
bool movewait_cb(dsr_msgs::MoveWait::Request &req, dsr_msgs::MoveWait::Response &res)
bool set_current_tool_cb(dsr_msgs::SetCurrentTool::Request &req, dsr_msgs::SetCurrentTool::Response &res)
bool movejx_cb(dsr_msgs::MoveJointx::Request &req, dsr_msgs::MoveJointx::Response &res)
bool set_analog_output_type_cb(dsr_msgs::SetCtrlBoxAnalogOutputType::Request &req, dsr_msgs::SetCtrlBoxAnalogOutputType::Response &res)
#define ROS_INFO(...)
ros::ServiceServer m_nh_modbus_service[4]
bool get_tool_digital_input_cb(dsr_msgs::GetToolDigitalInput::Request &req, dsr_msgs::GetToolDigitalInput::Response &res)
bool param(const std::string &param_name, T &param_val, const T &default_val) const
bool moveperiodic_cb(dsr_msgs::MovePeriodic::Request &req, dsr_msgs::MovePeriodic::Response &res)
bool config_create_modbus_cb(dsr_msgs::ConfigCreateModbus::Request &req, dsr_msgs::ConfigCreateModbus::Response &res)
bool moveb_cb(dsr_msgs::MoveBlending::Request &req, dsr_msgs::MoveBlending::Response &res)
ROSCPP_DECL bool ok()
bool get_digital_input_cb(dsr_msgs::GetCtrlBoxDigitalInput::Request &req, dsr_msgs::GetCtrlBoxDigitalInput::Response &res)
bool bCtrlBoxDigitalOutput[16]
bool get_drl_state_cb(dsr_msgs::GetDrlState::Request &req, dsr_msgs::GetDrlState::Response &res)
static void OnMonitoringModbusCB(const LPMONITORING_MODBUS pModbus)
bool bDisconnected
hardware_interface::PositionJointInterface jnt_pos_interface
int nModbusValue[100]
bool config_create_tcp_cb(dsr_msgs::ConfigCreateTcp::Request &req, dsr_msgs::ConfigCreateTcp::Response &res)
float fActualMT[NUM_JOINT]
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
float fTaskErr[NUM_TASK]
ros::Subscriber m_sub_joint_trajectory
bool set_tool_digital_output_cb(dsr_msgs::SetToolDigitalOutput::Request &req, dsr_msgs::SetToolDigitalOutput::Response &res)
bool bCtrlBoxDigitalInput[16]
virtual void spin(CallbackQueue *queue=0)
static void OnMonitoringAccessControlCB(const MONITORING_ACCESS_CONTROL eAccCtrl)
static void OnProgramStoppedCB(const PROGRAM_STOP_CAUSE iStopCause)
void MsgScriber(const dsr_msgs::RobotStop::ConstPtr &msg)
int IsInposition(double dCurPosDeg[], double dCmdPosDeg[])
void registerHandle(const JointStateHandle &handle)
static void OnMonitoringDataCB(const LPMONITORING_DATA pData)
#define rad2deg(rad)
float fTargetVelj[NUM_JOINT]
float fDynamicTor[NUM_JOINT]
bool sleep()
bool set_modbus_output_cb(dsr_msgs::SetModbusOutput::Request &req, dsr_msgs::SetModbusOutput::Response &res)
char strRobotState[MAX_SYMBOL_SIZE]
static void thread_subscribe(ros::NodeHandle nh)
Serial_comm ser_comm
float fTargetPosx[NUM_TASK]
const char * GetRobotStateString(int nState)
bool drl_stop_cb(dsr_msgs::DrlStop::Request &req, dsr_msgs::DrlStop::Response &res)
static void OnLogAlarm(LPLOG_ALARM pLogAlarm)
bool set_digital_output_cb(dsr_msgs::SetCtrlBoxDigitalOutput::Request &req, dsr_msgs::SetCtrlBoxDigitalOutput::Response &res)
bool get_analog_input_cb(dsr_msgs::GetCtrlBoxAnalogInput::Request &req, dsr_msgs::GetCtrlBoxAnalogInput::Response &res)
float fActualJTS[NUM_JOINT]
virtual void write(ros::Duration &elapsed_time)
bool getParam(const std::string &key, std::string &s) const
bool bTpInitialized
bool get_modbus_input_cb(dsr_msgs::GetModbusInput::Request &req, dsr_msgs::GetModbusInput::Response &res)
struct dsr_control::DRHWInterface::Joint joints[NUM_JOINT]
bool serial_send_data_cb(dsr_msgs::SerialSendData::Request &req, dsr_msgs::SerialSendData::Response &res)
float fTargetVelx[NUM_TASK]
bool get_robot_mode_cb(dsr_msgs::GetRobotMode::Request &req, dsr_msgs::GetRobotMode::Response &res)
string strModbusSymbol[100]
float fCurrentPosx[NUM_TASK]
float fTargetPosj[NUM_JOINT]
bool movec_cb(dsr_msgs::MoveCircle::Request &req, dsr_msgs::MoveCircle::Response &res)
ros::Subscriber m_sub_joint_position
bool movel_cb(dsr_msgs::MoveLine::Request &req, dsr_msgs::MoveLine::Response &res)
bool get_current_tool_cb(dsr_msgs::GetCurrentTool::Request &req, dsr_msgs::GetCurrentTool::Response &res)
static void OnHommingCompletedCB()
int MsgPublisher_RobotError(); 현재 미사용 : DRHWInterface::OnLogAlarm 에서 바로 퍼블리싱 함...
float fActualEJT[NUM_JOINT]
ros::ServiceServer m_nh_drl_service[10]
DR_STATE g_stDrState
ros::ServiceServer m_nh_tool_service[4]
float fActualMC[NUM_JOINT]
bool robotiq_2f_open_cb(dsr_msgs::Robotiq2FOpen::Request &req, dsr_msgs::Robotiq2FOpen::Response &res)
std::array< float, NUM_JOINT > cmd_
void positionCallback(const std_msgs::Float64MultiArray::ConstPtr &msg)
bool movej_cb(dsr_msgs::MoveJoint::Request &req, dsr_msgs::MoveJoint::Response &res)
bool config_create_tool_cb(dsr_msgs::ConfigCreateTool::Request &req, dsr_msgs::ConfigCreateTool::Response &res)
#define ROS_ERROR(...)
char strMsg3[MAX_STRING_SIZE]
DRHWInterface(ros::NodeHandle &nh)
#define deg2rad(deg)
static void OnMonitoringCtrlIOCB(const LPMONITORING_CTRLIO pCtrlIO)
float fJointAbs[NUM_JOINT]
double dSyncTime
#define ROS_DEBUG(...)


dsr_control
Author(s): Kab Kyoum Kim , Jin Hyuk Gong , Jeongwoo Lee
autogenerated on Sat May 18 2019 02:32:52