Skip to content

docs(commandbased): Add Python code examples and RobotPy API references (#2645) - #3338

Open
lukalyc wants to merge 2 commits into
wpilibsuite:mainfrom
lukalyc:feature/issue-2645-python-command-docs
Open

docs(commandbased): Add Python code examples and RobotPy API references (#2645)#3338
lukalyc wants to merge 2 commits into
wpilibsuite:mainfrom
lukalyc:feature/issue-2645-python-command-docs

Conversation

@lukalyc

@lukalyc lukalyc commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

This PR completes the Python documentation additions for the Commands v2 section as tracked in issue #2645 (following up on PR #2648).

Summary of Changes:

  • binding-commands-to-triggers.rst: Added Python code tabs for Trigger bindings (onTrue, whileTrue, toggleOnTrue, chaining, composing with and_, debouncing) and Python API links (commands2.button.Trigger, commands2.button.CommandXboxController, commands2.button.JoystickButton).
  • command-scheduler.rst: Added Python API references for commands2.CommandScheduler methods (schedule, run, onCommandInitialize, etc.) and Python code tab for event callbacks.
  • index.rst: Added Functions and Lambdas (Python) subsection under "Passing Functions As Parameters".
  • organizing-command-based.rst: Added Python code tabs for inline commands, factory methods, static/instance factories, subclassing Command, and subclassing SequentialCommandGroup.
  • pid-subsystems-commands.rst: Added wpimath.controller.PIDController API reference and Python tab for RapidReactCommandBot shooter.
  • profile-subsystems-commands.rst: Added wpimath.trajectory.TrapezoidProfile API reference and Python tab for DriveDistanceOffboard.
  • profilepid-subsystems-commands.rst: Added wpimath.controller.ProfiledPIDController API reference and Python tab for RapidReactCommandBot drive.
  • structuring-command-based-project.rst: Added Python template links and Python tabs for robot.py, robotcontainer.py, and constants.py.

Closes #2645

@lukalyc
lukalyc force-pushed the feature/issue-2645-python-command-docs branch from 98d9b61 to 514f254 Compare August 2, 2026 21:22

## Composing Triggers

The ``Trigger`` class can be composed to create composite triggers through the ``and()``, ``or()``, and ``negate()`` methods (or, in C++, the ``&&``, ``||``, and ``!`` operators). For example:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we document the Python bitwise operators (&, |, ~) here too?

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 this pull request may close these issues.

Include Robotpy Examples and references in document pages about Command based Robots

2 participants