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: 3951

Comment by hotelzululima on October 31, 2013 at 10:32am

hmm and this DOES bring up a rather obvious question.. is there ANY way to instrument the processor load on the AVR cpu , ie how do we know when its time to move to faster processors for ardupilot like what is already been done with pixhawk? And of course the above implied question is how do x8,y6 affect processor load vs hex and octo configs vs a quad or a tri configs.(guess its time for me to start coming through the ardupilot source tree... :)

          hzl

Comment by hotelzululima on October 31, 2013 at 10:41am

and by the way, amazing work.. and of course I am wondering .. will it work with a 3DR Y6?

     hzl

Comment by David Dewey on October 31, 2013 at 4:35pm

Hi Hotel, I believe Pixhawk is the move of Ardupilot to a faster processor. Having one of those would certainly make coding SplineNav easier, as I wouldn't have to sacrifice speed and precision to save CPU load.

I expect it should work on a 3DR Y6, if you change the FRAME_CONFIG define before compile of course. I'm looking forward to hearing the results of your SplineNav test on your Y6.

Comment by F1P on October 31, 2013 at 9:28pm

How about adding gimbal control?

Its may be very useful ...

Comment by David Dewey on October 31, 2013 at 9:44pm

Interesting idea, do you mean auto gimbal control, for example the gimbal would always point along the slope of the spline path, so it would angle up during a climb, and down during a decent? That way the video would look more like it was filmed from a fixed-wing aircraft. Although that might not be a good thing all the time, because on a steep climb you'd just see sky in the video. It could be a pretty cool effect though.

Or SplineNav could recognize ROI commands and point the camera at a given location, that would be pretty useful.

Of course you can do manual gimbal control already, for example I control the pitch of my gimbal with my channel 6 knob while flying SplineNav.

Comment by David Dewey on November 1, 2013 at 12:59am

That's true, you could have an entirely separate spline curve to control the gimbal pointing, for example the ROI point itself could be made to follow a it's own spline curve (different from the one the aircraft is flying), instead of using a fixed ROI point.

Comment by F1P on November 1, 2013 at 1:07am

Yep! As mathematical procedure "Spline" is universal method for compensation parametres irregularity =)
Imho there is many variants smoothing gimbal manipulation depend of camera operation mode.
Spline processin in manual mode of  gimbal manipulation is highly in demand, but it need "self" set of parameters.

Comment by Søren Kuula on December 4, 2013 at 2:10am

Hi,

This is way cool. Is there something in the way of integrating it into the newest AC code? I could try but not if someone says it needs lots of rework in things I might not understand..

I tried it yesterday in a flight where the waypoints were just 20 to 100 m apart. The copter made some pretty violent jerks in some very sharp turns. Is there something needing retuning for smaller scale missions?

Regards

Soren

Comment by David Dewey on December 9, 2013 at 3:44pm

The SplineNav 0.3 code will slow the forward speed down as the curve gets tighter, so it should be OK for waypoints close together, unless you have a long straighter stretch before those points where it accelerates to a high speed (since currently the processor limitations don't allow us to do look-ahead on the spline curve and slow down ahead of time for sharp curves, so if they come on suddenly instead of gradually you can get some violent jerks; although if you turn your stab P parameters down it will smooth out those jerks a bit). When I update to a Pixhawk I will definitely add the look-ahead, so this will no longer be a problem. For now there's really no extra processor power available though.

Also turn your waypoint nav speed parameter down if your curves are too tight, or choose your waypoints better so that the curve won't be so tight.

Do you have a KML file of the flight from the dataflash? If so you can view it in Google Earth, or overlay in on your flight plan in Mission Planner (use the the "Map Tool -> KML Overlay" option from the right-click menu on the Flight Plan screen) and get a good idea of how tight the curve was.

If you post your log file with parameters I could compare it to mine.

Comment by Chris Onyando on January 17, 2014 at 5:12am

This is very cool. I think it should be added to the arducopter code.

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