Skip to content

Commit

Permalink
Merge branch 'dev-space-nav2' into main. Close #126.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanperez-keera committed Jan 30, 2024
2 parents 4ba8f6d + b82ca0a commit bf23e58
Show file tree
Hide file tree
Showing 15 changed files with 809 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,19 @@ jobs:
docker load --input /tmp/moveit2.tar
docker images
cd space_robots && ./build.sh
space_nav2:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up buildx
uses: docker/setup-buildx-action@v1
- name: Build space_nav2 image
uses: docker/build-push-action@v2
with:
context: navigation2
push: false
tags: osrf/space_nav2:latest
cache-from: type=gha
cache-to: type=gha,mode=max
no-cache: false
55 changes: 55 additions & 0 deletions nav2_demo/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright 2021 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# A Docker configuration script to build the Navigation2/Space ROS image.
#
# The script provides the following build arguments:
#
# VCS_REF - The git revision of the Space ROS source code (no default value).
# VERSION - The version of Space ROS (default: "preview")

FROM osrf/space_nav2:latest

# Define arguments used in the metadata definition
ARG VCS_REF
ARG VERSION="preview"

# Specify the docker image metadata
LABEL org.label-schema.schema-version="1.0"
LABEL org.label-schema.name="Navigation2 demo"
LABEL org.label-schema.description="Preview version of the Navigation2/Space ROS platform"
LABEL org.label-schema.vendor="Open Robotics"
LABEL org.label-schema.version=${VERSION}
LABEL org.label-schema.url="https://github.com/space-ros"
LABEL org.label-schema.vcs-url="https://github.com/space-ros/docker"
LABEL org.label-schema.vcs-ref=${VCS_REF}

# Disable prompting during package installation
ARG DEBIAN_FRONTEND=noninteractive

# Define workspace locations
ENV NAVIGATION2_WS=${HOME_DIR}/nav2_ws
ENV NAV2_DEPS_WS=${HOME_DIR}/nav2_deps_ws

# Setup mars_rover demo
# Install map file for localization
COPY mars_map* /home/spaceros-user/nav2_ws

# Install nav2 config file for mars rover demo
COPY nav2_params.yaml /home/spaceros-user/nav2_ws

# Set up the entrypoint
COPY ./entrypoint.sh /
ENTRYPOINT ["/entrypoint.sh"]
CMD ["bash"]
51 changes: 51 additions & 0 deletions nav2_demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This folder contains the necessary files for running Nav2 on the Mars Rover demo

# This demo is a preliminary release, please file any issues found

## First build this container using the build script

```
build.sh
```

There will now be a docker image called "osrf/space_nav2_demo:latest".

# Run the Mars Rover demo with Nav2 and SLAM toolbox

## Terminal 1 - launch the mars_rover demo

Follow instructions on space-ros/docker/space-robots/README.md.

## Terminal 2 - launch Nav2

Start the space_nav2 container and launch the navigation2 nodes:

```
./run.sh
ros2 launch nav2_bringup navigation_launch.py use_sim_time:=True params_file:=nav2_params.yaml
```

## Terminal 3 - launch localization with map

```
docker exec -it osrf_space_nav2_demo bash
source install/setup.bash
ros2 launch nav2_bringup localization_launch.py use_sim_time:=True map:=mars_map.yaml
```

## Terminal 4 - launch Rviz

Exec into the same space_nav2 container and launch Rviz2:

```
docker exec -it -e DISPLAY=:0 osrf_space_nav2_demo bash
source /opt/ros/humble/setup.bash
source install/setup.bash
ros2 launch nav2_bringup rviz_launch.py
```

## Localize the robot and send a Nav2 goal

In the Rviz GUI, localize robot in Rviz using 2D Pose estimate tool, with an arrow pointing up at the center of the grid.
Wait for Nav2 to initialize / costmaps to appear.
When the costmap appears, send a goal using the "Nav2 goal" tool in Rviz
23 changes: 23 additions & 0 deletions nav2_demo/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

ORG=osrf
IMAGE=space_nav2_demo
TAG=latest

VCS_REF=""
VERSION=preview

# Exit script with failure if build fails
set -eo pipefail

echo ""
echo "##### Building Navigation2/Space ROS Docker Image #####"
echo ""

docker build -t $ORG/$IMAGE:$TAG \
--build-arg VCS_REF="$VCS_REF" \
--build-arg VERSION="$VERSION" .

echo ""
echo "##### Done! #####"

6 changes: 6 additions & 0 deletions nav2_demo/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e

# Setup the Navigation2 environment
source "/home/spaceros-user/nav2_ws/install/setup.bash"
exec "$@"
4 changes: 4 additions & 0 deletions nav2_demo/mars_map.pgm

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions nav2_demo/mars_map.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
image: mars_map.pgm
mode: trinary
resolution: 0.05
origin: [-28.2, -22.1, 0]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.25
Loading

0 comments on commit bf23e58

Please sign in to comment.