Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 99

How to publish a ROS2 message in a Linux Terminal

$
0
0
In ROS1, when publishing a message in a terminal (such as in [this question](https://answers.ros.org/question/218818/how-to-publish-a-ros-msg-on-linux-terminal/)) when typing rostopic pub -r 10 /cmd_vel geometry_msgs/Twist and hitting TAB, there would come up a suggestion with a template of the message structure into which one can easily fill out the desired data. As far as I know, this doesn't workt in ROS2 (at least I couldn't figure out how). Furthermore, the format used in ROS does not always work for ROS2. Particularly, I couldn't figure out how to create a sequence of items (such as when having a message item of type `TrafficSignSet[]` where `TrafficSignSet` is another message type). For example, this worked in ROS: rostopic pub -l --once /topic my_msgs/TrafficSignSetList "header: seq: 0 stamp: secs: 0 nsecs: 0 frame_id: '' sign_set_list: - id: 0 lane_ordered_signs: - signs: - {sign_type: 1, numeric_value: 200} - signs: [] - signs: [] - signs: - {sign_type: 1, numeric_value: 50} ego_lane_index: 0 distance: 1000 valid: true - id: 1 lane_ordered_signs: - signs: - {sign_type: 1, numeric_value: 120} - signs: [] - signs: [] - signs: - {sign_type: 1, numeric_value: 50} ego_lane_index: 0 distance: 500 valid: true - id: 2 lane_ordered_signs: - signs: - {sign_type: 1, numeric_value: 100} - signs: [] - signs: [] - signs: - {sign_type: 1, numeric_value: 50} ego_lane_index: 0 distance: 0 valid: true - id: 3 lane_ordered_signs: - signs: - {sign_type: 1, numeric_value: 120} - signs: [] - signs: [] - signs: - {sign_type: 1, numeric_value: 50} ego_lane_index: 0 distance: -500 valid: true" But it yields an error in ROS2 (when called as `ros2 topic pub -1 /topic my_msgs/TrafficSignSetList "..."`): Failed to populate field 'sign_set_list': The 'sign_set_list' field must be a set or sequence and each value of type 'TrafficSignSet' So how do I have to format sequences in a message when publishing form treminal?

Viewing all articles
Browse latest Browse all 99

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>