docs(cameras): update find_cameras instructions
This commit is contained in:
@@ -13,5 +13,5 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from .camera import Camera
|
from .camera import Camera
|
||||||
from .configs import CameraConfig, ColorMode
|
from .configs import CameraConfig, ColorMode, Cv2Rotation
|
||||||
from .utils import make_cameras_from_configs
|
from .utils import make_cameras_from_configs
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ class OpenCVCamera(Camera):
|
|||||||
or port changes, especially on Linux. Use the provided utility script to find
|
or port changes, especially on Linux. Use the provided utility script to find
|
||||||
available camera indices or paths:
|
available camera indices or paths:
|
||||||
```bash
|
```bash
|
||||||
python -m lerobot.find_cameras
|
python -m lerobot.find_cameras opencv
|
||||||
```
|
```
|
||||||
|
|
||||||
The camera's default settings (FPS, resolution, color mode) are used unless
|
The camera's default settings (FPS, resolution, color mode) are used unless
|
||||||
@@ -67,7 +67,7 @@ class OpenCVCamera(Camera):
|
|||||||
Example:
|
Example:
|
||||||
```python
|
```python
|
||||||
from lerobot.common.cameras.opencv import OpenCVCamera
|
from lerobot.common.cameras.opencv import OpenCVCamera
|
||||||
from lerobot.common.cameras.configuration_opencv import OpenCVCameraConfig, ColorMode
|
from lerobot.common.cameras.configuration_opencv import OpenCVCameraConfig, ColorMode, Cv2Rotation
|
||||||
|
|
||||||
# Basic usage with camera index 0
|
# Basic usage with camera index 0
|
||||||
config = OpenCVCameraConfig(index_or_path=0)
|
config = OpenCVCameraConfig(index_or_path=0)
|
||||||
@@ -92,7 +92,7 @@ class OpenCVCamera(Camera):
|
|||||||
width=1280,
|
width=1280,
|
||||||
height=720,
|
height=720,
|
||||||
color_mode=ColorMode.RGB,
|
color_mode=ColorMode.RGB,
|
||||||
rotation=90
|
rotation=Cv2Rotation.ROTATE_90
|
||||||
)
|
)
|
||||||
custom_camera = OpenCVCamera(custom_config)
|
custom_camera = OpenCVCamera(custom_config)
|
||||||
# ... connect, read, disconnect ...
|
# ... connect, read, disconnect ...
|
||||||
@@ -164,7 +164,7 @@ class OpenCVCamera(Camera):
|
|||||||
self.videocapture = None
|
self.videocapture = None
|
||||||
raise ConnectionError(
|
raise ConnectionError(
|
||||||
f"Failed to open OpenCV camera {self.index_or_path}."
|
f"Failed to open OpenCV camera {self.index_or_path}."
|
||||||
f"Run 'python -m find_cameras Run 'python -m find_cameras' for details about the available cameras in your system."
|
f"Run 'python -m lerobot.find_cameras opencv' for details about the available cameras in your system."
|
||||||
)
|
)
|
||||||
|
|
||||||
self._configure_capture_settings()
|
self._configure_capture_settings()
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class RealSenseCamera(Camera):
|
|||||||
|
|
||||||
Use the provided utility script to find available camera indices and default profiles:
|
Use the provided utility script to find available camera indices and default profiles:
|
||||||
```bash
|
```bash
|
||||||
python -m lerobot.find_cameras
|
python -m lerobot.find_cameras realsense
|
||||||
```
|
```
|
||||||
|
|
||||||
A `RealSenseCamera` instance requires a configuration object specifying the
|
A `RealSenseCamera` instance requires a configuration object specifying the
|
||||||
@@ -63,7 +63,7 @@ class RealSenseCamera(Camera):
|
|||||||
Example:
|
Example:
|
||||||
```python
|
```python
|
||||||
from lerobot.common.cameras.realsense import RealSenseCamera, RealSenseCameraConfig
|
from lerobot.common.cameras.realsense import RealSenseCamera, RealSenseCameraConfig
|
||||||
from lerobot.common.cameras import ColorMode
|
from lerobot.common.cameras import ColorMode, Cv2Rotation
|
||||||
|
|
||||||
# Basic usage with serial number
|
# Basic usage with serial number
|
||||||
config = RealSenseCameraConfig(serial_number_or_name="1234567890") # Replace with actual SN
|
config = RealSenseCameraConfig(serial_number_or_name="1234567890") # Replace with actual SN
|
||||||
@@ -87,7 +87,7 @@ class RealSenseCamera(Camera):
|
|||||||
width=1280,
|
width=1280,
|
||||||
height=720,
|
height=720,
|
||||||
color_mode=ColorMode.BGR, # Request BGR output
|
color_mode=ColorMode.BGR, # Request BGR output
|
||||||
rotation=0,
|
rotation=Cv2Rotation.NO_ROTATION,
|
||||||
use_depth=True
|
use_depth=True
|
||||||
)
|
)
|
||||||
depth_camera = RealSenseCamera(custom_config)
|
depth_camera = RealSenseCamera(custom_config)
|
||||||
@@ -175,7 +175,7 @@ class RealSenseCamera(Camera):
|
|||||||
self.rs_profile = None
|
self.rs_profile = None
|
||||||
self.rs_pipeline = None
|
self.rs_pipeline = None
|
||||||
raise ConnectionError(
|
raise ConnectionError(
|
||||||
f"Failed to open {self} camera. Run 'python -m find_cameras' for details about the available cameras in your system."
|
f"Failed to open {self} camera. Run 'python -m lerobot.find_cameras realsense' for details about the available cameras in your system."
|
||||||
) from e
|
) from e
|
||||||
|
|
||||||
logger.debug(f"Validating stream configuration for {self}...")
|
logger.debug(f"Validating stream configuration for {self}...")
|
||||||
@@ -388,10 +388,9 @@ class RealSenseCamera(Camera):
|
|||||||
|
|
||||||
if not self.is_connected:
|
if not self.is_connected:
|
||||||
raise DeviceNotConnectedError(f"{self} is not connected.")
|
raise DeviceNotConnectedError(f"{self} is not connected.")
|
||||||
|
|
||||||
if not self.use_depth:
|
if not self.use_depth:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
f"Failed to capture depth frame from {self}. '.read_depth()'. Depth stream is not enabled."
|
f"Failed to capture depth frame '.read_depth()'. Depth stream is not enabled for {self}."
|
||||||
)
|
)
|
||||||
|
|
||||||
start_time = time.perf_counter()
|
start_time = time.perf_counter()
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ def create_camera_instance(cam_meta: Dict[str, Any]) -> Dict[str, Any] | None:
|
|||||||
instance = OpenCVCamera(cv_config)
|
instance = OpenCVCamera(cv_config)
|
||||||
elif cam_type == "RealSense":
|
elif cam_type == "RealSense":
|
||||||
rs_config = RealSenseCameraConfig(
|
rs_config = RealSenseCameraConfig(
|
||||||
serial_number=str(cam_id),
|
serial_number_or_name=int(cam_id),
|
||||||
color_mode=ColorMode.RGB,
|
color_mode=ColorMode.RGB,
|
||||||
)
|
)
|
||||||
instance = RealSenseCamera(rs_config)
|
instance = RealSenseCamera(rs_config)
|
||||||
|
|||||||
Reference in New Issue
Block a user