Skip to content

Conversation

@Samson560915
Copy link

Follows turret subsystem. SIM runs, however it is not responsive to PID tuning. Constants need to be set and states need to be finished.

@Samson560915 Samson560915 linked an issue Jan 26, 2026 that may be closed by this pull request
@Samson560915 Samson560915 self-assigned this Jan 26, 2026
@Samson560915
Copy link
Author

@aidnem Could you look at this branch/run SIM and see if/why PID tuning is completely unresponsive?

@godmar
Copy link
Contributor

godmar commented Jan 26, 2026

I'm merging main into this branch to get the TestMode update.

@godmar
Copy link
Contributor

godmar commented Jan 26, 2026

  • DiskSim.java and DiskSimAdapter.java aren't needed anymore, are they? If so, please remove them.
  • you have a homingAngle variable? I thought the hopper was just spinning

@aidnem Could you look at this branch/run SIM and see if/why PID tuning is completely unresponsive?

What do you mean, specifically?
In shop, Aiden used the Phoenix Tuner to connect to the motors in sim. This "poking" appeared to have an effect.

Check the documentation for the TalonFXConfig, which are used directly in coppercore.

Copy link
Contributor

@aidnem aidnem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a couple comments, hopefully these should help your sim become responsive once again.

Logger.recordOutput("Hopper/closedLoopReferenceRadians", inputs.closedLoopReference);
Logger.recordOutput(
"Hopper/closedLoopReferenceSlopeRadPerSec", inputs.closedLoopReferenceSlope);
Logger.recordOutput("Hopper/State", stateMachine.getCurrentState().getName());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another thing to check would be to use AdvantageScope to log Hopper/State as a discrete field (drag it into the middle section at the bottom of the line graph, in between the left and right axes) and make sure that you are actually entering the test mode state when you should be.

@godmar
Copy link
Contributor

godmar commented Jan 28, 2026

@Samson560915 one thing you need to do here is Resolve the conversations. When you got comments, react to them, and if that concludes the conversation hit "Resolve conversation." Do not leave conversations open longer than required.

…ocity instead of setting voltage, now the velocity doesn't change in SIM at all.
@aidnem
Copy link
Contributor

aidnem commented Jan 29, 2026

@Samson560915 do you want me to take care of merge conflicts for you?

@Samson560915
Copy link
Author

@aidnem Sure! That would be amazing! Thank you so much!

@aidnem
Copy link
Contributor

aidnem commented Jan 29, 2026

@Samson560915 Done 👍 . Do you think we can get this merged tonight? I'd like to be "done with subsystems" as soon as possible.

@Samson560915
Copy link
Author

@aidnem I don't know, I did something and now it doesn't spin (velocity does not change). Do you know if I can simulate the velocity changing using the profiled control to spin the motor?

@aidnem
Copy link
Contributor

aidnem commented Jan 29, 2026

@Samson560915

Do you know if I can simulate the velocity changing using the profiled control to spin the motor?

When commanding a velocity, the sim should handle all of that

I've done some digging, by adding a print statement here:

  public void setToTargetVelocity() {
    System.out.println("Set to target velocity " + targetVelocity.in(RPM) + " RPM");
    motor.controlToVelocityProfiled(targetVelocity);
  }

This revealed the following situation: target velocity is always 0.

image

The only place you're setting the value is here:

image

This value is false in your JSON:

image

Also, none of your PID gains are present in the JSON.

If you add this line in JSON constants before the line where the constants are loaded, and run sim once, it'll write them out to JSON from the java file:

    jsonHandler.saveObject(new HopperConstants(), "HopperConstants.json");

If you fix all of these issues, you should be set.

@Samson560915
Copy link
Author

@aidnem
Screenshot 2026-01-29 151744
It changes target Velocity, but the SIM seems very off.
Screenshot 2026-01-29 152034

@aidnem
Copy link
Contributor

aidnem commented Jan 29, 2026

@Samson560915 all of your gains are 0 except for kA. this means that the only time it's applying any power is when the profile commands acceleration. Try tuning the PIDs in test mode. The general process is:

  1. Start all gains at 0
  2. Increase kP to something small like 0.1 or 1
  3. Double kP until it overshoots and oscillates around the target
  4. Increase kD until it doesn't oscillate

In between all gains changes, make sure you change your target RPM around to see how it responds to commands.

@Samson560915
Copy link
Author

@aidnem Is it supposed to be in test mode when I click
Screenshot 2026-01-29 155134

@aidnem
Copy link
Contributor

aidnem commented Jan 30, 2026

Yes. you also have to select the right hopper test mode elastic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Program Hopper

6 participants