Skip to content

Conversation

@clrozeboom
Copy link
Contributor

This pull request adds additional safety checks to the simIterate method in Pivot.java to ensure that the motor simulation does not exceed its configured hard limits. The main improvement is that the motor's angular velocity and duty cycle are now explicitly set to zero when a hard limit is reached, preventing further movement beyond the limit.

Simulation safety improvements:

  • In simIterate, when the mechanism reaches either the lower or upper hard limit, the motor's angular velocity is set to zero and the duty cycle is stopped, ensuring the simulated motor cannot move past its physical constraints.

Note: Maybe this is a 'hack' solution, IDK. It at least stops the drifting behavior enough to make it act more like reality.

Sets default values for Optional fields to Optional.empty() and updates getMechanismY to safely handle absent robotToMechanism by returning the input value.
Introduces speedometer simulation support to ShooterConfig and Shooter, including configuration methods and visualization updates. Implements a proper sysId routine for velocity-based shooter mechanisms. Updates closed-loop controller parameters and feedforward in ShooterSubsystem, and improves SmartMotorController feedforward calculation. Also fixes a typo in ElevatorConfig.
When the Pivot mechanism hits its lower or upper hard limit the sim previously only snapped the encoder position, allowing the simulated motor to keep driving past the limit. This change stops the motor by zeroing the DC motor angular velocity and clearing the duty cycle in both the lower- and upper-limit branches, and adds comments explaining the intent to prevent further movement past hard limits.
@thenetworkgrinch
Copy link
Collaborator

I was looking at this too! This is definitely a "hack". Does this work in your setup? My main concern is that it wont be able to get out of a hardstop if it exceeds it for whatever reason.

Copy link
Collaborator

@thenetworkgrinch thenetworkgrinch left a comment

Choose a reason for hiding this comment

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

Not denied or accepted, just some more info needed

@clrozeboom
Copy link
Contributor Author

I'll test it a bit more to ensure it doesn't present problems. I've been able to successfully SysID (using my own routines) and it also obeys the limits when operating as a turret. One thing I'm noticing is that the Sim settings aren't shown when in LiveTuning.

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.

2 participants