Hmm... I'm trying to get the servos to turn while tracking and I fail every time:
If I use camera_find_color and then set servos, it stops finding color.
If I use camera_stop(), camera_set_servo(), camera_find_color() then it resets to center because that's what camera_find_color() does.
If I put all the color init code at the beginning, and then only run the TC command at the time, then stop it, it doesn't recieve updates:
Code:
///// For some reason camera_track_update() returns 0 unless I call reset before I send the TC command.
static int counter=0;
if (camera_track_update()) {
// updated
} else {
// no update
}
counter++;
if (counter>15) {
counter=0;
camera_stop(); // in user_camera
camera_set_pan_servo(...); // sends "SV 0 xxx"
// camera_reset(); // If I call this then it works, but keeps jumping to the center servo position.
camera_track_continue(); // function that just sends "TC ... ... ..."
}
I wrote this from memory since I don't have access to the other computer, but it is the general idea (check for updates, stop, turn, track).
I am sure that the individual camera_ functions work as they work when not setting the servo, and the servos move but don't track. But the combination causes it ot not reply with a "T ... ..." packet.
Also, I read something about poll mode ("PM 1") I tried this and it still did not recieve packets. Have any of you had this method work?
Maybe I have to call the TC command twice. (I remember having to click the button twice in the java program to retart the tracking...?
I could also try using HyperTerminal and pasting in all the stuff that it would have sent from the RC.
Do you have any ideas about what works for you?
If I can't figure it out, it won't hurt the time very much to actually turn the entire robot instead (pwm01=80;pwm02=-80;

)