Hello everyone,
I am using the KUKA ready2educate cell with the following setup:
Controller: KRC4 compact - 8.3.36
Robot: KR3R540 C4SR
I want to write the command id of amotion primitive into a variable after the primitive ptp/lin/circ execution is finished. Does anyone know a way to implement this without losing the advance pointer?
Code
...
loop
if get_command(current_command) then
CURRENT_COMMAND_ID = current_command.id
switch current_command.type
case 1
check_error(do_grip(current_command.grip_data))
check_error(do_move(current_command.step, current_command.move_data, current_command.id))
;LAST_FINISHED_MOVE_ID = current_command.id
case 2
check_error(do_move(current_command.step, current_command.move_data, current_command.id))
;msgnotify("Motion primitive with command ID %1 done","Motion EKI",current_command.id)
;LAST_FINISHED_MOVE_ID = current_command.id
case 3
check_error(do_grip(current_command.grip_data))
endswitch
else
CURRENT_COMMAND_ID = 0
endif
endloop
close_interface()
end
deffct int do_move(step :in, move_data :in, cmd_id :in)
decl int step
decl move_type move_data
decl int cmd_id
decl int error_code
error_code = 0
...
switch (move_data.mode)
case 1
set_joint_vel(move_data.velocity)
set_joint_acc(move_data.acceleration)
set_blending(move_data.blending)
INTERRUPT ON 19 ; enable interrupt to stop movement
ptp move_data.joint c_ptp C_DIS
INTERRUPT OFF 19
LAST_FINISHED_MOVE_ID = cmd_id ; save id of last finished motion primitive
case 2
set_joint_vel(move_data.velocity)
set_joint_acc(move_data.acceleration)
set_blending(move_data.blending)
INTERRUPT ON 19
ptp move_data.cartesian c_ptp C_DIS
INTERRUPT OFF 19
LAST_FINISHED_MOVE_ID = cmd_id
case 3
set_cart_vel(move_data.velocity)
set_cart_acc(move_data.acceleration)
set_blending(move_data.blending)
INTERRUPT ON 19
lin move_data.cartesian C_DIS
INTERRUPT OFF 19
LAST_FINISHED_MOVE_ID = cmd_id
case 6
set_cart_vel(move_data.velocity)
set_cart_acc(move_data.acceleration)
set_blending(move_data.blending)
INTERRUPT ON 19
circ move_data.cartesian_aux, move_data.cartesian C_DIS
INTERRUPT OFF 19
LAST_FINISHED_MOVE_ID = cmd_id
endswitch
return error_code
endfct
Display More
I would appreciate any hints or suggestions on this.
Thanks in advance!