Skip to content

Send supported options in discovery stream-header #11164

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

Merged
merged 7 commits into from
Dec 14, 2022

Conversation

OhadMeir
Copy link
Contributor

Added dds_option class to handle option objects
rs-dds-server tool gets all supported options and sends them in discovery, currently in stream header message. If we will see that the messages are to big we will split later.
The options are received by dds-device-impl and registered to the software device.

Also disabled shared memory transport as dds_participant.init() stuck many times because of it

@OhadMeir OhadMeir requested review from Nir-Az and maloel November 30, 2022 13:03
@maloel
Copy link
Contributor

maloel commented Dec 2, 2022

In general, I don't like dds_option -- "option" does not convey the nature of a setting, control, or configuration.
Let's distance ourselves from the librealsense "option" terminology, the usage of which will also cause confusion.
In ROS I believe they're called "parameters", abbreviated "param/s". This is fine by me.

@maloel
Copy link
Contributor

maloel commented Dec 2, 2022

Parameters can exist on multiple levels, and I'd say the first level is that of the device, not stream. In fact, I'd even say stream parameters are the last we want to worry about and that most can be handled at the level of the device. Why not start by adding a parameter-initialization message that we can use for any entity - device/stream/etc.?

@maloel
Copy link
Contributor

maloel commented Dec 2, 2022

Also disabled shared memory transport as dds_participant.init() stuck many times because of it

I don't agree with this. If we have trouble, it's very indicative of improper destruction. You can switch domains, reset the directory, etc. -- hiding the problem is not good and we need FastDDS to address this.

dds_option( nlohmann::json const & j );

public:
dds_option() = default;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this? I imagine the minimum ever would get an option name, but even then it would be protected and overwritten?

Also, _value, _range are uninitialized. Aren't you getting a warning?

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 did not want to create a constructor with many parameters, especially when you can set the values later
(rs-dds-server uses this to create an option and then set values it gets from LibRS interface)

When I started I didn't use option name, only added later and I agree it can be a minimum.
(I still need to consider your comment about device options for now I also think we will need stream name if using stream level options)

@Nir-Az
Copy link
Collaborator

Nir-Az commented Dec 4, 2022

Also disabled shared memory transport as dds_participant.init() stuck many times because of it

I don't agree with this. If we have trouble, it's very indicative of improper destruction. You can switch domains, reset the directory, etc. -- hiding the problem is not good and we need FastDDS to address this.

I don't see why we need shared memory to be used.
It is not our use case and it add issues and I don't believe it will be solved in the near future (or at all)
Why use it?

Note that on our new use cases we will probably have 100% "improper destructions".

@OhadMeir
Copy link
Contributor Author

OhadMeir commented Dec 7, 2022

I separated the supported options message from the device/stream-header messages.

This PR handles the discovery and listing the supported messages. Setting/querying and maybe changing LibRS style options (float, with range) to type hierarchy in next PRs

#
#############################################################################################
#
test.start( "Test no options..." )
Copy link
Collaborator

Choose a reason for hiding this comment

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

No need to add ... on every test postfix - IMO

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

test.check( device.is_running() )

options = device.options();
test.check_equal( len( options ), 3 )
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that it will be clearer if options-server will be more generic and will get the values here, is this possible?

Here we compare the values to values that were introduces somewhere else

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@maloel
Copy link
Contributor

maloel commented Dec 13, 2022

I don't see why we need shared memory to be used. It is not our use case and it add issues and I don't believe it will be solved in the near future (or at all) Why use it?

@Nir-Az I don't see any use-case here. This is realdds, and it shouldn't enforce anything. The proper way to do this is with a parameter.

Note that on our new use cases we will probably have 100% "improper destructions".

What're these new use-cases? I don't see why we should have improper destructions...

src/context.cpp Outdated
{
}

void set( float value ) override {}; //TODO - implement
Copy link
Contributor

Choose a reason for hiding this comment

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

extra semicolons in this and next lines

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

@Nir-Az
Copy link
Collaborator

Nir-Az commented Dec 13, 2022

I don't see why we need shared memory to be used. It is not our use case and it add issues and I don't believe it will be solved in the near future (or at all) Why use it?

@Nir-Az I don't see any use-case here. This is realdds, and it shouldn't enforce anything. The proper way to do this is with a parameter.

Note that on our new use cases we will probably have 100% "improper destructions".

What're these new use-cases? I don't see why we should have improper destructions...

You are right, about RealDDS and about the improper destructions.
I just think we need to continue implementing required features currently and not hold back for use cases that we don't have currently like client + server on the same PC (It will also work with UDP nut SHM will be more efficient, so we are OK)
We have a lot more to implement for our deadlines..

dds_options options;
for( auto & option : j["options"] )
{
options.push_back( dds_option::from_json( option, stream_it->second->name() ) );
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that init_options should set the owner name, not here...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And you will allow passing the dds_option object around, setting new owner?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, owner should only be set once

@@ -136,12 +135,12 @@ void dds_participant::init( dds_domain_id domain_id, std::string const & partici
pqos.wire_protocol().builtin.discovery_config.leaseDuration = { 10, 0 }; // [sec,nsec]

//Disable shared memory, use only UDP
//Disabling because sometimes, after improper destruction (e.g. stopping debug) the shared memory is not opened
Copy link
Contributor

Choose a reason for hiding this comment

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

Next time, please please please add a space between the // and the text and keep everything looking similar.

@Nir-Az Nir-Az merged commit bdc60ca into IntelRealSense:dds Dec 14, 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.

3 participants