ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I feel your pain. It's not well-documented IMO.

Sending Action goal with simpler goal definition is documented in the tutorial (docs.ros.org/humble):

ros2 action send_goal /turtle1/rotate_absolute turtlesim/action/RotateAbsolute "{theta: 1.57}"

So following that, you just have to construct the dictionary for the goal definition you want to send. In my case I referred to ros2cli#59, which shows an example of ros2 topic instead of ros2 action, but I think (/hope) the syntax both CLI commands use is the same.

ros2 topic pub /chatter test_msgs/DynamicArrayNested "{primitive_values: [{string_value: 'foo', int8_value: 42}]}"

I feel your pain. It's not well-documented IMO.

Sending Action goal with simpler goal definition is documented in the tutorial (docs.ros.org/humble):

ros2 action send_goal /turtle1/rotate_absolute turtlesim/action/RotateAbsolute "{theta: 1.57}"

So following that, For complexed interface definition, you just have to construct the a dictionary for the goal definition you want to send. In my case I referred to ros2cli#59, which shows an example of ros2 topic instead of ros2 action, but I think (/hope) the syntax both CLI commands use is the same.

ros2 topic pub /chatter test_msgs/DynamicArrayNested "{primitive_values: [{string_value: 'foo', int8_value: 42}]}"

I feel your pain. It's not well-documented IMO.

Sending Action goal with simpler goal definition is documented in the tutorial (docs.ros.org/humble):

ros2 action send_goal /turtle1/rotate_absolute turtlesim/action/RotateAbsolute "{theta: 1.57}"

For complexed interface definition, you just have to construct a dictionary for the goal definition you want to send. In my case I referred to ros2cli#59, which shows an example of ros2 topic instead of ros2 action, but I think (/hope) the syntax both CLI commands use is the same.

ros2 topic pub /chatter test_msgs/DynamicArrayNested "{primitive_values: [{string_value: 'foo', int8_value: 42}]}"

Update: In response to

doesn't auto-complete help here?

I do find it helpful, for simpler structure Interface. E.g. in this topic pub verb case, it shows not just the value syntax but also shows options in addition.

# ros2 topic pub /linear_rail_controller/follow_joint_trajectory geometry_msgs/msg/Point <%double-tab here%>
--keep-alive                  --print                       --qos-history                 --rate                        -n                            -t
--node-name                   --qos-depth                   --qos-profile                 --times                       -p                            x:\ 0.0\^Jy:\ 0.0\^Jz:\ 0.0\
--once                        --qos-durability              --qos-reliability             -1                            -r

For a complexed definition, however, I found it way too difficult IMO. E.g. control_msgs/action/FollowJointTrajectory (3.0.0), double-tabbing on CLI output looks like this, which is waaay too convoluted to comprehend IMO (though this may not be the best example as it entails Header, which might typically be supposed to be auto-filled):

# ros2 action send_goal /node_nodonodo/follow_joint_trajectory control_msgs/action/FollowJointTrajectory 
--feedback
-f
trajectory:\^J\ \ header:\^J\ \ \ \ stamp:\^J\ \ \ \ \ \ sec:\ 0\^J\ \ \ \ \ \ nanosec:\ 0\^J\ \ \ \ frame_id:\ \'\'\^J\ \ joint_names:\ []\^J\ \ points:\ []\^Jmulti_dof_trajectory:\^J\ \ header:\^J\ \ \ \ stamp:\^J\ \ \ \ \ \ sec:\ 0\^J\ \ \ \ \ \ nanosec:\ 0\^J\ \ \ \ frame_id:\ \'\'\^J\ \ joint_names:\ []\^J\ \ points:\ []\^Jpath_tolerance:\ []\^Jcomponent_path_tolerance:\ []\^Jgoal_tolerance:\ []\^Jcomponent_goal_tolerance:\ []\^Jgoal_time_tolerance:\^J\ \ sec:\ 0\^J\ \ nanosec:\ 0\