Go to Post Everyone needs to please stop now before Karthik starts singing. - dlavery [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 11-03-2015, 18:13
razar51 razar51 is offline
Registered User
AKA: John Faulkner
FRC #1288 (Raven Robotics)
Team Role: Mentor
 
Join Date: Jan 2015
Rookie Year: 2007
Location: St. Charles, MO
Posts: 10
razar51 is an unknown quantity at this point
Team 1288 Initial Python Code release

This is the first year team 1288 is using python for our robot. Here is our initial code going into the competition.

We only scratched the surface of what we can do with python and hope to greatly improve our coding process in the years to come!
Attached Files
File Type: zip robot.zip (4.2 KB, 39 views)
Reply With Quote
  #2   Spotlight this post!  
Unread 11-03-2015, 23:16
TimTheGreat's Avatar
TimTheGreat TimTheGreat is offline
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 231
TimTheGreat will become famous soon enoughTimTheGreat will become famous soon enough
Re: Team 1288 Initial Python Code release

First off, congrats. Python is a great language choice since it's so easy to use.

I went through your code because it is always fun to see how teams do stuff differently, and I noticed a few things.

Code:
self.cameraFour = wpilib.USBCamera(b'cam3')
Did you mean to put b'cam3'?

Also, the code for gyro rotation seems awfully long. 1418 did this last year and the way we did it was

Code:
angleOffset = target_angle - self.return_gyro_angle()
if angleOffset < -1 or angleOffset > 1:
	self.rotation = angleOffset * self.angle_constant
	self.rotation = max(min(0.5, self.rotation), -0.5)
self.angle_constant was used to keep the rotation speed low. It was .04. The max(min()) code keeps the rotation in between -.5 and .5 as an extra safety precaution. Then we just pass self.rotation into the mecanum drive method to rotate.

Quote:
Originally Posted by razar51 View Post
We only scratched the surface of what we can do with python and hope to greatly improve our coding process in the years to come!
Either now while you're waiting for competition or during the offseason rewrite your code. It is a great way to learn, as you often think of a better way to do something. Also, look at other python teams and their code from previous years.

PS: Don't forget to add yourselves to the 2015 RobotPy Roll Call
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP
Reply With Quote
  #3   Spotlight this post!  
Unread 11-03-2015, 23:34
TimTheGreat's Avatar
TimTheGreat TimTheGreat is offline
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 231
TimTheGreat will become famous soon enoughTimTheGreat will become famous soon enough
Re: Team 1288 Initial Python Code release

You guys aren't using github are you?
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP
Reply With Quote
  #4   Spotlight this post!  
Unread 12-03-2015, 01:02
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,032
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: Team 1288 Initial Python Code release

Good stuff! Glad to see more people making use of python

You might find that your autonomous state machines will be easier to create/read/adjust if you use the StatefulAutonomous stuff in robotpy-wpilib-utilities.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
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
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 21:36.

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