-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Milestone! I tested this with a live drone and ran it through some ma…
…unevers. It works!
- Loading branch information
Remy Porter
committed
Jun 12, 2015
1 parent
2b92aa4
commit 423af9c
Showing
4 changed files
with
86 additions
and
3 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
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,60 @@ | ||
public class Drone { | ||
OscOut osc; | ||
fun void connect(string host, int port) { | ||
(host, port) => osc.dest; | ||
} | ||
fun void takeoff() { | ||
osc.start("/takeoff").send(); | ||
} | ||
fun void land() { | ||
osc.start("/land").send(); | ||
} | ||
fun void light(string pattern, float freq, float durInMills) { | ||
osc.start("/light/" + pattern).add(freq).add(durInMills).send(); | ||
} | ||
fun void anim(string pattern, float durInMills) { | ||
osc.start("/anim/" + pattern).add(durInMills); | ||
} | ||
fun void forward(float speed) { | ||
osc.start("/move/front").add(speed).send(); | ||
} | ||
fun void up(float speed) { | ||
osc.start("/move/up").add(speed).send(); | ||
} | ||
fun void down(float speed) { | ||
osc.start("/move/down").add(speed).send(); | ||
} | ||
fun void backward(float speed) { | ||
osc.start("/move/back").add(speed).send(); | ||
} | ||
fun void left(float speed) { | ||
osc.start("/move/left").add(speed).send(); | ||
} | ||
fun void right(float speed) { | ||
osc.start("/move/right").add(speed).send(); | ||
} | ||
fun void clockwise(float speed) { | ||
osc.start("/move/clockwise").add(speed).send(); | ||
} | ||
fun void counterClockwise(float speed) { | ||
osc.start("/move/counterClockwise").add(speed).send(); | ||
} | ||
fun void stop() { | ||
osc.start("/move/stop").send(); | ||
} | ||
fun void verticalSpeed(float speed) { | ||
osc.start("/config/vert_speed").add(speed).send(); | ||
} | ||
fun void yawSpeed(float speed) { | ||
osc.start("/config/yaw_speed").add(speed).send(); | ||
} | ||
fun void outdoor(string val) { | ||
osc.start("/config/outdoor").add(val).send(); | ||
} | ||
fun void noShell(string val) { | ||
osc.start("/config/no_shell").add(val).send(); | ||
} | ||
fun void reset() { | ||
osc.start("/reset").send(); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,3 +1,18 @@ | ||
OscOut oout; | ||
("localhost", 8081) => oout.dest; | ||
oout.start("/test/op").add("data").add(5.0).send(); | ||
Drone d; | ||
("localhost", 8081) => d.connect; | ||
d.reset(); | ||
1::second => now; | ||
d.takeoff(); | ||
2::second => now; | ||
d.light("snakeGreenRed", 5, 20000); | ||
2::second => now; | ||
d.forward(1); | ||
d.up(0.5); | ||
4::second => now; | ||
d.clockwise(0.5); | ||
0.5::second => now; | ||
d.stop(); | ||
d.anim("flipAhead", 500); | ||
3::second => now; | ||
d.anim("flipBehind", 500); | ||
d.land(); |
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,2 @@ | ||
Machine.add(me.dir() + "/drone.ck"); | ||
Machine.add(me.dir() + "/osctest.ck"); |