Skip to content

Message template autocompletion broken #742

@Flova

Description

@Flova

When publishing a topic via ros2 topic pub or calling a service via ros2 service call the tab completion for the fields of the message is broken. The completion for the topic and message type works fine. The issue seems to be different between zsh and bash.

In zsh:
The field of the message are all handled are possible cli parameters that can be autocompleted pressing tab iterates through the fields. Each of the fields has its escaped indentation in the beginning and is individually selectable. Creating a valid message is impossible even for small msgs.
Example:

🐋 /home/florian/Projekt/bitbots/colcon_ws  ros2 topic pub /camera_info sensor_msgs/msg/CameraInfo -\ 0.0\
-\ 0.0\                        \ \ do_rectify:\ false\        --keep-alive                   p:\                            --qos-reliability              \ \ stamp:\                    width:\ 0\                   
-1                             \ \ frame_id:\ \'\'\           -n                             --print                        -r                             -t                             \ \ x_offset:\ 0\            
binning_x:\ 0\                 header:\                       \ \ \ \ nanosec:\ 0\           --qos-depth                    r:\                            --times                        \ \ y_offset:\ 0\            
binning_y:\ 0\                 \ \ height:\ 0\                --node-name                    --qos-durability               --rate                         -w                                                          
d:\ []\                        height:\ 0\                    --once                         --qos-history                  roi:\                          --wait-matching-subscriptions                               
distortion_model:\ \'\'\       k:\                            -p                             --qos-profile                  \ \ \ \ sec:\ 0\               \ \ width:\ 0\                                              

In bash:
Bash looks overall better as the message template is printed as one piece, but contains many escape characters.
Example:

[florian@flovat colcon_ws]$ ros2 topic pub /camera_info sensor_msgs/msg/CameraInfo 
-1
header:\^J\ \ stamp:\^J\ \ \ \ sec:\ 0\^J\ \ \ \ nanosec:\ 0\^J\ \ frame_id:\ \'\'\^Jheight:\ 0\^Jwidth:\ 0\^Jdistortion_model:\ \'\'\^Jd:\ []\^Jk:\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^Jr:\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^Jp:\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^J-\ 0.0\^Jbinning_x:\ 0\^Jbinning_y:\ 0\^Jroi:\^J\ \ x_offset:\ 0\^J\ \ y_offset:\ 0\^J\ \ height:\ 0\^J\ \ width:\ 0\^J\ \ do_rectify:\ false\
--keep-alive
-n
--node-name
--once
-p
--print
--qos-depth
--qos-durability
--qos-history
--qos-profile
--qos-reliability
-r
--rate
-t
--times
-w
--wait-matching-subscriptions
[florian@flovat colcon_ws]$ ros2 topic pub /camera_info sensor_msgs/msg/CameraInfo

I observed this behavior on all ros2 machines I have used so far, making the cli unusable for publishing topics.

Bug report

Required Info:

  • Operating System:
    • Ubuntu 22.04 LTS
  • Installation type:
    • binaries
  • Version or commit hash:
    • 0.19.0-1jammy.20220711.162709
  • DDS implementation:
    • Cyclone & FastDDS

Steps to reproduce issue

  • source your terminal (zsh or bash)
  • type ros2 topic pub /camera_info sensor_msgs/msg/CameraInfo and press TAB

Expected behavior

A nicely formatted and editable string containing the message fields with their defaults should appear.

Actual behavior

Either the message is split and autocompleted in pieces (zsh) or cleaner (like in ros1) (bash)

Implementation considerations

I am not familiar with terminal formatting.

Metadata

Metadata

Labels

help wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions