Package frc.robot.subsystems.DriveTrain
Class DriveTrainRealIO
java.lang.Object
edu.wpi.first.wpilibj2.command.SubsystemBase
frc.robot.subsystems.DriveTrain.DriveTrain
frc.robot.subsystems.DriveTrain.DriveTrainRealIO
- All Implemented Interfaces:
edu.wpi.first.util.sendable.Sendable
,edu.wpi.first.wpilibj2.command.Subsystem
-
Field Summary
Fields inherited from class frc.robot.subsystems.DriveTrain.DriveTrain
adv_gyro_pub, adv_real_states_pub, adv_target_states_pub, m_module_states, m_modules
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionedu.wpi.first.math.geometry.Rotation2d
Gets either the measured yaw from the AHRS or the calculated angle from the simulation.initializeModule
(int drive_port, int steer_port, int sensor_port) Creates either a SwerveModuleRealIO or SwerveModuleSimIO object.void
periodic()
void
Methods inherited from class frc.robot.subsystems.DriveTrain.DriveTrain
discretize_chassis_speeds, getModulePositions, getModuleStates, setModules, setSwerveDrive, setSwerveDrive
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, startEnd
-
Constructor Details
-
DriveTrainRealIO
public DriveTrainRealIO()
-
-
Method Details
-
initializeModule
Description copied from class:DriveTrain
Creates either a SwerveModuleRealIO or SwerveModuleSimIO object.- Specified by:
initializeModule
in classDriveTrain
- Parameters:
drive_port
- port number of the drive motorsteer_port
- port number of the steer motorsensor_port
- port number of the module's CANcoder- Returns:
- The constructed SwerveModule object
-
getGyroAngle
public edu.wpi.first.math.geometry.Rotation2d getGyroAngle()Description copied from class:DriveTrain
Gets either the measured yaw from the AHRS or the calculated angle from the simulation. Forward is 0, CCW is positive.- Specified by:
getGyroAngle
in classDriveTrain
- Returns:
- The robot yaw.
-
periodic
public void periodic()- Specified by:
periodic
in interfaceedu.wpi.first.wpilibj2.command.Subsystem
- Overrides:
periodic
in classDriveTrain
-
simulationPeriodic
public void simulationPeriodic()- Specified by:
simulationPeriodic
in interfaceedu.wpi.first.wpilibj2.command.Subsystem
- Overrides:
simulationPeriodic
in classDriveTrain
-