Go to Post Some clever fellow a few years back made a little scooter based on this principal and made so much on the idea he can afford the finest denim in the land. - phrontist [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 04-03-2008, 19:28
burkey_turkey burkey_turkey is offline
Registered User
AKA: Andrew
FRC #0422 (MechTechs)
Team Role: Mechanical
 
Join Date: Apr 2006
Rookie Year: 2004
Location: Richmond, VA
Posts: 161
burkey_turkey is a splendid one to beholdburkey_turkey is a splendid one to beholdburkey_turkey is a splendid one to beholdburkey_turkey is a splendid one to beholdburkey_turkey is a splendid one to beholdburkey_turkey is a splendid one to behold
Last Minute Programmer - Need Help!

Hi,
Our teams programmer has the flu and will not be able to attend our first regional, the VCU regional. noone else knows how to program the bot. Does anyone know any really good quick start tutorials for programming the bot that i could look at? Obviously i can't program our real code until thursday, but if anyone could point me to resources to show me how to take standard joystick inputs (the variable parts and the button parts) and do random math and conditional logic on them to set some outputs (to either a victor or a spike) i would really appreciate it. I've programmed in other languages before but have never touched the Robots 1's and 0's before. THanks in advance for all your help, while i wait for a response i will look through the standard code and any resources i find from FIRST.

Also, if anyone has some spare time tonight and wants to talk me through some stuff my AIM is alboo2002, and i would love to chat :-)
  #2   Spotlight this post!  
Unread 04-03-2008, 19:55
lukevanoort lukevanoort is offline
in between teams
AKA: Luke Van Oort
no team
 
Join Date: Oct 2005
Rookie Year: 2005
Location: Waterloo, ON, Canada
Posts: 1,873
lukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond repute
Send a message via AIM to lukevanoort
Re: Last Minute Programmer - Need Help!

You are going to be hard pressed to learn how to program in a night... if you have wired robots before, it might be possible to learn the basics. How familiar are you with the robot's electrical system? (PS my AIM is in my profile and I would be happy to help, but I may be a bit distracted... I am working on an AP Computer Science program right now) I'll also be at VCU, in case you need some help while you are there, just drop by 587's pit and ask for Luke.
__________________
Team 1219: 2009 - Mentor
Team 587: 2005 - Animator, 2006-2008 - Team Captain

Last edited by lukevanoort : 04-03-2008 at 20:05.
  #3   Spotlight this post!  
Unread 04-03-2008, 19:57
burkey_turkey burkey_turkey is offline
Registered User
AKA: Andrew
FRC #0422 (MechTechs)
Team Role: Mechanical
 
Join Date: Apr 2006
Rookie Year: 2004
Location: Richmond, VA
Posts: 161
burkey_turkey is a splendid one to beholdburkey_turkey is a splendid one to beholdburkey_turkey is a splendid one to beholdburkey_turkey is a splendid one to beholdburkey_turkey is a splendid one to beholdburkey_turkey is a splendid one to behold
Re: Last Minute Programmer - Need Help!

I know there are wires going in with inputs and wires leaving to the spikes and victors with outputs. Ive been looking over the standard code some already tonight. is it as simple as taking the input values from the joysticks (either a [-127,127] or a [0,1]), doing math on them, and setting outputs to victors and spikes as [-127,127] and [0,1] respectively?

EDIT: and we arent using pnumatics, so i think that simplifies things
  #4   Spotlight this post!  
Unread 04-03-2008, 20:02
lukevanoort lukevanoort is offline
in between teams
AKA: Luke Van Oort
no team
 
Join Date: Oct 2005
Rookie Year: 2005
Location: Waterloo, ON, Canada
Posts: 1,873
lukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond repute
Send a message via AIM to lukevanoort
Re: Last Minute Programmer - Need Help!

Sort of. The joystick analogs give values from 0->254 and the pwms also run on a 0->254 scale, with 0 being full reverse and 254 being full forward. Spikes are a bit different. There are two program variables used to control them, a rev and fwd for each spike. You set one to zero and the other to one to give power in a direction and zero to both for neutral. (1 for forward and 0 for reverse makes gives a full forward output, for example)

EDIT: What I am saying is relevant to MPLAB code using IFI or Kevin's codebases. I don't know anything about RobotC or EasyC... and its been a while since I used WPIlib.
__________________
Team 1219: 2009 - Mentor
Team 587: 2005 - Animator, 2006-2008 - Team Captain
  #5   Spotlight this post!  
Unread 04-03-2008, 20:06
burkey_turkey burkey_turkey is offline
Registered User
AKA: Andrew
FRC #0422 (MechTechs)
Team Role: Mechanical
 
Join Date: Apr 2006
Rookie Year: 2004
Location: Richmond, VA
Posts: 161
burkey_turkey is a splendid one to beholdburkey_turkey is a splendid one to beholdburkey_turkey is a splendid one to beholdburkey_turkey is a splendid one to beholdburkey_turkey is a splendid one to beholdburkey_turkey is a splendid one to behold
Re: Last Minute Programmer - Need Help!

ok cool, thanks. MPLAB, is that free form anywhere so i can poke around with it? what specific applications and/or libraries should i download tonight?
  #6   Spotlight this post!  
Unread 04-03-2008, 20:08
lukevanoort lukevanoort is offline
in between teams
AKA: Luke Van Oort
no team
 
Join Date: Oct 2005
Rookie Year: 2005
Location: Waterloo, ON, Canada
Posts: 1,873
lukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond repute
Send a message via AIM to lukevanoort
Re: Last Minute Programmer - Need Help!

What are you using now to look through the default code?
__________________
Team 1219: 2009 - Mentor
Team 587: 2005 - Animator, 2006-2008 - Team Captain
  #7   Spotlight this post!  
Unread 04-03-2008, 21:04
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 6,995
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: Last Minute Programmer - Need Help!

(Why do I get the strange feeling his next question is going to be "Default code? What's that?")

OK, it depends on what you're most comfortable with, but if time is of the essence, not elegance or finer control, then consider Easy-C. You can literally write joystick control for 2 or 4 Victors plus some random controls for Spikes in less than 15 minutes.

It is drag & drop, with just some simple parameterization.

On the other hand, with a complex bot, you run out of flexibility soon enough.

On Thursday morning at VCU, the first thing you must do is go to Pit Administration and send an announcement for "Major programming help", you'll get a few good offers, and at least get the bot rolling while you learn and code the finer points.

Don
__________________

I am N2IRZ - What's your callsign?
  #8   Spotlight this post!  
Unread 04-03-2008, 21:13
SL8's Avatar
SL8 SL8 is offline
...
AKA: Jesus
FRC #0647 (Cyber Wolf Corps)
Team Role: Programmer
 
Join Date: Dec 2007
Rookie Year: 2008
Location: Killeen, Texas (Fort Hood)
Posts: 352
SL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud ofSL8 has much to be proud of
Send a message via Yahoo to SL8
Re: Last Minute Programmer - Need Help!

I would agree that Easy-C would be the way to go right now as long as what you need done is simple enough. Btw you should have your programmer run through his code with you ( unless there isn't any). There are tutorials in Easy-C. The program should have come in the kit. What have you all been using? ( I have a feeling that you have not programmed much yet.
__________________


  #9   Spotlight this post!  
Unread 04-03-2008, 21:20
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Last Minute Programmer - Need Help!

MPLAB is Free!
However... I don't believe this version will work with version 2.40 of the C18 compiler (a compiler is what takes the code you write, and converts it to code the robot understands) The C18 compiler is not free, but you should have received it in the kit.

As for the default code, you have 3 choices
  1. IFI's Default Code
  2. Kevin Watson's Code
  3. Make Your Own (very bad decision for 3 days left)

I've used IFI's code in the past, and it works perfectly...
I've also used Kevin's Code, and it works perfectly...
I haven't tried to make my own code from scratch, nor do I even want to imagine it...

I would start with IFI's code as it already has code to make the robot move, and a lot more sample code. Basically, a PWM output will range from 0 to 255 A spike has 2 inputs relayX_fwd and relayX_rev. To make it go forward, fwd must equal 1, and rev must equal 0, and vice versa. If both equal 1 or 0, then the spike will turn off.

Remember semicolons after almost everything;

In a condition statement, remember to use double equal signs == and when setting something, use only one equal sign = [ if (xvariable == 0) reset = 1;]

With Kevin's code, the MPLAB shown above will work. I'm not sure where to quote where it says that you must use MPLAB version 7.4 or below with IFI's code, but I'm pretty sure it says that somewhere (it's not a rule, but the code won't compile with a version 7.4 with IFI's code).

My best advice would be to to go the school and work on an old robot. Put the robot on blocks so it doesn't run off on its own with a computer dragging behind it.

Hopefully this isn't too messy and will aid you in your hard time.
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364
  #10   Spotlight this post!  
Unread 04-03-2008, 22:23
burkey_turkey burkey_turkey is offline
Registered User
AKA: Andrew
FRC #0422 (MechTechs)
Team Role: Mechanical
 
Join Date: Apr 2006
Rookie Year: 2004
Location: Richmond, VA
Posts: 161
burkey_turkey is a splendid one to beholdburkey_turkey is a splendid one to beholdburkey_turkey is a splendid one to beholdburkey_turkey is a splendid one to beholdburkey_turkey is a splendid one to beholdburkey_turkey is a splendid one to behold
Re: Last Minute Programmer - Need Help!

thanks everybody, especially john from 587, I'll throw something together thursday morning at VCU then hopefully someone with the compiler can help me out and i can see how many errors i made :-)

i still dont fully understand interrupts, but it looks like these things might come together for me. thanks everyone, especially 587, for the help!
  #11   Spotlight this post!  
Unread 04-03-2008, 22:28
Uberbots's Avatar
Uberbots Uberbots is offline
Mad Programmer
AKA: Billy Sisson
FRC #1124 (ÜberBots)
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Avon
Posts: 739
Uberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond repute
Re: Last Minute Programmer - Need Help!

if pwms 4 and 5 are your left drive motors, and 6 and 7 are your right drive motors, you can do this for a single joystick drive (assuming you use IFI's code):

pwm04 = pwm05 = Limit_Mix(2000 + p1_y - p1_x + 127);
pwm06 = pwm07 = Limit_Mix(2000 + p1_y + p1_x - 127);

That will get you some basic drive capabilities with the port1 joystick. Keep in mind, if you use IFI's default code, that all the variables to control the robot that you would ever need are in "ifi_aliases.h".

interrupts are like tiny peices of code that will execute in response to something. With an interrupt, though, the code that is currently running is 'interrupted', and the processor will jump to another part of the code, do what it needs to, and jump back. That 'another part of the code' is the "interrupt_handler_low()" routine in user_routines_fast.c. Configurating an interrupt to work in the first place is half the battle... i would suggest taking a look at kevin watson's encoder code to get an idea how to set one up.
__________________
A few of my favorite numbers:
175 176 177 195 230 558 716 1024 1071 1592 1784 1816
RPI 2012
BREAKAWAY

Last edited by Uberbots : 04-03-2008 at 22:32.
  #12   Spotlight this post!  
Unread 04-03-2008, 23:16
Jim E Jim E is offline
Registered User
FRC #1523 (M.A.R.S.)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Lantana, FL
Posts: 188
Jim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond reputeJim E has a reputation beyond repute
Re: Last Minute Programmer - Need Help!

HEY!

Slow down for a minute!

Hopefully your programmer has given you the basics of the code in the robot in the box. Was it written in MPLAB or Easy C?

The default code will give you general control of the robot in tele-operating mode. Hopefully, this capability is already done for you.

It's important to have a map. Get to know what the PWM signals used are doing. What are the Digital I/O signal pins and Analog signal pins connected to?

Without this, you cannot write effective software in either language platform.

If your teammates are looking to you to write autonomous, good luck in MPLAB. You would be wise to find a guru or alliance partner willing to help you to write a routine that could get you a few points based on your sensor capabilities.

If your tele-operated code is already in Easy C, Then it's is easier for you. Find another guru versed in Easy C to help.

My experience is someone knowing Easy C may not have the skills necessary to write Code in MPLAB, but someone knowing MPLAB may be able to convert code from Easy C to MPLAB. You are better selecting a platform to use and sticking to it. I have no success in combining the two into one effective program. The libraries are totally different.

It is far more difficult to convert from MPLAB to Easy C than vice versa.

Look at your base code and understand it's capabilities before tinkering with it and ALWAYS back up the software before making ANY changes. You will be glad you did.

Good Luck a VCU.
__________________
Team MARS = 1.523 AU from the SUN!

Jim E.
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
NEW PROGRAMMER!!!!! NEED HELP!!!! delphi demon Programming 5 19-04-2007 13:22
NEED PROGRAMMER TO HELP WITH PROGRAMING Reaper40 Programming 4 02-02-2007 17:31
Rookie programmer in need of help. kshot Programming 7 20-01-2005 15:05


All times are GMT -5. The time now is 10:36.

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