diff --git a/Docker_PX4/Dockerfile b/Docker_PX4/Dockerfile index 8c4e3d7..8f6177d 100644 --- a/Docker_PX4/Dockerfile +++ b/Docker_PX4/Dockerfile @@ -9,8 +9,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-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 @@ -65,17 +65,12 @@ RUN apt-get update && apt-get -y --quiet --no-install-recommends install \ 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/* -# 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 \ && pip install setuptools pkgconfig wheel \ && 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 -# 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 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 @@ -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/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 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 clean autoclean \ && rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/* \ - # pip && 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 python3.8 -m pip install --ignore-installed PyGObject + 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 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 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) 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 -# 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 -#RUN cd $ARRROW_HOME && git clone # Install some useful ros tf packages 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 cd $ARROW_HOME \ && git clone https://github.com/PX4/PX4-Autopilot.git --recursive \ && cd PX4-Autopilot \ - #&& git checkout 601c588294973caf105b79a23f7587c6b991bb05 \ && echo 'argcomplete \n\ argparse>=1.2 \n\ cerberus \n\ @@ -359,13 +275,8 @@ requests \n\ setuptools>=39.2.0 \n\ six>=1.12.0 \n\ toml>=0.9' > Tools/setup/requirements.txt \ - #&& git checkout 601c588294973caf105b79a23f7587c6b991bb05 \ && echo "arrow" | sudo -S bash ./Tools/setup/ubuntu.sh \ && 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 @@ -377,17 +288,11 @@ 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 install git - -#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 pip install scipy 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 git config --global --add safe.directory /home/arrow/Firmware 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 mkdir -p ~/PX4-Autopilot/Tools/sitl_gazebo/models RUN mkdir -p ~/PX4-Autopilot/Tools/sitl_gazebo/worlds @@ -400,16 +305,12 @@ RUN mkdir -p /home/arrow/PX4-Autopilot/ROMFS/px4fmu_common/init.d-posix/airframe 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 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 -RUN echo "arrow" | sudo -S pip install scipy + +#install QGroundControl 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 +RUN echo "arrow" | sudo -S apt install gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-gl libqt5gui5 libfuse2 libpulse-dev fuse -y 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 -RUN echo "arrow"| sudo -S apt-get install fuse +#final setup SHELL ["/bin/bash", "-c"] RUN cd ~/PX4-Autopilot\ && source Tools/simulation/gazebo-classic/setup_gazebo.bash $(pwd) $(pwd)/build/px4_sitl_default \