OCCRA
Go to Post The on-going debate on this thread is just because we care. - Steve Wherry [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Events   CD-Media   CD-Spy   FRC-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 07-01-2005, 01:55 PM
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,332
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
If you could write the default code...

Just out of curiosity, if you could design the RC default code, what would the architecture look like? What do you like about the current default RC code? What don't you like?

-Kevin
__________________
Kevin Watson
Engineer at Virgin Galactic
http://kevin.org
  #2   Spotlight this post!  
Unread 07-01-2005, 02:16 PM
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 Send a message via Skype™ to Matt Krass
Re: If you could write the default code...

I think functions names could be shortened, with explanatory comments. I know (well, I don't know but I suspect very strongly) you are trying to make the function names self-explanatory, but after a while it gets annoying to be perfectly honest typing out those long names. And maybe make the flow a little bit easier to follow, otherwise I commend your work, it's quite helpful.
__________________
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!)
  #3   Spotlight this post!  
Unread 07-01-2005, 03:08 PM
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,332
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: If you could write the default code...

Quote:
Originally Posted by Matt Krass
I think functions names could be shortened, with explanatory comments. I know (well, I don't know but I suspect very strongly) you are trying to make the function names self-explanatory, but after a while it gets annoying to be perfectly honest typing out those long names. And maybe make the flow a little bit easier to follow, otherwise I commend your work, it's quite helpful.
Thanks. Comments about my code are always welcome, but I'm more interested in how the default code included with the RC is perceived. What do you like? What don't you like? What improvements (if any) would you make?

-Kevin
__________________
Kevin Watson
Engineer at Virgin Galactic
http://kevin.org
  #4   Spotlight this post!  
Unread 07-01-2005, 08:31 PM
RbtGal1351's Avatar
RbtGal1351 RbtGal1351 is offline
~La Reina de los Robots~
AKA: Stephanie
FRC #1351 (TKO)
Team Role: Programmer
 
Join Date: Dec 2004
Rookie Year: 2004
Location: San Jose, CA
Posts: 166
RbtGal1351 is a splendid one to beholdRbtGal1351 is a splendid one to beholdRbtGal1351 is a splendid one to beholdRbtGal1351 is a splendid one to beholdRbtGal1351 is a splendid one to beholdRbtGal1351 is a splendid one to beholdRbtGal1351 is a splendid one to behold
Send a message via AIM to RbtGal1351 Send a message via MSN to RbtGal1351
Re: If you could write the default code...

Quote:
Originally Posted by Kevin Watson
Just out of curiosity, if you could design the RC default code, what would the architecture look like? What do you like about the current default RC code? What don't you like?

-Kevin
It'd be really nice if it was easier to debug... Mostly debugging isn't necessary with the default code, but it's annoying to go hunting around to figure out where that function is called, when, why, if it ever happens, etc.
Maybe a more logical flow (altho im not sure what, but you asked for feedback), so you don't have to go hunting through every file for that function!

Personally i dont mind the long names - i'd rather them than, 'what does this do again?!'

~Stephanie
Team 1351

ps- i'll think about what to change next time im programming!

[edit] and i definately agree w/ seanwitte, see below [/edit]
__________________
2004 Founding member and Arm leader, 2005 Lead programmer, 2006 Controls leader, 2007 Project Manager/President
Thanks for making FIRST such a great experience for me. I'm no longer on 1351, and I'm not currently planning to mentor team 97, but FIRST has meant so much in getting me to where I am now, in life and at MIT, class of 2011.
I met Billfred! He recognized me!
SVR 04: 11th seed - Highest Rookie Seed - Semifinalists w/ 1120 and 568 - GM Industrial Design Award
SVR 05: Semifinalists w/ 8 and 766
SVR 06: 6th seed - Quarterfinalists w/ 368 and 1072
Davis 06: 1st seed - Quarterfinalists w/ 649 and 100 - KPCB Entrepreneurship Award
SVR 07: 36th seed
David 07: 4th seed - Semifinalists w/ 1280 and 692 - Johnson and Johnson Sportsmanship Award

Last edited by RbtGal1351 : 07-01-2005 at 09:43 PM.
  #5   Spotlight this post!  
Unread 07-01-2005, 09:15 PM
seanwitte seanwitte is offline
Registered User
None #0116
Team Role: Engineer
 
Join Date: Nov 2002
Location: Herndon, VA
Posts: 378
seanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant future
Send a message via AIM to seanwitte
Re: If you could write the default code...

It would be nice if was organized with hooks for discrete events since the programs all follow a similar lifecycle. This is rough, but something like:

masterSystemInit() - runs once at startup to configure the device
masterUserInit() - runs once at startup to configure user information
runDisabled() - runs while robot is disabled
initAutonomous() - runs once when state changes to autonomous
runAutonomous() - runs each cycle during autonomous
initTeleoperation() - runs once when state changes to teleoperation mode
runTeleoperation() - runs each cycle during teleoperation
readInputs() - runs at the start of each cycle to collect any inputs
writeOutputs() - runs at the end of each cycle to update relays and motors

This framework would allow you to focus on these relatively simple stubs. The flow of the framework code would be something like:

masterSystemInit()
masterUserInit()
while 1=1
wait for master uP

readInputs()

if runState != previous runState then
if runState = AUTO then
initAutonomous()
elseif runState = TELEOP then
initTeleoperation()
end if

if runState = DISABLED then
runDisabled()
else if runState = AUTO then
runAutonomous()
else
runTeleoperation()
end if

writeOutputs()
wend
  #6   Spotlight this post!  
Unread 07-02-2005, 07:03 AM
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: If you could write the default code...

Quote:
Originally Posted by seanwitte
It would be nice if was organized with hooks for discrete events since the programs all follow a similar lifecycle. This is rough, but something like:

...rest of post..
Interesting idea. I like it.

Two things: I can't stand the fact that spaces are used instead of tabs ( ) and it might be nice (especially for new FIRST programmers) if all "never editable" files were moved into a subdirectory. That would make it more obvious what you are supposed to edit as well as make finding individual files easier.
__________________


Last edited by Ryan M. : 07-02-2005 at 12:37 PM.
  #7   Spotlight this post!  
Unread 07-02-2005, 11:33 AM
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,332
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: If you could write the default code...

Quote:
Originally Posted by Ryan M.
...all "never editable" files were moved into a subdirectory. That would both make it more obvious what you are supposed to edit as well as make finding individual files easier.
Good idea. How about just putting those functions into a library? The library source code could be provided as a separate project.

-Kevin
__________________
Kevin Watson
Engineer at Virgin Galactic
http://kevin.org
  #8   Spotlight this post!  
Unread 07-02-2005, 03:40 PM
Bharat Nain's Avatar
Bharat Nain Bharat Nain is offline
Registered User
no team
Team Role: Alumni
 
Join Date: Jan 2004
Rookie Year: 2003
Location: New York
Posts: 1,999
Bharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond reputeBharat Nain has a reputation beyond repute
Send a message via AIM to Bharat Nain Send a message via MSN to Bharat Nain
Re: If you could write the default code...

Quote:
Originally Posted by Kevin Watson
Good idea. How about just putting those functions into a library? The library source code could be provided as a separate project.

-Kevin
Now that is an excellent idea. That would make it a lot easier to play around with different versions of a code.
__________________
-= Bharat Nain =-

Whatever you do, you need courage. Whatever course you decide upon, there is always someone to tell you that you are wrong. There are always difficulties arising that tempt you to believe your critics are right. To map out a course of action and follow it to an end requires some of the same courage that a soldier needs. Peace has its victories, but it takes brave men and women to win them. - Ralph Waldo Emerson
  #9   Spotlight this post!  
Unread 07-16-2005, 01:56 AM
Orborde Orborde is offline
Registered User
FRC #1747
Team Role: Mentor
 
Join Date: Apr 2004
Rookie Year: 2003
Location: Indianapolis, IN
Posts: 44
Orborde has a spectacular aura aboutOrborde has a spectacular aura about
Send a message via AIM to Orborde
Re: If you could write the default code...

I personally like being able to modify main.c, and I think that "DO NOT EDIT THIS FILE" should be sufficient warning for the clueless.

I like how the code is put together to some extent, but I sometimes wish it weren't so massively splayed out across 15 files.
  #10   Spotlight this post!  
Unread 07-23-2005, 08:17 PM
Kyle T Kyle T is offline
waiting for next season...
FRC #0810 (Mechanical Bulls)
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 2004
Location: Smithtown
Posts: 20
Kyle T is an unknown quantity at this point
Re: If you could write the default code...

I just hate how they made all those 'don't touch' read only. What if I want to add my own aliases to ifi_aliases.h? I have to go out of MPLAB, find the file, un-read-only it, and then re-open it with MPLAB.
__________________
  #11   Spotlight this post!  
Unread 07-24-2005, 03:46 PM
RyanMcE RyanMcE is offline
Still Learning...
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2002
Location: Bellevue, WA
Posts: 60
RyanMcE will become famous soon enough
Re: If you could write the default code...

Quote:
Originally Posted by Kyle T
I just hate how they made all those 'don't touch' read only. What if I want to add my own aliases to ifi_aliases.h? I have to go out of MPLAB, find the file, un-read-only it, and then re-open it with MPLAB.
Or in the open or save as dialog you can right click on the file, select properties, uncheck the read-only box, and then open or save the file. Or you could make all the files writable before starting work. Hope this helps speed up the process!
__________________
Titan Robotics Club (Team 492) Co-Founder, Alumni & Mentor

#1 in the Northwest: 2001 Silicon Valley Regional Rookie All-Star Award || 2001 Galileo Incredible Play Award || 2002 Southern California Regional Judge's Award || 2002 Pacific Northwest Regional Finalist || 2003 Silicon Valley Regional Entrepreneurship Award || 2003 Pacific Northwest Regional Website Award || 2003 Pacific Northwest Regional Finalist || 2003 Pacific Northwest Regional Engineering Inspiration Award || 2004 Pacific Northwest Website Award || 2004 Pacific Northwest Regional Champions (#1 seed) || 2004 Galileo Semi-Finalist || 2005 Pacific Northwest Regional General Motors Industiral Design Award || 2005 Pacific Northwest Regional Champions (#1 seed) || 2005 Galileo Finalist

"We'll do better next time" -- Team Motto
  #12   Spotlight this post!  
Unread 07-24-2005, 07:49 PM
Kyle T Kyle T is offline
waiting for next season...
FRC #0810 (Mechanical Bulls)
Team Role: Programmer
 
Join Date: Feb 2005
Rookie Year: 2004
Location: Smithtown
Posts: 20
Kyle T is an unknown quantity at this point
Re: If you could write the default code...

Yeah, I know, I removed read-only from everything as soon as I got the default code, but it's still annoying.
__________________
  #13   Spotlight this post!  
Unread 07-24-2005, 08:07 PM
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: 7,867
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: If you could write the default code...

Quote:
Originally Posted by Kyle T
I just hate how they made all those 'don't touch' read only. What if I want to add my own aliases to ifi_aliases.h?
It's a bad idea to modify ifi_aliases.h. If IFI ever releases a new version of the default code with a new ifi_aliases.h, you'll have to redo all your changes which leads to errors and extra work. It's also almost impossible to pass your code on to the next set of programmers.

Instead, you should create a new file, perhaps "kyles_aliases.h" and add everything you want there.
  #14   Spotlight this post!  
Unread 07-25-2005, 11:34 AM
mpob's Avatar
mpob mpob is offline
Registered User
AKA: Mike OBrien
#1511 (Rolling Thunder)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2004
Location: Rochester, NY
Posts: 50
mpob will become famous soon enoughmpob will become famous soon enough
Re: If you could write the default code...

I was new to the code this year, and noticed that the basic architecture is scan loops and ISR's.

Would it be useful to have an advanced version of the default code that contained an RTOS (Real Time Operating System).

With an RTOS the application code could be designed as indepently executing threads. I know it would add a layer of complexity as the programmers of this type of code kit would need to understand:
- what a semaphore is
- task priorities, and priority inversion
- designing and debugging multi-threaded code
- concepts like task switching, mutual exclusion, and race conditions
- Memory management
- Stack allocation, and management

a lot of complex things to understand, but a lot to be gained also,
which is why I was thinking in terms of offering this as a optional "advanced" code kit.

I have always been very comfortable working with real-time embedded code, and RTOS's. But it is an area of interest for me

But I am wondering what others think of this???

Is an RTOS to far out, and complex to be used in a FIRST Robot ?


--Mike O'Brien
__________________
Roll Strong!
Mentor Team 1511 - Rolling Thunder!
  #15   Spotlight this post!  
Unread 07-25-2005, 03:48 PM
Hutch Hutch is offline
NOTAG
FRC #0461 (Westside Boiler Invasion)
Team Role: Programmer
 
Join Date: Jul 2005
Location: Indiana
Posts: 69
Hutch will become famous soon enoughHutch will become famous soon enough
Re: If you could write the default code...

Quote:
Originally Posted by mpob
I was new to the code this year, and noticed that the basic architecture is scan loops and ISR's.

Would it be useful to have an advanced version of the default code that contained an RTOS (Real Time Operating System).

With an RTOS the application code could be designed as indepently executing threads. I know it would add a layer of complexity as the programmers of this type of code kit would need to understand:
- what a semaphore is
- task priorities, and priority inversion
- designing and debugging multi-threaded code
- concepts like task switching, mutual exclusion, and race conditions
- Memory management
- Stack allocation, and management

a lot of complex things to understand, but a lot to be gained also,
which is why I was thinking in terms of offering this as a optional "advanced" code kit.

I have always been very comfortable working with real-time embedded code, and RTOS's. But it is an area of interest for me

But I am wondering what others think of this???

Is an RTOS to far out, and complex to be used in a FIRST Robot ?


--Mike O'Brien

I feel it's not entirely necessary at this point... Not to mention I doubt it's feasible with the current controller (think about the tiny memory size). That being said, if something more simplistic were done such as a simple cooperative multitasker (that's part of my design for next year), that would definitely be good. At the moment though, debugging is painful enough on the RC - no need to throw multithreading into the mix.

OP: I think maybe having cleaner code in general... No functions with comment headers longer than the functions, consistent naming, things like that.
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
Out of the Box Camera Code russell Programming 9 10-21-2009 04:28 AM
Best Way To Insert Autonomous Code Into Default then load help.? :-)? gemccnp Programming 2 02-05-2005 05:58 PM
default code vs. 2.4 stephenthe1 Programming 2 02-05-2005 05:02 PM
Team THRUST - Kevin's Code and Camera Code Combine Chris_Elston Programming 3 01-31-2005 09:28 PM
heres the code. y this not working omega Programming 16 03-31-2004 02:18 PM


All times are GMT -5. The time now is 05:32 AM.

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


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