用于 ROS2 的 .NET 绑定
| Target | Status |
|---|---|
| Linux | |
| Windows Desktop |
Windows UWP CI Builds are currently disabled, see this issue for more information.
This is a collection of projects (bindings, code generator, examples and more) for writing ROS2 applications for .NET Core and .NET Standard.
The current set of features include:
Lots of things!
First of all install the standard ROS2 dependencies for your operating system of choice (NOTE: only do this if building Windows Desktop or Linux. For UWP, see the relevant section below): https://github.com/ros2/ros2/wiki/Installation#building-from-source
Next make sure you've either installed .Net Core (preferred) https://www.microsoft.com/net/learn/get-started or Mono https://www.mono-project.com/. (NOTE: For building unit tests, .NET 6 is required).
For running on Linux or Windows Desktop, one can build ros2_dotnet (along with
all desired packages containing interface definitions) as an overlay on top
of an existing ROS2 installation. The ros2_dotnet_foxy.repos contains all
necessary repositories to build the core ros2_dotnet project along with all
standard ROS2 interface packages. If you are using other packages which provide
interface definitions, those must also be included in the ros2_dotnet workspace
in order for .NET bindings to be generated. (NOTE: if you wish to build the
core of ROS2 from source, everything through the rcl layer is required.)
For running within UWP (Universal Windows Platform) applications, the entire core of ROS2 must be compiled for UWP compatibility.
Assuming you've installed ROS2 (pre-built binary packages) to the directory c:\dev\ros2_foxy per the official installation instructions, run the following from an Administrator Visual Studio 2019 Developer Command Prompt:
(NOTE: Building as an overlay on top of binary distributions of ROS2 has
presented some challenges. As of this writing, you may also need to include the
rosidl package due to some unicode/locale compatibility problems.
This is done for you below in the line preceding colcon build. This step
can/should be omitted if building on top of a built-from-source ROS2 workspace)
…File - Build Settings - Build
### Unity generated Visual Studio solution
Open the VS solution generated after building your Unity project.
In Solution Explorer panel:right click on Universal Windows project - Add - Existing item...
and include every DLL file from `{your_ros2_uwp_ws}\install\bin`. Now select all of these files in Solution Explorer and check/set the properties:Build action: Content Copy to output directory: Copy always
This allows you to retrieve the files in the same directory as the assembly.
Next step, in Solution Explorer panel:right click on References - Add reference...
and include `{your_ros2_uwp_ws}\install\lib\rcldotnet\dotnet\rcldotnet_assemblies.dll`, `{your_ros2_uwp_ws}\install\lib\rcldotnet\dotnet\rcldotnet_common.dll` and `{your_ros2_uwp_ws}\install\lib\std_msgs\dotnet\std_msgs_assemblies.dll`.
Finally compile your project for UWP (32 bits) and run it on HoloLens Emulator or HoloLens physical device.暂无开放 Issues,或尚未同步最近议题。