Hi team,
The following is my python code:
import rtde_control
import rtde_receive
import time
rtde_c = rtde_control.RTDEControlInterface("number")
rtde_r = rtde_receive.RTDEReceiveInterface("number")
print("a")
result = rtde_c.sendCustomScriptFile("my.script")
'''
The code for my.script is
movej(get_inverse_kin(Waypoint_1_p, qnear=Waypoint_1_q), a=1.3962634015954636, v=1.0471975511965976)
movej(get_inverse_kin(Waypoint_2_p, qnear=Waypoint_2_q), a=1.3962634015954636, v=1.0471975511965976)
'''
print("b")
if result:
print("true")
print("c")
My arms do move to where I want, but the output only print "a"(it stuck at result = rtde_c.sendCustomScriptFile("my.script") this line).
I use another function which is sendCustomScript as follows:
import rtde_control
import rtde_receive
import time
rtde_c = rtde_control.RTDEControlInterface("number")
rtde_r = rtde_receive.RTDEReceiveInterface("number")
print("a")
inline_script ="""
def script_test():\n
global Waypoint_1_p=p[.563680615211, -.477776281521, .931261513423, -.216869564618, .618509619849, -2.027430390457]\n
global Waypoint_1_q=[-0.420081917439596, -1.3105357152274628, -1.815070629119873, -0.5506666463664551, 1.5176153182983398, 0.14520569145679474]\n
global Waypoint_2_p=p[.709160793559, -.224598873441, .900052191176, -.342416429180, .556536765580, -1.643688525955]\n
global Waypoint_2_q=[-0.02563649812807256, -1.3105324667743226, -1.8508906364440918, -0.55081661165271, 1.5176604986190796, 0.14514535665512085]\n
movej(get_inverse_kin(Waypoint_1_p, qnear=Waypoint_1_q), a=1.3962634015954636, v=1.0471975511965976)\n
movej(get_inverse_kin(Waypoint_2_p, qnear=Waypoint_2_q), a=1.3962634015954636, v=1.0471975511965976)\n
end\n
run program\n"""
result = rtde_c.sendCustomScript(inline_script)
print("b")
if result:
print("true")
print("c")
And I get the same as above.
My arms do move to where I want, but the output only print "a"(it stuck at result = rtde_c.sendCustomScriptFile("my.script") this line).
Hi team, The following is my python code: import rtde_control import rtde_receive import time rtde_c = rtde_control.RTDEControlInterface("number") rtde_r = rtde_receive.RTDEReceiveInterface("number") print("a") result = rtde_c.sendCustomScriptFile("my.script") ''' The code for my.script is movej(get_inverse_kin(Waypoint_1_p, qnear=Waypoint_1_q), a=1.3962634015954636, v=1.0471975511965976) movej(get_inverse_kin(Waypoint_2_p, qnear=Waypoint_2_q), a=1.3962634015954636, v=1.0471975511965976) ''' print("b") if result: print("true") print("c")
My arms do move to where I want, but the output only print "a"(it stuck at result = rtde_c.sendCustomScriptFile("my.script") this line).
I use another function which is sendCustomScript as follows: import rtde_control import rtde_receive import time rtde_c = rtde_control.RTDEControlInterface("number") rtde_r = rtde_receive.RTDEReceiveInterface("number") print("a") inline_script =""" def script_test():\n global Waypoint_1_p=p[.563680615211, -.477776281521, .931261513423, -.216869564618, .618509619849, -2.027430390457]\n global Waypoint_1_q=[-0.420081917439596, -1.3105357152274628, -1.815070629119873, -0.5506666463664551, 1.5176153182983398, 0.14520569145679474]\n global Waypoint_2_p=p[.709160793559, -.224598873441, .900052191176, -.342416429180, .556536765580, -1.643688525955]\n global Waypoint_2_q=[-0.02563649812807256, -1.3105324667743226, -1.8508906364440918, -0.55081661165271, 1.5176604986190796, 0.14514535665512085]\n movej(get_inverse_kin(Waypoint_1_p, qnear=Waypoint_1_q), a=1.3962634015954636, v=1.0471975511965976)\n movej(get_inverse_kin(Waypoint_2_p, qnear=Waypoint_2_q), a=1.3962634015954636, v=1.0471975511965976)\n end\n run program\n""" result = rtde_c.sendCustomScript(inline_script) print("b") if result: print("true") print("c")
And I get the same as above. My arms do move to where I want, but the output only print "a"(it stuck at result = rtde_c.sendCustomScriptFile("my.script") this line).