|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Getting the camera to work in autonomous
I've now got the camera working in human operated mode but when we switch over to autonomous nothing happens. I've also included tracking.h in user_routines_fast.c, Our code currently looks something like this:
Code:
Getdata(&rxdata);
Camera_Handler();
Servo_Track();
if (Get_Tracking_State == TARGET_IN_VIEW)
{
pwm13 = pwm15 = 170;
}
else
{
pwm13 = pwm15 = 127;
}
Generate_Pwms(pwm13,pwm14,pwm15,pwm16);
Putdata(&txdata);
|
|
#2
|
|||||
|
|||||
|
Re: Getting the camera to work in autonomous
Kevin's camera state handler (Camera_Handler(), I believe) wants to be called in the "slow loop" (every 26.2 ms). It counts how many times it has been called to determine how long it has been to determine if a time-out condition has occurred. Make sure your code is calling Camera_Handler() only when there is new data:
Code:
while (autonomous_mode) /* DO NOT CHANGE! */
{
if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */
{
Getdata(&rxdata); /* DO NOT DELETE, or you will be stuck here forever! */
/* Add your own autonomous code here. */
Camera_Handler();
Servo_Track();
///////////////////////////////////////////
//Add whatever code you want here.//
///////////////////////////////////////////
Generate_Pwms(pwm13,pwm14,pwm15,pwm16);
Putdata(&txdata); /* DO NOT DELETE, or you will get no PWM outputs! */
}
}
JBot Last edited by JBotAlan : 10-02-2007 at 19:23. |
|
#3
|
||||
|
||||
|
Re: Getting the camera to work in autonomous
I have the Camera_Handler() and Servo_Track() functions where you said to put them. I am using Kevin's bells and whistles code but when i enable debugging one of motors goes full forward and one goes full reverse (but that just could be because of how we have them mounted).
|
|
#4
|
|||||
|
|||||
|
Re: Getting the camera to work in autonomous
Quote:
). Just for now, comment any code that deals with the motors during auton. Look in the terminal window and see what you get. You need to know if the camera is still getting initialized like normal. If it is, the problem is with your drive code.My guess is that the camera is initializing fine, and as soon as it sees a target, it gives both motors 170, which, depending on your setup, motor polarity, transmissions, etc. might look like a full power spin. Try reversing one of the motors (it would be pwm15 = 84; I think). JBot |
|
#5
|
||||
|
||||
|
Re: Getting the camera to work in autonomous
It says Camera: Initialized abnormally with code. Unfortunatly I've had to leave our work area and won't be able to get back to the robot until monday so I won't be able to do any more testing.
|
|
#6
|
|||||
|
|||||
|
Re: Getting the camera to work in autonomous
Quote:
JBot |
|
#7
|
|||||
|
|||||
|
Re: Getting the camera to work in autonomous
Yes, there is a reason. Kevin didn't modify the autonomous function to use the interrupt-based PWM generation he included with the camera code. You need to replace the Generate_Pwms() call with PWM(pwm13,pwm14,pwm15,pwm16) instead.
|
|
#8
|
||||
|
||||
|
Re: Getting the camera to work in autonomous
Sorry I don't remeber what the code was. Though would you get a timeout error if the camera never starts searching?
|
|
#9
|
||||
|
||||
|
Re: Getting the camera to work in autonomous
When I first started playing with autonomous I just sent the motors full forward which only worked with generate_pwms and not PWM.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Getting the Camera out of Idle | Eclipse | Programming | 2 | 13-02-2007 04:06 |
| Camera did not work for well at the regionals, but worked great at home. | Alan Ing | Programming | 12 | 17-04-2006 17:43 |
| even simple autonomous code doesn't work?? | colman77 | Programming | 4 | 17-02-2006 23:58 |
| Getting the Camera and Default Code to Work | nukem | Programming | 5 | 18-01-2006 11:48 |
| Anyone get Autonomous mode to work? | Larry Barello | Control System | 4 | 13-01-2004 15:15 |