robosage / deployer /simulator_interface.py
mgbam's picture
Update deployer/simulator_interface.py
f6da057 verified
raw
history blame
849 Bytes
import time
import logging
class VirtualRobot:
def __init__(self):
self.state = "IDLE"
logging.info("πŸ€– Robot initialized")
def perform_action(self, command):
command = (command or "").strip().lower()
if command == "wave":
return self._wave()
elif command.startswith("say"):
return self._speak(command[3:].strip())
return "❓ Try 'wave' or 'say [message]'"
def _wave(self):
self.state = "WAVING"
time.sleep(0.5)
self.state = "IDLE"
return "πŸ‘‹ Wave complete!"
def _speak(self, message):
if not message:
return "❌ No message provided"
self.state = "SPEAKING"
time.sleep(max(0.3, len(message)*0.05))
self.state = "IDLE"
return f"πŸ—£οΈ {message.capitalize()}"