Complete the code to create a ROS service client.
client = rospy.ServiceProxy('[1]', AddTwoInts)
The service client must connect to the correct service name, which is '/add_two_ints' here.
Complete the code to call the service with two integers.
response = client([1], 5)
The service call requires integer arguments, so 3 is correct. Strings or variables not defined cause errors.
Fix the error in the service server callback definition.
def handle_add_two_ints(req): return AddTwoIntsResponse(req.a [1] req.b)
The service adds two integers, so the '+' operator is needed to sum req.a and req.b.
Fill both blanks to complete the service server setup.
service = rospy.Service('[1]', AddTwoInts, [2])
The service name must match the client, and the callback function handles requests.
Fill all three blanks to complete the service server main loop.
rospy.init_node('[1]') service = rospy.Service('[2]', AddTwoInts, handle_add_two_ints) rospy.[3]()
The node must be initialized with a name, the service name must match, and rospy.spin() keeps the server alive.
