Skip to content
Snippets Groups Projects
Commit cf98729d authored by Emil Harlan's avatar Emil Harlan
Browse files

a

parent a6bc5fb9
No related branches found
No related tags found
No related merge requests found
......@@ -18,14 +18,12 @@ class CommandExecutor(Node):
def execute_command_callback(self, msg):
command = msg.data.split() # Split the received string into command and name
if command[0] == "kill":
kill_node(command[1])
self.kill_node(command[1]) # Call the kill_node method using 'self'
else:
name = command[0]
launch_command = " ".join(command[1:])
# Execute the launch command in a separate thread
threading.Thread(target=self.execute_command, args=(name, launch_command)).start()
self.get_logger().error("Invalid command format.")
def execute_command(self, name, launch_command):
try:
......@@ -60,4 +58,4 @@ def main(args=None):
rclpy.shutdown()
if __name__ == '__main__':
main()
main()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment