Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(WIP) Testing branch freisa_on_mars of B-AROL-O/space-ros-demos #1

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f460d4c
freisa_on_mars: Create README.md
gmacario Sep 9, 2024
3b65bd4
Add Dev Container configuration files
gmacario Sep 10, 2024
0438cd6
Add VSCode Extension: Git Graph
gmacario Sep 10, 2024
68a21f4
Add VSCode Extension: SpaceRos Dashboard
gmacario Sep 10, 2024
071b4df
freisa_on_mars: Create README.md
gmacario Sep 9, 2024
f5850ab
freisa_on_mars: Create Dockerfile
gmacario Sep 9, 2024
3b3d5a3
freisa_on_mars: Create build.sh
gmacario Sep 9, 2024
2dc4a9c
freisa_on_mars: Create run.sh
gmacario Sep 9, 2024
fab4d01
Update IMG_NAME=baroloteam/freisa_on_mars:latest
gmacario Sep 9, 2024
2a2c193
Change file mode
gmacario Sep 9, 2024
be44f79
freisa_on_mars: Add entrypoint.sh
gmacario Sep 10, 2024
0cf8406
freisa_on_mars: Add demo_manual_pkgs.repos
gmacario Sep 10, 2024
ef7c494
:Dockerfile: Add contents
gmacario Sep 10, 2024
24600d2
demo_manual_pkgs.repos: Add (commented) all upstream packages
gmacario Sep 10, 2024
b16135f
Install SPACEROS
gmacario Sep 10, 2024
adbbc2a
demo_manual_pkgs.repos: Add some more comments
gmacario Sep 10, 2024
e5838a2
Use the new KeyValueFormat for ENV
gmacario Sep 10, 2024
7bc25b9
Add mini_pupper_ros and its dependencies
gmacario Sep 10, 2024
ac35d7c
freisa_on_mars/run.sh: Add more command-line options to docker run
gmacario Sep 10, 2024
13f5f0d
Merge branch 'dev-gmacario' into freisa_on_mars
gmacario Sep 10, 2024
5cabf29
Uncomment all Repositories used by space_robots
gmacario Sep 11, 2024
64ac68a
Temporarily comment out --volume="$XAUTHORITY:..."
gmacario Sep 11, 2024
8292993
Sanity checks on environment variables
gmacario Sep 13, 2024
b31a702
freisa_on_mars: Add layers for integration of MoveIt2
gmacario Sep 13, 2024
a96e4b2
freisa_on_mars: Add *-pkgs.txt files
gmacario Sep 13, 2024
afdf5d3
freisa_on_mars: Progress in building MoveIt2
gmacario Sep 13, 2024
da8ec3b
freisa_on_mars: Add octomap_fix.diff
gmacario Sep 14, 2024
0d91d99
freisa_on_mars: Complete building MoveIt2
gmacario Sep 14, 2024
3433f1d
freisa_on_mars: Fix docker build
gmacario Sep 15, 2024
6beaa7a
freisa_on_mars: Make sure all demo dependencies are installed
gmacario Sep 15, 2024
1f60d28
Managed to build most packages from sources
gmacario Sep 18, 2024
bbc4757
README.md: Embed YouTube video: FREISA meets NASA Space ROS
gmacario Sep 24, 2024
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
31 changes: 31 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "Ubuntu",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:jammy",

// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",

// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"mhutchie.git-graph",
"openrobotics.spaceros-dashboard"
]
}
}

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
218 changes: 218 additions & 0 deletions freisa_on_mars/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
# ==========================================================================
# File: freisa_on_mars/Dockerfile
#
# Adapted from
# * https://github.com/space-ros/docker/blob/main/moveit2/Dockerfile
# * https://github.com/space-ros/docker/blob/main/space_robots/Dockerfile
# ==========================================================================

FROM osrf/space-ros:latest
# FROM openrobotics/moveit2: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="FREISA meets Curiosity Rover"
LABEL org.label-schema.description="FREISA Robot Dog meets Curiosity rover demo on the Space ROS platform"
LABEL org.label-schema.vendor="B-AROL-O Team"
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/demos"
LABEL org.label-schema.vcs-ref=${VCS_REF}

# Define a few key variables
ENV DEMO_DIR=${HOME_DIR}/demos_ws
ENV IGNITION_VERSION=fortress
ENV GZ_VERSION=fortress

# Disable prompting during package installation
ARG DEBIAN_FRONTEND=noninteractive

# === BEGIN Adaptation from space-ros/docker/moveit2/Dockerfile ===

# Define key locations
ENV MOVEIT2_DIR=${HOME_DIR}/moveit2

# Make sure the latest versions of packages are installed
# Using Docker BuildKit cache mounts for /var/cache/apt and /var/lib/apt ensures that
# the cache won't make it into the built image but will be maintained between steps.
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sudo apt-get update
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sudo apt-get dist-upgrade -y
RUN rosdep update

# Get the MoveIt2 source code
WORKDIR ${HOME_DIR}
RUN git clone https://github.com/moveit/moveit2.git -b ${ROSDISTRO} moveit2/src
RUN cd ${MOVEIT2_DIR}/src \
&& git clone https://github.com/moveit/moveit2_tutorials.git -b ${ROSDISTRO}

# Get rosinstall_generator
# Using Docker BuildKit cache mounts for /var/cache/apt and /var/lib/apt ensures that
# the cache won't make it into the built image but will be maintained between steps.
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sudo apt-get update -y && sudo apt-get install -y python3-rosinstall-generator

RUN mkdir -p ${SPACEROS_DIR}/src # HACK

RUN touch DEBUG-01.txt

# Generate repos file for moveit2 dependencies, excluding packages from Space ROS core.
WORKDIR ${MOVEIT2_DIR}
COPY --chown=${USERNAME}:${USERNAME} moveit2-pkgs.txt /tmp/
COPY --chown=${USERNAME}:${USERNAME} excluded-pkgs.txt /tmp/
RUN rosinstall_generator \
--rosdistro ${ROSDISTRO} \
--deps \
--exclude-path ${SPACEROS_DIR}/src \
--exclude $(cat /tmp/excluded-pkgs.txt) -- \
-- $(cat /tmp/moveit2-pkgs.txt) \
> /tmp/moveit2_generated_pkgs.repos

# Get the repositories required by MoveIt2, but not included in Space ROS
WORKDIR ${MOVEIT2_DIR}
RUN vcs import src < /tmp/moveit2_generated_pkgs.repos
COPY --chown=${USERNAME}:${USERNAME} moveit2_tutorials.repos /tmp/
RUN vcs import src < /tmp/moveit2_tutorials.repos

# Update the ownership of the source files (had to use sudo above to work around
# a possible inherited 'insteadof' from the host that forces use of ssh
RUN sudo chown -R ${USERNAME}:${USERNAME} ${MOVEIT2_DIR}

RUN touch DEBUG-02.txt

# Install system dependencies
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
/bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash' \
&& rosdep install --from-paths ../spaceros/src src --ignore-src \
--rosdistro ${ROSDISTRO} -r -y --skip-keys \
"console_bridge generate_parameter_library fastcdr fastrtps rti-connext-dds-5.3.1 urdfdom_headers rmw_connextdds ros_testing rmw_connextdds rmw_fastrtps_cpp rmw_fastrtps_dynamic_cpp composition demo_nodes_py lifecycle rosidl_typesupport_fastrtps_cpp rosidl_typesupport_fastrtps_c ikos diagnostic_aggregator diagnostic_updater joy qt_gui rqt_gui rqt_gui_py"

# Apply a patch to octomap_msgs to work around a build issue
COPY --chown=${USERNAME}:${USERNAME} octomap_fix.diff ./src/octomap_msgs
RUN cd src/octomap_msgs && git apply octomap_fix.diff

# Build MoveIt2
RUN /bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash \
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON --event-handlers desktop_notification- status-'

# # Add a couple sample GUI apps for testing
# RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
# --mount=type=cache,target=/var/lib/apt,sharing=locked \
# sudo apt-get install -y \
# firefox \
# glmark2 \
# libcanberra-gtk3-0 \
# libpci-dev \
# xauth \
# xterm

# === END Adaptation from space-ros/docker/moveit2/Dockerfile ===

RUN touch DEBUG-11.txt

# TODO(anyone): remove demo-pkgs.txt, no packages left after exclusions
# Generate repos file for demo dependencies, excluding packages from Space ROS core.
# COPY --chown=${USERNAME}:${USERNAME} demo-pkgs.txt /tmp/
# COPY --chown=${USERNAME}:${USERNAME} excluded-pkgs.txt /tmp/
# RUN rosinstall_generator \
# --rosdistro ${ROSDISTRO} \
# --deps \
# --exclude-path ${SPACEROS_DIR}/src \
# --exclude-path ${MOVEIT2_DIR}/src \
# --exclude $(cat /tmp/excluded-pkgs.txt) -- \
# -- $(cat /tmp/demo-pkgs.txt) \
# > /tmp/demo_generated_pkgs.repos

RUN mkdir -p ${DEMO_DIR}/src
WORKDIR ${DEMO_DIR}

RUN touch DEBUG-12.txt

# Install libmongoc for development
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sudo apt-get install libmongoc-dev -y

# Compile mongo cxx driver https://mongocxx.org/mongocxx-v3/installation/linux/
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sudo apt-get install libssl-dev build-essential devscripts debian-keyring fakeroot \
debhelper cmake libboost-dev libsasl2-dev libicu-dev libzstd-dev doxygen -y
RUN wget https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.6.7/mongo-cxx-driver-r3.6.7.tar.gz
RUN tar -xzf mongo-cxx-driver-r3.6.7.tar.gz
RUN cd mongo-cxx-driver-r3.6.7/build \
&& cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local \
&& sudo cmake --build . --target EP_mnmlstc_core \
&& cmake --build . \
&& sudo cmake --build . --target install

RUN touch DEBUG-15.txt

# Get the source for the dependencies
# RUN vcs import src < /tmp/demo_generated_pkgs.repos
COPY --chown=${USERNAME}:${USERNAME} demo_manual_pkgs.repos /tmp/
RUN vcs import src < /tmp/demo_manual_pkgs.repos \
&& /bin/bash -c 'source "${SPACEROS_DIR}/install/setup.bash"'

RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sudo apt-get update -y \
&& /bin/bash -c 'source "${SPACEROS_DIR}/install/setup.bash"' \
&& /bin/bash -c 'source "${MOVEIT2_DIR}/install/setup.bash"' \
&& rosdep install --from-paths src --ignore-src -r -y --rosdistro ${ROSDISTRO}

RUN vcs import src < "${DEMO_DIR}/src/mini_pupper_ros/.minipupper.repos"

# HACK: Move out package whose build still fails
RUN /bin/mkdir -p ../NO_src \
&& for d in champ ros2_controllers; do mv "src/$d" "../NO_src/"; done

# Build the demo
RUN /bin/bash -c '\
source "${SPACEROS_DIR}/install/setup.bash" \
&& source "${MOVEIT2_DIR}/install/setup.bash" \
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release'

# === TODO: The command above fails ============================================
# --- stderr: forward_command_controller
# CMake Error at CMakeLists.txt:26 (find_package):
# By not providing "Findcontroller_interface.cmake" in CMAKE_MODULE_PATH this
# project has asked CMake to find a package configuration file provided by
# "controller_interface", but CMake did not find one.
#
# Could not find a package configuration file provided by
# "controller_interface" with any of the following names:
#
# controller_interfaceConfig.cmake
# controller_interface-config.cmake
#
# Add the installation prefix of "controller_interface" to CMAKE_PREFIX_PATH
# or set "controller_interface_DIR" to a directory containing one of the
# above files. If "controller_interface" provides a separate development
# package or SDK, be sure it has been installed.
#
#
# ---
# Failed <<< forward_command_controller [1.84s, exited with code 1]
# ==============================================================================

RUN touch DEBUG-21.txt

# # Add the user to the render group so that the user can access /dev/dri/renderD128
# RUN sudo usermod -aG render $USERNAME

# # Setup the entrypoint
# COPY ./entrypoint.sh /
# ENTRYPOINT ["/entrypoint.sh"]
# CMD ["bash"]

# EOF
73 changes: 73 additions & 0 deletions freisa_on_mars/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# FREISA Robot Dog with Space ROS Mars Rover Demo

## Introduction

This demo integrates the simulation of the [FREISA Robot Dog](https://github.com/B-AROL-O/FREISA) (based on the [Mini Pupper 2 Pro](https://www.kickstarter.com/projects/mdrobotkits/md-robot-kits-open-source-support-your-genai-creativity) by [MangDang (HK) Limited](https://mangdang.store/)) inside the [Space ROS Mars Rover demo](https://space-ros.github.io/docs/rolling/Demos.html).

This code is a part of the following challenge:

* Challenge Name: NASA Space ROS Sim Summer Sprint Challenge
* Team Lead Freelancer Username: [@gmacario](https://www.freelancer.com/u/gmacario)
* Submission Title: Integrate FREISA Robot Dog with Space ROS Mars Rover Demo

[![FREISA meets NASA Space ROS](https://img.youtube.com/vi/KcfOwAC_WE0/0.jpg)](https://www.youtube.com/watch?v=KcfOwAC_WE0 "FREISA meets NASA Space ROS")

<!--
## Directory Overview

TODO
-->

<!--
## Dependencies

TODO
-->

<!--
## Build Instructions

TODO
-->

<!--
## Usage Instructions

TODO
-->

<!--
## Architecture and design choices

TODO
-->

## Added bonus

The proposed feature is only dealing with the integration of the [Mini Pupper 2](https://github.com/mangdangroboticsclub) robot inside Space ROS demo.
However, once the PR is merged, as an added bonus it should be possible to instantiate in the Space ROS Demo any of the quadruped robots supported by [CHAMP](https://github.com/chvmp/champ):

![champ](https://raw.githubusercontent.com/chvmp/champ/master/docs/images/robots.gif)

## Authors

The FREISA Robot Dog with Space ROS Mars Rover Demo is another fine project by [the B-AROL-O Team](https://github.com/B-AROL-O) - a group of friends who in their spare time enjoy creating fun projects with Robotics, Computer Vision and [LEGO®](https://www.lego.com/).

Everything we do - both hardware and software - is Open Source and [shared on GitHub](https://github.com/B-AROL-O).

Our projects have been awarded several prizes in worldwide competitions on Computer Vision and robotics.
As an example, project "[Four-legged Robot Ensuring Intelligent Sprinkler Automation](https://www.hackster.io/projects/845012)" (a.k.a. [FREISA](https://github.com/B-AROL-O/FREISA)) - was the Grand Prize Winner 🥇 of the [OpenCV AI Competition 2023](https://www.hackster.io/contests/opencv-ai-competition-2023) with [OpenCV](https://www.hackster.io/opencv), [Khadas](https://www.hackster.io/khadas) and [Seeed Studio](https://www.hackster.io/seeed).

[![OpenCV AI Competition 2023 Grand Prize Winners - OpenCV Live 126](https://img.youtube.com/vi/iUe4N7yvpmA/0.jpg)](https://www.youtube.com/watch?v=iUe4N7yvpmA "OpenCV AI Competition 2023 Grand Prize Winners - OpenCV Live 126")

### How to get in touch

You can reach out to us through the following platforms:

* [![Instagram](https://img.icons8.com/small/16/000000/instagram-new.png)](https://instagram.com/baroloteam) Instagram: [@baroloteam](https://instagram.com/baroloteam)

* [![Twitter](https://img.icons8.com/small/16/000000/twitter.png)](https://x.com/baroloteam) X: [@baroloteam](<https://x.com/baroloteam>)

* [![GitHub](https://img.icons8.com/small/16/000000/github.png)](https://github.com/B-AROL-O) GitHub: [B-AROL-O](https://github.com/B-AROL-O)

<!-- EOF -->
24 changes: 24 additions & 0 deletions freisa_on_mars/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

ORG=baroloteam
IMAGE=freisa_on_mars
TAG=latest

VCS_REF=""
VERSION=preview

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

echo ""
echo "##### Building freisa_on_mars Demo Docker Image #####"
echo ""

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

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

# EOF
Loading
Loading