Go to Post It is hard to write code that conforms to a standard that isn't published... - AustinSchuh [more]
Home
Go Back   Chief Delphi > Other > VEX
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 05-09-2006, 16:18
Culvan Van Li's Avatar
Culvan Van Li Culvan Van Li is offline
Jack-Of-All-Trades
AKA: Andy
FRC #1939 (Kuh-Nig-Its)
Team Role: Engineer
 
Join Date: Sep 2006
Rookie Year: 2006
Location: Kansas City, MO
Posts: 36
Culvan Van Li is on a distinguished road
Autonomous enable/disable

I'm new to the VEX system. I've searched through the forums but I haven't found what I'm looking for. I'm programming the VEX kit using MPLAB. I'm trying to build a personal project using a VEX kit. I'd like the robot operate autonomously unless the RC is turned on. When it detects a good signal from the RC I'd like it to come out of autonomous mode so it can be controlled by the RC.

Is there any easy way to do this? I know that "txdata.user_cmd = 0x02;" enables autonomous mode and disables the RC.

I've noticed that VEX has a light to indicate when it has a good signal from the RC. Does anyone know how to detect a good RC signal in software?

Thanks for the help.

Andy
Reply With Quote
  #2   Spotlight this post!  
Unread 05-09-2006, 16:40
artdutra04's Avatar
artdutra04 artdutra04 is offline
VEX Robotics Engineer
AKA: Arthur Dutra IV; NERD #18
FRC #0148 (Robowranglers)
Team Role: Engineer
 
Join Date: Mar 2005
Rookie Year: 2002
Location: Greenville, TX
Posts: 3,078
artdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond reputeartdutra04 has a reputation beyond repute
Re: Autonomous enable/disable

Quote:
Originally Posted by Culvan Van Li
I'm new to the VEX system. I've searched through the forums but I haven't found what I'm looking for. I'm programming the VEX kit using MPLAB. I'm trying to build a personal project using a VEX kit. I'd like the robot operate autonomously unless the RC is turned on. When it detects a good signal from the RC I'd like it to come out of autonomous mode so it can be controlled by the RC.

Is there any easy way to do this? I know that "txdata.user_cmd = 0x02;" enables autonomous mode and disables the RC.

I've noticed that VEX has a light to indicate when it has a good signal from the RC. Does anyone know how to detect a good RC signal in software?
If you are not using one of the channels on the Transmitter to control the robot, offset the trim on that channel, so that the neutral band on that channel is somewhere in the 90s or 160s on the 0-255 PWM scale. Then in the code, program in that if it ever sees a signal coming from that specific channel in the same range where you offset the trim, you know the Transmitter must be on. (Otherwise, everything defaults to 127.)
__________________
Art Dutra IV
Robotics Engineer, VEX Robotics, Inc., a subsidiary of Innovation First International (IFI)
Robowranglers Team 148 | GUS Robotics Team 228 (Alumni) | Rho Beta Epsilon (Alumni) | @arthurdutra

世上无难事,只怕有心人.
Reply With Quote
  #3   Spotlight this post!  
Unread 06-09-2006, 01:11
Culvan Van Li's Avatar
Culvan Van Li Culvan Van Li is offline
Jack-Of-All-Trades
AKA: Andy
FRC #1939 (Kuh-Nig-Its)
Team Role: Engineer
 
Join Date: Sep 2006
Rookie Year: 2006
Location: Kansas City, MO
Posts: 36
Culvan Van Li is on a distinguished road
Re: Autonomous enable/disable

Clever, it's like a dead man's switch. You could make a robot that could identify when it's been driven out of range and program it to drive back.

For some reason I can't get it to work. It seems like it stops paying attention to the RC as soon as it loses signal. It won't drive the motors without an RC signal unless it is actually in autonomous mode.

Anyone else have some ideas?

Andy
Reply With Quote
  #4   Spotlight this post!  
Unread 06-09-2006, 19:40
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,800
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
  #5   Spotlight this post!  
Unread 21-09-2006, 13:03
Culvan Van Li's Avatar
Culvan Van Li Culvan Van Li is offline
Jack-Of-All-Trades
AKA: Andy
FRC #1939 (Kuh-Nig-Its)
Team Role: Engineer
 
Join Date: Sep 2006
Rookie Year: 2006
Location: Kansas City, MO
Posts: 36
Culvan Van Li is on a distinguished road
Re: Autonomous enable/disable

Thanks for the help. This code is working now. I setup counters to handle the state changes. I have to set the motors to 128 for 5 cycles during the transition to prevent little hiccups. You were also right that it takes about 15 cycles for the controller to find the transmitter. The down side is that the autonomous mode stops for about a 3rd of a second ever few seconds to check for the transmitter. Because it's easy to detect the loss of transmitter there's no problem while I've got the transmitter on.

Let me know if you think of a way to do this on the fly so I don't have the downtime in my autonomous mode.

Andy
Reply With Quote
Reply


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
Bypass Disable Switch jakep Control System 36 19-08-2006 12:46
Question about human disable Collmandoman Programming 6 10-03-2005 23:30
enable interrupt Dean Programming 2 13-02-2005 07:37


All times are GMT -5. The time now is 03:55.

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