PathPlannerLib
Loading...
Searching...
No Matches
PathPlannerLogging.h
1#pragma once
2
3#include <functional>
4#include <vector>
5#include <frc/geometry/Pose2d.h>
6#include <memory>
7#include <optional>
8#include "pathplanner/lib/path/PathPlannerPath.h"
9
10namespace pathplanner {
12public:
13 static inline void setLogCurrentPoseCallback(
14 std::function<void(const frc::Pose2d&)> logCurrentPose) {
15 m_logCurrentPose = logCurrentPose;
16 }
17
18 static inline void setLogTargetPoseCallback(
19 std::function<void(const frc::Pose2d&)> logTargetPose) {
20 m_logTargetPose = logTargetPose;
21 }
22
23 static inline void setLogActivePathCallback(
24 std::function<void(const std::vector<frc::Pose2d>&)> logActivePath) {
25 m_logActivePath = logActivePath;
26 }
27
28 static inline void logCurrentPose(const frc::Pose2d &pose) {
29 if (m_logCurrentPose) {
30 m_logCurrentPose(pose);
31 }
32 }
33
34 static inline void logTargetPose(const frc::Pose2d &targetPose) {
35 if (m_logTargetPose) {
36 m_logTargetPose(targetPose);
37 }
38 }
39
40 static void logActivePath(const PathPlannerPath *path) {
41 if (m_logActivePath) {
42 std::vector < frc::Pose2d > poses;
43
44 if (path) {
45 poses = path->getPathPoses();
46 }
47
48 m_logActivePath(poses);
49 }
50 }
51
52private:
53 static std::function<void(const frc::Pose2d&)> m_logCurrentPose;
54 static std::function<void(const frc::Pose2d&)> m_logTargetPose;
55 static std::function<void(const std::vector<frc::Pose2d>&)> m_logActivePath;
56};
57}
Definition: PathPlannerLogging.h:11
Definition: PathPlannerPath.h:26
std::vector< frc::Pose2d > getPathPoses() const
Definition: PathPlannerPath.h:334