Practice the ROS2 IMU Tilt Compensation coding problem in Perception. 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/Imu data and computes roll and pitch from the IMU's orientation quaternion, then publishes them as a geometry_msgs/Vector3Stamped (roll=x, pitch=y, yaw=z).
Your node must:
/imu/data (sensor_msgs/Imu)msg.orientation (x, y, z, w)quaternion_to_euler(x, y, z, w) -> (roll, pitch, yaw) using:roll = atan2(2*(w*x + y*z), 1 - 2*(x*x + y*y))
pitch = asin(clamp(2*(w*y - z*x), -1, 1))
yaw = atan2(2*(w*z + x*y), 1 - 2*(y*y + z*z))
geometry_msgs/Vector3Stamped on /imu/euler_angles where:vector.x = roll (radians)vector.y = pitch (radians)vector.z = yaw (radians)Input: sensor_msgs/Imu on /imu/data
Output: geometry_msgs/Vector3Stamped on /imu/euler_angles
Every ground robot needs tilt estimation for stability monitoring — if a robot tips past 30°, it should emergency stop. Drones use this to level their airframe. The RPY decomposition of the orientation quaternion is one of the most commonly needed calculations in any ROS2 project, yet it's not built into the standard message types.
Input: /imu (sensor_msgs/Imu) | Output: /tilt (std_msgs/Float32)
It is a hands-on Perception 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 Medium problem focuses on Perception skills used in robotics interviews and production systems.