Randy Mackay
1c6606cc58
AC_WPNav: resolve twitch when passing spline waypoints
...
The target positions target velocity was being reset to zero as we
passed through a spline waypoint.
2014-08-28 11:00:51 +09:00
Randy Mackay
3fd2b3b4a1
AC_WPNav: init members to resolve compiler warnings
2014-08-14 11:27:30 +09:00
Randy Mackay
2b64c511ed
AC_WPNav: update yaw only when track is at least 2m
2014-07-06 17:02:12 +09:00
Randy Mackay
c9661cfb09
AC_WPNav: integrate set_desired_velocity_xy function name change
2014-07-06 17:01:10 +09:00
Randy Mackay
a2f54fdf2c
AC_WPNav: smooth waypoint by freezing feed-forward and allowing overshoot
...
First part of this fix is freezing the position controller's xy-axis
feed foward as we transition to the new segment.
Second part is work-around for straight line segments in that we allow
the target point to actually overshoot the end of the segment by up to
2m if the segment is a "fast waypoint". Ideally we would instead notice
the waypoint has been completed and take any left over time or distance
and move our target along the track towards the next waypoint but that
would require a much larger change to allow the wpnav lib to hold the
next two waypoints.
2014-06-10 20:03:01 +09:00
Randy Mackay
ce85d1f6b2
AC_WPNav: use curr pos target as spline origin
...
We only use the current target position as origin if the waypoint
controller is active (i..e has been used in the past 1 second). This is
consistent with how we initialise straight line waypoints
2014-06-10 20:02:59 +09:00
lthall
8bbce7e658
AC_PosControl: freeze feed forward for alt control in Auto
2014-06-10 20:02:36 +09:00
Randy Mackay
f23e94707c
AC_WPNav: use fast_atan2 for bearing calcs
2014-06-06 18:51:08 +09:00
Randy Mackay
efd6d6dc70
AC_WPNav: spline div by zero fix
...
Also add check for straight line navigation to ensure speed is not
reduced below zero when it hits the leash limit
Also minor formatting changes
2014-06-05 22:23:38 +09:00
lthall
0912bec8f5
Spline div zero and leash limit fix
2014-06-05 22:23:35 +09:00
Randy Mackay
cde7d31dad
AC_WPNav: fix divide by zero when origin and dest are same location
2014-05-22 21:18:24 +09:00
Randy Mackay
597d5227f5
AC_WPNav: rename set_loiter_target to init_loiter_target
2014-05-19 12:27:25 +09:00
Randy Mackay
e7b3c00767
AC_WPNav: set_loiter_target uses set_xy_target
...
Loiter is only a horizontal position controller so it should not set the
z-axis position.
Moved pos_control.set_speed and accel functions so order matches
init_loiter_targets function order
2014-05-19 12:27:20 +09:00
Ju1ien
aed5787c1b
AC_WPNav: bug fix for loiter init in Hybrid
...
AC_PosControl::init_xy_controller() has been added to PosControl and is
called by init_loiter_target.
Hybrid is currently using set_loiter_target function to init the loiter
controller. So we have to call init_xy_controller() by set_loiter_target
function.
What happens otherwise?
In AC_PosControl::update_xy_controller, we update "now" with
now = hal.scheduler->millis();
and, as _last_update_xy_ms has not been updated previously by
init_xy_controller(), we just call init_xy_controller().
So, _dt_xy will be negative and used anyways in all the functions and
PID called by update_xy_controller.
That will avoid at least _accel_target.x/y to be set to 0 but I'm not
sure for the high values, probably an I_term that is not reset and
reached very high value.
Or maybe a cast error somewhere... no clue at all
2014-05-19 12:27:16 +09:00
Randy Mackay
091ff91a70
WPNav: add wp_and_spline_init to set speeds an init pos controller
2014-05-08 16:15:50 +09:00
lthall
b38c484874
AC_WPNav: add LOIT_JERK parameter
...
Limit accel output from loiter controller.
Call new pos_control.init_xy_controller when loiter starts
Remove sudden stop when pilot requested acceleration is zero
Pair programmed with Randy
2014-05-08 16:15:38 +09:00
Randy Mackay
fd9f8f571f
AC_WPNav: replace inav, ahrs pointers with references
2014-05-08 16:15:26 +09:00
Randy Mackay
7dd366d84e
AC_WPNav: init_loiter sets speed, accel before calcing stopping distance
...
The stopping distance depends upon the speed and acceleration so these
must be updated first
2014-04-30 21:46:18 +09:00
Randy Mackay
0103ae2eb0
AC_WPNav: add WPNAV_ACCEL_Z
...
Allows configurable z-axis acceleration during missions
2014-04-30 21:46:12 +09:00
Randy Mackay
510c9920a6
AC_WPNav: rename get_horizontal_velocity to get_speed_xy
...
This new method name is consistent with the equivalent in the
AC_PosControl class
2014-04-30 21:46:06 +09:00
Randy Mackay
ad99918fee
AC_WPNav: recalc leash lengths if set_horizontal_velocity is called
...
Resolves bug in which do-set-speed allowed reducing the speed during the
mission but not increasing it.
Slow down distance is also recalculated.
Unnecessary call to calc_wp_leash_length removed from
set_spline_origin_and_destination.
2014-04-24 13:16:08 +09:00
Randy Mackay
46fba47c8e
AC_WPNav: slow target point's speed near destination
2014-04-24 13:16:00 +09:00
Randy Mackay
7c02a02bd8
AC_WPNav: reset_I flag moved to position controller
2014-04-23 15:00:14 +09:00
Randy Mackay
4d5b73b968
AC_WPNav: add reset_I to set_loiter_target
2014-04-23 15:00:07 +09:00
Ju1ien
5d0476e522
AC_WPNav: add reset_I to init_loiter_target
2014-04-23 14:59:47 +09:00
Randy Mackay
559a258ede
AC_WPNav: bug fix to limit target point from moving beyond leash
...
Also pull Z-axis acceleration from position controller instead of using
#define
2014-04-22 23:05:11 +09:00
Randy Mackay
648787a6c8
AC_WPNav: rename some definitions
2014-04-21 15:06:29 +09:00
Randy Mackay
2167dd7d3e
AC_WPNav: update target speed immediately
2014-04-21 14:51:26 +09:00
Randy Mackay
d382fa51ee
AC_WPNav: run loiter and wp nav at 50hz on Pixhawk
2014-04-21 13:32:02 +09:00
Randy Mackay
72d2712c4e
AC_WPNav: integrate update_xy_controller name change
2014-04-21 13:31:58 +09:00
Randy Mackay
60f522a094
AC_WPNav: set_wp_destination to use current target
...
Previously we used the projected stopping point if the vehicle had not
reached the destination but this could lead to large jumps in target
position
2014-04-13 22:42:50 +09:00
Randy Mackay
15da01cf3a
AC_WPNav: replace safe_sqrt with pythagorous2
2014-04-01 20:43:45 +09:00
Randy Mackay
b15d4379d8
AC_WPNav: use atan2f, make methods const
2014-03-30 23:09:51 +09:00
Randy Mackay
d27ca53a9d
AC_WPNav: spline sets origin vel to zero when no prev segment
...
Issue caught by Michael Oborne
2014-03-30 15:19:18 +09:00
Randy Mackay
7dfde39e19
AC_WPNav: advance_spline to use dt
2014-03-30 15:02:07 +09:00
Randy Mackay
c0458b786a
AC_WPNav: check acceleration is non zero
2014-03-30 11:52:44 +09:00
Randy Mackay
f0f3688172
AC_WPNav: rounder corners for short spline segments
2014-03-30 11:52:41 +09:00
Randy Mackay
197683d539
WPNav: clean up spline comments
2014-03-29 17:57:47 +09:00
Randy Mackay
24eb195aa3
WPNav: add yaw control for straight line wp nav
2014-03-28 09:23:13 +09:00
Randy Mackay
b42b12f7be
AC_WPNav: add get_spline_yaw
2014-03-28 09:23:07 +09:00
Randy Mackay
e5e71ce371
WPNav: add spline support
2014-03-28 09:22:53 +09:00
Randy Mackay
98bdbb7fed
AC_WPNav: set loiter accel to 1/2 of speed
...
Bug fix from Leonard.
Also fixed some formatting.
2014-02-20 21:37:45 +09:00
Randy Mackay
9e31f0b985
AC_WPNav: use PosControl accessor
...
Saves 2bytes of RAM
2014-02-15 05:27:50 +11:00
Randy Mackay
d4e4620159
AC_WPNav: remove unused PID references
2014-02-15 05:27:39 +11:00
Randy Mackay
fc427967ae
AC_WPNav: set wp origin to horiz and vert stopping point
...
Also bug fix to set pos_control's down speed as a negative number
2014-02-15 05:27:39 +11:00
Randy Mackay
4cd45e2edf
AC_WPNav: remove debug
2014-02-15 05:27:38 +11:00
Randy Mackay
1596d83d02
AC_WPNav: move leashes to AC_PosControl
2014-02-15 05:27:37 +11:00
Randy Mackay
0c8cbba644
AC_WPNav: remove xy pos controller
2014-02-15 05:27:36 +11:00
Randy Mackay
2984e492df
AC_WPNav: add reference to AC_PosControl
...
Also remove requirement to pass in inertial nav position and velocity to
init_loiter method
2014-02-15 05:27:35 +11:00
Randy Mackay
c9415a08f1
AC_WPNav: use ahrs trig values
2014-02-08 18:16:47 +09:00
Randy Mackay
5767aa47d9
AC_WPNav: reduce leash length for stopping
...
We now limit the target stopping point to 1x the xy leash length while
previously it was 2x. This is justified because this limit is only used
when the copter is travelling at higher speeds but at higher speeds air
drag tends to make the copter stop more quickly naturally.
2013-12-13 22:12:30 +09:00
Randy Mackay
952afd296e
Copter: initialise waypoint leash length
...
Without this initialisation the first RTL could be too aggressive as it
tries to stop too suddenly
2013-12-12 16:23:37 +09:00
Andrew Tridgell
30fffa5854
AC_WPNav: fixed some build warnings
2013-12-11 10:21:41 +11:00
Tobias
c3309d909c
AC_WPNav: make more member pointers const
2013-10-27 13:41:29 +09:00
Tobias
bb5cf4a311
AC_WPNav: make member pointer to AP_InertialNav object const since it's
...
never modified
2013-10-27 13:41:23 +09:00
Tobias
1ecb583dd9
AC_WPNav: replace unnecessary objects with const refs
2013-10-27 13:40:53 +09:00
Randy Mackay
45aeb1a921
Copter: split up loiter into 4 steps
...
Reduces disruption to the main loop but also introduces a delay of 30ms
to navigation output
2013-08-28 11:33:10 +09:00
Randy Mackay
6969ab573d
Copter: configurable max lean angle
...
ANGLE_MAX parameter allows limiting the roll and pitch angles during
manual and auto flight modes to anywhere from 10 to 80 degrees
2013-08-11 12:53:22 +09:00
Randy Mackay
bf5a50f738
WPNav: stopping point projection uses wp_leash
2013-07-11 11:39:44 +09:00
Randy Mackay
345924ddec
WPNav: replace LOITER_ACCEL_MAX with parameter
...
Also removed unused _lean_angle_max variable
2013-07-10 20:00:32 +09:00
Randy Mackay
204f613467
WPNav: bug fix to reported distance to target
...
This value is for reporting purposes only
2013-07-10 18:21:08 +09:00
Randy Mackay
518eba0729
WPNav: bug fix to loiter accel calculation
...
Contribution from Leonard Hall
2013-07-10 17:52:12 +09:00
Randy Mackay
c4f17b3235
WPNav: rounding error fix in loiter
...
Contributed by Leonard Hall
2013-07-10 16:24:37 +09:00
Randy Mackay
5d23d5aaa7
WPNav: reduce loiter speed used to correct pos error
...
Contributed by Leonard Hall
This should reduce the aggressiveness of the response when we experience
a GPS glitch
2013-07-10 15:52:18 +09:00
Randy Mackay
dde19c9585
WPNav: add acceleration parameter
...
WP_ACCEL added to allow user control of acceleration during missions.
Loiter acceleration made to be half of loiter max speed
2013-06-16 11:40:51 +09:00
Randy Mackay
272f0e5032
Copter: reduce twitch when entering CIRCLE mode
...
Set loiter target and prev iterations velocity when circle mode is
started
Start circling from projected stopping point
2013-06-15 18:18:30 +09:00
Randy Mackay
89bbf5844f
Copter WPNav: remove unused variable
2013-05-31 21:41:32 +09:00
Randy Mackay
8c4a7ec094
Copter WPNav: Leonard's improved speed fix
...
Also pass in althold gain from main code
2013-05-31 21:03:27 +09:00
Randy Mackay
a1926441da
Copter: use fast tan for accel to lean angle calcs
...
Committed on behalf of Leonard
2013-05-30 18:25:04 +09:00
Randy Mackay
d203f0295b
Copter: bug fix for vertical speed during missions
2013-05-30 11:52:04 +09:00
Randy Mackay
dbd6524f9f
Copter: WPNav consolidate acceleration #defines
2013-05-27 10:36:24 +09:00
Randy Mackay
e3dffb920b
Copter: initialise target vel in loiter
2013-05-25 14:07:04 +09:00
Randy Mackay
a474b97291
Copter: resolve compiler warning re unused vars
2013-05-25 13:32:15 +09:00
Randy Mackay
916f241fff
Copter: Leonard's improved Loiter
2013-05-24 23:45:03 +09:00
Randy Mackay
46d65150af
Copter: lengthen loiter stopping point
...
This will make stops less aggressive when entering loiter at very high
speeds (more 7.5m/s)
2013-05-22 17:35:20 +09:00
Randy Mackay
400c1bd7b7
Copter: smooth waypoint transitions
...
Speed of intermediate point is initialised and constrained based on
current speed vector vs direction to the next waypoint.
This means the copter does not slow if the previous segment and next
segment are in line and also the intermediate point is not advanced
towards the next waypoint if the copter is moving quickly in the
opposite direction.
2013-05-22 14:17:26 +09:00
Randy Mackay
cb795ea536
WPNav: divide by zero checks
2013-05-15 11:51:26 +09:00
Randy Mackay
55235630b6
Copter: bug fix for slow loiter repositioning
2013-05-12 14:51:02 +09:00
Randy Mackay
61288fcb90
WPNav: make get_stopping_point method public
2013-05-11 16:05:42 +09:00
Randy Mackay
ed5ddfd9db
WPNav: initialise desired roll, pitch
...
bug-fix to resolve 1/10th second twitch when loiter or waypoint
controller are first engaged
2013-05-09 18:32:02 +09:00
Randy Mackay
9f735c8d03
WPNav: add fast waypoints flag
...
Waypoint is considered "reached" when the intermediate point reaches the
destination
2013-05-09 00:18:02 +09:00
Randy Mackay
4704b729c2
WPNav: reduce max acceleration to 2.5m/s
...
Also includes bug fix to ramp up of speed of intermediate point
2013-05-08 23:20:29 +09:00
Randy Mackay
328d900647
WPNav: flexible loiter speed
...
Also includes bug fix to allow speeds > 10m/s during missions
2013-05-07 17:11:24 +09:00
Randy Mackay
1f8161b493
AC_WPNav: remove unnecessary speed constraint
2013-05-07 11:58:04 +09:00
Randy Mackay
647a93e78e
Copter: remove jerk when entering RTL or AUTO
...
Loiter target position was not being initialised properly.
Add a few more comments
2013-05-03 16:58:00 +09:00
Andrew Tridgell
ba83950fc4
libraries: replace constrain() with constrain_float()
...
this makes the type much more obvious. Thanks to Tobias for the
suggestion.
2013-05-02 10:25:40 +10:00
Randy Mackay
6c081c3def
AC_WPNav: slow acceleration of intermediate point
2013-04-30 10:20:23 +09:00
Andrew Tridgell
ad40ba57be
AC_WPNav: optimise to reduce memory copies
...
save a few cycles
Pair-Programmed-With: Randy Mackay <rmackay9@yahoo.com>
2013-04-22 12:21:58 +10:00
Randy Mackay
2fc25da4c3
Copter: Leonard's fix for get_loiter_accel_to_lean_angle
2013-04-21 16:27:50 +09:00
Randy Mackay
ed298363f4
AC_WPNav: remove unnecessary limit in leash calc
2013-04-18 22:31:44 +09:00
Randy Mackay
764853bd56
AC_WPNav: add climb and descent params, dynamic leash length
2013-04-18 14:51:01 +09:00
Randy Mackay
effd5b0da7
AC_WPNav: improved comments
...
Made SPEEDZ a parameter although it's not yet used
2013-04-18 11:17:41 +09:00
Randy Mackay
8fe3e689f4
Copter: add WPNAV log message
2013-04-15 21:54:29 +09:00
Randy Mackay
0eab3e87b2
AC_WPNav: use prev wp as origin for next wp
2013-04-14 18:27:39 +09:00
Randy Mackay
0351c2ae33
AC_WPNav: allow setting of horizontal velocity
...
Also added accessor function for waypoint radius parameter
2013-04-14 13:24:14 +09:00
Randy Mackay
252e98ec57
AC_WPNav: use global gravity constant
2013-04-14 10:39:32 +09:00
Randy Mackay
9d7d174995
AC_WPNAV: check distance to waypoint within library
...
bug fix for loiter using lat/lon position instead of NED position when
calculating desired velocity towards target
2013-04-14 10:39:21 +09:00
Randy Mackay
35001619f0
AC_WPNav: stop track_desired from moving backwards
2013-04-14 10:39:19 +09:00
Randy Mackay
c6b68c7843
AC_WPNav: Leonard's 3d leash calculator
2013-04-14 10:39:08 +09:00
Randy Mackay
74e1c2e660
AC_WPNav: advance track fixes
2013-04-14 10:39:05 +09:00
Randy Mackay
6dbcbdcb43
AC_WPNav: limit max loiter position error
...
move interpretation of pilot input to wpnav lib
2013-04-14 10:38:58 +09:00
Randy Mackay
31838b2865
AC_WPNAV: change loiter controllers to use floats
...
in particular get_loiter_pos_lat_lon and get_loiter_accel_lat_lon
2013-04-14 10:38:56 +09:00
Randy Mackay
0ccdce1b22
AC_WPNav: Leonard's ff loiter and 3d wp nav
2013-04-14 10:38:43 +09:00
Randy Mackay
926c404994
AC_WPNav: Leonard's loiter target smoothing
2013-04-14 10:38:39 +09:00
Randy Mackay
f82ce449d7
AC_WPNav: add angle limits and set from AC's throttle controller
2013-04-14 10:38:34 +09:00
Randy Mackay
afd2f82768
AC_WPNav: bug fix for track covered being 2D
...
Replaced abs and fabs with fabsf
Added get_destination method
2013-04-14 10:38:32 +09:00
Randy Mackay
8ec7fd1c9c
AC_WPNav: add set_loiter_target to use velocity
...
Target can be set in front of the copter to reduce the bounce back to
the position where loiter was engaged.
2013-04-14 10:38:25 +09:00
Randy Mackay
60060d8184
AC_WPNav: add get_target_alt
...
Required because waypoint controller will be modified to control
altitude
2013-04-14 10:37:58 +09:00
Randy Mackay
0d70ba1030
AC_WPNav: bug fix to dt calculation
2013-04-14 10:37:51 +09:00
Randy Mackay
39bc3800c9
AC_WPNav: add distance and bearing to target methods
2013-04-14 10:34:50 +09:00
Randy Mackay
b92c4097d2
AC_WPNav: first implementation
2013-04-14 10:34:47 +09:00