Go to Post John Abele certainly deserves much more recognition than he gets. - Richard Wallace [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 24-11-2005, 01:51
TimCraig TimCraig is offline
Registered User
AKA: Tim Craig
no team
 
Join Date: Aug 2004
Rookie Year: 2003
Location: San Jose, CA
Posts: 221
TimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to behold
Re: Programming Organization

Quote:
Originally Posted by Dave Scheck
Please not that C compilers are not required to support the double slash style comment.
For a C compiler to be compliant with the ISO/ANSI C99 standard, it must accept the // style comments. These were not in the earlier C89 standard although most mainsteam compilers accepted them as an extension. The problem is the demand for pure C has dropped in favor of C++ and the bulk of users are probably now in the embedded market. So many of the compilers there haven't been updated to be compliant with the new standard, probably to lower sales volumes. Although recognizing the // style comment should be child's play to a compiler writer whom you're going to entrust with optimizing your source into machine code.
  #2   Spotlight this post!  
Unread 24-11-2005, 22:18
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: Programming Organization

Everything said so far is good. Here is my list of the important stuff:

Use a standard formatting style. This includes how to position braces ({ and }), spacing between arguments, amount of indent (2 spaces, 4 spaces, or a tab), line overflow, etc. I believe the de facto standard of C is like this:
Code:
// You should use more descriptive names for everything
void AFunctionName(int an_argument, int other_argument)
{
	int retval = DoSomething(other_argument, an_argument + 1);
	int n = 0;
	for (int i = 0; i < retval; i++)
	{
		// So, do something here...
		n = an_argument * i;
	}
}
Use a versioning system. CVS and Subversion are the best (only) free ones I've heard of. Do some googling as to how to use them/set them up. If used appropriately, this can also cover changelogs. (Write a descriptive commit message! I prefer many commits with specific changes to few large commits that can't have a good description.)

Document. I find doxygen works well for API-type documentation (Which functions do what, and what arguments they take). For logic documentation, nothing beats good ol' comments.

Create functions for conceptual reasons. A function should perform a specific task, and that task should be fairly clear from the name. (And having clearly named functions with unambiguous purposes also helps with self-documenting code, if you believe in such a thing.)

I agree entirely with teaching basic OOP concepts, since that includes ideas of abstraction and encapsulation (not to mention a few other things), concepts I consider important to writing clear code that works.

Code reuse. Last year, I used a system much like the autonomous scripting to handle motor control (control loops). This was a great boon for me, because when part of the robot didn't work, I could say, "It's not the code. The same code works on the other joint." (This is greatly undervalued. Definately going to do something similar again.)

Many files are good. You should actually reduce the number of functions in user_routines.c and user_routines_fast.c. Have a file devouted to translating human input, another one for driving, and several for autonomous. (I consider autonomous a 95-10 situation: 95% of your work goes into 10% of the match.)

In 2004 (code) and in 2005, I organized code based on function on the robot. All the hardware interaction went through abstraction macros/functions. This ment higher-level code would do things like:
Code:
 //user_routines.c, line 175
 //Map Joysticks to drive train
 Drive_Joystick(OI_Left, OI_Right);
While code farther in would be doing:
Code:
// Drive.c, line 51
void Drive_Joystick(char Left, char Right)
{
	if(Left > 127)
	{
		Left_CIM = Left_Drill =  (128 + JOYSTICK_SMOOTHING[Left - 127]);
	}
	else
	{
		Left_CIM = Left_Drill = (127 - JOYSTICK_SMOOTHING[127 - Left]);
    }
    
//	Right_CIM = Right_Drill = Right;
   	if(Right > 127)
	{
		Right_CIM = Right_Drill =  (128 + JOYSTICK_SMOOTHING[Right - 127]);
	}
	else
	{
		Right_CIM = Right_Drill = (127 - JOYSTICK_SMOOTHING[127 - Right]);
    }
}
(These same routines were used for autonomous, as well.)
This is a simplistic sample. The Hand_*() functions in Grabber.c (which maybe should have been broken up) are the most complex, due to the current-limiting sensor. BTW, this example is not from the year I used doxygen, so the functions themselves are poorly documented. *_Check() functions compared the input value to the current value and reacted appropriately (except the drive code, which just mapped input to output without feedback).
  #3   Spotlight this post!  
Unread 25-11-2005, 21:39
prograid's Avatar
prograid prograid is offline
Registered User
AKA: Ben Cherian
FRC #0254 (The Cheesy Poofs)
Team Role: Alumni
 
Join Date: Oct 2004
Rookie Year: 2004
Location: San Jose
Posts: 80
prograid will become famous soon enough
Re: Programming Organization

If you are intent upon using Subversion (like someone I know is.) and you want to use Eclipse (which I do) then I would suggest using an Eclipse plug-in called Subclipse. It's made by the same people that make Subversion. It's not as nice as Eclipse's CVS integration but it's more than adequate for FIRST purposes. Also, more information on Eclipse (e.g. installation instructions, setting up a basic project, etc) along with an updated version of my plug-in can be found in this white paper.
The white paper itself is not very useful if you are already familiar with Eclipse, but otherwise it should be helpful.
  #4   Spotlight this post!  
Unread 23-11-2005, 17:01
WizardOfAz's Avatar
WizardOfAz WizardOfAz is offline
Lead Mentor
AKA: Bill Bennett
FRC #1011 (CRUSH)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Tucson, AZ
Posts: 101
WizardOfAz will become famous soon enough
Send a message via AIM to WizardOfAz
Re: Programming Organization

I would second the recommendation by Mike Sorrenti ealier in this thread about using CVS to share code among the programmers and manage changes. An environment that integrates CVS very nicely is Eclipse. See this thread (http://www.chiefdelphi.com/forums/sh...ad.php?t=37736) for information about using Eclipse for FRC development. We've switched to it, and will never go back. You basically trade Eclipse for MPLAB, and although you lose the simulation capability, it is not all that useful for FRC projects anyway. In exchange, you get CVS, a C-aware editor, and experience with an IDE environment that is the standard in many commercial development shops.

It will take some learning and effort to get the eclipse and CVS environment set up, and for you to understand how to steer it, so if you're going to do it, start now so you're up to speed before competition season. Pretty good information is available in the CD thread mentioned above, and a few others you can find by searching for Eclipse. I am willing to help via PM or even phone, as long as the level doesn't get overwhelming.

BTW - Eclipse is open source and free, so there are no costs or difficult licensing issues.

If you want CVS but not Eclipse, maybe TortoiseCVS would be the way to go. It's also free and open-source.

You can get a free CVS account from sourceforge.net. By using it, you are not only getting change control, sharing among your team members, and backup, but you're sharing with other FIRST teams - in true FIRST spirit!

You can see all of our code there, in sourceforge project "crush1011".

Bill Bennett

Last edited by WizardOfAz : 23-11-2005 at 17:04.
  #5   Spotlight this post!  
Unread 22-11-2005, 18:01
Timothy D. Ginn's Avatar
Timothy D. Ginn Timothy D. Ginn is offline
I check here maybe once a year.
no team
 
Join Date: Apr 2003
Rookie Year: 2002
Location: Port Perry, ON. Canada
Posts: 247
Timothy D. Ginn is a name known to allTimothy D. Ginn is a name known to allTimothy D. Ginn is a name known to allTimothy D. Ginn is a name known to allTimothy D. Ginn is a name known to allTimothy D. Ginn is a name known to all
Send a message via ICQ to Timothy D. Ginn Send a message via AIM to Timothy D. Ginn Send a message via MSN to Timothy D. Ginn Send a message via Yahoo to Timothy D. Ginn
Re: Programming Organization

Quote:
Originally Posted by coastertux
...
This year it looks like we will have about 8 people on the programming team and were wondering how we can manage that many people. ...
Also, how can we divide the programming and then get it all back together into one easily?

Thanks!
Well, congratulations on being able to find such numbers; it seems to be rare that teams will get that many people interested in programming.

The advice given so far about using some version management system (like for example CVS or Subversion) is good (actually, it's even handy if you were the only one programming since if you're ever in a situation where you make a big oops you can revert back to a good copy).

One thing that I would like to add though, is that with such a large group I would consider it likely that there will be problems with certain members not having enough to do at times (which can spin off into a feeling of not making a valuable contribution and eventually a lack of interest in attending) none of which are good things. Be very careful about this; it's not always easy to notice and people won't always admit if they're feeling left out. Assuming your programming team does both robot and website programming it might be worth splitting into two subgroups so that people can take ownership of a particular task.
__________________
Alumni of FRC Team 1006
Former mentor of Full Lego Alchemist (FLL 5621) - Sempar School / Computing Students' Association of Queen's University
  #6   Spotlight this post!  
Unread 23-11-2005, 00:51
TimCraig TimCraig is offline
Registered User
AKA: Tim Craig
no team
 
Join Date: Aug 2004
Rookie Year: 2003
Location: San Jose, CA
Posts: 221
TimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to beholdTimCraig is a splendid one to behold
Re: Programming Organization

The primary purpose of coding standards is to make the source code easy to read. While the compiler may not care, source code MUST be readable by humans. If you're used to the standard in place, sometimes you can glance at a piece of code and know there's a problem because it just doesn't look "right". When the body of code is uniform, it's just easier to read and understand. This may not seem all that important on small projects like the control code for a FIRST robot, but for real projects of half a million lines of code, it becomes very important for productivity. On projects like that people come and go and it's important that things be clear and concise.

FWIW, the example programs that come with Microsoft's Visual Studio are NOT good examples of how to program in a production environment. In fact, most of the examples roaming around the web are pure crap. Unfortunately, this obervation probably also applies to the majority of production code in acutal software products.
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
Organizing a programming team. scitobor 617 Programming 7 28-01-2005 19:18
Team 342 Training and Organization cbolin Team Organization 1 15-01-2005 10:37
Robot Programming Education phrontist Programming 11 03-05-2004 07:32


All times are GMT -5. The time now is 13: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