Skip to content

Commit

Permalink
RMF fleet adapter nav2 for Ionic demo (#8)
Browse files Browse the repository at this point in the history
* Add basic dispenser pick and place

Signed-off-by: Luca Della Vedova <[email protected]>

* Add rmf message to dependencies

Signed-off-by: Luca Della Vedova <[email protected]>

* Update branches / dependencies

Signed-off-by: Luca Della Vedova <[email protected]>

* Add nav2 and custom branch

Signed-off-by: Luca Della Vedova <[email protected]>

* Fix rviz and nav2 demo

Signed-off-by: Luca Della Vedova <[email protected]>

* Fleet adapter nav2 for Ionic demo (#5)

* Add fleet adapter template

Signed-off-by: Xiyu Oh <[email protected]>

* Ac/tf listener (#1)

* Basic TF listener, not tested yet

Signed-off-by: Aaron Chong <[email protected]>

* Started README

Signed-off-by: Aaron Chong <[email protected]>

---------

Signed-off-by: Aaron Chong <[email protected]>

* Fleet adapter bringup (#3)

* Working adapter but wrong tf read

Signed-off-by: Xiyu Oh <[email protected]>

* Fix reference coordinates, tfs,typo (#4)

Signed-off-by: Aaron Chong <[email protected]>

* Working fleet adapter with demo map

Signed-off-by: Xiyu Oh <[email protected]>

---------

Signed-off-by: Xiyu Oh <[email protected]>
Signed-off-by: Aaron Chong <[email protected]>
Co-authored-by: Aaron Chong <[email protected]>

* Works with #1

Signed-off-by: Aaron Chong <[email protected]>

* Update instructions

Signed-off-by: Aaron Chong <[email protected]>

* Ros package and nav2 demo (#1)

* launching the demo world
* Added new laser scan and updated launch file
* Setting up ionic_demo as its own pacakge
* Updated with gif
* Clean up and add license
* Remove unused launch file
* Add media

---------

Signed-off-by: Aaron Chong <[email protected]>
Co-authored-by: Tully Foote <[email protected]>

* Add docker file and workflow to publish docker images (#3)

Signed-off-by: Addisu Z. Taddese <[email protected]>

* Use composition for ros_gz and Gazebo in Nav2 launch files (#4)

* Reimplements the turtlebot4 launch file from nav2_bringup in order to
use composition for ros_gz and Gazebo. Hopefully, some of this will be
upstreamed to Nav2.

* This also updates the step size to 0.004 to speed up simulation

Signed-off-by: Addisu Z. Taddese <[email protected]>

* Add a tray to the turtlebot4 (#6)

* Use composition for ros_gz and Gazebo in Nav2 launch files

* Reimplements the turtlebot4 launch file from nav2_bringup in order to
use composition for ros_gz and Gazebo. Hopefully, some of this will be
upstreamed to Nav2.

* This also updates the step size to 0.004 to speed up simulation

Signed-off-by: Addisu Z. Taddese <[email protected]>

* Add a tray to the turtlebot4

Signed-off-by: Addisu Z. Taddese <[email protected]>

---------

Signed-off-by: Addisu Z. Taddese <[email protected]>

---------

Signed-off-by: Xiyu Oh <[email protected]>
Signed-off-by: Aaron Chong <[email protected]>
Signed-off-by: Addisu Z. Taddese <[email protected]>
Co-authored-by: Xiyu Oh <[email protected]>
Co-authored-by: Xiyu <[email protected]>
Co-authored-by: Tully Foote <[email protected]>
Co-authored-by: Addisu Z. Taddese <[email protected]>

* Add adapter to launch file

Signed-off-by: Xiyu Oh <[email protected]>

* Fix launch file and add exec depends

Signed-off-by: Aaron Chong <[email protected]>

* Add rest of dispenser logic, fix fleet adapter

Signed-off-by: Luca Della Vedova <[email protected]>

* Fix dispensor result / stage logic

Signed-off-by: Luca Della Vedova <[email protected]>

* Build docker image with RMF as well

Signed-off-by: Aaron Chong <[email protected]>

* Spawn teleport ingestor model

Signed-off-by: Luca Della Vedova <[email protected]>

* Change branch of ionic_demo

Signed-off-by: Aaron Chong <[email protected]>

* Add RMF to moveit launch

Signed-off-by: Luca Della Vedova <[email protected]>

* Target rmf.repos that allow skipping qt building plugins

Signed-off-by: Aaron Chong <[email protected]>

* Fix dependencies

Signed-off-by: Luca Della Vedova <[email protected]>

* Use correct flag to skip qt moc plugin builds

Signed-off-by: Aaron Chong <[email protected]>

* Revert to use rmf_simulation main, remove cmake flag (#7)

* Revert to use rmf_simulation main, remove cmake flag

Signed-off-by: Aaron Chong <[email protected]>

* Remove wget and vcs step for rmf.repos

Signed-off-by: Aaron Chong <[email protected]>

---------

Signed-off-by: Aaron Chong <[email protected]>

* Fix coordinates / names for delivery demo

Signed-off-by: Luca Della Vedova <[email protected]>

* Remove detachable joint and use normal gripping

Signed-off-by: Luca Della Vedova <[email protected]>

* Split launch files for single demos

Signed-off-by: Luca Della Vedova <[email protected]>

* Tune map, nav2 inflation layer, gripper close values, added dashboard… (#8)

* Tune map, nav2 inflation layer, gripper close values, added dashboard build

Signed-off-by: Aaron Chong <[email protected]>

* Attempt to build dashboard image first

Signed-off-by: Aaron Chong <[email protected]>

* Add media, update readme, revert changes to workflow

Signed-off-by: Aaron Chong <[email protected]>

* One liner for dashboard url

Signed-off-by: Xiyu Oh <[email protected]>

* Move environment variables to moveit launch

Signed-off-by: Luca Della Vedova <[email protected]>

* Build dashboard with better robot zoom values, increase yaw tolerance for nav2 to prevent wobble

Signed-off-by: Aaron Chong <[email protected]>

* Increase yaw tolerance even more, revert workflow

Signed-off-by: Aaron Chong <[email protected]>

* Add gitignore

Signed-off-by: Aaron Chong <[email protected]>

---------

Signed-off-by: Aaron Chong <[email protected]>
Signed-off-by: Xiyu Oh <[email protected]>
Signed-off-by: Luca Della Vedova <[email protected]>
Co-authored-by: Xiyu Oh <[email protected]>
Co-authored-by: Luca Della Vedova <[email protected]>

* Update dashboard docker image URL

Signed-off-by: Aaron Chong <[email protected]>

---------

Signed-off-by: Luca Della Vedova <[email protected]>
Signed-off-by: Xiyu Oh <[email protected]>
Signed-off-by: Aaron Chong <[email protected]>
Signed-off-by: Addisu Z. Taddese <[email protected]>
Signed-off-by: Luca Della Vedova <[email protected]>
Co-authored-by: Luca Della Vedova <[email protected]>
Co-authored-by: Aaron Chong <[email protected]>
Co-authored-by: Tully Foote <[email protected]>
Co-authored-by: Addisu Z. Taddese <[email protected]>
Co-authored-by: Luca Della Vedova <[email protected]>
  • Loading branch information
6 people authored Sep 26, 2024
1 parent 2350def commit 5e39cbb
Show file tree
Hide file tree
Showing 42 changed files with 2,956 additions and 36 deletions.
41 changes: 41 additions & 0 deletions .github/dashboard/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
ARG BASE_IMAGE
FROM $BASE_IMAGE
ARG BRANCH=main

### Build dashboard

# fetch sources
RUN mkdir -p /ws \
&& curl -L https://github.com/open-rmf/rmf-web/archive/$BRANCH.tar.gz -o rmf_web.tar.gz \
&& tar zxf rmf_web.tar.gz -C /ws --strip-components=1

# install deps
RUN cd /ws \
&& pnpm install --filter rmf-dashboard...

# replace configs and build
COPY app-config.json /ws/packages/dashboard/app-config.json
RUN cd /ws/packages/dashboard \
&& pnpm run build

### Set up bare minimum dashboard image

FROM docker.io/ubuntu:24.04
COPY --from=0 /ws/packages/dashboard/dist /opt/dashboard

RUN apt update && apt install -y curl

RUN curl -fsSL https://get.pnpm.io/install.sh | bash -
# shell runs in non-interactive mode, which does not source .bashrc so we need to set the PATH manually
ENV PNPM_HOME /root/.local/share/pnpm
ENV PATH "$PNPM_HOME:$PATH"

# nodejs seems to have changed the official mirror, the default in pnpm is very slow now
RUN pnpm config -g set 'node-mirror:release' https://nodejs.org/dist && pnpm env use --global lts

RUN npm install --global serve
ENV PATH "$(npm bin -g):$PATH"

COPY inject-env.sh /opt/inject-env.sh

ENTRYPOINT ["bash", "-c", ". /opt/inject-env.sh && npx serve -s /opt/dashboard"]
43 changes: 43 additions & 0 deletions .github/dashboard/app-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"$schema": "https://raw.githubusercontent.com/open-rmf/rmf-web/main/packages/dashboard/app-config.schema.json",
"rmfServerUrl": "__RMF_SERVER_URL__",
"trajectoryServerUrl": "__TRAJECTORY_SERVER_URL__",
"authConfig": {},
"helpLink": "https://osrf.github.io/ros2multirobotbook/rmf-core.html",
"reportIssue": "https://github.com/open-rmf/rmf-web/issues",
"pickupZones": [],
"defaultZoom": 20,
"defaultRobotZoom": 70,
"attributionPrefix": "OSRC-SG",
"defaultMapLevel": "L1",
"allowedTasks": [
{
"taskDefinitionId": "patrol"
},
{
"taskDefinitionId": "delivery"
}
],
"resources": {
"default": {
"fleets": {
"tb4": {
"default": {
"icon": "https://raw.githubusercontent.com/open-rmf/rmf_demos/rmf-web-dashboard-resources/rmf_demos_dashboard_resources/icons/tb4.png",
"scale": 0.00068
}
}
},
"logos": {
"header": "/resources/defaultLogo.png"
}
}
},
"cartIds": [],
"buildConfig": {
"baseUrl": "/",
"authProvider": "stub",
"customTabs": false,
"adminTab": false
}
}
5 changes: 5 additions & 0 deletions .github/dashboard/inject-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/bash
set -e

sed -i "s,__RMF_SERVER_URL__,${RMF_SERVER_URL},g" /opt/dashboard/index.html
sed -i "s,__TRAJECTORY_SERVER_URL__,${TRAJECTORY_SERVER_URL},g" /opt/dashboard/index.html
40 changes: 39 additions & 1 deletion .github/workflows/build_docker_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ on:
push:
branches: ['main']


# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
DASHBOARD_IMAGE_NAME: ${{ github.repository }}_rmf_dashboard

# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
jobs:
Expand Down Expand Up @@ -62,3 +62,41 @@ jobs:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
build-and-push-dashboard-image:
runs-on: ubuntu-latest
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
attestations: write
id-token: write
#
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
- name: Log in to the Container registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: ${{ env.REGISTRY }}/${{ env.DASHBOARD_IMAGE_NAME }}
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image
id: push
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0
with:
context: .github/dashboard
push: true
build-args: |
BASE_IMAGE=ghcr.io/open-rmf/rmf-web/minimal-rmf:latest
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/__pycache__/
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM ros:rolling
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y dirmngr curl git python3 python3-docopt python3-yaml python3-distro sudo mesa-utils \
&& apt-get install -y dirmngr curl git python3 python3-docopt python3-yaml python3-distro python3-pip sudo mesa-utils \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/gazebo-tooling/gzdev \
Expand All @@ -20,6 +20,9 @@ RUN apt-get update \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Install nudged via pip (required by rmf_fleet_adapter_python)
RUN pip install nudged --break-system-packages

RUN mkdir -p /root/ws/src
WORKDIR /root/ws
COPY ionic_demo.repos .
Expand All @@ -30,7 +33,7 @@ RUN apt-get update \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN . /opt/ros/rolling/setup.sh \
&& MAKEFLAGS=-j6 GZ_RELAX_VERSION_MATCH=1 colcon build --symlink-install --packages-up-to ionic_demo
&& MAKEFLAGS=-j6 GZ_RELAX_VERSION_MATCH=1 colcon build --symlink-install --packages-up-to ionic_demo --cmake-args -DNO_DOWNLOAD_MODELS=On
COPY entrypoint.sh /ionic_entrypoint.sh
ENTRYPOINT ["/ionic_entrypoint.sh"]
CMD ["bash"]
50 changes: 45 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,52 @@ Navigation commands can now be sent via the `Nav2 Goal` button.

![](media/rviz-navigate.png)

# Troubleshooting
# Running the Open-RMF demo

* If there are communication/middleware related issues while running the demos, we recommend trying again [using a different RMW implementation](https://docs.ros.org/en/jazzy/How-To-Guides/Working-with-multiple-RMW-implementations.html#specifying-rmw-implementations), for example `rmw_cyclonedds_cpp`.
In order to minimize race conditions, we recommend running each launch file one after the other.

Start the dashboard docker image,

```
docker run --network host -it --rm \
-e RMF_SERVER_URL=http://localhost:8000 \
-e TRAJECTORY_SERVER_URL=http://localhost:8006 \
ghcr.io/gazebosim/ionic_demo_rmf_dashboard:main
```

Start the API server docker image, make sure to note the `ROS_DOMAIN_ID` and `RMW_IMPLEMENTATION`. This starts the API server on `localhost:8000`.

```
docker run --network host -it --rm \
-e ROS_DOMAIN_ID=<ROS_DOMAIN_ID> \
-e RMW_IMPLEMENTATION=<RMW_IMPLEMENTATION> \
ghcr.io/open-rmf/rmf-web/api-server:rolling
```
The dashboard will be accessible at `localhost:3000` by default.

Spawn the world and arm,

```
ros2 launch ionic_demo ionic_moveit_demo_launch.py
```

# TODOs
Spawn the turtlebot4, start its nav2 stack, moveit plugin for the arm, and all other Open-RMF related nodes. This also lets the fleet adapter know to communicate with the API server on `localhost:8000/_internal`.

* package descriptions
* fleet adapter
```
ros2 launch ionic_demo ionic_rmf_demo_launch.py server_uri:="ws://localhost:8000/_internal"
```

Dispatch delivery or patrol tasks via `rmf-web`.

![](media/rmf-web-1.png)
![](media/rmf-web-2.png)

Or dispatch the delivery task manually,

```
ros2 run rmf_demos_tasks dispatch_delivery -p bar -ph moveit_dispenser -d table_4 -dh coke_ingestor --use_sim_time -st 0
```

# Troubleshooting

* If there are communication/middleware related issues while running the demos, we recommend trying again [using a different RMW implementation](https://docs.ros.org/en/jazzy/How-To-Guides/Working-with-multiple-RMW-implementations.html#specifying-rmw-implementations), for example `rmw_cyclonedds_cpp`.
47 changes: 47 additions & 0 deletions fleet_adapter_nav2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# fleet_adapter_nav2

Set up workspace

```
git clone https://github.com/open-rmf/rmf
mkdir -p ws/src
vcs import ws/src < rmf/rmf.repos
cd ws/src
git clone https://github.com/gazebosim/ionic_demo
# rosdep
# build
```

Run basic tb4 bringup, and set initial posititon

```
ros2 launch ionic_demo ionic_navigation_demo_launch.py
```

Start `rmf_demos` common packages

```
cd ws
ros2 launch rmf_demos common.launch.xml headless:=1 use_sim_time:=true config_file:=src/ionic_demo/ionic_demo_building_maps/maps/ionic_demo/ionic_demo.building.yaml
```

Start `fleet_adapter_nav2`

```
ros2 run fleet_adapter_nav2 fleet_adapter -c src/ionic_demo/fleet_adapter_nav2/config/tb4_config.yaml -n install/ionic_demo_building_maps/share/ionic_demo_building_maps/maps/ionic_demo/nav_graphs/0.yaml -sim --ros-args -r /tf:=/tb4/tf
```

Send a task

```
ros2 run rmf_demos_tasks dispatch_patrol -p table_1 -n 1 -st 0 --use_sim_time
```

Send a delivery task

```
ros2 run rmf_demos_tasks dispatch_delivery -p bar -ph moveit_dispenser -d table_4 -dh coke_ingestor --use_sim_time
```
58 changes: 58 additions & 0 deletions fleet_adapter_nav2/config/tb4_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# FLEET CONFIG =================================================================
# RMF Fleet parameters

rmf_fleet:
name: "tb4"
limits:
linear: [0.5, 0.75] # velocity, acceleration
angular: [0.6, 2.0] # velocity, acceleration
profile: # Robot profile is modelled as a circle
footprint: 0.3 # radius in m
vicinity: 0.5 # radius in m
reversible: True # whether robots in this fleet can reverse
battery_system:
voltage: 12.0 # V
capacity: 24.0 # Ahr
charging_current: 5.0 # A
mechanical_system:
mass: 20.0 # kg
moment_of_inertia: 10.0 #kgm^2
friction_coefficient: 0.22
ambient_system:
power: 20.0 # W
tool_system:
power: 0.0 # W
recharge_threshold: 0.10 # Battery level below which robots in this fleet will not operate
recharge_soc: 1.0 # Battery level to which robots in this fleet should be charged up to during recharging tasks
publish_fleet_state: 10.0 # Publish frequency for fleet state, ensure that it is same as robot_state_update_frequency
account_for_battery_drain: True
task_capabilities: # Specify the types of RMF Tasks that robots in this fleet are capable of performing
loop: True
delivery: True
actions: []
finishing_request: "nothing" # [park, charge, nothing]
responsive_wait: False # Should responsive wait be on/off for the whole fleet by default? False if not specified.
robots:
tb4:
charger: "tb4_start"
# For robot API
map: "L1"
prefix: ""
target_frame: "map"
from_frame: "base_link"

conversions:
reference_coordinates:
L1:
rmf: [[0.1, -1.2494],
[7.5464, -0.6497],
[10.3451, -5.3975],
[1.7492, -7.4465]]
tb4: [[-5.422642707824707, 3.07148814201355],
[2.0564370155334473, 3.6545846462249756],
[4.780905723571777, -1.036746859550476],
[-3.804450511932373, -3.1021950244903564]]

map:
# rmf to tb4
L1: 'map'
Empty file.
Loading

0 comments on commit 5e39cbb

Please sign in to comment.