mirror of
https://github.com/Team4388/2022NoWayHome.git
synced 2026-06-09 00:38:05 -06:00
Switched hook motors
This commit is contained in:
@@ -1,31 +1,36 @@
|
||||
package frc4388.robot.subsystems;
|
||||
|
||||
import edu.wpi.first.wpilibj.Servo;
|
||||
import com.revrobotics.CANSparkMax;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.SubsystemBase;
|
||||
import frc4388.robot.Constants.HooksConstants;
|
||||
|
||||
public class Hooks extends SubsystemBase {
|
||||
private Servo m_leftHook;
|
||||
private Servo m_rightHook;
|
||||
private CANSparkMax m_leftHook;
|
||||
private CANSparkMax m_rightHook;
|
||||
|
||||
double m_leftOffset;
|
||||
double m_rightOffset;
|
||||
|
||||
private boolean m_open;
|
||||
|
||||
public Hooks(Servo leftHook, Servo rightHook) {
|
||||
public Hooks(CANSparkMax leftHook, CANSparkMax rightHook) {
|
||||
m_leftHook = leftHook;
|
||||
m_rightHook = rightHook;
|
||||
|
||||
m_open = false;
|
||||
setOpen(m_open);
|
||||
setOpen(false);
|
||||
}
|
||||
|
||||
public void setOpen(boolean open) {
|
||||
if(open) {
|
||||
m_leftHook.setPosition(HooksConstants.OPEN_POSITION);
|
||||
m_rightHook.setPosition(HooksConstants.OPEN_POSITION);
|
||||
m_leftHook.getEncoder().setPosition(HooksConstants.OPEN_POSITION + m_leftOffset);
|
||||
m_rightHook.getEncoder().setPosition(HooksConstants.OPEN_POSITION + m_rightOffset);
|
||||
} else {
|
||||
m_leftHook.setPosition(HooksConstants.CLOSE_POSITION);
|
||||
m_rightHook.setPosition(HooksConstants.CLOSE_POSITION);
|
||||
m_leftHook.getEncoder().setPosition(HooksConstants.CLOSE_POSITION + m_leftOffset);
|
||||
m_rightHook.getEncoder().setPosition(HooksConstants.CLOSE_POSITION + m_rightOffset);
|
||||
}
|
||||
|
||||
m_open = open;
|
||||
}
|
||||
|
||||
public boolean getOpen() {
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"fileName": "REVLib.json",
|
||||
"name": "REVLib",
|
||||
"version": "2022.1.1",
|
||||
"uuid": "3f48eb8c-50fe-43a6-9cb7-44c86353c4cb",
|
||||
"mavenUrls": [
|
||||
"https://maven.revrobotics.com/"
|
||||
],
|
||||
"jsonUrl": "https://software-metadata.revrobotics.com/REVLib.json",
|
||||
"javaDependencies": [
|
||||
{
|
||||
"groupId": "com.revrobotics.frc",
|
||||
"artifactId": "REVLib-java",
|
||||
"version": "2022.1.1"
|
||||
}
|
||||
],
|
||||
"jniDependencies": [
|
||||
{
|
||||
"groupId": "com.revrobotics.frc",
|
||||
"artifactId": "REVLib-driver",
|
||||
"version": "2022.1.1",
|
||||
"skipInvalidPlatforms": true,
|
||||
"isJar": false,
|
||||
"validPlatforms": [
|
||||
"windowsx86-64",
|
||||
"windowsx86",
|
||||
"linuxaarch64bionic",
|
||||
"linuxx86-64",
|
||||
"linuxathena",
|
||||
"linuxraspbian",
|
||||
"osxx86-64"
|
||||
]
|
||||
}
|
||||
],
|
||||
"cppDependencies": [
|
||||
{
|
||||
"groupId": "com.revrobotics.frc",
|
||||
"artifactId": "REVLib-cpp",
|
||||
"version": "2022.1.1",
|
||||
"libName": "REVLib",
|
||||
"headerClassifier": "headers",
|
||||
"sharedLibrary": false,
|
||||
"skipInvalidPlatforms": true,
|
||||
"binaryPlatforms": [
|
||||
"windowsx86-64",
|
||||
"windowsx86",
|
||||
"linuxaarch64bionic",
|
||||
"linuxx86-64",
|
||||
"linuxathena",
|
||||
"linuxraspbian",
|
||||
"osxx86-64"
|
||||
]
|
||||
},
|
||||
{
|
||||
"groupId": "com.revrobotics.frc",
|
||||
"artifactId": "REVLib-driver",
|
||||
"version": "2022.1.1",
|
||||
"libName": "REVLibDriver",
|
||||
"headerClassifier": "headers",
|
||||
"sharedLibrary": false,
|
||||
"skipInvalidPlatforms": true,
|
||||
"binaryPlatforms": [
|
||||
"windowsx86-64",
|
||||
"windowsx86",
|
||||
"linuxaarch64bionic",
|
||||
"linuxx86-64",
|
||||
"linuxathena",
|
||||
"linuxraspbian",
|
||||
"osxx86-64"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user