Skip to content

Commit

Permalink
Remove Foxy from the list of supported ROS 2 distributions (#318)
Browse files Browse the repository at this point in the history
  • Loading branch information
esteve authored Jul 6, 2023
1 parent 047f483 commit 8d5d57e
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 54 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ros:foxy as base
FROM ros:humble as base
ARG DEBIAN_FRONTEND=noninteractive

# Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Here are the steps for building the `ros2_rust` examples in a vanilla Ubuntu Foc
<!--- These steps should be kept in sync with docs/Building.md --->
```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:
Expand All @@ -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
```

Expand Down
14 changes: 7 additions & 7 deletions docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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.
Expand All @@ -41,7 +41,7 @@ The exact steps may differ between platforms, but as an example, here is how you
<!--- These steps should be kept in sync with README.md --->
```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:
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
3 changes: 0 additions & 3 deletions rclrs/src/dynamic_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand Down
5 changes: 0 additions & 5 deletions rclrs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ pub fn spin_once(node: &Node, timeout: Option<Duration>) -> 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()) };
Expand Down
5 changes: 0 additions & 5 deletions rclrs/src/subscription/message_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand All @@ -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,
Expand All @@ -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,
}
Expand All @@ -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 {
Expand Down
25 changes: 0 additions & 25 deletions ros2_rust_foxy.repos

This file was deleted.

0 comments on commit 8d5d57e

Please sign in to comment.