Skip to content

Commit

Permalink
added more ath
Browse files Browse the repository at this point in the history
  • Loading branch information
DriverStationComputer committed Jan 17, 2024
1 parent 26d86d3 commit b9495e1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/main/java/org/carlmontrobotics/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public static final class Drivetrain {
}

public static final class Arm {

//Motor port
public final static int MOTOR_PORT = 8;
//all angles in rot here
public static final double intakeAngle = -.1;
public static final double ampAngle = .3;
Expand Down
Empty file.
26 changes: 21 additions & 5 deletions src/main/java/org/carlmontrobotics/subsystems/Arm.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@

package org.carlmontrobotics.subsystems;

import org.carlmontrobotics.Constants;
import org.carlmontrobotics.Constants.Arm.*;
import org.carlmontrobotics.lib199.MotorConfig;
import org.carlmontrobotics.lib199.MotorControllerFactory;

import com.revrobotics.CANSparkMax;

import edu.wpi.first.math.MathUtil;
import edu.wpi.first.math.controller.SimpleMotorFeedforward;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.XboxController;
import edu.wpi.first.wpilibj.motorcontrol.MotorController;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.InstantCommand;
Expand All @@ -15,7 +24,10 @@
import edu.wpi.first.wpilibj2.command.WaitCommand;

public class Arm extends SubsystemBase {
public Arm() {
private final CANSparkMax armMotor = MotorControllerFactory.createSparkMax(Constants.Arm.MOTOR_PORT,MotorConfig.NEO);
private final SimpleMotorFeedforward armFeed = new SimpleMotorFeedforward(Constants.Arm.kS, Constants.Arm.kV);
private final XboxController controller;
public Arm(XboxController controller) {
//arm
/*
have 3 set positions
Expand All @@ -26,23 +38,27 @@ public Arm() {
There will also be a manual control for the arm using the right joystick
*/
this.controller = controller;
}

public void setArmPos() {
public void setArmPos(double targetPosition, double targetVelocity) {
//Sets arm to the optimal angle for amp, speaker and Ground intake | used to score in amp
//these values are in constants
//pass in where scorign and use switch statement



}

public void setSpeed() {
public void controllerSetSpeed(double rightJoystick) {
//move the arm around based off the right joystick movement on the manipulator joystick
//use the trapezoid thingy from robot code 2023
}

public double getArmClampedGoal(double goal) {
return MathUtil.clamp(MathUtil.inputModulus(goal, goal, goal), goal, goal);
}
@Override
public void periodic() {
// run moveArm passing in controller here
controllerSetSpeed(controller.getRightY());
}
}

0 comments on commit b9495e1

Please sign in to comment.