question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Message template autocompletion broken

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
clalancettecommented, Jul 29, 2022

So this isn’t ideal, but at least in bash if you start with a ", and then the first letter of the message, then autocompletion works as expected:

$ . /opt/ros/rolling/setup.bash 
$ ros2 topic pub /camera_info sensor_msgs/msg/CameraInfo "<TAB>
-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
$ ros2 topic pub /camera_info sensor_msgs/msg/CameraInfo "h<TAB>
$ ros2 topic pub /camera_info sensor_msgs/msg/CameraInfo "header:
  stamp:
    sec: 0
    nanosec: 0
  frame_id: ''
height: 0
width: 0
distortion_model: ''
d: []
k:
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
r:
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
p:
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
binning_x: 0
binning_y: 0
roi:
  x_offset: 0
  y_offset: 0
  height: 0
  width: 0
  do_rectify: false"

It would be fantastic to figure out how to do that by default, so we don’t need those beginning two letters.

0reactions
clalancettecommented, Jul 29, 2022

True. This even seems to work in Windows.

I’d be for adding a mode like this; I think it would be easier to use. I don’t necessarily think we should make it the default (it is not useful for scripting), but for manual interaction it would be pretty cool.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Autocompletion for message contents broken since foxy #563
Autocompletion for message contents broken since foxy #563 ... A complete template of the contents of the specified message appears:.
Read more >
Eclipse Template Proposals (aka auto completion) not working
1 Answer 1 ... Somehow the references to the JDK where broken, so no completions could be made! UPDATE: Solved by going to...
Read more >
[Solved]MonoDevelop template autocomplete not working
Hello, I'm using mono under OSx for C# scripts. I have strange problem with autocomplete code templates. For example if I want use...
Read more >
Visual Studio Auto Complete Not Working in Unity - YouTube
Unity By Example : 20+ Mini Projects (20+ Hours): https://www.udemy.com/unity-game-deve... 2. Build 5 Games in Unity & C# (21+ Hours) ...
Read more >
Outlook does not add recipients to the Auto-Complete cache
As you add recipients to a new email message, Microsoft Outlook does not ... is mentioned in the "Symptoms" section, the Auto-Complete cache...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found