I have a question regarding working logic of services. That question may arise because I may not have grasped the idea underlying ROS and services yet. Anyway. I can create publisher, subscriber and services and run them successfully (thanks to you). However, I have used them for itself alone, not together in a package. That is to say, I have not built a large project yet. Let’s say, I need to use publisher, subscriber and service together as a one package. Your example in service-client chapter is a good example. Let’s talk about it: Laser scanner, face recognition and navigation. For my question, ignore the navigation part, consider only camera (instead of laser) and traffic light detection (instead of face recognition).
Assume that we are building a robot that should move straight until it recognizes the traffic light. When it detects red light, it should stop. otherwise, it should keep moving. I want to use service, not publisher/subscriber, for traffic light detection. How can this system be automated? I mean, while the robot is moving straight, service-server is running. This is understandable, okay. But, who will call this service? Which node can call this service so that robot stops and wait for the service is finished until traffic light turns to green. Afterwards, program continues so robot start moving again. In service chapter, You have taught us starting service-server and calling this service by launching the launch file of service-client manually. How can I call the launch file of service-client automatically? Is it a kind of nested system? In short, I am curious about the way calling service-server when it is needed, not launching service-client node’s launch file manually. Is there a way to automate this system? Can you also provide some example, link or source in addition to your explanation? Thanks in advance.