PX4Docker/Docker_PX4/Dockerfile

76 lines
4.0 KiB
Docker

FROM mzahana/ros-melodic-cuda10.1:latest
LABEL maintainer="Mohamed Abdelkader <mohamedashraf123@gmail.com>"
USER arrow
ENV DEBIAN_FRONTEND noninteractive
ENV ARROW_HOME /home/arrow
RUN echo "arrow" | sudo -S apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
RUN echo "arrow" | sudo -S apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
RUN echo "arrow" | sudo -S apt-get update && sudo apt-get -y --quiet --no-install-recommends install software-properties-common apt-utils
# Insatll VS Code for easy code development
RUN echo "arrow" | sudo -S apt-get update && wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -
RUN echo "arrow" | sudo -S add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
RUN echo "arrow" | sudo -S apt-get update
RUN echo "arrow" | sudo -S apt-get -y --quiet install code libgbm-dev
# source catkin_ws inside .bashrc
RUN sed -i '/source ~\/catkin_ws\/devel\/setup.bash/d' $HOME/.bashrc && \
sed -i 's+source /opt/ros/melodic/setup.bash+source /opt/ros/melodic/setup.bash\nsource ~/catkin_ws/devel/setup.bash+g' $ARROW_HOME/.bashrc
# Install some useful ros tf packages
RUN echo "arrow" | sudo -S apt-get install ros-melodic-tf-conversions ros-melodic-rqt-tf-tree -y
RUN if [ ! -d "$ARROW_HOME/src" ]; then \
mkdir -p $ARROW_HOME/src; fi
RUN if [ ! -d "$ARROW_HOME/src/containers" ]; then \
cd $ARROW_HOME/src \
&& git clone https://github.com/mzahana/containers.git \
&& cd $ARROW_HOME/src/containers/scripts \
&& echo "Cloning and building PX4 v1.10.1 ..." \
&& ./setup_px4.sh; fi
RUN echo "export PATH=\$PATH:/home/arrow/.local/bin:/home/arrow/.local/bin" >> /home/arrow/.bashrc
RUN echo "export PATH=\$PATH:/usr/local/cuda-10.1/bin" >> /home/arrow/.bashrc
RUN echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/local/cuda-10.1/lib64:/usr/local/cuda-10.1/targets/x86_64-linux/lib/:/usr/local/cuda/extras/CUPTI/lib64/" >> /home/arrow/.bashrc
RUN echo "export CUDA_HOME=/usr/local/cuda" >> /home/arrow/.bashrc
RUN touch ~/hi
RUN echo "hi" > ~/hi
RUN chmod u+w ~/catkin_ws
RUN mkdir -p ~/test_ws/src
RUN chmod 777 ~/catkin_ws/src
RUN echo "arrow" | sudo -S chown -R arrow ~/catkin_ws
RUN cd ~/test_ws/src
RUN echo "arrow" | sudo -S apt-get update
RUN echo "arrow" | sudo -S apt-get install git
RUN git clone https://git.spirirobotics.com/scorpio1/oscillation_ctrl.git ~/catkin_ws/src/oscillation_ctrl
RUN echo "arrow" | sudo -S apt install ros-melodic-tf2-geometry-msgs
RUN cd ~/catkin_ws && catkin build
RUN bash ~/catkin_ws/src/oscillation_ctrl/px4_setup/ubuntu_sim_ros_melodic.sh
RUN echo "arrow" | sudo -S apt upgrade -y libignition-math2
RUN cd ~/Firmware && git submodule update --init --recursive
RUN ~/Firmware/Tools/setup/ubuntu.sh
RUN cp ~/catkin_ws/src/oscillation_ctrl/px4_setup/airframe_changes ~/Firmware/platforms/posix/cmake/sitl_target.cmake
RUN cp -R ~/catkin_ws/src/oscillation_ctrl/models/* ~/Firmware/Tools/sitl_gazebo/models
RUN cp -R ~/catkin_ws/src/oscillation_ctrl/worlds/* ~/Firmware/Tools/sitl_gazebo/worlds
RUN cd ~/Firmware && DONT_RUN=1 make px4_sitl_default gazebo
RUN cp ~/catkin_ws/src/oscillation_ctrl/px4_setup/firmwareCmake ~/Firmware/Tools/sitl_gazebo/
RUN cd ~/Firmware && DONT_RUN=1 make px4_sitl_default gazebo
RUN mkdir -p /home/arrow/Firmware/ROMFS/px4fmu_common/init.d-posix/airframes
RUN cp -R ~/catkin_ws/src/oscillation_ctrl/airframes/18.04/* ~/Firmware/ROMFS/px4fmu_common/init.d-posix
RUN cd ~/Firmware && DONT_RUN=1 make px4_sitl_default gazebo
RUN echo "arrow" | sudo -S apt-get install -y xterm
RUN echo "arrow" | sudo -S apt-get install -y vim
RUN echo "arrow" | sudo -S pip install scipy
RUN echo "arrow" | sudo -S apt-get remove modemmanager -y
RUN echo "arrow" | sudo -S apt install gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-gl -y
RUN echo "arrow" | sudo -S apt install libqt5gui5 -y
RUN echo "arrow" | sudo -S apt install libfuse2 -y