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

Method set_camera_pose

scripts/sim/gs_bridge.py:85–117  ·  view source on GitHub ↗
(self, x, y, z, pitch, yaw, roll, path_params)

Source from the content-addressed store, hash-verified

83 return QW_new, QX_new, QY_new, QZ_new
84
85 def set_camera_pose(self, x, y, z, pitch, yaw, roll, path_params):
86 yaw = -yaw
87 pitch = -40
88 QW, QX, QY, QZ = self.transform_to_camera_frame(math.radians(roll), math.radians(pitch), math.radians(yaw))
89 camera_position = world2cam_WXYZ(x, y, z, QW, QX, QY, QZ)
90 quat = [QW, QX, QY, QZ]
91 camera_id = 0
92 image_name = "00000000.png"
93 image_data = f"{camera_id} {' '.join(map(str, quat))} {' '.join(map(str, [camera_position[0], camera_position[1], camera_position[2]]))} {0} {image_name}"
94 camera_params = f"0 PINHOLE 1436 1077 718.861 718.861 718 538.5"
95 data = {
96 "camera": camera_params,
97 "image": image_data,
98 "path": path_params
99 }
100 print(data)
101 try:
102 response = requests.post(self.url, data=data)
103 if response.status_code == 200:
104 print("Request successful!")
105 print(response.text)
106 else:
107 print(f"Request failed, status code: {response.status_code}")
108 print(response.text)
109 memory = psutil.virtual_memory()
110 print(memory.percent)
111 if memory.percent >= 90:
112 print("Memory usage is above 90%")
113 self.process.terminate()
114 self.__init__()
115 except requests.RequestException as e:
116 print(f"Error during request: {e}")
117 time.sleep(20)
118
119 def process_camera_data(self, file_path):
120 pass

Callers 2

handle_plannerFunction · 0.95
handle_plannerFunction · 0.95

Calls 4

__init__Method · 0.95
terminateMethod · 0.80
world2cam_WXYZFunction · 0.70

Tested by

no test coverage detected