Value for IF Statement

Hi all,

I am programming a sorting cell and would like to sort the components in the pallet into either the red (Base 2) or green (Base 3) container. I have attached the main section of my robot program as well as the subprograms. At the moment, the robot only brings the components to Base 2 (red container). Base 1 is defined on the platform underneath the pallet.

My idea is to sort the components based on a property of the component, such as the material (e.g., green components are sorted into the green container). Does anyone know how I could implement this and which condition to use in the IF statement?

(No Python preferred)

Thank you in advance.

Hello,

With the Process Modelling, that would be easy to do (see answer to your previous post: Efficient way to pick 50 parts from a 5Ă—10 pallet without teaching 50 targets (Robot Program) - #6 by mkittell )

I don’t think it is possible to do it with the robot programming without programming a little bit in Python.

In case of just two different colours, you can have some other component read the component’s material and then send a true/false signal to the robot’s inputs. To the IF statement, you can write for example IN[100] to read input signal 100:s current value. Robot Statements

What do you mean by another component reading the components material?

How would I go about implementing this in my case?

Thank you in advance

Something like a process statement, sensor, or a …python script.
I agree with @Tilma: it seems that this is not doable without a little Python, and I don’t think there’s any ready components in eCatalog to read/measure the material.

Luckily for you, I had a color sensor example in my hard drive. It tests the color of first surface that collides with its ray.
I modified it quickly for you so that it sends boolean signals if the material colliding with the ray has green/red in the name. Attach this to the robot’s link 5 or 6, take a measurement by sending a PulseSignal, and use the aforementioned expression in the IF statement.
Color Sensor.vcmx (17.9 KB)

2 Likes

That’s amazing, thank you! However it seems that the file was not uploaded correctly. The file only contains the sensor.

You can add this component to your layout and attach it to your gripper.

You can then connect the signals and use them in your robot program (if you need you can watch this Academy video about signals : Signals with robots | Visual Components Academy )

(post deleted by author)

What does the print in output panel say? Did you remember to send the pulse signal to take a measurement?

(post deleted by author)

Many thanks for the advice. I will definitely consider doing it this way for the next project. I’ve already committed to doing the sorting cell with the Robot Program Editor, so I want to see it through. :slight_smile:

Hello, i’ve tried the color sensor but didn’t work, in the image the box is red and the red bit doesn’t turn on! Any solution?

Thanks in advance!

The image, sorry.

Did you send a PulseSignal to take the measurement? It’s only checking the color when the PulseSignal is triggered

1 Like

That’s right, and also there’s a hidden parameter that you can change from the Modeling tab to have it taking measurements all the time:


The purpose of the pulse signal is to connect it to e.g. a volume detector to not make scans all the time but only when the object of interest is nearby, as scanning the triangle meshes in the 3D world can be quite heavy for the performance.

3 Likes

Didn’t realize it was that way.

Thanks!! This community is very helpful!!

1 Like

(post deleted by author)

The same would be with plc signals, i honestly try to use the less signals that connects to the robot. I prefer program all in the plc and teach the robot points, so then the plc will say to the robot which position has to go. By the way is there any place to see other peoples proyects to get ideas?

Thanks in advance!

You can have a look at the case studies: Case studies - Visual Components

I think most people won’t share their project, because a lot of them might be confidential, but on the Forum you can also find a lot of examples of what people did or are doing

Hello again,

How can do with other color such as blue or green?

I have edited but its wrong.

Thanks in advance!