Coordinated Motion

This AeroScript program shows coordinated linear and circular motion that uses two axes.

// Coordinated Motion Example:
// Demonstrates task-based coordinated motion, which allows the axes in a move to follow a pre-defined
// geometric path. All axes in the move will start and stop at the same time.
// The speeds and accelerations that you specify are vectorial. The resulting axis speeds and accelerations
// make up the components of the vector.

program

	// Arrays of axes.
	var $axes[] as axis = [X, Y, Z]
	var $arcAxes[] as axis = [X, Y]

	// Enable and home the axes.
	Enable($axes)
	Home($axes)

	// Specify the coordinated ramp type, mode, and rate for this task.
	SetupCoordinatedRampType(RampType.Linear)
	SetupCoordinatedRampValue(RampMode.Rate, 1000.0)

	// Set the task target mode to incremental. All move distances will be specified
	// relative to the start position of the move.
	SetupTaskTargetMode(TargetMode.Incremental)

	// Move axes X, Y, Z along a linear shape (line) by the incremental distances specified
	// in the array. The coordinated speed can be set for every motion command, or set once.  If a speed
	// is not specified with the motion, the previously set value will be used. In this case, the
	// coordinated speed is 10.0 units/second.
	MoveLinear($axes, [10, 12.3, 7.44], 10.0)
	MoveLinear($axes, [-10, -12.3, -7.44])

	// The coordinated speed can also be set by itself.
	SetupCoordinatedSpeed(15.0)

	// Additional moves which will use the coordinated speed
	// that were previously set (15.0 units/second).
	MoveLinear($axes, [-10, -12.3, -7.44])
	MoveLinear($axes, [10, 12.3, 7.44])

	// The X and Y moves below are along an arc (circular) shape.

	// Move X and Y along a clockwise arc. Because this program is using incremental
	// target mode, the axes will move a distance of (10, 0). The center point of the
	// arc is always specified as relative from the start position of the move. In this case,
	// the center point is a distance of (5, 0) from the start position of the move.
	MoveCw($arcAxes, [10, 0], [5, 0])

	// Same basic clockwise move as above except the radius of the arc is specified
	// instead of the center point. In this case, the radius is specified as 5.
	MoveCw($arcAxes, [10, 0], 5)

	// 360 degree full circle (clockwise). The target position equals the start position, which
	// makes this move specification a full circle. The center point is a distance of (5, 0)
	// from the start position of the move.
	MoveCw($arcAxes, [0, 0], [5, 0])


	// Perform a counter-clockwise arc move by an incremental distance of (-10, 0)
	// with a center point a distance of (-5, 0) from the start position.
	MoveCcw($arcAxes, [-10, 0], [-5, 0])

	// Same basic move except specify a radius instead of a center point.
	MoveCcw($arcAxes, [-10, 0], 5)

	// 360 degree full circle (counter-clockwise). The center point is a distance
	// of (5, 0) from the start position of the move.
	MoveCcw($arcAxes, [0, 0], [5, 0])


	// Change the task target mode to absolute. All move distances will be specified
	// in absolute coordinates.
	SetupTaskTargetMode(TargetMode.Absolute)

	// Move X along a line to the position of 7.0.
	MoveLinear($axes[1], 7) //Move to absolute X position of 7

	// Perform two arc moves in different directions. The target positions are
	// to absolute positions (0, 10) and (0, 0). The center point of the
	// arc is always specified as relative from the start position of the move.
	MoveCw($arcAxes, [0, 10], [0, 1.50])
	MoveCcw($arcAxes, [0, 0], [0, -5])

	// Disable the axes.
	Disable($axes)

end