Go to Post I dont compete to win prizes, I compete to win Pride. - CircularLogic [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Spotlight this post!  
Unread 04-30-2010, 04:27 PM
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: Feedback Thread: WPILib

I have to agree strongly with FRC4ME, the OOP is poorly implemented. When I look at the autocomplete for a digital input, I don't want to see stuff not related to a digital input.
I also don't like the error classes, aside from only being used in the PCVideoServer, they flood the autocomplete with unnecessary items. If all classes inherit from ErrorBase, it should have two methods: HasError() and GetError(), and GetError would return a object that can be used to set, clear, and get the error
Two alternate ideas for the PID classes would be to have every class implement a sensor interface that has a Get(), and then you could pass it to the PID stuff, or have a sort of function pointer that points to the method and/or objects to call on.
A better OOP sensor class inheritance would be nice, as well as a Get() and Set(value) for all sensors.
Some classes are somewhat confusing in name to a novice: AnalogChannel, AnalogModule, AnalogTrigger, AnalogTriggerOutput, etc...

One thing that would be really nice would be a cleanup of the public members. For instance, the DigitalInput has tons of stuff you don't really need:
CancelInterrupts (Whoop-de-do!)
CheckAnalogChannel (This is not analog. I don't care)
CheckAnalogModule (This is not analog. I don't care)
CheckDigitalChannel (Potentially for debugging, what does it check? the module is present? nope, the channel # is valid. how confusing)
CheckDigitalModule (Potentially for debugging, what does it check? the module is present? nope, the channel # is valid. how confusing)
CheckPWMChannel (confusing and unrelated)
CheckPWMModdule (confusing and unrelated)
CheckRelayChannel (confusing and unrelated)
CheckRelayModule (confusing and unrelated)
CheckSolenoidChannel (confusing and unrelated)
CheckSolenoidModule (confusing and unrelated)
ClearError (Not useful, I don't see an error ever being set in the code)
DeleleSingletons (what singletons?)
DisableInterrupts (Wow! The first potentially useful and non confusing method! But you do need to know what Interrupts are)
EnableInterrupts (Wow! another!)
Get (And another! This one will be use by most people, and is not confusing in any way!)
GetAnalogTrggerForRouting( Routing? whats that? why do I care? and why is it an analogtrigger when this is a digitalinput)
GetChannel (Didn't I set the channel? did it change?)
GetChannelForRouting( Routing? whats that? why do I care?)
GetDefaultAnalogModule (I don't need this, and its unrelated to digital inputs)
GetDefaultDigitalModule (Can't I just use the one item constructor?)
GetDefaultSolenoidModule (I don't need this, and its unrelated to digital inputs)
GetError (Do we have an Error? If the code set errors, yes, but otherwise, this is unnecessary)
GetGlobalError (A global error on a non-global object? what is this madness?)
GetModuleForRouting (Why so much rooting? is roto-rooter here?)
ReadInterruptTimestamp (Why do I care? Isn't WPILib supposed to be a higer level framework? do I have to manually compare timestamps?)
RequestInterrupts (I'm taking a nap until a useful function come up, so Interrupt my nap when one does)
SetDefaultAnalogModule (Its a DigitalInput, not Analog!)
SetDefaultDigitalModule (Useful for pointers if you like making work, but you could just use the two arg constructor)
SetDefaultSolenoidModule (Solenoid !=(in your wildest dreams) DigitalInput)
SetError (I can cause errors, he he he!)
SetUpSourceEdge(source edge. ok. sure (smile and nod))
WaitForInterrupt(A useful function if you know what interrupts are! state-changers, Its a final useful function!)

A better DigitalInput: (dashes represent members of the object the function above returns)
Disable
Enable
Get
GetError
-IsFatal
-Set
-Get
-Clear
-...
GetInterruptManager
-Cancel
-Request
-Enable
-Disable
-Wait
-...
HasError
WaitForStateChange

Also, the C interfaces are kind of strange, I don't really think we need them (also given the fact that I have not heard of any teams using C this year)
Namespacing would be nice, although possibly confusing to new users

Better documentation and help would be very nice. And along this line, a better commented default SimpleTemplate would also be helpful

It would be great if you fixed this TODO as well

/**
* @todo If this is going to last until release, it needs a better name.
*/
class SimpleRobot
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
 


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
Feedback Thread: Driver Station and Dashboard Greg McKaskle FRC Control System 10 10-13-2010 11:26 PM
WPILib in Dev C++ mikelowry C/C++ 2 09-22-2009 10:41 AM
Importing WPILib? lingomaniac88 C/C++ 1 01-12-2009 08:39 PM
Using WPILib RyanW Programming 1 01-19-2008 05:15 PM


All times are GMT -5. The time now is 03:57 AM.

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