This repository has been archived by the owner on May 3, 2021. It is now read-only.
forked from thp/psmoveapi
-
Notifications
You must be signed in to change notification settings - Fork 8
/
README.osx
170 lines (119 loc) · 6.76 KB
/
README.osx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
Get started on Mac OS X
====================================================
For more in-depth installation instructions with screenshots, see the tutorial on GDocs: http://goo.gl/cahbJ
You will need...
... a PS Move controller
... a mini-usb cable
... to create a root password (see: http://youtu.be/10sKJQuXq6A)
... to install Homebrew: http://mxcl.github.com/homebrew/
$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
$ brew doctor
... to install cmake, mercurial, and git from Homebrew
$ brew install cmake hg git
… to download and install Doxygen (http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc) to generate the documentation (optional)
1. Get ready
Connect the controller via USB.
Enable Bluetooth in MacOS.
2. Choose the install folder
$ cd /Developer/Library/
3. Grab binaries
$ git clone --recursive git://github.com/thp/psmoveapi.git
$ cd psmoveapi
4. Build all
$ bash -e -x contrib/build-osx-snapshot
Note: If the script returns some errors, you might need to build the API step-by-step. See “Building the API manually” for the alternative procedure.
5. Check
$ cd build
$ ./example
The controller vibrates and the sphere blinks. SUCCESS!
6. Pairing (automatic)
$ ./psmovepair
Repeat this step for every controller (plug the controller via usb before you call psmovepair).
Note: Some MacOS 10.7 users have trouble with the automated pairing. If this is your case, see the “Manual pairing” instructions below.
Note 2: Mountain Lion (Mac OS X 10.8) introduced changes related to bluetooth. A fix is underway. You can get more info in the comments of this blog post by Doug Wilson (http://gutefabrik.com/blog/?p=1843) or asking on the mailing list.
7. Handshake
Press the PS button on the controller and wait until the LED stops blinking.
Click on the Bluetooth icon in Mac OS' toolbar; you should see a line reading “Motion Controller” for each controller connected.
Updating the API
====================================================
$ cd /Developer/Library/psmoveapi
$ git pull
$ cd build
$ cmake ..
$ make -j4
Building the API manually
====================================================
$ mkdir build
$ cd build
$ ccmake ..
Follow instructions to configure the build then build:
$ cmake ..
$ make -j4
Manual Pairing
====================================================
If ./psmovepair doesn't work or you get a PIN prompt when you press the PS button on your controller, follow these steps:
8.1. Right after you run ./psmovepair write down the adress you find after “controller address:” in the form “aa:bb:cc:dd:ee:ff”
8.2. Disable Bluetooth (or the modifications that follow won’t work).
8.4. Wait for BT process to quit
$ pgrep blued
repeat until nothing prints anymore (e.g. the process "blued" has quit) this can take a few seconds up to a minute.
8.5. Authorize the controller’s MAC address
$ sudo defaults write /Library/Preferences/com.apple.Bluetooth HIDDevices -array-add "<aa-bb-cc-dd-ee-ff>"
where <aa-bb-cc-dd-ee-ff> is the MAC address you wrote down at 8.2 but with hyphens for separators.
Type in your root password if promped
8.6. Enable Bluetooth again then press the PS button on the controller. The PIN request should not pop up this time and the Move should now appear in the bluetooth devices as “Motion Controller”.
Generate documentation with Doxygen
====================================================
Doxygen is a documentation system that takes the code from the api and automatically
generate an html reference for all its functions. Download the latest binary distribution
of Doxygen at: http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc
1. Run Doxygen.
2. Click File>Open and select the Doxyfile item in the psmoveapi folder which will
load the configuration for the build.
3. Click on the “Run” tab then on “Run Doxygen”.
4. Once Doxygen has finished, quit the app and go to your psmoveapi folder. You will
find a folder called html which contains the doc.
5. Open index.html in your favorite web browser to access the documentation.
Background information about iSight exposure locking
====================================================
On Mac OS X, we have problems getting the PS Eye to work reliably with OpenCV.
Because of that, it makes sense to use other cameras like the iSight camera
built into most (all?) MacBook (Pro) computers and iMacs. Unfortunately, there
is no API for controlling the exposure directly. It is possible to lock the
exposure to a given value so that the exposure isn't continously corrected.
How it works normally (continuous autoexposure):
1. The camera device determines a good first exposure when started
2. While frames are captured, the exposure is continuously modified
(e.g. when you hold the controller near the iSight, the exposure is
automatically lowered to accommodate the brighter camera image)
How it works with locked exposure:
1. The camera device determines a good first exposure when started
2. The exposure set after opening the device will stay the same
So what we need to do is the following:
1. Light up the controller to a very bright color
2. Move the controller directly in front of the camera (the sphere
can actually touch the iSight camera and "block its sight")
3. Open the camera device (the first exposure is determined here)
4. As soon as the camera device is opened (and the exposure set),
lock the exposure so that it doesn't change anymore
5. Move the controller away from the camera, proceed with normal
initialization procedure (blinking calibration, etc..)
The call to locking has been integrated into the tracker library, the
exposure will be automatically locked when the tracker library is started.
The exposure seems to be locked until the next reboot in my experiments,
but the exposure is determined every time the camera device is opened (but
will stay locked after opening the device).
Because of this, the calibration procedure on Mac OS X is a bit different
to other platforms, because we have to light up the controller, put it in
front of the iSight, open the camera device, wait for a good exposure, and
only then continue with normal calibration. This has been implemented in
examples/c/test_tracker.c - the console output will tell you what to do:
1. Start the application
2. Move the controller that lights up close to the iSight
3. Press the Move button on this controller
4. Keep the controller close to the iSight while the camera is opened
5. Move the controller away from the iSight and press the Move button
Thanks to Raphaël de Courville who had the initial idea for the exposure
locking, did some experimentation with it and provided an first draft of the
implementation that is now integrated in simplified form in the library.
Thomas Perl, 2012-10-05