loading
 
using if statement module
Maryam from Sweden  [3 posts]
15 year
Hi,

I have a question in using if statement module.
I have used different modules in roborealm pipe line environment such as  skin, display circle, display triangle,... and marked each of them with Marker module to use in desired time.
I want to use if statement to say e.g if the marker is related to "display circle module" then beep.
but I don't know:
1- how I mention the Marker name as a variable in condition part of the if statement since it does not appear in the variables list.

2- where I should use my if statement in the pip line.

Thanks in advance
Maryam
Anonymous 15 year
Maryam,

I think you may be mixing the Marker module and the SetVariable module. If you use the SetVariable module where you are using the Marker module you will then see the variable in the IF statement module dropdown. Keep in mind that Markers are for images only and thus as the IF statement module will not act on images but on variables you will not see the marked images in that module.

So for example

Display Circle Module
Set Variable (module = "circle")
.
.
If module =  "circle"
  beep
/if


If you are still having issues please include what you currently have as a robofile (Save button->something.robo) and we will take a look.

STeven.
Maryam from Sweden  [3 posts] 15 year

STeven,

Many thanks for your help. I used the statement you mentioned in my pipe line environment and it works great. Bu I still have problem.
My exact aim is to use different modules and mark them with Marker and then using the refer to them later using an if statement for different usages.
For example if I have already used "Display circle" module I want to say a robot that if you see a circle (showing the image containing the circle marked with Marker) then say e.g: "I see a circle." But I do not do how I should do it?

My next question is if it is possible to write:
if ... then
  say I see a circle.
end if

I mean if the statement after "then" is correctly used?

I also attach my robofile for you.

Thanks a lot
Maryam
program.robo
Anonymous 15 year
Maryam,

We simplified the robofile just down to the basics to illustrate how to do this.

Note the confusing part is how to detect that a circle has been found by the circle module. In this case we use the If statement module to detect the SIZE of the array being produced is > 1 (i.e. it has some information in it). When you use the If statement module and just specify an array it will grab the size of that array. If you want to test a specific element within the array you then use the variable:1 or variable:2 etc notation.

Hopefully this robofile illustrates the point. Note that we included a test image that should trigger the text display. Try dragging other images into RR to see what happens. Note that if more than 1 circle is found it will also trigger the text display.

You would then replace the text display with whatever else you would prefer to do when a circle is detected. Note that if you are using sound (like the beep module) then you will hear very rapid beeping when using video as each new image will trigger a beep ... using static images you should only hear one.

STeven.
program.robo

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index