The descriptive text in the beginning of the Modbus Server article “if (val > 32768): val = val - 65535” is incorrect for modbus address between 270 to 275.
modbus address between 270 to 275 is UR joint position in mili radian. As max degree allow to turn would be ±360 or ±6.283 rad or ±6283 m rad.
So unsigned value between modbus address 270 to 275 would never more than 32768.
I try derive formula and observe that in the case of
joint pose in -ve,than it should
val=(val-6283)/1000 radian
however in the case of joint pose in +ve,then
val=(val/1000) radian
I would like to get exactly same value get_actual_joint_position()
if joint in +ve
base=modbus[260]/1000
shoulder=modbus[261]/1000
elbow=modbus[262]/1000
w1=modbus[263]/1000
w2=modbus[264]/1000
w3=modbus[265]/1000
if joint in -ve
base=(modbus[260]-6283)/1000
shoulder=(modbus[261]-6283)/1000
elbow=(modbus[262]-6283)/1000
w1=(modbus[263]-6283)/1000
w2=(modbus[264]-6283)/1000
w3=(modbus[265]-6283)/1000
p[base,shoulder,elbow,w1,w2,w3]
however in run time,doesnt know either the joint in +ve or -ve.please advice.
Hi Willie,
Modbus registers 320 - 325 contain revolution counters for each joint.
“Base joint revolution count (number of full turns, typically 0 or 1) - See more at: Modbus Server - 16377 | Universal Robots Support”
As you’ve observed there are no negative numbers represented, the angle is counted up from zero for each cycle. For -360 to 0 (negative angles) rev counter register will be high (65535), 0 to +360 rev counter register will be low (0).
This should give you all you need to make it work.
Indeed make my program work
thank
Hey Guys,
Has this changed since?
currently my registers 270-275 don’t seem to be counting down when the angle goes negative.
I think its reversed u should get a higher word value if its negative and vice versa