Skip to main content
Skip table of contents

Run Motion Macro

After a Motion Macro has been saved, a Run Motion Macro command is used to allow an XBot to run the saved commands in the Macro.

If a Motion Macro has not been saved, this command can be used to make a Motion Macro call itself, by setting the input XbotID = MacroID. In this case, the Motion Macro will be an infinite loop, and the Motion Macro is automatically saved after sending this command.

Fieldbus Interface 

PMC_RunMacro

Inputs

Name

Data Type

Description

Execute

BOOL

Execution of the function block begins on a rising edge of this input.

cmdLB

UINT

Any 2 byte Command Label, user defined.

MacroID

USINT

Macro ID, valid range [128,191]

XbotID

USINT

ID of the XBot. Real XBot IDs [1,78]. Virtual XBot IDs [100,127]. Macro IDs [128,191]

PM_Controller

PMControllerType

Data structure that specifies which PMC to connect to. There should be only 1 instance of this variable for each connected PMC.

Outputs

Name

Data Type

Description

Ack

BOOL

Command has been accepted by the PMC when Ack = TRUE.

Done

BOOL

Execution successful. Function block is finished. (Note: Done will not become TRUE if Execute is already FALSE) 

Busy

BOOL

Function block is active and must continue to be called.

Aborted

BOOL

Command aborted by another command.

Error

BOOL

If there is an error in processing the command, then Error = TRUE, otherwise, FALSE.

ErrorID

UINT

0x0: All OK. Otherwise, please see PMC Reply Codes.

Ethernet Interface 

PMCRTN RunMotionMacro(ushort cmdLabel, int motionMacroID, int xbotID)

Parameters

Name

Type

Description

cmdLabel

ushort

Any 2 byte Command Label, user defined.

motionMacroID

int

Macro ID, valid range [128,191]

xbotID

int

ID of the XBot. Real XBot IDs [1,78]. Virtual XBot IDs [100,127]. Macro IDs [128,191]

Returns

Name

Type

Description

PMCRTN

PMCRTN enum

ALLOK (0): Command Accepted. Otherwise, please see Ethernet Reply Codes.

Conditions

Operating Conditions

Preconditions

Macro is in the saved state, or macro is in the unsaved state, and Input XbotID = MacroID. 

XBot is in the Idle state, Obstacle Detected state, Motion state, Stopped state, Hold Position state, or Waiting state.

Postconditions

If the XBot is ready to immediately begin executing the command, then the XBot will enter the Motion state. Otherwise, the XBot state remains unchanged, but the command will be added to the XBot's motion buffer.

If input XbotID = MacroID, then the run macro command will be added to the specified macro, and the macro will be saved.

Description

After a Motion Macro has been saved, a Run Motion Macro command is used to allow an XBot to run the saved commands in the Macro.

A Run Motion Macro command can be placed into an XBot’s motion command buffer.

Once an XBot begins executing this command, it will follow all the saved commands in the Macro in sequence. 

The diagram below illustrates the system operation when a Run Macro command includes another Run Macro command.

An XBot running Macro 1 will run Actions 1 & 2, followed by Actions A & B, and finally Actions 4 & 5.

 

If a Motion Macro has not been saved, this command can be used to make a Motion Macro call itself, by setting the input XbotID = MacroID. In this case, the Motion Macro will be an infinite loop, and the Motion Macro is automatically saved after sending this command.

An XBot running Macro 3 will run Action 3A, then 3B, followed by 3A and 3B, repeating infinitely until a Stop XBot command is used or an error occurs.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.