Use the RAPID SearchL instruction when the robot must search along a linear path until a digital input or CyclicBool indicates an event. Store the detected position in a robtarget, and select an appropriate stop switch when the robot must end the commanded motion at the event instead of continuing toward ToPoint.
Select the Supported Search Motion
The available evidence identifies SearchL for linear motion and SearchC for circular motion. It mentions SearchExtJ but does not establish it as a joint-motion equivalent to SearchL or SearchC. Do not assume that an equivalent joint search instruction exists without checking the applicable RAPID instruction manual.
Stop at the Search Event
A search event alone does not necessarily cancel the remaining travel to the ToPoint argument. Apply one of the supported optional switches—\Stop, \PStop, or \SStop—to make the robot stop when the event is detected. The evidence does not define the behavioral differences among these switches, so select one only after reviewing its documented stop behavior for the controller and application.
- Define the search condition as a digital input or
CyclicBool. - Use
SearchLfor a linear search and store the event position in arobtarget. - Add
\Stop,\PStop, or\SStopwhen the motion must terminate at the detected event. - Verify that the stored target represents the event position and that the robot does not continue to
ToPoint.
Read the Stored X Coordinate
A robtarget does not expose X directly as pSearch.x. Its Cartesian position is nested under trans; assign the X component to a num with the following expression:
nPosX:=pSearch.trans.x;
Replace pSearch and nPosX with the actual robtarget and num variables. An expression such as p11Mem.x fails because it omits the trans component.
Controller Scope and Verification
The requested program targets IRC5. The evidence does not confirm identical instruction availability or behavior on controllers described only as “6” and “7.” For each controller generation, verify that the selected search instruction, event source, and stop switch are supported before deployment.
FAQ
How do I stop ABB RAPID SearchL when an input turns on?
Use a digital input or CyclicBool as the search condition and apply \Stop, \PStop, or \SStop so the robot stops at the detected event.
Why does SearchL continue toward ToPoint after finding the event?
The movement can continue to the position specified by ToPoint when no stop switch is selected. Add one of the documented stop switches and verify the resulting stopping behavior.
How do I copy a robtarget X coordinate into a RAPID num?
Access X through the target's translation component: nPosX:=pSearch.trans.x;. Direct access such as pSearch.x is not the supported field path shown by the evidence.