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

Test playback behavior with syncer at EOF #9668

Merged
merged 7 commits into from
Aug 30, 2021

Conversation

maloel
Copy link
Collaborator

@maloel maloel commented Aug 23, 2021

Added improvements to Python wrapper usability:

  • added frame_queue-like wait_for_frame etc. to syncer so they can be used interchangeably
  • added pyrs.sensor.name and repr

Also:

  • added a text converter to rs-convert to easily see the frame content of a rosbag

Tracked on [LRS-172]

global syncer, playback_status
f = syncer.poll_for_frame()
if playback_status is not None:
countdown = 50 # 5 seconds
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not using a timer class.
Set it to 5 seconds and check has_expired()
It will be more elegant IMO

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's easier for me to implement simple code like this without remembering APIs :)

unit-tests/syncer/sw.py Outdated Show resolved Hide resolved
elif not depth:
color = rs.video_frame( f )
else:
color = None
test.info( "actual color", color )
test.check_equal( color_frame is None, not color )
if color_frame is not None and color:
test.check_equal( color.get_frame_number(), color_frame )
Copy link
Collaborator

@Nir-Az Nir-Az Aug 29, 2021

Choose a reason for hiding this comment

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

Oh, I just realized that color_frame is actually color_frame_number
I didn't understand why we compare a frame number to a frame.
consider adding the arguments "_number" suffix

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah it's a mess. If I change it I have to change lots of lines in alll 3 testcases. I'll do it separately.


sw.generate_depth_and_color( frame_number = 0, timestamp = 0 )
sw.expect( depth_frame = 0 ) # syncer doesn't know about color yet
sw.expect( color_frame = 0, nothing_else = True ) # less than next expected of D
Copy link
Collaborator

Choose a reason for hiding this comment

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

less than next expected of D ,

  1. D = depth?
  2. What do you mean by less than next expected. I didn't understand the comment

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You need to understand the syncer: every stream has a time at which we expect the next frame to arrive. This is called the "next expected".

Copy link
Collaborator

Choose a reason for hiding this comment

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

I know what next expected means :)
I meant that a comment like "Since the next expected time for a depth frame is less than the time the color frame arrive, the syncer will not wait for it and output the color frame"

Will be more verbose without knowing the inside internal parameters of the syncer.

test.finish()
#
#############################################################################################
test.print_results_and_exit()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Great UT.

It really help to understand the "under the hood" of the syncer

Copy link
Collaborator

@Nir-Az Nir-Az left a comment

Choose a reason for hiding this comment

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

Great UT 🥇

@maloel maloel merged commit 613d307 into IntelRealSense:development Aug 30, 2021
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.

2 participants