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

dds stream type derivations; rs-enumerate-devices works #11075

Merged
merged 9 commits into from
Nov 8, 2022

Conversation

maloel
Copy link
Collaborator

@maloel maloel commented Nov 8, 2022

  • complain if device.open() or .close() with no profiles/streams

  • reverse frequency & format in profile ctors to fit order in json

  • add basic d435i test

  • add RS2_PRODUCT_LINE_SW_ONLY to find only software devices in context

    • rs-enumerate-devices now has --debug, --sw-only, --dds-domain flags
  • fix bug with context creation on pyrealsense2 load (a default context was always created, making creating another context for DDS impossible)

  • changed rs2 (sid.index) calc in the device-/sensor-proxy

@maloel maloel requested a review from OhadMeir November 8, 2022 06:53
src/context.cpp Outdated
int8_t index; // Used to distinguish similar streams like IR L / R, 0 otherwise

sid_index( int sid_, int index_ )
: sid( static_cast< int16_t >( sid_ ) )
Copy link
Contributor

Choose a reason for hiding this comment

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

Why cast and not save as int? If it is received from LibRS as int then there is no point casting it. If need to cast when sending over DDS cast there, If the message interface will change, no need to update here

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 a copy from dds_stream_uid that was removed. You're right, but I don't think it's important right now?

Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer that we will fix this now, we have to many things we commented on as "for later" and we'll forget to update them all

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

src/context.cpp Outdated

std::string to_string() const { return '(' + std::to_string( sid ) + '.' + std::to_string( index ) + ')'; }

inline bool operator<( sid_index const & r ) const { return this->sid < r.sid || this->index < r.index; }
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is a well defined "smaller than" operation. If a = { 5, 0 } and b = { 3, 1 } then a < b is true and also b < a is true;

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 doesn't matter, as long as it's consistent. This is simply a requirement for ordering items in a map.
That said, I think it's logical to break by sid and then index -- which is what I did, no?

Copy link
Contributor

Choose a reason for hiding this comment

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

It is logical to break sid and then index, but I think it means:
this->sid < r.sid || ( this->sid == r.sid && this->index < r.index )
No case when this->sid > r.sid will return true

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right :)

@@ -27,35 +27,68 @@ using namespace TCLAP;
using namespace realdds;


#define NAME2SERVER( X ) \
Copy link
Contributor

Choose a reason for hiding this comment

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

Since it is only used in get_supported_streams (including variable names) it is better to #define and #undef it in the function scope

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Now you're reaching... ;)

@maloel maloel merged commit 17e8051 into IntelRealSense:dds Nov 8, 2022
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