|
reading values after time lapse Dawson from Malaysia [173 posts] |
13 year
|
How do i read a variable (exp COG_X) value at Time = 1second ago and compare this with the current value (Time = current)
The chart_variables stores these values. How do i access it and what is the data capture rate?
|
|
|
Anonymous |
13 year
|
Dawson,
You can use a bit of programming to accomplish this. Assuming that your pipeline runs at a max of 30 fps the following would give you COG values from about a second ago.
delaySize = 30
queuePos = GetVariable("cog_queue_pos")
queue = GetArrayVariable("cog_queue")
if not isArray(queue) or ubound(queue)<30 then
ReDim queue(delaySize)
end if
delayedCog = queue(queuePos)
queue(queuePos) = GetVariable("COG_X")
queuePos = queuePos + 1
if queuePos>=delaySize then
queuePos = 0
end if
SetArrayVariable "cog_queue", queue
SetVariable "cog_queue_pos", queuePos
SetVariable "delayed_cog", delayedCog
and your delayed value will now be in the variable delayed_cog. Note that delaySize specifies how old the variable will be. Also note that the first 30 sample will all be zero until the queue is filled ...
STeven.
|
|
|
Dawson from Malaysia [173 posts] |
13 year
|
That's great thanks.
I managed to use the SetTimedVariable feature to accomplish a similar effect. It seems to work...
|
|