Пример #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
    // 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> ();
    }
Пример #4
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>();
    }