mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-21 08:14:00 +08:00
Simulator: only send camera frames at rate that they are generated (#30802)
only send frames at rate that they are generated old-commit-hash: 8017c25f0b2960db13df22295c077fbbd6aa6a07
This commit is contained in:
@@ -39,7 +39,8 @@ def apply_metadrive_patches():
|
||||
|
||||
MetaDriveEnv._is_arrive_destination = arrive_destination_patch
|
||||
|
||||
def metadrive_process(dual_camera: bool, config: dict, camera_array, wide_camera_array, controls_recv: Connection, state_send: Connection, exit_event):
|
||||
def metadrive_process(dual_camera: bool, config: dict, camera_array, wide_camera_array, image_lock,
|
||||
controls_recv: Connection, state_send: Connection, exit_event):
|
||||
apply_metadrive_patches()
|
||||
|
||||
road_image = np.frombuffer(camera_array.get_obj(), dtype=np.uint8).reshape((H, W, 3))
|
||||
@@ -98,5 +99,6 @@ def metadrive_process(dual_camera: bool, config: dict, camera_array, wide_camera
|
||||
if dual_camera:
|
||||
wide_road_image[...] = get_cam_as_rgb("rgb_wide")
|
||||
road_image[...] = get_cam_as_rgb("rgb_road")
|
||||
image_lock.release()
|
||||
|
||||
rk.keep_time()
|
||||
|
||||
@@ -27,7 +27,9 @@ class MetaDriveWorld(World):
|
||||
|
||||
self.metadrive_process = multiprocessing.Process(name="metadrive process", target=
|
||||
functools.partial(metadrive_process, dual_camera, config,
|
||||
self.camera_array, self.wide_camera_array, self.controls_recv, self.state_send, self.exit_event))
|
||||
self.camera_array, self.wide_camera_array, self.image_lock,
|
||||
self.controls_recv, self.state_send, self.exit_event))
|
||||
|
||||
self.metadrive_process.start()
|
||||
|
||||
print("----------------------------------------------------------")
|
||||
|
||||
Reference in New Issue
Block a user