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

export internal subscriptions of feedback and status #3

Conversation

iuhilnehc-ynos
Copy link
Owner

For internal review.

Signed-off-by: Chen Lihui [email protected]

@iuhilnehc-ynos
Copy link
Owner Author

@fujitatomoya @Barry-Xu-2018

Could you help me review this?

* Attribute | Adherence
* ------------------ | -------------
* Allocates Memory | No
* Thread-Safe | No
Copy link
Collaborator

Choose a reason for hiding this comment

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

If only get pointer, is it thread-safe ?

Copy link
Owner Author

@iuhilnehc-ynos iuhilnehc-ynos Mar 16, 2021

Choose a reason for hiding this comment

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

It's not thread-safe (almost all of the api in this files are not thread-safe), so the outside caller need to add a lock for it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

My mistake. It's not thread-safe.

Copy link
Collaborator

Choose a reason for hiding this comment

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

right, in rcl there is not mutex lock currently. i think that this is because of difficulty and maintenance cost since mutex introduces complication especially in C implementation.

@Barry-Xu-2018
Copy link
Collaborator

LGTM

Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

probably unit test will be required as well.

* Attribute | Adherence
* ------------------ | -------------
* Allocates Memory | No
* Thread-Safe | No
Copy link
Collaborator

Choose a reason for hiding this comment

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

right, in rcl there is not mutex lock currently. i think that this is because of difficulty and maintenance cost since mutex introduces complication especially in C implementation.

/// Add a goal uuid.
/**
* This function is to add a goal uuid to the map of rcl_action_client_t
* and then set content filtered topic again.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* and then set content filtered topic again.
* and then try to set content filtered topic if it is supported.

*
* \param[in] action_client handle to the client that will take the goal response
* \param[in] uuid pointer to a uuid which length is 16
* \return `RCL_RET_OK` if the response was taken successfully, or
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* \return `RCL_RET_OK` if the response was taken successfully, or
* \return `RCL_RET_OK` if success on setting a goal uuid, or

/// Remove a goal uuid.
/**
* This function is to remove a goal uuid from the map of rcl_action_client_t
* and then set content filtered topic again.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* and then set content filtered topic again.
* and then try to reset content filtered topic if it is supported.

*
* \param[in] action_client handle to the client that will take the goal response
* \param[in] uuid pointer to a uuid which length is 16
* \return `RCL_RET_OK` if the response was taken successfully, or
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* \return `RCL_RET_OK` if the response was taken successfully, or
* \return `RCL_RET_OK` if success on removing a goal uuid, or

@@ -171,6 +176,27 @@ _rcl_action_client_fini_impl(
goto fail; \
}

size_t hash_map_uuid_hash_func(const void * uuid)
Copy link
Collaborator

Choose a reason for hiding this comment

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

just a comment, i think it is okay just to use djb2 hash function here.

@@ -222,6 +248,16 @@ rcl_action_client_init(
SUBSCRIPTION_INIT(feedback);
SUBSCRIPTION_INIT(status);

// Initialize goal_uuids map
rcutils_ret_t rcutils_ret = rcutils_hash_map_init(
Copy link
Collaborator

Choose a reason for hiding this comment

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

RCL_RET_FROM_RCUTIL_RET should be used?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah, i do not have strong preference here, so either way you go, i am good to go with it.

Comment on lines 688 to 707
#define UUID_FMT \
"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X"

#define UUID_FMT_ARGS(uuid) \
uuid[0], \
uuid[1], \
uuid[2], \
uuid[3], \
uuid[4], \
uuid[5], \
uuid[6], \
uuid[7], \
uuid[8], \
uuid[9], \
uuid[10], \
uuid[11], \
uuid[12], \
uuid[13], \
uuid[14], \
uuid[15]
Copy link
Collaborator

Choose a reason for hiding this comment

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

probably we would want to move these into rcl_action/include/rcl_action/types.h?

allocator.deallocate(feedback_filter, allocator.state);
feedback_filter = feedback_filter_update;

for (i = 0; i < size; ++i) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this even work for multiple action clients request the goal?

  1. client-A requests goal-1-A.
  2. client-B requests goal-2-B.
  3. client-A requests goal-3-A.
  4. client-B requests goal-4-B.

as far as i see, example on client-A. it will try to do filtering 1 & 2 which are goal-1-A and goal-2-B on the server side list because client-A/B cannot know the array size on server side? so in this case, we would need probably like a wildcard filtering expression?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Does this even work for multiple action clients request the goal?

Yes, it does.

cannot know the array size on server side?

Sorry? I feel that client-A/B does not need to know the array size on server side.
the feedback and status subscribers are on client side, and they know the array size of goal_id.

  • Client A request goal-1-A with UUID-1-A
    • it will set feedback filter with (goal_id.uuid=UUID-1-A) and status filter with (status_list[0].goal_info.goal_id.uuid=UUID-1-A)
  • Client B request goal-2-B with UUID-2-B
    • it will set feedback filter with (goal_id.uuid=UUID-2-B) and status filter with (status_list[0].goal_info.goal_id.uuid=UUID-2-B)
  • Client A request goal-3-A with UUID-3-A ( if goal-1-A is still processed )
    • it will set feedback filter with (goal_id.uuid=UUID-1-A or goal_id.uuid=UUID-3-A) and status filter with (status_list[0].goal_info.goal_id.uuid=UUID-1-A or status_list[1].goal_info.goal_id.uuid=UUID-3-A or status_list[0].goal_info.goal_id.uuid=UUID-3-A or status_list[1].goal_info.goal_id.uuid=UUID-1-A)
  • Client B request goal-4-B with UUID-4-B
    • it will set feedback filter with (goal_id.uuid=UUID-2-B or goal_id.uuid=UUID-4-B) and status filter with (status_list[0].goal_info.goal_id.uuid=UUID-2-B or status_list[1].goal_info.goal_id.uuid=UUID-4-B or status_list[0].goal_info.goal_id.uuid=UUID-4-B or status_list[1].goal_info.goal_id.uuid=UUID-2-B)

What do you think?

so in this case, we would need probably like a wildcard filtering expression?

Sorry, I can't find it to support array wildcard filtering expression? So I add the commend for the https://github.com/iuhilnehc-ynos/rclcpp/blob/4ec21c2414c3c8677445a8bcc8cf9b654cbc65e4/rclcpp/src/rclcpp/time_source.cpp#L126-L133

Copy link
Owner Author

Choose a reason for hiding this comment

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

After reconsideration, yes, it has the issues there. I'll find a way to support this wildcard filtering expression for array.

Copy link
Collaborator

Choose a reason for hiding this comment

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

sorry to be late to get back to this. yeah, the problem is with index of status_list, semantic of index is different between writer and reader.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Owner Author

Choose a reason for hiding this comment

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

It seems there only exist two ways:

  1. ask RTI to support this kind of feature. (Actually, the "&hex" for UUID is also an extension for the content filtered topic on rti_connext, other DDS implementation might not support this feature.)
  2. change action message type (goal request) to transfer node name, but it will change the original action design. (One design needs to update another design, is it OK to go for it? If so, do you think we need to update the action design first, and then go back to finish this CFT feature.)

Do you have any suggestions?

Copy link
Collaborator

Choose a reason for hiding this comment

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

ask RTI to support this kind of feature. (Actually, the "&hex" for UUID is also an extension for the content filtered topic on rti_connext, other DDS implementation might not support this feature.)

probably 1st step is just ask their opinion is good. with some background about CFT feature, could you create question
on https://github.com/rticommunity/rmw_connextdds/issues?

change action message type (goal request) to transfer node name, but it will change the original action design. (One design needs to update another design, is it OK to go for it? If so, do you think we need to update the action design first, and then go back to finish this CFT feature.)

probably we can skip status topic at this time, only feedback. i would say, CFT is still really good feature for user subscription, parameter events and action feedback topic. so let's finish that 1st. then we can come back to this topic for more additional enhancement with CFT requesting action status message modification. how about that?

Copy link
Owner Author

Choose a reason for hiding this comment

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

could you create question
on https://github.com/rticommunity/rmw_connextdds/issues?

I have opened a feature request on ros2/rmw_connextdds#11.

how about that?

Thanks for your understanding.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@iuhilnehc-ynos

how about we put this status topic enhancement as in T.B.D but we can improve feedback? we will leave the description as T.B.D or W.I.P in official PR? how does it sound?

Karsten1987 and others added 4 commits March 23, 2021 11:26
* make rcl_lifecycle_com_interface optional

Signed-off-by: Karsten Knese <[email protected]>

* only disable services, not transition event publisher

Signed-off-by: Karsten Knese <[email protected]>

* flag if com interface is enabled

Signed-off-by: Karsten Knese <[email protected]>

* use options struct

Signed-off-by: Karsten Knese <[email protected]>

* attach allocator to state machine struct

Signed-off-by: Karsten Knese <[email protected]>

* validate allocator before using in fini

Signed-off-by: Karsten Knese <[email protected]>

* set allocator in default options

Signed-off-by: Knese Karsten <[email protected]>

* Update rcl_lifecycle/include/rcl_lifecycle/rcl_lifecycle.h

Co-authored-by: Chris Lalancette <[email protected]>

* remove allocator check in fini

Signed-off-by: Karsten Knese <[email protected]>

Co-authored-by: Chris Lalancette <[email protected]>
Signed-off-by: Chris Lalancette <[email protected]>
@iuhilnehc-ynos iuhilnehc-ynos force-pushed the topic-content_filtered_topic-action branch from 0d6a26d to 34d0802 Compare March 24, 2021 05:54
@iuhilnehc-ynos
Copy link
Owner Author

Close it. (already pushed into official PR)

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.

7 participants