View Single Post
  #3   Spotlight this post!  
Unread 06-09-2006, 19:40
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
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,847
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: Autonomous enable/disable

The transmitter values come to the Master processor. It then forwards them to you via the GetData call.
When you tell the Master processor you want to be in autonomous mode, using the txdata.user_cmd setting, you are instructing the master processor to ignore the normal inputs it receives from your transmitter. The Master processor will send you a neutral packet of data until your code changes txdata.user_cmd back. No matter what you do with the transmitter from then on you will never again receive any data originating from it. So flipping the transmitter controls will do nothing for you.

I can think of a couple of options to get around this lack of transmitter data.

If you are willing to leave the transmitter on then you can use the signal you guys were talking about. For instance, do autonomous stuff if a channel 6 button is pushed rather than use the txdata.user_cm at all.

If you want to go autonomous when the robot gets cut off from transmissions, then set txdata.user_cmd when your signal value goes to neutral (Master sets it when the transmitter signal is lost), to come out of it you could periodically stop, set txdata.user_c back to the default value temporarily, test for valid transmitter data, then if no signal is received return to autonomous operation. It takes around 15 data packets (or slow loops) for contact to be reestablished though.

P.S.
I seem to remember an interesting side effect of setting txdata.user_cmd on the fly. If your code sets txdata.user_cmd while receiving valid transmitter data, the GetData packet retains the last known transmitter values and your code keeps receiving it. The Master doesn't set the packet to neutral for some reason.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 06-09-2006 at 20:00.
Reply With Quote