Move servo as long as signal is true

Hey,

I have a robot connected to a real robot through OPC UA. The real robot uses signals to move it for example clockwise or counter_clockwise as long as the signal is true.

How can I do the same in VC?

You need to implement the motion yourself using a script since the servo and robot controller behaviors don’t support interrupting already started motion.

I think you could either assign joint values at certain interval or use servo controller behavior to move the joint for e.g. 100 ms at a time. The first option could achieve more accurate stopping point (less overshoot), while the second does proper interpolation instead of jumping from value to value.

1 Like

I did something like

...
for i in range(start_value, limit):
    j1.CurrentValue = i
    delay(1/speed) 
    if not move:
        break
...

Worked but didn’t look fluid. Guess I will have to use a formula or sth and tweak it a bit.

I also tried using the servo controller with the moveRelTo method but it also didn’t look fluid. One could see that it stopped. Maybe it’s because it accelerates and deccelerates every time? Or maybe I took too big of a value? It moved about 1° at a time.

How would I go on about only moving for 100 ms? Should I just take the right Value so that it only moves for 100ms? Is the moveImmediate method better here?

Hello, I have the same issue I’m trying to solve but can’t program in Python at all. Did you find the solution for moving the joints for e.g. 100ms at a time? I’m using the ServoController script generated from the Behaviours → ServoController menu - can I just modify this script somehow?