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
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