View Single Post
  #8   Spotlight this post!  
Unread 06-03-2006, 14:32
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,797
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: Disabling the Radio Control

Quote:
Originally Posted by Guy_E
So I should sample my sensors in "Process_from_local_IO" and change the motors in "User_Autonomous_Code"?

I just need to call "Process_from_local_IO" from the "User_Autonomous_Code"?

But can I do it all in the "Process_from_local_IO" or will it "confuse" the CPU?
The way the default Vex code is organized you have to add Process_From_Local_IO to the auto loop in User_Autonomous_Code, if you want it to be called while you're running autonomously. Be careful where you place it though. I actually get rid of this autonomous loop altogether and depend instead upon the main loop in main.c, but that's only a personal choice.
Code:
  while (autonomous_mode)   /* DO NOT CHANGE! */
  {
	if (statusflag.NEW_SPI_DATA)	  /* 18.5ms loop area */
	{
	  Getdata(&rxdata);   /* DO NOT DELETE, or you will be stuck here forever! */
	 /* Add your own code here. */
	  printf("%2x : %2x %2x %2x %2x %2x %2x\n",(int)rxdata.rc_receiver_status_byte.allbits,
		(int)PWM_in1,(int)PWM_in2,(int)pwm01,(int)pwm02,(int)pwm03,(int)pwm04);
	  Putdata(&txdata);   /* DO NOT DELETE, or you will get no PWM outputs! */
	}
	Process_Data_From_Local_IO();
  }
If you want to you can set the variables used for the motors as fast as you like (in Process_From_Local_IO for instance), just realize only the values in there at the time of the slow loop will be acted upon. If you're constantly setting the motors to the same value then it won't matter to you.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote