diff --git a/.github/workflows/inspector.json b/.github/workflows/inspector.json index 50dab7cf5f..c15de4829d 100644 --- a/.github/workflows/inspector.json +++ b/.github/workflows/inspector.json @@ -41,7 +41,6 @@ "source/docs/software/commandbased/commands-v2/structuring-command-based-project.rst", "source/docs/software/dashboards/glass/mech2d-widget.rst", "source/docs/software/basic-programming/robot-preferences.rst", - "source/docs/zero-to-robot/step-4/creating-test-drivetrain-program-cpp-java-python.rst", "source/docs/software/wpilib-tools/robot-simulation/physics-sim.rst", "source/docs/software/vision-processing/roborio/using-the-cameraserver-on-the-roborio.rst" ] diff --git a/source/docs/zero-to-robot/step-4/creating-test-drivetrain-program-cpp-java-python.rst b/source/docs/zero-to-robot/step-4/creating-test-drivetrain-program-cpp-java-python.rst index 7296f0cf0c..24f4a66ba3 100644 --- a/source/docs/zero-to-robot/step-4/creating-test-drivetrain-program-cpp-java-python.rst +++ b/source/docs/zero-to-robot/step-4/creating-test-drivetrain-program-cpp-java-python.rst @@ -126,11 +126,11 @@ First, here is what a simple code can look like for a Drivetrain with PWM contro .. tab-set-code:: - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-6/wpilibjExamples/src/main/java/org/wpilib/examples/gettingstarted/Robot.java + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-7/wpilibjExamples/src/main/java/org/wpilib/examples/gettingstarted/Robot.java :language: java :linenos: - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-6/wpilibcExamples/src/main/cpp/examples/GettingStarted/cpp/Robot.cpp + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-7/wpilibcExamples/src/main/cpp/examples/GettingStarted/cpp/Robot.cpp :language: c++ :linenos: @@ -152,15 +152,15 @@ Now let's look at various parts of the code. .. tab-item:: Java :sync: java - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-6/wpilibjExamples/src/main/java/org/wpilib/examples/gettingstarted/Robot.java + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-7/wpilibjExamples/src/main/java/org/wpilib/examples/gettingstarted/Robot.java :language: java - :lines: 7-12 + :lines: 7-11 :linenos: .. tab-item:: C++ :sync: c++ - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-6/wpilibcExamples/src/main/cpp/examples/GettingStarted/cpp/Robot.cpp + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-7/wpilibcExamples/src/main/cpp/examples/GettingStarted/cpp/Robot.cpp :language: c++ :lines: 5-9 :lineno-match: @@ -196,9 +196,9 @@ Now let's look at various parts of the code. ``` ```python - import wpilib # Used to get the joysticks - import wpilib.drive # Used for the DifferentialDrive class - import phoenix6 # CTRE library + import wpilib # Used to get the joysticks + from wpilib import DifferentialDrive # Used for the DifferentialDrive class + import phoenix6 # CTRE library ``` .. tab-item:: REV @@ -224,8 +224,7 @@ Now let's look at various parts of the code. ``` ```python - import wpilib # Used to get the joysticks - import wpilib.drive # Used for the DifferentialDrive class + import wpilib # Used to get the joysticks and DifferentialDrive class import rev # REV library ``` @@ -253,9 +252,9 @@ Now let's look at various parts of the code. ``` ```python - import wpilib # Used to get the joysticks - import wpilib.drive # Used for the DifferentialDrive class - import ctre # CTRE library + import wpilib # Used to get the joysticks + from wpilib import DifferentialDrive # Used for the DifferentialDrive class + import phoenix5 # Phoenix5 library ``` Our code needs to reference the components of WPILib that are used. In C++ this is accomplished using ``#include`` statements; in Java and Python it is done with ``import`` statements. The program references classes for ``Gamepad`` (for driving), ``PWMSparkMax`` / ``TalonFX`` / ``CANSparkMax`` / ``WPI_TalonSRX`` (for controlling motors), ``TimedRobot`` (the base class used for the example), ``Timer`` (used for autonomous), and ``DifferentialDrive`` (for connecting the Gamepad to the motors). @@ -274,17 +273,17 @@ Our code needs to reference the components of WPILib that are used. In C++ this .. tab-item:: Java :sync: java - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-6/wpilibjExamples/src/main/java/org/wpilib/examples/gettingstarted/Robot.java + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-7/wpilibjExamples/src/main/java/org/wpilib/examples/gettingstarted/Robot.java :language: java - :lines: 19-25 + :lines: 18-24 :lineno-match: .. tab-item:: C++ :sync: c++ - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-6/wpilibcExamples/src/main/cpp/examples/GettingStarted/cpp/Robot.cpp + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-7/wpilibcExamples/src/main/cpp/examples/GettingStarted/cpp/Robot.cpp :language: c++ - :lines: 50-60 + :lines: 46-55 :lineno-match: .. tab-item:: Python @@ -292,9 +291,8 @@ Our code needs to reference the components of WPILib that are used. In C++ this .. remoteliteralinclude:: https://raw.githubusercontent.com/robotpy/mostrobotpy/2027.0.0a6/examples/robot/GettingStarted/robot.py :language: python - :linenos: + :lineno-match: :lines: 11-28 - :lineno-start: 11 .. tab-item:: CTRE-Phoenix6 :sync: ctre6 @@ -342,7 +340,7 @@ Our code needs to reference the components of WPILib that are used. In C++ this super().__init__() self.left_drive = phoenix6.hardware.TalonFX(1) self.right_drive = phoenix6.hardware.TalonFX(2) - self.robot_drive = wpilib.drive.DifferentialDrive( + self.robot_drive = DifferentialDrive( self.left_drive, self.right_drive ) self.controller = wpilib.Gamepad(0) @@ -389,11 +387,11 @@ Our code needs to reference the components of WPILib that are used. In C++ this .. tab-item:: Python :sync: python - .. remoteliteralinclude:: https://raw.githubusercontent.com/robotpy/robotpy-rev/bc3ebc4/examples/getting-started/robot.py + .. remoteliteralinclude:: https://raw.githubusercontent.com/robotpy/robotpy-rev/29651ec/examples/getting-started/robot.py :language: python :linenos: - :lines: 13-30 - :lineno-start: 13 + :lines: 12-28 + :lineno-start: 12 .. tab-item:: CTRE-Phoenix5 :sync: ctre5 @@ -430,7 +428,7 @@ Our code needs to reference the components of WPILib that are used. In C++ this .. tab-item:: Python :sync: python - .. remoteliteralinclude:: https://raw.githubusercontent.com/robotpy/robotpy-ctre/5b8d33f/examples/getting-started/robot.py + .. remoteliteralinclude:: https://raw.githubusercontent.com/robotpy/robotpy-ctre/126e0a4/examples/getting-started/robot.py :language: python :linenos: :lines: 13-30 @@ -441,7 +439,7 @@ The sample robot in our examples will have an Xbox Controller (or other Gamepad) 1. Defines the variables as members of our Robot class. 2. Initializes the variables. -.. note:: The variable initializations for C++ are in the ``private`` section at the bottom of the program. This means they are private to the class (``Robot``). The C++ code also sets the Motor Safety expiration to 0.1 seconds (the drive will shut off if we don't give it a command every .1 seconds) and starts the ``Timer`` used for autonomous. +.. note:: The variable initializations for C++ are in the ``private`` section at the bottom of the program. This means they are private to the class (``Robot``). ## Robot Initialization @@ -450,28 +448,27 @@ The sample robot in our examples will have an Xbox Controller (or other Gamepad) .. tab-item:: Java :sync: java - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-6/wpilibjExamples/src/main/java/org/wpilib/examples/gettingstarted/Robot.java + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-7/wpilibjExamples/src/main/java/org/wpilib/examples/gettingstarted/Robot.java :language: java - :lines: 27-28,32-36 - :linenos: - :lineno-start: 27 + :lines: 27-32 + :lineno-match: .. tab-item:: C++ :sync: c++ - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-6/wpilibcExamples/src/main/cpp/examples/GettingStarted/cpp/Robot.cpp + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-7/wpilibcExamples/src/main/cpp/examples/GettingStarted/cpp/Robot.cpp :language: c++ - :lines: 12-13,17-24 - :linenos: - :lineno-start: 12 + :lines: 13-20 + :lineno-match: .. tab-item:: Python :sync: python - ```python - def __init__(self): - super().__init__() - ``` + .. remoteliteralinclude:: https://raw.githubusercontent.com/robotpy/mostrobotpy/2027.0.0a6/examples/robot/GettingStarted/robot.py + :language: python + :lines: 12-17, 24-27 + :linesnos: + :lineno-start: 12 The ``Robot`` constructor for our sample program inverts the right side of the drivetrain. Depending on your drive setup, you might need to invert the left side instead. @@ -479,14 +476,14 @@ The ``Robot`` constructor for our sample program inverts the right side of the d .. tab-set-code:: - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-6/wpilibjExamples/src/main/java/org/wpilib/examples/gettingstarted/Robot.java + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-7/wpilibjExamples/src/main/java/org/wpilib/examples/gettingstarted/Robot.java :language: java - :lines: 38-54 + :lines: 34-50 :lineno-match: - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-6/wpilibcExamples/src/main/cpp/examples/GettingStarted/cpp/Robot.cpp + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-7/wpilibcExamples/src/main/cpp/examples/GettingStarted/cpp/Robot.cpp :language: c++ - :lines: 25-36 + :lines: 22-33 :lineno-match: .. remoteliteralinclude:: https://raw.githubusercontent.com/robotpy/mostrobotpy/2027.0.0a6/examples/robot/GettingStarted/robot.py @@ -502,14 +499,14 @@ The ``AutonomousInit`` method is run once each time the robot transitions to aut .. tab-set-code:: - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-6/wpilibjExamples/src/main/java/org/wpilib/examples/gettingstarted/Robot.java + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-7/wpilibjExamples/src/main/java/org/wpilib/examples/gettingstarted/Robot.java :language: java - :lines: 56-64 + :lines: 52-60 :lineno-match: - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-6/wpilibcExamples/src/main/cpp/examples/GettingStarted/cpp/Robot.cpp + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-7/wpilibcExamples/src/main/cpp/examples/GettingStarted/cpp/Robot.cpp :language: c++ - :lines: 38-45 + :lines: 35-40 :lineno-match: .. remoteliteralinclude:: https://raw.githubusercontent.com/robotpy/mostrobotpy/2027.0.0a6/examples/robot/GettingStarted/robot.py @@ -523,14 +520,14 @@ Like in Autonomous, the Teleop mode has a ``TeleopInit`` and ``TeleopPeriodic`` .. tab-set-code:: - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-6/wpilibjExamples/src/main/java/org/wpilib/examples/gettingstarted/Robot.java + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-7/wpilibjExamples/src/main/java/org/wpilib/examples/gettingstarted/Robot.java :language: java - :lines: 66-73 + :lines: 62-68 :lineno-match: - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-6/wpilibcExamples/src/main/cpp/examples/GettingStarted/cpp/Robot.cpp + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-7/wpilibcExamples/src/main/cpp/examples/GettingStarted/cpp/Robot.cpp :language: c++ - :lines: 45-48 + :lines: 42-44 :lineno-match: .. remoteliteralinclude:: https://raw.githubusercontent.com/robotpy/mostrobotpy/2027.0.0a6/examples/robot/GettingStarted/robot.py @@ -580,4 +577,3 @@ Utility Mode is used for testing robot functionality or running other code that ``` For more detailed instructions, see :doc:`Deploy Python code `. -