View Single Post
  #6   Spotlight this post!  
Unread 30-01-2005, 03:27
russell's Avatar
russell russell is offline
Registered User
#1430 (WRONG)
Team Role: Electrical
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Anchorage AK
Posts: 402
russell is a name known to allrussell is a name known to allrussell is a name known to allrussell is a name known to allrussell is a name known to allrussell is a name known to all
Re: Have you gotten your robot to go towards the vision tetra?

The trig for this is all right triangle stuff. That is reasonably easy (though I dont know how to do it in C but it couldnt be all that hard could it?). The rule is SOH-CAH-TOA (pronounced "so cuh toe-uh").
sine=opp/hyp
cosine=adj/hyp
tan=opp/adj

So basically you have a right triangle where one side (lets say this is side a) is a line straight down to the floor (or level of the panel on a vision tetra) from your camera, another side (side b) is the line between the bottom of that line and the vision target, and the hypotenuse is the line between your camera and the vision target.


So you know that the sin of the tilt angle of the camera is equal to the distance to the target divided by the height of the camera. Assuming that the tilt servo angle is a linnear thing when compared to the pwm value it returns you should be able to compute that angle then the height of your camera times the tangent of that angle should equal the distance to the target. Of course the servo resolution is no good, but it should be ok for close range.