Go to Post It's not easy dealing with the reality that others aren't as passionate as we are and that the process may be slower than we want it to be - but it gives me plenty of time to think and prepare. - JaneYoung [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 26-04-2004, 15:53
Mr. Lim Mr. Lim is offline
Registered User
AKA: Mr. Lim
no team
Team Role: Leadership
 
Join Date: Jan 2004
Rookie Year: 1998
Location: Toronto, Ontario
Posts: 1,125
Mr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond repute
Re: Multiple Auton's

Quote:
Originally Posted by Joe Clohessy
I was wondering of a way to do multiple auton modes. Please if you have any proven information let me know either in a PM or Email DragonMan@si.rr.com .


Can someone tell me why this theory wouldnt work ??
Does anyone have an auton mode that has a switch to change between modes that I can look at and pick apart. Thankyou
Joe, your theory should work just fine. We also used switches to customize our autonomous mode. We could use switches to determine which side of the field we started on, what path to drive, and whether to do it in high gear or low gear. It was all configurable on the field, so our autonomous mode selection was a match-time decision, often based on who was lined up opposite from us.

The code is pretty much what you have above, albeit much uglier. This is an earlier copy that wasn't cleaned up.

Cheers!

Code:
void User_Autonomous_Code(void)
{	
	static unsigned int auton_status = 0;
	static unsigned char left_set; // left motor speed set-point
	static unsigned char right_set; // right motor speed set-point
	static unsigned int counter; // used to take snapshot of clock for dead-reckoning moves
	unsigned int pressure;
	
	
  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! */
		
		relay2_fwd=1; //turns brake off.....

		if (Clock > Old_Clock) // Old_Clock and Clock are serviced by the IR Timer - this line ensures a new IR cycle has occured
		{
			Old_Clock = Clock;
			switch (auton_status)
			{
				case 0: 
					Left_Encoder_Count = 0;
					counter = Clock;
					left_set = 127;
					right_set = 127;
					relay2_fwd = 1;
					if (rc_dig_in10)
					{ 
						relay5_fwd=1;
					}
					else
					{
						relay5_fwd=0;
					}
					auton_status++;
					break;
			
			case 1:

		
		if (rc_dig_in11)

		{ 
			if ((Clock - counter) < 384) //this stops the robot in low gear right in front of the goal
					
					{
						left_set = 255;
						right_set = 225;//fudge factor
					}
				
					else 
					{
						left_set = 127;
						right_set = 127;
					    counter = Clock;
					}
					break;
		}

	
	

		if (rc_dig_in12)
		
		{	
			if ((Clock - counter) < 460) //this makes the robot hit the goal and go straight 3/4 of the way
					{
						left_set = 255;
						right_set = 225;//fudge factor
					}
				
					else 
					{
						left_set = 127;
						right_set = 127;
						counter = Clock;
					}
					break;

		}


		if (rc_dig_in13)

		{
				if ((Clock - counter) < 576) // rush down to the other end of the feild hitting the goal HIGH GEAR
					{
						left_set = 255;
						right_set = 255;
					}
				
					else 
					{
						left_set = 127;
						right_set = 127;
						counter = Clock;
					}
					break;
		}


		if (rc_dig_in14)

		{
				if ((Clock - counter) < 396) //stop beside the mobile goal,
						
						left_set = 225;
						right_set = 225;
					}
				
					else 
					{
						left_set = 127;
						right_set = 127;
					   	counter = Clock;
						auton_status=2;
					}
					break;
				
				case 2:
				
				if ((Clock - counter) < 15) //turn to face right back at you.
					{
						left_set = 0;
						right_set = 255;
					}
				
					else 
					{
						left_set = 127;
						right_set = 127;
					   	counter = Clock;
						auton_status=3;
					}
					break;
			
				case 3:
				
				if ((Clock - counter) < 10) //positions itself behind the goal
					{
						left_set = 255;
						right_set = 225;
					}
				
					else 
					{
						left_set = 127;
						right_set = 127;
						counter = Clock;
						auton_status=4;
					}
					break;

				case 4:
		
				if ((Clock - counter) < 15) //positions itself behind the goal
					{
						left_set = 0;
						right_set = 225;
					}
				
					else 
					{
						left_set = 127;
						right_set = 127;
					    	counter = Clock;
						auton_status=5;
					}
					break;
				
				case 5:
		
				if ((Clock - counter) < 384) //positions itself behind the goal
					{
						left_set = 255;
						right_set = 225;
					}
				
					else 
					{
						left_set = 127;
						right_set = 127;
					    	counter = Clock;
					}
					break;
				
		
		}

		
			}
		}
		
		// Carol's cubic transfer function that desensitizes small movements, but still allows full speed
		temp_p1_y = (signed long)left_set - 128;
	    pwm01 = (unsigned char)(((temp_p1_y * temp_p1_y * temp_p1_y)  >> 14) + 128);
  		temp_p2_y = (signed long)right_set - 128;
  		pwm02 = (unsigned char)(((temp_p2_y * temp_p2_y * temp_p2_y)  >> 14) + 128); 
		
		

// Run compressor
		  pressure = Get_Analog_Value(rc_ana_in16);
		  
		  if (pressure < 800)
		  	relay6_fwd = 1;
		  else if (pressure > 925)
		  	relay6_fwd = 0;

		// Get all 6 drive motors working together		
		pwm03 = pwm01;
  		pwm05 = pwm01;
  		pwm04 = pwm02;
  		pwm06 = pwm02;
        Putdata(&txdata);   /* DO NOT DELETE, or you will get no PWM outputs! */
    }
  }
  #2   Spotlight this post!  
Unread 26-04-2004, 17:25
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,808
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Multiple Auton's

Here are two ways teams I helped accomplished it this year.

1) Use a BCD style rotary switch available from Digi-Key (hooked to digital input pins 15-18 in this case). 16 choices using 4 digital input pins or 8 choices using 3 pins. The extra selections were used for diagnostic software rather than have so many autonomous programs.
Code:
static unsigned int swtc; //set equal to the switch input
 
swtc = PORTJ>>4; // Auto select switch 0-15
switch(swtc) 
{
	case 0: 
	default:
		AUTO_0();
		break;
 
	case 1: 
		AUTO_1();
		break;

}

2) Use a regular Radioshack style mechanical rotary switch. In this case a 6-position switch hooked to digital input pins 11-16.
Code:
if (!rc_dig_in11)
{
	 Auto_1();
}
else if (!rc_dig_in12)
{
	 Auto_2();
}
...
else
{
	 Auto_1();
}
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 26-04-2004 at 17:29.
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
multiple definition error in MCC/Linker (possible bug?) wun Programming 5 01-04-2004 17:49
Multiple programs/autonomous routines galewind Programming 12 09-01-2004 22:25
question for teams created among multiple high schools archiver 2001 20 24-06-2002 03:58
multiple e-mail notifications srawls CD Forum Support 3 23-05-2002 12:55
Multiple Regional Winners and a little jab JamesJones General Forum 32 10-04-2002 23:38


All times are GMT -5. The time now is 06:31.

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