View Single Post
  #4   Spotlight this post!  
Unread 29-01-2006, 18:49
kaszeta's Avatar
kaszeta kaszeta is offline
Registered User
FRC #0095 (Grasshoppers)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Lebanon, NH
Posts: 334
kaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of light
Re: Problems Combining Camera Code and Driving Code

Quote:
Originally Posted by cmurdoch
I have both the camera code and the driving code working independently , but I've been having some trouble combining them. I've added both user_SerialDrv.c and user_SerialDrv.h to the camera code and uncommented the IFI code in user_routines.c as well as in user_routines_fast.c. I've also tried to change the pwm output assignments of either our two drive motors or the camera servos. When I left the servos on pwm01 and pwm02 and changed the pwms for the motors the camera worked and the driving didn't. When I switched them the driving worked and the camera didn't, in fact, the camera just sat there and twitched. Then, I assigned the servos to pwm01 and pwm02 and the motors to pwm05 and pwm06. The camera froze in home position and the driving worked for about 30 seconds before halting and displaying a code error. If anyone has any idea how I can fix this I'd really appreciate it.
I see two likely problems with what you are doing:

(1) As Kevin says, the camera's serial code needs serial.c and serial.h from his code, and not the user_SerialDrv.c/h. You need to remove those from the project.

(2) Similarly, Kevin's serial code requires the interrupt routines in user_routines_fast.c to be correct (if you don't have this correct, you'll get the red light of death). If you aren't using other special interrupt code (encoders or the gyro), just copy user_routines_fast.c from Kevin's camera code and try that. Otherwise, you'll have to make sure all the appropriate interrupt handlers are in place for all the codes you are using. This can be done, our bot's testbed code now has the camera, gyro, shaft encoders, and two additional ADC channels running at the same time, but it's tricky and requires careful reading of the adc_readme.txt, encoder_readme.txt, camera_readme.txt, etc. (And we didn't get it right the first time, as you can see if you look the other places I've posted).