#pragma once
#include <memory>
#include <utility>
#include <vector>
#include <wpi/SymbolExports.h>
#include "frc/trajectory/Trajectory.h"
#include "frc/trajectory/constraint/TrajectoryConstraint.h"
namespace frc {
class WPILIB_DLLEXPORT TrajectoryParameterizer {
public:
using PoseWithCurvature = std::pair<Pose2d, units::curvature_t>;
static Trajectory TimeParameterizeTrajectory(
const std::vector<PoseWithCurvature>& points,
const std::vector<std::unique_ptr<TrajectoryConstraint>>& constraints,
units::meters_per_second_t startVelocity,
units::meters_per_second_t endVelocity,
units::meters_per_second_t maxVelocity,
units::meters_per_second_squared_t maxAcceleration, bool reversed);
private:
constexpr static double kEpsilon = 1E-6;
struct ConstrainedState {
PoseWithCurvature pose = {Pose2d{}, units::curvature_t{0.0}};
units::meter_t distance = 0_m;
units::meters_per_second_t maxVelocity = 0_mps;
units::meters_per_second_squared_t minAcceleration = 0_mps_sq;
units::meters_per_second_squared_t maxAcceleration = 0_mps_sq;
};
static void EnforceAccelerationLimits(
bool reverse,
const std::vector<std::unique_ptr<TrajectoryConstraint>>& constraints,
ConstrainedState* state);
};
}