Skip to content

Commit 5f059a1

Browse files
committed
first build with ignition
1 parent 8c7b6e8 commit 5f059a1

8 files changed

+196
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/build
2+
/install
3+
/log

.gitmodules

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "src/mulinex_gazebo"]
2+
path = src/mulinex_gazebo
3+
url = https://github.com/CentroEPiaggio/mulinex_gazebo.git
4+
[submodule "src/mulinex_description"]
5+
path = src/mulinex_description
6+
url = https://github.com/CentroEPiaggio/mulinex_description.git

Dockerfile

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
2+
# base image osrf/ros tag humble-desktop-full
3+
ARG BASE_IMAGE=osrf/ros
4+
ARG BASE_TAG=humble-desktop-full
5+
FROM ${BASE_IMAGE}:${BASE_TAG}
6+
7+
# set the environment variable with the command ENV <key>=<value>, it can be replaced online
8+
ENV DEBIAN_FRONTEND=noninteractive
9+
10+
# RUN is used to execute and add new layer on top of the base immage
11+
12+
RUN apt-get update \
13+
&& apt-get install -y \
14+
ros-humble-gazebo-ros-pkgs \
15+
ros-humble-gazebo-ros2-control \
16+
ros-humble-joint-state-publisher \
17+
ros-humble-joint-state-publisher-gui \
18+
ros-humble-ros-ign-bridge \
19+
ros-humble-ign-ros2-control \
20+
ros-humble-ign-ros2-control-demos \
21+
ros-humble-teleop-twist-joy \
22+
ros-humble-joy \
23+
ros-humble-pinocchio \
24+
ros-humble-ros2-control \
25+
ros-humble-ros2-controllers \
26+
ros-humble-xacro \
27+
ros-humble-rosbag2-storage-mcap \
28+
ros-humble-plotjuggler-ros \
29+
chrony \
30+
tmux python3-pip\
31+
xterm \
32+
libeigen3-dev \
33+
nano \
34+
ros-humble-rviz2 \
35+
nautilus \
36+
iputils-ping \
37+
iproute2 \
38+
python3-rosdep \
39+
&& apt-get clean
40+
# install
41+
# Adapt your desired python version here
42+
# ENV PATH=/opt/openrobots/bin:$PATH
43+
# ENV PKG_CONFIG_PATH=/opt/openrobots/lib/pkgconfig:$PKG_CONFIG_PATH
44+
# ENV LD_LIBRARY_PATH=/opt/openrobots/lib:$LD_LIBRARY_PATH
45+
# ENV PYTHONPATH=/opt/openrobots/lib/python3.10/site-packages:$PYTHONPATH
46+
# ENV CMAKE_PREFIX_PATH=/opt/openrobots:$CMAKE_PREFIX_PATH
47+
# ENV TERM=xterm-256color
48+
49+
ENV DEBIAN_FRONTEND=dialog
50+
51+
# Create a new user
52+
ARG USERNAME=ros
53+
ARG USER_UID=1000
54+
ARG USER_GID=${USER_UID}
55+
RUN groupadd --gid ${USER_GID} ${USERNAME} \
56+
&& useradd --uid ${USER_UID} --gid ${USER_GID} -m ${USERNAME} \
57+
&& apt-get update \
58+
&& apt-get install -y sudo \
59+
&& echo ${USERNAME} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} \
60+
&& chmod 0440 /etc/sudoers.d/${USERNAME}
61+
62+
#Change HOME environment variable
63+
ENV HOME /home/${USERNAME}
64+
65+
# Choose to run as user
66+
ENV USER ${USERNAME}
67+
68+
USER ${USERNAME}
69+
70+
# ********************************************************
71+
# * Anything else you want to do like clean up goes here *
72+
# ********************************************************
73+
74+
# Install the python packages cosi non vengono installati da root
75+
RUN pip3 install \
76+
numpy \
77+
numpy-quaternion \
78+
quadprog \
79+
scipy \
80+
--upgrade
81+
# Set up auto-source of workspace for ros user
82+
ARG WORKSPACE=docker_navigation
83+
84+
RUN echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
85+
RUN echo 'source /usr/share/gazebo/setup.bash' >> ~/.bashrc
86+
RUN echo "if [ -f ~/${WORKSPACE}/install/setup.bash ]; then source ~/${WORKSPACE}/install/setup.bash; fi" >> /home/ros/.bashrc
87+
88+
ENTRYPOINT ["/ros_entrypoint.sh"]

build.bash

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
3+
# ================================= Edit Here ================================ #
4+
5+
# Change these values to use different versions of ROS or different base images. The rest of the script should be left unchanged.
6+
BASE_IMAGE=osrf/ros
7+
BASE_TAG=humble-desktop-full
8+
IMAGE_NAME=docker_control_simulation
9+
IMAGE_TAG=0.1
10+
USERNAME=ros
11+
USER_UID="$(id -u $USER)"
12+
USER_GID="$(id -g $USER)"
13+
WORKSPACE=docker_simulation_ws
14+
15+
# =============================== Help Function ============================== #
16+
17+
helpFunction()
18+
{
19+
echo ""
20+
echo -e "\t-h --help Script used to build the image."
21+
exit 1 # Exit script after printing help
22+
}
23+
24+
# =============================== BUILD ============================== #
25+
26+
# Auxiliary functions
27+
die() { echo "$*" >&2; exit 2; } # complain to STDERR and exit with error
28+
needs_arg() { if [ -z "$OPTARG" ]; then die "No arg for --$OPT option"; fi; }
29+
no_arg() { if [ -n "$OPTARG" ]; then die "No arg allowed for --$OPT option"; fi; }
30+
31+
# Get the script options. This accepts both single dash (e.g. -a) and double dash options (e.g. --all)
32+
while getopts h-: OPT; do
33+
# support long options: https://stackoverflow.com/a/28466267/519360
34+
if [ "$OPT" = "-" ]; then # long option: reformulate OPT and OPTARG
35+
OPT="${OPTARG%%=*}" # extract long option name
36+
OPTARG="${OPTARG#$OPT}" # extract long option argument (may be empty)
37+
OPTARG="${OPTARG#=}" # if long option argument, remove assigning `=`
38+
fi
39+
case "$OPT" in
40+
h | help ) no_arg; helpFunction ;;
41+
esac
42+
done
43+
44+
docker build \
45+
--build-arg BASE_IMAGE=$BASE_IMAGE \
46+
--build-arg BASE_TAG=$BASE_TAG \
47+
--build-arg IMAGE_NAME=$IMAGE_NAME \
48+
--build-arg IMAGE_TAG=$IMAGE_TAG \
49+
--build-arg USERNAME=$USERNAME \
50+
--build-arg USER_UID=$USER_UID \
51+
--build-arg USER_GID=$USER_GID \
52+
--build-arg WORKSPACE=$WORKSPACE \
53+
-t $IMAGE_NAME:$IMAGE_TAG .

entrypoint.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
3+
. /opt/ros/humble/setup.sh
4+
echo "PASS HERE"
5+
. /home/${WORKSPACE}/install/setup.sh
6+
exec "$@

run.bash

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
IMAGE_NAME=docker_control_simulation
4+
IMAGE_TAG=0.1
5+
6+
chmod +rw ~/.bash_history
7+
chmod o+w ~/.bash_history
8+
9+
WORKSPACE=sim_framework
10+
11+
# Create /tmp/.docker.xauth if it does not already exist.
12+
XAUTH=/tmp/.docker.xauth
13+
if [ ! -f $XAUTH ]
14+
then
15+
touch $XAUTH
16+
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
17+
fi
18+
19+
xhost +
20+
21+
docker run \
22+
--net=host \
23+
-it \
24+
-v $(pwd):/home/ros/$WORKSPACE \
25+
--env="HISTFILE=/home/ros/.bash_history" \
26+
--env="HISTFILESIZE=2000" \
27+
-v ~/.bash_history:/home/ros/.bash_history \
28+
--device=/dev/dri:/dev/dri \
29+
--privileged -v /dev/input:/dev/input \
30+
--rm \
31+
--env="DISPLAY=$DISPLAY" \
32+
-v /tmp/.X11-unix:/tmp/.X11-unix \
33+
--env="XAUTHORITY=$XAUTH" \
34+
--volume="$XAUTH:$XAUTH" \
35+
--name docker_simulation \
36+
-w /home/ros/$WORKSPACE \
37+
$IMAGE_NAME:$IMAGE_TAG \
38+
/bin/bash

src/mulinex_description

Submodule mulinex_description added at ff79c24

src/mulinex_gazebo

Submodule mulinex_gazebo added at 6670c25

0 commit comments

Comments
 (0)