If statement with time variablr
Frederick Macklin from United States  [4 posts]
1 month
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.

Steven Gentner from United States  [1365 posts] 23 days

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.

Frederick Macklin from United States  [4 posts] 17 days
Thank you sir, this works perfectly!

 Reply  New Post   Forum Index