/* * Here commands to the robot-side can be send */ void Update() { if (Input.GetKeyDown(KeyCode.C)) { rosBridge.EnqueRosCommand(new RosPublish("/SModelRobotOutput", HandControlMessageGenerator.closeHand(1.0f))); } else if (Input.GetKeyDown(KeyCode.O)) { rosBridge.EnqueRosCommand(new RosPublish("/SModelRobotOutput", HandControlMessageGenerator.openHand(1.0f))); } else if (Input.GetKey(KeyCode.M)) //sends a perormance-test ping message { JointState jointState = JointStateGenerator.emptyJointState(); Stamp stamp = new Stamp(); DateTime currentTime = DateTime.Now; stamp.secs = currentTime.Second; stamp.nsecs = currentTime.Millisecond; Header header = new Header(); header.stamp = stamp; header.seq = (ulong)messageSeq++; header.frame_id = "Latency Test"; jointState.header = header; rosBridge.EnqueRosCommand(new RosPublish("/joint_states", jointState)); //rosBridge.EnqueRosCommand (new RosPublish ("/SModelRobotOutput", HandControlMessageGenerator.openHand (1.0f))); } else if (Input.GetKeyDown(KeyCode.W)) { rosBridge.WriteLatencyDataFile(); } }
void Start() { //gripperMsgGen = new HandControlMessageGenerator (); rosBridge = new RosBridgeClient(this.verbose, this.imageStreaming, this.jointStates, this.testLatency, this.pointCloud); if (autoConnect) { Connect(); } // leapController.Activate (useLeap); if (testLatency) { jointStateMsgGen = new JointStateGenerator(); // rosBridge.EnqueRosCommand (new RosAdvertise ("/SModelRobotOutput", "SModel_robot_output")); } /* * if (autoConnect) * { * if (!rosBridge.IsConnected()) * { * Connect(); * } * } */ }