|
transfering variable from previous frame-using VBScript boaz from Israel [5 posts] |
15 year
|
hi
i have built a pan-tilt webcam using BrainStem controller.
when the program run the COG_X\Y is flickering in the same rate if FPS.
in some interval of 15-25 frame it throws 0 to COG and the Pan-Tilt loos the direction.
is their any way to transfer the SERVO_VALUE or COG_X\Y from the previous frame using VBScript module?
or a better solution to avoid the 0 that i get ?
Regards
boaz
|
|
|
boaz from Israel [5 posts] |
15 year
|
correction- the COG_X\Y gives N\A ( not a 0)..
(is their any way to change a post ?)
Regards
boaz
|
|
|
Anonymous |
15 year
|
boaz,
Yes, you can add in the VBScript module just before you send out the variable to the servos and include the following code.
cogX = GetVariable("COG_X")
if cogx = "" then
cogx = GetVariable("LAST_COG_X")
SetVariable "COG_X", cogx
end if
SetVariable "LAST_COG_X", cogx
which will use the last non-zero COG_X value if the current one is zero. It will also update the LAST_COG_X variable with the current coord if not zero.
You'd need to also do this for COG_Y.
You can also put in a counter that if after say 10 times of being zero you'd then assign zero to COG_X if you needed at some point the values to be zero.
Or you could also average the past values .... lots of options here!
STeven.
|
|