Commit Graph

118 Commits

Author SHA1 Message Date
Tom Pittenger 034cd2413e Plane: re-calc landing glide slope to gracefully handle baro offset during long flights
New param: LAND_SLOPE_RCALC
@Description: This parameter is used when using a rangefinder during landing for altitude correction from baro drift (RNGFND_LANDING=1) and the altitude correction indicates your altitude is lower than the intended slope path. This value is the threshold of the correction to re-calculate the landing approach slope. Set to zero to keep the original slope all the way down and any detected baro drift will be corrected by pitching/throttling up to snap back to resume the original slope path. Otherwise, when a rangefinder altitude correction exceeds this threshold it will trigger a slope re-calculate to give a shallower slope. This also smoothes out the approach when flying over objects such as trees. Recommend a value of 2m.

default value is 2 (so, enabled by default)
2016-05-17 15:39:04 -07:00
Tom Pittenger 8a58f5a5eb Plane: convert airspeed_error_cmd to airspeed_error (in meters) 2016-05-13 17:21:59 -07:00
Andrew Tridgell 2a0476483b Plane: make takeoff less noisy with zero timeout 2016-05-14 08:26:10 +10:00
Andrew Tridgell 574ba71ef3 Plane: update for AP_TECS API change 2016-05-14 08:26:10 +10:00
Andrew Tridgell 12e0012b16 Plane: allow for NAV_LOITER_UNLIM and NAV_LOITER_TIME in quadplane 2016-05-11 15:57:41 +10:00
Andrew Tridgell 3fc43b94f9 Plane: separate out auto and guided VTOL states
this prevents a switch to AUTO from using VTOL mode incorrectly
2016-05-11 15:14:43 +10:00
Andrew Tridgell 691d4b6ca7 Plane: added local reached_loiter_target()
this distinguishes between VTOL and fixed wing loiter targets
2016-05-11 05:55:26 +10:00
Andrew Tridgell eab42c5740 Plane: fixed attitude logging with fast logging off 2016-05-11 05:55:24 +10:00
skyscraper 7f29903287 ArduPlane: 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
Andrew Tridgell db5f50e08e Plane: convert tuning to use AP_Tuning library 2016-05-07 18:34:15 +10:00
Lucas De Marchi baa287e5e5 ArduPlane: use separate header for version macro
Having the version macro in the config.h and consequently in the main
vehicle header means that whenever the version changes we need to
compiler the whole vehicle again. This would not be so bad if we weren't
also appending the git hash in the version. In this case, whenever we
commit to the repository we would need to recompile everything.

Move to a separate header that is include only by its users. Then
instead of compiling everything we will compile just a few files.
2016-05-06 13:11:28 -03:00
Rimvydas Naktinis 9fdf39baf0 Plane: Added a method that returns current altitude relative to terrain, if available, or home otherwise. 2016-05-05 09:02:20 -07:00
Michael du Breuil 0fcfcdc169 Plane: Broadcast POSITION_TARGET_GLOBAL_INT as part of the EXTENDED_STATUS stream 2016-05-01 07:38:23 +10:00
Andrew Tridgell a99616bd10 Plane: prepare for 3.6.0beta1 release 2016-04-30 14:34:47 +10:00
Andrew Tridgell 4666b25258 Plane: initial implementation of QRTL for quadplane RTL 2016-04-30 14:34:47 +10:00
Michael du Breuil de1e299754 Plane: Remove support for CONDITION_CHANGE_ALT 2016-04-30 10:56:05 +09:00
Michael du Breuil 731c68f273 Plane: Change mode to RTL on end of mission rather then staying in auto
Deleted commands_process as it had 2 lines of useful code left, and was cleaner to move the remaining two lines into the caller case
2016-04-29 13:12:18 +10:00
James Stoyell 4e7e84fc99 Plane: Modified last_valid_rc_ms AFS failsafe input to work when standard failsafe is on
Ran into a bug on our physical plane where failsafe.last_valid_rc_ms was not recognizing that the transmitter had failed. This is likely due to how the standard failsafe works in receiving lower-than-possible throttle values. So in order to account for this, I added a new variable to the failsafe, AFS_last_valid_rc_ms, and I update it only if the ch3_failsafe (the throttle failsafe) is not on. If the throttle failsafe is on, that means that the plane has indeed lost transmitter input, so the AFS needs to recognize that.
2016-04-22 11:48:36 -07:00
Tom Pittenger 2ba9a04bf5 Plane: smooth-out the end of takeoff pitch by reducing takeoff pitch min via TKOFF_PLIM_SEC
@Description: This parameter reduces the pitch minimum limit of an auto-takeoff just a few seconds before it reaches the target altitude. This reduces overshoot by allowing the flight controller to start leveling off a few seconds before reaching the target height. When set to zero, the mission pitch min is enforced all the way to and through the target altitude, otherwise the pitch min slowly reduces to zero in the final segment. This is the pitch_min, not the demand. The flight controller should still be commanding to gain altitude to finish the takeoff but with this param it is not forcing it higher than it wants to be. (+1 squashed commits)
2016-04-21 22:54:17 -07:00
Andrew Tridgell cf7b6123a9 Plane: log the number of lost log messages 2016-04-21 16:45:02 +10:00
Andrew Tridgell 8683616d8c Plane: redo scheduler table and improve perf logging
The scheduler table was still setup for a worst case CPU of
AVR2560. Adjust times for the stm32 and improve perf logging
2016-04-21 16:45:02 +10:00
Andrew Tridgell a7006a7784 Plane: refactor perf variables into a structure 2016-04-21 16:45:02 +10:00
Andrew Tridgell 27fb35253c Plane: added in-flight transmitter tuning 2016-04-16 20:26:43 +10:00
Tom Pittenger 436062ef37 Plane: improved crash detection
- fixes bug where a bungee launch is configured but the aircraft gets bumped and triggers the prop to spin up. This will now detect that and "crash' and disable the motor
2016-04-14 22:34:46 -07:00
Ricardo de Almeida Gonzaga 5bd034a5a8 Global: start using cmath instead of math.h 2016-04-05 21:06:19 -07:00
Andrew Tridgell dc9d87fde3 Plane: prepare for 3.5.2 release 2016-03-26 14:52:17 +11:00
Andrew Tridgell 0442c2c659 Plane: prepare for 3.5.1 release 2016-03-21 09:44:52 +11:00
Lucas De Marchi e01d49ff53 ArduPlane: replace header guard with pragma once 2016-03-16 18:40:45 +11:00
Michael du Breuil 0117522998 Plane: Use arming voltage 2016-03-14 09:06:58 -07:00
Andrew Tridgell f4ccf94dfc Plane: added QLAND mode
for VTOL landing. Use for failsafe as well
2016-03-09 18:20:41 +11:00
Tom Pittenger ed6aa4ed17 Plane: added throttle limiting via max power (current*voltage) 2016-03-02 10:20:44 -08:00
Tom Pittenger be3941efdf Plane: unify loiter mission items to require heading to next wp
- except loiter_unlimited because it never exits
2016-03-02 08:48:25 -08:00
Tom Pittenger 6399d00950 Plane: convert to using static send_statustext
- no more MSG_STATUSTEXT
- TODO: replace calls to gcs_send_text and gcs_send_text_fmt to GCS_MAVLINK::send_statustext()
2016-02-24 09:18:06 +11:00
Tom Pittenger 2e92089ce6 Plane: Reverse Thrust
Reverse thrust for controlled landings, even with much steeper approach slopes. This is achieved by allowing throttle demand to go negative to maintain a target airspeed. A Pre-Flare stage was added, triggered by an altitude, to allow for a slower airspeed just before land. That lower airspeed can be near stall.
new params LAND_PF_ALT, LAND_PF_SEC, LAND_PF_ARSPD, USE_REV_THRUST
2016-02-09 14:18:02 +11:00
Tom Pittenger 1cb094f12e Plane: make throttle signed (pos and neg) 2016-02-09 14:18:02 +11:00
Tom Pittenger 9157f634eb Plane: Add Tom Pittenger to authors list 2016-02-02 10:50:12 +09:00
Andrew Tridgell 379ca5ac00 Plane: prepare for 3.5.0 release 2016-01-30 13:04:51 +11:00
Andrew Tridgell 99847da297 Plane: release 3.5.0beta2 2016-01-29 12:21:39 +11:00
Michael du Breuil bcc939930c Plane: Only resend the mixer configuration if its changed 2016-01-29 12:20:14 +11:00
Andrew Tridgell d82c8dcd6d ArduPlane: update for changed AP_Camera API 2016-01-29 09:19:44 +11:00
Dario Lindo Andres 9bba55f937 ArduPlane: Added precise camera trigger logging
Added update_trigger and check_digital_pin functions
added camera trigger precise time mark
detect camera feedback pin status
added support for simple digital pin
included support for digital pin. Already included in
added support for TRIGGER MSG
2016-01-29 09:19:43 +11:00
Andrew Tridgell 23eef91c59 Plane: added parameter RTL_RADIUS
this allows the loiter radius for RTL to be controlled separately from
the radius for loiter (as requested by a user)
2016-01-19 15:04:30 +11:00
Andrew Tridgell ebe1fe0b17 Plane: raise version to 3.5.0beta1 2016-01-09 13:33:27 +11:00
Andrew Tridgell 70018ee0cb Plane: fixed final descent for VTOL auto landing 2016-01-09 07:38:54 +11:00
Andrew Tridgell f068a8c913 Plane: added support for VTOL_TAKEOFF and VTOL_LAND commands 2016-01-09 07:38:53 +11:00
Andrew Tridgell 0d6b353bcb Plane: added quad assistance and auto support for quadplane 2016-01-09 07:38:52 +11:00
Andrew Tridgell 6468fc6d93 Plane: Initial implementation of quadplane
adds "HOVER" mode
2016-01-09 07:38:52 +11:00
Tom Pittenger 7cde90553d Plane: new param CRASH_ACC_THRESH
@Description: X-Axis deceleration threshold to notify the crash detector that there was a possible impact which helps disarm the motor quickly after a crash. This value should be much higher than normal negative x-axis forces during normal flight, check flight log files to determine the average IMU.x values for your aircraft and motor type. Higher value means less sensative (triggers on higher impact). For electric planes that don't vibrate much during fight a value of 25 is good (that's about 2.5G). For petrol/nitro planes you'll want a higher value. Set to 0 to disable the collision detector.
2016-01-02 09:58:32 +11:00
Tom Pittenger 21205f8b41 Plane: improved crash detection logic and agility
- inhibit crash detection warnings when disabled by param so now it can be completely disabled
- reset is_crashed when disabled by param
- fixed pre-takeoff detection bug by adding in_preLaunch_flight_stage() where we are actually in FLIGHT_NORMAL instead of FLIGHT_TAKEOFF during setup of bungee launches. This now detects if we're in that state
- simplified the use of been_auto_flying to check across all flight stages. before it was excluded to handle hand-launches which can now be detected with in_preLaunch_flight_stage()
- added impact detector timer to clamp is_flying a few seconds after an impact
- logging new impact detector as "STAT.Hit"
2016-01-02 09:58:31 +11:00
Tom Pittenger 3b06260358 Plane: refactored interface
- added guided mode handling
- now handles gracefully a manual mode changes during evasion
2015-12-31 15:36:49 +11:00