/// <summary> /// makes Sonar and memory Proxies /// </summary> /// <param name="ip"></param> public Sonar(String ip) { sonarProxy = new SonarProxy(ip, 9559); memoryProxy = new MemoryProxy(ip, 9559); ActivateSonar(); }
public void initializeProxies() { fdp = new FaceDetectionProxy(this.ip, 9559); fdp.enableTracking(true); vdp = new VideoDeviceProxy(this.ip, 9559); mp = new MemoryProxy(this.ip, 9559); }
public MarkerRecogniser() { detector = Proxies.GetProxy<LandMarkDetectionProxy>(); detector.subscribe("MarkerRecogniser", 1000, 0F); memory = Proxies.GetProxy<MemoryProxy>(); Camera camera = new Camera("MarkerRecogniser"); camera.Subscribe(); camera.CalibrateCamera(3); camera.Unsubscribe(); }
public MarkerRecogniser() { detector = Proxies.GetProxy <LandMarkDetectionProxy>(); detector.subscribe("MarkerRecogniser", 1000, 0F); memory = Proxies.GetProxy <MemoryProxy>(); Camera camera = new Camera("MarkerRecogniser"); camera.Subscribe(); camera.CalibrateCamera(3); camera.Unsubscribe(); }
public bool tryConnection() { try { MemoryProxy mem = new MemoryProxy(this.ip, this.port); return true; } catch (Exception e) { Console.Out.WriteLine(e.ToString()); return false; } }
public ToNao2(String IP, int port, Kinect kinect, int avg) { this.motioProxy = new MotionProxy(IP, port); this.memProxy = new MemoryProxy(IP, port); this.postureproxy = new RobotPostureProxy(IP, port); this.sensor = kinect; this.jointAngles = new Dictionary <string, float>(); this.avgPoint = new Dictionary <JointType, SkeletonPoint>(); this.avg = avg; this.iteration = 0; setUpjointAngleDictionary(); }
public ToNao2(String IP, int port, Kinect kinect, int avg) { this.motioProxy = new MotionProxy(IP, port); this.memProxy = new MemoryProxy(IP, port); this.postureproxy = new RobotPostureProxy(IP, port); this.sensor = kinect; this.jointAngles = new Dictionary<string, float>(); this.avgPoint = new Dictionary<JointType, SkeletonPoint>(); this.avg = avg; this.iteration = 0; setUpjointAngleDictionary(); }
/// <summary> /// Method that reads the LandmarkDetected memory and extracts the landmarks info into a dictionary /// </summary> /// <param name="memProxy"></param> /// <returns></returns> private Dictionary <int, ArrayList> TryGetLandMark(MemoryProxy memProxy) { Dictionary <int, ArrayList> ret = null; try { // get the LandmarkDetected memory var landMarkMemory = memProxy.getData("LandmarkDetected") as ArrayList; if (landMarkMemory != null) { var landMarks = LandMarkHelper.Instance.GetLandMarksInfo(landMarkMemory) as ArrayList; if (landMarks != null) { ret = new Dictionary <int, ArrayList>(); foreach (var landMark in landMarks) { var landMarkArr = landMark as ArrayList; if (landMarkArr != null) { int?markId = LandMarkHelper.Instance.GetMarkID(landMarkArr) as int?; if (markId.HasValue) { ret.Add(markId.Value, landMarkArr); } } } } } } catch (Exception ex) { Debug.WriteLine("Coult get marks. " + ex.ToString()); } return(ret); }
/// <summary> /// Connects to the NAO robot /// </summary> /// <param name="ip"> ip address of the robot </param> public void connect(string ip) { // if audio or tts is not null it then was not properly disconnected if (audio != null || tts != null) { Disconnect(); } // attempt to connect try { ipString = ip; audio = new AudioDeviceProxy(ip, 9559); tts = new TextToSpeechProxy(ip, 9559); mem = new MemoryProxy(ip, 9559); } catch (Exception e) { // display error message and write exceptions to a file //MessageBox.Show("Exception occurred, error log in C:\\NAOserver\\exception.txt"); System.IO.File.WriteAllText(@"C:\\NAOserver\\exception.txt", e.ToString()); } }
static void Main(string[] args) { bool guessed = false; // used to determine if the user has guessed the right number int wordAsInt = -1; // used to translate recongized word in to an integer value List<string> words = new List<string>(); // create list of words to sent to Nao bot // Create a connection to the text to speech engine on the Nao bot TextToSpeechProxy tts = new TextToSpeechProxy("172.28.78.228", 9559); // Create a connection to the speech recognition on the Nao bot SpeechRecognitionProxy speechR = new SpeechRecognitionProxy("172.28.78.228", 9559); // create connection to robot memory MemoryProxy m = new MemoryProxy("172.28.78.228", 9559); // random number generator Random rnd = new Random(); // generates number between 1‐5 int rndNum = rnd.Next(6); // check for rndNum being 0 if(rndNum == 0) { wordAsInt++; } // add words we want recognized to word list words.Add("one"); words.Add("two"); words.Add("three"); words.Add("four"); words.Add("five"); speechR.setVocabulary(words, false); // send the word list to robot Console.WriteLine("Guessing game running on NAO"); // loop until number is guessed while (!guessed) { // user instructions tts.say("I have picked a number between one and five, try to guess it"); System.Threading.Thread.Sleep(1500); // wait 1.5 seconds speechR.subscribe("Main", 50, 50); // Start speech recognition engine System.Threading.Thread.Sleep(5000); // wait 5 seconds speechR.unsubscribe("Main"); // stop speech recognition engine // get lastwordrecognized from memory object wordObj = m.getData("LastWordRecognized"); string word = (string)((ArrayList)wordObj)[0]; // convert word to a integer switch (word) { case "one": wordAsInt = 1; break; case "two": wordAsInt = 2; break; case "three": wordAsInt = 3; break; case "four": wordAsInt = 4; break; case "five": wordAsInt = 5; break; default: wordAsInt = -1; break; } // if else block to determine if user guessed too high, too low, or correctly if (wordAsInt > rndNum) { tts.say("You guessed too high"); } else if (wordAsInt == rndNum) { tts.say("You guessed correctly!"); guessed = true; } else if (wordAsInt < rndNum) { tts.say("You guessed too low"); } // debug output Console.WriteLine("/nNumber guessed was "); Console.Write(word); Console.WriteLine("/n Actual number is "); Console.Write(rndNum); } }
///<summary> /// Creates proxes to be used by this class only. /// </summary> private void CreateMyProxies() { motion = Proxies.GetProxy <MotionProxy>(); battery = Proxies.GetProxy <BatteryProxy>(); memory = Proxies.GetProxy <MemoryProxy>(); }
///<summary> /// Creates proxes to be used by this class only. /// </summary> private void CreateMyProxies() { motion = Proxies.GetProxy<MotionProxy>(); battery = Proxies.GetProxy<BatteryProxy>(); memory = Proxies.GetProxy<MemoryProxy>(); }
public static void Init() { groupProxy = new GroupProxy(); memoryProxy = new MemoryProxy(); }