Thread: RobotPy 2012.1
View Single Post
  #4   Spotlight this post!  
Unread 11-01-2012, 02:49
Peter Johnson Peter Johnson is offline
WPILib Developer
FRC #0294 (Beach Cities Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Redondo Beach, CA
Posts: 247
Peter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud ofPeter Johnson has much to be proud of
Re: RobotPy 2012.1

Quote:
Originally Posted by jhersh View Post
How are you deciding what to wrap and what to reimplement?
Basically I decided to wrap the low level "core" classes, and reimplement the higher level frameworks (NetworkTables, SmartDashboard, Commands). My main reasoning was that the higher level frameworks would feel much more Pythonic (e.g. natural to use) if duck typing could be used for the various interfaces (e.g. SmartDashboardData, NetworkTableChangeListener) rather than forcing people to derive from multiple base classes and remember to call all of the base class __init__ methods (required when you have a wrappered class or bad things can happen). Also, when the user code fails, error messages tend to be a lot better for native than for wrappered classes.

Something like PIDController is on the line; currently it's wrapped C++ but I'm definitely leaning towards making it native Python in the future.

I perhaps could have saved myself some work by wrapping a modified NetworkTables rather than reimplementing the whole thing, but I'm pretty pleased with the end result. Line counts of the reimplementations (SLOC):

NetworkTables.py: 1201
Preferences.py: 384
SmartDashboard.py: 355
Commands.py: 884
Buttons.py: 116
__________________
Author of cscore - WPILib CameraServer for 2017+
Author of ntcore - WPILib NetworkTables for 2016+
Creator of RobotPy - Python for FRC

2010 FRC World Champions (294, 67, 177)
2007 FTC World Champions (30, 74, 23)
2001 FRC National Champions (71, 294, 125, 365, 279)
Reply With Quote