001/**
002 * Copyright 2024 The Space Cookies : Girl Scout Troop #62868 and FRC Team #1868
003 * Open Source Software; you may modify and/or share it under the terms of
004 * the 3-Clause BSD License found in the root directory of this project.
005 */
006
007package tagalong.controls;
008
009import edu.wpi.first.math.controller.ArmFeedforward;
010import edu.wpi.first.math.controller.ElevatorFeedforward;
011import edu.wpi.first.math.controller.SimpleMotorFeedforward;
012
013/**
014 * Wrapper class for FeedForward coefficients for generic reuse or conversion
015 * between multiple devices
016 */
017public class FeedforwardConstants {
018  /**
019   * FeedForward coefficient S or static in volts
020   */
021  public final double s;
022  /**
023   * FeedForward coefficient G or gravity in volts
024   */
025  public final double g;
026  /**
027   * FeedForward coefficient V or velocity in volts per unit of velocity
028   */
029  public final double v;
030  /**
031   * FeedForward coefficient A or acceleration in volts per unit of acceleration
032   */
033  public final double a;
034
035  /**
036   * @return Constants converted to an ElevatorFeedforward
037   */
038  public ElevatorFeedforward getElevatorFeedforward() {
039    return new ElevatorFeedforward(s, g, v, a);
040  }
041
042  /**
043   * @return Constants converted to an ArmFeedforward
044   */
045  public ArmFeedforward getArmFeedforward() {
046    return new ArmFeedforward(s, g, v, a);
047  }
048
049  /**
050   *
051   * @return Constants converted to a SimpleMotorFeedforward
052   */
053  public SimpleMotorFeedforward getSimpleMotorFeedforward() {
054    return new SimpleMotorFeedforward(s, v, a);
055  }
056
057  /**
058   *
059   * @param s FeedForward coefficient S or static in volts
060   * @param g FeedForward coefficient G or gravity in volts
061   * @param v FeedForward coefficient V or velocity in volts per unit of velocity
062   * @param a FeedForward coefficient A or acceleration in volts per unit of
063   *          acceleration
064   */
065  public FeedforwardConstants(double s, double g, double v, double a) {
066    this.s = s;
067    this.g = g;
068    this.v = v;
069    this.a = a;
070  }
071}