Constructing and Jogging a Single Axis Positioner
Brief: in this example, we add a single rotational axis to an axis group and jog it in simulation
URScript API functions used in this example:
axis_group_add
axis_group_add_axis
axis_group_movej
reset_world_model
The example programs adds a new axis group called “positioner” where the “positioner” frame is placed 0.5m in the x direction of the robot frame. The program then adds an external axis called “axis1” which is placed 0.3m in the z axis of the “positioner” frame and rotated 90 degrees around the “positioner” frame x axis. The external axis is commanded to rotate 180 degrees and then return to its zero position.
NOTE: This example does not drive any EtherCAT hardware and the external axes move only in the world model.
Let’s go through some highlights of this example in greater detail:
Resetting the World Model
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
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 an Axis
This adds a new axis called “axis1” to the “positioner” axis group. 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 final three arguments of the axis_group_add_axis
set the type to rotational (0=rotational, 1=prismatic), set the max velocity to 3 rad/s, and set the max acceleration to 3 rad/s/s in order.
Jogging the Axis
This moves “axis1” to the 180 degree position and then back to its zero position. The axis_group_movej
call takes in the name of the axis group and the provided array is the target positions for the group’s axes. In this case, there is only one axis assigned to the “positioner” axis group, so the target position array is only size 1. The last two arguments specify the velocity and acceleration scale factors which determine the max velocity and acceleration to use as a percentage of the max allowable (specified with the call to axis_group_add_axis
). In this case, the velocity and acceleration factors are all 1 so it uses the max allowable of 3 rad/s and 3 rad/s/s.