Go to Post "which came first, the hamster or the toad?" - dlavery [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 31-01-2007, 09:46
razer razer is offline
Registered User
FRC #1690
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Israel
Posts: 24
razer is an unknown quantity at this point
Help - Making the autonomous mode

Hi, this is my first year in the FIRST competition, and i dont know how to make an autonomous mode, i dont know where to write my code, and i dont know how to activate it at all. can someone tell me how can i do it?
1. where to write my code.
2. how to activate it.
3. a short example of it..

thanks, Nir.
  #2   Spotlight this post!  
Unread 31-01-2007, 10:00
whytheheckme's Avatar
whytheheckme whytheheckme is offline
Registered User
AKA: Jacob Komar
no team
 
Join Date: Feb 2006
Rookie Year: 2005
Location: Providence, RI
Posts: 1,320
whytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond repute
Send a message via ICQ to whytheheckme Send a message via AIM to whytheheckme Send a message via MSN to whytheheckme Send a message via Yahoo to whytheheckme
Re: Help - Making the autonomous mode

Check out this post I just replied to.

http://www.chiefdelphi.com/forums/sh...d.php?p=568759

--
Remember, If my posts are helpful, Good Rep is always Good
  #3   Spotlight this post!  
Unread 31-01-2007, 10:14
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Help - Making the autonomous mode

If you're using MPLab and the C18 compiler, you write your autonomous code in the User_Autonomous_Code(void) function found in the user_routines_fast.c file. Here's what it looks like in the default code:
Code:
/*******************************************************************************
* FUNCTION NAME: User_Autonomous_Code
* PURPOSE:       Execute user's code during autonomous robot operation.
* You should modify this routine by adding code which you wish to run in
* autonomous mode.  It will be executed every program loop, and not
* wait for or use any data from the Operator Interface.
* CALLED FROM:   main.c file, main() routine when in Autonomous mode
* ARGUMENTS:     none
* RETURNS:       void
*******************************************************************************/
void User_Autonomous_Code(void)
{
  /* Initialize all PWMs and Relays when entering Autonomous mode, or else it
     will be stuck with the last values mapped from the joysticks.  Remember, 
     even when Disabled it is reading inputs from the Operator Interface. 
  */
  pwm01 = pwm02 = pwm03 = pwm04 = pwm05 = pwm06 = pwm07 = pwm08 = 127;
  pwm09 = pwm10 = pwm11 = pwm12 = pwm13 = pwm14 = pwm15 = pwm16 = 127;
  relay1_fwd = relay1_rev = relay2_fwd = relay2_rev = 0;
  relay3_fwd = relay3_rev = relay4_fwd = relay4_rev = 0;
  relay5_fwd = relay5_rev = relay6_fwd = relay6_rev = 0;
  relay7_fwd = relay7_rev = relay8_fwd = relay8_rev = 0;

  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. */

        Generate_Pwms(pwm13,pwm14,pwm15,pwm16);

        Putdata(&txdata);   /* DO NOT DELETE, or you will get no PWM outputs! */
    }
  }
}
You activate the autonomous code by flipping the "autonomous" switch on your competition port dongle. (What? You don't have one? Make one using the information found at http://www.ifirobotics.com/docs/comp...guide-reva.pdf .)

I think a short example would be insufficiently helpful, and a helpful example would be insufficiently short. What you need to write depends on 1) what you want your robot to do, 2) how you want your robot to do it, and 3) exactly what sensors and motors your robot has connected.
  #4   Spotlight this post!  
Unread 31-01-2007, 10:41
Dave Scheck's Avatar
Dave Scheck Dave Scheck is offline
Registered User
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Feb 2003
Rookie Year: 2002
Location: Arlington Heights, IL
Posts: 574
Dave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond reputeDave Scheck has a reputation beyond repute
Re: Help - Making the autonomous mode

You may also want to check out the white paper entitled C Programming and Autonomous Modes for Newbies. It was written a few years ago, but it should still be pertinent.
  #5   Spotlight this post!  
Unread 31-01-2007, 16:13
mluckham's Avatar
mluckham mluckham is offline
Registered User
FRC #0758 (Sky Robotics)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2006
Location: Ontario, Canada
Posts: 116
mluckham will become famous soon enoughmluckham will become famous soon enough
Re: Help - Making the autonomous mode

We are using EasyC this year - I highly recommend it, as it eliminates a lot of programming "stuff" you have to know about. No need to know about .c/.h files, what goes where, yada-yada.

With EasyC, you put the autonomous code into the Autonomous() routine.
  #6   Spotlight this post!  
Unread 31-01-2007, 16:25
xrabohrok's Avatar
xrabohrok xrabohrok is offline
hunter of errors
FRC #1208 (The Metool Brigade)
Team Role: Programmer
 
Join Date: Jan 2006
Location: O'Fallon
Posts: 62
xrabohrok is an unknown quantity at this point
Re: Help - Making the autonomous mode

Keep in mind that the code is executed from top to bottom 32 times a second. This can really affect the coding process.
__________________
"It's programming's fault" may be a viable excuse for just about everything, except the robot falling apart.

It will 'cause it can!

constants aren't. variables won't.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Simulating autonomous mode - i need help!! :( itay_ms Programming 5 21-01-2007 11:28
Autonomous mode... to the max Total Meltdown Programming 16 18-01-2006 22:19
How do I enter the Autonomous mode? CompMaster Programming 5 17-02-2005 19:12
A little question about the autonomous mode Anton Programming 4 18-01-2005 14:08
counting in seconds for the autonomous mode?? Pattyta Programming 22 31-03-2004 12:55


All times are GMT -5. The time now is 10:43.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi