Commit Graph

4532 Commits

Author SHA1 Message Date
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 4980c8bc94 ArduCopter: RC_Channel refactor
More fixing up of RC_Channel change direct access to data members
to access via member functions.
2016-05-10 16:21:16 +10:00
skyscraper 49d3410896 ArduCopter: fixup RC_Channel data member accesses to function calls 2016-05-10 16:21:16 +10: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
Andrew Tridgell 3c9b063eb1 Copter: removed unnecessary libs
now in common
2016-05-10 14:13:35 +10:00
Andrew Tridgell 111eb2ccc1 Copter: use DataFlash::log_while_disarmed() 2016-05-09 12:05:52 +10:00
Leandro Pereira f23bd7e09d GCS_MAVLink: Use a single stream_trigger() implementation
This has no side effects, but since all implementations were basically
the same, move the implementation to GCS_Common and the only part that
adjusts the rate based on which which stream to each individual
GCS_MAVLINK implementation.
2016-05-07 23:49:35 -03:00
Andrew Tridgell 874fae931f Copter: fix for changed API 2016-05-07 18:27:22 +10:00
Andrew Tridgell 9da3b8db60 Copter: only log baro, gps and mag if ekf not logging them 2016-05-07 18:27:19 +10:00
Andrew Tridgell b235304235 Copter: reduce IMU logging to 25Hz
leave more room for IMT logging needed for Replay
2016-05-07 18:27:17 +10:00
Randy Mackay a5c55c3fbd Copter: fix get_non_takeoff_throttle
The throttle_mid parameter (for historic reason) is interpreted as a value that includes throttle_min.  This means we must subtract the throttle_min value from it when converting it to a throttle in the 0 to 1 range.
2016-05-07 12:21:41 +09:00
Randy Mackay 2eb0484142 Copter: rename Loiter states and swap order within select statement 2016-05-07 10:08:34 +09:00
Randy Mackay 1c4db779a1 Copter: Loiter stabilizes roll and pitch while landed 2016-05-07 10:08:32 +09:00
Randy Mackay 9c12b64ba5 Copter: rename AltHold states and swap order within select statement
No functional change
2016-05-07 10:08:30 +09:00
Randy Mackay 932cd907d4 Copter: AltHold stabilizes roll and pitch while landed 2016-05-07 10:08:28 +09:00
Randy Mackay 3ead74c4be Copter: remove zero-throttle check from AltHold takeoff state
Hard to imagine a reason why we would want to turn off stabilization during takeoff
2016-05-07 10:08:26 +09:00
Lucas De Marchi fea084a596 Global: use ap_version.h
This header is used by waf to contain the generated version macros,
particularly using the git hash. For waf it's better to be in a separate
header since it then can keep track of changes on it a trigger
recompilation.

For the make build system, a dummy ap_version.h file has been added in
the missing/ folder so both implementations can co-exist.
2016-05-06 13:11:28 -03:00
Lucas De Marchi 352e103f1a ArduCopter: 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
Allan Matthew d6012c535e Copter: remove unused dt passed to precland 2016-05-06 11:04:45 +09:00
skyscraper 6bcd9e6f65 Copter::pre_arm_rc_checks: fix logic checking that throttle min and max are configured 2016-05-06 10:56:38 +09:00
Allan Matthew 7960e3bb8f Copter: pass DISTANCE_SENSOR messages to rangefinders
This allows the MAVLink range finder driver to intercept distance measurements
2016-05-04 12:10:58 +09:00
Michael du Breuil e7974702d4 Copter: Ignore POSITION_TARGET_GLOBAL_INT 2016-05-01 07:38:24 +10:00
Michael Oborne 5848d8a5e6 ArduCopter: support MAVLINK_MSG_ID_MISSION_ITEM_INT 2016-05-01 07:13:46 +10:00
Andrew Tridgell 54d1cc7e50 Copter: only save offsets for Compass::LEARN_EKF
this means by default that one flight one affect the next one, which
makes it more robust in case of a bad flight
2016-04-30 16:43:14 +10:00
Michael du Breuil c97888f524 Copter: Remove support for CONDITION_CHANGE_ALT 2016-04-30 10:56:07 +09:00
Randy Mackay d455e2a33f Copter: fix auto-circle comment 2016-04-30 10:33:01 +09:00
Randy Mackay a6b6fb2473 Copter: fix TERRAIN_FOLLOW parameter description
Thanks OXINARF
2016-04-30 10:33:01 +09:00
Randy Mackay 3d31c3b936 Copter: log error if circle does not initialise correctly 2016-04-30 10:33:01 +09:00
Randy Mackay caf6bbc2e0 Copter: rename set_alt to set_alt_cm in control_rtl 2016-04-30 10:33:01 +09: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 f8f6c135e9 Copter: rename set_alt to set_alt_cm in control_auto 2016-04-30 10:33:01 +09:00
Randy Mackay d92154a44e Copter: rename set_alt to set_alt_cm in commands_logic 2016-04-30 10:33:01 +09:00
Randy Mackay cd97aa97a3 Copter: provide terrain reference to AC_WPNav 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 9100cf605a Copter: auto can trigger terrain failsafe 2016-04-30 10:33:01 +09:00
Randy Mackay 43d14defd4 Copter: RTL handles terrain data failure 2016-04-30 10:33:01 +09:00
Randy Mackay 47658fe964 Copter: add terrain failsafe 2016-04-30 10:33:01 +09:00
Randy Mackay 8e43be1511 Copter: fixes to allow compiling without terrain support 2016-04-30 10:33:01 +09:00
Randy Mackay 74e02d2c82 Copter: rename TERRAIN_USE to TERRAIN_FOLLOW
This matches plane's parameter name
2016-04-30 10:33:01 +09:00
Randy Mackay 13c26eab67 Copter: update current_loc at 400hz 2016-04-30 10:33:01 +09:00
Randy Mackay f45c69e7ad Copter: log terrain altitude in CTUN message 2016-04-30 10:33:01 +09:00
Randy Mackay 25c676c3b4 Copter: report terrain capability to GCS 2016-04-30 10:33:01 +09:00
Randy Mackay ddffbe27aa Copter: add terrain pre-arm check 2016-04-30 10:33:01 +09:00
Randy Mackay 91f6c7b503 Copter: add TERRAIN_USE parameter
Also add terrain.cpp to hold terrain_update and terrain_logging functions
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 e8b14e59fc Copter: spline mission commands handle terrain altitudes 2016-04-30 10:33:01 +09:00
Randy Mackay 81d244c9bd Copter: do-circle accept terrain altitude 2016-04-30 10:33:01 +09:00
Randy Mackay 70630e9774 Copter: auto loiter handles terrain 2016-04-30 10:33:01 +09:00
Randy Mackay 4892446c55 Copter: do-loiter accepts terrain altitudes 2016-04-30 10:33:01 +09:00