ROS2 RViz2 - Marker Publisher

Easy Visualization 88% pass rate
#rviz#markers#visualization#display

Practice the ROS2 RViz2 - Marker Publisher coding problem in Visualization. Browser-based execution with automated grading — no local ROS install required. 88% of engineers pass this challenge.

Problem Statement

Implement a ROS2 node that publishes a visualization marker on the /visualization_marker topic at 1 Hz.

Requirements

Your node must:

  • Create a publisher for visualization_msgs/Marker on /visualization_marker
  • Use create_timer(1.0, ...) for the publish loop
  • Set all mandatory Marker fields in every published message:
    • header.frame_id = 'map' and header.stamp from the node clock
    • ns (namespace string, any value)
    • id (integer, e.g. 0)
    • type = Marker.SPHERE (or CUBE, ARROW, CYLINDER, LINE_STRIP — your choice)
    • action = Marker.ADD
    • pose.position (x, y, z — any values)
    • pose.orientation.w = 1.0 (valid quaternion)
    • scale.x, scale.y, scale.z — all > 0 (scale of 0 makes the marker invisible)
    • color.r, color.g, color.b, color.a — all in 0.0–1.0 range, alpha must be > 0
  • Log "Marker Publisher Ready" on startup

Input / Output

Output: visualization_msgs/Marker messages on /visualization_marker at 1 Hz

🤖 Why This Matters in Real Robots

RViz2 Markers are the primary tool for debugging perception and planning algorithms in the field. A robot engineer who can't publish markers can't visualize where their node thinks obstacles are, where the planned path goes, or what the sensor is seeing. In every robotics lab and company, "add a marker to see what's happening" is step 1 of any debugging process.

⚠️ Common Pitfalls

  • alpha = 0: If color.a == 0 the marker is completely transparent and invisible in RViz2. It will also fail the test.
  • scale = 0: Any scale dimension of 0 makes the marker degenerate. RViz2 will show a warning and not render it.
  • Missing frame_id: Without a valid header.frame_id, RViz2 can't place the marker in any coordinate system.
  • Forgetting header.stamp: Markers without a timestamp can't be synchronized with the TF tree.

Frequently asked questions

What is the ROS2 RViz2 - Marker Publisher practice problem?

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

How do I practice ROS2 RViz2 - Marker Publisher 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 RViz2 - Marker Publisher test?

This Easy problem focuses on rviz, markers, visualization skills used in robotics interviews and production systems.