diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index d2fb3bb2..44eca9ba 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -4,24 +4,54 @@ on: [push, pull_request] jobs: build_and_test: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 steps: - name: Install Java run: | sudo apt-get update -qq sudo apt-get install -y default-jdk gradle - uses: actions/checkout@v2 - - uses: ros-tooling/setup-ros@0.2.1 + - uses: ros-tooling/setup-ros@v0.2 with: - required-ros-distributions: dashing + required-ros-distributions: galactic - uses: ros-tooling/action-ros-ci@v0.2 with: package-name: rosidl_generator_java rcljava_common rcljava - target-ros2-distro: dashing + target-ros2-distro: galactic vcs-repo-file-url: ${{ github.workspace }}/ros2_java_desktop.repos build_android: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + include: + - colcon_meta: | + { + "names": { + "rcl": { + "cmake-args": [ "-DBUILD_TESTING=OFF" ] + }, + "rcl_yaml_param_parser": { + "cmake-args": [ "-DBUILD_TESTING=OFF" ] + }, + "rclcpp": { + "cmake-args": [ "-DBUILD_TESTING=OFF" ] + }, + "rclcpp_action": { + "cmake-args": [ "-DBUILD_TESTING=OFF" ] + }, + "rclcpp_lifecycle": { + "cmake-args": [ "-DBUILD_TESTING=OFF" ] + }, + "rcutils": { + "cmake-args": [ "-DBUILD_TESTING=OFF" ] + }, + "rosidl_typesupport_c": { + "cmake-args": [ "-DBUILD_TESTING=OFF" ] + }, + } + } steps: - name: Install Java run: | @@ -43,20 +73,25 @@ jobs: sudo apt-get update && sudo apt-get install -y python3-colcon-common-extensions python3-vcstool python3-lark-parser python3-dev - name: Install colcon extensions for Gradle run: | - sudo pip3 install git+git://github.com/colcon/colcon-gradle.git - sudo pip3 install git+git://github.com/colcon/colcon-ros-gradle.git + sudo pip3 install git+https://github.com/colcon/colcon-gradle.git + sudo pip3 install git+https://github.com/colcon/colcon-ros-gradle.git - name: Install Android NDK run: | curl -LO https://dl.google.com/android/repository/android-ndk-r21d-linux-x86_64.zip unzip android-ndk-r21d-linux-x86_64.zip + - name: Install QEMU emulation binaries + run: | + sudo apt-get update && sudo apt-get install -y qemu-user - name: Setup workspace with VCS repo file run: | mkdir -p ros2_java_ws/src cd ros2_java_ws curl -sL file://${{ github.workspace }}/ros2_java_android.repos | vcs import src # Use checked out version of ros2_java - rm -rf src/ros2_java/ros2_java - ln --symbolic ${{ github.workspace }} src/ros2_java + rm -rf src/ros2-java/ros2_java + ln --symbolic ${{ github.workspace }} src/ros2-java + - name: Create colcon defaults file + run: printf "${{matrix.colcon_meta}}" > ${{ github.workspace }}/colcon.meta - name: Build ros2_java for Android run: | export PYTHON3_EXEC="$( which python3 )" @@ -69,9 +104,11 @@ jobs: cd ros2_java_ws colcon build \ - --packages-ignore cyclonedds rcl_logging_log4cxx rosidl_generator_py \ + --packages-ignore cyclonedds rcl_logging_spdlog rcl_logging_log4cxx rosidl_generator_py \ --packages-up-to rcljava \ + --metas ${{ github.workspace }}/colcon.meta \ --cmake-args \ + -DRCL_LOGGING_IMPLEMENTATION=rcl_logging_noop \ -DPYTHON_EXECUTABLE=${PYTHON3_EXEC} \ -DPYTHON_LIBRARY=${PYTHON3_LIBRARY} \ -DPYTHON_INCLUDE_DIR=${PYTHON3_INCLUDE_DIR} \ @@ -82,6 +119,9 @@ jobs: -DANDROID_STL=c++_shared \ -DANDROID_ABI=${ANDROID_ABI} \ -DANDROID_NDK=${ANDROID_NDK} \ + -DANDROID=ON \ + -DTHIRDPARTY_android-ifaddrs=FORCE \ -DTHIRDPARTY=ON \ -DCOMPILE_EXAMPLES=OFF \ - -DCMAKE_FIND_ROOT_PATH="${PWD}/install" + -DCMAKE_FIND_ROOT_PATH="${PWD}/install" \ + -DCMAKE_CROSSCOMPILING_EMULATOR="/usr/bin/qemu-arm" diff --git a/README.md b/README.md index b9c17154..89e05c43 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ | Target | Status | |-------------------------------------------|---------------| -| **ROS Dashing - Ubuntu Bionic (OpenJDK)** | ![Build Status](https://github.com/ros2-java/ros2_java/workflows/CI/badge.svg?branch=dashing) | +| **ROS Galactic - Ubuntu Focal (OpenJDK)** | ![Build Status](https://github.com/ros2-java/ros2_java/workflows/CI/badge.svg?branch=main) | ## Introduction @@ -86,13 +86,13 @@ Make sure you have Gradle 3.2 (or later) installed. 1. Source your ROS 2 installation, for example: - source /opt/ros/dashing/setup.bash + source /opt/ros/galactic/setup.bash 1. Download the ROS 2 Java repositories into a workspace: mkdir -p ros2_java_ws/src cd ros2_java_ws - curl -skL https://raw.githubusercontent.com/ros2-java/ros2_java/dashing/ros2_java_desktop.repos | vcs import src + curl -skL https://raw.githubusercontent.com/ros2-java/ros2_java/main/ros2_java_desktop.repos | vcs import src 1. **Linux only** Install ROS dependencies: @@ -127,7 +127,7 @@ Although the `ros2_java_android.repos` file contains all the repositories for th mkdir -p $HOME/ros2_android_ws/src cd $HOME/ros2_android_ws - curl https://raw.githubusercontent.com/ros2-java/ros2_java/dashing/ros2_java_android.repos | vcs import src + curl https://raw.githubusercontent.com/ros2-java/ros2_java/main/ros2_java_android.repos | vcs import src 1. Set Android build configuration: diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 11359aff..00000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,19 +0,0 @@ -pool: - vmImage: 'Ubuntu 16.04' - -strategy: - matrix: - xenial_android: - ubuntu_distro: 'xenial' - docker_tag: 'android' - script_path: 'build_android.sh' - xenial_java: - ubuntu_distro: 'xenial' - docker_tag: 'java' - script_path: 'build_java.sh' - maxParallel: 2 - -steps: -- script: | - docker run -v $BUILD_SOURCESDIRECTORY/ci-scripts:/ci-scripts -e ROS2_JAVA_DIR=${AGENT_BUILDDIRECTORY}/ros2_java_build -e ROS2_JAVA_CI=1 -e ROS2_JAVA_BRANCH=${BUILD_SOURCEBRANCHNAME} -i --rm esteve/ros2-ubuntu-$UBUNTU_DISTRO-travisci:$DOCKER_TAG sh /ci-scripts/$SCRIPT_PATH - displayName: 'Build for $(ubuntu_distro) / $(docker_tag)' diff --git a/rcljava/include/org_ros2_rcljava_client_ClientImpl.h b/rcljava/include/org_ros2_rcljava_client_ClientImpl.h index c59635e0..9a3b20e5 100644 --- a/rcljava/include/org_ros2_rcljava_client_ClientImpl.h +++ b/rcljava/include/org_ros2_rcljava_client_ClientImpl.h @@ -25,9 +25,9 @@ extern "C" { * Method: nativeSendClientRequest * Signature: (JJJJJLorg/ros2/rcljava/interfaces/MessageDefinition;)V */ -JNIEXPORT void +JNIEXPORT jlong JNICALL Java_org_ros2_rcljava_client_ClientImpl_nativeSendClientRequest( - JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong, jobject); + JNIEnv *, jclass, jlong, jlong, jlong, jlong, jobject); /* * Class: org_ros2_rcljava_client_ClientImpl diff --git a/rcljava/package.xml b/rcljava/package.xml index 90da562f..340edf33 100644 --- a/rcljava/package.xml +++ b/rcljava/package.xml @@ -22,7 +22,7 @@ builtin_interfaces rcl_interfaces rmw - rosidl_generator_c + rosidl_runtime_c rosidl_generator_java rosidl_typesupport_c @@ -31,7 +31,7 @@ rcl rmw_implementation_cmake rmw_implementation - rosidl_generator_c + rosidl_runtime_c rosidl_parser ament_lint_auto @@ -41,7 +41,9 @@ rcljava_common rmw_implementation_cmake rmw - rosidl_generator_c + rosidl_runtime_c + + rosidl_generator_cpp rosidl_generator_java std_msgs diff --git a/rcljava/src/main/cpp/org_ros2_rcljava_RCLJava.cpp b/rcljava/src/main/cpp/org_ros2_rcljava_RCLJava.cpp index 0f2ef0d4..a4f5717f 100644 --- a/rcljava/src/main/cpp/org_ros2_rcljava_RCLJava.cpp +++ b/rcljava/src/main/cpp/org_ros2_rcljava_RCLJava.cpp @@ -23,7 +23,7 @@ #include "rcl/rcl.h" #include "rcl/timer.h" #include "rmw/rmw.h" -#include "rosidl_generator_c/message_type_support_struct.h" +#include "rosidl_runtime_c/message_type_support_struct.h" #include "rcljava_common/exceptions.hpp" #include "rcljava_common/signatures.hpp" diff --git a/rcljava/src/main/cpp/org_ros2_rcljava_client_ClientImpl.cpp b/rcljava/src/main/cpp/org_ros2_rcljava_client_ClientImpl.cpp index 0455c306..842b7d99 100644 --- a/rcljava/src/main/cpp/org_ros2_rcljava_client_ClientImpl.cpp +++ b/rcljava/src/main/cpp/org_ros2_rcljava_client_ClientImpl.cpp @@ -23,7 +23,7 @@ #include "rcl/node.h" #include "rcl/rcl.h" #include "rmw/rmw.h" -#include "rosidl_generator_c/message_type_support_struct.h" +#include "rosidl_runtime_c/message_type_support_struct.h" #include "rcljava_common/exceptions.hpp" #include "rcljava_common/signatures.hpp" @@ -34,9 +34,9 @@ using rcljava_common::exceptions::rcljava_throw_rclexception; using rcljava_common::signatures::convert_from_java_signature; using rcljava_common::signatures::destroy_ros_message_signature; -JNIEXPORT void JNICALL +JNIEXPORT jlong JNICALL Java_org_ros2_rcljava_client_ClientImpl_nativeSendClientRequest( - JNIEnv * env, jclass, jlong client_handle, jlong sequence_number, + JNIEnv * env, jclass, jlong client_handle, jlong jrequest_from_java_converter_handle, jlong jrequest_to_java_converter_handle, jlong jrequest_destructor_handle, jobject jrequest_msg) { @@ -53,6 +53,7 @@ Java_org_ros2_rcljava_client_ClientImpl_nativeSendClientRequest( void * request_msg = convert_from_java(jrequest_msg, nullptr); + int64_t sequence_number; rcl_ret_t ret = rcl_send_request(client, request_msg, &sequence_number); destroy_ros_message_signature destroy_ros_message = @@ -65,6 +66,7 @@ Java_org_ros2_rcljava_client_ClientImpl_nativeSendClientRequest( rcl_reset_error(); rcljava_throw_rclexception(env, ret, msg); } + return static_cast(sequence_number); } JNIEXPORT void JNICALL diff --git a/rcljava/src/main/cpp/org_ros2_rcljava_executors_BaseExecutor.cpp b/rcljava/src/main/cpp/org_ros2_rcljava_executors_BaseExecutor.cpp index e87daaa4..ad515de5 100644 --- a/rcljava/src/main/cpp/org_ros2_rcljava_executors_BaseExecutor.cpp +++ b/rcljava/src/main/cpp/org_ros2_rcljava_executors_BaseExecutor.cpp @@ -23,7 +23,7 @@ #include "rcl/rcl.h" #include "rcl/timer.h" #include "rmw/rmw.h" -#include "rosidl_generator_c/message_type_support_struct.h" +#include "rosidl_runtime_c/message_type_support_struct.h" #include "rcljava_common/exceptions.hpp" #include "rcljava_common/signatures.hpp" diff --git a/rcljava/src/main/cpp/org_ros2_rcljava_node_NodeImpl.cpp b/rcljava/src/main/cpp/org_ros2_rcljava_node_NodeImpl.cpp index 618c8c03..16b6ed4c 100644 --- a/rcljava/src/main/cpp/org_ros2_rcljava_node_NodeImpl.cpp +++ b/rcljava/src/main/cpp/org_ros2_rcljava_node_NodeImpl.cpp @@ -22,7 +22,7 @@ #include "rcl/node.h" #include "rcl/rcl.h" #include "rmw/rmw.h" -#include "rosidl_generator_c/message_type_support_struct.h" +#include "rosidl_runtime_c/message_type_support_struct.h" #include "rcljava_common/exceptions.hpp" #include "rcljava_common/signatures.hpp" diff --git a/rcljava/src/main/cpp/org_ros2_rcljava_service_ServiceImpl.cpp b/rcljava/src/main/cpp/org_ros2_rcljava_service_ServiceImpl.cpp index f4708f6c..bfec845c 100644 --- a/rcljava/src/main/cpp/org_ros2_rcljava_service_ServiceImpl.cpp +++ b/rcljava/src/main/cpp/org_ros2_rcljava_service_ServiceImpl.cpp @@ -22,7 +22,7 @@ #include "rcl/node.h" #include "rcl/rcl.h" #include "rmw/rmw.h" -#include "rosidl_generator_c/message_type_support_struct.h" +#include "rosidl_runtime_c/message_type_support_struct.h" #include "rcljava_common/exceptions.hpp" #include "rcljava_common/signatures.hpp" diff --git a/rcljava/src/main/cpp/org_ros2_rcljava_subscription_SubscriptionImpl.cpp b/rcljava/src/main/cpp/org_ros2_rcljava_subscription_SubscriptionImpl.cpp index eedb9242..151bc0a0 100644 --- a/rcljava/src/main/cpp/org_ros2_rcljava_subscription_SubscriptionImpl.cpp +++ b/rcljava/src/main/cpp/org_ros2_rcljava_subscription_SubscriptionImpl.cpp @@ -22,7 +22,7 @@ #include "rcl/node.h" #include "rcl/rcl.h" #include "rmw/rmw.h" -#include "rosidl_generator_c/message_type_support_struct.h" +#include "rosidl_runtime_c/message_type_support_struct.h" #include "rcljava_common/exceptions.hpp" #include "rcljava_common/signatures.hpp" diff --git a/rcljava/src/main/java/org/ros2/rcljava/client/ClientImpl.java b/rcljava/src/main/java/org/ros2/rcljava/client/ClientImpl.java index 076b99cc..70ff3074 100644 --- a/rcljava/src/main/java/org/ros2/rcljava/client/ClientImpl.java +++ b/rcljava/src/main/java/org/ros2/rcljava/client/ClientImpl.java @@ -17,6 +17,7 @@ import java.time.Duration; import java.lang.ref.WeakReference; +import java.lang.IllegalStateException; import java.lang.InterruptedException; import java.lang.Long; import java.util.AbstractMap; @@ -52,7 +53,6 @@ public class ClientImpl implements Client { private final WeakReference nodeReference; private long handle; private final String serviceName; - private long sequenceNumber = 0; private Map> pendingRequests; private final Class requestType; @@ -79,8 +79,8 @@ public void accept(Future input) {} public final Future asyncSendRequest(final U request, final Consumer> callback) { synchronized (pendingRequests) { - sequenceNumber++; - nativeSendClientRequest(handle, sequenceNumber, request.getFromJavaConverterInstance(), + long sequenceNumber = nativeSendClientRequest( + handle, request.getFromJavaConverterInstance(), request.getToJavaConverterInstance(), request.getDestructorInstance(), request); RCLFuture future = new RCLFuture(this.nodeReference); @@ -96,15 +96,20 @@ public final void handleResponse( synchronized (pendingRequests) { long sequenceNumber = header.sequenceNumber; Map.Entry entry = pendingRequests.remove(sequenceNumber); - Consumer callback = entry.getKey(); - RCLFuture future = entry.getValue(); - future.set(response); - callback.accept(future); + if (entry != null) { + Consumer callback = entry.getKey(); + RCLFuture future = entry.getValue(); + future.set(response); + callback.accept(future); + return; + } + throw new IllegalStateException( + "No request made with the given sequence number: " + sequenceNumber); } } - private static native void nativeSendClientRequest(long handle, long sequenceNumber, - long requestFromJavaConverterHandle, long requestToJavaConverterHandle, + private static native long nativeSendClientRequest( + long handle, long requestFromJavaConverterHandle, long requestToJavaConverterHandle, long requestDestructorHandle, MessageDefinition requestMessage); public final Class getRequestType() { diff --git a/rcljava_common/cmake/Modules/JavaExtra.cmake b/rcljava_common/cmake/Modules/JavaExtra.cmake index 461aa667..0ab52441 100644 --- a/rcljava_common/cmake/Modules/JavaExtra.cmake +++ b/rcljava_common/cmake/Modules/JavaExtra.cmake @@ -106,11 +106,11 @@ function(ament_add_junit_tests TARGET_NAME) set(${TARGET_NAME}_jar_dependencies "${JUNIT_JAR}${SEPARATOR}${HAMCREST_JAR}") add_jar("${TARGET_NAME}_jar" - "${_source_files}" + SOURCES "${_source_files}" OUTPUT_NAME "${TARGET_NAME}" INCLUDE_JARS - "${ARG_INCLUDE_JARS}" + ${ARG_INCLUDE_JARS} "${JUNIT_JAR}" "${HAMCREST_JAR}" ) diff --git a/ros2_java_android.repos b/ros2_java_android.repos index 6e7eb9b8..9ee3bba2 100644 --- a/ros2_java_android.repos +++ b/ros2_java_android.repos @@ -2,144 +2,172 @@ repositories: ament/ament_cmake: type: git url: https://github.com/ament/ament_cmake.git - version: dashing + version: galactic ament/ament_index: type: git url: https://github.com/ament/ament_index.git - version: dashing + version: galactic ament/ament_lint: type: git url: https://github.com/ament/ament_lint.git - version: dashing + version: galactic ament/ament_package: type: git url: https://github.com/ament/ament_package.git - version: dashing + version: galactic + ament/google_benchmark_vendor: + type: git + url: https://github.com/ament/google_benchmark_vendor.git + version: main ament/googletest: type: git url: https://github.com/ament/googletest.git - version: dashing + version: galactic ament/uncrustify_vendor: type: git url: https://github.com/ament/uncrustify_vendor.git - version: dashing - ament/ament_java: - type: git - url: https://github.com/ros2-java/ament_java.git - version: main + version: galactic eProsima/Fast-CDR: type: git url: https://github.com/eProsima/Fast-CDR.git - version: v1.0.11 + version: v1.0.20 eProsima/Fast-DDS: type: git url: https://github.com/eProsima/Fast-DDS.git - version: v1.8.2 + version: 2.3.x + eProsima/foonathan_memory_vendor: + type: git + url: https://github.com/eProsima/foonathan_memory_vendor.git + version: master osrf/osrf_pycommon: type: git url: https://github.com/osrf/osrf_pycommon.git - version: dashing + version: master osrf/osrf_testing_tools_cpp: type: git - url: https://github.com/ros2-java/osrf_testing_tools_cpp.git - version: dashing-android + url: https://github.com/osrf/osrf_testing_tools_cpp.git + version: master + ros-tooling/libstatistics_collector: + type: git + url: https://github.com/ros-tooling/libstatistics_collector.git + version: master + ros-tracing/ros2_tracing: + type: git + url: https://gitlab.com/ros-tracing/ros2_tracing.git + version: master ros2/ament_cmake_ros: type: git url: https://github.com/ros2/ament_cmake_ros.git - version: dashing + version: galactic ros2/common_interfaces: type: git url: https://github.com/ros2/common_interfaces.git - version: dashing + version: galactic ros2/example_interfaces: type: git url: https://github.com/ros2/example_interfaces.git - version: dashing + version: galactic ros2/launch: type: git url: https://github.com/ros2/launch.git - version: dashing - ros2/poco_vendor: + version: galactic + ros2/libyaml_vendor: + type: git + url: https://github.com/ros2/libyaml_vendor.git + version: galactic + ros2/performance_test_fixture: type: git - url: https://github.com/ros2/poco_vendor.git - version: dashing + url: https://github.com/ros2/performance_test_fixture.git + version: main + ros2/python_cmake_module: + type: git + url: https://github.com/ros2/python_cmake_module.git + version: galactic ros2/rcl: type: git url: https://github.com/ros2/rcl.git - version: dashing + version: galactic ros2/rcl_interfaces: type: git url: https://github.com/ros2/rcl_interfaces.git - version: dashing + version: galactic ros2/rcl_logging: type: git url: https://github.com/ros2/rcl_logging.git - version: dashing + version: galactic ros2/rcpputils: type: git url: https://github.com/ros2/rcpputils.git - version: dashing + version: galactic ros2/rcutils: type: git url: https://github.com/ros2/rcutils.git - version: dashing + version: galactic ros2/rmw: type: git url: https://github.com/ros2/rmw.git - version: dashing + version: galactic + ros2/rmw_dds_common: + type: git + url: https://github.com/ros2/rmw_dds_common.git + version: galactic ros2/rmw_fastrtps: type: git url: https://github.com/ros2/rmw_fastrtps.git - version: dashing + version: galactic ros2/rmw_implementation: type: git url: https://github.com/ros2/rmw_implementation.git - version: dashing + version: galactic ros2/rosidl: type: git url: https://github.com/ros2/rosidl.git - version: dashing + version: galactic ros2/rosidl_dds: type: git url: https://github.com/ros2/rosidl_dds.git - version: dashing + version: galactic ros2/rosidl_defaults: type: git url: https://github.com/ros2/rosidl_defaults.git - version: dashing + version: galactic ros2/rosidl_python: type: git url: https://github.com/ros2/rosidl_python.git - version: dashing + version: galactic ros2/rosidl_typesupport: type: git url: https://github.com/ros2/rosidl_typesupport.git - version: dashing + version: galactic ros2/rosidl_typesupport_fastrtps: type: git url: https://github.com/ros2/rosidl_typesupport_fastrtps.git - version: dashing + version: galactic + ros2/rpyutils: + type: git + url: https://github.com/ros2/rpyutils.git + version: galactic ros2/test_interface_files: type: git url: https://github.com/ros2/test_interface_files.git - version: dashing - ros2/tinydir_vendor: - type: git - url: https://github.com/ros2/tinydir_vendor.git - version: dashing + version: galactic ros2/unique_identifier_msgs: type: git url: https://github.com/ros2/unique_identifier_msgs.git - version: dashing - ros2_java/ros2_java: + version: galactic + ros2-java/ament_java: type: git - url: https://github.com/ros2-java/ros2_java - version: dashing - ros2_java/ros2_android: + url: https://github.com/ros2-java/ament_java.git + version: main + ros2-java/ros2_java: + type: git + url: https://github.com/ros2-java/ros2_java.git + version: main + ros2-java/ros2_android: type: git url: https://github.com/ros2-java/ros2_android.git - version: master - ros2_java/ros2_android_examples: + version: main + ros2-java/ros2_android_examples: type: git - url: https://github.com/ros2-java/ros2_android_examples - version: master + url: https://github.com/ros2-java/ros2_android_examples.git + version: main diff --git a/ros2_java_desktop.repos b/ros2_java_desktop.repos index 862f0fbd..1b10ef90 100644 --- a/ros2_java_desktop.repos +++ b/ros2_java_desktop.repos @@ -1,33 +1,33 @@ repositories: - ament/ament_java: - type: git - url: https://github.com/ros2-java/ament_java.git - version: main ros2/common_interfaces: type: git url: https://github.com/ros2/common_interfaces.git - version: dashing + version: galactic ros2/example_interfaces: type: git url: https://github.com/ros2/example_interfaces.git - version: dashing + version: galactic ros2/rcl_interfaces: type: git url: https://github.com/ros2/rcl_interfaces.git - version: dashing + version: galactic ros2/rosidl_defaults: type: git url: https://github.com/ros2/rosidl_defaults.git - version: dashing + version: galactic ros2/unique_identifier_msgs: type: git url: https://github.com/ros2/unique_identifier_msgs.git - version: dashing - ros2_java/ros2_java: + version: galactic + ros2-java/ament_java: + type: git + url: https://github.com/ros2-java/ament_java.git + version: main + ros2-java/ros2_java: type: git url: https://github.com/ros2-java/ros2_java.git - version: dashing - ros2_java/ros2_java_examples: + version: main + ros2-java/ros2_java_examples: type: git url: https://github.com/ros2-java/ros2_java_examples.git - version: master + version: main diff --git a/ros2_java_desktop_travis.repos b/ros2_java_desktop_travis.repos deleted file mode 100644 index 9cedbc35..00000000 --- a/ros2_java_desktop_travis.repos +++ /dev/null @@ -1,113 +0,0 @@ -repositories: - eProsima/Fast-CDR: - type: git - url: https://github.com/eProsima/Fast-CDR.git - version: v1.0.7 - eProsima/Fast-RTPS: - type: git - url: https://github.com/eProsima/Fast-RTPS.git - version: 7a0b0fe7ca8d2c4ea41e36744c6024c263a6505a - ros/class_loader: - type: git - url: https://github.com/ros/class_loader.git - version: 1.1.0 - ros/console_bridge: - type: git - url: https://github.com/ros/console_bridge.git - version: ad25f7307da76be2857545e7e5c2a20727eee542 - ros2/console_bridge_vendor: - type: git - url: https://github.com/ros2/console_bridge_vendor.git - version: master - ros2/ament_cmake_ros: - type: git - url: https://github.com/ros2/ament_cmake_ros.git - version: 0.5.0 - ros2/rcutils: - type: git - url: https://github.com/ros2/rcutils.git - version: 0.5.1 - ros2/common_interfaces: - type: git - url: https://github.com/ros2/common_interfaces.git - version: 0.5.0 - ros2/example_interfaces: - type: git - url: https://github.com/ros2/example_interfaces.git - version: 0.5.0 - ros2/launch: - type: git - url: https://github.com/ros2/launch.git - version: 0.5.2 - ros2/libyaml_vendor: - type: git - url: https://github.com/ros2/libyaml_vendor.git - version: 1.0.0 - ros2/poco_vendor: - type: git - url: https://github.com/ros2/poco_vendor.git - version: 1.1.1 - ros2/rcl: - type: git - url: https://github.com/ros2/rcl.git - version: 0.5.1 - ros2/rcl_interfaces: - type: git - url: https://github.com/ros2/rcl_interfaces.git - version: master - ros2/rclpy: - type: git - url: https://github.com/ros2/rclpy.git - version: 0.5.3 - ros2/rmw: - type: git - url: https://github.com/ros2/rmw.git - version: 0.5.0 - ros2/rmw_fastrtps: - type: git - url: https://github.com/ros2/rmw_fastrtps.git - version: 0.5.1 - ros2/rmw_implementation: - type: git - url: https://github.com/ros2/rmw_implementation.git - version: 0.5.1 - ros2/rmw_opensplice: - type: git - url: https://github.com/ros2/rmw_opensplice.git - version: 0.5.2 - ros2/rosidl_typesupport_opensplice: - type: git - url: https://github.com/ros2/rosidl_typesupport_opensplice.git - version: 0.5.0 - ros2/ros2cli: - type: git - url: https://github.com/ros2/ros2cli.git - version: 0.5.3 - ros2/rosidl: - type: git - url: https://github.com/ros2/rosidl.git - version: 0.5.1 - ros2/rosidl_dds: - type: git - url: https://github.com/ros2/rosidl_dds.git - version: 0.5.0 - ros2/rosidl_defaults: - type: git - url: https://github.com/ros2/rosidl_defaults.git - version: 0.5.0 - ros2/rosidl_python: - type: git - url: https://github.com/ros2/rosidl_python.git - version: 0.5.2 - ros2/rosidl_typesupport: - type: git - url: https://github.com/ros2/rosidl_typesupport.git - version: 0.5.0 - ros2_java/ros2_java: - type: git - url: https://github.com/esteve/ros2_java.git - version: master - ros2_java/ros2_java_examples: - type: git - url: https://github.com/esteve/ros2_java_examples.git - version: master diff --git a/rosidl_generator_java/CMakeLists.txt b/rosidl_generator_java/CMakeLists.txt index bd4c94b4..76a31477 100644 --- a/rosidl_generator_java/CMakeLists.txt +++ b/rosidl_generator_java/CMakeLists.txt @@ -28,7 +28,7 @@ ament_index_register_resource("rosidl_generator_packages") if(BUILD_TESTING) find_package(rosidl_cmake REQUIRED) - find_package(rosidl_generator_c REQUIRED) + find_package(rosidl_runtime_c REQUIRED) find_package(test_interface_files REQUIRED) # Disable flake8 linter diff --git a/rosidl_generator_java/cmake/rosidl_generator_java_generate_interfaces.cmake b/rosidl_generator_java/cmake/rosidl_generator_java_generate_interfaces.cmake index 31dc1a59..0093329c 100644 --- a/rosidl_generator_java/cmake/rosidl_generator_java_generate_interfaces.cmake +++ b/rosidl_generator_java/cmake/rosidl_generator_java_generate_interfaces.cmake @@ -15,6 +15,7 @@ find_package(ament_cmake_export_jars REQUIRED) find_package(ament_cmake_export_jni_libraries REQUIRED) find_package(rosidl_generator_c REQUIRED) +find_package(rosidl_typesupport_c REQUIRED) find_package(rmw_implementation_cmake REQUIRED) find_package(rmw REQUIRED) find_package(rcljava_common REQUIRED) @@ -71,8 +72,12 @@ foreach(_abs_idl_file ${rosidl_generate_interfaces_ABS_IDL_FILES}) "${_output_path}/${_parent_folder}/${_idl_name}_Response.java" ) foreach(_typesupport_impl ${_typesupport_impls}) - list(APPEND _generated_extension_${_typesupport_impl}_files "${_output_path}/${_parent_folder}/${_idl_name}_Request.ep.${_typesupport_impl}.cpp") - list(APPEND _generated_extension_${_typesupport_impl}_files "${_output_path}/${_parent_folder}/${_idl_name}_Response.ep.${_typesupport_impl}.cpp") + list(APPEND _generated_extension_${_typesupport_impl}_files + "${_output_path}/${_parent_folder}/${_idl_name}_Request.ep.${_typesupport_impl}.cpp" + ) + list(APPEND _generated_extension_${_typesupport_impl}_files + "${_output_path}/${_parent_folder}/${_idl_name}_Response.ep.${_typesupport_impl}.cpp" + ) endforeach() endif() # Actions generate extra files @@ -89,20 +94,24 @@ foreach(_abs_idl_file ${rosidl_generate_interfaces_ABS_IDL_FILES}) "${_output_path}/${_parent_folder}/${_idl_name}_GetResult_Response.java" ) foreach(_typesupport_impl ${_typesupport_impls}) - list(APPEND _generated_extension_${_typesupport_impl}_files "${_output_path}/${_parent_folder}/${_idl_name}_Goal.ep.${_typesupport_impl}.cpp") - list(APPEND _generated_extension_${_typesupport_impl}_files "${_output_path}/${_parent_folder}/${_idl_name}_Result.ep.${_typesupport_impl}.cpp") - list(APPEND _generated_extension_${_typesupport_impl}_files "${_output_path}/${_parent_folder}/${_idl_name}_Feedback.ep.${_typesupport_impl}.cpp") - list(APPEND _generated_extension_${_typesupport_impl}_files "${_output_path}/${_parent_folder}/${_idl_name}_SendGoal.ep.${_typesupport_impl}.cpp") - list(APPEND _generated_extension_${_typesupport_impl}_files "${_output_path}/${_parent_folder}/${_idl_name}_SendGoal_Request.ep.${_typesupport_impl}.cpp") - list(APPEND _generated_extension_${_typesupport_impl}_files "${_output_path}/${_parent_folder}/${_idl_name}_SendGoal_Response.ep.${_typesupport_impl}.cpp") - list(APPEND _generated_extension_${_typesupport_impl}_files "${_output_path}/${_parent_folder}/${_idl_name}_GetResult.ep.${_typesupport_impl}.cpp") - list(APPEND _generated_extension_${_typesupport_impl}_files "${_output_path}/${_parent_folder}/${_idl_name}_GetResult_Request.ep.${_typesupport_impl}.cpp") - list(APPEND _generated_extension_${_typesupport_impl}_files "${_output_path}/${_parent_folder}/${_idl_name}_GetResult_Response.ep.${_typesupport_impl}.cpp") + list(APPEND _generated_extension_${_typesupport_impl}_files + "${_output_path}/${_parent_folder}/${_idl_name}_Goal.ep.${_typesupport_impl}.cpp" + "${_output_path}/${_parent_folder}/${_idl_name}_Result.ep.${_typesupport_impl}.cpp" + "${_output_path}/${_parent_folder}/${_idl_name}_Feedback.ep.${_typesupport_impl}.cpp" + "${_output_path}/${_parent_folder}/${_idl_name}_SendGoal.ep.${_typesupport_impl}.cpp" + "${_output_path}/${_parent_folder}/${_idl_name}_SendGoal_Request.ep.${_typesupport_impl}.cpp" + "${_output_path}/${_parent_folder}/${_idl_name}_SendGoal_Response.ep.${_typesupport_impl}.cpp" + "${_output_path}/${_parent_folder}/${_idl_name}_GetResult.ep.${_typesupport_impl}.cpp" + "${_output_path}/${_parent_folder}/${_idl_name}_GetResult_Request.ep.${_typesupport_impl}.cpp" + "${_output_path}/${_parent_folder}/${_idl_name}_GetResult_Response.ep.${_typesupport_impl}.cpp" + ) endforeach() endif() foreach(_typesupport_impl ${_typesupport_impls}) - list(APPEND _generated_extension_${_typesupport_impl}_files "${_output_path}/${_parent_folder}/${_idl_name}.ep.${_typesupport_impl}.cpp") + list(APPEND _generated_extension_${_typesupport_impl}_files + "${_output_path}/${_parent_folder}/${_idl_name}.ep.${_typesupport_impl}.cpp" + ) endforeach() endforeach() @@ -244,6 +253,7 @@ foreach(_generated_cpp_file ${_generated_extension_files}) target_link_libraries( ${_library_name} ${PROJECT_NAME}__${_typesupport_impl} + ${rosidl_generate_interfaces_TARGET}__rosidl_generator_c ${_extension_link_flags} ) rosidl_target_interfaces(${_library_name} diff --git a/rosidl_generator_java/cmake/rosidl_generator_java_get_typesupports.cmake b/rosidl_generator_java/cmake/rosidl_generator_java_get_typesupports.cmake index 434bfda0..d51d1a1f 100644 --- a/rosidl_generator_java/cmake/rosidl_generator_java_get_typesupports.cmake +++ b/rosidl_generator_java/cmake/rosidl_generator_java_get_typesupports.cmake @@ -12,19 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -macro(accumulate_typesupports) - set(_typesupport_impl_tmp "") - get_rmw_typesupport(_typesupport_impl_tmp ${rmw_implementation} LANGUAGE "C") - list(APPEND _typesupport_impls_tmp ${_typesupport_impl_tmp}) -endmacro() - macro(rosidl_generator_java_get_typesupports TYPESUPPORT_IMPLS) set(${TYPESUPPORT_IMPLS} "") - set(_typesupport_impls_tmp "") - set(_typesupport_impls_tmp_unique "") - call_for_each_rmw_implementation(accumulate_typesupports) - - foreach(_typesupport_impl ${_typesupport_impls_tmp}) - list_append_unique(${TYPESUPPORT_IMPLS} ${_typesupport_impl}) + ament_index_get_resources(${TYPESUPPORT_IMPLS} "rosidl_typesupport_c") + list(APPEND ${TYPESUPPORT_IMPLS} "rosidl_typesupport_c") + foreach(_typesupport ${${TYPESUPPORT_IMPLS}}) + find_package(${_typesupport} QUIET) + if(NOT ${_typesupport}_FOUND) + list(REMOVE_ITEM ${TYPESUPPORT_IMPLS} "${_typesupport}") + endif() endforeach() endmacro() diff --git a/rosidl_generator_java/package.xml b/rosidl_generator_java/package.xml index ebf566eb..3594eb25 100644 --- a/rosidl_generator_java/package.xml +++ b/rosidl_generator_java/package.xml @@ -22,18 +22,20 @@ rosidl_typesupport_c rosidl_typesupport_interface - rmw_implementation rmw_implementation_cmake - rosidl_generator_c + rosidl_runtime_c rosidl_parser ament_cmake_gtest ament_lint_auto ament_lint_common - rmw_implementation rmw_implementation_cmake - rosidl_generator_c + + rosidl_generator_cpp + rosidl_runtime_c rosidl_cmake rosidl_parser @@ -41,7 +43,6 @@ rosidl_typesupport_c rosidl_typesupport_fastrtps_c rosidl_typesupport_introspection_c - rosidl_typesupport_opensplice_c test_interface_files rosidl_generator_packages diff --git a/rosidl_generator_java/resource/action.cpp.em b/rosidl_generator_java/resource/action.cpp.em index b093b313..0d3492e4 100644 --- a/rosidl_generator_java/resource/action.cpp.em +++ b/rosidl_generator_java/resource/action.cpp.em @@ -88,7 +88,7 @@ expand_template( #include -#include "rosidl_generator_c/action_type_support_struct.h" +#include "rosidl_runtime_c/action_type_support_struct.h" #include "@(idl_structure_type_to_c_include_prefix(action.namespaced_type)).h" diff --git a/rosidl_generator_java/resource/msg.cpp.em b/rosidl_generator_java/resource/msg.cpp.em index 681083e6..a7008a53 100644 --- a/rosidl_generator_java/resource/msg.cpp.em +++ b/rosidl_generator_java/resource/msg.cpp.em @@ -43,20 +43,20 @@ for member in message.structure.members: cache[array_list_normalized_type] = array_list_jni_type type_ = type_.value_type if isinstance(type_, BasicType): - member_includes.add('rosidl_generator_c/primitives_sequence.h') - member_includes.add('rosidl_generator_c/primitives_sequence_functions.h') + member_includes.add('rosidl_runtime_c/primitives_sequence.h') + member_includes.add('rosidl_runtime_c/primitives_sequence_functions.h') # We do not cache strings because java.lang.String behaves differently if not isinstance(type_, AbstractGenericString): cache[get_normalized_type(type_)] = get_jni_type(type_) if isinstance(type_, AbstractString): - member_includes.add('rosidl_generator_c/string.h') - member_includes.add('rosidl_generator_c/string_functions.h') + member_includes.add('rosidl_runtime_c/string.h') + member_includes.add('rosidl_runtime_c/string_functions.h') if isinstance(type_, AbstractWString): - member_includes.add('rosidl_generator_c/u16string.h') - member_includes.add('rosidl_generator_c/u16string_functions.h') + member_includes.add('rosidl_runtime_c/u16string.h') + member_includes.add('rosidl_runtime_c/u16string_functions.h') if isinstance(type_, NamespacedType): namespaced_types.add(get_jni_type(type_)) @@ -110,7 +110,7 @@ elif message_c_include_prefix.endswith('__get_result'): #include #include -#include "rosidl_generator_c/message_type_support_struct.h" +#include "rosidl_runtime_c/message_type_support_struct.h" #include "rcljava_common/exceptions.hpp" #include "rcljava_common/signatures.hpp" @@ -232,16 +232,16 @@ normalized_type = get_normalized_type(member.type) jmethodID _jlist_@(member.name)_size_mid = env->GetMethodID(_j@(list_normalized_type)_class_global, "size", "()I"); jint _jlist_@(member.name)_size = env->CallIntMethod(_jlist_@(member.name)_object, _jlist_@(member.name)_size_mid); @[ if isinstance(member.type.value_type, AbstractString)]@ - if (!rosidl_generator_c__String__Sequence__init(&(ros_message->@(member.name)), _jlist_@(member.name)_size)) { + if (!rosidl_runtime_c__String__Sequence__init(&(ros_message->@(member.name)), _jlist_@(member.name)_size)) { rcljava_throw_exception(env, "java/lang/IllegalStateException", "unable to create String__Array ros_message"); } @[ elif isinstance(member.type.value_type, AbstractWString)]@ - if (!rosidl_generator_c__U16String__Sequence__init(&(ros_message->@(member.name)), _jlist_@(member.name)_size)) { + if (!rosidl_runtime_c__U16String__Sequence__init(&(ros_message->@(member.name)), _jlist_@(member.name)_size)) { rcljava_throw_exception(env, "java/lang/IllegalStateException", "unable to create U16String__Array ros_message"); } @[ else]@ @[ if isinstance(member.type.value_type, BasicType)]@ - if (!rosidl_generator_c__@(member.type.value_type.typename)__Sequence__init(&(ros_message->@(member.name)), _jlist_@(member.name)_size)) { + if (!rosidl_runtime_c__@(member.type.value_type.typename)__Sequence__init(&(ros_message->@(member.name)), _jlist_@(member.name)_size)) { rcljava_throw_exception(env, "java/lang/IllegalStateException", "unable to create @(member.type.value_type)__Array ros_message"); } @[ else]@ @@ -264,7 +264,7 @@ normalized_type = get_normalized_type(member.type) jstring _jfield_@(member.name)_value = static_cast(element); if (_jfield_@(member.name)_value != nullptr) { const char * _str@(member.name) = env->GetStringUTFChars(_jfield_@(member.name)_value, 0); - rosidl_generator_c__String__assign( + rosidl_runtime_c__String__assign( &_dest_@(member.name)[i], _str@(member.name)); env->ReleaseStringUTFChars(_jfield_@(member.name)_value, _str@(member.name)); } @@ -272,7 +272,7 @@ normalized_type = get_normalized_type(member.type) jstring _jfield_@(member.name)_value = static_cast(element); if (_jfield_@(member.name)_value != nullptr) { const jchar * _str@(member.name) = env->GetStringChars(_jfield_@(member.name)_value, 0); - rosidl_generator_c__U16String__assign( + rosidl_runtime_c__U16String__assign( &_dest_@(member.name)[i], _str@(member.name)); env->ReleaseStringChars(_jfield_@(member.name)_value, _str@(member.name)); } @@ -295,12 +295,12 @@ call_method_name = 'Call%sMethod' % get_java_type(member.type.value_type, use_pr if (_jvalue@(member.name) != nullptr) { @[ if isinstance(member.type, AbstractString)]@ const char * _str@(member.name) = env->GetStringUTFChars(_jvalue@(member.name), 0); - rosidl_generator_c__String__assign( + rosidl_runtime_c__String__assign( &ros_message->@(member.name), _str@(member.name)); env->ReleaseStringUTFChars(_jvalue@(member.name), _str@(member.name)); @[ else]@ const jchar * _str@(member.name) = env->GetStringChars(_jvalue@(member.name), 0); - rosidl_generator_c__U16String__assign( + rosidl_runtime_c__U16String__assign( &ros_message->@(member.name), _str@(member.name)); env->ReleaseStringChars(_jvalue@(member.name), _str@(member.name)); @[ end if]@ diff --git a/rosidl_generator_java/resource/srv.cpp.em b/rosidl_generator_java/resource/srv.cpp.em index 7bf6209b..4c13f6b5 100644 --- a/rosidl_generator_java/resource/srv.cpp.em +++ b/rosidl_generator_java/resource/srv.cpp.em @@ -38,7 +38,7 @@ expand_template( #include -#include "rosidl_generator_c/service_type_support_struct.h" +#include "rosidl_runtime_c/service_type_support_struct.h" @{ include_prefix = idl_structure_type_to_c_include_prefix(service.namespaced_type)