Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
73 changes: 46 additions & 27 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
- humble
- iron
- jazzy
- kilted
include:
- ros_distribution: foxy
docker_image: ros:foxy-ros-base
Expand All @@ -23,6 +24,8 @@ jobs:
docker_image: ros:iron-ros-base
- ros_distribution: jazzy
docker_image: ros:jazzy-ros-base
- ros_distribution: kilted
docker_image: ros:kilted-ros-base
container:
image: ${{ matrix.docker_image }}
steps:
Expand Down Expand Up @@ -68,7 +71,7 @@ jobs:
RMW_IMPLEMENTATION: rmw_fastrtps_cpp
ROS_LOCALHOST_ONLY: 0
run: |
. /opt/ros/${{ matrix.ros_distribution }}/setup.sh
. /opt/ros/${{ matrix.ros_distribution }}/setup.sh && \
dotnet test -c Release -p:BuildInParallel=false --no-build --verbosity normal --blame-crash-dump-type mini --blame-hang-dump-type none --blame-hang-timeout 1m

- name: Test (cyclonedds)
Expand All @@ -77,7 +80,7 @@ jobs:
RMW_IMPLEMENTATION: rmw_cyclonedds_cpp
ROS_LOCALHOST_ONLY: 0
run: |
. /opt/ros/${{ matrix.ros_distribution }}/setup.sh
. /opt/ros/${{ matrix.ros_distribution }}/setup.sh && \
dotnet test -c Release -p:BuildInParallel=false --no-build --verbosity normal --blame-crash-dump-type mini --blame-hang-dump-type none --blame-hang-timeout 1m

windows:
Expand All @@ -90,7 +93,11 @@ jobs:
- humble
- iron
- jazzy
- kilted
include:
- ros_distribution: kilted
ros_archive: https://github.com/ros2/ros2/releases/download/release-kilted-20250728/ros2-kilted-20250728-windows-release-amd64.zip
is_legacy_distro: false
- ros_distribution: jazzy
ros_archive: https://github.com/ros2/ros2/releases/download/release-jazzy-20250820/ros2-jazzy-20250820-windows-release-amd64.zip
is_legacy_distro: false
Expand All @@ -107,7 +114,20 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true


- name: Restore cached ROS installation
id: ros-cache
uses: actions/cache@v3
with:
path: c:/dev/${{ matrix.ros_distribution }}/
key: ${{ matrix.ros_archive }}

- name: Download and install ROS
if: ${{ steps.ros-cache.outputs.cache-hit != 'true' }}
run: |
Invoke-WebRequest -Uri ${{ matrix.ros_archive }} -OutFile ros2-release.zip
Expand-Archive -Path ros2-release.zip c:/dev/${{ matrix.ros_distribution }}

- name: Install dependencies (Legacy)
if: ${{ matrix.is_legacy_distro }}
run: |
Expand All @@ -116,27 +136,28 @@ jobs:
choco install --limit-output --no-progress -y -s . tinyxml2
choco install --limit-output --no-progress -y openssl --version 1.1.1.2100

- name: Install dependencies
- name: Install Pixi
if: ${{ !matrix.is_legacy_distro }}
run: |
Set-ExecutionPolicy ByPass
irm -useb https://pixi.sh/install.ps1 | iex
irm https://raw.githubusercontent.com/ros2/ros2/refs/heads/jazzy/pixi.toml -OutFile pixi.toml
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
pixi install

- name: Restore cached ROS installation
id: ros-cache
- name: Restore cached Pixi dependencies
if: ${{ !matrix.is_legacy_distro }}
id: pixi-cache
uses: actions/cache@v3
with:
path: c:/dev/${{ matrix.ros_distribution }}/
key: ${{ matrix.ros_archive }}
path: c:/dev/pixi/
key: pixi-${{ matrix.ros_distribution }}

- name: Download and install ROS
if: ${{ steps.ros-cache.outputs.cache-hit != 'true' }}
- name: Install dependencies
if: ${{ !matrix.is_legacy_distro }}
run: |
Invoke-WebRequest -Uri ${{ matrix.ros_archive }} -OutFile ros2-release.zip
Expand-Archive -Path ros2-release.zip c:/dev/${{ matrix.ros_distribution }}
mkdir c:/dev/pixi/
cd c:/dev/pixi/
irm https://raw.githubusercontent.com/ros2/ros2/refs/heads/${{ matrix.ros_distribution }}/pixi.toml -OutFile pixi.toml
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
pixi install

- name: Setup .NET 8.0
uses: actions/setup-dotnet@v3
Expand Down Expand Up @@ -167,8 +188,8 @@ jobs:
RMW_IMPLEMENTATION: rmw_fastrtps_cpp
ROS_LOCALHOST_ONLY: 0
run: |
refreshenv
call c:/dev/${{ matrix.ros_distribution }}/ros2-windows/setup.bat
refreshenv && ^
call c:/dev/${{ matrix.ros_distribution }}/ros2-windows/setup.bat && ^
dotnet test -c Release -p:BuildInParallel=false --no-build --verbosity normal --blame-crash-dump-type mini --blame-hang-dump-type none --blame-hang-timeout 1m

- name: Test (cyclonedds) (Legacy)
Expand All @@ -179,8 +200,8 @@ jobs:
RMW_IMPLEMENTATION: rmw_cyclonedds_cpp
ROS_LOCALHOST_ONLY: 0
run: |
refreshenv
call c:/dev/${{ matrix.ros_distribution }}/ros2-windows/setup.bat
refreshenv && ^
call c:/dev/${{ matrix.ros_distribution }}/ros2-windows/setup.bat && ^
dotnet test -c Release -p:BuildInParallel=false --no-build --verbosity normal --blame-crash-dump-type mini --blame-hang-dump-type none --blame-hang-timeout 1m

- name: Test (fastrtps)
Expand All @@ -191,10 +212,9 @@ jobs:
RMW_IMPLEMENTATION: rmw_fastrtps_cpp
ROS_LOCALHOST_ONLY: 0
run: |
refreshenv
pixi shell
call c:/dev/${{ matrix.ros_distribution }}/ros2-windows/setup.bat
dotnet test -c Release -p:BuildInParallel=false --no-build --verbosity normal --blame-crash-dump-type mini --blame-hang-dump-type none --blame-hang-timeout 1m
refreshenv && ^
pixi run --manifest-path "c:/dev/pixi/" ^
cmd /c "call c:/dev/${{ matrix.ros_distribution }}/ros2-windows/setup.bat && dotnet test -c Release -p:BuildInParallel=false --no-build --verbosity normal --blame-crash-dump-type mini --blame-hang-dump-type none --blame-hang-timeout 1m"

- name: Test (cyclonedds)
if: ${{ !matrix.is_legacy_distro }}
Expand All @@ -204,10 +224,9 @@ jobs:
RMW_IMPLEMENTATION: rmw_cyclonedds_cpp
ROS_LOCALHOST_ONLY: 0
run: |
refreshenv
pixi shell
call c:/dev/${{ matrix.ros_distribution }}/ros2-windows/setup.bat
dotnet test -c Release -p:BuildInParallel=false --no-build --verbosity normal --blame-crash-dump-type mini --blame-hang-dump-type none --blame-hang-timeout 1m
refreshenv && ^
pixi run --manifest-path "c:/dev/pixi/" ^
cmd /c "call c:/dev/${{ matrix.ros_distribution }}/ros2-windows/setup.bat && dotnet test -c Release -p:BuildInParallel=false --no-build --verbosity normal --blame-crash-dump-type mini --blame-hang-dump-type none --blame-hang-timeout 1m"

#test_macos:
# runs-on: macos-latest
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ rclnet is a fast and easy-to-use .NET wrapper over ROS 2 client library, allowin

## What's New in 2.0
- Added support for .NET 10 and changed minimum supported .NET version to 8.0
- ROS2 Jazzy Support by @AlrayQiu ([#39](https://github.com/noelex/rclnet/pull/39))
- ROS 2 Kilted Support
- ROS 2 Jazzy Support by @AlrayQiu ([#39](https://github.com/noelex/rclnet/pull/39))
- Simplified message generation workflow by @ha-ves ([#38](https://github.com/noelex/rclnet/pull/38))
- String pooling is now disabled by default

Expand Down Expand Up @@ -48,6 +49,7 @@ Supported ROS 2 Distributions:
- Humble Hawksbill
- Iron Irwini
- Jazzy Jalisco
- Kilted Kaiju

Supported Operating Systems:
- Ubuntu
Expand Down
18 changes: 18 additions & 0 deletions src/Rcl.NET.Tests/kilted.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM ros:kilted-ros-core
RUN apt-get update \
&& apt-get -y install --no-install-recommends \
ros-kilted-rmw-cyclonedds-cpp \
ros-kilted-rmw-fastrtps-cpp \
ros-kilted-tf2-msgs \
ros-kilted-service-msgs \
wget \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* \
&& wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh \
&& chmod +x ./dotnet-install.sh \
&& ./dotnet-install.sh --channel 10.0 --runtime dotnet \
&& ./dotnet-install.sh --channel 9.0 --runtime dotnet \
&& ./dotnet-install.sh --channel 8.0 --runtime dotnet
ENV DOTNET_ROOT=/root/.dotnet
ENV PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools
14 changes: 14 additions & 0 deletions src/Rcl.NET.Tests/ubuntu.kilted.cyclonedds.runsettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<RunConfiguration>
<EnvironmentVariables>
<ROS_DISTRO>kilted</ROS_DISTRO>
<ROS_LOCALHOST_ONLY>0</ROS_LOCALHOST_ONLY>
<ROS_PYTHON_VERSION>3</ROS_PYTHON_VERSION>
<ROS_VERSION>2</ROS_VERSION>
<LD_LIBRARY_PATH>/opt/ros/kilted/opt/yaml_cpp_vendor/lib:/opt/ros/kilted/lib/x86_64-linux-gnu:/opt/ros/kilted/lib</LD_LIBRARY_PATH>
<AMENT_PREFIX_PATH>/opt/ros/kilted</AMENT_PREFIX_PATH>
<RMW_IMPLEMENTATION>rmw_cyclonedds_cpp</RMW_IMPLEMENTATION>
</EnvironmentVariables>
</RunConfiguration>
</RunSettings>
14 changes: 14 additions & 0 deletions src/Rcl.NET.Tests/ubuntu.kilted.fastrtps.runsettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<RunConfiguration>
<EnvironmentVariables>
<ROS_DISTRO>kilted</ROS_DISTRO>
<ROS_LOCALHOST_ONLY>0</ROS_LOCALHOST_ONLY>
<ROS_PYTHON_VERSION>3</ROS_PYTHON_VERSION>
<ROS_VERSION>2</ROS_VERSION>
<LD_LIBRARY_PATH>/opt/ros/kilted/opt/yaml_cpp_vendor/lib:/opt/ros/kilted/lib/x86_64-linux-gnu:/opt/ros/kilted/lib</LD_LIBRARY_PATH>
<AMENT_PREFIX_PATH>/opt/ros/kilted</AMENT_PREFIX_PATH>
<RMW_IMPLEMENTATION>rmw_fastrtps_cpp</RMW_IMPLEMENTATION>
</EnvironmentVariables>
</RunConfiguration>
</RunSettings>
18 changes: 13 additions & 5 deletions src/Rcl.NET/Interop/RclJazzy.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
using Rosidl.Runtime.Interop;
using System.Runtime.InteropServices;
using static Rcl.Interop.RclHumble;
using System.Runtime.InteropServices;

namespace Rcl.Interop;

// Same typedef with iron
using RclJazzy = RclIron;
unsafe static class RclJazzy
{
[DllImport("rcl", CallingConvention = CallingConvention.Cdecl)]
public static extern rcl_ret_t rcl_timer_init2(
RclCommon.rcl_timer_t* timer,
RclCommon.rcl_clock_t* clock,
RclCommon.rcl_context_t* context,
long period,
delegate* unmanaged[Cdecl]<RclCommon.rcl_timer_t*, long, void> callback,
RclCommon.rcl_allocator_t allocator,
bool autostart);
}
4 changes: 2 additions & 2 deletions src/Rcl.NET/Introspection/MessageIntrospection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public unsafe static IMessageIntrospection Create(MessageTypeSupport* typesuppor
{
return new HumbleMessageIntrospection(typesupport);
}
else if (RosEnvironment.IsJazzy)
else if (RosEnvironment.IsJazzy || RosEnvironment.IsKilted)
{
return new JazzyMessageIntrospection(typesupport);
}
Expand All @@ -62,7 +62,7 @@ public unsafe static IMessageIntrospection Create(MessageMembers* messageMembers
{
return new HumbleMessageIntrospection(messageMembers);
}
else if (RosEnvironment.IsJazzy)
else if (RosEnvironment.IsJazzy || RosEnvironment.IsKilted)
{
return new JazzyMessageIntrospection((MessageMembers_Jazzy*)messageMembers);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Rcl.NET/Parameters/Impl/ParameterService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ internal unsafe ParameterService(RclNodeImpl node, IDictionary<string, Variant>
{
return &((RclFoxy.rcl_node_options_t*)handle)->arguments;
}
else if (RosEnvironment.IsHumble || RosEnvironment.IsIron || RosEnvironment.IsJazzy)
else if (RosEnvironment.IsHumble || RosEnvironment.IsIron || RosEnvironment.IsJazzy || RosEnvironment.IsKilted)
{
return &((RclHumble.rcl_node_options_t*)handle)->arguments;
}
Expand Down
15 changes: 13 additions & 2 deletions src/Rcl.NET/RosEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal enum VersionRequirement
/// </summary>
public unsafe static class RosEnvironment
{
private static readonly string[] SupportedDistributions = new[] { Foxy, Humble, Iron, Jazzy };
private static readonly string[] SupportedDistributions = [Foxy, Humble, Iron, Jazzy, Kilted];

/// <summary>
/// ROS 2 Foxy Fitzroy.
Expand All @@ -36,6 +36,11 @@ public unsafe static class RosEnvironment
/// </summary>
public const string Jazzy = "jazzy";

/// <summary>
/// ROS 2 Kilted Kaiju
/// </summary>
public const string Kilted = "kilted";

/// <summary>
/// Gets whether the application is running in foxy.
/// </summary>
Expand All @@ -50,11 +55,17 @@ public unsafe static class RosEnvironment
/// Gets whether the application is running in iron.
/// </summary>
public static bool IsIron => Distribution == Iron;

/// <summary>
/// Gets whether the application is running in iron.
/// Gets whether the application is running in jazzy.
/// </summary>
public static bool IsJazzy => Distribution == Jazzy;

/// <summary>
/// Gets whether the application is running in kilted.
/// </summary>
public static bool IsKilted => Distribution == Kilted;

/// <summary>
/// Get the name of the rmw implementation being used.
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions src/Rcl.NET/SafeHandles/SafeNodeHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public SafeNodeHandle(SafeContextHandle context, string name, string @namespace,
case RosEnvironment.Humble:
case RosEnvironment.Iron:
case RosEnvironment.Jazzy:
case RosEnvironment.Kilted:
InitHumbleOrLater(namePtr, nsPtr, context, options);
break;
default: throw new NotImplementedException();
Expand Down
19 changes: 14 additions & 5 deletions src/Rcl.NET/SafeHandles/SafeTimerHandle.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Rosidl.Messages.Rosgraph;
using Rcl.Interop;

namespace Rcl.SafeHandles;

Expand All @@ -10,15 +10,24 @@ public SafeTimerHandle(
SafeContextHandle context, SafeClockHandle clock, long period)
{
_clock = clock;
* Object = rcl_get_zero_initialized_timer();
*Object = rcl_get_zero_initialized_timer();

try
{
using (ScopedLock.Lock(ref _clock.SyncRoot))
{
RclException.ThrowIfNonSuccess(
rcl_timer_init(Object, clock.Object, context.Object,
period, null, RclAllocator.Default.Object));
if (RosEnvironment.IsSupported(RosEnvironment.Jazzy))
{
RclException.ThrowIfNonSuccess(
RclJazzy.rcl_timer_init2(Object, clock.Object, context.Object,
period, null, RclAllocator.Default.Object, true));
}
else
{
RclException.ThrowIfNonSuccess(
rcl_timer_init(Object, clock.Object, context.Object,
period, null, RclAllocator.Default.Object));
}
_clock.AddTimerRef();
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/testEnvironments.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
"name": "Container - Jazzy",
"type": "docker",
"dockerFile": "Rcl.NET.Tests/jazzy.Dockerfile"
},
{
"name": "Container - Kilted",
"type": "docker",
"dockerFile": "Rcl.NET.Tests/kilted.Dockerfile"
}
]
}
Loading