Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 29 additions & 17 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
FROM --platform=linux/amd64 althack/ros2:humble-full

# ** [Optional] Uncomment this section to install additional packages. **
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get -y install --no-install-recommends \
python3-pip \
python3.10-venv \
ros-${ROS_DISTRO}-rclpy \
ros-${ROS_DISTRO}-ur \
ros-${ROS_DISTRO}-moveit\
build-essential \
python3-colcon-common-extensions \
libopencv-dev \
python3-opencv \
# Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

&& apt-get -y install --no-install-recommends \
python3-pip \
python3.10-venv \
ros-${ROS_DISTRO}-rclpy \
ros-${ROS_DISTRO}-ur \
ros-${ROS_DISTRO}-moveit\
build-essential \
python3-colcon-common-extensions \
libopencv-dev \
python3-opencv \
# Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
ENV DEBIAN_FRONTEND=dialog

# Set up auto-source of workspace for ros user
Expand All @@ -30,5 +28,19 @@ RUN curl -fsSL https://pixi.sh/install.sh | sh
RUN echo 'export PATH="/home/ros/.pixi/bin:$PATH"' >> /home/ros/.bashrc
RUN echo 'eval "$(pixi completion --shell bash)"' >> /home/ros/.bashrc

# Bring the default user back to root for unit test or other admin tasks
# Copy entire repo and run setup script
USER root
WORKDIR ${WORKSPACE}
COPY . .

# Run setup script to install dependencies
RUN chmod +x setup.sh && \
sed -i 's/sudo //g' setup.sh && \
./setup.sh && \
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*

# Bring the default user back to root for unit test or other admin tasks
WORKDIR ${WORKSPACE}
USER root
49 changes: 49 additions & 0 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build and Push Docker Image to GHCR
on:
push:
tags:
- 'v*'
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./.devcontainer/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
4 changes: 2 additions & 2 deletions .github/workflows/ros.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: ROS C++ Testing and Linting

on:
push:
branches: [main, humble]
branches: [main, humble, feature/*]
pull_request:
branches: [main, humble]
branches: [main, humble, feature/*]
workflow_dispatch:

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Check Code Style - Ruff

on:
push:
branches: [main, humble]
branches: [main, humble, feature/*]
pull_request:
branches: [main, humble]
branches: [main, humble, feature/*]
workflow_dispatch:

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ name: Lint Code Base (Super-Linter)

on:
push:
branches: [main, humble]
branches: [main, humble, feature/*]
pull_request:
branches: [main, humble]
branches: [main, humble, feature/*]
jobs:
run-lint:
runs-on: ubuntu-latest
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ log
site
erobs.code-workspace

# Packages being handled by vcs
src/end_effectors/pipettor
src/end_effectors/robotiq_hande
src/end_effectors/ros2_epick_gripper
src/end_effectors/serial

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
75 changes: 59 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Extensible Robotic Beamline Scientist

Project repository for building extensible robotic beamline scientists at NSLS-II.
Project repository for building extensible robotic beamline scientists at NSLS-II. ROS 2 Humble with Ubuntu 22.04 LTS

## Contents

Expand Down Expand Up @@ -31,33 +31,76 @@ Each manifest in the [docker](./docker) directory is a container image that can

### Docker Contents

We use Podman throughout this work, but have named the container images with Docker in mind.
**⚠️ The `docker/` directory and `scripts/pdf-launch-scripts/` are DEPRECATED. See below for the active deployment workflow.**

- [erobs-common-img](./docker/erobs-common-img): Common container image for running the majority of applications herein, including: UR robot driver, gripper service, MoveIt service, and the pdf_beamtime_server (primary `Action` server).
- [bsui](./docker/bsui): Container image for running the Bluesky User Interface with mounts at NSLS-II.
- [azure-kinect](./docker/azure-kinect): Container image for running the Azure Kinect ROS2 driver.
- Other auxiliary container images that are not used in the main application, but are useful for development and testing:
- [ursim](./docker/ursim): Container image for running a simulated UR3e robot arm with a teach pendant.
- [ur-driver](./docker/ur-driver): Container image for running the UR3e robot arm ROS2 driver.
- [ur-moveit](./docker/ur-moveit): Container image for running MoveIt with the UR3e robot arm.
- [ur-example](./docker/ur-example): Container image for running a simple action with the UR3e robot arm.
- [erobs-hello-moveit](./docker/erobs-hello-moveit): Container image for running a simple action with the UR3e robot arm.
#### Active Deployment Workflow

For development and deployment

- **Development**: Use [.devcontainer/Dockerfile](./.devcontainer/Dockerfile) with VSCode devcontainer for local development
- **CI/CD**: Automated builds via [.github/workflows/docker-build.yaml](./.github/workflows/docker-build.yaml)
- Push a version tag to trigger automatic build and publish to GitHub Container Registry (GHCR)
- **Deployment**: Pull the unified container image from GHCR at `ghcr.io/<your-org>/<your-repo>:latest`
- All dependencies are pre-installed (no apt install required at deployment)
- Launch ROS2 nodes using `ros2 launch` commands directly from the container

#### Deprecated Docker Contents (For Reference Only)

The following directories contain legacy container configurations and are **no longer maintained**:

- [docker/](./docker/): Legacy multi-container Dockerfiles - See [docker/DEPRECATED.md](./docker/DEPRECATED.md)
- [scripts/pdf-launch-scripts/](./scripts/pdf-launch-scripts/): Legacy deployment scripts referencing gatekept GHCR images - See [scripts/pdf-launch-scripts/DEPRECATED.md](./scripts/pdf-launch-scripts/DEPRECATED.md)

These can be used for learning purposes but should not be used for active development or deployment.

### Hello Moveit

Demonstrations using a combination of the MoveIt tutorials and some UR specific tools, to show how to make simple actions
that can deploy MoveIt using the MoveGroupInterface.
Demonstrations using a combination of the MoveIt tutorials and some UR specific tools, to show how to make simple actions that can deploy MoveIt using the MoveGroupInterface.

### Bluesky ROS

Ongoing developments of integrating ROS2 and Bluesky. Currently targeted towards integrating Ophyd Objects as ROS2 Action Clients.

## Using Containers to Run the Full Applicaiton Suite
## Development Setup

### Local Development with VSCode

1. Install VSCode with the Remote-Containers extension
2. Open this repository in VSCode
3. VSCode will prompt to "Reopen in Container" - accept this
4. The devcontainer will automatically build using `.devcontainer/Dockerfile`
5. Once inside the container, build the workspace:
```bash
colcon build --symlink-install
source install/setup.bash
```

### Deployment

For production deployment:

1. **Automated Build**: Push a version tag to trigger GitHub Actions
```bash
git tag v1.0.0
git push origin v1.0.0
```

2. **Pull from GHCR**: On your deployment machine
```bash
podman pull ghcr.io/<your-org>/<your-repo>:latest
```

3. **Run containers**: Launch ROS2 nodes with appropriate environment variables
```bash
podman run -it --network host --ipc=host \
--env ROS_DOMAIN_ID=10 \
ghcr.io/<your-org>/<your-repo>:latest \
ros2 launch <package> <launch_file>
```

The complete application uses a 1-node-per-container model. The containers are currently orchestrated by bash scripts detailed in the READMEs of each container image. Specifically, the full application is detailed in [erobs-common-img](./docker/erobs-common-img/README.md).
## Running Example Applications (Legacy - For Learning Only)

## Running some example applications
**⚠️ The following examples use deprecated docker configurations. See above for current deployment workflow.**

In order to run the `ur-example` with Docker, follow this procedure:

Expand Down
15 changes: 8 additions & 7 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ set -e
# Set the default build type
BUILD_TYPE=RelWithDebInfo

source /opt/ros/${ROS_DISTRO}/setup.bash && colcon build \
--merge-install \
--symlink-install \
--packages-select ur3e_hande_robot_description serial robotiq_driver pdf_beamtime_interfaces \
--cmake-args "-DCMAKE_BUILD_TYPE=$BUILD_TYPE" "-DCMAKE_EXPORT_COMPILE_COMMANDS=On" \
--cmake-args "-DCMAKE_CXX_FLAGS=-Wall -Wextra -Wpedantic"
# source /opt/ros/${ROS_DISTRO}/setup.bash && colcon build
# --merge-install \
# --symlink-install \
# --packages-select ur3e_hande_robot_description serial robotiq_driver pdf_beamtime_interfaces \
# --cmake-args "-DCMAKE_BUILD_TYPE=$BUILD_TYPE" "-DCMAKE_EXPORT_COMPILE_COMMANDS=On" \
# --cmake-args "-DCMAKE_CXX_FLAGS=-Wall -Wextra -Wpedantic"

colcon build \
--merge-install \
--symlink-install \
--executor sequential \
--cmake-args "-DCMAKE_BUILD_TYPE=$BUILD_TYPE" "-DCMAKE_EXPORT_COMPILE_COMMANDS=On" \
-Wall -Wextra -Wpedantic
-Wall -Wextra -Wpedantic \
--packages-skip epick_moveit_studio epick_config
26 changes: 26 additions & 0 deletions docker/DEPRECATED.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# ⚠️ DEPRECATED

**This directory is deprecated and should not be used for new development.**

## Why is this deprecated?

The container images in this directory are being deprecated because:

1. **CI/CD uses devcontainer**: The GitHub Actions workflows use `.devcontainer/Dockerfile` for testing and building
2. **Different source dependencies**: These images will soon depend on different source code
3. **Inconsistent with development workflow**: The devcontainer approach provides better integration with modern development tools

## What should you use instead?

For development and deployment, use:
- **Development**: `.devcontainer/Dockerfile` for VSCode devcontainer development
- **Deployment**: Container images published to GitHub Container Registry (GHCR) built from the devcontainer
- **CI/CD**: Automated workflows in `.github/workflows/`

## Timeline

This directory will be removed or archived in a future release.

## Questions?

See the main [README.md](../README.md) for current deployment instructions.
8 changes: 7 additions & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# To run the demo contianers
# ⚠️ DEPRECATED - See [DEPRECATED.md](./DEPRECATED.md)

**This directory is deprecated. Use `.devcontainer/Dockerfile` and GHCR images instead.**

---

# To run the demo contianers for Learning purposes

```bash
cd docker/ursim
Expand Down
41 changes: 41 additions & 0 deletions scripts/pdf-launch-scripts/DEPRECATED.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# ⚠️ DEPRECATED

**This directory is deprecated and should not be used for new development or deployment.**

## Why is this deprecated?

The container launch scripts in this directory are being deprecated because:

1. **Gatekept container images**: These scripts reference GHCR images behind other accounts that you cannot control:
- `ghcr.io/chandimafernando/erobs-common-img:latest` (personal account)
- `ghcr.io/nsls2/erobs-ur-driver:latest`
- `ghcr.io/nsls2/ur-hande-draft:latest`
- `ghcr.io/nsls2/erobs-bsui:latest`

2. **Old architecture**: These containers use the deprecated `docker/` directory approach that clones and builds source code inside the container at build time

3. **Inconsistent with CI/CD**: The GitHub Actions workflows now use `.devcontainer/Dockerfile` for building and publishing to GHCR

## What should you use instead?

For deployment, use the new unified container workflow:

### Development
- Use `.devcontainer/Dockerfile` with VSCode devcontainer for local development

### Deployment
1. **Pull from GHCR**: The GitHub Actions workflow automatically builds and publishes container images to your repository's GHCR when you push version tags
2. **Run containers**: Launch ROS2 nodes directly from the unified container image using `ros2 launch` commands
3. **See the main README**: Refer to [../../README.md](../../README.md) for current deployment instructions

### CI/CD
- Automated builds are configured in `.github/workflows/docker-build.yaml`
- Push a version tag (e.g., `v1.0.0`) to trigger automated builds

## Timeline

This directory will be removed or archived in a future release.

## Questions?

See the main [README.md](../../README.md) for current deployment instructions.
6 changes: 6 additions & 0 deletions scripts/pdf-launch-scripts/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# ⚠️ DEPRECATED - See [DEPRECATED.md](./DEPRECATED.md)

**This directory is deprecated. Use `.devcontainer/Dockerfile` and GHCR images instead.**

---

# File Contents
Docker launch scripts for ROS2 at the PDF beamline. Detailed documentation on building and deploying containers at NSLS-II
can be found in our [documentation](https://docs.nsls2.bnl.gov/docs/how-to/containers.html).
Expand Down
Loading