ROS2 REST in Pieces

Hard Integration 0% pass rate
#http#subscriber#blocking-io#timer#cache#performance#ros2

Practice the ROS2 REST in Pieces coding problem in Integration. Browser-based execution with automated grading — no local ROS install required. 0% of engineers pass this challenge.

A fleet management dashboard polls a REST API every 2 seconds to display robot positions. The robot publishes its position over ROS2 at 10 Hz. A ROS2→REST bridge is supposed to forward these positions to the dashboard, but operators report the dashboard always shows data that is 8–12 seconds old.

The bug: a synchronous HTTP POST is made inside the subscriber callback. Each POST takes ~200 ms to complete. At 10 Hz subscriptions the callbacks pile up 2× faster than they drain — by the time a position is forwarded to REST it's already 7–8 positions stale.

Fix the bridge using a cache-and-timer pattern:

  • The subscriber callback only stores self.latest_pose = msg (non-blocking, O(1)).
  • A create_timer fires at 2 Hz and performs the HTTP POST with the cached pose.

This decouples ROS2 message ingestion from network I/O entirely.

Frequently asked questions

What is the ROS2 REST in Pieces practice problem?

It is a hands-on Integration challenge on SimuCode where you implement and run ROS2 code in the browser with runtime-verified tests.

How do I practice ROS2 REST in Pieces online?

Open this page, sign in, and solve the problem in the built-in IDE. Your solution is graded against real ROS2 execution checks.

What skills does ROS2 REST in Pieces test?

This Hard problem focuses on http, subscriber, blocking-io skills used in robotics interviews and production systems.