Skip to content

[ros2topic] enable ros2topic hz delay bw command #132

Closed

Description

@yechun1

Reference to discussing "rostopic command for ROS2"

ROS topic commands are very useful for simple performance tests such as hz/delay/bw, but those tools are not supported in ros2 topic right now, if there is no body work on there. I would like to contribute to port ROS topic(hz/delay/bw) to ROS2.

Todo list:

Activity

  1. changed the title [-][ros2topic] enable ros2topic hz delay command[/-] [+][ros2topic] enable ros2topic hz delay bw command[/+] on Aug 13, 2018
  2. added
    in progress
    on Aug 13, 2018
  3. dirk-thomas commented on Aug 13, 2018

    @dirk-thomas
    Member

    Great! Let use know if you have any questions.

  4. added
    in review
    and removed
    in progress
    on Aug 23, 2018
  5. yechun1 commented on Oct 8, 2018

    @yechun1
    ContributorAuthor

    While porting bw command, did not find the api to get size of the subscribed msg. Could anyone help?

    ROS use AnyMsg and len(data._buff) to get the size (line to https://github.com/ros/ros_comm/blob/melodic-devel/tools/rostopic/src/rostopic/__init__.py#L440). But how to replace on ROS2?

  6. josephduchesne commented on Oct 8, 2018

    @josephduchesne

    I'm not sure if there is a canonical size of a ros message any more, especially exposed in python.

    Rclpy now hands serialization off to the cpp rcl then rmw layer from what I can tell.

    ros2/demos#185 and the other PRs linked therin add rmw+rcl+rclcpp support for returning the raw serialized message in a raw type callback, but I don't think this is exposed in rclpy (yet?).

    I wonder which would be easier or better:

    • Port bw to C++ and using the existing raw function (Can ros2cli verbs be written in C++?)
    • Write a purpose built C++ glue function to get just this data and invoke it from the python side
    • Add raw=False keyword arg to rclpy Node.create_subscription and all the way down to support returning a byte list subscription in python.

    I may take a crack at the last option there and if it turns out to be reasonable, I'll submit a PR and link it here, otherwise I'll try to explain what trouble I ran into here.

  7. josephduchesne commented on Oct 8, 2018

    @josephduchesne

    I've created PR ros2/rclpy#242 that needs review for design, and some touching up to work towards providing a rclpy implementation of raw message subscriptions like rclcpp has thanks to ros2/demos#185

  8. LucidOne commented on Oct 24, 2018

    @LucidOne

    One complementary approach I have been thinking about is updating the metrics/counters in Publisher::publish() since the data is there already. It could be accessed via Publisher::get_bw() and used with a diagnostic aggregator implementation.

  9. added
    in progress
    and removed
    in review
    on Nov 6, 2018
  10. josephduchesne commented on Jan 10, 2019

    @josephduchesne

    ros2/rclpy#242 is now merged, so ros2 topic bw should be fairly straight forward to implement now.

    Something like

    subscription = self.create_subscription(..., raw=True)
    

    then in the callback, len(msg) will be the serialized byte length required.

  11. dirk-thomas commented on Jan 10, 2019

    @dirk-thomas
    Member

    Actually subscribing to the messages to then calculate their length sounds highly inefficiency to me. I wouldn't recommend that

  12. yechun1 commented on Jan 11, 2019

    @yechun1
    ContributorAuthor

    len(msg) to get the length of subscribing message is very similar with what ROS1 len(msg._buff) does. It might be inefficiency, but at least, could make ros2topic bw work. Could we first enable ros2topic bw feature and later improve if we found the better APIs?

  13. yechun1 commented on Jan 11, 2019

    @yechun1
    ContributorAuthor

    thanks @josephduchesne .
    Here is patch ready for review #190

  14. LucidOne commented on Jan 11, 2019

    @LucidOne

    @yechun1 What are your thoughts on putting the bandwidth metrics in the publisher?

  15. mjcarroll commented on Jan 11, 2019

    @mjcarroll
    Member

    @LucidOne I would be inclined to believe that would be the most efficient approach, but would certainly imply changes deeper in the stack (at least rclpy or rclcpp, but potentially deeper). @dirk-thomas would you be in favor of working with the existing implementation in ros2cli with the understanding that it would be further enhanced down the road?

  16. dirk-thomas commented on Jan 11, 2019

    @dirk-thomas
    Member

    The current approach of the PR is ok to be merged. If anyone would continue the effort to make it more efficient afterwards that would be good though.

  17. LucidOne commented on Jan 11, 2019

    @LucidOne

    I'm more or less 👍 for merging #190 and improving things later.

    In addition to debugging, I think there is also a programmatic need for bandwidth utilization information, especially in multi-robot systems. Does it make sense to add a publisher here, or in a separate node/API? If it is a separate node, should the bandwidth calculation be pushed into a module? An API may be be more efficient for the diagnostic aggregator to monitor topics exceeding bandwidth limits.

  18. yechun1 commented on Apr 18, 2019

    @yechun1
    ContributorAuthor

    todo list all done, close this issue
    [ ros2 topic hz] (#133)
    [ ros2 topic delay] (#139)
    [ ros2 topic bw] (#190)

  19. removed
    in progress
    on Apr 18, 2019
  20. added a commit that references this issue on Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions