Go to Post Everyone is reading way too much into this. The game piece is clearly a bunch of Opahs this year. Problem solved, case closed. Start designing your fish handling robots now. - Ryan Dognaux [more]
Home
Go Back   Chief Delphi > Technical > Programming > Python
Team 51   CD-Events   CD-Media   CD-Swap   CD-Spy   FRC-Spy   Unsung FIRST Heroes   WFA
portal register members calendar search Today's Posts Mark Forums Read FAQ rules
VEXpro
The Chief Delphi Forums are sponsored by Innovation First International, Inc.
ITT Tech
ADVERTISEMENT

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 08-27-2011, 02:10 AM
WizenedEE's Avatar
WizenedEE WizenedEE is offline
Registered User
AKA: Adam
FRC #3238 (Cyborg Ferrets)
Team Role: Leadership
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Anacortes, WA
Posts: 395
WizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to all
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!
Reply With Quote
  #2   Spotlight this post!  
Unread 08-27-2011, 11:25 PM
Peter Johnson Peter Johnson is offline
With great power comes great I^2*R
FRC #0294 (Beach Cities Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Redondo Beach, CA
Posts: 114
Peter Johnson is a splendid one to beholdPeter Johnson is a splendid one to beholdPeter Johnson is a splendid one to beholdPeter Johnson is a splendid one to beholdPeter Johnson is a splendid one to beholdPeter Johnson is a splendid one to beholdPeter Johnson is a splendid one to behold
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
__________________
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
  #3   Spotlight this post!  
Unread 08-28-2011, 02:58 AM
WizenedEE's Avatar
WizenedEE WizenedEE is offline
Registered User
AKA: Adam
FRC #3238 (Cyborg Ferrets)
Team Role: Leadership
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Anacortes, WA
Posts: 395
WizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to all
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?
Reply With Quote
  #4   Spotlight this post!  
Unread 08-28-2011, 11:09 PM
Peter Johnson Peter Johnson is offline
With great power comes great I^2*R
FRC #0294 (Beach Cities Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Redondo Beach, CA
Posts: 114
Peter Johnson is a splendid one to beholdPeter Johnson is a splendid one to beholdPeter Johnson is a splendid one to beholdPeter Johnson is a splendid one to beholdPeter Johnson is a splendid one to beholdPeter Johnson is a splendid one to beholdPeter Johnson is a splendid one to behold
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.
__________________
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
  #5   Spotlight this post!  
Unread 09-02-2011, 11:26 PM
Ziv Ziv is offline
Has code to be writing...
FRC #0125 (Nutrons)
Team Role: Alumni
 
Join Date: Mar 2010
Rookie Year: 2009
Location: Boston
Posts: 37
Ziv is a glorious beacon of lightZiv is a glorious beacon of lightZiv is a glorious beacon of lightZiv is a glorious beacon of lightZiv is a glorious beacon of light
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?
Reply With Quote
  #6   Spotlight this post!  
Unread 09-03-2011, 11:06 PM
Peter Johnson Peter Johnson is offline
With great power comes great I^2*R
FRC #0294 (Beach Cities Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Redondo Beach, CA
Posts: 114
Peter Johnson is a splendid one to beholdPeter Johnson is a splendid one to beholdPeter Johnson is a splendid one to beholdPeter Johnson is a splendid one to beholdPeter Johnson is a splendid one to beholdPeter Johnson is a splendid one to beholdPeter Johnson is a splendid one to behold
Re: Python WPILib Reference?

Quote:
Originally Posted by Ziv View Post
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?
Constants are scoped into the class where they are defined. E.g. "wpilib.Encoder.k4x", "wpilib.Relay.kReverse", etc.
__________________
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
  #7   Spotlight this post!  
Unread 09-24-2011, 07:42 PM
DjMaddius's Avatar
DjMaddius DjMaddius is offline
Registered User
AKA: Matt Smith
FRC #2620 (Southgate Titans)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Southgate, Mi
Posts: 159
DjMaddius is an unknown quantity at this point
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:
Reply With Quote
  #8   Spotlight this post!  
Unread 09-24-2011, 11:27 PM
Peter Johnson Peter Johnson is offline
With great power comes great I^2*R
FRC #0294 (Beach Cities Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Redondo Beach, CA
Posts: 114
Peter Johnson is a splendid one to beholdPeter Johnson is a splendid one to beholdPeter Johnson is a splendid one to beholdPeter Johnson is a splendid one to beholdPeter Johnson is a splendid one to beholdPeter Johnson is a splendid one to beholdPeter Johnson is a splendid one to behold
Re: Python WPILib Reference?

Quote:
Originally Posted by DjMaddius View Post
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:
Until the 2012 game manual is released, we won't know for sure, but all indications are that it (and other scripting languages like Lua) will be legal. One positive indication: both teams 294 (ported Python) and 973 (ported Lua) are control system beta testers for 2012.
__________________
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
  #9   Spotlight this post!  
Unread 09-25-2011, 12:38 PM
DjMaddius's Avatar
DjMaddius DjMaddius is offline
Registered User
AKA: Matt Smith
FRC #2620 (Southgate Titans)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Southgate, Mi
Posts: 159
DjMaddius is an unknown quantity at this point
Re: Python WPILib Reference?

Awesome! Really looking forward to it this year. Thanks for the info.
Reply With Quote
  #10   Spotlight this post!  
Unread 09-26-2011, 02:05 PM
virtuald virtuald is offline
Registered User
AKA: Dustin Spicuzza
FRC #2423 (Kwarqs)
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Massachusetts
Posts: 370
virtuald is a splendid one to beholdvirtuald is a splendid one to beholdvirtuald is a splendid one to beholdvirtuald is a splendid one to beholdvirtuald is a splendid one to beholdvirtuald is a splendid one to behold
Send a message via AIM to virtuald
Re: Python WPILib Reference?

We used python last year, it was fantastic.
__________________
--Innovation is just a problem away

2012 & 2013 Boston Regional Innovation in Control Award

NetworkTables for PC in a python module: https://github.com/robotpy/pynetworktables
FRC Software Resources (including 2012 python code): http://www.virtualroadside.com/FRC/
WPILib Doxygen Repo: http://www.virtualroadside.com/WPILib/index.html
Reply With Quote
  #11   Spotlight this post!  
Unread 09-26-2011, 02:46 PM
DjMaddius's Avatar
DjMaddius DjMaddius is offline
Registered User
AKA: Matt Smith
FRC #2620 (Southgate Titans)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Southgate, Mi
Posts: 159
DjMaddius is an unknown quantity at this point
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 : 09-26-2011 at 03:10 PM.
Reply With Quote
  #12   Spotlight this post!  
Unread 10-05-2011, 01:52 PM
LinuxArchitect LinuxArchitect is offline
Registered User
AKA: George Boyce
FRC #0053 (Cow Abductors)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Greenbelt MD
Posts: 78
LinuxArchitect is a name known to allLinuxArchitect is a name known to allLinuxArchitect is a name known to allLinuxArchitect is a name known to allLinuxArchitect is a name known to allLinuxArchitect is a name known to all
Re: Python WPILib Reference?

Quote:
Originally Posted by DjMaddius View Post
it looks like we are going to do Labview and python parallel together this year!
You're not alone. We're doing the same thing, beta testing labview and developing our python skills in parallel. A third team might sneak in with Java as well. We'll have an in-house autonomous challenge in December and then decide on which language to use for competition season.

George/Team 53
Reply With Quote
  #13   Spotlight this post!  
Unread 10-11-2011, 07:59 PM
DjMaddius's Avatar
DjMaddius DjMaddius is offline
Registered User
AKA: Matt Smith
FRC #2620 (Southgate Titans)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Southgate, Mi
Posts: 159
DjMaddius is an unknown quantity at this point
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.
Reply With Quote
Reply


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


All times are GMT -5. The time now is 09:39 AM.

The Chief Delphi Forums are sponsored by Innovation First, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright © Delphi and Pontiac Central High School