diff --git a/source/docs/contributing/frc-docs/style-guide.rst b/source/docs/contributing/frc-docs/style-guide.rst index aad5de9312..d6dffd8178 100644 --- a/source/docs/contributing/frc-docs/style-guide.rst +++ b/source/docs/contributing/frc-docs/style-guide.rst @@ -114,7 +114,7 @@ When possible, instead of using code blocks, an RLI should be used. This pulls :lineno-start: 44 .. rli:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/RamseteController/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 18-30 :linenos: :lineno-start: 18 @@ -136,7 +136,7 @@ To create code tabs in an article, you can use the ``.. tab-set-code::`` directi :lineno-start: 44 - .. code-block:: cpp + .. code-block:: c++ // Start the timer. m_timer.Start(); diff --git a/source/docs/software/advanced-controls/state-space/state-space-flywheel-walkthrough.rst b/source/docs/software/advanced-controls/state-space/state-space-flywheel-walkthrough.rst index 753d9c4b52..b830104b2d 100644 --- a/source/docs/software/advanced-controls/state-space/state-space-flywheel-walkthrough.rst +++ b/source/docs/software/advanced-controls/state-space/state-space-flywheel-walkthrough.rst @@ -66,7 +66,7 @@ The second part of state-space notation relates the system's current :term:`stat The ``LinearSystem`` class contains methods for easily creating state-space systems identified using :term:`system identification`. This example shows a flywheel model with a kV of 0.023 and a kA of 0.001: .. tab-set:: - .. tab-item:: JAVA + .. tab-item:: Java :sync: java .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/statespaceflywheelsysid/Robot.java @@ -77,16 +77,16 @@ The ``LinearSystem`` class contains methods for easily creating state-space syst .. tab-item:: C++ - :sync: cpp + :sync: c++ .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/StateSpaceFlywheelSysId/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 17 :linenos: :lineno-start: 17 .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/StateSpaceFlywheelSysId/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 30-46 :linenos: :lineno-start: 30 @@ -105,7 +105,7 @@ The ``LinearSystem`` class contains methods to easily create a model of a flywhe .. tab-set:: - .. tab-item:: JAVA + .. tab-item:: Java :sync: java .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/statespaceflywheel/Robot.java @@ -115,16 +115,16 @@ The ``LinearSystem`` class contains methods to easily create a model of a flywhe :lineno-start: 34 .. tab-item:: C++ - :sync: cpp + :sync: c++ .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/StateSpaceFlywheel/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 17-17 :linenos: :lineno-start: 17 .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/StateSpaceFlywheel/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 17,31-46 :linenos: :lineno-start: 31 @@ -145,7 +145,7 @@ Because the feedback controller computes error using the :term:`x-hat` estimated .. tab-set:: - .. tab-item:: JAVA + .. tab-item:: Java :sync: java .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/statespaceflywheel/Robot.java @@ -155,16 +155,16 @@ Because the feedback controller computes error using the :term:`x-hat` estimated :lineno-start: 59 .. tab-item:: C++ - :sync: cpp + :sync: c++ .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/StateSpaceFlywheelSysId/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 13-13 :linenos: :lineno-start: 13 .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/StateSpaceFlywheel/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 48-53 :linenos: :lineno-start: 48 @@ -182,7 +182,7 @@ Much like ``SimpleMotorFeedforward`` can be used to generate feedforward voltage .. tab-set:: - .. tab-item:: JAVA + .. tab-item:: Java :sync: java .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/statespaceflywheel/Robot.java @@ -192,16 +192,16 @@ Much like ``SimpleMotorFeedforward`` can be used to generate feedforward voltage :lineno-start: 60 .. tab-item:: C++ - :sync: cpp + :sync: c++ .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/StateSpaceFlywheelSysId/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 11 :linenos: :lineno-start: 11 .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/StateSpaceFlywheel/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 55-75 :linenos: :lineno-start: 54 @@ -213,7 +213,7 @@ LinearSystemLoop combines our system, controller, and observer that we created e .. tab-set:: - .. tab-item:: JAVA + .. tab-item:: Java :sync: java .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/statespaceflywheel/Robot.java @@ -223,16 +223,16 @@ LinearSystemLoop combines our system, controller, and observer that we created e :lineno-start: 73 .. tab-item:: C++ - :sync: cpp + :sync: c++ .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/StateSpaceFlywheelSysId/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 15-15 :linenos: :lineno-start: 15 .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/StateSpaceFlywheel/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 71-74 :linenos: :lineno-start: 71 @@ -241,7 +241,7 @@ Once we have our ``LinearSystemLoop``, the only thing left to do is actually run .. tab-set:: - .. tab-item:: JAVA + .. tab-item:: Java :sync: java .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/statespaceflywheel/Robot.java @@ -251,16 +251,16 @@ Once we have our ``LinearSystemLoop``, the only thing left to do is actually run :lineno-start: 96 .. tab-item:: C++ - :sync: cpp + :sync: c++ .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/StateSpaceFlywheelSysId/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 5-17 :linenos: :lineno-start: 5 .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/StateSpaceFlywheel/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 92-114 :linenos: :lineno-start: 92 @@ -278,7 +278,7 @@ Mechanisms with a continuous angle can have that angle wrapped by calling the co error.set(0, 0, MathUtil.angleModulus(error.get(0, 0))); var u = lqr.getK().times(error); - .. code-block:: cpp + .. code-block:: c++ Eigen::Vector error = lqr.R() - x; error(0) = frc::AngleModulus(units::radian_t{error(0)}).value(); diff --git a/source/docs/software/advanced-controls/state-space/state-space-observers.rst b/source/docs/software/advanced-controls/state-space/state-space-observers.rst index 197e8108c3..e9f831f554 100644 --- a/source/docs/software/advanced-controls/state-space/state-space-observers.rst +++ b/source/docs/software/advanced-controls/state-space/state-space-observers.rst @@ -108,13 +108,13 @@ WPILib's Kalman Filter classes' constructors take a linear system, a vector of p .. tab-item:: C++ .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/StateSpaceFlywheel/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 5-18 :linenos: :lineno-start: 5 .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/StateSpaceFlywheel/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 48-53 :linenos: :lineno-start: 48 diff --git a/source/docs/software/advanced-controls/trajectories/ramsete.rst b/source/docs/software/advanced-controls/trajectories/ramsete.rst index a715e49a09..6aa33ef33a 100644 --- a/source/docs/software/advanced-controls/trajectories/ramsete.rst +++ b/source/docs/software/advanced-controls/trajectories/ramsete.rst @@ -67,7 +67,7 @@ The returned adjusted speeds can be converted to usable speeds using the kinemat double left = wheelSpeeds.leftMetersPerSecond; double right = wheelSpeeds.rightMetersPerSecond; - .. code-block:: cpp + .. code-block:: c++ ChassisSpeeds adjustedSpeeds = controller.Calculate(currentRobotPose, goal); DifferentialDriveWheelSpeeds wheelSpeeds = kinematics.ToWheelSpeeds(adjustedSpeeds); diff --git a/source/docs/software/advanced-controls/trajectories/trajectory-generation.rst b/source/docs/software/advanced-controls/trajectories/trajectory-generation.rst index ba2199d687..a530b95efc 100644 --- a/source/docs/software/advanced-controls/trajectories/trajectory-generation.rst +++ b/source/docs/software/advanced-controls/trajectories/trajectory-generation.rst @@ -56,7 +56,7 @@ Here is an example of generating a trajectory using clamped cubic splines for th .. tab-item:: C++ .. literalinclude:: examples/trajectory-generation-1/cpp/ExampleTrajectory.cpp - :language: cpp + :language: c++ :lines: 8-22 .. note:: The Java code utilizes the `Units `_ utility, for easy unit conversions. @@ -90,7 +90,7 @@ Trajectories in Java can be combined into a single trajectory using the ``concat var concatTraj = trajectoryOne.concatenate(trajectoryTwo); - .. code-block:: cpp + .. code-block:: c++ auto trajectoryOne = frc::TrajectoryGenerator::GenerateTrajectory( frc::Pose2d(0_m, 0_m, 0_rad), diff --git a/source/docs/software/basic-programming/functions-as-data.rst b/source/docs/software/basic-programming/functions-as-data.rst index 1bf2d4f753..dcd81ee3fc 100644 --- a/source/docs/software/basic-programming/functions-as-data.rst +++ b/source/docs/software/basic-programming/functions-as-data.rst @@ -116,7 +116,7 @@ This sounds a lot more complicated than it is to use in practice. Let's look at .. note:: The ``requirements`` parameter is explained in the :ref:`Command-based documentation `, and will not be discussed here. -.. code-block:: cpp +.. code-block:: c++ CommandPtr RunOnce( std::function action, @@ -129,7 +129,7 @@ Lambda Expressions in C++ To pass a function to ``runOnce``, we need to write a short inline function expression using a special syntax that resembles ordinary C++ function declarations, but varies in a few important ways: -.. code-block:: cpp +.. code-block:: c++ // Create an InstantCommand that runs the drive forward at half speed CommandPtr driveHalfSpeed = cmd::RunOnce([this] { drivetrain.ArcadeDrive(0.5, 0.0); }, {drivetrain}); diff --git a/source/docs/software/basic-programming/robot-preferences.rst b/source/docs/software/basic-programming/robot-preferences.rst index 2c90e3cc58..9f63330541 100644 --- a/source/docs/software/basic-programming/robot-preferences.rst +++ b/source/docs/software/basic-programming/robot-preferences.rst @@ -26,11 +26,11 @@ Initializing Preferences :sync: C++ .. rli:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/ArmSimulation/include/Constants.h - :language: cpp + :language: c++ :lines: 30-34 .. rli:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/ArmSimulation/cpp/subsystems/Arm.cpp - :language: cpp + :language: c++ :lines: 12, 18-22 .. tab-item:: Python @@ -66,7 +66,7 @@ Reading Preferences :sync: C++ .. rli:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/ArmSimulation/cpp/subsystems/Arm.cpp - :language: cpp + :language: c++ :lines: 44-52 .. tab-item:: Python @@ -96,10 +96,10 @@ Depending on the data that is stored in preferences, you can use it when you rea :sync: C++ .. rli:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/ArmSimulation/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 15-24 .. rli:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/ArmSimulation/cpp/subsystems/Arm.cpp - :language: cpp + :language: c++ :lines: 54-60 .. tab-item:: Python diff --git a/source/docs/software/can-devices/power-distribution-module.rst b/source/docs/software/can-devices/power-distribution-module.rst index c58e579bf5..4b67641981 100644 --- a/source/docs/software/can-devices/power-distribution-module.rst +++ b/source/docs/software/can-devices/power-distribution-module.rst @@ -40,7 +40,7 @@ Reading the Bus Voltage .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/CANPDP/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 28-31 :linenos: :lineno-start: 28 @@ -59,7 +59,7 @@ Reading the Temperature :lineno-start: 37 .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/CANPDP/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 33-35 :linenos: :lineno-start: 33 @@ -78,7 +78,7 @@ Reading the Total Current, Power, and Energy :lineno-start: 41 .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/CANPDP/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 37-49 :linenos: :lineno-start: 37 @@ -99,7 +99,7 @@ The PDP/PDH also allows users to monitor the current drawn by the individual dev :lineno-start: 26 .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/CANPDP/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 22-26 :linenos: :lineno-start: 22 diff --git a/source/docs/software/commandbased/command-scheduler.rst b/source/docs/software/commandbased/command-scheduler.rst index fc534d05aa..0439c971a6 100644 --- a/source/docs/software/commandbased/command-scheduler.rst +++ b/source/docs/software/commandbased/command-scheduler.rst @@ -30,30 +30,29 @@ This method walks through the following steps: .. tab-set:: - .. tab-item:: Java - :sync: tabcode-java - - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2023.4.3/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java - :language: java - :lines: 202-245 - :linenos: - :lineno-start: 202 - - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2023.4.3/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java - :language: java - :lines: 181-191 - :linenos: - :lineno-start: 181 - - .. tab-item:: C++ (Source) - :sync: tabcode-cpp - - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2023.4.3/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp - :language: c++ - :lines: 114-159 - :linenos: - :lineno-start: 114 - + .. tab-item:: Java + :sync: tabcode-java + + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2023.4.3/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java + :language: java + :lines: 202-245 + :linenos: + :lineno-start: 202 + + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2023.4.3/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java + :language: java + :lines: 181-191 + :linenos: + :lineno-start: 181 + + .. tab-item:: C++ (Source) + :sync: tabcode-c++ + + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2023.4.3/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp + :language: c++ + :lines: 114-159 + :linenos: + :lineno-start: 114 The Scheduler Run Sequence -------------------------- @@ -69,23 +68,23 @@ First, the scheduler runs the ``periodic()`` method of each registered ``Subsyst .. tab-set:: - .. tab-item:: Java - :sync: tabcode-java + .. tab-item:: Java + :sync: tabcode-java - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2023.4.3/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java - :language: java - :lines: 278-285 - :linenos: - :lineno-start: 278 + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2023.4.3/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java + :language: java + :lines: 278-285 + :linenos: + :lineno-start: 278 - .. tab-item:: C++ (Source) - :sync: tabcode-cpp + .. tab-item:: C++ (Source) + :sync: tabcode-c++ - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2023.4.3/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp - :language: c++ - :lines: 183-190 - :linenos: - :lineno-start: 183 + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2023.4.3/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp + :language: c++ + :lines: 183-190 + :linenos: + :lineno-start: 183 Step 2: Poll Command Scheduling Triggers ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -96,23 +95,23 @@ Secondly, the scheduler polls the state of all registered triggers to see if any .. tab-set:: - .. tab-item:: Java - :sync: tabcode-java + .. tab-item:: Java + :sync: tabcode-java - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2023.4.3/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java - :language: java - :lines: 290-292 - :linenos: - :lineno-start: 290 + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2023.4.3/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java + :language: java + :lines: 290-292 + :linenos: + :lineno-start: 290 - .. tab-item:: C++ (Source) - :sync: tabcode-cpp + .. tab-item:: C++ (Source) + :sync: tabcode-c++ - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2023.4.3/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp - :language: c++ - :lines: 195-197 - :linenos: - :lineno-start: 195 + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2023.4.3/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp + :language: c++ + :lines: 195-197 + :linenos: + :lineno-start: 195 Step 3: Run/Finish Scheduled Commands ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -123,25 +122,25 @@ Note that this sequence of calls is done in order for each command - thus, one c .. tab-set:: - .. tab-item:: Java - :sync: tabcode-java + .. tab-item:: Java + :sync: tabcode-java - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2023.4.3/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java - :language: java - :lines: 295-325 - :linenos: - :lineno-start: 295 - :emphasize-lines: 16,21-22 + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2023.4.3/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java + :language: java + :lines: 295-325 + :linenos: + :lineno-start: 295 + :emphasize-lines: 16,21-22 - .. tab-item:: C++ (Source) - :sync: tabcode-cpp + .. tab-item:: C++ (Source) + :sync: tabcode-c++ - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2023.4.3/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp - :language: c++ - :lines: 201-226 - :linenos: - :lineno-start: 201 - :emphasize-lines: 7,13-14 + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2023.4.3/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp + :language: c++ + :lines: 201-226 + :linenos: + :lineno-start: 201 + :emphasize-lines: 7,13-14 Step 4: Schedule Default Commands ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -150,23 +149,23 @@ Finally, any registered ``Subsystem`` has its default command scheduled (if it h .. tab-set:: - .. tab-item:: Java - :sync: tabcode-java + .. tab-item:: Java + :sync: tabcode-java - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2023.4.3/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java - :language: java - :lines: 340-346 - :linenos: - :lineno-start: 340 + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2023.4.3/wpilibNewCommands/src/main/java/edu/wpi/first/wpilibj2/command/CommandScheduler.java + :language: java + :lines: 340-346 + :linenos: + :lineno-start: 340 - .. tab-item:: C++ (Source) - :sync: tabcode-cpp + .. tab-item:: C++ (Source) + :sync: tabcode-c++ - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2023.4.3/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp - :language: c++ - :lines: 240-246 - :linenos: - :lineno-start: 240 + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2023.4.3/wpilibNewCommands/src/main/native/cpp/frc2/command/CommandScheduler.cpp + :language: c++ + :lines: 240-246 + :linenos: + :lineno-start: 240 Disabling the Scheduler ----------------------- @@ -192,20 +191,20 @@ A typical use-case for these methods is adding markers in an event log whenever .. tab-set:: - .. tab-item:: Java - :sync: tabcode-java + .. tab-item:: Java + :sync: tabcode-java - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-2/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/hatchbotinlined/RobotContainer.java - :language: java - :lines: 73-88 - :linenos: - :lineno-start: 73 + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-2/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/hatchbotinlined/RobotContainer.java + :language: java + :lines: 73-88 + :linenos: + :lineno-start: 73 - .. tab-item:: C++ (Source) - :sync: tabcode-cpp + .. tab-item:: C++ (Source) + :sync: tabcode-c++ - .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-2/wpilibcExamples/src/main/cpp/examples/HatchbotInlined/cpp/RobotContainer.cpp - :language: c++ - :lines: 23-47 - :linenos: - :lineno-start: 23 + .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-2/wpilibcExamples/src/main/cpp/examples/HatchbotInlined/cpp/RobotContainer.cpp + :language: c++ + :lines: 23-47 + :linenos: + :lineno-start: 23 diff --git a/source/docs/software/commandbased/commands.rst b/source/docs/software/commandbased/commands.rst index 889a4ceb57..9799713e18 100644 --- a/source/docs/software/commandbased/commands.rst +++ b/source/docs/software/commandbased/commands.rst @@ -118,7 +118,7 @@ The ``runOnce`` factory, backed by the ``InstantCommand`` (`Java > properties{ std::make_pair("Label position", nt::Value::MakeString("HIDDEN")) diff --git a/source/docs/software/dashboards/smartdashboard/displaying-expressions.rst b/source/docs/software/dashboards/smartdashboard/displaying-expressions.rst index 7c002494c3..51cd9eefea 100644 --- a/source/docs/software/dashboards/smartdashboard/displaying-expressions.rst +++ b/source/docs/software/dashboards/smartdashboard/displaying-expressions.rst @@ -21,7 +21,7 @@ Writing Values to SmartDashboard SmartDashboard.putNumber("RPM", shooter.getRPM()); } - .. code-block:: cpp + .. code-block:: c++ void Command::Execute() { frc::SmartDashboard::PutBoolean("Bridge Limit", BridgeTipper.AtBridge()); diff --git a/source/docs/software/dashboards/smartdashboard/test-mode-and-live-window/displaying-LiveWindow-values.rst b/source/docs/software/dashboards/smartdashboard/test-mode-and-live-window/displaying-LiveWindow-values.rst index 79fded01a1..8f06ce79c4 100644 --- a/source/docs/software/dashboards/smartdashboard/test-mode-and-live-window/displaying-LiveWindow-values.rst +++ b/source/docs/software/dashboards/smartdashboard/test-mode-and-live-window/displaying-LiveWindow-values.rst @@ -21,7 +21,7 @@ For each sensor or actuator that is created, set the subsystem name and display Victor wrist = new Victor(2); SendableRegistry.setName(wrist, "Arm", "Wrist"); - .. code-block:: cpp + .. code-block:: c++ frc::Ultrasonic ultrasonic{1, 2}; SendableRegistry::SetName(ultrasonic, "Arm", "Ultrasonic"); @@ -47,7 +47,7 @@ If your objects are in a ``Subsystem``, this can be simplified using the addChil Victor wrist = new Victor(2); addChild("Wrist", wrist); - .. code-block:: cpp + .. code-block:: c++ frc::Ultrasonic ultrasonic{1, 2}; AddChild("Ultrasonic", ultrasonic); diff --git a/source/docs/software/dashboards/smartdashboard/test-mode-and-live-window/enabling-test-mode.rst b/source/docs/software/dashboards/smartdashboard/test-mode-and-live-window/enabling-test-mode.rst index e55e3d242d..4f461c7341 100644 --- a/source/docs/software/dashboards/smartdashboard/test-mode-and-live-window/enabling-test-mode.rst +++ b/source/docs/software/dashboards/smartdashboard/test-mode-and-live-window/enabling-test-mode.rst @@ -20,7 +20,7 @@ To run LiveWindow in Test Mode, the following code is needed in the ``Robot`` cl enableLiveWindowInTest(true); } - .. code-block:: cpp + .. code-block:: c++ void Robot::RobotInit() { EnableLiveWindowInTest(true); @@ -49,7 +49,7 @@ Explicitly vs. implicit test mode display SendableRegistry.setName(accel, "SomeSubsystem", "Accelerometer"); } - .. code-block:: cpp + .. code-block:: c++ frc::PWMSparkMax leftDrive{0}; frc::PWMSparkMax rigthDrive{1}; diff --git a/source/docs/software/hardware-apis/misc/addressable-leds.rst b/source/docs/software/hardware-apis/misc/addressable-leds.rst index d335b48fc8..1c3676becd 100644 --- a/source/docs/software/hardware-apis/misc/addressable-leds.rst +++ b/source/docs/software/hardware-apis/misc/addressable-leds.rst @@ -29,13 +29,13 @@ After the length of the strip has been set, you'll have to create an ``Addressab :sync: C++ .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/AddressableLED/include/Robot.h - :language: cpp + :language: c++ :lines: 12-12, 18-27 :linenos: :lineno-start: 11 .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/AddressableLED/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 7-13 :linenos: :lineno-start: 7 @@ -136,7 +136,7 @@ Moving outside of the for loop, the ``m_rainbowFirstPixelHue`` then iterates the :sync: C++ .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/AddressableLED/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 22-35 :linenos: :lineno-start: 22 @@ -158,7 +158,7 @@ Now that we have our ``rainbow`` method created, we have to actually call the me :sync: C++ .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/AddressableLED/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 15-20 :linenos: :lineno-start: 15 diff --git a/source/docs/software/hardware-apis/motors/wpi-drive-classes.rst b/source/docs/software/hardware-apis/motors/wpi-drive-classes.rst index 6000970eac..16f7f5c743 100644 --- a/source/docs/software/hardware-apis/motors/wpi-drive-classes.rst +++ b/source/docs/software/hardware-apis/motors/wpi-drive-classes.rst @@ -45,7 +45,7 @@ As of 2022, the right side of the drivetrain is **no longer** inverted by defaul m_motorRight.setInverted(true); } - .. code-block:: cpp + .. code-block:: c++ frc::PWMSparkMax m_motorLeft{0}; @@ -144,7 +144,7 @@ DifferentialDrive is a method provided for the control of "skid-steer" or "West .. tab-item:: C++ (Header) :sync: C++ (Header) - .. code-block:: cpp + .. code-block:: c++ class Robot { private: @@ -155,7 +155,7 @@ DifferentialDrive is a method provided for the control of "skid-steer" or "West .. tab-item:: C++ (Source) :sync: C++ (Source) - .. code-block:: cpp + .. code-block:: c++ void Robot::RobotInit() { m_left.SetInverted(true); // if you want to invert motor outputs, you must do so here @@ -317,7 +317,7 @@ MecanumDrive is a method provided for the control of holonomic drivetrains with :lineno-start: 24 .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/MecanumDrive/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 31-44 :linenos: :lineno-start: 31 diff --git a/source/docs/software/hardware-apis/sensors/limit-switch.rst b/source/docs/software/hardware-apis/sensors/limit-switch.rst index a2d4a72168..0c228dece7 100644 --- a/source/docs/software/hardware-apis/sensors/limit-switch.rst +++ b/source/docs/software/hardware-apis/sensors/limit-switch.rst @@ -42,7 +42,7 @@ Controlling a Motor with Two Limit Switches } } - .. code-block:: cpp + .. code-block:: c++ frc::DigitalInput toplimitSwitch {0}; frc::DigitalInput bottomlimitSwitch {1}; diff --git a/source/docs/software/hardware-apis/sensors/ultrasonics-software.rst b/source/docs/software/hardware-apis/sensors/ultrasonics-software.rst index 01f03832cf..f85c3ce0c7 100644 --- a/source/docs/software/hardware-apis/sensors/ultrasonics-software.rst +++ b/source/docs/software/hardware-apis/sensors/ultrasonics-software.rst @@ -28,7 +28,7 @@ The :code:`Ultrasonic` class (`Java ` is used to automatically convert to any desired length unit: @@ -46,7 +46,7 @@ The measurement can then be retrieved in either inches or millimeters in Java; i :sync: C++ .. rli:: https://github.com/wpilibsuite/allwpilib/raw/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/Ultrasonic/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 18-22 Analog ultrasonics @@ -77,14 +77,14 @@ Ultrasonic sensors are very useful for determining spacing during autonomous rou :sync: C++ (Header) .. rli:: https://github.com/wpilibsuite/allwpilib/raw/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/UltrasonicPID/include/Robot.h - :language: cpp + :language: c++ :lines: 19-51 .. tab-item:: C++ (Source) :sync: C++ (Source) .. rli:: https://github.com/wpilibsuite/allwpilib/raw/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/UltrasonicPID/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 7-19 Additionally, ping-response ultrasonics can be sent to :ref:`Shuffleboard `, where they will be displayed with their own widgets: @@ -102,5 +102,5 @@ Additionally, ping-response ultrasonics can be sent to :ref:`Shuffleboard #include @@ -93,7 +93,7 @@ A basic client program looks like the following example. .. tab-item:: C++ (Handle-based) :sync: C++ (Handle-based) - .. code-block:: cpp + .. code-block:: c++ #include #include diff --git a/source/docs/software/networktables/listening-for-change.rst b/source/docs/software/networktables/listening-for-change.rst index 1e422e87ea..3e5b6bb33b 100644 --- a/source/docs/software/networktables/listening-for-change.rst +++ b/source/docs/software/networktables/listening-for-change.rst @@ -58,7 +58,7 @@ There are a few different ways to detect that a topic's value has changed; the e .. tab-item:: C++ :sync: C++ - .. code-block:: cpp + .. code-block:: c++ class Example { nt::DoubleSubscriber ySub; @@ -101,7 +101,7 @@ There are a few different ways to detect that a topic's value has changed; the e .. tab-item:: C++ (Handle-based) :sync: C++ (Handle-based) - .. code-block:: cpp + .. code-block:: c++ class Example { NT_Subscriber ySub; @@ -272,7 +272,7 @@ The ``addListener`` functions in NetworkTableInstance return a listener handle. .. tab-item:: C++ :sync: C++ - .. code-block:: cpp + .. code-block:: c++ class Example { nt::DoubleSubscriber ySub; diff --git a/source/docs/software/networktables/multiple-instances.rst b/source/docs/software/networktables/multiple-instances.rst index 1e35a51c6f..94c426ccf6 100644 --- a/source/docs/software/networktables/multiple-instances.rst +++ b/source/docs/software/networktables/multiple-instances.rst @@ -30,7 +30,7 @@ Destroying a NetworkTableInstance frees all resources related to the instance. A .. tab-item:: C++ :sync: C++ - .. code-block:: cpp + .. code-block:: c++ // get the default NetworkTable instance nt::NetworkTableInstance defaultInst = nt::NetworkTableInstance::GetDefault(); @@ -44,7 +44,7 @@ Destroying a NetworkTableInstance frees all resources related to the instance. A .. tab-item:: C++ (Handle-based) :sync: C++ (Handle-based) - .. code-block:: cpp + .. code-block:: c++ // get the default NetworkTable instance NT_Instance defaultInst = nt::GetDefaultInstance(); diff --git a/source/docs/software/networktables/networktables-networking.rst b/source/docs/software/networktables/networktables-networking.rst index 8170494e0d..1d3b2a898d 100644 --- a/source/docs/software/networktables/networktables-networking.rst +++ b/source/docs/software/networktables/networktables-networking.rst @@ -19,7 +19,7 @@ Starting a NetworkTables Server .. tab-item:: C++ :sync: C++ - .. code-block:: cpp + .. code-block:: c++ nt::NetworkTableInstance inst = nt::NetworkTableInstance::GetDefault(); inst.StartServer(); @@ -27,7 +27,7 @@ Starting a NetworkTables Server .. tab-item:: C++ (Handle-based) :sync: C++ (Handle-based) - .. code-block:: cpp + .. code-block:: c++ NT_Inst inst = nt::GetDefaultInstance(); nt::StartServer(inst, "networktables.json", "", NT_DEFAULT_PORT3, NT_DEFAULT_PORT4); @@ -79,7 +79,7 @@ Starting a NetworkTables Client .. tab-item:: C++ :sync: C++ - .. code-block:: cpp + .. code-block:: c++ nt::NetworkTableInstance inst = nt::NetworkTableInstance::GetDefault(); @@ -98,7 +98,7 @@ Starting a NetworkTables Client .. tab-item:: C++ (Handle-based) :sync: C++ (Handle-based) - .. code-block:: cpp + .. code-block:: c++ NT_Inst inst = nt::GetDefaultInstance(); diff --git a/source/docs/software/networktables/nt4-migration-guide.rst b/source/docs/software/networktables/nt4-migration-guide.rst index 7c3347cda2..57add39427 100644 --- a/source/docs/software/networktables/nt4-migration-guide.rst +++ b/source/docs/software/networktables/nt4-migration-guide.rst @@ -39,7 +39,7 @@ NT3 code (was): } - .. code-block:: cpp + .. code-block:: c++ class Example { nt::NetworkTableEntry yEntry; @@ -128,7 +128,7 @@ Recommended NT4 equivalent (should be): } - .. code-block:: cpp + .. code-block:: c++ class Example { nt::DoubleSubscriber ySub; diff --git a/source/docs/software/networktables/publish-and-subscribe.rst b/source/docs/software/networktables/publish-and-subscribe.rst index 6c81dbbe81..9ab3494514 100644 --- a/source/docs/software/networktables/publish-and-subscribe.rst +++ b/source/docs/software/networktables/publish-and-subscribe.rst @@ -69,7 +69,7 @@ Publishing values is done via a ``set()`` operation. By default, this operation .. tab-item:: C++ :sync: C++ - .. code-block:: cpp + .. code-block:: c++ class Example { // the publisher is an instance variable so its lifetime matches that of the class @@ -110,7 +110,7 @@ Publishing values is done via a ``set()`` operation. By default, this operation .. tab-item:: C++ (Handle-based) :sync: C++ (Handle-based) - .. code-block:: cpp + .. code-block:: c++ class Example { // the publisher is an instance variable, but since it's a handle, it's @@ -298,7 +298,7 @@ Subscribers have a range of different ways to read received values. It's possibl .. tab-item:: C++ :sync: C++ - .. code-block:: cpp + .. code-block:: c++ class Example { // the subscriber is an instance variable so its lifetime matches that of the class @@ -343,7 +343,7 @@ Subscribers have a range of different ways to read received values. It's possibl .. tab-item:: C++ (Handle-based) :sync: C++ (Handle-based) - .. code-block:: cpp + .. code-block:: c++ class Example { // the subscriber is an instance variable, but since it's a handle, it's @@ -533,7 +533,7 @@ An :term:`entry` is a combined publisher and subscriber. The subscriber is alway .. tab-item:: C++ :sync: C++ - .. code-block:: cpp + .. code-block:: c++ class Example { // the entry is an instance variable so its lifetime matches that of the class @@ -583,7 +583,7 @@ An :term:`entry` is a combined publisher and subscriber. The subscriber is alway .. tab-item:: C++ (Handle-based) :sync: C++ (Handle-based) - .. code-block:: cpp + .. code-block:: c++ class Example { // the entry is an instance variable, but since it's a handle, it's @@ -814,7 +814,7 @@ For the most robust code, using the type-specific Publisher, Subscriber, and Ent .. tab-item:: C++ :sync: C++ - .. code-block:: cpp + .. code-block:: c++ class Example { // the entry is an instance variable so its lifetime matches that of the class @@ -1010,7 +1010,7 @@ While in most cases it's only necessary to subscribe to individual topics, it is .. tab-item:: C++ :sync: C++ - .. code-block:: cpp + .. code-block:: c++ class Example { // the subscriber is an instance variable so its lifetime matches that of the class @@ -1047,7 +1047,7 @@ While in most cases it's only necessary to subscribe to individual topics, it is .. tab-item:: C++ (Handle-based) :sync: C++ (Handle-based) - .. code-block:: cpp + .. code-block:: c++ class Example { // the subscriber is an instance variable, but since it's a handle, it's diff --git a/source/docs/software/networktables/reading-array-values-published-by-networktables.rst b/source/docs/software/networktables/reading-array-values-published-by-networktables.rst index d1c0e426b4..e866eb17f6 100644 --- a/source/docs/software/networktables/reading-array-values-published-by-networktables.rst +++ b/source/docs/software/networktables/reading-array-values-published-by-networktables.rst @@ -44,7 +44,7 @@ Writing a Program to Access the Topics System.out.println(); } - .. code-block:: cpp + .. code-block:: c++ nt::DoubleArraySubscriber areasSub; diff --git a/source/docs/software/networktables/tables-and-topics.rst b/source/docs/software/networktables/tables-and-topics.rst index c7188b3ff2..181cd870af 100644 --- a/source/docs/software/networktables/tables-and-topics.rst +++ b/source/docs/software/networktables/tables-and-topics.rst @@ -39,7 +39,7 @@ Having a Topic object or handle does not mean the topic exists or is of the corr .. tab-item:: C++ :sync: C++ - .. code-block:: cpp + .. code-block:: c++ nt::NetworkTableInstance inst = nt::NetworkTableInstance::GetDefault(); std::shared_ptr table = inst.GetTable("datatable"); @@ -60,7 +60,7 @@ Having a Topic object or handle does not mean the topic exists or is of the corr .. tab-item:: C++ (Handle-based) :sync: C++ (Handle-based) - .. code-block:: cpp + .. code-block:: c++ NT_Instance inst = nt::GetDefaultInstance(); diff --git a/source/docs/software/telemetry/robot-telemetry-with-sendable.rst b/source/docs/software/telemetry/robot-telemetry-with-sendable.rst index 6392387e89..74835739ca 100644 --- a/source/docs/software/telemetry/robot-telemetry-with-sendable.rst +++ b/source/docs/software/telemetry/robot-telemetry-with-sendable.rst @@ -29,7 +29,7 @@ To send a ``Sendable`` object to the dashboard, simply use the dashboard's ``put SmartDashboard.putData("Arm PID", armPIDController); - .. code-block:: cpp + .. code-block:: c++ frc::SmartDashboard::PutData("Arm PID", &armPIDController); diff --git a/source/docs/software/telemetry/writing-sendable-classes.rst b/source/docs/software/telemetry/writing-sendable-classes.rst index 42f54cbbec..dabd373b2e 100644 --- a/source/docs/software/telemetry/writing-sendable-classes.rst +++ b/source/docs/software/telemetry/writing-sendable-classes.rst @@ -14,7 +14,7 @@ For example, here is the implementation of ``initSendable`` from WPILib's ``Bang :lineno-start: 151 .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpimath/src/main/native/cpp/controller/BangBangController.cpp - :language: cpp + :language: c++ :lines: 55-69 :linenos: :lineno-start: 55 @@ -55,7 +55,7 @@ To help users ensure safety when interfacing with dashboard values, ``SendableBu :lineno-start: 120 .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibc/src/main/native/cpp/motorcontrol/PWMMotorController.cpp - :language: cpp + :language: c++ :lines: 56-62 :linenos: :lineno-start: 56 diff --git a/source/docs/software/vision-processing/roborio/using-the-cameraserver-on-the-roborio.rst b/source/docs/software/vision-processing/roborio/using-the-cameraserver-on-the-roborio.rst index df2d6b3456..2da2e9c799 100644 --- a/source/docs/software/vision-processing/roborio/using-the-cameraserver-on-the-roborio.rst +++ b/source/docs/software/vision-processing/roborio/using-the-cameraserver-on-the-roborio.rst @@ -18,7 +18,7 @@ The following program starts automatic capture of a USB camera like the Microsof :lineno-start: 7 .. rli:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/QuickVision/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 7-8, 16-18, 20, 25-31 .. rli:: https://raw.githubusercontent.com/robotpy/examples/4cfe0b1ea9cef182e2bd81692746dfe3ae13a337/cscore-quick-vision/robot.py @@ -43,11 +43,11 @@ In the following example a thread created in robotInit() gets the Camera Server :linenos: :lineno-start: 7 - .. tab-item:: CPP - :sync: tabcode-cpp + .. tab-item:: c++ + :sync: tabcode-c++ .. rli:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/IntermediateVision/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 5-20, 23-56, 58-61, 63-64, 69-76 .. tab-item:: PYTHON diff --git a/source/docs/software/vscode-overview/creating-robot-program.rst b/source/docs/software/vscode-overview/creating-robot-program.rst index 05f5167a71..c83d37154a 100644 --- a/source/docs/software/vscode-overview/creating-robot-program.rst +++ b/source/docs/software/vscode-overview/creating-robot-program.rst @@ -32,7 +32,7 @@ The :code:`TimedRobot` class is the base class recommended for most users. It p :lineno-start: 7 .. rli:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/templates/timedskeleton/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 5-29 :linenos: :lineno-start: 5 diff --git a/source/docs/software/wpilib-tools/robot-simulation/device-sim.rst b/source/docs/software/wpilib-tools/robot-simulation/device-sim.rst index b37c4d66f5..f8013c270d 100644 --- a/source/docs/software/wpilib-tools/robot-simulation/device-sim.rst +++ b/source/docs/software/wpilib-tools/robot-simulation/device-sim.rst @@ -26,7 +26,7 @@ Simulation device object can be constructed in two ways: // create a sim controller for the encoder EncoderSim simEncoder = new EncoderSim(encoder); - .. code-block:: cpp + .. code-block:: c++ // create a real encoder object on DIO 2,3 frc::Encoder encoder{2, 3}; @@ -45,7 +45,7 @@ Each simulation class has getter (``getXxx()``/``GetXxx()``) and setter (``setXx encoder.getCount(); // 100 simEncoder.getCount(); // 100 - .. code-block:: cpp + .. code-block:: c++ simEncoder.SetCount(100); encoder.GetCount(); // 100 @@ -74,7 +74,7 @@ In C++, save the ``CallbackStore`` object in the right scope - the callback will store.close(); // cancel the callback - .. code-block:: cpp + .. code-block:: c++ HAL_NotifyCallback callback = [](const char* name, void* param, const HALValue* value) { if (value->type == HAL_INT) { @@ -98,7 +98,7 @@ The ``SimDeviceSim`` object is created using a string key identical to the key t SimDeviceSim device = new SimDeviceSim(deviceKey, index); - .. code-block:: cpp + .. code-block:: c++ frc::sim::SimDeviceSim device{deviceKey, index}; @@ -111,7 +111,7 @@ Once we have the ``SimDeviceSim``, we can get ``SimValue`` objects representing field.get(); field.set(value); - .. code-block:: cpp + .. code-block:: c++ hal::SimDouble field = device.GetDouble(fieldKey); field.Get(); diff --git a/source/docs/software/wpilib-tools/robot-simulation/physics-sim.rst b/source/docs/software/wpilib-tools/robot-simulation/physics-sim.rst index 9dfb4aec1c..07cfcadf09 100644 --- a/source/docs/software/wpilib-tools/robot-simulation/physics-sim.rst +++ b/source/docs/software/wpilib-tools/robot-simulation/physics-sim.rst @@ -51,10 +51,10 @@ In the following example, we simulate an elevator given the mass of the moving c :lineno-start: 47 .. tab-item:: C++ - :sync: cpp + :sync: c++ .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/ElevatorSimulation/include/subsystems/Elevator.h - :language: cpp + :language: c++ :lines: 51-61 :linenos: :lineno-start: 51 @@ -79,16 +79,16 @@ Next, :code:`teleopPeriodic`/:code:`TeleopPeriodic` (Java/C++) uses a simple PID :lineno-start: 99 .. tab-item:: C++ - :sync: cpp + :sync: c++ .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/ElevatorSimulation/cpp/Robot.cpp - :language: cpp + :language: c++ :lines: 20-28 :linenos: :lineno-start: 20 .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/ElevatorSimulation/cpp/subsystems/Elevator.cpp - :language: cpp + :language: c++ :lines: 42-50 :linenos: :lineno-start: 42 @@ -111,10 +111,10 @@ Finally, the simulated encoder's distance reading is set using the simulated ele :lineno-start: 79 .. tab-item:: C++ - :sync: cpp + :sync: c++ .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/ElevatorSimulation/cpp/subsystems/Elevator.cpp - :language: cpp + :language: c++ :lines: 20-35 :linenos: :lineno-start: 20 diff --git a/source/docs/software/wpilib-tools/robot-simulation/unit-testing.rst b/source/docs/software/wpilib-tools/robot-simulation/unit-testing.rst index 2bcbf26ebb..d43c93b5c5 100644 --- a/source/docs/software/wpilib-tools/robot-simulation/unit-testing.rst +++ b/source/docs/software/wpilib-tools/robot-simulation/unit-testing.rst @@ -27,14 +27,14 @@ To provide a "clean slate" for each test, we need to have a function to destroy .. rli:: https://github.com/wpilibsuite/allwpilib/raw/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/UnitTest/include/subsystems/Intake.h - :language: cpp + :language: c++ :lines: 7- .. tab-item:: C++ (Source) :sync: C++ (Source) .. rli:: https://github.com/wpilibsuite/allwpilib/raw/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/UnitTest/cpp/subsystems/Intake.cpp - :language: cpp + :language: c++ :lines: 5- Writing Tests @@ -62,7 +62,7 @@ Both JUnit and GoogleTest have multiple assertion types; the most common is equa :sync: C++ .. rli:: https://github.com/wpilibsuite/allwpilib/raw/v2024.1.1-beta-4/wpilibcExamples/src/test/cpp/examples/UnitTest/cpp/subsystems/IntakeTest.cpp - :language: cpp + :language: c++ :lines: 5- For more advanced usage of JUnit and Google Test, see the framework docs. diff --git a/source/docs/software/wpilib-tools/robotbuilder/advanced/robotbuilder-custom-components.rst b/source/docs/software/wpilib-tools/robotbuilder/advanced/robotbuilder-custom-components.rst index fb68bca386..3f42e3432f 100644 --- a/source/docs/software/wpilib-tools/robotbuilder/advanced/robotbuilder-custom-components.rst +++ b/source/docs/software/wpilib-tools/robotbuilder/advanced/robotbuilder-custom-components.rst @@ -88,7 +88,7 @@ A line-by-line breakdown of the file: This example expects a KiwiDrive class with the constructor -.. code-block:: cpp +.. code-block:: c++ KiwiDrive(SpeedController, SpeedController, SpeedController) diff --git a/source/docs/software/wpilib-tools/robotbuilder/advanced/robotbuilder-writing-pidsubsystem-code.rst b/source/docs/software/wpilib-tools/robotbuilder/advanced/robotbuilder-writing-pidsubsystem-code.rst index ad8fd30837..5ba4c5fd0c 100644 --- a/source/docs/software/wpilib-tools/robotbuilder/advanced/robotbuilder-writing-pidsubsystem-code.rst +++ b/source/docs/software/wpilib-tools/robotbuilder/advanced/robotbuilder-writing-pidsubsystem-code.rst @@ -35,7 +35,7 @@ The height constants and PID constants are automatically generated. private static final double kF = 0.0; // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS - .. code-block:: cpp + .. code-block:: c++ // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTANTS static constexpr const double Bottom = 4.6; @@ -63,7 +63,7 @@ Get Potentiometer Measurement // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=SOURCE } - .. code-block:: cpp + .. code-block:: c++ double Elevator::GetMeasurement() { // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=SOURCE @@ -90,7 +90,7 @@ Calculate PID Output // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=OUTPUT } - .. code-block:: cpp + .. code-block:: c++ void Elevator::UseOutput(double output, double setpoint) { output += setpoint*kF; diff --git a/source/docs/software/wpilib-tools/robotbuilder/introduction/robotbuilder-created-code.rst b/source/docs/software/wpilib-tools/robotbuilder/introduction/robotbuilder-created-code.rst index c2af7196ad..6372a6b43f 100644 --- a/source/docs/software/wpilib-tools/robotbuilder/introduction/robotbuilder-created-code.rst +++ b/source/docs/software/wpilib-tools/robotbuilder/introduction/robotbuilder-created-code.rst @@ -26,7 +26,7 @@ Autogenerated Code SmartDashboard.putData("Auto Mode", m_chooser); - .. code-block:: cpp + .. code-block:: c++ // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS m_chooser.SetDefaultOption("Autonomous", new Autonomous()); @@ -44,7 +44,7 @@ If code inside one of these blocks must be modified, the comments can be removed // ROBOTBUILDER TYPE: Robot. - .. code-block:: cpp + .. code-block:: c++ // ROBOTBUILDER TYPE: Robot. @@ -556,7 +556,7 @@ RobotContainer .. tab-item:: C++ (Source) - .. code-block:: cpp + .. code-block:: c++ :linenos: :lineno-start: 11 :emphasize-lines: 28, 46, 56, 74 diff --git a/source/docs/software/wpilib-tools/robotbuilder/introduction/robotbuilder-testing-with-shuffleboard.rst b/source/docs/software/wpilib-tools/robotbuilder/introduction/robotbuilder-testing-with-shuffleboard.rst index df0967b542..9f3f7606ae 100644 --- a/source/docs/software/wpilib-tools/robotbuilder/introduction/robotbuilder-testing-with-shuffleboard.rst +++ b/source/docs/software/wpilib-tools/robotbuilder/introduction/robotbuilder-testing-with-shuffleboard.rst @@ -32,7 +32,7 @@ Adding Commands Manually SmartDashboard.putData("Open Claw", new OpenClaw(m_claw); SmartDashboard.putData("Close Claw", new CloseClaw(m_claw)); - .. code-block:: cpp + .. code-block:: c++ SmartDashboard::PutData("Autonomous Command", new AutonomousCommand()); SmartDashboard::PutData("Open Claw", new OpenClaw(&m_claw)); diff --git a/source/docs/software/wpilib-tools/robotbuilder/writing-code/robotbuilder-writing-command-code.rst b/source/docs/software/wpilib-tools/robotbuilder/writing-code/robotbuilder-writing-command-code.rst index 86cc3f628d..53b29cafbe 100644 --- a/source/docs/software/wpilib-tools/robotbuilder/writing-code/robotbuilder-writing-command-code.rst +++ b/source/docs/software/wpilib-tools/robotbuilder/writing-code/robotbuilder-writing-command-code.rst @@ -93,7 +93,7 @@ Generated CloseClaw Class - .. code-block:: cpp + .. code-block:: c++ :linenos: :lineno-start: 11 :emphasize-lines: 21, 31, 36 diff --git a/source/docs/software/wpilib-tools/robotbuilder/writing-code/robotbuilder-writing-subsystem-code.rst b/source/docs/software/wpilib-tools/robotbuilder/writing-code/robotbuilder-writing-subsystem-code.rst index be71fd4cdc..ceef85e9e8 100644 --- a/source/docs/software/wpilib-tools/robotbuilder/writing-code/robotbuilder-writing-subsystem-code.rst +++ b/source/docs/software/wpilib-tools/robotbuilder/writing-code/robotbuilder-writing-subsystem-code.rst @@ -104,9 +104,9 @@ Adding Subsystem Capabilities } .. tab-item:: C++ - :sync: cpp + :sync: c++ - .. code-block:: cpp + .. code-block:: c++ :linenos: :lineno-start: 11 :emphasize-lines: 38-52 @@ -176,9 +176,9 @@ Adding the Method Declarations to the Header File (C++ Only) .. tab-set:: .. tab-item:: C++ - :sync: cpp + :sync: c++ - .. code-block:: cpp + .. code-block:: c++ :linenos: :lineno-start: 11 :emphasize-lines: 30-33 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 fee724fe8c..45e2ced705 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 @@ -104,7 +104,7 @@ Imports/Includes :lineno-start: 7 .. tab-item:: C++ - :sync: cpp + :sync: c++ .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/GettingStarted/cpp/Robot.cpp :language: c++ @@ -136,7 +136,7 @@ Imports/Includes import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX; - .. code-block:: cpp + .. code-block:: c++ #include #include @@ -166,7 +166,7 @@ Imports/Includes import edu.wpi.first.wpilibj.drive.DifferentialDrive; - .. code-block:: cpp + .. code-block:: c++ #include #include @@ -205,7 +205,7 @@ Defining the variables for our sample robot :lineno-start: 19 .. tab-item:: C++ - :sync: cpp + :sync: c++ .. remoteliteralinclude:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2024.1.1-beta-4/wpilibcExamples/src/main/cpp/examples/GettingStarted/cpp/Robot.cpp :language: c++ @@ -246,9 +246,9 @@ Defining the variables for our sample robot private final Timer m_timer = new Timer(); .. tab-item:: C++ - :sync: cpp + :sync: c++ - .. code-block:: cpp + .. code-block:: c++ public: Robot() { @@ -260,7 +260,7 @@ Defining the variables for our sample robot m_timer.Start(); } - .. code-block:: cpp + .. code-block:: c++ private: // Robot drive system @@ -298,9 +298,9 @@ Defining the variables for our sample robot private final Timer m_timer = new Timer(); .. tab-item:: C++ - :sync: cpp + :sync: c++ - .. code-block:: cpp + .. code-block:: c++ Robot() { // We need to invert one side of the drivetrain so that positive voltages @@ -311,7 +311,7 @@ Defining the variables for our sample robot m_timer.Start(); } - .. code-block:: cpp + .. code-block:: c++ private: // Robot drive system