![]() |
Programming - Getting Started
With the advent of a new season and the influx of new programmers-to-be I decided to do a 1 or 2 page write-up on just how a programmer new to FIRST can get started. I wrote this up to bootstrap rookie team programmers. Sort of a how does one get started when they know absolutely nothing about where to even start programming the FIRST controller. It’s not intended to replace the IFI documentation, it’s more to direct new programmers to it. I tried to stay away from most "how to program" type stuff and more advanced topics like the Linux/Windows debate and configuration management. This is just to get newbies rolling. Anyone have suggestions, additions, corrections. Everything is up for debate.
P.S. I have enough tips now to continue the recent trend in “lists”, but I’ve created three lists: One for programming tips, another for tips specific to just the control system, and the third for quick starting new FIRST programmers. Programming Quick Start
|
Re: Programming - Getting Started
1) Programming will take more time than you expect, especially if you want autonomous to work. Tell the team that the robot needs to be driving and in your (the programmer's) hands with at least three days before shipping.
2) Rookies: Don't program without sleep. Sure, you'll hear the experienced programmers bragging about a 36-hour code marathon, but all that means is that they are good at procrastinating. And working without sleep. 3) Don't forget to initialize a variable you are using as a PWM output to 127. 4) Increment your counters! (One year my robot span around in a circle for about three minutes...) 5) If at all possible, make sure the code works *before* dumping it into your robot 6) When testing your robot, lift it off the ground. Prop it up somehow. This can save lives! (well, shins, anyways) Good Luck! |
Re: Programming - Getting Started
you might want to add that sometimes serial to usb converters are really tempermental. Alot of people have trouble with them.
Maybe recommend a certain kind that is known to be more reliable than others? |
Re: Programming - Getting Started
Quote:
2) Things in theory are not always right practically. You can calculate how far your robot will go in a certain time, but when you do it practically you might find different reasons. For that reason everyone tells you to reserve a lot of time for programming autonomous. 3) Most of the time if you find a problem, look Though a C guide for syntax, or the Innovation FIRST programming guide, simple mistakes can cause you to go crazy. I agree to Noah, sleep is important, it helps you take it easy and not go bonkers programming. 4) Step by step: Don't write the whole robot code in one shot and expect it to work, do it step by step i.e. part by part, drives first, then arm, then other stuff.... 5) Will think up more and post later... |
Re: Programming - Getting Started
Download PowerPoint Module A:
http://www.usfirst.org/robotics/C_help.htm It has a great overview of the programming process. |
Re: Programming - Getting Started
1) Kill Switches: It's always a good idea to add drive/device kill switches.(If you have the time)
2) Limit switches can prevent an appendage from destroying itself. Last year my team constructed a poorly designed arm with the ability to destroy it self, limit switches are the only reason while that robot is still in one piece. |
Re: Programming - Getting Started
|
Re: Programming - Getting Started
Quote:
Comments are your friends. Use them, use them frequently, and use them intelligently. Try to document the code well enough so that someone who's never seen it before could understand it. There are certain things that you DON'T want to do - like, say, leaving excessive amounts of old code in the program but commented out, or copying and pasting PBASIC (!) into the comment sections - but it can't hurt to use them in most cases. Try to understand the basic framework of the code ahead of time. It would be nice to have your programming team know how to map the controls to the robot fuctions, or how to set up a basic autonomous mode. Be prepared to deal with time constraints. My team gets the robot with less than two weeks to go most years, and it can be hard to do what you want before you ship. Even if other teams are more efficient in getting the robot to the programmers, you'll still have to worry about making sure that your code works and that you'll have enough time to fix what doesn't. Most importantly...have fun. The programmers tend to get less credit than they deserve, but the robot wouldn't run if we weren't there. :) |
Re: Programming - Getting Started
This is an excellent overview, I'll have to make a copy for myself and the rest of the programmers on my team.
As far as programming is concerned, I have these few suggestions: 1.) LEARN BASIC or at least take a quick look. It will give you the basics of programming like logical, arithmetic, and relational operators, plus simple counter builds and other good basics. 2.) Then goto About.com's C Tutorial to learn the basics of C. How it's structured, done, etc. Try and find a simple compiler other than MPLAB while you're at it. I have Pacific C, but the site I got it from isn't working. 3.) Don't let all the script make you think it's difficult. Yes, there's a few difficult parts to get passed like the declaration of variables, knowing what they are, etc. The rest, however, is quite logical. Otherwise, just remember that you ARE the most important group of people within your team, for it is the programming that makes it a robot and not just a highly modified RC car. :D Have fun! |
Re: Programming - Getting Started
This is a good overview. But all you people talking about having programming "teams" i ask you : how is it that you get a team, for my team its always just me. And new programmers out there don't be discuraged when you get blamed for *every* problem the robot has. And don't think that you will get any fame out of the robot even if it does work. Everyone else in the team gets that. But hey us programmers get to have all the fun so i soppose it's a fair trade. :D
|
Re: Programming - Getting Started
|
Re: Programming - Getting Started
Quote:
Dr Joe has recommended a Bafo Technologies BF-810 if I recall correctly. From last year's experience, I have to concur that some are VERY tempermental. Thanks everyone......this is a really good thread Eric |
Re: Programming - Getting Started
KISS- Keep It Simple Stupid
Example: 2003: Our robot, Miss Daisy II won the Galileo Division at Nats. Number of Speed Controllers: 3 2004: Our robot, Miss Daisy III didn't work at Chesapeake, didn't work very well at Drexel or Nats, and only started working in the offseason. Number of Speed Controllers: 10-12 (too many) Don't let the mechanics bully you into trying to add way too much stuff. Simple stuff can work quite well and it also gives time to write a nice autonomous program. |
Re: Programming - Getting Started
Quote:
I'll post the programming and control systems list later on in the week. I almost pulled a gwross and have a sprained wrist, so typing is slower. It's hard to post fast enough to beat the time-out. |
Re: Programming - Getting Started
this helped me soooo much. thank you all. this is our second yr competing and this is my first year in FIRST. i have a java background and a simple C background from 8th grade...but it was so long ago. :eek:
I'm the only one in charge of programming so when i was handed all these Cd's and codes and links and websites, i was pretty overwhelmed. i just learned about this today and I've spend the majority of the day looking through posts to answer my Q's is there anyone here that i can directly e-mail or talk to if i have questions? (warning: I'm like a pet, i demand a lot of attn: i have questions everyday....or close to it) :( also, everyone speaks about a "dongle" and i saw the picture and everything. but what exactly IS it? :confused: |
Re: Programming - Getting Started
Quote:
Teams are permitted to connect to four specific pins on the Competition Port, in order to 1) enable additional frequencies for practicing with multiple robots, 2) activate autonomous mode for testing, and 3) disable the robot. Most teams build a box with two or three switches that connects to the port. That box is called a dongle. The Competition Port Pinout Guide shows how to construct one. |
Re: Programming - Getting Started
Here's an updated version for this year with 2005 links included.
Programming Quick Start
v FRC (Full-size Robot Controller) RC Default Code
v C Programming Resource Library http://www.usfirst.org/robotics/C_help.htm has a great overview of the programming process.
v c18_getting_started_2.4.pdf http://ww1.microchip.com/downloads/en/DeviceDoc/MPLAB_C18_Getting_Started_51295d.pdf
|
Re: Programming - Getting Started
*waves hand* hi... I'm another of the newbies with little (read, none) experience working with C. I am also the only one on my team doing the programming dance. At the moment I'm teaching myself from whatever tutorials I can find, but if anyone can spare a moment or ten through e-mail or IM to answer my questions, I would be muchly indebted to you.
AIM- daemonlvr856 e-mail- krystal_dragon9@yahoo.com THANK YOU!!! ~kat |
Re: Programming - Getting Started
I'm another newbie, with probably less experience than the other two and just as hopeful maybe someone could give me some time cause i'm running into problems i don't know how to solve. Any help is welcome via im or e-mail or anything.
Team 695 |
Re: Programming - Getting Started
I have another one i forgot about, when I try to build the error is that it can't locate the build tool, any insight?
|
Re: Programming - Getting Started
I really am a newbie. Heres proof. Can I call the function Limit_Mix as it exists in the v2.4 code from the autonomous mode section of user_routines_fast.c? I was under the impression that I can, but when I just tried to compile it gave me warnings about no function prototype (whatever that is :confused: ), but it seems to have compiled anyway. Anyone?
|
Re: Programming - Getting Started
Quote:
You just need to tell the compiler a little bit about the function Limit_Mix. A function prototype does this, and it can be added to the top of your user_routines_fast.c file, or better yet to the user_routines.h file that gets included by user_routines_fast.c, like so: Code:
unsigned char Limit_Mix (int);Prototypes is one of the main uses of the .h files, so any other file that needs to use Limit_Mix for example, will just need to include "user_routines.h" |
Re: Programming - Getting Started
can anyone help me out with programming the buttons on the joy sticks`
|
Re: Programming - Getting Started
Quote:
For Joystick Port 1:
p2_sw_top would be on joystick Port 2, p3_sw_top on Port 3, etc. They are used in your code like this: Code:
if (p2_sw_top == 1) |
Re: Programming - Getting Started
Mark:
Great review, could you post a link to the latest default code v. 2.4 for 2005; I downloaded the file from http://www.ifirobotics.com/rc.shtml#Programming and upon extracting it there is nothing in the files. Maybe someone else has a good copy. Thanks. :ahh: |
Re: Programming - Getting Started
Quote:
http://www.ifirobotics.com/docs/frc-...2-2005v2.4.zip |
Re: Programming - Getting Started
Quote:
|
Re: Programming - Getting Started
Quote:
Now, why do you say use a switch you may wonder? And why use a normally off/open switch? If your robot goes on an evil plot to kill you and you start to run away, you will let go of the switch, and the robot won't do autonomous anymore. OK, newcomers, there are a few tips that I myself have: 1. Programming takes time. If it doesn't work correctly/compile on the first attempt, and you can't figure out what is wrong, Save the file, close out MPLAB, and go do something for an hour then come back. It will probably hit you then. 2. Pay attention to the default code. It is your friend. It will tell you just about absolutely everything you need to know to program the robot. 3. Autonomous mode is not hard, you just need to think about it. Remember, there is a 40ms clock in the RC, so 1 second = 26.2ms. This would be a good time for a calculator. 4. NEVER DELETE OLD CODE. 5. Always put new code, even if you're only changing a comment, in a new folder. SAVE AN ENTIRE SEPARATE COPY! 6. NEVER DELETE OLD CODE. Those should be your ground rules. Enjoy :) |
Re: Programming - Getting Started
Quote:
Quote:
I'm not sure where you got 40ms, but my memory is bad, and I remember two loops running in the RC, perhaps you're referring to a separate one than I am. |
Re: Programming - Getting Started
>> 3. Autonomous mode is not hard, you just need to think about it. Remember, there is a 40ms clock in the RC, so 1 second = 26.2ms. This would be a good time for a calculator.
Maybe it should read 40MHZ clock in the RC. There is a 26.2ms sample time in the outer/main loop where you get new input from the operator station so in 1 second that is 40hz, i.e. 40 samples per second (actually is 28.167...hz, but 40hz is probably close enough)? Not really sure what the intent was, I'm having trouble parsing the line. Bud |
Re: Programming - Getting Started
I had some students that had the fundamentals of C and how to program it. They could build "hello world" programs with ease. But they quickly got lost when trying to implement the hardware control logic in C to use sensors or manipulate motors/actuators/etc.
In my first year as rookie mentor, what I found the hardest was that I spent 80% of my time trying to figure out how the hardware worked and how to program it to work effeciently. I spent 1% of my time helping write and debug C code and 19% of my time trying to figure out what the pecular limitations of the C implementations were and why sometimes the compiler generated some "unusual" and long/complex sequences of assembler. I've been trying to put together a presentation on programming the hardware with examples to help out - but it quickly gets overwhelming and I have to start again. Although you do have to start by learning the C language and how to construct programs... understanding which bits to twiddle and when to do so to control things seemed to take a lot more of the time than ramping up on C. In this respect the PIC18C and PIC18F manuals became my bed time reading for most of last year. I am planning on spending some time this year teaching how to read hardware specifications to help students decipher some things on their own. Bud |
Re: Programming - Getting Started
I think that it is really important to use some kind of content management (even if you are by yourself) because it allows you to roll back to previous versions. CVSDude offers free subversion/CVS accounts to non-profit organizaitons, and is very reliable.
Doing this can save you a lot of time by simply rolling back to an earlier version, and can even allow simultaneous development of different ideas (branches). |
Re: Programming - Getting Started
who knows which files are allowed to be transferred to the bot. ie <stdio.c>
|
Re: Programming - Getting Started
Quote:
However, be aware that the PIC is limited in it's capabilities and will not support or fully support the functions you may want to use in a typical stdio.c file. You can't just drag one in from a PC and expect it to work. You can check the documentation (C:\mcc18\doc) to see what is supported by the C18 compiler. The document that might interest you for the C18 v2.4 compiler is at: http://ww1.microchip.com/downloads/e...Lib_51297d.pdf |
Re: Programming - Getting Started
thanx
|
Re: Programming - Getting Started
Right now I am one of two programmers on my team and we both can't figure this out(we're both rookies). We can write the code for the autonomous mode, build it, and transfer it, but how do we tell the FRC to execute the autonomous coding?? We copied everything and tried to mess around with Main.c but is there any less hazardous way to go about it?? :confused:
|
To JooHoo
JooHoo I got your private message but got errors when i tryed to send you one, it said you had selected not to recieve private messages. You should be able to fix this in the User CP.
I hope this answers your question. To run your autonomous code you need to build a mock competition port (a couple of switches that attach to the competition port to allow you to use autonomous and to disable the robot.) You need a 15 pin serial adapter (i dont know if that id the right name but it is the thing that plugs into a serial port.) The pinout diagram for the port can be found at http://ifirobotics.com/docs/competit...guide-reva.pdf It is easy to make one (it took me about 10 minutes) and will make your programming much easier. Last season we didnt make one and that ment i couldn't teas my autonomous until a practice meet 2 days before ship. We mad one between our regional and the off season competitions and I was able to write 5 succesful autonomous codes in one day. It will save you alot of late build season stress. |
Re: To JooHoo
I can find no member named JooHoo. Are you certain you tried to send your PM to the correct person?
Brandon, could this be an account that was recently deleted or suspended? |
Re: To JooHoo
Joohoo aka http://www.chiefdelphi.com/forums/me...p?userid=11578 is an actual person:)
He has email enabled but not PM in his user profile. |
Re: Programming - Getting Started
Quote:
One is to build a competition port dongle that allows you to flip a switch and the code in main.c will react the same as in competition. There are lots of references to them in this thread and James Brown pointed you to the pinout diagram in another more personalized thread post (his post is here now). In the long run a dongle is a very important device to have as it also provides you with a DISABLE switch that overrides all autonomous programming errors! Another is to simply pick a switch of your own, such as an unused button on a joystick and have the code in main.c set the autonomous bit as long as it sees that button pressed. There are lots of variations on this and it's certainly safer than hardcoding it within main.c. Use your imagination. Just remember to remove it from your competition code unless you come up with an interesting autonomous move that's useful in the middle of this year's game.;) |
Re: To JooHoo
1 Attachment(s)
Quote:
I looked at his profile and searched by his real name and didn't find that, either. I'm sick, so it's entirely plausible that I'm also crazy, but I think I'm just overlooking something stupid here. |
Re: To JooHoo
Quote:
He's a ghost of ChiefDelphi. We can only see him when he posts something. P.S. Thought you'd be interested. 810 Smithtown isn't registered this year. The team is still around and was in a recent parade, but the school budget went down and they're on an austerity budget. |
Re: To JooHoo
Quote:
|
Re: Programming - Getting Started
Hey Thanks fellas This is my first year and I'm a programmer and am used to C++, C isnt much different but I still need all the help I can get. Thanks.
-Matt |
2006 Programming - Getting Started
2006 Programming Quick Start
1. Beginners need the following to program the FIRST robot:
4. Check the IFI website periodically for updates to the software that corrects issues and fixes problems. For instance, new Master Controller “patches” if any, will be made available there. Directions will be included with any download. 5. The programming language used is “C” or PIC assembly. Tutorials in C can be found on the web, in your local bookstore or on the FIRST website, e.g.,
7. Documentation is your friend. Take the time to at least leaf through each manual, so you have an idea of where information can be found. Most of the basic information beginners require can be found in the IFI documents or MPLAB documents available from the websites:
|
Re: Programming - Getting Started
Quote:
|
Re: Programming - Getting Started
I tried to get a look at the dogle, and sorry for spelling mistakes now, but the link would not work.
|
Re: Programming - Getting Started
|
Re: Programming - Getting Started
Quote:
|
Re: Programming - Getting Started
Quote:
|
Re: Programming - Getting Started
Quote:
The "Practice" switch in the schematic no longer serves a purpose in post-2004 controllers. |
Re: Programming - Getting Started
Quote:
Quote:
Quote:
|
Re: Programming - Getting Started
Quote:
http://www.ifirobotics.com/docs/comp...guide-reva.pdf This allows you to kill the robot from the OI instantly, with no doubt, and test autonomous mode as if the field activated it, so you don't need to play with the autonomous activation code and risk accidentally starting it mid-match (Been there!). I highly recommend a dongle for every team and if you're not confident in your skills at making one you can purchase from AndyMark here: http://andymark.biz/mode-switch.htm Some people also go with spring loaded switches, so all you have to do is let go and the robot is disabled, problem with those is they become a pain for longtime testing. |
Re: Programming - Getting Started
A few basic tips:
|
Re: Programming - Getting Started
Our main programmer that did most of the work went to a different school so I'm actually going to have to learn to code C this year.
This topic is a real help thanks guys. |
Re: Programming - Getting Started
Cool this is perfect for a beginner programmer as I.
|
Re: Programming - Getting Started
Mark,
I have already looked for some articles on autonomous programming and have found a few. Do you have a favorites list or best list for less experience autonomous programmers? |
Re: Programming - Getting Started
hi peoples,
i just registered so that i could thank kevin for his work on the software and making it as dummy proof as possible - believe me i need it! this is the first year our team has used the camera and it is quite the challenge. your code is readable, i can follow along with your train of thought & our team has a pretty bright student handling the guts of the camera work (i give him the hard stuff, while i just read manuals :o ). with these three things i think we have a fighting chance at getting a camera functional AND useful! thx again, keep up the great work! slloyd |
Re: Programming - Getting Started
Where do you guys get your D15 pin connectors for making the autonomous dongle? And also for game ports so you can wire switches to your control box etc... I can't seem to find these anywhere.
|
Re: Programming - Getting Started
Quote:
15 Conductor 24 AWG Bulk Cable 100ft http://www.jameco.com/webapp/wcs/sto...roductId=31844 Solder Cup D-Sub Connector, DB15 Male http://www.jameco.com/webapp/wcs/sto...roductId=15035 Assembled Hood Kit, DB15/HD26 Gray http://www.jameco.com/webapp/wcs/sto...roductId=15019 Toggle Switches - 2 State http://www.jameco.com/webapp/wcs/sto...duct Id=76523 Toggle Switches - 3 State http://www.jameco.com/webapp/wcs/sto...duct Id=21910 |
Re: Programming - Getting Started
Something else that's amazingly helpful is WPlLib. WPIlib simplifies programming a great deal by storing a vast majority of the code in a library file that is automatically called when ever you need it. No default code is needed. Further description, documentation, and downloads can be found here. A thread on the subject is located here.
|
Re: Programming - Getting Started
Overdue for updated links and accounting for 2007 changes...
2007 Programming Quick Start 1. Beginners need the following to program the FIRST robot: v FRC (Full-size Robot Controller) RC Default Code v Microchip MPLAB & C compiler (only from the Kit-of-Parts (KOP) CD) or Intelitek Easy C also in the KOP. v IFI_Loader v1.1.0 (from the KOP CD) v A standard serial cable v A Windows PC with a serial port or USB-to-serial converter 2. Where to get everything: -Basic default code, updates, documentation, and support information is available on the Innovation FIRST (IFI) website, in particular at: v 2007 default code comes ready for basic driving and with a variety of sample I/O usages. v Robot Controller v Operator Interface v CMUCam2 -The Camera default code for use with the CMUCam2 camera comes in two versions, one for the MPLAB native C programming environment and the other for the EasyC development environment. The MPLAB version is available at the developer Kevin Watson’s website. While there you’ll also find code examples for using other beneficial sensors. This default code may have the normal driving mode disabled. -MPLAB is the FIRST supplied Windows based development environment (edit, compile, debug) that runs on your desktop computer and comes in the Kit-of-Parts wrapped inside the small clipboard. Manuals for using MPLAB come on the CD and are also found hosted on-line at Kevin Watson’s website. IFI_Loader v1.1.0 (also on the KOP CD) is used to download the compiled code into the RC via a serial cable from your desktop or laptop computer. -EasyC from Intellitek can be used instead of MPLAB or as a rapid prototyping tool. It came in the KOP in the bag with the robotics magazines. The Main Contact of each team received an email from FIRST a software key to activate one installation of the software. -- The EasyC version of the Camera default code for use with the CMUCam2 camera is available at Intelitek's website. 3. National Instruments Labview came in the kit-of-parts and has some optional special applications for the camera and OI dashboard among others have been provided in this Chiefdelphi thread and discussions can be followed in the Chiefdelphi EasyC Pro forum. 4. WPI has developed a potentially useful approach to programming your robot. Details are at WPILIBand discussions can be followed in the Chiefdelphi WPILIB forum. 5. Check the IFI website periodically for updates to the software that corrects issues and fixes problems. For instance, new Master Controller “patches” if any, will be made available there. Directions will be included with any download. 6. The programming language used is “C”, EasyC, or PIC assembly. Tutorials in C can be found on the web, in your local bookstore or on the FIRST website, e.g., -- C Programming Resource Library has a great overview of the programming process. -- Learn C Programming - Developed by Carnegie Mellon and the National Robotics Engineering Consortium specifically for FIRST, this interactive website will get your team prepared for the FIRST Robotics Competition. 7. Newer laptops no longer come with the serial port required to download code to the Robot Controller. If you have one of these laptops a solution is to use a USB/Serial converter. Various models are available at Radio Shack, CompUSA, or online, however, some models can be temperamental and they generally take longer to download than a built-in serial port (60sec vs 10 sec). Good results have been reported using: Bafo Technologies BF-810 (~$15) and a Radio Shack USB-to-Serial port cable #26-183 ($42). You can also use the converter that comes with the Radio Shack Vex Programming Kit. 8. Documentation is your friend. Take the time to at least leaf through each manual, so you have an idea of where information can be found. Most of the basic information beginners require can be found in the IFI documents or MPLAB documents available from the websites:
v c18_getting_started_2.4.pdf v c18_libraries_2.4.pdf – details on timers, interrupts, and various other utility functions available to the programmer. v c18_users_guide_2.4.pdf - table of max numbers each variable type will store, compiler options, error messages, detailed descriptions of pragmas and some other advanced topics. v Microchip pic18f8722 data sheet - PIC assembly instruction set and details on EEPROM and other chip specific topics. Mistakes found later after the datasheet was published. v Microchip PICmicro 18C MCU Family Reference Manual – all things great and small (in excruciating detail) about the processor we use. v MPLAB Quick Start Guide.pdf - basic how to use MPLAB and set options. v MPLAB Users Guide.pdfVisit the ChiefDelphi Programming forum for discussions on all programming topics, problems, issues, and ideas. |
Re: Programming - Getting Started
Im experienced in programming but im new on FRC is that an advantage???
|
Re: Programming - Getting Started
I need help how can i program the robot controller to have my team number
how do i put my team number on a FRC Robot Controller that is my question please help:confused: |
Re: Programming - Getting Started
You set your team number using the binary dip switches on the Operator Interface (OI) labeled "Team Number."
--Tether the OI and RC together. --Power up the RC (the OI will get it's power through the tether). --Press the "Select" button on the OI three times and it will display the current team number setting. As you change the dip switches you will see the team number display also change, so it's easy to verify you've set your team number correctly. -- The left most dip switch is the most significant bit. Each switch is "1" if the front is pressed down and "0" if the back of the switch is down. You can figure out the binary number of your team, or start with all the switches set to zero then beginning at the left flip the switches one at a time. If the number you get after you flip a switch to "1" is lower than your team number, keep it. If the resulting number is higher put that dip switch back to zero and go to the next one on the right. |
Re: Programming - Getting Started
Sorry Marc. I didn't notice this right away.
I have some books I've taken excerpts from for the kids to read, such as Programming Robot Controllers by Myke Predko The Personal Robot Navigator by Miller, Winkless, and Bosworth and some random articles I've used with students. Obviously covering state machines, but also some behavioral programming, waypoint navigation, that type of thing. I've found most kids respond most rapidly to programs structured as a series of lessons of increasing complexity where they can get down to experimenting with autonomous driving their first day on the job so to speak. (I purposely use robots that don't have remote controls.) Quote:
|
Re: Programming - Getting Started
Quote:
Quote:
|
Re: Programming - Getting Started
Quote:
its usually a piece of hardware (USB flash drive) that a program needs to be used in order for it to work some programs allow them to be "virtual dongles" or a software dongle, but usually its a hardware device. --------second point--------- New programmers might also check out Kevin's code and test it out. Testing and checking is a must! |
Re: Programming - Getting Started
Quote:
When talking about the USB/Serial hardware, we usually use the term "adapter" (as in a USB-Serial adapter). We rarely use the term "dongle" to describe a license device, since none of the software teams use requires one. (Correct me if I'm wrong.) |
Re: Programming - Getting Started
ok, i have read all of this and it seems helpful for coding the robot in C....But we have easyC and it seems simple enough to just drag and drop and get teh code to the controller but i can't get it to do anything. I belive i have tried just about all options with it and still no results. Maybe i should give up eacyC and go with an actual C compiler. I don't know....i could really use some help....
This is my first time in any kind of robotics activity ever. Programming languages i know are VB, dark basic(not useful but jsut fun!), and a little bit of C++...Im the only programmer on my team so i really could use some help |
Re: Programming - Getting Started
Don't give up on EasyC.
You just need some direction. Easy C Pro, the version FRC teams work with has it's own forum over here: http://www.chiefdelphi.com/forums/fo...play.php?f=164 Post your questions there. |
Re: Programming - Getting Started
I believe that the name EasyC is misleading, C is not that easy.
|
Re: Programming - Getting Started
What happened to the coder's update post for '07-'08? Look at the post dates.
And does anyone know how they want us to handle the new '08 version of Autonomous Mode, with the 4-button controller? The code platform for the older versions of MPLAB and even the code in the ROBOTC package just released doesn't seem to have the codes for interfacing with the 4-button controller, just the old Autonomous Mode codes. Is this just a futile question? Am I just completely not making any sense? :confused: Please help. |
Re: Programming - Getting Started
You might want to try looking on the countless threads kicking about regarding the IR sensor... There should be a decent amount of information there, although, as far as interfacing the sensor, I believe it's a matter of four digital inputs and then just synchronizing the signal? Don't know, there are a lot of threads around, though.
|
Re: Programming - Getting Started
We have hit a programmers worst nightmare. A cyber brick wall. No communication between the RC board and the computer. It's worked before, but for some reason, it took a giant dump on itself. We are so frustrated right now most of us just feel like dropping the tools and going home... :mad:
We are using a very noob friendly program called RobotC. This program is used for VEX but has an option to be used for FRC instead. Any other compatible programming is like a foreign language and we have no clue how to use it. If anyone has a miracle, we will display your name and achievement in big letters on our bumpers. |
Re: Programming - Getting Started
*****************************
** The Rookie Programmer's Primer ** ***** by Dr. Andrew Winslow ****** ***************************** What follows is a guide/list of do's and dont's for Rookie Teams to help them get a focus of how to approach the programming process for their "First" robot. This guidebook is basically a list I've come up as I helped mentor my First (USFirst.org *and* first-time mentor hehe) team. The team itself was a Rookie team just as I was a Rookie mentor. Needless to say, it was a tremendous learning experience for all involved. Here we go: ************************************************** ******** ************************************************** ******** Job #0: Access Code Your zero'th job as a programmer will be to understand your programming environment (EasyC, MPLAB, LabVIEW, etc..). You will need to know how to use While Loops, If/Then/Else Statements, Declare Variables, create Timers and Waits, and create Subroutines. All of these functionalities of the language should be well understood to where you can perform them with ease. You will also need to know how to download your code down onto your bot's controller. Trust me when I say you will be doing this a lot, so you should be able to push your code at a moments notice. Note: COMMENT YOUR CODE!!! Placing comments throughout your code will make your job easier and will also aid anyone else that may need to look through your code. It is a real life-saver during debugging. ************************************************** ******** ************************************************** ******** Job #1: Sunday Driver Your first job as a programmer will be to get a basic driving program written for your bot. Typically, most teams approach their chassis first, so you should get this code going asap. Having a driveable bot will be a great sense of achievement for your whole team and will fuel the desire for more success. The team I was on was able to (in a 12 hour day), complete the chassis and drive train, and get a basic 2-joystick tank drive program downloaded onto the bot's controller. It was a wonderful kickoff for our team and injected loads of enthusiasm that kept us coming back for more. ************************************************** ******** ************************************************** ******** Job #2: I Sense Trouble Your second job as a programmer (after getting your chassis driving) should be to start work on understanding all of the sensors shipped in your First Kit. The benefit of this is that it is a programming task that can be performed in parallel with the mechanical/electrical design and fabrication. Here's the order I would recommend tackling them in: 1) Gear Tooth Sensors - As a rookie team, you will likely not have time to work on the more advanced sensors like CMU Cameras and such. This pair of sensors, to be mounted near the drive sprockets on either side of your bot, will ultimately enable you to have a bot that can drive (roughly) straight, and then be able to turn corners at programmed distances. This is the primary sensor needed to get a basic program written to have your bot be able to run a pre-programmed course *autonomously*. The 'pre-programmed' part will take a bit of work and will require *dedicated access* to a working chassis, so for starters, just work on understanding how to measure the sensor. Once you have a program that can measure this sensor properly, move on to the next sensor. 2) Contact Switches - Contact Switches (a.k.a. Limit Switches) are integral to the design of many bots. They will allow you to sense when an arm or other moving part has reached a given location or attitude. They can also be used on bumpers or other parts of your bot to detect if it has contacted a wall or other obstruction. 3) IR Board - This board will allow you to send up to 4 commands to your bot using a common stereo or tv remote control. The team I was mentoring never had time to get this sensor working and I greatly regret not seeing the value it would have given to our bot. 4) Yaw Rate Gauge and Accelerometers - Note: YOUR BOT WILL BE HIT! This is an unwritten fact. However, successfully measuring these sensors will be able to tell you how much your bot has been turned and moved by the collision. You can then feed this information back to your Gear Tooth Sensor code to be able to correct for the wheel-slippage and thus get you back on track. If understanding these sensors starts taking too long, they can be dropped and you can just run your bot autonomously using a lot of faith and luck. There may be more sensors your team has sketched into your design. If the sensor is critical to the success of your bot, tackle them as well. If it begins to take too long though to get them running, put them on the back burner and move on to the next phase. A side note on sensors: Have your electrical design such that the robot controller board is easily removed from the bot. This will allow the programming team can yank it out while the mechanical/electrical teams are working on the rest of the bot. While it is removed, you can connect your pc up to the programming port on it, connect your sensors, and toy around with them without interfering with the other parts of your team. ************************************************** ******** ************************************************** ******** Job #3: It's All About Control After getting your sensors up and running, you will need to start work on the Controls for your bot. This involves all physical actions your bot needs to do to perform its assigned task and includes all of your bot's motors, actuators, and pneumatics. You should tackle these in order of importance to your bot's design. If you have a lifting arm that does most of the work, make sure you understand how to accurately drive its motor so the arm gets where it needs to go. If you have pneumatics, learn how to make your pistons extend and retract properly. A design note here: For the actionable parts of your bot, try to envision whether they will need to be controlled via analog or digital. Any given action needs to be able to be set to either a range of values (analog) or to purely on/off, up/down, or forward/backward values (digital). Be sure to count all your inputs (sensors) and outputs (controls) and make sure that the robot controller board has enough I/O ports for the task. ************************************************** ******** ************************************************** ******** Job #4: System Integration This is the last step of the fabrication process. It is the process of bringing all the parts together into a working whole. If all teams have been working in parallel with one another, hopefully everyone should reach this phase at nearly the same time (I did say *hopefully*). Granted, the programming team may be a bit behind the others. This will be due to the fact that you've been trying to write code for something that you haven't had dedicated access to. This will likely be your crunch time. Late nights will be spent here so be sure to stock up on your favorite caffeinated beverage and memorize the phone number to the local pizza delivery guy. ************************************************** ******** ************************************************** ******** Job #5: This Is Just A Test The final phase is testing. Test - Refine Code - Deploy - Lather - Rinse - Repeat. One good thing about this phase is that you've already memorized the phone number to the local pizza place. You may need to restock on sodas though. ************************************************** ******** ************************************************** ******** I hope this information can be used to help future Rookie Teams be able to achieve as much success as can be had. Good Luck!!! - Andy |
Re: Programming - Getting Started
can anyone tell me what macros, constants, and stuff like that are for? as in, what do they modify-Relays,PWM or what? and can i have an example of a code and tell me what it does to the robot?
|
Re: Programming - Getting Started
Quote:
Instead of changing pwm01=150; to pwm03=150; You would just change a value assigned to the macro like Left_wheel_pwms pwm03 It save a lot of time spent on hunting errors. A constant is user defined such as pi 3.14 and helps the compiler catch errors. Sorry, can;t give code right now,no computer and I don't type very fast. |
Re: Programming - Getting Started
where can i find a gear tooth sensor code? Just post the link.
thank you in advance, team 2604. |
Re: Programming - Getting Started
Quote:
|
Re: Programming - Getting Started
Quote:
Thanks Andy!!!! Jacob |
| All times are GMT -5. The time now is 11:20. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi