gazebosim / gz-transport

Transport library for component communication based on publication/subscription and service calls.
https://gazebosim.org
Apache License 2.0
29 stars 36 forks source link

Add -h option to gz topic command line #446

Open TheotimeBalaguer opened 9 months ago

TheotimeBalaguer commented 9 months ago

Desired behavior

There is no straight-forward way of getting the number of messages per second published on a gazebo transport topic. Basically, this is an extension of the gz topic command with a new option (I propose -h for consistency with gazebo-classic) that prints the number of received messages on a particular topic. The functioning would be very close to the ros2 topic hz <topic_name> command of the ROS middleware.

Alternatives considered

There could be an alternative using a mix of watch, grep, wc -l but that is not easily usable for everyone.

Implementation suggestion

Additional context

For reference, the output of a ros2 hz command : image

TheotimeBalaguer commented 9 months ago

For the curious out there, the VERY clumsy one-liner to have an (imprecise !) idea of the number of messages per second : watch -n 1 "( timeout 1s gz topic -e -t /model/px4vision_lidar_2/odometry | grep nsec || true ) | wc -l"

azeey commented 7 months ago

-h is already used for "help", so we should probably use a different flag.