|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Python WPILib Reference?
Hello there,
I'm looking to try out programming in python, but I can't figure out what functions/classes/etc exist. Is there some sort of simple reference that lists the functions, parameters, returns, and a sort description of what they do? Or is there a file in the robotpy folder that defines them? Going off examples involves a lot of guesswork, which is tough without a C-RIO. I did find something that says, "They're basically the same as the c++ ones but some of them are different" which wasn't very helpful, especially since I don't know the c++ functions! If anyone has a page on the c++ functions, that would be nice also. Thanks for the help! |
|
#2
|
|||
|
|||
|
Re: Python WPILib Reference?
It's available in a couple of places online (just search for "WPILib reference"):
http://devildawgs549.com/2011_WPILib...Reference.html http://amhsrobotics.com/wpilib/html/annotated.html |
|
#3
|
||||
|
||||
|
Re: Python WPILib Reference?
Thank you, those look great.
Is there a place where I can look at the source code of all the wpilib python functions, somewhere in the robotpy file that's on github? |
|
#4
|
|||
|
|||
|
Re: Python WPILib Reference?
The Python WPILib is mostly just a wrapper around the C++ one, generated by a tool called SIP (this is unlike Java, where the Java WPILib is written entirely in Java itself). The code is located in https://github.com/robotpy/robotpy/t...ackages/wpilib
The wpilib.py file is what you get when you "import wpilib", and is the only real Python file. It reimplements the robot base classes (e.g. IterativeRobot) for technical reasons (the C++ robot class runs the Python interpreter so you can't overload it directly from Python). The rest of the library is implemented through code generated from the sip files in the sip/ directory. These are (for the most part) just stripped down copies of the C++ header files with a few tweaks where necessary to support reasonable parameter passing to and from Python. |
|
#5
|
|||
|
|||
|
Re: Python WPILib Reference?
Peter, thanks for bringing Python to FRC!
I poked around for a while in the links you mention, but I still have one question: does one need to do anything special to specify values of types such as EncodingType? Is the proper syntax just "enc = wpilib.Encoder(1, 2, False, k4x)" or something fancier? |
|
#6
|
|||
|
|||
|
Re: Python WPILib Reference?
Quote:
|
|
#7
|
||||
|
||||
|
Re: Python WPILib Reference?
Are we allowed to use Python this year? That would be incredible! Python is easily on the top of my favorite languages. It makes things that would normally take lots of code in one language into just a few short lines.
If we can use Python, we are all set this year. Not a fan of labview D: |
|
#8
|
|||
|
|||
|
Re: Python WPILib Reference?
Quote:
|
|
#9
|
||||
|
||||
|
Re: Python WPILib Reference?
Awesome! Really looking forward to it this year. Thanks for the info.
|
|
#10
|
||||
|
||||
|
Re: Python WPILib Reference?
We used python last year, it was fantastic.
![]() |
|
#11
|
||||
|
||||
|
Re: Python WPILib Reference?
Been talking with the others involved and it looks like we are going to do Labview and python parallel together this year! Im doing the python and one of the mentors is doing labview. He prefers labview because he did it at Comau.
Really looking forward to my third year programming for the team! Im glad their is a nice community on python now. I had no idea the opportunity was there last year. Last edited by DjMaddius : 26-09-2011 at 16:10. |
|
#12
|
|||
|
|||
|
Re: Python WPILib Reference?
Quote:
George/Team 53 |
|
#13
|
||||
|
||||
|
Re: Python WPILib Reference?
Thats a good idea, put the students to the test to see which language to follow. See which one we are strongest at, and get some experience in as well. Im going to bring this idea up at our meeting on Thursday. Thanks haha.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|