Skip to content

Commit

Permalink
Zed2i -> Zed rename (#152)
Browse files Browse the repository at this point in the history
* Zed2i -> Zed rename, keep Zed2i and zed2i module for backwards compatibility

* Update CHANGELOG.md

* Add @deprecated decorator to Zed2i

* Add -> None type annotation

* update camera readme

* Rename all occurrences of Zed2i to Zed in airo-mono

---------

Co-authored-by: Thomas Lips <[email protected]>
  • Loading branch information
m-decoster and tlpss authored Dec 10, 2024
1 parent 8059efc commit e20960e
Show file tree
Hide file tree
Showing 13 changed files with 355 additions and 338 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ This project uses a [CalVer](https://calver.org/) versioning scheme with monthly
- Dropped support for python 3.8 and added 3.11 to the testing matrix [#103](https://github.com/airo-ugent/airo-mono/issues/103).
- Set python version to 3.10 because of an issue with the `ur_rtde` wheels [#121](https://github.com/airo-ugent/airo-mono/issues/121). Updated README.md to reflect this change.
- `URrtde` will now try connecting to do control interface up to 3 times before raising a `RuntimeError`.
- Renamed `Zed2i` to `Zed` and `zed2i.py` to `zed.py`, but kept the old names as aliases for backwards compatibility

### Fixed
- Fixed bug in `get_colored_point_cloud()` that removed some points see issue #25.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ pip install airo-camera-toolkit airo-robots
```
And writing a simple script:
```python
from airo_camera_toolkit.cameras.zed.zed2i import Zed2i
from airo_camera_toolkit.cameras.zed.zed import Zed
from airo_robots.manipulators.hardware.ur_rtde import URrtde
from airo_robots.grippers.hardware.robotiq_2f85_urcap import Robotiq2F85

robot_ip_address = "10.40.0.162"

camera = Zed2i()
camera = Zed()
robot = URrtde(ip_address=robot_ip_address)
gripper = Robotiq2F85(ip_address=robot_ip_address)

Expand Down
4 changes: 2 additions & 2 deletions airo-camera-toolkit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ pip install .[hand-eye-calibration]
## Getting started with cameras
Camera can be accessed by instantiating the corresponding class:, e.g. for a ZED camera:
```python
from airo_camera_toolkit.cameras.zed2i import Zed2i
from airo_camera_toolkit.cameras.zed import Zed
from airo_camera_toolkit.utils import ImageConverter
import cv2

camera = Zed2i(Zed2i.RESOLUTION_720, fps=30)
camera = Zed(Zed.RESOLUTION_720, fps=30)

while True:
image_rgb_float = camera.get_rgb_image()
Expand Down
6 changes: 3 additions & 3 deletions airo-camera-toolkit/airo_camera_toolkit/cameras/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Cameras
This subpackage contains implementations of the camera interface for the cameras we have at AIRO.

- ZED 2i
- ZED 2 series
- Realsense D400 series

It also contains code to enable multiprocessed use of the camera streams: [multiprocessed camera](./multiprocess/)
Expand All @@ -24,5 +24,5 @@ Each camera implementation can be run as a script and will execute the relevant
For example, to test your ZED installation:
```
conda activate airo-mono
python3 zed2i.py
```
python3 zed.py
```
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def discover_camera(brand: Optional[str], serial_number: Optional[str] = None, *
brand_enum = CameraBrand(brand) # Attempt to convert to enum

if brand_enum == CameraBrand.ZED:
from airo_camera_toolkit.cameras.zed.zed2i import Zed2i
from airo_camera_toolkit.cameras.zed.zed import Zed

camera = Zed2i(serial_number=serial_number, **kwargs)
camera = Zed(serial_number=serial_number, **kwargs)
elif brand_enum == CameraBrand.REALSENSE:
from airo_camera_toolkit.cameras.realsense.realsense import Realsense

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The receiver is subclass of `RGBCamera` which ensures that it follows the interf

## Usage
See the main function in [multiprocess_rgb_camera.py](./multiprocess_rgb_camera.py) for a simple example of how to use these classes with a ZED camera.
The main difference with the regular workflow is that instead of instantiating a `Zed2i` object, you now have to first create a `MultiprocessRGBPublisher` with the class and its kwargs, and then one or more `MultiprocessRGBReceiver`s.
The main difference with the regular workflow is that instead of instantiating a `Zed` object, you now have to first create a `MultiprocessRGBPublisher` with the class and its kwargs, and then one or more `MultiprocessRGBReceiver`s.

> :information_source: Similar to how regular `RGBCamera`s behave, `MultiprocessRGBReceiver`s will block until a new image is available.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(
"""Instantiates the publisher. Note that the publisher (and its process) will not start until start() is called.
Args:
camera_cls (type): The class e.g. Zed2i that this publisher will instantiate.
camera_cls (type): The class e.g. Zed that this publisher will instantiate.
camera_kwargs (dict, optional): The kwargs that will be passed to the camera_cls constructor.
shared_memory_namespace (str, optional): The string that will be used to prefix the shared memory blocks that this class will create.
"""
Expand Down Expand Up @@ -413,21 +413,21 @@ def __del__(self) -> None:
"""example of how to use the MultiprocessRGBPublisher and MultiprocessRGBReceiver.
You can also use the MultiprocessRGBReceiver in a different process (e.g. in a different python script)
"""
from airo_camera_toolkit.cameras.zed.zed2i import Zed2i
from airo_camera_toolkit.cameras.zed.zed import Zed

multiprocessing.set_start_method("spawn")

resolution = Zed2i.RESOLUTION_2K
resolution = Zed.RESOLUTION_2K
camera_fps = 15
namespace = "camera"

# Creating and starting the publisher
publisher = MultiprocessRGBPublisher(
Zed2i,
Zed,
camera_kwargs={
"resolution": resolution,
"fps": camera_fps,
"depth_mode": Zed2i.NEURAL_DEPTH_MODE,
"depth_mode": Zed.NEURAL_DEPTH_MODE,
},
shared_memory_namespace=namespace,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,19 +389,19 @@ def __del__(self) -> None:

import multiprocessing

from airo_camera_toolkit.cameras.zed.zed2i import Zed2i
from airo_camera_toolkit.cameras.zed.zed import Zed

multiprocessing.set_start_method("spawn")

resolution = Zed2i.RESOLUTION_2K
resolution = Zed.RESOLUTION_2K
camera_fps = 15

publisher = MultiprocessRGBDPublisher(
Zed2i,
Zed,
camera_kwargs={
"resolution": resolution,
"fps": camera_fps,
"depth_mode": Zed2i.NEURAL_DEPTH_MODE,
"depth_mode": Zed.NEURAL_DEPTH_MODE,
},
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,22 +281,22 @@ def __del__(self) -> None:

import multiprocessing

from airo_camera_toolkit.cameras.zed.zed2i import Zed2i
from airo_camera_toolkit.cameras.zed.zed import Zed

multiprocessing.set_start_method("spawn")

resolution = Zed2i.RESOLUTION_2K
resolution = Zed.RESOLUTION_2K
camera_fps = 15

# import os
# os.environ["CUDA_VISIBLE_DEVICES"] = "3"

publisher = MultiprocessStereoRGBDPublisher(
Zed2i,
Zed,
camera_kwargs={
"resolution": resolution,
"fps": camera_fps,
"depth_mode": Zed2i.NEURAL_DEPTH_MODE,
"depth_mode": Zed.NEURAL_DEPTH_MODE,
},
log_debug=True,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Now We will test whether our `airo_camera_toolkit can access the ZED cameras.
In this directory run:
```
conda activate airo-mono
python zed2i.py
python zed.py
```
Complete the prompts. If everything looks normal, congrats, you successfully completed the installation! :tada:
Expand Down
Loading

0 comments on commit e20960e

Please sign in to comment.