Git Product home page Git Product logo

kmr-env's Introduction

KM Robotics development environment

Common images and other tools to standardize development environments used in KM Robotics product development.

Content

Tools and resources installed in the environment:

Docker images

Docker images are placed in GitHub Container Registry and associated with KM Robotics organization.

Those common environment images and the repository itself are PUBLIC.

In the future there should be images for each used ROS version, right now there is support for ROS Kinetic and ROS Noetic and ROS2 Humble.

Get the image

docker pull ghcr.io/km-robotics/env-humble:edge

Always do this before other work, to get newest version of the container image. You can also add --pull always argument to docker run commands to enforce updating of the Docker image before running.

Daily work

Suppose that you have your Colcon workspace in ~/robocon_ros2_monows.

To run single command inside the environment with mapped Colcon workspace and under the same user as in the host system:

docker run -ti --rm --net=host --cap-add=SYS_PTRACE --device=/dev/dri --env="DISPLAY" -v $HOME/.Xauthority:/$HOME/.Xauthority:rw -v /etc/passwd:/etc/passwd:ro -v /etc/shadow:/etc/shadow:ro -v /etc/group:/etc/group:ro --user $UID -v $HOME/robocon_ros2_monows:$HOME/robocon_ros2_monows -e APP_WS=$HOME/robocon_ros2_monows ghcr.io/km-robotics/env-humble:edge CMD

# add more volume mounts for extra stuff:
# -v $HOME/.config/mc:$HOME/.config/mc -v $HOME/.bashrc:$HOME/.bashrc -v $HOME/.profile:$HOME/.profile -v $HOME/.bash_history:$HOME/.bash_history -v $HOME/.git-credentials:$HOME/.git-credentials -v $HOME/.gitconfig:$HOME/.gitconfig -v $HOME/.config/robocon:$HOME/.config/robocon -v /var/run/docker.sock:/var/run/docker.sock:ro

To start an instance capable of running multiple commands:

docker run -d -ti --name=kmr1 --net=host --cap-add=SYS_PTRACE --device=/dev/dri --env="DISPLAY" -v $HOME/.Xauthority:/$HOME/.Xauthority:rw -v /etc/passwd:/etc/passwd:ro -v /etc/shadow:/etc/shadow:ro -v /etc/group:/etc/group:ro --user $UID -v $HOME/robocon_ros2_monows:$HOME/robocon_ros2_monows -e APP_WS=$HOME/robocon_ros2_monows ghcr.io/km-robotics/env-humble:edge bash

# in first terminal
docker exec -ti kmr1 bash -l
  . /source_app.sh
  ros2 launch ...

# in second terminal
docker exec -ti kmr1 bash -l
  . /source_app.sh
  rviz2

docker rm -f kmr1

To start an environment capable of running multiple commands in several terminals multiplexed by Byobu (command not specified, because byobu -l -2 is a default command for this image):

docker run -ti --rm --net=host --cap-add=SYS_PTRACE --device=/dev/dri --env="DISPLAY" -v $HOME/.Xauthority:/$HOME/.Xauthority:rw -v /etc/passwd:/etc/passwd:ro -v /etc/shadow:/etc/shadow:ro -v /etc/group:/etc/group:ro --user $UID -v $HOME/robocon_ros2_monows:$HOME/robocon_ros2_monows -e APP_WS=$HOME/robocon_ros2_monows ghcr.io/km-robotics/env-humble:edge

# open new terminal with F2 or Ctrl+A,C, switch terminals back and forth with F3 or Ctrl+A,P and F4 or Ctrl+A,N, close terminal with Ctrl+A,K; use Esc,number instead of Fnumber in applications such as Midnight Commander
ros2 launch ... # in 1st terminal
rviz2 # in 2nd terminal

# F6 to exit from the environment

Of course you can set an alias for those commands by using alias command. Persist those aliases in your .bashrc file. You can even create Bash functions to create "aliases" with arguments.

Webots

Webots simulator is installed inside the container in /opt/webots. You can run it from inside the container either directly (/opt/webots/webots) or by using ROS package ros-$ROS_DISTRO-webots-ros2.

Other useful tools

Singularity containers

For easier running of GUI tools and seamless binding with local (host) environment you can also use Singularity container system.

You can create Singularity image from the Docker image:

singularity build kmr-env-humble.simg docker://ghcr.io/km-robotics/env-humble:edge

Then you can launch something using this image, with your home directory automatically mapped into the container:

singularity shell kmr-env-humble.simg
  source ...setup.bash
  ros2 launch ... &
  rviz2
  /opt/webots/webots

Singularity maps user IDs and automatically maps current user's home directory into the container. The integration is more seamless that way.

โš ๏ธ Problem with Singularity (at least version 2.6.1) is that when you launch something inside the container's shell and then you exit the shell, the thing remains running. That's different from Docker behavior.

kmr-env's People

Contributors

galou avatar jmarsik avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

galou

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.