Accomplish the exp scripts v1; Add video recording and trajectory recording of desktop agent; Fix minor bugs
This commit is contained in:
@@ -243,6 +243,32 @@ class PythonController:
|
||||
else:
|
||||
raise Exception(f"Unknown action type: {action_type}")
|
||||
|
||||
# Record video
|
||||
def start_recording(self):
|
||||
"""
|
||||
Starts recording the screen.
|
||||
"""
|
||||
response = requests.post(self.http_server + "/start_recording")
|
||||
if response.status_code == 200:
|
||||
logger.info("Recording started successfully")
|
||||
else:
|
||||
logger.error("Failed to start recording. Status code: %d", response.status_code)
|
||||
|
||||
def end_recording(self, dest: str):
|
||||
"""
|
||||
Ends recording the screen.
|
||||
"""
|
||||
response = requests.post(self.http_server + "/end_recording")
|
||||
if response.status_code == 200:
|
||||
logger.info("Recording stopped successfully")
|
||||
with open(dest, 'wb') as f:
|
||||
for chunk in response.iter_content(chunk_size=8192):
|
||||
if chunk:
|
||||
f.write(chunk)
|
||||
else:
|
||||
logger.error("Failed to stop recording. Status code: %d", response.status_code)
|
||||
return None
|
||||
|
||||
# Additional info
|
||||
def get_vm_platform(self):
|
||||
"""
|
||||
|
||||
@@ -209,10 +209,6 @@ class SetupController:
|
||||
if not command:
|
||||
raise Exception("Empty command to launch.")
|
||||
|
||||
if isinstance(command, str) and len(command.split()) > 1:
|
||||
logger.warning("Command should be a list of strings. Now it is a string. Will split it by space.")
|
||||
command = command.split()
|
||||
|
||||
payload = json.dumps({"command": command})
|
||||
headers = {"Content-Type": "application/json"}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user