-
Notifications
You must be signed in to change notification settings - Fork 0
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
export internal subscriptions of feedback and status #3
Conversation
Signed-off-by: Andrea Sorbini <[email protected]>
Could you help me review this? |
* Attribute | Adherence | ||
* ------------------ | ------------- | ||
* Allocates Memory | No | ||
* Thread-Safe | No |
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.
If only get pointer, is it thread-safe ?
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 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.
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.
My mistake. It's not thread-safe.
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, 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.
LGTM |
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.
probably unit test will be required as well.
* Attribute | Adherence | ||
* ------------------ | ------------- | ||
* Allocates Memory | No | ||
* Thread-Safe | No |
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, 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. |
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 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 |
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.
* \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. |
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 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 |
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.
* \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) |
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.
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( |
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.
RCL_RET_FROM_RCUTIL_RET
should be used?
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.
I thought that before, but the macro(RCL_RET_FROM_RCUTIL_RET) definition is at https://github.com/ros2/rcl/blob/0ad11506e4a2e7db0925df48e113f66f16db0651/rcl/src/rcl/logging_rosout.c#L46
. OK, I'll move this macro into https://github.com/ros2/rcl/blob/0ad11506e4a2e7db0925df48e113f66f16db0651/rcl/include/rcl/macros.h
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.
yeah, i do not have strong preference here, so either way you go, i am good to go with it.
#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] |
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.
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) { |
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.
Does this even work for multiple action clients request the goal?
- client-A requests goal-1-A.
- client-B requests goal-2-B.
- client-A requests goal-3-A.
- 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?
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.
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
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.
After reconsideration, yes, it has the issues there. I'll find a way to support this wildcard filtering expression for array.
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.
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.
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.
as far as i can see from https://community.rti.com/static/documentation/connext-dds/5.2.3/doc/manuals/connext_dds/html_files/RTI_ConnextDDS_CoreLibraries_UsersManual/Content/UsersManual/SQL_Filter_Expression_Notation.htm#topics_3596570972_161086, it does not seem to support the wildcard for array nor sequence.
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 seems there only exist two ways:
- 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.)
- 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?
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.
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?
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.
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.
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.
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?
* 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]>
Signed-off-by: Chen Lihui <[email protected]>
0d6a26d
to
34d0802
Compare
Close it. (already pushed into official PR) |
For internal review.
Signed-off-by: Chen Lihui [email protected]