Commit Graph

224 Commits

Author SHA1 Message Date
Randy Mackay 055ce4e53e Copter: integrate control_rtl 2014-02-15 05:27:39 +11:00
Randy Mackay cdc0f8e414 Copter: use new control_auto takeoff and land 2014-02-15 05:27:38 +11:00
Randy Mackay f3bcbb2ce4 Copter: remove setting roll, pitch yaw modes in set_mode 2014-02-15 05:27:37 +11:00
Randy Mackay 65f7bf92f4 Copter: replace yaw_mode with auto_yaw_mode 2014-02-15 05:27:37 +11:00
Randy Mackay 0a2adbac1b Copter: renaming functions after moving xy control 2014-02-15 05:27:36 +11:00
Randy Mackay 5fd9410ff5 Copter: much renaming as xy pos controller moves 2014-02-15 05:27:36 +11:00
Andrew Tridgell e8b8cc1a5d Copter: converted to AP_ServoRelayEvents 2014-01-20 17:06:29 +11:00
Andrew Tridgell e3804e2846 Copter: fixes for AP_Relay API change 2014-01-20 17:06:29 +11:00
Randy Mackay 6d55895d30 Copter: simplify do-set-servo mission command
This potentially changes the servo number that must be supplied if using
an APM1 but it now shares the same logic as arduplane and also adds
protection that the servo is not attached to the motor.
removed debug message from previous commit.
2014-01-15 14:36:50 +09:00
Randy Mackay 59cea4b88c Copter: remove CopterLED from main code 2013-11-30 18:20:55 +09:00
Randy Mackay 7ef04bb73b Copter: rename nav_yaw to control_yaw 2013-11-27 22:48:20 +09:00
Robert Lefebvre 0e2ddb0378 Copter: verify_takeoff() should set ap.takeoff_complete to True after the takeoff is complete. 2013-11-15 22:57:34 +09:00
Randy Mackay 65980ace68 Copter: remove some commented out send_text code 2013-10-30 13:44:56 +09:00
Andrew Tridgell 3b9566bc09 Copter: support MAV_CMD_DO_SET_CAM_TRIGG_DIST 2013-10-11 21:40:57 +11:00
Randy Mackay 7cc8a9038f Copter: move failsafe flags into structure 2013-09-26 19:37:15 +09:00
Randy Mackay 284aa2217f Copter: remove old comments 2013-09-24 21:45:43 +09:00
Randy Mackay 6052017b13 Copter: allow override of auto throttle mode 2013-08-28 11:45:07 +09:00
Randy Mackay 7ea971d948 Copter: check set_mode for failure
Previously if set_mode failed it would return the copter to stabilize
mode.  With this commit set_mode returns a true/false indicating whether
it succeeded or not so the caller can make the decision as to the
appropriate response which could be to stay in the current flight mode
or try another flight mode.
2013-07-20 11:01:10 +09:00
Randy Mackay 1dcc5886d0 Copter: ensure take-off alt is at least 1m
fixes issue #377
2013-07-16 15:51:18 +09:00
Randy Mackay 47ab02d686 Copter: bug fix to ROI to pull target from conditional command queue 2013-07-14 17:37:06 +09:00
Randy Mackay f1969d5662 Copter: switch from NAV_ROI to DO_SET_ROI 2013-07-14 17:37:05 +09:00
Randy Mackay ab1a7baf71 Copter: project stopping point for loiter command 2013-07-11 11:39:47 +09:00
Randy Mackay 022148ec0d Copter: LAND only control horizontal position if we have GPS lock 2013-06-25 22:34:58 +09:00
Randy Mackay 993bccc60e Copter: point nose at landing point if specified 2013-06-03 15:20:37 +09:00
Randy Mackay 9f59f2724f Copter: bug fix for take-off when throttle is zero
Verify_takeoff was always returning false if throttle was zero.  The
pilot should be able to move their throttle back to zero immediately
after initiating the mission
2013-06-03 14:18:56 +09:00
Dr Gareth Owen 79bd8b4fd0 rtl resets yaw to same as when armed - unless user specifies otherwise 2013-06-02 11:29:27 +09:00
Randy Mackay 0460147a15 Copter: guided mode yaw fix
Nose of copter now points at next guided point if it is more than 10m
away
2013-06-02 11:25:35 +09:00
Randy Mackay 429f900460 Copter: bug fix for RTL bearing
Also smooth RTL's initial climb stage by projecting stopping point
2013-05-11 16:21:25 +09:00
Randy Mackay ad656c7e8a Copter: allow lat/lon to be specified for land 2013-05-10 22:37:15 +09:00
Randy Mackay b3bca271d4 Copter: rename verify_must to verify_nav_command
Perhaps easier to understand if we use the "nav" and "conditional"
command labels
2013-05-10 12:06:29 +09:00
Randy Mackay b65d714675 Copter: set yaw-mode in do_loiter mission command 2013-05-10 10:51:46 +09:00
Randy Mackay 1b52ee211a Copter: bug fix for RTL yaw control
Nose was only pointing home if your initial altitude was above the
RTL_ALT
2013-05-09 21:44:46 +09:00
Randy Mackay 1b2d8636ca Copter: set wp to "fast" if they have no delay 2013-05-09 00:18:36 +09:00
Andrew Tridgell 105bd32a2e Copter: fixed some uses of constrain_float() to be right type 2013-05-02 10:29:57 +10:00
Andrew Tridgell 25c576cad7 Copter: replaced constrain() with constrain_float() 2013-05-02 10:26:49 +10:00
Randy Mackay a53e5f747b Copter: add fourth yaw behaviour, look-at-home
Added get_wp_yaw_mode to remove duplication of checks of the
WP_YAW_BEHAVIOR parameter
2013-04-20 15:36:24 +09:00
Randy Mackay 37abfdc65a Copter: make CIRCLE_RATE a tunable parameter
Also bug fix to check of how many time it has rotated during a loiter
turns mission command
2013-04-20 12:03:55 +09:00
Randy Mackay d65d7d95e2 Copter: bug fix for take-off so it never descends
If copter was already flying when take-off command was received it could
descend to the target altitude if it was below the current altitude.
2013-04-18 22:30:24 +09:00
Randy Mackay 0fc9c8739e Copter: add WP_YAW_BEHAVE parameter
Allows user to control whether nose points towards next waypoint and/or
home when RTLing.
Replaces YAW_OVR_BEHAVE which had a very similar purpose.  Almost nobody
ever knew about or used this parameter.
2013-04-18 15:30:18 +09:00
Randy Mackay a7b32caf72 Copter: bug fix for loiter_time check
loiter_time_max was changed to hold the loiter time in seconds
(previously it was milliseconds) in order to allow the delay to be more
than 65 seconds but the verify_loiter_time check was missed from that
change
2013-04-15 23:57:22 +09:00
Randy Mackay 8c7a1597dc Copter: remove debug comment from RTL 2013-04-14 18:28:13 +09:00
Randy Mackay 629d23b7e2 Copter: remove WP_SPEED and WP_RADIUS parameters
AC_WPNav library has equivalent params with very similar names
2013-04-14 13:27:37 +09:00
Randy Mackay 1ee825ee9a Copter: move alt and wp checking to AC_WPNAV
RTL fix so that if it starts rtl-ing from above 80m it returns home
while descending instead of descending at initial position.
add get and set_target_alt_for_reporting
2013-04-14 10:39:23 +09:00
Randy Mackay 553f40a99c Copter: bug fix to loiter delay
change delay to seconds to allow delays longer than 65seconds
2013-04-14 10:38:30 +09:00
Randy Mackay 1516972eaa Copter: add panorama to CIRCLE mode
Yaw will slowly rotate if CIRCLE_RADIUS is set to zero
Circle center is projected forward CIRCLE_RADIUS from current position
and heading
2013-04-14 10:38:01 +09:00
Randy Mackay 58ed8cd544 Copter: replace set_next_WP with direct call to wp_nav 2013-04-14 10:37:55 +09:00
Randy Mackay 49828eba7d Copter: integrate AC_WPNav 2013-04-14 10:37:48 +09:00
Andrew Tridgell b280857025 Copter: use common angle wrap code 2013-03-29 13:14:31 +11:00
Randy Mackay a1295c042b Copter: fix init of wp_verify_byte so wp alt is always required 2013-03-17 16:37:30 +09:00
Randy Mackay f9539384a1 Copter: rename failsafe to failsafe_radio
Makes way for separation of failsafes for throttle, gps and gcs
2013-03-16 17:14:21 +09:00
Randy Mackay 5380973225 Copter: only start delay timer after reaching wp location and altitude 2013-03-06 12:50:41 +09:00
Randy Mackay e0506bd622 Copter: inav circle initial implementation 2013-02-26 11:35:35 +09:00
Randy Mackay cbde042ec5 Copter: remove non-inav loiter and wp controllers
lon_speed, lat_speed changed to float
do_takeoff, do_land now set roll-pitch, yaw and nav modes specifically
removed fast_corners functionality (may need to be reimplemented with
new inertial nav controllers)
2013-02-24 14:41:52 +09:00
Randy Mackay 574756908d Copter: set wpinav controller targets in nav calls
All navigation commands now properly set wpinav controller targets
except CIRCLE related commands.
2013-02-24 14:41:36 +09:00
Randy Mackay 00bc28adcc Copter: take-off code cleanup
remove redundant setting of loiter target.
explicitely set throttle mode to THROTTLE_AUTO
2013-02-24 14:41:32 +09:00
Randy Mackay 37d3e1d7e4 Copter: add zero slope checks to wpinav
also added RTL fix to set wpinav target explicitly
2013-02-24 14:41:25 +09:00
Randy Mackay fcf102b2cf Copter: inertial nav waypoint controller
#define added to allow compile time selection of traditional or inav
based loiter and wp controllers
2013-02-24 14:41:09 +09:00
Randy Mackay 9d34ead486 Copter: fix up some casting issues for wp_distance 2013-02-01 22:42:50 +09:00
Randy Mackay 6f5050a8b9 Copter: minor casting fixup for wp_distance 2013-01-27 11:27:43 +09:00
Randy Mackay d2767b911c AP_Math: switch get_distance_cm to return uint32_t
Includes changes required on ArduCopter and ArduPlane side as well
2013-01-26 17:04:12 +09:00
Randy Mackay fd02cfe706 Copter: added set_nav_mode to control initialisation of nav controllers
Renamed run_navigation_controllers() to run_autopilot()
Renamed update_nav_wp() to update_nav_mode()
Renamed wp_control to nav_mode to be more consistent with roll-pitch,
yaw and throttle controllers
2013-01-25 15:16:29 +09:00
James Bielman 5631f865b2 Update floating point calculations to use floats instead of doubles.
- Allows use of hardware floating point on the Cortex-M4.
- Added "f" suffix to floating point literals.
- Call floating point versions of stdlib math functions.
2013-01-16 13:52:01 +11:00
Randy Mackay ccaa7a52ef Copter: RTL bug fix to initial step is always a climb and not a descent
Also bug fix to hold yaw on take-off
2013-01-15 12:17:52 +09:00
Randy Mackay 76f032160c Copter: relax altitude check in verify_takeoff
Previously we checked if the alt > target_alt but because there is
little to no overshoot with the new accel based alt controller this
check was failing for some users.
2013-01-14 13:34:06 +09:00
Randy Mackay c447b4b79b ArduCopter: move setting of land's yaw mode to the do_land function 2013-01-13 20:01:06 +11:00
rmackay9 68b62abd38 ArduCopter with the new Camera and Relay classes for APM1 and APM2.
All changes by Sandro Benigno
2013-01-02 09:55:37 +11:00
rmackay9 e77b54c7dc ArduCopter: bug fix to GUIDED mode. Now checks that desired altitude was reached before deciding the waypoint is complete. 2013-01-02 09:24:31 +11:00
rmackay9 d3cbf733ba ArduCopter: ensure RTL performs a land if a failsafe has been triggered 2013-01-02 09:19:39 +11:00
rmackay9 1b5ff6aac6 ArduCopter: restore initial climb to RTL 2013-01-02 09:19:17 +11:00
rmackay9 d8e3d5c10c ArduCopter: allow RTL's yaw mode to be overridden with a #define in APM_Config.h 2013-01-02 09:12:40 +11:00
rmackay9 ddc578fd18 ArduCopter: restore YAW to default AUTO_YAW mode instead of YAW_LOOK_AT_NEXT_WP mode 2013-01-02 09:12:17 +11:00
Pat Hickey 7af03127f6 ArduCopter: more work 2012-12-20 14:52:28 +11:00
rmackay9 d31efebd44 ArduCopter: rename throttle failsafe parameters.
Switch to LAND flight mode if throttle failsafe triggers and we do not have a GPS.
THR_FAILSAFE renamed to FS_THR_ENABLE.
THR_FS_VALUE renamed to FS_THR_VALUE.
THR_FS_ACTION removed (action is now controlled by setting FS_THR parameter).
2012-12-10 23:38:43 +09:00
rmackay9 f522ef078e ArduCopter: remove unused functions do_target_yaw, do_loiter_at_location, get_altitude_error and clear_new_altitude 2012-12-10 17:30:50 +09:00
rmackay9 56ceb230cb ArduCopter: add YAW_OVR_BEHAVE to allow control of when autopilot takes back control of yaw after pilot overrides it during a mission 2012-12-09 18:04:31 +09:00
rmackay9 9a05d3bd36 ArduCopter: add comments at the top of many navigation functions 2012-12-09 15:50:50 +09:00
rmackay9 9dd978576b ArduCopter: auto yaw changes to allow pilot override of yaw during missions
Added set_yaw_mode to better control of yaw controller changes and variable initialisation.
Replaced AUTO_YAW mode with separate yaw controllers YAW_LOOK_AT_NEXT_WP, YAW_LOOK_AT_LOCATION, YAW_LOOK_AT_HEADING.
Pilot manual override of yaw causes yaw to change to YAW_HOLD (i.e. manual yaw) until next waypoint is reached.
Added get_yaw_slew function to control how quickly autopilot turns copter
Changed YAW_LOOK_AHEAD to use GPS heading and moved to new get_look_ahead_yaw function in Attitude.pde
Renamed variables: target_bearing->wp_bearing, original_target_bearing->original_wp_bearing.
Removed auto_yaw_tracking and auto_yaw variables and update_auto_yaw function as they are no longer needed.
Simplified MAV_CMD_CONDITION_YAW handling (do_yaw).  We lose ability to control direction of turn and ability to do long panorama shots but it now works between waypoints and save 20bytes.
2012-12-08 14:23:32 +09:00
rmackay9 cca9f9dbce ArduCopter: do_set_servo fix to resolve -1 being assigned to uint8_t 2012-12-07 12:58:44 +09:00
rmackay9 3a90fc77f9 ArduCopter: add dataflash logging of camera events 2012-12-07 00:57:08 +09:00
rmackay9 d74cf54b5d ArduCopter: allow triggering of camera from a mission 2012-12-06 23:48:30 +09:00
rmackay9 d3de77f74c ArduCopter: fix do_set_servo so that it works again 2012-12-06 20:18:33 +09:00
rmackay9 75401756f2 ArduCopter: maintain loiter control even below 1m while landing 2012-12-06 12:40:53 +09:00
rmackay9 a5bb54e36e ArduCopter: RTL clean-up and slightly improved landing sensor
Consolidated RTL state to be captured by rtl_state variable.
Combined update_RTL_Nav and verify_RTL functions which performed the same function but one was for missions, the other for the RTL flight mode.
Renamed some RTL parameters and global variables to have RTL at the front.
Landing detector now checks accel-throttle's I term and/or a very low throttle value
2012-12-06 10:31:52 +09:00
rmackay9 a94826f182 ArduCopter: add set_throttle_mode to better control initialisation of variables 2012-12-06 10:31:04 +09:00
rmackay9 3cbef57c64 ArduCopter: first merge of leonard's accel based altitude controller plus other changes from Randy
Changes include:
New low-level get_throttle_accel function takes target acceleration and compares vs earth-frame Z accelerometer values to produce output to motors.
Higher level throttle controllers modified to call new get_throttle_accel controller
Throttle_rate_stabilized controller added which maintains a desired climb/descent rate
Throttle_land controller added - descends using normal auto throttle controller to 10m then descends at 50cm/s
Multiple throttle modes added including landing mode
Land flight mode no longer needs GPS
Throttle cruise maintenance moved to update_throttle_cruise function
2012-12-06 10:30:49 +09:00
Andrew Tridgell bcae83c4f6 ACM: make it possible to run CLI on radio port in ArduCopter 2012-11-21 21:41:34 +11:00
Jason Short d2a5928c06 Ap state updates 2012-11-09 22:15:15 -08:00
Andrew Tridgell 406a5dc328 ACM: save another 20 bytes 2012-10-22 18:59:51 +11:00
Jason Short a0752dc7dc ACM Acceleration management
removed unused waypoint_radius var
removed slow_wp
updated speed management system to maintain a constant acceleration or deceleration of 1m/s
changed version to 2.8.1a
2012-10-21 14:32:39 -07:00
rmackay9 3c9ba94f42 ArduCopter: bug fix to ROI when no camera mount is specific 2012-10-08 12:31:10 +09:00
rmackay9 5d3ddf1fc9 ArduCopter: bug fix for ROI not working if user did not have a camera mount
Changed verify_nav_roi command to attempt to point at the target if our camera mount type is not pan_tilt nor pan_tilt_roll
2012-09-10 02:03:32 +09:00
uncrustify 6791da4ee7 uncrustify ArduCopter/commands_logic.pde 2012-08-21 19:19:50 -07:00
rmackay9 7a6732fb4b ArduCopter: removed unused icount variable from commands_logic.pde to reduce compiler warnings. 2012-08-18 16:04:23 +09:00
rmackay9 a72bf6ef57 ArduCopter: replaced abs with labs as required in a few places.
Also fixed a small bug in the get_stabilize_pitch function in which it was using the roll (instead of pitch) to decide whether it should let the i term build-up or not.
2012-08-16 17:51:09 +09:00
Jason Short 3ad08b7ffc ACM : Added larger WP radius for fast waypoints so we don't loose speed angling in on the WP at the last second. 2012-08-10 10:02:32 -07:00
Jason Short d796814dfc ACM : Commands Logic
Altitude cleanup
2012-08-09 16:59:43 -07:00
Andrew Tridgell fb26160d3b ACM: change to use get_bearing_cd() instead of get_bearing() 2012-08-08 12:12:30 +10:00
rmackay9 f79b90725e ArduCopter: Dan Gray's fix for Condition_Yaw
command_yaw_dir is an unsigned byte but was being set to a -ve number leading to very incorrect yaw target heading for counter clockwise turns.
command_yaw_end (i.e. turn's end target) was not being set if turn was of type "relative"
2012-08-07 06:43:10 -07:00
rmackay9 8e5312a759 ArduCopter: add support for MAVLink's MAV_CMD_NAV_ROI command
do_nav_roi and verify_nav_roi functions added to turn the copter and/or mount in response to a MAV_CMD_NAV_ROI way point
2012-07-25 11:02:54 +09:00
Jason Short 3a62608355 Arducopter: Added Slow_WP setting to regular wp navigation 2012-07-19 09:48:54 -07:00