Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
elevator
Browse files Browse the repository at this point in the history
  • Loading branch information
raghavsial committed Nov 21, 2024
1 parent 8f9e540 commit 4426ac2
Show file tree
Hide file tree
Showing 20 changed files with 108 additions and 37 deletions.
6 changes: 4 additions & 2 deletions .pathplanner/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"robotWidth": 0.97,
"robotLength": 0.97,
"holonomicMode": true,
"pathFolders": [],
"holonomicMode": false,
"pathFolders": [
"Main Season Paths"
],
"autoFolders": [],
"defaultMaxVel": 3.0,
"defaultMaxAccel": 3.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"rotateFast": true
},
"reversed": false,
"folder": null,
"folder": "Main Season Paths",
"previewStartingState": {
"rotation": 60.0,
"velocity": 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"rotateFast": true
},
"reversed": false,
"folder": null,
"folder": "Main Season Paths",
"previewStartingState": null,
"useDefaultConstraints": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"rotateFast": false
},
"reversed": false,
"folder": null,
"folder": "Main Season Paths",
"previewStartingState": {
"rotation": -31.5,
"velocity": 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"rotateFast": true
},
"reversed": false,
"folder": null,
"folder": "Main Season Paths",
"previewStartingState": {
"rotation": -60.0,
"velocity": 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"rotateFast": false
},
"reversed": false,
"folder": null,
"folder": "Main Season Paths",
"previewStartingState": {
"rotation": -60.0,
"velocity": 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"rotateFast": false
},
"reversed": false,
"folder": null,
"folder": "Main Season Paths",
"previewStartingState": null,
"useDefaultConstraints": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"rotateFast": true
},
"reversed": false,
"folder": null,
"folder": "Main Season Paths",
"previewStartingState": {
"rotation": 31.5,
"velocity": 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"rotateFast": false
},
"reversed": false,
"folder": null,
"folder": "Main Season Paths",
"previewStartingState": {
"rotation": 0.0,
"velocity": 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"rotateFast": false
},
"reversed": false,
"folder": null,
"folder": "Main Season Paths",
"previewStartingState": null,
"useDefaultConstraints": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"rotateFast": false
},
"reversed": false,
"folder": null,
"folder": "Main Season Paths",
"previewStartingState": {
"rotation": 0,
"velocity": 0
Expand Down
52 changes: 52 additions & 0 deletions src/main/deploy/pathplanner/paths/New Path.path
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"version": 1.0,
"waypoints": [
{
"anchor": {
"x": 1.3005404928188775,
"y": 5.578111669043852
},
"prevControl": null,
"nextControl": {
"x": 2.3005404928188744,
"y": 5.578111669043852
},
"isLocked": false,
"linkedName": null
},
{
"anchor": {
"x": 4.411185574507901,
"y": 6.805997885500045
},
"prevControl": {
"x": 4.49304465560498,
"y": 5.81199475789265
},
"nextControl": null,
"isLocked": false,
"linkedName": null
}
],
"rotationTargets": [],
"constraintZones": [],
"eventMarkers": [],
"globalConstraints": {
"maxVelocity": 3.0,
"maxAcceleration": 3.0,
"maxAngularVelocity": 540.0,
"maxAngularAcceleration": 720.0
},
"goalEndState": {
"velocity": 0,
"rotation": 0,
"rotateFast": false
},
"reversed": false,
"folder": null,
"previewStartingState": {
"rotation": 0,
"velocity": 0
},
"useDefaultConstraints": true
}
2 changes: 1 addition & 1 deletion src/main/deploy/pathplanner/paths/Playoff Path 1.path
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"rotateFast": true
},
"reversed": false,
"folder": null,
"folder": "Main Season Paths",
"previewStartingState": {
"rotation": 0,
"velocity": 0
Expand Down
2 changes: 1 addition & 1 deletion src/main/deploy/pathplanner/paths/Playoff Path 3.path
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"rotateFast": false
},
"reversed": false,
"folder": null,
"folder": "Main Season Paths",
"previewStartingState": null,
"useDefaultConstraints": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"rotateFast": true
},
"reversed": false,
"folder": null,
"folder": "Main Season Paths",
"previewStartingState": {
"rotation": 31.5,
"velocity": 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"rotateFast": false
},
"reversed": false,
"folder": null,
"folder": "Main Season Paths",
"previewStartingState": {
"rotation": 31.5,
"velocity": 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"rotateFast": true
},
"reversed": false,
"folder": null,
"folder": "Main Season Paths",
"previewStartingState": {
"rotation": 31.5,
"velocity": 0
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/com/team766/robot/rookie_bot/OI.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.team766.hal.RobotProvider;
import com.team766.logging.Category;
import com.team766.robot.example.procedures.*;
import com.team766.robot.rookie_bot.mechanisms.Intake;
import com.team766.robot.rookie_bot.procedures.PIDElevator;

/**
Expand Down Expand Up @@ -42,13 +43,13 @@ public void run(final Context context) {
context.startAsync(new PIDElevator(true));
}
if(joystick0.getAxis(2)>=0.5 && joystick0.getAxis(3)<0.1){
Robot.Intake.inout(true);
Robot.Intake.inout(Intake.State.IN);
}
else if(joystick0.getAxis(3)>=0.5 && joystick0.getAxis(2)<0.1){
Robot.Intake.inout(false);
Robot.Intake.inout(Intake.State.OUT);
}
else{

Robot.Intake.inout(Intake.State.STOP);
}
// Add driver controls here - make sure to take/release ownership
// of mechanisms when appropriate.
Expand Down
46 changes: 31 additions & 15 deletions src/main/java/com/team766/robot/rookie_bot/mechanisms/Intake.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,47 @@


public class Intake extends Mechanism {

public enum State {
IN,
OUT,
STOP
}

public MotorController intakeWheelLeft;
public MotorController intakeWheelRight;
double leftPowerIntake= 0.75;
double rightPowerIntake= -0.75;
double Power= -0.35;
public Intake(){
intakeWheelLeft = RobotProvider.instance.getMotor("intakeWheelLeft");
intakeWheelRight = RobotProvider.instance.getMotor("intakeWheelRight");
}
public void intake() {

intakeWheelLeft.set(leftPowerIntake);
intakeWheelRight.set(rightPowerIntake);
intakeWheelLeft.set(Power);
intakeWheelRight.set(Power);
}
public void inout(boolean in){
if(in==false){
intakeWheelLeft.set(leftPowerIntake*-1);
intakeWheelRight.set(rightPowerIntake*-1);
}
else{
intakeWheelLeft.set(leftPowerIntake);
intakeWheelRight.set(rightPowerIntake);
public void inout(State state){

double normal=0;;
switch (state) {
case IN:

normal=Power;
break;
case OUT:
normal=Power*-1;
break;
case STOP:
normal=0;
default: // drop down
break;
}
SmartDashboard.putBoolean("Way", in);
SmartDashboard.putNumber("leftPower", leftPowerIntake);
SmartDashboard.putNumber("rightPower", rightPowerIntake);
intakeWheelLeft.set(normal);
intakeWheelRight.set(normal);

SmartDashboard.putString("State", state.toString());
SmartDashboard.putNumber("leftPower", normal);
SmartDashboard.putNumber("rightPower", normal*-1 );// inversion happens in config
//Make three new methods instead of 1: In, Out and Stop
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class PIDElevator extends Procedure {

public PIDElevator(boolean top){
if (top == true ){
this.setpoint = 180;
this.setpoint = 170;
}
else {
this.setpoint = 0 ;
Expand All @@ -24,7 +24,7 @@ public void run(Context context){
context.takeOwnership(Robot.elevator);
Robot.elevator.resetEncoder();

controller = new PIDController(0.1, 0, 0.0002, -0.5, 0.5, 0.01);
controller = new PIDController(0.1, 0, 0.0002, -0.1, 0.1, 0.01);
controller.setSetpoint(setpoint);
SmartDashboard.putNumber("Setpoint", setpoint);

Expand Down

0 comments on commit 4426ac2

Please sign in to comment.