Commit Graph

55 Commits

Author SHA1 Message Date
Randy Mackay c1433e0220 Copter: minor comment and formatting fixes
no functional change
2017-07-12 13:27:45 +09:00
Randy Mackay ed65d55f5e Copter: guided stops rotating if no updates received for 3 seconds 2017-07-12 13:27:45 +09:00
Randy Mackay 2b98fd765d Copter: guided_set_destination accepts relative yaw 2017-07-12 13:27:45 +09:00
Randy Mackay 9b05f1d9c7 Copter: add auto-yaw-rate and replace guided_angle_state.use_yaw_rate
We use the auto_yaw_mode in auto and guided modes to allow various yaw behaviours
This commit adds a new AUTO_YAW_RATE control to the mode and uses it within guided mode.
This new RATE control is not currently used within auto mode because there is no way (yet) for a mission command to specify a desired rate.
2017-07-12 13:27:45 +09:00
kouseii 4dd7d9eaff Copter: guided mode supports heading and yaw-rate target 2017-07-12 13:27:45 +09:00
Randy Mackay 81f8ab3933 Copter: guided init uses vertical stopping point 2017-04-27 14:36:23 +09:00
Randy Mackay a342b73604 Copter: guided velocity contoller inits accel and jerk
In practice this has no functional impact because the guided_pos_control_start initialises these values (using AC_WPNav) and it is not currently possible for a user to get to the velocity controller without having first used the guided position controller
2017-04-27 14:35:46 +09:00
Clément 3aa17d17eb Copter : set land_complete to false during guided takeoff (same fix as for auto takeoff bug) 2017-02-07 20:19:17 +09:00
Randy Mackay 62a4867cd4 Copter: use avoidance adjusted climb rate in all modes 2017-01-18 09:35:47 +09:00
Andrew Tridgell 0f6d0c5ba9 Copter: combined tri, single, coax and multicopter into a single build
this allows copter to be just 2 builds, one for heli, and one for
everything else
2017-01-12 17:39:37 +11:00
Peter Barker a233024e05 Copter: fix compilation when fence andd proximity are disabled
This adds AC_AVOID_ENABLED; avoidance must be disabled if either
of fence or proximity are disabled.

Parameter definitions have been reordered to avoid compiler warnings;
this make sthe numbering non-linear
2017-01-03 10:44:03 +09:00
Mathieu OTHACEHE 152edf7189 Global: remove mode line from headers
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02:00
Randy Mackay 5894a54a16 Copter: althold uses current alt target if active
Previously we always reset the altitude target to the current altitude but this causes a jump if the vehicle is already in an alt-hold flight mode but has an altitude error
2016-10-15 11:29:10 +09:00
Andrew Tridgell 89c10a2db9 Copter: rename WP_TKOFF_NAV_ALT to WP_NAVALT_MIN
this is in preparation for using the same parameter for landing as
well
2016-08-16 11:26:56 +10:00
Randy Mackay 0ed5665193 Copter: change parameter order of guided_set_angle
I thought it might be slightly better to put the optional parameters at the end
No functional change
2016-08-10 10:03:54 +09:00
Allan Matthew 6dd4e1a2aa Copter: accept yaw rate commands in Guided atttude controller 2016-08-10 10:03:37 +09:00
Randy Mackay 40db19549e Copter: allow taking off in Guided mode's attitude control sub mode 2016-08-02 18:26:05 +09:00
mirkix e3934fac80 ArduCopter: Delete (wrong) filename out of header 2016-07-25 17:13:41 -03:00
Randy Mackay 49674abb21 Copter: guided mode's velocity controller stops before fence 2016-07-25 20:24:37 +09:00
Randy Mackay 7a6e0a981b Copter: simplify guided mode's velocity controller's accel limit calcs 2016-07-25 20:24:37 +09:00
Randy Mackay dc52f3b2df Copter: guided mode applies acceleration limits to velocity controller 2016-07-25 20:24:37 +09:00
Randy Mackay 866487608e Copter: rename guided mode's posvel controller target variables
We will re-use these targets for the guided velocity controller
2016-07-25 20:24:37 +09:00
Andrew Tridgell 3a8ed06267 Copter: added TKOFF_NAV_ALT parameter
this adds TKOFF_NAV_ALT which controls the altitude above takeoff that
navigation can begin. It is meant for unstable vehicles such as helis
to prevent blade strike during initial takeoff.

This also adds a new parameter class ParametersG2 which can hold 64
parameters. This is to avoid running out of parameters in the first
256 block
2016-07-07 14:21:47 +09:00
Randy Mackay 2647bed484 Copter: guided mode uses modified check_destination_within_fence 2016-07-04 18:25:03 +09:00
Leonard Hall 7d54c268f6 Copter: consolidate input_euler_angle calls to use smoothing gain
Previously we had _smooth and non-smooth methods in the attitude
controller but as part of the move to quaternions these have been replaced
by a single call which always takes a smoothing gain
2016-06-24 17:17:17 +09:00
Leonard Hall 75c4367cfc Copter: Change fabs to fabsf 2016-06-24 15:03:14 +09:00
Randy Mackay e0bf08abe0 Copter: fixes to guided mode target check is within fence
guided altitude targets are converted to alt-above-home
remove unnecessary fence_status local variable from guided_set_destination methods
log failures to set guided target under a new failure code: ERROR_CODE_DEST_OUTSIDE_FENCE (5)
rename pv_get_home_destination_distance_mc to pv_distance_to_home_cm
2016-05-21 09:56:12 +09:00
Saloni Jain bc22419286 Copter : Modified set_guided_destination() to reject requests for guided waypoints outside the fence. 2016-05-21 09:56:12 +09:00
dgrat 41661f815f AP_Math: Replace the pythagorous* functions with a variadic template
The new function can deal with a variable number of function parameters.
Additionally, I renamed the functions to norm(), because this is the
standard name used in several other projects.
2016-05-10 11:41:26 -03:00
dgrat 76362caee0 AP_Math: Replace wrap_* functions with template versions 2016-05-10 11:41:26 -03:00
skyscraper 6f200fa923 ArduCopter: Fix up after refactoring RC_Channel class
Further to refactor of RC_Channel class which included
adding get_xx set_xx methods, change reads and writes to the public members
to calls to  get and set functionsss

old public member(int16_t)   get function -> int16_t     set function (int16_t)
(expression where c is an object of type RC_Channel)
c.radio_in                     c.get_radio_in()           c.set_radio_in(v)
c.control_in                   c.get_control_in()         c.set_control_in(v)
c.servo_out                    c.get_servo_out()          c.set_servo_out(v)
c.pwm_out                      c.get_pwm_out()            // use existing
c.radio_out                    c.get_radio_out()          c.set_radio_out(v)
c.radio_max                    c.get_radio_max()          c.set_radio_max(v)
c.radio_min                    c.get_radio_min()          c.set_radio_min(v)
c.radio_trim                   c.get_radio_trim()         c.set_radio_trim(v);

c.min_max_configured() // return true if min and max are configured

Because data members of RC_Channels are now private and so cannot be written directly
 some overloads are provided in the Plane classes to provide the old functionality

new overload Plane::stick_mix_channel(RC_Channel *channel)
which forwards to the previously existing
void stick_mix_channel(RC_Channel *channel, int16_t &servo_out);

new overload Plane::channel_output_mixer(Rc_Channel* , RC_Channel*)const
which forwards to
(uint8_t mixing_type, int16_t & chan1, int16_t & chan2)const;

Rename functions

 RC_Channel_aux::set_radio_trim(Aux_servo_function_t function)
    to RC_Channel_aux::set_trim_to_radio_in_for(Aux_servo_function_t function)

 RC_Channel_aux::set_servo_out(Aux_servo_function_t function, int16_t value)
    to RC_Channel_aux::set_servo_out_for(Aux_servo_function_t function, int16_t value)

 Rationale:

        RC_Channel is a complicated class, which combines
        several functionalities dealing with stick inputs
        in pwm and logical units, logical and actual actuator
        outputs, unit conversion etc, etc
        The intent of this PR is to clarify existing use of
        the class. At the basic level it should now be possible
        to grep all places where private variable is set by
        searching for the set_xx function.

        (The wider purpose is to provide a more generic and
        logically simpler method of output mixing. This is a small step)
2016-05-10 16:21:16 +10:00
Randy Mackay fac7b7c566 Copter: rename set_alt to set_alt_cm in control_guided 2016-04-30 10:33:01 +09:00
Randy Mackay cac79f297e Copter: guided can trigger terrain failsafe 2016-04-30 10:33:01 +09:00
Randy Mackay 267c1c3934 Copter: guided mode handles terrain alt 2016-04-30 10:33:01 +09:00
Randy Mackay 94b35d659e Copter: guided uses AP_Motors set_desired_spool_state 2016-04-01 11:59:30 +09:00
Leonard Hall 42f5de44d4 Copter: guided sets desired spool state 2016-04-01 11:59:30 +09:00
Randy Mackay 89c147184f Copter: log guided mode targets 2016-01-12 18:04:59 +09:00
Jonathan Challinger dfab21171b Copter: call renamed functions in AC_AttitudeControl 2015-12-09 19:58:37 +09:00
Jonathan Challinger 9d8b0f3d58 Copter: call renamed functions in AC_AttitudeControl 2015-12-09 19:58:30 +09:00
Lucas De Marchi 2591261af6 Global: rename min and max macros to uppercase
The problem with using min() and max() is that they conflict with some
C++ headers. Name the macros in uppercase instead. We may go case by
case later converting them to be typesafe.

Changes generated with:

	git ls-files '*.cpp' '*.h' -z | xargs -0 sed -i 's/\([^_[:alnum:]]\)max(/\1MAX(/g'
	git ls-files '*.cpp' '*.h' -z | xargs -0 sed -i 's/\([^_[:alnum:]]\)min(/\1MIN(/g'
2015-12-01 16:28:09 -02:00
Caio Marcelo de Oliveira Filho c7acc46d09 Copter: use millis/micros/panic functions 2015-11-20 12:26:31 +09:00
Randy Mackay b2b8dcb8ff Copter: guided calls velocity controller at 400hz
velocity controller internally updates xy-axis at 50hz, z-axis at 400hz
2015-11-18 13:31:22 +09:00
Randy Mackay 606a0e0d0b Copter: set jerk to default for circle and guided 2015-10-29 12:10:49 +09:00
Leonard Hall 411e75b917 Copter: feed forward only used for AltHold, Loiter, PosHold
land modes use non-feedforward alt hold
2015-10-28 20:21:54 +09:00
Randy Mackay 1858a0544f Copter: guided takeoff checks auto-armed status
This resolves an edge case in which the vehicle could takeoff with auto-armed false
2015-10-20 15:51:55 +09:00
Randy Mackay a142688fea Copter: guided attitude timeout to 1sec
Also add set-attitude-target capabilities flag
Thanks to Fredia and Sebastian for noticing these issues!
2015-10-10 22:04:48 +09:00
Randy Mackay e20038a453 Copter: support SET_ATTITUDE_TARGET in guided mode 2015-10-09 12:15:38 +09:00
Randy Mackay 0eaf815411 Copter: guided mode vel controller integrates althold lean limit
Note it does not yet actually limit the lean angles based on throttle
2015-09-07 15:10:13 +09:00
TShapinsky 5dfd1ff8d6 Copter: add velocity control timeout in guided mode 2015-08-13 02:07:00 +09:00
Randy Mackay 59d5a4fad8 Copter: landing with guided velocity controller 2015-08-11 16:41:05 -07:00