Ok before you guys beat us up…please read the following:
Here is Kevin’s Navigation Script and the Default Camera Code from IFI in one program.
PS: Thank you Kevin for your responses and e-mail answers! Also thank you IFI for providing some default code to get started…
Before you get too excited, know this…
Just as the program sits now, it compiles to 30K of user memory. And we haven’t even begun to write any automous mode scripting.
Also, to even get it to compiled…we had to comment out sections of the code…
Basically look for this in user_routines.c
line 318 or so…in MPLAB IDE.
robot_control();
#if _USE_CMU_CAMERA
//auto_drive();
#else
//man_drive();
#endif
You’ll want to place robot_control(); function in drive.c
void auto_drive (void) section…
Also you’ll need to uncomment all the vision controls in drive.c
void auto_drive (void) section…
If you have enough space left, it might let you compile the code. Version 1.1 below will compile barely with enough space left. The changes we have described above are included in version 1.1. Basically start with version 1.1 below and you should be able to see the camera code and navigation code work independently of each other just as if you were downloading them separately.
thrust_1.1 version has all of the above ready to go.
We’ve tested this and each part works correctly, we’ve decided that we are not going to use both types of code because compiled as is, the program is 30K…good luck writting your automous mode with 2k left.
Kevin’s code complies to 20K and the camera code complies to 19K.
Together they are 30K.
Basically press the button PORT 1 to select a color, and you can still wait for the bump switch too from Kevin’s code. (If your not Camera code Enabled) We are using PWM 11 and PWM 12 with this code.
Anyway like we said, good luck if you plan on taking this approach. We pretty much have canned the idea after seeing the memory usage tonight so not much more time was spent on cleaning up this code to perfection. We hope there is enough code here for someone to pick it up and use it if you wish.
Team THRUST programmers can answer any questions you’d like to ask.
However you’ll have to come up with your own memory saving games.
Also when using the code, don’t forget to:
- TUNE your PID
- Set your encoder direction in encoder
- Set your drive motor direction in pid
- Set your wheelbase and encoder resolution
- Change your PWM values to your setting.
- Set your own color settings, (lighting varibles)
If you’re like us, you know what we are talking about if you’ve played with Kevin’s Navigation Script and the Camera code script independently.
We hope this helps someone…