diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f413596e8..662ef293a 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -16,14 +16,9 @@ jobs: strategy: matrix: ros_distribution: - - foxy - humble - rolling include: - # Foxy Fitzroy (June 2020 - May 2023) - - docker_image: rostooling/setup-ros-docker:ubuntu-focal-ros-foxy-ros-base-latest - ros_distribution: foxy - ros_version: 2 # Humble Hawksbill (May 2022 - May 2027) - docker_image: rostooling/setup-ros-docker:ubuntu-jammy-ros-humble-ros-base-latest ros_distribution: humble diff --git a/Dockerfile b/Dockerfile index 692bdc969..e3929e089 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ros:foxy as base +FROM ros:humble as base ARG DEBIAN_FRONTEND=noninteractive # Install dependencies diff --git a/README.md b/README.md index 41657dd76..7fb17a8db 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Here are the steps for building the `ros2_rust` examples in a vanilla Ubuntu Foc ```shell # Install Rust, e.g. as described in https://rustup.rs/ -# Install ROS 2 as described in https://docs.ros.org/en/foxy/Installation.html +# Install ROS 2 as described in https://docs.ros.org/en/humble/Installation.html # Assuming you installed the minimal version of ROS 2, you need these additional packages: sudo apt install -y git libclang-dev python3-pip python3-vcstool # libclang-dev is required by bindgen # Install these plugins for cargo and colcon: @@ -43,8 +43,8 @@ pip install git+https://github.com/colcon/colcon-ros-cargo.git mkdir -p workspace/src && cd workspace git clone https://github.com/ros2-rust/ros2_rust.git src/ros2_rust -vcs import src < src/ros2_rust/ros2_rust_foxy.repos -. /opt/ros/foxy/setup.sh +vcs import src < src/ros2_rust/ros2_rust_humble.repos +. /opt/ros/humble/setup.sh colcon build ``` diff --git a/docs/building.md b/docs/building.md index 4202063d8..c57400b1c 100644 --- a/docs/building.md +++ b/docs/building.md @@ -2,7 +2,7 @@ This is a more detailed guide on how to build ROS 2 packages written in Rust that expands on the minimal steps in the README. -In this guide, the Foxy distribution of ROS 2 is used, but newer distributions can be used by simply replacing 'foxy' with the distribution name everywhere. +In this guide, the Humble distribution of ROS 2 is used, but newer distributions can be used by simply replacing 'humble' with the distribution name everywhere. ## Choosing a workspace directory and cloning `ros2_rust` @@ -24,7 +24,7 @@ git clone https://github.com/ros2-rust/ros2_rust.git src/ros2_rust ## Environment setup -Building `rclrs` requires a standard [ROS 2 installation](https://docs.ros.org/en/foxy/Installation.html), and a few extensions. +Building `rclrs` requires a standard [ROS 2 installation](https://docs.ros.org/en/humble/Installation.html), and a few extensions. These extensions are: `colcon-cargo`, `colcon-ros-cargo`, `cargo-ament-build`. The first two are `colcon` plugins, and the third is a `cargo` plugin. The `libclang` library is also required for automatically generating FFI bindings with `bindgen`. See the [`bindgen` docs](https://rust-lang.github.io/rust-bindgen/requirements.html) on how to install it. As a side note, on Ubuntu the `clang` package is not required, only the `libclang-dev` package. @@ -41,7 +41,7 @@ The exact steps may differ between platforms, but as an example, here is how you ```shell # Install Rust, e.g. as described in https://rustup.rs/ -# Install ROS 2 as described in https://docs.ros.org/en/foxy/Installation.html +# Install ROS 2 as described in https://docs.ros.org/en/humble/Installation.html # Assuming you installed the minimal version of ROS 2, you need these additional packages: sudo apt install -y git libclang-dev python3-pip python3-vcstool # libclang-dev is required by bindgen # Install these plugins for cargo and colcon: @@ -75,7 +75,7 @@ As you can see, this maps the workspace directory to `/workspace` inside the con ```shell # Make sure to run this in the workspace directory -vcs import src < src/ros2_rust/ros2_rust_foxy.repos +vcs import src < src/ros2_rust/ros2_rust_humble.repos ``` This uses the [`vcs` tool](https://github.com/dirk-thomas/vcstool), which is preinstalled in the Docker image. @@ -87,13 +87,13 @@ The list of needed repositories should very rarely change, so you typically only ### Sourcing the ROS 2 installation Before building, the ROS 2 installation, and ideally _only_ the ROS 2 installation, should be sourced. -Sourcing an installation populates a few environment variables such as `$AMENT_PREFIX_PATH`, so if you are not sure, you can check that the `$AMENT_PREFIX_PATH` environment variable contains the ROS 2 installation, e.g. `/opt/ros/foxy`. +Sourcing an installation populates a few environment variables such as `$AMENT_PREFIX_PATH`, so if you are not sure, you can check that the `$AMENT_PREFIX_PATH` environment variable contains the ROS 2 installation, e.g. `/opt/ros/humble`. In the pre-made Docker image, sourcing is already done for you. Otherwise, if `$AMENT_PREFIX_PATH` is empty, you need to source the ROS 2 installation yourself: ```shell -# You can also do `source /opt/ros/foxy/setup.bash` in bash -. /opt/ros/foxy/setup.sh +# You can also do `source /opt/ros/humble/setup.bash` in bash +. /opt/ros/humble/setup.sh ```` If `$AMENT_PREFIX_PATH` contains undesired paths, exit and reopen your shell. If the problem persists, it's probably because of a sourcing command in your `~/.bashrc` or similar. diff --git a/rclrs/src/dynamic_message.rs b/rclrs/src/dynamic_message.rs index 3997ad6e7..ba6dce1fc 100644 --- a/rclrs/src/dynamic_message.rs +++ b/rclrs/src/dynamic_message.rs @@ -9,9 +9,6 @@ use std::fmt::{self, Display}; use std::path::PathBuf; use std::sync::Arc; -#[cfg(ros_distro = "foxy")] -use crate::rcl_bindings::rosidl_typesupport_introspection_c__MessageMembers as rosidl_message_members_t; -#[cfg(not(ros_distro = "foxy"))] use crate::rcl_bindings::rosidl_typesupport_introspection_c__MessageMembers_s as rosidl_message_members_t; use crate::rcl_bindings::*; diff --git a/rclrs/src/lib.rs b/rclrs/src/lib.rs index 2cf90e843..4fd69a84e 100644 --- a/rclrs/src/lib.rs +++ b/rclrs/src/lib.rs @@ -73,11 +73,6 @@ pub fn spin_once(node: &Node, timeout: Option) -> Result<(), RclrsErro /// This function additionally checks that the context is still valid. pub fn spin(node: &Node) -> Result<(), RclrsError> { // The context_is_valid functions exists only to abstract away ROS distro differences - #[cfg(ros_distro = "foxy")] - // SAFETY: No preconditions for this function. - let context_is_valid = - || unsafe { rcl_context_is_valid(&mut *node.rcl_context_mtx.lock().unwrap()) }; - #[cfg(not(ros_distro = "foxy"))] // SAFETY: No preconditions for this function. let context_is_valid = || unsafe { rcl_context_is_valid(&*node.rcl_context_mtx.lock().unwrap()) }; diff --git a/rclrs/src/subscription/message_info.rs b/rclrs/src/subscription/message_info.rs index 722089592..1c2ba9936 100644 --- a/rclrs/src/subscription/message_info.rs +++ b/rclrs/src/subscription/message_info.rs @@ -80,7 +80,6 @@ pub struct MessageInfo { /// received messages. /// Those might have already been taken by other messages that were received in between or lost. /// `psn2 - psn1 - 1 = 0` if and only if the messages were sent by the publisher consecutively. - #[cfg(not(ros_distro = "foxy"))] pub publication_sequence_number: u64, /// Sequence number of the received message set by the subscription. /// @@ -98,7 +97,6 @@ pub struct MessageInfo { /// /// - `rsn2 > rsn1` (except in the case of a wrap around) /// - `rsn2 = rsn1 + 1` if and only if both messages were received consecutively. - #[cfg(not(ros_distro = "foxy"))] pub reception_sequence_number: u64, /// An identifier for the publisher that sent the message. pub publisher_gid: PublisherGid, @@ -123,9 +121,7 @@ impl MessageInfo { Self { source_timestamp, received_timestamp, - #[cfg(not(ros_distro = "foxy"))] publication_sequence_number: rmw_message_info.publication_sequence_number, - #[cfg(not(ros_distro = "foxy"))] reception_sequence_number: rmw_message_info.reception_sequence_number, publisher_gid, } @@ -136,7 +132,6 @@ impl MessageInfo { mod tests { use super::*; - #[cfg(not(ros_distro = "foxy"))] #[test] fn negative_durations() { let rmw_message_info = rmw_message_info_t { diff --git a/ros2_rust_foxy.repos b/ros2_rust_foxy.repos deleted file mode 100644 index 3d70dc920..000000000 --- a/ros2_rust_foxy.repos +++ /dev/null @@ -1,25 +0,0 @@ -repositories: - ros2/common_interfaces: - type: git - url: https://github.com/ros2/common_interfaces.git - version: foxy - ros2/example_interfaces: - type: git - url: https://github.com/ros2/example_interfaces.git - version: foxy - ros2/rcl_interfaces: - type: git - url: https://github.com/ros2/rcl_interfaces.git - version: foxy - ros2/test_interface_files: - type: git - url: https://github.com/ros2/test_interface_files.git - version: foxy - ros2/rosidl_defaults: - type: git - url: https://github.com/ros2/rosidl_defaults.git - version: foxy - ros2/unique_identifier_msgs: - type: git - url: https://github.com/ros2/unique_identifier_msgs.git - version: foxy