How To: Detect Part Position with 2D / 3D Sensor

In 2026xFD01, the 2D & 3D Sensors will be able to output the position of a detected Object, including Generated Objects. This position can be used as an Input of the Robot, a "Position Variable" the Robot will use to move to the correct target, based on the detection. Below are the explanations and steps to follow to make it work play with it!

Scenario

Parts to be moved by the Robot may be at different position on the carrier. The Sensor is detecting the part, one by one, and share the position of each part to the Robot, so the Robot can use this position as a "Position Variable", to reach this target and grab the part at the right position

 

1 Define the Sensor

  • Create a 2D or 3D sensor

  • On the Behavior tab editor, create a Position as Output Signal

  • Define the distance origin - best is to define the same position as the Robot Work Object (Object Profile), the one that will be used during in the Robot Trajectory

  • The Sensor detects the position when the "Object Detected" is activated - the position is kept even when the object is no longer detected

  • The update of the detected position happens only when a new object is being detected

  • Output of the sensor is the full tag position of the detected part origin, on the defined referential frame. Detected Attributes X, Y, Z are in meter.

 

2 Prepare the Position Variable

  • Create an Input as Position Variable on the Robot, and connect it with the output of the sensor

  • On the Robot, create one internal Variable as Position, to keep in memory the detected position "memPose"

    • To be able to use this tag in the Robot Task, the variable must be defined as a "Tag Position", referencing a well defined tag.

    • This pre-defined tag will be overwritten by the new detected position, so the exact position does not really matter, only the Reference Frame and Associated Resource are important.

 

3 Define the Robot Task

  • Create Robot Motions to reach the "memPose" Tag, so the Robot will have to reach the detected position. You can also play with position attributes values to manage "Approach" and "retract" routines.

  • In this case, the routine to "memorize" the detected position is called each time a new part is being detected by the sensor

  • The detected "Pose.refFrame" is equals to 0 and not to the PCB_Frame used by the Robot task. This can generate unreachable targets due to wrong position definition. to handle this:

    • In the Robot Controller Parameters, in the Position Variable tab, switch the Object Frame Profile attribute to "Define on Robot Motion" 

  • If you want (or have to) keep "Use from variable", you can, in the memRoutineTask, copy all necessary attributes instead of the full detected tag attributes

Result

  • If multiple parts are being detected by the sensor, the position output will provide only one value. When the part will be out of the sensor range, if the "ObjectDetected" attributes is still at "true", the position of the other detected part will be shared.

the /1000 thing is from a previous behavior, no need to add this anymore

 

Dataset