|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Autonomous Mode
Hello.
For the camera to track, you need to copy the camera tracking stuff (ie. Camera_Handler and Servo_Track) from Process_Data_From_Master_uP to User_Autonomous_Code. PM me if you need more details. Good luck, Sam |
|
#2
|
|||
|
|||
|
Re: Autonomous Mode
hi! I put servo_track(), and camera_handler() in the autonomous code
Code:
while (autonomous_mode) /* DO NOT CHANGE! */
{
if (statusflag.NEW_SPI_DATA) /* 26.2ms loop area */
{
Getdata(&rxdata);
Camera_Handler();
Servo_Track();
// Turn on the "Switch 3" LED on the operator interface if
// the camera is pointed at the green light target. The
// Switch3_LED variable is also used by the Default_Routine()
// function below, so disable it inside Default_Routine()
// if you want to keep this functionality.
if(Get_Tracking_State() == CAMERA_ON_TARGET)
{
Switch3_LED = 1;
}
else
{
Switch3_LED = 0;
}
/* Add your own autonomous code here. */
if(Get_Tracking_State() == CAMERA_ON_TARGET)
{
static char oldpwm01, oldpwm02, oldpwm03, oldpwm04;
int slowpwm01, slowpwm02, slowpwm03, slowpwm04;
p.s. why does the autonomous mode need to be a large while loop? isn't it checked every cycle of the main function? so wouldn't it be easier to leave the up_master_data stuff out and just run autonomous from main.c Last edited by fallen751 : 05-02-2007 at 19:06. |
|
#3
|
|||||
|
|||||
|
Re: Autonomous Mode
There are a lot of while statements in that code that don't look at all right to me. For example,
Code:
while (PAN_SERVO > 130)
{
pwm01 = 147;
pwm02 = 147;
pwm03 = 147;
pwm04 = 147;
}
And then try changing those while statments into if statements, which is what it looks like they really ought to be. |
|
#4
|
|||
|
|||
|
Re: Autonomous Mode
just a hint. Try to stay away from while loops as previously mentioned. They mess with your code because othe essential functions are not able to be called when your code is in a while loop.
|
|
#5
|
|||||
|
|||||
|
Re: Autonomous Mode
Ifs and Elses are the key in FRC.
![]() |
|
#6
|
|||
|
|||
|
Re: Autonomous Mode
Don't forget to copy over all the includes at the top of user_routines dealing with the camera. IE tracking.h. You can just copy all the includes from user_routines to user_routines_fast if you wish.
|
|
#7
|
|||
|
|||
|
Re: Autonomous Mode
don't forget the switch statement, which can be more useful or better for use in autonomous.
|
|
#8
|
||||
|
||||
|
Re: Autonomous Mode
Quote:
Most of our routines end up looking something like: Code:
switch (auto_state) {
case INITIALIZE:
Auto_Initialize(); // Set up auto mode
auto_state=FASTASPPROACH
break;
case APPROACH:
// Code that drives towards goals quickly, and at some point
// resets auto_state to SCORE
break;
case SCORE:
// Score many points!
break;
case DONE:
default:
// do nothing!
break;
}
|
|
#9
|
||||
|
||||
|
Re: Autonomous Mode
Yeah, definately don't do loops in autonomous. The while loop in the default code provides the repeat. Just use if-elses to get one thing done before the next happens. That eliminates the possiblility of running into an error becuase the code takes too long to execute and fills the buffer. That would stop the bot cold for the entire match. (Beleive me, I've done it
![]() |
|
#10
|
||||
|
||||
|
Re: Autonomous Mode
Could someone please explain how to "switch" into autonomous mode without using a dongle. I want to test my autonomous code but haven't had time to make a dongle yet.
Thanks |
|
#11
|
|||||
|
|||||
|
Re: Autonomous Mode
Tether to your OI and make the Team number 0000.
|
|
#12
|
||||
|
||||
|
Re: Autonomous Mode
Thanks.
|
|
#13
|
|||||
|
|||||
|
Re: Autonomous Mode
Quote:
If everyone on your team is deathly afraid of soldering, you can buy a dongle from AndyMark. |
|
#14
|
||||
|
||||
|
Re: Autonomous Mode
Quote:
1. Make dongle. 2. Use dongle. Seriously, you really, really, should have a dongle with a disable switch handy when you test autonomous mode. 1 trip to Radio Shack and a half hour with a soldering iron is all it takes. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Autonomous Mode | Slick | Programming | 22 | 01-02-2007 19:26 |
| autonomous mode | seanl | Programming | 6 | 31-01-2007 15:59 |
| Autonomous mode | chs938 | Programming | 1 | 03-02-2006 10:19 |
| Autonomous Mode | David Bryan | Programming | 1 | 21-01-2003 21:15 |
| autonomous mode? | bigwalt | Technical Discussion | 1 | 21-01-2003 01:14 |