Ejemplo n.º 1
0
 public void setUpNao()
 {
     motioProxy.setSmartStiffnessEnabled(true);
     motioProxy.wakeUp();
     postureproxy.goToPosture("Stand", 0.5f);//Stand LyingBack
     this.sensor.SkeletonReady += getPoint;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Take a stable position, mainly used for walking.
 /// </summary>
 public void TakeStableArmPosition()
 {
     motion.wakeUp();
     Grabbing.GrabWorker w = new Grabbing.GrabWorker();
     Pose.Instance.StandUp();
     w.StiffenArms();
     w.CloseArmsAroundObject();
     w.GrabHands();
     w.HoldForWalking();
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Sets the stiffness of the Nao's motors on if it is not already so.
 /// </summary>
 public void InitMove()
 {
     if (!MotorOn())
     {
         Motion.wakeUp();
     }
     if (!Motion.moveIsActive())
     {
         Motion.moveInit();
     }
 }
        //run a behavior on the robot
        private void RunBehavior(string behaviorName)
        {
            MotionProxy.wakeUp();
            AudioProxy.setOutputVolume(Properties.Settings.Default.AudioOutputVolume);
            CurrentlyRunningLabel.Content = "Currently Running: " + behaviorName;
            int ID = BehaviorManagerProxy.post.runBehavior(behaviorName);

            LogBehavior(behaviorName);
            RemoveStiffness = behaviorName != "contingency/introduction";
            CurrentlyRunningLabel.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                                                         new BehaviorWaiterDelegate(WaitForBehaviorToFinish), ID);
        }
Ejemplo n.º 5
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();
        }
Ejemplo n.º 6
0
 public void setUpNao()
 {
     motioProxy.setSmartStiffnessEnabled(true);
     motioProxy.wakeUp();
     postureproxy.goToPosture("Stand", 0.5f);//Stand LyingBack
 }
Ejemplo n.º 7
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();
        }