add_two_ints_server
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 server node that provides addition functionality. It receives two integers from clients and returns their sum. This demonstrates basic service server implementation in Python.
Services
Service:
/add_two_intsType:
example_interfaces/srv/AddTwoIntsDescription: Adds two integers and returns the sum
Request:
int64 a, int64 bResponse:
int64 sum
Example Usage
# Run the service server
ros2 run demo_nodes_py add_two_ints_server
The server will log incoming requests:
[INFO] [add_two_ints_server]: Incoming request
a: 2 b: 3
To test the service:
# Terminal 1: Run the server
ros2 run demo_nodes_py add_two_ints_server
# Terminal 2: Call the service
ros2 service call /add_two_ints example_interfaces/srv/AddTwoInts "{a: 5, b: 7}"
Or use the provided client:
# 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