feat: add stateful control task API - #3238
Open
TomCC7 wants to merge 8 commits into
Open
Conversation
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## main #3238 +/- ##
==========================================
- Coverage 75.20% 74.99% -0.21%
==========================================
Files 1128 1130 +2
Lines 107954 108359 +405
Branches 9751 9761 +10
==========================================
+ Hits 81188 81266 +78
- Misses 23955 24355 +400
+ Partials 2811 2738 -73
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 24 files with indirect coverage changes 🚀 New features to boost your workflow:
|
TomCC7
commented
Jul 28, 2026
TomCC7
marked this pull request as ready for review
July 28, 2026 05:56
TomCC7
requested review from
Dreamsorcerer,
leshy,
mustafab0,
paul-nechifor and
spomichter
as code owners
July 28, 2026 05:56
TomCC7
force-pushed
the
cc/feat/api-for-stateful-cc-task
branch
from
July 30, 2026 00:52
9b4708e to
5d70e08
Compare
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution path
mainProblem
Control tasks were originally tick-driven and effectively stateless:
compute()received the completeCoordinatorStateneeded to produce the next command.Tasks can now expose RPC commands that run outside
compute(). For example,JointTrajectoryTask.execute()must validate a trajectory against the latest joint state, but it receives no state argument. The previous workaround added trajectory-specific methods toControlCoordinator, making the generic coordinator depend on an optional task and requiring another wrapper for every future stateful task command.Tasks need a narrow way to fetch the coordinator's latest observation during an RPC command without taking ownership of state collection.
Solution
CoordinatorStatebefore task filtering.BaseControlTaskinstances transparent access throughself.context.get_state().ControlTaskContextstateless: it exposes a function that reads coordinator-owned state and performs no hardware read or freshness check.RuntimeError.ControlTasksupport without requiring context.task_invoke(task_name, method, kwargs).TASK_EXPOSESas a strict allowlist, validate arguments, and propagate task results and exceptions unchanged.JointTrajectoryTaskthe fixed unique namejoint_trajectory, move start-state validation into the task, and remove trajectory-specific coordinator RPCs and state injection.Test organization
dimos/control/test_task_context.py.test_manipulation_unit.py; the redundanttest_plan_execution.pysuite is removed.test_manipulation_drake_integration.pyand keeps one plan-to-dispatch integration boundary instead of duplicating mocked unit behavior.Validation
Local result after rebasing onto
main:648 passed, 9 deselectedacrossdimos/controlanddimos/manipulation; mypy passed 925 source files.AI assistance
Codex with GPT-5 helped design, implement, migrate, and test this change. The author reviewed the design decisions interactively.
Checklist