A MoveIt PlanningScene diff is a set of changes to an existing scene. It may add, move, or remove collision objects; update robot state; alter attached objects; or change other scene components. The message can be small because unchanged information comes from the receiver's current planning scene. That efficiency creates a requirement: producer and consumer must agree on the baseline to which the diff applies.

A diff captured without its baseline is not a complete description of the world. Replaying it against a different object set, robot state, transform set, or allowed-collision matrix can produce another valid-looking scene with different collision results.

Full scenes and diffs have different contracts

The PlanningScene message includes an is_diff flag. MoveIt planning-scene code can serialize a complete scene with is_diff false or a diff with is_diff true. The diff serializer also marks the embedded robot state as a diff. The API documentation explains that a diff message is applied to existing data: values can be appended or overwritten, while data omitted from the patch is inherited.

A complete scene establishes a broad baseline. It contains the robot state, transforms, collision settings, objects, and octomap components selected for serialization. A diff deliberately omits unchanged components. Empty fields in a diff generally do not mean that the corresponding baseline data should be erased.

Object operations carry their own semantics. An ADD or MOVE operation needs an object identity and appropriate geometry or pose context; REMOVE names what should disappear. Reusing an object ID can update the receiver's existing object rather than create an independent history entry. Record both operation and ID.

Receiver state determines the result

Suppose baseline A contains pallet_1 and fixture_7. A diff removes pallet_1 and adds tote_3. Applied to A, the result contains fixture_7 and tote_3. Applied to baseline B, which lacks pallet_1 but contains an extra cart_9, the same diff leaves cart_9 present. The patch bytes are identical; the resulting world is not.

Robot state has a similar issue. A partial RobotState diff can overwrite selected joints while inheriting others. If the inherited joints differ, collision checks can change even when the patch names the same updated joint values.

Transforms and attached bodies matter too. An object pose expressed in a frame requires a compatible transform context. An attachment operation changes whether geometry follows the robot and which touch links or link association apply. A stale or missing baseline can place the same geometry differently.

Ordering is part of the evidence

Multiple diffs form an ordered change stream. Removing an object before adding it has different transient behavior from adding a replacement before removing the old one. Applying the same diff twice may be harmless for some idempotent updates but wrong for other operations.

Do not treat transport sequence as scene revision automatically. A ROS topic can reconnect, drop messages under QoS, or deliver to a late joiner according to its policy. The application needs a scene revision, snapshot identifier, or another reconciliation mechanism if exact history matters.

MoveIt's PlanningSceneMonitor can publish a full planning scene first and then maintained diffs. Its source explicitly sends a complete scene at publishing startup before emitting updates. This pattern gives subscribers a baseline, but a subscriber that misses, discards, or replaces that snapshot still needs recovery.

Design a baseline protocol

Give each complete scene a stable revision identifier or content hash. Associate every diff with the expected base revision and a monotonically increasing change number. If the receiver's revision does not match, stop applying patches and request a fresh complete scene.

Apply a diff atomically under the scene's update lock. Avoid letting a planner observe half of a multi-object change. If the application must coordinate an object move with an allowed-collision change, package or synchronize them so a planning request cannot see an unintended intermediate state.

After application, compute or record the resulting revision. Acknowledging receipt of a diff is weaker than confirming that the expected resulting scene exists. The acknowledgement should identify the applied change and resulting baseline.

Keep producers single-purpose. Perception may own detected obstacles, while task logic owns fixtures and attached workpieces. Define object-ID namespaces and authority rules so two sources do not overwrite the same ID by accident.

Validate the resulting scene

For each test, begin from a known complete snapshot. Apply the diff, then serialize or query the resulting scene and compare object IDs, poses, shapes, attachments, robot joints, transforms, and collision settings with an independently defined expectation.

Run a wrong-baseline negative control. Add an extra obstacle or modify an inherited joint before applying the same diff. The test should detect the base-revision mismatch rather than silently accept a different result.

Test a missed-diff sequence. Drop one change, deliver the next, and verify that the receiver requests resynchronization. Then restart the subscriber and confirm that it obtains a complete scene before accepting new diffs.

Check removal and replacement carefully. Confirm that the intended geometry is absent from the world and, if attached, absent or present in the robot state as required. Query collision results at selected robot configurations instead of only counting objects.

Record frame stamps and transform availability for externally framed collision objects. A correct ID with a wrong frame can be more dangerous than an obvious missing object.

Planning needs a captured view

Even a synchronized monitor can change while a planning request is running. Capture or lock the scene revision used for a plan, and record that revision with the trajectory. If execution begins later, compare current world state with the planning baseline and revalidate or replan according to policy.

A planning result is therefore evidence about a robot state and scene revision, not a timeless statement that the path is collision-free. World changes after planning require another decision.

State the result narrowly

A defensible report says that diff D was applied once, in order, to verified baseline B, producing revision C; it then lists the resulting objects, states, transforms, and collision checks. It does not present D alone as the world model.

PlanningScene diffs are efficient and useful. Their safety depends on treating them like patches: bind each patch to a known baseline, preserve order and authority, apply atomically, verify the result, and recover with a full snapshot whenever continuity is uncertain.