mgbam commited on
Commit
d207de4
Β·
verified Β·
1 Parent(s): 00c851e

Update deployer/simulator_interface.py

Browse files
Files changed (1) hide show
  1. deployer/simulator_interface.py +15 -19
deployer/simulator_interface.py CHANGED
@@ -2,38 +2,34 @@ import time
2
  import logging
3
 
4
  class VirtualRobot:
5
- """Enhanced virtual robot with state management"""
6
 
7
  def __init__(self):
8
  self.state = "IDLE"
9
  logging.info("πŸ€– Virtual Robot initialized")
10
-
11
- def perform_action(self, command: str) -> str:
12
- """Main action processor with validation"""
13
  command = (command or "").strip().lower()
14
 
15
  if not command:
16
  return "❌ Please enter a command"
17
 
18
- try:
19
- if command == "wave":
20
- return self._wave()
21
- elif command.startswith("say"):
22
- return self._speak(command[3:].strip())
23
- return "❓ Try 'wave' or 'say [message]'"
24
- except Exception as e:
25
- logging.error(f"Action failed: {str(e)}")
26
- return f"⚠️ Error: {str(e)}"
27
-
28
- def _wave(self) -> str:
29
- """Handle wave action"""
30
  self.state = "WAVING"
31
  time.sleep(0.5)
32
  self.state = "IDLE"
33
  return "πŸ‘‹ Wave complete!"
34
-
35
- def _speak(self, message: str) -> str:
36
- """Handle speak action"""
37
  if not message:
38
  return "❌ No message provided"
39
  self.state = "SPEAKING"
 
2
  import logging
3
 
4
  class VirtualRobot:
5
+ """Simplified but robust virtual robot implementation"""
6
 
7
  def __init__(self):
8
  self.state = "IDLE"
9
  logging.info("πŸ€– Virtual Robot initialized")
10
+
11
+ def perform_action(self, command):
12
+ """Main command processor with validation"""
13
  command = (command or "").strip().lower()
14
 
15
  if not command:
16
  return "❌ Please enter a command"
17
 
18
+ if command == "wave":
19
+ return self._wave()
20
+ elif command.startswith("say"):
21
+ return self._speak(command[3:].strip())
22
+ return "❓ Try 'wave' or 'say [message]'"
23
+
24
+ def _wave(self):
25
+ """Wave action handler"""
 
 
 
 
26
  self.state = "WAVING"
27
  time.sleep(0.5)
28
  self.state = "IDLE"
29
  return "πŸ‘‹ Wave complete!"
30
+
31
+ def _speak(self, message):
32
+ """Speak action handler"""
33
  if not message:
34
  return "❌ No message provided"
35
  self.state = "SPEAKING"