Skip to content

Commit

Permalink
example profile in arm
Browse files Browse the repository at this point in the history
  • Loading branch information
fodfodfod committed Nov 21, 2024
1 parent 8811e2d commit 68f8bfe
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/frc/robot/subsystems/Arm.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@
import edu.wpi.first.math.controller.ArmFeedforward;
import edu.wpi.first.math.controller.ElevatorFeedforward;
import edu.wpi.first.math.interpolation.InterpolatingDoubleTreeMap;
import edu.wpi.first.math.trajectory.TrapezoidProfile;
import edu.wpi.first.math.util.Units;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.RunCommand;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import edu.wpi.first.wpilibj2.command.TrapezoidProfileCommand;
import frc.robot.Constants.ArmConstants;
import frc.robot.Constants.ElevatorConstants;
import frc.robot.Constants.ShootingConstants.ShootingPosition;
Expand Down Expand Up @@ -169,6 +171,11 @@ public Arm() {

time.reset();
time.start();
TrapezoidProfile.Constraints constraints = new TrapezoidProfile.Constraints(0.5, 0.5);
TrapezoidProfile profile = new TrapezoidProfile(constraints);
TrapezoidProfile.State startState = new TrapezoidProfile.State(0, 0);
TrapezoidProfile.State endState = new TrapezoidProfile.State(1, 0);
armTarget = profile.calculate(5, startState, endState).position;
}

private ElevatorFeedforward getElevatorFeedforward() {
Expand Down

0 comments on commit 68f8bfe

Please sign in to comment.