Get Controller Status
Use Status to get information about what the controller is doing at the current moment in time. Status provides useful information about the current state of the controller. The pieces of information that you collect are known as status items. Status can have variable latency when you retrieve it.
You can get Status by using the concepts that follow:
-
Automation1 Console
-
All Automation1 APIs
Many of the status items are dependent on the current units of the controller. Refer to the SetupTaskTimeUnits()
and SetupTaskDistanceUnits()
functions on Motion Setup Functions page and the UnitsName Parameter for more information.
You can get status items from these parts of the controller:
-
Axis - gets information about the behavior of axes and motors
-
Task - gets information about the behavior of tasks and program execution
-
System - gets information about global behaviors of the controller
Controller Status Functions
Each status item function has an overload that has an additional data argument. For some data items, this argument is used for context.
While the motion engine of the controller runs at a rate of 1 kHz, you can collect data faster by using the fast functions (StatusGetAxisItemFast()
and StatusGetTaskItemFast()
). These functions return an array of values that are proportional to the supplied sample rate. To see the supported motion rates, refer to Motion Functions.
Get Axis Status
Use the functions that follow to get axis status items.
function StatusGetAxisItem($axis as axis, $statusItem as AxisStatusItem) as real
Gets the specified status item value from the specified axis.
Arguments
$axis The axis from which to retrieve the status item value.
$statusItem The status item to retrieve.
Returns
The value of the specified axis status item.
function StatusGetAxisItem($axis as axis, $statusItem as AxisStatusItem, $additionalData as integer) as real
Gets the specified status item value from the specified axis.
Arguments
$axis The axis from which to retrieve the status item value.
$statusItem The status item to retrieve.
$additionalData Additional data for the specified status item. This argument is required by some status items.
Returns
The value of the specified axis status item.
function StatusGetAxisItemFast($axis as axis, $statusItem as AxisStatusItem, $additionalData as integer, $sampleRate as integer, ref $values[] as real)
Gets the specified status item value from the specified axis at a rate that is faster than 1 kHz.
Arguments
$axis The axis from which to retrieve the status item value.
$statusItem The status item to retrieve.
$additionalData Additional data for the specified status item. This argument is required by some status items. If additional data is not required, specify a value of 0 for this argument.
$sampleRate The number of samples to collect. This must be 1, 10, 20, 50, or 100.
ref $values An array variable in which to retrieve the data. The length of the variable must be sufficient to store the number of samples that are specified by the $sampleRate argument.
enum AxisStatusItem
PositionFeedback = 0 PositionCommand = 1 PositionError = 2 VelocityFeedback = 3 VelocityCommand = 4 VelocityError = 5 AccelerationCommand = 6 CurrentFeedback = 7 CurrentCommand = 8 CurrentError = 9 AnalogInput0 = 10 AnalogInput1 = 11 PositionCommandRaw = 12 VelocityCommandRaw = 13 AuxiliaryFeedback = 14 DigitalInput = 15 DigitalOutput = 16 WorkOffsetValue = 18 AnalogInput2 = 23 AnalogInput3 = 24 AnalogOutput0 = 31 AnalogOutput1 = 32 AnalogOutput2 = 33 AnalogOutput3 = 34 PsoStatus = 38 CoordinatedPositionTarget = 41 DriveStatus = 42 AxisStatus = 43 AxisFault = 44 AccelerationCommandRaw = 45 PositionCalibrationAll = 50 PositionFeedbackRollover = 63 PositionCommandRollover = 64 VelocityFeedbackAverage = 65 CurrentFeedbackAverage = 66 AxisParameter = 68 Backlash = 72 HomeState = 73 PositionCalibration2D = 74 NormalcyDebug = 75 TotalMoveTime = 76 PositionFeedbackDrive = 77 JerkCommandRaw = 78 ProgramPositionCommand = 79 PositionOffset = 80 PositionCommandRawBackwardsDiff = 82 VelocityCommandRawBackwardsDiffDelta = 83 PositionCommandDrive = 84 DriveStatusActual = 85 WorkOffsetIndex = 88 ProgramPositionFeedback = 89 JogTrajectoryStatus = 94 PingTest = 95 AccelerationTime = 109 DecelerationTime = 110 AccelerationRate = 111 DecelerationRate = 112 AccelerationType = 113 DecelerationType = 114 AccelerationMode = 115 DecelerationMode = 116 ProgramPosition = 124 SpeedTarget = 128 PositionCommandPacket = 131 DriveSmcMotionState = 132 PositionCommandRawCal = 140 VelocityCommandRawCal = 141 VelocityCommandDrive = 142 AccelerationCommandDrive = 143 GalvoLaserOutputRaw = 144 DriveInterfacePacketInt32 = 147 DriveInterfacePacketInt16 = 148 DriveInterfacePacketInt8 = 149 DriveInterfacePacketDouble = 150 DriveInterfacePacketFloat = 151 DriveInterfaceCommandCode = 152 AccelerationFeedback = 153 AccelerationCommandRawCal = 154 PositionCalibrationAllDrive = 155 BacklashTarget = 156 DriveMotionRate = 158 DriveMotionDelay = 159 CalibrationAdjustmentValue = 160 ServoLoopFeedforwardControlEffortRaw = 162 DriveInterfacePacketInfoBitValue = 164 AccelerationError = 165 SuppressedFaults = 167 DriveInterfacePacketStreamingData = 168 PositionCommandRawUnfiltered = 169 TransitionOffsetErrors = 170 FreezeVelocityCommand = 179 FreezeVelocityFeedback = 180 InternalPositionOffsets = 181 StatusHighLevelOffsetsLastMsec = 182 ProgramVelocityCommand = 183 ProgramVelocityFeedback = 184 DriveMotionDelayLive = 185 DriveCommunicationDelay = 186 DriveCommunicationDelayLive = 187 DriveInterfacePacketResponseInt32 = 189 DriveInterfacePacketResponseInt16 = 190 DriveInterfacePacketResponseInt8 = 191 DriveInterfacePacketResponseDouble = 192 DriveInterfacePacketResponseFloat = 193 DriveInterfacePacketBit = 194 DriveInterfacePacketResponseBit = 195 SpeedTargetActual = 196 CoordinatedDistanceRemaining = 199 AmplifierPeakCurrent = 211 ServoUpdateRate = 220 SafeZoneState = 230 PositionErrorGalvo = 235 MoveReferencePosition = 237 MoveReferenceOffsetCutterRadius = 250 MoveReferenceOffsetCornerRounding = 251 MoveReferenceOffsetTotal = 252 PiezoVoltageCommand = 262 PiezoVoltageFeedback = 263 DistanceLog = 264 MaximumVoltage = 274 CommandOutputType = 275 GalvoLaserOutputRawAdvance = 296 GalvoLaserOnDelay = 297 GalvoLaserOffDelay = 298 CalibrationAdjustmentState = 301 AccuracyCorrectionStartingPosition = 302 AccuracyCorrectionEndingPosition = 303 DriveCommandsDelayed = 309 DriveCommandsLost = 310 StoStatus = 327 DriveAssert = 336 PrimaryFeedback = 366 AccelerationSCurvePercentage = 371 DecelerationSCurvePercentage = 372 DriveArraySize = 388 GantryMarkerDifference = 390 PrimaryFeedbackStatus = 392 HomeTargetPosition = 398 GantryRealignmentMoveTargetPosition = 399 GantryDriveControlRealignmentState = 400 DriveInterfacePositionCommandPhysical = 434 DriveControlReason = 435 SyncPortAPosition = 444 SyncPortBPosition = 445 AnalogOutput4 = 467 AnalogOutput5 = 468 MoveReferenceOffsetCutterOffset = 471 end |
Use the StatusGetAxisItemFast()
function to get status at a rate that is faster than 1 kHz. Some status items are not available at a faster rate. You can only get the status items that follow at a faster rate.
- Acceleration Command Raw
- Backlash
- Galvo Laser Output Raw
- Jerk Command Raw
- Position Calibration 2D
- Position Calibration All
- Position Command Raw
- Velocity Command Raw
Use Axis Status Functions
The examples that follow show you how to retrieve some axis status items.
Program Example: Determine if an Axis is Enabled
// Determine if the Enabled bit of the DriveStatus item is set on axis X. var $isEnabled as real $isEnabled = (StatusGetAxisItem(X, AxisStatusItem.DriveStatus, DriveStatus.Enabled) == DriveStatus.Enabled)
Program Example: Determine if an Axis is Homed
// Determine if the Homed bit of the AxisStatus item is set on axis X. var $isHomed as real $isHomed = (StatusGetAxisItem(X, AxisStatusItem.AxisStatus, AxisStatus.Homed) == AxisStatus.Homed)
Program Example: Determine if Motion Commanded on an Axis is Complete
// Determine if the MotionDone bit of the AxisStatus item is set on axis X. var $isMotionDone as real $isMotionDone = (StatusGetAxisItem(X, AxisStatusItem.AxisStatus, AxisStatus.MotionDone) == AxisStatus.MotionDone)
Program Example: Read the Position Command of an Axis
// Retrieve the Position Command on axis X. var $positionCommand as real $positionCommand = StatusGetAxisItem(X, AxisStatusItem.PositionCommand)
Program Example: Read the Position Feedback of an Axis
// Retrieve the Position Feedback on axis X. var $positionFeedback as real $positionFeedback = StatusGetAxisItem(X, AxisStatusItem.PositionFeedback)
Program Example: Read the Position Command Raw of an Axis at 20 kHz
// Retrieve the Position Command Raw at 20 kHz on axis X. var $positions[20] as real StatusGetAxisItemFast(X, AxisStatusItem.PositionCommandRaw, 0, 20, $positions)
Get Task Status
Use the functions that follow to get task status items.
function StatusGetTaskItem($taskIndex as integer, $statusItem as TaskStatusItem) as real
Gets the specified status item value from the specified task.
Arguments
$taskIndex The task from which to retrieve the status item value.
$statusItem The status item to retrieve.
Returns
The value of the specified task status item.
function StatusGetTaskItem($taskIndex as integer, $statusItem as TaskStatusItem, $additionalData as integer) as real
Gets the specified status item value from the specified task.
Arguments
$taskIndex The task from which to retrieve the status item value.
$statusItem The status item to retrieve.
$additionalData Additional data for the specified status item. This argument is required by some status items.
Returns
The value of the specified task status item.
function StatusGetTaskItemFast($taskIndex as integer, $statusItem as TaskStatusItem, $additionalData as integer, $sampleRate as integer, ref $values[] as real)
Gets the specified status item value from the specified task at a rate that is faster than 1 kHz.
Arguments
$taskIndex The task from which to retrieve the status item value.
$statusItem The status item to retrieve.
$additionalData Additional data for the specified status item. This argument is required by some status items. If additional data is not required, specify a value of 0 for this argument.
$sampleRate The number of samples to collect. This must be 1, 10, 20, 50, or 100.
ref $values An array variable in which to retrieve the data. The length of the variable must be sufficient to store the number of samples that are specified by the $sampleRate argument.
enum TaskStatusItem
ProgramLineNumber = 17 CoordinatedFlags = 40 CoordinatedArcStartAngle = 53 CoordinatedArcEndAngle = 54 CoordinatedArcRadius = 55 CoordinatedArcRadiusError = 56 CoordinatedPositionCommand = 57 CoordinatedSpeedCommand = 58 CoordinatedAccelerationCommand = 59 CoordinatedTotalDistance = 60 CoordinatedPercentDone = 61 CoordinatedPositionCommandBackwardsDiff = 62 TaskParameter = 69 TaskError = 70 TaskWarning = 71 CoordinatedSpeedTargetActual = 86 DependentCoordinatedSpeedTargetActual = 87 TaskStatus0 = 90 TaskStatus1 = 91 TaskStatus2 = 92 SpindleSpeedTarget = 93 CoordinateSystem1I = 96 CoordinateSystem1J = 97 CoordinateSystem1K = 98 CoordinateSystem1Plane = 99 Mfo = 101 CoordinatedSpeedTarget = 102 DependentCoordinatedSpeedTarget = 103 CoordinatedAccelerationRate = 104 CoordinatedDecelerationRate = 105 CoordinatedAccelerationTime = 106 CoordinatedDecelerationTime = 107 TaskMode = 108 TaskState = 117 TaskStateInternal = 118 ExecutionMode = 121 EnableAlignmentAxes = 127 CoordinatedGalvoLaserOutput = 133 CoordinatedMotionRate = 145 CoordinatedTaskCommand = 146 EnableState = 166 LookaheadMovesExamined = 200 ProfileControlMask = 231 CoordinatedArcRadiusReciprocal = 253 MotionEngineStage = 254 CoordinatedTimeScale = 256 CoordinatedTimeScaleDerivative = 257 IfovSpeedScale = 266 IfovSpeedScaleAverage = 267 IfovGenerationFrameCounter = 268 IfovGenerationTimeOriginal = 269 IfovGenerationTimeModified = 270 IfovCoordinatedPositionCommand = 271 IfovCoordinatedSpeedCommand = 272 IfovCenterPointH = 276 IfovCenterPointV = 277 IfovTrajectoryCount = 278 IfovTrajectoryIndex = 279 IfovAttemptCode = 280 IfovGenerationFrameIndex = 281 IfovMaximumVelocity = 282 IfovIdealVelocity = 283 TaskInternalDebug = 284 IfovCoordinatedAccelerationCommand = 285 IfovFovPositionH = 286 IfovFovPositionV = 287 IfovFovDimensionH = 288 IfovFovDimensionV = 289 MotionBufferElements = 311 MotionBufferMoves = 312 MotionLineNumber = 313 MotionBufferRetraceMoves = 314 MotionBufferRetraceElements = 315 MotionBufferIndex = 316 MotionBufferIndexLookahead = 317 MotionBufferProcessingBlocked = 318 ActiveMoveValid = 319 TaskExecutionLines = 320 SchedulerTaskHolds = 321 SchedulerProgramLoopRuns = 322 SchedulerTaskBlocked = 323 CriticalSectionsActive = 324 AxesSlowdownReason = 331 TaskExecutionTime = 333 TaskExecutionTimeMaximum = 334 TaskExecutionLinesMaximum = 335 LookaheadDecelReason = 338 LookaheadDecelMoves = 339 LookaheadDecelDistance = 340 ProgramCounter = 341 StackPointer = 342 FramePointer = 343 StringStackPointer = 344 ProgramLineNumberSourceFileId = 349 MotionLineNumberSourceFileId = 350 ProgramLineNumberSourcePathId = 351 MotionLineNumberSourcePathId = 352 StringArgumentStackPointer = 354 CoordinatedAccelerationSCurvePercentage = 369 CoordinatedDecelerationSCurvePercentage = 370 DependentCoordinatedAccelerationRate = 373 DependentCoordinatedDecelerationRate = 374 CriticalSectionTimeout = 375 CommandQueueCapacity = 421 CommandQueueUnexecutedCount = 422 CommandQueueTimesEmptied = 423 CommandQueueExecutedCount = 424 CommandQueueLineNumber = 452 TaskReal = 469 TaskInteger = 470 end |
Use the StatusGetTaskItemFast()
function to get status at a rate that is faster than 1 kHz. Some status items are not available at a faster rate. You can only get the status items that follow at a faster rate.
- Coordinated Acceleration Command
- Coordinated Percent Done
- Coordinated Position Command
- Coordinated Speed Command
- Coordinated Total Distance
- Ifov Speed Scale
Use Task Status Functions
The examples that follow show you how to retrieve some task status items.
Program Example: Read the Task State of an AeroScript Task
// Read the Task State of Task 2. See the TaskState enum for more information. var $taskState as real $taskState = StatusGetTaskItem(2, TaskStatusItem.TaskState)
Program Example: Read the Program Line Number of an AeroScript Program
var $programLineNumber as real $programLineNumber = StatusGetTaskItem(TaskGetIndex(), TaskStatusItem.ProgramLineNumber)
Program Example: Read the Coordinated Position Command of an Axis at 20 kHz
// Retrieve the Coordinated Position Command at 20 kHz on Task 2 on the axis whose index is 1. var $speeds[20] as real StatusGetTaskItemFast(2, TaskStatusItem.CoordinatedPositionCommand, 1, 20, $speeds)
Get System Status
IMPORTANT: There are not "fast" signals to collect for system status.
Use the functions that follow to get system status items.
function StatusGetSystemItem($statusItem as SystemStatusItem) as real
Gets the specified system status item value.
Arguments
$statusItem The status item to retrieve.
Returns
The value of the specified system status item.
function StatusGetSystemItem($statusItem as SystemStatusItem, $additionalData as integer) as real
Gets the specified system status item value.
Arguments
$statusItem The status item to retrieve.
$additionalData Additional data for the specified status item. This argument is required by some status items.
Returns
The value of the specified system status item.
enum SystemStatusItem
VirtualBinaryInput = 46 VirtualBinaryOutput = 47 VirtualRegisterInput = 48 VirtualRegisterOutput = 49 Timer = 51 TimerPerformance = 52 GlobalReal = 67 CommunicationRealTimeErrors = 81 LibraryCommand = 119 DataCollectionSampleTime = 120 DataCollectionSampleIndex = 129 ModbusClientConnected = 134 ModbusServerConnected = 135 ModbusClientError = 136 ModbusServerError = 137 StopWatchTimer = 157 ScopetrigId = 163 EstimatedProcessorUsage = 177 DataCollectionStatus = 188 SignalLogState = 198 SafeZoneViolationMask = 207 SafeZoneActiveMask = 229 ModbusClientInputWords = 240 ModbusClientOutputWords = 241 ModbusClientInputBits = 242 ModbusClientOutputBits = 243 ModbusClientOutputBitsStatus = 244 ModbusClientOutputWordsStatus = 245 ModbusServerInputWords = 246 ModbusServerOutputWords = 247 ModbusServerInputBits = 248 ModbusServerOutputBits = 249 SystemParameter = 265 ThermoCompSensorTemperature = 305 ThermoCompControllingTemperature = 306 ThermoCompCompensatingTemperature = 307 ThermoCompStatus = 308 GlobalInteger = 345 AliveAxesMask = 348 SignalLogPointsStored = 377 ControllerInitializationWarning = 379 StopWatchTimerMin = 416 StopWatchTimerMax = 417 StopWatchTimerAvg = 418 EthercatEnabled = 428 EthercatError = 429 EthercatTxPdo = 430 EthercatTxPdoSize = 431 EthercatRxPdo = 432 EthercatRxPdoSize = 433 EthercatState = 437 ModbusClientEnabled = 438 ModbusServerEnabled = 439 HyperWireExternalSynchronizationActive = 440 HyperWireExternalSynchronizationFrequency = 441 HyperWireExternalSynchronizationLagging = 442 HyperWireExternalSynchronizationAdjustmentNanoseconds = 443 CallbackSlotProcessingState = 453 ControllerAssertCount = 457 VirtualBinaryInputBit = 472 VirtualBinaryOutputBit = 473 EtherNetIpAdapterEnabled = 474 EtherNetIpAdapterConnected = 475 EtherNetIpAdapterError = 476 EtherNetIpAdapterInputIntegerSize = 477 EtherNetIpAdapterInputFloatSize = 478 EtherNetIpAdapterOutputIntegerSize = 479 EtherNetIpAdapterOutputFloatSize = 480 end |
Use System Status Functions
The example that follows shows you how to retrieve a system status item.
Program Example: Get the Value of a Timer
// Read the value of Timer 0 using a system status item instead of TimerRead(). var $timer as real $timer = StatusGetSystemItem(SystemStatusItem.Timer, 0)
Other Ways to Get Controller Status
You can use the different modules that follow in Automation1 Studio and Automation1 MachineApps to get controller status:
- Axis Dashboard
- Buttons & Indicators
- Message Log Viewer
- Program Variables
- Task Status
- Variables & I/O
You can get status by using the Automation1 Status Utility, Automation1 Console, and all of the Automation1 APIs.
You can write an AeroScript program that collects information from the controller and then sends the information over a socket. Refer to the example that follows.
Program Example: Collect Status and Send the Information over a Socket
var $server as handle var $client as handle $server = SocketTcpServerCreate(8080) $client = SocketTcpServerAccept($server) while true var $command as string var $response as string $command = SocketReadString($client, "\n") if StringEquals($command, "position") $response = RealToString(StatusGetAxisItem(X, AxisStatusItem.PositionCommand)) elseif StringEquals($command, "velocity") $response = RealToString(StatusGetAxisItem(X, AxisStatusItem.VelocityCommand)) elseif StringEquals($command, "acceleration") $response = RealToString(StatusGetAxisItem(X, AxisStatusItem.AccelerationCommand)) else $response = "Unknown command." end SocketWriteString($client, $response) end