Go to Post Darn kids, how can they not be addicted to ChiefDelphi? - Kyle Love [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 08-01-2015, 23:46
Asymons Asymons is offline
Registered User
FRC #4716 (Purple Raiders)
Team Role: Driver
 
Join Date: Apr 2013
Rookie Year: 2013
Location: Ontario
Posts: 33
Asymons is an unknown quantity at this point
Logging Data in Java

Hello everyone!

I have a few questions about logging. Currently, our team uses a simple System.out.println to tell us if a command is running correctly, however; we would like to take it a step further. When looking at different team's robot code to learn from, I've noticed they would use some try and catch instance for logging. Is this restricted to CAN setups because I've only seen it as the code here follows, similar in nature for a variety of teams:

Code:
       try{
            System.out.println("FL = " + RobotMap.frontRightMotor.getPosition());
         }catch (CANTimeoutException ex) {
            System.out.println("--- Error Printing Encoder ---");
                ex.printStackTrace();
             }

So here are my questions:
1) Is logging possible without a CAN setup? (I assume yes, but to be sure I want to ask)
2) What are the benefits of logging?
3) Does logging use up too many resources on your processor?
4) What would you log and why?

Sorry if the question seems too trivial; however, I'm stumped on this currently.

Last edited by Asymons : 08-01-2015 at 23:55.
Reply With Quote
  #2   Spotlight this post!  
Unread 09-01-2015, 00:25
fsilberberg fsilberberg is offline
WPILib Developer
AKA: Fred Silberberg
FRC #0190
Team Role: Alumni
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Redmond
Posts: 147
fsilberberg has a spectacular aura aboutfsilberberg has a spectacular aura aboutfsilberberg has a spectacular aura about
Re: Logging Data in Java

I'm a little confused as to what you mean by logging in this case. Are you talking about logging exceptions, logging that things happened, or logging things like sensor values at specific times?

1) In general, sure it's possible to log other things. For example, let's say you want to log where an elevator motor is before/after you adjust its position. You could get the value of whatever sensor is attached to the elevator and print it out. You can also write it to a file if you want, you have all of Java IO at your disposal this year.

2) Some of the benefits of logging are knowing what happened if things go wrong. For example, the roboRIO will let you know if it enters brown-out mode, and it is currently logging the current draw on each of the individual ports on the PDP to the DS log file. The log viewer doesn't display this currently, but the hope is to have it display for competition season. This will let you know if a motor suddenly starts drawing way more current than it should be, so there could be an issue with the motor or the mechanical system it's attached to. You might also log conditions internally. You might have some a complicated command or command group that does a whole bunch of things, logging would tell you where in the command you are, and if you experience issues with the command, you know where things started to go wrong.

3) Depends on how much you log. Generally, if you're just logging via println, you're going to overload the human trying to read the log output far faster than you will overload the processor. Too much data can be a bad thing when you're trying to understand what happened. Even if you're writing logs to a file with some advanced logging framework, you'll probably overwhelm yourself much faster than you overwhelm the roboRIO.

4) I hope that my other answers clarified this one for you.
Reply With Quote
  #3   Spotlight this post!  
Unread 09-01-2015, 15:28
Asymons Asymons is offline
Registered User
FRC #4716 (Purple Raiders)
Team Role: Driver
 
Join Date: Apr 2013
Rookie Year: 2013
Location: Ontario
Posts: 33
Asymons is an unknown quantity at this point
Re: Logging Data in Java

I was referring to logging when something bad happens (brown-out, motor is not functioning properly). You're answer was extremely helpful and detailed, so I thank you for that !

I'm going to see if I can instead create a new text file that logs data in a sense of errors and issues so it can be quickly looked upon after a match, and I will leave all the sensor data in the Smart Dashboard. I will also include println in the initialize of all the commands just to make sure they're properly configured. Again, thank you for the answers to my questions, they were helpful!
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 11:08.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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