Obtaining data for Control Panel in Infinite Recharge

I have a question regarding the Control Panel in terms of obtaining the data as according to the game rules, we get the color for our match from inserting the following code into our robot: https://frc-docs.readthedocs.io/en/latest/docs/software/wpilib-overview/2020-Game-Data.html. According to this document I put the code they provided into my robot’s code; however, what I do not understand is where I put this code in the robot code, would it be in the Robot class under the teleopPeriodic Method?

Also, where is the data displayed during the competition as for what color we have to rotate the control panel to?

Yes, teleopPeriodic is a good place to put it (or a function called by teleopPeriodic such as a subsystem periodic function in command-based), since this information is given to you at some point in teleoperated mode.

The information is not displayed. You have to get it using the above code. If you want it displayed to the drivers, you’ll need to display it to them (one good way to do this is to use NetworkTables and show it via a dashboard application).


Ok, I implemented it in the code; however, did I display the data correctly? I am new to using the dashboard applications for FRC, so cana you check if I did this correctly on this github repo? https://github.com/FRC-4509-MechBulls/2020-Season/blob/master/src/main/java/frc/robot/Robot.java#L147

Thank you!

If you are using SmartDashboard, you want to make sure the key is the same for all of them. Like this:

SmartDashboard.putString("my key", "my value");

“my key” will not change. “my value” will change because it’s the variable you are reporting. So this:

SmartDashboard.putString("color", "blue");
// or 
SmartDashboard.putString("color", "red");
1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.