ThunderLib
Loading...
Searching...
No Matches
Trajectory.hpp
1#pragma once
2
3#include <frc/kinematics/ChassisSpeeds.h>
4#include <frc/geometry/Pose2d.h>
5#include <frc/geometry/Rotation2d.h>
6#include <units/time.h>
7#include <units/velocity.h>
8#include <units/length.h>
9
10namespace thunder {
11
19enum FieldSymmetry {
20 NONE,
21 ROTATIONAL, // Rotated 180 degrees, like 2022, 2025, and 2026.
22 REFLECTIONAL, // Mirrored across the center line, like 2023 and 2024.
23};
24
26 units::meter_t width = 0_m; // X
27 units::meter_t length = 0_m; // Y
28};
29
31 units::second_t time = 0_s;
32 frc::Pose2d pose;
33 frc::ChassisSpeeds chassisSpeeds; // Field-centric
34 units::meters_per_second_t linearVelocity = 0.0_mps;
35 frc::Rotation2d heading;
36};
37
39 public:
40 virtual ~Trajectory() = default;
41
42 virtual bool isValid() const noexcept = 0;
43
44 operator bool() const noexcept { return isValid(); }
45
52 virtual TrajectoryState sample(units::second_t time) const noexcept = 0;
53
59 virtual units::second_t getDuration() const noexcept = 0;
60
66 virtual TrajectoryState getInitialState() const noexcept = 0;
67
73 virtual TrajectoryState getFinalState() const noexcept = 0;
74
75 protected:
76 Trajectory() = default;
77};
78
79} // namespace thunder
Definition Trajectory.hpp:38
virtual TrajectoryState getFinalState() const noexcept=0
virtual TrajectoryState getInitialState() const noexcept=0
virtual units::second_t getDuration() const noexcept=0
virtual TrajectoryState sample(units::second_t time) const noexcept=0
Definition Trajectory.hpp:25
Definition Trajectory.hpp:30