3#include <frc2/command/CommandHelper.h> 
    4#include <frc2/command/button/Trigger.h> 
    5#include <frc/geometry/Pose2d.h> 
   10#include <frc/event/EventLoop.h> 
   13#include "pathplanner/lib/path/PathPlannerPath.h" 
   14#include "pathplanner/lib/events/EventTrigger.h" 
   15#include "pathplanner/lib/events/PointTowardsZoneTrigger.h" 
   16#include "pathplanner/lib/auto/AutoBuilder.h" 
   18namespace pathplanner {
 
   22class PathPlannerAuto: 
public frc2::CommandHelper<frc2::Command, PathPlannerAuto> {
 
   24    static std::string currentPathName;
 
   49    PathPlannerAuto(frc2::CommandPtr &&autoCommand, frc::Pose2d startingPose =
 
   59            std::string autoName);
 
   68        return m_startingPose;
 
   79        return frc2::Trigger(m_autoLoop.get(), 
condition);
 
  101            return m_timer.HasElapsed(time);
 
  112    inline frc2::Trigger 
timeRange(units::second_t startTime,
 
  113            units::second_t endTime) {
 
  114        return condition([
this, startTime, endTime]() {
 
  115            return m_timer.Get() >= startTime && m_timer.Get() <= endTime;
 
  149            return pathName == PathPlannerAuto::currentPathName;
 
  163            units::meter_t tolerance) {
 
  165                [fieldPosition, tolerance]() {
 
  167                            fieldPosition) <= tolerance;
 
  181            frc::Translation2d blueFieldPosition, units::meter_t tolerance);
 
  193    frc2::Trigger 
inFieldArea(frc::Translation2d boundingBoxMin,
 
  194            frc::Translation2d boundingBoxMax);
 
  209            frc::Translation2d blueBoundingBoxMax);
 
  211    void Initialize() 
override;
 
  213    void Execute() 
override;
 
  215    bool IsFinished() 
override;
 
  217    void End(
bool interrupted) 
override;
 
  220    std::unique_ptr<frc2::Command> m_autoCommand;
 
  221    frc::Pose2d m_startingPose;
 
  224    std::unique_ptr<frc::EventLoop> m_autoLoop;
 
  228    static std::vector<std::shared_ptr<PathPlannerPath>> pathsFromCommandJson(
 
  229            const wpi::json &json, 
bool choreoPaths);
 
  231    void initFromJson(
const wpi::json &json, 
bool mirror);
 
  233    static int m_instances;
 
static frc::Pose2d getCurrentPose()
Definition: AutoBuilder.h:126
 
Definition: EventTrigger.h:9
 
Definition: PathPlannerAuto.h:22
 
EventTrigger event(std::string eventName)
Definition: PathPlannerAuto.h:126
 
frc2::Trigger condition(std::function< bool()> condition)
Definition: PathPlannerAuto.h:78
 
static std::vector< std::shared_ptr< PathPlannerPath > > getPathGroupFromAutoFile(std::string autoName)
Definition: PathPlannerAuto.cpp:138
 
frc2::Trigger nearFieldPosition(frc::Translation2d fieldPosition, units::meter_t tolerance)
Definition: PathPlannerAuto.h:162
 
frc2::Trigger activePath(std::string pathName)
Definition: PathPlannerAuto.h:147
 
frc2::Trigger timeRange(units::second_t startTime, units::second_t endTime)
Definition: PathPlannerAuto.h:112
 
constexpr frc::Pose2d getStartingPose() const
Definition: PathPlannerAuto.h:67
 
frc2::Trigger isRunning()
Definition: PathPlannerAuto.h:87
 
frc2::Trigger inFieldAreaAutoFlipped(frc::Translation2d blueBoundingBoxMin, frc::Translation2d blueBoundingBoxMax)
Definition: PathPlannerAuto.cpp:106
 
PointTowardsZoneTrigger pointTowardsZone(std::string zoneName)
Definition: PathPlannerAuto.h:137
 
frc2::Trigger nearFieldPositionAutoFlipped(frc::Translation2d blueFieldPosition, units::meter_t tolerance)
Definition: PathPlannerAuto.cpp:71
 
frc2::Trigger timeElapsed(units::second_t time)
Definition: PathPlannerAuto.h:99
 
frc2::Trigger inFieldArea(frc::Translation2d boundingBoxMin, frc::Translation2d boundingBoxMax)
Definition: PathPlannerAuto.cpp:88
 
Definition: PointTowardsZoneTrigger.h:9