Skip to content

Commit 53eb8b8

Browse files
committed
Runs apriltag pose fusion while robot is disabled, but not during auton/teleop by default
Use the FusePose Command to update the pose estimate from vision when its actually wanted. If it only works well while the robot is still, can just run it during scoring, for instance. This should give flexibility Signed-off-by: Eric Ward <ezeward4@gmail.com>
1 parent 6e9fd39 commit 53eb8b8

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/main/cpp/Robot.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <frc/smartdashboard/SmartDashboard.h>
1111
#include <frc2/command/CommandScheduler.h>
1212

13-
void Robot::RobotInit() {}
13+
void Robot::RobotInit() { m_disabledCommand = m_container.FusePose(); }
1414

1515
void Robot::DriverStationConnected() {}
1616

@@ -85,7 +85,15 @@ void Robot::RobotPeriodic() {
8585
* can use it to reset any subsystem information you want to clear when the
8686
* robot is disabled.
8787
*/
88-
void Robot::DisabledInit() {}
88+
void Robot::DisabledInit() {
89+
if (m_disabledCommand)
90+
m_disabledCommand->Schedule();
91+
}
92+
93+
void Robot::DisabledExit() {
94+
if (m_disabledCommand)
95+
m_disabledCommand->Cancel();
96+
}
8997

9098
void Robot::DisabledPeriodic() {}
9199

src/main/include/Robot.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class Robot : public frc::TimedRobot {
1717
void DriverStationConnected() override;
1818
void RobotPeriodic() override;
1919
void DisabledInit() override;
20+
void DisabledExit() override;
2021
void DisabledPeriodic() override;
2122
void AutonomousInit() override;
2223
void AutonomousPeriodic() override;

0 commit comments

Comments
 (0)