In the Dockerfile.bluerov2-nogpu file, python3.7 is installed separately, which causes a conflict with the original python3.8. As a result, "pip install -e ~/acados/interfaces/acados_template" fails (because it depends on python3.7, and the default python version is python3.8).
The solution is as follows: Use python3.7 to create a virtual environment named auv and activate the environment when you need to execute: "yes | python3 generate_c_code.py".(Currently tested on my Ubuntu 20.04)
Dockerfile.bluerov2-nogpu:
FROM pattylo/airo_ros_noetic:nogpu-nopkg
ENV DEBIAN_FRONTEND=noninteractive
ARG HOME=/root
RUN add-apt-repository ppa:deadsnakes/ppa && \
apt-get update && \
apt-get install -y python3.7 python3.7-venv python3.7-dev python3.7-tk
RUN python3.7 -m venv /root/auv
RUN /bin/bash -c "source /root/auv/bin/activate && \
pip install --upgrade pip && \
pip install numpy matplotlib scipy future-fstrings casadi>=3.5.1 setuptools"
RUN python3 --version && echo "Force rebuild: $(date)"
RUN which python3 && echo "Force rebuild: $(date)"
RUN python3.7 --version && echo "Force rebuild: $(date)"
RUN which python3.7 && echo "Force rebuild: $(date)"
WORKDIR $HOME
RUN git clone https://github.com/acados/acados.git && \
cd ~/acados && git checkout 568e46c && \
git submodule update --recursive --init && \
mkdir build && cd build && \
cmake -DACADOS_WITH_QPOASES=ON -DACADOS_WITH_OSQP=OFF/ON -DACADOS_INSTALL_DIR=~/acados .. && \
sudo make install -j4
# RUN pip install importlib-metadata
RUN /bin/bash -c "source /root/auv/bin/activate && \
pip install -e ~/acados/interfaces/acados_template"
RUN echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/root/acados/lib"' >> ~/.bashrc && \
echo 'export ACADOS_SOURCE_DIR="/root/acados"' >> ~/.bashrc
RUN sudo apt-get install -y ros-noetic-geodesy
RUN mkdir -p ~/catkin_ws/src && \
cd ~/catkin_ws/src && \
git clone --branch noetic https://github.com/arturmiller/uuv_simulator.git
RUN cd ~/catkin_ws/src && \
sudo apt-get install ros-noetic-sophus ros-noetic-ddynamic-reconfigure -y && \
# git clone https://github.com/HKPolyU-UAV/bluerov2.git && \
git clone --branch eskf_obs2 https://github.com/HKPolyU-UAV/bluerov2.git && \
cd ~/catkin_ws/src/bluerov2 && \
git submodule update --init --recursive
# REALSENSE
RUN sudo mkdir -p /etc/apt/keyrings
RUN curl -sSf https://librealsense.intel.com/Debian/librealsense.pgp | sudo tee /etc/apt/keyrings/librealsense.pgp > /dev/null
RUN echo "deb [signed-by=/etc/apt/keyrings/librealsense.pgp] https://librealsense.intel.com/Debian/apt-repo `lsb_release -cs` main" | \
sudo tee /etc/apt/sources.list.d/librealsense.list
RUN sudo apt-get update && \
sudo apt-get install librealsense2-dkms -y && \
sudo apt-get install librealsense2-utils -y && \
sudo apt-get install librealsense2-dev -y && \
sudo apt-get install librealsense2-dbg -y
# RUN mkdir -p ~/camera_ws/src && cd ~/camera_ws/src/ && \
# git clone https://github.com/IntelRealSense/realsense-ros.git && \
# cd realsense-ros/ && \
# git checkout `git tag | sort -V | grep -P "^2.\d+\.\d+" | tail -1`
# RUN sudo apt-get install ros-noetic-ddynamic-reconfigure -y && \
# /bin/bash -c '. /opt/ros/noetic/setup.bash; cd ~/camera_ws/src;\
# catkin_init_workspace' && \
# /bin/bash -c '. /opt/ros/noetic/setup.bash; cd ~/camera_ws;\
# catkin_make clean' && \
# /bin/bash -c '. /opt/ros/noetic/setup.bash; cd ~/camera_ws;\
# catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release' && \
# /bin/bash -c '. /opt/ros/noetic/setup.bash; cd ~/camera_ws;\
# catkin_make install'
RUN export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/root/acados/lib" && \
export ACADOS_SOURCE_DIR="/root/acados" && \
cd ~/catkin_ws/src/bluerov2/bluerov2_dobmpc/scripts && \
/bin/bash -c "source /root/auv/bin/activate && yes | python3 generate_c_code.py"
RUN export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/root/acados/lib" && \
export ACADOS_SOURCE_DIR="/root/acados" && \
cd ~/catkin_ws/src/bluerov2/bluerov2_mpc/scripts && \
/bin/bash -c "source /root/auv/bin/activate && yes | python3 generate_c_code.py"
RUN sudo apt-get update && sudo apt-get install -y libeigen3-dev
RUN sudo apt-get update && sudo apt-get install -y \
ros-noetic-catkin \
ros-noetic-common-msgs \
ros-noetic-geometry-msgs \
ros-noetic-tf2 \
ros-noetic-tf2-ros
RUN sudo ln -s /usr/include/eigen3/Eigen /usr/include/Eigen && \
/bin/bash -c '. /opt/ros/noetic/setup.bash; cd ~/catkin_ws/; \
rm -rf build devel; \
catkin_make -j4 -l4'
RUN echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
WORKDIR $HOME
In the Dockerfile.bluerov2-nogpu file, python3.7 is installed separately, which causes a conflict with the original python3.8. As a result, "pip install -e ~/acados/interfaces/acados_template" fails (because it depends on python3.7, and the default python version is python3.8).
The solution is as follows: Use python3.7 to create a virtual environment named auv and activate the environment when you need to execute: "yes | python3 generate_c_code.py".(Currently tested on my Ubuntu 20.04)
Dockerfile.bluerov2-nogpu: