RIT VEXU Core API
Loading...
Searching...
No Matches
hermite_point.h
1#pragma once
2
3#include "core/math/geometry/pose2d.h"
4#include "core/math/geometry/rotation2d.h"
5#include "core/math/geometry/translation2d.h"
6#include "core/math/units.h"
7
8using namespace units::literals;
9
17 Translation2d point;
18 Translation2d tangent;
19 Translation2d second_derivative;
20
24 HermitePoint() = default;
25
32 HermitePoint(const Translation2d& point, const Translation2d& tangent,
33 const Translation2d& second_derivative = Translation2d())
35
43 HermitePoint(double x, double y, double vx, double vy)
44 : point(x * 1_in, y * 1_in), tangent(vx * 1_in, vy * 1_in), second_derivative(0_in, 0_in) {}
45
56 HermitePoint(double x, double y, double vx, double vy, double ax, double ay)
57 : point(x * 1_in, y * 1_in),
58 tangent(vx * 1_in, vy * 1_in),
59 second_derivative(ax * 1_in, ay * 1_in) {}
60
68 static HermitePoint from_derivatives(const Translation2d& point, const Translation2d& tangent,
69 const Translation2d& second_derivative = Translation2d()) {
71 }
72
83 static HermitePoint from_heading(units::Length x, units::Length y, Rotation2d heading,
84 double speed, Rotation2d accel_heading = Rotation2d(),
85 double accel_mag = 0.0) {
86 return HermitePoint(Translation2d(x, y), Translation2d(speed * 1_in, heading),
87 Translation2d(accel_mag * 1_in, accel_heading));
88 }
89
100 static HermitePoint from_heading(const Translation2d& point, Rotation2d heading, double speed,
101 Rotation2d accel_heading = Rotation2d(),
102 double accel_mag = 0.0) {
103 return HermitePoint(point, Translation2d(speed * 1_in, heading),
104 Translation2d(accel_mag * 1_in, accel_heading));
105 }
106
114 static HermitePoint from_pose(const Pose2d& pose, double speed, double accel_mag = 0.0) {
115 return HermitePoint(pose.translation(), Translation2d(speed * 1_in, pose.rotation()),
116 Translation2d(accel_mag * 1_in, pose.rotation()));
117 }
118
120 Translation2d get_point() const { return point; }
122 Translation2d get_tangent() const { return tangent; }
124 Translation2d get_second_derivative() const { return second_derivative; }
125};
Definition pose2d.h:21
constexpr Rotation2d rotation() const
Gets the rotation.
Definition pose2d.h:102
constexpr Translation2d translation() const
Gets the translation.
Definition pose2d.h:96
Definition rotation2d.h:16
constexpr Rotation2d()=default
Default Constructor for Rotation2d.
HermitePoint(const Translation2d &point, const Translation2d &tangent, const Translation2d &second_derivative=Translation2d())
Constructs a HermitePoint from Translation2d vectors.
Definition hermite_point.h:32
static HermitePoint from_derivatives(const Translation2d &point, const Translation2d &tangent, const Translation2d &second_derivative=Translation2d())
Factory method constructing HermitePoint from explicit derivative vectors.
Definition hermite_point.h:68
static HermitePoint from_heading(units::Length x, units::Length y, Rotation2d heading, double speed, Rotation2d accel_heading=Rotation2d(), double accel_mag=0.0)
Factory method constructing HermitePoint from heading angle and scalar speed.
Definition hermite_point.h:83
Translation2d tangent
First derivative vector (dx/du, dy/du).
Definition hermite_point.h:18
Translation2d point
2D position coordinates (x, y)
Definition hermite_point.h:17
Translation2d second_derivative
Second derivative vector (d^2x/du^2, d^2y/du^2).
Definition hermite_point.h:19
Translation2d get_point() const
Definition hermite_point.h:120
HermitePoint()=default
Default constructor initializing all vectors to zero.
static HermitePoint from_pose(const Pose2d &pose, double speed, double accel_mag=0.0)
Factory method constructing HermitePoint from Pose2d and speeds.
Definition hermite_point.h:114
HermitePoint(double x, double y, double vx, double vy)
Constructs a HermitePoint from scalar position and tangent components.
Definition hermite_point.h:43
HermitePoint(double x, double y, double vx, double vy, double ax, double ay)
Constructs a HermitePoint from scalar position, tangent, and second derivative components.
Definition hermite_point.h:56
static HermitePoint from_heading(const Translation2d &point, Rotation2d heading, double speed, Rotation2d accel_heading=Rotation2d(), double accel_mag=0.0)
Factory method constructing HermitePoint from position vector, heading angle, and speed.
Definition hermite_point.h:100
Translation2d get_tangent() const
Definition hermite_point.h:122
Translation2d get_second_derivative() const
Definition hermite_point.h:124