Computing / Computer Science

Content: 

We are now going to take a look at logging (also called tracing) as a tool to debug our robot programs. Logging is recording useful information from the robot program to a disk file on the RoboRio controller. You can then download that file to your PC and examine it. It can be very useful to record information while your robot is running during a match so you can look at it afterwards and see what took place. If you have not read the general lesson on Logging, you should do that now.

Note that the FRC control system supports using System.out.println to write information to the RioLog and to the session log on the Driver Station. However these two ways to log information have drawbacks. The RioLog does not persist and is not available during match play. The DS log also contains extensive logging from the control system and it can be hard to separate out your logged information. Niether form of logging provides automatic identification of where in your program the logged information comes from. The logging code provided here automatically marks all logged information with the date, time, name of method and location in your source file where the information was logged. Only your logged information is recorded. The information is recorded in a new disk file for each startup of the RoboRio and can be easily downloaded after sessions or matches for review. Note that the logged information is also sent to the RioLog and the DS log.

To use the Logging class below with the Sample robot program, create a new class called Logging in the same place as Robot.java. Copy and paste the code into that class.

Now you can modify the Sample program as follows to use logging instead of System.out.println():

You can view the log file on the RoboRio disk with a browser. Navigate to ftp://roborio-nnnn-frc.local/home/lvuser and select the desired log file. You can download the log file with Windows Explorer. Navigate to the url <to be inserted> and copy the desired log file to a local directory.

Note: Log files are numbered 0-99. After 99 no new log files will be created and an error will be logged to the DS console window. You must use Windows Explorer to delete old log files.

 

Overview: 
Explore the use of logging to debug robot programs.
Objectives: 

Understand logging and how to implement it in RoboRio based robot control programs.

Content: 

We are now going to take a look at logging (also called tracing) as a tool to debug our robot programs. Logging is recording useful information from the robot program to a disk file on the RoboRio controller. You can then download that file to your PC and examine it. It can be very useful to record information while your robot is running during a match so you can look at it afterwards and see what took place. If you have not read the general lesson on Logging, you should do that now.

Note that the FRC control system supports using System.out.println to write information to the RioLog and to the session log on the Driver Station. However these two ways to log information have drawbacks. The RioLog does not persist and is not available during match play. The DS log also contains extensive logging from the control system and it can be hard to separate out your logged information. Niether form of logging provides automatic identification of where in your program the logged information comes from. The logging code provided here automatically marks all logged information with the date, time, name of method and location in your source file where the information was logged. Only your logged information is recorded. The information is recorded in a new disk file for each startup of the RoboRio and can be easily downloaded after sessions or matches for review. Note that the logged information is also sent to the RioLog and the DS log.

To use the Logging class below with the Sample robot program, create a new class called Logging in the same place as Robot.java. Copy and paste the code into that class.

Now you can modify the Sample program as follows to use logging instead of System.out.println():

You can view the log file on the RoboRio disk with a browser. Navigate to ftp://roborio-nnnn-frc.local/home/lvuser and select the desired log file. You can download the log file with Windows Explorer. Navigate to the url <to be inserted> and copy the desired log file to a local directory.

Note: Log files are numbered 0-99. After 99 no new log files will be created and an error will be logged to the DS console window. You must use Windows Explorer to delete old log files.

 

Lesson navigation:

Comparison Self Assessment

This is the self-assessment for the Comparison lesson.

Variable Assignment Quiz

Test self-assessment.

Wired Article on "What is a Robot" 8/24/17

This Wired article interviews several Roboticists about their definition of "What is a Robot"..... ambiguity remains. https://www.wired.com/story/what-is-a-robot/?mbid=nl_82417_p2&CNDID

Version 2: What is Programming?

Version 2: Intro to Pneumatics

Version 2: Intro to Sensors

Pages