File size: 4,428 Bytes
2d6bfa0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
.. _docker:
Docker
######
The latest versions of docker-engine and docker-compose have to be installed
before getting started. Please have a look at `docker's official website <https://docs.docker.com/get-started/overview/>`_
for more insights into the working and usage of docker images and docker containers.
It is highly recommended that you use docker containers to build and run your
nodes rather than directly installing ROS and working with the MAS industrial software on your PC.
.. _using_mir_docker_images:
Using Our Images
================
Our docker images are available `here <https://github.com/orgs/b-it-bots/packages>`_.
The images provide a proper development environment -with ros pre-installed and without
any missing dependencies- for the MAS industrial software. Additionally, the images
also contain src packages which are prebuilt.
Directory structure in the image:
.. code-block:: bash
/home/robocup/<ros_distro>/catkin_ws
βββ build
βββ devel
βββ logs
βββ src
βββ mas_industrial_robotics
βββ mas_perception_msgs
βββ mas_navigation
βββ ...
Where `ros_distro` corresponds to the ros distribution i.e. `kinetic, melodic`.
The main github branch of the each ros distro should always reflect `latest`
tag in the github registry, for example `kinetic` branch reflects
`mas_industrial_robotics/industrial-kinetic:latest`, while the `devel` branch
always reflects `devel` tag, for example `kinetic` branch reflects `mas_industrial_robotics/industrial-kinetic:devel`
* **Start the container**
To start the container, `docker-compose <https://docs.docker.com/compose/install/>`_
is required, with which it is easier to define the environment and volumes from
the host PC to the container.
.. code-block:: bash
docker-compose -f start-container.yaml up industrial_<ros_distro>
If there is no local image, docker will automatically pull from MIR github
container registry.
The images can also be pulled manually without docker-compose.
.. code-block:: bash
#kinetic image
docker pull ghcr.io/b-it-bots/mas_industrial_robotics/industrial-kinetic:latest
#melodic image
docker pull ghcr.io/b-it-bots/mas_industrial_robotics/industrial-melodic:latest
* **Log in to the container**
.. code-block:: bash
docker exec -it mas_industrial_robotics_industrial_kinetic_1 /bin/bash
.. tip::
The container is set up to use `host` network, and therefore when you run
roscore or ros packages in either host or container, and both will have access
to ros communication infrastructure such as topics and services.
.. _mounting_volumes:
Mounting Local Volumes
======================
Since the codes in the image are not persistent, which means they will be
removed when the images are rebuilt, it is recommended to mount your local disk
containing the repository to the container.
To mount your local disk to the container, you need to modify `start-container.yaml`
under `mas_industrial_robotics` repository. The following example shows how you
can mount your `rviz` configuration and `mas_industrial_robotics` repository which
is mounted to `/home/robocup/<ros_distro>/catkin_ws/src/external` in the container.
.. code-block:: yaml
# under volume add your local disk
volumes:
- $HOME/.rviz:/home/robocup/.rviz
- $HOME/catkin_ws/mas_industrial_robotics:/home/robocup/<ros_distro>/catkin_ws/src/external/mas_industrial_robotics
Since there are now two `mas_industrial_robotics` repositories, you have to do
the followings to make the build successful:
* Remove or `CATKIN_IGNORE` the repository that comes with the image under `src/mas_industrial_robotics`.
* `catkin clean` to remove the prebuilt packages from the image
* Rebuild the package e.g. `catkin build mir_object_recognition`
Now, you can make changes locally in your PC using your favourite IDE, and build
the package inside the container.
.. note::
This was only tested with Linux.
.. _creating_own_image:
Creating Your Own Image
=======================
You can create your own image by using b-it-bots image as base:
.. code-block:: bash
FROM ghcr.io/b-it-bots/mas_industrial_robotics/industrial-melodic:latest
USER robocup
# add your modification e.g. install tensorflow
RUN pip install tensorflow
|