loading
 
If statement with time variablr
Frederick Macklin from United States  [4 posts]
6 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
Steven Gentner from United States  [1446 posts] 6 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] 6 year
Thank you sir, this works perfectly!

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