Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Stupidest Programming Mistakes (http://www.chiefdelphi.com/forums/showthread.php?t=43343)

Adam Shapiro 09-02-2006 08:15

Re: Stupidest Programming Mistakes
 
How about having a programmer delete PutData as "unnecessary" in a code update 2 minutes before a match?

Dillon Compton 09-02-2006 11:07

Re: Stupidest Programming Mistakes
 
Quote:

Originally Posted by Adam Shapiro
How about having a programmer delete PutData as "unnecessary" in a code update 2 minutes before a match?



...ouch.

JugglingSuns120 09-02-2006 16:56

Re: Stupidest Programming Mistakes
 
Well our "programming" errors tend to really not be programming errors at all. One of the more frustrating ones we had this year happened a couple weeks ago. We were testing some code for gyros we are using. Well after two hours of pouring over the code trying to figure out why our printf with the variables wouldnt work we realized that we never tethered the OI to the the robot controller.

slade24 15-02-2006 17:21

Re: Stupidest Programming Mistakes
 
My associate programmer decided to add Limit_Mix calls to the equations for joystick input / pwm output. He uploaded the code, but before we tested it he left, and took with him the updated code files (when I asked to get a copy, he uploaded only the .hex file onto my computer for some reason). Apparently he didn't read the Limit_Mix function correctly, because when we fired the robot up and began testing the ball launcher, it started spinning backwards! :confused:

In the dilemma that ensued, we reversed the polarity of the motor to get it to spin correctly (though we didn't know what was the original cause at the time). The launcher worked, but then we noticed its speed couldn't be adjusted.

Upon reaching home, I looked at the code (we post it onto a team wiki) and found... lo and behold, he forgot to add " + 2000" to the Limit_Mix calls. After fixing this error, I realized how lucky the team was to have remembered to take the drivetrain fuses out before testing the launcher -- all functions calling Limit_Mix were being returned as 0 (FULL REVERSE!). :ahh:

We almost had a mass murdering robot (at least this years robot doesn't have a huge arm like last years -- now that would have been bad).

CmptrGk 15-02-2006 22:30

Re: Stupidest Programming Mistakes
 
just yesterday i made an incredibly stupid mistake

Code:

if(TempCount4BA <= 38)
{
BALL_MOVER = 1;
}
else if((TempCount4BA > 38) && (TempCount4BA <= 78))
{
BALL_MOVER = 0;
TempCount4BA = 0;
}
TempCount4BA++;

needless to say, the air postion never "moved"

aaeamdar 15-02-2006 22:35

Re: Stupidest Programming Mistakes
 
Quote:

Originally Posted by Andrew Blair
Last night, tried to get my drive code lookup table to compile. Turns out that I did everything right...except NAME THE STUPID THING!!! :ahh: Thanks to Alan Anderson for catching it.


Gosh that is funny. When programming in java I've gotten so lost in
Code:

public static final volatile private blah
that I forgot to give it an actual type. I did this:
Code:

public static final theta;
It no like that...

Good thread.

Paul Dennis

aaeamdar 15-02-2006 22:45

Re: Stupidest Programming Mistakes
 
I had this:

Code:

auto_mode = ~auto_select1 + 2(~auto_select2) + 3(~auto_select3);
Where auto_mode is later used in a switch{case:}, and auto_selectNs are variouss rc_dig_ins.

Can someone spot the error there? Yeah, 2() is not a valid method. So I changed it to this:

Code:

auto_mode = ~auto_select1 + 2*(~auto_select2) + 3*(~auto_select3);
And it still didn't work. Gee whiz. What is wrong now. It gives me a run-time unexpectedness glitch where auto_mode is calculated to be 246 or some nonsense like that. OK, fixed that by not using the binary complement and instead used the logical complement (in a #define) and it works.

In another one we had:

Code:

printf("Some motor values %d %d %d", 1,2,3);//Whatever
And nothing was printing. Gosh, that sure was weird. Well, it turns out that we failed to import stdio.h (or anything else that gives us access to printfs). And then, to make things worse, the C language is so incredibly stupid that all it gives you is a warning because it's not prototyped. Since we had been using some other methods that weren't prototyped (may have been a few in Kevins Code) those warnings got mushed in with the others.

Thank goodness for Java.

Paul Dennis

Jake M 15-02-2006 23:19

Re: Stupidest Programming Mistakes
 
How about spending an hour trying to decipher a run-time error and systematically commenting all of our added code up to that point, only to later find we were compiling with the 2005 FRC settings instead of 2006?

Oh, and this isn't really a programming error, but I still think it's up there as stupid. In our third or fourth practice match last year, our robot suddenly started smoking out on the field. We had used a large ribbon cable to wire the camera and dozens of switches throughout the robot for use in autonomous mode to sense and pick up tetras, and cap them, which had been working perfectly. As it turns out, several of the spare wires, which was about half of the cable, that had been cut off from removed sensors and never removed from the electronics, and that included several five volts and grounds, had brushed up against the frame, which, simply put, melted the entire cable and fried our camera.

Calvin 16-02-2006 02:50

Re: Stupidest Programming Mistakes
 
I decided to make life easier and write functions, and reuse them through out the program... Last night I spent 2 hours trying to figure out what was wrong with the functions, later I discovered that I forgot to include them in the user_routines.c

GeorgeTheEng 16-02-2006 12:28

Re: Stupidest Programming Mistakes
 
During the stack attack game, in Atlanta, we had to change our autonomous code. I had a brain fart and missed the fact the motors were moving in different directions on left and right sides. The robot was supposed to move forward for x seconds. Instead it looked like it was dancing as it spent all autonomous mode spining around. :D

P1h3r1e3d13 26-04-2006 00:58

Re: Stupidest Programming Mistakes
 
Originally our drive motors were hooked up such that 255 on both sides made the bot drive backward, because the person wiring them didn't know what the polarity should be. At this point I was using EasyC's Tank command to drive the bot, so I told the electronics people not reverse the wiring, because it was easier for me to just check "Invert direction" in EasyC.

My (yet untested) autonomous code, however, used PWM commands, which I had already set to numbers greater than 127 to drive the bot forward (logically).

For the longest time, I couldn't figure out why it drove backward in autonomous....

Rickertsen2 26-04-2006 01:09

Re: Stupidest Programming Mistakes
 
Earlier today i was confounded with a mysterious bug in my php code. No matter what i did, i couldn't get it to work. After exhausting everything i could possibly think of, i spent another 15 minutes scouring the php manual thinking my bug might be due to an obscure security permissions issue. Well, it turns out I was uploading my code to the wrong server. I felt pretty dumb as i realized i fixed the bug half an hour ago.


------------------------------- edit ----------------------------------------
At regionals i had block of code like:
...
if(condition)
//do something
...

which i later changed to :

...
if(condition)
//do something
//do something else

without adding the brackets. I tend to do that often. In any case it caused out robot to automatically aim at people level and autofire/load until it ran out of balls

Chris Hibner 26-04-2006 09:41

Re: Stupidest Programming Mistakes
 
Quote:

Originally Posted by Rickertsen2
Earlier today i was confounded with a mysterious bug in my php code. No matter what i did, i couldn't get it to work. After exhausting everything i could possibly think of, i spent another 15 minutes scouring the php manual thinking my bug might be due to an obscure security permissions issue. Well, it turns out I was uploading my code to the wrong server. I felt pretty dumb as i realized i fixed the bug half an hour ago.


------------------------------- edit ----------------------------------------
At regionals i had block of code like:
...
if(condition)
//do something
...

which i later changed to :

...
if(condition)
//do something
//do something else

without adding the brackets. I tend to do that often. In any case it caused out robot to automatically aim at people level and autofire/load until it ran out of balls


This is an EXTREMELY common mistake. In fact, most companies' coding standards require to use braces {} even if there is only one line of code in the code block. The reason for this standard is to aviod the bug you speak of. We mention this in our Advanced Programming presentation at the FIRST Robotics Conference that we presented last year (and will be presenting again at 3:00 tomorrow.

It's good that you finally caught it. I would definitely suggest always using braces.

nehalita 26-04-2006 09:46

Re: Stupidest Programming Mistakes
 
How about I made a new program during Florida Regional that did something simple for a few seconds and then was supposed to stop. I forgot to set the pwms to neutral. It kept going. That flipped our robot.

KenWittlief 26-04-2006 10:36

Re: Stupidest Programming Mistakes
 
stupidest programming mistake I ever made

when I was in college I took a course in the language LISP. This language is all functions, and you can define or change the definition of any function, even the core default ones built into the language.

I was entering code on a terminal at the computer center, and the terminal wacked out for a second. I thought the mainframe was crashing so I typed

EXIT <return>

which is how you get out of the LISP program space.

But then the terminal was ok, it did not exit, it just kept running. So I finished up my project, printed the listing and entered

EXIT <return>

and nothing happened - I was still in LISP - it wouldnt stop running.

Then I realized just before the terminal wacked out I was defining a new function, so what I had really done was enter

Define EXIT <return>

which in LISP means: define the function 'EXIT' to be nothing!

I had to sit at the terminal for 30 minutes to wait for the mainframe to timeout my link and kick me off.


All times are GMT -5. The time now is 19:07.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi