Skip to content

URScript

The program commands provided by the URCap esaDrive (see chapter Program Commands) can also be used directly as URScript statements. This is useful when you want to implement logic in URScript or parameterize commands dynamically.


The following sections describe the individual URScript statements.

esaDrive_moveAbsolute

Moves the specified drive to an absolute target position.

Signature

esaDrive_moveAbsolute(<driveName>, <pos_vel_acc_dec>, <seq>, <modDir>)

Parameters

Name Type Description
driveName string Name of the drive that should execute the command.
pos number Target position. Linear axes: unit m, rotary axes: unit degrees.
vel number Velocity. Linear axes: m/s, rotary axes: deg/s.
acc number Acceleration. Linear axes: m/s², rotary axes: deg/s².
dec number Deceleration. Linear axes: m/s², rotary axes: deg/s².
seq int[1] Execution behavior (array with exactly one element): [0] = wait until target is reached, [1] = continue simultaneously.
modDir int[1] Modular direction (array with exactly one element, only effective if modular mode is enabled): [0] = shortest path, [1] = positive direction, [2] = negative direction.

Note: In the URScript statement, pos, vel, acc and dec are combined into the array pos_vel_acc_dec = [pos, vel, acc, dec].

Examples

Linear axis:

Moves the linear drive "myDrive" to 350 mm at 100 mm/s, with an acceleration of 400 mm/s² and a deceleration of 200 mm/s². The program waits until the position is reached.

# 350 mm = 0.35 m, 100 mm/s = 0.10 m/s, 400 mm/s^2 = 0.40 m/s^2, 200 mm/s^2 = 0.20 m/s^2
esaDrive_moveAbsolute("myDrive", [0.35, 0.10, 0.40, 0.20], [0], [0])

Rotary axis:

Moves a rotary axis to 90° at 30°/s, with an acceleration of 100°/s² and a deceleration of 100°/s². The program continues simultaneously.

esaDrive_moveAbsolute("myDrive", [90.0, 30.0, 100.0, 100.0], [1], [0])

esaDrive_getPosition

Reads the actual position of the drive and returns the value.

Signature

position = esaDrive_getPosition(<driveName>)

Parameters

Name Type Description
driveName string Name of the drive whose actual position should be read.

Example

position = esaDrive_getPosition("myDrive")

Notes

  • Return unit according to axis type: linear axes m, rotary axes degrees.

esaDrive_homing

Executes a homing procedure for the specified drive.

Signature

esaDrive_homing(<driveName>, <conditions>, <askUser>)

Parameters

Name Type Description
driveName string Name of the drive to be homed.
conditions int Homing logic: 0 = always re-home, 1 = only if necessary (e.g., if the drive is not yet homed).
askUser int Interaction behavior: 0 = execute without asking, 1 = ask the user before starting homing.

Examples

Always re-home, without asking

esaDrive_homing("myDrive", 0, 0)

Only if necessary, with user confirmation

esaDrive_homing("myDrive", 1, 1)