ThunderLib
Loading...
Searching...
No Matches
ThunderAutoModeCommand.hpp
1#pragma once
2
3#include <ThunderLib/Auto/ThunderAutoMode.hpp>
4#include <ThunderLib/Auto/ThunderAutoProject.hpp>
5#include <ThunderLib/Trajectory/TrajectoryRunnerProperties.hpp>
6#include <frc2/command/Command.h>
7#include <frc2/command/Commands.h>
8#include <frc2/command/CommandHelper.h>
9#include <memory>
10
11namespace thunder {
12
16class ThunderAutoModeCommand : public frc2::CommandHelper<frc2::Command, ThunderAutoModeCommand> {
17 public:
26 ThunderAutoModeCommand(const std::string& autoModeName,
27 std::shared_ptr<ThunderAutoProject> project,
28 const TrajectoryRunnerProperties& properties);
29
30 bool isValid() const;
31
32 explicit operator bool() const { return isValid(); }
33
34 void Initialize() override;
35 void Execute() override;
36 void End(bool interrupted) override;
37 bool IsFinished() override;
38
39 private:
40 void nextStep();
41 void setupCurrentStep();
42
43 private:
44 const std::string m_autoModeName;
45 std::unique_ptr<ThunderAutoMode> m_autoMode;
46 std::shared_ptr<ThunderAutoProject> m_project;
47 TrajectoryRunnerProperties m_runnerProperties;
48 TrajectoryRunnerProperties m_runnerPropertiesNoResetPose;
49
50 bool m_isFinished = true;
51 std::shared_ptr<ThunderAutoModeStep> m_currentStep;
52 frc2::CommandPtr m_currentStepCommand = frc2::cmd::None();
53 bool m_currentStepWasInitialized = false;
54 bool m_firstTrajectoryWasSeen = false;
55};
56
57} // namespace thunder
Definition ThunderAutoModeCommand.hpp:16
ThunderAutoModeCommand(const std::string &autoModeName, std::shared_ptr< ThunderAutoProject > project, const TrajectoryRunnerProperties &properties)
Definition ThunderAutoModeCommand.cpp:7
Definition TrajectoryRunnerProperties.hpp:14