示例#1
0
    public void sendPingerPos()
    {
        Vector3    posTmp = pinger.transform.position;
        Quaternion rotTmp = pinger.transform.rotation;

        pingerPoint      = new PointMsg(posTmp.x, posTmp.y, posTmp.z);
        pingerQuaternion = new QuaternionMsg(rotTmp.x, rotTmp.y, rotTmp.z, rotTmp.w);
        pingerMsg        = new PoseMsg(pingerPoint, pingerQuaternion);
        obj.GetComponent <ROSInitializerSAUVC>().rosSAUVC.Publish(PingerPublisher.GetMessageTopic(), pingerMsg);
    }
    void Update()
    {
        try
        {
            float p = PingerAngle();
            pingermsg = new Float32Msg(p);
            obj.GetComponent <ROS_Initialize>().ros.Publish(PingerPublisher.GetMessageTopic(), pingermsg);

            /*     Debug.Log("Sending: PingerAngle = " + p);
             *   Debug.Log("Sending to topic: " + PingerPublisher.GetMessageTopic());
             */
        }
        catch (Exception e)
        {
            Debug.Log("Socket error: " + e);
        }
    }