-
Notifications
You must be signed in to change notification settings - Fork 0
added flashyflash #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
added flashyflash #111
Conversation
|
|
||
| private Config config; | ||
| private int times; | ||
| private Timer timer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are never initializing this. You should be able to get this from robot
|
Forgot to register command |
|
Rename the command class-- there is no auton subsystem |
|
Read the documentation of Timer, it's used wrong here |
| boolean blinding = vision.getLedState(); | ||
| if(blinding && timer.hasPeriodElapsed(config.onTime)) { | ||
| vision.setLedState(false); | ||
| timer.reset(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think resetting is necessary if you immediately start again
| super("VisionFlashyFlash"); | ||
| vision = robot.vision(); | ||
| requires(vision); | ||
| this.timer = new Timer(robot.timeProvider()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use robot.timer() even though it isn't merged yet
| logger.info("Flashing light {} times", config.maxTimes); | ||
| times = 0; | ||
| vision.setLedState(true); | ||
| timer.reset(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get rid of redundant timer function calls
|
|
||
| static class Config { | ||
| public int maxTimes; | ||
| public float onTime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use doubles 'round these parts
9a156d0 to
d78b628
Compare
d78b628 to
c578d15
Compare
| boolean blinding = vision.getLedState(); | ||
| if(blinding && timer.hasPeriodElapsed(config.onTime)) { | ||
| vision.setLedState(false); | ||
| timer.start(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently not necessary, hasPeriodElapsed restarts if it has
| super("VisionFlashyFlash"); | ||
| vision = robot.vision(); | ||
| requires(vision); | ||
| timer = new Timer(robot.timeProvider()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get the timer from robot
7274ada to
1459c18
Compare
|
Needs autoformat |
| private AbstractVision vision; | ||
|
|
||
| public VisionFlashyFlash(CoreRobot robot) { | ||
| super("AutonFlashyFlash"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename this
1459c18 to
bd954f7
Compare
bd954f7 to
2ea1ac7
Compare
2ea1ac7 to
e17c0d0
Compare
No description provided.