SubZero Common
Common library components for an FRC CommandRobot
Loading...
Searching...
No Matches
AutoFactory.h
Go to the documentation of this file.
1#pragma once
2
3#include <frc/DriverStation.h>
4#include <frc/Filesystem.h>
5#include <frc2/command/CommandPtr.h>
6#include <frc2/command/WaitCommand.h>
7#include <pathplanner/lib/commands/FollowPathHolonomic.h>
8#include <wpi/MemoryBuffer.h>
9
10#include <filesystem>
11#include <functional>
12#include <map>
13#include <memory>
14#include <string>
15#include <vector>
16
19
20namespace subzero {
21
29template <typename T> class AutoFactory {
30public:
31 explicit AutoFactory(const std::map<T, std::string> &autos)
32 : m_autos{autos} {}
33
34private:
35 const std::map<T, std::string> &m_autos;
36
37 bool AutoFileExists(const std::string fileName);
38
39 frc2::CommandPtr PathPlannerPathFromName(const std::string autoName);
40
41public:
48 frc2::CommandPtr GetAuto(T type);
49};
50} // namespace subzero
Safely get an auto command from PPLib without the risk of crashing from a missing auto file.
Definition AutoFactory.h:29
frc2::CommandPtr GetAuto(T type)
Get the auto command specified by the key.
AutoFactory(const std::map< T, std::string > &autos)
Definition AutoFactory.h:31