Skip to content

Commit

Permalink
Add Method to drive Field Oriented and Robot Oriented at the same time
Browse files Browse the repository at this point in the history
  • Loading branch information
Technologyman00 committed Mar 24, 2024
1 parent 235c436 commit e58d6bd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/java/swervelib/SwerveDrive.java
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,19 @@ public void setHeadingCorrection(boolean state, double deadband)
HEADING_CORRECTION_DEADBAND = deadband;
}

/**
* Tertiary method of controlling the drive base given velocity in both field oriented and robot oriented at the same time.
* The inputs are added together so this is not intneded to be used to give the driver both methods of control.
*
* @param fieldOrientedVelocity The field oriented velocties to use
* @param robotOrientedVelocity The robot oriented velocties to use
*/
public void driveFieldOrientedandRobotOriented(ChassisSpeeds fieldOrientedVelocity, ChassisSpeeds robotOrientedVelocity)
{
ChassisSpeeds TotalVelocties = ChassisSpeeds.fromFieldRelativeSpeeds(fieldOrientedVelocity, getOdometryHeading()).plus(robotOrientedVelocity);
drive(TotalVelocties);
}

/**
* Secondary method of controlling the drive base given velocity and adjusting it for field oriented use.
*
Expand Down

0 comments on commit e58d6bd

Please sign in to comment.