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.Rotation2dGets 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.voidperiodic()voidMethods inherited from class frc.robot.subsystems.DriveTrain.DriveTrain
discretize_chassis_speeds, getModulePositions, getModuleStates, setModules, setSwerveDrive, setSwerveDriveMethods inherited from class edu.wpi.first.wpilibj2.command.SubsystemBase
addChild, getName, getSubsystem, initSendable, setName, setSubsystemMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:DriveTrainCreates either a SwerveModuleRealIO or SwerveModuleSimIO object.- Specified by:
initializeModulein 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:DriveTrainGets either the measured yaw from the AHRS or the calculated angle from the simulation. Forward is 0, CCW is positive.- Specified by:
getGyroAnglein classDriveTrain- Returns:
- The robot yaw.
-
periodic
public void periodic()- Specified by:
periodicin interfaceedu.wpi.first.wpilibj2.command.Subsystem- Overrides:
periodicin classDriveTrain
-
simulationPeriodic
public void simulationPeriodic()- Specified by:
simulationPeriodicin interfaceedu.wpi.first.wpilibj2.command.Subsystem- Overrides:
simulationPeriodicin classDriveTrain
-