ROS2 Static Transform Broadcaster

Easy TF2 Broadcasting 84% pass rate
#tf2#transform#static#broadcaster

Practice the ROS2 Static Transform Broadcaster coding problem in TF2 Broadcasting. Browser-based execution with automated grading — no local ROS install required. 84% of engineers pass this challenge.

🧠 Concept: TF2 — The Transform Tree

Every real robot has multiple coordinate frames: base_link (robot centre), camera_link (camera position), laser_link (LiDAR position). TF2 tracks where each frame is relative to others, forming a transform tree.

         world
           │
        base_link
        /        \
  camera_link   laser_link

When your navigation stack asks "where is the obstacle in base_link coordinates?", TF2 walks this tree to answer.

Static transforms are for frames that never move relative to each other (e.g. a fixed camera on the robot body):

from tf2_ros import StaticTransformBroadcaster
from geometry_msgs.msg import TransformStamped

broadcaster = StaticTransformBroadcaster(self)
t = TransformStamped()
t.header.frame_id = 'base_link'    # parent frame
t.child_frame_id  = 'camera_link'  # child frame
t.transform.translation.x = 0.2   # camera is 20cm in front
broadcaster.sendTransform(t)

Problem Statement

Broadcast a static coordinate transformation between two frames. This defines the physical relationship between robot parts (e.g., Lidar is 10cm above Base).

Requirements

  • Create a node that broadcasts a static TF
  • Parent Frame: world
  • Child Frame: robot_base
  • Translation: x=1.0, y=2.0, z=0.0
  • Rotation: 0,0,0 (identity quaternion)

Input/Output Format

Output:

  • Publishes to /tf_static topic.

⚠️ Common Pitfalls

  • Publishing to /tf instead of /tf_static (static transforms should be latched and published once or rarely).
  • Forgetting the timestamp (now()).

📚 Helpful Resources

Frequently asked questions

What is the ROS2 Static Transform Broadcaster practice problem?

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

How do I practice ROS2 Static Transform Broadcaster 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 Static Transform Broadcaster test?

This Easy problem focuses on tf2, transform, static skills used in robotics interviews and production systems.