Synthesize PCB and Defects with rule-based locations using Omniverse Replicator


I want to synthesize PCB(Printed Circuit Board) and defections dataset by omniverse replicator,

Is there a way to render the defections on a reasonable and random location in PCB, instead of only random location?

I mean the PCB has some components are: circle light, circuit, board
and let defections put on the circuit line edge, or put a mesh between two circuit line.

for example the following picture,
which simulate PCB defection dataset, but the defections(colored circle) is randomly put. that’s not what I want…

Is there a tutorial that I should study first?

Thanks in advance.

Hi there,

you can use multiple smaller randomization areas using normal or uniform distributions for the locations (rep.distribution.normal or rep.distribution.uniform), or providing a self generated list of possible locations to choose from either randomly or in sequential order (rep.distribution.choice or rep.distribution.sequence)

Hi @ahaidu ,

Thanks for your reply!

Sorry, my question is I want to make defections automately put on the line edge, like this
(the red part represents PCB mouse-bite defection )

And random uniform or normal distribution can’t achieve the outcome.
Rather I don’t use sequence or choice method to handle the problem, because that represents there are many locations I should precisely pick up on many PCB models.

Is there something rule-based method that makes some constraint between components?

Thank you~!!

If you can analytically represent the paths on which the defects can be placed on, you could sample from those models multiple possible locations (thousands or tens of thousands if needed, I don’t think there is a numerical limit) and use those arrays of locations as input to the choice randomizer.
I think this would be a more straightforward approach. Otherwise you could implement your own randomizer graph node (a bit more advanced topic), this would be more memory efficient since you do not need to cache all the points. You would still need the model from which to sample the locations though.

Hi @ahaidu ,

Thank you for quickly reply!

If you can analytically represent the paths on which the defects can be placed on, you could sample from those models multiple possible locations (thousands or tens of thousands if needed

how can I get the position of prim object, and I want random put some sphere(like defections) base on added or decreased offset of position.

Is the way can do it by replicator API? I use “omni.replicator.core.get.xform” API but seems have not the position attribute.

Can you give me some example for your suggestion? Thank you so much!

In case, you can generate the points where to place the “sphere” (defects) you can use a script such as:

import omni.replicator.core as rep

generated_defects_locations = [(0.3, 0.2, 0.1), (0.1, 0.3, 0.2)]
defect_prim_node = rep.create.sphere()
# # OR
# defect_prim_node = rep.get.prim_at_path("/World/my_defect")

def place_defect():
    with defect_prim_node:
    return defect_prim_node.node


with rep.trigger.on_frame():

Hi @ahaidu ,

Yes, actually I have already tried all tutorials this

and the first image I post was generated by same as example you provide,

but I want to use a program automated to detect the component position, so let me put the defections nearby.

the following code can not work but is my thought as I mentioned.

Is there an API or example that could get the position, thank you!

WORKER = '/World/my_defect'
with rep.new_layer():

    def worker():
        pos = rep.get.xform("/World/PCB_04") #get the position (x, y, z)
        particle = rep.create.from_usd(WORKER, semantics=[('class', 'particle')], count=2)
        with particle:
                position=rep.distribution.uniform((pos.x-100, 3, -100), (pos.x+100, 3, 100)) #
        return particle

    # Register randomization

If the PCB_04 prim is not going to move during the randomizations then you can read the transform of the prim: tf_mat = omni.usd.get_world_transform_matrix(pcb_prim)

Here is a more detailed description of a tutorial mixing isaac sim, usd, and replicator API: 3. Offline Dataset Generation — Omniverse Robotics documentation