Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

driver class #15

Open
vstadnytskyi opened this issue Jun 23, 2022 · 3 comments
Open

driver class #15

vstadnytskyi opened this issue Jun 23, 2022 · 3 comments

Comments

@vstadnytskyi
Copy link
Owner

vstadnytskyi commented Jun 23, 2022

@AbdelRahmanNasser20
Following up on the most recent pull request.

We need more feedback and diagnostics options when instantiating driver object.

Here is the minimal example that should yield working driver object. Unless I am not using it correctly, then we need to have documentation on how it supposed to be used.

>ipython3
Python 3.8.8rc1 (tags/v3.8.8rc1:dfd7d68, Feb 17 2021, 11:01:21) [MSC v.1928 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.0.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from intel_realsense_devices.driver import Driver

In [2]: driver = Driver()

In [3]: driver.init(serial_number="f1231322")

In [4]: driver.get_images()
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Input In [4], in <module>
----> 1 driver.get_images()

File ~\Documents\Valentyn\custom_python_libraries\intel-realsense-devices\intel_realsense_devices\driver.py:194, in Driver.get_images(self)
    191 depth = f.get_depth_frame()
    193 color_img = np.asanyarray(color.get_data())
--> 194 ir_img = np.asanyarray(infrared.get_data())
    195 depth_img = np.asanyarray(depth.get_data())
    197 return {"color": color_img, "depth" : depth_img, "infrared" : ir_img}

RuntimeError: null pointer passed for argument "frame_ref"

Rebooting computer did not solve the problem. It is possible we need to do hardware reset before continuing. If that is correct, we need to have an extra function that would allow us to do this. Proposed definition:

def hardware_reset(self):
   """
   resets hardware
   """
   dev = driver.profile["gyro"].get_device()
   dev.hardware_reset()
@vstadnytskyi
Copy link
Owner Author

I found what is the problem. The driver object has connected itself to a wrong camera.

if I request device info from a profile, I do not get the camera I have requested with specific serial number. See below.

In [8]: driver.profile["gyro"].get_device()
Out[8]: <pyrealsense2.device: Intel RealSense D435I (S/N: 139522074713  FW: 05.12.07.150  on USB2.1)>

@vstadnytskyi
Copy link
Owner Author

@AbdelRahmanNasser20, I still get a problem with driver class. It connects to another camera first.

In [1]: from intel_realsense_devices.driver import Driver

In [2]: driver = Driver()

In [3]: driver.init(serial_number="f1231322")
 ----- Available devices -----
  Device PID:  0B3A
  Device name:  Intel RealSense D435I
  Serial number:  139522074713
  Firmware version:  05.12.07.150
  USB:  2.1
Enabled all streams
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Input In [3], in <module>
----> 1 driver.init(serial_number="f1231322")

File ~\Documents\Valentyn\custom_python_libraries\intel-realsense-devices\intel_realsense_devices\driver.py:67, in Driver.init(self, serial_number)
     64 self.conf[IMAGE].enable_device(serial_number)
     65 self.conf[GYRO].enable_device(serial_number)
---> 67 self.start()

File ~\Documents\Valentyn\custom_python_libraries\intel-realsense-devices\intel_realsense_devices\driver.py:88, in Driver.start(self)
     86 self.profile[ACCEL] = self.pipeline[ACCEL].start(self.conf[ACCEL])
     87 self.profile[GYRO] = self.pipeline[GYRO].start(self.conf[GYRO])
---> 88 self.profile[IMAGE] = self.pipeline[IMAGE].start(self.conf[IMAGE])

RuntimeError: Couldn't resolve requests

In [4]: import intel_realsense_devices

In [5]: intel_realsense_devices.__version__
Out[5]: '0.post52+gb0d4b19'

@vstadnytskyi
Copy link
Owner Author

vstadnytskyi commented Jun 24, 2022

It still connects to another camera

self.device
<pyrealsense2.device: Intel RealSense D435I (S/
N: 139522074713  FW: 05.12.07.150  on USB2.1)>

Check version of the code I have

In [5]: intel_realsense_devices.__version__
Out[5]: '0.post52+gb0d4b19'

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

No branches or pull requests

1 participant