Skip to content
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

66-logging-util Initial Implementation #74

Open
wants to merge 7 commits into
base: tank-bot
Choose a base branch
from

Conversation

KTruntaev
Copy link
Contributor

@KTruntaev KTruntaev commented Mar 11, 2023

Added a utility that allows us to record any sensor reading from the robot into a .csv file.

Added changes within RobotContainer.java & Robot.java, and implemented the util folder.

resolves #66

@@ -44,6 +50,17 @@ public void robotPeriodic() {
// and running subsystem periodic() methods. This must be called from the robot's periodic
// block in order for anything in the Command-based framework to work.
CommandScheduler.getInstance().run();

// REMEMBER TO MOVE THIS OUT OF ROBOT PERIODIC
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this comment outdated or do you still intend to move this out?

m_logger.updateFields();
m_logger.log();
} else {
m_logTime += 20;
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than incrementing this by a fixed 20 here, should we increment by the elapsed time since the last execution?

Comment on lines 91 to 93
public double getMotorSpeed() {
return m_leftA.get();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this should return both motor speeds (in an array for example). Otherwise we're only ever able to log the speed of one motor. Alternatively you could create a getLeftMotorSpeed and getRightMotorSpeed.

public void log() {
try {
// TODO: Do not close the writer after each write
FileWriter myWriter = new FileWriter(file,true);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can accomplish this by simply initializing a private instance variable in your constructor.

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.

Implement Data Logging
2 participants