Returns a numeric value that provides state information for the Trajectory Generator or the currently executing motion for a given robot.
...Robot.TrajState ( robot, mode )
Prerequisites
None
Parameters
robot
An optional numeric expression that specifies the robot to be accessed (1-n). If this value is 0 or unspecified, the Selected robot will be accessed.
mode
An optional numeric expression that specifies the type of state information that is to be returned. If no value is specified, a mode of 0 is assumed.
Remarks
This property returns various state information for the trajectory generator or the currently executing motion for a specific robot depending upon the value of the mode parameter.mode0: Basic Trajectory State
This property returns a value that indicates whether a trajectory is currently being evaluated for the specified robot and, if so, what portion of the trajectory is being generated. This value can be utilized to determine if a trajectory is being ramped up to its maximum speed, being ramped, waiting for final position errors to be nulled, sitting idle, performing a special control mode, etc. The possible values returned by this property are presented in Table 19-85.
TrajState | Description ( Mode = 0, Basic Trajectory State ) |
---|---|
0 |
Halted, Trajectory Generator not being executed and no robot attached |
1 |
Idle, Trajectory Generator ready to service commands but no motion in progress. |
2 |
Position controlled mode, accelerating up to maximum speed |
3 |
Position controlled mode, moving at constant velocity |
4 |
Position controlled mode, blending two motions together |
5 |
Position controlled mode, decelerating robot to a stop |
6 |
Position controlled mode, force overlapping two motions together |
8 |
Velocity controlled mode |
9 |
Special motor speed control mode, usually indicates homing |
10 |
Jog (manual) control mode |
11 |
External trajectory control, special mode |
15 |
Motion terminated, waiting for final position to satisfy InRange criteria |
mode1: Active Motion Status
This property returns a value that indicates whether the currently active or the previous motion (if none is currently active) has been initiated or has terminated and, if so, whether the motion ran to completion or was prematurely terminated. The possible values returned by this property are presented in Table 19-86.
TrajState | Description ( Mode = 1, Active Motion Status ) |
---|---|
0 |
No motion posted for execution yet. |
1 |
Motion was posted to the trajectory generator but was rejected because it didn't match the end point of the previous motion (this value is normally never returned). |
2 |
Motion has been posted to the trajectory generator for execution but has not started yet (this value is normally never returned). |
3 |
Motion has been posted that is to be executed in continuous path mode with respect to the previous motion (this value is normally never returned). |
4 |
Motion currently being executed. |
5 |
Motion terminated or is being terminated, but the motion did not run to completion and the robot did not or will not reach its planned destination. |
6 |
Motion terminated and ran to completion and reached its planned destination. |
mode2: Motion Counter
Each time that a new motion is executed for a specific robot, the robot's Motion Counter is incremented. This value can use used to verify that the data being analyzed is with respect to the same motion. This is a 32-bit integer counter and should not roll-over for most practical situations.mode3: Active Motion Type
This property returns a value that indicates the type of motion being executed, e.g. Cartesian straight-line, joint interpolated, etc. Some of the values returned are for special modes and are not documented. See Table 19-87.
TrajState | Description ( Mode = 3, Active Motion Type ) |
---|---|
0 |
Joint interpolated motion |
1 |
Cartesian straight-line motion |
2 |
Circular interpolated motion |
3 - 6 |
Special motion types, such as velocity or jog or external trajectory control modes. |
mode4: Total Motion Time in Seconds
For the currently executing motion or the previous motion (if no motion is currently executing), this value returns the total motion time in seconds. If the motion is part of a continuous path, some of the specified time will be overlapped with the previous or the next motion.mode5: Motion Elapsed Time in Seconds
This indicates the number of seconds that have elapsed since the start of the currently executing motion or the previous motion (if no motion is currently executing). After a motion completes execution, this timer continues to increase in value until the next motion begins execution, at which time the timer is reset to zero.mode6: Motion Interpolation Factor
is the factor that is computed by the Trajectory Generator to interpolate between the starting and the ending position of the currently executing motion. Initially, it has a value of 0. At the end of the motion, it will have a value of 1. This factor can be used to determine how far the trajectory has progressed. For example, for Cartesian straight-line motions, this value indicates how far the robot is from the initial or the final position.
Examples
Dim istate As Integer
istate = Robot.TrajState() ' Reads current trajectory state
See Also