11 #include <boost/thread/thread.hpp> 18 #include <dsr_msgs/RobotState.h> 19 #include <dsr_msgs/RobotStop.h> 21 #include <dsr_msgs/MoveJoint.h> 22 #include <dsr_msgs/MoveLine.h> 23 #include <dsr_msgs/MoveJointx.h> 24 #include <dsr_msgs/MoveCircle.h> 25 #include <dsr_msgs/MoveSplineJoint.h> 26 #include <dsr_msgs/MoveSplineTask.h> 27 #include <dsr_msgs/MoveBlending.h> 28 #include <dsr_msgs/MoveSpiral.h> 29 #include <dsr_msgs/MovePeriodic.h> 30 #include <dsr_msgs/MoveWait.h> 33 #include "dsr_robot.h" 44 int movej(
float fTargetPos[NUM_JOINT],
float fTargetVel,
float fTargetAcc,
float fTargetTime = 0.f,
float fBlendingRadius = 0.f,
45 int nMoveMode = MOVE_MODE_ABSOLUTE,
int nBlendingType = BLENDING_SPEED_TYPE_DUPLICATE,
int nSyncType = 0)
51 dsr_msgs::MoveJoint srv;
53 for(
int i=0; i<NUM_JOINT; i++)
54 srv.request.pos[i] = fTargetPos[i];
55 srv.request.vel = fTargetVel;
56 srv.request.acc = fTargetAcc;
57 srv.request.time = fTargetTime;
58 srv.request.radius = fBlendingRadius;
59 srv.request.mode = nMoveMode;
60 srv.request.blendType = nBlendingType;
61 srv.request.syncType = nSyncType;
68 if(srvMoveJoint.call(srv))
71 return (srv.response.success);
75 ROS_ERROR(
"Failed to call service dr_control_service : move_joint\n");
80 int amovej(
float fTargetPos[NUM_JOINT],
float fTargetVel,
float fTargetAcc,
float fTargetTime = 0.f,
float fBlendingRadius = 0.f,
81 int nMoveMode = MOVE_MODE_ABSOLUTE,
int nBlendingType = BLENDING_SPEED_TYPE_DUPLICATE,
int nSyncType = 1)
83 return movej(fTargetPos, fTargetVel, fTargetAcc, fTargetTime, fBlendingRadius, nMoveMode, nBlendingType, 1);
87 int movel(
float fTargetPos[NUM_JOINT],
float fTargetVel[2],
float fTargetAcc[2],
float fTargetTime = 0.f,
float fBlendingRadius = 0.f,
88 int nMoveReference = MOVE_REFERENCE_BASE,
int nMoveMode = MOVE_MODE_ABSOLUTE,
int nBlendingType = BLENDING_SPEED_TYPE_DUPLICATE,
int nSyncType = 0)
92 dsr_msgs::MoveLine srv;
94 for(
int i=0; i<NUM_JOINT; i++)
95 srv.request.pos[i] = fTargetPos[i];
96 for(
int i=0; i<2; i++){
97 srv.request.vel[i] = fTargetVel[i];
98 srv.request.acc[i] = fTargetAcc[i];
100 srv.request.time = fTargetTime;
101 srv.request.radius = fBlendingRadius;
102 srv.request.ref = nMoveReference;
103 srv.request.mode = nMoveMode;
104 srv.request.blendType = nBlendingType;
105 srv.request.syncType = nSyncType;
107 ROS_INFO(
"service call: /dsr01m1013/motion/move_line");
108 ROS_INFO(
" <pos> %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f",srv.request.pos[0],srv.request.pos[1],srv.request.pos[2],srv.request.pos[3],srv.request.pos[4],srv.request.pos[5]);
109 ROS_INFO(
" <vel> %7.3f,%7.3f <acc> %7.3f,%7.3f <time> %7.3f",srv.request.vel[0],srv.request.vel[1],srv.request.acc[0],srv.request.acc[1], srv.request.time);
110 ROS_INFO(
" <mode> %d, <ref> %d, <radius> %7.3f, <blendType> %d",srv.request.mode,srv.request.ref, srv.request.radius, srv.request.blendType);
112 if(srvMoveLine.call(srv))
115 return (srv.response.success);
119 ROS_ERROR(
"Failed to call service dr_control_service : move_line\n");
124 int amovel(
float fTargetPos[NUM_JOINT],
float fTargetVel[2],
float fTargetAcc[2],
float fTargetTime = 0.f,
float fBlendingRadius = 0.f,
125 int nMoveReference = MOVE_REFERENCE_BASE,
int nMoveMode = MOVE_MODE_ABSOLUTE,
int nBlendingType = BLENDING_SPEED_TYPE_DUPLICATE,
int nSyncType = 1)
127 return movel(fTargetPos, fTargetVel, fTargetAcc, fTargetTime, fBlendingRadius, nMoveReference, nMoveMode, nBlendingType, 1);
131 int movejx(
float fTargetPos[NUM_TASK],
float fTargetVel,
float fTargetAcc,
float fTargetTime=0.f,
float fBlendingRadius = 0.f,
132 int nMoveReference = MOVE_REFERENCE_BASE,
int nMoveMode = MOVE_MODE_ABSOLUTE,
int nBlendingType = BLENDING_SPEED_TYPE_DUPLICATE,
int nSolSpace = 0,
int nSyncType = 0)
136 dsr_msgs::MoveJointx srv;
138 for(
int i=0; i<NUM_TASK; i++)
139 srv.request.pos[i] = fTargetPos[i];
140 srv.request.vel = fTargetVel;
141 srv.request.acc = fTargetAcc;
142 srv.request.time = fTargetTime;
143 srv.request.radius = fBlendingRadius;
144 srv.request.ref = nMoveReference;
145 srv.request.mode = nMoveMode;
146 srv.request.blendType = nBlendingType;
147 srv.request.sol = nSolSpace;
149 if(srvMoveJointx.call(srv))
152 return (srv.response.success);
156 ROS_ERROR(
"Failed to call service dr_control_service : move_jointx\n");
161 int amovejx(
float fTargetPos[NUM_TASK],
float fTargetVel,
float fTargetAcc,
float fTargetTime=0.f,
float fBlendingRadius = 0.f,
162 int nMoveReference = MOVE_REFERENCE_BASE,
int nMoveMode = MOVE_MODE_ABSOLUTE,
int nBlendingType = BLENDING_SPEED_TYPE_DUPLICATE,
int nSolSpace = 0,
int nSyncType = 1)
164 return movejx(fTargetPos, fTargetVel, fTargetAcc, fTargetTime, fBlendingRadius, nMoveReference, nMoveMode, nBlendingType, nSolSpace, 1);
168 int movec(
float fTargetPos[2][NUM_TASK],
float fTargetVel[2],
float fTargetAcc[2],
float fTargetTime = 0.f,
float fBlendingRadius = 0.f,
169 int nMoveReference = MOVE_REFERENCE_BASE,
int nMoveMode = MOVE_MODE_ABSOLUTE,
int nBlendingType = BLENDING_SPEED_TYPE_DUPLICATE,
int nSyncType = 0)
174 dsr_msgs::MoveCircle srv;
175 std::vector<std_msgs::Float64MultiArray> poses;
176 std_msgs::Float64MultiArray pos;
177 for(
int i=0; i<2; i++){
179 for(
int j = 0; j < NUM_TASK; j++){
180 pos.data.push_back(fTargetPos[i][j]);
182 poses.push_back(pos);
185 ROS_INFO(
" <xxx pos1> %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f",fTargetPos[0][0],fTargetPos[0][1],fTargetPos[0][2],fTargetPos[0][3],fTargetPos[0][4],fTargetPos[0][5]);
186 ROS_INFO(
" <xxx pos2> %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f",fTargetPos[1][0],fTargetPos[1][1],fTargetPos[1][2],fTargetPos[1][3],fTargetPos[1][4],fTargetPos[1][5]);
188 ROS_INFO(
" <pos1> %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f",poses[0].data[0],poses[0].data[1],poses[0].data[2],poses[0].data[3],poses[0].data[4],poses[0].data[5]);
189 ROS_INFO(
" <pos2> %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f",poses[1].data[0],poses[1].data[1],poses[1].data[2],poses[1].data[3],poses[1].data[4],poses[1].data[5]);
191 srv.request.pos = poses;
193 for(
int i=0; i<2; i++){
194 srv.request.vel[i] = fTargetVel[i];
195 srv.request.acc[i] = fTargetAcc[i];
197 srv.request.time = fTargetTime;
198 srv.request.radius = fBlendingRadius;
199 srv.request.ref = nMoveReference;
200 srv.request.mode = nMoveMode;
201 srv.request.blendType = nBlendingType;
202 srv.request.syncType = nSyncType;
204 ROS_INFO(
"service call: /dsr01m1013/motion/move_circle");
205 ROS_INFO(
" <pos1> %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f",srv.request.pos[0].data[0],srv.request.pos[0].data[1],srv.request.pos[0].data[2],srv.request.pos[0].data[3],srv.request.pos[0].data[4],srv.request.pos[0].data[5]);
206 ROS_INFO(
" <pos2> %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f",srv.request.pos[1].data[0],srv.request.pos[1].data[1],srv.request.pos[1].data[2],srv.request.pos[1].data[3],srv.request.pos[1].data[4],srv.request.pos[1].data[5]);
207 ROS_INFO(
" <vel> %7.3f,%7.3f <acc> %7.3f,%7.3f <time> %7.3f",srv.request.vel[0],srv.request.vel[1],srv.request.acc[0],srv.request.acc[1], srv.request.time);
208 ROS_INFO(
" <mode> %d, <ref> %d, <radius> %7.3f, <blendType> %d",srv.request.mode,srv.request.ref, srv.request.radius, srv.request.blendType);
210 if(srvMoveCircle.call(srv))
213 return (srv.response.success);
217 ROS_ERROR(
"Failed to call service dr_control_service : move_circle\n");
222 int amovec(
float fTargetPos[2][NUM_TASK],
float fTargetVel[2],
float fTargetAcc[2],
float fTargetTime = 0.f,
float fBlendingRadius = 0.f,
223 int nMoveReference = MOVE_REFERENCE_BASE,
int nMoveMode = MOVE_MODE_ABSOLUTE,
int nBlendingType = BLENDING_SPEED_TYPE_DUPLICATE,
int nSyncType = 1)
225 return movec(fTargetPos, fTargetVel, fTargetAcc, fTargetTime, fBlendingRadius, nMoveReference, nMoveMode, nBlendingType, 1);
229 int movesj(
float fTargetPos[MAX_SPLINE_POINT][NUM_JOINT],
int nPosCount,
float fTargetVel,
float fTargetAcc,
float fTargetTime = 0.f,
230 int nMoveMode = MOVE_MODE_ABSOLUTE,
int nSyncType = 0)
234 dsr_msgs::MoveSplineJoint srv;
235 std::vector<std_msgs::Float64MultiArray> poses;
236 std_msgs::Float64MultiArray pos;
238 for(
int i = 0; i < MAX_SPLINE_POINT; i++){
240 for(
int j = 0; j < NUM_JOINT; j++){
241 pos.data.push_back(fTargetPos[i][j]);
243 poses.push_back(pos);
245 srv.request.pos = poses;
246 srv.request.posCnt = nPosCount;
248 srv.request.vel = fTargetVel;
249 srv.request.acc = fTargetAcc;
250 srv.request.time = fTargetTime;
251 srv.request.mode = nMoveMode;
252 srv.request.syncType = nSyncType;
254 if(srvMoveSplineJoint.call(srv))
257 return (srv.response.success);
261 ROS_ERROR(
"Failed to call service dr_control_service : move_spline_joint\n");
266 int amovesj(
float fTargetPos[MAX_SPLINE_POINT][NUM_JOINT],
int nPosCount,
float fTargetVel,
float fTargetAcc,
float fTargetTime = 0.f,
267 int nMoveMode = MOVE_MODE_ABSOLUTE,
int nSyncType = 1)
269 return movesj(fTargetPos, nPosCount, fTargetVel, fTargetAcc, fTargetTime, nMoveMode, 1);
273 int movesx(
float fTargetPos[MAX_SPLINE_POINT][NUM_TASK],
int nPosCount,
float fTargetVel[2],
float fTargetAcc[2],
float fTargetTime = 0.f,
274 int nMoveReference = MOVE_REFERENCE_BASE,
int nMoveMode = MOVE_MODE_ABSOLUTE,
int nVelOpt = SPLINE_VELOCITY_OPTION_DEFAULT,
int nSyncType = 0)
278 dsr_msgs::MoveSplineTask srv;
279 std::vector<std_msgs::Float64MultiArray> poses;
280 std_msgs::Float64MultiArray pos;
282 for(
int i = 0; i < MAX_SPLINE_POINT; i++){
284 for(
int j = 0; j < NUM_TASK; j++){
285 pos.data.push_back(fTargetPos[i][j]);
287 poses.push_back(pos);
289 srv.request.pos = poses;
290 srv.request.posCnt = nPosCount;
292 for(
int i=0; i<2; i++){
293 srv.request.vel[i] = fTargetVel[i];
294 srv.request.acc[i] = fTargetAcc[i];
296 srv.request.time = fTargetTime;
297 srv.request.ref = nMoveReference;
298 srv.request.mode = nMoveMode;
299 srv.request.opt = nVelOpt;
300 srv.request.syncType = nSyncType;
302 if(srvMoveSplineTask.call(srv))
305 return (srv.response.success);
309 ROS_ERROR(
"Failed to call service dr_control_service : move_spline_task\n");
314 int amovesx(
float fTargetPos[MAX_SPLINE_POINT][NUM_TASK],
int nPosCount,
float fTargetVel[2],
float fTargetAcc[2],
float fTargetTime = 0.f,
315 int nMoveReference = MOVE_REFERENCE_BASE,
int nMoveMode = MOVE_MODE_ABSOLUTE,
int nVelOpt = SPLINE_VELOCITY_OPTION_DEFAULT,
int nSyncType = 1)
317 return movesx(fTargetPos, nPosCount, fTargetVel, fTargetAcc, fTargetTime, nMoveReference, nMoveMode, nVelOpt, 1);
321 int moveb(MOVE_POSB* fTargetPos,
int nPosCount,
float fTargetVel[2],
float fTargetAcc[2],
float fTargetTime = 0.f,
322 int nMoveReference = MOVE_REFERENCE_BASE,
int nMoveMode = MOVE_MODE_ABSOLUTE,
int nSyncType = 0)
326 dsr_msgs::MoveBlending srv;
328 std::vector<std_msgs::Float64MultiArray> segments;
329 std_msgs::Float64MultiArray segment;
331 for(
int i=0; i<nPosCount; i++){
332 segment.data.clear();
334 for(
int j=0; j<NUM_TASK; j++)
335 segment.data.push_back( fTargetPos[i]._fTargetPos[0][j]);
336 for(
int j=0; j<NUM_TASK; j++)
337 segment.data.push_back( fTargetPos[i]._fTargetPos[1][j]);
339 segment.data.push_back( fTargetPos[i]._iBlendType );
340 segment.data.push_back( fTargetPos[i]._fBlendRad );
342 segments.push_back(segment);
344 srv.request.segment = segments;
345 srv.request.posCnt = nPosCount;
347 for(
int i=0; i<2; i++){
348 srv.request.vel[i] = fTargetVel[i];
349 srv.request.acc[i] = fTargetAcc[i];
351 srv.request.time = fTargetTime;
352 srv.request.ref = nMoveReference;
353 srv.request.mode = nMoveMode;
354 srv.request.syncType = nSyncType;
356 if(srvMoveBlending.call(srv))
359 return (srv.response.success);
363 ROS_ERROR(
"Failed to call service dr_control_service : move_spline_blending\n");
370 int amoveb(MOVE_POSB* fTargetPos,
int nPosCount,
float fTargetVel[2],
float fTargetAcc[2],
float fTargetTime = 0.f,
371 int nMoveReference = MOVE_REFERENCE_BASE,
int nMoveMode = MOVE_MODE_ABSOLUTE,
int nSyncType = 1)
373 return moveb(fTargetPos, nPosCount, fTargetVel, fTargetAcc, fTargetTime, nMoveReference, nMoveMode, 1);
377 int move_spiral(
float fRevolution,
float fMaxRadius,
float fMaxLength,
float fTargetVel[2],
float fTargetAcc[2],
float fTargetTime = 0.f,
378 int nTaskAxis = TASK_AXIS_Z,
int nMoveReference = MOVE_REFERENCE_TOOL,
int nSyncType = 0)
382 dsr_msgs::MoveSpiral srv;
384 srv.request.revolution = fRevolution;
385 srv.request.maxRadius = fMaxRadius;
386 srv.request.maxLength = fMaxLength;
387 for(
int i=0; i<2; i++){
388 srv.request.vel[i] = fTargetVel[i];
389 srv.request.acc[i] = fTargetAcc[i];
391 srv.request.time = fTargetTime;
392 srv.request.taskAxis = nTaskAxis;
393 srv.request.ref = nMoveReference;
394 srv.request.syncType = nSyncType;
396 if(srvMoveSpiral.call(srv)){
398 return (srv.response.success);
401 ROS_ERROR(
"Failed to call service dr_control_service : move_spiral\n");
406 int amove_spiral(
float fRevolution,
float fMaxRadius,
float fMaxLength,
float fTargetVel[2],
float fTargetAcc[2],
float fTargetTime = 0.f,
407 int nTaskAxis = TASK_AXIS_Z,
int nMoveReference = MOVE_REFERENCE_TOOL,
int nSyncType = 1)
409 return move_spiral(fRevolution, fMaxRadius, fMaxLength, fTargetVel, fTargetAcc, fTargetTime, nTaskAxis, nMoveReference, 1);
413 int move_periodic(
float fAmplitude[NUM_TASK],
float fPeriodic[NUM_TASK],
float fAccelTime = 0.f,
int nRepeat = 1,
int nMoveReference = MOVE_REFERENCE_TOOL,
int nSyncType = 0)
417 dsr_msgs::MovePeriodic srv;
419 for(
int i=0; i<NUM_TASK; i++){
420 srv.request.amp[i] = fAmplitude[i];
421 srv.request.periodic[i] = fPeriodic[i];
423 srv.request.acc = fAccelTime;
424 srv.request.repeat = nRepeat;
425 srv.request.ref = nMoveReference;
426 srv.request.syncType = nSyncType;
428 if(srvMovePeriodic.call(srv))
431 return (srv.response.success);
435 ROS_ERROR(
"Failed to call service dr_control_service : move_periodic\n");
442 int amove_periodic(
float fAmplitude[NUM_TASK],
float fPeriodic[NUM_TASK],
float fAccelTime = 0.f,
int nRepeat = 1,
int nMoveReference = MOVE_REFERENCE_TOOL,
int nSyncType = 1)
444 return move_periodic(fAmplitude, fPeriodic, fAccelTime, nRepeat, nMoveReference, 1);
452 dsr_msgs::MoveWait srv;
454 if(srvMoveWait.call(srv))
457 return (srv.response.success);
461 ROS_ERROR(
"Failed to call service dr_control_service : move_wait\n");
471 static int sn_cnt =0;
474 if(0==(sn_cnt % 100))
476 ROS_INFO(
"________ ROBOT STATUS ________");
477 ROS_INFO(
" robot_state : %d", msg->robot_state);
478 ROS_INFO(
" robot_state_str : %s", msg->robot_state_str.c_str());
479 ROS_INFO(
" current_posj : %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f", msg->current_posj[0], msg->current_posj[1] ,msg->current_posj[2]
480 , msg->current_posj[3], msg->current_posj[4] ,msg->current_posj[5] );
481 ROS_INFO(
" current_velj : %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f" , msg->current_velj[0], msg->current_velj[1], msg->current_velj[2], msg->current_velj[3],msg->current_velj[4],msg->current_velj[5]);
482 ROS_INFO(
" joint_abs : %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f" , msg->joint_abs[0],msg->joint_abs[1],msg->joint_abs[2],msg->joint_abs[3],msg->joint_abs[4],msg->joint_abs[5]);
483 ROS_INFO(
" joint_err : %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f" , msg->joint_err[0],msg->joint_err[1],msg->joint_err[2],msg->joint_err[3],msg->joint_err[4],msg->joint_err[5]);
484 ROS_INFO(
" target_posj : %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f" , msg->target_posj[0],msg->target_posj[1],msg->target_posj[2],msg->target_posj[3],msg->target_posj[4],msg->target_posj[5]);
485 ROS_INFO(
" target_velj : %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f" , msg->target_velj[0],msg->target_velj[1],msg->target_velj[2],msg->target_velj[3],msg->target_velj[4],msg->target_velj[5]);
486 ROS_INFO(
" current_posx : %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f", msg->current_posx[0] ,msg->current_posx[1] ,msg->current_posx[2]
487 , msg->current_posx[3] ,msg->current_posx[4] ,msg->current_posx[5]);
488 ROS_INFO(
" current_velx : %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f" , msg->current_velx[0],msg->current_velx[1],msg->current_velx[2],msg->current_velx[3],msg->current_velx[4],msg->current_velx[5]);
489 ROS_INFO(
" task_err : %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f" , msg->task_err[0],msg->task_err[1],msg->task_err[2],msg->task_err[3],msg->task_err[4],msg->task_err[5]);
490 ROS_INFO(
" solution_space : %d" ,(msg->solution_space));
493 for(
int i = 0; i < 3; i++){
494 temp_data += (
"dim[" + std::to_string(i) +
"] [");
495 for(
int j = 0; j < 3; j++){
496 temp_data += (std::to_string(msg->rotation_matrix[i].data[j]) +
" ");
500 ROS_INFO(
" rotation_matrix : %s",
temp_data.c_str());
501 ROS_INFO(
" dynamic_tor : %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f" , msg->dynamic_tor[0],msg->dynamic_tor[1],msg->dynamic_tor[2],msg->dynamic_tor[3],msg->dynamic_tor[4],msg->dynamic_tor[5]);
502 ROS_INFO(
" actual_jts : %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f" , msg->actual_jts[0],msg->actual_jts[1],msg->actual_jts[2],msg->actual_jts[3],msg->actual_jts[4],msg->actual_jts[5]);
503 ROS_INFO(
" actual_ejt : %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f" , msg->actual_ejt[0],msg->actual_ejt[1],msg->actual_ejt[2],msg->actual_ejt[3],msg->actual_ejt[4],msg->actual_ejt[5]);
504 ROS_INFO(
" actual_ett : %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f" , msg->actual_ett[0],msg->actual_ett[1],msg->actual_ett[2],msg->actual_ett[3],msg->actual_ett[4],msg->actual_ett[5]);
505 ROS_INFO(
" sync_time : %7.3f" , msg->sync_time);
506 ROS_INFO(
" actual_bk : %d %d %d %d %d %d" , msg->actual_bk[0],msg->actual_bk[1],msg->actual_bk[2],msg->actual_bk[3],msg->actual_bk[4],msg->actual_bk[5]);
507 ROS_INFO(
" actual_bt : %d %d %d %d %d " , msg->actual_bt[0],msg->actual_bt[1],msg->actual_bt[2],msg->actual_bt[3],msg->actual_bt[4]);
508 ROS_INFO(
" actual_mc : %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f" , msg->actual_mc[0],msg->actual_mc[1],msg->actual_mc[2],msg->actual_mc[3],msg->actual_mc[4],msg->actual_mc[5]);
509 ROS_INFO(
" actual_mt : %7.3f %7.3f %7.3f %7.3f %7.3f %7.3f" , msg->actual_mt[0],msg->actual_mt[1],msg->actual_mt[2],msg->actual_mt[3],msg->actual_mt[4],msg->actual_mt[5]);
513 for(
int i = 0; i < 16; i++){
514 temp_data += (std::to_string(msg->ctrlbox_digital_input[i]) +
" ");
516 ROS_INFO(
" ctrlbox_digital_input : %s",
temp_data.c_str());
519 for(
int i = 0; i < 16; i++){
520 temp_data += (std::to_string(msg->ctrlbox_digital_output[i]) +
" ");
522 ROS_INFO(
" ctrlbox_digital_output : %s", temp_data.c_str());
525 for(
int i = 0; i < 6; i++){
526 temp_data += (std::to_string(msg->flange_digital_input[i]) +
" ");
528 ROS_INFO(
" flange_digital_input : %s", temp_data.c_str());
531 for(
int i = 0; i < 6; i++){
532 temp_data += (std::to_string(msg->flange_digital_output[i]) +
" ");
534 ROS_INFO(
" flange_digital_output : %s", temp_data.c_str());
537 for(
int i = 0; i < msg->modbus_state.size(); i++){
538 temp_data += (
"[" + msg->modbus_state[i].modbus_symbol +
" , " + std::to_string(msg->modbus_state[i].modbus_value) +
"] ");
540 ROS_INFO(
" modbus_state : %s", temp_data.c_str());
541 ROS_INFO(
" access_control : %d", msg->access_control);
542 ROS_INFO(
" homming_completed : %d", msg->homming_completed);
543 ROS_INFO(
" tp_initialized : %d", msg->tp_initialized);
544 ROS_INFO(
" mastering_need : %d", msg->mastering_need);
545 ROS_INFO(
" drl_stopped : %d", msg->drl_stopped);
546 ROS_INFO(
" disconnected : %d", msg->disconnected);
571 ROS_INFO(
"shutdown time! sig=%d",sig);
572 ROS_INFO(
"shutdown time! sig=%d",sig);
573 ROS_INFO(
"shutdown time! sig=%d",sig);
579 dsr_msgs::RobotStop msg;
581 msg.stop_mode = STOP_TYPE_QUICK;
582 pubRobotStop.publish(msg);
587 int main(
int argc,
char** argv)
590 string my_robot_id =
"dsr01";
591 string my_robot_model =
"m1013";
593 ROS_INFO(
"default arguments: dsr01 m1013");
597 ROS_ERROR(
"invalid arguments: <ns> <model> (ex) dsr01 m1013");
600 for (
int i = 1; i < argc; i++){
601 printf(
"argv[%d] = %s\n", i, argv[i]);
603 my_robot_id = argv[1];
604 my_robot_model = argv[2];
640 float p2[6]={0.0, 0.0, 90.0, 0.0, 90.0, 0.0};
642 float x1[6]={400, 500, 800.0, 0.0, 180.0, 0.0};
643 float x2[6]={400, 500, 500.0, 0.0, 180.0, 0.0};
644 float velx[2]={50, 50};
645 float accx[2]={100, 100};
647 float fCirclePos[2][6] = {{559,434.5,651.5,0,180,0}, {559,434.5,251.5,0,180,0}};
654 movel(x1, velx, accx);
655 movel(x2, velx, accx);
657 movec(fCirclePos, velx, accx);
666 ROS_INFO(
"dsr_basic_test_cpp finished !!!!!!!!!!!!!!!!!!!!!");
int movel(float fTargetPos[NUM_JOINT], float fTargetVel[2], float fTargetAcc[2], float fTargetTime=0.f, float fBlendingRadius=0.f, int nMoveReference=MOVE_REFERENCE_BASE, int nMoveMode=MOVE_MODE_ABSOLUTE, int nBlendingType=BLENDING_SPEED_TYPE_DUPLICATE, int nSyncType=0)
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
int amove_spiral(float fRevolution, float fMaxRadius, float fMaxLength, float fTargetVel[2], float fTargetAcc[2], float fTargetTime=0.f, int nTaskAxis=TASK_AXIS_Z, int nMoveReference=MOVE_REFERENCE_TOOL, int nSyncType=1)
int amovec(float fTargetPos[2][NUM_TASK], float fTargetVel[2], float fTargetAcc[2], float fTargetTime=0.f, float fBlendingRadius=0.f, int nMoveReference=MOVE_REFERENCE_BASE, int nMoveMode=MOVE_MODE_ABSOLUTE, int nBlendingType=BLENDING_SPEED_TYPE_DUPLICATE, int nSyncType=1)
int move_periodic(float fAmplitude[NUM_TASK], float fPeriodic[NUM_TASK], float fAccelTime=0.f, int nRepeat=1, int nMoveReference=MOVE_REFERENCE_TOOL, int nSyncType=0)
void msgRobotState_cb(const dsr_msgs::RobotState::ConstPtr &msg)
int amovesj(float fTargetPos[MAX_SPLINE_POINT][NUM_JOINT], int nPosCount, float fTargetVel, float fTargetAcc, float fTargetTime=0.f, int nMoveMode=MOVE_MODE_ABSOLUTE, int nSyncType=1)
int movec(float fTargetPos[2][NUM_TASK], float fTargetVel[2], float fTargetAcc[2], float fTargetTime=0.f, float fBlendingRadius=0.f, int nMoveReference=MOVE_REFERENCE_BASE, int nMoveMode=MOVE_MODE_ABSOLUTE, int nBlendingType=BLENDING_SPEED_TYPE_DUPLICATE, int nSyncType=0)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
int amovesx(float fTargetPos[MAX_SPLINE_POINT][NUM_TASK], int nPosCount, float fTargetVel[2], float fTargetAcc[2], float fTargetTime=0.f, int nMoveReference=MOVE_REFERENCE_BASE, int nMoveMode=MOVE_MODE_ABSOLUTE, int nVelOpt=SPLINE_VELOCITY_OPTION_DEFAULT, int nSyncType=1)
int movesj(float fTargetPos[MAX_SPLINE_POINT][NUM_JOINT], int nPosCount, float fTargetVel, float fTargetAcc, float fTargetTime=0.f, int nMoveMode=MOVE_MODE_ABSOLUTE, int nSyncType=0)
int amovejx(float fTargetPos[NUM_TASK], float fTargetVel, float fTargetAcc, float fTargetTime=0.f, float fBlendingRadius=0.f, int nMoveReference=MOVE_REFERENCE_BASE, int nMoveMode=MOVE_MODE_ABSOLUTE, int nBlendingType=BLENDING_SPEED_TYPE_DUPLICATE, int nSolSpace=0, int nSyncType=1)
int movej(float fTargetPos[NUM_JOINT], float fTargetVel, float fTargetAcc, float fTargetTime=0.f, float fBlendingRadius=0.f, int nMoveMode=MOVE_MODE_ABSOLUTE, int nBlendingType=BLENDING_SPEED_TYPE_DUPLICATE, int nSyncType=0)
int main(int argc, char **argv)
int amove_periodic(float fAmplitude[NUM_TASK], float fPeriodic[NUM_TASK], float fAccelTime=0.f, int nRepeat=1, int nMoveReference=MOVE_REFERENCE_TOOL, int nSyncType=1)
int amovej(float fTargetPos[NUM_JOINT], float fTargetVel, float fTargetAcc, float fTargetTime=0.f, float fBlendingRadius=0.f, int nMoveMode=MOVE_MODE_ABSOLUTE, int nBlendingType=BLENDING_SPEED_TYPE_DUPLICATE, int nSyncType=1)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
int amovel(float fTargetPos[NUM_JOINT], float fTargetVel[2], float fTargetAcc[2], float fTargetTime=0.f, float fBlendingRadius=0.f, int nMoveReference=MOVE_REFERENCE_BASE, int nMoveMode=MOVE_MODE_ABSOLUTE, int nBlendingType=BLENDING_SPEED_TYPE_DUPLICATE, int nSyncType=1)
virtual void spin(CallbackQueue *queue=0)
int amoveb(MOVE_POSB *fTargetPos, int nPosCount, float fTargetVel[2], float fTargetAcc[2], float fTargetTime=0.f, int nMoveReference=MOVE_REFERENCE_BASE, int nMoveMode=MOVE_MODE_ABSOLUTE, int nSyncType=1)
void SET_ROBOT(string id, string model)
int move_spiral(float fRevolution, float fMaxRadius, float fMaxLength, float fTargetVel[2], float fTargetAcc[2], float fTargetTime=0.f, int nTaskAxis=TASK_AXIS_Z, int nMoveReference=MOVE_REFERENCE_TOOL, int nSyncType=0)
ROSCPP_DECL void shutdown()
int moveb(MOVE_POSB *fTargetPos, int nPosCount, float fTargetVel[2], float fTargetAcc[2], float fTargetTime=0.f, int nMoveReference=MOVE_REFERENCE_BASE, int nMoveMode=MOVE_MODE_ABSOLUTE, int nSyncType=0)
int movejx(float fTargetPos[NUM_TASK], float fTargetVel, float fTargetAcc, float fTargetTime=0.f, float fBlendingRadius=0.f, int nMoveReference=MOVE_REFERENCE_BASE, int nMoveMode=MOVE_MODE_ABSOLUTE, int nBlendingType=BLENDING_SPEED_TYPE_DUPLICATE, int nSolSpace=0, int nSyncType=0)
int movesx(float fTargetPos[MAX_SPLINE_POINT][NUM_TASK], int nPosCount, float fTargetVel[2], float fTargetAcc[2], float fTargetTime=0.f, int nMoveReference=MOVE_REFERENCE_BASE, int nMoveMode=MOVE_MODE_ABSOLUTE, int nVelOpt=SPLINE_VELOCITY_OPTION_DEFAULT, int nSyncType=0)