Package com.marswars.swerve_lib
Class ChassisRequest.ApplyFieldSpeeds
java.lang.Object
com.marswars.swerve_lib.ChassisRequest.ApplyFieldSpeeds
- All Implemented Interfaces:
ChassisRequest
- Enclosing interface:
- ChassisRequest
Accepts a generic Field Relative 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 the robot should 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 of the requestwithDriveRequestType(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 the robot should rotate around. This is (0,0) by default, which will rotate around the center of the robot. -
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
-
ApplyFieldSpeeds
public ApplyFieldSpeeds()
-
-
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 of the request- Parameters:
centerOfRotation- The center of rotation the robot should rotate around.- Returns:
- this request
-
withDriveRequestType
public ChassisRequest.ApplyFieldSpeeds 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.ApplyFieldSpeeds 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
-