Suggestions on how to architect robot system to start/stop nodes itself

asked 2021-05-03 02:40:26 -0500

parzival gravatar image

I'm making a robot system which could work in production, mainly the difference would be I won't be able to start/stop scripts manually using a terminal and the system would have to rely on information from nodes to start/stop/modify other nodes.

Let's take the example of SLAM and navigation. First, the robot would autonomously explore and create a map and the autonomous exploration node signals the system that map is ready let's start navigation. And this would trigger move base nodes to launch and SLAM node to die. When done navigating to some points the robot goes to dock and kills all scripts other than monitoring the charge. When substantially charged, it launches those nodes again.

How do I build such a system?

I am currently using topics to send Bool messages to signal the status of a process, which would be subscribed by a task manager node, which, upon reception of a message, creates a new subprocess(using the python subprocess library), but I am not sure if it is the best implementation. Another idea I have is to use ROS param instead which can be used as flags to check and alter the system.

But I want to know are these good approaches? Is there a better, cleaner way to handle different processes?

Any help would be much appreciated, thanks!

edit retag flag offensive close merge delete