In a tunnel or a mine shaft, an accident can potentially cause very dangerous situations and even fatalities. The time from a collision to the situation is under control is critical. The first thing an accident responder team will have to do is map out the situation. In a tunnel, gases and fire can prevent a team from going into the tunnel. Dangerous gases from a fire can behave differently in a tunnel because of chemical properties, some rising and others sinking.
Norway has a lot of long tunnels, some over 20 kilometers. Connectivity in a tunnel is, as we all know, usually not very good. Laying out internet connection to cover the whole tunnel might be very costly.
Our solution: Tunnel Raiders
Tunnel Raiders are Parrot AR Drones, the idea is to control the drones through the internet using a Raspberry Pi 2 and performing REST calls, the drones are equipped with various sensors to analyze the tunnels. A Node.js Express server for the Parrot AR Drone 2.0. The server uses the node-ar-drone and ardrone-autonomy libraries to fly the drone with REST calls.
- SSH into a Raspberry Pi and clone this repository.
- Download and install Node.js.
- Start up cmd or terminal and execute the following command:
npm install
This installs the following framework and libraries:
- Express framework, which is a lightweight version of Node.js.
- nodemon, which monitors changes in the server source code and automatically restarts the server.
- node-ar-drone library: This library is used to fly the drone.
- ardrone-autonomy library: This library helps us automate the drone, for instance, enabling us to send predefined flying coordinates.
We are using SensorTag to analyze data inside the tunnels. The Raspberry Pi connects to the SensorTag through bluetooth:
- Run the install.sh script.
- node sensortag-irtemp.js to start the SensorTag
PS: All the steps above are run on the Raspberry Pi device, through SSH.
Once the drone is turned on, it will send out WiFi signals like a router. Connect your Pi to the drone via WiFi. Like a router, the drone uses the IP 192.168.1.1
by default.
Start up an SSH shell, connect to the Pi, navigate to repl.js
and execute the following command:
nodemon repl.js
192.168.1.1
. While connected to the drone, in terminal, execute the following command:
takeoff()
land()
Now that we are able to establish a connection to the drone and test fly it, we are now ready to control it with REST calls using Node.js. Start up cmd or terminal and navigate to node_server.js
, then execute the following command:
nodemon node_server.js
1337
. As you can see in node_server.js
, we have defined serveral GET requests. Start up your browser and go to http://localhost:1337, you should be greeted by the message Welcome to my Parrot AR node server!
Try to control the drone by sending GET requests to your local Node.js server:
http://localhost:1337/takeoff
takes off the drone, starts hovering it for 5 seconds and then lands it.http://localhost:1337/takeoffAndSpin
takes off the drone, starts hovering it for 4 seconds, spins it clockwise and then lands it after 1 second.http://localhost:1337/land
lands the drone immediately.
We can also automate the flight path of the drone, by providing predefined x,y
coordinates. You can do this by doing a call to http://localhost:1337/takeoffAndFly
and then appending the call with the coordinates. Here is an example:
-
http://localhost:1337/takeoffAndFly?c=8,5&c=4,5
takes off the drone, flies it tox,y
coordinates[8,5]
,[4,5]
and then lands it.