Пример #1
0
    void Update()
    {
        laser2.defineParameters(maxLeftAngle, maxRightAngle, maxTopAngle, maxBottomAngle, verticalIncrement, horizontalIncrement, maxDistance, 1 << 8, repetitions);

        if (run)
        {
            //this function is resposible for push the correct points to the pcl cloud
            if (laser2.runCasterSequentialRep(ref pcl, this, drawRay))
            {
                //convert from pcl cloud to pcl cloud2
                pcl.convertToCloud2();

                //create a new mensage to be send
                SensorPointCloud2 pc = new SensorPointCloud2();

                //from the Pcl cloud2 converted to Ros cloud2 using marshal for better performance
                pcl.convertToRosCloud(ref pc, frame_id);

                //publish the ros cloud mensage
                rosSocket.Publish(publication_id, pc);

                //restart pcl cloud
                pc = new SensorPointCloud2();
                pcl.createPclCloud(0, 0, true);
            }
        }
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        pcl.createPclCloud(0, 0, true);
        pcl.pushPointToCloud(new Vector3(1, 2, 3));
        pcl.convertToCloud2();
        SensorPointCloud2 pc = new SensorPointCloud2();

        pcl.convertToRosCloud(ref pc, "ok");
        Debug.Log("data: " + pc.data[0] + " " + pc.data[1] + " " + pc.data[2] + " " + pc.data[3] + " " + pc.data[4]);
        //byte[] data= new byte[0];
        //pcl.testByteArray222(ref data);
        //Debug.Log("data: "+data[0]+" "+data[1] + " " + data[2] + " " + data[3] + " " + data[4]);
    }