Skip to content
This repository has been archived by the owner on Nov 10, 2024. It is now read-only.

Commit

Permalink
pid okkey
Browse files Browse the repository at this point in the history
  • Loading branch information
MorphaxTheDeveloper committed Mar 15, 2024
1 parent 4f4510d commit 91189ae
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
8 changes: 4 additions & 4 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ private void configureBindings() {
new JoystickButton(subJoytick, 2).whileFalse(new InstantCommand(()->m_intake.StopNoteMotor()));

//buton 3 Shooter Manuel subbuffer
//new JoystickButton(subJoytick, 3).whileTrue(new VisionShooter(m_shooter, m_network));
new JoystickButton(subJoytick, 3).whileTrue(new InstantCommand(()-> m_shooter.ShooterThrowMotorOutput(-1)));
new JoystickButton(subJoytick, 3).whileFalse(new InstantCommand(()-> m_shooter.ShooterThrow1MotorStop()));
new JoystickButton(subJoytick, 3).whileFalse(new InstantCommand(()-> m_shooter.ShooterThrow2MotorStop()));
new JoystickButton(subJoytick, 3).whileTrue(new VisionShooter(m_shooter, m_network));
new JoystickButton(subJoytick, 7).whileTrue(new InstantCommand(()-> m_shooter.ShooterThrowMotorOutput(-1)));
new JoystickButton(subJoytick, 7).whileFalse(new InstantCommand(()-> m_shooter.ShooterThrow1MotorStop()));
new JoystickButton(subJoytick, 7).whileFalse(new InstantCommand(()-> m_shooter.ShooterThrow2MotorStop()));

//button 4 Shooter oto aim ve hız
// new JoystickButton(subJoytick, 3).whileTrue(new ShooterSetDegree(m_shooter, ()->70.0));
Expand Down
9 changes: 2 additions & 7 deletions src/main/java/frc/robot/commands/Shooter/VisionShooter.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ public VisionShooter(ShooterSubsystem m_shooter, NetworkSubsystem m_network) {
super(

new PIDController(0.004,
0,
0.01,
Constants.values.shooter.PidShooterAngleKD),
() -> m_network.getY(),
() -> -165,
() -> m_network.getTarget(),
output -> {
/* try {
m_shooter.ShooterAngleMotorOutput(output * .13);
Expand All @@ -26,11 +26,6 @@ public VisionShooter(ShooterSubsystem m_shooter, NetworkSubsystem m_network) {
e.printStackTrace();
}*/






m_shooter.ShooterAngleMotorOutput(output * .13);
});

Expand Down
15 changes: 8 additions & 7 deletions src/main/java/frc/robot/subsystems/NetworkSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class NetworkSubsystem extends SubsystemBase {

double apriltag_x_value;
double apriltag_y_value;
boolean has_apriltag_value;
double apriltag_target_value;


public NetworkTableInstance inst = NetworkTableInstance.getDefault();
Expand All @@ -26,17 +26,17 @@ public class NetworkSubsystem extends SubsystemBase {
//entry
public NetworkTableEntry apriltag_x = networkTable.getEntry("apriltag_x");
public NetworkTableEntry apriltag_y = networkTable.getEntry("apriltag_y");
public NetworkTableEntry has_apriltag = networkTable.getEntry("has_apriltag");
public NetworkTableEntry apriltag_target = networkTable.getEntry("apriltag_target");

public NetworkSubsystem() {
// inst.setServerTeam(7672);
//inst.startServer("10.76.72.2");
inst.setServerTeam(7672);
}

public boolean hasApriltag(){
return has_apriltag_value;
}
public double getTarget(){
return apriltag_target_value;
}

public double getX(){
return apriltag_x_value;
Expand All @@ -50,9 +50,10 @@ public double getY(){
public void periodic() {
apriltag_x_value = apriltag_x.getDouble(0.0);
apriltag_y_value = apriltag_y.getDouble(0.0);
has_apriltag_value = has_apriltag.getBoolean(false);
apriltag_target_value = apriltag_target.getDouble(0.0);


SmartDashboard.putBoolean("Has apriltag", has_apriltag_value);
SmartDashboard.putNumber("target", apriltag_target_value);
SmartDashboard.putNumber("apriltag x value", apriltag_x_value);
SmartDashboard.putNumber("apriltag y value", apriltag_y_value);
SmartDashboard.putBoolean("connection",inst.isConnected());
Expand Down

0 comments on commit 91189ae

Please sign in to comment.