Giter VIP home page Giter VIP logo

ros-docker's Introduction


KA-RaceIng
ROS-Docker

Comprehensive Docker Image for the development environment of the Autonomous System at KA-RaceIng.

PrerequisitesDocker UsageDocker Compose SetupRunning with VSCodeLicense

Prerequisites

Docker and Docker Compose

Docker is required to run the image in this repo. Installing Docker Compose is also highly recommended.

  • Ubuntu: follow these instructions
  • Arch Linux:
sudo pacman -S docker docker-compose
sudo systemctl enable docker
# after this reboot system or manually start the docker service via the following
sudo systemctl start docker

Docker Usage

The image can be pulled from Github Packages

docker pull ghcr.io/ka-raceing/ros-docker

It can then be run via docker run

docker run --name ka-raceing_ros -itd ghcr.io/ka-raceing/ros-docker

After that the container's bash shell can be accessed via

docker exec -it ka-raceing_ros bash

Also it is possible to perform actions like mounting external directories via docker run parameters it is recommended to use docker-compose for more advanced setups.

Docker Compose Setup

with mounted workspace

version: '3'

services:
  ros-docker:
    image: ghcr.io/ka-raceing/ros-docker
    network_mode: host
    volumes:
      # the workspace
      - <path_to_ws>:<desired_path_in_container>
    command: /bin/sh -c "while sleep 1000; do :; done"

including graphic support (e.g. for RViz)

version: '3'

services:
  ros-docker:
    image: ghcr.io/ka-raceing/ros-docker
    mem_limit: 4g #avoid bricking your device with a rviz memory overrun
    environment:
      - QT_X11_NO_MITSHM=1
      - DISPLAY=$DISPLAY
    devices:
      # this is a workaround, cause there isn't an option that works with different gpu manufacturers yet (https://github.com/docker/cli/issues/2063)
      - /dev/dri/card0:/dev/dri/card0 
    ulimits: # https://answers.ros.org/question/336963/rosout-high-memory-usage/
      nofile:
        soft: 1024
        hard: 524288 
    privileged: true #for graphics permissions
    network_mode: host
    volumes:
      # for GUI applications (e.g. RViz)
      - /tmp/.X11-unix:/tmp/.X11-unix:rw
      - ~/.Xauthority:/root/.Xauthority:ro
    command: /bin/sh -c "while sleep 1000; do :; done"

including external PCAN driver

version: '3'

services:
  ros-docker:
    image: ghcr.io/ka-raceing/ros-docker
    network_mode: host
    volumes:
      # pcan (host paths may be different)
      - /usr/include/libpcan.h:/usr/include/libpcan.h:ro
      - /usr/include/pcan.h:/usr/include/pcan.h:ro
      - /usr/include/libpcanfd.h:/usr/include/libpcanfd.h:ro
      - /usr/include/pcanfd.h:/usr/include/pcanfd.h:ro
      - /usr/lib/libpcan.so:/usr/lib/libpcan.so:ro
      - /usr/lib/libpcanbasic.so:/usr/lib/libpcanbasic.so:ro
      - /usr/lib/libpcanfd.so:/usr/lib/libpcanfd.so:ro
    command: /bin/sh -c "while sleep 1000; do :; done"

including external .bashrc file

version: '3'

services:
  ros-docker:
    image: ghcr.io/ka-raceing/ros-docker
    network_mode: host
    volumes:
      #bashrc
      - ~/.bashrc:/root/.bashrc:ro
    command: /bin/sh -c "while sleep 1000; do :; done"

everything together

version: '3'

services:
  ros-docker:
    image: ghcr.io/ka-raceing/ros-docker
    mem_limit: 4g #avoid bricking your device with a rviz memory overrun
    environment:
      - QT_X11_NO_MITSHM=1
      - DISPLAY=$DISPLAY
    devices:
      # this is a workaround, cause there isn't an option that works with different gpu manufacturers yet (https://github.com/docker/cli/issues/2063)
      - /dev/dri/card0:/dev/dri/card0 
    ulimits: # https://answers.ros.org/question/336963/rosout-high-memory-usage/
      nofile:
        soft: 1024
        hard: 524288 
    privileged: true #for graphics permissions
    network_mode: host
    volumes:
      # the workspace
      - <path_to_ws>:<desired_path_in_container>
      # pcan (host paths may be different)
      - /usr/include/libpcan.h:/usr/include/libpcan.h:ro
      - /usr/include/pcan.h:/usr/include/pcan.h:ro
      - /usr/include/libpcanfd.h:/usr/include/libpcanfd.h:ro
      - /usr/include/pcanfd.h:/usr/include/pcanfd.h:ro
      - /usr/lib/libpcan.so:/usr/lib/libpcan.so:ro
      - /usr/lib/libpcanbasic.so:/usr/lib/libpcanbasic.so:ro
      - /usr/lib/libpcanfd.so:/usr/lib/libpcanfd.so:ro
      # for GUI applications (e.g. RViz)
      - /tmp/.X11-unix:/tmp/.X11-unix:rw
      - ~/.Xauthority:/root/.Xauthority:ro
      #bashrc
      - ~/.bashrc:/root/.bashrc:ro

    command: /bin/sh -c "while sleep 1000; do :; done"

Running with VSCode

Using the Remote Development Plugin for VSCode enables you to create and work inside a Docker Container as if you were working on your own machine. An example for the required .devcontainer.json file would be

{
    "name": "ros-docker_container",
    "service": "ros-docker",
    "dockerComposeFile": "./docker-compose.yaml",
    "workspaceFolder": "<path_to_the_ws_folder_inside_the_container>",
    "shutdownAction": "stopCompose"
}

Any Extensions that should be pre-installed can be installed at this point. We would recommend installing the ROS and C++ Plugins

{
    "name": "ros-docker_container",
    "service": "ros-docker",
    "dockerComposeFile": "./docker-compose.yaml",
    "customizations": {
            "vscode": {
                "extensions": [
                    "ms-iot.vscode-ros",
                    "ms-vscode.cpptools-extension-pack"
                ]
            }
        },
    "workspaceFolder": "<path_to_the_ws_folder_inside_the_container>",
    "shutdownAction": "stopCompose"
}

License

GNU GPL v3

ros-docker's People

Contributors

ploedige avatar mabdn avatar

Stargazers

Henry Paegel avatar AKORA avatar  avatar

Watchers

Simon Schaefer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.