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 using generic format types #11946

Merged
merged 10 commits into from
Jul 11, 2023
Merged

Conversation

OhadMeir
Copy link
Contributor

@OhadMeir OhadMeir commented Jun 28, 2023

rs-dds-adapter sends only profiles of "generic" formats: YUYV/UYVY for color, no interleaved formats etc...

The adapter also sets default profiles that are different from the USB defaults. D400 default color format is RGB8 for USB, here using YUYV, Infrared default resolution matches depth default resolution.

Context is saving the json params it receives during construction, device is using relevant parameters without the need for context to parse the parameters

@OhadMeir OhadMeir requested a review from maloel June 29, 2023 07:53
src/context.h Outdated Show resolved Hide resolved
src/device.h Outdated
@@ -87,6 +87,8 @@ class device : public virtual device_interface, public info_container

bool device_changed_notifications_on() const { return _device_changed_notifications; }

bool should_use_basic_formats() const;
Copy link
Collaborator

Choose a reason for hiding this comment

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

A few things: :)

  • Not sure about the name - if we stuck to the existing convention, it would be use_basic_formats_on()?
  • Should we really expose a function from the device? I'd bet the sensor pretty much knows how to get the context? If so, why not query the context directly and no go through the device? It's really not a device function, is it?

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 sensor uses it's device "owner" to access the context, no direct access.
Conceptually we can make this a per sensor decision, but I don't really see a case where it is not an application wide resolution. It is whether we convert at server side or host side and the CPU/bandwidth resources needed.

Copy link
Collaborator

@maloel maloel Jul 3, 2023

Choose a reason for hiding this comment

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

I would argue it's not actually per device, though. It's per context.
I think the sensor should query the context.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated sensor to parse this parameter

src/sensor.cpp Outdated
// Invoke processing blocks callback
const auto&& process_cb = make_callback([&, this](frame_holder f) {
const auto & process_cb = make_callback( [&, this]( frame_holder f ) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not a ref

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@@ -41,6 +41,13 @@ class lrs_device_controller
void start_streaming( const nlohmann::json & msg );
void publish_frame_metadata( const rs2::frame & f, realdds::dds_time const & );

void override_default_profiles( const std::map< std::string, realdds::dds_stream_profiles > & stream_name_to_profiles,
std::map< std::string, size_t > & stream_name_to_default_profile ) const;
size_t get_index_of_profile( const realdds::dds_stream_profiles & profiles,
Copy link
Collaborator

Choose a reason for hiding this comment

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

These two look like they don't belong in the class and can be static in the cpp

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't like creating static functions just to hide the signature. This is why they are private functions of the class. All the public interface is on the first lines of the class so users don't need to scroll down and "get to know" the private parts if it is not important for them. I considered making the parameters members of the class but decided not to, currently.

Copy link
Collaborator

Choose a reason for hiding this comment

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

But then it dirties the header and pollutes the build space when changes are made. It's implementation. If it doesn't need to be in class, it shouldn't. My opinion. Do what you think is right.

"}" );
nlohmann::json j = {
{ "dds-discovery", false },
{ "use-basic-formats", true }
Copy link
Collaborator

Choose a reason for hiding this comment

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

May want to explain

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added explanation

@@ -41,142 +42,142 @@ def colored_infrared_stream_profiles():
# dds.video_stream_profile( 30, dds.stream_format("BGRA"), 1280, 720 ),
# dds.video_stream_profile( 30, dds.stream_format("RGBA"), 1280, 720 ),
# dds.video_stream_profile( 30, dds.stream_format("RGB2"), 1280, 720 ),
# dds.video_stream_profile( 30, dds.stream_format("rgb8"), 1280, 720 ),
dds.video_stream_profile( 30, dds.stream_format("rgb8"), 1280, 720 ),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why re-enable rgb8?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know if your question is for the colored infrared stream or general.

For the D405 color stream and also for the other modules I re-enabled rgb8 because that is what the users will see after LibRS will convert the received streams.
For the colored infrared it was more of inertia, doing the same all over the files. The stream is not broadcasted anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, as previously discussed

@OhadMeir OhadMeir mentioned this pull request Jul 5, 2023
@OhadMeir OhadMeir marked this pull request as ready for review July 11, 2023 07:23
@OhadMeir OhadMeir force-pushed the dds_formats_conversion branch from 2bcc566 to edff921 Compare July 11, 2023 07:31
@maloel maloel merged commit ffb1375 into IntelRealSense:dds Jul 11, 2023
@OhadMeir OhadMeir deleted the dds_formats_conversion branch March 14, 2024 09:52
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