Skip to content

Commit

Permalink
ROS Noetic Java Generator (#770)
Browse files Browse the repository at this point in the history
* Add scripts to patch and repackage genjava for ROS noetic
* Update README to reflect genjava backport to ROS noetic
* Update msgs_jar workflow to run on Ubuntu 20 instead
* Update android submodule to latest version

---------

Co-authored-by: Ruben Garcia <[email protected]>
Co-authored-by: Trey Smith <[email protected]>
  • Loading branch information
3 people authored Mar 22, 2024
1 parent 6ac552f commit 11eab6f
Show file tree
Hide file tree
Showing 41 changed files with 837 additions and 27 deletions.
13 changes: 3 additions & 10 deletions .github/workflows/msgs_jar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,12 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Build image astrobee/astrobee:msgs-ubuntu16.04
- name: Build image astrobee/astrobee:msgs-ubuntu20.04
run: docker build . -f ./scripts/docker/astrobee_msgs.Dockerfile
--build-arg UBUNTU_VERSION=16.04
--build-arg ROS_VERSION=kinetic
--build-arg PYTHON=''
-t astrobee/astrobee:msgs-ubuntu16.04
-t astrobee/astrobee:msgs-ubuntu20.04

- name: Build image astrobee/astrobee:latest-msgs-jar-ubuntu16.04
- name: Build image astrobee/astrobee:latest-msgs-jar-ubuntu20.04
run: docker build . -f ./scripts/docker/build_msgs_jar.Dockerfile
--build-arg UBUNTU_VERSION=16.04
--build-arg ROS_VERSION=kinetic
--build-arg PYTHON=''
--build-arg REPO=astrobee
-t ghcr.io/${{ github.repository_owner }}/astrobee:latest-msgs-jar

- name: Copy jar files
Expand Down
6 changes: 3 additions & 3 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

## System requirements

Ubuntu 20.04 is currently the only supported platform for most Astrobee development use cases.
Ubuntu 20.04 is currently the only supported platform.

Here are the currently available host OS options with development roadmap details (use 64-bit PC (AMD64) desktop image):
- [Ubuntu 20.04](http://releases.ubuntu.com/20.04): This is currently the only supported platform for most Astrobee development use cases. The Astrobee hardware on ISS has been running Ubuntu 20.04 since it was upgraded during the "Crew-Minimal S14" activity on December 19, 2023.
- [Ubuntu 16.04](http://releases.ubuntu.com/16.04): No longer supported for most use cases. The Astrobee robot hardware ran Ubuntu 16.04 from its launch in 2019 until it was upgraded to run Ubuntu 20.04. Ubuntu 16.04 support was discontinued for most use cases in February 2024. Ending Ubuntu 16.04 support removed important limitations. For example, going forward, Astrobee's software will no longer need to be backward-compatible with Python 2 and OpenCV 3. However, Ubuntu 16.04 is still required in a very limited role that most developers don't need to worry about. We use it to compile a JAR file binary artifact of Astrobee message definitions used by the [astrobee_android](https://github.com/nasa/astrobee_android) code hosted on Astrobee's High-Level Processor, which runs a legacy version of Android with `rosjava`, which was designed to communicate with the ROS Kinetic distribution. Compiling the JAR file requires the `ros-kinetic-rosjava` package that is only available for Ubuntu 16.04. (But most developers shouldn't need to generate this artifact.)
- [Ubuntu 20.04](http://releases.ubuntu.com/20.04): This is currently the only supported platform. The Astrobee hardware on ISS has been running Ubuntu 20.04 since it was upgraded during the "Crew-Minimal S14" activity on December 19, 2023.

Specifically not supported:
- ~~[Ubuntu 16.04](http://releases.ubuntu.com/16.04)~~: No longer supported. The Astrobee robot hardware ran Ubuntu 16.04 from its launch in 2019 until it was upgraded to run Ubuntu 20.04. Ubuntu 16.04 support was discontinued in February 2024. Ending Ubuntu 16.04 support removed important limitations. For example, going forward, Astrobee's software will no longer need to be backward-compatible with Python 2 and OpenCV 3.
- ~~[Ubuntu 18.04](http://releases.ubuntu.com/18.04)~~: Ubuntu 18.04 support as a software development platform was discontinued as of November 2023. (It was never supported on the robot hardware.)
- ~~[Ubuntu 22.04](http://releases.ubuntu.com/22.04)~~: There is currently no plan for Ubuntu 22.04 support on the Astrobee roadmap. However, note that Astrobee ROS2 support, when it eventually becomes available, is currently expected to use the ROS2 Humble Hawksbill distribution that normally runs on 22.04, but backported to run on 20.04 (the last Ubuntu version supported by ROS1). This will facilitate migrating from ROS1 to ROS2 without requiring a simultaneous Ubuntu distribution upgrade.

Expand Down
6 changes: 3 additions & 3 deletions scripts/docker/astrobee_msgs.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
# This will set up an Astrobee docker container using the non-NASA install instructions.
# You must set the docker context to be the repository root directory

ARG UBUNTU_VERSION=16.04
ARG UBUNTU_VERSION=20.04
FROM ubuntu:${UBUNTU_VERSION}

ARG ROS_VERSION=kinetic
ARG PYTHON=""
ARG ROS_VERSION=noetic
ARG PYTHON="3"

# try to suppress certain warnings during apt-get calls
ARG DEBIAN_FRONTEND=noninteractive
Expand Down
24 changes: 14 additions & 10 deletions scripts/docker/build_msgs_jar.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,22 @@

ARG REMOTE=astrobee
ARG REPO=astrobee
FROM ${REMOTE}/${REPO}:msgs-ubuntu16.04
FROM ${REMOTE}/${REPO}:msgs-ubuntu20.04

RUN apt-get update && apt-get install -y \
unzip \
libc6-dev-i386 \
lib32z1 \
python-wstool \
openjdk-8-jdk \
ros-kinetic-rosjava \
&& rm -rf /var/lib/apt/lists/*
COPY scripts/setup/debians/rosjava /src/msgs/src/scripts

# Compile msg jar files, genjava_message_artifacts only works with bash
# make sure there is a python binary
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1

# install dependencies for rosjava build script
RUN apt-get update && apt-get install -y devscripts equivs

# build rosjava debians
RUN cd /src/msgs/src/scripts \
&& /bin/bash build_rosjava_debians.sh --install-with-deps \
&& rm -rf /var/lib/apt/lists/*

# compile msg jar files, genjava_message_artifacts only works with bash
RUN ["/bin/bash", "-c", "cd /src/msgs \
&& catkin config \
&& catkin build \
Expand Down
12 changes: 12 additions & 0 deletions scripts/setup/debians/rosjava/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*.build
*.changes
*.dsc
*.tar.xz
*.tar.gz
*.deb
*.ddeb
*.buildinfo
ros-noetic-rosjava-build-tools
ros-noetic-rosjava-bootstrap
ros-noetic-genjava
ros-noetic-rosjava-messages
5 changes: 5 additions & 0 deletions scripts/setup/debians/rosjava/bootstrap/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ros-noetic-rosjava-bootstrap (0.3.3-1astrobeefocal) focal; urgency=high

* Add Python3 basic support

-- Ruben Garcia <[email protected]> Thu, 15 Feb 2024 02:00:00 -0000
1 change: 1 addition & 0 deletions scripts/setup/debians/rosjava/bootstrap/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
12 changes: 12 additions & 0 deletions scripts/setup/debians/rosjava/bootstrap/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Source: ros-noetic-rosjava-bootstrap
Section: misc
Priority: extra
Maintainer: Ruben Garcia <[email protected]>
Build-Depends: debhelper (>= 9.0.0), ros-noetic-catkin, ros-noetic-rosjava-build-tools
Homepage: http://ros.org/wiki/rosjava_bootstrap
Standards-Version: 3.9.2

Package: ros-noetic-rosjava-bootstrap
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, ros-noetic-rosjava-build-tools
Description: Bootstrap utilities for rosjava builds.
61 changes: 61 additions & 0 deletions scripts/setup/debians/rosjava/bootstrap/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
# TODO: remove the LDFLAGS override. It's here to avoid esoteric problems
# of this sort:
# https://code.ros.org/trac/ros/ticket/2977
# https://code.ros.org/trac/ros/ticket/3842
export LDFLAGS=
export PKG_CONFIG_PATH=/opt/ros/noetic/lib/pkgconfig
# Explicitly enable -DNDEBUG, see:
# https://github.com/ros-infrastructure/bloom/issues/327
export DEB_CXXFLAGS_MAINT_APPEND=-DNDEBUG

%:
dh $@ -v --buildsystem=cmake

override_dh_auto_configure:
# In case we're installing to a non-standard location, look for a setup.sh
# in the install tree that was dropped by catkin, and source it. It will
# set things like CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH.
if [ -f "/opt/ros/noetic/setup.sh" ]; then . "/opt/ros/noetic/setup.sh"; fi && \
dh_auto_configure -- \
-DCATKIN_BUILD_BINARY_PACKAGE="1" \
-DCMAKE_INSTALL_PREFIX="/opt/ros/noetic" \
-DCMAKE_PREFIX_PATH="/opt/ros/noetic"

override_dh_auto_build:
# In case we're installing to a non-standard location, look for a setup.sh
# in the install tree that was dropped by catkin, and source it. It will
# set things like CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH.
if [ -f "/opt/ros/noetic/setup.sh" ]; then . "/opt/ros/noetic/setup.sh"; fi && \
dh_auto_build

override_dh_auto_test:
# In case we're installing to a non-standard location, look for a setup.sh
# in the install tree that was dropped by catkin, and source it. It will
# set things like CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH.
echo -- Running tests. Even if one of them fails the build is not canceled.
if [ -f "/opt/ros/noetic/setup.sh" ]; then . "/opt/ros/noetic/setup.sh"; fi && \
dh_auto_test || true

override_dh_shlibdeps:
# In case we're installing to a non-standard location, look for a setup.sh
# in the install tree that was dropped by catkin, and source it. It will
# set things like CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH.
if [ -f "/opt/ros/noetic/setup.sh" ]; then . "/opt/ros/noetic/setup.sh"; fi && \
dh_shlibdeps -l$(CURDIR)/debian/ros-noetic-rosjava-bootstrap//opt/ros/noetic/lib/

override_dh_auto_install:
# In case we're installing to a non-standard location, look for a setup.sh
# in the install tree that was dropped by catkin, and source it. It will
# set things like CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH.
if [ -f "/opt/ros/noetic/setup.sh" ]; then . "/opt/ros/noetic/setup.sh"; fi && \
dh_auto_install
1 change: 1 addition & 0 deletions scripts/setup/debians/rosjava/bootstrap/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (quilt)
5 changes: 5 additions & 0 deletions scripts/setup/debians/rosjava/bootstrap/source/options
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Automatically add upstream changes to the quilt overlay.
# http://manpages.ubuntu.com/manpages/trusty/man1/dpkg-source.1.html
# This supports reusing the orig.tar.gz for debian increments.
auto-commit

5 changes: 5 additions & 0 deletions scripts/setup/debians/rosjava/build-tools/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ros-noetic-rosjava-build-tools (0.3.3-1astrobeefocal) focal; urgency=high

* Add Python3 basic support

-- Ruben Garcia <[email protected]> Thu, 15 Feb 2024 02:00:00 -0000
1 change: 1 addition & 0 deletions scripts/setup/debians/rosjava/build-tools/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
12 changes: 12 additions & 0 deletions scripts/setup/debians/rosjava/build-tools/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Source: ros-noetic-rosjava-build-tools
Section: misc
Priority: extra
Maintainer: Ruben Garcia <[email protected]>
Build-Depends: debhelper (>= 9.0.0), ant, openjdk-8-jdk, ros-noetic-catkin
Homepage: http://ros.org/wiki/rosjava_build_tools
Standards-Version: 3.9.2

Package: ros-noetic-rosjava-build-tools
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, ant, openjdk-8-jdk, ros-noetic-catkin
Description: Simple tools and catkin modules for rosjava development.
121 changes: 121 additions & 0 deletions scripts/setup/debians/rosjava/build-tools/patches/python3_compat.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
Index: ros-noetic-rosjava-build-tools/src/rosjava_build_tools/__init__.py
===================================================================
--- ros-noetic-rosjava-build-tools.orig/src/rosjava_build_tools/__init__.py
+++ ros-noetic-rosjava-build-tools/src/rosjava_build_tools/__init__.py
@@ -4,10 +4,11 @@
# Imports
##############################################################################

-import console
-from create_package import init_android_package, init_rosjava_package
-from create_android_project import create_android_project
-from create_rosjava_project import create_rosjava_project, create_rosjava_msg_project, create_rosjava_library_project
-from utils import which
-from release import scrape_for_release_message_packages
-import catkin
+from rosjava_build_tools import console
+from rosjava_build_tools.create_package import init_android_package, init_rosjava_package
+from rosjava_build_tools.create_android_project import create_android_project
+from rosjava_build_tools.create_rosjava_project import create_rosjava_project, create_rosjava_msg_project, create_rosjava_library_project
+from rosjava_build_tools.utils import which
+from rosjava_build_tools.release import scrape_for_release_message_packages
+from rosjava_build_tools import catkin
+
Index: ros-noetic-rosjava-build-tools/src/rosjava_build_tools/create_android_project.py
===================================================================
--- ros-noetic-rosjava-build-tools.orig/src/rosjava_build_tools/create_android_project.py
+++ ros-noetic-rosjava-build-tools/src/rosjava_build_tools/create_android_project.py
@@ -11,11 +11,10 @@ import sys
import argparse
import subprocess
import shutil
-import exceptions

# local imports
-import utils
-import console
+from rosjava_build_tools import utils
+from rosjava_build_tools import console

##############################################################################
# Methods
@@ -72,9 +71,9 @@ def actually_create_android_project(pack
except subprocess.CalledProcessError:
print("Error")
raise subprocess.CalledProcessError("failed to create android project.")
- except exceptions.OSError as e:
+ except OSError as e:
print("OS error" + str(e))
- raise exceptions.OSError()
+ raise OSError()

# This is in the old form, let's shovel the shit around to the new form
utils.mkdir_p(os.path.join(path, 'src', 'main', 'java'))
Index: ros-noetic-rosjava-build-tools/src/rosjava_build_tools/create_package.py
===================================================================
--- ros-noetic-rosjava-build-tools.orig/src/rosjava_build_tools/create_package.py
+++ ros-noetic-rosjava-build-tools/src/rosjava_build_tools/create_package.py
@@ -12,8 +12,8 @@ import catkin_pkg
from catkin_pkg.package_templates import create_package_xml, PackageTemplate

# local imports
-import utils
-import console
+from rosjava_build_tools import utils
+from rosjava_build_tools import console

##############################################################################
# Methods
Index: ros-noetic-rosjava-build-tools/src/rosjava_build_tools/create_rosjava_project.py
===================================================================
--- ros-noetic-rosjava-build-tools.orig/src/rosjava_build_tools/create_rosjava_project.py
+++ ros-noetic-rosjava-build-tools/src/rosjava_build_tools/create_rosjava_project.py
@@ -13,8 +13,8 @@ import argparse
import xml.etree.ElementTree as ElementTree

# local imports
-import utils
-import console
+from rosjava_build_tools import utils
+from rosjava_build_tools import console

##############################################################################
# Methods
Index: ros-noetic-rosjava-build-tools/src/rosjava_build_tools/release.py
===================================================================
--- ros-noetic-rosjava-build-tools.orig/src/rosjava_build_tools/release.py
+++ ros-noetic-rosjava-build-tools/src/rosjava_build_tools/release.py
@@ -6,7 +6,7 @@

import rosdistro
import catkin_pkg
-from . import catkin
+from rosjava_build_tools import catkin

##############################################################################
# Imports
@@ -16,9 +16,9 @@ from . import catkin
def scrape_for_release_message_packages(track):
url = rosdistro.get_index_url()
index = rosdistro.get_index(url)
- cache = rosdistro.get_release_cache(index, 'kinetic')
+ cache = rosdistro.get_release_cache(index, 'noetic')
packages = []
- for package_name, package_string in cache.package_xmls.iteritems():
+ for package_name, package_string in cache.package_xmls.items():
package = catkin_pkg.package.parse_package_string(package_string)
#print(" Name: %s" % package_name)
#print(" Buildtool Depends %s" % package.build)
Index: ros-noetic-rosjava-build-tools/src/rosjava_build_tools/utils.py
===================================================================
--- ros-noetic-rosjava-build-tools.orig/src/rosjava_build_tools/utils.py
+++ ros-noetic-rosjava-build-tools/src/rosjava_build_tools/utils.py
@@ -8,7 +8,7 @@ import os
import sys
import errno
import pwd
-import console
+from rosjava_build_tools import console

##############################################################################
# Methods
1 change: 1 addition & 0 deletions scripts/setup/debians/rosjava/build-tools/patches/series
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python3_compat.patch
Loading

0 comments on commit 11eab6f

Please sign in to comment.