MCPcopy Create free account
hub / github.com/SHAILAB-IPEC/OpenFly-Platform / set_camera_pose

Method set_camera_pose

train/eval.py:348–380  ·  view source on GitHub ↗
(self, x, y, z, pitch, yaw, roll, path_params)

Source from the content-addressed store, hash-verified

346 return QW_new, QX_new, QY_new, QZ_new
347
348 def set_camera_pose(self, x, y, z, pitch, yaw, roll, path_params):
349 yaw = -yaw
350 pitch = -40
351 QW, QX, QY, QZ = self.transform_to_camera_frame(math.radians(roll), math.radians(pitch), math.radians(yaw))
352 camera_position = world2cam_WXYZ(x, y, z, QW, QX, QY, QZ)
353 quat = [QW, QX, QY, QZ]
354 camera_id = 0
355 image_name = "00000000.png"
356 image_data = f"{camera_id} {' '.join(map(str, quat))} {' '.join(map(str, [camera_position[0], camera_position[1], camera_position[2]]))} {0} {image_name}"
357 camera_params = f"0 PINHOLE 1436 1077 718.861 718.861 718 538.5"
358 data = {
359 "camera": camera_params,
360 "image": image_data,
361 "path": path_params
362 }
363 print(data)
364 try:
365 response = requests.post(self.url, data=data)
366 if response.status_code == 200:
367 print("Request successful!")
368 print(response.text)
369 else:
370 print(f"Request failed, status code: {response.status_code}")
371 print(response.text)
372 memory = psutil.virtual_memory()
373 print(memory.percent)
374 if memory.percent >= 90:
375 print("Memory usage is above 90%")
376 self.process.terminate()
377 self.__init__()
378 except requests.RequestException as e:
379 print(f"Error during request: {e}")
380 time.sleep(20)
381
382 def process_camera_data(self, file_path):
383 pass

Callers 1

mainFunction · 0.95

Calls 4

__init__Method · 0.95
terminateMethod · 0.80
world2cam_WXYZFunction · 0.70

Tested by

no test coverage detected