I need to use registers output by the robot and read by the Matlab client.
Firstly I need it to use for some internal working, to know the completion status of a given task.
and secondly, I need to know the robot’s status.
But when I am preparing one recipe, and then preparing another recipe(I know only 1 output recipe is possible), during the read message from the robot, it gives a different message size.
You’re going to have to be a lot more specific, can you post some of the URScript you are using? What do you mean by recipes?
This might be related to the issue I’m currently facing.
I printed out the message returned by RTDE and it says SafetySetup is not yet confirmed.
Hi Sam!
I want to prepare the output recipe using the RTDE_CONTROL_PACKAGE_SETUP_OUTPUTS
I want to prepare the output recipe for different registers and states of robots at different times.
For example, when I want to command the robot, I want to read a register value so using only read_input_integer_register(1).
But for another instance, I want to read the state of robot_mode or actual_TCP_force, then I want to override the same recipe(At the moment the CON only supports one output recipe).
But during the RTDE_CONTROL_PACKAGE_PAUSE, it is giving different message size.
I am attaching the UR script below:
This is a demo of RTDE server script.
global jSpeed = [0,0,0,0,0,0]
global pos = [0,0,0,0,0,0]
global vel = 0
global dT = 0
global blendRadius = 0
global accel = 0
global cmd=0
#global cmd1=0
#global cmd2=0
global keep_executing = True
global executing_cmd1 = False
global executing_cmd2 = False
#global l=0
def read_command():
return read_input_integer_register(1)
end
#def read_command1():
#return read_input_integer_register(1)
#end
#def read_command2():
#return read_input_integer_register(2)
#end
#def read_command3():
#return read_input_integer_register(2)
#end
thread speedThread():
enter_critical
write_output_integer_register(1, 0) # 0 indicates operation started
exit_critical
while True:
textmsg(“move_thread started”)
textmsg(get_actual_joint_positions())
speedj(jSpeed, a = accel,t = dT) # URScript movej command
break
end
enter_critical
write_output_integer_register(1, -1) # indicates operation finished
textmsg(“speed_thread finished”)
l=1
exit_critical
end
thread moveThread():
enter_critical
write_output_integer_register(1, 0) # 0 indicates operation started
exit_critical
while True:
textmsg(“move_thread started”)
textmsg(get_actual_joint_positions())
movej(pos, a = accel, v = vel, t = dT, r= blendRadius) # URScript movej command
break
end
enter_critical
write_output_integer_register(1, -1) # indicates operation finished
textmsg(“move_thread finished”)
exit_critical
end
def programCommand2():
textmsg(“program command started”)
if (cmd ==2):
# reading joints value
pos_temp = [0,0,0,0,0,0]
pos_temp[0] = read_input_float_register(0)
pos_temp[1] = read_input_float_register(1)
pos_temp[2] = read_input_float_register(2)
pos_temp[3] = read_input_float_register(3)
pos_temp[4] = read_input_float_register(4)
pos_temp[5] = read_input_float_register(5)
accel_temp = read_input_float_register(6) # reading acceleration value
dT_temp = read_input_float_register(7) # reading time value
enter_critical
jSpeed = pos_temp
dT = dT_temp
accel = accel_temp
exit_critical
textmsg(jSpeed)
speed_thrd = run speedThread()
join speed_thrd
end
return True
end
def programCommand1():
textmsg(“program command started”)
if (cmd == 1):
# reading joints value
pos_temp = [0,0,0,0,0,0]
pos_temp[0] = read_input_float_register(0)
pos_temp[1] = read_input_float_register(1)
pos_temp[2] = read_input_float_register(2)
pos_temp[3] = read_input_float_register(3)
pos_temp[4] = read_input_float_register(4)
pos_temp[5] = read_input_float_register(5)
accel_temp = read_input_float_register(6) # reading acceleration value
vel_temp = read_input_float_register(7) # reading velocity value
time_temp = read_input_float_register(8) # reading time value
blend_radius_temp = read_input_float_register(9) # reading blend radius value
enter_critical
pos = pos_temp
accel = accel_temp
vel = vel_temp
dT=time_temp
blendRadius=blend_radius_temp
exit_critical
textmsg(pos)
move_thrd = run moveThread()
join move_thrd
end
return True
end
while keep_executing:
cmd = read_command()
#cmd1 = read_command1()
#cmd2 = read_command2()
if (cmd == 0):
executing_cmd1 = False
executing_cmd2 = False
elif (cmd == 1):
if not executing_cmd1:
keep_executing = programCommand1()
end
executing_cmd1 = True
elif (cmd==2):
if (not executing_cmd2):
keep_executing = programCommand2()
end
executing_cmd2 = True
end
sync()
end