3#include <networktables/NetworkTableInstance.h>
4#include <networktables/DoubleArrayTopic.h>
5#include <networktables/DoubleTopic.h>
6#include <networktables/StructTopic.h>
7#include <networktables/StructArrayTopic.h>
8#include <networktables/NetworkTableListener.h>
10#include <unordered_map>
14#include <units/velocity.h>
15#include <units/angular_velocity.h>
16#include <units/length.h>
18#include <frc/geometry/Pose2d.h>
19#include "pathplanner/lib/path/PathPlannerPath.h"
20#include "pathplanner/lib/commands/PathPlannerAuto.h"
22namespace pathplanner {
25 static inline void enableCompetitionMode() {
29 static inline void setVelocities(units::meters_per_second_t actualVel,
30 units::meters_per_second_t commandedVel,
31 units::degrees_per_second_t actualAngVel,
32 units::degrees_per_second_t commandedAngVel) {
34 m_velPub.Set(std::span<const double>( { actualVel(), commandedVel(),
35 actualAngVel(), commandedAngVel() }));
39 static inline void setCurrentPose(frc::Pose2d pose) {
45 static inline void setCurrentPath(std::shared_ptr<PathPlannerPath> path) {
47 auto poses = path->getPathPoses();
48 m_pathPub.Set(std::span { poses.data(), poses.size() });
52 static inline void setTargetPose(frc::Pose2d targetPose) {
54 m_targetPosePub.Set(targetPose);
58 static void registerHotReloadPath(std::string pathName,
59 std::shared_ptr<PathPlannerPath> path);
62 static void ensureHotReloadListenersInitialized();
64 static void handlePathHotReloadEvent(
const nt::Event &event);
66 static bool m_compMode;
68 static nt::DoubleArrayPublisher m_velPub;
69 static nt::StructPublisher<frc::Pose2d> m_posePub;
70 static nt::StructArrayPublisher<frc::Pose2d> m_pathPub;
71 static nt::StructPublisher<frc::Pose2d> m_targetPosePub;
73 static std::unordered_map<std::string,
74 std::vector<std::shared_ptr<PathPlannerPath>>> m_hotReloadPaths;
76 static std::optional<NT_Listener> m_hotReloadPathListener;
Definition: PPLibTelemetry.h:23