Skip to content

Commit

Permalink
Add warning about using VS Code play button.
Browse files Browse the repository at this point in the history
Make various updates for the simulation docs for clarity and for minor
changes
  • Loading branch information
sciencewhiz committed Jan 21, 2025
1 parent 3c82187 commit f75801c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@ Often a team may want to test their code without having an actual robot availabl

**Running Robot Simulation**

Basic robot simulation can be run using VS Code. This can be done without using any commands by using VS Code's command palette.
Basic robot simulation can be run using VS Code. This can be done by using VS Code's command palette :guilabel:`WPILib: Simulate Robot Code` as shown below.

.. image:: images/vscode-run-simulation.png
:alt: Running robot simulation through VS Code

.. image:: images/vscode-pick-extension.png
:alt: Picking Sim GUI simulation extension

Your console output in Visual Studio Code should look like the below. However, teams probably will want to actually *test* their code versus just running the simulation. This can be done using :doc:`WPILib's Simulation GUI <simulation-gui>`.
By default the :guilabel:`Sim GUI` option will be selected by default. This will launch the :doc:`Simulation GUI <simulation-gui>`. You can also launch simulation without a GUI by unchecking :guilabel:`Sim GUI` in which case your console output in Visual Studio Code should look like the below.

```console
********** Robot program starting **********
Expand All @@ -47,7 +50,12 @@ Often a team may want to test their code without having an actual robot availabl
Default robotPeriodic() method... Override me!
```

.. important:: Simulation can also be run outside of VS Code using ``./gradlew simulateJava`` for Java or ``./gradlew simulateNative`` for C++.
.. warning:: You may see a run button next to the WPILib button. This button does not set up simulation appropriately and should not be used. Instead, the menu item shown above :guilabel:`WPILib: Simulate Robot Code` should be used.

.. image:: images/vscode-run-bad.png
:alt: Run button to the left of the WPIlib Button

.. note:: Simulation can also be run outside of VS Code using ``./gradlew simulateJava`` for Java or ``./gradlew simulateNative`` for C++.

.. note:: Some vendors support attaching hardware to your PC and using the hardware in desktop simulation (e.g. CANivore). See :doc:`vendor documentation </docs/software/vscode-overview/wpilib-commands-vscode>` for more information about the command `WPILib: Hardware Sim Robot Code`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,21 @@ WPILib has extended robot simulation to introduce a graphical user interface (GU
.. image:: images/vscode-run-simulation.png
:alt: Running simulation via VS Code

You can simply launch the GUI via the **Run Simulation** command palette option.
You can simply launch the GUI via the :guilabel:`Simulate Robot Code` command palette option.

.. image:: images/vscode-pick-extension.png
:alt: Picking Sim GUI simulation extension

And the ``Sim GUI`` option should popup in a new dialog and will be selected by default. Press :guilabel:`Ok`. This will now launch the Simulation GUI!
And the :guilabel:`Sim GUI` option should popup in a new dialog and will be selected by default. Press :guilabel:`Ok`. This will now launch the Simulation GUI.

.. image:: images/sim-gui.png
:alt: The simulation graphical user interface

.. warning:: You may see a run button next to the WPILib button. This button does not set up simulation appropriately and should not be used. Instead, the menu item shown above :guilabel:`WPILib: Simulate Robot Code` should be used.

.. image:: images/vscode-run-bad.png
:alt: Run button to the left of the WPIlib Button

## Using the GUI

### Learning the Layout
Expand Down

0 comments on commit f75801c

Please sign in to comment.