Ok well as stated in previous posts, I have modded a usb missile launcher into a airsoft turret. The objective of the code is to find the target isolated, move to near the center of the screen, then oscillate fire on and off to prevent over heating and excessive bb use.
This code DOES NOT WORK! I have the right idea but cant get it working,
move = 0
size = GetVariable("COG_BOX_SIZE")
if size > 10 then
cogx = GetVariable("cog_x")
cogy = GetVariable("cog_y")
if cogx < 130 then
move = move OR 4
else
if cogx > 222 then
move = move OR 8
end if
end if
if cogy < 101 then
move = move OR 2
else
if cogy > 181 then
move = move OR 1
end if
end if
end if
if cogx <197 and cogx > 150 and cogy < 168 and cogy > 121 then
step = 0
period = 500
period2 = 1000
step = GetVariable("step")
if step = 0 then
SetVariable "move", 16
SetVariable "step", 1
SetTimedVariable "step", 2, period
else
if step = 2 then
SetVariable "move", 0
SetVariable "step", 3
SetTimedVariable "step", 0, period2
end if
end if
end if
SetVariable "move", move
I would love any input and have also included the roborealm file.
Thank You!
Jon
program.robo
|
|