Class SwerveRequest.SwerveDriveBrake
- All Implemented Interfaces:
SwerveRequest,SwerveRequest.NativeSwerveRequest
- Enclosing interface:
- SwerveRequest
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.ctre.phoenix6.swerve.SwerveRequest
SwerveRequest.ApplyChassisSpeeds, SwerveRequest.ApplyFieldSpeeds, SwerveRequest.ApplyRobotSpeeds, SwerveRequest.FieldCentric, SwerveRequest.FieldCentricFacingAngle, SwerveRequest.ForwardPerspectiveValue, SwerveRequest.Idle, SwerveRequest.NativeSwerveRequest, SwerveRequest.PointWheelsAt, SwerveRequest.RobotCentric, SwerveRequest.SwerveDriveBrake, SwerveRequest.SysIdSwerveRotation, SwerveRequest.SysIdSwerveSteerGains, SwerveRequest.SysIdSwerveTranslation -
Field Summary
FieldsModifier and TypeFieldDescriptionThe type of control request to use for the drive motor.The type of control request to use for the drive motor. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(SwerveDrivetrain.SwerveControlParameters parameters, SwerveModule... modulesToApply) Applies this swerve request to the given modules.voidapplyNative(int id) Applies a native swerve request to the native drivetrain with the provided ID.withDriveRequestType(SwerveModule.DriveRequestType newDriveRequestType) Modifies the DriveRequestType parameter and returns itself.withSteerRequestType(SwerveModule.SteerRequestType newSteerRequestType) Modifies the SteerRequestType parameter and returns itself.
-
Field Details
-
DriveRequestType
The type of control request to use for the drive motor. -
SteerRequestType
The type of control request to use for the drive motor.
-
-
Constructor Details
-
SwerveDriveBrake
public SwerveDriveBrake()
-
-
Method Details
-
withDriveRequestType
public SwerveRequest.SwerveDriveBrake withDriveRequestType(SwerveModule.DriveRequestType newDriveRequestType) Modifies the DriveRequestType parameter and returns itself.The type of control request to use for the drive motor.
- Parameters:
newDriveRequestType- Parameter to modify- Returns:
- this object
-
withSteerRequestType
public SwerveRequest.SwerveDriveBrake withSteerRequestType(SwerveModule.SteerRequestType newSteerRequestType) Modifies the SteerRequestType parameter and returns itself.The type of control request to use for the drive motor.
- Parameters:
newSteerRequestType- Parameter to modify- Returns:
- this object
-
apply
public StatusCode apply(SwerveDrivetrain.SwerveControlParameters parameters, SwerveModule... modulesToApply) Description copied from interface:SwerveRequestApplies this swerve request to the given modules. This is typically called by the SwerveDrivetrain odometry thread.For native swerve requests, this API can be called from a non-native request's
applyto compose the two together.- Specified by:
applyin interfaceSwerveRequest- Parameters:
parameters- Parameters the control request needs to calculate the module statemodulesToApply- Modules to which the control request is applied- Returns:
- Status code of sending the request
-
applyNative
Description copied from interface:SwerveRequest.NativeSwerveRequestApplies a native swerve request to the native drivetrain with the provided ID.When this is implemented, the regular
SwerveRequest.apply(com.ctre.phoenix6.swerve.SwerveDrivetrain.SwerveControlParameters, com.ctre.phoenix6.swerve.SwerveModule...)function should do nothing (return OK). Additionally, this cannot be called from another swerve request's apply method, as this overrides the native swerve request of the drivetrain.Unlike
SwerveRequest.apply(com.ctre.phoenix6.swerve.SwerveDrivetrain.SwerveControlParameters, com.ctre.phoenix6.swerve.SwerveModule...), this function is called every timeSwerveDrivetrain.setControl(com.ctre.phoenix6.swerve.SwerveRequest)is run, not every loop of the odometry thread. Instead, the underlying native request is run at the full update frequency of the odometry thread.- Specified by:
applyNativein interfaceSwerveRequest.NativeSwerveRequest- Parameters:
id- ID of the native swerve drivetrain
-