I have searched around and found out that the script generated by the function generateScript() is run immediately after pressing the play button on polyscope.
What I want to accomplish is run my script between two waypoint nodes inside a single movej.
Is it possible to delay the execution of urscript up to this point?
I have tried an infinite loop while a variable is 0, then turn the variable to 1 at the moment I want the script executed.
while callServoJFlag == 0:
#do nothing
end
def pathRecordMove(i):
global j=0
q1=p[0.4,0.4,0.0,0.0,3.14159,0.0]
q2=p[0.5,0.4,0.0,0.0,3.14159,0.0]
q3=p[0.6,0.4,0.0,0.0,3.14159,0.0]
q4=p[0.7,0.4,0.0,0.0,3.14159,0.0]
q5=p[0.8,0.4,0.0,0.0,3.14159,0.0]
q6=p[0.8,0.5,0.0,0.0,3.14159,0.0]
array=[q1,q2,q3,q4,q5,q6]
while j < i:
global joint_pos=get_inverse_kin(array[j])
servoj(joint_pos, 0, 0, 0.05, 0.1, 300)
global j =j+1
sync()
end
end
pathRecordMove(6)
result: as if callServoJFlag is never set to 0, pathRecordMove(6) gets called at the beginning of the program execution
I would greatly appreciate any help or advice. Thank you.