uml-robotics / ROS.NET_Unity

A wrapper around ROS.NET to create precompiled Unity plugin DLLs for use in Unity scripts
BSD 2-Clause "Simplified" License
26 stars 10 forks source link

Unity hangs when Markers are serialized with missing fields #10

Open GregoryLeMasurier opened 4 years ago

GregoryLeMasurier commented 4 years ago

Unity hangs after calling msg.Serialize() on a Marker with missing fields: marker.header.stamp and marker.lifetime.

Source used:

    public ROSCore rosmaster;
    private NodeHandle nh = null;

    private Publisher<MarkerArray> pub;

    // Use this for initialization
    void Start () {
        nh = rosmaster.getNodeHandle();
        pub = nh.advertise<MarkerArray>("test", 10);
    }

    void Update()
    {
        MarkerArray msg = new MarkerArray();
        msg.markers = new Marker[1];

        msg.markers[0] = new Marker();
        msg.markers[0].header = new Messages.std_msgs.Header();
        msg.markers[0].header.stamp = ROS.GetTime();

        msg.markers[0].lifetime = new Duration();

        msg.Serialize();

        pub.publish(msg);
    }