Skip to content

Commit

Permalink
WIP arm/gripper
Browse files Browse the repository at this point in the history
  • Loading branch information
ArmedBot22 committed Dec 7, 2023
1 parent d6ed271 commit e018d49
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
7 changes: 7 additions & 0 deletions simgui.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,12 @@
"/SmartDashboard/Field": "Field2d",
"/SmartDashboard/SendableChooser[0]": "String Chooser"
}
},
"NetworkTables": {
"transitory": {
"SmartDashboard": {
"open": true
}
}
}
}
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/commands/ArmCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class ArmCommand extends CommandBase {
16; // to reduce stick sensitivity, this value indicates how much to scale the returned speed
// by
private final double m_minBaseRange = 0; // min range for the arm's base
private final double m_maxBaseRange = 1; // max range for the arm's base
private final double m_maxBaseRange = 0.5; // max range for the arm's base

public ArmCommand(Arm arm, DoubleSupplier baseSpeed) {
m_arm = arm;
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/frc/robot/commands/GripperCommand.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package frc.robot.commands;

import edu.wpi.first.math.MathUtil;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.CommandBase;
import frc.robot.subsystems.Gripper;
import java.util.function.DoubleSupplier;
Expand All @@ -21,7 +22,7 @@ public class GripperCommand extends CommandBase {
// to prevent stick drift, this value sets the min absolute value the speed needs to be
// before we assume it is not zero
private final double m_speedScale =
16; // to reduce stick sensitivity, this value indicates how much to scale the returned speed
64; // to reduce stick sensitivity, this value indicates how much to scale the returned speed
// by
private final double m_minBaseRange = 0; // min range for the gripper's base
private final double m_maxBaseRange = 1; // max range for the gripper's base
Expand Down Expand Up @@ -60,5 +61,8 @@ public void execute() {

// Finally, set the gripper base positon to the new calculated gripper position.
m_gripper.setClawPosition(newClawPosition);

SmartDashboard.putNumber("Gripper Position", m_gripper.getClawPosition());
SmartDashboard.putNumber("New Gripper Position", newClawPosition);
}
}
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/subsystems/Arm.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class Arm extends SubsystemBase {
// This code assumes we are using the ROMI's external IO configuration and the arm base servo is
// connected to Romi Pin EXT4 which is configured as PWM and mapped to port 3
// https://docs.wpilib.org/en/stable/docs/romi-robot/web-ui.html#external-io-configuration
private final Servo m_armBaseServo = new Servo(3);
private final Servo m_armBaseServo = new Servo(2);

// Note: If you have a multi-axis arm, you could create another Servo object using a differemt PWM
// channel and add the corresponding methods for controlling the position.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/subsystems/Gripper.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class Gripper extends SubsystemBase {
// This code assumes we are using the ROMI's external IO configuration and the arm claw servo is
// connected to Romi Pin EXT4 which is configured as PWM and mapped to port 2
// https://docs.wpilib.org/en/stable/docs/romi-robot/web-ui.html#external-io-configuration
private final Servo m_armClawServo = new Servo(2);
private final Servo m_armClawServo = new Servo(3);

// Note: If you have a multi-axis arm, you could create another Servo object using a differemt PWM
// channel and add the corresponding methods for controlling the position.
Expand Down

0 comments on commit e018d49

Please sign in to comment.