ros2-service-pattern

Generate ROS 2 Humble service server and client code using AddTwoInts.

1|Updated Feb 19, 2026
One-click install
npx skills add https://github.com/ayeshakhalid192007-dev/humanoid-ai-studio --skill ros2-service-pattern-ayeshakhalid192007-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ros2-service-pattern
Source: https://github.com/ayeshakhalid192007-dev/humanoid-ai-studio/tree/main/.claude/skills/ros2-service-pattern
Command: npx skills add https://github.com/ayeshakhalid192007-dev/humanoid-ai-studio --skill ros2-service-pattern-ayeshakhalid192007-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provide clear, reproducible ROS 2 service server and client code examples to teach request/response patterns in robotics education and hands-on learning with Humble.

Core Features & Use Cases

  • Canonical Service Pattern: Demonstrates creating a service server, handling requests, and proper logging.
  • Asynchronous Client Pattern: Demonstrates a non-blocking service client using call_async with result handling.
  • Educational Scenarios: Useful in lessons about choosing between services and topics, and building exercises around AddTwoInts service.

Quick Start

Generate a canonical ROS 2 service server and client example using the AddTwoInts pattern for Humble.

Frequently Asked Questions about ros2-service-pattern

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a ROS 2 service server and client example for education?

To create a ROS 2 service server and client example for education, use the AddTwoInts pattern from example_interfaces.srv in ROS 2 Humble. It generates canonical synchronous server callbacks and asynchronous clients using rclpy to teach inter-node communication.

What is the difference between ROS 2 services and topics for inter-node communication?

ROS 2 services differ from topics by using a request/response pattern instead of continuous data streaming. Services are suitable for immediate, synchronous or asynchronous tasks like AddTwoInts, whereas topics are better for continuous sensor data streams in robotics education.

How does an asynchronous ROS 2 service client handle responses using rclpy?

An asynchronous ROS 2 service client handles responses using the call_async method in rclpy. This non-blocking pattern sends requests without halting node execution and processes the returned future result once the server completes its callback.

Can I use the AddTwoInts service example with ROS 2 Humble?

Yes, you can use the AddTwoInts service example with ROS 2 Humble. The generated code strictly enforces canonical ROS 2 patterns and aligns with official Humble tutorials to ensure compatibility and educational accuracy for inter-node communication lessons.

What is the best way to teach ROS 2 request and response patterns in robotics?

The best way to teach ROS 2 request and response patterns is by generating reproducible server and client code examples. Using the AddTwoInts interface demonstrates synchronous server callbacks and asynchronous clients, providing a clear comparison against topic-based communication.