add_two_ints_client

This file is ai generated. Do not edit this file directly. Instead, edit the node source code and run the generate-node-docs command to update this file.

Description

A ROS2 service client node that calls the add_two_ints service with two integers (2 and 3) and displays the result. This demonstrates synchronous service client usage with spin_until_future_complete in Python.

Services

  • Service Client: /add_two_ints

    • Type: example_interfaces/srv/AddTwoInts

    • Description: Calls the add_two_ints service to add two numbers

Example Usage

# Run the client (requires add_two_ints_server to be running)
ros2 run demo_nodes_py add_two_ints_client

The client will output:

service not available, waiting again...  # (if server not ready)
[INFO] [add_two_ints_client]: Result of add_two_ints: 5

Complete example:

# Terminal 1: Run the server
ros2 run demo_nodes_py add_two_ints_server

# Terminal 2: Run the client
ros2 run demo_nodes_py add_two_ints_client