|
If statement with time variablr Frederick Macklin from United States [4 posts] |
7 year
|
Hello, I've been wanting write an if statement that also includes a time variable. For example in would like to write...If angle is less than x for y amount of time. I know it's possible, I just don't have any programming knowledge.
Thanks
|
|
|
Carl from Your Country [1447 posts] |
7 year
|
Frederick,
The easiest way would be to add in the Filter Variable and use the Mean over 30 past values and then use the If Statement module to check if the difference between the current and previous values are significantly different. The mean will cause a slow moving value to remain mostly the same from frame to frame. "Significant difference" will mean different values depending on how quickly the object being tracked moved and what the mean window size (default at 30) is. I.e. perhaps 1 is ok but if this triggers too frequently you can try 0.5. See attached.
STeven.
program.robo
|
|
|
Frederick Macklin from United States [4 posts] |
7 year
|
Thank you sir, this works perfectly!
|
|