Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Java) RamseteCommand putData causes crash if data is read before initialize() called #5187

Closed
fixermark opened this issue Mar 14, 2023 · 0 comments · Fixed by #5188
Closed

Comments

@fixermark
Copy link

Describe the bug
At this line (https://github.com/wpilibsuite/allwpilib/blob/main/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/RamseteCommand.java#L218), leftVelocity is configured with a data-putter that assumes m_prevSpeeds exists.

m_prevSpeeds is not given a value until initialize() is called (https://github.com/wpilibsuite/allwpilib/blob/main/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/RamseteCommand.java#L140).

If the command is added to SmartDashboard before the command is run, it crashes on attempting to dereference a null m_prevSpeeds reference.

To Reproduce

  1. Create a new RamseteCommand.
  2. Add the created command to the dashboard (SmartDashboard.putData("ramsete command", ramseteCommand);) before the command is run.

Expected behavior
Command's watched data is put on the dashboard.

Observed behavior
Program crashes at RamseteCommand.java:218

Screenshots
N/A

Desktop (please complete the following information):

  • WPILib Version: 2023.3.2
  • OS: Windows 11
  • Java version: OpenJDK 17.0.5

Additional context
None

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 a pull request may close this issue.

1 participant