View Single Post
  #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: 234
TimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura about
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