parent
6d843f7097
commit
63d907daf3
|
@ -1,12 +0,0 @@
|
||||||
Cylon = require '../..'
|
|
||||||
|
|
||||||
Cylon.robot
|
|
||||||
connection: { name: 'ardrone', adaptor: 'ardrone', port: '192.168.1.1' }
|
|
||||||
device: { name: 'drone', driver: 'ardrone' }
|
|
||||||
|
|
||||||
work: (my) ->
|
|
||||||
my.drone.takeoff()
|
|
||||||
after 10.seconds(), -> my.drone.land()
|
|
||||||
after 15.seconds(), -> my.drone.stop()
|
|
||||||
|
|
||||||
.start()
|
|
|
@ -1,12 +0,0 @@
|
||||||
var Cylon = require('../..');
|
|
||||||
|
|
||||||
Cylon.robot({
|
|
||||||
connection: { name: 'ardrone', adaptor: 'ardrone', port: '192.168.1.1' },
|
|
||||||
device: { name: 'drone', driver: 'ardrone' },
|
|
||||||
|
|
||||||
work: function(my) {
|
|
||||||
my.drone.takeoff();
|
|
||||||
after(10..seconds(), function() { my.drone.land(); });
|
|
||||||
after(15..seconds(), function() { my.drone.stop(); });
|
|
||||||
}
|
|
||||||
}).start();
|
|
|
@ -1,32 +0,0 @@
|
||||||
# Drone
|
|
||||||
|
|
||||||
For a very simple drone demo, we're going to use Cylon to make an ARDrone take
|
|
||||||
off, hover, and land. Before you get started, make sure you have the
|
|
||||||
`cylon-ardrone` module installed.
|
|
||||||
|
|
||||||
First, we need to load up Cylon.
|
|
||||||
|
|
||||||
Cylon = require '../..'
|
|
||||||
|
|
||||||
And now that we have that taken care of, we can define our robot.
|
|
||||||
|
|
||||||
Cylon.robot
|
|
||||||
|
|
||||||
Our robot will communicate with an ARDrone over an IP address, and controls the
|
|
||||||
drone using a device we're going to call "drone":
|
|
||||||
|
|
||||||
connection: { name: 'ardrone', adaptor: 'ardrone', port: '192.168.1.1' }
|
|
||||||
device: { name: 'drone', driver: 'ardrone' }
|
|
||||||
|
|
||||||
The work for this robot is pretty straightforward. It's going to take off, and
|
|
||||||
then land after ten seconds. Five seconds later, after it's safely on the
|
|
||||||
ground, it will fully stop.
|
|
||||||
|
|
||||||
work: (my) ->
|
|
||||||
my.drone.takeoff()
|
|
||||||
after 10.seconds(), -> my.drone.land()
|
|
||||||
after 15.seconds(), -> my.drone.stop()
|
|
||||||
|
|
||||||
Simple as can be. And now that we've got all that set up, we can get started!
|
|
||||||
|
|
||||||
.start()
|
|
|
@ -1,16 +0,0 @@
|
||||||
Cylon = require '../..'
|
|
||||||
|
|
||||||
Cylon.robot
|
|
||||||
connection:
|
|
||||||
name: 'ardrone', adaptor: 'ardrone', port: '192.168.1.1'
|
|
||||||
|
|
||||||
devices: [
|
|
||||||
{name: 'drone', driver: 'ardrone'},
|
|
||||||
{name: 'nav', driver: 'ardroneNav'}
|
|
||||||
]
|
|
||||||
|
|
||||||
work: (my) ->
|
|
||||||
my.drone.config 'general:navdata_demo', 'TRUE'
|
|
||||||
my.nav.on 'update', (data) -> console.log data
|
|
||||||
|
|
||||||
.start()
|
|
|
@ -1,14 +0,0 @@
|
||||||
var Cylon = require('../..');
|
|
||||||
|
|
||||||
Cylon.robot({
|
|
||||||
connection: { name: 'ardrone', adaptor: 'ardrone', port: '192.168.1.1' },
|
|
||||||
devices: [
|
|
||||||
{ name: 'drone', driver: 'ardrone' },
|
|
||||||
{ name: 'nav', driver: 'ardroneNav' }
|
|
||||||
],
|
|
||||||
|
|
||||||
work: function(my) {
|
|
||||||
my.drone.config('general:navdata_demo', 'TRUE');
|
|
||||||
my.nav.on('update', function(data) { console.log(data); });
|
|
||||||
}
|
|
||||||
}).start();
|
|
|
@ -1,39 +0,0 @@
|
||||||
# Drone Navigation
|
|
||||||
|
|
||||||
For this Cylon example, we'll be using an ARDrone again, this time getting data
|
|
||||||
from it's navigation board. When the board emits an 'update' event, we'll log
|
|
||||||
the data it's collected to the console.
|
|
||||||
|
|
||||||
Before we get started, make sure you've got the `cylon-ardrone` module
|
|
||||||
installed. First, let's start by loading up Cylon:
|
|
||||||
|
|
||||||
Cylon = require '../..'
|
|
||||||
|
|
||||||
After we've got that loaded up, let's start defining our robot.
|
|
||||||
|
|
||||||
Cylon.robot
|
|
||||||
|
|
||||||
Our robot will, as with the basic ARDrone example, have a connection to an
|
|
||||||
ARDrone over an IP address, and a `drone` device to control the drone itself.
|
|
||||||
Except this time, we're also adding a `nav` device that will bind to the
|
|
||||||
ARDrone's navigation board.
|
|
||||||
|
|
||||||
connection:
|
|
||||||
name: 'ardrone', adaptor: 'ardrone', port: '192.168.1.1'
|
|
||||||
|
|
||||||
devices: [
|
|
||||||
{ name: 'drone', driver: 'ardrone' },
|
|
||||||
{ name: 'nav', driver: 'ardroneNav' }
|
|
||||||
]
|
|
||||||
|
|
||||||
For our robot's work, it's going to enable the nav board's demo mode in the
|
|
||||||
drone's config, and log data to the console whenever the nav board emits the
|
|
||||||
'update' event.
|
|
||||||
|
|
||||||
work: (my) ->
|
|
||||||
my.drone.config 'general:navdata_demo', 'TRUE'
|
|
||||||
my.nav.on 'update', (data) -> console.log data
|
|
||||||
|
|
||||||
Simple enough. Now all that's left is to start the robot:
|
|
||||||
|
|
||||||
.start()
|
|
Loading…
Reference in New Issue