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.