ROS2 topic echo Selected field
In ROS1, you could perform:
rostopic echo /mavros/state/armed for topic rostopic echo /mavros/state
In ROS2, I didn't succed to find how to do it.
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
In ROS1, you could perform:
rostopic echo /mavros/state/armed for topic rostopic echo /mavros/state
In ROS2, I didn't succed to find how to do it.
You can use the --field
flag of the ros2 topic echo
command. Here is an example:
ros2 topic echo /imu_test --field linear_acceleration
which will give the output
x: 0.0
y: 0.0
z: 0.0
---
You can go further into the field by putting periods after each subsection, so
ros2 topic echo /imu_test --field linear_acceleration.x
will give you
0.0
---
I do not know a ROS2 equivalent of the command you described . However a simple workaround to get a similar behavior could be to use grep
for this purpose. You can specify the number of lines that should be visible after your search key with the -A [num lines after match]
option. Just set it to the size of the data field of interest.
For example to view the linear acceleration of an sensor_msgs/msg/Imu one could write:
ros2 topic echo /imu_topic | grep -A 3 "linear"
linear:
x: 0.0
y: 0.0
z: 0.0
(...)
Asked: 2020-10-22 01:28:20 -0600
Seen: 9,837 times
Last updated: May 28 '22
Is there a release date of ros 2 or more informations about it?
Is the planned ROS1 to ROS2/DDS bridge available yet?
ROS2: content-based topic subscriptions?
Building Ros 2.0 without OpenCV?
ros2 rttest example build error
ROS 2 Alpha 2 ros1_bridge using DDS between two computers
Hi! Did you find how to do it without grep?