We love solving problems with technology! This article describes a challenge students solve using drones and a cool new mapping service called what3words.
At the end of July, the Flying Robot School (FRS) visited Kurnai College in Morwell, Victoria. We were there to spend the day with twelve Year 9 and 10 students that had shown a keen interest in technology. We wanted to expose the students to flying drones and get them excited about pursuing further study and a future career in STEM.
We had three 3DR Solo drones available for use on the day. Two of the drones had been kindly sponsored by EquipSuper in conjunction with the Baw Baw Latrobe Local Learning and Employment Network (BBLLLEN). Each drone had a GoPro mounted on a 3-axis gimbal to enable aerial photography and a hand-held controller fitted with an Android tablet.
In preparation for a session of pilot training, we presented the major risks and safety hazards associated with drone flying. Emphasising the importance of safety is an essential component of the training, as students need to be aware and considerate of others when flying.
After forming their own teams, each student was given a turn at flying a drone on the school oval, while the others in their team completed a worksheet covering relevant scientific concepts such as longitude, latitude, quadcopter dynamics and positioning systems. All the students approached the flying task with enthusiasm, their faces beamed when they saw the drones take off - they were genuinely surprised with their abilities. It was also great to see the students researching answers for their worksheets online and working proactively in their teams.
A highlight of the day involved the students solving a real-world challenge. The challenge was linked to an initiative called ‘WithOneSeed’. An aim of this initiative is to encourage East Timorese farmers to plant and maintain trees, thereby earning themselves carbon credits. The farmers can then make an income from selling these credits to companies wishing to offset their carbon emissions. Official auditing of a farmers compliance involves measuring the size of the trees they grow. We asked the students to use their problem solving skills and devise a way to measure the circumference of a tree using a drone and photogrammetry techniques.
The students approached the task with a great work ethic, continuing to re-work their measurement method until they improved the accuracy of their answers. They collated their findings and presented these to the entire group. After a great day of flying, each student was awarded a certificate for their participation in the program.
The two drones donated by EquipSuper will remain at Kurnai College for a few months, before being rotated through other schools in the Baw Baw Latrobe region. The students have been encouraged to start their own flying robot club at their school and involve other students interested in technology and a career in STEM. The FRS is looking forward to visiting Lowanna Secondary College, Yallourn, in October.
On the 3DR Solo, we can fly missions manually with the controller, or we can fly automated missions with a ground control station (GCS). By 'automated' we mean the aircraft is not controlled by manual input to the controller's sticks as usual, but rather it is controlled by the autopilot. We give the autopilot a series of points on a map, called waypoints, which make up a mission. We can then start the mission, monitor the aircraft's progress, and send it new commands in-flight, from the GCS.
Before we go and fly automated missions in the real world, it's a good idea to simulate the missions first. It's a good idea because a simulator makes it easy for you to get comfortable with automated missions before taking your precious drone outside for its first automated flight.
For the Solo, there's a nice way of doing that, using the same Tower app on an Android tablet that we will be using for real-world missions. This applies whether we are defining the mission on Tower, or writing a Python script to define the mission.
In this article, I will take you through the process of setting up your simulation environment for Solo missions. I'm going to assume you have access to a Windows PC, but it's also easy to do the same thing on OS X and Linux.
DroneKit is an open source library for creating your own flying robot applications. Through its interface (also known as an API), you can send commands to the flying robot, and monitor the robot's position and altitude. This means that you can use a GCS such as Tower to define and run your Solo missions, but you can also write a program to do that as well. This is useful because you might want to fly special moves that are difficult to define on a tablet, or you might want to have control of the Solo's onboard computer and sensors for extra-special missions.
Python is a great language for many applications, and especially good for robotics. That's why it is the language used by the DroneKit team. If you haven't already started writing scripts in Python, learning to use it to control flying robots is time well spent, and fun too.
Download and install the latest 2.7 from here:
You might be wondering why not use Python 3. Support for Python 3 in DroneKit is coming, but it's not here yet. The example scripts are still written for Python 2.7. As DroneKit is an open source project, you would be most welcome to contribute to it!
SITL stands for 'software-in-the-loop'. It means that in our simulation setup we will be using the same software that controls a real Solo, which is called ArduPilot Copter. That means we can be sure that how the software behaves in the simulation will be quite close to how it performs in the real world, except for the weather, and obstacles like trees, of course.
To install dronekit-sitl, we will use the Python package manager, called pip.
pip install dronekit-sitl -UI
MAVProxy is a very useful piece of software for our flying robot programming toolbox. It's a GCS but it's also a plumbing construction set for drone applications. Its name comes from the messaging protocol used by ArduPilot, called MAVLink, where MAV stands for 'micro air vehicle'.
Install the latest version at:
There's a lot of useful information about MAVProxy here.
On your Android tablet, make sure the latest version of Tower is installed. Use the Play Store app to install Tower, and 3DR Services.
Find out your tablet's IP address
Tower provides a number of ways of connecting to the vehicle (in this case, our simulated vehicle). We'll be using UDP to communicate between MAVProxy and Tower. We will tell MAYProxy on the PC to send UDP packets to Tower on the tablet, which is going to be listening on port 14550. To do that, we need to know the tablet's IP address.
Go to Settings -> About device -> Status. There you should be able to find the tablet's IP address.
It will be different in your case, but for me it's 10.0.0.91. We'll use that in the next step.
Preparing Tower on your tablet
When you start Tower, you should see a screen similar to this one.
Change the protocol to UDP if it isn't already selected. Touch the three dots to specify the port we'll listen to for UDP messages.
Touch 'UDP Server Port' and enter 14550 for the port number.
Start the simulator
Now we're ready to start the simulator on the PC. By default, it will listen on port 5760 for connections.
Next we will start MAVProxy, telling it to connect to the simulator on port 5760, and to send its output to the tablet on port 14550, where Tower will be listening. Make sure to substitute the tablet's IP address in the --out parameter.
In a Command Prompt separate to the one where we started the simulator:
"C:\Program Files (x86)\MAVProxy\mavproxy.exe” --master tcp:127.0.0.1:5760 —out udpout:10.0.0.91:14550
If all is going to plan, on the Windows PC you should see command prompts with the output of the simulator and MAVProxy, which should be connected, and MAVProxy waiting for a connection from Tower.
Connect with Tower
On the Android tablet, in Tower, connect to MAVProxy and the simulator. Now you're all set to plan a mission and execute it, as if you were flying a real Solo.
Here's the setup we just created.
To try it out, define a very simple mission with three waypoints.
Upload the mission to the (simulated) vehicle. When you do that, Tower will automatically add takeoff and return-to-launch (RTL) commands to the mission.
When you're ready to fly the mission, touch 'Arm' and 'Auto'. You will see the aircraft's altitude increase to the mission altitude, in this case 80 meters above ground level (AGL).
The blue rectangle under the aircraft in the display represents what the aircraft's camera can see on the ground, which is useful for ground surveys, and something we'll use in later projects.
In the next article, I'll build on the simulator setup here and take you through the process of writing a Python script to run an automated mission. Until then, take your time and get to know Tower with the simulator.