Practice the ROS2 LIDAR: Find Nearest Obstacle coding problem in Sensor Processing. Browser-based execution with automated grading — no local ROS install required. 0% of engineers pass this challenge.
Implement a ROS2 node that reads sensor_msgs/LaserScan data, finds the nearest valid obstacle, and publishes its position as a std_msgs/Float32 distance on /nearest_obstacle_distance.
Your node must:
/scan (sensor_msgs/LaserScan)inf, nan, <= msg.range_min, or >= msg.range_maxstd_msgs/Float32 on /nearest_obstacle_distanceself.get_logger().info()Input: sensor_msgs/LaserScan on /scan
Output: std_msgs/Float32 on /nearest_obstacle_distance
This is the foundation of reactive obstacle avoidance. iRobot's Roomba, Boston Dynamics Spot, and every autonomous forklift uses this same pattern — scan the LIDAR, find the closest thing, decide whether to stop. The Nav2 obstacle layer builds a full costmap using this data, but the core primitive is always "what is the nearest obstacle and how far is it?"
Input: /scan (sensor_msgs/LaserScan) | Output: /nearest_obstacle (std_msgs/Float32)
It is a hands-on Sensor Processing challenge on SimuCode where you implement and run ROS2 code in the browser with runtime-verified tests.
Open this page, sign in, and solve the problem in the built-in IDE. Your solution is graded against real ROS2 execution checks.
This Easy problem focuses on Sensor Processing skills used in robotics interviews and production systems.