ROS2 Python - Type Hints & Logging

Medium Python for ROS2 75% pass rate
#python#type-hints#logging#best-practices

Practice the ROS2 Python - Type Hints & Logging coding problem in Python for ROS2. Browser-based execution with automated grading — no local ROS install required. 75% of engineers pass this challenge.

Problem Statement

Write clean, maintainable ROS2 code using Python type hints and proper logging levels.

Requirements

  • Create a node named clean_node
  • Define a function calculate_sum(a: int, b: int) -> int with type hints
  • In the node's timer callback (1 Hz):
    • Call calculate_sum(5, 10)
    • Log the result using WARN level
    • Log format: "Sum is: 15"

Input/Output Format

Output:

  • Console Log (WARN): "Sum is: 15"

⚠️ Common Pitfalls

  • Using print() instead of ROS2 logging. Print statements don't show up in rqt_console or logs correctly in all launch configurations.

📚 Helpful Resources

Frequently asked questions

What is the ROS2 Python - Type Hints & Logging practice problem?

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

How do I practice ROS2 Python - Type Hints & Logging 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 Python - Type Hints & Logging test?

This Medium problem focuses on python, type-hints, logging skills used in robotics interviews and production systems.