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

a

parent 2ab1e523
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ import rclpy
from rclpy.node import Node
from std_msgs.msg import String
import subprocess
import threading
class CommandExecutor(Node):
def __init__(self):
......@@ -16,6 +17,10 @@ class CommandExecutor(Node):
def execute_command_callback(self, msg):
command = msg.data
# Führe den Befehl in einem separaten Thread aus
threading.Thread(target=self.execute_command, args=(command,)).start()
def execute_command(self, command):
try:
subprocess.run(command, shell=True, check=True)
except subprocess.CalledProcessError as e:
......@@ -31,5 +36,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