Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROS1 autocomplete for interactive container not working #760

Open
jmehami1 opened this issue Jun 26, 2024 · 4 comments
Open

ROS1 autocomplete for interactive container not working #760

jmehami1 opened this issue Jun 26, 2024 · 4 comments

Comments

@jmehami1
Copy link

Hi, I have been running ROS1 containers on two different computers with OSs Ubuntu 22.04 and Ubuntu 20.04 to avoid local installations. I start the containers interactively using the following command on both systems:
docker run -it --rm --network host osrf/ros:noetic-desktop-full

I'm assuming the script ros_entrypoint.sh sources the setup.bash file when container is started. I try to type and autocomplete ROS commands. For example, when I type "ros" and press TAB I find all the relevant ROS commands.

The issue appears when finding subcommands. For example, If I want to run the rosbag command and I want to see its subcommands, they do not appear when I press TAB and instead directories are shown as follows:
image

In order to fix this I have to source the setup.bash script as follows:
source /opt/ros/noetic/setup.bash
After sourcing the setup.bash script, I can now see the subcommands when autocompleting with TAB as follows:
image

Why do I have to source the setup.bash script after the ros_entrypoint.sh has already carried out the command.

The ros_entrypoint.sh is as follows:
image

@mikaelarguedas
Copy link
Contributor

Looks like some catkin environment hooks dont carry over to the new shell.

The environment does but it must work differently for the autocompletion stuff from rosbash 🤷

@jmehami1
Copy link
Author

I appreciate the fast response. I guess I will just keep sourcing setup.bash script each time I start up a ROS container. I'll set up a keybinding to automate it.

@ruffsl
Copy link
Member

ruffsl commented Jun 30, 2024

The setup is sources by the Dockerfile entrypoint, so that sets the ENV, but like @mikaelarguedas hypothesizes, perhaps something shell specific is not carrying over to the bash process you start via docker run that the entrypoint would then exec?

docker run -it --rm osrf/ros:noetic-desktop-full bash

Perhaps you could add the source setup to the bashrc of the desired user you want to start the container from? E.g.

docker run -it --rm --user root osrf/ros:noetic-desktop-full echo 'source /opt/ros/$ROS_DISTRO/setup.bash' >> ~/.bashrc && bash

@jmehami1
Copy link
Author

jmehami1 commented Jul 9, 2024

Hi,
Thanks for the recommendation. I have fixed the issue as follows:

docker run -it --rm --network host ros:noetic-ros-core bash -c "echo 'source /opt/ros/noetic/setup.bash' >> ~/.bashrc && source ~/.bashrc && bash"

Both rosbag and rostopic are autocompleting for subcommands. You will have to manually add the ros version (noetic) to the path, you can't use "$ROS_DISTRO" because it doesn't exist on your PC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants