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)

lukevanoort 06-05-2006 15:30

Re: Stupidest Programming Mistakes
 
At the meeting last week, I managed to finish the exponential drive code (Excel saved my butt there) and loaded it into the robot. Putting it up on blocks (always a good idea with new code) I noticed that it ran fine in reverse, but when the joystick was pushed forward the wheels started turning fast then slowed to a stop. My problem? I had forgotten to add 127 to the value from the look-up table... stupid stupid stupid.

EHaskins 16-05-2006 10:40

Re: Stupidest Programming Mistakes
 
When i was testing my custom joystick mixing code i forgot to add 2000 to the value before i sent it to the Limit_Mix Function. The robot was on the floor and wnet full reverse it ran over one person and finaly ran into a workbench before anyone could shut it off.

Joe_Widen 16-05-2006 20:22

Re: Stupidest Programming Mistakes
 
While one of our programmers was cleaning up the code, he accidentally deleted a line that said *DO NOT DELETE THIS LINE*. Well anyways it gave us quite a few headaches in Milwaukee.

Adam Shapiro 16-05-2006 22:57

Re: Stupidest Programming Mistakes
 
Quote:

Originally Posted by Joe_Widen
While one of our programmers was cleaning up the code, he accidentally deleted a line that said *DO NOT DELETE THIS LINE*. Well anyways it gave us quite a few headaches in Milwaukee.

That happened to us 3 years ago. One of our programmers accidentally deleted the PutData line about 2 minutes before a match. We ended up on the field with a code error and a loss to our record.

coldabert 17-05-2006 17:18

Re: Stupidest Programming Mistakes
 
This isnt as stupid as it was an accident but I'm still not going to mention the guy who wrote it:

We had a winch system that would connect to our drive motors. The point was to engage the winch when the cable was taken off the robot and hooked on the bar (2 years ago). Well, he engaged the winch during autonomous and the aircraft cable (which doesnt break) was wraped around the frame of the robot and the dead reckoning code simply drove the motors. The cable just got tighter and tighter. Needless to say the 1/2 inch steel tubing was a little bent and the entire frame looked like a car wreck.

Thats when we decided that only one guy should make the programming mistakes.

aaronm_k 20-05-2006 01:00

Re: Stupidest Programming Mistakes
 
Quote:

Originally Posted by Eldarion
One of the things that keeps tripping us up is that the MPLAB compiler does not follow standard C data type promotion rules.

For example, given the statement below, standard C would promote both data types to integer, then multiply. The MPLAB compiler, however, multiplies a and b as unsigned chars and then sticks the result in the integer value, resulting in an overflow where you least expect it! :ahh:

Code:

unsigned char a = 127:
unsigned char b = 127;
int result;

result = (a * b);


You can turn on integer promotions by going to "Project" > "Build Options" > "Project" in MPLAB, clicking the "MPLAB C18" tab, and adding "-Oi " to the beginning of the "Use Alternate Settings" text box. (Checking the "Enable integer promotions" check box will NOT work.) Believe me, I had plenty of trouble with this too! :)

Astronouth7303 21-05-2006 00:15

Re: Stupidest Programming Mistakes
 
The stupidest programming mistake:

Assuming the programmer is driving.

Robert Flanagan 07-08-2006 14:50

Re: Stupidest Programming Mistakes
 
Hehehe, of course semicolons r an issue.

The biggest mistake was working on autonomous. It was at nationals and I still dont know what I did wrong but fixed it. As soon as autonomous started the bot drove forward then started spinning to the left firing into the crowds, judges, everywhere else.

Alexa Stott 07-08-2006 14:51

Re: Stupidest Programming Mistakes
 
One stupid mistake I made at one point was that I forgot to close something off. I was too lazy to go back and look for it, so I just added a random "}" at the end of the code. Problem fixed! :D

Robert Flanagan 07-08-2006 14:53

Re: Stupidest Programming Mistakes
 
Quote:

Originally Posted by Joe_Widen
While one of our programmers was cleaning up the code, he accidentally deleted a line that said *DO NOT DELETE THIS LINE*. Well anyways it gave us quite a few headaches in Milwaukee.


That's why you always save a copy of the default code.

kaszeta 07-08-2006 15:13

Re: Stupidest Programming Mistakes
 
Quote:

Originally Posted by Robert Flanagan
Hehehe, of course semicolons r an issue.

The biggest mistake was working on autonomous. It was at nationals and I still dont know what I did wrong but fixed it. As soon as autonomous started the bot drove forward then started spinning to the left firing into the crowds, judges, everywhere else.

Team 95's robot did this in the practice pits at Manchester. It was rather entertaining, which helped offset the frustration.

LordTalps 07-08-2006 15:18

Re: Stupidest Programming Mistakes
 
Was working on the Marine Biology Study for AP Computer Science AB, and had was running through making a fish (was easy after the first 5 or 6 we made).

All of a sudden, STACK OVERFLOW? What in the world?

isolated it to a method that returned a class variable, myID. That method was one line, it couldn't be the issue. Lo and behold, it was pointed out:

public int myID()
{
return myID();
}

:(

Booger 07-08-2006 15:19

Re: Stupidest Programming Mistakes
 
i loaded the defualt code from last year, and the robot just started going. It ran into a table and knocked everything over. Luckly it wasnt facing the otherway becasue it would have went down the road.

thegathering 07-08-2006 15:24

Re: Stupidest Programming Mistakes
 
Quote:

Originally Posted by Booger
i loaded the defualt code from last year, and the robot just started going. It ran into a table and knocked everything over. Luckly it wasnt facing the otherway becasue it would have went down the road.

Related bug, we had a 1 in an assembly level if check instead of a 0 (one of our less experienced coders put it there) and all the motors ran by the method just started running at full speed. Luckily this was early on and the motors were not attached to the bot yet.

Booger 07-08-2006 15:26

Re: Stupidest Programming Mistakes
 
Quote:

Originally Posted by thegathering
Related bug, we had a 1 in an assembly level if check instead of a 0 (one of our less experienced coders put it there) and all the motors ran by the method just started running at full speed. Luckily this was early on and the motors were not attached to the bot yet.

Yeah we ended up putting the robot on wood blocks just so it doesnt do that again because its a real pain.


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