Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Remove topic partitions#285

Merged
Karsten1987 merged 7 commits intomasterfrom
remove_topic_partitions
Jun 7, 2018
Merged

Remove topic partitions#285
Karsten1987 merged 7 commits intomasterfrom
remove_topic_partitions

Conversation

@rohitsalem
Copy link
Copy Markdown
Member

connects to ros2/ros2#476
To use the topic/service name directly without using the partitions.

@rohitsalem rohitsalem added the in progress Actively being worked on (Kanban column) label Apr 13, 2018
@rohitsalem rohitsalem force-pushed the remove_topic_partitions branch from f5e9b23 to ae38b7a Compare April 18, 2018 20:52
@rohitsalem rohitsalem added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Apr 18, 2018
@rohitsalem rohitsalem requested a review from Karsten1987 April 18, 2018 20:54
participant_qos.user_data.value[sizeof(prefix) - 1 + name_length] = ';';
}

// Setting the contentfilter_property_max_length to 1024
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you please modify the comment to describe why it's needed and how 1024 has been picked?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, I'm still investigating the exact number that should be used for the property, will update once I have a reasonable one.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

for reference: https://community.rti.com/static/documentation/connext-dds/5.3.1/doc/api/connext_dds/api_cpp/structDDS__DomainParticipantResourceLimitsQosPolicy.html#aef1ff851202f5777d31528a52d528e4f

From the RTPS spec:

ContentFilterProperty_t: Mapping of the type

typedef string<256> String256;
typedef sequence<string> StringSequence;
struct ContentFilterProperty_t {
  String256 contentFilteredTopicName;
  String256 relatedTopicName;
  String256 filterClassName;
  string filterExpression;
  StringSequence expressionParameters;
};

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@mikaelarguedas do you suggest putting the link in the code comment as well?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yes I think it makes sense to have the link in the comment as well

}

// Setting the contentfilter_property_max_length to 1024
participant_qos.resource_limits.contentfilter_property_max_length = 1024;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As it been confirm that we can still talk to native connext participants if we modify this default value ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Still investigating that to confirm along with the exact length for the property.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we place this back in progress then if you're still working on it ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I've checked native connext replier and requester, changed the contentfilter_property_max_length of requester to be 1024, replier to be 256 and vice-versa. The replier and requester worked as expected.

@rohitsalem rohitsalem added in progress Actively being worked on (Kanban column) in review Waiting for review (Kanban column) and removed in review Waiting for review (Kanban column) in progress Actively being worked on (Kanban column) labels Apr 18, 2018
@mikaelarguedas
Copy link
Copy Markdown
Member

As we found out that the service length has to be shorter with Connext. Can you post here what the error message is if we pass a service name within "ROS maximum length" but too long for Connext?
It may be worth add a check here to return a sensible error message in the case where it's too long

@rohitsalem
Copy link
Copy Markdown
Member Author

rohitsalem commented Apr 26, 2018

Here is the error message when I run ros2 run demo_nodes_cpp add_two_ints_client when the service_name is for example repeated character a but still within "ROS maximum length"

rsalem@warner:~/work/ros2_ws$ ros2 run demo_nodes_cpp add_two_ints_client
RTI Data Distribution Service Evaluation License issued to OSRF dthomas@osrfoundation.org For non-production use only.
Expires on 05-may-2018 See www.rti.com for more information.
CorrelationCFTBuilder::create_correlation_cft:ERROR: Bad parameter: topic name is too long: rr/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaReply
connext::details::EntityUntypedImpl::initialize:!failed (see previous errors)

>>> [rcutils|error_handling.c:155] rcutils_set_error_state()
This error state is being overwritten:

  'C++ exception during construction of Requester, at /home/rsalem/work/ros2_ws/build_isolated/example_interfaces/rosidl_typesupport_connext_cpp/example_interfaces/srv/dds_connext/add_two_ints__type_support.cpp:100'

with this new error message:

  'failed to create requester, at /home/rsalem/work/ros2_ws/src/ros2/rmw_connext/rmw_connext_cpp/src/rmw_client.cpp:141'

rcutils_reset_error() should be called after error handling to avoid this.
<<<
terminate called after throwing an instance of 'rclcpp::exceptions::RCLError'
  what():  could not create client: failed to create requester, at /home/rsalem/work/ros2_ws/src/ros2/rmw_connext/rmw_connext_cpp/src/rmw_client.cpp:141, at /home/rsalem/work/ros2_ws/src/ros2/rcl/rcl/src/rcl/client.c:174

@rohitsalem
Copy link
Copy Markdown
Member Author

regarding the check for the length of the service_name, I think It should be added in _process_service_name function, but still as of now what should the max limit for service_name in connext should be? When I checked the native connext Requester Replier example, the maximum service name that I was able to use was of 185 characters, If we have to impose a limit here I think it should be 185U - 8U (to account for the ros prefixes)

@mikaelarguedas
Copy link
Copy Markdown
Member

Actually as the service length is not checked properly at the moment for any rmw implementation (we check the length before adding Request or Reply to the topic names and don't account for it), let's keep that for another set of PRs to make sure these ones get reviewed / merged in a timely manner.

Can you open an issue on rmw to relocate the discussion there ?

Copy link
Copy Markdown
Member

@mikaelarguedas mikaelarguedas left a comment

Choose a reason for hiding this comment

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

lgtm, one question about adding the Request/Reply suffixes ourselves though

@@ -129,12 +127,16 @@ rmw_create_client(
// This has to be evaluated whether or not to provide a
// Subscriber/Publisher object directly with preset partitions.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: no preset partitions anymore

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@Karsten1987 this is a TODO, can it be removed or should it be modified?

// concat the ros_service_*_prefix and Request/Reply suffixes with the service_name
char * request_concat_str = rcutils_format_string(
allocator,
"%s%s%s", ros_service_requester_prefix, service_name, "Request");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hmmm Do we need to add Request and Reply ourselves now ? Isn't Connext adding them automatically when we call their service API ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, There are two ways connext allows us to do this:

  1. if we use set service_name, then connext does add the Request and Reply for us.
  2. If we use set the request_topic_name and reply_topic_name, connext just uses whatever we give to it. (although it adds the GUID to Reply topic) see: here
    Here we are not passing the service name but instead passing the request_topic_str and reply_topic_str directly

char * response_concat_str = rcutils_format_string(
allocator,
"%s%s%s", ros_service_response_prefix, service_name, "Reply");
if (!response_concat_str) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i think request_concat_str is leaked here. If it was previously allocated, but response_concat_str fails here, only the request string will be deallocated.

Copy link
Copy Markdown
Member Author

@rohitsalem rohitsalem May 3, 2018

Choose a reason for hiding this comment

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

@Karsten1987 I think I got the logic wrong. So should it be if the response_concat_str fails here, the request_concat_str for which memory was allocated previously is deallocated? I see that's what was there previously

}
*request_partition_str = DDS_String_dup(request_concat_str);
*response_partition_str = DDS_String_dup(response_concat_str);
if (!avoid_ros_namespace_conventions) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Consider to simply set the ros prefix to an empty string and run the same logic when concatenating the topic string. Because if I understand your code correctly, the only difference is whether you append the ros prefix or not, right?
This makes the logic for cleaning up the allocated strings simpler.

string _ros_prefix = ros_prefix;
if (avoid_ros_namespace_conventions) {
   _ros_prefix = "";
}

topic = (%s%s%s, _ros_prefix, topic_name, "[Request|Reply]"

@Karsten1987 Karsten1987 force-pushed the remove_topic_partitions branch from 58f06d4 to 89024a5 Compare May 14, 2018 18:44
@Karsten1987 Karsten1987 merged commit 26fee35 into master Jun 7, 2018
@Karsten1987 Karsten1987 deleted the remove_topic_partitions branch June 7, 2018 21:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants