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

support ros2 topic pub yaml file input #925

Open
wants to merge 3 commits into
base: rolling
Choose a base branch
from

Conversation

fujitatomoya
Copy link
Collaborator

closes #919

Copy link
Collaborator Author

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

This enables the following command line option with ros2 topic pub.

Note that yaml files are saved with ros2 topic echo > xxx.yaml.

root@tomoyafujita:~/ros2_ws/colcon_ws# cat chatter.yaml
---
data: 'Hello ROS Users'
---
---
data: Hello ROS Developers
---
data: Hello ROS Developers
---
---
data: 'Hello ROS Users'

root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 topic pub /chatter std_msgs/msg/String --yaml-file chatter.yaml
publisher: beginning loop
publishing #1: std_msgs.msg.String(data='Hello ROS Users')

publishing #2: std_msgs.msg.String(data='Hello ROS Developers')

publishing #3: std_msgs.msg.String(data='Hello ROS Developers')

publishing #4: std_msgs.msg.String(data='Hello ROS Users')

root@tomoyafujita:~/ros2_ws/colcon_ws# cat tf2.yaml
transforms:
- header:
    stamp:
      sec: 1721935886
      nanosec: 528868866
    frame_id: foo
  child_frame_id: bar
  transform:
    translation:
      x: 1.0
      y: 2.0
      z: 3.0
    rotation:
      x: -0.4747921762038255
      y: -0.07596622270177095
      z: 0.24006245183344296
      w: 0.8433098728485138
---
transforms:
- header:
    stamp:
      sec: 1721935886
      nanosec: 528868866
    frame_id: foo
  child_frame_id: bar
  transform:
    translation:
      x: 1.0
      y: 2.0
      z: 3.0
    rotation:
      x: -0.4747921762038255
      y: -0.07596622270177095
      z: 0.24006245183344296
      w: 0.8433098728485138

root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 topic pub /tf_static tf2_msgs/msg/TFMessage --yaml-file tf2.yaml
publisher: beginning loop
publishing #1: tf2_msgs.msg.TFMessage(transforms=[geometry_msgs.msg.TransformStamped(header=std_msgs.msg.Header(stamp=builtin_interfaces.msg.Time(sec=1721935886, nanosec=528868866), frame_id='foo'), child_frame_id='bar', transform=geometry_msgs.msg.Transform(translation=geometry_msgs.msg.Vector3(x=1.0, y=2.0, z=3.0), rotation=geometry_msgs.msg.Quaternion(x=-0.4747921762038255, y=-0.07596622270177095, z=0.24006245183344296, w=0.8433098728485138)))])

publishing #2: tf2_msgs.msg.TFMessage(transforms=[geometry_msgs.msg.TransformStamped(header=std_msgs.msg.Header(stamp=builtin_interfaces.msg.Time(sec=1721935886, nanosec=528868866), frame_id='foo'), child_frame_id='bar', transform=geometry_msgs.msg.Transform(translation=geometry_msgs.msg.Vector3(x=1.0, y=2.0, z=3.0), rotation=geometry_msgs.msg.Quaternion(x=-0.4747921762038255, y=-0.07596622270177095, z=0.24006245183344296, w=0.8433098728485138)))])

@fujitatomoya
Copy link
Collaborator Author

@mjcarroll @clalancette @sloretz what do you think? this can be useful for test and development.

@fujitatomoya
Copy link
Collaborator Author

CC: @ahcorde if you have time, can you take a look?

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.

This is a simplification of a rosbag, not sure about this feature, let's see what other people thing about it

ros2topic/ros2topic/verb/pub.py Outdated Show resolved Hide resolved
ros2topic/ros2topic/verb/pub.py Outdated Show resolved Hide resolved
@fujitatomoya
Copy link
Collaborator Author

This is a simplification of a rosbag, not sure about this feature, let's see what other people thing about it

yeah that is true.

the difference what i think of is, probably much easier to use and modify the data contents that are saved as yaml via ros2 topic echo. we have a chat about this in triage meeting, #919 (comment) but yes lets get more feedback for this feature. see usage for #925 (review)

CC: @Ryanf55 @mjcarroll @clalancette

Signed-off-by: Tomoya Fujita <[email protected]>
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.

Allow ros2 topic echo output to be used in ros2 topic pub
3 participants