mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[commands] Add GetName to Subsystem, use in Scheduler tracer epochs (#5836)
This commit is contained in:
@@ -183,7 +183,7 @@ void CommandScheduler::Run() {
|
||||
if constexpr (frc::RobotBase::IsSimulation()) {
|
||||
subsystem.getFirst()->SimulationPeriodic();
|
||||
}
|
||||
m_watchdog.AddEpoch("Subsystem Periodic()");
|
||||
m_watchdog.AddEpoch(subsystem.getFirst()->GetName() + ".Periodic()");
|
||||
}
|
||||
|
||||
// Cache the active instance to avoid concurrency problems if SetActiveLoop()
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "frc2/command/Subsystem.h"
|
||||
|
||||
#include <wpi/Demangle.h>
|
||||
|
||||
#include "frc2/command/CommandPtr.h"
|
||||
#include "frc2/command/Commands.h"
|
||||
|
||||
@@ -16,6 +18,10 @@ void Subsystem::Periodic() {}
|
||||
|
||||
void Subsystem::SimulationPeriodic() {}
|
||||
|
||||
std::string Subsystem::GetName() const {
|
||||
return wpi::GetTypeName(*this);
|
||||
}
|
||||
|
||||
void Subsystem::SetDefaultCommand(CommandPtr&& defaultCommand) {
|
||||
CommandScheduler::GetInstance().SetDefaultCommand(this,
|
||||
std::move(defaultCommand));
|
||||
|
||||
Reference in New Issue
Block a user