Skip to content

feat(diffusion_planner): build T4Scene inputs from polled observations - #63

Open
xtk8532704 wants to merge 4 commits into
kem/ml-planner-t4scene-mapfrom
kem/t4scene-ml-planner-dev
Open

xtk8532704 wants to merge 4 commits into
kem/ml-planner-t4scene-mapfrom
kem/t4scene-ml-planner-dev

Conversation

@xtk8532704

@xtk8532704 xtk8532704 commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

Build the deployed Diffusion Planner 7.0 feature tensors from T4Scene windows through the shared DiffusionPlanner2 C++ adapter. The planner retains batching, initial noise, inference and output publishing.

The existing timer, polling subscribers and QoS stay in place. Each decision uses the messages drained for that tick and anchors its grid to the latest admitted odometry stamp. Planning reads the adapter's installed online.yaml, which matches the T4Scene online preset and specifies zero future rows. Offline generation uses its own window.yaml.

The latest polled route remains active even if its header is older. The original tracking batch supplies output covariance and existence probabilities. The optimizer continues to read raw steering and acceleration.

Effects on system behavior

A decision is skipped if tracking, steering or turn-indicator observations do not support the current row. The online profile accepts interleaved traffic-light reports, keeps each group's original stamp, and drops groups older than 200 ms. The adapter can apply a stricter model timeout. The first observed route-light debug output reads the same selected Scene row as the model, and the model projects future traffic lights from the sampled history.

Use a fresh planner node after seeking backwards or looping a rosbag with simulated time. Same-node recovery is follow-up work in #67.

Related links

Stacked on #71. The pinned ROS generator comes from tier4/T4Scene#21, stacked on tier4/T4Scene#16. The adapter and its online and offline profiles are owned by tier4/DiffusionPlanner2#6.

How was this PR tested?

  • The aligned Release planner and native adapter passed 75 tests on Humble and 82 on Jazzy. Each generator was built against the messages installed in that Planning workspace.
  • Tests cover mixed group stamps, expiry, a stricter model timeout and a fresh report received on a later poll. The installed online profile is byte-identical to T4Scene's preset.
  • Verified the generator and adapter library resolution at runtime.

@xtk8532704 xtk8532704 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Codex agent review of 0107a93 against dev (d3cadb8).

I checked the node callbacks and timer, receipt-time cutoff and odometry anchor, model-input builder, dependency pin, and launch/build examples. The reviewed Jazzy logs cover 43 SDK tests and 83 planner tests. The paired playback covers 106 readable bags across 17 sites and 29 maps. The other 14 bags failed CDR deserialization in every configuration. Across 61,478 matched decisions, input preparation fell from 3.5772 to 2.3487 ms at P50 and from 7.5724 to 6.4245 ms at P99. The active routes agreed throughout. Several tensor fingerprints differed, and two additional decisions passed on dev when required observations were missing in the new path. The replay measures input preparation and does not establish downstream trajectory equivalence.

Follow-up for backwards ROS time. I tested the original PR node with a one-shot route as the first callback after moving its clock from 120 s to 10 s. It discarded the new route and odometry at 10 s and 30 s, kept the previous route and odometry, and resumed accepting input when the clock reached 120 s. The old dev implementation also fails to start a fresh epoch: it accepts the new route immediately but retains the previous 120 s ego sample even when an equal-stamp sample arrives. A fresh node accepted the new inputs at 10 s on both revisions. This affects same-node backward seek or looping playback with simulated time. An ordinary monotonic single-bag run does not trigger the receipt-time guard. With a monotonic receipt clock and rewound message headers the PR still retains the newest old odometry until it becomes stale. A separate clock-reset change is appropriate for workflows that need to reuse a planner across rewind. Restarting the planner at the recording boundary avoids the retained state.

@xtk8532704
xtk8532704 marked this pull request as ready for review November 30, 2026 08:14

@SakodaShintaro SakodaShintaro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please break this down into a total of about 3 to 5 pull requests, keeping the changes in each as small as possible.

Comment on lines +263 to +270
rclcpp::Subscription<Odometry>::SharedPtr sub_current_odometry_;
rclcpp::Subscription<TrackedObjects>::SharedPtr sub_tracked_objects_;
rclcpp::Subscription<autoware_perception_msgs::msg::TrafficLightGroupArray>::SharedPtr
sub_traffic_signals_;
rclcpp::Subscription<TurnIndicatorsReport>::SharedPtr sub_turn_indicators_;
rclcpp::Subscription<SteeringReport>::SharedPtr sub_steering_;
rclcpp::Subscription<geometry_msgs::msg::AccelWithCovarianceStamped>::SharedPtr sub_acceleration_;
rclcpp::Subscription<LaneletRoute>::SharedPtr sub_route_;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is it necessary to revert to using callbacks? This would represent a major change, so it will require careful discussion.

@xtk8532704 xtk8532704 Dec 1, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for flagging this. We can build T4Scene inputs with the existing polling subscribers. I removed the callback change. The planner keeps its timer and QoS settings, reads the available messages on each tick, and uses them to build the observation window for the 7.0 model.

I also split the Planning changes into four PRs as you suggested:

  1. perf(ml_planner): fill initial noise directly in the batch tensor #69 (merged) generates initial noise directly in the batch tensor and fills zero-scale samples with zeros.
  2. refactor(diffusion_planner): reuse T4Scene map preprocessing #71 moves map preprocessing to the shared adapter. The planner still handles dynamic observations through its existing buffers.
  3. feat(diffusion_planner): build T4Scene inputs from polled observations #63 (this PR) builds on refactor(diffusion_planner): reuse T4Scene map preprocessing #71 and converts polled observations into a T4Scene window and model inputs.
  4. perf(diffusion_planner): enable indexed lane lookup and faster T4Scene conversion #65 updates the adapter revision to enable the optional performance changes. We can decide whether to take those separately.

Could you review #71 first, then the diff here in #63? That order lets you review map preprocessing and online observation handling separately.

@xtk8532704
xtk8532704 force-pushed the kem/t4scene-ml-planner-dev branch from 0107a93 to 1420103 Compare November 30, 2026 08:50
@xtk8532704 xtk8532704 changed the title feat(ml_planner): build online model inputs with T4Scene feat(ml_planner): build T4Scene inputs from polled observations Nov 30, 2026
@xtk8532704
xtk8532704 changed the base branch from dev to kem/ml-planner-t4scene-map November 30, 2026 08:51
@xtk8532704
xtk8532704 force-pushed the kem/ml-planner-t4scene-map branch from 8545eee to ca2db28 Compare November 30, 2026 10:23
@xtk8532704
xtk8532704 force-pushed the kem/t4scene-ml-planner-dev branch 2 times, most recently from dd2b6de to b38d4d2 Compare November 30, 2026 10:27
@xtk8532704
xtk8532704 force-pushed the kem/ml-planner-t4scene-map branch from 55fe24c to d5761e3 Compare November 30, 2026 11:52
@xtk8532704
xtk8532704 force-pushed the kem/t4scene-ml-planner-dev branch 8 times, most recently from 8316848 to 9d641b2 Compare November 30, 2026 16:51
@xtk8532704 xtk8532704 changed the title feat(ml_planner): build T4Scene inputs from polled observations feat(diffusion_planner): build T4Scene inputs from polled observations Nov 30, 2026
@xtk8532704
xtk8532704 force-pushed the kem/t4scene-ml-planner-dev branch from 9d641b2 to c7d4950 Compare November 30, 2026 16:55
@xtk8532704
xtk8532704 force-pushed the kem/t4scene-ml-planner-dev branch 3 times, most recently from 4cb6552 to 82d92ce Compare November 30, 2026 17:29
Signed-off-by: temkei.kem <temkei.kem@tier4.jp>
@xtk8532704
xtk8532704 force-pushed the kem/t4scene-ml-planner-dev branch from 82d92ce to 22af0c3 Compare November 30, 2026 17:46
Signed-off-by: temkei.kem <temkei.kem@tier4.jp>
Signed-off-by: temkei.kem <temkei.kem@tier4.jp>
Signed-off-by: temkei.kem <temkei.kem@tier4.jp>
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.

2 participants