PDA

View Full Version : RobotPy 2011.1


Peter Johnson
01-11-2011, 02:21 AM
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.

Slix
01-11-2011, 06:41 PM
Cool.


2011 WPILib module that includes all 2011 updated classes and functions.


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



SIP is now used instead of SWIG for WPILib wrapper generation. This makes the library feel much more Pythonic.

What did that change?

Peter Johnson
01-11-2011, 08:09 PM
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.

Slix
01-11-2011, 08:29 PM
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).

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

blakeelias
01-12-2011, 05:29 PM
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?

Robototes2412
01-12-2011, 11:43 PM
yes, its just in the _wpilib.out file

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

Peter Johnson
01-13-2011, 03:10 AM
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?

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

CapnKernel
01-13-2011, 07:08 PM
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.

blakeelias
01-13-2011, 09:13 PM
Oops that's a bug! I'll fix it in git tonight and it'll be fixed in the 2011.2 release.

Great! Can't wait to test it.

blakeelias
01-13-2011, 09:16 PM
yes, its just in the _wpilib.out file

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

Peter Johnson
01-13-2011, 11:45 PM
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.

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.

Peter Johnson
01-13-2011, 11:47 PM
I tried to make a wrapper class for _wpilib.Victor, but was unsuccessful. I guess I did something wrong.

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.