ChoreoLib
Choreo support library.
Loading...
Searching...
No Matches
TrajectorySample.h
1// Copyright (c) Choreo contributors
2
3#pragma once
4
5#include <concepts>
6
7#include <frc/geometry/Pose2d.h>
8#include <frc/kinematics/ChassisSpeeds.h>
9#include <units/time.h>
10
11namespace choreo {
12
14template <typename T>
15concept EqualityComparable = requires(const T& a, const T& b) {
16 { a == b } -> std::convertible_to<bool>;
17 { a != b } -> std::convertible_to<bool>;
18};
19
21template <typename T>
24 requires(T t, units::second_t time, T tother, int year) {
25 { t.GetTimestamp() } -> std::same_as<units::second_t>;
26 { t.GetPose() } -> std::same_as<frc::Pose2d>;
27 { t.GetChassisSpeeds() } -> std::same_as<frc::ChassisSpeeds>;
28 { t.OffsetBy(time) } -> std::same_as<T>;
29 { t.Interpolate(tother, time) } -> std::same_as<T>;
30 // FIXME: This works around a roboRIO GCC internal compiler error; it
31 // can't be fully generic
32 { t.template Flipped<2022>() } -> std::same_as<T>;
33 { t.template Flipped<2023>() } -> std::same_as<T>;
34 { t.template Flipped<2024>() } -> std::same_as<T>;
35 };
36
37} // namespace choreo
Enforce equality operators on trajectory sample types.
Definition TrajectorySample.h:15
A concept representing a single robot sample in a Trajectory.
Definition TrajectorySample.h:22