Skip to content

Conversation

@khaledmohamed00
Copy link
Collaborator

feat(digit_cam): Add DIGIT Tactile Sensor Support to RCS

Description

This PR adds support for the DIGIT tactile sensor to the rcs library. It introduces a new module (digit_cam) which allows integration and communication with one or more DIGIT sensors. You can specify the number of connected devices and their serial numbers directly in the configuration.


Key Features

  • Configurable DIGIT sensors: Specify multiple sensors via the cameras dictionary using their unique identifiers(serial number).
  • stream settings: Choose between QVGA or VGA resolutions and corresponding frame rates.
  • Sensor interfacing: A new wrapper class is introduced to enable observation, action, and reset functionality for DIGIT.
  • Example usage: Includes an example script .

Module Structure & Additions

1. New Directory:

  • robot-control-stack/python/rcs/digit_cam/

2. New Configuration and interface Class:

located in robot-control-stack/python/rcs/digit_cam/digit_cam.py

Interface Class:
  • DigitCam(BaseHardwareCameraSet)
    Inherits from BaseHardwareCameraSet and implements:
    • initialize()
    • _poll_frame()
    • Config getters/setters
Configuration Class
class DigitConfig(HWCameraSetConfig):
    """Configuration for the DIGIT device."""
    cameras: dict[str, BaseCameraConfig] = Field(
        default_factory=lambda: {"camera1": BaseCameraConfig(identifier="D21182")}
    )
    stream: dict = Digit.STREAMS["QVGA"]
    resolution_width: int = stream["resolution"]["width"]
    resolution_height: int = stream["resolution"]["height"]
    frame_rate: int = stream["fps"]["30fps"]

    @property
    def name_to_identifier(self):
        return dict(self.cameras)

Example configuration:

cameras={
        "camera1": BaseCameraConfig(identifier="D21182"),
        "camera2": BaseCameraConfig(identifier="D211xx")
    }

3. New Wrapper Class:

robot-control-stack/python/rcs/envs/base.py

  • DigitCameraSetWrapper inherits from CameraSetWrapper

  • implements:

    • observation
  • This adds digit_frames to the observation dictionary:

    observation['digit_frames'] = {
        "camera_1": np.array(shape=(320, 240, 3))
    }

Resolution and Frame Rate Options

QVGA:

  • Resolution: 320x240
  • FPS: 60 (default), 30

VGA:

  • Resolution: 640x480
  • FPS: 30 (default), 15

Example Added

  • robot-control-stack/python/examples/env_cartesian_control_digit.py

This example demonstrates how to use the new DIGIT sensor interface for the Cartesian control example.


Checklist

  • DIGIT sensor module added
  • Wrapper for sensor control and observation
  • Configurable stream settings
  • Example environment script provided

juelg added 3 commits June 2, 2025 16:16
- factory produces digit class and not config
- cleaned digit config and adapted to existing camera logic; moved example value to example script
- removed set_config as it would need to reinitialize the cameras
- cleaned digit import paths
- added digit to exported modules
- adapted info dict to represent digit explicitly
remove width and height properties in digit config and moved them to default factory
@juelg
Copy link
Contributor

juelg commented Jun 2, 2025

Thanks! I went over the code and adjusted the logic to fit the current camera code a bit closer. I also moved the digit into the camera folder as I want to refactor the camera code to be able to have the digit implemented as a true camera. That would save us a bit of redundant code. You can see my progress at #189 .

I would also like to remove the example code for two reasons: We dont have example code for the normal camera and there is no digit in simulation. The examples should just show case the basic functionality and do not have to include every support sensor. This also reduces the amount of internal dependencies that need to be updated.

@juelg juelg merged commit 6203369 into master Jun 2, 2025
2 checks passed
@juelg juelg deleted the gamal/digit_cam branch June 2, 2025 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants