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

hdr test converted to python and stabilized #12670

Merged
merged 6 commits into from
Mar 7, 2024

Conversation

AviaAv
Copy link
Contributor

@AviaAv AviaAv commented Feb 15, 2024

Tracked on: [LRS-1000]

@AviaAv AviaAv requested a review from Nir-Az February 15, 2024 11:40
ctx = rs.context()
device = test.find_first_device_or_exit()
if ctx is not None:
devices_list = ctx.query_devices()
Copy link
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
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.

min_counter_set = False

if not min_counter_set:
min_counter = int(depth_counter)
Copy link
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
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
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

test.check(depth_sensor.get_option(rs.option.hdr_enabled) == 1)

sequence_id = -1
iterations_for_preparation = 30
Copy link
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
Contributor

Choose a reason for hiding this comment

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

interesting...?


# 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
Collaborator

Choose a reason for hiding this comment

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

Why 10 --> 30?

@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
Copy link
Collaborator

Nir-Az commented Feb 29, 2024

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
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
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
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

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
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

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
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

test.check(depth_sensor.get_option(rs.option.hdr_enabled) == 0)

device.hardware_reset()
time.sleep(5)
Copy link
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

"""
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
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

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
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
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
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
Copy link
Contributor

@remibettan remibettan Mar 6, 2024

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
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)) ?

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
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.

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
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?

Copy link
Contributor

@remibettan remibettan left a comment

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!

@Nir-Az
Copy link
Collaborator

Nir-Az commented Mar 7, 2024

Still conflict that needs to be resolved
image

Copy link
Contributor

@remibettan remibettan left a comment

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 IntelRealSense:development Mar 7, 2024
16 of 17 checks passed
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