Skip to content

Commit

Permalink
started on motion magic and current limiting
Browse files Browse the repository at this point in the history
  • Loading branch information
GearBoxFox committed Feb 7, 2024
1 parent ed7ccde commit 8910521
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/frc/robot/subsystems/arm/ArmIOPrototype.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.ctre.phoenix6.controls.PositionVoltage;
import com.ctre.phoenix6.hardware.TalonFX;
import com.ctre.phoenix6.signals.GravityTypeValue;
import edu.wpi.first.math.util.Units;
import lib.properties.phoenix6.Phoenix6PidPropertyBuilder;
import lib.properties.phoenix6.PidPropertyPublic;
import org.littletonrobotics.junction.Logger;
Expand All @@ -28,12 +29,20 @@ public ArmIOPrototype() {
m_wrist = new TalonFX(24);

TalonFXConfiguration config = new TalonFXConfiguration();
// config for the shoulder joint
config.Feedback.SensorToMechanismRatio = 125.0 * (60.0 / 18.0);

config.CurrentLimits.
config.Voltage.PeakForwardVoltage = 12;
config.Voltage.PeakReverseVoltage = -12;

// motion magic configs for both joints
config.MotionMagic.MotionMagicCruiseVelocity = Units.degreesToRotations(360);
config.MotionMagic.MotionMagicAcceleration = Units.degreesToRotations(720);

m_shoulder.getConfigurator().apply(config);

// wrist joint config
config.Feedback.SensorToMechanismRatio = 125.0 * (38.0 / 18.0);
m_wrist.getConfigurator().apply(config);

Expand Down

0 comments on commit 8910521

Please sign in to comment.