Skip to content
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

Add configurable TF topics to view_frames #709

Merged
merged 1 commit into from
Oct 15, 2024

Conversation

Ryanf55
Copy link
Contributor

@Ryanf55 Ryanf55 commented Sep 14, 2024

Here's the python implementation of #708. It's a convenience over the following for those who don't understand remaps.

ros2 run tf2_tools view_frames --ros-args -r tf:=foo -r tf_static:=bar

help text

$ ros2 run tf2_tools view_frames -h
usage: view_frames [-h] [--wait-time WAIT_TIME] [-o OUTPUT] [--tf_topic TF_TOPIC] [--tf_static_topic TF_STATIC_TOPIC]

Create a diagram of the TF frames being broadcast over ROS

options:
  -h, --help            show this help message and exit
  --wait-time WAIT_TIME, -t WAIT_TIME
                        Listen to the /tf topic for this many seconds before rendering the frame tree
  -o OUTPUT, --output OUTPUT
                        Output filename
  --tf_topic TF_TOPIC   Topic for dynamic transforms
  --tf_static_topic TF_STATIC_TOPIC
                        Topic for static transforms

Run the node

$ ros2 run tf2_tools view_frames --tf_topic=/foo  --tf_static_topic=bar
[INFO] [1726288349.673591679] [view_frames]: Listening to tf data for 5.0 seconds...
[INFO] [1726288354.694076715] [view_frames]: Generating graph...
[INFO] [1726288354.694984295] [view_frames]: Result:tf2_msgs.srv.FrameGraph_Response(frame_yaml='[]')
[INFO] [1726288354.695316110] [view_frames]: Exporting graph in frames_2024-09-13_22.32.34.pdf file...

Get it's node info while running to prove the topics are different

$ ros2 node info /view_frames 
/view_frames
  Subscribers:
    /bar: tf2_msgs/msg/TFMessage
    /foo: tf2_msgs/msg/TFMessage
  Publishers:
    /parameter_events: rcl_interfaces/msg/ParameterEvent
    /rosout: rcl_interfaces/msg/Log
  Service Servers:
    /tf2_frames: tf2_msgs/srv/FrameGraph
    /view_frames/describe_parameters: rcl_interfaces/srv/DescribeParameters
    /view_frames/get_parameter_types: rcl_interfaces/srv/GetParameterTypes
    /view_frames/get_parameters: rcl_interfaces/srv/GetParameters
    /view_frames/list_parameters: rcl_interfaces/srv/ListParameters
    /view_frames/set_parameters: rcl_interfaces/srv/SetParameters
    /view_frames/set_parameters_atomically: rcl_interfaces/srv/SetParametersAtomically
  Service Clients:
    /tf2_frames: tf2_msgs/srv/FrameGraph
  Action Servers:

  Action Clients:

@@ -50,12 +51,19 @@ def main():
'--wait-time', '-t', type=float, default=5.0,
help='Listen to the /tf topic for this many seconds before rendering the frame tree')
parser.add_argument('-o', '--output', help='Output filename')
parser.add_argument('--tf_topic', help='Topic for dynamic transforms',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could also be tf_dynamic_topic. Open to either given the help text next to it says dynamic

@Ryanf55 Ryanf55 force-pushed the 708-expose-configurable-tf-topics branch from 27b84b6 to 45f3f30 Compare September 14, 2024 05:45
Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

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

do you mind to add some documentation here cli_tools.rst? Adding some notes about these new options ?

@fujitatomoya
Copy link

@Ryanf55 friendly ping, more information needed.

@ahcorde
Copy link
Contributor

ahcorde commented Oct 14, 2024

@Ryanf55 friendly ping

* Set defaults in transform lister and expose them as args to the
  TransformLister
* Add CLI args in view_frames to change /tf and /tf_static topics

Signed-off-by: Ryan Friedman <[email protected]>
@Ryanf55 Ryanf55 force-pushed the 708-expose-configurable-tf-topics branch from 45f3f30 to 4d30e24 Compare October 15, 2024 04:25
@Ryanf55
Copy link
Contributor Author

Ryanf55 commented Oct 15, 2024

do you mind to add some documentation here cli_tools.rst? Adding some notes about these new options ?

Done! Sorry for the delay.

@ahcorde
Copy link
Contributor

ahcorde commented Oct 15, 2024

Pulls: #709
Gist: https://gist.githubusercontent.com/ahcorde/197c9a03ab960f3f45525653ab8e9ecf/raw/0e039e4045cb19543984c0af18ddfe60a81d7c68/ros2.repos
BUILD args: --packages-above-and-dependencies tf2_ros tf2_ros_py tf2_tools --packages-above-and-dependencies tf2_ros tf2_ros_py tf2_tools
TEST args: --packages-above tf2_ros tf2_ros_py tf2_tools --packages-above tf2_ros tf2_ros_py tf2_tools
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/14703

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@ahcorde ahcorde merged commit 5911417 into ros2:rolling Oct 15, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants