Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   EasyC autonomous modes (http://www.chiefdelphi.com/forums/showthread.php?t=44749)

BradAMiller 27-02-2006 08:34

Re: EasyC autonomous modes
 
All I can say is too cool, too elegant, and too late at night.

Thanks for fixing the example.

JJMax7 09-03-2006 15:15

Re: EasyC autonomous modes
 
Can't you also just put a couple of switches right on the robot using the digital in ports. That way they can be read right at the begining of autonomous mode. Rather than risking getting stuck. This is what my team plans on doing. Hopefully it won't have too many bugs to have to deal with.

Dillon Compton 09-03-2006 17:03

Re: EasyC autonomous modes
 
Quote:

Originally Posted by JJMax7
Can't you also just put a couple of switches right on the robot using the digital in ports. That way they can be read right at the begining of autonomous mode. Rather than risking getting stuck. This is what my team plans on doing. Hopefully it won't have too many bugs to have to deal with.

That should also be fine JJ- I prefer having the auton. mode set at the OI, but either way will work, provided the code is properly written.

Dad1279 09-03-2006 19:00

Re: EasyC autonomous modes
 
Quote:

Originally Posted by JJMax7
Can't you also just put a couple of switches right on the robot using the digital in ports. That way they can be read right at the begining of autonomous mode. Rather than risking getting stuck. This is what my team plans on doing. Hopefully it won't have too many bugs to have to deal with.

To keep it simple, and use only one port, we use a radio shack 6 position switch, with 5 resistors as dividers connected to an analog input on the RC.

Dillon Compton 06-04-2006 12:09

Re: EasyC autonomous modes
 
Hmm. I attempted to use the code on the first page, after all the bugs were worked out and all, and it wont display to my userbyte on the OI- any ideas?

TubaMorg 06-04-2006 17:43

Re: EasyC autonomous modes
 
Quote:

Originally Posted by Dillon Compton
Hmm. I attempted to use the code on the first page, after all the bugs were worked out and all, and it wont display to my userbyte on the OI- any ideas?

Well my final version worked ok so here it is:

Code:

while ( !IsEnabled() )
      {
            p4_trig = GetOIDInput ( 4 , 1 ) ;
            if ( p4_trig )
            {
                  if ( autoProgram < 8 )
                  {
                        autoProgram ++ ;
                  }
                  else
                  {
                        autoProgram = 0 ;
                  }
                  while ( p4_trig )
                  {
                        p4_trig = GetOIDInput ( 4 , 1 ) ;
                  }
            }
            SetUserDisplay ( autoProgram ) ;
      }

Uh, just to ask a dumb question: Did you switch the OI to u-mode? I'm sure you did, just checking though. Also make sure the variable "autoProgram" is set as a global unsigned char.

Kingofl337 07-04-2006 13:19

Re: EasyC autonomous modes
 
IS the OI set in the correct mode. Eg when you get set to user mode it should
first display u012 then u000 until you chage modes.

lynca 09-04-2006 11:24

Re: EasyC autonomous modes
 
When configuring globals to be either on or off (i.e. only two conditions) such as the "isEnabled" global mentioned above. You might want to instead use a

#define ISENABLED 1 // instead of defining a global

//later in the program put
#ifdef ISENABLED
//put autonomous code here
#endif

This page is a good tutorial on using MACROS, http://vergil.chemistry.gatech.edu/r...al/basic2.html

TubaMorg 09-04-2006 13:13

Re: EasyC autonomous modes
 
Quote:

Originally Posted by lynca
When configuring globals to be either on or off (i.e. only two conditions) such as the "isEnabled" global mentioned above. You might want to instead use a

#define ISENABLED 1 // instead of defining a global

//later in the program put
#ifdef ISENABLED
//put autonomous code here
#endif

This page is a good tutorial on using MACROS, http://vergil.chemistry.gatech.edu/r...al/basic2.html

Pretty good advice if not using EasyC, which is what this discussion is about.

P1h3r1e3d13 12-04-2006 01:06

Re: EasyC autonomous modes
 
I believe that all your creative solutions using !IsEnabled() are actually moot.

Input from the competition port overrides code loops. In other words, even if you have a while(1) in your autonomous code, when your dongle (or whoever's running the match) switches off autonomous, your code drops whatever it's doing, and the Operator Control code starts.

Our code has a while(1) in Autonomous() and it works fine. I can't remember if I've tried it in Initialize(), but I have every reason to think it should work the same. Still, test it with a dongle, just to be triple sure.


On the other hand, the simple way (the way I used) is to have a switch (or several, or an analog input as described above), set it before you power on the bot, and just read it once (no loops).

Dillon Compton 12-04-2006 22:53

Re: EasyC autonomous modes
 
The advantage to this is that it allows us to use the pre-existing joystick; something I much prefer. I got this working on last years robot, so it should be fine; no reason to mess with the safety measures in place- redundancy is my friend. I'd rather have something I know that I wrote backing it up than mystical field-happenings.

Thanks for the info, nonetheless.


All times are GMT -5. The time now is 23:05.

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