-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Telescoping arm #14
base: main
Are you sure you want to change the base?
Telescoping arm #14
Changes from 2 commits
75e3d0a
9b807c5
c747955
0e0746e
65a81dc
8ef1c14
691f2ac
b335a67
60999c6
e6e0ac4
ad9ba88
15bd6ba
45df378
c0f375b
2c72bac
e549cad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ | |
import edu.wpi.first.networktables.NetworkTable.*; | ||
import edu.wpi.first.math.geometry.Rotation2d; | ||
import frc.robot.subsystems.ArmTelescopingSubsystem.TelescopingStates; | ||
import frc.robot.subsystems.ElevatorSubsystem.ElevatorStates; | ||
import edu.wpi.first.math.geometry.Translation2d; | ||
import edu.wpi.first.math.geometry.Pose2d; | ||
import edu.wpi.first.math.kinematics.ChassisSpeeds; | ||
|
@@ -51,6 +52,7 @@ public class Robot extends TimedRobot { | |
private final SendableChooser<AutonomousBase> m_chooser = new SendableChooser<AutonomousBase>(); | ||
public static final DrivetrainSubsystem m_drivetrainSubsystem = new DrivetrainSubsystem(); //if anything breaks in the future it might be this | ||
private static ArmTelescopingSubsystem armTelescopingSubsystem = new ArmTelescopingSubsystem(); | ||
private static ElevatorSubsystem elevatorSubsystem = new ElevatorSubsystem(); | ||
private final Field2d m_field = new Field2d(); | ||
double t= 0.0; | ||
ChassisSpeeds m_ChassisSpeeds; | ||
|
@@ -142,25 +144,28 @@ public void robotPeriodic() { | |
@Override | ||
public void autonomousInit() { | ||
|
||
armTelescopingSubsystem.setTState(TelescopingStates.SHELF_ARM_LENGTH); //moved from auto periodic to init | ||
// elevatorSubsystem.init(); | ||
// elevatorSubsystem.elevatorMotor.setSelectedSensorPosition(0, Constants.kPIDLoopIdx, Constants.kTimeoutMs); | ||
armTelescopingSubsystem.init(); | ||
armTelescopingSubsystem.telescopingMotor.setSelectedSensorPosition(0, Constants.kPIDLoopIdx, Constants.kTimeoutMs); //VERY VERY IMPORTANT | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep! |
||
|
||
//m_drivetrainSubsystem.m_frontLeftModule.getCANCoder().getPosition(); | ||
// System.out.println("Error code" + m_drivetrainSubsystem.m_frontLeftModule.getCANCoder().getLastError()); | ||
System.out.println("current pose: " + DrivetrainSubsystem.m_pose.getX() + " , " + DrivetrainSubsystem.m_pose.getY()); | ||
m_autoSelected = m_chooser.getSelected(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep |
||
m_autoSelected.init(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep |
||
// System.out.println("current pose: " + DrivetrainSubsystem.m_pose.getX() + " , " + DrivetrainSubsystem.m_pose.getY()); | ||
// m_autoSelected = m_chooser.getSelected(); | ||
// m_autoSelected.init(); | ||
|
||
} | ||
|
||
/** This function is called periodically during autonomous. */ | ||
@Override | ||
public void autonomousPeriodic() { | ||
//elevatorSubsystem.setState(ElevatorStates.LOW_ELEVATOR_HEIGHT); | ||
//elevatorSubsystem.periodic(); | ||
|
||
armTelescopingSubsystem.periodic(); | ||
m_autoSelected.periodic(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. keep? |
||
armTelescopingSubsystem.setTState(TelescopingStates.LOW_ARM_LENGTH); //moved from auto periodic to init | ||
armTelescopingSubsystem.periodic(); | ||
|
||
// m_autoSelected.periodic(); | ||
//m_drivetrainSubsystem.drive(); | ||
} | ||
|
||
|
@@ -214,22 +219,28 @@ public void testInit() { | |
// m_drivetrainSubsystem.m_pose = new Pose2d(20, 30, new Rotation2d(Math.PI/4)); | ||
// System.out.println("m_pose: " + m_drivetrainSubsystem.m_pose); | ||
// autonomousBasePD.init(); | ||
|
||
// armTelescopingSubsystem.init(); | ||
// armTelescopingSubsystem.telescopingMotor.setSelectedSensorPosition(0, Constants.kPIDLoopIdx, Constants.kTimeoutMs); //VERY VERY IMPORTANT | ||
m_drivetrainSubsystem.zeroGyroscope(); | ||
|
||
//m_drivetrainSubsystem.zeroGyroscope(); | ||
|
||
armTelescopingSubsystem.init(); | ||
// armTelescopingSubsystem.telescopingMotor.setSelectedSensorPosition(0, Constants.kPIDLoopIdx, Constants.kTimeoutMs); //VERY VERY IMPORTANT | ||
} | ||
|
||
/** This function is called periodically during test mode. */ | ||
@Override | ||
public void testPeriodic() { | ||
// elevatorSubsystem.setState(ElevatorStates.ZERO); | ||
// elevatorSubsystem.periodic(); | ||
|
||
//armTelescopingSubsystem.telescopingMotor.set(ControlMode.PercentOutput, -0.1); | ||
//System.out.println("telescoping ticks: " + armTelescopingSubsystem.telescopingMotor.getSelectedSensorPosition()); | ||
// armTelescopingSubsystem.setTState(TelescopingStates.RETRACTED); | ||
// armTelescopingSubsystem.periodic(); | ||
armTelescopingSubsystem.setTState(TelescopingStates.RETRACTED); | ||
armTelescopingSubsystem.periodic(); | ||
|
||
m_drivetrainSubsystem.setSpeed(ChassisSpeeds.fromFieldRelativeSpeeds(0.2, 0.0, Math.toRadians(0), m_drivetrainSubsystem.getGyroscopeRotation())); | ||
m_drivetrainSubsystem.drive(); | ||
// m_drivetrainSubsystem.setSpeed(ChassisSpeeds.fromFieldRelativeSpeeds(0.2, 0.0, Math.toRadians(0), m_drivetrainSubsystem.getGyroscopeRotation())); | ||
// m_drivetrainSubsystem.drive(); | ||
} | ||
|
||
/** This function is called once when the robot is first started up. */ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably keep this?