Tracking Object with camera movement only
Menec from Greece  [5 posts]
15 year
Hy !!!

I have a SSC-32 (servo controller) with two servos 180o (not continuous rotation servos). And as you can see in the first image i have established them with a camera so the camera can move " up-down" and "left-right".

What i am trying to do is to track the orange ball in the second picture.  

My VBscript is this one:

  if  cogx = 0 then
    N1_motor = 1500
    if cogx > 0 then
      N1_motor = 1900 - cogx
  end if
end if

  if  cogy = 0 then
    N2_motor = 1500
    if cogy > 0 then
      N2_motor = 1800 - cogy
  end if
end if

  SetVariable "N1_motor", N1_motor
  SetVariable "N2_motor", N2_motor

The problem is that when the camera is trying to go on the target then its run crazy and the camera moves left, right, up and down of the target without stopping.

what can i do so the camera will go straight to the target and stop on it.

I am sending you all my robo file!!!

Thanks Menec


Anonymous 15 year

I think you are not realizing that the center of the image is actually the coordinate 400,300. Thus your VBScript would probably be more like

cogx = GetVariable("cog_x")
cogy = GetVariable("cog_y")

w = GetVariable("IMAGE_WIDTH")
h = GetVariable("IMAGE_HEIGHT")

N1_motor = 1200+ ((cogx / w) * (1900 - 1200))
N2_motor = 1200+ ((cogy / h) * (1900 - 1200))

SetVariable "N1_motor", N1_motor
SetVariable "N2_motor", N2_motor

which would scale the N1 motors from 1200 to 1900 (I'm assuming that is the correct range) based on how far the cogx location is. Same for cogy.

You may have to tweak the range by reducing the number a bit to slow down the motors ... so if they really jerk try 400 instead of 700 (1900-1200).

lim from Malaysia  [2 posts] 14 year
Can show the actual programming of this targeting object system with 2 servo motors?

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