Go to Post Roses are red/Violets are blue/I'll write a poem/Once build season's over. - Taylor [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 16-02-2008, 19:41
theprogrammer theprogrammer is offline
Registered User
FRC #1982
 
Join Date: Feb 2008
Location: Shawnee
Posts: 4
theprogrammer is an unknown quantity at this point
IR button coding rules

im currently working on our hybrid code and im not sure if this is legal

else if(rc_dig_in08 ==1 )
{
pwm05 = 255;
if(rc_dig_in09==1&&rc_dig_in10==1)
{
while(counter1<=15)
{
pwm03 = 200;
}
pwm03 = 127;
while(counter2<=10)
{
pwm01 = 255;
pwm02 = 0;
}
the buttons are supposed to do the same thing every time. All I really need teh button to do is to move the motor connected to pwm05, should i reposition the rest of the code so that its legal or am i fine as it is?
The only thing the button actually needs to do is activate the pwm05 motor, the rest of it triggers from both of our digital pressure switches returning positive.
Thanks in advance

Last edited by theprogrammer : 17-02-2008 at 12:42. Reason: further explanation
  #2   Spotlight this post!  
Unread 17-02-2008, 13:47
RyanW RyanW is offline
Registered User
FRC #0449 (Blair Robot Project)
Team Role: Programmer
 
Join Date: Feb 2007
Rookie Year: 2007
Location: MD
Posts: 40
RyanW has a spectacular aura aboutRyanW has a spectacular aura about
Re: IR button coding rules

Well, first of all, pwm03 is going to be 127 no matter what counter1 is. You set it to 200, and then immediately to 127 in the same method. It's either going to stall back and forth for 15 loops (if you're using something like WPILIB which calls GetData and PutData in the middle of your routines) or else just stay at 127.

Beyond that,
If you're using rc_dig_in08 to 11 as your IR buttons, this isn't legal. Any individual IR command should only make reference to one of the buttons, UNLESS you use combinations of buttons to minimize interference, and still send EXACTLY four commands. So you need to move if(rc_dig_in09==1&&rc_dig_in10==1) out of your else if.

You're allowed to use timers in your command - you're allowed to use pretty much whatever you want in your command - BUT it has to be internal to the command, or else directly based on sensor inputs from the robot. So if you tell it "Drive straight", and it sees that there's a wall, it can stop based on that information. Your counters are fine as long as they're initialized in the same IR command.
  #3   Spotlight this post!  
Unread 17-02-2008, 13:52
EricH's Avatar
EricH EricH is online now
New year, new team
FRC #1197 (Torbots)
Team Role: Engineer
 
Join Date: Jan 2005
Rookie Year: 2003
Location: SoCal
Posts: 19,789
EricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond repute
Re: IR button coding rules

Quote:
Originally Posted by RyanW View Post
Beyond that,
If you're using rc_dig_in08 to 11 as your IR buttons, this isn't legal. Any individual IR command should only make reference to one of the buttons, UNLESS you use combinations of buttons to minimize interference, and still send EXACTLY four commands. So you need to move if(rc_dig_in09==1&&rc_dig_in10==1) out of your else if.
Sorry, but the bold portion is out. The Q&A has long since eliminated this, as has Update #3. No sequences of buttons.
__________________
Past teams:
2003-2007: FRC0330 BeachBots
2008: FRC1135 Shmoebotics
2012: FRC4046 Schroedinger's Dragons

"Rockets are tricky..."--Elon Musk


Last edited by EricH : 17-02-2008 at 15:37.
  #4   Spotlight this post!  
Unread 17-02-2008, 14:05
RyanW RyanW is offline
Registered User
FRC #0449 (Blair Robot Project)
Team Role: Programmer
 
Join Date: Feb 2007
Rookie Year: 2007
Location: MD
Posts: 40
RyanW has a spectacular aura aboutRyanW has a spectacular aura about
Re: IR button coding rules

Maybe I've been misunderstanding GDC's responses...

According to http://forums.usfirst.org/showthread.php?t=8575 and http://forums.usfirst.org/showthread.php?t=8270, this would not be allowed. I had read some of these posts, but there is some contradictory information.

The following post: http://forums.usfirst.org/showthread.php?t=8314 says that you can use commands to set registers, which would then execute four different commands. This is what I was thinking of when I made the statement quoted above.
  #5   Spotlight this post!  
Unread 17-02-2008, 15:17
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,521
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: IR button coding rules

>>you can use commands to set registers, which would then execute four
>>different commands.

You may be confused. You can not change which commands your 4 IR buttons perform during a match. I.e., if IR button 1 is "move forward", you cannot use another button to change your command set so that the IR button later means "move backward". You also cannot toggle state like this "Press once, go forward. Press again, stop. Press again, go backwards. Press again, stop."

You MAY change what your four buttons do in between matches, assuming you have your index cards filled out with the 4 (four) (IV) commands that the buttons will perform.

Note this part of the GDC response:

>>If there was a one-to-one mapping between the transmitted functions/register settings and the resulting
>>commands/actions, then it would satisfy the signaling requirements.

The rules, as spelled out by the GDC, are extremely clear. One button, one command. It always does the same thing during that particular match.
  #6   Spotlight this post!  
Unread 17-02-2008, 15:41
theprogrammer theprogrammer is offline
Registered User
FRC #1982
 
Join Date: Feb 2008
Location: Shawnee
Posts: 4
theprogrammer is an unknown quantity at this point
Re: IR button coding rules

actually, pwm03 is set to 167 as default because the associated motor doesnt have enough torque to keep our arm in place at neutral so setting it to 127 moves the arm downwards. As for the dig_ins for the IR, we're using 5-8 not 8-11. Also the counters have been changed to Get_Encoder_1-3_Counts which is currently giving us trouble. the dig_ins 9 and 10 arent IR but regular switches mounted inside our claw to tell wether or not its currently gripping a ball.

We are encountering a new problem regarding gear counters, we're using kevins encoder code, it compiles fine but when we try and use code involving the GTS's, we get the red light of doom in programming state meaning there is probably a paradox somewhere that i can't find.
  #7   Spotlight this post!  
Unread 18-02-2008, 11:20
jacobhurwitz jacobhurwitz is offline
Registered User
FRC #0449 (Blair Robot Project)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Maryland
Posts: 45
jacobhurwitz has a spectacular aura aboutjacobhurwitz has a spectacular aura aboutjacobhurwitz has a spectacular aura about
Re: IR button coding rules

We've found that interference can sometimes be a problem. To cut down interference, we were thinking about having to press a sequence of buttons. For example, AAA might do action 1, AAB for action 2, ABA for action 3, and ABB for action 4. Thus, a team would have to press a number of buttons in order for our robot to be accidentally controlled by another team. This seems to violate one rule (cannot use buttons in a sequence) but, as GDC said, there is a one-to-one mapping (and only *four* possible end results). Would this be allowed?
  #8   Spotlight this post!  
Unread 18-02-2008, 11:56
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,521
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: IR button coding rules

Requiring sequenced keypresses is explicitly disallowed.
  #9   Spotlight this post!  
Unread 18-02-2008, 21:11
RyanW RyanW is offline
Registered User
FRC #0449 (Blair Robot Project)
Team Role: Programmer
 
Join Date: Feb 2007
Rookie Year: 2007
Location: MD
Posts: 40
RyanW has a spectacular aura aboutRyanW has a spectacular aura about
Re: IR button coding rules

Sorry, I guess I misread their response. I interpreted "one-to-one mapping" as "You still can't have more than four commands." Upon rereading, it looks like even what I was describing wouldn't be allowed - you can set variables, but each individual button can only be used to set one thing. Apparently, that hasn't been drummed into my head enough times - even with having to correct other people about it!

Jacob, one-to-one mapping seems to be between variables and results, not between command sets and results. You could set A, B, C, and D, and then have your code execute a different method depending on which of those was true. You couldn't set A and B, and then execute methods based on AA vs. AB vs. BA vs. BB
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
Infrared button rules duhoverdrive Programming 1 26-01-2008 14:26
C coding ExarKun666 General Forum 12 21-12-2007 14:13
Photoswitch coding magical hands Programming 0 17-01-2006 21:20
coding a potentiometer incognito_NICK Programming 5 14-02-2005 15:56
Coding conventions Anthony Kesich Programming 20 08-01-2004 10:50


All times are GMT -5. The time now is 00:59.

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