PathPlannerLib
Loading...
Searching...
No Matches
Waypoint.h
1#pragma once
2
3#include <frc/geometry/Translation2d.h>
4#include <frc/geometry/Rotation2d.h>
5#include <wpi/json.h>
6#include <optional>
7#include "pathplanner/lib/util/FlippingUtil.h"
8
9namespace pathplanner {
10
11#define AUTO_CONTROL_DISTANCE_FACTOR 0.4
12
13class Waypoint {
14public:
15 std::optional<frc::Translation2d> prevControl;
16 frc::Translation2d anchor;
17 std::optional<frc::Translation2d> nextControl;
18
26 constexpr Waypoint(std::optional<frc::Translation2d> prevControl,
27 frc::Translation2d anchor,
28 std::optional<frc::Translation2d> nextControl) : prevControl(
29 prevControl), anchor(anchor), nextControl(nextControl) {
30 }
31
37 Waypoint flip() const;
38
49 static Waypoint autoControlPoints(frc::Translation2d anchor,
50 frc::Rotation2d heading,
51 std::optional<frc::Translation2d> prevAnchor,
52 std::optional<frc::Translation2d> nextAnchor);
53
60 static Waypoint fromJson(const wpi::json &waypointJson);
61};
62}
Definition: Waypoint.h:13
static Waypoint autoControlPoints(frc::Translation2d anchor, frc::Rotation2d heading, std::optional< frc::Translation2d > prevAnchor, std::optional< frc::Translation2d > nextAnchor)
Definition: Waypoint.cpp:6
static Waypoint fromJson(const wpi::json &waypointJson)
Definition: Waypoint.cpp:26
Waypoint flip() const
Definition: Waypoint.cpp:43
constexpr Waypoint(std::optional< frc::Translation2d > prevControl, frc::Translation2d anchor, std::optional< frc::Translation2d > nextControl)
Definition: Waypoint.h:26