Create the following C# script and attach to a gameobject in a scene
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using ROS2;
public class SampleScript : MonoBehaviour
{
private ROS2UnityCore ros2Unity;
private ROS2Node ros2Node;
void Awake() {
ros2Unity = new ROS2UnityCore();
}
// Start is called before the first frame update
void Start()
{
if (ros2Unity.Ok()) {
ros2Node = ros2Unity.CreateNode("unity_ros2_node");
}
}
}
Run Unity Editor
Unity Editor crashes
~/.config/unity3d/Editor.log's last few lines are as follow
Loaded scene 'Temp/__Backupscenes/0.backup'
Deserialize: 0.470 ms
Integration: 75.618 ms
Integration of assets: 0.005 ms
Thread Wait Time: 0.025 ms
Total Operation Time: 76.118 ms
Caught fatal signal - signo:11 code:1 errno:0 addr:0x560e00000001
Obtained 10 stack frames.
#0 0x007fce5d242520 in __sigaction
#1 0x007fce5d39d9bd in __nss_database_lookup
#2 0x007fcc7c0e321d in ddsrt_strdup
#3 0x007fcc7c0cf082 in dds_create_topic_impl
#4 0x007fcc7c0cf68c in dds_create_topic_sertype
#5 0x007fcc7c15aed0 in rmw_deserialize
#6 0x007fcc7c15b277 in rmw_deserialize
#7 0x007fcc7c15cf3c in rmw_create_node
#8 0x007fcd100f920a in rcl_node_init
#9 0x0000004231b058 in (wrapper managed-to-native) object:wrapper_native_0x7fcd100f8da0 (ROS2.rcl_node_t&,string,string,ROS2.rcl_context_t&,intptr)
Launching bug reporter
Attribute Qt::AA_EnableHighDpiScaling must be set before QCoreApplication is created.
Expected behavior
A node "unity_ros2_node" is created
Additional context
It seems like ros2cs's this line is causing the error. The error log says ddsrt_strdup is in the stack frames and it is from cyclonedds's this line. I don't really know how to debug the middleware level issue, so I don't know any further.
When switching to fastdds, it works properly. It happens only on cyclonedds. It may be related to cyclonedds's latest update or something.
Describe the bug When using Cyclone DDS as the DDS, creating ROS2 node with Ros2ForUnity fails with segmentaion fault.
Environment
To Reproduce Steps to reproduce the behavior:
~/.config/unity3d/Editor.log
's last few lines are as followExpected behavior A node "unity_ros2_node" is created
Additional context
It seems like ros2cs's this line is causing the error. The error log says
ddsrt_strdup
is in the stack frames and it is from cyclonedds's this line. I don't really know how to debug the middleware level issue, so I don't know any further.When switching to fastdds, it works properly. It happens only on cyclonedds. It may be related to cyclonedds's latest update or something.