From f2c861be5461e103fe6bde56ba06e69f4c1c8bea Mon Sep 17 00:00:00 2001 From: Logan H-D Date: Sat, 7 Mar 2020 20:45:44 -0600 Subject: [PATCH 1/5] Moved climb subsystem stuff for drive team --- src/main/cpp/subsystems/Climb.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/cpp/subsystems/Climb.cpp b/src/main/cpp/subsystems/Climb.cpp index 55e4d1d..890a8ba 100644 --- a/src/main/cpp/subsystems/Climb.cpp +++ b/src/main/cpp/subsystems/Climb.cpp @@ -2,6 +2,7 @@ #include #include +#include #include @@ -11,7 +12,9 @@ Climb::Climb () {} void Climb::Periodic () { - frc::SmartDashboard::PutBoolean("Winch Locked", m_IsWinchLocked); + auto drivetable = nt::NetworkTableInstance::GetDefault().GetTable("Driving"); + drivetable->PutBoolean("Winch Locked", m_IsWinchLocked); + drivetable->PutBoolean("Climb Piston Extended", m_IsPistonExtended); } void Climb::PistonExtend () { From 3a2f8fe103f22d20b865b83e4291e615222ce653 Mon Sep 17 00:00:00 2001 From: Logan H-D Date: Sat, 7 Mar 2020 21:07:59 -0600 Subject: [PATCH 2/5] More moving, but with the auto stuff --- src/main/cpp/RobotContainer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/cpp/RobotContainer.cpp b/src/main/cpp/RobotContainer.cpp index d9a4b9c..a56d724 100644 --- a/src/main/cpp/RobotContainer.cpp +++ b/src/main/cpp/RobotContainer.cpp @@ -17,6 +17,8 @@ #include #include +#include + #include "commands/AimCommand.h" #include "commands/AimShootCommand.h" #include "commands/SimpleDriveCommand.h" @@ -68,6 +70,7 @@ RobotContainer::RobotContainer () { frc2::CommandScheduler::GetInstance().RegisterSubsystem(m_PowerCellCounter); InitAutonomousChooser(); + // Remember to put this in the driver table later? frc::SmartDashboard::PutData("Auto Modes", &m_DashboardAutoChooser); // Configure the button bindings @@ -343,5 +346,6 @@ void RobotContainer::ReportSelectedAuto () { name = m_DashboardAutoChooser.GetDefaultName(); } - frc::SmartDashboard::PutString("Robot sees autonomous", name); + auto drivetable = nt::NetworkTableInstance::GetDefault().GetTable("Driving"); + drivetable->PutString("Robot Sees AutoMode:", name); } From a76c1c46d382fa38b664265c57d23ef9f2eb5f3b Mon Sep 17 00:00:00 2001 From: Logan H-D Date: Sat, 7 Mar 2020 21:15:18 -0600 Subject: [PATCH 3/5] Push all the needed variables from the shooter --- src/main/cpp/subsystems/Shooter.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/cpp/subsystems/Shooter.cpp b/src/main/cpp/subsystems/Shooter.cpp index 1c59966..ce2ec39 100644 --- a/src/main/cpp/subsystems/Shooter.cpp +++ b/src/main/cpp/subsystems/Shooter.cpp @@ -169,6 +169,8 @@ void Shooter::SetLimelightLight (bool on) { } void Shooter::TrackingPeriodic (TrackingMode mode) { + auto drivetable = nt::NetworkTableInstance::GetDefault().GetTable("Driving"); + if (mode == TrackingMode::CameraTracking) { double speed = 0; @@ -176,7 +178,7 @@ void Shooter::TrackingPeriodic (TrackingMode mode) { if (m_TargetCount > 0) { std::cout << "Count: " << m_TargetCount << std::endl; - frc::SmartDashboard::PutBoolean("Limelight Has Target", true); + drivetable->PutBoolean("Limelight Has Target", true); m_TargetErrorX = -m_VisionTable->GetNumber("tx", 0); m_TargetErrorY = -m_VisionTable->GetNumber("ty", 0); @@ -189,15 +191,15 @@ void Shooter::TrackingPeriodic (TrackingMode mode) { speed = m_TurretPID->Calculate(m_TargetErrorX); } else if (m_TargetCount == 0) { std::cout << "No objects detected" << std::endl; - frc::SmartDashboard::PutBoolean("Limelight Has Target", false); + drivetable->PutBoolean("Limelight Has Target", false); } else { std::cout << "Variable tv does not exist in table limelight-gears" << std::endl; - frc::SmartDashboard::PutBoolean("Limelight Has Target", false); + drivetable->PutBoolean("Limelight Has Target", false); } SetTurretSpeed(speed); } else { - frc::SmartDashboard::PutBoolean("Limelight Has Target", false); + drivetable->PutBoolean("Limelight Has Target", false); SetLimelightLight(false); return; } From 9d9285145470f5d91d384293bb3e2b80a4960d51 Mon Sep 17 00:00:00 2001 From: Logan H-D Date: Sat, 7 Mar 2020 21:19:13 -0600 Subject: [PATCH 4/5] Rationale commit Currently we use Shuffleboard for our dashboard on the driver station. The Driving network table contains all the data that we can push (which does not include from the SendableChooser and the Limelight camera feed) that the drive team needs to run a match. This table should be reserved for this purpose alone, as currently we simply push any data we may need during testing with SmartDashboard. As I understand, Shuffleboard allows us to use data from other tables on the same page as the ones specifically for it, and we can set up a nice view that will remain persistent between reboots of the robot and not be cluttered with data the drive team does not need. From bef6284728f474f075382bb5550ebc879f6aa630 Mon Sep 17 00:00:00 2001 From: Logan H-D Date: Sat, 7 Mar 2020 21:32:39 -0600 Subject: [PATCH 5/5] Move table name to constants --- src/main/cpp/RobotContainer.cpp | 2 +- src/main/cpp/subsystems/Climb.cpp | 2 +- src/main/cpp/subsystems/Shooter.cpp | 2 +- src/main/include/Constants.h | 4 ++++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/cpp/RobotContainer.cpp b/src/main/cpp/RobotContainer.cpp index a56d724..f3c987e 100644 --- a/src/main/cpp/RobotContainer.cpp +++ b/src/main/cpp/RobotContainer.cpp @@ -346,6 +346,6 @@ void RobotContainer::ReportSelectedAuto () { name = m_DashboardAutoChooser.GetDefaultName(); } - auto drivetable = nt::NetworkTableInstance::GetDefault().GetTable("Driving"); + auto drivetable = nt::NetworkTableInstance::GetDefault().GetTable(NetTabs::DriveTeamTable); drivetable->PutString("Robot Sees AutoMode:", name); } diff --git a/src/main/cpp/subsystems/Climb.cpp b/src/main/cpp/subsystems/Climb.cpp index 890a8ba..a05cf5e 100644 --- a/src/main/cpp/subsystems/Climb.cpp +++ b/src/main/cpp/subsystems/Climb.cpp @@ -12,7 +12,7 @@ Climb::Climb () {} void Climb::Periodic () { - auto drivetable = nt::NetworkTableInstance::GetDefault().GetTable("Driving"); + auto drivetable = nt::NetworkTableInstance::GetDefault().GetTable(NetTabs::DriveTeamTable); drivetable->PutBoolean("Winch Locked", m_IsWinchLocked); drivetable->PutBoolean("Climb Piston Extended", m_IsPistonExtended); } diff --git a/src/main/cpp/subsystems/Shooter.cpp b/src/main/cpp/subsystems/Shooter.cpp index ce2ec39..9e06fdb 100644 --- a/src/main/cpp/subsystems/Shooter.cpp +++ b/src/main/cpp/subsystems/Shooter.cpp @@ -169,7 +169,7 @@ void Shooter::SetLimelightLight (bool on) { } void Shooter::TrackingPeriodic (TrackingMode mode) { - auto drivetable = nt::NetworkTableInstance::GetDefault().GetTable("Driving"); + auto drivetable = nt::NetworkTableInstance::GetDefault().GetTable(NetTabs::DriveTeamTable); if (mode == TrackingMode::CameraTracking) { double speed = 0; diff --git a/src/main/include/Constants.h b/src/main/include/Constants.h index 9052628..9def665 100644 --- a/src/main/include/Constants.h +++ b/src/main/include/Constants.h @@ -1,5 +1,9 @@ #pragma once +namespace NetTabs { + const std::string DriveTeamTable = "Driving"; +} + namespace ConfigFiles { const std::string ConfigFile = "config.toml"; const std::string AutoConfigFile = "auto.toml";