-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Yotam- make elbow which works for both simulation and real, robot typ…
…e constant, ElbowFactory
- Loading branch information
Showing
5 changed files
with
58 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package subsystems.elbow; | ||
|
||
import edu.wpi.first.math.geometry.Rotation2d; | ||
|
||
public class Elbow implements IElbow { | ||
|
||
private IElbow iElbow; | ||
|
||
public Elbow(){ | ||
iElbow =Factory.create(); | ||
} | ||
|
||
@Override | ||
public Rotation2d getAngle() { | ||
return iElbow.getAngle(); | ||
} | ||
|
||
@Override | ||
public double getRPMVelocity() { | ||
return iElbow.getRPMVelocity(); | ||
} | ||
|
||
@Override | ||
public void setPower(double power) { | ||
iElbow.setPower(power); | ||
} | ||
|
||
@Override | ||
public void goToPosition(Rotation2d position) { | ||
iElbow.goToPosition(position); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package subsystems.elbow; | ||
|
||
import subsystems.elbow.neoElbow.NeoElbow; | ||
import subsystems.elbow.simulationElbow.SimulationElbow; | ||
import training.Robot; | ||
|
||
public class Factory { | ||
|
||
public static IElbow create(){ | ||
return switch (Robot.ROBOT_TYPE){ | ||
case REAL -> new NeoElbow(); | ||
case SIMULATION -> new SimulationElbow(); | ||
}; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters