Ejemplo n.º 1
0
    public new static void CallBack(ROSBridgeMsg msg)
    {
        PointCloud2Msg pointCloudMsg = (PointCloud2Msg)msg;

        if (verbose)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(pointCloudMsg.GetHeader().GetSeq());
            sb.Append(":\n");
            sb.AppendFormat("Size: {0} X {1} = {2}\n", pointCloudMsg.GetWidth(), pointCloudMsg.GetHeight(), pointCloudMsg.GetWidth() * pointCloudMsg.GetHeight());
            sb.Append(pointCloudMsg.GetFieldString());
            Debug.Log(sb.ToString());
        }

        LidarVisualizer visualizer = GameObject.Find(rendererObjectName).GetComponent <LidarVisualizer>();

        visualizer.SetPointCloud(pointCloudMsg.GetCloud());
    }
Ejemplo n.º 2
0
    private IEnumerator DrawCloud(PointCloud2Msg cloud_msg)
    {
        PointCloud2Prefab converter = new PointCloud2Prefab(cloud_msg.GetPoints(), cloud_msg.GetColors(), cloud_msg.GetHeader().GetSeq(), matVertex);
        GameObject        cloud_go  = converter.GetPrefab();

        cloud_go.transform.position = new Vector3(0.0f, 0.0f, 0.0f);
        cloud_go.transform.rotation = new Quaternion(0.0f, 0.0f, 0.0f, 1);
        cloud_go.transform.parent   = pointCloudContainer.transform;
        cloud_go.SetActive(true); // activate Point Cloud in Unity
        yield return(null);
    }