![]() |
New to FRC programming... How does this look?
I am completely new at FRC programming, and I'm not sure what really is the best way to go about it. Anyone care to give suggestions?
Code:
package edu.wpi.first.wpilibj.templates; |
Re: New to FRC programming... How does this look?
Quote:
Just some quick suggestions :) |
Re: New to FRC programming... How does this look?
Thanks so much for the help :)
Look better? Code:
package edu.wpi.first.wpilibj.templates; |
Re: New to FRC programming... How does this look?
This may just be one of the things that I do and find useful, but creating constants for port numbers can be extremely useful for someone who has not read your code and is not using your robot.
Things like Code:
private static final int DRIVE_LEFT_FRONT = 1;Also, to find the x axis/y axis value just type joystick.getX() or joystick.getY(). You also do not need to set the value of the joystick to a double before supplying it to the drive() method. Code:
public static String log(String aMessage){ |
Re: New to FRC programming... How does this look?
Code:
double angle = 0;And only reset your gyro when you need to, and not when its moving. You want to stop and wait a little so that you have a steady zero value. |
Re: New to FRC programming... How does this look?
Like omalleyj said, resetting gyro in the loop isn't a good way, especially when it's moving.
I would do something simple like this: Code:
// Reset gyro before the main loop, or with a button. |
| All times are GMT -5. The time now is 10:39. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi