Software architecture for sequential execution of two ROS nodes
This question is regarding the best programming practices while heavily using ROS. I am trying to achieve sequential execution of two ROS nodes. I have a depth camera mounted on a moving robot. The camera works on ROS CPP and robot works on ROS Python.
Below is the sequential execution plan-
- Command the robot to move robot little bit.
- Stop the robot.
- Once the robot is stopped, take a picture from the camera.
- Process the picture. The processing is time-consuming and takes around few seconds.
- Once processing is done, the robot is commanded to move next.
- The cycle repeats.
The above execution could be done quickly if the camera and robot operate on the same programming language.
At present, I have defined two ROS topics. I have one publisher and one subscriber inside robot node, and similarly, I have another publisher and subscriber inside camera node. However, it is getting complicated to debug. I believe, there should be a more natural way in ROS to handle such scenarios.'
I want to know how to achieve sequential execution of two ROS nodes in this scenario.
PS: The code snippet wasn't provided since it is too long to put here. However, I tried to convey the approach I have implemented. Sorry for such a long post!