Go to Post Due to risk of unforseeable consequences, teams may not initiate a wormhole for the purpose of scoring ringers from past or future matches. - Richard Wallace [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-01-2005, 08:35
schenkin schenkin is offline
Registered User
#0486
 
Join Date: Jan 2005
Location: Strath Haven High School
Posts: 17
schenkin is on a distinguished road
Using Custom Inputs on the Controller Board

Hey

I want to use custon imports on the controller board to choose which color the robot should look for. I plan on using 2 switches and using the four possible possitions as four possible options (Yellow, Red, Green, Off)

How do I call on these inputs in the code. I figured I would us one of the joystick inputs and use my owm cable, but how do I tell the code where to pull the info from?

--Sam
--Team 486
--Positronic Panthers
  #2   Spotlight this post!  
Unread 26-01-2005, 08:44
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: Using Custom Inputs on the Controller Board

Quote:
Originally Posted by schenkin
Hey

I want to use custon imports on the controller board to choose which color the robot should look for. I plan on using 2 switches and using the four possible possitions as four possible options (Yellow, Red, Green, Off)

How do I call on these inputs in the code. I figured I would us one of the joystick inputs and use my owm cable, but how do I tell the code where to pull the info from?

--Sam
--Team 486
--Positronic Panthers
I suggest that you install switches for use during autonomous mode on the robot and wire them into the digital inputs on the RC following the directions in the RC reference manual. You will find examples of how to read digital inputs in the default code and in the RC programming guide.
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #3   Spotlight this post!  
Unread 26-01-2005, 09:46
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Using Custom Inputs on the Controller Board

Quote:
Originally Posted by schenkin
I want to use custon imports on the controller board...
How do I call on these inputs in the code. I figured I would us one of the joystick inputs and use my owm cable, but how do I tell the code where to pull the info from?
Use the OI documentation to find which pins to use on the joystick connectors. Then look at the ifi_aliases.h file in the default code to find the software names of each switch input. You can treat each switch input as a "magic variable" which is set for you automatically and reads out as either 0 (not active) or 1 (active).

(By the way, the default code with camera support already uses the trigger switch on joystick #2 to switch among colors to track.)
  #4   Spotlight this post!  
Unread 26-01-2005, 09:47
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
Re: Using Custom Inputs on the Controller Board

Keep in mind that while in autonomous mode, the controller will read all switches as off. However, you can read the values before autonomous mode and save them on the robot controller itself to work around this.
__________________
Shift to the left, shift to the right!
Pop up, push down, byte, byte, byte!
  #5   Spotlight this post!  
Unread 26-01-2005, 10:30
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: Using Custom Inputs on the Controller Board

Quote:
Originally Posted by steven114
Keep in mind that while in autonomous mode, the controller will read all switches as off. However, you can read the values before autonomous mode and save them on the robot controller itself to work around this.
That is true for switches on the OI. The state of switches on the RC are available during autonomous.
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #6   Spotlight this post!  
Unread 26-01-2005, 10:32
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
Re: Using Custom Inputs on the Controller Board

Sorry, that's what I meant
__________________
Shift to the left, shift to the right!
Pop up, push down, byte, byte, byte!
  #7   Spotlight this post!  
Unread 26-01-2005, 11:05
russell's Avatar
russell russell is offline
Registered User
#1430 (WRONG)
Team Role: Electrical
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Anchorage AK
Posts: 402
russell is a name known to allrussell is a name known to allrussell is a name known to allrussell is a name known to allrussell is a name known to allrussell is a name known to all
Re: Using Custom Inputs on the Controller Board

Quote:
you can read the values before autonomous mode and save them on the robot controller itself to work around this.
I have a question about this. A few days ago I decided to write some dead reckoning code just for fun, and because I had never done so before. Basically I made it drive forward fast for 120 loops then turn left. I put it in the autonomous section and I expected the program would start running as soon as I turned the robot on even though I had it disabled. Basically I expected the program to run without driving the wheels until I enabled the robot. But it didnt. The program did not start running until I enabled the robot. This makes me wonder exactly how much of the code runs while the robot is disabled? Bascially I need the robot to tell the camera to track green even before the match starts. Can I do this somewhere or can we turn the robot on while it isnt on the field, and tether it so it will tell the camera this? Something?
  #8   Spotlight this post!  
Unread 26-01-2005, 12:22
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Using Custom Inputs on the Controller Board

Unless you put in a specific check, the software doesn't care about enabled vs. disabled. The only difference is whether or not the RC pwm and relay outputs are activated.

Autonomous vs. manual is another story. If you put code in the autonomous section, it will only run if autonomous mode is commanded (by grounding the "autonomous" pin on the competition port). I'm not sure if the auton_mode flag is overriden by the "disable" pin or not.
  #9   Spotlight this post!  
Unread 27-01-2005, 08:11
schenkin schenkin is offline
Registered User
#0486
 
Join Date: Jan 2005
Location: Strath Haven High School
Posts: 17
schenkin is on a distinguished road
Re: Using Custom Inputs on the Controller Board

1. The autonomous mode is disabled if the disable pin is grouned. I made a switch which allows us to enable/disable the robot as well as activate autonomous mode. We also made a dongle which allows us to change the channels the robot was using. This came in handy when we participated in a post-season competition and those running it forgot that by default the robots run on the same frequency. I don't know how many people have these, but if anyone wants instructions to make one, just send me a Private Message.

2. I know how to work digital I/O on the RC, its just on the controller board that I don't know how. In ifi_aliases.h it simply defined by a bizzare string (the trigger on the 1st joystick is defined by "rxdata.oi_swA_byte.bitselect.bit0," which comments tell us is the 5th pin on port 4 [sic] plus what I assume is ground. There are only 4 possible digital inputs defined for each port. Is this the maximum? Also, is it possible to have outputs (ie for extra leds, etc)? I know that we are allowed to use computers connected to the dashboard program this year, but is there a more streamlined way?


--Sam
--Team 486
--Positronic Panthers
--http://www.gotrobot.org/
  #10   Spotlight this post!  
Unread 27-01-2005, 09:00
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Using Custom Inputs on the Controller Board

Again, Sam, all your questions are answered in the OI documentation (on the IFI web site). Yes, there are four switch inputs on each joystick port. Yes, you can connect LEDs to the LED outputs provided for that purpose on two of the ports.

The "bizarre" string is pointing to a particular bit in the received communication buffer coming from the radio link. That's how the RC gets its data from the OI. Just use the alias and don't worry about the details of why it works.
  #11   Spotlight this post!  
Unread 27-01-2005, 10:26
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,867
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: Using Custom Inputs on the Controller Board

Quote:
Originally Posted by schenkin
There are only 4 possible digital inputs defined for each port. Is this the maximum?
Some Ports are more equal than others.
Specifically, see page 5 and 7-10 of http://www.ifirobotics.com/docs/oi-ref-guide-1-25-05.pdf.
Each port provides four unique digital inputs. PORT 2 provides access to the same digital inputs as PORT 3, allowing access to 8 digital inputs from PORT 2. PORT 4 provides access to the same digital inputs as PORT 1, allowing access to 8 digital inputs from PORT 4.”
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
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
Help On Coding 2K1 Controller GregTheGreat Programming 9 05-12-2003 18:35
serious problem found - robot controller resets when jarred! KenWittlief Electrical 23 19-03-2003 13:30
Custom Mod Controller. Josh Hambright Electrical 9 17-01-2003 08:05


All times are GMT -5. The time now is 01:43.

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