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

Support for ON_REQUESTED_INCOMPATIBLE_QOS and ON_OFFERED_INCOMPATIBLE_QOS events #193

Merged
merged 11 commits into from
Mar 27, 2020

Conversation

jaisontj
Copy link
Contributor

@jaisontj jaisontj commented Nov 15, 2019

Related to this feature request. The design and implementation details can also be found there.

  • Added new enum type RMW_EVENT_REQUESTED_INCOMPATIBLE_QOS and RMW_EVENT_OFFERED_INCOMPATIBLE_QOS to rmw_event_type_t
  • Defined new structures that encapsulate data for the new events above

Signed-off-by: Jaison Titus jaisontj92@gmail.com

@dirk-thomas
Copy link
Member

Please reference all related PR from at least one ticket for visibility.

Also for an RMW API change please include significantly more context / information.

@jaisontj
Copy link
Contributor Author

jaisontj commented Nov 16, 2019

@dirk-thomas Apologies for the lack of context, I planned on adding more information and that is why I had open this as a draft PR.

I've now opened up an issue here tracking all of the related PRs as well as detailing out the need for this feature and the implementation details. Intention is also to initiate a design discussion towards this.

@jaisontj jaisontj marked this pull request as ready for review November 20, 2019 19:22
Copy link

@piraka9011 piraka9011 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@mjcarroll mjcarroll left a comment

Choose a reason for hiding this comment

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

Some small nits

/**
* Total cumulative number of times the concerned subscription discovered a
* publisher for the same topic with an offered QoS that was incompatible
* with that requested by the subscription..
Copy link
Member

Choose a reason for hiding this comment

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

extra period

Copy link
Member

Choose a reason for hiding this comment

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

Done.

int32_t total_count_change;
/**
* The Qos Policy Id of one of the policies that was found to be
* incompatible the last time an incompatibility was detected
Copy link
Member

Choose a reason for hiding this comment

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

Missing period

Copy link
Member

Choose a reason for hiding this comment

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

Done.

@@ -295,6 +295,18 @@ enum RMW_PUBLIC_TYPE rmw_qos_liveliness_policy_t
#define RMW_QOS_LIFESPAN_DEFAULT {0, 0}
#define RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT {0, 0}

/// RMW equivalent of the DDS QoS Policy IDs
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reference for these enum values that could be linked?

Copy link
Member

Choose a reason for hiding this comment

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

I would say we should not mention DDS in the rmw API or its doc strings, as the underlying middleware may not be DDS. So we should just define what makes sense for our layer and if that happens to be similar to DDS's then we can mention that, but our interface should stand on its own.

Copy link
Member

@mm318 mm318 Mar 3, 2020

Choose a reason for hiding this comment

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

Removed mention of DDS from the comment / docstring.

RMW_QOS_POLICY_ID_LIVELINESS = 8,
RMW_QOS_POLICY_ID_RELIABILITY= 11,
RMW_QOS_POLICY_ID_HISTORY = 13,
RMW_QOS_POLICY_ID_LIFESPAN = 21
Copy link
Member

Choose a reason for hiding this comment

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

Why those strange numbers?
If they were taken from an specific implementation, please use contiguous numbers here, and convert them in each implementation.

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 took these values from the DDS implementation spec assuming that all RMW implementations will follow the same values. However, that may not be a correct assumption.

Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't assume a DDS based implementation.
The numbers in rmw can be just made up by you (if you decide to keep the ones in the dds spec that's ok, but add a comment stating that).
The rmw implementations should have a map between the ros ids and the specific implementations ids, using the macros that both provide.
In that way, we don't depend on future changes of the numbers.

Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

Choose a reason for hiding this comment

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

I have changed these values to one-hot bit values, to possibly address the question at #193 (comment) later.

@ivanpauno ivanpauno added the in review Waiting for review (Kanban column) label Dec 18, 2019
@@ -295,6 +295,18 @@ enum RMW_PUBLIC_TYPE rmw_qos_liveliness_policy_t
#define RMW_QOS_LIFESPAN_DEFAULT {0, 0}
#define RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT {0, 0}

/// RMW equivalent of the DDS QoS Policy IDs
Copy link
Member

Choose a reason for hiding this comment

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

I would say we should not mention DDS in the rmw API or its doc strings, as the underlying middleware may not be DDS. So we should just define what makes sense for our layer and if that happens to be similar to DDS's then we can mention that, but our interface should stand on its own.

RMW_QOS_POLICY_ID_LIVELINESS = 8,
RMW_QOS_POLICY_ID_RELIABILITY= 11,
RMW_QOS_POLICY_ID_HISTORY = 13,
RMW_QOS_POLICY_ID_LIFESPAN = 21
Copy link
Member

Choose a reason for hiding this comment

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

👍

@@ -295,6 +295,18 @@ enum RMW_PUBLIC_TYPE rmw_qos_liveliness_policy_t
#define RMW_QOS_LIFESPAN_DEFAULT {0, 0}
#define RMW_QOS_LIVELINESS_LEASE_DURATION_DEFAULT {0, 0}

/// RMW equivalent of the DDS QoS Policy IDs
enum RMW_PUBLIC_TYPE rmw_qos_policy_id_t
Copy link
Member

Choose a reason for hiding this comment

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

I'd use the word kind rather than id. For an analogy, if we had an enum for colors we'd not call the enum rmw_color_id_t, we'd just use rmw_color_kind_t or rmw_color_t most likely. So I think this should probably just be rmw_qos_policy_kind_t or rmw_qos_policy_t.

Copy link
Member

Choose a reason for hiding this comment

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

Done.

/// RMW equivalent of the DDS QoS Policy IDs
enum RMW_PUBLIC_TYPE rmw_qos_policy_id_t
{
RMW_QOS_POLICY_ID_INVALID = 0,
Copy link
Member

Choose a reason for hiding this comment

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

If we take my other recommendation, these should become RMW_QOS_POLICY_X or RMW_QOS_POLICY_KIND_X where X is each kind, like INVALID or RELIABILITY.

Copy link
Member

Choose a reason for hiding this comment

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

I have changed these enum names to RMW_QOS_POLICY_<X>.

int32_t total_count_change;
/**
* The Qos Policy Id of one of the policies that was found to be
* incompatible the last time an incompatibility was detected
Copy link
Member

Choose a reason for hiding this comment

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

Is there any logic to which policy id will be here if more than one are incompatible?

Copy link
Member

Choose a reason for hiding this comment

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

I am thinking of last_policy_kind (renamed from last_policy_id) as a bitmask, where each 1 bit represents a different policy kind that was incompatible.

@@ -35,10 +35,12 @@ typedef enum rmw_event_type_t
// subscription events
RMW_EVENT_LIVELINESS_CHANGED,
RMW_EVENT_REQUESTED_DEADLINE_MISSED,
RMW_EVENT_REQUESTED_INCOMPATIBLE_QOS,
Copy link
Member

Choose a reason for hiding this comment

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

This is hard for me to read and make sense of and it is worse in some of the struct descriptions below.

Would another wording make more sense? Maybe RMW_EVENT_REQUESTED_QOS_INCOMPATIBLE would be better. I would read it as:

An RMW_EVENT occurred due to a REQUESTED_QOS being INCOMPATIBLE with the subscription's QoS.

Which I think matches, for example, the deadline one better, which I would read as:

An RMW_EVENT occurred due to a REQUESTED_DEADLINE being MISSED.


Extending this to the other new event, I'd call it RMW_EVENT_OFFERED_QOS_INCOMPATIBLE.

Copy link
Member

Choose a reason for hiding this comment

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

Done.

@@ -400,6 +412,26 @@ typedef struct RMW_PUBLIC_TYPE rmw_requested_deadline_missed_status_t
int32_t total_count_change;
} rmw_requested_deadline_missed_status_t;

/// QoS Requested Incompatible QoS information provided by a subscription.
typedef struct RMW_PUBLIC_TYPE rmw_requested_incompatible_qos_status_t
Copy link
Member

Choose a reason for hiding this comment

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

Maybe you're just basing this off the DDS names, which a good place to start, but status doesn't really make sense to me here. I think that comes from this being the result of a "StatusCondition" in DDS. However, this strikes me as state more than status. I'm not sold on this (I know other similar structs may already use status rather than state), but I think state or event_state are better descriptors. What do other think?

Also, following from my other comment about naming, I'd swap them here too to be like this:

/// Event state for a subscription's 'RMW_EVENT_REQUESTED_QOS_INCOMPATIBLE' events.
typedef struct RMW_PUBLIC_TYPE rmw_requested_qos_incompatible_event_state_t
{
  ...

Or we could leave status in place of state and get:

/// Event status for a subscription's 'RMW_EVENT_REQUESTED_QOS_INCOMPATIBLE' events.
typedef struct RMW_PUBLIC_TYPE rmw_requested_qos_incompatible_event_status_t
{
  ...

Both options are an improvement in "at-a-glance comprehension", at least for me.

Copy link
Member

Choose a reason for hiding this comment

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

Swapped the positions of incompatible and qos, but let's keep the use of status for consistency.

@mm318 mm318 force-pushed the jaisontj/incompatible_qos branch from 3746b42 to 86e698b Compare February 24, 2020 19:38
@mm318 mm318 force-pushed the jaisontj/incompatible_qos branch from 077e14c to bf50896 Compare March 3, 2020 23:09
jaisontj and others added 10 commits March 22, 2020 10:10
RMW_EVENT_OFFERED_INCOMPATIBLE_QOS to rmw_event_type_t
- Defined new structures that encapsulate data for the new events above

Signed-off-by: Jaison Titus <jaisontj92@gmail.com>
Signed-off-by: Jaison Titus <jaisontj92@gmail.com>
Signed-off-by: Jaison Titus <jaisontj92@gmail.com>
Signed-off-by: Jaison Titus <jaisontj92@gmail.com>
Signed-off-by: Jaison Titus <jaisontj92@gmail.com>
Signed-off-by: Jaison Titus <jaisontj92@gmail.com>
Signed-off-by: Miaofei <miaofei@amazon.com>
Signed-off-by: Miaofei <miaofei@amazon.com>
Signed-off-by: Miaofei <miaofei@amazon.com>
Signed-off-by: Miaofei <miaofei@amazon.com>
@mm318 mm318 force-pushed the jaisontj/incompatible_qos branch from e05106c to db521dd Compare March 22, 2020 18:22
Signed-off-by: Miaofei <miaofei@amazon.com>
@mm318
Copy link
Member

mm318 commented Mar 26, 2020

@ros2/aws-oncall - please run this CI job
Gist: https://gist.githubusercontent.com/mm318/6e086798710e344feb2df41f94baf717/raw/26f6df7bdb054887b226bac7fc22fca942c04384/ros2_qos.repos
BUILD args: --packages-up-to rclcpp rclpy
TEST args: --packages-select rmw_connext_cpp rmw_connext_shared_cpp rmw_cyclonedds_cpp rmw rcl rclcpp rclpy
Job: ci_launcher

*/
int32_t total_count_change;
/**
* The Qos Policy Kind of one of the policies that was found to be
Copy link
Contributor

Choose a reason for hiding this comment

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

since you've changed the enum to bitflags, is the intent to only return "one of the policies" or is it now intended to return a bitfield with "all of the policies" that were incompatible?

Copy link
Member

Choose a reason for hiding this comment

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

Defining it as a bitflags opens up the possibility of returning multiple policies. However, currently the rmw implementations are still only capable of returning one policy.

@mm318
Copy link
Member

mm318 commented Mar 26, 2020

@ivanpauno
Copy link
Member

@mm318 SGTM! CI failures also look unrelated to me.
@wjwwood Do you think that does PRs are ready to be merged?

@wjwwood
Copy link
Member

wjwwood commented Mar 26, 2020

Fine by me, I trust you guys to review and merge it since my initial review.

@mm318
Copy link
Member

mm318 commented Mar 27, 2020

Fine by me, I trust you guys to review and merge it since my initial review.

Let's merge it then please, @ivanpauno. Thanks!

@ivanpauno ivanpauno merged commit 5356f91 into ros2:master Mar 27, 2020
@ivanpauno
Copy link
Member

@mm318 I merged those four PRs.
Please, open a issue in rmw_fastrtps, to track the future addition of these events.

@mm318
Copy link
Member

mm318 commented Mar 27, 2020

Thanks!

I have opened ros2/rmw_fastrtps#356 to track the future addition of support for these types of QoS events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in review Waiting for review (Kanban column)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants