ROS2 Actions - Fibonacci with Feedback

Hard Actions 48% pass rate
#actions#feedback#server#fibonacci

Practice the ROS2 Actions - Fibonacci with Feedback coding problem in Actions. Browser-based execution with automated grading — no local ROS install required. 48% of engineers pass this challenge.

🧠 Concept: Actions (Long-Running Tasks with Feedback)

Actions are for tasks that take time and need progress updates — navigating to a waypoint, running a calibration, executing a trajectory.

Unlike services (instant response), actions have 3 phases:

  1. Goal — client sends what it wants done
  2. Feedback — server sends progress updates while working
  3. Result — server sends the final outcome
Client sends goal ──▶ Server accepts ──▶ Server sends feedback (N times) ──▶ Server sends result

Key API (server side):

from rclpy.action import ActionServer

self.action_server = ActionServer(self, ActionType, '/action_name', self.execute_callback)

def execute_callback(self, goal_handle):
    # Send feedback during execution
    goal_handle.publish_feedback(feedback_msg)
    # Mark as succeeded and return result
    goal_handle.succeed()
    return result

When to use: Anything that takes more than ~100ms and benefits from progress reporting.


Problem Statement

Actions are for long-running tasks that provide feedback and can be cancelled. Implement an Action Server that computes the Fibonacci sequence.

Requirements

  • Create an action server for the Fibonacci action (custom or example)
  • Action Name: fibonacci
  • Logic: Compute sequence up to order (from goal)
  • Publish feedback (partial sequence) at each step
  • Return result (full sequence) when done
  • Simluated delay: 1 second per step

Input/Output Format

Input:

  • Action Goal: order=5

Output:

  • Feedback: [0, 1], [0, 1, 1], ...
  • Result: [0, 1, 1, 2, 3, 5]

⚠️ Common Pitfalls

  • Blocking the callback. You must mark the callback as async or use threads.
  • Forgetting to set the goal state to succeed.

📚 Helpful Resources

Frequently asked questions

What is the ROS2 Actions - Fibonacci with Feedback practice problem?

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

How do I practice ROS2 Actions - Fibonacci with Feedback 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 Actions - Fibonacci with Feedback test?

This Hard problem focuses on actions, feedback, server skills used in robotics interviews and production systems.