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

Ros2 with docker - dev setup

asked 2023-01-12 10:33:59 -0500

robin_rob96 gravatar image

Hi there, I'm new to ROS and seeking some advice for my dev setup.

  • M1 Mac
  • Ros2 Humble

So, I'm using docker to run ros on my mac. I dont want to rebuild the image after every little change, therefore I thought docker-compose would be good (for development). Also, I'm running a little container for getting the screen out (vnc).

Here is the current setup: https://github.com/RobinHeitz/ros2-do...

What works great: I can "work" (like create packages etc.) within the living container and see the changes within VSCode -> Great for development.

But: Seems like docker-compose exec ros bash is launching some new container or something like that, because I can't see a publishing message in another terminal tab (again, with docker-compose exec ros bash).

I know its not a clear question, but I want know if this setup could work and what I have to change to access the running container and see nodes/ topics from other terminal tabs.

If Its bad, then I might need a hint in the right direction. Thank you!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2023-01-18 03:56:38 -0500

kevsmac gravatar image

With docker you use the

docker exec -it <containername> bash

command to get access to the tty session within the container.

I created a video on how to setup ROS2 within a docker container, from scratch here:

https://www.youtube.com/watch?v=03wKo...

Hope this helps.

edit flag offensive delete link more

Comments

I don't get it - it does not work... I tried the following both, for a custom container and the official osrf/ros:humble-desktop-full image:

I start the container with docker -it run and start to publish on a topic or run a node.

In a second terminal window, i run docker exec -it <name/ ID> bash. I get into the running container (I guess, but there is not error). After sourcing opt/ros/ I can't see any node started before nor the topic I'm currently publishing to.

For me it seems like I'm in a different container (?) but with docker container list i see, that there is only 1 running...

What am I doing wrong? Hope you can help me :S

robin_rob96 gravatar image robin_rob96  ( 2023-01-27 13:04:05 -0500 )edit

I fixed the 'problem' finally.

So, I was using the image osrf/ros:humble-desktop-full which seems to be official, at least for me (watching the docker-hub page).

With the image ros:humble everything works as it should...

robin_rob96 gravatar image robin_rob96  ( 2023-01-28 04:01:00 -0500 )edit
1

answered 2023-01-12 12:17:52 -0500

ljaniec gravatar image

There are some tutorials and templates for working with ROS2 in the VS Code with Docker set up, I suggest you to check them out: https://www.allisonthackston.com/arti... and https://discourse.ros.org/t/ros2-vsco...

The part of your question with the option to see topics from other terminal tabs is interesting - I would also like to see an explanation how to do it.

Other sources I found:

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2023-01-12 10:33:59 -0500

Seen: 189 times

Last updated: Jan 18 '23