Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Read speed from robot

#1
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


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)


Messages In This Thread
Read speed from robot - by泰迪- 05-12-2023, 08:17 AM
RE: Read speed from robot - byAlbert- 05-12-2023, 08:35 AM
RE: Read speed from robot - by泰迪- 05-16-2023, 08:21 AM



Users browsing this thread:
1 Guest(s)