The global Latch Class provides a means for GPL procedures to receive the results of latches generated by digital input signals configured to trigger latching. These latch results allow a robot or belt position to be captured with high accuracy when a digital input value changes.
The Latch Class defines Latch Objects that contain the time when the latch occurred and the robot axis positions at that time. This class includes methods and properties for accessing the queue of latch results, and for accessing the data in the results themselves.
Each robot has a single independent queue of latch result objects, generated when a configured latch signal changes state. The queue is kept in order of time, with the oldest events first. Conveyor belts are a special case of robots, normally configured as "encoder only" robots. Multiple belts or robots may be latched independently.
For a general discussion of Latches, please see the Controller Software > Introduction To The Software > Communications > Digital Inputs and Outputs > Latch Inputs section of the PreciseFlex Library.
The methods for this class are summarized in Table 19-23:
| Member | Type | Description |
|---|---|---|
|
latch_object.Angle |
Property |
Returns the latched value of the specified axis angle. Avoids creating a Location object. |
|
Latch.Count |
Shared Property |
Returns the number of latch results pending for a robot or conveyor belt. |
|
latch_object.ErrorCode |
Property |
Returns the error code from a latch object. 0 means no error. |
|
Latch.Flush |
Shared Method |
Flushes all latch results pending for a robot or conveyor belt. |
|
latch_object.Location |
Method |
Returns a Location object containing the latched position, as a Cartesian value or a set of angles. |
|
Latch.Result |
Shared Method |
Removes the next latch result from the queue for a robot or belt and returns it as a Latch object. Returns Nothing if the queue is empty. Throws an exception if a result was lost due to an overflow. |
|
latch_object.Signal |
Property |
Returns the number of the digital input signal that generated the latch. |
|
Latch.ThreadEvent |
Shared Property |
Associates a thread event with a robot or belt. The thread event gets set if the latch queue contains latch results or when new latch results are added. |
|
latch_object.Timestamp |
Property |
Returns the timestamp when the latch occurred as a Double value, consistent with the Controller.Timer property. |