2023-Robot
Robot code for 2023 FRC season by Argos, FRC team #1756
Loading...
Searching...
No Matches
drive_to_position_spline.h
Go to the documentation of this file.
1
4
5#pragma once
6
7#include <frc/geometry/Pose2d.h>
8#include <frc/spline/Spline.h>
9#include <frc2/command/CommandBase.h>
10#include <frc2/command/CommandHelper.h>
11#include <units/angle.h>
12#include <units/velocity.h>
13
14#include <memory>
15#include <vector>
16
19
20class DriveToPositionSpline : public frc2::CommandHelper<frc2::CommandBase, DriveToPositionSpline> {
21 public:
23 const frc::Spline<3>::ControlVector initialPosition,
24 const units::degree_t initialAngle,
25 const std::vector<frc::Translation2d>& waypoints,
26 const frc::Spline<3>::ControlVector finalPosition,
27 const units::degree_t finalAngle,
28 const units::second_t turnDelay,
29 const frc::TrapezoidProfile<units::inches>::Constraints linearConstraints,
30 const frc::TrapezoidProfile<units::degrees>::Constraints rotationalConstraints,
31 const units::feet_per_second_t initialVelocity = 0_fps,
32 const units::feet_per_second_t finalVelocity = 0_fps);
33
34 void Initialize() override;
35
36 void Execute() override;
37
38 void End(bool interrupted) override;
39
40 bool IsFinished() override;
41
42 private:
45 const units::degree_t m_initialAngle;
46 const units::degree_t m_finalAngle;
47 const frc::TrapezoidProfile<units::inches>::Constraints m_linearConstraints;
48 const frc::TrapezoidProfile<units::degrees>::Constraints m_rotationalConstraints;
49 const units::feet_per_second_t m_initialVelocity;
50 const units::feet_per_second_t m_finalVelocity;
51};
52
53frc::Spline<3>::ControlVector ConvertToControlVector(units::foot_t x,
54 units::foot_t y,
55 units::foot_t tangentX,
56 units::foot_t tangentY);
Definition drive_to_position_spline.h:20
const frc::TrapezoidProfile< units::degrees >::Constraints m_rotationalConstraints
Definition drive_to_position_spline.h:48
SwerveDriveSubsystem * m_pDrive
Definition drive_to_position_spline.h:43
bool IsFinished() override
Definition drive_to_position_spline.cpp:72
const frc::TrapezoidProfile< units::inches >::Constraints m_linearConstraints
Definition drive_to_position_spline.h:47
void Execute() override
Definition drive_to_position_spline.cpp:60
void End(bool interrupted) override
Definition drive_to_position_spline.cpp:65
const units::feet_per_second_t m_finalVelocity
Definition drive_to_position_spline.h:50
SwerveTrapezoidalSpline m_splinePath
Definition drive_to_position_spline.h:44
const units::feet_per_second_t m_initialVelocity
Definition drive_to_position_spline.h:49
const units::degree_t m_initialAngle
Definition drive_to_position_spline.h:45
void Initialize() override
Definition drive_to_position_spline.cpp:54
const units::degree_t m_finalAngle
Definition drive_to_position_spline.h:46
Subsystem for controlling the swerve drivetrain of the robot.
Definition swerve_drive_subsystem.h:56
Definition swerve_trapezoidal_spline.h:19
frc::Spline< 3 >::ControlVector ConvertToControlVector(units::foot_t x, units::foot_t y, units::foot_t tangentX, units::foot_t tangentY)
Definition drive_to_position_spline.cpp:76