New SplineNav 0.3: Smoother Yaw, and Manual Yaw Override

 

After a few months of hard work, SplineNav 0.3 is now ready to fly! This SplineNav release started with the goal of simply reducing the yaw jitter issues of SplineNav 0.2, but in the end it turned into a major rewrite of the code.

 

New Features:

 

  • Smoother Yaw: Updates x and y spline derivative calculations faster, in a separate loop, for a more precise yaw control. Uses a fast approximation of the atan2 function to compute the yaw angle from the spline derivative.
  • Features yaw rate smoothing for much smoother video, avoiding the small yaw "jerk" at each waypoint.
  • Allows manual override of yaw control, then takes back auto control of yaw if the pilot centers the stick when yaw is directed approximately in the direction of the spline curve.
  • Now enters SplineNav mode smoothly, without an initial jerk.
  • Uses it's own flight mode, so unlike SplineNav 0.2 it doesn't override your Circle mode. To use SplineNav 0.3, set one of your FLTMODE parameters to 14 in the Full Parameter List.

 

SplineNav Waypoints

 

We collected the waypoints for this video while flying FPV, and flipping the channel 8 switch at each point to record. Then we loaded the waypoints into Mission Planner, and made some small adjustments:

Waypoints recorded during FPV flight and adjusted in Mission Planner


The GPS track indicates it hit all the waypoints quite precisely, on each lap for a total of 3 laps (72 waypoints in total):

GPS track from dataflash log shows SplineNav hitting each waypoint precisely over 3 complete laps


The waypoints had a range of altitudes set, from 7 to 35 meters. Here is the flight profile from the autopilot logs, imported into Google Earth:

GPS flight profile from dataflash logs after 3 complete laps

 

Hardware Used:


Airframe: 3D Robotics Quad, with some modifications.

Autopilot
: 3DR APM 2.6, with external compass/GPS module

Motors
: T-Motor MT2216 KV800

Props
: APC 11x4.7

Gimbal
: WIND-1 two-axis brushless

Camera
: GoPro Hero 3 Silver

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 + SecurityCamera2000 CMQ1993X
Also: These mods for longer range FPV.

SplineNav 0.3 Firmware Installation:

 

  1. First make sure your quad copter is flying well with ArduCopter version 3.0.1, since SplineNav 0.3 is based on this firmware version.
  2. Go to https://github.com/mavbot/SplineNav, and click the "Download ZIP" link.
  3. In the special Ardupilot version of Arduino, go to File -> Preferences and set your sketch directory to the path of the "SplineNav-SplineNav-0.3" directory from the extracted zip archive.
  4. Restart Arduino, then choose File -> Sketchbook -> ArduCopter from the menu.
  5. From the ArduPilot menu, make sure your HAL Board is set correctly.
  6. Connect your copter's APM via USB, and from Arduino's Tools menu make sure the serial port is set correctly.
  7. Click the Upload arrow button and wait for the code to compile and upload to your APM.
  8. Set one of your FLTMODE parameters to 14 in Mission Planner's Full Parameter List, set your waypoints (either with Mission Planner or with the channel 7 or 8 switch), then go fly!

Note: If you have any special requirements, such as a frame or orientation other than quad X, remember to make those adjustments in the code before compiling. Or if you'd rather not compile yourself, please contact us to get a hex file you can upload directly via Mission Planner.

 

Parameters

 

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

WPNAV_SPEED: 1350 cm/s
This should make SplineNav go about 49 km/h on straight segments.

WPNAV_SPEED_UP: 1000 cm/s

WPNAV_SPEED_DN: 650 cm/s

WPNAV_LOIT_SPEED: 1500 cm/s
Should be set higher than WPNAV_SPEED.

WPNAV_ACCEL: 180 cm/s/s
Nice low value for a smooth steady start.

Also, the following parameters are #defines in the splinenav.h source code, and can be changed at compile time:

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

SPLINE_CURVE_ACCEL_MULTIPLE: 2.0
This allows for twice the max curve acceleration as set in the WPNAV_ACCEL parameter. Added this parameter to allow for smooth slow starts without making tight curves overly sluggish.

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

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

Views: 4012

Comment by Sam Grob on January 17, 2014 at 5:35am

This is the feature that would set APM apart from all other FCs. Why is this getting no love from the APM devs ? Don't they want DJI to have sleepless nights ?

:-)


Moderator
Comment by Gary Mortimer on January 17, 2014 at 10:10am

It is getting attention, will work best on the pixhawk me thinks.

Comment by David Dewey on February 9, 2014 at 12:23am

I just uploaded SplineNav-0.4, a new version for ArduCopter 3.1: https://github.com/mavbot/SplineNav

If you're not yet familiar with the new ArduPilot Arduino, please read build instructions here: http://dev.ardupilot.com/wiki/building-ardupilot-with-arduino-windows/

It should be straightforward to compile and upload following these instructions. Let me know if there are any questions.

Performance should be much better with this version of SplineNav, since it breaks tasks into smaller pieces to not overload the scheduler. Also note that it no longer does a spline loop by default; instead it slows to a stop at the last waypoint.

Comment by Jeff P on February 16, 2014 at 10:19am

David, will this .4 version work on the Pixhawk?  Thanks, Jeff

Comment by David Dewey on February 16, 2014 at 6:47pm

Well, it hasn't been tested on Pixhawk, but it should work. Let us know your results!

Comment by Zidlov on February 16, 2014 at 11:07pm

Uploaded end tested it on a foldable h-frame "Alien Locust" from goodluckbuy.

It uses 5010 630kv motors from rctimer and 12" Graupner props, both of which are balanced.

Gave it a small mission around a group of trees with altitude changes from 20 to 30 and 40 meters and back down to 20 meters.

It flew the mission beautifully smooth, visually couldn't make out where the individual waypoints were, it was all one long smooth curve, very nice!

Only weird thing I noticed was that after I landed and rearmed and went for another manual flight, the baro was behaving very strange. On alt-hold it shot up in the air , gaining about 5 meters of height and corrected very aggressively. Probably this hasn't anything to do with the splinenav code, though. Or did the spline nav code alter any of the alt-hold behaviour? Don't think so, right?

This was just a first test and I'm looking forward to do some more once I have a free day...

Will report back here, but so far I'm really impressed, great work! Can't wait to try this fpv....

Comment by David Dewey on February 17, 2014 at 12:01am

Hi Zidlov. Great to hear about your SplineNav test. No, SplineNav doesn't affect the behavior of other flight modes, so it must be a separate issue.

Comment by Kumaresan Gurusamy on March 13, 2014 at 11:06pm
hi david, really some nice work done. i'm using multiplex easystar + arduplane 2.68 for my work. can the spline navigation algorithm can be used in arduplane also ? i would really be excited to use it. is porting the changes from arducopter+spline nav to arduplane+spline nav easy ? where should i start ? is there a change log file so that i can start making the same changes and integrate it with auduplane.

any pointers would be helpful.

thanks.
Comment by David Dewey on March 13, 2014 at 11:23pm

Hi Kumaresan, I'm not familiar with the Arduplane code, but it seems like it should be possible. To see the changes that make up SplineNav you can go on GitHub and do a compare between SplineNav 0.4 and Arducopter 3.1. That will show you each line that has been added or changed. Besides the addition of SplineNav.h and SplineNav.pde files, there are changes to 8 other files, most of them minor, just a few lines. Altogether SplineNav is pretty simple, only a couple hundred lines of code in total.

Comment by Kumaresan Gurusamy on March 14, 2014 at 4:32am
thanks for the quick reply david. i'll try this on auruplane and get back to you for any clarifications.

Comment

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