The attached Python script (also shown below) is my minimum example. It moves the position of the first moveL instruction. It seems to be moving the position because the robot path shows it, but the green polyline does not reflect the changed position. The two attached images help to explain.
What step am I missing that will update the polyline on the screen?
Related question, the code adjusts the "target pose" but does not adjust the joints. My hope is that the program would deal with the joints. If that is a wrong assumption, then what is the recommended way to accomplish this? In practice, the movements would not be this large but I wanted something that was easy to see on the screen.
Thanks for your help.
What step am I missing that will update the polyline on the screen?
Related question, the code adjusts the "target pose" but does not adjust the joints. My hope is that the program would deal with the joints. If that is a wrong assumption, then what is the recommended way to accomplish this? In practice, the movements would not be this large but I wanted something that was easy to see on the screen.
Thanks for your help.
Code:
from robodk import robolink
from robodk import robomath
RDK = robolink.Robolink()
currentProg = RDK.ItemList(8)[0]
# Look at the instruction at index 6 - the first linear move in my case
n = 6
currentInst = currentProg.Instruction(n)
instName = currentInst[0]
instType = currentInst[1]
moveType = currentInst[2]
isJoint = currentInst[3]
targetPose = currentInst[4]
joints = currentInst[5]
print(f'Index = {n} Name={instName} Type={instType} moveType={moveType}')
# Get the current target position
position = targetPose.Pos()
x = position[0]
y = position[1]
z = position[2]
print(f'Original -> {x:.6f} {y:.6f} {z:.6f}')
# Change the position and update the target Mat
newX = x + 150
newY = y + 0
newZ = z + 200
print(f'Updated -> {x:.6f} {y:.6f} {z:.6f}')
targetPose = targetPose.setPos([newX, newY, newZ])
# Update the instruction
currentProg.setInstruction(n, instName, instType, moveType, isJoint, targetPose, joints)
# Just for kicks, print the new position to see if it stuck
currentInst = currentProg.Instruction(n)
targetPose = currentInst[4]
position = targetPose.Pos()
x = position[0]
y = position[1]
z = position[2]
print(f'Checked -> {x:.6f} {y:.6f} {z:.6f}')
# Try to update the display
result = currentProg.Update(1, 1000, -1, -1)
validCount = result[0]
progTime = result[1]
progDist = result[2]
validRatio = result[3]
message = result[4]
print(f'Valid lines = {validCount} Time={progTime:.1f} Distance={progDist:.1f} Ratio={validRatio:.3f}')
print(message)