Part 4 Move Service-Client¶
Copy all the code below into your move_client.py
file and review the annotations to understand how it all works.
move_client.py
#!/usr/bin/env python3
import rospy
from tuos_msgs.srv import SetBool, {BLANK}
service_name = "move_service"
rospy.init_node(f"{service_name}_client")
rospy.wait_for_service(service_name)
service = rospy.ServiceProxy(service_name, SetBool)
request_to_server = {BLANK}()
request_to_server.request_signal = True
response_from_server = service(request_to_server)
print(response_from_server)
Fill in the Blank!
Consider the import
statement for the service Server that we created earlier... Which part of the SetBool
Service message was imported here? Now consider that you need to build a client to call this service... which part of the SetBool
Service message is needed in order to call a service?
Note: the same {BLANK}
appears in two places in the code above - the answer is the same in both places!