4#include <frc2/command/CommandPtr.h>
5#include <frc2/command/Commands.h>
6#include <frc/geometry/Pose2d.h>
7#include <frc/kinematics/ChassisSpeeds.h>
8#include <frc/controller/RamseteController.h>
11#include <frc2/command/Command.h>
12#include <frc/smartdashboard/SendableChooser.h>
17#include "pathplanner/lib/path/PathPlannerPath.h"
18#include "pathplanner/lib/config/RobotConfig.h"
19#include "pathplanner/lib/controllers/PathFollowingController.h"
20#include "pathplanner/lib/util/DriveFeedforwards.h"
21#include "pathplanner/lib/util/FlippingUtil.h"
23namespace pathplanner {
46 static void configure(std::function<frc::Pose2d()> poseSupplier,
47 std::function<
void(
const frc::Pose2d&)> resetPose,
48 std::function<frc::ChassisSpeeds()> robotRelativeSpeedsSupplier,
51 std::shared_ptr<PathFollowingController> controller,
52 RobotConfig robotConfig, std::function<
bool()> shouldFlipPath,
53 frc2::Subsystem *driveSubsystem);
68 static inline void configure(std::function<frc::Pose2d()> poseSupplier,
69 std::function<
void(
const frc::Pose2d&)> resetPose,
70 std::function<frc::ChassisSpeeds()> robotRelativeSpeedsSupplier,
71 std::function<
void(
const frc::ChassisSpeeds&)> output,
72 std::shared_ptr<PathFollowingController> controller,
73 RobotConfig robotConfig, std::function<
bool()> shouldFlipPath,
74 frc2::Subsystem *driveSubsystem) {
75 configure(poseSupplier, resetPose, robotRelativeSpeedsSupplier,
76 [output](
auto &&speeds,
auto &&feedforwards) {
78 }, std::move(controller), std::move(robotConfig),
79 shouldFlipPath, driveSubsystem);
97 std::function<frc2::CommandPtr(std::shared_ptr<PathPlannerPath>)> pathFollowingCommandBuilder,
98 std::function<
void(
const frc::Pose2d&)> resetPose,
bool isHolonomic,
99 std::function<
bool()> shouldFlipPose = []() {
118 return m_isHolonomic;
127 return m_poseSupplier();
136 return m_shouldFlipPath();
145 static frc2::CommandPtr
followPath(std::shared_ptr<PathPlannerPath> path);
153 static inline frc2::CommandPtr
buildAuto(std::string autoName);
161 static frc2::CommandPtr
resetOdom(frc::Pose2d bluePose);
190 return frc2::cmd::Either(
205 std::shared_ptr<PathPlannerPath> goalPath,
227 std::string defaultAutoName =
"");
244 std::string defaultAutoName =
"");
261 std::function<
bool(
const PathPlannerAuto&, std::filesystem::path)> filter,
262 std::string defaultAutoName =
"");
279 static bool m_configured;
280 static std::function<frc2::CommandPtr(std::shared_ptr<PathPlannerPath>)> m_pathFollowingCommandBuilder;
281 static std::function<frc::Pose2d()> m_poseSupplier;
282 static std::function<void(
const frc::Pose2d&)> m_resetPose;
283 static std::function<bool()> m_shouldFlipPath;
284 static bool m_isHolonomic;
286 static bool m_commandRefsGeneratedForSendable;
287 static frc2::CommandPtr m_noneCommand;
288 static std::map<std::filesystem::path, frc2::CommandPtr> m_autoCommands;
290 static bool m_pathfindingConfigured;
291 static std::function<
293 units::meters_per_second_t)> m_pathfindToPoseCommandBuilder;
294 static std::function<
295 frc2::CommandPtr(std::shared_ptr<PathPlannerPath>,
PathConstraints)> m_pathfindThenFollowPathCommandBuilder;
Definition: AutoBuilder.h:27
static frc::SendableChooser< frc2::Command * > buildAutoChooserFilterPath(std::function< bool(const PathPlannerAuto &, std::filesystem::path)> filter, std::string defaultAutoName="")
Definition: AutoBuilder.cpp:179
static frc::SendableChooser< frc2::Command * > buildAutoChooserFilter(std::function< bool(const PathPlannerAuto &)> filter, std::string defaultAutoName="")
Definition: AutoBuilder.cpp:169
static frc::SendableChooser< frc2::Command * > buildAutoChooser(std::string defaultAutoName="")
Definition: AutoBuilder.cpp:160
static frc2::CommandPtr followPath(std::shared_ptr< PathPlannerPath > path)
Definition: AutoBuilder.cpp:99
static frc2::CommandPtr pathfindThenFollowPath(std::shared_ptr< PathPlannerPath > goalPath, PathConstraints pathfindingConstraints)
Definition: AutoBuilder.cpp:138
static frc2::CommandPtr pathfindToPoseFlipped(frc::Pose2d pose, PathConstraints constraints, units::meters_per_second_t goalEndVel=0_mps)
Definition: AutoBuilder.h:187
static std::vector< std::string > getAllAutoNames()
Definition: AutoBuilder.cpp:220
static void regenerateSendableReferences()
Definition: AutoBuilder.cpp:150
static bool isHolonomic()
Definition: AutoBuilder.h:117
static std::vector< std::filesystem::path > getAllAutoPaths()
Definition: AutoBuilder.cpp:230
static frc2::CommandPtr pathfindToPose(frc::Pose2d pose, PathConstraints constraints, units::meters_per_second_t goalEndVel=0_mps)
Definition: AutoBuilder.cpp:128
static frc2::CommandPtr buildAuto(std::string autoName)
Definition: AutoBuilder.cpp:109
static bool isConfigured()
Definition: AutoBuilder.h:108
static bool shouldFlip()
Definition: AutoBuilder.h:135
static void configure(std::function< frc::Pose2d()> poseSupplier, std::function< void(const frc::Pose2d &)> resetPose, std::function< frc::ChassisSpeeds()> robotRelativeSpeedsSupplier, std::function< void(const frc::ChassisSpeeds &)> output, std::shared_ptr< PathFollowingController > controller, RobotConfig robotConfig, std::function< bool()> shouldFlipPath, frc2::Subsystem *driveSubsystem)
Definition: AutoBuilder.h:68
static frc::Pose2d getCurrentPose()
Definition: AutoBuilder.h:126
static frc2::CommandPtr resetOdom(frc::Pose2d bluePose)
Definition: AutoBuilder.cpp:113
static void configure(std::function< frc::Pose2d()> poseSupplier, std::function< void(const frc::Pose2d &)> resetPose, std::function< frc::ChassisSpeeds()> robotRelativeSpeedsSupplier, std::function< void(const frc::ChassisSpeeds &, const DriveFeedforwards &)> output, std::shared_ptr< PathFollowingController > controller, RobotConfig robotConfig, std::function< bool()> shouldFlipPath, frc2::Subsystem *driveSubsystem)
Definition: AutoBuilder.cpp:34
static void configureCustom(std::function< frc::Pose2d()> poseSupplier, std::function< frc2::CommandPtr(std::shared_ptr< PathPlannerPath >)> pathFollowingCommandBuilder, std::function< void(const frc::Pose2d &)> resetPose, bool isHolonomic, std::function< bool()> shouldFlipPose=[]() { return false;})
Definition: AutoBuilder.cpp:80
static frc::Pose2d flipFieldPose(const frc::Pose2d &pose)
Definition: FlippingUtil.h:61
Definition: PathConstraints.h:12
Definition: PathPlannerAuto.h:22
Definition: RobotConfig.h:17
Definition: DriveFeedforwards.h:12