Пример #1
0
    void Start()
    {
        // Get the live websocket client
        wsc = GameObject.Find("WebsocketClient").GetComponent <WebsocketClient>();

        // Get the live TFListener
        TFListener = GameObject.Find("TFListener").GetComponent <TFListener>();

        // Create publisher to the Baxter's arm topic (uses Ein)
        wsc.Advertise("ein/" + arm + "/forth_commands", "std_msgs/String");
        // Asychrononously call sendControls every .1 seconds
        InvokeRepeating("SendControls", .1f, .1f);

        if (arm == "left")
        {
            grip_label    = "Left Grip";
            trigger_label = "Left Trigger";
        }
        else if (arm == "right")
        {
            grip_label    = "Right Grip";
            trigger_label = "Right Trigger";
        }
        else
        {
            Debug.LogError("arm variable is not set correctly");
        }
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        GameObject wso = GameObject.FindWithTag("WebsocketTag");

        wsc = wso.GetComponent <WebsocketClient>();

        wsc.Advertise("ein/" + arm + "/forth_commands", "std_msgs/String");
        TFListener = GameObject.Find("TFListener").GetComponent <TFListener>();
        tf         = GetComponent <Transform>();

        //last positions/rotation of the controller (calculate relative displacement of controller at each update)
        lastControllerPosition = tf.position;
        lastControllerRotation = tf.rotation;
        Invoke("FindArm", 1f);                     //update position of lastArm position and rotation
        InvokeRepeating("sendMessage", 1.2f, .1f); //send message to move arm by displacement of current controller position/rotation with previous position/rotation
        targetTransform = targetModel.GetComponent <Transform>();

        if (arm == "left")
        {
            grip_label    = "Left Grip";
            trigger_label = "Left Trigger";
        }
        if (arm == "right")
        {
            grip_label    = "Right Grip";
            trigger_label = "Right Trigger";
        }
        else
        {
            Debug.LogError("arm variable is not set correctly");
        }
    }
Пример #3
0
    // StringMsg rosMsg = new StringMsg("");

    // Use this for initialization
    void Start()
    {
        myref          = transform;
        ScannerLoc     = myref.position;
        prevScannerLoc = ScannerLoc;
        if (!SensorRotator)
        {
            SensorRotator = myref.Find("Laser Sensor").transform;
        }
        if (!emitter)
        {
            SensorRotator = myref.Find("Emitter").transform;
        }

        attachedRB = GetComponentInParent <Rigidbody>();
        if (UDP && !ROS)
        {
            // sendObj =gameObject.AddComponent< UDPSend>();
            sendObj = new UDPSend();
            sendObj.init();
        }
        PointsTemp = new List <Vector3>();
        Points     = new List <Vector3>();
        // writer = new StreamWriter(Application.dataPath+"/Data.csv");
        NoOfScansPerFrame = (int)((HorScanAngRange / HorRes) * hz * Time.fixedDeltaTime);
        currentangle      = -HorScanAngRange / 2;
        if (ROS)
        {
            wsc = FindObjectOfType <WebsocketClient>();
            wsc.Advertise("velodyne", "std_msgs/String");
            // SimulationManager.instance.ros.AddPublisher(typeof(VelodyneStringPublisher));
        }
        // writer.WriteLine("This is a data file");
        // datacolumn=new float[lasercount];
    }
Пример #4
0
    // Use this for initialization
    void Start()
    {
        GameObject wso = GameObject.FindWithTag("WebsocketTag");

        wsc = wso.GetComponent <WebsocketClient> ();
        //while (!wsc.IsConnected ()) {

        //}
        wsc.Advertise("ein/" + arm + "/forth_commands", "std_msgs/String");
        InvokeRepeating("sendControls", .1f, .1f);
        controller = this.GetComponent <VRTK.VRTK_ControllerEvents>();

        TFListener = GameObject.Find("TFListener").GetComponent <TFListener> ();
    }
Пример #5
0
    void Start()
    {
        // Get the live websocket client
        wsc = GameObject.Find("WebsocketClient").GetComponent <WebsocketClient>();

        // Get the live TFListener
        TFListener = GameObject.Find("TFListener").GetComponent <TFListener>();

        // Get the controller componenet of this gameobject
        controller = GetComponent <VRTK.VRTK_ControllerEvents>();

        // Create publisher to the Baxter's arm topic (uses Ein)
        wsc.Advertise("ein/" + arm + "/forth_commands", "std_msgs/String");
        // Asychrononously call sendControls every .1 seconds
        InvokeRepeating("SendControls", .1f, .1f);
    }
    // Use this for initialization
    void Start()
    {
        GameObject wso = GameObject.FindWithTag("WebsocketTag");

        wsc = wso.GetComponent <WebsocketClient>();

        wsc.Advertise("ein/" + arm + "/forth_commands", "std_msgs/String");
        controller = GetComponent <VRTK.VRTK_ControllerEvents>();
        TFListener = GameObject.Find("TFListener").GetComponent <TFListener>();
        tf         = GetComponent <Transform>();

        //last positions/rotation of the controller (calculate relative displacement of controller at each update)
        lastControllerPosition = tf.position;
        lastControllerRotation = tf.rotation;
        Invoke("FindArm", 1f);                     //update position of lastArm position and rotation
        InvokeRepeating("sendMessage", 1.2f, .1f); //send message to move arm by displacement of current controller position/rotation with previous position/rotation
        targetTransform = targetModel.GetComponent <Transform>();
    }