Go to Post It would be a lot easier if students would quit being so magnificent. Really. - JaneYoung [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
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 18-12-2007, 19:02
ExarKun666's Avatar
ExarKun666 ExarKun666 is offline
Ben Error/MC Ben/NC Ben
AKA: Ben Kellogg
FRC #2429 (LCEC)
Team Role: Programmer
 
Join Date: Dec 2007
Rookie Year: 2008
Location: La Cañada, CA
Posts: 208
ExarKun666 is an unknown quantity at this point
Send a message via AIM to ExarKun666 Send a message via MSN to ExarKun666 Send a message via Yahoo to ExarKun666
C coding

Just wondering, for you veterans, of F.I.R.S., this is my personal first year, and I choose, to help with programming the robot, but the problem is I don't know how to program in C. So any one who can tell me how C works, or how to write it, or explain it to me, any help would be appreciated. Thanks, to all those who answer!
Reply With Quote
  #2   Spotlight this post!  
Unread 18-12-2007, 19:04
whytheheckme's Avatar
whytheheckme whytheheckme is offline
Registered User
AKA: Jacob Komar
no team
 
Join Date: Feb 2006
Rookie Year: 2005
Location: Providence, RI
Posts: 1,320
whytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond reputewhytheheckme has a reputation beyond repute
Send a message via ICQ to whytheheckme Send a message via AIM to whytheheckme Send a message via MSN to whytheheckme Send a message via Yahoo to whytheheckme
Re: C coding

Welcome to ChiefDelphi. Lots of friendly folk here.

Take a look at the programming section of the site:

http://www.chiefdelphi.com/forums/forumdisplay.php?f=51


There a bunch of stickies there about how to get started, among numerous threads about other people getting started just like you. If you have any specific questions, be sure to put them in the Programming section.

Again, Welcome!

Jacob
Reply With Quote
  #3   Spotlight this post!  
Unread 18-12-2007, 20:58
blaxbb blaxbb is offline
Ohio State Engineering Scholar
AKA: Brian Barrett
FRC #2331
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2007
Location: Vernon, New Jersey
Posts: 131
blaxbb is just really niceblaxbb is just really niceblaxbb is just really niceblaxbb is just really niceblaxbb is just really nice
My Expirience

I learned the basics of C outside of FIRST, which I think is much easier to understand rather than jumping into the robot right away. I was just in the same position as you (except for an offseason competition) and these are my tips to anyone just starting to program for FIRST.

http://aelinik.free.fr/c/ is the tutorial I used.
You could only do the first 10 lessons and have a basic understanding, but like everything else, the more you know, the better off you'll be. Learn as much as you can before the season starts.

During the season, remember that your main goal (assuming the game is similar to prior years) is to have the controls running so that the controls are natural to the driver. In order to do this efficiently, make sure that you understand the electrical system, as it is the core of everything you program for. Watch everything that the electrical team wires and ask as much as you can about what they are doing.

Once you have the controls "done", you should at least attempt an autonomous (again assuming that it is in this years game.) Whether you attempt to score or just set the driver up for an extra few seconds it is very effective in helping your team. Just remember to start small with your autonomous and add to it little by little until you understand everything and have a finished product.

For the specifics on how to upload code to the robot the best place would be the programming section posted above.

Remember don't be afraid to ask about anything on here, everyone here was a new member once and knows how hard it is to jump into something you have never done. Just keep working at it and you will improve.
__________________
"Whether you think you can or think you can’t, you’re right." - Henry Ford
www.vthsrobotics.org
Reply With Quote
  #4   Spotlight this post!  
Unread 18-12-2007, 21:14
Branden Ghena's Avatar
Branden Ghena Branden Ghena is offline
Previously: tawnos23
FRC #0240 (TEMPEST)
Team Role: College Student
 
Join Date: Nov 2005
Rookie Year: 2004
Location: Houghton, Michigan (MTU)
Posts: 303
Branden Ghena has a spectacular aura aboutBranden Ghena has a spectacular aura aboutBranden Ghena has a spectacular aura about
Re: C coding

Another good idea, especially if you are new to C coding, is to try EasyC. EasyC made learning C much simpler for me, and once I understood the basics, I could still use EasyC to make more advanced codes.
__________________
Branden Ghena - Michigan Tech Student and Team 240 Alumnus
Working Towards: Electrical Engineering and Computer Engineering Double Major

"All we have to decide is what to do with the time that is given to us." - Gandalf
Reply With Quote
  #5   Spotlight this post!  
Unread 18-12-2007, 21:52
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: My Expirience

Quote:
Originally Posted by blaxbb View Post
During the season, remember that your main goal (assuming the game is similar to prior years) is to have the controls running so that the controls are natural to the driver.
I would like to add emphasis to this point. This is probably the single most important thing for a programmer to realize. As both a programmer and a driver (among other things...) I can tell you it makes a HUGE difference in robot effectiveness. There is a common saying that the three most important things in having a successful robot are 1) Drivetrain 2) Drivetrain and 3) Drivetrain. Yet a drivetrain is useless without driver skill, so I would propose that the two most important things are 1) Drivetrain 2) Driver Practice/Skill. Good programming can take a mediocre driver and make them good, or a good driver and make them amazing. Bad programming will not enhance a driver's natural abilities, and may even make them worse. Essentially, it can take the place of practice time and make the practice the drivers do have more effective.

This doesn't only go for drive systems it applies to game piece manipulators too; case in point, in our last two matches at VCU, when we finally got our arm working using a thrown together control method we scored, I believe, one ringer (part of that was a drivetrain problem stemming from a broken wheel, but the point still stands). At Palmetto, with improved algorithms we scored 3.5 per match (this is an actual number determined from our actual matches, not inflated conjecture; however, it does not include our first two matches when loose wires kept us from being able to score. But, since our lack of scoring in those matches has nothing to do with control, more like wiring sloppiness, those matches are irrelevant to the statistic in this use).

At Battle of Baltimore, I believe we scored at least 6-7 tubes in the first quarterfinal (I don't know exactly, I don't remember that match too well. 1089, the other scorer on the alliance, was pretty much neutralized by a double-teamed defense the entire match and yet the alliance still ran out of tubes in the player station. So, we must have scored quite a few) All along our robot was the same (actually, our turret broke at BoB, so it was scoring more even partially disabled and with a new, inexperienced base driver); yet, there is a big difference between 0-1 and 6-7 tubes. All of that was control algorithms and practice. (Actually, I expect that we could probably score up to nine tubes in two minutes if our turret was working and our controls were refined just a bit more)

Anyway, the effect of good programming can be huge. My first year as a driver our programmer (this was before I learned C and became a programmer myself) wouldn't listen to my requests for control changes and such, believing them unnecessary. Don't do this. Period. Autonomous is ten to fifteen seconds (usually), and teleoperated is one-hundred and twenty seconds. Don't shortchange the driver. If the driver wants a control change, listen to them. If you think a different method might make it easier to drive, suggest it and let them try it out, but do not force a certain method upon them. Your basic goal is to (as cheesy as it sounds) make the robot and the driver work in harmony, not opposition; to make operating the robot feel to the driver as natural and easy has operating their own feet and hands. If you reach that goal, even if the robot lacks an autonomous mode of any kind, I would say you've reached the pinnacle of FIRST robot programming.
__________________
Team 1219: 2009 - Mentor
Team 587: 2005 - Animator, 2006-2008 - Team Captain
Reply With Quote
  #6   Spotlight this post!  
Unread 18-12-2007, 23:39
whitetiger0990's Avatar
whitetiger0990 whitetiger0990 is offline
Registered User
no team
Team Role: Programmer
 
Join Date: Mar 2006
Rookie Year: 2006
Location: Earth
Posts: 157
whitetiger0990 is a glorious beacon of lightwhitetiger0990 is a glorious beacon of lightwhitetiger0990 is a glorious beacon of lightwhitetiger0990 is a glorious beacon of lightwhitetiger0990 is a glorious beacon of light
Re: C coding

If you have done any sort of programming before, learning C will be a breeze. Programming logic translate directly from language to language (usually). The only thing you need to do is get used to the syntax of the language. Control structure logic will be mostly the same. (while, for, if, etc).

By looking at the links said previously, you can get a handle of what's going on. And if you read the error messages, you'll be able to fix what's going on. (Don't forget ;s)

Like likevanoort said, you should strive to have a fluid system between the driver and the bot. But also remember that you cannot solve all mechanical problems through programming (so, it's probably a good idea to stay in the design and build development loop, motors can only take so much rigorous testing). Everything they request might not be able to be implemented (and if they aren't a programmer, they probably won't know why). Be sure to talk with the people making the requests, and make sure they are specific in their requests. I've gotten quite mad when I was only told "This doesn't feel natural" when it was a physical problem which I had been struggling with for long before they showed up, had their epiphany, and told me to fix it. In retrospect, I should have kept them in the development loop, but still. As a programmer, you shouldn't disregard all requests, but if you know right then and there they won't work, explain. If you figure out later they won't work... explain.

Try to get a basic control background going in your bot code (taking in and processing inputs, figuring out what to do with them, and then outputting). You might not be able to do specific things without a good portion of the bot first, but you should be able to get it to drive. Preseason, figure out how to use sensors, they make life much simpler (and it will show in your auton). =)

Oh, also, if your team doesn't already know, make sure they know programming takes time, and can't be shoved into a couple days of the season. The bot is nothing but a nice looking paperweight without programming.
__________________
print$q=chr(ord($q)+$1)while("7443-0201-8465130105-12-03135-82482113-06-7672-070208-0613-70"=~/(-?\d\d)/g);
Reply With Quote
  #7   Spotlight this post!  
Unread 20-12-2007, 15:18
diesel's Avatar
diesel diesel is offline
Registered User
FRC #2077
 
Join Date: Oct 2007
Location: Wisconsin
Posts: 50
diesel has a spectacular aura aboutdiesel has a spectacular aura about
Re: C coding

Sorry if this is in the wrong thread.
I am also looking to learn C before the seanson starts.
My question is: Is there a compiler I can download to learn C with?
Any help will be great.
__________________
Design. Build. Dew.
Reply With Quote
  #8   Spotlight this post!  
Unread 20-12-2007, 16:05
blaxbb blaxbb is offline
Ohio State Engineering Scholar
AKA: Brian Barrett
FRC #2331
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2007
Location: Vernon, New Jersey
Posts: 131
blaxbb is just really niceblaxbb is just really niceblaxbb is just really niceblaxbb is just really niceblaxbb is just really nice
Re: C coding

I use dev c++ http://www.bloodshed.net/devcpp.html

It's an IDE which comes with both C and C++ compilers, and is fairly easy to set up.
__________________
"Whether you think you can or think you can’t, you’re right." - Henry Ford
www.vthsrobotics.org
Reply With Quote
  #9   Spotlight this post!  
Unread 20-12-2007, 16:07
popo308's Avatar
popo308 popo308 is offline
Registered User
AKA: Brent
FRC #1625 (Winnovation)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Winnebago, IL
Posts: 312
popo308 is a name known to allpopo308 is a name known to allpopo308 is a name known to allpopo308 is a name known to allpopo308 is a name known to allpopo308 is a name known to all
Send a message via AIM to popo308
Re: C coding

I would recommend Easy C or if you are going to have a basic robot such as tank drive with a basic manipulator Mplab is pretty easy to learn the basics. It only took me about a week to learn most all the basics needed to program in regular C.
Reply With Quote
  #10   Spotlight this post!  
Unread 21-12-2007, 09:11
diesel's Avatar
diesel diesel is offline
Registered User
FRC #2077
 
Join Date: Oct 2007
Location: Wisconsin
Posts: 50
diesel has a spectacular aura aboutdiesel has a spectacular aura about
C compiler

I know a little easy C from programing my vex robot, not a lot.
I also am learning PASCAL in my computer science class.
Thank you for all your help.
__________________
Design. Build. Dew.
Reply With Quote
  #11   Spotlight this post!  
Unread 21-12-2007, 09:42
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 861
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Re: C coding

You can download easyC Pro at http://www.intelitekdownloads.com
and you can have a mentor e-mail us to request your team CD-Key.
If you are a 08 Rookie we can create a team key to get you started.

If you have a Vex robot can you prototype code in Vex mode to learn
how things work.
__________________
FIRST Team 501 PowerKnights - Mentor
FIRST Team 40 Checkmate - Mentor Alum
FIRST Team 146 Blue Lightning - Alumni
Reply With Quote
  #12   Spotlight this post!  
Unread 21-12-2007, 10:01
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: C coding

Welcome to programming! I just learned how to program a few months ago, and I'm pretty good now. If you're anything like me, then you learn by a hands on example. To get started, download the robot code off of ifirobotics.com; while at IFI, download the IFI_Loader. Next you'll need MPLAB with the C18 compiler. The main program you'll program with is User_Routines.c Just look at the code and try to figure out how it works. pwm?? are the PWM outputs on the controller. 127 is center/off. Relays are H bridges, so fwd triggers one relay, and rev triggers the other relay. If you have both on or both off, whatever you are controlling will remain off. You must have a 1 and 0 or a 0 and 1 to turn something on. In robotics, you will usually leave rev at 0 and then turn fwd on and off because of the polarity of the devices. Controls are pretty simple too, it's all in user_routines.c Good luck with programming and feel free to contact me.
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364
Reply With Quote
  #13   Spotlight this post!  
Unread 21-12-2007, 14:13
Ken Leedle Ken Leedle is offline
College Student
FRC #0706 (CyberHawks)
Team Role: Alumni
 
Join Date: Mar 2006
Rookie Year: 2004
Location: Wisconsin
Posts: 37
Ken Leedle will become famous soon enoughKen Leedle will become famous soon enough
Re: C coding

Quote:
Originally Posted by RyanN View Post
pwm?? are the PWM outputs on the controller. 127 is center/off. Relays are H bridges, so fwd triggers one relay, and rev triggers the other relay.
Just a minor correction: The Victors translate the RC style PWM signal (~1ms-2ms pulse) into a straight duty cycle (0-100%) and direction signal for controlling the actual FETs in their H-Bridge. The Spikes are configured similarly to an H-Bridge, but use relays instead of FETs. Relays are electromechanical switches. Notice the audible click when they are actuated.

The MPLab IDE is fairly easy to set up and use from my experience. The code FIRST gives you takes a lot of the learning curve of programming micro-controllers out of the picture and allows you to code basic functionality without knowing the particulars of the device. It may seem intimidating at first because of the sheer volume of code, but once you figure out which sections you need to be concerned with you should find programming the robot controller straightforward.

-Ken
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
Photoswitch coding magical hands Programming 0 17-01-2006 21:20
coding problem!! HELP! wildabyss Programming 7 21-02-2005 21:48
Pneumatic Coding Problem lasoaaro Pneumatics 11 18-02-2005 12:11
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 23:03.

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