-
Notifications
You must be signed in to change notification settings - Fork 119
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
Implement functions to get publisher and subcription informations like QoS policies from topic name #336
Implement functions to get publisher and subcription informations like QoS policies from topic name #336
Conversation
Signed-off-by: Jaison Titus <jaisontj92@gmail.com>
topic_cache.hpp Signed-off-by: Jaison Titus <jaisontj92@gmail.com>
- Modified call to topic_cache.addTopic at custom_participant_info.hpp - Wrote tests for topic_cache Signed-off-by: Jaison Titus <jaisontj92@gmail.com>
rmw_get_subscriptions_info_by_topic Signed-off-by: Jaison Titus <jaisontj92@gmail.com>
rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/qos_converter.hpp
Outdated
Show resolved
Hide resolved
rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/qos_converter.hpp
Outdated
Show resolved
Hide resolved
rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/topic_cache.hpp
Outdated
Show resolved
Hide resolved
rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/custom_participant_info.hpp
Outdated
Show resolved
Hide resolved
58c1fe8
to
f029dac
Compare
176cff3
to
17f0695
Compare
rmw_get_subscriptions_info_by_topic Signed-off-by: Jaison Titus <jaisontj92@gmail.com>
17f0695
to
e640479
Compare
Signed-off-by: Jaison Titus <jaisontj92@gmail.com>
rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/topic_cache.hpp
Outdated
Show resolved
Hide resolved
- changed to using instead of typedef Signed-off-by: Jaison Titus <jaisontj92@gmail.com>
Signed-off-by: Jaison Titus <jaisontj92@gmail.com>
rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/topic_cache.hpp
Outdated
Show resolved
Hide resolved
rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/topic_cache.hpp
Outdated
Show resolved
Hide resolved
rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/topic_cache.hpp
Outdated
Show resolved
Hide resolved
topic_fqdns.push_back(topic_name); | ||
// if mangle | ||
if (!no_mangle) { | ||
auto ros_prefixes = _get_all_ros_prefixes(); |
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 know this is imitating the rmw_count
implementation, but trying with all prefixes is wrong.
I will continue the discussion in a follow up issue.
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.
Let's not forget this point.
- Refactor to accomodate change in rmw_topic_info_array* functions. Signed-off-by: Jaison Titus <jaisontj92@gmail.com>
Signed-off-by: Miaofei <miaofei@amazon.com>
be2cf37
to
169f218
Compare
rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/topic_cache.hpp
Outdated
Show resolved
Hide resolved
rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/topic_cache.hpp
Outdated
Show resolved
Hide resolved
return ret; | ||
} | ||
for (auto i = 0u; i < count; i++) { | ||
participants_info->info_array[i] = topic_info_vector.at(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.
@jaisontj do we need an std::vector
if we'll eventually just copy it into a primitive 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.
It doesn't look trivial to determine what size of a primitive array would need be initially allocated.
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.
That's because of how the loop is written. If iterators that refer to matching topic data were collected first, then it'd be straightforward. This somewhat connects to @ivanpauno 's previous comment here. I can understand why it was done this way initially but the overhead is not necessary. I'm fine with deferring though.
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'm also ok with deferring, but I would really like to see it cleaned up at some point. My experience has been that clean up things like this tend to get overlooked though.
Signed-off-by: Miaofei <miaofei@amazon.com>
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.
One last observation is that this patch abuses auto
a bit. It's a great feature to deal with iterator types and such, but if used even in lieu of int
types it obscures code.
rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/topic_cache.hpp
Outdated
Show resolved
Hide resolved
return ret; | ||
} | ||
for (auto i = 0u; i < count; i++) { | ||
participants_info->info_array[i] = topic_info_vector.at(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.
That's because of how the loop is written. If iterators that refer to matching topic data were collected first, then it'd be straightforward. This somewhat connects to @ivanpauno 's previous comment here. I can understand why it was done this way initially but the overhead is not necessary. I'm fine with deferring though.
Signed-off-by: Miaofei <miaofei@amazon.com>
Signed-off-by: Miaofei <miaofei@amazon.com>
Signed-off-by: Miaofei <miaofei@amazon.com>
8a72fc0
to
38dec2a
Compare
Signed-off-by: Miaofei <miaofei@amazon.com>
4f4959a
to
c231f14
Compare
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.
lgtm, with some comments
rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/topic_cache.hpp
Outdated
Show resolved
Hide resolved
topic_fqdns.push_back(topic_name); | ||
// if mangle | ||
if (!no_mangle) { | ||
auto ros_prefixes = _get_all_ros_prefixes(); |
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.
Let's not forget this point.
return ret; | ||
} | ||
for (auto i = 0u; i < count; i++) { | ||
participants_info->info_array[i] = topic_info_vector.at(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.
I'm also ok with deferring, but I would really like to see it cleaned up at some point. My experience has been that clean up things like this tend to get overlooked though.
Signed-off-by: Miaofei <miaofei@amazon.com>
Signed-off-by: Miaofei <miaofei@amazon.com>
Signed-off-by: Miaofei <miaofei@amazon.com>
NOTE: DO NOT MERGE until rmw #186 and rmw_implementation #72 are merged.
This PR makes the necessary changes to implement this feature request. Relevant design discussions can be found here.
The changes can be summarized as follows:
TopicCache
class (topic_cache.hpp
) from holding a map oftopic_name
to a vector oftopic_types
to a map oftopic_name
to a vector of tuples (GUID_t
,topic_type
andqos_profile
). TheaddTopic
function was also modified to accept the QoS profile as an additional parameter.TopicCache
qos_converter.hpp
was moved from being a package-private header to being public as this needed to be accessed bytopic_cache.hpp
.rmw_get_publishers_info_by_topic
andrmw_get_subscriptions_info_by_topic
insidermw_fastrtps_cpp
,rmw_fastrtps_dynamic_cpp
andrmw_fastrtps_shared_cpp
. These functions are defined in thermw
(PR) andrmw_implementation
(PR) packages.Related to issues in aws-roadmap #84 and #83
Closing #333 and #332 in favor of this PR.