Add Shuffleboard calls to IterativeRobotBase in C++ (#1607)

Additionally, add epochs for Shuffleboard, LiveWindow, and
Smartdashboard updates.
This commit is contained in:
sciencewhiz
2019-04-27 22:23:21 -07:00
committed by Peter Johnson
parent f42905b32e
commit 1c454b000f
2 changed files with 16 additions and 4 deletions

View File

@@ -17,6 +17,7 @@
#include "frc/Timer.h"
#include "frc/commands/Scheduler.h"
#include "frc/livewindow/LiveWindow.h"
#include "frc/shuffleboard/Shuffleboard.h"
#include "frc/smartdashboard/SmartDashboard.h"
using namespace frc;
@@ -94,6 +95,7 @@ void IterativeRobotBase::LoopFunc() {
// either a different mode or from power-on.
if (m_lastMode != Mode::kDisabled) {
LiveWindow::GetInstance()->SetEnabled(false);
Shuffleboard::DisableActuatorWidgets();
DisabledInit();
m_watchdog.AddEpoch("DisabledInit()");
m_lastMode = Mode::kDisabled;
@@ -107,6 +109,7 @@ void IterativeRobotBase::LoopFunc() {
// either a different mode or from power-on.
if (m_lastMode != Mode::kAutonomous) {
LiveWindow::GetInstance()->SetEnabled(false);
Shuffleboard::DisableActuatorWidgets();
AutonomousInit();
m_watchdog.AddEpoch("AutonomousInit()");
m_lastMode = Mode::kAutonomous;
@@ -120,6 +123,7 @@ void IterativeRobotBase::LoopFunc() {
// either a different mode or from power-on.
if (m_lastMode != Mode::kTeleop) {
LiveWindow::GetInstance()->SetEnabled(false);
Shuffleboard::DisableActuatorWidgets();
TeleopInit();
m_watchdog.AddEpoch("TeleopInit()");
m_lastMode = Mode::kTeleop;
@@ -134,6 +138,7 @@ void IterativeRobotBase::LoopFunc() {
// either a different mode or from power-on.
if (m_lastMode != Mode::kTest) {
LiveWindow::GetInstance()->SetEnabled(true);
Shuffleboard::EnableActuatorWidgets();
TestInit();
m_watchdog.AddEpoch("TestInit()");
m_lastMode = Mode::kTest;
@@ -146,10 +151,14 @@ void IterativeRobotBase::LoopFunc() {
RobotPeriodic();
m_watchdog.AddEpoch("RobotPeriodic()");
m_watchdog.Disable();
SmartDashboard::UpdateValues();
SmartDashboard::UpdateValues();
m_watchdog.AddEpoch("SmartDashboard::UpdateValues()");
LiveWindow::GetInstance()->UpdateValues();
m_watchdog.AddEpoch("LiveWindow::UpdateValues()");
Shuffleboard::Update();
m_watchdog.AddEpoch("Shuffleboard::Update()");
m_watchdog.Disable();
// Warn on loop time overruns
if (m_watchdog.IsExpired()) {

View File

@@ -257,11 +257,14 @@ public abstract class IterativeRobotBase extends RobotBase {
robotPeriodic();
m_watchdog.addEpoch("robotPeriodic()");
m_watchdog.disable();
SmartDashboard.updateValues();
SmartDashboard.updateValues();
m_watchdog.addEpoch("SmartDashboard.updateValues()");
LiveWindow.updateValues();
m_watchdog.addEpoch("LiveWindow.updateValues()");
Shuffleboard.update();
m_watchdog.addEpoch("Shuffleboard.update()");
m_watchdog.disable();
// Warn on loop time overruns
if (m_watchdog.isExpired()) {