Class SwerveModuleSubsystem
java.lang.Object
edu.wpi.first.wpilibj2.command.SubsystemBase
xbot.common.command.BaseSubsystem
xbot.common.subsystems.drive.swerve.SwerveModuleSubsystem
- All Implemented Interfaces:
Sendable
,Subsystem
,DataFrameRefreshable
,IPropertySupport
-
Field Summary
Fields inherited from class xbot.common.command.BaseSubsystem
aKitLog, dataFrameRefreshables
-
Constructor Summary
ConstructorDescriptionSwerveModuleSubsystem
(SwerveInstance swerveInstance, SwerveDriveSubsystem driveSubsystem, SwerveSteeringSubsystem steeringSubsystem, XSwerveDriveElectricalContract contract, PropertyFactory pf) -
Method Summary
Modifier and TypeMethodDescriptionGets the current state of the module, in METRIC UNITS.void
Consumes and processes inputs from the device or subsystem.void
void
setNoviceMode
(boolean enabled) void
setPowers
(double drivePower, double steeringPower) Very basic drive method - bypasses all PID to directly control the motors.void
setTargetState
(SwerveModuleState swerveModuleState) Sets the target steering angle and drive power for this module, in METRIC UNITS.Methods inherited from class xbot.common.command.BaseSubsystem
periodic, registerDataFrameRefreshable
Methods inherited from class edu.wpi.first.wpilibj2.command.SubsystemBase
addChild, getName, getSubsystem, initSendable, setName, setSubsystem
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface edu.wpi.first.wpilibj2.command.Subsystem
defer, getCurrentCommand, getDefaultCommand, register, removeDefaultCommand, run, runEnd, runOnce, setDefaultCommand, simulationPeriodic, startEnd, startRun
-
Constructor Details
-
SwerveModuleSubsystem
@Inject public SwerveModuleSubsystem(SwerveInstance swerveInstance, SwerveDriveSubsystem driveSubsystem, SwerveSteeringSubsystem steeringSubsystem, XSwerveDriveElectricalContract contract, PropertyFactory pf)
-
-
Method Details
-
setTargetState
Sets the target steering angle and drive power for this module, in METRIC UNITS.- Parameters:
swerveModuleState
- Metric swerve module state
-
getCurrentState
Gets the current state of the module, in METRIC UNITS.- Returns:
- Metric swerve module state
-
getCurrentPosition
-
getTargetState
-
getPrefix
- Specified by:
getPrefix
in interfaceIPropertySupport
- Overrides:
getPrefix
in classBaseSubsystem
-
getModuleTranslation
-
getDriveSubsystem
-
getSteeringSubsystem
-
setNoviceMode
public void setNoviceMode(boolean enabled) -
setPowers
public void setPowers(double drivePower, double steeringPower) Very basic drive method - bypasses all PID to directly control the motors. Ensure that your command has required control of all relevant subsystems before doing this, or you will be fighting the maintainers.- Parameters:
drivePower
- -1 to 1 value for nodule wheel powersteeringPower
- -1 to 1 value for module rotation power
-
setDriveCurrentLimits
-
refreshDataFrame
public void refreshDataFrame()Description copied from interface:DataFrameRefreshable
Consumes and processes inputs from the device or subsystem.- Specified by:
refreshDataFrame
in interfaceDataFrameRefreshable
- Overrides:
refreshDataFrame
in classBaseSubsystem
-