Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Python (http://www.chiefdelphi.com/forums/forumdisplay.php?f=187)
-   -   Team 1288 Initial Python Code release (http://www.chiefdelphi.com/forums/showthread.php?t=135688)

razar51 11-03-2015 18:13

Team 1288 Initial Python Code release
 
1 Attachment(s)
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!

TimTheGreat 11-03-2015 23:16

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 (Post 1456657)
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

TimTheGreat 11-03-2015 23:34

Re: Team 1288 Initial Python Code release
 
You guys aren't using github are you?

virtuald 12-03-2015 01:02

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.


All times are GMT -5. The time now is 19:51.

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