Exemplo n.º 1
0
        private static bool IsNao(string ip)
        {
            TextToSpeechProxy proxy = new TextToSpeechProxy(ip, 9559);

            proxy.say("Connected");
            return(true);
        }
Exemplo n.º 2
0
 public void Startposition(RobotPostureProxy rpp, TextToSpeechProxy tts)
 {
     try
     {
         rpp.goToPosture("StandZero", 1);
         tts.say("Herzlich Willkommen zum Spiel.");
     }
     catch (Exception e)
     {
         Console.WriteLine("Startposition Fehler" + e.Message);
     }
 }
Exemplo n.º 3
0
 static void Main(string[] args)
 {
     TextToSpeechProxy tts = new TextToSpeechProxy("192.168.100.4", 9559);
     tts.say("Koko");
 }
Exemplo n.º 4
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            //Initialize the motion proxy using the text in the ipBox
            MotionProxy mp = new MotionProxy(ipBox.Text, 9559);

            //Initialize the text to speech proxy using the text in the ipBox
            ttsp = new TextToSpeechProxy(ipBox.Text, 9559);

            //Initialize the robots posture proxy using the text in the ipBox
            RobotPostureProxy rpp = new RobotPostureProxy(ipBox.Text, 9559);

               //Wakes the robot up, tells the robot to stand and say hello
                mp.wakeUp();
                rpp.goToPosture("StandInit", .5f);
            ttsp.say("Hola");

            //Sets up lighting of the camera with a white color and directs it in the appropriate direction
            DirectionalLight DirLight1 = new DirectionalLight();
            DirLight1.Color = Colors.White;
            DirLight1.Direction = new Vector3D(1, 1, 1);

            //Setting up the camera so that the picture we see is in a good position
            PerspectiveCamera Camera1 = new PerspectiveCamera();
            Camera1.FarPlaneDistance = 16000;
            Camera1.NearPlaneDistance = 10;

            //Zoomed in with a 45 degree field of view
            Camera1.FieldOfView = 45;

            //50 mm away from the point cloud and centered in the middle
            Camera1.Position = new Point3D(320, 240, -50);

            //Flips the camera so that we see everything right side up
            Camera1.LookDirection = new Vector3D(0, 0, 1);
            Camera1.UpDirection = new Vector3D(0, -1, 0);

            //Creates a new model 3D group to hold the sets of 3D models
            Model3DGroup modelGroup = new Model3DGroup();

            //builds the 3D model
            int i = 0;
            for (int y = 0; y < 480; y += pointDen)
            {
                for (int x = 0; x < 640; x += pointDen)
                {
                    points[i] = Triangle(x, y, pointDen);
                    points[i].Transform = new TranslateTransform3D(0, 0, 0);
                    modelGroup.Children.Add(points[i]);
                    i++;
                }
            }

            //Adds the directional light to the model group
            modelGroup.Children.Add(DirLight1);

            ModelVisual3D modelsVisual = new ModelVisual3D();
            modelsVisual.Content = modelGroup;
            Viewport3D myViewport = new Viewport3D();
            myViewport.IsHitTestVisible = false;
            myViewport.Camera = Camera1;
            myViewport.Children.Add(modelsVisual);
            canvas1.Children.Add(myViewport);
            myViewport.Height = canvas1.Height;
            myViewport.Width = canvas1.Width;
            Canvas.SetTop(myViewport, 0);
            Canvas.SetLeft(myViewport, 0);

            sensor = KinectSensor.KinectSensors[0];
            sensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
            sensor.DepthFrameReady += DepthFrameReady;
            sensor.Start();
        }
Exemplo n.º 5
0
 public void sendToNAO(string input)
 {
     tts.say(input);
 }
Exemplo n.º 6
0
        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); 
            } 
        } 
Exemplo n.º 7
0
 public void speak(String context)
 {
     tts = new TextToSpeechProxy(this.ip, 9559);
     tts.say(context);
 }
Exemplo n.º 8
0
 private static bool IsNao(string ip)
 {
     TextToSpeechProxy proxy = new TextToSpeechProxy(ip, 9559);
     proxy.say("Connected");
     return true;
 }
Exemplo n.º 9
0
 static void Main(string[] args)
 {
     TextToSpeechProxy tts = new TextToSpeechProxy("<IP OF YOUR ROBOT>", 9559);
      tts.say("Hello World");
 }
Exemplo n.º 10
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            //Initialize the motion proxy using the text in the ipBox
            MotionProxy mp = new MotionProxy(ipBox.Text, 9559);

            //Initialize the text to speech proxy using the text in the ipBox
            ttsp = new TextToSpeechProxy(ipBox.Text, 9559);

            //Initialize the robots posture proxy using the text in the ipBox
            RobotPostureProxy rpp = new RobotPostureProxy(ipBox.Text, 9559);

            //Wakes the robot up, tells the robot to stand and say hello
            mp.wakeUp();
            rpp.goToPosture("StandInit", .5f);
            ttsp.say("Hola");

            //Sets up lighting of the camera with a white color and directs it in the appropriate direction
            DirectionalLight DirLight1 = new DirectionalLight();

            DirLight1.Color     = Colors.White;
            DirLight1.Direction = new Vector3D(1, 1, 1);

            //Setting up the camera so that the picture we see is in a good position
            PerspectiveCamera Camera1 = new PerspectiveCamera();

            Camera1.FarPlaneDistance  = 16000;
            Camera1.NearPlaneDistance = 10;

            //Zoomed in with a 45 degree field of view
            Camera1.FieldOfView = 45;

            //50 mm away from the point cloud and centered in the middle
            Camera1.Position = new Point3D(320, 240, -50);

            //Flips the camera so that we see everything right side up
            Camera1.LookDirection = new Vector3D(0, 0, 1);
            Camera1.UpDirection   = new Vector3D(0, -1, 0);

            //Creates a new model 3D group to hold the sets of 3D models
            Model3DGroup modelGroup = new Model3DGroup();

            //builds the 3D model
            int i = 0;

            for (int y = 0; y < 480; y += pointDen)
            {
                for (int x = 0; x < 640; x += pointDen)
                {
                    points[i]           = Triangle(x, y, pointDen);
                    points[i].Transform = new TranslateTransform3D(0, 0, 0);
                    modelGroup.Children.Add(points[i]);
                    i++;
                }
            }

            //Adds the directional light to the model group
            modelGroup.Children.Add(DirLight1);

            ModelVisual3D modelsVisual = new ModelVisual3D();

            modelsVisual.Content = modelGroup;
            Viewport3D myViewport = new Viewport3D();

            myViewport.IsHitTestVisible = false;
            myViewport.Camera           = Camera1;
            myViewport.Children.Add(modelsVisual);
            canvas1.Children.Add(myViewport);
            myViewport.Height = canvas1.Height;
            myViewport.Width  = canvas1.Width;
            Canvas.SetTop(myViewport, 0);
            Canvas.SetLeft(myViewport, 0);

            sensor = KinectSensor.KinectSensors[0];
            sensor.DepthStream.Enable(DepthImageFormat.Resolution640x480Fps30);
            sensor.DepthFrameReady += DepthFrameReady;
            sensor.Start();
        }
Exemplo n.º 11
0
    static void Main(string[] args)
    {
        TextToSpeechProxy tts = new TextToSpeechProxy("<IP OF YOUR ROBOT>", 9559);

        tts.say("Hello World");
    }
Exemplo n.º 12
0
 public void speak(String context)
 {
     tts = new TextToSpeechProxy("128.208.4.225", 9559);
     tts.say(context);
 }
Exemplo n.º 13
0
        static void Main(string[] args)
        {
            string mIp = "127.0.0.1";
            //string mIp = "192.168.1.134";
            int mPort = 9559;

            GamePadState state;
            state = GamePad.GetState(PlayerIndex.One);

            MotionProxy motion = new MotionProxy(mIp, mPort);
            Console.WriteLine("MotionProxy connecté à {0}:{1}", mIp, mPort);
            TextToSpeechProxy tts = new TextToSpeechProxy(mIp, mPort);
            Console.WriteLine("TextToSpeechProxy connecté à {0}:{1}", mIp, mPort);
            RobotPostureProxy posture = new RobotPostureProxy(mIp,mPort);
            Console.WriteLine("RobotPostureProxy connecté à {0}:{1}", mIp, mPort);

            tts.setLanguage("French");
            motion.setStiffnesses("Body", 1f);

            Console.WriteLine();

            Console.WriteLine("En attente de connection de la manette");

            while (!state.IsConnected)
            {
                state = GamePad.GetState(PlayerIndex.One);
            }

            Console.WriteLine("Manette connectée");

            Object[] headJoints = { "HeadYaw", "HeadPitch" };
            Object[] rshoulderJoints = { "RShoulderRoll", "RShoulderPitch" };
            Object[] lelbowJoints = { "LElbowYaw", "LElbowRoll" };
            Object[] handsJoints = { "LHand", "RHand" };
            Object[] handAngles = new Object[2];
            Object[] Angles = new Object[2];

            float horizontal = 0f;
            float parallel = 0f;
            float theta = 0f;
            float percentMaxSpeed = 0.5f;

            while (state.IsConnected && state.Buttons.Back == ButtonState.Released )
            {
                state = GamePad.GetState(PlayerIndex.One);

                if (state.Buttons.A == ButtonState.Pressed)
                {
                    tts.setLanguage("French");
                    tts.say("Bonjour");
                }

                if(state.Buttons.B == ButtonState.Pressed)
                {
                    tts.setLanguage("English");
                    tts.say("Hello");
                }

                if (state.Buttons.X == ButtonState.Pressed) posture.goToPosture("Crouch", 1f) ;
                if (state.Buttons.Y == ButtonState.Pressed) posture.goToPosture("Stand", 1f);
                if (state.Buttons.Start == ButtonState.Pressed) posture.goToPosture("StandZero", 1f);
                if (state.DPad.Up == ButtonState.Pressed) posture.goToPosture("LyingBelly", 1f);
                if (state.DPad.Down == ButtonState.Pressed) posture.goToPosture("LyingBack", 1f);
                if (state.DPad.Left == ButtonState.Pressed) posture.goToPosture("SitRelax", 1f);
                if (state.DPad.Right == ButtonState.Pressed) posture.goToPosture("Sit", 1f);

                float modX = 1.75f;
                float modY = 2f;
                Angles = new Object[] { -state.ThumbSticks.Right.X * modX, -state.ThumbSticks.Right.Y * modY };

                if (state.ThumbSticks.Left.Y <= -0.1f || state.ThumbSticks.Left.Y >= 0.1f)
                    horizontal = state.ThumbSticks.Left.Y;
                else horizontal = 0f;

                if (state.ThumbSticks.Left.X <= -0.1f || state.ThumbSticks.Left.X >= 0.1f)
                    theta = -state.ThumbSticks.Left.X;
                else theta = 0f;

                if (state.Triggers.Left >= 0.1f)
                    parallel = state.Triggers.Left;
                else if (state.Buttons.LeftShoulder == ButtonState.Pressed)
                    parallel = -state.Triggers.Right;
                else parallel = 0f;

                handAngles = new Object[] {
                    state.Buttons.LeftShoulder == ButtonState.Pressed ? 0f : 1f,
                    state.Buttons.RightShoulder == ButtonState.Pressed ? 0f : 1f
                };

                motion.move(horizontal, parallel, theta);

                //motion.setAngles(rshoulderJoints, Angles, percentMaxSpeed);
                motion.setAngles(headJoints, Angles, percentMaxSpeed);
                //motion.setAngles(lelbowJoints, Angles, percentMaxSpeed);
                motion.setAngles(handsJoints, handAngles, 1f);

            }
        }
Exemplo n.º 14
0
 static void bicara()
 {
     TextToSpeechProxy tts = new TextToSpeechProxy("167.205.66.80", 9559);
     tts.say("Hallo buddy");
 }