RobotPy 2011.1

I’m happy to announce the first version of RobotPy (Python for FRC) for the 2011 season, 2011.1.

http://firstforge.wpi.edu/sf/projects/robotpy

Major changes from 2010.beta2 release:

  • 2011 WPILib module that includes all 2011 updated classes and functions.
  • SIP is now used instead of SWIG for WPILib wrapper generation. This makes the library feel much more Pythonic.
  • Stack size has been increased to 128K per thread. This enables many more modules to be used.
  • Hash modules (sha, md5) now work.
  • Absolute paths used to find boot.py and libraries.
  • Exception catching and 5 second restart code is now in boot.py instead of at the C++ level. If boot.py exits, so does the C++ UserProgram.out. This enables easier customization of restart functionality.

Thanks to Austin Schuh and Dustin Spicuzza for their testing, bug reports, and patches!

Per discussion in other threads, expect another release by next weekend to change restart functionality to be a bit more user-friendly, and possibly the inclusion of winpdb for debugging.

Cool.

So the camera stuff hasn’t been put in yet? (It sounds like the camera could be important this year.)

What did that change?

Sorry, no, the camera/image processing library is not yet included. I’m aware it’ll likely be important this year so I’ll be working on it this week and those classes will be in the 2011.2 release (slated for this weekend/early next week).

Changing to SIP makes it possible to create derived classes from all WPILib classes. Also, static functions are now part of their class (ClassName.StaticName()) instead of being renamed to ClassName_StaticName(). I need to update the wiki to reflect this.

Great! That addition will be a huge help in convincing my team that we won’t lose much by switching to Python.

It seems that RobotPy 2011.1 doesn’t have the Victor class any more, though it is in the 2011 WPILib. Can we still use it?

yes, its just in the _wpilib.out file

Good job on this, i’m gonna hack in basic camera stuff

Oops that’s a bug! I’ll fix it in git tonight and it’ll be fixed in the 2011.2 release.

This looks awesome! Any chance of using the python naming conventions (snake-case methods)? If not, I can create a wrapper for the classes I use.

Great work, I’ll definitely help out with testing.

Great! Can’t wait to test it.

I tried to make a wrapper class for _wpilib.Victor, but was unsuccessful. I guess I did something wrong.

When I first wrappered the C++ classes, the easiest approach was to keep the C++ naming. Plus it means you can pretty easily use the C++ WPILib reference to find out function names. It’s relatively straightforward to annotate the .sip files to rename each function to PEP 8’s lower_case convention, but I do not plan on doing so for 2011 as it would break everyone’s code who already started using 2011.1. I will consider renaming to follow Python naming conventions for 2012 if there’s sufficient community desire to do so.

The Python wrapper class was accidentally not compiled into _wpilib.out, so it’s impossible to get access to it from Python. I’m going to try to get the new release out tomorrow night.