Skip to content

Commit

Permalink
R: get started feedforward tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
JJTech0130 committed Feb 9, 2024
1 parent 8c28beb commit c4daf65
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ public static double getMotorVelocityF(double ticksPerSecond) {
public static double MAX_ANG_ACCEL = Math.toRadians(360);
public static double MAX_ANG_VEL = Math.toRadians(360);
public static double TRACK_WIDTH = 12;
public static double kV = 1.0/30;

public static double rpmToVelocity(double rpm) {
return rpm * GEAR_RATIO * 2 * Math.PI * WHEEL_RADIUS / 60.0;
}
public static double kV = 1.0/rpmToVelocity(30);
public static double kA = 0.0;
public static double kStatic = 0;
public static double X_MULTIPLIER = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
import com.acmerobotics.roadrunner.profile.MotionState;
import com.acmerobotics.roadrunner.util.NanoClock;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.hardware.VoltageSensor;
import com.qualcomm.robotcore.util.RobotLog;

import org.firstinspires.ftc.robotcore.external.Telemetry;
import org.firstinspires.ftc.teamcode.drive.PsiBot;
import org.firstinspires.ftc.teamcode.drive.Robot;
import org.firstinspires.ftc.teamcode.drive.RoboticaBot;
import org.firstinspires.ftc.teamcode.drive.TrajectoryDrive;

import java.util.Objects;
Expand Down Expand Up @@ -118,7 +118,7 @@ public void runOpMode() {
}

MotionState motionState = activeProfile.get(profileTime);
double targetPower = Kinematics.calculateMotorFeedforward(motionState.getV(), motionState.getA(), PsiBot.kV, PsiBot.kA, PsiBot.kStatic);
double targetPower = Kinematics.calculateMotorFeedforward(motionState.getV(), motionState.getA(), RoboticaBot.kV, RoboticaBot.kA, RoboticaBot.kStatic);


final double NOMINAL_VOLTAGE = 12.0;
Expand Down

0 comments on commit c4daf65

Please sign in to comment.