Motion Restriction Functions

The motion restriction feature is a protective mechanism that you can use to prevent motion on axes that you specify. You can restrict motion commands, home commands, enable commands, disable commands, and abort commands. For example, you can use the motion restriction feature to prevent motion on axes that are under the control of a critical task or C Transformation. When you apply motion restrictions to an axis, a task error will occur if you try to move the axis or configure it to be part of a motion feature that causes it to move.

Motion restrictions prevent motion on the axes that you specify from all tasks on the controller, the buttons of Automation1 Studio, and the .NET, C, and Python APIs. Aerotech recommends that you enable motion restrictions from a background task that is always running to monitor status and to handle errors, faults, and safety conditions.

Limitations of Motion Restrictions

WARNING: Do not use motion restrictions to prevent an axis from being moved, homed, enabled, disabled, or aborted in safety-critical conditions. These restrictions usually cause an error if a person tries to move, home, enable, disable, or abort an axis. But the controller might not stop all motion each time, which can cause injury to personnel and damage to equipment. If you must prevent axis motion in safety-critical conditions, use the Emergency Stop (ESTOP) input or the Safe Torque Off (STO) input based on your drive type. For ESTOP, see the EmergencyStopFaultInput Parameter. For STO, refer to the hardware manual for your drive.

Tip: To download your drive hardware manual from www.aerotech.com, go to the Automation1 section of Manuals & Help Files.

In some conditions, the controller might let you use features that you restricted on an axis. Refer to the examples that follow:

  • The controller might abort motion on an axis when all of these conditions occur: The axis is specified in a mask of axes for the TaskStopAbortAxes or TaskErrorAbortAxes parameter for a task. Then the related task stops or a task error occurs.
  • The controller might abort motion on when all of these conditions occur: The axis does synchronous motion with other axes that are not restricted, and you abort motion on one or more of those axes.
  • The controller might abort motion on an axis when all of these conditions occur: The axis does synchronous motion on a task. Then the task stops or a task error occurs.
  • The controller might disable an axis if the controller generates a task fault that is specified in the FaultMaskDisable Parameter for that axis.

For safety, the controller might automatically disable, move, or abort motion on an axis. To make sure that axis motion is safely and fully restricted, it might be necessary for you to use a combination of motion restrictions and controller features. Refer to the list of applicable controller features that you can use:

Enable Motion Restrictions

You can use the MotionRestrictionOn() function to apply motion restrictions to axes that you specify. To restrict motion commands, home commands, and enable commands on these specified axes, use the function overload that follows.

function MotionRestrictionOn($axes[] as axis)

Applies motion restrictions to the selected axes. This function restricts the motion, home, and enable features on the selected axes.

Arguments

$axes  The axes on which to apply motion restrictions.

When you use this function overload, all of the features in the Features Restricted by MotionRestrictionType.Motion list are restricted on the axes that you specify. The enable commands and home commands are also restricted on these specified axes.

You can select which type of motion restrictions to apply to axes that you specify with the MotionRestrictionOn() function and the MotionRestrictionType enum. Use the function overload that follows.

function MotionRestrictionOn($axes[] as axis, $motionRestrictionTypes[] as MotionRestrictionType)

Applies the specified motion restrictions to the selected axes.

Arguments

$axes  The axes on which to apply the motion restrictions.

$motionRestrictionTypes  The types of motion restrictions to apply to the selected axes.

When you use this function overload, you can select one or more of these motion restrictions to apply:

When you select MotionRestrictionType.Motion, all of the features in the list that follows are restricted.

When you select a different MotionRestrictionType, the corresponding feature is restricted when the motion restrictions are applied.

For Example

If you select MotionRestrictionType.Enable, an error will occur if you command the restricted axis to enable.

If you select MotionRestrictionType.Abort, an error does not occur when you try to abort motion on the restricted axis. But motion will not stop on the restricted axis.

WARNING: If you use the Disable or Abort motion restriction types, this can prevent machine operators from doing critical safety stops.

If you restrict the Disable feature, operators cannot stop servo control of the restricted axis through the Automation1 Studio or Automation1 MachineApps interface.

If you restrict the Abort feature, operators cannot stop axis motion through the Automation1 Studio or Automation1 MachineApps interface.

Only apply these types of motion restrictions if you make sure it is safe for your application.

When you apply any motion restrictions, the features that follow do not cause a task error if you command them on the specified axes.

Motion restrictions apply to axes on the controller, not to tasks. This means that if you apply motion restrictions to an axis, you cannot command motion on that axis from any task. To let a task temporarily command motion on a restricted axis, use the MotionRestrictionAllow sections. Refer to the MotionRestrictionAllow Sections part of this page for more information.

If you specify two or more axes to a command and motion restrictions are applied to one or more of those axes, the full command is not executed, and a task error occurs. For example, if motion restrictions are applied to axis Y and you execute the AeroScript command that follows, none of the specified axes will move.

Program Example

MoveAbsolute([X, Y, Z, U], [1, 2, 3, 4], [0.5, 1, 1.5, 2])

This behavior applies to all motion restrictions except for those that have an effect on the Abort command. If you apply motion restrictions to an axis that limit the Abort command, any Abort command that includes the restricted axis will silently skip that axis. The controller will continue to abort motion on all other specified axes that are not restricted. This safety precaution makes sure that the controller aborts motion on as many axes as possible.

Disable Motion Restrictions

You can use the MotionRestrictionOff() function to remove all motion restrictions from the specified axes. When you use this function, all motion restrictions that have been applied to this axis are removed. Thus, you can command motion to the axis again from any task on the controller.

Motion restrictions are automatically removed from all axes when you reset your controller.

Use the function that follows to remove all motion restrictions from the axes that you specify.

Program Example

function MotionRestrictionOff($axes[] as axis)

MotionRestrictionAllow Sections

You can use MotionRestrictionAllow sections to let specific tasks temporarily ignore motion restrictions. These sections cause the AeroScript code and commands issued by those tasks to temporarily ignore motion restrictions. This is useful for critical operations, such as when a task must do critical setup or motion on an axis with a small section of AeroScript code. For all other tasks, the controller will apply motion restrictions to them at the same time. For example, you can use these sections to let one critical task do motion with an axis, while all other tasks on the controller cannot interfere with this motion.

To start a MotionRestrictionAllow section, use the MotionRestrictionAllowSectionStart() function.

To end one or more MotionRestrictionAllow sections, use the MotionRestrictionAllowSectionEnd() or MotionRestrictionAllowSectionEndAll() function.

MotionRestrictionAllow sections that you start will stay active until you end them with the MotionRestrictionAllowSectionEnd() or MotionRestrictionAllowSectionEndAll() function or until you stop or reset the program on the task. To stop the program on the task, use the ProgramStop() function or the Stop Task button in the Programming Module. To rest the program on the task, use the ProgramReset() function. For more information about how to stop or reset a task, see Task and Program Functions.

IMPORTANT: If you call the MotionRestrictionAllowSectionStart() function from an immediate command on a task, the task will still have a MotionRestrictionAllow section active after the command completes. The MotionRestrictionAllow sections that are active on the task will not end if one of these conditions occurs:

  • A program is started on a task, but the task does not have an AeroScript program currently associated with it.
  • A program completes, but the task is not stopped or reset.

To make sure that all MotionRestrictionAllow sections on a task will end, click the Stop Task button or call the MotionRestrictionAllowSectionEndAll() function.

You can have a maximum of 100 MotionRestrictionAllow sections active on a task at one time. To start more MotionRestrictionAllow sections after you get to 100, you must call MotionRestrictionAllowSectionEnd() or MotionRestrictionAllowSectionEndAll() to end one or more of the current sections. If you call the MotionRestrictionAllowSectionStart() function more than 100 times without ending any of the current sections first, a task error will occur.

Usually, it is not necessary to start more than one MotionRestrictionAllow section. While the behavior of these sections does not change based on the number of active sections on a task, you must make sure to call MotionRestrictionAllowSectionEnd() an equal number of times to MotionRestrictionAllowSectionStart(). But it might be necessary for you to use multiple MotionRestrictionAllow sections when you call functions that are defined in an AeroScript library that uses these sections. The program that follows shows an example of when you must use multiple MotionRestrictionAllow sections.

Program Example

// ExampleLibrary.ascriptlib
library function ExampleLib($axis as axis)
    MotionRestrictionAllowSectionStart()
    Enable($axis)
    Home($axis)
    MotionRestrictionAllowSectionEnd()
end

// ExampleProgram.ascript
import "ExampleLibrary.a1lib" as static

program
    MotionRestrictionAllowSectionStart()
    ExampleLib(X)
    MoveLinear(X, 10)
    MotionRestrictionAllowSectionEnd()
end

In this example, you must make multiple MotionRestrictionAllow sections, or the code will not operate correctly. If each call to the MotionRestrictionAllowSectionStart() function does not add a new active MotionRestrictionAllow section, and keeps the number of active sections at 1, then the call to MotionRestrictionAllowSectionEnd() function inside of the ExampleLib() function will cause the outer MotionRestrictionAllow section to end. This would cause the task to error when ExampleProgram.ascript executes the MoveLinear() function. Thus, you can start multiple MotionRestrictionAllow sections, which include sections inside of other sections. But you must end with an equal number of these sections.

Use the function that follows to start a MotionRestrictionAllow section on the current task.

function MotionRestrictionAllowSectionStart()

Starts a motion restriction allow section on the current task. When a motion restriction allow section is active, code executed on the task temporarily ignores motion restrictions until the MotionRestrictionAllowSectionEnd() function or MotionRestrictionAllowSectionEndAll() function is called.

Use the function that follows to end one MotionRestrictionAllow section on the current task.

function MotionRestrictionAllowSectionEnd()

Ends a motion restriction allow section on the current task. If no motion restriction allow sections are active on the current task after this function executes, code executed on the task will apply motion restrictions.

Use the function that follows to end all MotionRestrictionAllow sections on the current task.

function MotionRestrictionAllowSectionEndAll()

Ends all motion restriction allow sections on the current task. Code executed on the task will apply motion restrictions.

Monitor Motion Restrictions

Use axis data signals to monitor the status of an axis. You can use these signals to:

  • Determine if motion restrictions are currently applied to an axis.
  • Identify which motion features are restricted.

To determine if an axis has any motion restrictions, examine the MotionRestricted bit of the AxisStatus axis data signal. This bit is set to a non-zero value when a motion restriction is applied to the axis. For more information about the AxisStatus signal, refer to enum AxisStatus on AeroScript Enums.

Use the MotionRestrictionMask axis data signal to identify which types of motion restrictions are applied to an axis. This data signal returns a bitmask, where each bit corresponds to a different type of motion restriction.

The program example that follows shows you how to use the AxisStatus.MotionRestricted status item to see if any types of motion restrictions are applied to an axis.

Program Example

if StatusGetAxisItem(X, AxisStatusItem.AxisStatus, AxisStatus.MotionRestricted)
    MessageLogWrite("Axis X is restricted!", MessageLogSeverity.Information)
else
    MessageLogWrite("Axis X is not restricted!", MessageLogSeverity.Information)
end

The program example that follows shows you how to use the AxisStatusItem.MotionRestrictionMask status item to see if MotionRestrictionType.Motion restrictions are applied to an axis.

Program Example

var $motionRestrictionMask as integer = StatusGetAxisItem(X, AxisStatusItem.MotionRestrictionMask)

if $motionRestrictionMask & MotionRestrictionType.Motion
    MessageLogWrite("Motion commands are restricted on axis X.", MessageLogSeverity.Information)
else
    MessageLogWrite("Motion commands are not restricted on axis X.", MessageLogSeverity.Information)
end

You can use any of the MotionRestrictionType enum values this way in order to see if specific kinds of motion restrictions are applied to an axis.