OCCRA
Go to Post It's the corollary that you pick them no matter what shape they start the event in. Pink is known for showing up at their 1st regional with the robot in an unfinished state. And somehow, magically by the end of qualifications it just works, and they win. - Nuttyman54 [more]
Home
Go Back   Chief Delphi > Technical > Programming > Python
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 08-27-2011, 03: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-28-2011, 12:25 AM
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: 328
Peter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant future
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
__________________
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
  #3   Spotlight this post!  
Unread 08-28-2011, 03: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-29-2011, 12:09 AM
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: 328
Peter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant future
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.
__________________
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
  #5   Spotlight this post!  
Unread 09-03-2011, 12:26 AM
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: 39
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-04-2011, 12:06 AM
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: 328
Peter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant future
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.
__________________
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
  #7   Spotlight this post!  
Unread 09-24-2011, 08: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: 161
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-25-2011, 12:27 AM
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: 328
Peter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant futurePeter Johnson has a brilliant future
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.
__________________
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
  #9   Spotlight this post!  
Unread 09-25-2011, 01: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: 161
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, 03:05 PM
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,235
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: Python WPILib Reference?

We used python last year, it was fantastic.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python), pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript), and lots more...

2017 Season: Teams #1973, #4796, #6367
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote
  #11   Spotlight this post!  
Unread 09-26-2011, 03: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: 161
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 04:10 PM.
Reply With Quote
  #12   Spotlight this post!  
Unread 10-05-2011, 02: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, 08: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: 161
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 07:52 AM.

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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi