2023-Robot
Robot code for 2023 FRC season by Argos, FRC team #1756
Loading...
Searching...
No Matches
swerve_trapezoidal_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 <frc/trajectory/Trajectory.h>
10#include <frc/trajectory/TrapezoidProfile.h>
11#include <units/angle.h>
12#include <units/angular_velocity.h>
13#include <units/length.h>
14#include <units/time.h>
15#include <units/velocity.h>
16
17#include <vector>
18
20 public:
22 SwerveTrapezoidalSpline(const frc::Spline<3>::ControlVector initialPosition,
23 const units::degree_t initialAngle,
24 const std::vector<frc::Translation2d>& waypoints,
25 const frc::Spline<3>::ControlVector finalPosition,
26 const units::degree_t finalAngle,
27 const units::second_t turnDelay,
28 const frc::TrapezoidProfile<units::inches>::Constraints linearConstraints,
29 const units::feet_per_second_t initialVelocity = 0_fps,
30 const units::feet_per_second_t finalVelocity = 0_fps);
33
36
37 frc::Trajectory::State Calculate(units::second_t time) const;
38 units::degree_t HeadingSetpoint(units::second_t time) const;
39 bool IsFinished(units::second_t time) const;
40 units::degree_t GetEndAngle() const;
41 units::degree_t GetOdometryOffset() const;
42
43 units::second_t GetDriveTime() const;
44 void SetTurnDelay(units::second_t delay);
45
46 units::feet_per_second_t GetXVelocity(const frc::Trajectory::State& state) const;
47 units::feet_per_second_t GetYVelocity(const frc::Trajectory::State& state) const;
48
49 private:
50 frc::Trajectory m_pathTrajectory;
51 units::degree_t m_initialAngle;
52 units::degree_t m_finalAngle;
53 units::second_t m_turnDelay;
54};
Definition swerve_trapezoidal_spline.h:19
units::degree_t GetOdometryOffset() const
units::second_t m_turnDelay
Definition swerve_trapezoidal_spline.h:53
SwerveTrapezoidalSpline(SwerveTrapezoidalSpline &&other)=default
units::degree_t m_finalAngle
Definition swerve_trapezoidal_spline.h:52
units::degree_t HeadingSetpoint(units::second_t time) const
Definition swerve_trapezoidal_spline.cpp:33
units::feet_per_second_t GetYVelocity(const frc::Trajectory::State &state) const
Definition swerve_trapezoidal_spline.cpp:63
bool IsFinished(units::second_t time) const
Definition swerve_trapezoidal_spline.cpp:43
SwerveTrapezoidalSpline()=delete
units::degree_t GetEndAngle() const
Definition swerve_trapezoidal_spline.cpp:47
frc::Trajectory::State Calculate(units::second_t time) const
Definition swerve_trapezoidal_spline.cpp:29
units::second_t GetDriveTime() const
Definition swerve_trapezoidal_spline.cpp:51
units::degree_t m_initialAngle
Definition swerve_trapezoidal_spline.h:51
SwerveTrapezoidalSpline(const SwerveTrapezoidalSpline &other)=default
units::feet_per_second_t GetXVelocity(const frc::Trajectory::State &state) const
Definition swerve_trapezoidal_spline.cpp:59
SwerveTrapezoidalSpline & operator=(SwerveTrapezoidalSpline &&)=delete
SwerveTrapezoidalSpline & operator=(const SwerveTrapezoidalSpline &)=delete
frc::Trajectory m_pathTrajectory
Definition swerve_trapezoidal_spline.h:50
void SetTurnDelay(units::second_t delay)
Definition swerve_trapezoidal_spline.cpp:55