/// <summary> /// Return Gaze /// </summary> public void returnGaze() { if (staticmotion) { return; } //Get the current position. //Reinitialize the motion proxy to prevent SOAP error. motion = new MotionProxy(ip, port); List<float> curlist = motion.getAngles(this.jointList, false); //The final position var list = new List<float>(); list.Add(initAngle[0]); list.Add(initAngle[1]); //Initialize to prevent SOAP error. bezierMotion = new Bezier(ip, port); bezierMotion.beziermove(jointList, 1, curlist, list); //Deactive facetracking for side effect - 08/06/2013 //active = true; }
/// <summary> /// Start HeadGaze /// </summary> /// <param name="yaw">Angle for yaw</param> /// <param name="pitch">Angle for pitch</param> /// <param name="absolute">If the angle is absolute or not</param> /// <returns></returns> public List<float> startGaze(float yaw,float pitch,bool absolute=false) { //Deactivate FaceTracking active = false; //List for final angle endAngle = new List<float>(); endAngle.Add(yaw); endAngle.Add(pitch); //reverse is true, means look at him if (reverse) { endAngle = correctLocation; absolute = true; } //get the current degree, if its in a middle of a gaze //changue to last position. if (lastPosition != null) { initAngle = lastPosition; } else { initAngle = motion.getAngles(this.jointList, true); } //When it should not move at all... wakakakaka if (staticmotion) { return initAngle; } //Change the final angle to be relative to the currentAngle if (!absolute) { endAngle[0] += initAngle[0]; endAngle[1] += initAngle[1]; } bezierMotion = new Bezier(ip, port); bezierMotion.beziermove(jointList, 1, initAngle, endAngle); return initAngle; }
protected void beginNode() { Random rnd = new Random(); Bezier move = new Bezier(this.ip, this.port); Console.WriteLine("Start noding"); List<String> jointlist = new List<string>(); jointlist.Add("HeadPitch"); List<float> startlist = new List<float>(); List<float> endlist = new List<float>(); if (type == 3) { startlist.Add(0F); endlist.Add(0.3F); move.beziermove(jointlist, 0.50F, startlist, endlist); } while (!end) { if(type == 2) tracker.startTracker(); endlist.Clear(); startlist.Clear(); double wait = 0; double pause = intimacyLengthDistribution.Sample(); pause *= 1000; int pause_int = (int)pause; if (type == 0)//speaking // 2 is wrong motion. { wait = nextIntimacyDistributionSpeaking.Sample(); } else //listening { wait = nextIntimacyDistributionListening.Sample(); } wait *= 1000; int wait_int = (int)wait; System.Threading.Thread.Sleep(wait_int); if (type == 2) { try { tracker.stopTracker(); } catch (Exception) { end = true; } } if (type == 3) { startlist.Add(0F); endlist.Add(0F); move.beziermove(jointlist, 0.50F, startlist, endlist); endlist.Clear(); endlist.Add(0.3F); System.Threading.Thread.Sleep(pause_int); move.beziermove(jointlist, 0.50F, startlist, endlist); } else { startlist.Add(0F); endlist.Add((float)0.2); move.beziermove(jointlist, 0.50F, startlist, endlist); endlist.Clear(); endlist.Add(0F); System.Threading.Thread.Sleep(pause_int); move.beziermove(jointlist, 0.50F, startlist, endlist); } } }