Go to Post Yes, it is fun. Its fun to watch the students expand their thinking and look outside the "normal" and watch their thoughts explode! Its also fun to watch the mentor's minds fry trying to out think the students.;) - Robert Cawthon [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 05-02-2006, 15:24
Matt Krass's Avatar
Matt Krass Matt Krass is offline
"Old" and Cranky. Get off my lawn!
AKA: Dark Ages
FRC #0263 (Sachem Aftershock)
Team Role: Mentor
 
Join Date: Oct 2002
Rookie Year: 2002
Location: Long Island, NY
Posts: 1,187
Matt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond repute
Send a message via AIM to Matt Krass
Re: Stupidest Programming Mistakes

Quote:
Originally Posted by seg9585
In trying to comment stuff out with "/* */", we realize that we comment out other stuff already commented out using the same method, and whenever it reached that comment's "*/" it would end, causing a bunch of syntax errors throughout the rest of the uncommented code, and we couldnt figure out for the life of us why it was reading that code...
Little trick Mark McLeod showed me for that:

Code:
#ifdef //This is actually a comment block, #1
code
code
code
#endif //This is the end of comment block #1
Since the #ifdef is missing something to check, it always fails, so any code in it never compiles, doesn't get stopped by */, quite useful
__________________
Matt Krass
If I suggest something to try and fix a problem, and you don't understand what I mean, please PM me!

I'm a FIRST relic of sorts, I remember when we used PBASIC and we got CH Flightsticks in the KoP. In my day we didn't have motorized carts, we pushed our robots uphill, both ways! (Houston 2003!)
  #2   Spotlight this post!  
Unread 05-02-2006, 17:03
Mike Shaul's Avatar
Mike Shaul Mike Shaul is offline
Registered User
FRC #0065 (Huskie Brigade)
Team Role: Engineer
 
Join Date: Jan 2006
Rookie Year: 2003
Location: Farmington Hills, MI
Posts: 53
Mike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant future
Re: Stupidest Programming Mistakes

The C Programing language has MANY different "issues" with undefined behavior or easy-to-make mistakes that compilers won't usually catch.

This website has compiled 10 (actually more than 10) common mistakes, check it out.
__________________
By far the best proof is experience. - Sir Francis Bacon
  #3   Spotlight this post!  
Unread 05-02-2006, 18:12
Goldeye Goldeye is offline
Registered User
AKA: Josh Hecht
FRC #0694 (Stuypulse)
Team Role: College Student
 
Join Date: Jan 2005
Rookie Year: 2005
Location: New York
Posts: 145
Goldeye has a spectacular aura aboutGoldeye has a spectacular aura aboutGoldeye has a spectacular aura about
Send a message via AIM to Goldeye
Re: Stupidest Programming Mistakes

My teammate made a great slipup that him and a mentor didn't catch till I looked. Here it is (with the error) in a function for averaging something in pseudocode.
Code:
int sum,count;
while(stuff_left)
{
     sum+=stuff;
     count++;
}
if(!count == 0)
     return -1
else
     return sum/count;
__________________
Team 694

2005 Championship - Galileo Semifinalist
2005 New York - Regional Chairmans Award
2005 New York - Semifinalist (Thanks 1257,1340)
  #4   Spotlight this post!  
Unread 09-02-2006, 00:33
jfelser jfelser is offline
Registered User
FRC #0948
Team Role: Leadership
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Seattle, WA.
Posts: 43
jfelser will become famous soon enough
Send a message via AIM to jfelser
Re: Stupidest Programming Mistakes

I dunno if this is truly a programming mistake... but testing autonomous (using PID) we forgot to plug in one of the the interrupt pins on the encoders, resulting in a very interesting open-loop control system, and various material damages (the robot LED, the green light, the 6' stack of books the light was sitting on, the desk the books were sitting on, the counter with microscopes behind the desk with the books and light, and my self confidence).
__________________
Code Red Robotics Team 639 | www.team639.org
2004 Canadian SUPER Regional Winners with 33 & 1112, GM Industrial Design Award
2005 Finger Lakes Regional Winners with 191 & 494, Canadian Regional GM Industrial Design Award


Newport Robotics Group Team 948 | www.nrg948.org
2006 Portland Regional Motorola Quality Award Winners
2007 Portland Regional Finalists with 1540 & 1778, GM Industrial Design Award


-Jake Felser-
  #5   Spotlight this post!  
Unread 15-02-2006, 22:45
aaeamdar's Avatar
aaeamdar aaeamdar is offline
Post-A-Holic
AKA: Paul Dennis
FRC #1719 (The Umbrella Corp)
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Baltimore, MD
Posts: 231
aaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant future
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
  #6   Spotlight this post!  
Unread 15-02-2006, 23:19
Jake M Jake M is offline
void* Jake;
FRC #1178 (DURT)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Missouri
Posts: 118
Jake M has a spectacular aura aboutJake M has a spectacular aura about
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.
__________________
Code:
void function(void)
 {
  function();
 }
  #7   Spotlight this post!  
Unread 16-02-2006, 02:50
Calvin Calvin is offline
Registered User
no team
 
Join Date: Feb 2005
Location: Portland OR
Posts: 105
Calvin has a spectacular aura aboutCalvin has a spectacular aura about
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
  #8   Spotlight this post!  
Unread 16-05-2006, 20:22
Joe_Widen's Avatar
Joe_Widen Joe_Widen is offline
Registered User
FRC #1675 (The Ultimate Protection Squad)
Team Role: Alumni
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Milwaukee
Posts: 215
Joe_Widen has much to be proud ofJoe_Widen has much to be proud ofJoe_Widen has much to be proud ofJoe_Widen has much to be proud ofJoe_Widen has much to be proud ofJoe_Widen has much to be proud ofJoe_Widen has much to be proud ofJoe_Widen has much to be proud of
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.
__________________
Finally in college =]


2009 Midwest Regional Champions - Thanks 111 and 1625
  #9   Spotlight this post!  
Unread 16-05-2006, 22:57
Adam Shapiro's Avatar
Adam Shapiro Adam Shapiro is offline
Registered User
FRC #0555 (Montclair Robotics)
Team Role: Alumni
 
Join Date: Jan 2002
Rookie Year: 2001
Location: Montclair, NJ
Posts: 401
Adam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud of
Send a message via AIM to Adam Shapiro
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.
__________________
Mentor to Teams 555, 1929, and 2070!
Currently working in hardware design at Cisco.
Cornell University DARPA Urban Challenge - http://www.cornellracing.com
Co-Captain Team 555 - 2003,2004,2005
Trust, Love, and Magic
  #10   Spotlight this post!  
Unread 07-08-2006, 14:53
Robert Flanagan's Avatar
Robert Flanagan Robert Flanagan is offline
Robert Flanagan
FRC #1390 (Welethedawgsout)
Team Role: Programmer
 
Join Date: May 2005
Rookie Year: 2004
Location: ST. Cloud
Posts: 11
Robert Flanagan is an unknown quantity at this point
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.
__________________
Everywhere and nowhere, like the wind

Robert Flanagan, Programmer, team 1390
  #11   Spotlight this post!  
Unread 07-08-2006, 15:18
LordTalps LordTalps is offline
Crimson Ninja
AKA: Pat
FRC #1885 (Robocats)
Team Role: Programmer
 
Join Date: Aug 2006
Rookie Year: 2006
Location: Skingrad
Posts: 106
LordTalps is a splendid one to beholdLordTalps is a splendid one to beholdLordTalps is a splendid one to beholdLordTalps is a splendid one to beholdLordTalps is a splendid one to beholdLordTalps is a splendid one to beholdLordTalps is a splendid one to beholdLordTalps is a splendid one to behold
Send a message via AIM to LordTalps
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();
}

  #12   Spotlight this post!  
Unread 17-05-2006, 17:18
coldabert's Avatar
coldabert coldabert is offline
The Dude
FRC #0888 (Robotiators)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2003
Location: MD
Posts: 83
coldabert is a glorious beacon of lightcoldabert is a glorious beacon of lightcoldabert is a glorious beacon of lightcoldabert is a glorious beacon of lightcoldabert is a glorious beacon of light
Send a message via AIM to coldabert
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.
  #13   Spotlight this post!  
Unread 07-08-2006, 14:50
Robert Flanagan's Avatar
Robert Flanagan Robert Flanagan is offline
Robert Flanagan
FRC #1390 (Welethedawgsout)
Team Role: Programmer
 
Join Date: May 2005
Rookie Year: 2004
Location: ST. Cloud
Posts: 11
Robert Flanagan is an unknown quantity at this point
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.
__________________
Everywhere and nowhere, like the wind

Robert Flanagan, Programmer, team 1390
  #14   Spotlight this post!  
Unread 07-08-2006, 14:51
Alexa Stott's Avatar
Alexa Stott Alexa Stott is offline
All I do is twin.
AKA: elixir
FRC #0025 (Raider Robotix)
Team Role: College Student
 
Join Date: Oct 2005
Rookie Year: 2006
Location: No. Bruns., NJ/College Park, MD
Posts: 781
Alexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond reputeAlexa Stott has a reputation beyond repute
Send a message via AIM to Alexa Stott
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!
__________________
|Email:alexastott[at]gmail.com|Facebook|@zelixir|Google+|
[University of Maryland Computer Science, Psychology]
[Brunswick Eruption]
  #15   Spotlight this post!  
Unread 07-08-2006, 15:13
kaszeta's Avatar
kaszeta kaszeta is offline
Registered User
FRC #0095 (Grasshoppers)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Lebanon, NH
Posts: 334
kaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of light
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.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming Vex w/ MPLab dababyjebus FIRST Tech Challenge 27 25-04-2008 09:11
Programming - Getting Started Mark McLeod Programming 80 16-04-2008 23:37
VEX programming Gene F Programming 14 08-08-2006 22:21
Suggestion for Delphi Programming Posts Chris Hibner CD Forum Support 1 27-07-2005 10:02
Robot Programming Education phrontist Programming 11 03-05-2004 07:32


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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