diff --git a/scripts/VCDI/Dockerfile b/scripts/VCDI/Dockerfile new file mode 100644 index 00000000..86d96d35 --- /dev/null +++ b/scripts/VCDI/Dockerfile @@ -0,0 +1,45 @@ +FROM python:3.11-slim + +RUN apt-get update && apt-get install -y \ + git \ + curl \ + build-essential \ + gnupg \ + && rm -rf /var/lib/apt/lists/* + + +RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ + apt-get update && apt-get install -y nodejs + + +WORKDIR /app + + +ARG BRANCH=master + +RUN git clone --branch ${BRANCH} --single-branch https://github.com/JdeRobot/VisualCircuit.git + + + +WORKDIR /app/VisualCircuit/frontend +RUN npm install --legacy-peer-deps + + +WORKDIR /app/VisualCircuit/backend +RUN pip install --upgrade pip && pip install -r requirements.txt + +RUN echo "DJANGO_DEBUG=true" >> /app/VisualCircuit/backend/.env && \ + echo "VISUAL_CIRCUIT_FRONTEND_HOST='http://localhost:4000'" >> /app/VisualCircuit/backend/.env && \ + echo "DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1" >> /app/VisualCircuit/backend/.env && \ + echo "DJANGO_SECRET_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" >> /app/VisualCircuit/backend/.env + +# Collect static files +RUN python manage.py collectstatic + +WORKDIR /app/VisualCircuit +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +EXPOSE 4000 8080 +ENTRYPOINT ["/entrypoint.sh"] + diff --git a/scripts/VCDI/entrypoint.sh b/scripts/VCDI/entrypoint.sh new file mode 100644 index 00000000..7ad86968 --- /dev/null +++ b/scripts/VCDI/entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +echo "Starting backend server on port 8080..." +cd /app/VisualCircuit/backend +python3 manage.py migrate || true +python3 manage.py runserver 0.0.0.0:8080 & + +echo "Starting frontend server on port 4000..." +cd /app/VisualCircuit/frontend +npm start diff --git a/scripts/VCDI_with_RI/Dockerfile.dependencies_humble b/scripts/VCDI_with_RI/Dockerfile.dependencies_humble new file mode 100644 index 00000000..24da5d1a --- /dev/null +++ b/scripts/VCDI_with_RI/Dockerfile.dependencies_humble @@ -0,0 +1,318 @@ +FROM nvidia/opengl:1.2-glvnd-runtime-ubuntu22.04 + +# Make all NVIDIA GPUS visible +ARG NVIDIA_VISIBLE_DEVICES=all +ENV NVIDIA_DRIVER_CAPABILITIES=all +ENV VIRTUALGL_VERSION=3.0.2 +ENV TURBOVNC_VERSION=3.0.3 + +# Setup NON INTERACTIVE ENVIRONMENT +ENV DEBIAN_FRONTEND=noninteractive + +# Install locales to prevent errors +RUN apt-get clean && \ + apt-get update && \ + apt-get install --no-install-recommends -y locales && \ + rm -rf /var/lib/apt/lists/* && \ + locale-gen en_US.UTF-8 +ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US:en +ENV LC_ALL=en_US.UTF-8 + +ENV ROS_DISTRO=humble +ENV AMENT_PREFIX_PATH=/opt/ros/${ROS_DISTRO} +ENV COLCON_PREFIX_PATH=/opt/ros/${ROS_DISTRO} +ENV LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/gazebo-11/plugins:/opt/ros/${ROS_DISTRO}/opt/rviz_ogre_vendor/lib:/opt/ros/${ROS_DISTRO}/lib/x86_64-linux-gnu:/opt/ros/${ROS_DISTRO}/lib:/usr/share/gazebo/../../lib/x86_64-linux-gnu/gazebo-11/plugins: +ENV PATH=/opt/ros/${ROS_DISTRO}/bin:$PATH +ENV PYTHONPATH=/opt/ros/${ROS_DISTRO}/lib/python3.10/site-packages +ENV ROS_PYTHON_VERSION=3 +ENV ROS_VERSION=2 + +# Install common tools +RUN apt-get update && apt-get install -y \ + software-properties-common \ + bash-completion \ + apt-utils \ + build-essential \ + git curl wget cmake \ + nano vim \ + gnupg \ + lsb-release \ + sudo \ + net-tools \ + pciutils \ + && rm -rf /var/lib/apt/lists/* + +# Install ROS2 and ROS packages +RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null \ + && apt-get update && apt-get install -y \ + ros-${ROS_DISTRO}-ros-base \ + ros-${ROS_DISTRO}-xacro \ + ros-${ROS_DISTRO}-joint-state-publisher \ + ros-${ROS_DISTRO}-rviz2 \ + python3-colcon-common-extensions \ + python3-pip python3-rosdep python3-vcstool \ + python3-argcomplete \ + && rosdep init \ + && rm -rf /var/lib/apt/lists/* + +# Install Gazebo 11 +RUN add-apt-repository ppa:openrobotics/gazebo11-gz-cli +RUN apt-get update && apt-get install -y \ + gazebo11 \ + ros-humble-gazebo-ros-pkgs \ + gstreamer1.0-plugins-bad \ + gstreamer1.0-plugins-good \ + gstreamer1.0-plugins-ugly \ + gstreamer1.0-libav \ + libgstreamer-plugins-base1.0-dev \ + libimage-exiftool-perl \ + && apt-get -y autoremove \ + && apt-get clean autoclean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN mkdir ~/.gazebo && touch ~/.gazebo/gui.ini + +# Install Gazebo Harmonic +RUN apt-get update \ + && wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null \ + && apt-get update && apt-get install -y -q \ + gz-harmonic \ + && rm -rf /var/lib/apt/lists/* + +RUN apt-get update && apt-get install -y \ + ros-humble-ros-gzharmonic \ + && rm -rf /var/lib/apt/lists/* + +# Install VNC +# Xorg segfault error mitigation +RUN apt-get update && apt-get install -y --no-install-recommends \ + dbus-x11 \ + libdbus-c++-1-0v5 \ + xvfb xauth xfonts-base xkb-data x11-xkb-utils \ + x11vnc \ + xterm \ + xserver-xorg-video-dummy \ + x11-apps \ + && apt-get -y autoremove \ + && apt-get clean autoclean \ + && rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/* + +RUN wget https://xpra.org/xorg.conf \ + && rm -rf /tmp/* + +# Install noVNC and websockify +RUN git clone -b v1.4.0 https://github.com/novnc/noVNC.git +RUN cd /noVNC/utils && git clone -b v0.11.0 https://github.com/novnc/websockify.git + +# VirtualGL and TurboVNC +COPY ./gpu/virtualgl_${VIRTUALGL_VERSION}_amd64.deb ./gpu/virtualgl32_${VIRTUALGL_VERSION}_amd64.deb ./gpu/turbovnc_${TURBOVNC_VERSION}_amd64.deb / + +RUN dpkg --add-architecture i386 && apt-get update && apt-get install -y \ + libxtst6:i386 \ + libxv1:i386 \ + libglu1-mesa:i386 \ + libegl1-mesa:i386 \ + libegl1-mesa:amd64 + +RUN apt-get update && dpkg -i /virtualgl_${VIRTUALGL_VERSION}_amd64.deb /virtualgl32_${VIRTUALGL_VERSION}_amd64.deb \ + && rm /virtualgl_${VIRTUALGL_VERSION}_amd64.deb /virtualgl32_${VIRTUALGL_VERSION}_amd64.deb \ + && chmod u+s /usr/lib/libvglfaker.so \ + && chmod u+s /usr/lib/libdlfaker.so \ + && chmod u+s /usr/lib32/libvglfaker.so \ + && chmod u+s /usr/lib32/libdlfaker.so \ + && chmod u+s /usr/lib/i386-linux-gnu/libvglfaker.so \ + && chmod u+s /usr/lib/i386-linux-gnu/libdlfaker.so \ + && apt-get update && apt-get install -y --no-install-recommends \ + /turbovnc_${TURBOVNC_VERSION}_amd64.deb \ + && rm turbovnc_${TURBOVNC_VERSION}_amd64.deb \ + && rm -rf /var/lib/apt/lists/* + +RUN apt-get update && \ + apt-get install -y lxde-common && \ + rm -rf /var/lib/apt/lists/* + +ENV PATH="$PATH:/opt/VirtualGL/bin:/opt/TurboVNC/bin" + +# Node +RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - \ + && apt-get install -y nodejs \ + && npm install -g yarn + +# Install Python 3 pip build dependencies first +RUN python3.10 -m pip install --upgrade pip==23.3.1 wheel==0.41.3 setuptools==69.0.2 selenium + +# pip install dependencies +RUN python3.10 -m pip install \ + pylint==3.3.1 transitions==0.9.0 pydantic==2.4.2 websocket-client==1.5.2 \ + argparse==1.4.0 coverage==6.2 cerberus==1.3.4 empy==3.3.4 jinja2==3.0.3 kconfiglib==14.1.0 \ + matplotlib==3.0.* numpy==1.24.3 nunavut==1.1.0 packaging==21.3 pkgconfig==1.5.5 pyros-genmsg==0.5.8 \ + pyulog==1.0.1 pyyaml==5.4.1 requests==2.31.0 serial==0.0.97 six==1.16.0 toml==0.10.2 psutil==5.9.0 \ + onnxruntime==1.15.0 Pillow==9.0.1 opencv-python==4.5.5.64 netron seaborn==0.11.2 watchdog==2.1.5 utm==0.7.0 psycopg2 jedi pyapriltags + +# monaco editor +RUN python3.10 -m pip install black==24.10.0 + +# websocket server dependency +RUN python3.10 -m pip install websocket_server==0.6.4 posix-ipc==1.1.1 django==4.1.7 djangorestframework==3.13.1 \ + django-webpack-loader==1.5.0 django-cors-headers==3.14.0 websockets==11.0.3 asyncio==3.4.3 + + +## Aerostack2 +WORKDIR /root/ + +RUN apt-get update && \ + apt-get install apt-utils -y \ + software-properties-common \ + git \ + tmux \ + tmuxinator \ + python3-rosdep \ + python3-pip \ + python3-colcon-common-extensions \ + python3-colcon-mixin \ + python-is-python3 \ + ros-dev-tools \ + python3-flake8 \ + python3-flake8-builtins \ + python3-flake8-comprehensions \ + python3-flake8-docstrings \ + python3-flake8-import-order \ + python3-flake8-quotes \ + cppcheck \ + lcov \ + lsb-release \ + wget \ + gnupg \ + && rm -rf /var/lib/apt/lists/* + +RUN pip3 install \ + pylint \ + flake8==4.0.1 \ + pycodestyle==2.8 \ + cmakelint \ + cpplint \ + colcon-lcov-result \ + PySimpleGUI-4-foss + +RUN colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml +RUN colcon mixin update default +RUN rm -rf log +# remove log folder +RUN mkdir -p /home/drones_ws/src/ +WORKDIR /home/drones_ws/src/ +RUN git clone https://github.com/aerostack2/aerostack2.git -b robotics-academy-fix +RUN touch aerostack2/as2_hardware_drivers/COLCON_IGNORE +RUN touch aerostack2/as2_behavior_tree/COLCON_IGNORE +RUN touch aerostack2/as2_map_server/COLCON_IGNORE +RUN touch aerostack2/as2_behaviors/as2_behaviors_path_planning/COLCON_IGNORE +RUN touch aerostack2/as2_utilities/as2_geozones/COLCON_IGNORE +RUN touch aerostack2/as2_user_interfaces/as2_visualization/as2_rviz_plugins/COLCON_IGNORE + +WORKDIR /home/drones_ws/ + +RUN apt-get update && \ + apt-get install -y \ + libbenchmark-dev \ + libeigen3-dev \ + libgeographic-dev \ + libncurses-dev \ + libyaml-cpp-dev \ + pybind11-dev \ + python3-jinja2 \ + python3-pydantic \ + python3-pymap3d \ + python3-pytest \ + ros-humble-action-msgs \ + ros-humble-ament-cmake \ + ros-humble-ament-cmake-gtest \ + ros-humble-ament-cmake-lint-cmake \ + ros-humble-ament-cmake-pytest \ + ros-humble-ament-cmake-python \ + ros-humble-ament-cmake-xmllint \ + ros-humble-ament-copyright \ + ros-humble-ament-flake8 \ + ros-humble-ament-index-cpp \ + ros-humble-ament-lint-auto \ + ros-humble-ament-lint-common \ + ros-humble-ament-pep257 \ + ros-humble-backward-ros \ + ros-humble-builtin-interfaces \ + ros-humble-cv-bridge \ + ros-humble-geographic-msgs \ + ros-humble-geometry-msgs \ + ros-humble-image-transport \ + ros-humble-mocap4r2-msgs \ + ros-humble-nav-msgs \ + ros-humble-pluginlib \ + ros-humble-rclcpp \ + ros-humble-rclcpp-action \ + ros-humble-rclcpp-components \ + ros-humble-rclcpp-lifecycle \ + ros-humble-rclpy \ + ros-humble-robot-state-publisher \ + ros-humble-rosidl-default-generators \ + ros-humble-rosidl-default-runtime \ + ros-humble-rviz2 \ + ros-humble-sdformat-urdf \ + ros-humble-sensor-msgs \ + ros-humble-std-msgs \ + ros-humble-std-srvs \ + ros-humble-tf2 \ + ros-humble-tf2-geometry-msgs \ + ros-humble-tf2-msgs \ + ros-humble-tf2-ros \ + ros-humble-trajectory-msgs \ + ros-humble-visualization-msgs \ + ros-humble-moveit \ + ros-humble-ros2-control \ + ros-humble-ros2-controllers \ + ros-humble-gripper-controllers \ + ros-humble-rmw-cyclonedds-cpp \ + ros-humble-ur \ + ros-humble-ros-testing \ + libpoco-dev \ + && rm -rf /var/lib/apt/lists/* + +RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ + colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release + +# Install CycloneDDS RMW for ROS 2 Humble to fix cycle time issues in humble-moveit (temporary fix) +RUN echo 'export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp' >> ~/.bashrc + +# Instalation for industrial robots + +RUN mkdir -p /home/industrial_ws/src/ABBDriver +WORKDIR /home/industrial_ws/src/ABBDriver +RUN git clone https://github.com/PickNikRobotics/abb_ros2.git -b rolling +RUN . /opt/ros/$ROS_DISTRO/setup.sh && rosdep update +RUN vcs import < abb_ros2/abb.repos +RUN . /opt/ros/$ROS_DISTRO/setup.sh && rosdep install -r --from-paths . --ignore-src --rosdistro $ROS_DISTRO -y +WORKDIR /home/industrial_ws/src +RUN git clone https://github.com/ros-controls/gazebo_ros2_control.git +RUN cd gazebo_ros2_control && git reset --hard 9a3736c # Commit for the 0.4.6 version! +RUN git clone https://github.com/IFRA-Cranfield/IFRA_LinkAttacher.git +RUN git clone https://github.com/IFRA-Cranfield/IFRA_ObjectPose.git +RUN git clone https://github.com/IFRA-Cranfield/IFRA_LinkPose.git +RUN git clone https://github.com/IFRA-Cranfield/ros2_RobotiqGripper.git +# Forked needed in order to read the parameters from main launcher +RUN git clone https://github.com/javizqh/ros2_SimRealRobotControl +RUN sudo cp /home/industrial_ws/src/ros2_SimRealRobotControl/include/move_group_interface_improved.h /opt/ros/humble/include/moveit/move_group_interface/move_group_interface_improved.h +WORKDIR /home/industrial_ws +RUN . /opt/ros/$ROS_DISTRO/setup.sh && \ + colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release + +# Create workspace and add drone packages +RUN echo "source /usr/share/gazebo/setup.bash" >> ~/.bashrc +RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> ~/.bashrc +RUN echo 'export AEROSTACK2_PATH=/home/drones_ws/src/aerostack2' >> ~/.bashrc +RUN echo 'source $AEROSTACK2_PATH/as2_cli/setup_env.bash' >> ~/.bashrc +RUN echo "source /home/drones_ws/install/setup.bash" >> ~/.bashrc +RUN echo "source /home/industrial_ws/install/setup.bash" >> ~/.bashrc + +# Download and install OMPL library +COPY install-ompl-ubuntu.sh / +WORKDIR / +RUN chmod u+x install-ompl-ubuntu.sh +RUN ./install-ompl-ubuntu.sh --github --python \ No newline at end of file diff --git a/scripts/VCDI_with_RI/Dockerfile.humble b/scripts/VCDI_with_RI/Dockerfile.humble new file mode 100644 index 00000000..dec51660 --- /dev/null +++ b/scripts/VCDI_with_RI/Dockerfile.humble @@ -0,0 +1,72 @@ +FROM jderobot/robotics-applications:dependencies-humble + +WORKDIR / + +# RoboticsInfrasctructure Repository +ARG ROBOTICS_INFRASTRUCTURE=$ROBOTICS_INFRASTRUCTURE +RUN mkdir -p /opt/jderobot && \ + git clone --depth 1 https://github.com/JdeRobot/RoboticsInfrastructure.git -b $ROBOTICS_INFRASTRUCTURE /opt/jderobot + +# create workspace and add Robot packages +RUN mkdir -p /home/ws/src +RUN mv /opt/jderobot/CustomRobots /opt/jderobot/jderobot_drones /home/ws/src/ +RUN mv /opt/jderobot/resources /resources + +ARG IMAGE_TAG +ENV IMAGE_TAG=${IMAGE_TAG} + +# Clone the RoboticsApplicationManager repository into the src folder inside RoboticsAcademy +ARG RAM=$RAM +RUN git clone https://github.com/JdeRobot/RoboticsApplicationManager.git -b $RAM /RoboticsApplicationManager + +# copy scripts +RUN mv -t / /opt/jderobot/scripts/.env /opt/jderobot/scripts/entrypoint.sh /opt/jderobot/scripts/start_vnc.sh /opt/jderobot/scripts/start_vnc_gpu.sh /opt/jderobot/scripts/kill_all.sh /opt/jderobot/scripts/test/check_device.py /opt/jderobot/scripts/set_dri_name.sh + +# give execution permissions +WORKDIR / +RUN chmod +x /start_vnc.sh /kill_all.sh /entrypoint.sh /start_vnc_gpu.sh /set_dri_name.sh + +# Bt-Studio +ARG VISUAL_CIRCUIT=$VISUAL_CIRCUIT +RUN git clone --depth 1 https://github.com/JdeRobot/VisualCircuit.git -b $VISUAL_CIRCUIT + +# Compiling and sourcing the workspace +WORKDIR /home/ws +RUN /bin/bash -c "source /home/drones_ws/install/setup.bash" +RUN /bin/bash -c "source /home/industrial_ws/install/setup.bash" +RUN /bin/bash -c "source /opt/ros/humble/setup.bash; colcon build --symlink-install" + +WORKDIR /VisualCircuit/frontend +RUN npm install --legacy-peer-deps + + +WORKDIR /VisualCircuit/backend +RUN pip install --upgrade pip && pip install -r requirements.txt + +RUN echo "DJANGO_DEBUG=true" >> /VisualCircuit/backend/.env && \ + echo "VISUAL_CIRCUIT_FRONTEND_HOST='http://localhost:4000'" >> /VisualCircuit/backend/.env && \ + echo "DJANGO_ALLOWED_HOSTS=localhost,127.0.0.1" >> /VisualCircuit/backend/.env && \ + echo "DJANGO_SECRET_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" >> /VisualCircuit/backend/.env + +# Collect static files +RUN python manage.py collectstatic + +WORKDIR /VisualCircuit +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +# Django server +EXPOSE 7164 + +# Manager websocket +EXPOSE 7163 + +# noVNC Console +EXPOSE 1108 + +# noVNC Gazebo +EXPOSE 6080 + +EXPOSE 4000 8080 + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/scripts/VCDI_with_RI/build.sh b/scripts/VCDI_with_RI/build.sh new file mode 100755 index 00000000..561269aa --- /dev/null +++ b/scripts/VCDI_with_RI/build.sh @@ -0,0 +1,124 @@ +#!/bin/bash + +# Default branch if not specified +VISUAL_CIRCUIT="master" +ROBOTICS_INFRASTRUCTURE="humble-devel" +RAM="humble-devel" +ROS_DISTRO="humble" +IMAGE_TAG="latest" +FORCE_BUILD=false +FORCE_BUILD_NO_CACHE=false + +Help() +{ + # Display Help + echo "Syntax: build.sh [options]" + echo "Options:" + echo " -h Print this Help." + echo " -f Force creation of the base image. If omitted, the base image is created only if " + echo " it doesn't exist." + echo " -F Force creation of the base image without using docker cache." + echo " -vc,--visual-circuit Branch of Visual Circuit. Default: master" + echo " -i, --infra Branch of RoboticsInfrastructure. Default: humble-devel" + echo " -m, --ram Branch of RoboticsApplicationManager. Default: humble-devel" + echo " -r, --ros ROS Distro (humble or noetic). Default: humble" + echo " -t, --tag Tag name of the image. Default: test" + echo + echo "Example:" + echo " ./build.sh -t my_image" + echo " ./build.sh -f -a master -i noetic-devel -m main -r noetic -t my_image" + echo " ./build.sh -f --academy master --infra noetic-devel --ram main --ros noetic --tag my_image" + echo +} + +while [[ $# -gt 0 ]]; do + case "$1" in + -vc | --visual-circuit) + VISUAL_CIRCUIT="$2" + shift 2 + ;; + -i | --infra) + ROBOTICS_INFRASTRUCTURE="$2" + shift 2 + ;; + -m | --ram) + RAM="$2" + shift 2 + ;; + -r | --ros) + ROS_DISTRO="$2" + shift 2 + ;; + -t | --tag) + IMAGE_TAG="$2" + shift 2 + ;; + -f | --force) + FORCE_BUILD=true + shift + ;; + -F | --force-no-cache) + FORCE_BUILD_NO_CACHE=true + shift + ;; + -h | --help) # display Help + echo "Generates Visual Circuit image" + echo + Help + exit 0 + ;; + *) + echo "Invalid Option: $1" + Help + exit 1 + ;; + esac +done + +echo "VISUAL_CIRCUIT:-------------:$VISUAL_CIRCUIT" +echo "ROBOTICS_INFRASTRUCTURE:------:$ROBOTICS_INFRASTRUCTURE" +echo "RAM:--------------------------:$RAM" +echo "ROS_DISTRO:-------------------:$ROS_DISTRO" +echo "IMAGE_TAG:--------------------:$IMAGE_TAG" +echo + +# Determine Dockerfile based on ROS_DISTRO +if [[ $ROS_DISTRO == "humble" ]]; then + DOCKERFILE_BASE="Dockerfile.dependencies_humble" + DOCKERFILE="Dockerfile.humble" +else + echo "Error: Unknown ROS_DISTRO ($ROS_DISTRO). Please set it to 'noetic' or 'humble'." + exit 1 +fi + +if $FORCE_BUILD_NO_CACHE; then + NO_CACHE="--no-cache" +else + NO_CACHE="" +fi + +# Build the Docker Base image +if $FORCE_BUILD_NO_CACHE || $FORCE_BUILD || [[ "$(docker images -q jderobot/robotics-applications:dependencies-$ROS_DISTRO 2> /dev/null)" == "" ]]; then + echo "===================== BUILDING $ROS_DISTRO BASE IMAGE =====================" + echo "Building base using $DOCKERFILE_BASE for ROS $ROS_DISTRO" + docker build $NO_CACHE -f $DOCKERFILE_BASE -t jderobot/robotics-applications:dependencies-$ROS_DISTRO . +fi + +if [ $? -eq 0 ]; then + echo "Docker Base Image Build Successful" +else + echo "Docker Base Image Build FAILED...exiting" + exit +fi + +# Build the Docker image +echo "===================== BUILDING $ROS_DISTRO RoboticsBackend =====================" +echo "Building RoboticsBackend using $DOCKERFILE for ROS $ROS_DISTRO" + +docker build --no-cache -f $DOCKERFILE \ + --build-arg VISUAL_CIRCUIT=$VISUAL_CIRCUIT \ + --build-arg ROBOTICS_INFRASTRUCTURE=$ROBOTICS_INFRASTRUCTURE \ + --build-arg RAM=$RAM \ + --build-arg ROS_DISTRO=$ROS_DISTRO \ + --build-arg IMAGE_TAG=$IMAGE_TAG \ + -t jderobot/visual-circuit:$IMAGE_TAG . \ No newline at end of file diff --git a/scripts/VCDI_with_RI/entrypoint.sh b/scripts/VCDI_with_RI/entrypoint.sh new file mode 100644 index 00000000..2e8eccc2 --- /dev/null +++ b/scripts/VCDI_with_RI/entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +echo "Starting backend server on port 8080..." +cd /VisualCircuit/backend +python3 manage.py migrate || true +python3 manage.py runserver 0.0.0.0:8080 & + +echo "Starting frontend server on port 4000..." +cd /VisualCircuit/frontend +npm start diff --git a/scripts/VCDI_with_RI/gpu/turbovnc_3.0.3_amd64.deb b/scripts/VCDI_with_RI/gpu/turbovnc_3.0.3_amd64.deb new file mode 100755 index 00000000..579a8f3b Binary files /dev/null and b/scripts/VCDI_with_RI/gpu/turbovnc_3.0.3_amd64.deb differ diff --git a/scripts/VCDI_with_RI/gpu/virtualgl32_3.0.2_amd64.deb b/scripts/VCDI_with_RI/gpu/virtualgl32_3.0.2_amd64.deb new file mode 100755 index 00000000..44094705 Binary files /dev/null and b/scripts/VCDI_with_RI/gpu/virtualgl32_3.0.2_amd64.deb differ diff --git a/scripts/VCDI_with_RI/gpu/virtualgl_3.0.2_amd64.deb b/scripts/VCDI_with_RI/gpu/virtualgl_3.0.2_amd64.deb new file mode 100755 index 00000000..06f6f2b9 Binary files /dev/null and b/scripts/VCDI_with_RI/gpu/virtualgl_3.0.2_amd64.deb differ diff --git a/scripts/VCDI_with_RI/install-ompl-ubuntu.sh b/scripts/VCDI_with_RI/install-ompl-ubuntu.sh new file mode 100644 index 00000000..7da8f8fe --- /dev/null +++ b/scripts/VCDI_with_RI/install-ompl-ubuntu.sh @@ -0,0 +1,141 @@ +#!/bin/bash + +set -e + +if [ `id -u` == 0 ]; then + SUDO= + export DEBIAN_FRONTEND=noninteractive + apt-get -y install lsb-release +else + SUDO="sudo -H" +fi + +ubuntu_version=`lsb_release -rs | sed 's/\.//'` + +install_common_dependencies() +{ + # install most dependencies via apt-get + ${SUDO} apt-get -y update + ${SUDO} apt-get -y upgrade + # We explicitly set the C++ compiler to g++, the default GNU g++ compiler. This is + # needed because we depend on system-installed libraries built with g++ and linked + # against libstdc++. In case `c++` corresponds to `clang++`, code will not build, even + # if we would pass the flag `-stdlib=libstdc++` to `clang++`. + ${SUDO} apt-get -y install g++ cmake pkg-config libboost-serialization-dev libboost-filesystem-dev libboost-system-dev libboost-program-options-dev libboost-test-dev libeigen3-dev libode-dev wget libyaml-cpp-dev + export CXX=g++ + export MAKEFLAGS="-j `nproc`" +} + +install_python_binding_dependencies() +{ + ${SUDO} apt-get -y install python${PYTHONV}-dev python${PYTHONV}-pip + # install additional python dependencies via pip + ${SUDO} pip${PYTHONV} install -vU https://github.com/CastXML/pygccxml/archive/develop.zip pyplusplus + # install castxml + if [[ $ubuntu_version > 1910 ]]; then + ${SUDO} apt-get -y install castxml + else + wget -q -O- https://data.kitware.com/api/v1/file/5e8b740d2660cbefba944189/download | tar zxf - -C ${HOME} + export PATH=${HOME}/castxml/bin:${PATH} + fi + ${SUDO} apt-get -y install libboost-python-dev + if [[ $ubuntu_version > 1710 ]]; then + ${SUDO} apt-get -y install libboost-numpy-dev python${PYTHONV}-numpy + fi + if [[ $ubuntu_version > 1904 ]]; then + ${SUDO} apt-get -y install pypy3 + fi +} + +install_app_dependencies() +{ + ${SUDO} apt-get -y install python${PYTHONV}-pyqt5.qtopengl freeglut3-dev libassimp-dev python${PYTHONV}-opengl python${PYTHONV}-flask python${PYTHONV}-celery libccd-dev + # install additional python dependencies via pip + ${SUDO} pip${PYTHONV} install -vU PyOpenGL-accelerate + # install fcl + if ! pkg-config --atleast-version=0.5.0 fcl; then + if [[ $ubuntu_version > 1604 ]]; then + ${SUDO} apt-get -y install libfcl-dev + else + wget -O - https://github.com/flexible-collision-library/fcl/archive/0.6.1.tar.gz | tar zxf - + cd fcl-0.6.1; cmake .; ${SUDO} -E make install; cd .. + fi + fi +} + +install_ompl() +{ + if [ -z $APP ]; then + OMPL="ompl" + else + OMPL="omplapp" + fi + if [ -z $GITHUB ]; then + if [ -z $APP]; then + wget -O - https://github.com/ompl/${OMPL}/archive/1.6.0.tar.gz | tar zxf - + cd ${OMPL}-1.6.0 + else + wget -O - https://github.com/ompl/${OMPL}/releases/download/1.6.0/${OMPL}-1.6.0-Source.tar.gz | tar zxf - + cd $OMPL-1.6.0-Source + fi + else + ${SUDO} apt-get -y install git + git clone --recurse-submodules https://github.com/ompl/${OMPL}.git + cd $OMPL + fi + mkdir -p build/Release + cd build/Release + cmake ../.. -DPYTHON_EXEC=/usr/bin/python${PYTHONV} + if [ ! -z $PYTHON ]; then + # Check if the total memory is less than 6GB. + if [ `cat /proc/meminfo | head -1 | awk '{print $2}'` -lt 6291456 ]; then + echo "Python binding generation is very memory intensive. At least 6GB of RAM is recommended." + echo "Proceeding with binding generation using 1 core..." + make -j 1 update_bindings + else + make update_bindings + fi + fi + make + ${SUDO} make install +} + +for i in "$@" +do +case $i in + -a|--app) + APP=1 + PYTHON=1 + shift + ;; + -p|--python) + PYTHON=1 + shift + ;; + -g|--github) + GITHUB=1 + shift + ;; + *) + # unknown option -> show help + echo "Usage: `basename $0` [-p] [-a]" + echo " -p: enable Python bindings" + echo " -a: enable OMPL.app (implies '-p')" + echo " -g: install latest commit from main branch on GitHub" + ;; +esac +done + +# the default version of Python in 17.10 and above is version 3 +if [[ $ubuntu_version > 1704 ]]; then + PYTHONV=3 +fi + +install_common_dependencies +if [ ! -z $PYTHON ]; then + install_python_binding_dependencies +fi +if [ ! -z $APP ]; then + install_app_dependencies +fi +install_ompl \ No newline at end of file