Example #1
0
    public static int Main(string [] args) {
        PSMoveTracker tracker = new PSMoveTracker();
        PSMove move = new PSMove();

        /* Calibrate the controller in the camera picture */
        while (tracker.enable(move) != Status.Tracker_CALIBRATED);

        while (true) {
            /* Get a new image from the camera */
            tracker.update_image();
            /* Track controllers in the camera picture */
            tracker.update();

            /* Optional and not required by default
            byte r, g, b;
            tracker.get_color(move, out r, out g, out b);
            move.set_leds(r, g, b);
            move.update_leds();
            */

            /* If we're tracking, output the position */
            if (tracker.get_status(move) == Status.Tracker_TRACKING) {
                float x, y, radius;
                tracker.get_position(move, out x, out y, out radius);
                Console.WriteLine(string.Format("Tracking: x:{0:0.000}, " +
                            "y:{1:0.000}, radius:{2:0.000}", x, y, radius));
            } else {
                Console.WriteLine("Not Tracking!");
            }
        }

        return 0;
    }
Example #2
0
    public static int Main(string [] args)
    {
        PSMove move = new PSMove();

        move.set_leds(0, 255, 0);
        move.update_leds();
        return(0);
    }
Example #3
0
    public static int Main(string [] args) {
        PSMove move = new PSMove();

        while (true) {
            if (move.poll() != 0) {
                int trigger = move.get_trigger();

                float ax, ay, az;
                move.get_accelerometer_frame(Frame.Frame_SecondHalf,
                        out ax, out ay, out az);

                Console.WriteLine(string.Format("Trigger: {0:0}, " +
                            "Accelerometer: {1:0.00} {2:0.00} {3:0.00}",
                            trigger, ax, ay, az));
            }
        }

        return 0;
    }
Example #4
0
    public static int Main(string [] args)
    {
        PSMoveTracker tracker = new PSMoveTracker();
        PSMove        move    = new PSMove();

        /* Calibrate the controller in the camera picture */
        while (tracker.enable(move) != Status.Tracker_CALIBRATED)
        {
            ;
        }

        while (true)
        {
            /* Get a new image from the camera */
            tracker.update_image();
            /* Track controllers in the camera picture */
            tracker.update();

            /* Optional and not required by default
             * byte r, g, b;
             * tracker.get_color(move, out r, out g, out b);
             * move.set_leds(r, g, b);
             * move.update_leds();
             */

            /* If we're tracking, output the position */
            if (tracker.get_status(move) == Status.Tracker_TRACKING)
            {
                float x, y, radius;
                tracker.get_position(move, out x, out y, out radius);
                Console.WriteLine(string.Format("Tracking: x:{0:0.000}, " +
                                                "y:{1:0.000}, radius:{2:0.000}", x, y, radius));
            }
            else
            {
                Console.WriteLine("Not Tracking!");
            }
        }

        return(0);
    }
Example #5
0
    // Use this for initialization
    public void Start()
    {
        _move = new PSMove();

        _tracker = new PSMoveTracker();
        _tracker.enable(_move);
        _tracker.set_mirror(1);

        PSMoveapiCsharp.psmove_enable_orientation(_move, PSMove_Bool.PSMove_True);

        _testThread = new Thread(CalculateTranslation);
        _testThread.Start();

        new Thread(() =>
            {
                while (_runThread)
                {
                    _move.poll();
                }
            }).Start();
    }
Example #6
0
    public static int Main(string [] args)
    {
        PSMove move = new PSMove();

        while (true)
        {
            if (move.poll() != 0)
            {
                int trigger = move.get_trigger();

                float ax, ay, az;
                move.get_accelerometer_frame(Frame.Frame_SecondHalf,
                                             out ax, out ay, out az);

                Console.WriteLine(string.Format("Trigger: {0:0}, " +
                                                "Accelerometer: {1:0.00} {2:0.00} {3:0.00}",
                                                trigger, ax, ay, az));
            }
        }

        return(0);
    }
Example #7
0
 public static int Main(string [] args) {
     PSMove move = new PSMove();
     move.set_leds(0, 255, 0);
     move.update_leds();
     return 0;
 }
Example #8
0
    void Start()
    {
        psMove = GetComponent<PSMove> ();
        loadFile("config.ini");
        initialTime = Time.time;
        PSMoveInput.Connect(ipAddress, int.Parse(port));
        Debug.Log ("Connecting... Address: " + ipAddress + ", Port: " + port);
        if (PSMoveInput.IsConnected) {
            Debug.Log ("Connected!");
        }

        StartCoroutine ("GetControllerNum");
    }