Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2f411fc
Showing
12 changed files
with
172 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/target | ||
/lib | ||
/classes | ||
/checkouts | ||
pom.xml | ||
*.jar | ||
*.class | ||
.lein-deps-sum | ||
.lein-failures | ||
.lein-plugins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/dev/cu.FireFly-943A-SPP | ||
SCI | ||
N |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# clj-roomba | ||
|
||
A Clojure library designed to ... well, that part is up to you. | ||
|
||
## Usage | ||
lein localrepo install roombacomm/roombacomm.jar roombacomm 0.96 | ||
lein localrepo install roombacomm/RXTXcomm.jar rxtxcomm 0103 | ||
http://wiki.processing.org/w/Serial_Issues | ||
|
||
FIXME | ||
|
||
## License | ||
|
||
Copyright © 2012 FIXME | ||
|
||
Distributed under the Eclipse Public License, the same as Clojure. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Introduction to clj-roomba | ||
|
||
TODO: write [great documentation](http://jacobian.org/writing/great-documentation/what-to-write/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
(defproject repl-roomba "1.0.0-SNAPSHOT" | ||
:description "Fun Sample Project to Control Roomba with Clojure" | ||
:dependencies [ [org.clojure/clojure "1.3.0"] | ||
[roombacomm "0.96"] | ||
[rxtxcomm "0103"]] | ||
:jvm-opts [~(str "-Djava.library.path=roombacomm/")]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
These RXTX files were just copied directly from the 0103 released of | ||
Processing. | ||
|
||
Their versions are reported as: | ||
Native lib Version = RXTX-2.1-7pre17 | ||
Java lib Version = RXTX-2.1-7pre17 | ||
|
||
|
||
|
||
|
||
If you've never used RXTX before on your Mac OS X box, run the command: | ||
|
||
% ./macosx_setup.command | ||
|
||
And then shutdown (not just log out) and log back in again. | ||
And read this faq from Processing: http://processing.org/faq/bugs.html#serial | ||
|
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/sh | ||
# | ||
# Taken from Processing's serial library -=tod | ||
# | ||
|
||
# | ||
# originally fixperm.sh from rxtx-2.1_6/contrib | ||
# with a couple additions from pathsetup.command from fink [fry] | ||
|
||
# A script to fix permissions for lock files on Mac OS X | ||
# Contributed by Dmitry Markman <dimitry.markman@verizon.net> | ||
# Fri Aug 23 15:46:46 MDT 2002 | ||
|
||
echo "" | ||
echo "" | ||
echo "This command will take care of a couple system things" | ||
echo "so that you can properly use the serial port to communicate" | ||
echo "between hardware devices and processing." | ||
echo "" | ||
echo "If there are actually changes that need to be made, then" | ||
echo "enter your password when prompted. The command uses sudo," | ||
echo "and you'll need to have administrator access." | ||
echo "" | ||
|
||
echo -n "Do you want to continue? [Y/n] " | ||
read answer | ||
answer=`echo $answer | sed 's/^[yY].*$/y/'` | ||
if [ -z "$answer" -o "x$answer" = "xy" ]; then | ||
curruser=`sudo id -p | grep 'login' | sed 's/login.//'` | ||
|
||
if [ ! -d /var/spool/uucp ] | ||
then | ||
sudo mkdir /var/spool/uucp | ||
fi | ||
|
||
sudo chgrp uucp /var/spool/uucp | ||
sudo chmod 775 /var/spool/uucp | ||
|
||
if [ ! `sudo niutil -readprop / /groups/uucp users | grep $curruser > /dev/null` ] | ||
then | ||
sudo niutil -mergeprop / /groups/uucp users $curruser | ||
fi | ||
|
||
echo "Finished making changes, you should be all set" | ||
else | ||
echo "Ok, nevermind then." | ||
fi | ||
|
||
echo "" | ||
echo "" | ||
echo " (All done... you can close this window now)" | ||
echo "" | ||
echo "" | ||
echo "" | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
(ns clj-roomba.core | ||
(:import roombacomm.RoombaCommSerial)) | ||
|
||
(println (System/getProperty "java.class.path")) | ||
(println (System/getProperty "java.library.path")) | ||
|
||
(def roomba (RoombaCommSerial. )) | ||
|
||
;;Find your port for your Roomba | ||
(map println (.listPorts roomba)) | ||
(def portname "/dev/cu.FireFly-943A-SPP") | ||
(.connect roomba portname) | ||
(.startup roomba) ;;puts Roomba in safe Mode | ||
;; What mode is Roomba in? | ||
(.modeAsString roomba) | ||
|
||
(.control roomba) | ||
(.pause roomba 30) | ||
(.updateSensors roomba) | ||
(.playNote roomba 72 40) | ||
(.playNote roomba 79 40) | ||
(.spinLeft roomba) | ||
(.spinRight roomba) | ||
(.goBackward roomba) | ||
(.goForward roomba) | ||
(.turnLeft roomba) | ||
(.turnRight roomba) | ||
|
||
(.stop roomba) | ||
(.reset roomba) | ||
|
||
|
||
;; Get the sensor data | ||
(.bumpLeft roomba) | ||
(.bumpRight roomba) | ||
(.wheelDropLeft roomba) | ||
(.wheelDropRight roomba) | ||
(.wheelDropCenter roomba) | ||
(.sensorsAsString roomba) | ||
|
||
(.vacuum roomba true) | ||
(.vacuum roomba false) | ||
|
||
|
||
(defn bark [r] | ||
(doto r | ||
(.vacuum true) | ||
(.playNote 50 5) | ||
(.pause 150) | ||
(.vacuum false))) | ||
|
||
|
||
(bark roomba) | ||
|
||
(.disconnect roomba) ;; coredumps locally native problem? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
(ns clj-roomba.core-test | ||
(:use clojure.test | ||
clj-roomba.core)) | ||
|
||
(deftest a-test | ||
(testing "FIXME, I fail." | ||
(is (= 0 1)))) |