Intel Aero Drone - Altitude and Position Hold Using PX4Flow

by intel-aero in Circuits > Robots

11140 Views, 31 Favorites, 0 Comments

Intel Aero Drone - Altitude and Position Hold Using PX4Flow

20170707_105933.jpg

For the latest information and support for Aero, please visit our wiki.

What is optical flow? Just the future. I mean, being able to sit in one position or cruise at a fixed altitude outdoors or indoors without having to worry about anything is the drone dream right?

These steps are going to be a little long and complicated, but well worth it.

This process could take 1-2 hours.

Collect Materials

Here's everything you will need

Print the Part

20170706_194050.jpg

Download this work of art here

Send it into your 3D printer and print for about 30 minutes. The PX4Flow weighs about 18 grams, and this part weighs about 5 grams in ABS, so the total weight added will be 23 grams. The shape seems a bit familiar...

Copy Files Onto Aero

px4flow2.png

While that part is baking in the oven, let's do something else.

Download the two attached files, 'aero-rtf_i2c.jam' and 'aerofc-v1_px4flow.px4'. Copy the files onto your Aero board. Start by connecting to it as a wifi device, then do the following for your OS.

Linux/Mac:

In a terminal, just scp the files onto your board, which has IP 192.168.8.1 when connected over wifi. For example

> scp Downloads/aero-rtf_i2c.jam root@192.168.8.1:/home/root

> scp Downloads/aerofc-v1_px4flow.px4 root@192.168.8.1:/home/root

Windows:

Use WinSCP

Connect to IP 192.168.8.1 with username 'root' as shown in the image. Then simply drag both files over.

Flash the FPGA and Flight Controller

px4flow3.png
px4flow4.png
px4flow5.png

Start by SSH-ing into your Aero board. Follow the steps for your own OS.

Linux/Mac:

In a terminal, just run ssh on IP 192.168.8.1 with username 'root', like so

> ssh root@192.168.8.1

Windows:

Once again life is a little harder on Windows, so get yourself PuTTY.

Enter the IP 192.168.8.1 and username 'root' as shown in the first image and click Open.

- - -

Once you're in, make sure you are in the directory with your copied files and run the following commands

> jam -aprogram aero-rtf_i2c.jam

> aerofc-update.sh aerofc-v1_px4flow.px4

You should see outputs such as in the last two images. Basically what we are doing is first updating the FPGA so that it can use the telemetry port as an I2C connection. Then we are updating the flight controller so that it will recognize the PX4Flow.

Setup the PX4Flow

Follow the steps here, only in the 'Image Quality and Output Section'.

This will take you through connecting to QGroundControl, updating the firmware, and calibrating the camera.

Modify the Wires

20170706_194533.jpg
px4flow6.png

And now for the most interesting part.

Take the 4 pin I2C connector that comes with your PX4Flow and solder it to your own 6 pin DF13 connector like so. Follow the second image; 1 goes to 1 and so on.

Mount the PX4Flow

20170706_194933.jpg
20170628_102507.jpg
20170706_195628.jpg
20170706_195739.jpg

First, use your own screws to screw the PX4Flow onto the printed part.

Then undo the four screws on the bottom of the frame.

Screw those four screws back in over the mount. Make sure the sonar is facing the front of the drone and the camera is facing the rear.

And finally, plug in the connector to the telemetry port.

Sanity Check

Screenshot from 2017-07-06 20-43-27.png

Reboot for good luck. Then connect the wifi, open up QGroundControl, and connect it to your drone. Open Widgets > MAVLink Inspector and verify that you can see 'OPTICAL_FLOW_RAD' under your vehicle.

If not, someone messed up. Time to go home.

Set Flight Parameters

20170707_110225.jpg
Screenshot from 2017-07-07 11-15-46.png
Screenshot from 2017-07-06 20-44-38.png
Screenshot from 2017-07-06 20-45-12.png

With the remoter controller connected, toggle the switch in the top left corner. Make sure that the three positions have the correct modes assigned to them in the 'Flight Modes' page.

Then go into Parameters > EKF2.

For the parameter 'EKF2_AID_MASK', check the box that says 'use optical flow' (bitmask is 3).

Note: if you are planning to use this indoors, you should also turn the GPS off. Uncheck the box that says 'use GPS' (bitmask is 2).

For the parameter 'EKF2_HGT_MODE', change this to 'Range sensor'.

Reboot once more for necessity.

Set PX4Flow Parameters

px4flow1.png

If you are flying outdoors, you should be good to go.

If you are indoors, you may want to adjust the PX4Flow parameters for better performance. The performance will vary depending on what kind of surface you are flying over, but we've found the following parameters work pretty well.

Connect to your PX4Flow in QGroundControl directly just as in Step 5. Open up the parameters, set 'BFLOW_F_THLD' to 10, and set 'BFLOW_V_THLD' to 7000.

These parameter changes won't remain after reboot. You can read more about the parameters here.

Fly Like a Pro

Intel Aero Drone - Position Hold With PX4Flow

And there you have it. Living proof that even the worst pilots can hope to fly one day.