From b9268e8acd42f2c724e78a31b199f328fc73edd0 Mon Sep 17 00:00:00 2001 From: Matas Keras Date: Wed, 21 Jun 2023 13:33:52 -0400 Subject: [PATCH] Updated PX4 version --- Docker_PX4/Dockerfile | 124 ++++++++++++++++++++++++++++++++++-------- px4dockersetup.sh | 2 +- 2 files changed, 102 insertions(+), 24 deletions(-) diff --git a/Docker_PX4/Dockerfile b/Docker_PX4/Dockerfile index 463e9f9..8812fb1 100644 --- a/Docker_PX4/Dockerfile +++ b/Docker_PX4/Dockerfile @@ -151,7 +151,17 @@ 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 - \ && sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -sc` main" > /etc/apt/sources.list.d/gazebo-stable.list' \ @@ -221,9 +231,11 @@ RUN wget --quiet http://packages.osrfoundation.org/gazebo.key -O - | apt-key add && 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 +#RUN pip install Shapely Pillow MapProxy uwsgi # ADD mapproxy.yaml /mapproxy.yaml # install MAVLink headers @@ -253,8 +265,8 @@ ENV CATKIN_WS $ARROW_HOME/catkin_ws RUN echo "Working Folder is:$ARROW_HOME" -# RUN echo "Setting up the workspace" -# Create & build catkin_ws + 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 \ && cd ~/catkin_ws \ @@ -290,15 +302,71 @@ RUN if [ ! -d "$ARROW_HOME/src" ]; then \ +RUN git clone https://git.spirirobotics.com/scorpio1/oscillation_ctrl.git ~/catkin_ws/src/oscillation_ctrl -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 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\ +coverage \n\ +empy>=3.3 \n\ +future \n\ +jinja2>=2.8 \n\ +jsonschema \n\ +kconfiglib \n\ +lxml \n\ +matplotlib>=3.0.* \n\ +numpy>=1.13 \n\ +nunavut>=1.1.0 \n\ +packaging \n\ +pandas>=0.21 \n\ +pkgconfig \n\ +psutil \n\ +pygments \n\ +wheel>=0.31.1 \n\ +pymavlink \n\ +pyros-genmsg \n\ +pyserial \n\ +pyulog>=0.5.0 \n\ +pyyaml \n\ +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 RUN echo "export PATH=\$PATH:/home/arrow/.local/bin:/home/arrow/.local/bin" >> /home/arrow/.bashrc @@ -311,21 +379,27 @@ 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 +#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 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 cd ~/Firmware && make clean && make distclean && DONT_RUN=1 make px4_sitl_default gazebo -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 git config --global --add safe.directory /home/arrow/Firmware +RUN cd ~/PX4-Autopilot && DONT_RUN=1 make px4_sitl_default gazebo +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 +RUN cp -R ~/catkin_ws/src/oscillation_ctrl/models/* ~/PX4-Autopilot/Tools/sitl_gazebo/models +RUN cp -R ~/catkin_ws/src/oscillation_ctrl/worlds/* ~/PX4-Autopilot/Tools/sitl_gazebo/worlds +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 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 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 @@ -336,4 +410,8 @@ 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 echo "arrow" | sudo -S apt-get install -y libpulse-dev RUN echo "arrow"| sudo -S apt-get install fuse - +SHELL ["/bin/bash", "-c"] +RUN cd ~/PX4-Autopilot\ + && source Tools/simulation/gazebo-classic/setup_gazebo.bash $(pwd) $(pwd)/build/px4_sitl_default \ + && export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd) \ + && export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)/Tools/simulation/gazebo-classic/sitl_gazebo-classic diff --git a/px4dockersetup.sh b/px4dockersetup.sh index bd541d7..24dd1f6 100644 --- a/px4dockersetup.sh +++ b/px4dockersetup.sh @@ -16,4 +16,4 @@ 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 -sudo docker compose up --build \ No newline at end of file +sudo docker compose up --build