Package com.marswars.swerve_lib
Class ChassisRequest.ApplyChassisSpeeds
java.lang.Object
com.marswars.swerve_lib.ChassisRequest.ApplyChassisSpeeds
- All Implemented Interfaces:
ChassisRequest
- Enclosing interface:
- ChassisRequest
Accepts a generic ChassisSpeeds to apply to the drivetrain.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.marswars.swerve_lib.ChassisRequest
ChassisRequest.ApplyChassisSpeeds, ChassisRequest.ApplyFieldSpeeds, ChassisRequest.ChassisRequestParameters, ChassisRequest.FieldCentric, ChassisRequest.FieldCentricFacingAngle, ChassisRequest.Idle, ChassisRequest.PointWheelsAt, ChassisRequest.RobotCentric, ChassisRequest.RobotCentricFacingAngle, ChassisRequest.SwerveDriveBrake, ChassisRequest.XPositiveReference -
Field Summary
FieldsModifier and TypeFieldDescriptionThe center of rotation to rotate around.The type of control request to use for the drive motor.The chassis speeds to apply to the drivetrain.The type of control request to use for the steer motor. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(ChassisRequest.ChassisRequestParameters parameters, Module... modulesToApply) Applies this swerve request to the given modules.withCenterOfRotation(Translation2d centerOfRotation) Sets the center of rotation to rotate around.withDriveRequestType(Module.DriveControlMode driveRequestType) Sets the type of control request to use for the drive motor.withSpeeds(ChassisSpeeds speeds) Sets the chassis speeds to apply to the drivetrain.withSteerRequestType(Module.SteerControlMode steerRequestType) Sets the type of control request to use for the steer motor.
-
Field Details
-
Speeds
The chassis speeds to apply to the drivetrain. -
CenterOfRotation
The center of rotation to rotate around. -
DriveRequestType
The type of control request to use for the drive motor. -
SteerRequestType
The type of control request to use for the steer motor.
-
-
Constructor Details
-
ApplyChassisSpeeds
public ApplyChassisSpeeds()
-
-
Method Details
-
apply
Applies this swerve request to the given modules. This is typically called by the SwerveDrivetrain.- Specified by:
applyin interfaceChassisRequest- Parameters:
parameters- Parameters the control request needs to calculate the module statemodulesToApply- Modules to which the control request is applied
-
withSpeeds
Sets the chassis speeds to apply to the drivetrain.- Parameters:
speeds- Chassis speeds to apply to the drivetrain- Returns:
- this request
-
withCenterOfRotation
Sets the center of rotation to rotate around.- Parameters:
centerOfRotation- Center of rotation to rotate around- Returns:
- this request
-
withDriveRequestType
public ChassisRequest.ApplyChassisSpeeds withDriveRequestType(Module.DriveControlMode driveRequestType) Sets the type of control request to use for the drive motor.- Parameters:
driveRequestType- The type of control request to use for the drive motor- Returns:
- this request
-
withSteerRequestType
public ChassisRequest.ApplyChassisSpeeds withSteerRequestType(Module.SteerControlMode steerRequestType) Sets the type of control request to use for the steer motor.- Parameters:
steerRequestType- The type of control request to use for the steer motor- Returns:
- this request
-