From fe5be176be8eaf94f3ee5d47e4d456d2953ad67a Mon Sep 17 00:00:00 2001 From: Space Cookies Date: Fri, 30 Jan 2026 20:38:03 -0800 Subject: [PATCH 1/3] bump version year, adapt to some 2026 library changes, fix some leftover 2025 formatting and TODOs --- LICENSE-Tagalong.md | 2 +- README.md | 3 +- build.gradle | 2 +- scripts/auto-copyright.sh | 2 +- scripts/update-docs.sh | 2 +- .../java/tagalong/TagalongConfiguration.java | 2 +- .../tagalong/commands/TagalongCommand.java | 2 +- .../tagalong/commands/aim/PivotAimAtCmd.java | 2 +- .../commands/aim/PivotAimAtYawCompCmd.java | 2 +- .../tagalong/commands/aim/RollerAimAtCmd.java | 2 +- .../commands/aim/RollerAimAtYawCompCmd.java | 2 +- .../tagalong/commands/base/ElevateToCmd.java | 2 +- .../commands/base/ElevateToDynamicCmd.java | 2 +- .../tagalong/commands/base/ElevateXCmd.java | 2 +- .../commands/base/ElevatorZeroCmd.java | 2 +- .../commands/base/PivotToAbsoluteCmd.java | 2 +- .../tagalong/commands/base/PivotToCmd.java | 10 +++-- .../base/PivotToDynamicAbsoluteCmd.java | 2 +- .../commands/base/PivotToDynamicCmd.java | 2 +- .../tagalong/commands/base/PivotXCmd.java | 2 +- .../tagalong/commands/base/RollToCmd.java | 2 +- .../commands/base/RollToDynamicCmd.java | 2 +- .../java/tagalong/commands/base/RollXCmd.java | 2 +- .../controls/FeedforwardConstants.java | 2 +- .../java/tagalong/controls/PIDConstants.java | 2 +- .../tagalong/controls/PIDSGVAConstants.java | 2 +- .../tagalong/devices/CanDeviceInterface.java | 2 +- src/main/java/tagalong/devices/Encoders.java | 2 +- src/main/java/tagalong/devices/Motors.java | 10 ++--- .../java/tagalong/devices/TagalongCANBus.java | 40 +++++++++++++++++++ .../logging/ElevatorIOInputsAutoLogged.java | 8 ++-- .../logging/PivotIOInputsAutoLogged.java | 8 ++-- .../logging/RollerIOInputsAutoLogged.java | 8 ++-- .../java/tagalong/math/AlgebraicUtils.java | 2 +- .../java/tagalong/math/GeometricUtils.java | 2 +- .../tagalong/math/LinearizedLookupTable.java | 2 +- .../tagalong/measurements/AlliancePose2d.java | 2 +- .../tagalong/measurements/AlliancePose3d.java | 2 +- .../measurements/AllianceTranslation2d.java | 2 +- .../java/tagalong/measurements/Angle.java | 2 +- .../java/tagalong/measurements/Height.java | 2 +- .../subsystems/TagalongSubsystemBase.java | 2 +- .../tagalong/subsystems/micro/Elevator.java | 2 +- .../subsystems/micro/Microsystem.java | 2 +- .../java/tagalong/subsystems/micro/Pivot.java | 11 ++++- .../tagalong/subsystems/micro/PivotFused.java | 7 +++- .../subsystems/micro/PivotNoCancoder.java | 2 +- .../subsystems/micro/PivotUnfused.java | 2 +- .../tagalong/subsystems/micro/Roller.java | 2 +- .../micro/augments/ElevatorAugment.java | 2 +- .../micro/augments/PivotAugment.java | 2 +- .../micro/augments/RollerAugment.java | 2 +- .../subsystems/micro/confs/ElevatorConf.java | 2 +- .../micro/confs/MicrosystemConf.java | 9 +++-- .../subsystems/micro/confs/PivotConf.java | 8 ++-- .../subsystems/micro/confs/RollerConf.java | 2 +- .../tagalong/units/AccelerationUnits.java | 2 +- .../java/tagalong/units/DistanceUnits.java | 4 +- src/main/java/tagalong/units/MassUnits.java | 2 +- src/main/java/tagalong/units/TimeUnits.java | 2 +- .../java/tagalong/units/VelocityUnits.java | 2 +- .../tagalong/math/AlgebraicUtilsTest.java | 2 +- .../tagalong/math/GeometricUtilsTest.java | 2 +- .../tagalong/units/AccelerationUnitsTest.java | 2 +- .../tagalong/units/DistanceUnitsTest.java | 2 +- .../java/tagalong/units/MassUnitsTest.java | 2 +- .../java/tagalong/units/TimeUnitsTest.java | 2 +- .../tagalong/units/VelocityUnitsTest.java | 2 +- 68 files changed, 146 insertions(+), 92 deletions(-) create mode 100644 src/main/java/tagalong/devices/TagalongCANBus.java diff --git a/LICENSE-Tagalong.md b/LICENSE-Tagalong.md index e1ba0d9..b967372 100644 --- a/LICENSE-Tagalong.md +++ b/LICENSE-Tagalong.md @@ -1,4 +1,4 @@ -Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 +Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/README.md b/README.md index 4e5c2ff..cff09e4 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,6 @@ FUTURE DEV: List out microsystems and their specialized variants --> ### What functionalities are coming soon? -- 2025 vendor package support - More included configurations for Microsystem subtypes - Pivot variant without a fused encoder or mechanically zeroed - Simulation based unit tests @@ -79,4 +78,4 @@ Due to the required pairing of specific WPILib versions and other dependency ver > `(WPILibVersion in format YYYY.MajorMinor).MMDD` -For example, a TagalongLib release on January 1st, 2025 using WPILib version 2024.1.0 would be version `2025.10.0101`. +For example, a TagalongLib release on January 1st, 2026 using WPILib version 2024.1.0 would be version `2026.10.0101`. diff --git a/build.gradle b/build.gradle index 5648465..1e438df 100644 --- a/build.gradle +++ b/build.gradle @@ -56,7 +56,7 @@ apply from: 'config.gradle' // Apply Java configuration dependencies { implementation group: 'com.ctre.phoenix6', name: 'wpiapi-java', version: '26.1.0' - implementation group: 'org.littletonrobotics.akit', name: 'akit-java', version: '4.0.0' + implementation group: 'org.littletonrobotics.akit', name: 'akit-java', version: '26.0.0' implementation group: 'com.google.code.gson', name: 'gson', version: '2.11.0' implementation group: 'edu.wpi.first.wpilibj', name: 'wpilibj-java', version: '2026.2.1' implementation group: 'edu.wpi.first.wpiutil', name: 'wpiutil-java', version: '2026.2.1' diff --git a/scripts/auto-copyright.sh b/scripts/auto-copyright.sh index 17b65aa..d99a3c9 100755 --- a/scripts/auto-copyright.sh +++ b/scripts/auto-copyright.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 +# Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 # Open Source Software; you may modify and/or share it under the terms of # the 3-Clause BSD License found in the root directory of this project. diff --git a/scripts/update-docs.sh b/scripts/update-docs.sh index 12f04c5..e29d3f9 100755 --- a/scripts/update-docs.sh +++ b/scripts/update-docs.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 +# Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 # Open Source Software; you may modify and/or share it under the terms of # the 3-Clause BSD License found in the root directory of this project. diff --git a/src/main/java/tagalong/TagalongConfiguration.java b/src/main/java/tagalong/TagalongConfiguration.java index d228341..1e9c0d6 100644 --- a/src/main/java/tagalong/TagalongConfiguration.java +++ b/src/main/java/tagalong/TagalongConfiguration.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/commands/TagalongCommand.java b/src/main/java/tagalong/commands/TagalongCommand.java index c8998e3..212b1f2 100644 --- a/src/main/java/tagalong/commands/TagalongCommand.java +++ b/src/main/java/tagalong/commands/TagalongCommand.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/commands/aim/PivotAimAtCmd.java b/src/main/java/tagalong/commands/aim/PivotAimAtCmd.java index a605b35..8962cf4 100644 --- a/src/main/java/tagalong/commands/aim/PivotAimAtCmd.java +++ b/src/main/java/tagalong/commands/aim/PivotAimAtCmd.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/commands/aim/PivotAimAtYawCompCmd.java b/src/main/java/tagalong/commands/aim/PivotAimAtYawCompCmd.java index 53aced9..9684f23 100644 --- a/src/main/java/tagalong/commands/aim/PivotAimAtYawCompCmd.java +++ b/src/main/java/tagalong/commands/aim/PivotAimAtYawCompCmd.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/commands/aim/RollerAimAtCmd.java b/src/main/java/tagalong/commands/aim/RollerAimAtCmd.java index 21756bf..fe57b08 100644 --- a/src/main/java/tagalong/commands/aim/RollerAimAtCmd.java +++ b/src/main/java/tagalong/commands/aim/RollerAimAtCmd.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/commands/aim/RollerAimAtYawCompCmd.java b/src/main/java/tagalong/commands/aim/RollerAimAtYawCompCmd.java index 09efbd7..3c73e8a 100644 --- a/src/main/java/tagalong/commands/aim/RollerAimAtYawCompCmd.java +++ b/src/main/java/tagalong/commands/aim/RollerAimAtYawCompCmd.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/commands/base/ElevateToCmd.java b/src/main/java/tagalong/commands/base/ElevateToCmd.java index 518cde8..f4ee616 100644 --- a/src/main/java/tagalong/commands/base/ElevateToCmd.java +++ b/src/main/java/tagalong/commands/base/ElevateToCmd.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/commands/base/ElevateToDynamicCmd.java b/src/main/java/tagalong/commands/base/ElevateToDynamicCmd.java index 95ef1e7..5159b46 100644 --- a/src/main/java/tagalong/commands/base/ElevateToDynamicCmd.java +++ b/src/main/java/tagalong/commands/base/ElevateToDynamicCmd.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/commands/base/ElevateXCmd.java b/src/main/java/tagalong/commands/base/ElevateXCmd.java index 5f6f7dc..53822f8 100644 --- a/src/main/java/tagalong/commands/base/ElevateXCmd.java +++ b/src/main/java/tagalong/commands/base/ElevateXCmd.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/commands/base/ElevatorZeroCmd.java b/src/main/java/tagalong/commands/base/ElevatorZeroCmd.java index 5cf7904..4fb25c1 100644 --- a/src/main/java/tagalong/commands/base/ElevatorZeroCmd.java +++ b/src/main/java/tagalong/commands/base/ElevatorZeroCmd.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/commands/base/PivotToAbsoluteCmd.java b/src/main/java/tagalong/commands/base/PivotToAbsoluteCmd.java index 093a8c6..2d84bf7 100644 --- a/src/main/java/tagalong/commands/base/PivotToAbsoluteCmd.java +++ b/src/main/java/tagalong/commands/base/PivotToAbsoluteCmd.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/commands/base/PivotToCmd.java b/src/main/java/tagalong/commands/base/PivotToCmd.java index 6ad903c..16b112b 100644 --- a/src/main/java/tagalong/commands/base/PivotToCmd.java +++ b/src/main/java/tagalong/commands/base/PivotToCmd.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ @@ -374,12 +374,12 @@ public PivotToCmd( * command * @param maxAccelerationRPS2 The maximum acceleration of the pivot, in rotations per * second squared, during this command - * @param upperToleranceRot The number of rotations beyond the target - * position the pivot can be - * while still being considered in tolerance * @param lowerToleranceRot The number of rotations short of the * target position the pivot can be * while still being considered in tolerance + * @param upperToleranceRot The number of rotations beyond the target + * position the pivot can be + * while still being considered in tolerance * @param requiredInToleranceDurationS The number of seconds that being in * tolerance is required for */ @@ -512,6 +512,8 @@ public PivotToCmd( * @param maxVelocityRPS The maximum velocity of the pivot, in * rotations per second, during this * command + * @param maxAccelerationRPS2 The maximum acceleration of the pivot, in rotations per + * second squared, during this command * @param lowerToleranceRot The number of rotations short of the * target position the pivot can be * while still being considered in tolerance diff --git a/src/main/java/tagalong/commands/base/PivotToDynamicAbsoluteCmd.java b/src/main/java/tagalong/commands/base/PivotToDynamicAbsoluteCmd.java index 453b864..571fb02 100644 --- a/src/main/java/tagalong/commands/base/PivotToDynamicAbsoluteCmd.java +++ b/src/main/java/tagalong/commands/base/PivotToDynamicAbsoluteCmd.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/commands/base/PivotToDynamicCmd.java b/src/main/java/tagalong/commands/base/PivotToDynamicCmd.java index a2f394c..a3f9b8a 100644 --- a/src/main/java/tagalong/commands/base/PivotToDynamicCmd.java +++ b/src/main/java/tagalong/commands/base/PivotToDynamicCmd.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/commands/base/PivotXCmd.java b/src/main/java/tagalong/commands/base/PivotXCmd.java index ec5e7f5..23c9d75 100644 --- a/src/main/java/tagalong/commands/base/PivotXCmd.java +++ b/src/main/java/tagalong/commands/base/PivotXCmd.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/commands/base/RollToCmd.java b/src/main/java/tagalong/commands/base/RollToCmd.java index 4b7ea98..2b5204b 100644 --- a/src/main/java/tagalong/commands/base/RollToCmd.java +++ b/src/main/java/tagalong/commands/base/RollToCmd.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/commands/base/RollToDynamicCmd.java b/src/main/java/tagalong/commands/base/RollToDynamicCmd.java index d3c82b8..50b913d 100644 --- a/src/main/java/tagalong/commands/base/RollToDynamicCmd.java +++ b/src/main/java/tagalong/commands/base/RollToDynamicCmd.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/commands/base/RollXCmd.java b/src/main/java/tagalong/commands/base/RollXCmd.java index 9f6df2f..63c97f2 100644 --- a/src/main/java/tagalong/commands/base/RollXCmd.java +++ b/src/main/java/tagalong/commands/base/RollXCmd.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/controls/FeedforwardConstants.java b/src/main/java/tagalong/controls/FeedforwardConstants.java index 19bebca..eca2ca5 100644 --- a/src/main/java/tagalong/controls/FeedforwardConstants.java +++ b/src/main/java/tagalong/controls/FeedforwardConstants.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/controls/PIDConstants.java b/src/main/java/tagalong/controls/PIDConstants.java index 40aaef2..19aa19f 100644 --- a/src/main/java/tagalong/controls/PIDConstants.java +++ b/src/main/java/tagalong/controls/PIDConstants.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/controls/PIDSGVAConstants.java b/src/main/java/tagalong/controls/PIDSGVAConstants.java index 16c8b6d..3692829 100644 --- a/src/main/java/tagalong/controls/PIDSGVAConstants.java +++ b/src/main/java/tagalong/controls/PIDSGVAConstants.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/devices/CanDeviceInterface.java b/src/main/java/tagalong/devices/CanDeviceInterface.java index e3b6737..ef6442e 100644 --- a/src/main/java/tagalong/devices/CanDeviceInterface.java +++ b/src/main/java/tagalong/devices/CanDeviceInterface.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/devices/Encoders.java b/src/main/java/tagalong/devices/Encoders.java index e79537a..1d90b6d 100644 --- a/src/main/java/tagalong/devices/Encoders.java +++ b/src/main/java/tagalong/devices/Encoders.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/devices/Motors.java b/src/main/java/tagalong/devices/Motors.java index ad8109f..21f0727 100644 --- a/src/main/java/tagalong/devices/Motors.java +++ b/src/main/java/tagalong/devices/Motors.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ @@ -36,14 +36,12 @@ public enum Motors implements CanDeviceInterface { FALCON500_FOC(6080, DCMotor::getFalcon500), /** * Kraken X44 - * FUTURE DEV: Waiting for motor specifications v2025 */ - KRAKEN_X44(1, DCMotor::getKrakenX60), + KRAKEN_X44(7758, DCMotor::getKrakenX44), /** - * Kraken X44 in FOC mode -- RPM WAITING FOR SPEC - * FUTURE DEV: Waiting for motor specifications v2025 + * Kraken X44 in FOC mode */ - KRAKEN_X44_FOC(1, DCMotor::getKrakenX60Foc); + KRAKEN_X44_FOC(7368, DCMotor::getKrakenX44Foc); /** * Max free speed RPM and converted RPS of the motor diff --git a/src/main/java/tagalong/devices/TagalongCANBus.java b/src/main/java/tagalong/devices/TagalongCANBus.java new file mode 100644 index 0000000..9c9c815 --- /dev/null +++ b/src/main/java/tagalong/devices/TagalongCANBus.java @@ -0,0 +1,40 @@ +package tagalong.devices; + +import java.util.Map; + +import com.ctre.phoenix6.CANBus; + +/** + * Tagalong CANBus manager instance manager, only CTRE devices are currently registered or supported + */ +public class TagalongCANBus { + /** + * Map of all instances with a CTRE device registered to them + */ + private static final Map _ctreCANBus = Map.of(); + + /** + * Gets or registers a CTRE CANBus instance with the given name + * + * @param canBusName Name of the CANBus + * @return CTRE CANBus instance + */ + public static CANBus getOrRegisterPhoenixCANBus(String canBusName) { + CANBus bus = _ctreCANBus.get(canBusName); + if (bus == null) { + bus = new CANBus(canBusName); + _ctreCANBus.put(canBusName, bus); + } + return bus; + } + + /** + * Gets the map of all registered CTRE CANBus instances + * + * @return Map of CANBus instances + */ + public static Map getPhoenixCANBusMap() { + return _ctreCANBus; + } + +} diff --git a/src/main/java/tagalong/logging/ElevatorIOInputsAutoLogged.java b/src/main/java/tagalong/logging/ElevatorIOInputsAutoLogged.java index 969c91f..4827bf0 100644 --- a/src/main/java/tagalong/logging/ElevatorIOInputsAutoLogged.java +++ b/src/main/java/tagalong/logging/ElevatorIOInputsAutoLogged.java @@ -12,10 +12,10 @@ public class ElevatorIOInputsAutoLogged extends ElevatorIO.ElevatorIOInputs implements LoggableInputs, Cloneable { @Override public void toLog(LogTable table) { - table.put("ElevatorHeightM", elevatorHeightM); - table.put("ElevatorVelocityMPS", elevatorVelocityMPS); - table.put("ElevatorAppliedVolts", elevatorAppliedVolts); - table.put("ElevatorCurrentAmps", elevatorCurrentAmps); + table.put("ElevatorHeightM", elevatorHeightM, "meters"); + table.put("ElevatorVelocityMPS", elevatorVelocityMPS, "meters/second"); + table.put("ElevatorAppliedVolts", elevatorAppliedVolts, "volts"); + table.put("ElevatorCurrentAmps", elevatorCurrentAmps, "amps"); } @Override diff --git a/src/main/java/tagalong/logging/PivotIOInputsAutoLogged.java b/src/main/java/tagalong/logging/PivotIOInputsAutoLogged.java index 8c590aa..672781e 100644 --- a/src/main/java/tagalong/logging/PivotIOInputsAutoLogged.java +++ b/src/main/java/tagalong/logging/PivotIOInputsAutoLogged.java @@ -12,10 +12,10 @@ public class PivotIOInputsAutoLogged extends PivotIO.PivotIOInputs implements LoggableInputs, Cloneable { @Override public void toLog(LogTable table) { - table.put("PivotPositionRot", pivotPositionRot); - table.put("PivotVelocityRPS", pivotVelocityRPS); - table.put("PivotAppliedVolts", pivotAppliedVolts); - table.put("PivotCurrentAmps", pivotCurrentAmps); + table.put("PivotPositionRot", pivotPositionRot, "rotations"); + table.put("PivotVelocityRPS", pivotVelocityRPS, "rotations/second"); + table.put("PivotAppliedVolts", pivotAppliedVolts, "volts"); + table.put("PivotCurrentAmps", pivotCurrentAmps, "amps"); } @Override diff --git a/src/main/java/tagalong/logging/RollerIOInputsAutoLogged.java b/src/main/java/tagalong/logging/RollerIOInputsAutoLogged.java index 020881c..1c31367 100644 --- a/src/main/java/tagalong/logging/RollerIOInputsAutoLogged.java +++ b/src/main/java/tagalong/logging/RollerIOInputsAutoLogged.java @@ -12,10 +12,10 @@ public class RollerIOInputsAutoLogged extends RollerIO.RollerIOInputs implements LoggableInputs, Cloneable { @Override public void toLog(LogTable table) { - table.put("RollerPositionRot", rollerPositionRot); - table.put("RollerVelocityRPS", rollerVelocityRPS); - table.put("RollerAppliedVolts", rollerAppliedVolts); - table.put("RollerCurrentAmps", rollerCurrentAmps); + table.put("RollerPositionRot", rollerPositionRot, "rotations"); + table.put("RollerVelocityRPS", rollerVelocityRPS, "rotations/second"); + table.put("RollerAppliedVolts", rollerAppliedVolts, "volts"); + table.put("RollerCurrentAmps", rollerCurrentAmps, "amps"); } @Override diff --git a/src/main/java/tagalong/math/AlgebraicUtils.java b/src/main/java/tagalong/math/AlgebraicUtils.java index 645a1a1..32ef57a 100644 --- a/src/main/java/tagalong/math/AlgebraicUtils.java +++ b/src/main/java/tagalong/math/AlgebraicUtils.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/math/GeometricUtils.java b/src/main/java/tagalong/math/GeometricUtils.java index 2aaf48a..28d8339 100644 --- a/src/main/java/tagalong/math/GeometricUtils.java +++ b/src/main/java/tagalong/math/GeometricUtils.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/math/LinearizedLookupTable.java b/src/main/java/tagalong/math/LinearizedLookupTable.java index 024f2d8..ffba2e5 100644 --- a/src/main/java/tagalong/math/LinearizedLookupTable.java +++ b/src/main/java/tagalong/math/LinearizedLookupTable.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/measurements/AlliancePose2d.java b/src/main/java/tagalong/measurements/AlliancePose2d.java index 3889f42..976d4f2 100644 --- a/src/main/java/tagalong/measurements/AlliancePose2d.java +++ b/src/main/java/tagalong/measurements/AlliancePose2d.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/measurements/AlliancePose3d.java b/src/main/java/tagalong/measurements/AlliancePose3d.java index f09544f..da8910f 100644 --- a/src/main/java/tagalong/measurements/AlliancePose3d.java +++ b/src/main/java/tagalong/measurements/AlliancePose3d.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/measurements/AllianceTranslation2d.java b/src/main/java/tagalong/measurements/AllianceTranslation2d.java index 4ec10e1..c108adc 100644 --- a/src/main/java/tagalong/measurements/AllianceTranslation2d.java +++ b/src/main/java/tagalong/measurements/AllianceTranslation2d.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/measurements/Angle.java b/src/main/java/tagalong/measurements/Angle.java index 59eff95..2eb131a 100644 --- a/src/main/java/tagalong/measurements/Angle.java +++ b/src/main/java/tagalong/measurements/Angle.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/measurements/Height.java b/src/main/java/tagalong/measurements/Height.java index 9f9d640..8f4266f 100644 --- a/src/main/java/tagalong/measurements/Height.java +++ b/src/main/java/tagalong/measurements/Height.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/subsystems/TagalongSubsystemBase.java b/src/main/java/tagalong/subsystems/TagalongSubsystemBase.java index 19fb142..2dcfc21 100644 --- a/src/main/java/tagalong/subsystems/TagalongSubsystemBase.java +++ b/src/main/java/tagalong/subsystems/TagalongSubsystemBase.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/subsystems/micro/Elevator.java b/src/main/java/tagalong/subsystems/micro/Elevator.java index 9273e00..ab814c0 100644 --- a/src/main/java/tagalong/subsystems/micro/Elevator.java +++ b/src/main/java/tagalong/subsystems/micro/Elevator.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/subsystems/micro/Microsystem.java b/src/main/java/tagalong/subsystems/micro/Microsystem.java index d8fef33..4e3e957 100644 --- a/src/main/java/tagalong/subsystems/micro/Microsystem.java +++ b/src/main/java/tagalong/subsystems/micro/Microsystem.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/subsystems/micro/Pivot.java b/src/main/java/tagalong/subsystems/micro/Pivot.java index 1ed7393..e13c7e8 100644 --- a/src/main/java/tagalong/subsystems/micro/Pivot.java +++ b/src/main/java/tagalong/subsystems/micro/Pivot.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ @@ -106,7 +106,9 @@ public class Pivot extends Microsystem { * Simulated arm of the pivot */ protected MechanismLigament2d _pivotLigament; - + /** + * Dynamic scope offset to handle absolute encoders and unpredictable boot locations + */ protected double _scopeOffset = 0.0; /** @@ -700,6 +702,11 @@ public MechanismLigament2d getPivotLigament() { return _pivotLigament; } + /** + * Gets the configured scope offset for the pivot + * + * @return scope offset in rotations + */ public double getScopeOffset() { return _scopeOffset; } diff --git a/src/main/java/tagalong/subsystems/micro/PivotFused.java b/src/main/java/tagalong/subsystems/micro/PivotFused.java index 59126a7..ef82428 100644 --- a/src/main/java/tagalong/subsystems/micro/PivotFused.java +++ b/src/main/java/tagalong/subsystems/micro/PivotFused.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ @@ -30,6 +30,9 @@ public class PivotFused extends Pivot { * Configuration for the CANcoder */ protected CANcoderConfiguration _pivotCancoderConfiguration; + /** + * Whether the fused cancoder has been setup yet + */ protected boolean _fusedCancoderSetup = false; /** * Constructs a pivot microsystem with the below configurations @@ -45,7 +48,7 @@ public PivotFused(PivotConf conf) { } private void setupFusedCancoder() { - if(!_fusedCancoderSetup) { + if (!_fusedCancoderSetup) { _pivotCancoder = new CANcoder(_pivotConf.encoderDeviceID, _pivotConf.encoderCanBus); _pivotCancoderConfiguration = _pivotConf.encoderConfig; configCancoder(); diff --git a/src/main/java/tagalong/subsystems/micro/PivotNoCancoder.java b/src/main/java/tagalong/subsystems/micro/PivotNoCancoder.java index 6d46340..7da221d 100644 --- a/src/main/java/tagalong/subsystems/micro/PivotNoCancoder.java +++ b/src/main/java/tagalong/subsystems/micro/PivotNoCancoder.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/subsystems/micro/PivotUnfused.java b/src/main/java/tagalong/subsystems/micro/PivotUnfused.java index db4179d..a480308 100644 --- a/src/main/java/tagalong/subsystems/micro/PivotUnfused.java +++ b/src/main/java/tagalong/subsystems/micro/PivotUnfused.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/subsystems/micro/Roller.java b/src/main/java/tagalong/subsystems/micro/Roller.java index 62ef4d9..719b312 100644 --- a/src/main/java/tagalong/subsystems/micro/Roller.java +++ b/src/main/java/tagalong/subsystems/micro/Roller.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/subsystems/micro/augments/ElevatorAugment.java b/src/main/java/tagalong/subsystems/micro/augments/ElevatorAugment.java index 7facd7c..5430e6b 100644 --- a/src/main/java/tagalong/subsystems/micro/augments/ElevatorAugment.java +++ b/src/main/java/tagalong/subsystems/micro/augments/ElevatorAugment.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/subsystems/micro/augments/PivotAugment.java b/src/main/java/tagalong/subsystems/micro/augments/PivotAugment.java index 3a844b2..8d8b2e1 100644 --- a/src/main/java/tagalong/subsystems/micro/augments/PivotAugment.java +++ b/src/main/java/tagalong/subsystems/micro/augments/PivotAugment.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/subsystems/micro/augments/RollerAugment.java b/src/main/java/tagalong/subsystems/micro/augments/RollerAugment.java index bea1c43..28e95d5 100644 --- a/src/main/java/tagalong/subsystems/micro/augments/RollerAugment.java +++ b/src/main/java/tagalong/subsystems/micro/augments/RollerAugment.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/subsystems/micro/confs/ElevatorConf.java b/src/main/java/tagalong/subsystems/micro/confs/ElevatorConf.java index 8a37b0a..27e07aa 100644 --- a/src/main/java/tagalong/subsystems/micro/confs/ElevatorConf.java +++ b/src/main/java/tagalong/subsystems/micro/confs/ElevatorConf.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/subsystems/micro/confs/MicrosystemConf.java b/src/main/java/tagalong/subsystems/micro/confs/MicrosystemConf.java index 230654d..e501a84 100644 --- a/src/main/java/tagalong/subsystems/micro/confs/MicrosystemConf.java +++ b/src/main/java/tagalong/subsystems/micro/confs/MicrosystemConf.java @@ -1,11 +1,12 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ package tagalong.subsystems.micro.confs; +import com.ctre.phoenix6.CANBus; import com.ctre.phoenix6.configs.CurrentLimitsConfigs; import com.ctre.phoenix6.configs.TalonFXConfiguration; import com.ctre.phoenix6.signals.InvertedValue; @@ -14,6 +15,7 @@ import edu.wpi.first.wpilibj.IterativeRobotBase; import tagalong.controls.PIDSGVAConstants; import tagalong.devices.Motors; +import tagalong.devices.TagalongCANBus; import tagalong.units.AccelerationUnits; import tagalong.units.DistanceUnits; import tagalong.units.VelocityUnits; @@ -52,7 +54,7 @@ public class MicrosystemConf { /** * The can bus of the motors */ - public final String[] motorCanBus; + public final CANBus[] motorCanBus; /** * The motor directionality */ @@ -167,7 +169,6 @@ public MicrosystemConf( this.motorTypes = motorTypes; this.motorDeviceIDs = motorDeviceIDs; - this.motorCanBus = motorCanBus; this.motorDirection = motorDirection; this.motorEnabledBrakeMode = motorEnabledBrakeMode; this.motorDisabledBrakeMode = motorDisabledBrakeMode; @@ -182,8 +183,10 @@ public MicrosystemConf( this.motorToMechRatio = calculateGearRatio(gearRatio); assert (this.motorToMechRatio > 0.0); + this.motorCanBus = new CANBus[numMotors]; motorConfig = new TalonFXConfiguration[numMotors]; for (int i = 0; i < numMotors; i++) { + this.motorCanBus[i] = TagalongCANBus.getOrRegisterPhoenixCANBus(motorCanBus[i]); motorConfig[i] = Motors.getDefaults(); motorConfig[i].MotorOutput.Inverted = motorDirection[i]; motorConfig[i].MotorOutput.NeutralMode = motorDisabledBrakeMode[i]; diff --git a/src/main/java/tagalong/subsystems/micro/confs/PivotConf.java b/src/main/java/tagalong/subsystems/micro/confs/PivotConf.java index 1fbc138..b9d50d2 100644 --- a/src/main/java/tagalong/subsystems/micro/confs/PivotConf.java +++ b/src/main/java/tagalong/subsystems/micro/confs/PivotConf.java @@ -1,11 +1,12 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ package tagalong.subsystems.micro.confs; +import com.ctre.phoenix6.CANBus; import com.ctre.phoenix6.configs.CANcoderConfiguration; import com.ctre.phoenix6.configs.CurrentLimitsConfigs; import com.ctre.phoenix6.configs.MagnetSensorConfigs; @@ -18,6 +19,7 @@ import tagalong.controls.PIDSGVAConstants; import tagalong.devices.Encoders; import tagalong.devices.Motors; +import tagalong.devices.TagalongCANBus; import tagalong.units.AccelerationUnits; import tagalong.units.DistanceUnits; import tagalong.units.VelocityUnits; @@ -50,7 +52,7 @@ public class PivotConf extends MicrosystemConf { /** * CAN bus of the encoder */ - public final String encoderCanBus; + public final CANBus encoderCanBus; /** * Ratio between the motor and encoder */ @@ -274,7 +276,7 @@ public PivotConf( ); this.encoderType = encoderType; this.encoderDeviceID = encoderDeviceID; - this.encoderCanBus = encoderCanBus; + this.encoderCanBus = TagalongCANBus.getOrRegisterPhoenixCANBus(encoderCanBus); this.encoderToPivotRatio = super.calculateGearRatio(encoderToPivotRatio); this.motorToEncoderRatio = super.calculateGearRatio(motorToPivotRatio) / this.encoderToPivotRatio; diff --git a/src/main/java/tagalong/subsystems/micro/confs/RollerConf.java b/src/main/java/tagalong/subsystems/micro/confs/RollerConf.java index 0c33957..e3f3e4e 100644 --- a/src/main/java/tagalong/subsystems/micro/confs/RollerConf.java +++ b/src/main/java/tagalong/subsystems/micro/confs/RollerConf.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/units/AccelerationUnits.java b/src/main/java/tagalong/units/AccelerationUnits.java index f1e0e0a..c1c9775 100644 --- a/src/main/java/tagalong/units/AccelerationUnits.java +++ b/src/main/java/tagalong/units/AccelerationUnits.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/units/DistanceUnits.java b/src/main/java/tagalong/units/DistanceUnits.java index 6bf3309..74db3cd 100644 --- a/src/main/java/tagalong/units/DistanceUnits.java +++ b/src/main/java/tagalong/units/DistanceUnits.java @@ -1,11 +1,11 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/units/MassUnits.java b/src/main/java/tagalong/units/MassUnits.java index fc22736..a30e633 100644 --- a/src/main/java/tagalong/units/MassUnits.java +++ b/src/main/java/tagalong/units/MassUnits.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/units/TimeUnits.java b/src/main/java/tagalong/units/TimeUnits.java index 4e1427b..b40dbec 100644 --- a/src/main/java/tagalong/units/TimeUnits.java +++ b/src/main/java/tagalong/units/TimeUnits.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/main/java/tagalong/units/VelocityUnits.java b/src/main/java/tagalong/units/VelocityUnits.java index e50a4d3..fa0979b 100644 --- a/src/main/java/tagalong/units/VelocityUnits.java +++ b/src/main/java/tagalong/units/VelocityUnits.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/test/java/tagalong/math/AlgebraicUtilsTest.java b/src/test/java/tagalong/math/AlgebraicUtilsTest.java index c2dd619..bc8871f 100644 --- a/src/test/java/tagalong/math/AlgebraicUtilsTest.java +++ b/src/test/java/tagalong/math/AlgebraicUtilsTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/test/java/tagalong/math/GeometricUtilsTest.java b/src/test/java/tagalong/math/GeometricUtilsTest.java index 94b96de..7f1a0bc 100644 --- a/src/test/java/tagalong/math/GeometricUtilsTest.java +++ b/src/test/java/tagalong/math/GeometricUtilsTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/test/java/tagalong/units/AccelerationUnitsTest.java b/src/test/java/tagalong/units/AccelerationUnitsTest.java index 98c5b0d..a27bffc 100644 --- a/src/test/java/tagalong/units/AccelerationUnitsTest.java +++ b/src/test/java/tagalong/units/AccelerationUnitsTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/test/java/tagalong/units/DistanceUnitsTest.java b/src/test/java/tagalong/units/DistanceUnitsTest.java index 94918fa..9fe104d 100644 --- a/src/test/java/tagalong/units/DistanceUnitsTest.java +++ b/src/test/java/tagalong/units/DistanceUnitsTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/test/java/tagalong/units/MassUnitsTest.java b/src/test/java/tagalong/units/MassUnitsTest.java index 60f9323..77acba3 100644 --- a/src/test/java/tagalong/units/MassUnitsTest.java +++ b/src/test/java/tagalong/units/MassUnitsTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/test/java/tagalong/units/TimeUnitsTest.java b/src/test/java/tagalong/units/TimeUnitsTest.java index e11f6b2..5fd9259 100644 --- a/src/test/java/tagalong/units/TimeUnitsTest.java +++ b/src/test/java/tagalong/units/TimeUnitsTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ diff --git a/src/test/java/tagalong/units/VelocityUnitsTest.java b/src/test/java/tagalong/units/VelocityUnitsTest.java index 303c41c..afc271b 100644 --- a/src/test/java/tagalong/units/VelocityUnitsTest.java +++ b/src/test/java/tagalong/units/VelocityUnitsTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 + * Copyright 2024-2026 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868 * Open Source Software; you may modify and/or share it under the terms of * the 3-Clause BSD License found in the root directory of this project. */ From 704f027e16c063f5d4941a11535e9223e9fc6a42 Mon Sep 17 00:00:00 2001 From: Space Cookies Date: Fri, 30 Jan 2026 21:10:40 -0800 Subject: [PATCH 2/3] cleanup CANBus change --- build.gradle | 4 ++-- src/main/java/tagalong/subsystems/micro/Microsystem.java | 5 ++++- src/main/java/tagalong/subsystems/micro/PivotFused.java | 6 +++++- src/main/java/tagalong/subsystems/micro/PivotUnfused.java | 6 +++++- .../tagalong/subsystems/micro/confs/MicrosystemConf.java | 7 ++----- .../java/tagalong/subsystems/micro/confs/PivotConf.java | 6 ++---- 6 files changed, 20 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index 1e438df..f8915e3 100644 --- a/build.gradle +++ b/build.gradle @@ -63,9 +63,9 @@ dependencies { implementation group: 'edu.wpi.first.wpimath', name: 'wpimath-java', version: '2026.2.1' implementation group: 'edu.wpi.first.wpilibNewCommands', name: 'wpilibNewCommands-java', version: '2026.2.1' implementation group: 'edu.wpi.first.wpiunits', name: 'wpiunits-java', version: '2026.2.1' - implementation group: 'edu.wpi.first.ntcore', name: 'ntcore-java', version: '2026.1.1-beta-1' + implementation group: 'edu.wpi.first.ntcore', name: 'ntcore-java', version: '2026.2.1' implementation group: 'edu.wpi.first.ntcore', name: 'ntcore-jni', version: '2025.3.2' - implementation group: 'edu.wpi.first.cscore', name: 'cscore-java', version: '2026.1.1-beta-1' + implementation group: 'edu.wpi.first.cscore', name: 'cscore-java', version: '2026.1.1' implementation 'us.hebi.quickbuf:quickbuf-runtime:1.4' diff --git a/src/main/java/tagalong/subsystems/micro/Microsystem.java b/src/main/java/tagalong/subsystems/micro/Microsystem.java index 4e3e957..2d022cd 100644 --- a/src/main/java/tagalong/subsystems/micro/Microsystem.java +++ b/src/main/java/tagalong/subsystems/micro/Microsystem.java @@ -29,6 +29,7 @@ import edu.wpi.first.wpilibj.smartdashboard.MechanismRoot2d; import tagalong.TagalongConfiguration; import tagalong.controls.PIDSGVAConstants; +import tagalong.devices.TagalongCANBus; import tagalong.subsystems.micro.confs.MicrosystemConf; /** @@ -187,7 +188,9 @@ public Microsystem(MicrosystemConf conf) { // Initialize motors _allMotors = new TalonFX[conf.numMotors]; for (int i = 0; i < conf.numMotors; i++) { - _allMotors[i] = new TalonFX(conf.motorDeviceIDs[i], conf.motorCanBus[i]); + _allMotors[i] = new TalonFX( + conf.motorDeviceIDs[i], TagalongCANBus.getOrRegisterPhoenixCANBus(conf.motorCanBus[i]) + ); } _primaryMotor = _allMotors[0]; // FUTURE DEV: Inject this here rather than robot builder diff --git a/src/main/java/tagalong/subsystems/micro/PivotFused.java b/src/main/java/tagalong/subsystems/micro/PivotFused.java index ef82428..ee1ab39 100644 --- a/src/main/java/tagalong/subsystems/micro/PivotFused.java +++ b/src/main/java/tagalong/subsystems/micro/PivotFused.java @@ -16,6 +16,7 @@ import edu.wpi.first.wpilibj.simulation.BatterySim; import edu.wpi.first.wpilibj.simulation.RoboRioSim; import tagalong.TagalongConfiguration; +import tagalong.devices.TagalongCANBus; import tagalong.subsystems.micro.confs.PivotConf; /** @@ -49,7 +50,10 @@ public PivotFused(PivotConf conf) { private void setupFusedCancoder() { if (!_fusedCancoderSetup) { - _pivotCancoder = new CANcoder(_pivotConf.encoderDeviceID, _pivotConf.encoderCanBus); + _pivotCancoder = new CANcoder( + _pivotConf.encoderDeviceID, + TagalongCANBus.getOrRegisterPhoenixCANBus(_pivotConf.encoderCanBus) + ); _pivotCancoderConfiguration = _pivotConf.encoderConfig; configCancoder(); configAllDevices(); diff --git a/src/main/java/tagalong/subsystems/micro/PivotUnfused.java b/src/main/java/tagalong/subsystems/micro/PivotUnfused.java index a480308..8f754e5 100644 --- a/src/main/java/tagalong/subsystems/micro/PivotUnfused.java +++ b/src/main/java/tagalong/subsystems/micro/PivotUnfused.java @@ -21,6 +21,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj.util.Color8Bit; import tagalong.TagalongConfiguration; +import tagalong.devices.TagalongCANBus; import tagalong.subsystems.micro.confs.PivotConf; /** @@ -45,7 +46,10 @@ public PivotUnfused(PivotConf conf) { if (_configuredMicrosystemDisable) { return; } - _pivotCancoder = new CANcoder(_pivotConf.encoderDeviceID, _pivotConf.encoderCanBus); + _pivotCancoder = new CANcoder( + _pivotConf.encoderDeviceID, + TagalongCANBus.getOrRegisterPhoenixCANBus(_pivotConf.encoderCanBus) + ); _pivotCancoderConfiguration = _pivotConf.encoderConfig; configCancoder(); configAllDevices(); diff --git a/src/main/java/tagalong/subsystems/micro/confs/MicrosystemConf.java b/src/main/java/tagalong/subsystems/micro/confs/MicrosystemConf.java index e501a84..cf3cfb5 100644 --- a/src/main/java/tagalong/subsystems/micro/confs/MicrosystemConf.java +++ b/src/main/java/tagalong/subsystems/micro/confs/MicrosystemConf.java @@ -6,7 +6,6 @@ package tagalong.subsystems.micro.confs; -import com.ctre.phoenix6.CANBus; import com.ctre.phoenix6.configs.CurrentLimitsConfigs; import com.ctre.phoenix6.configs.TalonFXConfiguration; import com.ctre.phoenix6.signals.InvertedValue; @@ -15,7 +14,6 @@ import edu.wpi.first.wpilibj.IterativeRobotBase; import tagalong.controls.PIDSGVAConstants; import tagalong.devices.Motors; -import tagalong.devices.TagalongCANBus; import tagalong.units.AccelerationUnits; import tagalong.units.DistanceUnits; import tagalong.units.VelocityUnits; @@ -54,7 +52,7 @@ public class MicrosystemConf { /** * The can bus of the motors */ - public final CANBus[] motorCanBus; + public final String[] motorCanBus; /** * The motor directionality */ @@ -169,6 +167,7 @@ public MicrosystemConf( this.motorTypes = motorTypes; this.motorDeviceIDs = motorDeviceIDs; + this.motorCanBus = motorCanBus; this.motorDirection = motorDirection; this.motorEnabledBrakeMode = motorEnabledBrakeMode; this.motorDisabledBrakeMode = motorDisabledBrakeMode; @@ -183,10 +182,8 @@ public MicrosystemConf( this.motorToMechRatio = calculateGearRatio(gearRatio); assert (this.motorToMechRatio > 0.0); - this.motorCanBus = new CANBus[numMotors]; motorConfig = new TalonFXConfiguration[numMotors]; for (int i = 0; i < numMotors; i++) { - this.motorCanBus[i] = TagalongCANBus.getOrRegisterPhoenixCANBus(motorCanBus[i]); motorConfig[i] = Motors.getDefaults(); motorConfig[i].MotorOutput.Inverted = motorDirection[i]; motorConfig[i].MotorOutput.NeutralMode = motorDisabledBrakeMode[i]; diff --git a/src/main/java/tagalong/subsystems/micro/confs/PivotConf.java b/src/main/java/tagalong/subsystems/micro/confs/PivotConf.java index b9d50d2..f809c67 100644 --- a/src/main/java/tagalong/subsystems/micro/confs/PivotConf.java +++ b/src/main/java/tagalong/subsystems/micro/confs/PivotConf.java @@ -6,7 +6,6 @@ package tagalong.subsystems.micro.confs; -import com.ctre.phoenix6.CANBus; import com.ctre.phoenix6.configs.CANcoderConfiguration; import com.ctre.phoenix6.configs.CurrentLimitsConfigs; import com.ctre.phoenix6.configs.MagnetSensorConfigs; @@ -19,7 +18,6 @@ import tagalong.controls.PIDSGVAConstants; import tagalong.devices.Encoders; import tagalong.devices.Motors; -import tagalong.devices.TagalongCANBus; import tagalong.units.AccelerationUnits; import tagalong.units.DistanceUnits; import tagalong.units.VelocityUnits; @@ -52,7 +50,7 @@ public class PivotConf extends MicrosystemConf { /** * CAN bus of the encoder */ - public final CANBus encoderCanBus; + public final String encoderCanBus; /** * Ratio between the motor and encoder */ @@ -276,7 +274,7 @@ public PivotConf( ); this.encoderType = encoderType; this.encoderDeviceID = encoderDeviceID; - this.encoderCanBus = TagalongCANBus.getOrRegisterPhoenixCANBus(encoderCanBus); + this.encoderCanBus = encoderCanBus; this.encoderToPivotRatio = super.calculateGearRatio(encoderToPivotRatio); this.motorToEncoderRatio = super.calculateGearRatio(motorToPivotRatio) / this.encoderToPivotRatio; From 09b8aa8359d57ab10f2249bd4c68440242b1302e Mon Sep 17 00:00:00 2001 From: Space Cookies Date: Fri, 30 Jan 2026 21:12:32 -0800 Subject: [PATCH 3/3] whitespace fix --- src/main/java/tagalong/devices/TagalongCANBus.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/tagalong/devices/TagalongCANBus.java b/src/main/java/tagalong/devices/TagalongCANBus.java index 9c9c815..00dff24 100644 --- a/src/main/java/tagalong/devices/TagalongCANBus.java +++ b/src/main/java/tagalong/devices/TagalongCANBus.java @@ -1,8 +1,7 @@ package tagalong.devices; -import java.util.Map; - import com.ctre.phoenix6.CANBus; +import java.util.Map; /** * Tagalong CANBus manager instance manager, only CTRE devices are currently registered or supported @@ -15,7 +14,7 @@ public class TagalongCANBus { /** * Gets or registers a CTRE CANBus instance with the given name - * + * * @param canBusName Name of the CANBus * @return CTRE CANBus instance */ @@ -30,11 +29,10 @@ public static CANBus getOrRegisterPhoenixCANBus(String canBusName) { /** * Gets the map of all registered CTRE CANBus instances - * + * * @return Map of CANBus instances */ public static Map getPhoenixCANBusMap() { return _ctreCANBus; } - }