Go to Post Omni wheels are cool... but mecanum wheels are COOL!! - dtengineering [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 Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 31-01-2008, 20:33
platypus's Avatar
platypus platypus is offline
OMG ASCII Badgers!
AKA: Rob Harris
FRC #0166 (Chop Shop)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: New Hampshire
Posts: 12
platypus is a jewel in the roughplatypus is a jewel in the roughplatypus is a jewel in the roughplatypus is a jewel in the rough
Team 166 Has Open Sourced Its Code

http://www.sourceforge.net/projects/frst166code08

Team 166 has released its robot code to the masses! Noting that it is still a work in progress (most of it has been tested on test boards and a chassis, which is worth...something), feel free to use it, edit it, and upload new code to the project.

Here's a brief listing of stuff in it:

-6 kinds of Drive Code, including Mechanum Drive
-Code to Utilize EEPROM that has been successfully used for the past two years
-Code for our manipulator this year, with OI integrated
-Code for the IR receiver
-Code for hybrid mode


Enjoy!
__________________
Software Member and Strategy/Scouting Guru for Team CLXVI CHOP SHOP
  #2   Spotlight this post!  
Unread 31-01-2008, 21:01
Guy Davidson Guy Davidson is offline
Registered User
AKA: formerly sumadin
FRC #0008 (Paly Robotics)
Team Role: Alumni
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Ra'anana, Israel
Posts: 660
Guy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to behold
Send a message via ICQ to Guy Davidson Send a message via AIM to Guy Davidson Send a message via MSN to Guy Davidson
Re: Team 166 Has Open Sourced Its Code

I'm sorry to disappoint you, but you should take it off as soon as you can. Your code is based off Kevin's code, which states, in the begining of every file

Quote:
Originally Posted by Kevin Watson
You are free to use this source code for any non-commercial use. Please do not make copies of this source code, modified or un-modified, publicly available on the internet or elsewhere without permission. Thanks.
It's a great thing you're doing, but unfortunatley, it breaks the rules.
__________________
  #3   Spotlight this post!  
Unread 31-01-2008, 22:46
blaxbb blaxbb is offline
Ohio State Engineering Scholar
AKA: Brian Barrett
FRC #2331
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2007
Location: Vernon, New Jersey
Posts: 131
blaxbb is just really niceblaxbb is just really niceblaxbb is just really niceblaxbb is just really niceblaxbb is just really nice
Re: Team 166 Has Open Sourced Its Code

Quote:
Originally Posted by sumadin View Post
I'm sorry to disappoint you, but you should take it off as soon as you can.
You could just remove all of Kevin's files and just release the code that you wrote.
__________________
"Whether you think you can or think you can’t, you’re right." - Henry Ford
www.vthsrobotics.org
  #4   Spotlight this post!  
Unread 01-02-2008, 02:23
platypus's Avatar
platypus platypus is offline
OMG ASCII Badgers!
AKA: Rob Harris
FRC #0166 (Chop Shop)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: New Hampshire
Posts: 12
platypus is a jewel in the roughplatypus is a jewel in the roughplatypus is a jewel in the roughplatypus is a jewel in the rough
Re: Team 166 Has Open Sourced Its Code

Assuming that the 2007 default code available on IFI's website doesn't fall under these restrictions, then our code does not actually include any of Kevin's files. At one point, his adc and gyro code was included and those files and documentation are still in the zipped folders posted for the project, but they have since been removed and the only trace left that they were ever used is a few stray lines that were commented out and never removed afterward.

Removing Kevin's code would be no problem at all, and I'll see to it immediately. Thanks for bringing the issue to my attention -- I clearly didn't think of that.
__________________
Software Member and Strategy/Scouting Guru for Team CLXVI CHOP SHOP
  #5   Spotlight this post!  
Unread 01-02-2008, 11:57
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,572
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Team 166 Has Open Sourced Its Code

Besides Kevin's code, you have two additional problems.

The sourceforge project shows that the project is GPL, but none of your source files contain any reference to the GPL and a copy of the GPL is not included with your source. The bottom of this page tells you how to properly apply the GPL http://opensource.org/licenses/gpl-license.php

In addition, since you don't own the IFI code, you can't license it as GPL, so their code should be removed from your project as well.
  #6   Spotlight this post!  
Unread 01-02-2008, 14:07
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,187
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: Team 166 Has Open Sourced Its Code

A little constructive criticism... I see a lot of logic being implemented in conditional statements that does not need to be. For example:
Code:
if(pressure_sensor == 0) compressor = 1; 	
    else compressor = 0;
could be
Code:
compressor != pressure_sensor;
From what I see you can cut out a good chunk of code and boost your efficiency by doing some simple optimizations.
  #7   Spotlight this post!  
Unread 01-02-2008, 16:06
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Team 166 Has Open Sourced Its Code

Quote:
Originally Posted by Tom Bottiglieri View Post
From what I see you can cut out a good chunk of code and boost your efficiency by doing some simple optimizations.
[tangential rant]
Compilers, not programmers, should do optimizations.
[/tangential rant]
  #8   Spotlight this post!  
Unread 01-02-2008, 16:07
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,187
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: Team 166 Has Open Sourced Its Code

Quote:
Originally Posted by Alan Anderson View Post
[tangential rant]
Compilers, not programmers, should do optimizations.
[/tangential rant]
I guess this is the old machine logic vs. human logic argument. Why have real programmers when the chem, mech, and civil E's can just put in their logic and the code spits out correctly?

But if programmers don't know how to do it then who will make the new compilers after this generation retires?

Last edited by Tom Bottiglieri : 01-02-2008 at 16:09.
  #9   Spotlight this post!  
Unread 01-02-2008, 22:30
wt200999's Avatar
wt200999 wt200999 is offline
Texas Instruments
AKA: Will Toth
FRC #3005 (Robochargers)
Team Role: Mentor
 
Join Date: Mar 2006
Rookie Year: 2004
Location: Dallas, Texas
Posts: 325
wt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud ofwt200999 has much to be proud of
Send a message via MSN to wt200999
Re: Team 166 Has Open Sourced Its Code

Quote:
Originally Posted by Alan Anderson View Post
[tangential rant]
Compilers, not programmers, should do optimizations.
[/tangential rant]
The programmers should optimise for readability while the compiler optimises for other things
__________________
Programming in LabVIEW? Try VI Snippets!

FIRST LEGO League 2004 - 2005
FRC Team 870 Student 2006 - 2009
FRC Team 3005 Mentor 2013 -
  #10   Spotlight this post!  
Unread 02-02-2008, 09:38
Eric Finn's Avatar
Eric Finn Eric Finn is offline
Registered User
FRC #0166 (Chop Shop)
Team Role: College Student
 
Join Date: May 2006
Rookie Year: 2005
Location: Merrimack, NH
Posts: 101
Eric Finn has a spectacular aura aboutEric Finn has a spectacular aura about
Send a message via AIM to Eric Finn
Re: Team 166 Has Open Sourced Its Code

Thank you for the info about the code we don't own or have the right to redistribute being on the project. All code has been temporarily taken down and we are going to repost *our* code soon.

EDIT: Our chopshop library (CHOPSHOP.C and CHOPSHOP.H) has been uploaded. This library contains our code from previous years (EEPROM, drive algorithms, etc.) that we keep from year to year. More current code will be uploaded once the writers believe that it's ready to release. Again, thank you for notifying us of the licensing issues.
__________________
It always takes longer than you expect, even when you take into account Hofstadter's Law.
--Hofstadter's Law


Last edited by Eric Finn : 02-02-2008 at 10:40.
  #11   Spotlight this post!  
Unread 02-02-2008, 13:39
ay2b's Avatar
ay2b ay2b is offline
Registered User
AKA: Andy
FRC #2928
Team Role: Mentor
 
Join Date: Mar 2004
Rookie Year: 1994
Location: Seattle, WA
Posts: 211
ay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant futureay2b has a brilliant future
Re: Team 166 Has Open Sourced Its Code

Quote:
Originally Posted by Eric Finn View Post
EDIT: Our chopshop library (CHOPSHOP.C and CHOPSHOP.H) has been uploaded. This library contains our code from previous years (EEPROM, drive algorithms, etc.) that we keep from year to year. More current code will be uploaded once the writers believe that it's ready to release. Again, thank you for notifying us of the licensing issues.
Be careful with this one too. You are not permitted to directly reuse code from previous years, just as you are not permitted to directly reuse hardware components from previous years. You are, however, permitted to use the designs, ideas and algorithms from past years, but your implementation is supposed to be new each year, implemented during the build season (and fix-it windows).

Any code which is published publicly, in a location widely recognized by FIRST teams, is considered COTS and is permitted to be used directly, as per the COTS rules. This allows the use of Kevin's code, or IFI's code, and allows them to update it outside the build season, and all teams to use any version of it.

It is my interpretation of this rule, that if you were to have published your code from past years on CD, or on sourceforge and announced it on CD, then that code would also be considered COTS and would be permitted. It is not clear to me: if you were to develop something prior to the build season, and then publish it during the build season, would that still be considered COTS?

Unfortunately, in my quick perusal of the rules, I am unable to find the exact rules at this time in order to quote them here. Hopefully someone else can help me out, find them and post them.
__________________

2011 - SD Quarterfinalists (980), LA Quarterfinalists (980)
2010 - LA (2404) Finalists (980), AZ Motorola Quality (980)
2009 - LA Semifinalists (980); Las Vegas Quarterfinalists (980); SD (2404); IRI #1 Seed, Finalist (980)
2008 - SD Quarterfinalists (980), LA Champions (980), LA Rookie Inspiration Award (2404); CalGames Finalists
2007 - So.Cal Finalists (980), SD Quarterfinalists (980); CalGames Finalists
2006 - So.Cal Regional Champion (4), Toronto Judge's Award Day 1 (4)
2005 - SVR Champions, Delphi "Driving Tomorrow's Technology" (980); AZ Xerox Creativity (980); So.Cal Finalists, RadioShack Innovation in Control (980); Championship Archimedes Division Semifinalists; IRI Finalists (980)
2004 - So.Cal Regional Champions, Leadership in Controls (980); AZ GM Industrial Design (980); Championship Galileo Division #2 Seed; IRI Champions
2003 - PNW Semi-finalists (488)
2002 - PNW Finalists (488)
2000 - X-bot / 488 - Mentor / Founder
1994 - Sunny Delight - Driver - champion
  #12   Spotlight this post!  
Unread 02-02-2008, 15:15
dcbrown dcbrown is offline
Registered User
AKA: Bud
no team
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Hollis,NH
Posts: 236
dcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud ofdcbrown has much to be proud of
Wink Re: Team 166 Has Open Sourced Its Code

Quote:
Compilers, not programmers, should do optimizations
Correct. Too bad we don't have a decent optimizing compiler available.

But is it better to have code that reads:

Code:
    for (samples_recieved=0; samples_recieved<10; samples_recieved++)
    {
           :
Or code?

Code:
    for (samples_left_to_receive=10; --samples_left_to_recieve !=0; )
    {
Both do equivalent things, the best optimizing compiler won't turn one into the other and yet the 2nd is much more efficient in that the change in control variable also will set status/results for testing and avoid a second comparison operation. With the PIC18F, the above is 3x+ times more efficient due to a programmer choosing a different but equivalent method.

Does this really matter? In most cases, no. But if the code happens to be executing at interrupt level or is executed thousands of time per second then generally yes it does matter. A few changes like this usually can reduce the interrupt code footprint to 1/2 to 1/3 of what it was. Typically I scrutinize only about 10% of the code I write for efficiency, yet the run-time impact can be huge.

Knowing the underlying architecture of a processor you're working on also can impact which code constructs you choose to utilize. Yeah, it would be great if the compiler figured out this stuff for you... but often it doesn't or like above can't. On the PIC, for example, computing ram addresses isn't exactly efficient. In some cases if makes sense to unroll "for(...)" loops. For example:

Code:
    for(ndx=0; ndx<10; ndx++)
    {
          sample[ndx] = 0;
    }
is terribly inefficient. It takes 14-16 instructions to calculate the ram address plus the overhead of ~13 instructions to manage the loop variable. Choosing to unroll the loop in the above case into the following is a huge win as the code execution is on average 10x times faster with little change in code size.

Code:
    sample[0] = 0;
    sample[1] = 0;
    :
    sample[9] = 0;
Anyway my point is a programmer should care about how code constructs map to the underlying architecture. If they didn't, then the way to go would be to just change everything to extended floating point precision and do all calculations that way -- the "smarts" in the compiler would figure out when we needed integers vs floats and 8 bit values vs 32 bit values and hide all that nonsense from the programmer.

PS
Another common trick/practice on the PIC when dealing with loading data from h/w such as:

Code:
379:               	timer_count = TMR1H;
380:               	timer_count <<= 8;
381:               	timer_count += TMR1L;
382:               	timer_count -= offset;

 06730    50CF     MOVF 0xfcf, W, ACCESS
 06732    6F17     MOVWF 0x17, BANKED
 06734    6B18     CLRF 0x18, BANKED

 06736    C517     MOVFF 0x517, 0x518
 06738    F518     NOP
 0673A    6B17     CLRF 0x17, BANKED

 0673C    50CE     MOVF 0xfce, W, ACCESS
 0673E    6E2B     MOVWF 0x2b, ACCESS
 06740    6A2C     CLRF 0x2c, ACCESS
 06742    502B     MOVF 0x2b, W, ACCESS
 06744    2717     ADDWF 0x17, F, BANKED
 06746    502C     MOVF 0x2c, W, ACCESS
 06748    2318     ADDWFC 0x18, F, BANKED

 0674A    5119     MOVF 0x19, W, BANKED
 0674C    5F17     SUBWF 0x17, F, BANKED
 0674E    511A     MOVF 0x1a, W, BANKED
 06750    5B18     SUBWFB 0x18, F, BANKED
A simple change can result in much more efficient code by using an anonymous union structure:

Code:
typedef union u_U16
{
	unsigned int data;
	struct {
		unsigned char b0;
		unsigned char b1;
	};
} u_U16;

u_U16 timer_drift;


384:               	timer_drift.b1 = TMR1H;
385:               	timer_drift.b0 = TMR1L;
386:               	timer_drift.data -= offset;

 06752    CFCF     MOVFF 0xfcf, 0x516
 06754    F516     NOP

 06756    CFCE     MOVFF 0xfce, 0x515
 06758    F515     NOP

 0675A    5119     MOVF 0x19, W, BANKED
 0675C    5F15     SUBWF 0x15, F, BANKED
 0675E    511A     MOVF 0x1a, W, BANKED
 06760    5B16     SUBWFB 0x16, F, BANKED
Another quick 3x increase in code size and execution efficiency.
  #13   Spotlight this post!  
Unread 03-02-2008, 15:35
baop858 baop858 is offline
Registered User
FRC #0069 (Hyper)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2002
Location: Quincy, MA
Posts: 25
baop858 will become famous soon enough
Send a message via AIM to baop858
Re: Team 166 Has Open Sourced Its Code

Aren't chars unsigned by default on the 3.10 compiler?
  #14   Spotlight this post!  
Unread 09-02-2008, 16:03
platypus's Avatar
platypus platypus is offline
OMG ASCII Badgers!
AKA: Rob Harris
FRC #0166 (Chop Shop)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: New Hampshire
Posts: 12
platypus is a jewel in the roughplatypus is a jewel in the roughplatypus is a jewel in the roughplatypus is a jewel in the rough
Re: Team 166 Has Open Sourced Its Code

Our of our code (specifically that code produced by us) is available now for download either individually or all at once. All code by Kevin or IFI has been taken down.

Our code is now properly licensed, with the copyright statement at the top of each file. You may use it, copy it, and edit it. We request that if you make useful updates to the code (and test them to success), then by all means, please share those updates in this thread.

Thanks to all who have posted about issues so far. Whenever you find anything, just post it here.
__________________
Software Member and Strategy/Scouting Guru for Team CLXVI CHOP SHOP
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
Open-source FRC code JBotAlan Programming 35 02-01-2008 03:54
Has anyone posted their autonomous code from 2007? marccenter Programming 9 24-05-2007 15:12
Does anyone has code for accelerometer? sjung9442 Programming 2 30-01-2006 21:37
Has anyone craked the code yet Jeremy General Forum 2 09-01-2004 14:12
Rookie Programmer has question about the default code DanL Programming 3 26-01-2002 19:59


All times are GMT -5. The time now is 15:02.

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