Updated support for Talons

This commit is contained in:
thenetworkgrinch
2023-02-13 17:21:24 -06:00
parent e8d248b68a
commit 8f28956426
126 changed files with 5706 additions and 190 deletions

View File

@@ -1,16 +1,19 @@
package frc.robot.subsystems.swervedrive2.swervelib.parser.json;
package swervelib.parser.json;
import edu.wpi.first.math.util.Units;
import frc.robot.subsystems.swervedrive2.swervelib.encoders.SwerveAbsoluteEncoder;
import frc.robot.subsystems.swervedrive2.swervelib.motors.SwerveMotor;
import frc.robot.subsystems.swervedrive2.swervelib.parser.PIDFConfig;
import frc.robot.subsystems.swervedrive2.swervelib.parser.SwerveModuleConfiguration;
import frc.robot.subsystems.swervedrive2.swervelib.parser.SwerveModulePhysicalCharacteristics;
import frc.robot.subsystems.swervedrive2.swervelib.parser.json.modules.BoolMotorJson;
import frc.robot.subsystems.swervedrive2.swervelib.parser.json.modules.LocationJson;
import swervelib.encoders.CANCoderSwerve;
import swervelib.encoders.SwerveAbsoluteEncoder;
import swervelib.motors.SwerveMotor;
import swervelib.motors.TalonFXSwerve;
import swervelib.motors.TalonSRXSwerve;
import swervelib.parser.PIDFConfig;
import swervelib.parser.SwerveModuleConfiguration;
import swervelib.parser.SwerveModulePhysicalCharacteristics;
import swervelib.parser.json.modules.BoolMotorJson;
import swervelib.parser.json.modules.LocationJson;
/**
* {@link frc.robot.subsystems.swervedrive2.swervelib.SwerveModule} JSON parsed class. Used to access the JSON data.
* {@link swervelib.SwerveModule} JSON parsed class. Used to access the JSON data.
*/
public class ModuleJson
{
@@ -65,6 +68,10 @@ public class ModuleJson
{
absEncoder = angle.createIntegratedEncoder(angleMotor);
angleMotor.setAbsoluteEncoder(absEncoder);
} else if ((angleMotor instanceof TalonFXSwerve || angleMotor instanceof TalonSRXSwerve) &&
absEncoder instanceof CANCoderSwerve)
{
angleMotor.setAbsoluteEncoder(absEncoder);
}
return new SwerveModuleConfiguration(drive.createMotor(true), angleMotor, absEncoder,