Compare commits

...

8 Commits

Author SHA1 Message Date
Matas 7656d4b2d1 added ros container 2023-07-26 09:41:18 -04:00
vboxuser af14343ba0 added spiri model 2023-07-18 14:52:58 -04:00
vboxuser b72b4066da Removed extra code in docker 2023-07-13 13:10:22 -04:00
scorpio1 5f3ef531b1 Update 'px4dockersetupubuntu22.sh' 2023-07-05 10:20:25 -07:00
scorpio1 8ed0bd700e Add 'px4dockersetupubuntu18.sh' 2023-07-05 10:19:13 -07:00
Matas Keras a1a122f50b changed launch command 2023-07-04 14:43:58 -04:00
Matas Keras 27026bf064 launches automatically 2023-07-04 14:37:54 -04:00
RK117 8e0f0880b8 Update 'README.md' 2023-06-21 11:12:24 -07:00
6 changed files with 309 additions and 131 deletions

View File

@ -9,8 +9,8 @@ ENV LC_ALL C.UTF-8
RUN apt-get update && apt-get install -y gnupg RUN apt-get update && apt-get install -y gnupg
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub #RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub #RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
@ -65,17 +65,12 @@ RUN apt-get update && apt-get -y --quiet --no-install-recommends install \
wget \ wget \
xsltproc \ xsltproc \
zip \ zip \
xterm \
vim \
&& apt-get -y autoremove \ && apt-get -y autoremove \
&& apt-get clean autoclean \ && apt-get clean autoclean \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/* && rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
# gtest
RUN cd /usr/src/gtest \
&& mkdir build && cd build \
&& cmake .. && make \
&& cp *.a /usr/lib \
&& cd .. && rm -rf build
RUN python -m pip install --upgrade pip \ RUN python -m pip install --upgrade pip \
&& pip install setuptools pkgconfig wheel \ && pip install setuptools pkgconfig wheel \
&& pip install argparse argcomplete coverage jinja2 empy numpy requests serial toml pyyaml cerberus && pip install argparse argcomplete coverage jinja2 empy numpy requests serial toml pyyaml cerberus
@ -86,39 +81,6 @@ RUN pip3 install argparse argcomplete coverage cerberus empy jinja2 \
requests serial toml pyulog wheel requests serial toml pyulog wheel
# astyle v2.06
RUN wget -q https://downloads.sourceforge.net/project/astyle/astyle/astyle%202.06/astyle_2.06_linux.tar.gz -O /tmp/astyle.tar.gz \
&& cd /tmp && tar zxf astyle.tar.gz && cd astyle/src \
&& make -f ../build/gcc/Makefile && cp bin/astyle /usr/local/bin \
&& rm -rf /tmp/*
# Gradle (Required to build Fast-RTPS-Gen)
RUN wget -q "https://services.gradle.org/distributions/gradle-5.6.2-bin.zip" -O /tmp/gradle-5.6.2-bin.zip \
&& mkdir /opt/gradle \
&& cd /tmp \
&& unzip -d /opt/gradle gradle-5.6.2-bin.zip \
&& rm -rf /tmp/*
ENV PATH "/opt/gradle/gradle-5.6.2/bin:$PATH"
# Fast-RTPS
RUN apt install libssl-dev -y
RUN git clone --recursive https://github.com/eProsima/Fast-RTPS.git -b 1.8.x /tmp/FastRTPS-1.8.2 \
&& cd /tmp/FastRTPS-1.8.2 \
&& mkdir build && cd build \
&& cmake -DTHIRDPARTY=ON -DSECURITY=ON .. \
&& cmake --build . --target install \
&& rm -rf /tmp/*
# Fast-RTPS-Gen (required since Fast-RTPS-Gen got split from Fast-RTPS repo since 1.8.x)
RUN git clone --recursive https://github.com/eProsima/Fast-RTPS-Gen.git -b v1.0.2 /tmp/Fast-RTPS-Gen \
&& cd /tmp/Fast-RTPS-Gen \
&& gradle assemble \
&& cp share/fastrtps/fastrtpsgen.jar /usr/local/share/fastrtps/ \
&& cp scripts/fastrtpsgen /usr/local/bin/ \
&& rm -rf /tmp/*
# create arrow with id 1000 with sudo access # create arrow with id 1000 with sudo access
RUN useradd --shell /bin/bash -u 1000 -c "" -m arrow && usermod -a -G dialout arrow && echo "arrow:arrow" | chpasswd && adduser arrow sudo RUN useradd --shell /bin/bash -u 1000 -c "" -m arrow && usermod -a -G dialout arrow && echo "arrow:arrow" | chpasswd && adduser arrow sudo
RUN sed -i '/force_color_prompt/s/^#//g' ~/.bashrc RUN sed -i '/force_color_prompt/s/^#//g' ~/.bashrc
@ -151,16 +113,6 @@ ARG TOKEN
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/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-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 install python3.8 -y
#RUN echo "arrow" | sudo -S update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
#RUN cd /usr/lib/python3/dist-packages/gi/ \
# && echo "arrow" | sudo -S ln -s _gi.so _gi.cpython-38-x86_64-linux-gnu.so
#RUN echo "arrow" | sudo -S apt remove python3-apt -y \
# && echo "arrow" | sudo -S apt autoremove -y \
# && echo "arrow" | sudo -S apt autoclean -y \
# && echo "arrow" | sudo -S apt install python3-apt -y
#RUN pip3 install --upgrade pip
#RUN ln -s /usr/lib/python3/dist-packages/apt_pkg.cpython-36m-x86_64-linux-gnu.so /usr/lib/python3/dist-packages/apt_pkg.so
RUN pip3 install --upgrade pip RUN pip3 install --upgrade pip
RUN wget --quiet http://packages.osrfoundation.org/gazebo.key -O - | apt-key add - \ RUN wget --quiet http://packages.osrfoundation.org/gazebo.key -O - | apt-key add - \
@ -225,18 +177,15 @@ RUN wget --quiet http://packages.osrfoundation.org/gazebo.key -O - | apt-key add
&& apt-get -y autoremove \ && apt-get -y autoremove \
&& apt-get clean autoclean \ && apt-get clean autoclean \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/* \ && rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/* \
# pip
&& pip3 install setuptools wheel \ && pip3 install setuptools wheel \
&& pip3 install pyulog matplotlib \ && pip3 install pyulog matplotlib \
&& pip3 install catkin_pkg px4tools pymavlink \ && pip3 install catkin_pkg px4tools pymavlink \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/* && rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
#RUN python3.8 -m pip install --ignore-installed PyGObject
RUN echo "source /opt/ros/melodic/setup.bash" >> /home/arrow/.bashrc RUN echo "source /opt/ros/melodic/setup.bash" >> /home/arrow/.bashrc
#RUN pip install Shapely Pillow MapProxy uwsgi
# ADD mapproxy.yaml /mapproxy.yaml
# install MAVLink headers # install MAVLink headers
RUN git clone --depth 1 https://github.com/mavlink/c_library_v2.git /usr/local/include/mavlink/v2.0 && rm -rf /usr/local/include/mavlink/v2.0/.git RUN git clone --depth 1 https://github.com/mavlink/c_library_v2.git /usr/local/include/mavlink/v2.0 && rm -rf /usr/local/include/mavlink/v2.0/.git
@ -244,11 +193,6 @@ RUN git clone --depth 1 https://github.com/mavlink/c_library_v2.git /usr/local/i
# Some QT-Apps/Gazebo don't not show controls without this # Some QT-Apps/Gazebo don't not show controls without this
ENV QT_X11_NO_MITSHM 1 ENV QT_X11_NO_MITSHM 1
# Gazebo 7 crashes on VM with OpenGL 3.3 support, so downgrade to OpenGL 2.1
# http://answers.gazebosim.org/question/13214/virtual-machine-not-launching-gazebo/
# https://www.mesa3d.org/vmware-guest.html
#ENV SVGA_VGPU10 0
# Use UTF8 encoding in java tools (needed to compile jMAVSim) # Use UTF8 encoding in java tools (needed to compile jMAVSim)
ENV JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8 ENV JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
@ -283,16 +227,8 @@ RUN mkdir -p $ARROW_HOME/catkin_ws/src \
RUN echo "arrow" | sudo -S apt-get update && sudo apt-get -y --quiet --no-install-recommends install software-properties-common apt-utils 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 && \ 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 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
#RUN cd $ARRROW_HOME && git clone
# Install some useful ros tf packages # 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 echo "arrow" | sudo -S apt-get install ros-melodic-tf-conversions ros-melodic-rqt-tf-tree -y
@ -307,30 +243,10 @@ RUN git clone https://git.spirirobotics.com/scorpio1/oscillation_ctrl.git ~/cat
#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 ..." \
# && cp ~/catkin_ws/src/oscillation_ctrl/px4_setup/px4setup.sh ~/src/containers/scripts/setup_px4.sh \
# && bash ./setup_px4.sh; fi
#RUN echo "arrow" | sudo -S apt-get install python3.8 -y
#RUN echo "arrow" | sudo -S update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
#RUN echo "arrow" | sudo -S apt remove python3-apt -y \
# && echo "arrow" | sudo -S apt autoremove -y \
# && echo "arrow" | sudo -S apt autoclean -y \
# && echo "arrow" | sudo -S apt install python3-apt -y
#RUN pip install pybind11
#RUN pip3 install --upgrade pip
#RUN pip3 install pybind11
#RUN pip3 install cython
#RUN pip3 install numpy
RUN pip3 install --user jsonschema RUN pip3 install --user jsonschema
RUN cd $ARROW_HOME \ RUN cd $ARROW_HOME \
&& git clone https://github.com/PX4/PX4-Autopilot.git --recursive \ && git clone https://github.com/PX4/PX4-Autopilot.git --recursive \
&& cd PX4-Autopilot \ && cd PX4-Autopilot \
#&& git checkout 601c588294973caf105b79a23f7587c6b991bb05 \
&& echo 'argcomplete \n\ && echo 'argcomplete \n\
argparse>=1.2 \n\ argparse>=1.2 \n\
cerberus \n\ cerberus \n\
@ -359,13 +275,8 @@ requests \n\
setuptools>=39.2.0 \n\ setuptools>=39.2.0 \n\
six>=1.12.0 \n\ six>=1.12.0 \n\
toml>=0.9' > Tools/setup/requirements.txt \ toml>=0.9' > Tools/setup/requirements.txt \
#&& git checkout 601c588294973caf105b79a23f7587c6b991bb05 \
&& echo "arrow" | sudo -S bash ./Tools/setup/ubuntu.sh \ && echo "arrow" | sudo -S bash ./Tools/setup/ubuntu.sh \
&& echo "arrow" | sudo -SH pip3 install kconfiglib \ && echo "arrow" | sudo -SH pip3 install kconfiglib \
#&& git submodule deinit -f src/lib/events/libevents \
#&& git submodule update --init --recursive \
#&& git submodule sync --recursive \
#&& git submodule update --init --recursive \
&& DONT_RUN=1 make px4_sitl_default gazebo && DONT_RUN=1 make px4_sitl_default gazebo
@ -377,39 +288,29 @@ RUN echo "export CUDA_HOME=/usr/local/cuda" >> /home/arrow/.bashrc
RUN echo "arrow" | sudo -S apt-get update RUN echo "arrow" | sudo -S apt-get update
RUN echo "arrow" | sudo -S apt-get install git RUN echo "arrow" | sudo -S pip install scipy
#RUN git clone https://git.spirirobotics.com/scorpio1/oscillation_ctrl.git ~/catkin_ws/src/oscillation_ctrl && cd $ARROW_HOME/catkin_ws/src/oscillation_ctrl/px4_setup && bash ./px4setup.sh
RUN echo "arrow" | sudo -S apt install ros-melodic-tf2-geometry-msgs RUN echo "arrow" | sudo -S apt install ros-melodic-tf2-geometry-msgs
#RUN rosdep update
#RUN cd ~/catkin_ws && catkin config --extend /opt/ros/melodic
#RUN source ~/catkin_ws/deve/setup.bash
RUN cd ~/catkin_ws && catkin build
RUN bash ~/catkin_ws/src/oscillation_ctrl/px4_setup/ubuntu_sim_ros_melodic.sh RUN bash ~/catkin_ws/src/oscillation_ctrl/px4_setup/ubuntu_sim_ros_melodic.sh
#RUN git config --global --add safe.directory /home/arrow/Firmware
RUN cd ~/PX4-Autopilot && DONT_RUN=1 make px4_sitl_default gazebo RUN cd ~/PX4-Autopilot && DONT_RUN=1 make px4_sitl_default gazebo
#setup models for px4
RUN cp ~/catkin_ws/src/oscillation_ctrl/px4_setup/airframe_changes ~/PX4-Autopilot/platforms/posix/cmake/sitl_target.cmake RUN cp ~/catkin_ws/src/oscillation_ctrl/px4_setup/airframe_changes ~/PX4-Autopilot/platforms/posix/cmake/sitl_target.cmake
RUN mkdir -p ~/PX4-Autopilot/Tools/sitl_gazebo/models RUN mkdir -p ~/PX4-Autopilot/Tools/sitl_gazebo/models
RUN mkdir -p ~/PX4-Autopilot/Tools/sitl_gazebo/worlds RUN mkdir -p ~/PX4-Autopilot/Tools/sitl_gazebo/worlds
RUN cp -R ~/catkin_ws/src/oscillation_ctrl/models/* ~/PX4-Autopilot/Tools/sitl_gazebo/models RUN cp -R ~/catkin_ws/src/oscillation_ctrl/models/* ~/PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic/models
RUN cp -R ~/catkin_ws/src/oscillation_ctrl/worlds/* ~/PX4-Autopilot/Tools/sitl_gazebo/worlds RUN cp -R ~/catkin_ws/src/oscillation_ctrl/worlds/* ~/PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic/worlds
RUN cd ~/PX4-Autopilot && DONT_RUN=1 make px4_sitl_default gazebo RUN cd ~/PX4-Autopilot && DONT_RUN=1 make px4_sitl_default gazebo
RUN cp ~/catkin_ws/src/oscillation_ctrl/px4_setup/firmwareCmake ~/PX4-Autopilot/Tools/sitl_gazebo/ RUN cp ~/catkin_ws/src/oscillation_ctrl/px4_setup/CMakeLists.txt ~/PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic/CMakeLists.txt
RUN cd ~/PX4-Autopilot && DONT_RUN=1 make px4_sitl_default gazebo RUN cd ~/PX4-Autopilot && DONT_RUN=1 make px4_sitl_default gazebo
RUN mkdir -p /home/arrow/PX4-Autopilot/ROMFS/px4fmu_common/init.d-posix/airframes RUN mkdir -p /home/arrow/PX4-Autopilot/ROMFS/px4fmu_common/init.d-posix/airframes
RUN cp -R ~/catkin_ws/src/oscillation_ctrl/airframes/18.04/* ~/PX4-Autopilot/ROMFS/px4fmu_common/init.d-posix RUN cp -R ~/catkin_ws/src/oscillation_ctrl/airframes/18.04/* ~/PX4-Autopilot/ROMFS/px4fmu_common/init.d-posix
RUN cd ~/PX4-Autopilot && DONT_RUN=1 make px4_sitl_default gazebo RUN cd ~/PX4-Autopilot && DONT_RUN=1 make px4_sitl_default gazebo
RUN bash ~/catkin_ws/src/oscillation_ctrl/px4_setup/px4setup.sh RUN bash ~/catkin_ws/src/oscillation_ctrl/px4_setup/px4setup.sh
RUN echo "arrow" | sudo -S apt-get install -y xterm
RUN echo "arrow" | sudo -S apt-get install -y vim #install QGroundControl
RUN echo "arrow" | sudo -S pip install scipy
RUN echo "arrow" | sudo -S apt-get remove modemmanager -y 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 gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-gl libqt5gui5 libfuse2 libpulse-dev fuse xmlstarlet -y
RUN echo "arrow" | sudo -S apt install libqt5gui5 -y
RUN echo "arrow" | sudo -S apt install libfuse2 -y
RUN cd ~ && wget https://github.com/mavlink/qgroundcontrol/releases/download/v4.2.6/QGroundControl.AppImage RUN cd ~ && wget https://github.com/mavlink/qgroundcontrol/releases/download/v4.2.6/QGroundControl.AppImage
RUN echo "arrow" | sudo -S apt-get install -y libpulse-dev #final setup
RUN echo "arrow"| sudo -S apt-get install fuse
SHELL ["/bin/bash", "-c"] SHELL ["/bin/bash", "-c"]
RUN cd ~/PX4-Autopilot\ RUN cd ~/PX4-Autopilot\
&& source Tools/simulation/gazebo-classic/setup_gazebo.bash $(pwd) $(pwd)/build/px4_sitl_default \ && source Tools/simulation/gazebo-classic/setup_gazebo.bash $(pwd) $(pwd)/build/px4_sitl_default \

252
Docker_ROS/Dockerfile Normal file
View File

@ -0,0 +1,252 @@
FROM ubuntu:18.04
SHELL ["/bin/bash","-c"]
ENV DEBIAN_FRONTEND noninteractive
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
RUN apt-get update && apt-get install -y gnupg
#RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
#RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
RUN apt-get update && apt-get -y --quiet --no-install-recommends install \
sudo \
nano \
gedit \
net-tools \
iputils-* \
bash-completion \
autotools-dev \
dh-autoreconf \
bzip2 \
ca-certificates \
ccache \
cmake \
cppcheck \
curl \
dirmngr \
doxygen \
file \
g++ \
gcc \
gdb \
git \
gnupg \
gosu \
lcov \
libfreetype6-dev \
libgtest-dev \
libpng-dev \
lsb-release \
make \
ninja-build \
openjdk-8-jdk \
openjdk-8-jre \
openssh-client \
pkg-config \
python-pip \
python-pygments \
python-setuptools \
python-wstool \
python3-dev \
python3-pip \
python3-pygments \
python3-setuptools \
locate \
rsync \
shellcheck \
tzdata \
unzip \
wget \
xsltproc \
zip \
xterm \
vim \
&& apt-get -y autoremove \
&& apt-get clean autoclean \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
RUN python -m pip install --upgrade pip \
&& pip install setuptools pkgconfig wheel \
&& pip install argparse argcomplete coverage jinja2 empy numpy requests serial toml pyyaml cerberus
# Python 3 dependencies installed by pip
RUN pip3 install argparse argcomplete coverage cerberus empy jinja2 \
matplotlib==3.0.* numpy pkgconfig pyros-genmsg pyulog pyyaml \
requests serial toml pyulog wheel
# create arrow with id 1000 with sudo access
RUN useradd --shell /bin/bash -u 1000 -c "" -m arrow && usermod -a -G dialout arrow && echo "arrow:arrow" | chpasswd && adduser arrow sudo
RUN sed -i '/force_color_prompt/s/^#//g' ~/.bashrc
RUN sed -i '/force_color_prompt/s/^#//g' /home/arrow/.bashrc
# setup virtual X server
RUN mkdir /tmp/.X11-unix && \
chmod 1777 /tmp/.X11-unix && \
chown -R root:root /tmp/.X11-unix
ENV DISPLAY :99
ENV CCACHE_UMASK=000
ENV FASTRTPSGEN_DIR="/usr/local/bin/"
ENV PATH="/usr/lib/ccache:$PATH"
ENV TERM=xterm
ENV TZ=UTC
RUN echo "source /etc/profile.d/bash_completion.sh" >> /home/arrow/.bashrc
# SITL UDP PORTS
EXPOSE 14556/udp
EXPOSE 14557/udp
#start of ros install
ENV ROS_DISTRO melodic
ARG TOKEN
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 pip3 install --upgrade pip
RUN wget --quiet http://packages.osrfoundation.org/gazebo.key -O - | apt-key add - \
&& sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -sc` main" > /etc/apt/sources.list.d/gazebo-stable.list' \
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 \
&& sh -c 'echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros-latest.list' \
&& sh -c 'echo "deb http://packages.ros.org/ros-shadow-fixed/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros-shadow.list' \
&& curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add - \
&& apt-get update \
&& apt-get -y upgrade \
&& apt-get -y dist-upgrade \
&& DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
ant \
gazebo9 \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-ugly \
libeigen3-dev \
libgazebo9-dev \
libgstreamer-plugins-base1.0-dev \
libimage-exiftool-perl \
libopencv-dev \
libxml2-utils \
pkg-config \
protobuf-compiler \
geographiclib-tools \
libeigen3-dev \
libgeographic-dev \
libopencv-dev \
python-catkin-tools \
python-tk \
python3-pip \
ros-$ROS_DISTRO-gazebo-ros-pkgs \
ros-$ROS_DISTRO-mavlink \
ros-$ROS_DISTRO-mavros \
ros-$ROS_DISTRO-mavros-extras \
ros-$ROS_DISTRO-pcl-conversions \
ros-$ROS_DISTRO-pcl-msgs \
ros-$ROS_DISTRO-pcl-ros \
ros-$ROS_DISTRO-ros-base \
ros-$ROS_DISTRO-rostest \
ros-$ROS_DISTRO-rosunit \
ros-$ROS_DISTRO-xacro \
ros-$ROS_DISTRO-tf2-ros \
ros-$ROS_DISTRO-roslint \
ros-$ROS_DISTRO-rviz \
xvfb \
python-pil \
python-yaml \
libgeos-dev \
python-lxml \
libgdal-dev \
build-essential \
python-dev \
libjpeg-dev \
zlib1g-dev \
libfreetype6-dev \
python-virtualenv \
python-rosdep \
&& geographiclib-get-geoids egm96-5 \
&& apt-get -y autoremove \
&& apt-get clean autoclean \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/* \
&& pip3 install setuptools wheel \
&& pip3 install pyulog matplotlib \
&& pip3 install catkin_pkg px4tools pymavlink \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
RUN echo "source /opt/ros/melodic/setup.bash" >> /home/arrow/.bashrc
# install MAVLink headers
RUN git clone --depth 1 https://github.com/mavlink/c_library_v2.git /usr/local/include/mavlink/v2.0 && rm -rf /usr/local/include/mavlink/v2.0/.git
# Some QT-Apps/Gazebo don't not show controls without this
ENV QT_X11_NO_MITSHM 1
# Use UTF8 encoding in java tools (needed to compile jMAVSim)
ENV JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
# Install MAVSDK library
RUN wget https://github.com/mavlink/MAVSDK/releases/download/v0.23.0/mavsdk_0.23.0_ubuntu18.04_amd64.deb \
&& dpkg -i mavsdk_0.23.0_ubuntu18.04_amd64.deb
RUN rosdep init && su -c "rosdep update -c /home/arrow/.ros/rosdep/sources.cache" - arrow
RUN echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
USER arrow
ENV ARROW_HOME /home/arrow
ENV CATKIN_WS $ARROW_HOME/catkin_ws
RUN echo "Working Folder is:$ARROW_HOME"
RUN rosdep update
RUN echo "Setting up the workspace"
#Create & build catkin_ws
RUN mkdir -p $ARROW_HOME/catkin_ws/src \
&& echo "arrow" | sudo -S chown -R arrow:arrow $ARROW_HOME/catkin_ws \
&& source /opt/ros/melodic/setup.bash \
&& cd ~/catkin_ws \
&& catkin init \
&& catkin build \
&& cd ~/catkin_ws/src
#start of px4 setup
RUN echo "arrow" | sudo -S apt-get update && echo "arrow" | sudo -S apt-get -y --quiet --no-install-recommends install software-properties-common apt-utils
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 git clone https://git.spirirobotics.com/scorpio1/oscillation_ctrl.git ~/catkin_ws/src/oscillation_ctrl
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 echo "arrow" | sudo -S apt-get update
RUN echo "arrow" | sudo -S pip install scipy
RUN echo "arrow" | sudo -S apt install ros-melodic-tf2-geometry-msgs
RUN cd ~ && source .bashrc && cd ~/catkin_ws && source ./devel/setup.bash && catkin build || true && catkin build

View File

@ -1,15 +1,8 @@
To install the docker, first you need git installed. To do so, run sudo apt install git Go to the releases section of this repository to get the setup script, follow the instructions there to get the docker running. You do not need anything beside a fresh ubuntu install.
After you have installed git, move to whichever directory you want to host the project (for example cd ~) Once the docker is built, enter it by:
- starting a new terminal window
- check the name of the docker using docker ps
- enter it using docker exec -it (name of docker) bash
Run git clone https://git.spirirobotics.com/scorpio1/PX4Docker.git If docker commands aren't running, try using sudo at the start of the commands.
Run cd PX4Docker
If you previously have docker installed, you should be able to launch the docker file using docker compose up --build, other you need to run the install script
To run the install script, use the commands chmod u+x px4dockersetup.sh followed by sudo ./px4dockersetup.sh
Once the docker is built, you can enter it by checking the name of the docker using docker ps, and enter it using docker exec -it (name of docker) bash
If docker commands aren't running, try using sudo

View File

@ -1,7 +1,11 @@
services: services:
px4: px4:
build: Docker_PX4 build: Docker_PX4
command: bash command: bash -c "source /opt/ros/melodic/setup.bash &&
source home/arrow/PX4-Autopilot/Tools/simulation/gazebo-classic/setup_gazebo.bash home/arrow/PX4-Autopilot/ home/arrow/PX4-Autopilot//build/px4_sitl_default &&
export ROS_PACKAGE_PATH=/home/arrow/catkin_ws/src/oscillation_ctrl:/opt/ros/melodic/share:/home/arrow/PX4-Autopilot:/home/arrow/PX4-Autopilot/Tools/sitl_gazebo:/home/arrow/PX4-Autopilot:/home/arrow/PX4-Autopilot/Tools/simulation/gazebo-classic/sitl_gazebo-classic &&
roslaunch px4 multi_uav_mavros_sitl_sdf.launch vehicle:=spiri"
tty: true tty: true
privileged: true privileged: true
volumes: volumes:
@ -19,5 +23,9 @@ services:
#- driver: nvidia #- driver: nvidia
# #
# capabilities: [gpu] # capabilities: [gpu]
ros:
build: Docker_ROS
command: bash
tty: true
privileged: true

22
px4dockersetupubuntu18.sh Normal file
View File

@ -0,0 +1,22 @@
#!/bin/bash
echo 'normal ubuntu 18.04 install, no third party'
echo 'July 2023'
echo 'docker password: arrow'
sudo apt -y install git
sudo apt -y install gnupg2 pass gpg
sudo apt-get -y update
sudo apt -y upgrade
sudo apt-get -y install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$UBUNTU_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get -y update
sudo apt -y upgrade
sudo apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo apt-get -y install docker-compose
git clone https://git.spirirobotics.com/scorpio1/PX4Docker
cd PX4Docker && sudo docker compose up --build

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
echo 'normal ubuntu 22.04 install, no third party' echo 'normal ubuntu 22.04 install, no third party'
echo 'June 2023' echo 'July 2023'
echo 'docker password: arrow'
sudo apt -y install git sudo apt -y install git
sudo apt-get -y update sudo apt-get -y update
sudo apt -y upgrade sudo apt -y upgrade
@ -16,4 +17,5 @@ sudo apt-get -y update
sudo apt -y upgrade sudo apt -y upgrade
sudo apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin sudo apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo apt-get -y install docker-compose sudo apt-get -y install docker-compose
sudo docker compose up --build git clone https://git.spirirobotics.com/scorpio1/PX4Docker
cd PX4Docker && sudo docker compose up --build