-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Unify notification and control messages using "flexible-message" #11063
Conversation
…r everywhere else...
…rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
{ | ||
} | ||
|
||
int add_dds_stream( std::shared_ptr< realdds::dds_stream > const & stream ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why int
and not size_t
? No need to cast
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the stream index, which is usually an int
in libRS and the profile. We'll need to cast at some point. Might as well be here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You cast the sensor index at to_rs2_video_stream
, I think this cast should be don't there too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this is not exactly how USB device indexes work, still need to work it out. Here you can have depth or color with index other than 0, and infrared with index 3 or 4. OK for this pull request, but needs more thinking
{ | ||
for( auto & sp : _streams[stream_index]->profiles() ) | ||
{ | ||
auto vsp = std::static_pointer_cast< realdds::dds_video_stream_profile >( sp ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to check if stream type is video
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now it assumes the streams are all uniform: they're created from a dds_device
which gets its streams from a stream-header
that defines the type of its profiles.
The previous message size was >10K for D435i. For L515, the color stream had a json that was |
: _uid( uid ) | ||
, _format( format ) | ||
dds_stream_profile( dds_stream_format format, int16_t frequency ) | ||
: _format( format ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is more efficient to initialize members by declaration order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK the init order is the order of decl, whatever order you write them in.
{ | ||
int it = 0; | ||
auto profile = std::make_shared< final_stream_profile >( j, it ); | ||
verify_end_of_json( j, it ); // just so it's not in the header |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not put all of from_json
implementation in the cpp? It is not inlined anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a template...
raw::flexible flexible_msg::to_raw() | ||
{ | ||
raw::flexible raw_msg; | ||
raw_msg.data_format( (raw::flexible_data_format) _data_format ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer cpp style casts
# the uid is not communicated any more... therefore 0x1 (the first profile) | ||
test.check_equal( '<pyrealdds.motion_stream_profile 0x1 RGB8 30 Hz>', str(profiles[0]) ) | ||
test.check_equal( len( profiles ), 1 ) | ||
test.check_equal( str(profiles[0]), '<pyrealdds.motion_stream_profile RGB8 @ 30 Hz>' ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its just a communication test but RGB8
for motion is wierd :-)
Maybe we need to add a motion format specification?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is... but like you said it's not important here.
The next PR will have a whole D435i emulation, with all the profiles including motion.
dds_stream_uid
- context-side code now generates them automaticallyoperator<()
forrs2::device
(otherwise std::map would useoperator bool()
and won't complain)