-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from pariaspe/main
Update dockerfile
- Loading branch information
Showing
5 changed files
with
213 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,100 +1,141 @@ | ||
FROM osrf/ros:humble-desktop | ||
|
||
RUN sudo apt update && apt install -y \ | ||
# install initial docker dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
apt-utils \ | ||
software-properties-common \ | ||
git \ | ||
tmux \ | ||
tmuxinator \ | ||
vim \ | ||
python-is-python3 \ | ||
python3-rosdep \ | ||
python3-pip \ | ||
python3-colcon-common-extensions \ | ||
python3-wheel \ | ||
ca-certificates \ | ||
gnupg \ | ||
lsb-core \ | ||
sudo \ | ||
wget \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN sudo apt update && apt install -y \ | ||
libgazebo11 \ | ||
python3-wheel \ | ||
libgazebo-dev \ | ||
ros-humble-geographic-msgs \ | ||
ros-humble-xacro \ | ||
gnome-terminal \ | ||
tmux \ | ||
tmuxinator \ | ||
ros-humble-gazebo-dev \ | ||
ros-humble-gazebo-ros\ | ||
ros-humble-ament-cmake-clang-format \ | ||
build-essential cmake git libeigen3-dev libyaml-cpp-dev libopencv-dev \ | ||
python3-pip python3-colcon-common-extensions python3-rosdep \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
build-essential \ | ||
cmake \ | ||
libeigen3-dev \ | ||
libyaml-cpp-dev \ | ||
libopencv-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Gazebo 11 | ||
RUN sudo rosdep fix-permissions \ | ||
&& rosdep update \ | ||
&& apt-get update && apt-get install -q -y \ | ||
ros-humble-gazebo* \ | ||
ros-humble-ros-gz-* \ | ||
gstreamer1.0-plugins-bad \ | ||
gstreamer1.0-plugins-good \ | ||
gstreamer1.0-plugins-ugly \ | ||
gstreamer1.0-libav \ | ||
libgstreamer-plugins-base1.0-dev \ | ||
libimage-exiftool-perl \ | ||
&& apt-get -y autoremove \ | ||
&& apt-get clean autoclean \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
# PX4 general dependencies | ||
RUN apt-get update && apt-get -y --quiet --no-install-recommends install \ | ||
astyle \ | ||
build-essential \ | ||
cmake \ | ||
cppcheck \ | ||
file \ | ||
g++ \ | ||
gcc \ | ||
gdb \ | ||
git \ | ||
lcov \ | ||
libfuse2 \ | ||
libxml2-dev \ | ||
libxml2-utils \ | ||
make \ | ||
ninja-build \ | ||
python3 \ | ||
python3-dev \ | ||
python3-pip \ | ||
python3-setuptools \ | ||
python3-wheel \ | ||
rsync \ | ||
shellcheck \ | ||
unzip \ | ||
zip \ | ||
&& apt-get -y autoremove \ | ||
&& apt-get clean autoclean \ | ||
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/* | ||
|
||
# Install Python 3 pip build dependencies first | ||
RUN python3.10 -m pip install --upgrade pip==23.3.1 wheel==0.41.3 setuptools==69.0.2 | ||
RUN python3.10 -m pip install evdev | ||
|
||
# Install setuptools, rosdep, and colcon | ||
RUN sudo pip install setuptools==58.2 \ | ||
&& pip install rosdep future \ | ||
&& pip install colcon-common-extensions \ | ||
&& pip install torch matplotlib albumentations torchvision Pillow numpy | ||
|
||
|
||
RUN sudo pip3 install kconfiglib jsonschema | ||
|
||
# Install Gazebo | ||
RUN curl -sSL http://get.gazebosim.org | sh | ||
|
||
ENTRYPOINT ["/ros_entrypoint.sh"] | ||
|
||
RUN mkdir -p root/workspace/src/px4 | ||
WORKDIR /root/workspace | ||
|
||
# Clone the required repositorys | ||
RUN git clone https://github.com/RoboticsLabURJC/2023-tfg-adrian-madinabeitia.git src/tfg | ||
RUN python3.10 -m pip install \ | ||
# setuptools==58.2 \ | ||
rosdep \ | ||
future \ | ||
colcon-common-extensions \ | ||
torch==2.4.1 matplotlib albumentations torchvision Pillow numpy | ||
RUN sudo pip3 install jsonschema==4.18.0 | ||
|
||
# Installing PX4 Python3 dependencies | ||
RUN python3.10 -m pip install argparse==1.4.0 argcomplete==3.1.2 coverage==7.3.2 cerberus==1.3.5 \ | ||
empy==3.3.4 jinja2==3.1.2 kconfiglib==14.1.0 matplotlib>=3.0 numpy==1.23.4 nunavut==1.1.0 \ | ||
packaging==23.2 pkgconfig==1.5.5 pyros-genmsg==0.5.8 pyulog==1.0.1 pyyaml==6.0.1 \ | ||
requests==2.22.0 serial==0.0.97 six==1.14.0 toml==0.10.2 sympy>=1.10.1 \ | ||
psutil==5.9.0 utm==0.7.0 psycopg2 | ||
|
||
# Install PX4 | ||
RUN git clone -b v1.14.3 https://github.com/PX4/PX4-Autopilot.git --recursive \ | ||
&& cd /PX4-Autopilot \ | ||
&& DONT_RUN=1 make px4_sitl gazebo | ||
|
||
RUN mkdir -p root/ws/src/px4 | ||
WORKDIR /root/ws | ||
|
||
#* Aerostack 2 | ||
RUN git clone https://github.com/aerostack2/aerostack2.git src/aerostack2 | ||
|
||
#* Other dependencies | ||
RUN git clone https://github.com/JdeRobot/RoboticsInfrastructure.git --branch humble-devel src/RoboticsInfrastructure | ||
|
||
#* px4 | ||
RUN git clone https://github.com/aerostack2/as2_platform_pixhawk.git -- src/px4/as2_platform_pixhawk | ||
RUN git clone https://github.com/eProsima/Micro-XRCE-DDS-Agent.git --branch v2.4.1 src/px4/Micro-XRCE-DDS-Agent | ||
RUN git clone https://github.com/aerostack2/project_px4_vision src/px4/project_px4_vision | ||
RUN git clone https://github.com/PX4/PX4-Autopilot.git --branch v1.14.0 src/px4/PX4-Autopilot | ||
RUN git clone https://github.com/PX4/px4_msgs.git src/px4/px4_msgs | ||
|
||
RUN git clone https://github.com/naoki-mizuno/ds4_driver.git src/ds4_driver | ||
RUN git clone https://github.com/aerostack2/as2_platform_pixhawk.git -b 1.0.9 src/px4/as2_platform_pixhawk | ||
RUN git clone https://github.com/eProsima/Micro-XRCE-DDS-Agent.git --branch v2.4.1 src/px4/Micro-XRCE-DDS-Agent | ||
|
||
# Bash configuration | ||
RUN echo source /usr/share/gazebo-11/setup.bash >> /root/.bashrc | ||
RUN echo source /opt/ros/humble/setup.bash >> /root/.bashrc | ||
RUN echo export GAZEBO_HOME=/usr/share/gazebo >> /root/.bashrc | ||
RUN echo export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/usr/share/gazebo-11/models >> /root/.bashrc | ||
RUN echo export GAZEBO_PLUGIN_PATH=$GAZEBO_PLUGIN_PATH:/usr/lib/x86_64-linux-gnu/gazebo-11/plugins >> /root/.bashrc | ||
RUN echo export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/gazebo-11/plugins >> /root/.bashrc | ||
RUN echo source /root/workspace/install/setup.bash >> /root/.bashrc | ||
|
||
RUN echo export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/src/aerostack2/as2_simulation_assets/as2_ign_gazebo_assets/models >> /root/.bashrc | ||
RUN echo export PX4_FOLDER=/src/px4/PX4-Autopilot >> /root/.bashrc | ||
RUN echo export AEROSTACK2_PATH=/src/aerostack2 >> /root/.bashrc | ||
RUN echo source $AEROSTACK2_PATH/as2_cli/setup_env.bash >> /root/.bashrc | ||
RUN echo AEROSTACK2_SIMULATION_DRONE_ID=drone0 >> /root/.bashrc | ||
RUN echo export AS2_GZ_ASSETS_SCRIPT_PATH=/root/workspace/install/as2_gazebo_classic_assets/share/as2_gazebo_classic_assets/scripts >> /root/.bashrc | ||
|
||
|
||
# Changes to specific commits some repositorys | ||
WORKDIR /root/workspace/src/px4/px4_msgs | ||
RUN git checkout 7203046 | ||
|
||
WORKDIR /root/workspace/src/px4/as2_platform_pixhawk | ||
RUN git checkout 7c55374 | ||
|
||
WORKDIR /root/workspace/src/aerostack2 | ||
RUN git checkout 96fdc4b | ||
|
||
#* Rosdep dependencies | ||
WORKDIR /root/workspace | ||
RUN rosdep update | ||
|
||
WORKDIR /root/workspace/src/px4/PX4-Autopilot | ||
RUN git submodule update --init --recursive | ||
## | ||
RUN git clone https://github.com/PX4/px4_msgs.git src/px4/px4_msgs -b release/1.14 | ||
|
||
RUN chmod +x /root/workspace/install/as2_gazebo_classic_assets/share/as2_gazebo_classic_assets/scripts/default_run.sh | ||
RUN chmod +x /root/workspace/install/as2_gazebo_classic_assets/share/as2_gazebo_classic_assets/scripts/run_sitl.sh | ||
RUN chmod +x /root/workspace/install/as2_gazebo_classic_assets/share/as2_gazebo_classic_assets/scripts/parse_json.py | ||
RUN chmod +x /root/workspace/install/as2_gazebo_classic_assets/share/as2_gazebo_classic_assets/scripts/*.sh | ||
RUN git clone https://github.com/aerostack2/aerostack2.git -b 1.0.9 src/aerostack2 | ||
RUN git clone https://github.com/pariaspe/2023-tfg-adrian-madinabeitia.git src/2023-tfg-adrian-madinabeitia | ||
RUN apt update && rosdep update && rosdep install --from-paths src --ignore-src -r -y | ||
|
||
RUN /bin/bash -c "source /opt/ros/$ROS_DISTRO/setup.bash && colcon build" | ||
|
||
RUN rosdep install --from-paths src --ignore-src -r -y | ||
WORKDIR / | ||
# used? | ||
RUN git clone https://github.com/Adrimapo/project_crazyflie_gates.git | ||
RUN git clone https://github.com/aerostack2/project_px4_vision src/px4/project_px4_vision | ||
|
||
#RUN colcon build | ||
RUN pip3 install PySimpleGUI-4-foss | ||
RUN echo "set -g mouse on" > ~/.tmux.conf | ||
|
||
RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> ~/.bashrc | ||
RUN echo "source /root/ws/install/setup.bash" >> ~/.bashrc | ||
# RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> ~/.bashrc | ||
|
||
CMD ["bash"] | ||
COPY ./entrypoint.bash / | ||
ENTRYPOINT [ "/entrypoint.bash" ] | ||
CMD [ "/bin/bash" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# HOWTODOCKER | ||
|
||
# Build and run (using docker-compose) | ||
``` | ||
xhost + | ||
docker compose up -d # use the -d for keep the container alive in background | ||
docker exec -it imitation_learning /bin/bash | ||
``` | ||
|
||
## Manual build container | ||
|
||
```bash | ||
docker build -t imitation_learning . | ||
``` | ||
|
||
## Manual run docker container | ||
```bash | ||
xhost + | ||
docker run -it --rm -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY imitation_learning | ||
``` | ||
|
||
### Launch PX4 and Gazebo11 only | ||
|
||
```bash | ||
cd /path/to/PX4-Autopilot | ||
make px4_sitl gazebo-classic | ||
``` | ||
|
||
--- | ||
|
||
``` | ||
chmod +x $AS2_GZ_ASSETS_SCRIPT_PATH/default_run.sh $AS2_GZ_ASSETS_SCRIPT_PATH/run_sitl.sh $AS2_GZ_ASSETS_SCRIPT_PATH/parse_json.py $AS2_GZ_ASSETS_SCRIPT_PATH/jinja_gen.py | ||
cd /root/ws/src/2023-tfg-adrian-madinabeitia/drone_platforms | ||
$AS2_GZ_ASSETS_SCRIPT_PATH/default_run.sh config/world.json | ||
``` | ||
|
||
``` | ||
cd /root/ws/src/2023-tfg-adrian-madinabeitia/drone_platforms | ||
tmuxinator start -n drone0 -p config/tmuxLaunch.yml drone_namespace=drone0 simulation_time=true config_path=config/ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
services: | ||
aerostack2: | ||
image: imitation_learning | ||
build: | ||
context: ./ | ||
dockerfile: Dockerfile | ||
container_name: imitation_learning | ||
environment: | ||
DISPLAY: $DISPLAY | ||
PX4_FOLDER: /PX4-Autopilot | ||
ROS_LOCALHOST_ONLY: 0 | ||
ROS_DOMAIN_ID: 0 | ||
privileged: true | ||
volumes: | ||
# X11 | ||
- ~/.Xauthority:/root/.Xauthority | ||
# | ||
- /dev/:/dev | ||
- .:/root/ws/src/2023-tfg-adrian-madinabeitia | ||
network_mode: "host" | ||
command: tail -f /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
if [[ -f /opt/ros/$ROS_DISTRO/setup.bash ]]; then | ||
source /opt/ros/$ROS_DISTRO/setup.bash | ||
fi | ||
|
||
if [[ -f /root/ws/install/setup.bash ]]; then | ||
source /root/ws/install/setup.bash | ||
fi | ||
|
||
source /usr/share/gazebo-11/setup.bash | ||
export GAZEBO_HOME=/usr/share/gazebo | ||
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/usr/share/gazebo-11/models | ||
export GAZEBO_PLUGIN_PATH=$GAZEBO_PLUGIN_PATH:/usr/lib/x86_64-linux-gnu/gazebo-11/plugins | ||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/gazebo-11/plugins | ||
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:/root/ws/src/aerostack2/as2_simulation_assets/as2_gazebo_assets/models | ||
export PX4_FOLDER=/root/ws/src/px4/PX4-Autopilot | ||
export AEROSTACK2_PATH=/root/ws/src/aerostack2 | ||
source $AEROSTACK2_PATH/as2_cli/setup_env.bash | ||
AEROSTACK2_SIMULATION_DRONE_ID=drone0 | ||
export AS2_GZ_ASSETS_SCRIPT_PATH=/root/ws/install/as2_gazebo_classic_assets/share/as2_gazebo_classic_assets/scripts | ||
|
||
exec "$@" |