skip to content

A drone summing weighted seek and obstacle-avoidance forces stalls in front of a pillar or jitters beside it; why, and how do priority arbitration or context steering fix it?

level: seniorimportance: should knowfreq 45%

answer

  1. vectors that disagree cancel
  2. compromise nobody asked for
  3. first urgent group wins
  4. interest and danger slots
  5. mask, then pick

basics

~20 s

Weighted blending adds vectors, so avoidance pointing back against seek cancels it and the drone stalls, or the sum flips as avoidance grows. Priority arbitration lets the most urgent behaviour win; context steering chooses among directions before building one vector.

solid answer

~50 s

A weighted sum is a compromise in vector space. With the pillar dead ahead, avoidance points back against seek and the sum is near zero, a local minimum where the drone hovers. Elsewhere the sum points where neither behaviour wanted, and as avoidance ramps up it swings between frames. **Priority arbitration** evaluates behaviour groups in order and takes the first whose output is above a small threshold, or fills the force budget in priority order, so avoidance overrides seek instead of averaging with it; it needs hysteresis so groups do not flicker. **Context steering** has each behaviour write into a ring of direction slots: an **interest** map and a **danger** map. Slots with too much danger are masked and the drone takes the most interesting slot left. Nothing cancels, but the heading resolution is the slot count, and none of these fixes a dead end that needs a route.

code

pseudocode · 16 lines
pseudocode
SLOTS = 16                                   // 22.5 degrees per slot
function contextSteer(agent, behaviours):
    interest = array(SLOTS, 0)
    danger = array(SLOTS, 0)                 // values in 0..1
    for b in behaviours:
        b.write(agent, interest, danger)     // each slot keeps the max written
    floor = min(danger)
    best = -1
    for i in 0 .. SLOTS - 1:
        if danger[i] > floor + DANGER_TOLERANCE:
            continue                         // masked
        if best == -1 or interest[i] > interest[best]:
            best = i
    // the least dangerous slot always survives the mask, so best >= 0 here
    speed = agent.maxSpeed * interest[best] * (1 - danger[best])
    return slotDirection(best) * speed       // a desired velocity

go deeper

for a junior

Recall that blending adds weighted forces, that opposing forces can cancel, and that priority arbitration lets the most urgent behaviour take over.

for a middle

Explain cancellation, compromise and oscillation in a weighted sum, and walk through building, masking and choosing from interest and danger maps.

for a senior

Diagnose a stall or jitter from logged vectors or slot maps, pick arbitration or context steering for the agent, and add hysteresis where decisions flicker.

for a principal

Consider making one combination scheme the standard for all agents, so designers add behaviours without retuning every existing weight.

## Why weighted sums fail Combining behaviours by **weighted blending**, `w1 * seek + w2 * avoid + ...`, is the first thing everyone tries, and it works while the behaviours roughly agree. When they disagree, vector addition causes three distinct failures: - **Cancellation.** A drone heading for a target with a pillar dead ahead gets a seek force forward and an avoidance force backward. The sum is close to zero and the drone hovers in front of the pillar. This is the same local-minimum problem potential fields have. - **Compromise.** When two behaviours each favour a different gap between pillars, their average points straight at the pillar between the gaps. - **Oscillation.** Avoidance usually grows as the obstacle gets closer. Near the threshold, one tick the sum points left, the next tick right, and the drone jitters beside the obstacle. Tuning weights moves these failures around rather than removing them, and every added behaviour multiplies the tuning work. Normalising each force first does not help either; equal-length opposing vectors still cancel. ## Priority arbitration **Priority arbitration** stops averaging the behaviours that matter most: 1. Group behaviours by urgency, for example collision avoidance, then separation, then path following, then wander. 2. Each tick, evaluate the groups in priority order. 3. Take the first group whose combined output exceeds a small threshold, and ignore the rest; or, in the budget variant, let each group in order use whatever is left of the maximum force. 4. Blend only inside a group, where the behaviours rarely disagree. The drone now turns away from the pillar instead of stalling. The cost is a new failure: when the top group hovers around its threshold it switches on and off, so add **hysteresis**, such as a lower threshold to release a group than to engage it. ## Context steering **Context steering** moves the decision out of vector space: 1. Divide the directions around the agent into a fixed set of **slots**, for example 16 slots of 22.5 degrees each. 2. Each behaviour writes into two maps over those slots. Seek writes **interest**, highest toward the target. Avoidance writes **danger**, highest toward obstacles. 3. Combine per slot, typically by taking the maximum, so behaviours stay independent. 4. **Mask** every slot whose danger is clearly above the lowest danger present. 5. Among the slots left, pick the one with the highest interest, optionally interpolating with its neighbours, and set speed from how strong the interest and how low the danger are. With the pillar ahead, the forward slot is masked and the drone takes the best open slot to one side. Nothing cancels, because danger removes options instead of subtracting a vector. Because each behaviour only writes into the maps, adding a new one, such as keeping near squadmates, means writing more interest or danger; it does not require retuning every existing weight against it. The price is work and memory proportional to the slot count for each agent on each tick, which is small, and a heading resolution set by that count. ## How they compare | Approach | Combines in | Stall from cancellation | Main cost | |---|---|---|---| | Weighted blending | velocity or force space | yes | endless weight tuning | | Priority arbitration | per group, in order | no, between groups | flicker at thresholds | | Context steering | direction slots | no | heading resolution, map memory | ## What none of them fix All three are **local**: they see the next few metres. A U-shaped wall between the drone and its target still traps it: from inside the U every direction toward the target is blocked, and the way out leads away from the target, which no local rule rewards. Getting out is the global planner's job; it supplies waypoints, and steering combines behaviours on the way to the next one. ## Debugging approach - Draw each behaviour's vector, or each slot's interest and danger, every frame. - Log which priority group won each tick; flicker shows up as alternating winners. - Replay the exact situation at a fixed timestep, so the stall reproduces. - Check whether the stall is a true cancellation, with two large opposing forces, or simply a zero desired velocity from one behaviour.

  • How do you stop a priority-arbitrated agent from flickering between avoidance and path following?
    Add hysteresis: engage avoidance when its output passes one threshold and release it only when it falls below a lower one, or keep the winning group for a minimum time. Smoothing the final steering over a few ticks also hides single-tick switches. The point is that the decision should not reverse because a value wobbled around one cutoff.
  • Why does context steering mask dangerous slots instead of subtracting danger from interest?
    Subtracting puts the behaviours back into a weighted trade-off: a very interesting slot can outweigh moderate danger, and two values can still cancel into a weak, ambiguous choice. Masking makes danger a constraint, so the agent picks the best of the safe directions. Comparing danger with the lowest danger present keeps at least one slot open even when every direction carries some risk.

Two people pushing a cart from opposite ends, one toward the shop and one away from a puddle, leave it barely moving; agreeing that whoever spots a hazard takes charge until it is passed is priority arbitration.

  • Careful weight tuning removes the stall for every obstacle layout.
  • Normalising each behaviour's force before summing prevents cancellation.
  • Priority arbitration averages the behaviours using their priority numbers as weights.
  • Context steering is a pathfinding method that finds a route around obstacles.
  • Jitter beside an obstacle must come from the physics step, not the steering mix.