Package frc.robot.Subsystems.DriveTrain
Class DriveTrainSimIO
java.lang.Object
edu.wpi.first.wpilibj2.command.SubsystemBase
frc.robot.Subsystems.DriveTrain.DriveTrain
frc.robot.Subsystems.DriveTrain.DriveTrainSimIO
- 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
instance, module_states, 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.doubleReturns the rate at which the gyro is spinning.initializeModule(int drive_port, int steer_port, int sensor_port) Creates either a SwerveModuleRealIO or SwerveModuleSimIO object.voidperiodic()voidResets the gyroscope angle to 0.Methods inherited from class frc.robot.Subsystems.DriveTrain.DriveTrain
discretize_chassis_speeds, getModulePositions, getModuleStates, getOdomSpeeds, getTargetOdomSpeeds, setAccelerationFeedforwards, setModules, setSwerveDrive, 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, simulationPeriodic, startEnd, startRun
-
Constructor Details
-
DriveTrainSimIO
protected DriveTrainSimIO()
-
-
Method Details
-
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.
-
getGyroRate
public double getGyroRate()Description copied from class:DriveTrainReturns the rate at which the gyro is spinning.- Specified by:
getGyroRatein classDriveTrain- Returns:
- The gyro rate in degrees per second.
-
resetGyroAngle
public void resetGyroAngle()Description copied from class:DriveTrainResets the gyroscope angle to 0.- Specified by:
resetGyroAnglein classDriveTrain
-
initializeModule
Description copied from class:DriveTrainCreates either a SwerveModuleRealIO or SwerveModuleSimIO object.- Specified by:
initializeModulein classDriveTrain- Parameters:
drive_port- The port number of the drive motor.steer_port- The port number of the steer motor.sensor_port- The port number of the module's CANcoder.- Returns:
- The constructed SwerveModule object.
-
periodic
public void periodic()- Specified by:
periodicin interfaceedu.wpi.first.wpilibj2.command.Subsystem- Overrides:
periodicin classDriveTrain
-