[docs]defget_cameras(command,cameras=None,check_cameras=True,fail_command=False):"""A helper to determine what cameras to use. Parameters ---------- command The command that wants to access the cameras. cameras : list The list of camera names passed to the command. check_cameras : bool If any of the cameras is not connected, returns `False`. fail_command : bool Fails the command before returning `False`. Returns ------- cameras : list of `.Camera` instances A list of `.Camera` instances that match the input ``cameras`` or, if ``cameras=None``, the default cameras. If ``cameras=None`` and there are no default cameras defined, returns all the connected camera. If ``check_cameras=True`` and any of the selected cameras is not connected, the command is failed and returns `False`. """default=command.actor.default_camerasifnotcameras:ifdefaultisNoneorlen(default)==0:camera_instances=command.actor.camera_system.camerascameras=[camera_instance.nameforcamera_instanceincamera_instances]else:cameras=defaultcamera_instances=[]forcameraincameras:camera_instance=command.actor.camera_system.get_camera(name=camera)ifcamera_instanceisFalse:iffail_command:command.fail(text=f"camera {camera} is not connected.")returnFalsecamera_instances.append(camera_instance)ifcheck_cameras:forcamera_instanceincamera_instances:ifnotcamera_instance.connected:iffail_command:command.fail(text=f"camera {camera_instance.name} has not been initialised.")returnFalseiflen(cameras)==0:iffail_command:command.fail(text="no cameras connected.")returnFalsereturncamera_instances
[docs]defget_schema()->Dict[str,Any]:"""Returns the actor schema as a dictionary."""schema=json.loads(open(os.path.join(os.path.dirname(__file__),"schema.json")).read())returnschema