# Tool Velocity

• JT
• Topic Author
• Away
11 May 2024 11:31 #300384 by JT
Tool Velocity was created by JT
I'm trying to figure out how to display the actual tool velocity in at least the XY plane. For example if the tool is moving in the X direction at 10 IPM and in the Y direction at 20 IPM what is the formula to figure out the tool velocity?

JT

11 May 2024 11:58 #300385 by rodw
Replied by rodw on topic Tool Velocity
I think you need to read joint.N.pos-fb for X & Y and save the last position and calc the distance moved in fperiod
If both pins have a value, use pythagoras therom to calulate the velocity (C in this diagram)
en.wikipedia.org/wiki/Pythagorean_theorem
otherwise report the value for the moving axis.

Note if X& Y are both at max velocity, the actual velocity will be higher because the hypotenuse is longer than the x & Y elements
The following user(s) said Thank You: besriworld, JT

11 May 2024 15:21 #300393 by PCW
Replied by PCW on topic Tool Velocity
If you want the the tool velocity (X,Y,Z)  you can use motion.current-vel

If you want just X,Y as rodw says you can use Pythagoras
(see the hypot hal component)
The following user(s) said Thank You: besriworld, JT

• JT
• Topic Author
• Away
12 May 2024 12:15 #300435 by JT
Replied by JT on topic Tool Velocity

If you want the the tool velocity (X,Y,Z)  you can use motion.current-vel

If you want just X,Y as rodw says you can use Pythagoras
(see the hypot hal component)

I should have mentioned that this is using the Python Interface and motion.current-vel is not a status item.

The status velocity:
```[b]velocity[/b]
[i](returns float)[/i] - This property is defined, but it does not have a useful interpretation.```

The axis velocity only returns the jogging velocity for each axis
```[b]velocity[/b]
[i](returns float)[/i] - current velocity.```

The joint velocity works all the time
```[b]velocity[/b]
[i](returns float)[/i] - current velocity.```

What I came up with is to use the joint velocity and some math.
```    # two joint velocity
for key, value in parent.two_vel.items():
vel_0 = getattr(parent, 'status').joint[value[0]]['velocity']
vel_1 = getattr(parent, 'status').joint[value[1]]['velocity']
vel = sqrt((vel_0 * vel_0) + (vel_1 * vel_1))
getattr(parent, key).setText(f'{vel * 60:.{value[2]}f}')

# three joint velocity
for key, value in parent.three_vel.items():
vel_0 = getattr(parent, 'status').joint[value[0]]['velocity']
vel_1 = getattr(parent, 'status').joint[value[1]]['velocity']
vel_2 = getattr(parent, 'status').joint[value[2]]['velocity']
vel = sqrt((vel_0 * vel_0) + (vel_1 * vel_1) + (vel_2 * vel_2))
getattr(parent, key).setText(f'{vel * 60:.{value[3]}f}')```

Seems to work and mirror what Axis reports.

JT
The following user(s) said Thank You: rodw