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)

Alan Anderson 15-01-2005 19:27

Re: Programming - Getting Started
 
Quote:

Originally Posted by nehalita
also, everyone speaks about a "dongle" and i saw the picture and everything. but what exactly IS it? :confused:

The Operator Interface (OI) has a 15-pin Competition Port connector in the middle of the top. Pins on that connector are used when running on a competition field to enable or disable the robot, select the radio modem frequency, and control autonomous mode. The field also supplies power to the OI through that port.

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.

Mark McLeod 27-01-2005 12:21

Re: Programming - Getting Started
 
Here's an updated version for this year with 2005 links included.

Programming Quick Start
  • Beginners need the following to program the FIRST robot:
v FRC (Full-size Robot Controller) RC Default Code

v Microchip MPLAB & C compiler



v IFI_Loader
v A standard serial cable
v A Windows PC with a serial port or USB-to-serial converter


  • MPLAB is the FIRST supplied Windows based development environment (edit, compile, debug) that runs on your desktop computer and is usually provided to each team on a compact disk in the Robovation kit. MPLAB v7.0 is also free on-line at the Microchip website http://microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName =en019469&part=SW007002 , but the C compiler is not free except via the Robovation CD and is normally only available online as a time-limited trial copy or for purchase. For a limited time the latest compiler is available from a link on http://www.usfirst.org/ (bottom left of the page where it says “Microchip Software downloads”). After the link is removed the latest compiler must be obtained through FIRST.Manuals for using MPLAB come on the FIRST CD.
  • Check the IFI website periodically for updates to the software that corrects issues and fixes problems. For instance, the first update that must be performed is the downloading of a new Master Controller “patch” http://www.ifirobotics.com/docs/master-software-ver10.zip . Follow directions included with the download.
  • 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.,
v C Programming Resource Library http://www.usfirst.org/robotics/C_help.htm has a great overview of the programming process.
v 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. http://www.rec.ri.cmu.edu/education/robot_builder/

v FIRST Robovation - A Primer for Success Learning Modules http://www.usfirst.org/robotics/robovation/primer/index.html

  • Newer laptops no longer come with serial ports. 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).
v c18_getting_started_2.4.pdf http://ww1.microchip.com/downloads/en/DeviceDoc/MPLAB_C18_Getting_Started_51295d.pdf
v c18_libraries_2.4.pdf – details on timers, interrupts, and various other utility functions available to the programmer. http://ww1.microchip.com/downloads/en/DeviceDoc/C18_Lib_51297d.pdf

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. http://ww1.microchip.com/downloads/en/DeviceDoc/C18_UG__51288e.pdf

v Microchip pic18f8520 data sheet - PIC assembly instruction set and details on EEPROM and other chip specific topics, and several others. http://ww1.microchip.com/downloads/en/DeviceDoc/39609b.pdf and mistakes in the datasheet http://ww1.microchip.com/downloads/en/DeviceDoc/80157d.pdf

v Microchip PICmicro 18C MCU Family Reference Manual – all things great and small (in excruciating detail) about the processor we use. http://ww1.microchip.com/downloads/en/DeviceDoc/39500a.pdf

v MPLAB Quick Start Guide.pdf - basic how to use MPLAB and set options. http://ww1.microchip.com/downloads/en/DeviceDoc/51281d.pdf

v MPLAB Users Guide.pdf http://ww1.microchip.com/downloads/en/DeviceDoc/51519a.pdf

  • Programming limits to the 2004 RC:
    • 30,720 bytes of program space is available to the user, after 2004 IFI code.
    • 1,343 bytes of ram available to the user, after 2004 code overhead.
    • 256 bytes of global variables available within any one MPLAB project file, such as user_routines.c
    • 120 bytes of variables can be declared within any single routine.
  • The program and data space your code has used can be checked either by the status line at the bottom of the IFI_Loader window or via the optional .map file that you can set MPLAB to generate for you. Note: the .map file lists % of program space used, but the user will have only 90% available to him or her. The .hex is ASCII and file size is no indication of code size.
Visit the ChiefDelphi Programming forum for discussions on all programming topics, problems, and issues http://www.chiefdelphi.com/forums

katkana 01-02-2005 16:06

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

695programmer 09-02-2005 19:02

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

695programmer 09-02-2005 19:37

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?

russell 16-02-2005 02:53

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?

Mark McLeod 16-02-2005 11:20

Re: Programming - Getting Started
 
Quote:

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

The compiler works on one c file in your project at a time. When it comes across a call to a function it's never seen in that particular file before it doesn't know if you are using it correctly (passing the right type of variables, getting the correct type back), so it gives you a warning that it cannot check on the validity of how you've used it in your code.

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"

Matt_Kitts 19-02-2005 12:19

Re: Programming - Getting Started
 
can anyone help me out with programming the buttons on the joy sticks`

Mark McLeod 20-02-2005 01:53

Re: Programming - Getting Started
 
Quote:

Originally Posted by Matt_Kitts
can anyone help me out with programming the buttons on the joy sticks`

Each OI joystick port has the 2005 KoP joystick buttons available in the default code as follows:
For Joystick Port 1:
  • p1_sw_top - thumb button
  • p1_sw_trig - trigger button
  • p1_sw_aux1 - button to the left of the "hat" switch on the front face
  • p1_sw_aux2 - button to the right of the "hat" switch on the front face
The other Port buttons follow the same naming convention, e.g.,
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)
printf("Hello FIRST\r");
else
printf("Goodbye cruel world\r");

There are also two analog inputs unused by the KoP joystick and the analog "hat" switch (that returns odd values).

reilly 20-02-2005 15:40

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:

Mark McLeod 20-02-2005 17:01

Re: Programming - Getting Started
 
Quote:

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

I just downloaded it and got everything.
http://www.ifirobotics.com/docs/frc-...2-2005v2.4.zip

maltz1881 21-02-2005 14:21

Re: Programming - Getting Started
 
Quote:

Originally Posted by Mark McLeod
I just downloaded it and got everything.
http://www.ifirobotics.com/docs/frc-...2-2005v2.4.zip

Is there anybody out there who can help me ASAP. Our 1 and only programmer quit on us 2 days before shipping!!!. He is the only 1 on the team that knows anything about C. I have tried other teams in our area with no luck. They are all very bust in the crunch time which is very understandable. Our team is very small with only 8 members all of whom are new to FIRST. I welcome any help that anybody can give. I am amazed by the help that others are willing to give to other teams and I feel the whole world needs to take a lesson from FIRST. Thank you :confused:

RIgnazio 22-09-2005 18:21

Re: Programming - Getting Started
 
Quote:

also, everyone speaks about a "dongle" and i saw the picture and everything. but what exactly IS it?
A dongle can be made with a RS-232 (serial) end, specifically the metal part. If you look at it, there are pins you can solder wires too. What you should do is solder a wire to each pin that would complete the circuit in the Pin Layout for the RC. Now, instead of just attaching a wire and having done it (the easy way) attach a push button switch that is normally in the off or open position. When you press it, (15 seconds), it will simulate the signal that the FIRST computer sends to the robots to start autnomous. When you let go, autonomous will be over and the robot will be live.

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

Matt Krass 22-09-2005 23:15

Re: Programming - Getting Started
 
Quote:

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

Funny, the guy we had holding our kill switch seemed oddly fascinated with the robots attempt to kill our teachers 7 year old son, so fascinated he held the switch tightly, preventing us from intervening and killing it. Until of course we realized we could just..unplug the dongle...yeeeeah.

Quote:

Originally Posted by RIgnazio
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 = 40ms. This would be a good time for a calculator.

I'm assuming you meant 1 cycle = 26.2ms

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.

Budster 30-09-2005 17:04

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


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