Skip to content

Conversation

@AustinShalit
Copy link
Member

Closes #573

This PR is a continuation of #573

PeterJohnson and others added 3 commits April 23, 2016 00:16
The period and path prefix and suffix can be set, and the operation enabled
and disabled at will (this is particularly useful in combination with PR WPIRoboticsProjects#572).

if (!inputSocket.getValue().isPresent()) {
throw new IllegalArgumentException("Input image must not be empty");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't necessary.
Step does this already.

@codecov-io
Copy link

codecov-io commented Jun 3, 2016

Current coverage is 58.78%

Merging #599 into master will decrease coverage by 0.04%

  1. File ...ables/NTManager.java (not in diff) was modified. more
    • Misses +3
    • Hits -3
@@             master       #599   diff @@
==========================================
  Files           191        194     +3   
  Lines          5963       6041    +78   
  Methods           0          0          
  Messages          0          0          
  Branches        553        556     +3   
==========================================
+ Hits           3508       3551    +43   
- Misses         2293       2330    +37   
+ Partials        162        160     -2   

Sunburst

Powered by Codecov. Last updated by 1fa3a84...67fe91f

}

final Handler fileHandler = new FileHandler("%h/GRIP.log");//Log to the file "GRIPlogger.log"
final Handler fileHandler = new FileHandler("%t/GRIP.log");//Log to the file "GRIPlogger.log"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you changing the log file directory?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never actually finished what I was doing... Going to move the log file into the GRIP directory.

}

// don't save new image until period expires
if (stopwatch.elapsed(TimeUnit.NANOSECONDS) < periodSocket.getValue().get().doubleValue()*1000000000L) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you using nanoseconds? There's no real point if the file name has only millisecond precision.

@AustinShalit
Copy link
Member Author

@SamCarlberg @JLLeitschuh I added the filetype selector. The only issue is that the quality slider does not do anything when png is selected (this is intentional). Do we care that it will not do anything?

logger.log(Level.WARNING, ex.getMessage(), ex);
}
};
new Thread(runnable).start();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this a daemon thread otherwise it won't die when the application tries to shut down.
This is especially important if the file writing hangs.

@AustinShalit
Copy link
Member Author

This PR is ready for review/merge

@SamCarlberg
Copy link
Member

LGTM

activeSocket = operation.getInputSockets().stream().filter(
o -> o.getSocketHint().getIdentifier().equals("Active")
&& o.getSocketHint().getType().equals(Boolean.class)).findFirst().get();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really need dependency injection for this?? There is a MockInputSocketFactory and a MockOutputSocketFactory you can use.
Also, why are you using a real file manager in a test? I really don't want tests writing to the file system.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe I am using a real FileManager. I will remove the injection

IMAGE_DIRECTORY.mkdirs(); // If the user deletes the directory
Files.write(image, file);
} catch (IOException ex) {
logger.log(Level.WARNING, ex.getMessage(), ex);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this not pass the exception up to the caller?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point it is in a different thread. How could I handle that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I suppose this doesn't make sense.

@JLLeitschuh JLLeitschuh merged commit 12ae9d6 into WPIRoboticsProjects:master Jul 8, 2016
@AustinShalit AustinShalit deleted the image-snapshots branch July 8, 2016 00:21
@AustinShalit AustinShalit added this to the v2.0.0 milestone Jul 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants