Speed change in a press machine cycle

Hello;
I would like to know if it is possible to manage the speed over a distance because I have noticed that on the machines existing in the Visual Components library, they only have cycle times and speeds already defined, in my case I have a press and I have envied that the beginning of the cycle is with a high speed and arriving at some points the speed changes (decreases) and in this point, I would like to put a sensor to detect the arrival of the moving part of the machine. If you have any ideas please help me.

Best regards
-Ness

If you want to change the joint speed during motion you need to use a trick with suspendRun() and resumeRun() commands.

Simple example below:

from vcScript import *

def OnSignal( signal ):

#Lower the speed when signal is True

if signal.Value:

suspendRun()

servo.Joints[0].MaxSpeed = 100

resumeRun()

else:

suspendRun()

servo.Joints[0].MaxSpeed = 1000

resumeRun()

def OnRun():

servo.Joints[0].MaxSpeed = 1000

goal_pos = 5000.0

#Command the servo to move to goal position

while True:

condition(lambda: servo.Joints[0].Dof.VALUE != goal_pos)

servo.move(goal_pos)

comp = getComponent()

servo = comp.findBehaviour(‘Servo Controller’)

2 Likes

@Este thank you for your answer I will try it

Best regards

-Ness