Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Programming - Getting Started (http://www.chiefdelphi.com/forums/showthread.php?t=30976)

Budster 30-09-2005 17:37

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

CJO 30-09-2005 18:09

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).

mallot1243 18-10-2005 07:23

Re: Programming - Getting Started
 
who knows which files are allowed to be transferred to the bot. ie <stdio.c>

Mark McLeod 18-10-2005 10:55

Re: Programming - Getting Started
 
Quote:

Originally Posted by mallot1243
who knows which files are allowed to be transferred to the bot. ie <stdio.c>

You are allowed to use any files in your project you like, even write your own as long as you include the ifi required libraries and supporting include files.

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

mallot1243 19-10-2005 12:07

Re: Programming - Getting Started
 
thanx

Joohoo 11-11-2005 15:55

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:

JamesBrown 11-11-2005 16:08

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.

Madison 11-11-2005 16:20

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?

Mark McLeod 11-11-2005 16:35

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.

Mark McLeod 11-11-2005 16:45

Re: Programming - Getting Started
 
Quote:

Originally Posted by Joohoo
... 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:

Yes, there are more ways than you can shake a stick at :)

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.;)

Madison 11-11-2005 17:04

Re: To JooHoo
 
1 Attachment(s)
Quote:

Originally Posted by Mark McLeod
Joohoo is an actual person:)
He has email enabled but not PM in his user profile.

Okay, so I must be delirious. I checked the member list alphabetically and didn't see JooHoo anywhere -- see the attached screenshot :)

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.

Mark McLeod 11-11-2005 17:46

Re: To JooHoo
 
Quote:

Originally Posted by M. Krass
Okay, so I must be delirious. I checked the member list alphabetically and didn't see JooHoo anywhere --

That's really interesting! He doesn't showup for me in the member search or list either. Only when I go directly to his userid. I wonder if "Invisible mode" has that effect?
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.

EricH 11-11-2005 18:12

Re: To JooHoo
 
Quote:

Originally Posted by Mark McLeod
That's really interesting! He doesn't showup for me in the member search or list either. Only when I go directly to his userid. I wonder if "Invisible mode" has that effect?

Same here. And invisible mode has no effect on viewing in the members list. There may be a way to change something like that, but I can't find it in the user cp options.

brianoconnor2f2 09-01-2006 18:22

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

Mark McLeod 15-01-2006 20:26

2006 Programming - Getting Started
 
2006 Programming Quick Start

1. Beginners need the following to program the FIRST robot:
  • FRC (Full-size Robot Controller) RC Default Code
  • Microchip MPLAB & C compiler or intelitek Easy C
  • IFI_Loader
  • A standard serial cable
  • A Windows PC with a serial port or USB-to-serial converter
2. Where to get everything:
  • The Camera default code for use with the CMUCam2 camera is available at the developer Kevin Watson’s website. While there you’ll also find code examples for using other benefical 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 MPLAB notepad. Manuals for using MPLAB come on the CD and are also found on-line at the Microchip website.
  • IFI_Loader v1.0.12 (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. The Main Contact of each team received an email from FIRST on 1/10/06 with directions on downloading the software.
3. National Instruments Labview came in the kit-of-parts, but you need the very useful special applications for the camera and OI dashboard that have been provided in this Chiefdelphi thread.

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.,
  • 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.
6. Newer laptops no longer come with the serial port required to download code to the Robot Controller. If you have this problem one 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.

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:
  • The 2005 IFI Control System Overview version applies to 2006 as well.
  • 2005 IFI Programming Reference Guide – basic how to hookup, program and download to the RC, hookup switches and sensors and do normal robot operations.
  • Useful programming and compiler documents come on the Kit provided MPLAB CBOT CD with the tool installations or are available from either Kevin Watson’s website or the legacy section of the Microchip website.
    1. c18_getting_started_2.4.pdf
    2. c18_libraries_2.4.pdf – details on timers, interrupts, and various other utility functions available to the programmer.
    3. 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.
    4. 2004/2005 RC Microchip pic18f8520 data sheet - PIC assembly instruction set and details on EEPROM and other chip specific topics. Mistakes in the datasheet.
    5. 2006 RC PIC18F8722datasheet and Errata.
    6. Microchip PICmicro 18C MCU Family Reference Manual – all things great and small (in excruciating detail) about the processors we use.
    7. MPLAB Quick Start Guide.pdf - basic how to use MPLAB and set options.
    8. MPLAB Users Guide.pdf
8. For the CMUCam2 sensor delivered in the Kit-Of-Parts (KOP):
  • Use the special Labview Calibration application mentioned here. to focus and test the camera.
  • Use Kevin Watson’s camera baseline program and his collection of camera documentation, but remember it only solves the headache of working the camera for you it doesn’t drive your robot.
Visit the ChiefDelphi Programming forum for discussions on all programming topics, problems, issues, and ideas.


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