Feasibility of using Docker to isolate ROS and other tools in Robotics

asked 2018-11-13 14:55:19 -0500

skr_robo gravatar image

I am very new to Docker and I want to use it to isolate ROS (Melodic), OpenCV and Deep Learning libraries. I have Ubuntu 18.04 LTS running with CUDA, Eclipse, cmake and a few other basic tools installed. Ideally, I would like three isolated entities, one each for ROS, OpenCV and Deep Learning Libraries. These three isolated entities run on top of the image of existing Ubuntu platform. When I install a new package/ module related to ROS, I don't want it to cause any conflicts with a package used by OpenCV or Deep Learning Libraries. At the same time ROS should be able to use OpenCV or Deep Learning Libraries as well as the common resources in the Ubuntu platform. I have already read this, but it only deals with ROS, not the interaction between different software packages.

1) Is such a system possible using Docker?

2) Can anyone provide some guidance regarding a roadmap towards such an implementation?

edit retag flag offensive close merge delete


Something to consider: if a ROS node has a dependency on OpenCV, and they're not in the same image, how is the ROS node going to be linked against / use OpenCV?

gvdhoorn gravatar imagegvdhoorn ( 2018-11-14 00:04:52 -0500 )edit

@gvdhoom Based on the research I have done so far, I believe the three isolated entities I have mentioned in the question should be three different containers within same image. I think the networking and interfacing abilities of Docker would handle how ROS talks to OpenCV libraries.

skr_robo gravatar imageskr_robo ( 2018-11-14 08:02:05 -0500 )edit

Containers are runtime concepts. Images are static. Containers are created from images. If your image doesn't contain something, neither will a container created from that image (unless you add it in a session in the container of course, but that would add it to the container, not the image).

gvdhoorn gravatar imagegvdhoorn ( 2018-11-14 08:32:15 -0500 )edit

So saying that you'd like three "isolated entities" with "one each for ROS, OpenCV and Deep Learning Libraries" to me implies that you'll have 3 images. They are only isolated if they don't derive from each other, in which case anything in image A cannot use anything from image B. This makes ..

gvdhoorn gravatar imagegvdhoorn ( 2018-11-14 08:34:42 -0500 )edit

.. linking/using OpenCV with ROS rather difficult.

When I install a new package/ module related to ROS, I don't want it to cause any conflicts with a package used by OpenCV or Deep Learning Libraries.

This further suggests that the images should not share anything.

gvdhoorn gravatar imagegvdhoorn ( 2018-11-14 08:35:10 -0500 )edit

But cannot it not be designed in such a way that ROS and OpenCV have their own separate container? Something similar to Multi Container Environment mentioned here.

skr_robo gravatar imageskr_robo ( 2018-11-14 08:42:09 -0500 )edit

Think of it this way: take 2 computers. Install ROS on the first, and OpenCV on the second. You want to keep everything isolated ("don't want [..] any conflicts"), so no copying of files. How is ROS are ROS nodes going to use OpenCV if it doesn't have access to the libraries?

gvdhoorn gravatar imagegvdhoorn ( 2018-11-14 08:43:48 -0500 )edit

Multi-container setups are certainly nice and can have their benefits, but they are not magical. If your ROS node needs an OpenCV library, it's going to have to have access to that library, one way or the other. If all your images are indeed "isolated", that cannot happen.

gvdhoorn gravatar imagegvdhoorn ( 2018-11-14 08:47:49 -0500 )edit