Skip to content

Commit

Permalink
temporarily fixed syntax errors; must revisit
Browse files Browse the repository at this point in the history
  • Loading branch information
therbun committed Jan 20, 2025
1 parent e80084e commit 6d1c65e
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions src/main/java/frc/robot/commands/ElevatorSetPointCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ public class ElevatorSetPointCommand extends Command {
// The subsystem the command runs on
public ElevatorSubsystem m_elevator;
public Timer time = new Timer();
public TrapezoidProfile.State profileSetPoint;
public TrapezoidProfile.State profileGoal;

public ElevatorSetPointCommand(ElevatorSubsystem elevator, double setpoint) {
m_elevator = elevator;
addRequirements(m_elevator);
profileGoal = new TrapezoidProfile.State(setpoint, 0);
//you cannot create an object without giving it a class
}
@Override
public void initialize(){
Expand All @@ -28,15 +31,23 @@ public void initialize(){
@Override
public void execute(){

profileSetPoint = m_elevator.elevatorProfile.calculate(time.get(), m_elevator.profileSetPoint, m_elevator.profileGoal);
profileSetPoint = m_elevator.elevatorProfile.calculate(time.get(), profileSetPoint, profileGoal);

double calculatedVolts = this.m_elevator.calculateVoltageForSetpoint(m_elevator.profileSetPoint.position);
/* many variables not initialized or defined properly
must initalize variables properly
* profileSetPoint = m_elevator.elevatorProfile.calculate(time.get(), m_elevator.profileSetPoint, m_elevator.profileGoal);
* ^^there is no definition of profileSetPoint within another m_elevator
* */
//TODO fix calculatedVolts

Logger.recordOutput("ElevatorSubsystem/target_velocity", m_elevator.profileSetPoint.velocity);
Logger.recordOutput("ElevatorSubsystem/target_position", m_elevator.profileSetPoint.position);
Logger.recordOutput("ElevatorSubsystem/target_voltage", calculatedVolts);
//double calculatedVolts = this.calculateVoltageForSetpoint(profileSetPoint.position);
//cannot use this. statements when the method doesn't exist

this.m_elevator.setElevatorVoltage(calculatedVolts);
Logger.recordOutput("ElevatorSubsystem/target_velocity", profileSetPoint.velocity);
Logger.recordOutput("ElevatorSubsystem/target_position", profileSetPoint.position);
//Logger.recordOutput("ElevatorSubsystem/target_voltage", calculatedVolts);

//this.m_elevator.setElevatorVoltage(calculatedVolts);

}

Expand All @@ -48,5 +59,7 @@ public void end(boolean interrupted) {
}
}

//TODO



0 comments on commit 6d1c65e

Please sign in to comment.