Skip to content

Conversation

@manasj326
Copy link

Creating a realsense interface

Copy link
Collaborator

@schromya schromya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some comments for you. You will also need to meet acceptance criteria in task #41. Also remember to leave a comment on the task with the PR link and add the time you spent.



def _capture_loop(self):
assert self._pipeline is not None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add full function comment. See software conventions

break


def _now_ns() -> int:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add full function comment. See software conventions


cur_dir = os.path.dirname(__file__)
# TODO:Update this config with the correct numbers
config_path = os.path.join(cur_dir, "config", "realsense_config.yaml")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update this yaml with the correct numbers.

self._thread = threading.Thread(target=self._capture_loop, name="RealSenseCapture", daemon=True)
self._thread.start()

...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove all these .... They were placeholders

from sensor_interface.camera.rgbd_camera import CameraIntrinsics, RGBDCameraInterface, RGBDFrame

try:
import pyrealsense2 as rs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add this dependency to the pyproject.toml

Copy link
Collaborator

@schromya schromya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These files do not run due to the following error. Please avoid submitting PRs with files that cannot run due to errors.

Exception in thread RealsenseCaptureLoop:
Traceback (most recent call last):
  File "/home/mya/Desktop/github/HCI/dexterity-interface/libs/sensor_interface/sensor_interface_py/src/sensor_interface/camera/realsense_interface.py", line 292, in _capture_loop
    frame = RGBDFrame(
            ^^^^^^^^^^
TypeError: RGBDFrame.__init__() got an unexpected keyword argument 'timestamp_ns'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.11/threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "/home/mya/Desktop/github/HCI/dexterity-interface/libs/sensor_interface/sensor_interface_py/src/sensor_interface/camera/realsense_interface.py", line 299, in _capture_loop
    frame = RGBDFrame(color_rgb, depth_m, ts_ns)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: RGBDFrame.__init__() missing 1 required positional argument: 'frame_id'
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/mya/Desktop/github/HCI/dexterity-interface/libs/sensor_interface/sensor_interface_py/src/sensor_interface/camera/realsense_interface.py", line 319, in <module>
    f = cam.latest()
        ^^^^^^^^^^^^
  File "/home/mya/Desktop/github/HCI/dexterity-interface/libs/sensor_interface/sensor_interface_py/src/sensor_interface/camera/realsense_interface.py", line 236, in latest
    raise RuntimeError("No frame captured yet. Did you call start() and wait briefly?")
RuntimeError: No frame captured yet. Did you call start() and wait briefly?

import argparse
import time

import cv2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This dependency needs to be added to pyproject.toml.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add instructions for running this file, along with arg description to sensor_interface/readme.md.

Also, this file shares a lot of overlap with the kinect equivalent. Either extract shared functionality or adjust so the same example can run either interface based off of arg passed (i.e. kinect or realsense).

@schromya schromya marked this pull request as draft October 28, 2025 13:50
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