Skip to content

Commit 5830e01

Browse files
authored
noetic docker setup (#4)
1 parent 194c9a1 commit 5830e01

File tree

11 files changed

+477
-0
lines changed

11 files changed

+477
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,5 @@ Thumbs.db
6868
*.mov
6969
*.wmv
7070

71+
# Local directories
72+
.etc/

catkin_workspace.vcs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
repositories:
2+
elevation_mapping:
3+
type: git
4+
url: https://github.com/leggedrobotics/elevation_mapping.git
5+
version: master
6+
gtsam_catkin:
7+
type: git
8+
url: https://github.com/leggedrobotics/gtsam_catkin.git
9+
version: main
10+
holistic_fusion:
11+
type: git
12+
url: [email protected]:leggedrobotics/holistic_fusion.git
13+
version: feature/docker
14+
kindr:
15+
type: git
16+
url: https://github.com/leggedrobotics/kindr.git
17+
version: master
18+
kindr_ros:
19+
type: git
20+
url: https://github.com/leggedrobotics/kindr_ros.git
21+
version: master
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
#=============================================================================
4+
# Copyright (C) 2025, Robotic Systems Lab, ETH Zurich
5+
# All rights reserved.
6+
# http://www.rsl.ethz.ch
7+
#
8+
# This software is distributed WITHOUT ANY WARRANTY; without even the
9+
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10+
# See the License for more information.
11+
#=============================================================================
12+
# Authors: Julian Nubert, [email protected]
13+
# Lorenzo Terenzi, [email protected]
14+
#=============================================================================
15+
16+
LATEST_CONTAINER_NAME=$(docker ps --latest --format "{{.Names}}")
17+
echo "Name of latest docker container is $LATEST_CONTAINER_NAME. Attaching to it..."
18+
docker exec -it $LATEST_CONTAINER_NAME /entrypoint.sh
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/bin/bash
2+
3+
#=============================================================================
4+
# Copyright (C) 2025, Robotic Systems Lab, ETH Zurich
5+
# All rights reserved.
6+
# http://www.rsl.ethz.ch
7+
#
8+
# This software is distributed WITHOUT ANY WARRANTY; without even the
9+
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10+
# See the License for more information.
11+
#=============================================================================
12+
# Authors: Julian Nubert, [email protected]
13+
# Lorenzo Terenzi, [email protected]
14+
#=============================================================================
15+
16+
# Exits if error occurs
17+
set -e
18+
19+
# Image name
20+
IMAGE="rslethz/holistic_fusion_ros1:latest"
21+
22+
# Entry point
23+
ENTRYPOINT="/entrypoint.sh"
24+
25+
# Graphical output
26+
XSOCK=/tmp/.X11-unix
27+
XAUTH=/tmp/.docker.xauth
28+
29+
# Create symlinks to user configs within the build context.
30+
mkdir -p .etc && cd .etc
31+
ln -sf /etc/passwd .
32+
ln -sf /etc/shadow .
33+
ln -sf /etc/group .
34+
cd ..
35+
36+
# Launch a container from the prebuilt image.
37+
echo -e "[run.sh]: \e[1;32mRunning docker image '$IMAGE' with entrypoint $ENTRYPOINT.\e[0m"
38+
echo "---------------------"
39+
RUN_COMMAND="docker run \
40+
$ARGS \
41+
-v /lib/modules:/lib/modules \
42+
--volume=$XSOCK:$XSOCK:rw \
43+
--volume=$XAUTH:$XAUTH:rw \
44+
--env="QT_X11_NO_MITSHM=1" \
45+
--env="XAUTHORITY=$XAUTH" \
46+
--env="DISPLAY=$DISPLAY" \
47+
--cap-add=ALL \
48+
--privileged \
49+
--net=host \
50+
-eHOST_USERNAME=$(whoami) \
51+
-v$HOME:$HOME \
52+
-v$(pwd)/.etc/shadow:/etc/shadow \
53+
-v$(pwd)/.etc/passwd:/etc/passwd \
54+
-v$(pwd)/.etc/group:/etc/group \
55+
-v/etc/localtime:/etc/localtime:ro \
56+
--entrypoint=$ENTRYPOINT
57+
--shm-size=2gb
58+
-it $IMAGE"
59+
60+
# Final command
61+
echo -e "[run.sh]: \e[1;32mThe final run command is\n\e[0;35m$RUN_COMMAND\e[0m."
62+
$RUN_COMMAND
63+
64+
# EOF

docker/ros1_noetic/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Docker Setup for Holistic Fusion
2+
3+
We provide docker images for running Holistic Fusion in a controlled environment.
4+
The ROS1 Image is based on Ubuntu 20.04 and includes the necessary dependencies for running Holistic Fusion.
5+
The ROS2 Image is based on Ubuntu 22.04 and will be released in the future.
6+
7+
## ROS1 Noetic Image
8+
9+
To build the ROS1 Noetic image, run the following command from the root of the repository:
10+
11+
```bash
12+
docker/bin/build_ros1_noetic_image.sh
13+
```

docker/ros1_noetic/base.Dockerfile

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#=============================================================================
2+
# Copyright (C) 2025, Robotic Systems Lab, ETH Zurich
3+
# All rights reserved.
4+
# http://www.rsl.ethz.ch
5+
#
6+
# This software is distributed WITHOUT ANY WARRANTY; without even the
7+
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
8+
# See the License for more information.
9+
#=============================================================================
10+
# Authors: Julian Nubert, [email protected]
11+
# Lorenzo Terenzi, [email protected]
12+
#=============================================================================
13+
14+
#==
15+
# Foundation
16+
#==
17+
ARG UBUNTU_VERSION=20.04
18+
FROM ubuntu:${UBUNTU_VERSION}
19+
20+
# Suppresses interactive calls to APT
21+
ENV DEBIAN_FRONTEND="noninteractive"
22+
23+
# Updates
24+
RUN apt update && apt upgrade -y
25+
26+
# ----------------------------------------------------------------------------
27+
28+
#==
29+
# System APT base dependencies and utilities
30+
#==
31+
32+
COPY submodules/base.sh /home/base.sh
33+
RUN chmod +x /home/base.sh
34+
RUN /home/base.sh && rm /home/base.sh
35+
36+
#==
37+
# ROS
38+
#==
39+
40+
# Version
41+
ARG ROS=noetic
42+
43+
COPY submodules/ros_1.sh /home/ros_1.sh
44+
RUN chmod +x /home/ros_1.sh
45+
RUN /home/ros_1.sh && rm /home/ros_1.sh
46+
47+
#==
48+
# GTSAM
49+
#==
50+
51+
COPY submodules/gtsam.sh /home/gtsam.sh
52+
RUN chmod +x /home/gtsam.sh
53+
RUN /home/gtsam.sh && rm /home/gtsam.sh
54+
55+
# ----------------------------------------------------------------------------
56+
57+
#==
58+
# Permissions
59+
#==
60+
RUN chmod ugo+rwx /software
61+
62+
#==
63+
# Environment
64+
#==
65+
COPY ros1_noetic/bashrc /etc/bash.bashrc
66+
RUN chmod a+rwx /etc/bash.bashrc
67+
68+
# ----------------------------------------------------------------------------
69+
70+
#==
71+
# Execution
72+
#==
73+
74+
COPY ros1_noetic/entrypoint.sh /entrypoint.sh
75+
RUN chmod +x /entrypoint.sh
76+
#ENTRYPOINT ["/entrypoint.sh"]
77+
CMD []
78+
79+
# EOF

docker/ros1_noetic/bashrc

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
#!/bin/bash
2+
3+
#=============================================================================
4+
# Copyright (C) 2025, Robotic Systems Lab, ETH Zurich
5+
# All rights reserved.
6+
# http://www.rsl.ethz.ch
7+
#
8+
# This software is distributed WITHOUT ANY WARRANTY; without even the
9+
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10+
# See the License for more information.
11+
#=============================================================================
12+
# Authors: Julian Nubert, [email protected]
13+
# Lorenzo Terenzi, [email protected]
14+
#=============================================================================
15+
16+
# If not running interactively, don't do anything
17+
case $- in
18+
*i*) ;;
19+
*) return;;
20+
esac
21+
22+
# don't put duplicate lines or lines starting with space in the history.
23+
HISTCONTROL=ignoreboth
24+
25+
# append to the history file, don't overwrite it
26+
shopt -s histappend
27+
28+
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
29+
HISTSIZE=1000
30+
HISTFILESIZE=2000
31+
32+
# check the window size after each command and, if necessary,
33+
# update the values of LINES and COLUMNS.
34+
shopt -s checkwinsize
35+
36+
# make less more friendly for non-text input files, see lesspipe(1)
37+
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
38+
39+
# set variable identifying the chroot you work in (used in the prompt below)
40+
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
41+
debian_chroot=$(cat /etc/debian_chroot)
42+
fi
43+
44+
# set a fancy prompt (non-color, unless we know we "want" color)
45+
case "$TERM" in
46+
xterm-color|*-256color) color_prompt=yes;;
47+
esac
48+
49+
# uncomment for a colored prompt, if the terminal has the capability; turned
50+
# off by default to not distract the user: the focus in a terminal window
51+
# should be on the output of commands, not on the prompt
52+
#force_color_prompt=yes
53+
54+
if [ -n "$force_color_prompt" ]; then
55+
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
56+
# We have color support; assume it's compliant with Ecma-48
57+
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
58+
# a case would tend to support setf rather than setaf.)
59+
color_prompt=yes
60+
else
61+
color_prompt=
62+
fi
63+
fi
64+
65+
if [ "$color_prompt" = yes ]; then
66+
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
67+
else
68+
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
69+
fi
70+
unset color_prompt force_color_prompt
71+
72+
# If this is an xterm set the title to user@host:dir
73+
case "$TERM" in
74+
xterm*|rxvt*)
75+
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
76+
;;
77+
*)
78+
;;
79+
esac
80+
81+
# enable color support of ls and also add handy aliases
82+
if [ -x /usr/bin/dircolors ]; then
83+
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
84+
alias ls='ls --color=auto'
85+
alias grep='grep --color=auto'
86+
alias fgrep='fgrep --color=auto'
87+
alias egrep='egrep --color=auto'
88+
fi
89+
90+
# some more ls aliases
91+
alias ll='ls -alF'
92+
alias la='ls -A'
93+
alias l='ls -CF'
94+
95+
# Add an "alert" alias for long running commands. Use like so:
96+
# sleep 10; alert
97+
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
98+
99+
# Alias definitions.
100+
if [ -f ~/.bash_aliases ]; then
101+
. ~/.bash_aliases
102+
fi
103+
104+
# enable programmable completion features (you don't need to enable
105+
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
106+
# sources /etc/bash.bashrc).
107+
if ! shopt -oq posix; then
108+
if [ -f /usr/share/bash-completion/bash_completion ]; then
109+
. /usr/share/bash-completion/bash_completion
110+
elif [ -f /etc/bash_completion ]; then
111+
. /etc/bash_completion
112+
fi
113+
fi
114+
115+
#==
116+
# Fuzzy search
117+
#==
118+
# Install fuzzy-search if missing
119+
if [[ ! -d ~/.fzf ]]
120+
then
121+
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && ~/.fzf/install
122+
fi
123+
124+
# Enable fuzzy search in terminal
125+
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
126+
127+
#==
128+
# Git
129+
#==
130+
parse_git_branch() {
131+
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
132+
}
133+
export PS1=$PS1"\[\e[91m\]\$(parse_git_branch)\[\e[00m\]$ "
134+
export PS1="(D) "$PS1
135+
136+
#==
137+
# ROS
138+
#==
139+
# Source the ROS distribution file to configure the shell environment.
140+
FILE=/opt/ros/noetic/setup.bash
141+
if test -f "$FILE";
142+
then
143+
echo "$FILE exists. Therefore sourcing noetic."
144+
source $FILE
145+
else
146+
echo "$FILE does not exist. Therefore not sourcing noetic."
147+
fi
148+
149+
# EOF

docker/ros1_noetic/entrypoint.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
#=============================================================================
4+
# Copyright (C) 2025, Robotic Systems Lab, ETH Zurich
5+
# All rights reserved.
6+
# http://www.rsl.ethz.ch
7+
#
8+
# This software is distributed WITHOUT ANY WARRANTY; without even the
9+
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10+
# See the License for more information.
11+
#=============================================================================
12+
# Authors: Vassilios Tsounis, [email protected]
13+
# Julian Nubert, [email protected]
14+
#=============================================================================
15+
figlet m545
16+
#==
17+
# Log into the container as the host user
18+
#==
19+
# set home for host user
20+
export HOME=/home/$HOST_USERNAME
21+
export USER=$HOST_USERNAME
22+
cd $HOME
23+
24+
# Enable sudo access without password
25+
echo "root ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
26+
echo "$HOST_USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
27+
28+
# Proceed as host user with superuser permissions
29+
sudo -E -u $HOST_USERNAME bash --rcfile /etc/bash.bashrc
30+
31+
# EOF

0 commit comments

Comments
 (0)