Get Myro on Mac
There have been some issues getting everything properly installed for the Scribbler Bot project on OS X. It worked for me the first time because I used Homebrew and pip instead of the .mpkg
installers. I've done this three times now and it has worked every time, so this should work for you too.
All code blocks are meant to be pasted into the Terminal.
Disclaimer: Follow these instructions at your own risk. I promise they won't do anything bad, but I don't guarantee it. I am not responsible for any unintended consequences.
Remove MacPython
If you already installed MacPython, you need to get rid of it.
1. Remove the application directory:
sudo mv "/Applications/MacPython 2.4/" ~/.Trash
2. Remove the framework:
sudo mv /Library/Frameworks/Python.framework ~/.Trash
3. Remove the symlinks (very important):
cd /usr/local/bin/ && find . -type l | while IFS= read -r lnk; do if (readlink "$lnk" | grep -q '^/Library/Frameworks/Python.framework'); then rm "$lnk"; fi; done
Fix your PATH
MacPython has taken it upon itself to change your path.
open -e ~/.bash_profile
There should be a couple comments (starting with #
), a line beginning with PATH=
, and finally export PATH
. Remove all that, and replace it with this:
export PATH=/usr/local/bin:$PATH
This will ensure that your locally installed packages (such as Python) are preferred over system binaries.
Get Homebrew
If you don't already have Homebrew, you need to get it. It is a very useful thing to have if you are a developer working on a Mac. Install it now:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Get Python 2.7
You used to have two Pythons: the system Python, and MacPython. We got rid of MacPython in the first step. The system Python won't work for us, and it isn't kept up to date. Get the latest Python 2.7:
brew install python
This will take a few minutes. Don't install python3
, because Myro doesn't work with Python 3.x.
Verify symlinks
After it's installed, make sure it gets symlinked:
brew link python
Now, which python
should print /usr/local/bin/python
, and which pip
should print /usr/local/bin/pip
.
Install Myro's dependencies
Myro depends on a few Python libraries. Install them:
pip install numpy pyserial Pillow
Checkout the Myro source
Go to your desktop with cd ~/Desktop
, then checkout Myro:
svn co http://svn.cs.brynmawr.edu/Myro/trunk myro
There is a problem in Myro when it tries to import ImageTK
, so I've created a patch and included it in this Gist. Scroll down, right-click on the "Raw" button in the top-right corner of myro-imagetk.diff
, and choose "Download Linked File." Now, cd ~/Desktop/myro
and apply the patch:
patch -p0 -i ~/Downloads/myro-imagetk.diff
Install Myro
Still in ~/Desktop/myro
, run the setup script:
python setup.py install
Pair with Fluke2
Turn on your Scribbler Bot. Go to System Preferences > Bluetooth and pair with the Fluke2 chip. It should have a name that looks something like "Fluke2-0530."
Now that you are paired, find the port ID:
ls /dev/tty.*
One of the items in this listing should look like /dev/tty.Fluke2-0530-Fluke2
(but it will have different numbers in it). Copy this entire path to your clipboard.
Test Myro
Fire up a Python REPL simply by entering python
in the Terminal. When you see the >>>
prompt, import Myro:
from myro import *
You should see Myro version 2.9.9 is ready!
before the prompt returns. Next, upgrade Scribbler:
upgrade("scribbler")
A dialog window will open, prompting you for a port ID. Paste the path that you copied in the previous step and click OK. Finally, initialize Myro, making sure to replace the string argument with the path that you copied:
initialize("/dev/tty.Fluke2-0530-Fluke2")
Now try executing some commands:
forward(1)
With any luck, your Scribbler Bot will start driving forward!
License
© 2014 Mitchell Kember
This document and myro-imagetk.diff
are available under the MIT License.
I'm getting this error: AttributeError: 'Serial' object has no attribute 'setTimeout'
Any suggestion?