05-12-2023, 08:17 AM
(This post was last modified: 05-12-2023, 08:31 AM byAlbert.Edit Reason: code formatting
)
Hello!
My Setup: KRC4 controller, and Kuka KR16-2 robot.
I'm trying to read the speed (prog.speed_mms) from my robot, as I would like to change the speed from the TCP (Tool Center Point) when it is at the maximum speed, but keep the velocities when it's below 100 mm/s. Can anyone help me with this?
In my code, I'm attempting to modify the jointSpeeds when TCP Speed is above 100mm/s. Here's what I have so far:
Thank you in advance!
Stefan
My Setup: KRC4 controller, and Kuka KR16-2 robot.
I'm trying to read the speed (prog.speed_mms) from my robot, as I would like to change the speed from the TCP (Tool Center Point) when it is at the maximum speed, but keep the velocities when it's below 100 mm/s. Can anyone help me with this?
In my code, I'm attempting to modify the jointSpeeds when TCP Speed is above 100mm/s. Here's what I have so far:
Thank you in advance!
Stefan
Code:
# Example to iteratively look for the speed instruction (INS_SPEED) and update it to 75 mm/s.
from robolink import *
RDK=Robolink()
prog = RDK.ItemUserPick('Machining2', ITEM_TYPE_PROGRAM) #Open the right program by name
# Iterate over all instructions in the program
for i in range(prog.InstructionCount()):
ins_name, ins_type, *_ = prog.Instruction(i)
# Check if it is a "set speed" instruction
if ins_type == INS_TYPE_CHANGESPEED:
print("Updating instruction %i" % i)
if prog.speed_mms >= 100
# Delete the instruction
prog.InstructionDelete(i)
# Select the previous instruction (any new instructions will be added afterwards)
prog.InstructionSelect(max(0,i-1))
# Add the new speed instruction
prog.setSpeed(*,100)