Constructing the Kinematics of a Two Axis Positioner

Brief: in this example, we add two rotational axes to an axis group and jog them in simulation

URScript API functions used in this example:

  • axis_group_add

  • axis_group_add_axis

  • axis_group_movej

  • reset_world_model

The example program adds a new axis group called “positioner” and then adds two axes called “axis1” and “axis2”. The “axis1” axis is attached to “positioner” and “axis2” is attached to “axis1”. The axes are then commanded to both simultaneously rotate 180 degrees and then return to their zero positions.

NOTE: This example does not drive any EtherCAT hardware and the external axes move only in the world model.

img

Let’s go through some highlights of this example in greater detail:

Resetting the World Model

img

This removes all axis groups and axes that have been added to the controller’s world. At the end of the program, the axis and groups that have been added remain in the controller’s world model for subsequent programs. Calling reset_world_model() at the start of a program ensures there is a clean slate if that’s desired. More info: reset_world_model

Adding a New Axis Group

img

This creates a new axis group called “positioner” and places it 0.5m in the x direction of the robot’s base coordinate frame. More info: axis_group_add

Adding New Axes

img

This adds two new axes to the “positioner” axis group. The first one is “axis1” and is attached to the “positioner” coordinate frame. It’s placed 0.3m in the z direction in the “positioner” frame and rotated by 90 degrees around the “positioner” frame’s x axis. The second axis is called “axis2” and is attached to “axis1”. It’s placed 0.3m in z direction of the the “axis1” frame and rotated 90 degrees around the “axis1” y axis. The last three arguments of axis_group_add_axis set both axis types to be rotational (0=rotary, 1=linear), set the max velocities to be 3 rad/s and the max accelerations to be 3 rad/s/s. Neither axes are configured with position limits, so they can rotate indefinitely. No index was provided for either axis, so the default behavior is for axis_group_add_axis() to use the next available index. In this case, “axis1” is index 0 and “axis2” is index 1. More info: axis_group_add_axis

Jog the Axes

img

This causes the axes to each rotate to their 180 degree position and then return back to their 0 positions. The mapping of the axes in the target position array is done in increasing index order, where “axis1” has index 0 and “axis2” has index 1 so that “axis1” is the first value and “axis2” is the second value in the target position array. More info: axis_group_movej


Jogging Two Axis Groups Using Threads

Brief: in this example, we add two axes, each one in its own independent axis group, and jog them simultaneously using URScript threads in simulation.

URScript API functions used in this example:

  • axis_group_add

  • axis_group_add_axis

  • axis_group_movej

  • reset_world_model

  • axis_group_speedj

The example program adds two new axis groups named “positioner1” and “positioner2”. The “axis1” external axis is added to the “positioner1” group, while “axis2” is added to the “positioner2” group. The axes are then jogged independently of each other.

NOTE: This example does not drive any EtherCAT hardware and the external axes move only in the world model.

img

Let’s go through some highlights of this example in greater detail:

Resetting the World Model

img

This removes all axis groups and axes that have been added to the controller’s world. At the end of the program, the axis and groups that have been added remain in the controller’s world model for subsequent programs. Calling reset_world_model() at the start of a program ensures there is a clean slate if that’s desired. More info: reset_world_model

Adding Two Axis Groups

  • img

    • This adds two axis groups named “positioner1” and “positioner2”. The axis group “positioner1” is placed 0.4m in the x direction and -0.2m in the y direction of the robot’s base frame.

    • The axis group “positioner2” is placed 0.4m in the x direction and 0.2m in the y direction of the robot’s base frame. More info: axis_group_add

Adding Two Axes

  • img

    • This adds an axis to each axis group. The “axis1” axis is configured to be rotational and is placed 0.3m in the z direction of the “positioner1” frame and rotated 90deg around the y axis of the “positioner1” frame. The “axis2” axis is configured to be linear and is placed 0.3m in the z direction of the “positioner2” frame and rotated 90deg around the y axis of the “positioner2” frame. The direction of motion for both axes is always in their z directions by construction. More info: axis_group_add_axis

Starting the Threads

  • img

    • This creates and starts two threads for moving both axes in parallel. The function moveAxis1() drives the first axis and moveAxis2() drives the second axis. Their implementations are described below in more detail. The call to “join” blocks the program from moving forward until each thread completes and returns. See the URScript manual for more info on URScript threads.

Moving Axis 1

  • img

    • This first rotates “axis1” with a velocity of 2rad/s using axis_group_speedj. The acceleration factor is 1 so it accelerates at the maximum rate set in the call to axis_group_add_axis(). It runs for a duration of 3 seconds, which is the last argument. The axis then rotates back to the 0 position using axis_group_movej. The acceleration and velocity factors are both 1 so it uses the maximum values set in the call to axis_group_add_axis(). More info: axis_group_movej, and axis_group_speedj

Moving Axis 2

img

This translates “axis2” with a velocity of .1m/s using axis_group_speedj. The acceleration factor is .1 so it accelerates at 10% of the maximum rate set in the call to axis_group_add_axis(). It runs for a duration of 3 seconds, which is the last argument. The axis then translates back to the 0 position using ``axis_group_movej. The acceleration factor is .1 and velocity factor is 1 it uses 10% of the maximum acceleration and 100% of the maximum velocity set in the call to axis_group_add_axis(). More info: axis_group_movej, and axis_group_speedj