add opmoderobot framework - #3328
Conversation
|
Update the DS used for screenshots. |
|
PRs for 2027 should be targeted to main now. I retargetted the PR |
sciencewhiz
left a comment
There was a problem hiding this comment.
I think it would be helpful to have a short section describing why opmodes (ie similar to the motivation section from the design document). It would also be helpful to have a section on differences from the FTC implementation, to help teams migrating.
|
|
||
| .. note:: Selecting a different opmode while the robot is enabled automatically disables the robot first, so ``end()`` is always called before the switch. | ||
|
|
||
| **If a different opmode is selected while the robot is already disabled**, ``close()`` is called (or the object is destroyed) with no ``end()`` call, since the opmode was never enabled. |
There was a problem hiding this comment.
This is worded a little weird. Does the behavior change if the opmode was or wasn't enabled?
|
|
||
| - Replace per-mode methods in ``Robot`` (``autonomousInit``, ``teleopPeriodic``, etc.) with separate ``@Autonomous`` and ``@Teleop`` opmode classes. | ||
| - Replace ``SendableChooser`` with multiple ``@Autonomous`` classes. | ||
| - Replace ``utilityInit``/``utilityPeriodic`` with ``@Utility`` opmode classes. |
There was a problem hiding this comment.
Any reason not to combine Utility into the Autonomous/Teleop bullet above?
| .. tab-set-code:: | ||
|
|
||
| .. rli:: https://raw.githubusercontent.com/wpilibsuite/allwpilib/v2027.0.0-alpha-6/wpilibjExamples/src/main/java/org/wpilib/templates/opmode/Robot.java | ||
| :language: java |
There was a problem hiding this comment.
Use the :lines: and :lineno-match: directive to avoid boilerplate (like the copyright notice). See below for examples
I agree; Amanda's PR adds a special FTC section to the sidebar, so I was going to add some migration info there once that lands instead of putting program-specific transition info on a page for both programs. |
j5155
left a comment
There was a problem hiding this comment.
Thanks for writing this. I think this is overall a pretty great explanation already from the perspective of an experienced FRC and Java programmer, but I have some nitpicky feedback to make it understandable for new programmers.
The biggest thing is that I'd love to see more explanations of the use cases for the functions so it's clear what they're actually for. Also, I would recommend avoiding semicolons and em dashes entirely, since they make the text look AI generated.
There's a Python OpMode example PR, but it isn't a template like what's used for Java/C++ on this page. |
I didn't include any Python examples because I don't even know if we have Python examples with OpModeRobot rn