|
|
![]() |
![]() |
|
|||||||
|
![]() |
Thread Tools | Rate Thread | Display Modes |
#1
![]() |
|||||
|
|||||
reprogram during a competition
At the risk of poking at a delicate subject – could the robot legally reprogram itself during a competition?
With a normal match the UI and the RC are in constant communication, but until the 15 sec autonomous mode is up, none of the joystick inputs (read – any input that operators can control) are active. As we have covered in other threads, a switch set before the match started could be detected by the robot before the controls were nulled. However it is blatantly wrong to have the robot be reprogram itself based on, say, at the location of the vision tetras: although theoretically possible with a 16F84, a flash card, and some clever coding and a 6 way switch. My question pertains to reprogramming of the robot, by the robot, at the end of the 15 second autonomous period. My team has had problems with limited memory of the PIC, and with camera tracking and accelerometer algorithms we are close to the maximum size, without any of the operator-assist code. Consider this example: When the 15 seconds of self control time is up, the autonomous flag is cleared; the RC pulls a digital output high. A carefully programmed microcontroller would emulate the serial port of a PC, putting the RC into boot loader mode and handing it the second set of code from an external EEPROM or “flash drive”. After the 1.5 or so seconds that the process takes, the robot is reset with its new code and on its way for the 2 minutes of user control. anyone have any comments? does this violates any FIRST rules? Thanks – jsd Last edited by jacob_dilles : 01-24-2005 at 08:59 PM. |
#2
![]() |
|||||
|
|||||
Re: reprogram during a competition
I am not a programmer but could you explain why you would need to do that after Auto mode is over the robot is in driver mode and the only programing that you would need is what is need to run from the controller to the robot, right?
Just remember that i am not a programmer, I would just like to know why that would be needed. so please be nice if I sound really dumb. |
#3
![]() |
||||
|
||||
Re: reprogram during a competition
I would suggest a much simpler way of achieving the same results: optimize your code. It's free, and much less likely to malfunction. I truely doubt that you actually are going to run out of memory, but if you do, come up with creative ways of doing things. Use fewer variables. For example, if you were trying to swap two variables, instead of doing:
Code:
int c; c=a; a=b; b=c; Code:
a+=b; b=a-b; a-=b; Last edited by jgannon : 01-24-2005 at 09:14 PM. |
#4
![]() |
|||||
|
|||||
Re: reprogram during a competition
Quote:
Our driver code is both complex and long, and we go over it hours at a time trying to make it shorter, and it’s still huge. We use sensors to measure rotation and two direction acceleration, and make changes to the motor outputs based on where the robot is and where the operator wants the robot to be. And all of the arm controls, limits, etc take up space too. The memory on the RC is limited to start with (a couple of KB). It doesn’t help that the chip was designed to run assembly and we compile C++ to it… C is a complicated high level language that uses lots of libraries that take space. Then IFs “default” code is a beast (its got to be compatible with every team), but you cant ditch it because they wont give you total control over the RC (it’s a boot loader, ugg). And some of our programming team members write crummy code. All and all, memory is precious, and the more the better. I hope this answers your question, jsd Quote:
Quote:
Quote:
Thanks though – jsd Last edited by jacob_dilles : 01-24-2005 at 09:25 PM. |
#5
![]() |
||||
|
||||
Re: reprogram during a competition
I believe your effort would be much better spent optimizing your code to make it smaller as others suggested. There is a lot you can legally and safely strip out of the default code. Additionally, once you have your code debugged and in a stable stage, you can start rewriting stuff to sacrifice manageability and "good" programming practice for smaller size.
BTW, we are programming in C, not C++ and every robots code that I have seen uses very few extra libraries. |
#6
![]() |
||||
|
||||
Re: reprogram during a competition
Quote:
Look at the Additional Parts flowchart in section 5 of the manual to determine if this device is legal or not. If you don't get a satisfactory answer, try the FIRST Q&A. One more note on the practicality of this: maybe our programming computer is different from yours (1.8GHz seems like enough), but it takes a bit longer than 1.5 seconds for me to send code to the RC with IFI Loader. |
#7
![]() |
|||||
|
|||||
Re: reprogram during a competition
Quote:
in order to save memory, my team is using #define s for as much as possible, so when you compile/build it, as much as possible is already done. also, the same for some of the autonomous calculations--look up tables are faster and smaller than calculating something. (especially for trig functions, which you might need for autonomous--distance). ![]() plz tell me if im horribly wrong or something... thanks, ~Stephanie |
#8
![]() |
||||
|
||||
Re: reprogram during a competition
If you need a sufficiently small number of values, table lookup will
save space. It just depends on how many you need. In the general case, an algorithm will save space and table lookup will optimize for speed. The use of #define will not necessarily save space (except in your source files, where you don't care). It depends on how you are doing things. To save space with constants, you want every reference to the value of the constant to be to the same memory location. If you just use the define, you will be storing the constant value everywhere it is used. |
#9
![]() |
|||||
|
|||||
Re: reprogram during a competition
I might be totally missing something, but like jgannon says it takes (me at least) way more than 1.5 seconds to download a program to the RC. More like 1.5 minutes. And why dont you simply do the processing on something else (how much does a 386 cost?) and just use the RC for I/O?
|
#10
![]() |
||||
|
||||
Re: reprogram during a competition
Jacob,
At the risk of sounding condescending, I can't believe that anyone is running out of space. If so, take a good hard look at what you are doing. Programming an embedded system is absolutely nothing like programming a PC. First rule: Never, never, ever use floating point arithmetic. Second rule: Never, ever use dynamic allocation of memory. Third: Avoid pointer manipulations unless you understand what it does in the machine (some dereferencing manipulations are murder). Look at the assembly code being generated by the compiler. You can see it in the .lst file that is generated when you build your project. Good Luck, |
#11
![]() |
||||
|
||||
Re: reprogram during a competition
Quote:
|
#12
![]() |
|||||
|
|||||
Re: reprogram during a competition
Quote:
Navigation (and all the trigonometry it requires). Multiple independently-tuned PID controls. Adaptive autonomy. Finally, lots and lots of text for communicating with the camera. I can easily understand someone running out of space. Last year's robot only did about half of what we have planned for this year, and it's using about 65 percent of the space. |
#13
![]() |
|||||
|
|||||
Re: reprogram during a competition
I have to agree with Alan that if you try to dump everything possible this year into the program it can grow large.
Maybe not what you are looking for, but have you tried using the built-in compiler optimization to reduce your program bulk? In MPLAB
You have gotten rid of the IFI printf code, right? |
#14
![]() |
||||
|
||||
Re: reprogram during a competition
Quote:
Quote:
Quote:
|
#15
![]() |
||||||
|
||||||
Re: reprogram during a competition
im sorry if you misunderstood my question. i was wondering if reprograming the robot was legal durring the compitition.
Quote:
![]() Quote:
Quote:
Quote:
Quote:
Im not a "newbie" programmer, ive have been the head of our programming team since my freshman year. I have taken collage level CS in JAVA and C, as well as many, many courses on programming in just about every other modern high level language. However, i have been doing this for a relatively short period of time -- there are people that are much better at this then i will ever be, and many of them participate in FIRST. i never pretend to know everything, so i respect everyone on the forums, and assume they know more then me, and in turn I hope they respect me also i try very hard to keep delphi threads to the point... but stuff like Quote:
![]() external processing is what our team has planned thus far. and i will be sure to try Marks optimization process... i wasnt looking for a lecture on how to optimize code (read the thread title!) i was looking for the legal implications of reprogramming the robot during a match. Thanks anyway – jsd |
![]() |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
CMUcam II and competition lighting environments | dlavery | Programming | 5 | 02-16-2005 01:07 AM |
2004 WPI EBOT Competition (using Robovation robots) | ahecht | Off-Season Events | 3 | 11-04-2004 08:25 PM |
FANATIC - Offseason Animation Competition | opnickc | 3D Animation and Competition | 15 | 06-10-2004 07:54 PM |
New Competition in MI, Mailing List | Allison K | Off-Season Events | 0 | 03-29-2004 06:53 PM |
Robots prepped for competition | Brandon Martus | FIRST In the News... | 0 | 03-24-2004 04:06 PM |