Practice the ROS2 Sensor Noise Filtering: Moving Average coding problem in Signal Processing. Browser-based execution with automated grading — no local ROS install required. 0% of engineers pass this challenge.
Implement moving_average(data, N) — a sliding window average filter.
def moving_average(data: list[float], N: int) -> list[float]:
i in data, compute the average of the last N values ending at index ii < N-1 (before a full window is available), average only the values from index 0 to i (inclusive)data[], N=1 returns a copy of datadata = [1.0, 3.0, 5.0, 7.0, 9.0], N = 3
| i | window | average |
|---|---|---|
| 0 | [1.0] | 1.0 |
| 1 | [1.0, 3.0] | 2.0 |
| 2 | [1.0, 3.0, 5.0] | 3.0 |
| 3 | [3.0, 5.0, 7.0] | 5.0 |
| 4 | [5.0, 7.0, 9.0] | 7.0 |
Result: [1.0, 2.0, 3.0, 5.0, 7.0]
This is the exact filter used in RPLIDAR drivers for range smoothing, in IMU preprocessing for accelerometer denoising, and in battery monitoring for SoC estimation. The window size N controls the trade-off: larger N = smoother signal but more lag. Real applications choose N based on sensor frequency and acceptable latency.
It is a hands-on Signal 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 Signal Processing skills used in robotics interviews and production systems.