Go to Post This is just one example of why you MUST NOT make engineering decisions based on assumptions. You should check/measure your parts and make appropriate design adjustments. - Stu Bloom [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
  #16   Spotlight this post!  
Unread 11-01-2007, 10:39
bear24rw's Avatar
bear24rw bear24rw is offline
Team 11 Programming Captain
AKA: Max T
FRC #0011 (MORT)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2005
Location: Flanders, NJ
Posts: 385
bear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to behold
Send a message via AIM to bear24rw
Re: What are we supposed to do!?!?!?!??!?!

The team number isnt set in the code, its setting in binary using the dipswitches..

Also, just try to get a copy of someones code (i would upload mine but i dont have it with me) and just look through it and try to learn it. Before last year I didnt have a clue what a #define statement was, i just read over the code from previous years over and over again and read all the programming papers on ifirobotics.com... now i knew the controller inside and out...

Good luck
  #17   Spotlight this post!  
Unread 11-01-2007, 10:42
Matt Krass's Avatar
Matt Krass Matt Krass is offline
"Old" and Cranky. Get off my lawn!
AKA: Dark Ages
FRC #0263 (Sachem Aftershock)
Team Role: Mentor
 
Join Date: Oct 2002
Rookie Year: 2002
Location: Long Island, NY
Posts: 1,187
Matt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond repute
Send a message via AIM to Matt Krass
Re: What are we supposed to do!?!?!?!??!?!

Quote:
Originally Posted by Bomberofdoom View Post
Ok, so I read about the joystick movment thing.
Do we need to build that code of if's? Do we need to make these macros to check the joystick axis status?
Every loop the controller updates the values in the P*_* variables, including axes and buttons. All you have to do is use logic on the values and set your pwm** variables.
__________________
Matt Krass
If I suggest something to try and fix a problem, and you don't understand what I mean, please PM me!

I'm a FIRST relic of sorts, I remember when we used PBASIC and we got CH Flightsticks in the KoP. In my day we didn't have motorized carts, we pushed our robots uphill, both ways! (Houston 2003!)
  #18   Spotlight this post!  
Unread 11-01-2007, 10:50
Bomberofdoom's Avatar
Bomberofdoom Bomberofdoom is offline
Biggest FIRST addict in Israel
AKA: Nir Levanon
FRC #2230 (Zcharia's Angels)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Israel
Posts: 471
Bomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond repute
Send a message via MSN to Bomberofdoom
Re: What are we supposed to do!?!?!?!??!?!

What do you mean by setting our own PWM** values?
  #19   Spotlight this post!  
Unread 11-01-2007, 10:51
SoD SoD is offline
Registered User
FRC #2230
 
Join Date: Jan 2007
Location: Israel
Posts: 15
SoD is an unknown quantity at this point
Re: What are we supposed to do!?!?!?!??!?!

Ok thanks alot for your help.

What do we have exactly in our code allready, and what should we use with it?
  #20   Spotlight this post!  
Unread 11-01-2007, 11:21
Joe Johnson's Avatar Unsung FIRST Hero
Joe Johnson Joe Johnson is offline
Engineer at Medrobotics
AKA: Dr. Joe
FRC #0088 (TJ2)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Raynham, MA
Posts: 2,648
Joe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond repute
Re: What are we supposed to do!?!?!?!??!?!

Quote:
Originally Posted by Bomberofdoom View Post
But we don't know what to do in EasyC. We're used to raw C code. These blocks are confusing(safe, but confusing).
I am not surprised that you are confused.

The Default code is a real mess in my opinion. It is a mix-mash of a bunch of legacy stuff from the early years of FIRST and a bunch of patches and band -aids applied to add new features and functions.

Here is the basic idea:
Inputs from the Operator Interface (OI) come from 4 ports -- they themselves are legacy 15 pin game ports from the early days of the IBM PC. Each port has switches and analog inputs.

The switches are defined this way: pN_sw_SWITCHNAME where N refers to the port number and SWITCHNAME refers to "top", "trig", "aux1" and "aux2" Depending on what brand joystick you use these switches will be available out of the box or not -- if not, and you need those switches, you will have to build a custom harness to get access to the switches. The default code has structures and aliases defined for you that allow you to treat these switches as either 1 or 0's

The analog inputs are defined this way:
pN_ANALOGNAME where N refers to the port number and ANALOGNAME
Refer to "X" "Y" "WHEEL" and "AUX" Again depending on what brand joystick you use these analog inputs will be available out of the box or not -- if not, and you need those inputs, you will have to build a custom harness to get access to the analog inputs (wiring in your own potentiometer for example). The default code has structures and aliases defined for you that allow you to treat these analog inputs as either a number between 0 and 255 -- with 127 being the nominal center position of the joystick.

You have similar naming conventions for inputs on the Robot Controller's analog and digital inputs.

The outputs on the RC are basically the PWM values 0-254 and relays (which are of the form rc_dig_outNN).

In order to control a motor, you just assign the PWM output to a value 0 = full rev, 127 = off, 254= full fwd. The default code simply maps joystick values from the OI to PWM outputs on the RC. It also has some example methods of mapping limit switches to particular PWM output so that the motor will turn off when an end of travel switch is made. If you know C and you know how to access the various inputs and outputs, you should be able to write code to let your robot do what ever you need it to do.

Good luck.

Joe J.
__________________
Joseph M. Johnson, Ph.D., P.E.
Mentor
Team #88, TJ2
  #21   Spotlight this post!  
Unread 11-01-2007, 13:38
Mark Pierce Mark Pierce is offline
Registered User
FRC #0085 (B. O. B.)
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 1999
Location: Zeeland, MI
Posts: 239
Mark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant future
Re: What are we supposed to do!?!?!?!??!?!

In preparing for some intro to programming sessions I held this year I spent some time looking for what you're after. I'm hoping to organize my thoughts into a white paper or something, but haven't had time to clean it up. Currently there are some of my notes on my website Marks programming page which might help with some references to some resources.

Here's a quick sketch of how our team tries to approach programming:

First: Familiarization -Get the default code compiling, downloading, and the controllers talking to each other, try connecting a joystick and motor or two and see how things work.

Second: Functional Requirements - Identify what functions need to by done by the controller. Every team's program will handle some operator input, use some robot sensors such as limit switches, and drive some outputs. The basic joystick as input and drive train as output is in the default code because it is the most common to all teams.

Third: Design -Break these functions down into smaller pieces and identify those that can be easily handled, and those which you will need to do more research or find help for, such as camera, timers, or other sensors.

Fourth: Implement - Make a working copy of the default code. Cut out parts of the example code that you won't need. Define macros for your names of inputs and outputs. Declare functions or at least insert comments for those things you need to add. Then start coding.

Quote:
Originally Posted by Joe Johnson View Post
The Default code is a real mess in my opinion.
I hope to have something ready soon (this weekend) showing how we are rearranging the default code into a framework to work from.
  #22   Spotlight this post!  
Unread 11-01-2007, 13:46
SuperBK's Avatar
SuperBK SuperBK is offline
Registered User
AKA: BrianK
FRC #1225 (Amperage Robotics)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Henersonville, NC
Posts: 358
SuperBK is just really niceSuperBK is just really niceSuperBK is just really niceSuperBK is just really nice
Re: What are we supposed to do!?!?!?!??!?!

Run the default code first. After loading the code into the robot controller, open the terminal, if the statement "printf(..." is not commented out, it will print the values for the joysticks. You can add other variables (like switches) to the printf. Move the sticks and see what values change. Look at Default_Routine() like the other poster said.

Look at ifi_aliases.h for the possible variables you can read and set.

Autonomous mode is in user_routines_fast.c. Look at User_Autonomous_Code(). It runs in a loop so you have to have a state machine. After you get the robot going and a few things figured out, then search around for an example or post back here.

Note: The operator interface will not talk to the robot controller until you set the team number on the IO and tether it first.

Hope this helps,
Brian
  #23   Spotlight this post!  
Unread 11-01-2007, 16:09
Bomberofdoom's Avatar
Bomberofdoom Bomberofdoom is offline
Biggest FIRST addict in Israel
AKA: Nir Levanon
FRC #2230 (Zcharia's Angels)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Israel
Posts: 471
Bomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond repute
Send a message via MSN to Bomberofdoom
Re: What are we supposed to do!?!?!?!??!?!

Thanks for the help guys.
I guess the only problem is right now is just trying to dycript those small macros, functions and other varibles and how they relate to the robot or OI.
But our Programming group all agreed that we've reached the begining point and we can probablly see the next step ahead(with minor help from you guys and Delphi).

Thanks again
  #24   Spotlight this post!  
Unread 11-01-2007, 16:19
Bomberofdoom's Avatar
Bomberofdoom Bomberofdoom is offline
Biggest FIRST addict in Israel
AKA: Nir Levanon
FRC #2230 (Zcharia's Angels)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Israel
Posts: 471
Bomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond reputeBomberofdoom has a reputation beyond repute
Send a message via MSN to Bomberofdoom
Re: What are we supposed to do!?!?!?!??!?!

BTW, I find the previous codes some people sent very usefull. It'll also help me and the team to get some more work to do(I'm head of the programming team{and look how desperate I was}).
Please send any previous codes you can(with comments of course, so we may understand ). We will really appreciate it.
  #25   Spotlight this post!  
Unread 11-01-2007, 16:25
robbekid robbekid is offline
Registered User
FRC #0056
Team Role: Mentor
 
Join Date: Mar 2004
Rookie Year: 2001
Location: NJ
Posts: 28
robbekid is on a distinguished road
Re: What are we supposed to do!?!?!?!??!?!

read kevins code, he has really well documented code, i am learning the programing this year as I am planning on helping with the programming from next year on wards, so i have been working with just decoding kevins FRC code.
__________________
07 - NY, FL and ATL

Last edited by robbekid : 11-01-2007 at 16:45.
  #26   Spotlight this post!  
Unread 12-01-2007, 16:30
bear24rw's Avatar
bear24rw bear24rw is offline
Team 11 Programming Captain
AKA: Max T
FRC #0011 (MORT)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2005
Location: Flanders, NJ
Posts: 385
bear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to behold
Send a message via AIM to bear24rw
Re: What are we supposed to do!?!?!?!??!?!

Quote:
Originally Posted by robbekid View Post
read kevins code, he has really well documented code, i am learning the programing this year as I am planning on helping with the programming from next year on wards, so i have been working with just decoding kevins FRC code.
www.kevin.org/frc
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
What are Potentiometers? Theory6RobotiX Control System 18 30-12-2005 09:57
PBASIC 2.5 Software supposed to be released TODAY. Travis Hoffman Programming 7 13-01-2003 20:43
What are pneumatics? Aignam Pneumatics 23 16-10-2002 21:17
Who was supposed to be in Huntington?? Heather 45 Off-Season Events 4 16-03-2002 22:43


All times are GMT -5. The time now is 02:06.

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