diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index f1bfc1aa..8c3af69e 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -5,6 +5,9 @@ ENV DEBIAN_FRONTEND=noninteractive RUN useradd -ms /bin/bash ros && echo "ros:ros" | chpasswd && adduser ros sudo RUN adduser ros video # Builder dependencies installation + +RUN echo "deb [trusted=yes] https://download.eclipse.org/zenoh/debian-repo/ /" | tee -a /etc/apt/sources.list + RUN apt-get update \ && apt-get install -qq -y --no-install-recommends \ build-essential \ @@ -51,8 +54,16 @@ RUN apt-get update \ libssl-dev \ python3-sphinx \ libyaml-cpp-dev \ + sudo \ + ros-humble-cyclonedds \ + ros-humble-zenoh-bridge-dds \ + llvm-dev libclang-dev \ + python3-rosdep \ && rm -rf /var/lib/apt/lists/* +# add sudo without password +RUN echo "ALL ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers + RUN git clone https://github.com/YDLIDAR/YDLidar-SDK.git &&\ mkdir -p YDLidar-SDK/build && \ cd YDLidar-SDK/build &&\ @@ -86,6 +97,16 @@ RUN git clone https://github.com/libuvc/libuvc.git &&\ sudo ldconfig &&\ cd ../.. && rm -r libuvc* + +RUN mkdir -p /opt/lcas/extensions +WORKDIR /opt/lcas/extensions +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +RUN git clone https://github.com/eclipse-zenoh/zenoh-plugin-ros2dds.git +WORKDIR /opt/lcas/extensions/zenoh-plugin-ros2dds +RUN bash -c "source '$HOME/.cargo/env'; cargo build --release -p zenoh-bridge-ros2dds" +RUN install target/release/zenoh-bridge-ros2dds /usr/local/bin/ +WORKDIR / + ENV NVIDIA_VISIBLE_DEVICES all ENV NVIDIA_DRIVER_CAPABILITIES graphics,utility,compute ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp @@ -93,5 +114,6 @@ ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp COPY *repos *.sh /tmp/.devcontainer/ RUN bash /tmp/.devcontainer/install.sh +RUN echo "source /opt/ros/humble/setup.bash" >> /etc/bash.bashrc +RUN cat /tmp/.devcontainer/setup-router.sh >> /etc/bash.bashrc -RUN echo "source /opt/ros/humble/setup.bash" >> /etc/bash.bashrc \ No newline at end of file diff --git a/.devcontainer/dds.repos b/.devcontainer/dds.repos deleted file mode 100644 index c697510a..00000000 --- a/.devcontainer/dds.repos +++ /dev/null @@ -1,29 +0,0 @@ -repositories: - foonathan_memory_vendor: - type: git - url: https://github.com/eProsima/foonathan_memory_vendor.git - version: v1.3.1 - fastcdr: - type: git - url: https://github.com/eProsima/Fast-CDR.git - version: v1.1.0 - fastdds: - type: git - url: https://github.com/eProsima/Fast-DDS.git - version: v2.11.2 - dev-utils: - type: git - url: https://github.com/eProsima/dev-utils.git - version: v0.4.0 - ddspipe: - type: git - url: https://github.com/eProsima/DDS-Pipe.git - version: v0.2.0 - ddsrouter: - type: git - url: https://github.com/eProsima/DDS-Router.git - version: v2.0.0 - googletest-distribution: - type: git - url: https://github.com/google/googletest.git - version: release-1.11.0 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index 7bc76646..00000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,55 +0,0 @@ -// https://github.com/athackst/vscode_ros2_workspace -// See https://aka.ms/vscode-remote/devcontainer.json for format details. -{ - // Use "dockerFile tag to build container using Dockerfile, or image tag to build using prebuilt image - // "dockerFile": "Dockerfile", - "image": "westonrobot/limo_ros:humble_22082023", - "build": { - "args": { - "WORKSPACE": "${containerWorkspaceFolder}" - } - }, - "remoteUser": "ros", - "runArgs": [ - "--network=host", - "-v=/dev:/dev", - "--privileged", - "--runtime=nvidia", - "--device-cgroup-rule" "a *:* rmw", - "--cap-add=SYS_PTRACE", - "--security-opt=seccomp:unconfined", - "--security-opt=apparmor:unconfined", - "--volume=/tmp/.X11-unix:/tmp/.X11-unix", - "--volume=/home/agilex/.Xauthority:/home/ros/.Xauthority", - "--gpus=all" - ], - "containerEnv": { - "DISPLAY": ":0", - "ROS_LOCALHOST_ONLY": "0", - "LIBGL_ALWAYS_SOFTWARE": "1" // Needed for software rendering of opengl - }, - - // Set *default* container specific settings.json values on container create. - "settings": { - "terminal.integrated.profiles.linux": { - "bash": { - "path": "bash" - }, - }, - "terminal.integrated.defaultProfile.linux": "bash" - }, - // VSCode Extensions - "extensions": [ - "dotjoshjohnson.xml", - "zachflower.uncrustify", - "ms-azuretools.vscode-docker", - "ms-iot.vscode-ros", - "ms-python.python", - "ms-vscode.cpptools", - "redhat.vscode-yaml", - "smilerobotics.urdf", - "streetsidesoftware.code-spell-checker", - "twxs.cmake", - "yzhang.markdown-all-in-one" - ] -} \ No newline at end of file diff --git a/.devcontainer/install.sh b/.devcontainer/install.sh index c9751911..6472dafb 100644 --- a/.devcontainer/install.sh +++ b/.devcontainer/install.sh @@ -3,21 +3,21 @@ set -e source /opt/ros/humble/setup.bash -#apt update -#rosdep --rosdistro=humble update +apt update +rosdep init +rosdep --rosdistro=humble update + pip install -U argcomplete rm -rf /opt/ros/lcas mkdir -p /opt/ros/lcas/src cd /opt/ros/lcas/src -vcs import < /tmp/.devcontainer/dds.repos -#rosdep install --from-paths . -r -i -y +vcs import < /tmp/.devcontainer/lcas.repos +rosdep install --from-paths . -r -i -y cd /opt/ros/lcas colcon build -colcon build --packages-select ddsrouter_core --cmake-args -DLOG_INFO=ON - #cd /home/lcas/ws #colcon build -echo "source /opt/ros/lcas/install/setup.bash" >> ~/.bashrc +echo "source /opt/ros/lcas/install/setup.bash" >> /etc/bash.bashrc diff --git a/.devcontainer/lcas.repos b/.devcontainer/lcas.repos new file mode 100644 index 00000000..353eae74 --- /dev/null +++ b/.devcontainer/lcas.repos @@ -0,0 +1,5 @@ +repositories: + limo_ros2: + type: git + url: https://github.com/LCAS/limo_ros2.git + version: humble diff --git a/.devcontainer/on_amd64/devcontainer.json b/.devcontainer/on_amd64/devcontainer.json new file mode 100644 index 00000000..b4f7f234 --- /dev/null +++ b/.devcontainer/on_amd64/devcontainer.json @@ -0,0 +1,64 @@ +// https://github.com/athackst/vscode_ros2_workspace +// See https://aka.ms/vscode-remote/devcontainer.json for format details. +{ + // Use "dockerFile tag to build container using Dockerfile, or image tag to build using prebuilt image + // "dockerFile": "Dockerfile", + //"image": "westonrobot/limo_ros:humble_22082023", + "name": "limo_ros2", + + "build": { + "dockerfile": "../Dockerfile", + "context": "..", + "args": { + "WORKSPACE": "${containerWorkspaceFolder}" + } + }, + "image": "lcas.lincoln.ac.uk/lcas/limo_ros_amd64:humble", + "remoteUser": "ros", + "runArgs": [ + // "--network=host", + // "-v=/dev:/dev", + // "--privileged", + "--runtime=nvidia", + // "--device-cgroup-rule" "a *:* rmw", + "--cap-add=SYS_PTRACE", + "--security-opt=seccomp:unconfined", + "--security-opt=apparmor:unconfined", + "--volume=/tmp/.X11-unix:/tmp/.X11-unix", + "--volume=/home/agilex/.Xauthority:/home/ros/.Xauthority", + "--gpus=all" + ], + "containerEnv": { + "DISPLAY": ":0", + "ROS_LOCALHOST_ONLY": "0", + "LIBGL_ALWAYS_SOFTWARE": "1" // Needed for software rendering of opengl + }, + + // Set *default* container specific settings.json values on container create. + "customizations": { + "vscode": { + "settings": { + "terminal.integrated.profiles.linux": { + "bash": { + "path": "bash" + }, + }, + "terminal.integrated.defaultProfile.linux": "bash" + }, + // VSCode Extensions + "extensions": [ + "dotjoshjohnson.xml", + "zachflower.uncrustify", + "ms-azuretools.vscode-docker", + "ms-iot.vscode-ros", + "ms-python.python", + "ms-vscode.cpptools", + "redhat.vscode-yaml", + "smilerobotics.urdf", + "streetsidesoftware.code-spell-checker", + "twxs.cmake", + "yzhang.markdown-all-in-one" + ] + } + } +} \ No newline at end of file diff --git a/.devcontainer/on_limo/devcontainer.json b/.devcontainer/on_limo/devcontainer.json new file mode 100644 index 00000000..0cbe6394 --- /dev/null +++ b/.devcontainer/on_limo/devcontainer.json @@ -0,0 +1,64 @@ +// https://github.com/athackst/vscode_ros2_workspace +// See https://aka.ms/vscode-remote/devcontainer.json for format details. +{ + // Use "dockerFile tag to build container using Dockerfile, or image tag to build using prebuilt image + // "dockerFile": "Dockerfile", + //"image": "westonrobot/limo_ros:humble_22082023", + "name": "limo_ros2_arm", + + // "build": { + // "dockerfile": "../Dockerfile", + // "context": "..", + // "args": { + // "WORKSPACE": "${containerWorkspaceFolder}" + // } + // }, + "image": "lcas.lincoln.ac.uk/lcas/limo_ros_arm64:humble", + "remoteUser": "ros", + "runArgs": [ + "--network=host", + "-v=/dev:/dev", + "--privileged", + "--runtime=nvidia", + "--device-cgroup-rule=a *:* rmw", + "--cap-add=SYS_PTRACE", + "--security-opt=seccomp:unconfined", + "--security-opt=apparmor:unconfined", + "--volume=/tmp/.X11-unix:/tmp/.X11-unix", + "--volume=/home/agilex/.Xauthority:/home/ros/.Xauthority", + "--gpus=all" + ], + "containerEnv": { + "DISPLAY": ":0", + "ROS_LOCALHOST_ONLY": "0", + "LIBGL_ALWAYS_SOFTWARE": "1" // Needed for software rendering of opengl + }, + + // Set *default* container specific settings.json values on container create. + "customizations": { + "vscode": { + "settings": { + "terminal.integrated.profiles.linux": { + "bash": { + "path": "bash" + }, + }, + "terminal.integrated.defaultProfile.linux": "bash" + }, + // VSCode Extensions + "extensions": [ + "dotjoshjohnson.xml", + "zachflower.uncrustify", + "ms-azuretools.vscode-docker", + "ms-iot.vscode-ros", + "ms-python.python", + "ms-vscode.cpptools", + "redhat.vscode-yaml", + "smilerobotics.urdf", + "streetsidesoftware.code-spell-checker", + "twxs.cmake", + "yzhang.markdown-all-in-one" + ] + } + } +} \ No newline at end of file diff --git a/.devcontainer/setup-router.sh b/.devcontainer/setup-router.sh index 90253b21..d9320371 100644 --- a/.devcontainer/setup-router.sh +++ b/.devcontainer/setup-router.sh @@ -1,9 +1,43 @@ -source /opt/ros/lcas/install/setup.bash -source /workspaces/limo_ros2/install/setup.bash +#source /opt/ros/lcas/install/setup.bash +#source /workspaces/limo_ros2/install/setup.bash unset RMW_IMPLEMENTATION unset ROS_LOCALHOST_ONLY -export FASTRTPS_DEFAULT_PROFILES_FILE=/workspaces/limo_ros2/.devcontainer/super_client_configuration_file.xml -export ROS_DISCOVERY_SERVER=localhost:11888 -unset ROS_DISCOVERY_SERVER -unset FASTRTPS_DEFAULT_PROFILES_FILE \ No newline at end of file +RMW_IMPLEMENTATION=rmw_cyclonedds_cpp + +#export FASTRTPS_DEFAULT_PROFILES_FILE=/workspaces/limo_ros2/.devcontainer/super_client_configuration_file.xml +#export ROS_DISCOVERY_SERVER=localhost:11888 + + +read -r -d '' CYCLONEDDS_URI << EOM + + + + + false + 65500B + 4000B + udp + + + + + + + + auto + + + + 500kB + + + + info + stdout + + + +EOM + +export CYCLONEDDS_URI diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 5687ac5a..14615f0a 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -74,7 +74,7 @@ jobs: uses: docker/setup-qemu-action@v3 - name: Build and push limo_ros2 for arm64 # only build for arm if not PR to speed things up - #if: ${{ github.event_name != 'pull_request' }} + if: ${{ github.event_name != 'pull_request' }} uses: docker/build-push-action@v5 with: context: .devcontainer diff --git a/.gitignore b/.gitignore index 7a2e3a9e..210cc539 100644 --- a/.gitignore +++ b/.gitignore @@ -298,4 +298,6 @@ dmypy.json # Cython debug symbols cython_debug/ -!src/** \ No newline at end of file +!src/** + +.local \ No newline at end of file