Use TalonFX Integrated Encoder for Command.isFinished()

I’m programming single-click raise/lower commands for our team’s robot climber right now. Here’s the code for our rear climber subsystem and both commands (raise and lower). I’m currently grabbing the encoder raw state and asking isFinished() to return true if it’s at or beyond a certain value but, it’s not working for me. Am I missing something?

RearClimber.java (2.5 KB) LowerRearClimber.java (1.9 KB) RaiseRearClimber.java (1.9 KB)

This feature branch isn’t yet uploaded to our Github so, it’s only on my computer. Also, the relevant values from Constants.java are here.

public static final double FRONT_CLIMBER_MIN_HEIGHT = 0.0, REAR_CLIMBER_MIN_HEIGHT = 0.0, FRONT_CLIMBER_MAX_HEIGHT = -190000.0, REAR_CLIMBER_MAX_HEIGHT = -230000.0;

public static final double CLIMBER_SPEED = 0.25, CLIMBER_REVERSE_SPEED = -(0.25);

Nevermind what I said above, I didn’t look closely at the constants you’d posted.

However, what would still help with diagnosis would be knowing what the currently seen behavior is. Are the commands never ending, ending too soon, or ending immediately?

One thing that can help is to log the encoder’s value to the Shuffleboard with the Smartdashboard class in WPILIB.

Sorry about that, I knew I was forgetting something. The command never ends. I’ve added code to output the encoder output to the Rio log but I won’t have access to the robot again until tomorrow.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.