I am trying to get all the sensors for a certain project:
OBSensorType.COLOR_SENSOR
OBSensorType.DEPTH_SENSOR
OBSensorType.ACCEL_SENSOR
OBSensorType.GYRO_SENSOR
For getting the depth images and colour images, I need to get them from the pipeline:
config = Config()
pipeline = Pipeline()
and then
profile_list = pipeline.get_stream_profile_list(OBSensorType.DEPTH_SENSOR)
assert profile_list is not None
try:
depth_profile = profile_list.get_video_stream_profile(640, 0, OBFormat.Y16, 30)
except OBError as e:
print("Error: ", e)
depth_profile = profile_list.get_default_video_stream_profile()
assert depth_profile is not None
whereas for getting the gyro and accel readings, I have to get them from the sensor list:
ctx= Context()
device_list= ctx.query_devices()
if device_list.get_count() == 0:
print("No device connected")
device= device_list.get_device_by_index(0)
sensor_list= device.get_sensor_list()
and then
gyro_senor = sensor_list.get_sensor_by_type(OBSensorType.GYRO_SENSOR)
if gyro_senor is None:
print("No gyro sensor")
gyro_profile_list = gyro_senor.get_stream_profile_list()
gyro_profile = gyro_profile_list.get_stream_profile_by_index(0)
assert gyro_profile is not None
How can I get both the readings in one way, I am asking this because I am getting this error when I try to use both Context() and Pipeline() which says that I have already created the the device by creating the Context and when I try to create the pipeline, the Context gets destroyed.
[2023-08-25 12:10:17.591266][info][9314][Context.cpp:66] Context created with config: default config!
[2023-08-25 12:10:17.713379][info][9314][DeviceManager.cpp:562] Found 1 device(s):
[2023-08-25 12:10:17.713429][info][9314][DeviceManager.cpp:564] - Name: Gemini2, PID: 0x0670, SN/ID: AY3A131006B
[2023-08-25 12:10:17.713578][info][9314][LinuxPal.cpp:109] Create PollingDeviceWatcher!
[2023-08-25 12:10:17.724635][info][9314][Gemini2Device.cpp:417] Device.OrbbecGemini2.FirmwareUpgradeFoolproof device firmware upgrade foolproof status true
[2023-08-25 12:10:17.726088][info][9314][Gemini2Device.cpp:116] Gemini2 device created! PID:1648, SN:AY3A131006B, depthMode: {name: Unbinned Dense Default, checksum(hex): 6bb28ca9a0dff5553497f9eecb59f667, optionCode: NORMAL}
[2023-08-25 12:10:17.726112][info][9314][DeviceManager.cpp:481] Device created successfully! Name: Gemini2, PID: 0x0670, SN/ID: AY3A131006B
[2023-08-25 12:10:17.726165][info][9314][Pipeline.cpp:15] Try to create pipeline with default device.
[2023-08-25 12:10:17.726194][warning][9314][ObException.cpp:5] Trying to create a device that you've already created! SN/ID: AY3A131006B, uid: 3-5-9
Traceback (most recent call last):
File "/home/npd/Dhruv/drone_implementation_tangentbug-dev_stereo/rs_demo_orbbec.py", line 178, in <module>
pipeline = Pipeline()
^^^^^^^^^^
RuntimeError: Caught an unknown exception!
[2023-08-25 12:10:17.770449][info][9314][Gemini2Device.cpp:121] Gemini2 device destroyed! PID:1648, SN:AY3A131006B, depthMode: {name: Unbinned Dense Default, checksum(hex): 6bb28ca9a0dff5553497f9eecb59f667, optionCode: NORMAL}
[2023-08-25 12:10:17.770963][info][9318][DeviceManager.cpp:117] task finish.
[2023-08-25 12:10:17.771053][info][9314][Context.cpp:82] Context destroyed
I want a way to use the readings from all the sensors: depth, gyro and accel. How can I do this?