Go to Post If students and mentors own their role and are proud of it, the team is stronger as a consequence. - Madison [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 20-02-2007, 11:55
cerberus170 cerberus170 is offline
Registered User
FRC #0522
 
Join Date: Oct 2006
Location: Staten Island
Posts: 2
cerberus170 is an unknown quantity at this point
multiple autonomous modes using easyc

Does anybody know where to put code to detect a switch on our operator console that would select one of our multiple autonomous modes? We are programming in EasyC.

Thanks for any help.
  #2   Spotlight this post!  
Unread 20-02-2007, 12:14
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Re: multiple autonomous modes using easyc

You would need to wire the switch(s) to the joystick inputs on the OI. The OI uses standard analog PC game ports so you should be able to find what pin to connect to.

Once you have the switch connected you would read to value from it the same way you would read the joystick switches.

In autonomous you would just need an if-else if for each switch.
This code assumes you have switches wired to OI port 3 Trigger and Thumb/Top.
Code:
if(GetOIDInput(3,1))
{
  //first autonomous mode
}
else if(GetOIDInput(3,2)
{
  //second autonomous mode
}
....
If you are short on input, or need more than eight autonomous modes you could convert the switches to a binary number so you could get 4 options out of 2 switches or 16 from 4.
__________________
Eric Haskins KC9JVH

Last edited by EHaskins : 20-02-2007 at 12:15. Reason: typo
  #3   Spotlight this post!  
Unread 20-02-2007, 14:01
TubaMorg TubaMorg is offline
Programmermechanicalelect ricalcoach
AKA: Dan
FRC #1480 (Robatos Locos)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Houston
Posts: 450
TubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond repute
Re: multiple autonomous modes using easyc

Check this thread out (for one). If you search EasyC automonous you will find other threads as well.http://www.chiefdelphi.com/forums/sh...syc+autonomous

To do what you want you need to put a loop in the Initialize function block that takes user input while the robot is disabled BEFORE autonomous starts. The autonomous block isn't called until the field is enabled in autonomous, at which point user input is disabled (not to mention illegal).
  #4   Spotlight this post!  
Unread 20-02-2007, 15:01
Chief Samwize Chief Samwize is offline
Registered User
AKA: Sam
FRC #0051 (Wings of Fire)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Pontiac, MI
Posts: 171
Chief Samwize has much to be proud ofChief Samwize has much to be proud ofChief Samwize has much to be proud ofChief Samwize has much to be proud ofChief Samwize has much to be proud ofChief Samwize has much to be proud ofChief Samwize has much to be proud ofChief Samwize has much to be proud ofChief Samwize has much to be proud of
Re: multiple autonomous modes using easyc

Our programmer last year wrote a code using easyC to select multiple autonoumous modes. What you need to do is start by making a Auto_Select Fuction Block and putting it under Initialize. In it start with a while loop using a GetOIDInput command (While GetOIDInput(1,1) == 0). Inside the loop add a GetOIDInput of that same digital input. Outside the loop start a timer followed by a while command of that same Digital Input as the statement (While GetOIDInput == 1).

Inside that loop add a Get Timer Command and have it changed to one of your variables (in the bottom of the window that opens up.) Add an If statement that reads when that timer reaches 200 milliseconds go into the If statement. Then add another if statement reading that if a digitial input does not equal 0 (If GetOIDInput ==! 0) add 1 to a variable that you create. Then the timer needs to be set back to 0.

You also need to define a Max Autonomous Select so that you do not go over the number of autonomous modes you have. Outside of the last If statement you created make another If statement the reads that if your variable was incrimented and your max value was not exceded that your auto select max. Add an else statement with a user code that will set your value to 0 if you max value is exceded.

I'm sorry that it seems so unorginized in this post but the code I have is at school which won't be open until monday. If you can wait that long PM me and I'll try to send it to you. (I Probably forgot some of the code too sorry about that). Hope I can help.
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
Sample Autonomous Modes NextPerception Programming 9 03-01-2007 17:26
EasyC autonomous modes TubaMorg Programming 25 12-04-2006 22:53
Rookie autonomous modes StephLee General Forum 6 30-04-2005 13:16
Autonomous modes? Buster Robotics Education and Curriculum 4 17-03-2004 15:56
Alternative autonomous modes Jon Reese Programming 1 14-01-2004 13:17


All times are GMT -5. The time now is 11:01.

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