Esempio n. 1
0
    void FixedUpdate()
    {
        // send new poses for target's hands & head
        SimplePoseArray poses = new SimplePoseArray(new ROSBridgeLib.std_msgs.Header(42, new ROSBridgeLib.msg_helpers.Time(1, 2), "body"), null);

        poses.poses = new System.Collections.Generic.List <SimplePose>
        {
            new SimplePose("LeftHand", target.LeftHand.transform.localPosition, target.LeftHand.transform.localRotation),
            new SimplePose("RightHand", target.RightHand.transform.localPosition, target.RightHand.transform.localRotation),
            new SimplePose("Head", target.Head.transform.localPosition, target.Head.transform.localRotation)
        };
        ros.Publish(pose_pub, poses);

        // send hand input states for target
        ROSBridgeLib.simple_unity_bot.HandState LeftHandMsg  = new ROSBridgeLib.simple_unity_bot.HandState("LeftHand", target.LeftHand.Inputs[NVRButtonID.HoldButton].SingleAxis, target.LeftHand.Inputs[NVRButtonID.UseButton].IsPressed ? 1.0f : 0.0f);
        ROSBridgeLib.simple_unity_bot.HandState RightHandMsg = new ROSBridgeLib.simple_unity_bot.HandState("RightHand", target.RightHand.Inputs[NVRButtonID.HoldButton].SingleAxis, target.RightHand.Inputs[NVRButtonID.UseButton].IsPressed ? 1.0f : 0.0f);
        ros.Publish(hand_pub, LeftHandMsg);
        ros.Publish(hand_pub, RightHandMsg);
        ros.Render();
    }
Esempio n. 2
0
 // Update is called once per frame in Unity
 void Update()
 {
     ros.Render();
 }