Quote:
|
Originally Posted by Tom Bottiglieri
Better yet.. read back the "wanted" pan servo rate from the camera, convert that into an angle relative to the bot in radians, and either
a) Turn the bot until the pan servo reads 127 (0 degrees)
b) Use a gyro (It would be a shame if a team skimped out on using one of these, seeing as we got a pretty nice one in the kit!) and turn to the calculated angle.
c) Use a combination of both: Lock onto the target.. get the relative angle.. turn UBER fast using the gyro to slow down.. and reposition yourself by using choice A.
|
For some reason I am thinking I heard that 150 was the center value for the servos. Correct me if I'm wrong.
I am by no means a programmer, but with no encoders/gyros/etc. whatsoever (method A you are referring to) is it not possible to write some code kinda like this:
Code:
if(pwm01 > 155) //giving kind of an error range of 5
{
pwmX = 157; //or some value that isn't terribly fast
}
if(pwm01 < 145)
{
pwmX = 97;
}
if(pwm02 > 155)
{
pwmY = 157;
}
if(pwm02 < 145)
{
pwmY = 97;
}
Assuming pwmX is your pan and pwmY is tilt for your "aiming" motors, 150 is the actual center value for they servos, and I don't know if there are some default variables for the pan and tilt servo values (I just thought they were pwm 1 and 2). Probably pretty inefficient code, but that basic idea?