Skip to content

Commit

Permalink
Separate dev (#17)
Browse files Browse the repository at this point in the history
* work towards cyclone

* ignore stuff in .local

* install all

* disable PR build for arm

* set up ros better
  • Loading branch information
marc-hanheide authored Feb 13, 2024
1 parent d56e10c commit 0a7a30f
Show file tree
Hide file tree
Showing 10 changed files with 207 additions and 100 deletions.
24 changes: 23 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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 &&\
Expand Down Expand Up @@ -86,12 +97,23 @@ 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

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
29 changes: 0 additions & 29 deletions .devcontainer/dds.repos

This file was deleted.

55 changes: 0 additions & 55 deletions .devcontainer/devcontainer.json

This file was deleted.

14 changes: 7 additions & 7 deletions .devcontainer/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

5 changes: 5 additions & 0 deletions .devcontainer/lcas.repos
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repositories:
limo_ros2:
type: git
url: https://github.com/LCAS/limo_ros2.git
version: humble
64 changes: 64 additions & 0 deletions .devcontainer/on_amd64/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
}
64 changes: 64 additions & 0 deletions .devcontainer/on_limo/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
}
46 changes: 40 additions & 6 deletions .devcontainer/setup-router.sh
Original file line number Diff line number Diff line change
@@ -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
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
<?xml version="1.0" encoding="UTF-8" ?>
<CycloneDDS xmlns="https://cdds.io/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://cdds.io/config https://raw.githubusercontent.com/eclipse-cyclonedds/cyclonedds/master/etc/cyclonedds.xsd">
<Domain id="0">
<General>
<AllowMulticast>false</AllowMulticast>
<MaxMessageSize>65500B</MaxMessageSize>
<FragmentSize>4000B</FragmentSize>
<Transport>udp</Transport>
</General>
<Discovery>
<Peers>
<Peer address="localhost"/>
<Peer address="`hostname`"/>
<!--<Peer address="[IPV6-address]"/>-->
</Peers>
<ParticipantIndex>auto</ParticipantIndex>
</Discovery>
<Internal>
<Watermarks>
<WhcHigh>500kB</WhcHigh>
</Watermarks>
</Internal>
<Tracing>
<Verbosity>info</Verbosity>
<OutputFile>stdout</OutputFile>
</Tracing>
</Domain>
</CycloneDDS>
EOM

export CYCLONEDDS_URI
2 changes: 1 addition & 1 deletion .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -298,4 +298,6 @@ dmypy.json
# Cython debug symbols
cython_debug/

!src/**
!src/**

.local

0 comments on commit 0a7a30f

Please sign in to comment.