Simple relative move

Hi All,

New to Visual Components on a two week trial and ran into a brick wall trying to define a relative move.

I have a subroutine which I want to:

–>>move down (-z) 20 mm relative to current position

–>>set an output to true

–>>move up (+z) 20 mm relative to current position

Unfortunately, every way i’ve tried, the point seems to be fixed in space, and is not relative to where the subroutine was called from.

Any help would be very much appreciated.

 

You mean whenever the subroutine is called you want to use the current position of robot at the time of the call and then apply the move down and move up logic?

Or do you just want 3 motion statements and a Set Binary Output statement…

The first option. I would like to use the current position of the robot at the time the subroutine is called, and move up a set distance (20 mm) from there.

The simulation calls the subroutine ~50 times in 50 different locations, so writing it out by hand is very tedious.

There are many approaches to this.

For example, you could use the moveAway() method in vcHelpers.Robot2 to handle the robot movements.


from vcScript import *
from vcHelpers.Robot2 import *

‘’’
tested with Generic Articulated Robot v4
‘’’

robot = getRobot()

def OnRun():
robot.Joints[4].CurrentValue = 90
delay(2)
robot.moveAway(-200)
delay(2)
robot.moveAway(400)


You could also create a Process statement that when executed does the movements and set bin action.