Class CommunicationManager
java.lang.Object
frc.team_8840_lib.input.communication.CommunicationManager
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringbase()Returns the base path of the network table for 8840-utilsvoidCloses all network communications.voidbooleanedu.wpi.first.networktables.NetworkTableEntryReturns the NetworkTableEntry for a given tab and key.static CommunicationManagerGet the instance of the CommunicationManager.static CommunicationManageri()Get the instance of the CommunicationManager.static voidinit()Start the communication manager.legacyWaitForAutonomousPath(PathCallback callback) Deprecated.readAndParsePath(org.json.JSONObject json, boolean toLastMovementPoint) This method is used to read a json file and parse it into a TimePoint array.static voidsetServerNotifications(boolean enabled) Sets the API server notifications to be enabled or disabled.voidupdateFieldObjectPose(String name, edu.wpi.first.math.geometry.Pose2d pose) updateInfo(String tab, String key, boolean value) updateInfo(String tab, String key, boolean[] value) updateInfo(String tab, String key, byte[] value) updateInfo(String tab, String key, double value) updateInfo(String tab, String key, double[] value) updateInfo(String tab, String key, int value) updateInfo(String tab, String key, long[] value) updateInfo(String tab, String key, String value) updateInfo(String tab, String key, String[] list) updateMotorControllerInfo(edu.wpi.first.wpilibj.motorcontrol.MotorController controller, String name) voidupdateRobotPose(edu.wpi.first.math.geometry.Pose2d pose) updateStatus(String service, String status) Update the status of a service.updateSwerveInfo(SwerveDrive swerveGroup) waitForAutonomousPath(Callback callback) This method is the new version of waitForAutonomousPath.
-
Field Details
-
SpeedControllerKey
- See Also:
-
port
public static int port
-
-
Method Details
-
getInstance
Get the instance of the CommunicationManager. This is the same asi().- Returns:
- The instance of the CommunicationManager.
-
i
Get the instance of the CommunicationManager. Shorter name for convenience.- Returns:
- The instance of the CommunicationManager.
-
init
public static void init()Start the communication manager. This method is used internally and should not be called. -
base
Returns the base path of the network table for 8840-utils- Returns:
- The base path of the network table for 8840-utils.
-
legacyWaitForAutonomousPath
@Deprecated(since="2023.2.1") public CommunicationManager legacyWaitForAutonomousPath(PathCallback callback) Deprecated.This method is the legacy version of waitForAutonomousPath. It is only used for backwards compatibility.- Parameters:
callback- The callback to be called when a new autonomous path is received.- Returns:
- The CommunicationManager instance.
-
waitForAutonomousPath
This method is the new version of waitForAutonomousPath. It is used for the new autonomous pathing system.- Parameters:
callback- The callback to be called when a new autonomous path is received.- Returns:
- The CommunicationManager instance.
-
readAndParsePath
This method is used to read a json file and parse it into a TimePoint array.- Parameters:
json- The json object to read.toLastMovementPoint- Whether or not to only parse up to the last movement point, or the full timeline.- Returns:
- The parsed TimePoint array.
-
updateStatus
Update the status of a service.- Parameters:
service- The service to update.status- The new status of the service.- Returns:
- The CommunicationManager instance.
-
updateSwerveInfo
-
updateSpeedControllerInfo
-
updateMotorControllerInfo
public CommunicationManager updateMotorControllerInfo(edu.wpi.first.wpilibj.motorcontrol.MotorController controller, String name) -
updateInfo
-
updateInfo
-
updateInfo
-
updateInfo
-
updateInfo
-
updateInfo
-
updateInfo
-
updateInfo
-
updateInfo
-
fieldExists
public boolean fieldExists() -
createField
public void createField() -
updateRobotPose
public void updateRobotPose(edu.wpi.first.math.geometry.Pose2d pose) -
updateFieldObjectPose
-
get
Returns the NetworkTableEntry for a given tab and key.- Parameters:
tab- The tab to get the entry from.key- The key to get the entry from.- Returns:
- The NetworkTableEntry for the given tab and key.
-
closeComms
public void closeComms()Closes all network communications. -
setServerNotifications
public static void setServerNotifications(boolean enabled) Sets the API server notifications to be enabled or disabled.- Parameters:
enabled-
-