Open
Conversation
| @Test void testPosition2() { | ||
| m_elevatorSubsystem.setPosition(1.0); | ||
| for (int i = 0; i < 100; i++) { | ||
| m_elevatorSubsystem.simulationPeriodic(); |
There was a problem hiding this comment.
The simulationPeriodic method is not defined in ElevatorSubsystem. It should be implemented to update the simulation state.
Suggested change
| m_elevatorSubsystem.simulationPeriodic(); | |
| m_elevatorSubsystem.updateSimulationState(); |
| // This method will be called once per scheduler run | ||
| } | ||
|
|
||
| public SparkFlexSim getSimMotor() { |
There was a problem hiding this comment.
The method getSimMotor() creates a new SparkFlexSim instance each time it is called. This might not be intended if the same instance is expected to be used throughout the tests. Consider storing the SparkFlexSim instance in a member variable and returning that instance.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change adds a few unit tests for the elevator as an example of how we can add unit tests.
These tests will fail right now because the elevator implementation is incomplete.
See also https://docs.wpilib.org/en/stable/docs/software/wpilib-tools/robot-simulation/unit-testing.html