PathPlannerLib
Loading...
Searching...
No Matches
FollowPathCommand.h
1#pragma once
2
3#include <frc2/command/Command.h>
4#include <frc2/command/CommandHelper.h>
5#include <frc2/command/Requirements.h>
6#include <memory>
7#include <functional>
8#include <deque>
9#include <frc/geometry/Pose2d.h>
10#include <frc/kinematics/ChassisSpeeds.h>
11#include <frc/Timer.h>
12#include <units/velocity.h>
13#include <units/length.h>
14#include <units/time.h>
15#include "pathplanner/lib/path/PathPlannerPath.h"
16#include "pathplanner/lib/trajectory/PathPlannerTrajectory.h"
17#include "pathplanner/lib/controllers/PathFollowingController.h"
18#include "pathplanner/lib/config/RobotConfig.h"
19#include "pathplanner/lib/util/PathPlannerLogging.h"
20#include "pathplanner/lib/util/PPLibTelemetry.h"
21#include "pathplanner/lib/events/EventScheduler.h"
22#include "pathplanner/lib/util/DriveFeedforwards.h"
23
24namespace pathplanner {
25class FollowPathCommand: public frc2::CommandHelper<frc2::Command,
26 FollowPathCommand> {
27public:
45 FollowPathCommand(std::shared_ptr<PathPlannerPath> path,
46 std::function<frc::Pose2d()> poseSupplier,
47 std::function<frc::ChassisSpeeds()> speedsSupplier,
48 std::function<
49 void(const frc::ChassisSpeeds&, const DriveFeedforwards&)> output,
50 std::shared_ptr<PathFollowingController> controller,
51 RobotConfig robotConfig, std::function<bool()> shouldFlipPath,
52 frc2::Requirements requirements);
53
54 void Initialize() override;
55
56 void Execute() override;
57
58 bool IsFinished() override;
59
60 void End(bool interrupted) override;
61
62private:
63 frc::Timer m_timer;
64 std::shared_ptr<PathPlannerPath> m_originalPath;
65 std::function<frc::Pose2d()> m_poseSupplier;
66 std::function<frc::ChassisSpeeds()> m_speedsSupplier;
67 std::function<void(const frc::ChassisSpeeds&, const DriveFeedforwards&)> m_output;
68 std::shared_ptr<PathFollowingController> m_controller;
69 RobotConfig m_robotConfig;
70 std::function<bool()> m_shouldFlipPath;
71
72 EventScheduler m_eventScheduler;
73
74 std::shared_ptr<PathPlannerPath> m_path;
75 PathPlannerTrajectory m_trajectory;
76};
77}
Definition: EventScheduler.h:15
Definition: FollowPathCommand.h:26
Definition: PathPlannerTrajectory.h:29
Definition: RobotConfig.h:17
Definition: DriveFeedforwards.h:12