Ugh. Fir the past 3 years I’ve been trying to get the camera to track the light, and every year I just can’t get it. This year I managed to get the camera to recognize the color and track it, but I can’t get the servos to move it. I download the easyC camera test program and downloaded to the robot, but it doesn’t seem to do anything. I set the variables for the left and right drive motors equal to the respective PWM ports, but I can’t seem to find where the pan and tilt servo pwm ports are defined. When I download the program to the bot, it doesn’t do anything. In autonomous, neither the servos nor the wheels move, and in regular mode the joystick has no control over the wheels; the bot is just dead.
I’m at a loss right now. I don’t know what I’m supposed to do with the program or how it’s supposed to work. Furthermore, I have no desire to do programming this year, but unfortunately I’m the only person on the team who knows how to and I have to train younger members how to.
for easyc code, servo ports 10 and 11. for kevins code, 1 and 2
I managed to hack around with the given code, and got it to track pretty easily. Don’t expect everything to be given to you, and read some more about C. It’s a fairly complex language, but extremely powerful
I’m having a very similar problem…
the camera follows the light… but how do i get the whole robot to go twoards the light, and still be able to change direction or stop when it gets close?
after messing with the camera some, the camera will return the values for the servos… now that u have the values, you need to determine the angles and have the robot to move according to those values, I do not have the code to look at now, but when i get a chance I will post some code snippits that might help
It’s probably the easiest to drive with the centroid value. So, in easyC you can use the two/four wheel wheel drive function and in MPLAB you can using the mixing value.
If you do:
Set you gain low and work your way up. Your robot should drive to
the target with this. Your best is to only have it track only one thing at a time. Center - Drive - Center - Drive…
QUOTE=AdmiralAllen;555954]I’m having a very similar problem…
the camera follows the light… but how do i get the whole robot to go twoards the light, and still be able to change direction or stop when it gets close?
Do you have the backup battery installed? The blue one. The servos are not powered unless the backup battery is installed. The 12V supply to the RC does not power the servos.