コード例 #1
0
    void Start()
    {
        rosSocket      = GameObject.Find("drone").GetComponent <RosConnector>().RosSocket;
        droneBody      = GameObject.Find("drone").GetComponent <Rigidbody>();
        publication_id = rosSocket.Advertize(publishTopic, "sensor_msgs/PointCloud2");
        laser          = new rayCaster(maxLeftAngle, maxRightAngle, maxTopAngle, maxBottomAngle, verticalIncrement, horizontalIncrement, maxDistance, this, 1 << 8);
        pcl.createPclCloud(0, 0, true);

        pc = new SensorPointCloud2();
    }
コード例 #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]);
    }
コード例 #3
0
        /// <summary>
        /// work in progress
        /// </summary>
        /// <param name="pcl"></param>
        /// <param name="laser"></param>
        /// <param name="drawRay"></param>
        /// <param name="rosCloud"></param>
        /// <returns></returns>
        public bool runCasterSequentialRep2(ref SensorPointCloud2 rosCloud, laserSensor laser, bool drawRay)
        {
            if (stackDone)//restart
            {
                currentAngle = topA;
                stackDone    = false;
            }

            pclInterface pcl = new pclInterface();

            pcl.createPclCloud(0, 0, true);

            int cicles = 0;

            while (cicles < repetitions)
            {
                if (currentAngle >= bottomA)
                {
                    float currentHoriAngle = leftA;
                    while (currentHoriAngle < rightA)
                    {
                        getPointFromRay(currentHoriAngle, currentAngle, maxDist, ref pcl, laser, drawRay);
                        currentHoriAngle += horiInc;
                    }
                    currentAngle -= horiInc;
                }
                else
                {
                    stackDone = true;
                    if (rosCloud.data.Length > 0)
                    {
                        return(true);
                    }
                }
                cicles++;
            }
            return(false);
        }