Skip to content

hdr test converted to python and stabilized - #12670

Merged
Nir-Az merged 6 commits into
realsenseai:developmentfrom
AviaAv:hdr-py-test
Mar 7, 2024
Merged

hdr test converted to python and stabilized#12670
Nir-Az merged 6 commits into
realsenseai:developmentfrom
AviaAv:hdr-py-test

Conversation

@AviaAv

@AviaAv AviaAv commented Feb 15, 2024

Copy link
Copy Markdown
Contributor

Tracked on: [LRS-1000]

@AviaAv
AviaAv requested a review from Nir-Az February 15, 2024 11:40
Comment thread unit-tests/live/d400/test-hdr.py Outdated
Comment thread unit-tests/live/d400/test-hdr.py Outdated
Comment thread unit-tests/live/d400/test-hdr.py Outdated
Comment thread unit-tests/live/d400/test-hdr.py Outdated
Comment thread unit-tests/live/d400/test-hdr.py Outdated
Comment thread unit-tests/live/d400/test-hdr.py Outdated
Comment thread unit-tests/live/d400/test-hdr.py Outdated
Comment thread unit-tests/live/d400/test-hdr.py Outdated
ctx = rs.context()
device = test.find_first_device_or_exit()
if ctx is not None:
devices_list = ctx.query_devices()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The original test used to perform a HW reset between each test, using restart_first_device_and_return_depth_sensor
This was removed, is this not required for this test suite?
@remibettan ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It would be better to perform HW reset between the tests, if they are changing some parameters, as the exposure for ID sequence 1/2.
Not needed for other tests.

Comment thread unit-tests/live/d400/test-hdr.py Outdated
Comment thread unit-tests/live/d400/test-hdr.py Outdated
Comment thread unit-tests/live/d400/test-hdr.py Outdated
min_counter_set = False

if not min_counter_set:
min_counter = int(depth_counter)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is this casting needed in python?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the original file had a static cast there, so i thought to do it like that.
but I'll just remove it, it's not really needed

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Still exist, let's please handle and answer all comments and than re-ask for a review from @remibettan

Comment thread unit-tests/live/d400/test-hdr.py Outdated
Comment thread unit-tests/live/d400/test-hdr.py Outdated
Comment thread unit-tests/live/d400/test-hdr.py Outdated
Comment thread unit-tests/live/d400/test-hdr.py Outdated
test.check(depth_sensor.get_option(rs.option.hdr_enabled) == 1)

sequence_id = -1
iterations_for_preparation = 30

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you explain the increase from 6 to 30?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

interesting...?

Comment thread unit-tests/live/d400/test-hdr.py Outdated
Comment thread unit-tests/live/d400/test-hdr.py Outdated

# emitter on/off works with PWM (pulse with modulation) in the hardware
# this takes some time to configure it
iterations_for_preparation = 30

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why 10 --> 30?

Comment thread unit-tests/live/d400/test-hdr.py Outdated
Comment thread unit-tests/live/d400/test-hdr.py Outdated
Comment thread unit-tests/live/d400/test-hdr.py Outdated
@AviaAv
AviaAv force-pushed the hdr-py-test branch 2 times, most recently from 750d293 to 94ce367 Compare February 21, 2024 15:14
@AviaAv
AviaAv force-pushed the hdr-py-test branch 2 times, most recently from c3a48e2 to 74e36a8 Compare February 29, 2024 12:52
@Nir-Az

Nir-Az commented Feb 29, 2024

Copy link
Copy Markdown
Collaborator

Please try to fix this conflict:
image
Oh this file was deleted, weird
Please rebase and make sure the file is deleted

@Nir-Az Nir-Az closed this Feb 29, 2024
@Nir-Az Nir-Az reopened this Feb 29, 2024
@Nir-Az
Nir-Az requested a review from remibettan March 4, 2024 06:48
Comment thread unit-tests/live/d400/test-hdr.py Outdated
device = test.find_first_device_or_exit()
depth_sensor = device.first_depth_sensor()

if depth_sensor and depth_sensor.supports(rs.option.hdr_enabled):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The test will not fail if this if statement is not filled, but the test itself will not be checked - please add else statement with failure of the test, with relevant message.
This comment is relevant for all below tests.

depth_sensor.set_option(rs.option.sequence_id, 1)
test.check(depth_sensor.get_option(rs.option.sequence_id) == 1)
exp = depth_sensor.get_option(rs.option.exposure)
test.check(depth_sensor.get_option(rs.option.exposure) == exposure_range.default - 1000) # w/a

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please add some comment to explain this w/a

Comment thread unit-tests/live/d400/test-hdr.py Outdated
depth_sensor.set_option(rs.option.hdr_enabled, 1)
test.check(depth_sensor.get_option(rs.option.hdr_enabled) == 1)

depth_sensor.set_option(rs.option.sequence_id, 1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please add some comment to explain that seq id 1 should be with default values

Comment thread unit-tests/live/d400/test-hdr.py Outdated
test.check(depth_sensor.get_option(rs.option.exposure) == exposure_range.default - 1000) # w/a
test.check(depth_sensor.get_option(rs.option.gain) == gain_range.default)

depth_sensor.set_option(rs.option.sequence_id, 2)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please add some comment to explain that seq id 2 should be with min values

Comment thread unit-tests/live/d400/test-hdr.py Outdated
test.check(depth_sensor.get_option(rs.option.hdr_enabled) == 0)

device.hardware_reset()
time.sleep(5)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  1. isn't it long? 5 seconds.
  2. I see these lines are between each test, please make a function for it

Comment thread unit-tests/live/d400/test-hdr.py Outdated
"""
helper method
checks that the frames resulting from the hdr_merge processing block are generated
from frames streamed within this method (and not using old frames) - see RSDSO-17341.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would change "within this method" to "within this streaming session" - only if you agree

Comment thread unit-tests/live/d400/test-hdr.py Outdated
5 3 (no frame to merge with 5 as 6 didn't arrive yet)
6 5 (merged frames 5+6)
... (more frames, until a frame counter reset)
1 1 (hdr # should like the value we reset to)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did you mean "hdr # should be around the value we reset to"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

not around, should be that value exactly... I'll fix that typo

pipe.stop()
depth_sensor.set_option(rs.option.hdr_enabled, 0) # disable hdr before next tests


Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes it's on purpose, by your comment I figured it's not needed here?

# get depth frame data
depth_frame = data.get_depth_frame()
if not test.check(depth_frame.supports_frame_metadata(rs.frame_metadata_value.sequence_id)):
return

@remibettan remibettan Mar 6, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you add here some log reading the fact that this metadata could not be read?
Do you think it should fail the test?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

on a second look... I dont think we need sequence id here, right? just the frame counter, what if we just remove it and remove also test.check(merged_frame.supports_frame_metadata(rs.frame_metadata_value.sequence_id)) ?

Comment thread unit-tests/live/d400/test-hdr.py Outdated
frame_counter = frame.get_frame_metadata(rs.frame_metadata_value.frame_counter)
frame_seq_id = frame.get_frame_metadata(rs.frame_metadata_value.sequence_id)
if frame_counter != prev_frame_counter + 1: # can only compare sequential frames
sequence_id = frame_seq_id

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please change this param name from sequence_id to expected_sequence_id.

Comment thread unit-tests/live/d400/test-hdr.py Outdated
depth_sensor.set_option(rs.option.emitter_on_off, 1)
test.check(depth_sensor.get_option(rs.option.emitter_on_off) == 0)

# Control's presence verified in the beginning of the block

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I do not understand this comment - could you rephrase it, please?

@remibettan remibettan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Few comments - but really great work!

@remibettan
remibettan self-requested a review March 7, 2024 09:24
@Nir-Az

Nir-Az commented Mar 7, 2024

Copy link
Copy Markdown
Collaborator

Still conflict that needs to be resolved
image

@remibettan remibettan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great task!

@Nir-Az
Nir-Az merged commit de220a4 into realsenseai:development Mar 7, 2024
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