RussTedrake / manipulation

Course notes for MIT manipulation class
BSD 3-Clause "New" or "Revised" License
392 stars 115 forks source link

Add Realsense Driver handling to HardwareStation #315

Closed evelyn-fu closed 1 month ago

evelyn-fu commented 1 month ago

Allow users to specify realsense lcm driver in scenario for HardwareStation in order to use realsense cameras in hardware.


This change is Reviewable

evelyn-fu commented 1 month ago

Thank you!

We already have CameraConfig in the scenarios., which has a name and an lcm_bus (and we use it to configure cameras in these notes... see manipulation/models/clutter.scenarios.yaml for an example). https://drake.mit.edu/doxygen_cxx/structdrake_1_1systems_1_1sensors_1_1_camera_config.html

Moreover, I don't think anything that you add to the diagram is actually specific to realsense? So perhaps we already have enough info to just add the lcm receiver, etc, based on the CameraConfig?

I do think there could be a tension between the the sensor_id and the camera name (which we tend to make more readable). But in that case, maybe we could just bolt on the extra info we need there? e.g. via something like

@dc.dataclass
class CameraConfigWithId(CameraConfig):
    """A camera configuration that includes the sensor id (for communicating with e.g. the output of a RealSense driver).

    Args:
        sensor_id: The camera id for lcm.
    """
    sensor_id: str = ""

Reviewed 1 of 1 files at r1, all commit messages. _Reviewable_ status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @evelyn-fu)

Would it make sense then to use the lcm channel name instead of the sensor_id since that's the only part that's specific to the realsense driver? (The realsense driver names the channels in this specific format: DRAKE_RGBD_CAMERA_IMAGES_{sensor_id})

nepfaff commented 1 month ago

The black CI fails. You should be able to fix this by running black *. Ideally, pre-commit would automatically force you to format before pushing. You can enable this by running pre-commit install or using poetry to install the repo (poetry install).