#!/usr/bin/python3

import math
import hal

h = hal.component("")

velXYZ = hal.get_value("XYZvel")
Z = hal.get_value("halui.axis.z.pos-relative")
Y = hal.get_value("halui.axis.y.pos-relative")
O = hal.get_value("joint.3.vel-cmd")
OB = 2*math.pi*math.sqrt(Z*Z+Y*Y)
SO = abs(OB*O/360)
VEL1 = (SO+velXYZ)
VEL = (SO+velXYZ)*60
print ("velXYZ",round(velXYZ,3))
print ("Z", round(Z,3))
print ("Y", round(Y,3))
print ("axisAvel", round(O,3))
print ("circuit",round(OB,3))
#print ("vline", SO)
print ("feedrate mm/sec", round(VEL1,3))
print ("feedrate mm/min", round(VEL,3))
#hal.set_s("new_vel", str(VEL))    #to qt_vismach

