From 726caa1f6b4eb322fd8b47c2192146914945cb22 Mon Sep 17 00:00:00 2001 From: Michael Jansen Date: Wed, 27 Dec 2023 20:20:30 -0500 Subject: [PATCH] update usage reporting to use generated values --- pathplannerlib-python/pathplannerlib/auto.py | 4 ++-- pathplannerlib-python/pathplannerlib/commands.py | 4 ++-- pathplannerlib-python/pathplannerlib/path.py | 4 ++-- .../com/pathplanner/lib/commands/PathPlannerAuto.java | 3 ++- .../com/pathplanner/lib/commands/PathfindingCommand.java | 5 +++-- .../java/com/pathplanner/lib/path/PathPlannerPath.java | 5 +++-- .../cpp/pathplanner/lib/commands/PathPlannerAuto.cpp | 4 ++-- .../cpp/pathplanner/lib/commands/PathfindingCommand.cpp | 8 +++++--- .../native/cpp/pathplanner/lib/path/PathPlannerPath.cpp | 6 +++--- 9 files changed, 24 insertions(+), 19 deletions(-) diff --git a/pathplannerlib-python/pathplannerlib/auto.py b/pathplannerlib-python/pathplannerlib/auto.py index 72fe0589..47dc84a2 100644 --- a/pathplannerlib-python/pathplannerlib/auto.py +++ b/pathplannerlib-python/pathplannerlib/auto.py @@ -13,7 +13,7 @@ from commands2.command import Command from commands2.subsystem import Subsystem from .config import HolonomicPathFollowerConfig, ReplanningConfig -from hal import report +from hal import report, tResourceType class NamedCommands: @@ -474,7 +474,7 @@ def __init__(self, auto_name: str): self.setName(auto_name) PathPlannerAuto._instances += 1 - report(107, PathPlannerAuto._instances) # TODO: Use resource type when updated + report(tResourceType.kResourceType_PathPlannerAuto.value, PathPlannerAuto._instances) @staticmethod def getStartingPoseFromAutoFile(auto_name: str) -> Pose2d: diff --git a/pathplannerlib-python/pathplannerlib/commands.py b/pathplannerlib-python/pathplannerlib/commands.py index 41c4e704..b2774a27 100644 --- a/pathplannerlib-python/pathplannerlib/commands.py +++ b/pathplannerlib-python/pathplannerlib/commands.py @@ -13,7 +13,7 @@ from typing import Callable, Tuple, List from .config import ReplanningConfig, HolonomicPathFollowerConfig from .pathfinding import Pathfinding -from hal import report +from hal import report, tResourceType class FollowPathWithEvents(Command): @@ -355,7 +355,7 @@ def __init__(self, constraints: PathConstraints, pose_supplier: Callable[[], Pos self._goalEndState = GoalEndState(goal_end_vel, target_pose.rotation(), True) PathfindingCommand._instances += 1 - report(108, PathfindingCommand._instances) # TODO: Use resource type when updated + report(tResourceType.kResourceType_PathFindingCommand.value, PathfindingCommand._instances) def initialize(self): self._currentTrajectory = None diff --git a/pathplannerlib-python/pathplannerlib/path.py b/pathplannerlib-python/pathplannerlib/path.py index ffe99bea..b4466f58 100644 --- a/pathplannerlib-python/pathplannerlib/path.py +++ b/pathplannerlib-python/pathplannerlib/path.py @@ -11,7 +11,7 @@ from .geometry_util import decimal_range, cubicLerp, calculateRadius from .trajectory import PathPlannerTrajectory, State from wpilib import getDeployDirectory -from hal import report +from hal import report, tResourceType import os import json @@ -364,7 +364,7 @@ def __init__(self, bezier_points: List[Translation2d], constraints: PathConstrai self._previewStartingRotation = preview_starting_rotation PathPlannerPath._instances += 1 - report(106, PathPlannerPath._instances) # TODO: Use resource type when updated + report(tResourceType.kResourceType_PathPlannerPath.value, PathPlannerPath._instances) @staticmethod def fromPathPoints(path_points: List[PathPoint], constraints: PathConstraints, diff --git a/pathplannerlib/src/main/java/com/pathplanner/lib/commands/PathPlannerAuto.java b/pathplannerlib/src/main/java/com/pathplanner/lib/commands/PathPlannerAuto.java index 3dcb8471..6c7c5f6d 100644 --- a/pathplannerlib/src/main/java/com/pathplanner/lib/commands/PathPlannerAuto.java +++ b/pathplannerlib/src/main/java/com/pathplanner/lib/commands/PathPlannerAuto.java @@ -3,6 +3,7 @@ import com.pathplanner.lib.auto.AutoBuilder; import com.pathplanner.lib.path.PathPlannerPath; import com.pathplanner.lib.util.PPLibTelemetry; +import edu.wpi.first.hal.FRCNetComm.tResourceType; import edu.wpi.first.hal.HAL; import edu.wpi.first.math.geometry.Pose2d; import edu.wpi.first.wpilibj.Filesystem; @@ -41,7 +42,7 @@ public PathPlannerAuto(String autoName) { PPLibTelemetry.registerHotReloadAuto(autoName, this); instances++; - HAL.report(107, instances); // TODO: Use tResourceType class when updated + HAL.report(tResourceType.kResourceType_PathPlannerAuto, instances); } /** diff --git a/pathplannerlib/src/main/java/com/pathplanner/lib/commands/PathfindingCommand.java b/pathplannerlib/src/main/java/com/pathplanner/lib/commands/PathfindingCommand.java index b042c1e3..f485c49f 100644 --- a/pathplannerlib/src/main/java/com/pathplanner/lib/commands/PathfindingCommand.java +++ b/pathplannerlib/src/main/java/com/pathplanner/lib/commands/PathfindingCommand.java @@ -7,6 +7,7 @@ import com.pathplanner.lib.util.PPLibTelemetry; import com.pathplanner.lib.util.PathPlannerLogging; import com.pathplanner.lib.util.ReplanningConfig; +import edu.wpi.first.hal.FRCNetComm.tResourceType; import edu.wpi.first.hal.HAL; import edu.wpi.first.math.MathUtil; import edu.wpi.first.math.geometry.Pose2d; @@ -98,7 +99,7 @@ public PathfindingCommand( this.replanningConfig = replanningConfig; instances++; - HAL.report(108, instances); // TODO: Use tResourceType class when updated + HAL.report(tResourceType.kResourceType_PathFindingCommand, instances); } /** @@ -144,7 +145,7 @@ public PathfindingCommand( this.replanningConfig = replanningConfig; instances++; - HAL.report(108, instances); // TODO: Use tResourceType class when updated + HAL.report(tResourceType.kResourceType_PathFindingCommand, instances); } @Override diff --git a/pathplannerlib/src/main/java/com/pathplanner/lib/path/PathPlannerPath.java b/pathplannerlib/src/main/java/com/pathplanner/lib/path/PathPlannerPath.java index 778764c4..bedefafe 100644 --- a/pathplannerlib/src/main/java/com/pathplanner/lib/path/PathPlannerPath.java +++ b/pathplannerlib/src/main/java/com/pathplanner/lib/path/PathPlannerPath.java @@ -2,6 +2,7 @@ import com.pathplanner.lib.util.GeometryUtil; import com.pathplanner.lib.util.PPLibTelemetry; +import edu.wpi.first.hal.FRCNetComm.tResourceType; import edu.wpi.first.hal.HAL; import edu.wpi.first.math.MathUtil; import edu.wpi.first.math.geometry.Pose2d; @@ -69,7 +70,7 @@ public PathPlannerPath( precalcValues(); instances++; - HAL.report(106, instances); // TODO: Use tResourceType class when updated + HAL.report(tResourceType.kResourceType_PathPlannerPath, instances); } /** @@ -156,7 +157,7 @@ private PathPlannerPath(PathConstraints globalConstraints, GoalEndState goalEndS this.previewStartingRotation = Rotation2d.fromDegrees(0); instances++; - HAL.report(106, instances); // TODO: Use tResourceType class when updated + HAL.report(tResourceType.kResourceType_PathPlannerPath, instances); } /** diff --git a/pathplannerlib/src/main/native/cpp/pathplanner/lib/commands/PathPlannerAuto.cpp b/pathplannerlib/src/main/native/cpp/pathplanner/lib/commands/PathPlannerAuto.cpp index 1abd120e..a438e345 100644 --- a/pathplannerlib/src/main/native/cpp/pathplanner/lib/commands/PathPlannerAuto.cpp +++ b/pathplannerlib/src/main/native/cpp/pathplanner/lib/commands/PathPlannerAuto.cpp @@ -3,7 +3,7 @@ #include "pathplanner/lib/util/PPLibTelemetry.h" #include #include -#include +#include using namespace pathplanner; @@ -20,7 +20,7 @@ PathPlannerAuto::PathPlannerAuto(std::string autoName) { SetName(autoName); m_instances++; - HAL_Report(107, m_instances); // TODO: Use resource type when updated + HAL_Report(HALUsageReporting::kResourceType_PathPlannerAuto, m_instances); } std::vector> PathPlannerAuto::getPathGroupFromAutoFile( diff --git a/pathplannerlib/src/main/native/cpp/pathplanner/lib/commands/PathfindingCommand.cpp b/pathplannerlib/src/main/native/cpp/pathplanner/lib/commands/PathfindingCommand.cpp index d1cfb958..42477a1e 100644 --- a/pathplannerlib/src/main/native/cpp/pathplanner/lib/commands/PathfindingCommand.cpp +++ b/pathplannerlib/src/main/native/cpp/pathplanner/lib/commands/PathfindingCommand.cpp @@ -2,7 +2,7 @@ #include "pathplanner/lib/pathfinding/Pathfinding.h" #include "pathplanner/lib/util/GeometryUtil.h" #include -#include +#include using namespace pathplanner; @@ -48,7 +48,8 @@ PathfindingCommand::PathfindingCommand( m_goalEndState = GoalEndState(goalEndVel, targetRotation, true); m_instances++; - HAL_Report(108, m_instances); // TODO: Use resource type when updated + HAL_Report(HALUsageReporting::kResourceType_PathFindingCommand, + m_instances); } PathfindingCommand::PathfindingCommand(frc::Pose2d targetPose, @@ -68,7 +69,8 @@ PathfindingCommand::PathfindingCommand(frc::Pose2d targetPose, Pathfinding::ensureInitialized(); m_instances++; - HAL_Report(108, m_instances); // TODO: Use resource type when updated + HAL_Report(HALUsageReporting::kResourceType_PathFindingCommand, + m_instances); } void PathfindingCommand::Initialize() { diff --git a/pathplannerlib/src/main/native/cpp/pathplanner/lib/path/PathPlannerPath.cpp b/pathplannerlib/src/main/native/cpp/pathplanner/lib/path/PathPlannerPath.cpp index 2a498d65..e627d9ab 100644 --- a/pathplannerlib/src/main/native/cpp/pathplanner/lib/path/PathPlannerPath.cpp +++ b/pathplannerlib/src/main/native/cpp/pathplanner/lib/path/PathPlannerPath.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include using namespace pathplanner; @@ -28,7 +28,7 @@ PathPlannerPath::PathPlannerPath(std::vector bezierPoints, precalcValues(); m_instances++; - HAL_Report(106, m_instances); // TODO: Use resource type when updated + HAL_Report(HALUsageReporting::kResourceType_PathPlannerPath, m_instances); } PathPlannerPath::PathPlannerPath(PathConstraints constraints, @@ -36,7 +36,7 @@ PathPlannerPath::PathPlannerPath(PathConstraints constraints, constraints), m_goalEndState(goalEndState), m_reversed(false), m_previewStartingRotation(), m_isChoreoPath( false), m_choreoTrajectory() { m_instances++; - HAL_Report(106, m_instances); // TODO: Use resource type when updated + HAL_Report(HALUsageReporting::kResourceType_PathPlannerPath, m_instances); } void PathPlannerPath::hotReload(const wpi::json &json) {