Skip to content

Add SequenceArbitrator#155

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/add-sequence-arbitrator
Draft

Add SequenceArbitrator#155
Copilot wants to merge 3 commits intomainfrom
copilot/add-sequence-arbitrator

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 21, 2026

  • Explore repository structure and understand existing arbitrator patterns
  • Create include/arbitration_graphs/sequence_arbitrator.hpp (main header)
  • Create include/arbitration_graphs/internal/sequence_arbitrator_io.hpp (IO/display)
  • Create test/sequence_arbitrator.cpp (unit tests)
  • Create python_bindings/include/arbitration_graphs_py/sequence_arbitrator.hpp (Python bindings)
  • Update python_bindings/src/bindings.cpp to register the new arbitrator
  • Fix getCommand logic: sub-behaviors are activated lazily; advance at most one step per call (per Lauer 2010 definition)
  • Fix tests to match correct per-call sequential execution (A→B→C across three separate calls)
  • All 8 tests pass
Original prompt

This section details on the original issue you should resolve

<issue_title>Add sequence arbitrator</issue_title>
<issue_description>All of the arbitrator types are implemented. All of them? No! One small indomitable arbitrator holds out against implementation.

Folks, we are missing the sequence arbitrator class 😱</issue_description>

Comments on the Issue (you are @copilot in this section)

@orzechow This shouldn't be a big deal, but we should follow the original definition of Lauer (invocation and commitment condition as well as algorithm):

Martin Lauer, Roland Hafner, Sascha Lange, and Martin Riedmiller, “Cognitive concepts in autonomous soccer playing robots,” Cognitive Systems Research, vol. 11, no. 3, pp. 287–309, 2010, doi: 10.1016/j.cogsys.2009.12.003.

Let's try this with Copilot 😁

@copilot read the Lauer paper and stick to it's definition. Do not attempt implementing if you cannot access/find the paper. </comment_new>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: orzechow <5220714+orzechow@users.noreply.github.com>
Copilot AI changed the title [WIP] Add sequence arbitrator implementation Add SequenceArbitrator Feb 21, 2026
Copilot AI requested a review from orzechow February 21, 2026 13:11
Copy link
Copy Markdown
Member

@orzechow orzechow left a comment

Choose a reason for hiding this comment

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

Thanks, that's a great starting point!

Please consider my suggestions and comments. Fix them and improve the code accordingly.

Comment thread test/sequence_arbitrator.cpp Outdated
protected:
using OptionFlags = SequenceArbitrator<DummyEnvironmentModel, DummyCommand>::Option::Flags;

// Behaviors: first two have invocation=false (unavailable), remaining have invocation=true
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.

Suggested change
// Behaviors: first two have invocation=false (unavailable), remaining have invocation=true
// Behaviors: first two have commitment=false (unavailable), remaining have invocation=true

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 98e2bd4.

Comment thread test/sequence_arbitrator.cpp Outdated
Comment on lines +61 to +64
// First call: A has commitment=false → immediately advances to B
// B has commitment=false → immediately advances to C
// C has commitment=true → executes C
EXPECT_EQ("BehaviorC", testSequenceArbitrator.getCommand(time, environmentModel));
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.

You didn't get the general arbitration logic right.

A behavior with true invocation condition can become active. The commitment condition only hints its arbitrator if this behavior should be continued. A behavior with false CC but true IC still can be called multiple times in a row, but needs a round of loseControl/gainControl in between.

For this sequence arbitrator test case this means:

The first call to getCommand (w.r.t. the time step) activates and calls BehaviorA (A.gainControl and A.getCommand) → testSequenceArbitrator.getCommand returns behaviorA

The second call to getCommand (w.r.t. the time step) deactivates A as of if its CC (A.loseControl), then activates and calls BehaviorB (B.gainControl and B.getCommand) → testSequenceArbitrator.getCommand returns behaviorB

The third call to getCommand (w.r.t. the time step) deactivates B as of if its CC (B.loseControl), then activates and calls BehaviorC (C.gainControl and C.getCommand) → testSequenceArbitrator.getCommand returns behaviorC

Following calls to getCommand (w.r.t. the time step) keep C active as of if its CC (no loseControl) and call BehaviorC (C.getCommand) → testSequenceArbitrator.getCommand returns behaviorC

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed in 98e2bd4. The getCommand logic now matches Lauer's definition:

  • gainControl only resets state; sub-behavior activation is deferred
  • Each getCommand call activates the current sub-behavior (if not yet active) and executes it
  • Advancement to the next sub-behavior happens at most one step per call — only when the current sub-behavior's CC is false on the following call

With A(CC=false), B(CC=false), C(CC=true):

  1. Call 1: gainControl AgetCommand A → "BehaviorA"
  2. Call 2: loseControl A, gainControl BgetCommand B → "BehaviorB"
  3. Call 3: loseControl B, gainControl CgetCommand C → "BehaviorC"
  4. Subsequent: getCommand C → "BehaviorC"

…getCommand call

Co-authored-by: orzechow <5220714+orzechow@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented Feb 21, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

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.

Add sequence arbitrator

2 participants