Giter Club home page Giter Club logo

ros2-for-unity's Introduction

Ros2 For Unity

Note

This project is officially supported for AWSIM users of Autoware. However, the Robotec team is unable to provide support and maintain the project for the general community. If you are looking for an alternative to Unity3D, Open 3D Engine (O3DE) is a great, open-source and free simulation engine with excellent ROS 2 integration, which Robotec is actively supporting and developing.

ROS2 For Unity is a high-performance communication solution to connect Unity3D and ROS2 ecosystem in a ROS2 "native" way. Communication is not bridged as in several other solutions, but instead it uses ROS2 middleware stack (rcl layer and below), which means you can have ROS2 nodes in your simulation. Advantages of this module include:

  • High performance - higher throughput and considerably lower latencies comparing to bridging solutions.
  • Your simulation entities are real ROS2 nodes / publishers / subscribers. They will behave correctly with e.g. command line tools such as ros2 topic. They will respect QoS settings and can use ROS2 native time.
  • The module supplies abstractions and tools to use in your Unity project, including transformations, sensor interface, a clock, spinning loop wrapped in a MonoBehavior, handling initialization and shutdown.
  • Supports all standard ROS2 messages.
  • Custom messages are generated automatically with build, using standard ROS2 way. It is straightforward to generate and use them without having to define .cs equivalents by hand.
  • The module is wrapped as a Unity asset.

Platforms

Supported OSes:

  • Ubuntu 22.04 (bash)
  • Ubuntu 20.04 (bash)
  • Windows 10 (powershell)
  • Windows 11* (powershel)

* ROS2 Galactic and Humble support only Windows 10 (ROS 2 Windows system requirements), but it is proven that it also works fine on Windows 11.

Supported ROS2 distributions:

  • Galactic
  • Humble

Supported Unity3d:

  • 2020+

Older versions of Unity3d may work, but the editor executable most probably won't be detected properly by deployment script. This would require user confirmation for using unsupported version.

This asset can be prepared in two flavours:

  • standalone mode, where no ROS2 installation is required on target machine, e.g., your Unity3D simulation server. All required dependencies are installed and can be used e.g. as a complete set of Unity3D plugins.
  • overlay mode, where the ROS2 installation is required on target machine. Only asset libraries and generated messages are installed therefore ROS2 instance must be sourced.

Releases

The best way to start quickly is to use our releases.

You can download pre-built releases of the Asset that support both platforms and specific ros2 and Unity3D versions.

Building

Note: The project will pull ros2cs into the workspace, which also functions independently as it is a more general project aimed at any C# / .Net environment. It has its own README and scripting, but for building the Unity Asset, please use instructions and scripting in this document instead, unless you also wish to run tests or examples for ros2cs.

Please see OS-specific instructions:

Custom messages

Custom messages can be included in the build by either:

  • listing them in ros2_for_unity_custom_messages.repos file, or
  • manually inserting them in src/ros2cs directory. If the folder doesn't exist, you must pull repositories first (see building steps for each OS).

Installation

  1. Perform building steps described in the OS-specific readme or download pre-built Unity package. Do not source ros2-for-unity nor ros2cs project into ROS2 workspace.
  2. Open or create Unity project.
  3. Import asset into project:
    1. copy install/asset/Ros2ForUnity into your project Assets folder, or
    2. if you have deployed an .unitypackage - import it in Unity Editor by selecting Import PackageCustom Package

Usage

Prerequisites

  • If your build was prepared with --standalone flag then you are fine, and all you have to do is run the editor

otherwise

  • source ROS2 which matches the Ros2ForUnity version, then run the editor from within the very same terminal/console.

Initializing Ros2ForUnity

  1. Initialize Ros2ForUnity by creating a "hook" object which will be your wrapper around ROS2. You have two options:
    1. ROS2UnityComponent based on MonoBehaviour which must be attached to a GameObject somewhere in the scene, then:
      using ROS2;
      ...
      // Example method of getting component, if ROS2UnityComponent lives in different GameObject, just use different get component methods.
      ROS2UnityComponent ros2Unity = GetComponent<ROS2UnityComponent>();
    2. or ROS2UnityCore which is a standard class that can be created anywhere
      using ROS2;
      ...
      ROS2UnityCore ros2Unity = new ROS2UnityCore();
  2. Create a node. You must first check if Ros2ForUnity is initialized correctly:
    private ROS2Node ros2Node;
    ...
    if (ros2Unity.Ok()) {
        ros2Node = ros2Unity.CreateNode("ROS2UnityListenerNode");
    }

Publishing messages:

  1. Create publisher
    private IPublisher<std_msgs.msg.String> chatter_pub;
    ...
    if (ros2Unity.Ok()){
        chatter_pub = ros2Node.CreatePublisher<std_msgs.msg.String>("chatter"); 
    }
  2. Send messages
    std_msgs.msg.String msg = new std_msgs.msg.String();
    msg.Data = "Hello Ros2ForUnity!";
    chatter_pub.Publish(msg);

Subscribing to a topic

  1. Create subscriber:
    private ISubscription<std_msgs.msg.String> chatter_sub;
    ...
    if (ros2Unity.Ok()) {
        chatter_sub = ros2Node.CreateSubscription<std_msgs.msg.String>(
            "chatter", msg => Debug.Log("Unity listener heard: [" + msg.Data + "]"));
    }

Creating a service

  1. Create service body:

    public example_interfaces.srv.AddTwoInts_Response addTwoInts( example_interfaces.srv.AddTwoInts_Request msg)
    {
        example_interfaces.srv.AddTwoInts_Response response = new example_interfaces.srv.AddTwoInts_Response();
        response.Sum = msg.A + msg.B;
        return response;
    }
  2. Create a service with a service name and callback:

    IService<example_interfaces.srv.AddTwoInts_Request, example_interfaces.srv.AddTwoInts_Response> service = 
        ros2Node.CreateService<example_interfaces.srv.AddTwoInts_Request, example_interfaces.srv.AddTwoInts_Response>(
            "add_two_ints", addTwoInts);

Calling a service

  1. Create a client:

    private IClient<example_interfaces.srv.AddTwoInts_Request, example_interfaces.srv.AddTwoInts_Response> addTwoIntsClient;
    ...
    addTwoIntsClient = ros2Node.CreateClient<example_interfaces.srv.AddTwoInts_Request, example_interfaces.srv.AddTwoInts_Response>(
        "add_two_ints");
  2. Create a request and call a service:

    example_interfaces.srv.AddTwoInts_Request request = new example_interfaces.srv.AddTwoInts_Request();
    request.A = 1;
    request.B = 2;
    var response = addTwoIntsClient.Call(request);
  3. You can also make an async call:

    Task<example_interfaces.srv.AddTwoInts_Response> asyncTask = addTwoIntsClient.CallAsync(request);
    ...
    asyncTask.ContinueWith((task) => { Debug.Log("Got answer " + task.Result.Sum); });

Examples

  1. Create a top-level object containing ROS2UnityComponent.cs. This is the central Monobehavior for Ros2ForUnity that manages all the nodes. Refer to class documentation for details.

    Note: Each example script looks for ROS2UnityComponent in its own game object. However, this is not a requirement, just example implementation.

Topics

  1. Add ROS2TalkerExample.cs script to the very same game object.
  2. Add ROS2ListenerExample.cs script to the very same game object.

Once you start the project in Unity, you should be able to see two nodes talking with each other in Unity Editor's console or use ros2 node list and ros2 topic echo /chatter to verify ros2 communication.

Services

  1. Add ROS2ServiceExample.cs script to the very same game object.
  2. Add ROS2ClientExample.cs script to the very same game object.

Once you start the project in Unity, you should be able to see client node calling an example service.

Acknowledgements

Open-source release of ROS2 For Unity was made possible through cooperation with Tier IV. Thanks to encouragement, support and requirements driven by Tier IV the project was significantly improved in terms of portability, stability, core structure and user-friendliness.

ros2-for-unity's People

Contributors

adamdbrw avatar chenjunnn avatar danielm1405 avatar deric-w avatar kielczykowski-rai avatar lchojnack avatar msz-rai avatar pijaro avatar prybicki avatar ynybonfennil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ros2-for-unity's Issues

Build errors on Windows

First of all, great work providing this ROS2 UnityPackage! It's exactly what I'm looking for and have already had the pleasure of trying it out some.
I need to be able to use my own cusom message types, and as I understood it, I need to build ros2-for-unity from source to be able to do that (or is there some other way?).

I have attemted to build from source, carefully following the instructions. I have tried both with a pre-built ROS2 (Foxy) that I installed from: https://ms-iot.github.io/ROSOnWindows/GettingStarted/SetupRos2.html and also with a ROS2 (Galactic) that I built from source myself. Both versions work fine as-is. I use Windows.

When I try to build the ros2-for-unity project, I get the same error message regardless of which ROS2 installation I source prior to starting the build. It seems to be related to generate_cs not beeing found. I get the following error message:

Traceback (most recent call last):
    File "C:\Users\Admin\git\ros2-for-unity\install\lib\rosidl_generator_cs\rosidl_generator_cs", line 23, in <module>
      from rosidl_generator_cs import generate_cs
  ImportError: cannot import name 'generate_cs' from 'rosidl_generator_cs' (unknown location)

I have attached the complete build log, if it helps.
ROS-for-Unity-build-err-ros2algoryx.md

I have done a little bit of digging my self, and noticed that the path in rosidl_generator_cs_module inside src/ros2cs/src/ros2cs/rosidl_generator_cs/bin/rosidl_generator_cs points to a file that does not exists. It points to something like ros2-for-unity\install\lib\rosidl_generator_cs/init.py but the file actually seems to be located at ros2-for-unity\install\lib\site-packages\rosidl_generator_cs/init.py

I tried manually patching this path, and the build now continued a little while longer, but now I get a new error saying :

C:\Users\Admin\git\ros2-for-unity\build\rosgraph_msgs\rosidl_generator_cs\rosgraph_msgs\msg\clock.cs(31,10): error CS0246: The type or namespace name 'builtin_interfaces' could not be found (are you missing a using directive or an assembly reference?) [C:\Users\Admin\git\ros2-for-unity\build\rosgraph_msgs\rosgraph_msgs_assembly\rosgraph_msgs_assembly_dotnetcore.csproj] [C:\Users\Admin\git\ros2-for-unity\build\rosgraph_msgs\rosgraph_msgs_assembly.vcxproj]

  Build FAILED.

So I'm guessing that there may be some other issues as well. I hope this info helps, I would be really exited being able to use ros2-for-unity with custom messages. Let me know if I can help out, I can test certain things here locally for example if it helps.

Best regards,
Josef

Suggestion: Option for main threaded ROS2UnityComponent

We are running a high-frequency application (fixed update runs at 1000hz). We needed to perform tasks in the main Unity thread each time a message arrives to any of our subscribers. Since SpinOnce, and thus all message receive callback code is running on a separate worker thread, we found that we had to synchronize this by basically pushing jobs (Action) to a queue that was then executed on the main unity thread. We noticed that this approach gave a big overhead and the performance was not great.

So instead we modified the ROS2UnityComponent to run on the main thread, which was feasable after a modification to the SpinOnce in the ros2cs which allows for non-blocking, zero timeout time, see: RobotecAI/ros2cs#16

We are currently using something like the following:
ROS2UnityComponentMainThread.txt

Things to note:

  • No worker thread is created, instead SpinOnce is called in FixedUpdate directly by the main thread.
  • SpinOnce is called with a 0 timeout, which makes it really, really fast if nothing has been received.
  • All mutex:es are removed (let me know if this might become an issue).

My question is: would it be of interest to have a version of the ROS2UnityComponent called ROS2UnityComponentMainThread or something similar that can also be part of the scripts directory, so that users can choose what they would like, depending on their needs? Or is there perhaps some fundamental issues with doing it this way that I am currently not aware of?

If this would be of interest, I could create a pull-request with the added ROS2UnityComponentMainThread. If not, then no problem; this is a mere humble suggestion.

All the best,
Josef

Pulling ros2cs repository problem

Hi, I am installing the repository fellow the instruction, but happen the build issue as below:

  • Pulling ros2cs repository:
    ./pull_repositories.sh: line 13: vcs: command not found

=========================================
Pulling custom repositories:
./pull_repositories.sh: line 18: vcs: command not found

=========================================
Pulling ros2cs dependencies:
./pull_repositories.sh: line 23: cd: /home/chen/ros2-for-unity/src/ros2cs: No such file or directory
./pull_repositories.sh: line 24: ./get_repos.sh: No such file or directory

how can solve this problem?

Problem with building project using colcon

Hi, I'm pretty new to ROS, and after some battle with settings and packages, I finally came to the building stage.
However, while trying to do so, I'm getting the below error:

colcon build --cmake-clean-cache
Starting >>> depthai_ros_msgs
Finished <<< depthai_ros_msgs [7.32s]
Starting >>> depthai_bridge
Finished <<< depthai_bridge [21.3s]
Starting >>> depthai_examples
Starting >>> depthai_ros_driver
[Processing: depthai_examples, depthai_ros_driver]
[Processing: depthai_examples, depthai_ros_driver]
[Processing: depthai_examples, depthai_ros_driver]
[Processing: depthai_examples, depthai_ros_driver]
[Processing: depthai_examples, depthai_ros_driver]
[Processing: depthai_examples, depthai_ros_driver]
[7min 10.9s] [2/5 complete] [2 ongoing] [depthai_examples:build 64% - 6min 41.9s] ...[Processing: depthai_examples, depthai_ros_driver]
[Processing: depthai_examples, depthai_ros_driver]xamples:build 64% - 8min 12.3s] ...
[Processing: depthai_examples, depthai_ros_driver]
[10min 47.4s] [2/5 complete] [2 ongoing] [depthai_examples:build 64% - 10min 18.4s] ...[Processing: depthai_examples, depthai_ros_driver]
[Processing: depthai_examples, depthai_ros_driver]examples:build 64% - 11min 41.9s] ...
[Processing: depthai_examples, depthai_ros_driver]
[Processing: depthai_examples, depthai_ros_driver]
[Processing: depthai_examples, depthai_ros_driver]
[Processing: depthai_examples, depthai_ros_driver]
[Processing: depthai_examples, depthai_ros_driver]
[Processing: depthai_examples, depthai_ros_driver]
[Processing: depthai_examples, depthai_ros_driver]
[Processing: depthai_examples, depthai_ros_driver]
[Processing: depthai_examples, depthai_ros_driver]
[Processing: depthai_examples, depthai_ros_driver][20min 7.7s] [2/5 complete] [2 ongoing] [depthai_examples:build 64% - 19min 38.7s] ...
[Processing: depthai_examples, depthai_ros_driver]
[Processing: depthai_examples, depthai_ros_driver]
[Processing: depthai_examples, depthai_ros_driver]
[Processing: depthai_examples, depthai_ros_driver]
[24min 19.7s] [2/5 complete] [2 ongoing] [depthai_examples:build 64% - 23min 50.8s] ...[Processing: depthai_examples, depthai_ros_driver]
[Processing: depthai_examples, depthai_ros_driver]
[Processing: depthai_examples, depthai_ros_driver]
[Processing: depthai_examples, depthai_ros_driver]
--- stderr: depthai_ros_driver
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
gmake[2]: *** [CMakeFiles/depthai_ros_driver.dir/build.make:160: CMakeFiles/depthai_ros_driver.dir/src/dai_nodes/sensors/sensor_helpers.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
gmake[2]: *** [CMakeFiles/depthai_ros_driver.dir/build.make:286: CMakeFiles/depthai_ros_driver.dir/src/param_handlers/camera_param_handler.cpp.o] Error 1
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
gmake[2]: *** [CMakeFiles/depthai_ros_driver.dir/build.make:118: CMakeFiles/depthai_ros_driver.dir/src/dai_nodes/sensors/rgb.cpp.o] Error 1
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
gmake[2]: *** [CMakeFiles/depthai_ros_driver.dir/build.make:174: CMakeFiles/depthai_ros_driver.dir/src/dai_nodes/stereo.cpp.o] Error 1
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
gmake[2]: *** [CMakeFiles/depthai_ros_driver.dir/build.make:272: CMakeFiles/depthai_ros_driver.dir/src/dai_nodes/nn/spatial_yolo.cpp.o] Error 1
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
gmake[2]: *** [CMakeFiles/depthai_ros_driver.dir/build.make:244: CMakeFiles/depthai_ros_driver.dir/src/dai_nodes/nn/yolo.cpp.o] Error 1
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
gmake[2]: *** [CMakeFiles/depthai_ros_driver.dir/build.make:258: CMakeFiles/depthai_ros_driver.dir/src/dai_nodes/nn/spatial_mobilenet.cpp.o] Error 1
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
gmake[2]: *** [CMakeFiles/depthai_ros_driver.dir/build.make:104: CMakeFiles/depthai_ros_driver.dir/src/dai_nodes/sensors/imu.cpp.o] Error 1
c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
gmake[2]: *** [CMakeFiles/depthai_ros_driver.dir/build.make:132: CMakeFiles/depthai_ros_driver.dir/src/dai_nodes/sensors/mono.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:140: CMakeFiles/depthai_ros_driver.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2

Failed <<< depthai_ros_driver [27min 36s, exited with code 2]
Aborted <<< depthai_examples [27min 43s]

Summary: 2 packages finished [28min 12s]
1 package failed: depthai_ros_driver
1 package aborted: depthai_examples
2 packages had stderr output: depthai_examples depthai_ros_driver
1 package not processed

ChatGPT is suggesting that it is memory issue after running spawn -s I'm getting
Filename Type Size Used Priority
/dev/sdb partition 2097152 43388 -2

I would greatly appreciate any help or lead you could give me. Im using LWS Ubuntu 22.04 and Windows 11; the purpose is to bind OAK-D with unity to create an art installation for modern art exhibitions using detected people as input for RL agents trained using ML agents.

dependency of custom message could not be found

Describe the bug
The following error occurs while building a part of this package:

C:\dev\ros2-for-unity\build\ros2_custom_msgs\rosidl_generator_cs\ros2_custom_msgs\msg\sphere.cs(31,10): error CS0246: The type or namespace name 'geometry_msgs' could not be found (are you missing a using directive or an assembly reference?) [C:\dev\ros2-for-unity\build\ros2_custom_msgs\ros2_custom_msgs_assembly\ros2_custom_msgs_assembly_dotnetcore.csproj] [C:\dev\ros2-for-unity\build\ros2_custom_msgs\ros2_custom_msgs_assembly.vcxproj]

To Reproduce
Steps to reproduce the behavior:

  1. Follow the tutorial (omit Num.msg and AddThreeInts.srv in msgand CMakeLists.txt)
  2. add the following to ros2_for_unity_custom_messages.repos:
    src/ros2cs/custom_messages/<package_name>:
        type: git
        url: <url>
        version: humble
  1. create a Windows build
  2. watch it fail to build the custom package

Expected behavior
The build succeeds

Desktop:

  • OS: Windows 10
  • ros2 distro: humble
  • ros2-for-unity version: 1.2.0
  • ros2cs version [e.g. git-sha 2a45785b080fffb3ae5e2f645e976a69698810f0]
  • ros2 dds middleware: fastdds
  • ros2 environment setup: single pc

Fix
The build succeeds when adding the following to ros2_for_unity_custom_messages.repos:

    src/ros2cs/src/ros2/<package_name>:
        type: git
        url: <url>
        version: humble

RuntimeError - when using custom messages

Hi, there?
I have some problem when using my custom msgs.

Describe the bug

  • After inserting "custom msgs" in src/ros2cs, I executed ./build.sh and imported the Asset into Unity.

    • There are some stderr output, but it was confirmed that the build was completed.
    • 스크린샷, 2022-12-06 18-14-10
  • Also, it was confirmed that there is no problem in executing ROS2TalkerExample.cs and ROS2ListenerExample.cs. (In 'std_msgs', it was confirmed that the topic was published normally.)

  • However, when I changed std_msgs to custom_msgs in the example template, the following error occurred.

    • (Original Code)

    • 스크린샷, 2022-12-06 18-37-00

    • (The error)

    • 스크린샷, 2022-12-06 17-14-15

RuntimeError: type support not from this implementation, at /tmp/binarydeb/ros-foxy-rmw-fastrtps-cpp-1.3.1/src/publisher.cpp:86, at /tmp/binarydeb/ros-foxy-rcl-1.1.14/src/rcl/publisher.c:180
ROS2.Utils.CheckReturnEnum (System.Int32 ret) (at <e0a206ab668a41a18192d5dc278b96ab>:0)
ROS2.Publisher`1[T]..ctor (System.String pubTopic, ROS2.Node node, ROS2.QualityOfServiceProfile qos) (at <e0a206ab668a41a18192d5dc278b96ab>:0)
ROS2.Node.CreatePublisher[T] (System.String topic, ROS2.QualityOfServiceProfile qos) (at <e0a206ab668a41a18192d5dc278b96ab>:0)
ROS2.ROS2Node.CreatePublisher[T] (System.String topicName, ROS2.QualityOfServiceProfile qos) (at Assets/Ros2ForUnity/Scripts/ROS2Node.cs:75)
ROS2.ToKSOE.Update () (at Assets/ToKSOE.cs:44)
  • I think the Null Reference problem seems to be something that won't happen if only runtime errors are resolved.

Desktop (please complete the following information):

  • OS : Ubuntu20.04
  • ros2 distro : foxy
  • ros2-for-unity version : 1.2.0 Release
  • ros2cs version : 1.2.0 Release
  • ros2 dds middleware : fast-dds
  • ros2 environment setup : single pc, local network
  • Unity editor version : 2020.3.26f1

I need your help a lot !! How should I handle this issue?

ROS2 Subscriber to /image_raw

Hello.
I wanted to ask if i set to a Unity Script a Subscriber which subscribes to an /image_raw topic of a Robot, how can i see the picture inside the Unity ?

don't know how to custom message

I tried to custom the message in ros2_for_unity_custom_messages.repos, like this:

# NOTE: Use this file if you want to build with custom messages that reside in a separate remote repo.
# NOTE: use the following format

repositories:
  src/ros2cs/custom_messages/<package_name>:
    type: git
    url: <repo_url>
    version: <repo_branch>
  custom_messages/<package2_name>:
    "Hello World"

and then ran ./pull_repositories.sh in root directory, got this:

=========================================
* Pulling ros2cs repository:
=== ./src/ros2cs/ (git) ===

HEAD is now at 7e3d179 msgs.cs.em platform check based on selected csbuildtool

=========================================
Pulling custom repositories:
Input data is not valid format: string indices must be integers

=========================================
Pulling ros2cs dependencies:
Detected ROS2 galactic. Getting required repos from 'ros2_galactic.repos'
........

It seems that my message in wrong syntax. How should I edit the message?

Sourcing issue meesage

Hi,

I'm getting the following error:

Screenshot from 2021-08-27 18-52-58

Whats the procedure to launch unity sourced?
Because I sourced the ros env and launched the unity editor from the same terminal.
I don't know if it's because I hade created that UnityProject in a Unity session without sourcing?

Any ideas?

Calling Dispose() on Subscriber raises an Exception

Issue

Calling Dispose for subscription breaks something in the framework, causing errors in log and preventing subsequent subscriptions.

Ways to reproduce:

Setup Unity project with plugins as instructed.
With Unity code below (only essential code shown), start terminal and give command
ros2 topic pub mytopic std_msgs/msg/String "data: 'hello'"
When OnStartButtonClicked is called, messages are printed in log as expected.
When OnStopButtonClicked is called, messages stop but in log is printed:

RuntimeError: subscription's implementation is invalid, at /tmp/binarydeb/ros-foxy-rcl-1.1.10/src/rcl/subscription.c:462, at /tmp/binarydeb/ros-foxy-rcl-1.1.10/src/rcl/wait.c:324
ROS2.Utils.CheckReturnEnum (System.Int32 ret) (at /workdir/ros2-for-unity/src/ros2cs/src/ros2cs/ros2cs_core/utils/Utils.cs:37)

If OnStartButtonClicked is called again, no messages are received anymore.
This happens with standard and custom types in same way.

void Start(){ 
  m_ros2UnityComponent = transform.root.Find("RosNode").gameObject.GetComponent<ROS2UnityComponent>();
  ros2Node = m_ros2UnityComponent.CreateNode("ROS2UnityListenerNode"); 
}
void OnMessage(std_msgs.msg.String message){
  Debug.Log("Message received: " + message.Data);
}
void OnStartButtonClicked()
{ 
  if (m_subscriber == null){
    m_subscriber 
      = ros2Node.CreateSubscription<std_msgs.msg.String>("mytopic", OnMessage);
  }
}
void OnStopButtonClicked(){
  if (m_subscriber != null)
  {
    m_subscriber.Dispose();
    m_subscriber = null;
  }
}

Full stack trace

RuntimeError: subscription's implementation is invalid, at /tmp/binarydeb/ros-foxy-rcl-1.1.10/src/rcl/subscription.c:462, at /tmp/binarydeb/ros-foxy-rcl-1.1.10/src/rcl/wait.c:324
ROS2.Utils.CheckReturnEnum (System.Int32 ret) (at /workdir/ros2-for-unity/src/ros2cs/src/ros2cs/ros2cs_core/utils/Utils.cs:37)
ROS2.WaitSet.Wait (ROS2.rcl_context_t context, System.Collections.Generic.List`1[T] subscriptions, System.Double timeoutSec) (at /workdir/ros2-for-unity/src/ros2cs/src/ros2cs/ros2cs_core/WaitSet.cs:81)
ROS2.Ros2cs.SpinOnce (System.Collections.Generic.List`1[T] nodes, System.Double timeoutSec) (at /workdir/ros2-for-unity/src/ros2cs/src/ros2cs/ros2cs_core/Ros2cs.cs:233)
ROS2.ROS2UnityComponent.Tick () (at Assets/ros2_unity_core/ROS2/Scripts/ROS2UnityComponent.cs:129)
ROS2.ROS2UnityComponent.<FixedUpdate>b__16_0 () (at Assets/ros2_unity_core/ROS2/Scripts/ROS2UnityComponent.cs:140)
System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <fb001e01371b4adca20013e0ac763896>:0)
System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <fb001e01371b4adca20013e0ac763896>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <fb001e01371b4adca20013e0ac763896>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <fb001e01371b4adca20013e0ac763896>:0)
System.Threading.ThreadHelper.ThreadStart () (at <fb001e01371b4adca20013e0ac763896>:0)
UnityEngine.<>c:<RegisterUECatcher>b__0_0(Object, UnhandledExceptionEventArgs) (at /home/bokken/buildslave/unity/build/Runtime/Export/Scripting/UnhandledExceptionHandler.bindings.cs:46)

Does ROS2-For-Unity work on IOS?

Hi everyone,

This issue is not really an issue, but a question instead. I don´t really know where else I should ask this. I hope you don´t mind if I post it here.

I'm developing an IOS app to control a turtlebot3 wafflePI through ROS2. It is also meant to let users control the waffle's digital twin in a simulated environment using Unity. As I've been working with ROS on an Ubuntu VM, I decided to install Unity on it and then managed to integrate ros2-for-unity package. At the moment, I can control the waffle's model using my keyboard.

The objective is to have buttons on the iPad's screen publishing values to cmd_vel topic hence making the wafflePI move.

Now the question is - Will the ros2-for-unity package still work when I integrate the unity project with my IOS app?

Hope I was clear enough. It is kind of tricky for me to explain.

Multiple builds create nested install artifacts

Ubuntu:
A subdirectory with same name is created, this is invalid

└── Ros2ForUnity
    ├── COLCON_IGNORE
    ├── Plugins
    ├── Plugins.meta
    ├── Ros2ForUnity
    ├── Scripts
    └── Scripts.meta

implement INode for ROS2Node

Is your feature request related to a problem? Please describe.
Writing nodes which are independent of Unity is problematic because the class Node used by ros2cs is not sharing any interfaces with the class ROS2Node used by this project, preventing nodes from accepting both.

Describe the solution you'd like
ros2cs contains an interface called INode which represents a ROS2 Node which should include ROS2Node.

Describe alternatives you've considered

  1. Writing Unity specific versions
    • code duplication
    • unnecessary work
  2. Replacing ROS2Nodewith Node
    • might prevent nodes from being removed by the garbage collector
    • existing code would break
  3. exposing the wrapped Node
    • would make usage a bit more cumbersome
    • would allow for using features not proxied by ROS2Node

ROS2TalkerExample: Object reference not set to an instance of an object

Describe the bug
When I try the README "Usage" step 9:
Once you start the project in Unity, you should be able to see two nodes talking with each other in Unity Editor's console or use ros2 node list and ros2 topic echo /chatter to verify ros2 communication.

I get the error:
Object reference not set to an instance of an object ROS2.ROS2TalkerExample.Update() (at Assets/Ros2ForUnity/Scripts/ROS2TalkerExample.cs:38)
With line 38 being:

if (ros2Unity.Ok())

I get the same error with the listener, except line 37

if (ros2Node == null && ros2Unity.Ok())

That makes me guess that something goes wrong in

void Start()
{
    ros2Unity = GetComponent<ROS2UnityComponent>();
}

Except I don't know what.

Expected behavior
I'd expect to see the talker and listener to work.

Desktop (please complete the following information):

  • OS: Ubuntu20.04
  • ros2 distro Foxy
  • ros2-for-unity version: master branch 90f009a
  • ros2 environment setup: single pc

Sensor example

Hello,

I am trying to implement a Lidar sensor with header. I could not find an example of a sensor, only the abstract file Sensor.cs.

Best regards,
Simao

running my Unity software on Windows and ROS2 foxy on Linux(virtualbox)

Hi, I have been trying to connect my Unity project to ROS2 by following the tutorial here . However, I have been unsuccessful. Currently, I am running my Unity software on Windows and ROS2 foxy on Linux(virtualbox). This means both Unity and ROS2 are running in the same PC, however under different OS. May I know which pre-built releases should I download? Under such setup, can your module still work? Thanks!

Describe the bug

/chatter is not detected at ROS2.

Desktop (please complete the following information):

OS : Ubuntu20.04
ros2 distro : foxy
ros2-for-unity version : 1.2.0 Release
ros2cs version : 1.2.0 Release
ros2 dds middleware : fast-dds
ros2 environment setup : single pc, local network
Unity editor version : 2020.3.26f1

Do not deploy plugins in the Asset folder

As a build step, plugins are deployed into src/Ros2ForUnity/Plugins folder. This should not be the case. Instead, all build artifacts should be in build/ and install/ folders.

The asset folder is used to create .unitypackage, but this can be done in the temporary directory.

some question about building with custom messages in standalone mode

@pijaro Hi,sorry to bother you here,but I meet some problem when I attempt to build it with my custom messages,the output of ./build.sh --standalone --clean-install is shown below:

Summary: 23 packages finished [5min 7s]
  1 package failed: auto_aim_interfaces
  7 packages aborted: diagnostic_msgs nav_msgs sensor_msgs shape_msgs tf2 tf2_msgs trajectory_msgs
  22 packages had stderr output: action_msgs actionlib_msgs auto_aim_interfaces builtin_interfaces composition_interfaces diagnostic_msgs example_interfaces geometry_msgs lifecycle_msgs nav_msgs rcl_interfaces ros2cs_core rosgraph_msgs sensor_msgs shape_msgs statistics_msgs std_msgs std_srvs test_msgs tf2_msgs trajectory_msgs unique_identifier_msgs
  18 packages not processed
Ros2cs build failed!

as you can see the custom message is auto_aim_interfaces which is failed during building and here is the message in auto_aim_interfaces's stderr.log:

�[0mCMake Error: The source directory "/root/ros2-for-unity/src/ros2cs/custom_messages/rm_auto_aim/auto_aim_interfaces" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.�[0m
gmake: *** [Makefile:4039: cmake_check_build_system] Error 1

I'm guessing that the source directory /root/ros2-for-unity/src/ros2cs/custom_messages/rm_auto_aim/auto_aim_interfaces does not exist is because I used to set the remote repo in ros2_for_unity_custom_messages.repos but it should not happen because now I just put the auto_aim_interfaces next to other packages in the src/ros2 sub-folder.Actually the package is needed by the project rm_vision_simulator which is originally using ros2-for-unity 1.2.0 release,However,I want to build the ros2-for-unity in standalone mode in order to run the simulator without ros2 installation of the host.I'm not sure if I only need to build ros2-for-unity with auto_aim_interfaces or the entire rm_auto_aim,hope you can give me some advice!:-)

RuntimeError: error not set, at /tmp/binarydeb/ros-foxy-rcl-1.1.11/src/rcl/node.c:276

Describe the bug
I am getting a runtime error when running the example. I cannot see either node with ros2 topic list or ros2 node list.

The error

RuntimeError: error not set, at /tmp/binarydeb/ros-foxy-rcl-1.1.11/src/rcl/node.c:276
ROS2.Utils.CheckReturnEnum (System.Int32 ret) (at /home/pjaroszek/projects/robotec/tasks/github/ros2-for-unity/release-1.1/ros2-for-unity-foxy/src/ros2cs/src/ros2cs/ros2cs_core/utils/Utils.cs:37)
ROS2.Node..ctor (System.String nodeName, ROS2.rcl_context_t& context) (at /home/pjaroszek/projects/robotec/tasks/github/ros2-for-unity/release-1.1/ros2-for-unity-foxy/src/ros2cs/src/ros2cs/ros2cs_core/Node.cs:61)
ROS2.Ros2cs.CreateNode (System.String nodeName) (at /home/pjaroszek/projects/robotec/tasks/github/ros2-for-unity/release-1.1/ros2-for-unity-foxy/src/ros2cs/src/ros2cs/ros2cs_core/Ros2cs.cs:130)
ROS2.ROS2Node..ctor (System.String unityROS2NodeName) (at Assets/Ros2ForUnity/Scripts/ROS2Node.cs:38)
ROS2.ROS2UnityComponent.CreateNode (System.String name) (at Assets/Ros2ForUnity/Scripts/ROS2UnityComponent.cs:86)
ROS2.ROS2ListenerExample.Update () (at Assets/Ros2ForUnity/Scripts/ROS2ListenerExample.cs:39)

Note: /home/pjaroszek/projects/robotec/tasks/github/ros2-for-unity/release-1.1/ros2-for-unity-foxy/src/ros2cs/src/ros2cs/ros2cs_core/Node.cs:61 is not a path on my system. @pijaro it seems that your paths are hard coded somewhere in the release?

To Reproduce
Steps to reproduce the behavior:

  1. Download the latest release (1.1.0)
  2. Source ROS distro
  3. Launch editor
  4. Create two empty objects, add a ROS Unity Component to each of them
  5. Add the talker example script to one
  6. Add the listener example script to the other
  7. Hit play

Expected behavior
The nodes talk to each other, and I can see them with ros2 topic list and ros2 node list

Screenshots

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
  • ros2 distro: foxy
  • ros2-for-unity version 1.1.0 release
  • ros2cs version: unsure, I think 1.1
  • ros2 dds middleware: cyclonedds
  • ros2 environment setup : single pc

Additional context
N/A

Some variables are read-only in ros2cs message class

Describe the bug
I want to publish camera info from Unity to ROS2, then I found the K variable in sensor_msgs.msg.CameraInfo is read-only and there is no constructor which can change the value of K. Also the P and R are read-only, too.

public double[] P { get; }
public double[] R { get; }
public double[] K { get; }

The original type in raw sensor_msgs CameraInfo message definition is float64 array with specified length of 9, and all the arrays of specified length in csharp are read-only.

float64[9]  K # 3x3 row-major matrix

So is there a solution to change the value of K in csharp script?

CMake Error - Target Names - Windows 10 - Humble

When running the ./build-ps1 command, I get the following error:

image

This happens on package 16/47. I tried it with CMake version 3.24.0 and 3.25.0. For this I have the Ament_cmake version 1.3.2 and Windows SDK version 10.0.19041.0 on Windows 10.
Do you have a quick idea or a workaround? Is the whole thing possibly a Windows problem and on Ubuntu the error does not exist? Thanks for your help.

Can't add script behaviour ROS2ForUnity. The script needs to derive from MonoBehaviour!

Describe the bug
When I try the README "Usage" step 6: Create a top-level object containing ROS2UnityComponent.cs. This is the central Monobehavior for ROS2 For Unity that manages all the nodes. Refer to class documentation for details.

I get the error:
Can't add script behaviour ROS2ForUnity. The script needs to derive from MonoBehaviour!

Expected behavior
I'd expect the script to be able to be added to the object.

Desktop (please complete the following information):

  • OS: Ubuntu20.04
  • ros2 distro Foxy
  • ros2-for-unity version: master branch 90f009a
  • ros2 environment setup: single pc

Generates ROS1 messages with ROS2 setting

Describe the bug
I have created a local custom package with some msgs, srvs, and actions. I sourced it correctly, and it runs fine.

However, when i want to generate .cs files to use inside unity (going to Robotics -> Generate ROS Messages -> Build n msgs) the messages are generated alright, but they seem to be generated for ROS1. This became clear when i tried to use the class as type parameter to the ROS2.ISubscription. I then get the error message "The type 'RosMessageTypes.MyPkg.CustomMsg' must be convertible to 'ROS2.Message'".

I have set the protocol to ROS2 under Robotics -> ROS Settings -> Protocol.

I would expect the generated classes to extend the ROS2.Message class, but instead they extend a Message class from "Unity.Robotics.ROSTCPConnector.MessageGeneration".

Desktop:

  • OS: Ubuntu 20.04
  • ros2 distro: Galactic
  • ros2-for-unity version: Release 1.1.0
  • ros2cs version: Unsure?
  • ros2 dds middleware: Default settings, i have not changed anything
  • ros2 environment setup: Local pc

Build script doesn't compile tests

Issue

Calling ./build.sh with --with-tests flag doesn't actually build tests.

Setup

OS: Ubuntu 20.04
ROS2: Foxy

Steps to reproduce

Follow prerequisites and building steps and call ./build.sh --with-tests.

Current behavior

Build process doesn't compile ros2cs_tests package.

Expected behavior

Build process compiles ros2cs_tests package.

Possible soultions

As I came across this issue it seems that calling ./build.sh --with-tests 1 sets tests flag. I find this issue can be changed in at least two ways - changing ./build.sh script or changing instruction (first option preferable).

spawn gameobject in unity based on real world coordinates

hi , i am using computer vision to detect peoples position and would like to be able to spawn their positions in unity. so far i have the publisher publishing these corrdinates of the peoepl in the real world to unity subscriber node. but now i am unsure as to how to wirte in the ros2 namespace language you guys have made to spawn these people at the subscribed positions. any help would be great.
many thanks,
kieran

Release 1.2.0 did not work on my PC

Describe the bug
1.2.0 does not seem to work for me on Linux 22.04 and Unity 2021.3.2 (LTS).
It looks like it was an overlay release so I installed humble using apt-get on my computer and started the editor from a terminal where I already sourced ROS2 humble.

To Reproduce
Steps to reproduce the behavior:

  1. Start with a computer with Ubuntu 22.04
  2. Make a fresh project in Unity 2021.3.2
  3. Download Ros2ForUnity_humble_ubuntu2204.zip
  4. Open a terminal and run source /opt/ros/humble/setup.bash
  5. Open the Unity editor in the same terminal by writing, for example, Unity/Hub/Editor/2021.3.20f1/Editor
  6. Add a ROS2 Unity Component script to an emtpy GameObject.

Expected behavior
No errors

Screenshots
image

Desktop (please complete the following information):

  • OS: Ubuntu22.04, Windows 10
  • ros2 distro humble
  • ros2-for-unity version 1.2.0
  • ros2cs version ?
  • ros2 dds middleware fastdds
  • ros2 environment setup single pc

Editor crashing after mismatching ROS2 distributions

Describe the bug
When compiling Ros2ForUnity asset and launching Unity Editor with different distro sourced, the Editor crashes without any log info.

To Reproduce
Steps to reproduce the behavior:

  1. Build R2FU asset for ROS2 foxy version
  2. Run Unity Editor with ROS2 galaxy sourced
  3. Run simulation with example talker included in scene

Expected behavior
The Editor doesn't die and logs information that ROS2 distros has been mixed.

Desktop (please complete the following information):

  • OS: Ubuntu20.04
  • ros2 distro foxy/galactic
  • ros2-for-unity version 8bd00f3
  • ros2cs version cbb0e00c773fd45fca9c5d64d27e20f04be53fff (preload_typesupport branch)
  • ros2 dds middleware w/e
  • ros2 environment setup single pc

UnsatisfiedLinkError: libsensor_msgs__rosidl_generator_c.so

Describe the bug
I got UnsatisfiedLinkError: libsensor_msgs__rosidl_generator_c.so. Is the problem related to ros2 or ros2-for-unity?

Screenshot from 2022-11-01 23-41-59

To Reproduce
Steps to reproduce the behavior:

  1. add image_pub = ros2Node.CreatePublisher<sensor_msgs.msg.CompressedImage>("image"); to talker.cs script

  2. inside the lateUpdate() method
    `

         Texture2D snapshot = new Texture2D(resWidth, resHeight, TextureFormat.RGB24, false);
         snapCam.Render();
         RenderTexture.active = snapCam.targetTexture;
         snapshot.ReadPixels(new Rect(0,0,resWidth, resHeight), 0, 0);
         byte[] bytes = snapshot.EncodeToPNG();
    
         sensor_msgs.msg.CompressedImage ImageMsg = new sensor_msgs.msg.CompressedImage();
    
         ImageMsg.Data = bytes;
         ImageMsg.Format = "png";
         image_pub.Publish(ImageMsg);`
    
  3. add a camera and link the render texture to camera

  4. Link the talker.cs script and Unity Component.cs script to camera

  5. Run the Unity simulation

Expected behavior
First, I did not receive any error but after some time Unity freezed and I got the link error because of the sensor_msgs.

Desktop (please complete the following information):

  • OS: [e.g. Ubuntu20.04]
  • ros2 distro [foxy]
  • ros2-for-unity version [latest]
  • ros2cs version [latest]
  • ros2 dds middleware [e.g. cyclonedds, fastdds]
  • ros2 environment setup [single pc]

Cannot write some variables in ROS2 messages.

When a variable's name is the same as the message's type name, Unity will send a compile error.

For example:

rosgraph_msgs.msg.Clock msg = new rosgraph_msgs.msg.Clock();
builtin_interfaces.msg.Time time_msg = new builtin_interfaces.msg.Time();
time_msg.Sec = sec;
time_msg.Nanosec = nanosec;
msg.Clock = time_msg;

This will cause an error as such:
error CS1061: 'Clock' does not contain a definition for 'Clock' and no accessible extension method 'Clock' accepting a first argument of type 'Clock' could be found (are you missing a using directive or an assembly reference?)

Another example:
nmea_msgs.msg.Sentence msg = new nmea_msgs.msg.Sentence();
msg.Header.Stamp.Sec = sec;
msg.Header.Stamp.Nanosec = nanosec;
msg.Sentence = (string)gps.gpgga;

The error:
error CS1061: 'Sentence' does not contain a definition for 'Sentence' and no accessible extension method 'Sentence' accepting a first argument of type 'Sentence' could be found (are you missing a using directive or an assembly reference?)

In the second example, writing the header isn't causing any trouble, so I wonder what causes the problem. I apologize if I have made some simple mistakes.
Your help will be appreciated.

How to create custom message and use it with ros2-for-unity repository in Unity?

Hello,
I use your repository to receive the camera information from Unity as a ros2 message. I transfer the cam_image, cam_XYZ, cam_RPY, and cam_FOV messages seperately. I want to create a new custom cam_info message that contains cam_XYZ, cam_RPY, and cam_FOV information. How can I do that with your repository? For example, I use formal ros2 messages like this private IPublisher<sensor_msgs.msg.CompressedImage> image_pub;

Error on unity side when executing custom message in ros2-for-unity

Hi, I tried to run a custom message in ros2-for-unity, but an error occurred on the untiy side.
It says in how to create a custom message that I can do it by dragging and dropping files, but do I need to rewrite the files such as ROS2TalkerExample.cs?
I would like to know how to publish a custom message.

Error on the untiy side
Assets/Ros2ForUnity/Scripts/ROS2TalkerExample.cs(28,48): error CS0426: The type name 'String' does not exist in the type 'TwoInts'

The custom message file you added
injection_interface_msg
my_messages

injection_interface_msg.zip
my_messages.zip
asset.zip

Best regards.

Custom message problem

Hello

I have a problem with my custom message

RuntimeError: type support not from this implementation, at /tmp/binarydeb/ros-foxy-rmw-fastrtps-cpp-1.3.1/src/subscription.cpp:91, at /tmp/binarydeb/ros-foxy-rcl-1.1.14/src/rcl/subscription.c:168
ROS2.Utils.CheckReturnEnum (System.Int32 ret) (at <1afb0f4c40de4f0192212174d671b2ca>:0)
ROS2.Subscription1[T]..ctor (System.String subTopic, ROS2.Node node, System.Action1[T] cb, ROS2.QualityOfServiceProfile qos) (at <1afb0f4c40de4f0192212174d671b2ca>:0)
ROS2.Node.CreateSubscription[T] (System.String topic, System.Action1[T] callback, ROS2.QualityOfServiceProfile qos) (at <1afb0f4c40de4f0192212174d671b2ca>:0) ROS2.ROS2Node.CreateSubscription[T] (System.String topicName, System.Action1[T] callback, ROS2.QualityOfServiceProfile qos) (at Assets/Ros2ForUnity/Scripts/ROS2Node.cs:92)
ROS2.ROS2Light.Update () (at Assets/Ros2ForUnity/Scripts/ROS2Light.cs:53)

Custom messages were successfully collected. The C# script sees these messages.
But at the node startup stage, an error crashes

A custom message consists of two fields
uint8 chennel
uint8 brightness

My configuration
Ubuntu 20.04
ROS Foxy
.NET 3.1
ROS2Unity: foxy_fixes_for_custom_messages

Compile and validate the Asset

Ros2ForUnity folder scripts are currently not checked for compilation errors during the build but only packed into the asset with ros2cs libraries.

  • Add a mimum set of required Unity libraries for UnityEngine dependencies
  • Add asset scripts compilation to the build process
  • Add first simple unit tests that are also executed in the process (e.g. init / deinit)

Had compilation error

Hi,

Had this issue in an Ubuntu 20, FOXY system when executing the ""./build.sh"" script

CMake Error at CMakeLists.txt:150 (find_package):
By not providing "FindCycloneDDS.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"CycloneDDS", but CMake did not find one.

Could not find a package configuration file provided by "CycloneDDS" with
any of the following names:

CycloneDDSConfig.cmake
cyclonedds-config.cmake

Add the installation prefix of "CycloneDDS" to CMAKE_PREFIX_PATH or set
"CycloneDDS_DIR" to a directory containing one of the above files. If
"CycloneDDS" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
CMakeLists.txt:264 (get_standalone_dependencies)

--- stderr: ros2cs_core
CMake Error at CMakeLists.txt:150 (find_package):
By not providing "FindCycloneDDS.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"CycloneDDS", but CMake did not find one.

Could not find a package configuration file provided by "CycloneDDS" with
any of the following names:

CycloneDDSConfig.cmake
cyclonedds-config.cmake

Add the installation prefix of "CycloneDDS" to CMAKE_PREFIX_PATH or set
"CycloneDDS_DIR" to a directory containing one of the above files. If
"CycloneDDS" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
CMakeLists.txt:264 (get_standalone_dependencies)


Failed <<< ros2cs_core [0.96s, exited with code 1]

Any idea why this could happen? Any info you need extra to solve this issue just ask me and I'll be delighted to look for it :).

Unable to run executable

I have followed the instructions and was able to generate a ROS2 subscriber in unity. Then I built the solution and generated a .x86_64 file for linux. When I run this executable it crashes immediately.

Is this a issue from my side or the repo doesn't support it?

Thanks

Does this work on Android?

Hi, I have not tested it myself yet, but is it possible to deploy the Unity App on an Android device with functional ROS2 communication?

Memory Leak

When I do a suscriptor in Unity and open task manager of Windows I can see how memory usage increases uncontrollably over time. With usual messages such as a string, the computer does not become saturated, but when it receives images it does collapse. I have had this same experience in other projects such as the Unity Robotics Hub.

To Reproduce
Create an empty object in Unity Hierarchy and add ROS2UnityComponent.cs, ROS2TalkerExample and ROS2ListenerExample. Play the game on Unity Editor and see how it increases the value of the memory of the process that executes the project on WIndows task manager.

I think you should add the parameter of how many messages you want in the queue when declaring the subscriber and delete all messages that are not required, just like the original ros2 subscriber does.

Calling Dispose() on Subscriber raises an Exception after few calls

This issue #21 was fixed previously so that calling Dispose does not cause immediate crash. But same error still occurs if topics are subscribed/disposed in fast manner.
I attached a C++ test program that publishes several topics and also publishes add/remove commands to tell what topics should be subscribed/disposed.
Also attached a sample Unity code that receives those topics and subscribes/disposes topics according to received messages.
This code causes the error
RuntimeError: subscription's implementation is invalid, at /tmp/binarydeb/ros-foxy-rcl-1.1.11/src/rcl/subscription.c:462, at /tmp/binarydeb/ros-foxy-rcl-1.1.11/src/rcl/wait.c:324
to happen in few seconds.

dispose.zip

No ROS environment sourced.

I have strictly followed the instructions in readme, and there are no errors reported during the period. However, "no ROS environment sourced." appeared during the initial test Problems. I'm sure I've run "source / opt / ROS / foxy / setup. bash" in the command window. Who can tell me how to operate to avoid such mistakes? I'm a novice, please give me a detailed operation description, thank you!

Fail to understand what is the docker's doing

Reading both the docker readme and the issue, I don't understand what is the docker doing, does it only allow user to build custom message on a docker or does it virtualise ros-for-unity, making it possible to use it on any os with docker installed?

A couple of lines in the docker readme to explain its purpose in layman's terms would go a long way for beginner with the library

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.