node ==== The node module is the main interface with ROS. The root component must always inherit from the `ROSNode` class and client side widgets should generally inherit from `ROSWidget` to make interacting with the library smoother. The following example shows how one may structure a service client application using these techniques. .. code:: python from flexx import flx, config from flexxros import node from flexxros.node import ROSNode, ROSWidget import rospy from std_srvs.srv import SetBool, SetBoolResponse node_name = "action_example_interface" service_name = "simple_service" config.hostname = "localhost" config.port = 8097 class SimpleService(object): def __init__(self, service_name): self.service = rospy.Service(service_name, SetBool, self.handle_request) def handle_request(self, req): return SetBoolResponse(req.data, "flexxros!") class ServiceClientWidget(ROSWidget): def callback(self, resp): self.receive_message.set_text(str(resp.success) + " " + resp.message) @flx.reaction("send_message.pointer_click") def _request_service(self, *events): self.call_service(service_name, "std_srvs/SetBool", {"data": self.type_message.checked}, self.callback) def init(self): with flx.FormLayout(flex=1, maxsize=400): self.type_message = flx.CheckBox(title="Checked?") self.send_message = flx.Button(text="Request service") self.receive_message = flx.Label(title="Response:", text="Waiting for response...") class ServiceExampleInterface(ROSNode): def init(self): self.client = ServiceClientWidget() rospy.init_node(node_name, anonymous=True) service = SimpleService(service_name) node.spin(ServiceExampleInterface) .. automodule:: flexxros.node :members: :undoc-members: