Skip to content

Commit

Permalink
added all of the missing examples (#2720)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasondaming authored Sep 1, 2024
1 parent 4e46de2 commit 14f3280
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions source/docs/software/examples-tutorials/wpilib-examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@ These examples demonstrate basic/minimal robot functionality. They are useful f
These examples demonstrate WPILib implementations of common robot controls. Sensors may be present, but are not the emphasized concept of these examples.

* **DifferentialDriveBot** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/differentialdrivebot), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/DifferentialDriveBot), [Python](https://github.com/robotpy/examples/tree/main/DifferentialDriveBot)): Demonstrates an advanced differential drive implementation, including encoder-and-gyro odometry through the ``DifferentialDriveOdometry`` class, and composition with PID velocity control through the ``DifferentialDriveKinematics`` and ``PIDController`` classes.
* **Elevator with profiled PID controller** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/elevatorprofiledpid), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/ElevatorProfiledPID), [Python](https://github.com/robotpy/examples/tree/main/ElevatorProfiledPID)): Demonstrates the use of the ``ProfiledPIDController`` class to control the position of an elevator mechanism.
* **Elevator with trapezoid profiled PID** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/elevatortrapezoidprofile), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/ElevatorTrapezoidProfile), [Python](https://github.com/robotpy/examples/tree/main/ElevatorTrapezoidProfile)): Demonstrates the use of the ``TrapezoidProfile`` class in conjunction with a "smart motor controller" to control the position of an elevator mechanism.
* **DifferentialDrivePoseEstimator** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/differentialdriveposeestimator), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/DifferentialDrivePoseEstimator)): Demonstrates an advanced differential drive implementation with all the features of ``DifferentialDriveBot``. In addition this example uses ``DifferentialDrivePoseEstimator`` to track the robots position on the field. It demonstrates these features by using WPILib Simulation.
* **Elevator with Profiled PID Controller** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/elevatorprofiledpid), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/ElevatorProfiledPID), [Python](https://github.com/robotpy/examples/tree/main/ElevatorProfiledPID)): Demonstrates the use of the ``ProfiledPIDController`` class to control the position of an elevator mechanism.
* **Elevator with Trapezoid Profiled PID** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/elevatortrapezoidprofile), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/ElevatorTrapezoidProfile), [Python](https://github.com/robotpy/examples/tree/main/ElevatorTrapezoidProfile)): Demonstrates the use of the ``TrapezoidProfile`` class in conjunction with a "smart motor controller" to control the position of an elevator mechanism.
* **Elevator with Exponential Profiled PID** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/elevatorexponentialprofile), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/ElevatorExponentialProfile)): Demonstrates the use of the ``ExponentialProfile`` class in conjunction with a "smart motor controller" to control the position of an elevator mechanism.
* **Flywheel Bang-Bang Controller** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/flywheelbangbangcontroller), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/FlywheelBangBangController/cpp), [Python](https://github.com/robotpy/examples/tree/main/FlywheelBangBangController)): Uses the ``BangBangController`` class to simply yet effectively control a flywheel.
* **Gyro Mecanum** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gyromecanum), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/GyroMecanum), [Python](https://github.com/robotpy/examples/tree/main/GyroMecanum)): Demonstrates field-oriented control of a mecanum robot through the ``MecanumDrive`` class in conjunction with a gyro.
* **MecanumBot** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mecanumbot), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/MecanumBot), [Python](https://github.com/robotpy/examples/tree/main/MecanumBot)): Demonstrates an advanced mecanum drive implementation, including encoder-and-gyro odometry through the ``MecanumDriveOdometry`` class, and composition with PID velocity control through the ``MecanumDriveKinematics`` and ``PIDController`` classes.
* **Mecanum Drive PoseEstimator** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mecanumdriveposeestimator), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/MecanumDrivePoseEstimator)): Demonstrates an advanced mecanum drive implementation with all the features of ``MecanumBot``. In addition this example uses ``MecanumDrivePoseEstimator`` to track the robots position on the field.
* **PotentiometerPID** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/potentiometerpid), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/PotentiometerPID), [Python](https://github.com/robotpy/examples/tree/main/PotentiometerPID)): Demonstrates the use of the ``PIDController`` class and a potentiometer to control the position of an elevator mechanism.
* **SwerveBot** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/swervebot), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/SwerveBot), [Python](https://github.com/robotpy/examples/tree/main/SwerveBot)): Demonstrates an advanced swerve drive implementation, including encoder-and-gyro odometry through the ``SwerveDriveOdometry`` class, and composition with PID position and velocity control through the ``SwerveDriveKinematics`` and ``PIDController`` classes.
* **Swerve Drive PoseEstimator** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/swervedriveposeestimator), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/SwerveDrivePoseEstimator)): Demonstrates an advanced swerve drive implementation with all the features of ``SwerveBot``. In addition this example uses ``SwerveDrivePoseEstimator`` to track the robots position on the field.
* **UltrasonicPID** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/ultrasonicpid), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/UltrasonicPID), [Python](https://github.com/robotpy/examples/tree/main/UltrasonicPID)): Demonstrates the use of the ``PIDController`` class in conjunction with an ultrasonic sensor to drive to a set distance from an object.

## Sensor Examples
Expand All @@ -60,6 +65,7 @@ These examples demonstrate the use of the :ref:`Command-Based framework <docs/so
* **DriveDistanceOffboard** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/drivedistanceoffboard), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/DriveDistanceOffboard), [Python](https://github.com/robotpy/examples/tree/main/DriveDistanceOffboard)): Demonstrates the use of a ``TrapezoidProfileCommand`` in conjunction with a "smart motor controller" to drive forward by a set distance with a trapezoidal motion profile.
* **FrisbeeBot** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/frisbeebot), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/Frisbeebot), [Python](https://github.com/robotpy/examples/tree/main/FrisbeeBot)): A complete set of robot code for a simple frisbee-shooting robot typical of the 2013 FRC\ |reg| game *Ultimate Ascent*. Demonstrates simple PID control through the ``PIDSubystem`` class.
* **Gears Bot** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gearsbot), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/GearsBot)): A complete set of robot code for the WPI demonstration robot, GearsBot.
* **Rapid React Command Bot** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/rapidreactcommandbot), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/RapidReactCommandBot)): This project uses the latest command based best practices and the Epilogue logging system. It is capable of playing the FRC 2022 game Rapid React.
* **Gyro Drive Commands** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/gyrodrivecommands), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/GyroDriveCommands), [Python](https://github.com/robotpy/examples/tree/main/GyroDriveCommands)): Demonstrates the use of ``PIDCommand`` and ``ProfiledPIDCommand`` in conjunction with a gyro to turn a robot to face a specified heading and to stabilize heading while driving.
* **Inlined Hatchbot** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/hatchbotinlined), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/HatchbotInlined), [Python](https://github.com/robotpy/examples/tree/main/HatchbotInlined)): A complete set of robot code for a simple hatch-delivery bot typical of the 2019 FRC game *Destination: Deep Space*. Commands are written in an "inline" style, in which explicit subclassing of ``Command`` is avoided.
* **Traditional Hatchbot** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/hatchbottraditional), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/HatchbotTraditional), [Python](https://github.com/robotpy/examples/tree/main/HatchbotTraditional)): A complete set of robot code for a simple hatch-delivery bot typical of the 2019 FRC game *Destination: Deep Space*. Commands are written in a "traditional" style, in which subclasses of ``Command`` are written for each robot action.
Expand All @@ -81,6 +87,7 @@ These examples demonstrate the use of the :ref:`State-Space Control <docs/softwa
These examples demonstrate the use of the physics simulation.

* **ElevatorSimulation** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/elevatorsimulation), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/ElevatorSimulation), [Python](https://github.com/robotpy/examples/tree/main/ElevatorSimulation)): Demonstrates the use of physics simulation with a simple elevator.
* **ElevatorSimulation with Exponential PID** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/elevatorexponentialsimulation), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/ElevatorExponentialSimulation)): Demonstrates the use of physics simulation of an elevator being controlled with exponential profiled PID.
* **ArmSimulation** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/armsimulation), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/ArmSimulation), [Python](https://github.com/robotpy/examples/tree/main/ArmSimulation)): Demonstrates the use of physics simulation with a simple single-jointed arm.
* **SimpleDifferentialDriveSimulation** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/simpledifferentialdrivesimulation), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/SimpleDifferentialDriveSimulation)): A barebones example of a basic drivetrain that can be used in simulation.

Expand All @@ -89,9 +96,14 @@ These examples demonstrate the use of the physics simulation.
These examples demonstrate miscellaneous WPILib functionality that does not fit into any of the above categories.

* **Addressable LED** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/addressableled), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/AddressableLED), [Python](https://github.com/robotpy/examples/tree/main/AddressableLED)): Demonstrates the use of the ``AddressableLED`` class to control RGB LEDs for robot decoration and/or driver feedback.
* **Digital Communication** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/digitalcommunication), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/DigitalCommunication), [Python](https://github.com/robotpy/examples/tree/main/DigitalCommunication)): This is a sample program demonstrating how to communicate to a light controller from the robot code using the roboRIO's DIO ports.
* **I2C Communication** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/i2ccommunication), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/I2CCommunication), [Python](https://github.com/robotpy/examples/tree/main/I2CCommunication)): This is a sample program demonstrating how to communicate to a light controller from the robot code using the roboRIO's I2C port.
* **DMA** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/dma/), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/DMA)): Demonstrates the use of DMA (Direct Memory Access) to read from sensors without using the RoboRIO's CPU.
* **HAL** ([C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/HAL)): Demonstrates the use of HAL (Hardware Abstraction Layer) without the use of the rest of WPILib. This example is for advanced users (C++ only).
* **HID Rumble** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/hidrumble), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/HidRumble), [Python](https://github.com/robotpy/examples/tree/main/HidRumble)): Demonstrates the use of the "rumble" functionality for tactile feedback on supported HIDs (such as XboxControllers).
* **Shuffleboard** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/shuffleboard), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/ShuffleBoard), [Python](https://github.com/robotpy/examples/tree/main/ShuffleBoard)): Demonstrates configuring tab/widget layouts on the "Shuffleboard" dashboard from robot code through the ``Shuffleboard`` class's fluent builder API.
* **RomiReference** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/romireference), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/RomiReference), [Python](https://github.com/robotpy/examples/tree/main/RomiReference)): A command based example of how to run the :doc:`Romi robot </docs/romi-robot/index>`.
* **XRPReference** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/xrpreference), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/XRPReference)): A command based example of how to run the :doc:`XRP robot </docs/xrp-robot/index>`.
* **Mechanism2d** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/mechanism2d), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/Mechanism2d), [Python](https://github.com/robotpy/examples/tree/main/Mechanism2d)): A simple example of using :doc:`Mechanism2d </docs/software/dashboards/glass/mech2d-widget>`.
* **EventLoop** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/eventloop), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/EventLoop/cpp)): Demonstrates the use of the ``EventLoop`` class that allows code to be called based on a boolean condition in the event-driven programming style.
* **UnitTest** ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/unittest), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/main/cpp/examples/UnitTest)): Shows how to do :doc:`Unit Testing </docs/software/wpilib-tools/robot-simulation/unit-testing>`. The test files need to be in a separate Test directory ([Java](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibjExamples/src/test/java/edu/wpi/first/wpilibj/examples/unittest), [C++](https://github.com/wpilibsuite/allwpilib/tree/main/wpilibcExamples/src/test/cpp/examples/UnitTest/cpp)).

0 comments on commit 14f3280

Please sign in to comment.