You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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
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.
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?
@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?
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.
Activity
[-][ros2topic] enable ros2topic hz delay command[/-][+][ros2topic] enable ros2topic hz delay bw command[/+]dirk-thomas commentedon Aug 13, 2018
Great! Let use know if you have any questions.
yechun1 commentedon Oct 8, 2018
While porting bw command, did not find the api to get size of the subscribed msg. Could anyone help?
ROS use
AnyMsgandlen(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?josephduchesne commentedon Oct 8, 2018
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:
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.
josephduchesne commentedon Oct 8, 2018
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
LucidOne commentedon Oct 24, 2018
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 viaPublisher::get_bw()and used with a diagnostic aggregator implementation.josephduchesne commentedon Jan 10, 2019
ros2/rclpy#242 is now merged, so
ros2 topic bwshould be fairly straight forward to implement now.Something like
then in the callback,
len(msg)will be the serialized byte length required.dirk-thomas commentedon Jan 10, 2019
Actually subscribing to the messages to then calculate their length sounds highly inefficiency to me. I wouldn't recommend that
yechun1 commentedon Jan 11, 2019
len(msg)to get the length of subscribing message is very similar with what ROS1len(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?yechun1 commentedon Jan 11, 2019
thanks @josephduchesne .
Here is patch ready for review #190
LucidOne commentedon Jan 11, 2019
@yechun1 What are your thoughts on putting the bandwidth metrics in the publisher?
mjcarroll commentedon Jan 11, 2019
@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
rclpyorrclcpp, but potentially deeper). @dirk-thomas would you be in favor of working with the existing implementation inros2cliwith the understanding that it would be further enhanced down the road?dirk-thomas commentedon Jan 11, 2019
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.
LucidOne commentedon Jan 11, 2019
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.
yechun1 commentedon Apr 18, 2019
todo listall done, close this issue[ ros2 topic hz] (#133)
[ ros2 topic delay] (#139)
[ ros2 topic bw] (#190)
Fix linter errors from ros2#131. (ros2#132)