Commit Graph

19229 Commits

Author SHA1 Message Date
Grant Morphett 7edf8c0e0a RC_Channel: New method to detect if channel is in trim location
This is a new method which will return true if an RC_Channel has a PWM
value that is at its TRIM value plus or minus the allowed dead zone
around the TRIM.
2015-11-11 13:39:38 +11:00
Grant Morphett 2d1745ab6a Rover: Implemented the HOME state update from Plane 2015-11-11 13:39:38 +11:00
Lucas De Marchi 1d51e60571 AP_HAL_Linux: move Util instantiation
The util object may be used by all other objects so we need to
instantiate it as earlier as possible.
2015-11-11 08:02:41 +11:00
Paul Riseborough ca31ced2b4 AP_NavEKF2: Fix bug preventing use of optical flow with multiple IMU's 2015-11-10 18:17:16 +11:00
José Roberto de Souza 01766e7069 AP_HAL_Linux: RCOutput: Add LinuxRCOutput_Sysfs
This RCOutput works over Linux PWM sysfs interface.
2015-11-10 17:05:34 +11:00
Lucas De Marchi 392879112e AP_HAL_Linux: document functions to write file
Document function and add attributes to mark then as printf- and
scanf-like functions.
2015-11-10 17:05:34 +11:00
Lucas De Marchi 821814007e AP_Common: add scanf format macro
Add a macro to annotate functions that act like scanf.  Calling the
printf format macro as FORMAT was bad as can be seen now. Later we need
to rename it to FMT_PRINTF.
2015-11-10 17:05:34 +11:00
Lucas De Marchi c66c61180a AP_HAL_Linux: rework PWM_Sysfs
This include some minor changes on all methods of PWM_Sysfs:

  - Sort headers
  - Add code inside Linux namespace rather than just use the namespace
  - Declare a union pwm_params, that's only used to calculate at compile
    time the maximum stack space we need in our methods: this is a bit
    safer for future extensions
  - Standardize error messages to include the useful params first and
    then the error message
  - Remove log message from hot path
  - Don't abuse macros for checking error - convert the SNPRINTF_CHECK
    macro into proper code, ignoring errors for not enough space since
    they can't happen
  - Fix call to read_file() passing uint8_t for "%u" in get_period()
  - Fix passing char** instead of char* to write_file() in set_polarity()
  - Use strncmp() instead of strncasecmp() since the kernel API uses
    lowercase.
  - Add comments on the 2 main methods of this class
2015-11-10 17:05:34 +11:00
José Roberto de Souza 39bd5fa80e AP_HAL_Linux: Add PWM_Sysfs
This class makes easy to use Linux PWM sysfs interface, available since
Linux 3.10.

More information https://www.kernel.org/doc/Documentation/pwm.txt
2015-11-10 17:05:34 +11:00
José Roberto de Souza d53911e3f6 AP_Math: Add functions to convert microseconds to/from nanoseconds 2015-11-10 17:05:34 +11:00
José Roberto de Souza ca533a9d94 AP_Math: Add functions to convert frequency to/from nanoseconds 2015-11-10 17:05:34 +11:00
Andrew Tridgell 3d8993ff33 build: added sitl-asan build target
this enables the address sanitiser for array bounds error detection
2015-11-10 16:21:41 +11:00
Paul Riseborough 577670ccee AP_NavEKF2: Reduce memory required by 6KB when running at 400Hz
Down-sample the IMU and output observer state data to 100Hz for storage in the buffer.
This reduces storage requirements for Copter by 75% or 6KB
It does not affect memory required by plane which already uses short buffers due to its 50Hz execution rate.
This means that the EKF filter operations operate at a maximum rate of 100Hz.
The output observer continues to operate at 400Hz and coning and sculling corrections are applied during the down-sampling so there is no loss of accuracy.
2015-11-10 15:51:18 +11:00
Siddharth Bharat Purohit 5e2382ea09 AP_GPS:UBLOX: send save cfg msg once per 5s and 5 times only 2015-11-10 15:16:55 +11:00
Siddharth Bharat Purohit 360c09f9bd AP_GPS_UBLOX: send cfg save msg only once every 1 second 2015-11-10 15:16:55 +11:00
Jonathan Challinger bc708f9808 AP_GPS: add SAVE_CFG parameter make ublox config saving optional 2015-11-10 15:16:55 +11:00
Jonathan Challinger e82df48631 AP_GPS: save configuration to non-volatile memory in UBlox GPS 2015-11-10 15:16:55 +11:00
lvale 89b593b1f4 APM_OBC: status text severity to INFO or ERROR 2015-11-10 13:11:38 +09:00
lvale b601ef2f9e AP_Arming: status text severity to INFO 2015-11-10 13:11:36 +09:00
lvale 9d88508cc3 GCS_MAVLink: handle_mission_item text severity to info 2015-11-10 13:11:34 +09:00
Jonathan Challinger 6784fd8625 AC_AttitudeControl: reserve parameter IDs 2015-11-10 12:56:52 +09:00
Lucas De Marchi 825d10c81a Filter: remove filter with double type
We are currently not using LowPassFilter2p<double> and it just generates
a lot of warnings on PX4 while instantiating it due to implicitly
promoting float to double:

libraries/Filter/LowPassFilter2p.cpp: In instantiation of
	'T DigitalBiquadFilter<T>::apply(const T&, const DigitalBiquadFilter<T>::biquad_params&) [with T = double]':
libraries/Filter/LowPassFilter2p.cpp:86:41:   required from 'T LowPassFilter2p<T>::apply(const T&) [with T = double]'
libraries/Filter/LowPassFilter2p.cpp:98:16:   required from here
libraries/Filter/LowPassFilter2p.cpp:20:82: warning: implicit conversion from 'float' to 'double' to match other
	operand of binary expression [-Wdouble-promotion]
     T delay_element_0 = sample - _delay_element_1 * params.a1 - _delay_element_2 * params.a2;
                                                                                  ^
2015-11-10 12:43:21 +09:00
Paul Riseborough e33aa7898a AP_NavEKF2: Prevent return of uninitialised variable 2015-11-09 22:30:38 +11:00
Paul Riseborough 3d8e74df26 AP_NavEKF2: Don't switch magnetometers when on the ground or just started
Large magnetometer innovations on the ground could be caused by factors that will disappear when flying, eg:

a) Bad initial gyro bias
b) External magnetic field disturbances (adjacent metal structures, placement of hatches with magnets, etc)

To avoid unnecessary switches, we inhibit switching until off-ground and when sufficient time has lapsed from power on to learn gyro bias offsets.
2015-11-09 22:07:10 +11:00
Paul Riseborough 3099d94e78 AP_NavEKF2: Retrieve correct time-stamp for active compass 2015-11-09 22:07:10 +11:00
Paul Riseborough 6698d4379d AP_Compass: Enable usec timestamps to be retrieved for specified instance 2015-11-09 22:07:10 +11:00
Paul Riseborough 42b47acdfc DataFlash: Fix logging error for EKF second instance 2015-11-09 22:07:10 +11:00
Paul Riseborough 5d2f78996a AP_NavEKF2: Remove un-used data in IMU buffer
Recovers 416 Bytes of memory per EKF2 instance for Copter
2015-11-09 22:07:10 +11:00
Paul Riseborough 88cc1e2ffe DataFlash: Publish the EKF2 magnetometer selection index 2015-11-09 22:07:10 +11:00
Paul Riseborough f00b1ff22d AP_NavEKF2: Publish the magnetometer selection index 2015-11-09 22:07:10 +11:00
Paul Riseborough 7294c8004b AP_NavEKF2: Enable use of backup magnetometers after a timeout
If the magnetometer fails innovation consistency checks for too long (currently 10 sec), then the next available sensor approved for yaw measurement will be used.
2015-11-09 22:07:09 +11:00
Paul Riseborough 6deabe28c2 AP_NavEKF2: Require all magnetometer axes to pass innovation test
The original design intent was to require all axes to pass because severe errors are rarely constrained to a single axis.
This was not achieved with the previous implementation.
These changes move the innovation consistency checks for all three axes to the top before any axes are fused.
Unnecessary performance timers have been removed.
2015-11-09 22:07:09 +11:00
Paul Riseborough afeadfca51 AP_NavEKF2: Don't attempt to compensate for external mag calibration
This was problematic to implement with magnetometer switching. It is likely that slow magnetometer learning can still be performed externally (eg plane) but this will need to be monitored to see if it causes issues.
2015-11-09 22:07:09 +11:00
Jonathan Challinger 6524222397 Copter: adapt auto disarm check to use a timer 2015-11-09 15:34:41 +09:00
Paul Riseborough e8305c5653 AP_NavEKF: Prevent front-end from returning uninitialised data (garbage) 2015-11-09 15:56:45 +11:00
Andrew Tridgell 840c9e65bb AP_Baro: don't notify the GCS of new pressure reference too often 2015-11-09 14:34:07 +11:00
Andrew Tridgell e873ff1e5f AP_Param: copter with vectors when sending parameters 2015-11-09 14:28:20 +11:00
Andrew Tridgell 3624162b18 PX4: added size of binaries to build
this will help us monitor the use of flash
2015-11-09 13:25:49 +11:00
lvale e18181e5c2 Plane: Uniformization of severities
Plane uniformization of severities
2015-11-09 09:38:25 +11:00
Peter Barker 1b13315092 AP_Baro: notify GCS of calibration 2015-11-09 09:23:20 +11:00
Peter Barker 5f9b1c5f4e AP_Param: provide facility to notify GCS of param set 2015-11-09 09:23:20 +11:00
Peter Barker 046b008889 AP_Param: send saved param values to all GCS 2015-11-09 09:23:20 +11:00
Peter Barker 368363531f GCS_MAVLink: provide facilities to send param values to all GCS 2015-11-09 09:23:20 +11:00
Tom Pittenger 5c3486d003 Plane: power-off rangefinder at high alt without terrain avail
- moved terrain alt rangefinder power-off trigger from trerrain thread to rangefinder thread
- allow rangefinder to power-off using baro if terrain data not available
2015-11-09 08:36:41 +11:00
Tom Pittenger 73c5234633 AP_Terrain: cache status
instead of computing the terrain status on-demand, assign it in update() and cache the result. Then external tasks that check the status won't be doing terrain intensive calculations in their thread. All the calculations needed for the status were being performed in update already so this is an optimization.
2015-11-09 08:36:41 +11:00
Lucas De Marchi 3d8211696c build: allow -j on top level makefile
By using $(MAKE) variable we allow to pass down to the called makefile
the number of jobs we want to compile with. The flags are communicated
to the next level via MAKEFLAGS variable.

Reference:
https://www.gnu.org/software/make/manual/html_node/Options_002fRecursion.html#Options_002fRecursion
2015-11-09 08:32:04 +11:00
Tom Pittenger 178bbb080b Plane: improve crosstrack error while navigating to loiter point
There is no crosstrack concept in the loiter navigation so when going from waypoint to loiter you will not converge onto the line between those two points. This commit adds crosstracking by performing normal waypoint navigation until you get near it.
2015-11-09 08:25:26 +11:00
Paul Riseborough f08a4af751 AP_NavEKF2: Remove redundant if statement
Thank you to OXINARF for picking up this one
2015-11-08 17:06:57 +11:00
Paul Riseborough 0f8cfa02ab AP_NavEKF: Remove redundant if statement
Thank you to OXINARF for picking up this one
2015-11-08 17:06:57 +11:00
Paul Riseborough 2243f95074 AP_NavEKF: Enable clean entry into GPS aiding whilst in-flight
Ensures that the latest GPS data is used to reset the states.
Separates the logic used to set the origin from the logic used to determine when to reset states and commence GPS aiding
2015-11-08 17:06:49 +11:00