There is not a URScript function but you can create one. The joint currents in mA are being broadcast on the modbus server. You can use the read_port_register(port) function to read these registers so a simple function like this could be used. YOu can find out more about the data on the modbus server here
def get_joint_currents():
local port = 290
local joint = 0
local jointCurrents = [0,0,0,0,0,0]
while (joint < 6):
jointCurrents[joint] = read_port_register(port+joint)
joint = joint + 1
end
return jointCurrents
end
Then you can either access that directly or have a background thread placing that value into a global variable. I have tested the above by placing it into a thread and it works without issues
I have been using get_joint_torques() to test how much force is being applied during bottle cap tightening on wrist3 but found it is inconsistent, and thought I could try testing amps instead, or maybe even test joint speed and catch the speed slowing down to indicate cap is tight. I dont want to invest in external torque sensor. If this cant be done I will probably look at mechanical clutch.