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

enable dds devices on run-unit-tests #13684

Open
wants to merge 3 commits into
base: development
Choose a base branch
from

Conversation

AviaAv
Copy link
Contributor

@AviaAv AviaAv commented Jan 15, 2025

Tracked on: [LRS-1221]

@AviaAv AviaAv requested a review from Nir-Az January 15, 2025 15:31
import subprocess
run_time_stopwatch = Stopwatch()
run_time_threshold = 2
run_time_threshold = 2 if 'D555' not in camera_name else 5
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we ask instead if the connection type is DDS?

Copy link
Collaborator

Choose a reason for hiding this comment

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

And add a comment explaining why?

@@ -35,15 +35,15 @@ def usage():
pyrs_dir = repo.find_pyrs_dir()
sys.path.insert( 1, pyrs_dir )

MAX_ENUMERATION_TIME = 10 # [sec]
MAX_ENUMERATION_TIME = 15 # [sec]
Copy link
Collaborator

Choose a reason for hiding this comment

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

This change will increase the libci timing for all devices.
What happens if we keep it at 10?

Copy link
Collaborator

Choose a reason for hiding this comment

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

f it's only for the first connection we are OK but I think we use this const in tests too, please check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we keep it at 10, we will get "timed out waiting for a device connection" when we wait, so sometimes we might begin the test without the device, which can cause it to fail (find_first_device_or_exit for example).

Also, as far as I understand, it will only increase libci times once, when we call query() and wait for the hub initially. As for the other uses, it's there as a timeout for when waiting, so we only wait until they're recognized and not the whole 15 seconds

Copy link
Collaborator

Choose a reason for hiding this comment

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

@OhadMeir is this expected? more than 10 seconds to get D555 after HW reset?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's make sure we understand why it takes more than 10 sec, but for now it's OK to proceed as is

Copy link
Contributor

Choose a reason for hiding this comment

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

Checked with wireshark. Between last message from old participant ("stopping") to first appearance of new participant almost 11 seconds. Less than 2 seconds later handshake complete.
So 15 seconds is a good limit for now.

try:
self._usb_location = _get_usb_location(self._physical_port)
if self._physical_port.startswith('realsense/'):
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see we already have dev , let's also ask if the connection type is dds?

Copy link
Collaborator

Choose a reason for hiding this comment

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

This way we fixed the error on D457 too, currently I see
-E- Failed to get usb location: invalid physical port '/dev/video-rs-depth-0'
On D457 the connection type is GMSL

@@ -223,7 +232,7 @@ def query( monitor_changes=True, hub_reset=False, recycle_ports=True ):
#
# Get all devices, and store by serial-number
global _device_by_sn, _context, _port_to_sn
_context = rs.context( { 'dds': False } )
_context = rs.context( { 'dds': { "enabled" : True } } )
Copy link
Collaborator

Choose a reason for hiding this comment

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

Today we ran DDS tests, maybe this comes externally?
Can you please verify how it's working without this change? as for other projects I prefer not to run DDS tests

Copy link
Contributor Author

@AviaAv AviaAv Jan 19, 2025

Choose a reason for hiding this comment

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

Without this change DDS devices are not found:
image

We can ignore DDS here if we get a flag in run_unit_tests, similar to what we do with --hub-reset, what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

About the DDS tests we ran - most of them were w/o a camera, the one that did worked on a USB camera (which was detected in this context), so I believe this is needed to detect the DDS cameras

Copy link
Collaborator

Choose a reason for hiding this comment

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

As discussed let's set this only if dds is in the context given

@@ -536,6 +546,9 @@ def enable_only( serial_numbers, recycle = False, timeout = MAX_ENUMERATION_TIME
else:
log.d( 'no hub; ports left as-is' )

# doesn't matter what it did, enable_only should wait for the devices to be available again
_wait_for(serial_numbers, timeout=timeout)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any impact on timing for non DDS devices after this addition?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea was that when we call this function in run_unit_tests:

should_reset = not no_reset
devices.enable_only( serial_numbers, recycle=should_reset )

We will wait even if there's no reset, because we want the devices to be available anyway after the test.

However, I now noticed we now have a wait twice if 'recycle' is on, so I'll move it to the else block. For non-DDS devices there shouldn't be a change

@@ -615,16 +628,19 @@ def hw_reset( serial_numbers, timeout = MAX_ENUMERATION_TIME ):
:param timeout: Maximum # of seconds to wait for the devices to come back online
:return: True if all devices have come back online before timeout
"""
# for usb and dds devices, we can wait until they're removed
removable_devs_sns = {sn for sn in serial_numbers if
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens on D457?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it will not be a part of it, it has both is_dds off and its port is None

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