New SplineNav Version 0.2 on a 63 km/h Tour of Chinese Lotus Pond

I've now finished coding up SplineNav version 0.2. It's almost a complete rewrite from version 0.1. Besides flying smoother and using processor resources more efficiently, it now restricts maximum speed to prevent lag. For example, if you're flying fast into a strong headwind, then altitude may get low due to insufficient downward thrust, and position may also start lagging target, resulting in corner cutting. SplineNav now tracks this, and continuously and smoothly adjusts target speed to allow the copter to keep up without major altitude loss. So it's now completely safe to crank up the speed settings and fly SplineNav really fast.


SplineNav Waypoints

I collected the waypoints for this video while flying FPV, and flipping the channel 8 switch at each point I wanted to record. Then I loaded the waypoints into Mission Planner, and made some small adjustments (Figure 1). I also checked them by flying SplineNav at low speed first, and watching via FPV how close it got to the trees.

Figure 1: Waypoints recorded during FPV flight and adjusted in Mission Planner

After the low speed check I felt comfortable to fly it at max speed, although it was still very nerve racking, because it was zipping by a few meters from those weeping willow trees at about 60 km/h. I'm not sure I could have reacted in time to prevent my copter going to the bottom of the pond had a GPS error caused it to brush the willow branches and careen out of control!


Flight Log Track

After the flight, I loaded the log data into Google Earth and exported a KML file to overlay on the map, using Mission Planner's handy KML Overlay feature (Figure 2).

Figure 2: Purple track is GPS recorded track during SplineNav flight

As you can see, the GPS track indicates it hit all the waypoints very precisely, expect it slightly missed waypoint 8, which I attribute to the copter having just flown right next to a large building which could have caused GPS signal reflections.

The waypoints had a range of altitudes set, for a more interesting flight. Here is the flight profile from the data logs, imported into Google Earth:

Altitude profile generated in Google Earth from flight log data

Hardware Used

Airframe: ArduPhantom (DJI Phantom case, stock motors, ESC, and battery)
Autopilot: 3DR APM 2.5
Gimbal: Hummer 2-axis brushless gimbal for DJI Phantom and GoPro 3
Camera: GoPro Hero 3 Silver
GPS: 3DR ublox LEA-6H
Telemetry: 3DR 433 MHz
R/C: FlySky TH9X(ER9X FW) + 2.4GHz FrSky DJT module + V8R7-II rx
FPV: ImmersionRC 5.8GHz 600mA + FatShark Predator goggles



This test was done using the excellent new ArduCopter 3.0.1 release code, that I then modified to include and call the SplineNav code.

The latest SplineNav code, already integrated into my own branch of ArduCopter 3.0.1, is available here:


SplineNav 0.2 Firmware Installation

Warning: Only install SplineNav if your copter is already working well with ArduCopter Version 3.0.1, and if you're experienced enough to test fly it safely.

1. Download the code with this link: and extract the zip file.

2. In the special Ardupilot version of Arduino, go to File -> Preferences and set your sketch directory to the path of the "SplineNav-SplineNav-0.2" directory from the extracted zip archive.

3. Restart Arduino, and choose File -> Sketchbook -> ArduCopter from the menu.

4. From the ArduPilot menu, make sure your HAL Board is set correctly.

5. Connect your copter's APM via USB, and from the Tools menu make sure the serial port is set correctly.

6. Click the Upload arrow button and wait for the code to compile and upload to your APM.

7. Set your waypoints (either with Mission planner or with the channel 7 or 8 switch), then go fly!

Note: Since there is not yet any SPLINENAV mode in Mission Planner, SplineNav for now just commandeers CIRCLE mode. So switch to CIRCLE mode on your transmitter when you're ready to fly your waypoints with SplineNav.



Here are the speed and acceleration parameters I used for this video (set in Mission Planner):

WPNAV_SPEED: 2000 cm/s
My copter can't fly 2000 cm/s, but SplineNav correctly kept the speed adjusted to what my copter can actually handle, and according to the GPS data it reached a maximum velocity of 1760 cm/s (63 km/hour).

WPNAV_SPEED_UP: 350 cm/s
WPNAV_SPEED_DN: 450 cm/s
WPNAV_ACCEL: 500 cm/s/s

Also, the following parameters are #defines in the splinenav.h source code, but hopefully they will eventually become configurable parameters:

Higher tension splines curve more tightly at waypoints, but straighter in between waypoints. A tension value of 2 makes it a Catmull-Rom spline. I found that slightly lower tensions tend to give nice loose curves for smooth aerial video.

SPLINE_JERK: 500.0 cm/s/s/s
Jerk is the maximum rate that SplineNav increases or decreases acceleration as it flies the curve.

This makes SplineNav loop the waypoints forever until you exit out into another mode.

Views: 2624

Comment by Mark Harrison on July 20, 2013 at 1:56am

Very nice!  Where's the location of the Lotus Pond?

Comment by David Dewey on July 20, 2013 at 7:16am

Thanks Mark,

The lotus pond is at Zhejiang University Zijingang Campus, Hangzhou City, Zhejiang Province, China. It's about a fifteen minute walk from my apartment, so I fly in this area all the time.

Comment by RickP on July 20, 2013 at 12:48pm

So I did some more playing with the code. I must admit, I've not done much 'auto' stuff before, so I've been a bit puzzled by how to setup a route - as I was finding it going into LAND mode prematurely. However, this is a couple of laps of the quarry on the same course. Once in 'AUTO' and once in 'Spline'

Its very noticeable that the Spline code maintains the speed, particularly around the corner at the bottom of the quarry.

Logs are here: - contains a few laps, some in auto and some in spline...

Comment by David Dewey on July 20, 2013 at 10:19pm

Hi Rick, I noticed that your WPNAV_ACCEL is only 100. SplineNav attempts to maintain a speed around curves that won't exceed that much acceleration, so you could probably get it to go a lot faster if you set that higher. Mine is set to 500.

Currently SplineNav constrains velocity to no more than WPNAV_LOIT_SPEED, so you'll probably want to set this to be a bit larger than WPNAV_SPEED, otherwise the flight could be jerky.

I also noticed your loiter rate P is only 0.8. I think the default is 1.0. Raising it should improve SplineNav performance a bit.

Comment by RickP on July 21, 2013 at 12:07am

Thanks - I'll give those a go next time...

Comment by Bryan Galusha on July 22, 2013 at 9:04pm

Great work, really good looking footage.

Comment by David Dewey on July 22, 2013 at 9:08pm

Thanks, glad you liked the footage! For me the yaw jitter in the video was a bit disappointing, but I'm working on improving that.

Comment by RickP on July 24, 2013 at 2:06pm

So I tried the new settings, and it certainly flies faster - but its losing height as it does so. Looking at the log it seems to me that the barometer thinks its climbing, though the GPS altitude is falling. When I drop out of Spline back into loiter/alt-hold - its slows and then the barometric height drops rapidly.

I'll work on solving this first before continuing with the spline nav stuff. Any suggstions?

Comment by David Dewey on July 24, 2013 at 6:12pm

This seems like a very common issue with copters, that the airflow over the frame at higher speeds results in a low pressure area that can make the barometer think its climbing. Perhaps you can solve it by changing the position of your APM, or adding a partial enclosure like a Tupperware or CD case. My APM is almost completely enclosed thanks to the Phantom case, and I don't have this issue, but I've encountered it before on my other copter, a 3DR quad, especially when flying into a headwind.

Comment by RickP on July 24, 2013 at 11:24pm

Yup, thats the conclusion I'd come to. Its an APM2.5 in the case and foam insert, with some additional taping around it. I'll see what I can do to improve it. Thanks ;)


You need to be a member of DIY Drones to add comments!

Join DIY Drones

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service